User:Lights/nolicense.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Animum/urlparameters.js');
 
$(function () {
  if(UrlParameters["addnolicensetag"] == 'yes' && wgCanonicalNamespace == "Image") {
    document.forms["editform"].wpTextbox1.value += "\{\{di-no license\|date\=\{\{subst\:\#time\:F j\, Y\}\}\}\}";
    document.forms["editform"].wpSummary.value = "No license information is given";
    document.forms["editform"].wpMinoredit.checked = true;
    window.setTimeout(function() { document.forms["editform"].submit(); }, 200);
  }
});
 
$(function() {
  if(wgCanonicalNamespace == "Image") {
    mw.util.addPortletLink('p-cactions', 'http://en.wikipedia.org/w/index.php?title='+wgPageName+'&action=edit&addnolicensetag=yes', 'no license', 'ca-nolicense', "Tag as di-no license");
  }
});