/*** Word truncation plug-in * wordlimit (OBJ); automatically obtains the CSS width for processing. If no width is specified for the jquery object OBJ in CSS, * wordlimit (OBJ, 24). Number of truncated characters. The value must be an integer greater than 0. The number of characters in the label of the jquery object OBJ can be 24 at most */wordlimit: function (OBJ, num) {obj. each (function () {If (! Num) {var copythis = (this.clonenode(true+}.hide().css ({'position': 'absolute ', 'width': 'auto', 'overflow': 'visable'}); $ (this ). after (copythis); If (copythis. width ()> trim () + '... '); copythis. remove (); COM. UE. util. wordlimit ($ (this);} else {copythis. remove (); // Clear copy return;} else {var maxwidth = num; if ($ (this ). text (). length> values () + '... ') ;}}) ;},/*** limit the maximum Div height. * controldivheight ('purformdiv', '123'); */controldivheight: function (OBJ, maxheight) {obj.css ("height", "Auto"); If (obj. height ()> maxheight) {obj.css ("height", maxheight + "PX"); obj.css ("overflow-y", "scroll ");}}
/*** Determine whether the string ends with a certain character * @ Param {object} S1 * @ Param {object} S2 * @ return {typename} */string. prototype. endwith = function endwith (STR) {If (this. length <Str. length) return false; If (this = Str) return true; If (this. substring (this. length-Str. length) = Str) Return
True; return false;}/*** use a regular expression to replace spaces with empty strings */string. prototype. trim = function () {return this. replace (/(^ \ s *) | (\ s * $)/g, "");}/*** replaceall */string. prototype. replaceall = function (S1, S2) {var r = new Regexp (s1.replace (/([\(\) \ [\] \ {\}\^\$ \+ \-\*\? \. \ "\ '\ | \/\])/G," \ $1 "),
"Ig"); return this. Replace (R, S2 );}