מדיה ויקי:Gadget-Cat-a-lot.js: הבדלים בין גרסאות בדף
add show(); submit onEnter |
separate add/copy functions, preserve sortkey when copying from one cat to another, add reload link |
||
| שורה 190: | שורה 190: | ||
switch (mode) { | switch (mode) { | ||
case 'add': | |||
text += "\n[[" + "Category:" + targetcat + "]]\n"; | |||
comment = "Adding [[" + "Category:" + targetcat + "]]"; | |||
break; | |||
case 'copy': | case 'copy': | ||
text | text = text.replace(this.regexBuilder(sourcecat), "[[Category:" + sourcecat + "$1]]\n[[Category:" + targetcat + "$1]]"); | ||
comment = "Copying from [[" + "Category:" + sourcecat + "]] to [[" + "Category:" + targetcat + "]]"; | comment = "Copying from [[" + "Category:" + sourcecat + "]] to [[" + "Category:" + targetcat + "]]"; | ||
break; | break; | ||
case 'move': | case 'move': | ||
| שורה 240: | שורה 243: | ||
var rep = this.domCounter.parent(); | var rep = this.domCounter.parent(); | ||
rep.html('<h3>Done!</h3>'); | rep.html('<h3>Done!</h3>'); | ||
rep.append('All pages are processed. <a href="javascript:void(location.reload())">Click here to reload the page.</a>'); | |||
rep.append('All pages are processed. | |||
if (this.alreadyThere.length) { | if (this.alreadyThere.length) { | ||
| שורה 264: | שורה 266: | ||
copyHere: function (targetcat) { | copyHere: function (targetcat) { | ||
this.doSomething(targetcat, 'copy'); | this.doSomething(targetcat, 'copy'); | ||
}, | |||
addHere: function (targetcat) { | |||
this.doSomething(targetcat, 'add'); | |||
}, | }, | ||
| שורה 317: | שורה 323: | ||
}); | }); | ||
var move = $('<a class="cat_a_lot_action"><b> Move</b></a>'); | if (this.searchmode) { | ||
var add = $('<a class="cat_a_lot_action"><b>Add</b></a>'); | |||
add.click(function () { | |||
catALot.addHere($(this).parent().data('cat')); | |||
}); | |||
} else { | |||
var move = $('<a class="cat_a_lot_action"><b> Move</b></a>'); | |||
move.click(function () { | |||
catALot.moveHere($(this).parent().data('cat')); | |||
}); | |||
var copy = $('<a class="cat_a_lot_action"><b>Copy</b></a>'); | |||
copy.click(function () { | |||
catALot.copyHere($(this).parent().data('cat')); | |||
}); | |||
} | |||
li.append(symbol).append(' ').append(link); | li.append(symbol).append(' ').append(link); | ||
// Can't move to source category | // Can't move to source category | ||
if (list[i] != wgTitle && this.searchmode) li.append(' ').append( | if (list[i] != wgTitle && this.searchmode) li.append(' ').append(add); | ||
else if (list[i] != wgTitle && !this.searchmode) li.append(' ').append(move).append(' ').append(copy); | else if (list[i] != wgTitle && !this.searchmode) li.append(' ').append(move).append(' ').append(copy); | ||