MediaWiki:Gadget-calc-core.js: Difference between revisions

no edit summary
(Created page with "/** * Calc script for RuneScape Wiki * * MAIN SCRIPT https://runescape.wiki/w/MediaWiki:Gadget-calc.js * https://runescape.wiki/w/MediaWiki:Gadget-calc.css * DUPLICATE TO https://oldschool.runescape.wiki/w/MediaWiki:Gadget-calc.js * https://oldschool.runescape.wiki/w/MediaWiki:Gadget-calc.css * make sure to update the hiscores URL for OSRS * * This script exposes the following hooks, accessible via `mw.hook`: * 1. 'rscalc.setupComplete' - Fires when...")
 
No edit summary
Tag: Reverted
Line 98:
}
 
for ( index in data.mw.pages ) {
suggestionPage = data.mw.pages[ index ];
 
// When excludeCurrentPage is set, don't list the current page unless the user has type the full title
Line 106:
}
 
// When excludeDynamicNamespaces is set, ignore all mw.pages with negative namespace
if ( this.excludeDynamicNamespaces && suggestionPage.ns < 0 ) {
continue;
Line 122:
};
 
// Throw away mw.pages from wrong namespaces. This can happen when 'showRedirectTargets' is true
// and we encounter a cross-namespace redirect.
if ( this.namespace === null || namespaces.indexOf(suggestionPage.ns) >= 0 ) {
Line 640:
var prom = new Promise ( function (resolve,reject) {
api.get(prms).then( function (ret) {
if ( ret.query.mw.pages && Object.keys(ret.query.mw.pages).length ) {
var nspaces = param.ooui.namespace.split('|'), allNS = false;
if (nspaces.indexOf('*') >= 0) {
Line 646:
}
nspaces = nspaces.map(function (ns) {return parseInt(ns,10);});
for (var pgID in ret.query.mw.pages) {
if ( ret.query.mw.pages.hasOwnProperty(pgID) && ret.query.mw.pages[pgID].missing!== '' ) {
if ( allNS ) {
resolve();
}
if ( ret.query.mw.pages[pgID].ns !== undefined && nspaces.indexOf(ret.query.mw.pages[pgID].ns) >= 0 ) {
resolve();
}
Line 751:
// experimental support for using VE to parse calc templates
if (!!mw.mw.util.getParamValue('vecalc')) {
params = {
action: 'visualeditor',
Line 776:
var html;
if (!!mw.mw.util.getParamValue('vecalc')) {
// strip body tag
html = $(response.visualeditor.content).contents();