Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php |
— | — | @@ -20,10 +20,10 @@ |
21 | 21 | array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 17 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'Vector.combined.js', 'version' => 51 ), |
| 24 | + array( 'src' => 'Vector.combined.js', 'version' => 52 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'Vector.combined.min.js', 'version' => 51 ), |
| 27 | + array( 'src' => 'Vector.combined.min.js', 'version' => 52 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $modules = array( |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -5,9 +5,9 @@ |
6 | 6 | if ( !wgVectorEnabledModules.collapsiblenav ) { |
7 | 7 | return true; |
8 | 8 | } |
9 | | - |
| 9 | + |
10 | 10 | /* Browser Support */ |
11 | | - |
| 11 | + |
12 | 12 | var map = { |
13 | 13 | // Left-to-right languages |
14 | 14 | 'ltr': { |
— | — | @@ -34,9 +34,9 @@ |
35 | 35 | if ( !mw.usability.testBrowser( map ) ) { |
36 | 36 | return true; |
37 | 37 | } |
38 | | - |
| 38 | + |
39 | 39 | /* Bucket Testing */ |
40 | | - |
| 40 | + |
41 | 41 | // Fallback to old version |
42 | 42 | var version = 1; |
43 | 43 | // Allow new version override |
— | — | @@ -55,9 +55,9 @@ |
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
59 | | - |
| 59 | + |
60 | 60 | /* Special Language Portal Handling */ |
61 | | - |
| 61 | + |
62 | 62 | // Language portal splitting feature (if it's turned on) |
63 | 63 | if ( version == 2 ) { |
64 | 64 | // How many links to show in the primary languages portal |
— | — | @@ -151,9 +151,9 @@ |
152 | 152 | // Always show the primary interwiki language portal |
153 | 153 | $j( '#p-lang' ).addClass( 'persistent' ); |
154 | 154 | } |
155 | | - |
| 155 | + |
156 | 156 | /* General Portal Modification */ |
157 | | - |
| 157 | + |
158 | 158 | // Always show the first portal |
159 | 159 | $j( '#mw-panel > div.portal:first' ).addClass( 'first persistent' ); |
160 | 160 | // Apply a class to the entire panel to activate styles |
— | — | @@ -191,9 +191,9 @@ |
192 | 192 | .find( 'div.body' ) |
193 | 193 | .slideToggle( 'fast' ); |
194 | 194 | } |
195 | | - |
| 195 | + |
196 | 196 | /* Tab Indexing */ |
197 | | - |
| 197 | + |
198 | 198 | var $headings = $j( '#mw-panel > div.portal:not(.persistent) > h5' ); |
199 | 199 | // Get the highest tab index |
200 | 200 | var tabIndex = mw.usability.getMaxTabIndex() + 1; |
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -73,10 +73,10 @@ |
74 | 74 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 17 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 22 ), |
77 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 35 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 36 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 193 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ), |
80 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 67 ), |
| 80 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 68 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 26 ), |
82 | 82 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 98 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), |
— | — | @@ -88,10 +88,10 @@ |
89 | 89 | array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ), |
90 | 90 | ), |
91 | 91 | 'combined' => array( |
92 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 425 ), |
| 92 | + array( 'src' => 'js/plugins.combined.js', 'version' => 426 ), |
93 | 93 | ), |
94 | 94 | 'minified' => array( |
95 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 426 ), |
| 95 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 427 ), |
96 | 96 | ), |
97 | 97 | ), |
98 | 98 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | selText = selText.replace( /\r?\n/g, "\r\n" ); |
82 | 82 | options.post = options.post.replace( /\r?\n/g, "\r\n" ); |
83 | 83 | } |
84 | | - if ( isSample ) { |
| 84 | + if ( isSample && options.selectPeri ) { |
85 | 85 | this.selectionStart = startPos + options.pre.length; |
86 | 86 | this.selectionEnd = startPos + options.pre.length + selText.length; |
87 | 87 | } else { |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | } |
116 | 116 | checkSelectedText(); |
117 | 117 | range.text = options.pre + selText + options.post; |
118 | | - if ( isSample && range.moveStart ) { |
| 118 | + if ( isSample && options.selectPeri && range.moveStart ) { |
119 | 119 | range.moveStart( 'character', - options.post.length - selText.length ); |
120 | 120 | range.moveEnd( 'character', - options.post.length ); |
121 | 121 | } |
— | — | @@ -356,7 +356,8 @@ |
357 | 357 | 'peri': '', // Text to insert between pre and post and select afterwards |
358 | 358 | 'post': '', // Text to insert after the cursor/selection |
359 | 359 | 'ownline': false, // Put the inserted text on a line of its own |
360 | | - 'replace': false // If there is a selection, replace it with peri instead of leaving it alone |
| 360 | + 'replace': false, // If there is a selection, replace it with peri instead of leaving it alone |
| 361 | + 'selectPeri': true // Select the peri text if it was inserted (but not if there was a selection and replace==false) |
361 | 362 | }, options ); |
362 | 363 | break; |
363 | 364 | case 'getCaretPosition': |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -542,7 +542,8 @@ |
543 | 543 | 'action' : { |
544 | 544 | 'type' : 'replace', |
545 | 545 | 'options' : { |
546 | | - 'peri' : character |
| 546 | + 'peri' : character, |
| 547 | + 'selectPeri': false |
547 | 548 | } |
548 | 549 | } |
549 | 550 | }; |
— | — | @@ -552,7 +553,8 @@ |
553 | 554 | 'action' : { |
554 | 555 | 'type' : 'replace', |
555 | 556 | 'options' : { |
556 | | - 'peri' : character[1] |
| 557 | + 'peri' : character[1], |
| 558 | + 'selectPeri': false |
557 | 559 | } |
558 | 560 | } |
559 | 561 | }; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6600,7 +6600,7 @@ |
6601 | 6601 | selText = selText.replace( /\r?\n/g, "\r\n" ); |
6602 | 6602 | options.post = options.post.replace( /\r?\n/g, "\r\n" ); |
6603 | 6603 | } |
6604 | | - if ( isSample ) { |
| 6604 | + if ( isSample && options.selectPeri ) { |
6605 | 6605 | this.selectionStart = startPos + options.pre.length; |
6606 | 6606 | this.selectionEnd = startPos + options.pre.length + selText.length; |
6607 | 6607 | } else { |
— | — | @@ -6634,7 +6634,7 @@ |
6635 | 6635 | } |
6636 | 6636 | checkSelectedText(); |
6637 | 6637 | range.text = options.pre + selText + options.post; |
6638 | | - if ( isSample && range.moveStart ) { |
| 6638 | + if ( isSample && options.selectPeri && range.moveStart ) { |
6639 | 6639 | range.moveStart( 'character', - options.post.length - selText.length ); |
6640 | 6640 | range.moveEnd( 'character', - options.post.length ); |
6641 | 6641 | } |
— | — | @@ -6876,7 +6876,8 @@ |
6877 | 6877 | 'peri': '', // Text to insert between pre and post and select afterwards |
6878 | 6878 | 'post': '', // Text to insert after the cursor/selection |
6879 | 6879 | 'ownline': false, // Put the inserted text on a line of its own |
6880 | | - 'replace': false // If there is a selection, replace it with peri instead of leaving it alone |
| 6880 | + 'replace': false, // If there is a selection, replace it with peri instead of leaving it alone |
| 6881 | + 'selectPeri': true // Select the peri text if it was inserted (but not if there was a selection and replace==false) |
6881 | 6882 | }, options ); |
6882 | 6883 | break; |
6883 | 6884 | case 'getCaretPosition': |
— | — | @@ -11719,7 +11720,8 @@ |
11720 | 11721 | 'action' : { |
11721 | 11722 | 'type' : 'replace', |
11722 | 11723 | 'options' : { |
11723 | | - 'peri' : character |
| 11724 | + 'peri' : character, |
| 11725 | + 'selectPeri': false |
11724 | 11726 | } |
11725 | 11727 | } |
11726 | 11728 | }; |
— | — | @@ -11729,7 +11731,8 @@ |
11730 | 11732 | 'action' : { |
11731 | 11733 | 'type' : 'replace', |
11732 | 11734 | 'options' : { |
11733 | | - 'peri' : character[1] |
| 11735 | + 'peri' : character[1], |
| 11736 | + 'selectPeri': false |
11734 | 11737 | } |
11735 | 11738 | } |
11736 | 11739 | }; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -434,11 +434,11 @@ |
435 | 435 | if(this.value.charAt(endPos)!="\n"){options.post+="\n";}} |
436 | 436 | this.value=this.value.substring(0,startPos)+options.pre+selText+options.post+ |
437 | 437 | this.value.substring(endPos,this.value.length);this.scrollTop=scrollTop;if(window.opera){options.pre=options.pre.replace(/\r?\n/g,"\r\n");selText=selText.replace(/\r?\n/g,"\r\n");options.post=options.post.replace(/\r?\n/g,"\r\n");} |
438 | | -if(isSample){this.selectionStart=startPos+options.pre.length;this.selectionEnd=startPos+options.pre.length+selText.length;}else{this.selectionStart=startPos+options.pre.length+selText.length+ |
| 438 | +if(isSample&&options.selectPeri){this.selectionStart=startPos+options.pre.length;this.selectionEnd=startPos+options.pre.length+selText.length;}else{this.selectionStart=startPos+options.pre.length+selText.length+ |
439 | 439 | options.post.length;this.selectionEnd=this.selectionStart;}}else if(document.selection&&document.selection.createRange){$(this).focus();if(context){context.fn.restoreStuffForIE();} |
440 | 440 | var selText=$(this).textSelection('getSelection');var scrollTop=this.scrollTop;var range=document.selection.createRange();if(options.ownline&&range.moveStart){var range2=document.selection.createRange();range2.collapse();range2.moveStart('character',-1);if(range2.text!="\r"&&range2.text!="\n"&&range2.text!=""){options.pre="\n"+options.pre;} |
441 | 441 | var range3=document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!=""){options.post+="\n";}} |
442 | | -checkSelectedText();range.text=options.pre+selText+options.post;if(isSample&&range.moveStart){range.moveStart('character',-options.post.length-selText.length);range.moveEnd('character',-options.post.length);} |
| 442 | +checkSelectedText();range.text=options.pre+selText+options.post;if(isSample&&options.selectPeri&&range.moveStart){range.moveStart('character',-options.post.length-selText.length);range.moveEnd('character',-options.post.length);} |
443 | 443 | range.select();this.scrollTop=scrollTop;} |
444 | 444 | $(this).trigger('encapsulateSelection',[options.pre,options.peri,options.post,options.ownline,options.replace]);});},getCaretPosition:function(options){function getCaret(e){var caretPos=0,endPos=0;if($.browser.msie){var preFinished=false;var periFinished=false;var postFinished=false;var preText,rawPreText,periText;var rawPeriText,postText,rawPostText;var periRange=document.selection.createRange().duplicate();var preRange=document.body.createTextRange();preRange.moveToElementText(e);preRange.setEndPoint("EndToStart",periRange);var postRange=document.body.createTextRange();postRange.moveToElementText(e);postRange.setEndPoint("StartToEnd",periRange);preText=rawPreText=preRange.text;periText=rawPeriText=periRange.text;postText=rawPostText=postRange.text;do{if(!preFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){preFinished=true;}else{preRange.moveEnd("character",-1) |
445 | 445 | if(preRange.text==preText){rawPreText+="\r\n";}else{preFinished=true;}}} |
— | — | @@ -457,7 +457,7 @@ |
458 | 458 | $(this).scrollTop(scroll);}else if(document.selection&&document.selection.createRange){var range=document.body.createTextRange();var savedRange=document.selection.createRange();var pos=$(this).textSelection('getCaretPosition');var oldScrollTop=this.scrollTop;range.moveToElementText(this);range.collapse();range.move('character',pos+1);range.select();if(this.scrollTop!=oldScrollTop) |
459 | 459 | this.scrollTop+=range.offsetTop;else if(options.force){range.move('character',-1);range.select();} |
460 | 460 | savedRange.select();} |
461 | | -$(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined) |
| 461 | +$(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false,'selectPeri':true},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined) |
462 | 462 | options.end=options.start;if(options.endContainer==undefined) |
463 | 463 | options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;} |
464 | 464 | 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;} |
— | — | @@ -797,7 +797,7 @@ |
798 | 798 | return $page;},buildHeading:function(context,headings){var html='<tr>';for(heading in headings){html+='<th>'+$.wikiEditor.autoMsg(headings[heading],['html','text'])+'</th>';} |
799 | 799 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
800 | 800 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
801 | | -html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'replace','options':{'peri':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'replace','options':{'peri':character[1]}}};} |
| 801 | +html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'replace','options':{'peri':character,'selectPeri':false}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'replace','options':{'peri':character[1],'selectPeri':false}}};} |
802 | 802 | if('action'in character&&'label'in character){actions[character.label]=character.action;return'<span rel="'+character.label+'">'+character.label+'</span>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');if(selected!=null){$.cookie('wikiEditor-'+context.instance+'-toolbar-section',selected,{expires:30,path:'/'});} |
803 | 803 | return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).mouseup(function(e){$(this).blur();}).mousedown(function(e){e.preventDefault();return false;}).click(function(e){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section-visible');$previousSections.css('position','absolute');$previousSections.removeClass('section-visible');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');function animate($this){$sections.css('display','block').animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');context.fn.trigger('resize');});} |
804 | 804 | if(show){$section.addClass('section-visible');$section.fadeIn('fast');if($section.hasClass('loading')){$this=$(this);$this.addClass('current loading');setTimeout(function(){$section.trigger('loadSection');animate($(this));$this.removeClass('loading');},1000);}else{animate($(this));$(this).addClass('current');}}else{$sections.css('height',$section.outerHeight()).animate({'height':'hide'},$section.outerHeight()*2,function(){$(this).css({'overflow':'visible','height':0});context.fn.trigger('resize');});} |