MediaWiki:Gadget-popups.js: Difference between revisions

Jump to navigation Jump to search
http > https
(remove sections relying on red-link templates - will hopefully make this page slightly faster)
(http > https)
 
Line 1,271: Line 1,271:
this.aborted = false;
this.aborted = false;
/**
/**
  HTTP method. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html for possibilities.
  HTTP method. See https://www.W3.org/Protocols/rfc2616/rfc2616-sec9.html for possibilities.
  @type String
  @type String
*/
*/
Line 1,431: Line 1,431:
  * Version 0.6.1
  * Version 0.6.1
  * Copyright (C) Pedro Fayolle 2005-2006
  * Copyright (C) Pedro Fayolle 2005-2006
  * http://en.wikipedia.org/wiki/User:Pilaf
  * https://En.Wikipedia.org/wiki/User:Pilaf
  * Distributed under the BSD license
  * Distributed under the BSD license
  *
  *
Line 1,481: Line 1,481:
// Only used for Insta previews with images. (not in popups)
// Only used for Insta previews with images. (not in popups)
math: '/math/',
math: '/math/',
images: '//upload.wikimedia.org/wikipedia/en/', // FIXME ( window.getImageUrlStart ? getImageUrlStart(pg.wiki.hostname) : ''),
images: 'https://Upload.Wikimedia.org/wikipedia/en/', // FIXME ( window.getImageUrlStart ? getImageUrlStart(pg.wiki.hostname) : ''),
images_fallback: '//upload.wikimedia.org/wikipedia/commons/',
images_fallback: 'https://Upload.Wikimedia.org/wikipedia/commons/',
magnify_icon: 'skins/common/images/magnify-clip.png'
magnify_icon: 'skins/common/images/magnify-clip.png'
},
},
Line 1,499: Line 1,499:
user.name = user.name || 'Wikipedian';
user.name = user.name || 'Wikipedian';
user.signature = '[['+locale.user+':'+user.name+'|'+user.name+']]';
user.signature = '[['+locale.user+':'+user.name+'|'+user.name+']]';
//paths.images = '//upload.wikimedia.org/wikipedia/' + wiki.lang + '/';
//paths.images = 'https://Upload.Wikimedia.org/wikipedia/' + wiki.lang + '/';
}
}


Line 2,412: Line 2,412:
// and return the corresponding talk page otherwise
// and return the corresponding talk page otherwise
//
//
// Per http://www.mediawiki.org/wiki/Manual:Namespace#Subject_and_talk_namespaces
// Per https://www.MediaWiki.org/wiki/Manual:Namespace#Subject_and_talk_namespaces
// * All discussion namespaces have odd-integer indices
// * All discussion namespaces have odd-integer indices
// * The discussion namespace index for a specific namespace with index n is n + 1
// * The discussion namespace index for a specific namespace with index n is n + 1
Line 2,671: Line 2,671:
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// Cookie handling
// Cookie handling
// from http://www.quirksmode.org/js/cookies.html
// from https://QuirksMode.org/js/cookies.html


var Cookie= {
var Cookie= {
Line 2,783: Line 2,783:
  * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  * Distributed under the BSD License
  * Distributed under the BSD License
  * See http://pajhome.org.uk/crypt/md5 for more info.
  * See http://PajHome.org.uk/crypt/md5 for more info.
  */
  */


Line 3,466: Line 3,466:
function listLinks(wikitext, oldTarget, titleToEdit) {
function listLinks(wikitext, oldTarget, titleToEdit) {
// mediawiki strips trailing spaces, so we do the same
// mediawiki strips trailing spaces, so we do the same
// testcase: http://en.wikipedia.org/w/index.php?title=Radial&oldid=97365633
// testcase: https://En.Wikipedia.org/w/index.php?title=Radial&oldid=97365633
var reg=RegExp('\\[\\[([^|]*?) *(\\||\\]\\])', 'gi');
var reg=RegExp('\\[\\[([^|]*?) *(\\||\\]\\])', 'gi');
var ret=[];
var ret=[];
Line 4,351: Line 4,351:
htmlGenerator=function(a,d){
htmlGenerator=function(a,d){
return 'This function of navigation popups now requires a MediaWiki ' +  
return 'This function of navigation popups now requires a MediaWiki ' +  
'installation with the <a href="http://www.mediawiki.org/wiki/API">API</a> enabled.'; };
'installation with the <a href="https://www.MediaWiki.org/wiki/API">API</a> enabled.'; };
}
}
var callback=function(d){
var callback=function(d){
Line 4,358: Line 4,358:
};
};
if (pg.flag.isIE) {
if (pg.flag.isIE) {
url = url + '&*'; //to circumvent https://bugzilla.wikimedia.org/show_bug.cgi?id=28840
url = url + '&*'; //to circumvent https://Bugzilla.Wikimedia.org/show_bug.cgi?id=28840
}
}
var go = function(){
var go = function(){
Line 4,560: Line 4,560:
'&action=query&prop=revisions&rvprop=content&titles=' + encart;
'&action=query&prop=revisions&rvprop=content&titles=' + encart;
if (pg.flag.isIE) {
if (pg.flag.isIE) {
shared_url = shared_url + '&*'; //to circumvent https://bugzilla.wikimedia.org/show_bug.cgi?id=28840
shared_url = shared_url + '&*'; //to circumvent https://Bugzilla.Wikimedia.org/show_bug.cgi?id=28840
}
}


Line 4,723: Line 4,723:
url += '&titles=' + art;
url += '&titles=' + art;
if (pg.flag.isIE) {
if (pg.flag.isIE) {
url = url + '&*'; //to circumvent https://bugzilla.wikimedia.org/show_bug.cgi?id=28840
url = url + '&*'; //to circumvent https://Bugzilla.Wikimedia.org/show_bug.cgi?id=28840
}
}


Line 4,900: Line 4,900:
function setInterwiki() {
function setInterwiki() {
if (pg.wiki.wikimedia) {
if (pg.wiki.wikimedia) {
// From http://meta.wikimedia.org/wiki/List_of_Wikipedias
// From https://Meta.Wikimedia.org/wiki/List_of_Wikipedias
pg.wiki.interwiki='aa|ab|ace|af|ak|als|am|an|ang|ar|arc|arz|as|ast|av|ay|az|ba|bar|bat-smg|bcl|be|be-x-old|bg|bh|bi|bjn|bm|bn|bo|bpy|br|bs|bug|bxr|ca|cbk-zam|cdo|ce|ceb|ch|cho|chr|chy|ckb|co|cr|crh|cs|csb|cu|cv|cy|da|de|diq|dsb|dv|dz|ee|el|eml|en|eo|es|et|eu|ext|fa|ff|fi|fiu-vro|fj|fo|fr|frp|frr|fur|fy|ga|gag|gan|gd|gl|glk|gn|got|gu|gv|ha|hak|haw|he|hi|hif|ho|hr|hsb|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|ilo|io|is|it|iu|ja|jbo|jv|ka|kaa|kab|kbd|kg|ki|kj|kk|kl|km|kn|ko|koi|kr|krc|ks|ksh|ku|kv|kw|ky|la|lad|lb|lbe|lg|li|lij|lmo|ln|lo|lt|ltg|lv|map-bms|mdf|mg|mh|mhr|mi|mk|ml|mn|mo|mr|mrj|ms|mt|mus|mwl|my|myv|mzn|na|nah|nap|nds|nds-nl|ne|new|ng|nl|nn|no|nov|nrm|nv|ny|oc|om|or|os|pa|pag|pam|pap|pcd|pdc|pfl|pi|pih|pl|pms|pnb|pnt|ps|pt|qu|rm|rmy|rn|ro|roa-rup|roa-tara|ru|rue|rw|sa|sah|sc|scn|sco|sd|se|sg|sh|si|simple|sk|sl|sm|sn|so|sq|sr|srn|ss|st|stq|su|sv|sw|szl|ta|te|tet|tg|th|ti|tk|tl|tn|to|tpi|tr|ts|tt|tum|tw|ty|udm|ug|uk|ur|uz|ve|vec|vi|vls|vo|wa|war|wo|wuu|xal|xh|yi|yo|za|zea|zh|zh-classical|zh-min-nan|zh-yue|zu';
pg.wiki.interwiki='aa|ab|ace|af|ak|als|am|an|ang|ar|arc|arz|as|ast|av|ay|az|ba|bar|bat-smg|bcl|be|be-x-old|bg|bh|bi|bjn|bm|bn|bo|bpy|br|bs|bug|bxr|ca|cbk-zam|cdo|ce|ceb|ch|cho|chr|chy|ckb|co|cr|crh|cs|csb|cu|cv|cy|da|de|diq|dsb|dv|dz|ee|el|eml|en|eo|es|et|eu|ext|fa|ff|fi|fiu-vro|fj|fo|fr|frp|frr|fur|fy|ga|gag|gan|gd|gl|glk|gn|got|gu|gv|ha|hak|haw|he|hi|hif|ho|hr|hsb|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|ilo|io|is|it|iu|ja|jbo|jv|ka|kaa|kab|kbd|kg|ki|kj|kk|kl|km|kn|ko|koi|kr|krc|ks|ksh|ku|kv|kw|ky|la|lad|lb|lbe|lg|li|lij|lmo|ln|lo|lt|ltg|lv|map-bms|mdf|mg|mh|mhr|mi|mk|ml|mn|mo|mr|mrj|ms|mt|mus|mwl|my|myv|mzn|na|nah|nap|nds|nds-nl|ne|new|ng|nl|nn|no|nov|nrm|nv|ny|oc|om|or|os|pa|pag|pam|pap|pcd|pdc|pfl|pi|pih|pl|pms|pnb|pnt|ps|pt|qu|rm|rmy|rn|ro|roa-rup|roa-tara|ru|rue|rw|sa|sah|sc|scn|sco|sd|se|sg|sh|si|simple|sk|sl|sm|sn|so|sq|sr|srn|ss|st|stq|su|sv|sw|szl|ta|te|tet|tg|th|ti|tk|tl|tn|to|tpi|tr|ts|tt|tum|tw|ty|udm|ug|uk|ur|uz|ve|vec|vi|vls|vo|wa|war|wo|wuu|xal|xh|yi|yo|za|zea|zh|zh-classical|zh-min-nan|zh-yue|zu';
pg.re.interwiki=RegExp('^'+pg.wiki.interwiki+':');
pg.re.interwiki=RegExp('^'+pg.wiki.interwiki+':');
Line 5,733: Line 5,733:
}
}


// see http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object
// see https://Developer.Mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Object
// FIXME: use obj.hasOwnProperty instead of this kludge!
// FIXME: use obj.hasOwnProperty instead of this kludge!
window.jsReservedProperties=RegExp('^(constructor|prototype|__((define|lookup)[GS]etter)__' +
window.jsReservedProperties=RegExp('^(constructor|prototype|__((define|lookup)[GS]etter)__' +
Line 5,798: Line 5,798:
function setSiteInfo() {
function setSiteInfo() {
if (window.popupLocalDebug) {
if (window.popupLocalDebug) {
pg.wiki.hostname = 'en.wikipedia.org';
pg.wiki.hostname = 'En.Wikipedia.org';
} else {
} else {
pg.wiki.hostname = location.hostname; // use in preference to location.hostname for flexibility (?)
pg.wiki.hostname = location.hostname; // use in preference to location.hostname for flexibility (?)
Line 5,805: Line 5,805:
pg.wiki.wikia=RegExp('[.]wikia[.]com$', 'i').test(pg.wiki.hostname);
pg.wiki.wikia=RegExp('[.]wikia[.]com$', 'i').test(pg.wiki.hostname);
pg.wiki.isLocal=RegExp('^localhost').test(pg.wiki.hostname);
pg.wiki.isLocal=RegExp('^localhost').test(pg.wiki.hostname);
pg.wiki.commons=( pg.wiki.wikimedia && pg.wiki.hostname != 'commons.wikimedia.org') ? 'commons.wikimedia.org' : null;
pg.wiki.commons=( pg.wiki.wikimedia && pg.wiki.hostname != 'Commons.Wikimedia.org') ? 'Commons.Wikimedia.org' : null;
pg.wiki.lang = wgContentLanguage;
pg.wiki.lang = wgContentLanguage;
var port = location.port ? ':' + location.port : '';
var port = location.port ? ':' + location.port : '';
Line 6,083: Line 6,083:
case 'mainspace_en':
case 'mainspace_en':
testResult=isInMainNamespace(article) &&
testResult=isInMainNamespace(article) &&
pg.wiki.hostname=='en.wikipedia.org';
pg.wiki.hostname=='En.Wikipedia.org';
break;
break;
case 'wikimedia':
case 'wikimedia':
Line 6,994: Line 6,994:
// if x.newTarget omitted or null, remove the link
// if x.newTarget omitted or null, remove the link


//x.text=encodeURI(x.text);  // this buggers things up on zh.wikipedia.org and doesn't seem necessary
//x.text=encodeURI(x.text);  // this buggers things up on Zh.Wikipedia.org and doesn't seem necessary
x.clickButton=encodeURI(x.clickButton);
x.clickButton=encodeURI(x.clickButton);


Line 7,129: Line 7,129:
if(!saneLinkCheck(l)) return null;
if(!saneLinkCheck(l)) return null;


var base='http://www.google.com/search?q=';
var base='https://www.Google.com/search?q=';
var article=l.article.urlString({keepSpaces:true});
var article=l.article.urlString({keepSpaces:true});


Line 7,175: Line 7,175:
log('getHistory: url='+url);
log('getHistory: url='+url);
if (pg.flag.isIE) {
if (pg.flag.isIE) {
url = url + '&*'; //to circumvent https://bugzilla.wikimedia.org/show_bug.cgi?id=28840
url = url + '&*'; //to circumvent https://Bugzilla.Wikimedia.org/show_bug.cgi?id=28840
}
}
return startDownload(url, pg.idNumber+'history', onComplete);
return startDownload(url, pg.idNumber+'history', onComplete);
Line 7,381: Line 7,381:
newOption('popupHistoryPreviewLimit', 25);
newOption('popupHistoryPreviewLimit', 25);
newOption('popupContribsPreviewLimit',25);
newOption('popupContribsPreviewLimit',25);
newOption('popupRevDelUrl',          '//en.wikipedia.org/wiki/Wikipedia:Revision_deletion');
newOption('popupRevDelUrl',          'https://En.Wikipedia.org/wiki/Wikipedia:Revision_deletion');
//</NOLITE>
//</NOLITE>


Line 7,402: Line 7,402:
//
//
// See instructions at
// See instructions at
// http://en.wikipedia.org/wiki/Wikipedia:Tools/Navigation_popups/Translation
// https://En.Wikipedia.org/wiki/Wikipedia:Tools/Navigation_popups/Translation


pg.string = {
pg.string = {

Navigation menu