User:Ricordisamoa/Blurry.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
This user script seems to have a documentation page at User:Ricordisamoa/Blurry. |
/* <nowiki>
* Blurry.js by [[User:Ricordisamoa]]
* uses jQuery & Ajax
* adds a link to tag the current image as {{Blurry}} (for Commons only)
*/
$(document).ready(function(){
if(wgCanonicalNamespace=="File"||wgNamespaceNumber==6&&wgAction=="view"){// the page is a file description
$(mw.util.addPortletLink("p-cactions","#","Blurry","Tag-blurry","Add {{Blurry}} to the file description page"))
.click(function(event){
event.preventDefault();
$.post(
mw.util.wikiScript("api"),
{
action:"edit",
prependtext:"{{Blurry}}\n",
title:wgPageName,
summary:"[[User:Ricordisamoa/Blurry|Blurry.js]]: tagging image as {{[[Template:Blurry|blurry]]}}",
token:mw.user.tokens.get("editToken")
}
)
.done(function(data){
if(data.error&&data.error.info) jsMsg("Blurry.js - Error:<br/>"+data.error.info);
else{
jsMsg("Blurry.js:<br/>Template added!");
setTimeout(function(){document.location.reload();},2500);
}
})
.fail(function(){
jsMsg("Blurry.js:<br/>The ajax request failed.");
});
});
}
});
/* </nowiki> */