User:לערי ריינהארט/common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// [[d:User:Yair rand/WikidataInfo.js]]
/* mw.loader.load("//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript"); *!
/** extract a URL parameter from the current URL **********
* From [[commons:en:user:Lupin/autoedit.js]]
*
* paramName : the name of the parameter to extract
*/
function getParamValue( paramName, url)
{
if (typeof (url) == 'undefined' ) url = document.location.href;
var cmdRe=RegExp( '[&?]' + paramName + '=([^&]*)' );
var m=cmdRe.exec(url);
if (m) {
try {
return decodeURIComponent(m[1]);
} catch (someError) {}
}
return null;
}
/* [[commons:Bugzilla:021572]] -- [[commons:meta:user:Platonides]] */
$ ( function() { if (wgArticleId) mw.util.addPortletLink("p-tb", wgScript + "?curid=" + wgArticleId + ( ((wgNamespaceNumber == 24) && getParamValue('dataset')) ? "&dataset=" + getParamValue('dataset') : "" ) , "Short url", "t-curid", "Reference using its article id"); } );