Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git@github.com:azatoth/twinkle.git

  • Loading branch information...
commit d985b54dc699815f24d6c0e81fc93274fe6b5879 2 parents b7835c7 + 06f8a62
@atlight atlight authored
View
2  modules/twinkledeprod.js
@@ -140,7 +140,7 @@
page.deletePage();
page = new Wikipedia.page(self.params.page, "Deleting article");
- page.setEditSummary("DDeleted because expired [[WP:PROD]]; Reason given: " + self.params.reason + "." + Twinkle.getPref('deletionSummaryAd'));
+ page.setEditSummary("Deleted because expired [[WP:PROD]]; Reason given: " + self.params.reason + "." + Twinkle.getPref('deletionSummaryAd'));
page.deletePage();
View
4 modules/twinklediff.js
@@ -18,7 +18,7 @@ Twinkle.diff = function twinklediff() {
'oldid': 'prev'
};
- twAddPortletLink( mw.util.wikiScript("index")+ "?" + jQuery.param( query ), 'Last', 'tw-lastdiff', 'Show most recent diff' );
+ twAddPortletLink( mw.util.wikiScript("index")+ "?" + $.param( query ), 'Last', 'tw-lastdiff', 'Show most recent diff' );
// Show additional tabs only on diff pages
if (QueryString.exists('diff')) {
@@ -31,7 +31,7 @@ Twinkle.diff = function twinklediff() {
'diff': 'cur',
'oldid' : oldid
};
- twAddPortletLink( mw.util.wikiScript("index")+ "?" + jQuery.param( query ), 'Current', 'tw-curdiff', 'Show difference to current revision' );
+ twAddPortletLink( mw.util.wikiScript("index")+ "?" + $.param( query ), 'Current', 'tw-curdiff', 'Show difference to current revision' );
}
};
View
60 morebits.js
@@ -30,8 +30,10 @@
*/
-var Morebits = {};
+( function ( $, undefined ) { // Wrap with anonymous function
+var Morebits = {};
+window.Morebits = Morebits; // allow global access
/**
@@ -39,7 +41,7 @@ var Morebits = {};
* Simple helper function to see what groups a user might belong
*/
-function userIsInGroup( group ) {
+window.userIsInGroup = function ( group ) {
return $.inArray(group, mw.config.get( 'wgUserGroups' )) !== -1;
}
@@ -57,7 +59,7 @@ Morebits.RE_IP_ADD = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[0-9])\.){3
Morebits.RE_IPV6_ADD = /^(?::(?::|(?::[0-9A-Fa-f]{1,4}){1,7})|[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6}::|[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){7})$/;
Morebits.RE_IPV6_ADD2 = /^[0-9A-Fa-f]{1,4}(?:::?[0-9A-Fa-f]{1,4}){1,6}$/;
-function isIPAddress( address ) {
+window.isIPAddress = function ( address ) {
return address.search( Morebits.RE_IP_ADD ) !== -1 || // IPv4
address.search( Morebits.RE_IPV6_ADD ) !== -1 || // IPv6
(address.search( Morebits.RE_IPV6_ADD2 ) !== -1 && address.search( /::/ ) !== -1 && address.search( /::.*::/ ) === -1);
@@ -110,6 +112,8 @@ var QuickForm = function QuickForm( event, eventType ) {
this.root = new QuickForm.element( { type: 'form', event: event, eventType:eventType } );
};
+window.QuickForm = QuickForm; // allow global access
+
QuickForm.prototype.render = function QuickFormRender() {
var ret = this.root.render();
ret.names = {};
@@ -303,7 +307,7 @@ QuickForm.element.prototype.compute = function QuickFormElementCompute( data, in
e.target.parentNode.appendChild( e.target.subgroup );
if( e.target.type === 'radio' ) {
var name = e.target.name;
- if( typeof e.target.form.names[name] !== 'undefined' ) {
+ if( e.target.form.names[name] !== undefined ) {
e.target.form.names[name].parentNode.removeChild( e.target.form.names[name].subgroup );
}
e.target.form.names[name] = e.target;
@@ -320,7 +324,7 @@ QuickForm.element.prototype.compute = function QuickFormElementCompute( data, in
event = function(e) {
if( e.target.checked ) {
var name = e.target.name;
- if( typeof e.target.form.names[name] !== 'undefined' ) {
+ if( e.target.form.names[name] !== undefined ) {
e.target.form.names[name].parentNode.removeChild( e.target.form.names[name].subgroup );
}
delete e.target.form.names[name];
@@ -479,7 +483,7 @@ QuickForm.element.prototype.compute = function QuickFormElementCompute( data, in
node.setAttribute( 'name', data.name );
}
if (data.label) {
- if ( !( data.label instanceof Array ) ) {
+ if ( ! $.isArray( data.label ) ) {
data.label = [ data.label ];
}
var result = document.createElement( 'span' );
@@ -692,6 +696,8 @@ var Bytes = function( value ) {
}
};
+window.Bytes = Bytes; // allow global access
+
Bytes.magnitudes = {
'': 0,
'K': 1,
@@ -792,8 +798,8 @@ Morebits.string = {
var level = 0;
var initial = null;
var result = [];
- if( !( skip instanceof Array ) ) {
- if( typeof skip === 'undefined' ) {
+ if( ! $.isArray( skip ) ) {
+ if( skip === undefined ) {
skip = [];
} else if( typeof skip === 'string' ) {
skip = [ skip ];
@@ -843,7 +849,7 @@ Morebits.string = {
Morebits.array = {
uniq: function(arr) {
- if (!($.isArray(arr))) {
+ if ( ! $.isArray( arr ) ) {
throw "A non-array object passed to Morebits.array.uniq";
}
var result = [];
@@ -856,7 +862,7 @@ Morebits.array = {
return result;
},
dups: function(arr) {
- if (!($.isArray(arr))) {
+ if ( ! $.isArray( arr ) ) {
throw "A non-array object passed to Morebits.array.dups";
}
var uniques = [];
@@ -872,7 +878,7 @@ Morebits.array = {
return result;
},
chunk: function( arr, size ) {
- if (!($.isArray(arr))) {
+ if ( ! $.isArray( arr ) ) {
throw "A non-array object passed to Morebits.array.chunk";
}
if( typeof size !== 'number' || size <= 0 ) { // pretty impossible to do anything :)
@@ -880,7 +886,7 @@ Morebits.array = {
}
var result = [];
var current;
- for(var i = 0; i < arr.length; ++i ) {
+ for( var i = 0; i < arr.length; ++i ) {
if( i % size === 0 ) { // when 'i' is 0, this is always true, so we start by creating one.
current = [];
result.push( current );
@@ -930,6 +936,8 @@ function Unbinder( string ) {
this.postfix = '::UNIQ%';
}
+window.Unbinder = Unbinder; // allow global access
+
Unbinder.prototype = {
unbind: function UnbinderUnbind( prefix, postfix ) {
var re = new RegExp( prefix + '(.*?)' + postfix, 'g' );
@@ -1026,6 +1034,8 @@ Date.prototype.getUTCMonthNameAbbrev = function() {
var Wikipedia = {};
+window.Wikipedia = Wikipedia; // allow global access
+
Wikipedia.namespaces = {
'-2': 'Media',
'-1': 'Special',
@@ -1137,7 +1147,8 @@ Wikipedia.actionCompleted.event = function() {
window.setTimeout( function() { window.location = Wikipedia.actionCompleted.redirect; }, Wikipedia.actionCompleted.timeOut );
}
};
-var wpActionCompletedTimeOut = ( typeof wpActionCompletedTimeOut === 'undefined' ? 5000 : wpActionCompletedTimeOut );
+var wpActionCompletedTimeOut = ( window.wpActionCompletedTimeOut === undefined ? 5000 : window.wpActionCompletedTimeOut );
+window.wpActionCompletedTimeOut = wpActionCompletedTimeOut; // allow global access
// editCount - REMOVEME when Wikipedia.wiki is gone
Wikipedia.editCount = 10;
@@ -2554,6 +2565,8 @@ Wikipedia.wiki.prototype = {
var Mediawiki = {};
+window.Mediawiki = Mediawiki; // allow global access
+
Mediawiki.Template = {
parse: function( text, start ) {
var count = -1;
@@ -2791,6 +2804,8 @@ var QueryString = function(qString) {
}
};
+window.QueryString = QueryString; // allow global access
+
QueryString.staticstr = null;
QueryString.staticInit = function() {
@@ -2839,11 +2854,11 @@ QueryString.create = function( arr ) {
var resarr = [];
var editToken; // KLUGE: this should always be the last item in the query string (bug TW-B-0013)
for( var i in arr ) {
- if( typeof arr[i] === 'undefined' ) {
+ if( arr[i] === undefined ) {
continue;
}
var res;
- if( arr[i] instanceof Array ){
+ if( $.isArray( arr[i] ) ){
var v = [];
for(var j = 0; j < arr[i].length; ++j ) {
v[j] = encodeURIComponent( arr[i][j] );
@@ -2858,7 +2873,7 @@ QueryString.create = function( arr ) {
resarr.push( encodeURIComponent( i ) + '=' + res );
}
}
- if( typeof editToken !== 'undefined' ) {
+ if( editToken !== undefined ) {
resarr.push( 'wpEditToken=' + editToken );
}
return resarr.join('&');
@@ -2889,6 +2904,8 @@ var Status = function( text, stat, type ) {
}
};
+window.Status = Status; // allow global access
+
Status.init = function( root ) {
if( !( root instanceof Element ) ) {
throw new Error( 'object not an instance of Element' );
@@ -2903,7 +2920,7 @@ Status.init = function( root ) {
Status.root = null;
Status.onError = function( handler ) {
- if (typeof handler === "function") {
+ if ( $.isFunction( handler ) ) {
Status.errorEvent = handler;
} else {
throw "Status.onError: handler is not a function";
@@ -2930,7 +2947,7 @@ Status.prototype = {
}
},
codify: function( obj ) {
- if ( ! ( obj instanceof Array ) ) {
+ if ( ! $.isArray( obj ) ) {
obj = [ obj ];
}
var result;
@@ -3009,7 +3026,7 @@ Status.error = function( text, status ) {
* XXX rewrite more flexibly, and place under an object, for example QuickNode.create
*/
-function htmlNode( type, content, color ) {
+window.htmlNode = function ( type, content, color ) {
var node = document.createElement( type );
if( color ) {
node.style.color = color;
@@ -3073,6 +3090,8 @@ var SimpleWindow = function( width, height ) {
$widget.find(".ui-dialog-buttonpane").append(buttonspan, linksspan);
};
+window.SimpleWindow = SimpleWindow; // allow global access
+
SimpleWindow.prototype = {
buttons: [],
height: 600,
@@ -3203,8 +3222,9 @@ SimpleWindow.setButtonsEnabled = function( enabled ) {
};
-
// Twinkle blacklist was removed per consensus at http://en.wikipedia.org/wiki/Wikipedia:Administrators%27_noticeboard/Archive221#New_Twinkle_blacklist_proposal
+} ( jQuery )); // End wrap with anonymous function
+
// </nowiki>
View
2  twinkle.footer.js
@@ -2,7 +2,7 @@
* General initialization code
*/
-var scriptpathbefore = mw.config.get( "wgServer" ) + mw.config.get( "wgScript" ) + "?title=";
+var scriptpathbefore = mw.util.wikiScript( "index" ) + "?title=";
var scriptpathafter = "&action=raw&ctype=text/javascript&happy=yes";
// Retrieve the user's Twinkle preferences
Please sign in to comment.
Something went wrong with that request. Please try again.