Sha256: 1619d2bb09409180913ccb70963de139c038ae6c93f614018d20c6e8b7945596

Contents?: true

Size: 1.4 KB

Versions: 81

Compression:

Stored size: 1.4 KB

Contents

/*
 *
 * Copyright (c) 2010 C. F., Wong (<a href="http://cloudgen.w0ng.hk">Cloudgen Examplet Store</a>)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
(function(k,e,i,j){k.fn.caret=function(b,l){var a,c,f=this[0],d=k.browser.msie;if(typeof b==="object"&&typeof b.start==="number"&&typeof b.end==="number"){a=b.start;c=b.end}else if(typeof b==="number"&&typeof l==="number"){a=b;c=l}else if(typeof b==="string")if((a=f.value.indexOf(b))>-1)c=a+b[e];else a=null;else if(Object.prototype.toString.call(b)==="[object RegExp]"){b=b.exec(f.value);if(b!=null){a=b.index;c=a+b[0][e]}}if(typeof a!="undefined"){if(d){d=this[0].createTextRange();d.collapse(true);
d.moveStart("character",a);d.moveEnd("character",c-a);d.select()}else{this[0].selectionStart=a;this[0].selectionEnd=c}this[0].focus();return this}else{if(d){c=document.selection;if(this[0].tagName.toLowerCase()!="textarea"){d=this.val();a=c[i]()[j]();a.moveEnd("character",d[e]);var g=a.text==""?d[e]:d.lastIndexOf(a.text);a=c[i]()[j]();a.moveStart("character",-d[e]);var h=a.text[e]}else{a=c[i]();c=a[j]();c.moveToElementText(this[0]);c.setEndPoint("EndToEnd",a);g=c.text[e]-a.text[e];h=g+a.text[e]}}else{g=
f.selectionStart;h=f.selectionEnd}a=f.value.substring(g,h);return{start:g,end:h,text:a,replace:function(m){return f.value.substring(0,g)+m+f.value.substring(h,f.value[e])}}}}})(jQuery,"length","createRange","duplicate");

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
cpee-1.3.146 cockpit/lib/jquery.caret.min.js
cpee-1.3.145 cockpit/lib/jquery.caret.min.js
cpee-1.3.144 cockpit/lib/jquery.caret.min.js
cpee-1.3.143 cockpit/lib/jquery.caret.min.js
cpee-1.3.142 cockpit/lib/jquery.caret.min.js
cpee-1.3.141 cockpit/lib/jquery.caret.min.js
cpee-1.3.140 cockpit/lib/jquery.caret.min.js
cpee-1.3.139 cockpit/lib/jquery.caret.min.js
cpee-1.3.138 cockpit/lib/jquery.caret.min.js
cpee-1.3.137 cockpit/lib/jquery.caret.min.js
cpee-1.3.136 cockpit/lib/jquery.caret.min.js
cpee-1.3.134 cockpit/lib/jquery.caret.min.js
cpee-1.3.133 cockpit/lib/jquery.caret.min.js
cpee-1.3.132 cockpit/lib/jquery.caret.min.js
cpee-1.3.131 cockpit/lib/jquery.caret.min.js
cpee-1.3.130 cockpit/lib/jquery.caret.min.js
cpee-1.3.129 cockpit/lib/jquery.caret.min.js
cpee-1.3.128 cockpit/lib/jquery.caret.min.js
cpee-1.3.127 cockpit/lib/jquery.caret.min.js
cpee-1.3.126 cockpit/lib/jquery.caret.min.js