मीडियाविकि:Gadget-morebits.js: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
Siddhartha Ghai (वार्ता) द्वारा किए बदलाव 1555707 को पूर्ववत करें
छो Mayur (Talk) के संपादनों को हटाकर Siddhartha Ghai के आखिरी अवतरण को पूर्ववत किया
लाइन 1:
// <nowiki>
/**
* morebits.js
Line 40 ⟶ 41:
function userIsAnon() {
return mw.config.get( 'wgUserGroups' ).length === 1;
}
 
 
/**
* **************** twAddPortlet() ****************
*
* Adds a portlet menu to one of the navigation areas on the page.
* This is necessarily quite a hack since skins, navigation areas, and
* portlet menu types all work slightly different.
*
* Available navigation areas depend on the script used.
* Monobook:
* "column-one", outer div class "portlet", inner div class "pBody". Existing portlets: "p-cactions", "p-personal", "p-logo", "p-navigation", "p-search", "p-interaction", "p-tb", "p-coll-print_export"
* Special layout of p-cactions and p-personal through specialized styles.
* Vector:
* "mw-panel", outer div class "portal", inner div class "body". Existing portlets/elements: "p-logo", "p-navigation", "p-interaction", "p-tb", "p-coll-print_export"
* "left-navigation", outer div class "vectorTabs" or "vectorMenu", inner div class "" or "menu". Existing portlets: "p-namespaces", "p-variants" (menu)
* "right-navigation", outer div class "vectorTabs" or "vectorMenu", inner div class "" or "menu". Existing portlets: "p-views", "p-cactions" (menu), "p-search"
* Special layout of p-personal portlet (part of "head") through specialized styles.
* Modern:
* "mw_contentwrapper" (top nav), outer div class "portlet", inner div class "pBody". Existing portlets or elements: "p-cactions", "mw_content"
* "mw_portlets" (sidebar), outer div class "portlet", inner div class "pBody". Existing portlets: "p-navigation", "p-search", "p-interaction", "p-tb", "p-coll-print_export"
*
* NOTE: If anyone is brave enough to reuse this directly, please shoot
* me a note. Otherwise I might change the signature down the line and
* your script breaks. Amalthea.
*
* @param String navigation -- id of the target navigation area (skin dependant, on vector either of "left-navigation", "right-navigation", or "mw-panel")
* @param String id -- id of the portlet menu to create, preferably start with "p-".
* @param String text -- name of the portlet menu to create. Visibility depends on the class used.
* @param String type -- type of portlet. Currently only used for the vector non-sidebar portlets, pass "menu" to make this portlet a drop down menu.
* @param Node nextnodeid -- the id of the node before which the new item should be added, should be another item in the same list, or undefined to place it at the end.
*
* @return Node -- the DOM node of the new item (a DIV element) or null
*/
function twAddPortlet( navigation, id, text, type, nextnodeid )
{
//sanity checks, and get required DOM nodes
var root = document.getElementById( navigation );
if ( !root ) {
return null;
}
 
var item = document.getElementById( id );
if (item) {
if (item.parentNode && item.parentNode === root) {
return item;
}
return null;
}
 
var nextnode;
if (nextnodeid) {
nextnode = document.getElementById(nextnodeid);
}
 
//verify/normalize input
type = (skin === "vector" && type === "menu" && (navigation === "left-navigation" || navigation === "right-navigation")) ? "menu" : "";
var outerDivClass;
var innerDivClass;
switch (skin)
{
case "vector":
if (navigation !== "portal" && navigation !== "left-navigation" && navigation !== "right-navigation") {
navigation = "mw-panel";
}
outerDivClass = (navigation === "mw-panel") ? "portal" : (type === "menu" ? "vectorMenu extraMenu" : "vectorTabs extraMenu");
innerDivClass = (navigation === "mw-panel") ? 'body' : (type === 'menu' ? 'menu':'');
break;
case "modern":
if (navigation !== "mw_portlets" && navigation !== "mw_contentwrapper") {
navigation = "mw_portlets";
}
outerDivClass = "portlet";
innerDivClass = "pBody";
break;
default:
navigation = "column-one";
outerDivClass = "portlet";
innerDivClass = "pBody";
break;
}
 
//Build the DOM elements.
var outerDiv = document.createElement( 'div' );
outerDiv.className = outerDivClass+" emptyPortlet";
outerDiv.id = id;
if ( nextnode && nextnode.parentNode === root ) {
root.insertBefore( outerDiv, nextnode );
} else {
root.appendChild( outerDiv );
}
 
var h5 = document.createElement( 'h5' );
if (type === 'menu') {
var span = document.createElement( 'span' );
span.appendChild( document.createTextNode( text ) );
h5.appendChild( span );
 
var a = document.createElement( 'a' );
a.href = "#";
span = document.createElement( 'span' );
span.appendChild( document.createTextNode( text ) );
a.appendChild( span );
h5.appendChild( a );
} else {
h5.appendChild( document.createTextNode( text ) );
}
outerDiv.appendChild( h5 );
 
var innerDiv = document.createElement( 'div' ); //not strictly necessary with type vectorTabs, or other skins.
innerDiv.className = innerDivClass;
outerDiv.appendChild(innerDiv);
 
var ul = document.createElement( 'ul' );
innerDiv.appendChild( ul );
 
return outerDiv;
}
 
 
/**
* **************** twAddPortletLink() ****************
* Builds a portlet menu if it doesn't exist yet, and add the portlet link.
*/
 
function twAddPortletLink( href, text, id, tooltip, accesskey, nextnode )
{
if (twAddPortlet.portletArea) {
twAddPortlet(twAddPortlet.portletArea, twAddPortlet.portletId, twAddPortlet.portletName, twAddPortlet.portletType, twAddPortlet.portletNext);
}
return addPortletLink( twAddPortlet.portletId, href, text, id, tooltip, accesskey, nextnode );
}
 
Line 187 ⟶ 56:
create: function( name, value, max_age, path ) {
if( Cookies.exists( name ) ) {
throw new Error( "cookie " + name + " already exists" );
}
Cookies.set( name, value, max_age, path );
Line 236 ⟶ 105:
/**
* **************** QuickForm ****************
* QuickformQuickForm is a class for creation of simple and standard forms without much
* specific coding.
*
* Index to QuickForm element types:
*
* select A combo box (aka drop-down).
* - Attributes: name, label, multiple, size, list, event
* option An element for a combo box.
* - Attributes: value, label, selected, disabled
* optgroup A group of "option"s.
* - Attributes: label, list
* field A fieldset (aka group box).
* - Attributes: name, label
* checkbox A checkbox. Must use "list" parameter.
* - Attributes: name, list, event
* - Attributes (within list): name, label, value, checked, disabled, event, subgroup
* radio A radio button. Must use "list" parameter.
* - Attributes: name, list, event
* - Attributes (within list): name, label, value, checked, disabled, event, subgroup
* input A text box.
* - Attributes: name, label, value, size, disabled, readonly, maxlength, event
* dyninput A set of text boxes with "Remove" buttons and an "Add" button.
* - Attributes: name, label, min, max, sublabel, value, size, maxlength, event
* hidden An invisible form field.
* - Attributes: name, value
* header A level 5 header.
* - Attributes: label
* div A generic placeholder element or label.
* - Attributes: name, label
* submit A submit button. SimpleWindow moves these to the footer of the dialog.
* - Attributes: name, label, disabled
* button A generic button.
* - Attributes: name, label, disabled, event
* textarea A big, multi-line text box.
* - Attributes: name, label, value, cols, rows, disabled, readonly
*
* Global attributes: id, tooltip, extra, adminonly
*/
 
Line 681 ⟶ 585:
break;
default:
throw new Error("QuickForm: unknown element type " + data.type.toString());
break;
}
 
Line 724 ⟶ 627:
* Type is optional and can specify if either radio or checkbox (for the event
* that both checkboxes and radiobuttons have the same name.
* getTexts:
* Returns an array containing the values of elements with the given name, that has non-empty strings
* type is "text" or given.
*/
 
Line 767 ⟶ 667:
}
}
}
}
return return_array;
};
 
HTMLFormElement.prototype.getTexts = function( name, type ) {
type = type || 'text';
var elements = this.elements[name];
if( !elements ) {
// if the element doesn't exists, return null.
return null;
}
var return_array = [];
for( var i = 0; i < elements.length; ++i ) {
if( elements[i].values ) {
return_array.push( elements[i].value );
}
}
Line 810 ⟶ 694:
 
return text;
};
 
 
/**
* **************** sprintf ****************
* implementation based on perl similar
* REMOVEME - and replace usages with concatenated strings - this is a real performance hog
*/
 
function sprintf() {
if( !arguments.length ) {
throw "Not enough arguments for sprintf";
}
var result = "";
var format = arguments[0];
 
var index = 1;
var current_index = 1;
var flags = {};
var in_operator = false;
var relative = false;
var precision = false;
var fixed = false;
var vector = false;
var vector_delimiter = '.';
 
 
for( var i = 0; i < format.length; ++i ) {
var current_char = format.charAt(i);
if( in_operator ) {
switch( current_char ) {
case 'i':
current_char = 'd';
break;
case 'F':
current_char = 'f';
break;
case '%':
case 'c':
case 's':
case 'd':
case 'u':
case 'o':
case 'x':
case 'e':
case 'f':
case 'g':
case 'X':
case 'E':
case 'G':
case 'b':
var value = arguments[current_index];
if( vector ) {
result += value.toString().split('').map( function( value ) {
return sprintf.format( current_char, value.charCodeAt(), flags );
}).join( vector_delimiter );
} else {
result += sprintf.format( current_char, value, flags );
}
if( !fixed ) {
++index;
}
current_index = index;
flags = {};
relative = false;
in_operator = false;
precision = false;
fixed = false;
vector = false;
vector_delimiter = '.';
break;
case 'v':
vector = true;
break;
case ' ':
case '0':
case '-':
case '+':
case '#':
flags[current_char] = true;
break;
case '*':
relative = true;
break;
case '.':
precision = true;
break;
default:
break;
}
if( (/\d/).test( current_char ) ) {
var num = parseInt( format.substr( i ) );
var len = num.toString().length;
i += len - 1;
var next = format.charAt( i + 1 );
if( next === '$' ) {
if( num <= 0 || num >= arguments.length ) {
throw "out of bound";
}
if( relative ) {
if( precision ) {
flags.precision = arguments[num];
precision = false;
} else if( format.charAt( i + 2 ) === 'v' ) {
vector_delimiter = arguments[num];
}else {
flags.width = arguments[num];
}
relative = false;
} else {
fixed = true;
current_index = num;
}
++i;
} else if( precision ) {
flags.precision = num;
precision = false;
} else {
flags.width = num;
}
} else if ( relative && !((/\d/).test( format.charAt( i + 1 ) )) ) {
if( precision ) {
flags.precision = arguments[current_index];
precision = false;
} else if( format.charAt( i + 1 ) === 'v' ) {
vector_delimiter = arguments[current_index];
} else {
flags.width = arguments[current_index];
}
++index;
if( !fixed ) {
current_index++;
}
relative = false;
}
} else {
if( current_char === '%' ) {
in_operator = true;
continue;
} else {
result += current_char;
continue;
}
}
}
return result;
}
 
sprintf.format = function sprintfFormat( type, value, flags ) {
 
// Similar to how perl printf works
if( !value ) {
if( type === 's' ) {
return '';
} else {
return '0';
}
}
 
var result;
var prefix = '';
var fill = '';
var fillchar = ' ';
var digits;
switch( type ) {
case '%':
result = '%';
break;
case 'c':
result = String.fromCharCode( parseInt( value ) );
break;
case 's':
result = value.toString();
break;
case 'd':
result = parseInt( value ).toString();
break;
case 'u':
result = Math.abs( parseInt( value ) ).toString(); // it's not correct, but JS lacks unsigned ints
break;
case 'o':
result = Math.abs( parseInt( value ) ).toString(8);
break;
case 'x':
result = Math.abs( parseInt( value ) ).toString(16);
break;
case 'b':
result = Math.abs( parseInt( value ) ).toString(2);
break;
case 'e':
digits = flags.precision ? flags.precision : 6;
result = (new Number( value ) ).toExponential( digits ).toString();
break;
case 'f':
digits = flags.precision ? flags.precision : 6;
result = (new Number( value ) ).toFixed( digits ).toString();
break;
case 'g':
digits = flags.precision ? flags.precision : 6;
result = (new Number( value ) ).toPrecision( digits ).toString();
break;
case 'X':
result = Math.abs( parseInt( value ) ).toString(16).toUpperCase();
break;
case 'E':
digits = flags.precision ? flags.precision : 6;
result = (new Number( value ) ).toExponential( digits ).toString().toUpperCase();
break;
case 'G':
digits = flags.precision ? flags.precision : 6;
result = (new Number( value ) ).toPrecision( digits ).toString().toUpperCase();
break;
default:
throw ("sprintf.format: unrecognized format code " + type.toString());
}
 
if(flags['+'] && parseFloat( value ) > 0 && ['d','e','f','g','E','G'].indexOf(type) !== -1 ) {
prefix = '+';
}
 
if(flags[' '] && parseFloat( value ) > 0 && ['d','e','f','g','E','G'].indexOf(type) !== -1 ) {
prefix = ' ';
}
 
if( flags['#'] && parseInt( value ) !== 0 ) {
switch(type) {
case 'o':
prefix = '0';
break;
case 'x':
case 'X':
prefix = '0x';
break;
case 'b':
prefix = '0b';
break;
default:
break;
}
}
 
if( flags['0'] && !flags['-'] ) {
fillchar = '0';
}
 
if( flags.width && flags.width > ( result.length + prefix.length ) ) {
var tofill = flags.width - result.length - prefix.length;
for( var i = 0; i < tofill; ++i ) {
fill += fillchar;
}
}
 
if( flags['-'] && !flags['0'] ) {
result += fill;
} else {
result = fill + result;
}
 
return prefix + result;
};
 
Line 1,136 ⟶ 761:
tmp /= Math.pow( 10, Bytes.magnitudes[mag] * 3 );
}
if( parseInt( tmp, 10 ) !== tmp ) {
tmp = (new Number( tmp ) ).toPrecision( 4 );
}
return tmp + ' ' + mag + (si?'i':'') + 'B';
} else {
// si per default
Line 1,148 ⟶ 773:
}
tmp = this.value / Math.pow( 2, current * 10 );
if( parseInt( tmp, 10 ) !== tmp ) {
tmp = (new Number( tmp ) ).toPrecision( 4 );
}
return tmp + ' ' + Bytes.rmagnitudes[current] + ( current > 0 ? 'iB' : 'B' );
}
};
 
 
/**
Line 1,160 ⟶ 786:
 
String.prototype.ltrim = function stringPrototypeLtrim( chars ) {
chars = chars || "\\s*";
return this.replace( new RegExp("^[" + chars + "]+", "g"), "" );
};
 
String.prototype.rtrim = function stringPrototypeRtrim( chars ) {
chars = chars || "\\s*";
return this.replace( new RegExp("[" + chars + "]+$", "g"), "" );
};
Line 1,175 ⟶ 801:
String.prototype.splitWeightedByKeys = function stringPrototypeSplitWeightedByKeys( start, end, skip ) {
if( start.length !== end.length ) {
throw new Error( 'start marker and end marker must be of the same length' );
}
var level = 0;
Line 1,186 ⟶ 812:
skip = [ skip ];
} else {
throw new Error( "non-applicable skip parameter" );
}
}
Line 1,264 ⟶ 890:
};
 
// REMOVEME
Array.prototype.chunk = function arrayChunk( size ) {
if( typeof( size ) !== 'number' || size <= 0 ) { // pretty impossible to do anything :)
Line 1,284 ⟶ 909:
/**
* **************** Unbinder ****************
* Used by MediaWiki.commentOutImage
* REMOVEME - no idea what this is for
*/
 
function Unbinder( string ) {
if( typeof( string ) !== 'string' ) {
throw new Error( "not a string" );
}
this.content = string;
Line 1,306 ⟶ 931:
var content = this.content;
content.self = this;
for( var current in this.history ) {
if( this.history.hasOwnProperty( current ) ) {
content = content.replace( current, this.history[current] );
}
}
return content;
},
Line 1,330 ⟶ 957:
/**
* **************** clone() ****************
* REMOVEME - global namespace pollution, and-> move to better name, unused?or
* rework the few usages using jQuery.extend
*/
 
function clone( obj, deep ) {
var objectClone = new obj.constructor();
for ( var property in obj ) {
if ( !deep ) {
objectClone[property] = obj[property];
Line 1,343 ⟶ 971:
objectClone[property] = obj[property];
}
}
return objectClone;
}
 
 
/**
* **************** ln() ****************
* REMOVEME - unused
*/
 
function ln( ns, title ) {
var ns2ln = {
'0': 'la',
'1': 'lat',
'2': 'lu',
'3': 'lut',
'4': 'lw',
'5': 'lwt',
'6': 'li',
'7': 'lit',
'8': 'lm',
'9': 'lmt',
'10': 'lt',
'11': 'ltt',
'12': 'lh',
'13': 'lht',
'14': 'lc',
'15': 'lct',
'100': 'lp',
'101': 'lpt',
'108': 'lb',
'109': 'lbt'
};
return "\{\{" + ns2ln[ns] + "|" + title + "\}\}";
}
 
Line 1,521 ⟶ 1,118:
'108': 'Book',
'109': 'Book talk'
};
 
// Analyzes the HTML of the current page (i.e. no AJAX requests) to determine if it
// is a redirect or soft redirect
Wikipedia.isPageRedirect = function wikipediaIsPageRedirect() {
return !!($("span.redirectText").length > 0 || document.getElementById("softredirect"));
};
 
// we dump all XHR here so they won't loose props
// REMOVEME - onlyafter Wikipedia.wiki usesis thisgone
Wikipedia.dump = [];
 
Line 1,570 ⟶ 1,173:
new Status( Wikipedia.actionCompleted.notice, Wikipedia.actionCompleted.postfix, 'info' );
if( Wikipedia.actionCompleted.redirect ) {
// if it isn't ana urlURL, which is likely, make it anone. relativeTODO: toThis selfbreaks (probablyon thisthe isarticles the'http://', 'ftp://', and similar ones. Are we ever using URL case)redirects?
if( !( (/^\w+\:\/\//).test( Wikipedia.actionCompleted.redirect ) ) ) {
Wikipedia.actionCompleted.redirect = mw.configutil.get( 'wgServer' ) + mw.config.get( 'wgArticlePath' ).replace( '$1', encodeURIComponentwikiGetlink( Wikipedia.actionCompleted.redirect ).replace( /\%2F/g, '/' ) );
if( Wikipedia.actionCompleted.followRedirect === false ) {
Wikipedia.actionCompleted.redirect += "?redirect=no";
Line 1,585 ⟶ 1,188:
// editCount - REMOVEME when Wikipedia.wiki is gone
Wikipedia.editCount = 10;
 
Wikipedia.actionCompleted.timeOut = wpActionCompletedTimeOut;
Wikipedia.actionCompleted.redirect = null;
Line 1,828 ⟶ 1,432:
*
* Watchlist notes:
* 1. The MediaWiki API value of 'unwatch', isn'twhich usedexplicitly hereremoves becausethe itpage seemsfrom to behavethe
* the same as user'nochange'. Not sure why we woulds wantwatchlist, thisis optionnot anywayused.
* 2. If both setWatchlist() and setWatchlistFromPreferences() are called,
* the last call takes priority.
Line 2,506 ⟶ 2,110:
// default on success action - display link for edited page
var link = document.createElement('a');
link.setAttribute('href', mw.configutil.getwikiGetlink('wgArticlePath').replace('$1', ctx.pageName) );
link.appendChild(document.createTextNode(ctx.pageName));
ctx.statusElement.info(['completed (', link, ')']);
Line 2,624 ⟶ 2,228:
var moveToken = $(xml).find('page').attr('movetoken');
if (!moveToken) {
ctx.statusElement.error("Failed to retrieve deletemove token.");
return;
}
Line 2,766 ⟶ 2,370:
/**
* **************** Wikipedia.wiki ****************
* REMOVEME - but *only* after: Twinkle no longer uses it
* (a) Twinkle no longer uses it, and
* (b) we know it's not in use by commonly-used custom scripts
*/
 
Line 2,861 ⟶ 2,463:
} else {
var link = document.createElement( 'a' );
link.setAttribute( 'href', mw.configutil.getwikiGetlink('wgArticlePath').replace( '$1', self.query['title'] ) );
link.setAttribute( 'title', self.query['title'] );
link.appendChild( document.createTextNode( self.query['title'] ) );
Line 2,956 ⟶ 2,558:
for( var i = start; i < text.length; ++i ) {
var test3 = text.substr( i, 3 );
if( test3 === '\{\{\{' ) {
current += '\{\{\{';
i += 2;
++level;
continue;
}
if( test3 === '\}\}\}' ) {
current += '\}\}\}';
i += 2;
--level;
Line 2,969 ⟶ 2,571:
}
var test2 = text.substr( i, 2 );
if( test2 === '\{\{' || test2 === '\[\[' ) {
current += test2;
++i;
Line 2,975 ⟶ 2,577:
continue;
}
if( test2 === '\]\][[' ) {
current += test2;
++i;
Line 2,981 ⟶ 2,583:
continue;
}
if( test2 === '\}\}' ) {
current += test2;
++i;
Line 3,113 ⟶ 2,715:
var first_char = template.substr( 0, 1 );
var template_re_string = "(?:[Tt]emplate:)?\\s*[" + first_char.toUpperCase() + first_char.toLowerCase() + ']' + RegExp.escape( template.substr( 1 ), true );
var links_re = new RegExp( "\\\{\\\{" + template_re_string );
var allTemplates = this.text.splitWeightedByKeys( '{\{', '}}', [ '{{{', '}}}' ] ).uniq();
for( var i = 0; i < allTemplates.length; ++i ) {
if( links_re.test( allTemplates[i] ) ) {
Line 3,134 ⟶ 2,736:
function isInNetwork( ipaddress, network ) {
var iparr = ipaddress.split('.');
var ip = (parseInt(iparr[0], 10) << 24) + (parseInt(iparr[1], 10) << 16) + (parseInt(iparr[2], 10) << 8) + (parseInt(iparr[3], 10));
 
var netmask = 0xffffffff << network.split('/')[1];
 
var netarr = network.split('/')[0].split('.');
var net = (parseInt(netarr[0], 10) << 24) + (parseInt(netarr[1], 10) << 16) + (parseInt(netarr[2], 10) << 8) + (parseInt(netarr[3], 10));
 
return (ip & netmask) === net;
Line 3,297 ⟶ 2,899:
this.stat = this.codify(stat);
this.type = type || 'status';
// hack to force the page not to reload when an error is output - see also update() below
if (type === 'error') {
// hack to force the page not to reload when an error is output - see also update() below
Wikipedia.numberOfActionsLeft = 1000;
// call error callback
if (Status.errorEvent) {
Status.errorEvent();
}
}
this.generate();
Line 3,309 ⟶ 2,915:
Status.init = function( root ) {
if( !( root instanceof Element ) ) {
throw new ExceptionError( 'object not an instance of Element' );
}
while( root.hasChildNodes() ) {
Line 3,315 ⟶ 2,921:
}
Status.root = root;
Status.errorEvent = null;
};
 
Status.root = null;
 
Status.onError = function( handler ) {
if (typeof handler === "function") {
Status.errorEvent = handler;
} else {
throw "Status.onError: handler is not a function";
}
};
 
Status.prototype = {
Line 3,358 ⟶ 2,973:
if( type ) {
this.type = type;
// hack to force the page not to reload when an error is output - see also Status() above
if (type === 'error') {
// hack to force the page not to reload when an error is output - see also Status() above
Wikipedia.numberOfActionsLeft = 1000;
// call error callback
if (Status.errorEvent) {
Status.errorEvent();
}
}
}
Line 3,445 ⟶ 3,064:
buttons: { "Placeholder button": function() {} },
dialogClass: 'morebits-dialog',
width: Math.min(parseInt(window.innerWidth, 10), parseInt(width ? width : 800, 10)),
// give jQuery the given height value (which represents the anticipated height of the dialog) here, so
// it can position the dialog appropriately
Line 3,503 ⟶ 3,122:
}
 
var dialog = $(this.content).dialog("open");
if (window.setupTooltips) { dialog.parent()[0].ranSetupTooltipsAlready = false; setupTooltips(dialog.parent()[0]); } //tie in with NAVPOP
this.setHeight( this.height ); // init height algorithm
},
Line 3,527 ⟶ 3,147:
// note that the given height will exclude the approx. 20px that the jQuery UI chrome has in height in addition to the height
// of an equivalent "classic" SimpleWindow
if (parseInt(getComputedStyle($(this.content).dialog("widget")[0], null).height, 10) > window.innerHeight) {
$(this.content).dialog("option", "height", window.innerHeight - 2).dialog("option", "position", "top");
} else {
$(this.content).dialog("option", "height", "auto");
}
$(this.content).dialog("widget").find(".morebits-dialog-content")[0].style.maxHeight = parseInt(this.height - 30, 10) + "px";
},
// Sets the content of the dialog to the given element node, usually from rendering a QuickForm or QuickForm element.
Line 3,582 ⟶ 3,202:
}
var link = document.createElement("a");
link.setAttribute("href", "/wiki/"mw.util.wikiGetlink(wikiPage) + wikiPage);
link.setAttribute("title", wikiPage);
link.setAttribute("target", "_blank");
Line 3,608 ⟶ 3,228:
};
 
/**
* **************** Twinkle-related stuff ****************
*/
 
// Blacklist was removed per consensus at http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/Archive221#New_Twinkle_blacklist_proposal
 
// Twinkle blacklist was removed per consensus at http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/Archive221#New_Twinkle_blacklist_proposal
// set up configuration of the Twinkle portlet
twAddPortlet.usingTwCfg = (typeof(TwinkleConfig) !== "undefined");
if (skin === 'vector') {
twAddPortlet.portletArea = (twAddPortlet.usingTwCfg && TwinkleConfig.portletArea ? TwinkleConfig.portletArea : 'right-navigation');
twAddPortlet.portletId = (twAddPortlet.usingTwCfg && TwinkleConfig.portletId ? TwinkleConfig.portletId : 'p-twinkle');
twAddPortlet.portletName = (twAddPortlet.usingTwCfg && TwinkleConfig.portletName ? TwinkleConfig.portletName : 'TW');
twAddPortlet.portletType = (twAddPortlet.usingTwCfg && TwinkleConfig.portletType ? TwinkleConfig.portletType : 'menu');
twAddPortlet.portletNext = (twAddPortlet.usingTwCfg && TwinkleConfig.portletNext ? TwinkleConfig.portletNext : 'p-search');
} else {
twAddPortlet.portletId = (twAddPortlet.usingTwCfg && TwinkleConfig.portletId ? TwinkleConfig.portletId : 'p-cactions');
}
 
// check if account is experienced enough for more advanced functions
// This may be useful to other user scripts.
var twinkleUserAuthorized = userIsInGroup( 'autoconfirmed' ) || userIsInGroup( 'confirmed' );
 
// </nowiki>
// flag to let script loaders know that this module has already been loaded
var morebits_js_loaded = true; // legacy version
var morebits_v2_js_loaded = true; // version enhanced for HTML5