מדיה ויקי:Gadget-HotCat.js: הבדלים בין גרסאות בדף
tooltips, show suggestions directly when modifying, and when on a category page, do not suggest self-reference in pop-up list |
Fix a bug with edit conflicts |
||
| שורה 550: | שורה 550: | ||
// it doesn't succeed), getting the page text. Perform the changes on the text, then construct | // it doesn't succeed), getting the page text. Perform the changes on the text, then construct | ||
// a form to submit all this as a diff. | // a form to submit all this as a diff. | ||
if ( | // Note: we have to do this even if we already got the page text. Other scripts may have already | ||
// edited the text, and we don't necessarily get an edit conflict with ourself. Use case: open | |||
// a file page, add an image note through ImageAnnotator, then change the categories. If HotCat | |||
// still operates on the page text loaded initially, it'll delete the just added note again, and | |||
// somehow the MediaWiki software does not produce an edit conflict. | |||
if (wgArticleId != 0) { | |||
var request = sajax_init_object (); | var request = sajax_init_object (); | ||
var uri = wgServer + wgScriptPath | var uri = wgServer + wgScriptPath | ||
| שורה 559: | שורה 564: | ||
if (request.status == 200 && request.responseText && request.responseText.charAt(0) == '{') { | if (request.status == 200 && request.responseText && request.responseText.charAt(0) == '{') { | ||
setPage (eval ('(' + request.responseText + ')')); | setPage (eval ('(' + request.responseText + ')')); | ||
} else { | |||
pageText = null; | |||
} | } | ||
} | } | ||