Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -49,16 +49,16 @@ |
50 | 50 | array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ), |
51 | 51 | array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ), |
52 | 52 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ), |
53 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 5 ), |
| 53 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 6 ), |
54 | 54 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 4 ), |
55 | 55 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 6 ), |
56 | 56 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 4 ), |
57 | 57 | ), |
58 | 58 | 'combined' => array( |
59 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 8 ), |
| 59 | + array( 'src' => 'js/plugins.combined.js', 'version' => 9 ), |
60 | 60 | ), |
61 | 61 | 'minified' => array( |
62 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 8 ), |
| 62 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 9 ), |
63 | 63 | ), |
64 | 64 | ), |
65 | 65 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js |
— | — | @@ -30,7 +30,9 @@ |
31 | 31 | var e = this.jquery ? this[0] : this; |
32 | 32 | var selText; |
33 | 33 | var isSample = false; |
34 | | - if ( document.selection && document.selection.createRange ) { |
| 34 | + if ( e.style.display == 'none' ) { |
| 35 | + // Do nothing |
| 36 | + } else if ( document.selection && document.selection.createRange ) { |
35 | 37 | // IE/Opera |
36 | 38 | if ( document.documentElement && document.documentElement.scrollTop ) { |
37 | 39 | var winScroll = document.documentElement.scrollTop; |
— | — | @@ -55,7 +57,7 @@ |
56 | 58 | } else if ( document.body ) { |
57 | 59 | document.body.scrollTop = winScroll; |
58 | 60 | } |
59 | | - } else if ( e.style.display != 'none' && ( e.selectionStart || e.selectionStart == '0' ) ) { |
| 61 | + } else if ( e.selectionStart || e.selectionStart == '0' ) { |
60 | 62 | // Mozilla |
61 | 63 | var textScroll = e.scrollTop; |
62 | 64 | $(this).focus(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -287,7 +287,9 @@ |
288 | 288 | var e = this.jquery ? this[0] : this; |
289 | 289 | var selText; |
290 | 290 | var isSample = false; |
291 | | - if ( document.selection && document.selection.createRange ) { |
| 291 | + if ( e.style.display == 'none' ) { |
| 292 | + // Do nothing |
| 293 | + } else if ( document.selection && document.selection.createRange ) { |
292 | 294 | // IE/Opera |
293 | 295 | if ( document.documentElement && document.documentElement.scrollTop ) { |
294 | 296 | var winScroll = document.documentElement.scrollTop; |
— | — | @@ -312,7 +314,7 @@ |
313 | 315 | } else if ( document.body ) { |
314 | 316 | document.body.scrollTop = winScroll; |
315 | 317 | } |
316 | | - } else if ( e.style.display != 'none' && ( e.selectionStart || e.selectionStart == '0' ) ) { |
| 318 | + } else if ( e.selectionStart || e.selectionStart == '0' ) { |
317 | 319 | // Mozilla |
318 | 320 | var textScroll = e.scrollTop; |
319 | 321 | $(this).focus(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -19,10 +19,10 @@ |
20 | 20 | expires='; expires='+date.toUTCString();} |
21 | 21 | var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}} |
22 | 22 | return cookieValue;}};(function($){$.fn.extend({encapsulateSelection:function(pre,peri,post){function checkSelectedText(){if(!selText){selText=peri;isSample=true;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' '}} |
23 | | -var e=this.jquery?this[0]:this;var selText;var isSample=false;if(document.selection&&document.selection.createRange){if(document.documentElement&&document.documentElement.scrollTop){var winScroll=document.documentElement.scrollTop;}else if(document.body){var winScroll=document.body.scrollTop;} |
| 23 | +var e=this.jquery?this[0]:this;var selText;var isSample=false;if(e.style.display=='none'){}else if(document.selection&&document.selection.createRange){if(document.documentElement&&document.documentElement.scrollTop){var winScroll=document.documentElement.scrollTop;}else if(document.body){var winScroll=document.body.scrollTop;} |
24 | 24 | $(this).focus();var range=document.selection.createRange();selText=range.text;checkSelectedText();range.text=pre+selText+post;if(isSample&&range.moveStart){if(window.opera){post=post.replace(/\n/g,'');} |
25 | 25 | range.moveStart('character',-post.length-selText.length);range.moveEnd('character',-post.length);} |
26 | | -range.select();if(document.documentElement&&document.documentElement.scrollTop){document.documentElement.scrollTop=winScroll}else if(document.body){document.body.scrollTop=winScroll;}}else if(e.style.display!='none'&&(e.selectionStart||e.selectionStart=='0')){var textScroll=e.scrollTop;$(this).focus();var startPos=e.selectionStart;var endPos=e.selectionEnd;selText=e.value.substring(startPos,endPos);checkSelectedText();e.value=e.value.substring(0,startPos)+pre+selText+post+ |
| 26 | +range.select();if(document.documentElement&&document.documentElement.scrollTop){document.documentElement.scrollTop=winScroll}else if(document.body){document.body.scrollTop=winScroll;}}else if(e.selectionStart||e.selectionStart=='0'){var textScroll=e.scrollTop;$(this).focus();var startPos=e.selectionStart;var endPos=e.selectionEnd;selText=e.value.substring(startPos,endPos);checkSelectedText();e.value=e.value.substring(0,startPos)+pre+selText+post+ |
27 | 27 | e.value.substring(endPos,e.value.length);if(isSample){e.selectionStart=startPos+pre.length;e.selectionEnd=startPos+pre.length+selText.length;}else{e.selectionStart=startPos+pre.length+selText.length+post.length;e.selectionEnd=e.selectionStart;} |
28 | 28 | e.scrollTop=textScroll;} |
29 | 29 | $(this).trigger('encapsulateSelection',[pre,peri,post]);},getCaretPosition:function(){function getCaret(e){var caretPos=0;if($.browser.msie){var postFinished=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(!postFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){postFinished=true;}else{preRange.moveEnd("character",-1) |