מדיה ויקי:Gadget-Cat-a-lot.js: הבדלים בין גרסאות בדף
מ dirtily fixing selector bug; need to look into it later on |
מ Keep reference to dom the whole time |
||
| שורה 51: | שורה 51: | ||
this.selectedLabels.each(function () { | this.selectedLabels.each(function () { | ||
var file = $(this).find('a[title]'); | var file = $(this).find('a[title]'); | ||
marked.push(file.attr('title')); | marked.push([file.attr('title'), $(this)]); | ||
}); | }); | ||
return marked; | return marked; | ||
| שורה 143: | שורה 143: | ||
}, | }, | ||
getContent: function ( | getContent: function (file, targetcat, mode) { | ||
var data = { | var data = { | ||
| שורה 150: | שורה 150: | ||
rvprop: 'content|timestamp', | rvprop: 'content|timestamp', | ||
intoken: 'edit', | intoken: 'edit', | ||
titles: | titles: file[0] | ||
}; | }; | ||
this.doAPICall(data, function (result) { | this.doAPICall(data, function (result) { | ||
catALot.editCategories(result, | catALot.editCategories(result, file, targetcat, mode); | ||
}); | }); | ||
}, | }, | ||
editCategories: function (result, | editCategories: function (result, file, targetcat, mode) { | ||
if (result == null) { | if (result == null) { | ||
//Happens on unstable wifi connections.. | //Happens on unstable wifi connections.. | ||
this.connectionError.push( | this.connectionError.push(file[0]); | ||
this.updateCounter(); | this.updateCounter(); | ||
return; | return; | ||
| שורה 186: | שורה 186: | ||
mode='remove'; | mode='remove'; | ||
} else { | } else { | ||
this.alreadyThere.push( | this.alreadyThere.push(file[0]); | ||
this.updateCounter(); | this.updateCounter(); | ||
return; | return; | ||
| שורה 216: | שורה 216: | ||
if (text == otext) { | if (text == otext) { | ||
this.notFound.push( | this.notFound.push(file[0]); | ||
this.updateCounter(); | this.updateCounter(); | ||
return; | return; | ||
| שורה 224: | שורה 224: | ||
action: 'edit', | action: 'edit', | ||
summary: comment, | summary: comment, | ||
title: | title: file[0], | ||
token: this.edittoken, | token: this.edittoken, | ||
starttimestamp: starttimestamp, | starttimestamp: starttimestamp, | ||
| שורה 232: | שורה 232: | ||
//TODO: Need to fix selectors later, wrapping in try...catch now, since we can do w/o it | //TODO: Need to fix selectors later, wrapping in try...catch now, since we can do w/o it | ||
try { | try { | ||
this.markAsDone( | this.markAsDone(file[1], mode, targetcat); | ||
} catch (e) { } | } catch (e) { } | ||
this.doAPICall(data, function (ret) { | this.doAPICall(data, function (ret) { | ||
| שורה 238: | שורה 238: | ||
}); | }); | ||
}, | }, | ||
markAsDone: function ( | markAsDone: function (label, mode, targetcat) { | ||
label.addClass('cat_a_lot_markAsDone'); | label.addClass('cat_a_lot_markAsDone'); | ||
switch (mode) { | switch (mode) { | ||
| שורה 408: | שורה 407: | ||
}, | }, | ||
showProgress: function () { | showProgress: function () { | ||
document.body.style.cursor = 'wait'; | document.body.style.cursor = 'wait'; | ||