Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | } else if ( document.body ) { |
57 | 57 | document.body.scrollTop = winScroll; |
58 | 58 | } |
59 | | - } else if ( e.selectionStart || e.selectionStart == '0' ) { |
| 59 | + } else if ( e.style.display != 'none' && ( e.selectionStart || e.selectionStart == '0' ) ) { |
60 | 60 | // Mozilla |
61 | 61 | var textScroll = e.scrollTop; |
62 | 62 | $(this).focus(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -312,7 +312,7 @@ |
313 | 313 | } else if ( document.body ) { |
314 | 314 | document.body.scrollTop = winScroll; |
315 | 315 | } |
316 | | - } else if ( e.selectionStart || e.selectionStart == '0' ) { |
| 316 | + } else if ( e.style.display != 'none' && ( e.selectionStart || e.selectionStart == '0' ) ) { |
317 | 317 | // Mozilla |
318 | 318 | var textScroll = e.scrollTop; |
319 | 319 | $(this).focus(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -22,7 +22,7 @@ |
23 | 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;} |
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.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.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+ |
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) |