Skip to content

Instantly share code, notes, and snippets.

@climu
Created May 29, 2018 09:29
Show Gist options
  • Save climu/18bd938fa7c1bc5b0a6018852a009f91 to your computer and use it in GitHub Desktop.
Save climu/18bd938fa7c1bc5b0a6018852a009f91 to your computer and use it in GitHub Desktop.
var match_8_sortable = Sortable.create(match_8,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 4) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 4) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[8] = match_8_sortable;
var match_9_sortable = Sortable.create(match_9,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 4) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 4) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[9] = match_9_sortable;
sortables[4] = matches;
matches = {};
var match_28_sortable = Sortable.create(match_28,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 14) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 14) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[28] = match_28_sortable;
var match_58_sortable = Sortable.create(match_58,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 14) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 14) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[58] = match_58_sortable;
var match_29_sortable = Sortable.create(match_29,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 14) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 14) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[29] = match_29_sortable;
var match_59_sortable = Sortable.create(match_59,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 14) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 14) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[59] = match_59_sortable;
sortables[14] = matches;
matches = {};
var match_60_sortable = Sortable.create(match_60,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 15) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 15) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[60] = match_60_sortable;
var match_31_sortable = Sortable.create(match_31,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 15) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 15) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[31] = match_31_sortable;
sortables[15] = matches;
matches = {};
var match_32_sortable = Sortable.create(match_32,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 16) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: true ,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 16) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[32] = match_32_sortable;
sortables[16] = matches;
matches = {};
var match_57_sortable = Sortable.create(match_57,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 28) && (to.attr('data-bracket') == 2)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 28) && ($(evt.from).attr('data-bracket') == 2)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[57] = match_57_sortable;
sortables[28] = matches;
matches = {};
var match_14_sortable = Sortable.create(match_14,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 8) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 8) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[14] = match_14_sortable;
var match_50_sortable = Sortable.create(match_50,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 8) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: true ,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 8) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[50] = match_50_sortable;
sortables[8] = matches;
matches = {};
var match_46_sortable = Sortable.create(match_46,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 23) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 23) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[46] = match_46_sortable;
var match_47_sortable = Sortable.create(match_47,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 23) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: true ,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 23) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[47] = match_47_sortable;
sortables[23] = matches;
matches = {};
var match_61_sortable = Sortable.create(match_61,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 29) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 29) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[61] = match_61_sortable;
var match_63_sortable = Sortable.create(match_63,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 29) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 29) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[63] = match_63_sortable;
sortables[29] = matches;
matches = {};
var match_65_sortable = Sortable.create(match_65,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 31) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: false,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 31) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[65] = match_65_sortable;
sortables[31] = matches;
matches = {};
var match_68_sortable = Sortable.create(match_68,{
group: {
name: 'players_list',
pull: function (to, from){
to = $(to.el)
if ($(from.el).hasClass('played')){
return 'clone';
}
if ((to.attr('data-round') <= 32) && (to.attr('data-bracket') == 3)){
return true;
}
if (to.attr('data-bracket') < 0 ) {
return true
}
else {
return 'clone';
}
},
put: true,
revertClone: true,
},
sort: true ,
onAdd: function (evt){
console.log($(evt.item).attr('data-id'))
if (($(evt.from).attr('data-round') > 32) && ($(evt.from).attr('data-bracket') == 3)) {
evt.item.outerHTML = "";
}
else{
$(evt.item).removeClass('list-group-item-success')
if ($(evt.from).hasClass('group_players')){
// if we put a new player, we had the select box to the item
text = '<div class="checkbox div-checkbox pull-right"><input class ="refetch check-player" value="' + $(evt.item).attr('data-id') + '" type="checkbox" ></div>'
$(evt.item).append(text)
}
}
},
});
matches[68] = match_68_sortable;
sortables[32] = matches;
matches = {};
function get_dict() {
var dict = {};
var bracket = {};
var round = {};
//console.log(match_8_sortable.toArray())
round[8] = match_8_sortable.toArray();
//console.log(match_9_sortable.toArray())
round[9] = match_9_sortable.toArray();
bracket[4] = round
round = {}
//console.log(match_28_sortable.toArray())
round[28] = match_28_sortable.toArray();
//console.log(match_58_sortable.toArray())
round[58] = match_58_sortable.toArray();
//console.log(match_29_sortable.toArray())
round[29] = match_29_sortable.toArray();
//console.log(match_59_sortable.toArray())
round[59] = match_59_sortable.toArray();
bracket[14] = round
round = {}
//console.log(match_60_sortable.toArray())
round[60] = match_60_sortable.toArray();
//console.log(match_31_sortable.toArray())
round[31] = match_31_sortable.toArray();
bracket[15] = round
round = {}
//console.log(match_32_sortable.toArray())
round[32] = match_32_sortable.toArray();
bracket[16] = round
round = {}
//console.log(match_57_sortable.toArray())
round[57] = match_57_sortable.toArray();
bracket[28] = round
round = {}
dict[2] = bracket
bracket = {}
//console.log(match_14_sortable.toArray())
round[14] = match_14_sortable.toArray();
//console.log(match_50_sortable.toArray())
round[50] = match_50_sortable.toArray();
bracket[8] = round
round = {}
//console.log(match_46_sortable.toArray())
round[46] = match_46_sortable.toArray();
//console.log(match_47_sortable.toArray())
round[47] = match_47_sortable.toArray();
bracket[23] = round
round = {}
//console.log(match_61_sortable.toArray())
round[61] = match_61_sortable.toArray();
//console.log(match_63_sortable.toArray())
round[63] = match_63_sortable.toArray();
bracket[29] = round
round = {}
//console.log(match_65_sortable.toArray())
round[65] = match_65_sortable.toArray();
bracket[31] = round
round = {}
//console.log(match_68_sortable.toArray())
round[68] = match_68_sortable.toArray();
bracket[32] = round
round = {}
dict[3] = bracket
bracket = {}
return dict;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment