Skip to content

Commit

Permalink
morebits: remove Morebits.wikipedia
Browse files Browse the repository at this point in the history
Based on the discussion at wikimedia-gadgets#103, specifically [this comment](wikimedia-gadgets#103 (comment)).

On enwiki, Morebits.wikipedia.namespaces is just a copy of mw.config.get('wgFormattedNamespaces').
On other wikis, it is useless. mw.config.get('wgFormattedNamespaces') is better as it shows localised
namespaces names across different wikis.

Morebits.wikipedia.namespacesFriendly (also enwiki-only) is used just once in the codebase. This usage
has been changed to use wgFormattedNamespaces.

Also removed the 8-year-old comment noting the removal of Twinkle blacklist by someone, because it has
nothing to do with morebits.
  • Loading branch information
siddharthvp committed Apr 24, 2019
1 parent f11d797 commit 9a862c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 76 deletions.
2 changes: 1 addition & 1 deletion modules/twinklespeedy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ Twinkle.speedy.callbacks = {
if (params.deleteTalkPage &&
params.normalized !== 'f8' &&
document.getElementById( 'ca-talk' ).className !== 'new') {
var talkpage = new Morebits.wiki.page( Morebits.wikipedia.namespaces[ mw.config.get('wgNamespaceNumber') + 1 ] + ':' + mw.config.get('wgTitle'), "Deleting talk page" );
var talkpage = new Morebits.wiki.page( mw.config.get('wgFormattedNamespaces')[ mw.config.get('wgNamespaceNumber') + 1 ] + ':' + mw.config.get('wgTitle'), "Deleting talk page" );
talkpage.setEditSummary('[[WP:CSD#G8|G8]]: Talk page of deleted page "' + Morebits.pageNameNorm + '"' + Twinkle.getPref('deletionSummaryAd'));
talkpage.deletePage();
// this is ugly, but because of the architecture of wiki.api, it is needed
Expand Down
6 changes: 4 additions & 2 deletions modules/twinkleunlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ Twinkle.unlink.callbacks = {
apiobj.params.form.append( { type:'header', label: 'File usage' } );
namespaces = [];
$.each(Twinkle.getPref('unlinkNamespaces'), function(k, v) {
namespaces.push(Morebits.wikipedia.namespacesFriendly[v]);
var nsName = mw.config.get('wgFormattedNamespaces')[v];
namespaces.push(nsName === '' ? '(Article)' : nsName);
});
apiobj.params.form.append( {
type: 'div',
Expand Down Expand Up @@ -210,7 +211,8 @@ Twinkle.unlink.callbacks = {
apiobj.params.form.append( { type:'header', label: 'Backlinks' } );
namespaces = [];
$.each(Twinkle.getPref('unlinkNamespaces'), function(k, v) {
namespaces.push(Morebits.wikipedia.namespacesFriendly[v]);
var nsName = mw.config.get('wgFormattedNamespaces')[v];
namespaces.push(nsName === '' ? '(Article)' : nsName);
});
apiobj.params.form.append( {
type: 'div',
Expand Down
74 changes: 1 addition & 73 deletions morebits.js
Original file line number Diff line number Diff line change
Expand Up @@ -1306,79 +1306,7 @@ Date.prototype.getUTCMonthNameAbbrev = function() {
};



/**
* **************** Morebits.wikipedia ****************
* English Wikipedia-specific objects
*/

Morebits.wikipedia = {};

Morebits.wikipedia.namespaces = {
'-2': 'Media',
'-1': 'Special',
'0': '',
'1': 'Talk',
'2': 'User',
'3': 'User talk',
'4': 'Project',
'5': 'Project talk',
'6': 'File',
'7': 'File talk',
'8': 'MediaWiki',
'9': 'MediaWiki talk',
'10': 'Template',
'11': 'Template talk',
'12': 'Help',
'13': 'Help talk',
'14': 'Category',
'15': 'Category talk',
'100': 'Portal',
'101': 'Portal talk',
'108': 'Book',
'109': 'Book talk',
'118': 'Draft',
'119': 'Draft talk',
'446': 'Education Program',
'447': 'Education Program talk',
'710': 'TimedText',
'711': 'TimedText talk',
'828': 'Module',
'829': 'Module talk'
};

Morebits.wikipedia.namespacesFriendly = {
'0': '(Article)',
'1': 'Talk',
'2': 'User',
'3': 'User talk',
'4': 'Wikipedia',
'5': 'Wikipedia talk',
'6': 'File',
'7': 'File talk',
'8': 'MediaWiki',
'9': 'MediaWiki talk',
'10': 'Template',
'11': 'Template talk',
'12': 'Help',
'13': 'Help talk',
'14': 'Category',
'15': 'Category talk',
'100': 'Portal',
'101': 'Portal talk',
'108': 'Book',
'109': 'Book talk',
'118': 'Draft',
'119': 'Draft talk',
'446': 'Education Program',
'447': 'Education Program talk',
'710': 'TimedText',
'711': 'TimedText talk',
'828': 'Module',
'829': 'Module talk'
};


// Morebits.wikipedia.namespaces is deprecated - use mw.config.get('wgFormattedNamespaces') or mw.config.get('wgNamespaceIds') instead

/**
* **************** Morebits.wiki ****************
Expand Down

0 comments on commit 9a862c4

Please sign in to comment.