r62400 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62399‎ | r62400 | r62401 >
Date:00:00, 13 February 2010
Author:catrope
Status:ok
Tags:
Comment:
wmf-deployment: Merge r62341, r62371 from trunk
Modified paths:
  • /branches/wmf-deployment/extensions/UsabilityInitiative (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/OptIn (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/OptIn
___________________________________________________________________
Name: svn:mergeinfo
11 - /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:51646
/trunk/extensions/UsabilityInitiative/OptIn:56207,56209,56296,56333,56355,62041,62043,62127,62139-62140,62142-62143,62145-62146,62256,62263,62274,62380,62384,62392-62396
/trunk/phase3/extensions/UsabilityInitiative/OptIn:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
22 + /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:51646
/trunk/extensions/UsabilityInitiative/OptIn:56207,56209,56296,56333,56355,62041,62043,62127,62139-62140,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396
/trunk/phase3/extensions/UsabilityInitiative/OptIn:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
___________________________________________________________________
Name: svn:mergeinfo
33 - /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62380,62384,62392-62396
44 + /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js
___________________________________________________________________
Name: svn:mergeinfo
55 - /trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62380,62384,62392-62396
66 + /trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -77,15 +77,33 @@
7878 * is essentially to blacklist rather than whitelist are debateable, but at this point we've decided it's the more
7979 * "open-web" way to go.
8080 */
81 - 'isSupported': function() {
82 - // Check for and make use of a cached return value
83 - if ( typeof $.wikiEditor.supported != 'undefined' ) {
84 - return $.wikiEditor.supported;
 81+ 'isSupported': function( module ) {
 82+ // Check for and make use of cached value and early opportunities to bail
 83+ if ( module ) {
 84+ // If the module doesn't exist, it's clearly not supported
 85+ if ( typeof $.wikiEditor.modules[module] == 'undefined' ) {
 86+ return false;
 87+ } else if ( typeof $.wikiEditor.modules[module].supported !== 'undefined' ) {
 88+ // Cache hit
 89+ return $.wikiEditor.modules[module].supported;
 90+ }
 91+ } else {
 92+ if ( typeof $.wikiEditor.supported !== 'undefined' ) {
 93+ // Cache hit
 94+ return $.wikiEditor.supported;
 95+ }
8596 }
 97+ // Provide quick way to cache support
 98+ function cacheSupport( value ) {
 99+ return module ? $.wikiEditor.modules[module].supported = value : $.wikiEditor.supported = value;
 100+ }
 101+ // Fallback to the wikiEditor browser map if no special map is provided in the module
 102+ var map = module && 'browsers' in $.wikiEditor.modules[module] ?
 103+ $.wikiEditor.modules[module].browsers : $.wikiEditor.browsers;
86104 // Check if we have any compatiblity information on-hand for the current browser
87105 if ( !( $.browser.name in $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) {
88106 // Assume good faith :)
89 - return $.wikiEditor.supported = true;
 107+ return cacheSupport( true );
90108 }
91109 // Check over each browser condition to determine if we are running in a compatible client
92110 var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name];
@@ -94,16 +112,16 @@
95113 var val = browser[condition][1];
96114 if ( typeof val == 'string' ) {
97115 if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) {
98 - return $.wikiEditor.supported = false;
 116+ return cacheSupport( false );
99117 }
100118 } else if ( typeof val == 'number' ) {
101119 if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) {
102 - return $.wikiEditor.supported = false;
 120+ return cacheSupport( false );
103121 }
104122 }
105123 }
106124 // Return and also cache the return value - this will be checked somewhat often
107 - return $.wikiEditor.supported = true;
 125+ return cacheSupport( true );
108126 },
109127 /**
110128 * Provides a way to extract messages from objects. Wraps the mw.usability.getMsg() function, which
@@ -236,8 +254,8 @@
237255 modules = data;
238256 }
239257 for ( var module in modules ) {
240 - // Check for the existance of an available module with a matching name and a create function
241 - if ( typeof module == 'string' && module in $.wikiEditor.modules ) {
 258+ // Check for the existance of an available / supported module with a matching name and a create function
 259+ if ( typeof module == 'string' && $.wikiEditor.isSupported( module ) ) {
242260 // Extend the context's core API with this module's own API calls
243261 if ( 'api' in $.wikiEditor.modules[module] ) {
244262 for ( var call in $.wikiEditor.modules[module].api ) {
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6510,15 +6510,33 @@
65116511 * is essentially to blacklist rather than whitelist are debateable, but at this point we've decided it's the more
65126512 * "open-web" way to go.
65136513 */
6514 - 'isSupported': function() {
6515 - // Check for and make use of a cached return value
6516 - if ( typeof $.wikiEditor.supported != 'undefined' ) {
6517 - return $.wikiEditor.supported;
 6514+ 'isSupported': function( module ) {
 6515+ // Check for and make use of cached value and early opportunities to bail
 6516+ if ( module ) {
 6517+ // If the module doesn't exist, it's clearly not supported
 6518+ if ( typeof $.wikiEditor.modules[module] == 'undefined' ) {
 6519+ return false;
 6520+ } else if ( typeof $.wikiEditor.modules[module].supported !== 'undefined' ) {
 6521+ // Cache hit
 6522+ return $.wikiEditor.modules[module].supported;
 6523+ }
 6524+ } else {
 6525+ if ( typeof $.wikiEditor.supported !== 'undefined' ) {
 6526+ // Cache hit
 6527+ return $.wikiEditor.supported;
 6528+ }
65186529 }
 6530+ // Provide quick way to cache support
 6531+ function cacheSupport( value ) {
 6532+ return module ? $.wikiEditor.modules[module].supported = value : $.wikiEditor.supported = value;
 6533+ }
 6534+ // Fallback to the wikiEditor browser map if no special map is provided in the module
 6535+ var map = module && 'browsers' in $.wikiEditor.modules[module] ?
 6536+ $.wikiEditor.modules[module].browsers : $.wikiEditor.browsers;
65196537 // Check if we have any compatiblity information on-hand for the current browser
65206538 if ( !( $.browser.name in $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) {
65216539 // Assume good faith :)
6522 - return $.wikiEditor.supported = true;
 6540+ return cacheSupport( true );
65236541 }
65246542 // Check over each browser condition to determine if we are running in a compatible client
65256543 var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name];
@@ -6527,16 +6545,16 @@
65286546 var val = browser[condition][1];
65296547 if ( typeof val == 'string' ) {
65306548 if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) {
6531 - return $.wikiEditor.supported = false;
 6549+ return cacheSupport( false );
65326550 }
65336551 } else if ( typeof val == 'number' ) {
65346552 if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) {
6535 - return $.wikiEditor.supported = false;
 6553+ return cacheSupport( false );
65366554 }
65376555 }
65386556 }
65396557 // Return and also cache the return value - this will be checked somewhat often
6540 - return $.wikiEditor.supported = true;
 6558+ return cacheSupport( true );
65416559 },
65426560 /**
65436561 * Provides a way to extract messages from objects. Wraps the mw.usability.getMsg() function, which
@@ -6669,8 +6687,8 @@
66706688 modules = data;
66716689 }
66726690 for ( var module in modules ) {
6673 - // Check for the existance of an available module with a matching name and a create function
6674 - if ( typeof module == 'string' && module in $.wikiEditor.modules ) {
 6691+ // Check for the existance of an available / supported module with a matching name and a create function
 6692+ if ( typeof module == 'string' && $.wikiEditor.isSupported( module ) ) {
66756693 // Extend the context's core API with this module's own API calls
66766694 if ( 'api' in $.wikiEditor.modules[module] ) {
66776695 for ( var call in $.wikiEditor.modules[module].api ) {
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -436,14 +436,15 @@
437437 options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;}
438438 var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;}
439439 retval=(hasIframe?context.fn:fn)[command].call(this,options);if(hasIframe&&needSave){context.fn.saveSelection();}
440 -return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(){if(typeof $.wikiEditor.supported!='undefined'){return $.wikiEditor.supported;}
441 -if(!($.browser.name in $.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'])){return $.wikiEditor.supported=true;}
442 -var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return $.wikiEditor.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return $.wikiEditor.supported=false;}}}
443 -return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
 440+return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',4]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){if(module){if(typeof $.wikiEditor.modules[module]=='undefined'){return false;}else if(typeof $.wikiEditor.modules[module].supported!=='undefined'){return $.wikiEditor.modules[module].supported;}}else{if(typeof $.wikiEditor.supported!=='undefined'){return $.wikiEditor.supported;}}
 441+function cacheSupport(value){return module?$.wikiEditor.modules[module].supported=value:$.wikiEditor.supported=value;}
 442+var map=module&&'browsers'in $.wikiEditor.modules[module]?$.wikiEditor.modules[module].browsers:$.wikiEditor.browsers;if(!($.browser.name in $.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'])){return cacheSupport(true);}
 443+var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return cacheSupport(false);}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return cacheSupport(false);}}}
 444+return cacheSupport(true);},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
444445 if(property in object){return object[property];}else if(property+'Msg'in object){if(typeof object[property+'Msg']=='object'){return mw.usability.getMsg.apply(mw.usability,object[property+'Msg']);}else{return mw.usability.getMsg(object[property+'Msg']);}}else{return'';}},'autoLang':function(object,lang){return object[lang||wgUserLanguage]||object['default']||object;},'autoIcon':function(icon,path,lang){var src=$.wikiEditor.autoLang(icon,lang);path=path||$.wikiEditor.imgPath;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/'){src=path+src;}
445446 return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);}
446447 var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'savedSelection':null,'history':[],'historyPosition':-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;}
447 -for(var module in modules){if(typeof module=='string'&&module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}
 448+for(var module in modules){if(typeof module=='string'&&$.wikiEditor.isSupported(module)){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}
448449 if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
449450 return false;}
450451 break;case 86:if(event.ctrlKey){context.evt.paste(event);}
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative
___________________________________________________________________
Name: svn:mergeinfo
451452 - /branches/REL1_15/phase3/extensions/UsabilityInitiative:51646
/trunk/extensions/UsabilityInitiative:56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62380,62384,62392-62396
/trunk/phase3/extensions/UsabilityInitiative:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
452453 + /branches/REL1_15/phase3/extensions/UsabilityInitiative:51646
/trunk/extensions/UsabilityInitiative:56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396
/trunk/phase3/extensions/UsabilityInitiative:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62341Finished the per-module isSupported system.tparscal23:16, 11 February 2010
r62371Cleaned up some messy code from r62341.tparscal17:47, 12 February 2010

Status & tagging log