+++ /dev/null
-/*\r
- * Copyright 2016-2017, CMCC Technologies Co., Ltd.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-var commonUtil = {};\r
-\r
-commonUtil.sendSynRequest = function(url){\r
- var response;\r
- $.ajax({\r
- "type": 'get',\r
- "url": url,\r
- "dataType": "json",\r
- "async": false,\r
- success: function (resp) {\r
- response = resp;\r
- return response;\r
- },\r
- error: function(XMLHttpRequest, textStatus, errorThrown){\r
- }\r
- });\r
-};\r
-\r
-commonUtil.strToJson = function(str){\r
- var json = eval('(' + str + ')');\r
- return json;\r
-};\r
-\r
-commonUtil.arrayRemove = function(aryInstance, index){\r
- if (aryInstance == undefined || aryInstance == null) {\r
- return;\r
- }\r
- for (var i = 0, n = 0; i < aryInstance.length; i++) {\r
- if (aryInstance[i] != aryInstance[dx]) {\r
- aryInstance[n++] = aryInstance[i];\r
- }\r
- }\r
- aryInstance.length -= 1;\r
-};\r
-\r
-// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423\r
-// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18\r
-commonUtil.parseDate = function(dateObj, format){\r
- var o = {\r
- "M+": dateObj.getMonth() + 1,\r
- "d+": dateObj.getDate(),\r
- "h+": dateObj.getHours(),\r
- "m+": dateObj.getMinutes(),\r
- "s+": dateObj.getSeconds(),\r
- "q+": Math.floor((dateObj.getMonth() + 3) / 3),\r
- "S": dateObj.getMilliseconds()\r
- }\r
- if (/(y+)/.test(format)) format = format.replace(RegExp.$1,\r
- (dateObj.getFullYear() + "").substr(4 - RegExp.$1.length));\r
- for (var k in o)\r
- if (new RegExp("(" + k + ")").test(format))\r
- format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] :\r
- ("00" + o[k]).substr(("" + o[k]).length));\r
- return format;\r
-};\r
-\r
-commonUtil.strToJson = function(str){\r
- var json = eval('(' + str + ')');\r
- return json;\r
-};\r