1var commonUtil = new Object(); 2 3 4/** 5 * 徿¹ä¸è´ç¢ºèª 6 */ 7commonUtil.endwith = function(target, srcStr) { 8 if (target == null || target == '' 9 || srcStr == null || srcStr == '') { 10 return false; 11 } 12 13 var sIndex = target.length - srcStr.length; 14 15 if (sIndex < 0){ 16 return false; 17 }else{ 18 if (target.substr(sIndex) == srcStr) { 19 return true; 20 }else{ 21 return false; 22 } 23 } 24}; 25 26/** 27 * åæ¹ä¸è´ç¢ºèª 28 */ 29commonUtil.startwith = function(target, srcStr) { 30 if (target == null || target == '' 31 || srcStr == null || srcStr == '') { 32 return false; 33 } 34 35 var sIndex = target.length - srcStr.length; 36 37 if (sIndex < 0) { 38 return false; 39 }else{ 40 if (target.substr(0,sIndex) == srcStr) { 41 return true; 42 }else{ 43 return false; 44 } 45 } 46}; 47 48/** 49 * 颿°é åã®å®è¡ 50 */ 51commonUtil.execFuncArray = function (funcs) { 52 for(var i = 0; i < funcs.length; i++) { 53 try{ 54 var func = funcs[i]; 55 if (typeof func == 'function') { 56 func.call(); 57 }else if(typeof func == 'string') { 58 eval(func); 59 } 60 }catch(e){} 61 } 62}; 63/** 64 * ã¨ã¹ã±ã¼ããããæååã®å¾©å 65 */ 66commonUtil.unescape = function(val){ 67 if (val==null){ 68 return null; 69 } 70 71 var unescaped; 72 unescaped = val.replace(/'/g,"'").replace(/"/g,"\"").replace(/</g,"<") 73 .replace(/>/g,">").replace(/&/g,"&"); 74 75 // ���Ì������� 76 return unescaped; 77};
78 79/** 80 * Elementã®ID屿§ã«è¨å®ããæååã使ãã 81 */ 82commonUtil.createIdString = function(name){ 83 return name.replace(/\./g, '_').replace(/\[/g, '_').replace(/\]/g, '_'); 84}; 85 86 87/** 88 * ã¿ã°ã¸ã®å¤è¨å® 89 * value屿§ããã¤Elementã«ã¤ãã¦ã¯Valueã« 90 * pã¿ã°ãããã¹ãã¨ãªã¢çã®å ´åã¯innerhtmlã« 91 * unescãtrueã®å ´åã¯ãã¢ã³ã¨ã¹ã±ã¼ããã 92 */ 93commonUtil.setValue = function(selector, value, unesc) { 94 var arr = $(selector); 95 for(var i = 0; i <arr.length; i++) { 96 var nodeType = arr[i].nodeName; 97 if ('input' == nodeType.toLowerCase()) { 98 if (unesc === undefined || unesc != true) { 99 $(arr[i]).val(value); 100 } else { 101 $(arr[i]).val(commonUtil.unescape(value)); 102 } 103 }else{ 104 $(arr[i]).html(value); 105 } 106 } 107}; 108/** 109 * ãããã¿ã¤ããã§ã¼ã³ãè¡ãå ´åã®ã親ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ãå¦ç 110 */ 111commonUtil.parentConstructor = function(myInstance,parentClass, cArgs) { 112 parentClass.apply(myInstance,cArgs); 113 for(var pKey in parentClass.prototype) { 114 var pType = myInstance.constructor.prototype; 115 116 if (!pType[pKey]) { 117 pType[pKey] = parentClass.prototype[pKey]; 118 } 119 } 120}; 121 122commonUtil.rTrim = function(str) { 123 if(typeof str != 'string'||str == null || str.lentgh == 0) { 124 return str; 125 } 126 127 var trimedStr = $.trim(str); 128 129 130 if (trimedStr.length==0){ 131 // trimããçµæã空æåã«ãªãå ´å 132 return trimedStr; 133 }else if(str.indexOf(trimedStr.substring(0,1))==0){ 134 // trimããçµæãæåã®æåãä¸è´ããå ´å 135 return trimedStr; 136 }else{ 137 return str.substring(0,str.indexOf(trimedStr.substring(0,1))) + trimedStr; 138 } 139}; 140 141commonUtil.rTrimToForm = function(formSelector) { 142 $(formSelector).find('input:not([type=file])').each( 143 function(){ 144 $(this).val(commonUtil.rTrim($(this).val())); 145 } 146 ); 147 return $(formSelector); 148 149}; 150 151/** 152 * @deprecated 153 * @param target 154 * @param srcStr 155 * @returns {Boolean} 156 */ 157function endwith(target,srcStr){ 158 if (target==null || target=="" 159 || srcStr==null || srcStr==""){ 160 return false; 161 } 162 163 var sIndex = target.length - srcStr.length; 164 165 if (sIndex < 0){ 166 return false; 167 }else{ 168 if (target.substr(sIndex)==srcStr){ 169 return true; 170 }else{ 171 return false; 172 } 173 } 174}; 175 176commonUtil.browserType = { 177 mobileSafari: function() { 178 return navigator.userAgent.match(/Apple.*Mobile.*Safari/); 179 }, 180 ie: function() { 181 return navigator.userAgent.match(/Windows.*Trident/); 182 } 183}; 184 185commonUtil.deviceType = { 186 mobilePhone: function() { 187 if (navigator.userAgent.match(/iPhone/)) { 188 return true; 189 } 190 return false; 191 } 192};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.