Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js |
— | — | @@ -2,35 +2,41 @@ |
3 | 3 | /* First draft and will be changing greatly */ |
4 | 4 | |
5 | 5 | $j(document).ready( function() { |
6 | | - if( !wgVectorEnabledModules.collapsiblenav ) { |
| 6 | + if ( !wgVectorEnabledModules.collapsiblenav ) { |
7 | 7 | return true; |
8 | 8 | } |
9 | | - var mod = { |
10 | | - 'browsers': { |
11 | | - // Left-to-right languages |
12 | | - 'ltr': { |
13 | | - // Collapsible Nav is broken in Opera < 9.6 and Konqueror < 4 |
14 | | - 'opera': [['>=', 9.6]], |
15 | | - 'konqueror': [['>=', 4.0]], |
16 | | - 'blackberry': false, |
17 | | - 'ipod': false, |
18 | | - 'iphone': false, |
19 | | - 'ps3': false |
20 | | - }, |
21 | | - // Right-to-left languages |
22 | | - 'rtl': { |
23 | | - 'opera': [['>=', 9.6]], |
24 | | - 'konqueror': [['>=', 4.0]], |
25 | | - 'blackberry': false, |
26 | | - 'ipod': false, |
27 | | - 'iphone': false, |
28 | | - 'ps3': false |
29 | | - } |
| 9 | + |
| 10 | + /* Browser Support */ |
| 11 | + |
| 12 | + var map = { |
| 13 | + // Left-to-right languages |
| 14 | + 'ltr': { |
| 15 | + // Collapsible Nav is broken in Opera < 9.6 and Konqueror < 4 |
| 16 | + 'msie': [['>=', 7]], |
| 17 | + 'opera': [['>=', 9.6]], |
| 18 | + 'konqueror': [['>=', 4.0]], |
| 19 | + 'blackberry': false, |
| 20 | + 'ipod': false, |
| 21 | + 'iphone': false, |
| 22 | + 'ps3': false |
| 23 | + }, |
| 24 | + // Right-to-left languages |
| 25 | + 'rtl': { |
| 26 | + 'msie': [['>=', 7]], |
| 27 | + 'opera': [['>=', 9.6]], |
| 28 | + 'konqueror': [['>=', 4.0]], |
| 29 | + 'blackberry': false, |
| 30 | + 'ipod': false, |
| 31 | + 'iphone': false, |
| 32 | + 'ps3': false |
30 | 33 | } |
31 | 34 | }; |
32 | | - if ( !$j.wikiEditor.isSupported( mod ) ) { |
| 35 | + if ( !mw.usability.testBrowser( map ) ) { |
33 | 36 | return true; |
34 | 37 | } |
| 38 | + |
| 39 | + /* Bucket Testing */ |
| 40 | + |
35 | 41 | // Fallback to old version |
36 | 42 | var version = 1; |
37 | 43 | // Allow new version override |
— | — | @@ -49,6 +55,9 @@ |
50 | 56 | } |
51 | 57 | } |
52 | 58 | } |
| 59 | + |
| 60 | + /* Special Language Portal Handling */ |
| 61 | + |
53 | 62 | // Language portal splitting feature (if it's turned on) |
54 | 63 | if ( version == 2 ) { |
55 | 64 | // How many links to show in the primary languages portal |
— | — | @@ -142,6 +151,9 @@ |
143 | 152 | // Always show the primary interwiki language portal |
144 | 153 | $j( '#p-lang' ).addClass( 'persistent' ); |
145 | 154 | } |
| 155 | + |
| 156 | + /* General Portal Modification */ |
| 157 | + debugger; |
146 | 158 | // Always show the first portal |
147 | 159 | $j( '#mw-panel > div.portal:first' ).addClass( 'first persistent' ); |
148 | 160 | // Apply a class to the entire panel to activate styles |
— | — | @@ -179,23 +191,18 @@ |
180 | 192 | .find( 'div.body' ) |
181 | 193 | .slideToggle( 'fast' ); |
182 | 194 | } |
| 195 | + |
| 196 | + /* Tab Indexing */ |
| 197 | + |
183 | 198 | var $headings = $j( '#mw-panel > div.portal:not(.persistent) > h5' ); |
184 | | - /** Copy-pasted from jquery.wikiEditor.dialogs - :( */ |
185 | | - // Find the highest tabindex in use |
186 | | - var maxTI = 0; |
187 | | - $j( '[tabindex]' ).each( function() { |
188 | | - var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
189 | | - if ( ti > maxTI ) |
190 | | - maxTI = ti; |
191 | | - }); |
192 | | - var tabIndex = maxTI + 1; |
| 199 | + // Get the highest tab index |
| 200 | + var tabIndex = mw.usability.getMaxTabIndex() + 1; |
193 | 201 | // Fix the search not having a tabindex |
194 | 202 | $j( '#searchInput' ).attr( 'tabindex', tabIndex++ ); |
195 | 203 | // Make it keyboard accessible |
196 | 204 | $headings.each( function() { |
197 | 205 | $j(this).attr( 'tabindex', tabIndex++ ); |
198 | 206 | } ); |
199 | | - /** End of copy-pasted section */ |
200 | 207 | // Toggle the selected menu's class and expand or collapse the menu |
201 | 208 | $headings |
202 | 209 | // Make the space and enter keys act as a click |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | static $scripts = array( |
15 | 15 | 'raw' => array( |
16 | | - array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 23 ), |
| 16 | + array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 24 ), |
17 | 17 | array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 8 ), |
18 | 18 | array( 'src' => 'Modules/ExpandableSearch/ExpandableSearch.js', 'version' => 3 ), |
19 | 19 | array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 8 ), |
— | — | @@ -20,10 +20,10 @@ |
21 | 21 | array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 15 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'Vector.combined.js', 'version' => 47 ), |
| 24 | + array( 'src' => 'Vector.combined.js', 'version' => 48 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'Vector.combined.min.js', 'version' => 47 ), |
| 27 | + array( 'src' => 'Vector.combined.min.js', 'version' => 48 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $modules = array( |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -2,35 +2,41 @@ |
3 | 3 | /* First draft and will be changing greatly */ |
4 | 4 | |
5 | 5 | $j(document).ready( function() { |
6 | | - if( !wgVectorEnabledModules.collapsiblenav ) { |
| 6 | + if ( !wgVectorEnabledModules.collapsiblenav ) { |
7 | 7 | return true; |
8 | 8 | } |
9 | | - var mod = { |
10 | | - 'browsers': { |
11 | | - // Left-to-right languages |
12 | | - 'ltr': { |
13 | | - // Collapsible Nav is broken in Opera < 9.6 and Konqueror < 4 |
14 | | - 'opera': [['>=', 9.6]], |
15 | | - 'konqueror': [['>=', 4.0]], |
16 | | - 'blackberry': false, |
17 | | - 'ipod': false, |
18 | | - 'iphone': false, |
19 | | - 'ps3': false |
20 | | - }, |
21 | | - // Right-to-left languages |
22 | | - 'rtl': { |
23 | | - 'opera': [['>=', 9.6]], |
24 | | - 'konqueror': [['>=', 4.0]], |
25 | | - 'blackberry': false, |
26 | | - 'ipod': false, |
27 | | - 'iphone': false, |
28 | | - 'ps3': false |
29 | | - } |
| 9 | + |
| 10 | + /* Browser Support */ |
| 11 | + |
| 12 | + var map = { |
| 13 | + // Left-to-right languages |
| 14 | + 'ltr': { |
| 15 | + // Collapsible Nav is broken in Opera < 9.6 and Konqueror < 4 |
| 16 | + 'msie': [['>=', 7]], |
| 17 | + 'opera': [['>=', 9.6]], |
| 18 | + 'konqueror': [['>=', 4.0]], |
| 19 | + 'blackberry': false, |
| 20 | + 'ipod': false, |
| 21 | + 'iphone': false, |
| 22 | + 'ps3': false |
| 23 | + }, |
| 24 | + // Right-to-left languages |
| 25 | + 'rtl': { |
| 26 | + 'msie': [['>=', 7]], |
| 27 | + 'opera': [['>=', 9.6]], |
| 28 | + 'konqueror': [['>=', 4.0]], |
| 29 | + 'blackberry': false, |
| 30 | + 'ipod': false, |
| 31 | + 'iphone': false, |
| 32 | + 'ps3': false |
30 | 33 | } |
31 | 34 | }; |
32 | | - if ( !$j.wikiEditor.isSupported( mod ) ) { |
| 35 | + if ( !mw.usability.testBrowser( map ) ) { |
33 | 36 | return true; |
34 | 37 | } |
| 38 | + |
| 39 | + /* Bucket Testing */ |
| 40 | + |
35 | 41 | // Fallback to old version |
36 | 42 | var version = 1; |
37 | 43 | // Allow new version override |
— | — | @@ -49,6 +55,9 @@ |
50 | 56 | } |
51 | 57 | } |
52 | 58 | } |
| 59 | + |
| 60 | + /* Special Language Portal Handling */ |
| 61 | + |
53 | 62 | // Language portal splitting feature (if it's turned on) |
54 | 63 | if ( version == 2 ) { |
55 | 64 | // How many links to show in the primary languages portal |
— | — | @@ -142,6 +151,9 @@ |
143 | 152 | // Always show the primary interwiki language portal |
144 | 153 | $j( '#p-lang' ).addClass( 'persistent' ); |
145 | 154 | } |
| 155 | + |
| 156 | + /* General Portal Modification */ |
| 157 | + debugger; |
146 | 158 | // Always show the first portal |
147 | 159 | $j( '#mw-panel > div.portal:first' ).addClass( 'first persistent' ); |
148 | 160 | // Apply a class to the entire panel to activate styles |
— | — | @@ -179,23 +191,18 @@ |
180 | 192 | .find( 'div.body' ) |
181 | 193 | .slideToggle( 'fast' ); |
182 | 194 | } |
| 195 | + |
| 196 | + /* Tab Indexing */ |
| 197 | + |
183 | 198 | var $headings = $j( '#mw-panel > div.portal:not(.persistent) > h5' ); |
184 | | - /** Copy-pasted from jquery.wikiEditor.dialogs - :( */ |
185 | | - // Find the highest tabindex in use |
186 | | - var maxTI = 0; |
187 | | - $j( '[tabindex]' ).each( function() { |
188 | | - var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
189 | | - if ( ti > maxTI ) |
190 | | - maxTI = ti; |
191 | | - }); |
192 | | - var tabIndex = maxTI + 1; |
| 199 | + // Get the highest tab index |
| 200 | + var tabIndex = mw.usability.getMaxTabIndex() + 1; |
193 | 201 | // Fix the search not having a tabindex |
194 | 202 | $j( '#searchInput' ).attr( 'tabindex', tabIndex++ ); |
195 | 203 | // Make it keyboard accessible |
196 | 204 | $headings.each( function() { |
197 | 205 | $j(this).attr( 'tabindex', tabIndex++ ); |
198 | 206 | } ); |
199 | | - /** End of copy-pasted section */ |
200 | 207 | // Toggle the selected menu's class and expand or collapse the menu |
201 | 208 | $headings |
202 | 209 | // Make the space and enter keys act as a click |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | |
3 | 3 | $j(document).ready(function(){if(!wgVectorEnabledModules.collapsiblenav){return true;} |
4 | | -var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false},'rtl':{'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;} |
| 4 | +var map={'ltr':{'msie':[['>=',7]],'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false},'rtl':{'msie':[['>=',7]],'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false}};if(!mw.usability.testBrowser(map)){return true;} |
5 | 5 | var version=1;if(wgCollapsibleNavForceNewVersion==true){version=2;}else{if(wgCollapsibleNavBucketTest==true){version=$j.cookie('vector-nav-pref-version');if(version==null){version=Math.round(Math.random()+1);$j.cookie('vector-nav-pref-version',version,{'expires':30,'path':'/'});}}} |
6 | 6 | if(version==2){var limit=5;var threshold=3;$j('#p-lang ul').addClass('secondary').before('<ul class="primary"></ul>');var languages=['en','fr','de','es','pt','it','ru','ja','nl','pl','zh','sv','ar','tr','uk','fi','no','ca','ro','hu','ksh','id','he','cs','vi','ko','sr','fa','da','eo','sk','th','lt','vo','bg','sl','hr','hi','et','mk','simple','new','ms','nn','gl','el','eu','ka','tl','bn','lv','ml','bs','te','la','az','sh','war','br','is','mr','be-x-old','sq','cy','lb','ta','zh-classical','an','jv','ht','oc','bpy','ceb','ur','zh-yue','pms','scn','be','roa-rup','qu','af','sw','nds','fy','lmo','wa','ku','hy','su','yi','io','os','ga','ast','nap','vec','gu','cv','bat-smg','kn','uz','zh-min-nan','si','als','yo','li','gan','arz','sah','tt','bar','gd','tg','kk','pam','hsb','roa-tara','nah','mn','vls','gv','mi','am','ia','co','ne','fo','nds-nl','glk','mt','ang','wuu','dv','km','sco','bcl','mg','my','diq','tk','szl','ug','fiu-vro','sc','rm','nrm','ps','nv','hif','bo','se','sa','pnb','map-bms','lad','lij','crh','fur','kw','to','pa','jbo','ba','ilo','csb','wo','xal','krc','ckb','pag','ln','frp','mzn','ce','nov','kv','eml','gn','ky','pdc','lo','haw','mhr','dsb','stq','tpi','arc','hak','ie','so','bh','ext','mwl','sd','ig','myv','ay','iu','na','cu','pi','kl','ty','lbe','ab','got','sm','as','mo','ee','zea','av','ace','kg','bm','cdo','cbk-zam','kab','om','chr','pap','udm','ks','zu','rmy','cr','ch','st','ik','mdf','kaa','aa','fj','srn','tet','or','pnt','bug','ss','ts','pcd','pih','za','sg','lg','bxr','xh','ak','ha','bi','ve','tn','ff','dz','ti','ki','ny','rw','chy','tw','sn','tum','ng','rn','mh','ii','cho','hz','kr','ho','mus','kj'];var acceptLangCookie=$j.cookie('accept-language');if(acceptLangCookie!=null){if(acceptLangCookie!=''){languages=acceptLangCookie.split(',').concat(languages);}}else{$j.getJSON(wgScriptPath+'/api.php?action=query&meta=userinfo&uiprop=acceptlang&format=json',function(data){var langs=[];if(typeof data.query!='undefined'&&typeof data.query.userinfo!='undefined'&&typeof data.query.userinfo.acceptlang!='undefined'){for(var j=0;j<data.query.userinfo.acceptlang.length;j++){if(data.query.userinfo.acceptlang[j].q!=0){langs.push(data.query.userinfo.acceptlang[j]['*']);}}} |
7 | 7 | $j.cookie('accept-language',langs.join(','),{'path':'/','expires':30});});} |
— | — | @@ -9,10 +9,9 @@ |
10 | 10 | if(count<limit){$secondary.children().each(function(){if(count++<limit){$j(this).appendTo($primary);}else{return false;}});} |
11 | 11 | if($secondary.children().length==0){$secondary.remove();}else{$j('#p-lang').after('<div id="p-lang-more" class="portal"><h5></h5><div class="body"></div></div>');$j('#p-lang-more h5').text(mw.usability.getMsg('vector-collapsiblenav-more'));$secondary.appendTo($j('#p-lang-more div.body'));} |
12 | 12 | $j('#p-lang').addClass('persistent');} |
13 | | -$j('#mw-panel > div.portal:first').addClass('first persistent');$j('#mw-panel').addClass('collapsible-nav');$j('#mw-panel > div.portal:not(.persistent)').each(function(i){var id=$j(this).attr('id');var state=$j.cookie('vector-nav-'+id);if(state=='true'||(state==null&&i<1)||version==1&&id=='p-lang'){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');} |
| 13 | +debugger;$j('#mw-panel > div.portal:first').addClass('first persistent');$j('#mw-panel').addClass('collapsible-nav');$j('#mw-panel > div.portal:not(.persistent)').each(function(i){var id=$j(this).attr('id');var state=$j.cookie('vector-nav-'+id);if(state=='true'||(state==null&&i<1)||version==1&&id=='p-lang'){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');} |
14 | 14 | if(state!=null){$j.cookie('vector-nav-'+$j(this).attr('id'),state,{'expires':30,'path':'/'});}});function toggle($element){$j.cookie('vector-nav-'+$element.parent().attr('id'),$element.parent().is('.collapsed'),{'expires':30,'path':'/'});$element.parent().toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');} |
15 | | -var $headings=$j('#mw-panel > div.portal:not(.persistent) > h5');var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
16 | | -maxTI=ti;});var tabIndex=maxTI+1;$j('#searchInput').attr('tabindex',tabIndex++);$headings.each(function(){$j(this).attr('tabindex',tabIndex++);});$headings.keydown(function(event){if(event.which==13||event.which==32){toggle($j(this));}}).mousedown(function(){toggle($j(this));$j(this).blur();return false;});});$j(document).ready(function(){if(!wgVectorEnabledModules.collapsibletabs){return true;} |
| 15 | +var $headings=$j('#mw-panel > div.portal:not(.persistent) > h5');var tabIndex=mw.usability.getMaxTabIndex()+1;$j('#searchInput').attr('tabindex',tabIndex++);$headings.each(function(){$j(this).attr('tabindex',tabIndex++);});$headings.keydown(function(event){if(event.which==13||event.which==32){toggle($j(this));}}).mousedown(function(){toggle($j(this));$j(this).blur();return false;});});$j(document).ready(function(){if(!wgVectorEnabledModules.collapsibletabs){return true;} |
17 | 16 | var rtl=$j('body').is('.rtl');$j.collapsibleTabs.moveToCollapsed=function(ele){var $moving=$j(ele);$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=true;var data=$j.collapsibleTabs.getSettings($moving);var target=data.collapsedContainer;$moving.css("position","relative").css((rtl?'left':'right'),0).animate({width:'1px'},"normal",function(){$j(this).hide();$j('<span class="placeholder" style="display:none;"></span>').insertAfter(this);$j(this).remove().prependTo(target).data('collapsibleTabsSettings',data);$j(this).attr('style','display:list-item;');$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($j(ele)).expandedContainer)).shifting=false;$j.collapsibleTabs.handleResize();});};$j.collapsibleTabs.moveToExpanded=function(ele){var $moving=$j(ele);$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=true;var data=$j.collapsibleTabs.getSettings($moving);var $target=$j(data.expandedContainer).find('span.placeholder:first');var expandedWidth=data.expandedWidth;$moving.css("position","relative").css((rtl?'right':'left'),0).css('width','1px');$target.replaceWith($moving.remove().css('width','1px').data('collapsibleTabsSettings',data).animate({width:expandedWidth+"px"},"normal",function(){$j(this).attr('style','display:block;');$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=false;$j.collapsibleTabs.handleResize();}));};$j('#p-views ul').bind("beforeTabCollapse",function(){if($j('#p-cactions').css('display')=='none') |
18 | 17 | $j("#p-cactions").addClass("filledPortlet").removeClass("emptyPortlet").find('h5').css('width','1px').animate({'width':'26px'},390);}).bind("beforeTabExpand",function(){if($j('#p-cactions li').length==1) |
19 | 18 | $j("#p-cactions h5").animate({'width':'1px'},370,function(){$j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet");});}).collapsibleTabs({expandCondition:function(eleWidth){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width()+1)<($j('#left-navigation').position().left-eleWidth);}else{return($j('#left-navigation').position().left+$j('#left-navigation').width()+1)<($j('#right-navigation').position().left-eleWidth);}},collapseCondition:function(){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width())>$j('#left-navigation').position().left;}else{return($j('#left-navigation').position().left+$j('#left-navigation').width())>$j('#right-navigation').position().left;}}});});$j(document).ready(function(){if(!wgVectorEnabledModules.editwarning||$j('#wpTextbox1').size()==0){return true;} |
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | 'base_sets' => array( |
55 | 55 | 'raw' => array( |
56 | 56 | // Common UsabilityInitiative funtions |
57 | | - array( 'src' => 'js/usability.js', 'version' => 1 ), |
| 57 | + array( 'src' => 'js/usability.js', 'version' => 2 ), |
58 | 58 | |
59 | 59 | // These scripts can be pulled from core once the js2 is merged |
60 | 60 | array( 'src' => 'js/js2stopgap/ui.core.js', 'version' => 1 ), |
— | — | @@ -75,10 +75,10 @@ |
76 | 76 | array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 16 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 21 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 35 ), |
79 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 192 ), |
| 79 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 193 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 66 ), |
82 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 25 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 26 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 98 ), |
84 | 84 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), |
85 | 85 | array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 77 ), |
— | — | @@ -89,10 +89,10 @@ |
90 | 90 | array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ), |
91 | 91 | ), |
92 | 92 | 'combined' => array( |
93 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 421 ), |
| 93 | + array( 'src' => 'js/plugins.combined.js', 'version' => 422 ), |
94 | 94 | ), |
95 | 95 | 'minified' => array( |
96 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 421 ), |
| 96 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 422 ), |
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
Index: trunk/extensions/UsabilityInitiative/js/usability.js |
— | — | @@ -5,18 +5,18 @@ |
6 | 6 | if ( typeof mw == 'undefined' ) { |
7 | 7 | mw = {}; |
8 | 8 | } |
9 | | - |
| 9 | +/** |
| 10 | + * Base object for Usability Initiative functionality - naming is temporary |
| 11 | + */ |
10 | 12 | mw.usability = { |
11 | | - messages: {} |
| 13 | + 'messages': {} |
12 | 14 | } |
13 | | - |
14 | 15 | /** |
15 | 16 | * This may eventually load something instead of just calling the callback. |
16 | 17 | */ |
17 | 18 | mw.usability.load = function( deps, callback ) { |
18 | 19 | callback(); |
19 | 20 | }; |
20 | | - |
21 | 21 | /** |
22 | 22 | * Add messages to a local message table |
23 | 23 | */ |
— | — | @@ -25,7 +25,6 @@ |
26 | 26 | this.messages[key] = messages[key]; |
27 | 27 | } |
28 | 28 | }; |
29 | | - |
30 | 29 | /** |
31 | 30 | * Get a message |
32 | 31 | */ |
— | — | @@ -43,3 +42,76 @@ |
44 | 43 | } |
45 | 44 | return msg; |
46 | 45 | }; |
| 46 | +/** |
| 47 | + * Checks the current browser against a support map object to determine if the browser has been black-listed or not. |
| 48 | + * Because these rules are often very complex, the object contains configurable operators and can check against |
| 49 | + * either the browser version number or string. This process also involves checking if the current browser is amung |
| 50 | + * those which we have configured as compatible or not. If the browser was not configured as comptible we just go on |
| 51 | + * assuming things will work - the argument here is to prevent the need to update the code when a new browser comes |
| 52 | + * to market. The assumption here is that any new browser will be built on an existing engine or be otherwise so |
| 53 | + * similar to another existing browser that things actually do work as expected. The merrits of this argument, which |
| 54 | + * is essentially to blacklist rather than whitelist are debateable, but at this point we've decided it's the more |
| 55 | + * "open-web" way to go. |
| 56 | + * |
| 57 | + * This function depends on the jquery browser plugin. |
| 58 | + * |
| 59 | + * A browser map is in the following format: |
| 60 | + * { |
| 61 | + * 'ltr': { |
| 62 | + * // Multiple rules with configurable operators |
| 63 | + * 'msie': [['>=', 7], ['!=', 9]], |
| 64 | + * // Blocked entirely |
| 65 | + * 'iphone': false |
| 66 | + * }, |
| 67 | + * 'rtl': { |
| 68 | + * // Test against a string |
| 69 | + * 'msie': [['!==', '8.1.2.3']], |
| 70 | + * // RTL rules do not fall through to LTR rules, you must explicity set each of them |
| 71 | + * 'iphone': false |
| 72 | + * } |
| 73 | + * } |
| 74 | + * |
| 75 | + * The user agent string is interpreted. Common browser names are as follows: |
| 76 | + * 'msie', 'firefox', 'opera', 'safari', 'chrome', 'blackberry', 'ipod', 'iphone', 'ps3', 'konqueror' |
| 77 | + * |
| 78 | + * @param Object of browser support map |
| 79 | + */ |
| 80 | +mw.usability.testBrowser = function( map ) { |
| 81 | + // Check over each browser condition to determine if we are running in a compatible client |
| 82 | + var browser = map[$j( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$j.browser.name]; |
| 83 | + if ( typeof browser !== 'object' ) { |
| 84 | + // Unknown, so we assume it's working |
| 85 | + return true; |
| 86 | + } |
| 87 | + for ( var condition in browser ) { |
| 88 | + var op = browser[condition][0]; |
| 89 | + var val = browser[condition][1]; |
| 90 | + if ( val === false ) { |
| 91 | + return false; |
| 92 | + } else if ( typeof val == 'string' ) { |
| 93 | + if ( !( eval( '$j.browser.version' + op + '"' + val + '"' ) ) ) { |
| 94 | + return false; |
| 95 | + } |
| 96 | + } else if ( typeof val == 'number' ) { |
| 97 | + if ( !( eval( '$j.browser.versionNumber' + op + val ) ) ) { |
| 98 | + return false; |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + return true; |
| 103 | +}; |
| 104 | +/** |
| 105 | + * Finds the highest tabindex in use. |
| 106 | + * |
| 107 | + * @return Integer of highest tabindex on the page |
| 108 | + */ |
| 109 | +mw.usability.getMaxTabIndex = function() { |
| 110 | + var maxTI = 0; |
| 111 | + $j( '[tabindex]' ).each( function() { |
| 112 | + var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
| 113 | + if ( ti > maxTI ) { |
| 114 | + maxTI = ti; |
| 115 | + } |
| 116 | + } ); |
| 117 | + return maxTI; |
| 118 | +}; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -190,14 +190,8 @@ |
191 | 191 | * @param $elements Elements to set tabindexes on. If they already have tabindexes, this function can behave a bit weird |
192 | 192 | */ |
193 | 193 | setTabindexes: function( $elements ) { |
194 | | - // Find the highest tabindex in use |
195 | | - var maxTI = 0; |
196 | | - $j( '[tabindex]' ).each( function() { |
197 | | - var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
198 | | - if ( ti > maxTI ) |
199 | | - maxTI = ti; |
200 | | - }); |
201 | | - var tabIndex = maxTI + 1; |
| 194 | + // Get the highest tab index |
| 195 | + var tabIndex = mw.usability.getMaxTabIndex() + 1; |
202 | 196 | $elements.each( function() { |
203 | 197 | $j(this).attr( 'tabindex', tabIndex++ ); |
204 | 198 | } ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -90,33 +90,8 @@ |
91 | 91 | // Cache hit |
92 | 92 | return mod.supported; |
93 | 93 | } |
94 | | - // Check if we have any compatiblity information on-hand for the current browser |
95 | | - if ( !( $.browser.name in mod.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) { |
96 | | - // Assume good faith :) |
97 | | - return mod.supported = true; |
98 | | - } |
99 | | - // Check over each browser condition to determine if we are running in a compatible client |
100 | | - var browser = mod.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name]; |
101 | | - if ( typeof browser != 'object' ) { |
102 | | - return mod.supported = false; |
103 | | - } |
104 | | - for ( var condition in browser ) { |
105 | | - var op = browser[condition][0]; |
106 | | - var val = browser[condition][1]; |
107 | | - if ( val === false ) { |
108 | | - return mod.supported = false; |
109 | | - } else if ( typeof val == 'string' ) { |
110 | | - if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) { |
111 | | - return mod.supported = false; |
112 | | - } |
113 | | - } else if ( typeof val == 'number' ) { |
114 | | - if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) { |
115 | | - return mod.supported = false; |
116 | | - } |
117 | | - } |
118 | | - } |
119 | | - // Return and also cache the return value - this will be checked somewhat often |
120 | | - return mod.supported = true; |
| 94 | + // Run a browser support test and then cache and return the result |
| 95 | + return mod.supported = mw.usability.testBrowser( mod.browsers ); |
121 | 96 | }, |
122 | 97 | /** |
123 | 98 | * Checks if a module has a specific requirement |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -5,18 +5,18 @@ |
6 | 6 | if ( typeof mw == 'undefined' ) { |
7 | 7 | mw = {}; |
8 | 8 | } |
9 | | - |
| 9 | +/** |
| 10 | + * Base object for Usability Initiative functionality - naming is temporary |
| 11 | + */ |
10 | 12 | mw.usability = { |
11 | | - messages: {} |
| 13 | + 'messages': {} |
12 | 14 | } |
13 | | - |
14 | 15 | /** |
15 | 16 | * This may eventually load something instead of just calling the callback. |
16 | 17 | */ |
17 | 18 | mw.usability.load = function( deps, callback ) { |
18 | 19 | callback(); |
19 | 20 | }; |
20 | | - |
21 | 21 | /** |
22 | 22 | * Add messages to a local message table |
23 | 23 | */ |
— | — | @@ -25,7 +25,6 @@ |
26 | 26 | this.messages[key] = messages[key]; |
27 | 27 | } |
28 | 28 | }; |
29 | | - |
30 | 29 | /** |
31 | 30 | * Get a message |
32 | 31 | */ |
— | — | @@ -43,6 +42,79 @@ |
44 | 43 | } |
45 | 44 | return msg; |
46 | 45 | }; |
| 46 | +/** |
| 47 | + * Checks the current browser against a support map object to determine if the browser has been black-listed or not. |
| 48 | + * Because these rules are often very complex, the object contains configurable operators and can check against |
| 49 | + * either the browser version number or string. This process also involves checking if the current browser is amung |
| 50 | + * those which we have configured as compatible or not. If the browser was not configured as comptible we just go on |
| 51 | + * assuming things will work - the argument here is to prevent the need to update the code when a new browser comes |
| 52 | + * to market. The assumption here is that any new browser will be built on an existing engine or be otherwise so |
| 53 | + * similar to another existing browser that things actually do work as expected. The merrits of this argument, which |
| 54 | + * is essentially to blacklist rather than whitelist are debateable, but at this point we've decided it's the more |
| 55 | + * "open-web" way to go. |
| 56 | + * |
| 57 | + * This function depends on the jquery browser plugin. |
| 58 | + * |
| 59 | + * A browser map is in the following format: |
| 60 | + * { |
| 61 | + * 'ltr': { |
| 62 | + * // Multiple rules with configurable operators |
| 63 | + * 'msie': [['>=', 7], ['!=', 9]], |
| 64 | + * // Blocked entirely |
| 65 | + * 'iphone': false |
| 66 | + * }, |
| 67 | + * 'rtl': { |
| 68 | + * // Test against a string |
| 69 | + * 'msie': [['!==', '8.1.2.3']], |
| 70 | + * // RTL rules do not fall through to LTR rules, you must explicity set each of them |
| 71 | + * 'iphone': false |
| 72 | + * } |
| 73 | + * } |
| 74 | + * |
| 75 | + * The user agent string is interpreted. Common browser names are as follows: |
| 76 | + * 'msie', 'firefox', 'opera', 'safari', 'chrome', 'blackberry', 'ipod', 'iphone', 'ps3', 'konqueror' |
| 77 | + * |
| 78 | + * @param Object of browser support map |
| 79 | + */ |
| 80 | +mw.usability.testBrowser = function( map ) { |
| 81 | + // Check over each browser condition to determine if we are running in a compatible client |
| 82 | + var browser = map[$j( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$j.browser.name]; |
| 83 | + if ( typeof browser !== 'object' ) { |
| 84 | + // Unknown, so we assume it's working |
| 85 | + return true; |
| 86 | + } |
| 87 | + for ( var condition in browser ) { |
| 88 | + var op = browser[condition][0]; |
| 89 | + var val = browser[condition][1]; |
| 90 | + if ( val === false ) { |
| 91 | + return false; |
| 92 | + } else if ( typeof val == 'string' ) { |
| 93 | + if ( !( eval( '$j.browser.version' + op + '"' + val + '"' ) ) ) { |
| 94 | + return false; |
| 95 | + } |
| 96 | + } else if ( typeof val == 'number' ) { |
| 97 | + if ( !( eval( '$j.browser.versionNumber' + op + val ) ) ) { |
| 98 | + return false; |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + return true; |
| 103 | +}; |
| 104 | +/** |
| 105 | + * Finds the highest tabindex in use. |
| 106 | + * |
| 107 | + * @return Integer of highest tabindex on the page |
| 108 | + */ |
| 109 | +mw.usability.getMaxTabIndex = function() { |
| 110 | + var maxTI = 0; |
| 111 | + $j( '[tabindex]' ).each( function() { |
| 112 | + var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
| 113 | + if ( ti > maxTI ) { |
| 114 | + maxTI = ti; |
| 115 | + } |
| 116 | + } ); |
| 117 | + return maxTI; |
| 118 | +}; |
47 | 119 | /* |
48 | 120 | * jQuery UI 1.7.1 |
49 | 121 | * |
— | — | @@ -6887,33 +6959,8 @@ |
6888 | 6960 | // Cache hit |
6889 | 6961 | return mod.supported; |
6890 | 6962 | } |
6891 | | - // Check if we have any compatiblity information on-hand for the current browser |
6892 | | - if ( !( $.browser.name in mod.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'] ) ) { |
6893 | | - // Assume good faith :) |
6894 | | - return mod.supported = true; |
6895 | | - } |
6896 | | - // Check over each browser condition to determine if we are running in a compatible client |
6897 | | - var browser = mod.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name]; |
6898 | | - if ( typeof browser != 'object' ) { |
6899 | | - return mod.supported = false; |
6900 | | - } |
6901 | | - for ( var condition in browser ) { |
6902 | | - var op = browser[condition][0]; |
6903 | | - var val = browser[condition][1]; |
6904 | | - if ( val === false ) { |
6905 | | - return mod.supported = false; |
6906 | | - } else if ( typeof val == 'string' ) { |
6907 | | - if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) { |
6908 | | - return mod.supported = false; |
6909 | | - } |
6910 | | - } else if ( typeof val == 'number' ) { |
6911 | | - if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) { |
6912 | | - return mod.supported = false; |
6913 | | - } |
6914 | | - } |
6915 | | - } |
6916 | | - // Return and also cache the return value - this will be checked somewhat often |
6917 | | - return mod.supported = true; |
| 6963 | + // Run a browser support test and then cache and return the result |
| 6964 | + return mod.supported = mw.usability.testBrowser( mod.browsers ); |
6918 | 6965 | }, |
6919 | 6966 | /** |
6920 | 6967 | * Checks if a module has a specific requirement |
— | — | @@ -8860,14 +8907,8 @@ |
8861 | 8908 | * @param $elements Elements to set tabindexes on. If they already have tabindexes, this function can behave a bit weird |
8862 | 8909 | */ |
8863 | 8910 | setTabindexes: function( $elements ) { |
8864 | | - // Find the highest tabindex in use |
8865 | | - var maxTI = 0; |
8866 | | - $j( '[tabindex]' ).each( function() { |
8867 | | - var ti = parseInt( $j(this).attr( 'tabindex' ) ); |
8868 | | - if ( ti > maxTI ) |
8869 | | - maxTI = ti; |
8870 | | - }); |
8871 | | - var tabIndex = maxTI + 1; |
| 8911 | + // Get the highest tab index |
| 8912 | + var tabIndex = mw.usability.getMaxTabIndex() + 1; |
8872 | 8913 | $elements.each( function() { |
8873 | 8914 | $j(this).attr( 'tabindex', tabIndex++ ); |
8874 | 8915 | } ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -1,9 +1,11 @@ |
2 | 2 | |
3 | 3 | if(typeof mw=='undefined'){mw={};} |
4 | | -mw.usability={messages:{}} |
| 4 | +mw.usability={'messages':{}} |
5 | 5 | mw.usability.load=function(deps,callback){callback();};mw.usability.addMessages=function(messages){for(var key in messages){this.messages[key]=messages[key];}};mw.usability.getMsg=function(key,args){if(!(key in this.messages)){return'['+key+']';} |
6 | 6 | var msg=this.messages[key];if(typeof args=='object'||typeof args=='array'){for(var argKey in args){msg=msg.replace('\$'+(parseInt(argKey)+1),args[argKey]);}}else if(typeof args=='string'||typeof args=='number'){msg=msg.replace('$1',args);} |
7 | | -return msg;};;jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.7.1",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;} |
| 7 | +return msg;};mw.usability.testBrowser=function(map){var browser=map[$j('body').is('.rtl')?'rtl':'ltr'][$j.browser.name];if(typeof browser!=='object'){return true;} |
| 8 | +for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(val===false){return false;}else if(typeof val=='string'){if(!(eval('$j.browser.version'+op+'"'+val+'"'))){return false;}}else if(typeof val=='number'){if(!(eval('$j.browser.versionNumber'+op+val))){return false;}}} |
| 9 | +return true;};mw.usability.getMaxTabIndex=function(){var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI){maxTI=ti;}});return maxTI;};;jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.7.1",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;} |
8 | 10 | for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css('overflow')=='hidden'){return false;} |
9 | 11 | var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(el[scroll]>0){return true;} |
10 | 12 | el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;$.attr=function(elem,name,value){var set=value!==undefined;return(name=='role'?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)));};$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""));}):removeAttr.call(this,name));};} |
— | — | @@ -457,10 +459,7 @@ |
458 | 460 | 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;} |
459 | 461 | retval=(hasIframe?context.fn:fn)[command].call(this,options);if(hasIframe&&needSave){context.fn.saveSelection();} |
460 | 462 | return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'blackberry':false,'ipod':false,'iphone':false}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){var mod=module&&'browsers'in module?module:$.wikiEditor;if(typeof mod.supported!=='undefined'){return mod.supported;} |
461 | | -if(!($.browser.name in mod.browsers[$('body').is('.rtl')?'rtl':'ltr'])){return mod.supported=true;} |
462 | | -var browser=mod.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];if(typeof browser!='object'){return mod.supported=false;} |
463 | | -for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(val===false){return mod.supported=false;}else if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return mod.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return mod.supported=false;}}} |
464 | | -return mod.supported=true;},'isRequired':function(module,requirement){if(typeof module['req']!=='undefined'){for(req in module['req']){if(module['req'][req]==requirement){return true;}}} |
| 463 | +return mod.supported=mw.usability.testBrowser(mod.browsers);},'isRequired':function(module,requirement){if(typeof module['req']!=='undefined'){for(req in module['req']){if(module['req'][req]==requirement){return true;}}} |
465 | 464 | return false;},'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;}}} |
466 | 465 | 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;} |
467 | 466 | return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} |
— | — | @@ -606,8 +605,7 @@ |
607 | 606 | context.$textarea.trigger('wikiEditor-dialogs-setup-'+mod);}}},reallyCreate:function(context,module){mw.usability.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons) |
608 | 607 | configuration.newButtons[mw.usability.getMsg(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div />').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);$.wikiEditor.modules.dialogs.fn.setTabindexes(dialogDiv.closest('.ui-dialog').find('button').not('[tabindex]'));if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});} |
609 | 608 | dialogDiv.bind('dialogclose',function(){context.fn.restoreSelection();});context.$textarea.trigger('wikiEditor-dialogs-loaded-'+mod);});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-(wrapper.width()-oldWidth)/2);} |
610 | | -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});},setTabindexes:function($elements){var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
611 | | -maxTI=ti;});var tabIndex=maxTI+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],'cfg':{'styleVersion':3},'evt':{'delayedChange':function(context,event){if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,event.data.scope);}},'ready':function(context,event){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,'ready');}},'fn':{'create':function(context,config){context.modules.highlight.markersStr='';},'scan':function(context,division){var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(var module in context.modules){if(module in $.wikiEditor.modules&&'exp'in $.wikiEditor.modules[module]){for(var exp in $.wikiEditor.modules[module].exp){var regex=$.wikiEditor.modules[module].exp[exp].regex;var label=$.wikiEditor.modules[module].exp[exp].label;var markAfter=$.wikiEditor.modules[module].exp[exp].markAfter||false;var offset=0,left,right,match;while((match=text.substr(offset).match(regex))!=null){right=(left=offset+match.index)+match[0].length;tokenArray[tokenArray.length]={'offset':markAfter?right:left,'label':label,'tokenStart':left,'match':match};offset=right;}}}} |
| 609 | +$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});},setTabindexes:function($elements){var tabIndex=mw.usability.getMaxTabIndex()+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],'cfg':{'styleVersion':3},'evt':{'delayedChange':function(context,event){if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,event.data.scope);}},'ready':function(context,event){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,'ready');}},'fn':{'create':function(context,config){context.modules.highlight.markersStr='';},'scan':function(context,division){var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(var module in context.modules){if(module in $.wikiEditor.modules&&'exp'in $.wikiEditor.modules[module]){for(var exp in $.wikiEditor.modules[module].exp){var regex=$.wikiEditor.modules[module].exp[exp].regex;var label=$.wikiEditor.modules[module].exp[exp].label;var markAfter=$.wikiEditor.modules[module].exp[exp].markAfter||false;var offset=0,left,right,match;while((match=text.substr(offset).match(regex))!=null){right=(left=offset+match.index)+match[0].length;tokenArray[tokenArray.length]={'offset':markAfter?right:left,'label':label,'tokenStart':left,'match':match};offset=right;}}}} |
612 | 610 | tokenArray.sort(function(a,b){return a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},'mark':function(context,division,tokens){var markers=[];if(context.modules.highlight.markers&&division!=''){for(var i=0;i<context.modules.highlight.markers.length;i++){if(context.modules.highlight.markers[i].skipDivision==division){markers.push(context.modules.highlight.markers[i]);}}} |
613 | 611 | context.modules.highlight.markers=markers;context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';} |
614 | 612 | if(context.modules.highlight.markersStr==markersStr){return;} |