123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374 |
- /*
- * Date Format 1.2.3
- * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
- * MIT license
- *
- * Includes enhancements by Scott Trenda <scott.trenda.net>
- * and Kris Kowal <cixar.com/~kris.kowal/>
- *
- * Accepts a date, a mask, or a date and a mask.
- * Returns a formatted version of the given date.
- * The date defaults to the current date/time.
- * The mask defaults to dateFormat.masks.default.
- */
- var dateFormat = function () {
- var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
- timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
- timezoneClip = /[^-+\dA-Z]/g,
- pad = function (val, len) {
- val = String(val);
- len = len || 2;
- while (val.length < len) val = "0" + val;
- return val;
- };
- // Regexes and supporting functions are cached through closure
- return function (date, mask, utc) {
- var dF = dateFormat;
- // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
- if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
- mask = date;
- date = undefined;
- }
- // Passing date through Date applies Date.parse, if necessary
- date = date ? new Date(date) : new Date;
- if (isNaN(date)) throw SyntaxError("invalid date");
- mask = String(dF.masks[mask] || mask || dF.masks["default"]);
- // Allow setting the utc argument via the mask
- if (mask.slice(0, 4) == "UTC:") {
- mask = mask.slice(4);
- utc = true;
- }
- var _ = utc ? "getUTC" : "get",
- d = date[_ + "Date"](),
- D = date[_ + "Day"](),
- m = date[_ + "Month"](),
- y = date[_ + "FullYear"](),
- H = date[_ + "Hours"](),
- M = date[_ + "Minutes"](),
- s = date[_ + "Seconds"](),
- L = date[_ + "Milliseconds"](),
- o = utc ? 0 : date.getTimezoneOffset(),
- flags = {
- d: d,
- dd: pad(d),
- ddd: dF.i18n.dayNames[D],
- dddd: dF.i18n.dayNames[D + 7],
- m: m + 1,
- mm: pad(m + 1),
- mmm: dF.i18n.monthNames[m],
- mmmm: dF.i18n.monthNames[m + 12],
- yy: String(y).slice(2),
- yyyy: y,
- h: H % 12 || 12,
- hh: pad(H % 12 || 12),
- H: H,
- HH: pad(H),
- M: M,
- MM: pad(M),
- s: s,
- ss: pad(s),
- l: pad(L, 3),
- L: pad(L > 99 ? Math.round(L / 10) : L),
- t: H < 12 ? "a" : "p",
- tt: H < 12 ? "am" : "pm",
- T: H < 12 ? "A" : "P",
- TT: H < 12 ? "AM" : "PM",
- Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
- o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
- S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
- };
- return mask.replace(token, function ($0) {
- return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
- });
- };
- }();
- // Some common format strings
- dateFormat.masks = {
- "default": "ddd mmm dd yyyy HH:MM:ss",
- shortDate: "m/d/yy",
- mediumDate: "mmm d, yyyy",
- longDate: "mmmm d, yyyy",
- fullDate: "dddd, mmmm d, yyyy",
- shortTime: "h:MM TT",
- mediumTime: "h:MM:ss TT",
- longTime: "h:MM:ss TT Z",
- isoDate: "yyyy-mm-dd",
- isoTime: "HH:MM:ss",
- isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
- isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
- };
- // Internationalization strings
- dateFormat.i18n = {
- dayNames: [
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
- ],
- monthNames: [
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- ]
- };
- // For convenience...
- Date.prototype.FormatEnhance = function (mask, utc) {
- return dateFormat(this, mask, utc);
- };
- Date.prototype.Format = function (fmt) { //author: meizz
- var o = {
- "M+": this.getMonth() + 1, //月份
- "d+": this.getDate(), //日
- "h+": this.getHours(), //小时
- "m+": this.getMinutes(), //分
- "s+": this.getSeconds(), //秒
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- }
- //替换input中的非数字
- function rePlaceUnDigital(obj){
- if(/[^\d]/g.test(obj.value)){
- var pos = getCursorPos(obj);
- var array = obj.value.split("");
- for(var i in array){
- if(/[^\d]/g.test(array[i])){
- pos--;
- }
- }
- obj.value = obj.value.replace(/[^\d]/g,'');
- setCursorPos(obj,pos);
- }
- }
- //替换input中的空格
- function rePlaceSpace(obj){
- if(obj.value.indexOf(' ')>-1){
- var pos = getCursorPos(obj);
- var array = obj.value.split("");
- for(var i in array){
- if(array[i] == " "){
- pos--;
- }
- }
- obj.value = obj.value.replace(new RegExp(' ','gm'),'');
- setCursorPos(obj,pos);
- }
- }
- /**
- * 设置光标在短连接输入框中的位置
- * @param inpObj 输入框
- * @param pos
- */
- function setCursorPos(inpObj, pos){
- if(navigator.userAgent.indexOf("MSIE") > -1){
- var range = document.selection.createRange();
- var textRange = inpObj.createTextRange();
- textRange.moveStart('character',pos);
- textRange.collapse();
- textRange.select();
- }else{
- inpObj.setSelectionRange(pos,pos);
- }
- }
- /**
- * 获取光标在短连接输入框中的位置
- * @param inpObj 输入框
- */
- function getCursorPos(inpObj){
- if(navigator.userAgent.indexOf("MSIE") > -1) { // IE
- var range = document.selection.createRange();
- range.text = '';
- range.setEndPoint('StartToStart',inpObj.createTextRange());
- return range.text.length;
- } else {
- return inpObj.selectionStart;
- }
- }
- //获取cookie
- function getCookie(name){
- var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
- if(arr=document.cookie.match(reg))
- return unescape(arr[2]);
- else
- return null;
- }
- /**
- * 正则表达式实现endWith效果函数
- * @param str 要判断的字符
- **/
- String.prototype.endWith = function(str){
- var reg = new RegExp(str+"$");
- return reg.test(this);
- }
- /**
- * 正则表达式实现startWith效果函数
- * @param str 要判断的字符
- **/
- String.prototype.startWith = function(str){
- var reg = new RegExp("^"+str);
- return reg.test(this);
- }
- /* ios input bugs*/
- function fixIOSInputBugs () {
- var windowHeight = window.innerHeight
- function checkHeightForIOS (e) {
- var windowFocusHeight = window.innerHeight
- if (windowHeight == windowFocusHeight) {
- return
- }
- if(e.target.hasClass('searchinput') || e.currentTarget.hasClass('searchinput')) {
- return
- }
- var currentPosition;
- var speed = 1; //页面滚动距离
- currentPosition = document.documentElement.scrollTop || document.body.scrollTop;
- currentPosition -= speed;
- window.scrollTo(0, currentPosition); //页面向上滚动
- currentPosition += speed; //speed变量
- window.scrollTo(0, currentPosition); //页面向下滚动
- }
- $("body").on('click', '#recList', function (e) {
- checkHeightForIOS(e)
- })
- $("body").on('click', '.inputDiv', function (e) {
- checkHeightForIOS(e)
- })
- $("body").on('blur', 'input' , function (e) {
- // checkHeightForIOS(e)
- })
- }
- //动态加载css
- function addCssByLink(url){
- var links=document.getElementsByTagName('link')
- for(var i=0;i<links.length;i++){
- if(links[i].href&&links[i].href.indexOf(url)>-1){
- return;
- }
- }
- var doc=document;
- var link=doc.createElement("link");
- link.setAttribute("rel", "stylesheet");
- link.setAttribute("type", "text/css");
- link.setAttribute("href", url);
- var heads = doc.getElementsByTagName("head");
- if(heads.length)
- heads[0].appendChild(link);
- else
- doc.documentElement.appendChild(link);
- }
- //动态加载js
- function loadJS(url, success){
- var scripts=document.getElementsByTagName('script')
- for(var i=0;i<scripts.length;i++){
- if(scripts[i].src&&scripts[i].src.indexOf(url)>-1){
- if(success) success();
- return;
- }
- }
- var domScript = document.createElement('script');
- domScript.src = url;
- success = success || function(){};
- domScript.onload = domScript.onreadystatechange = function() {
- if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
- success();
- this.onload = this.onreadystatechange = null;
- //this.parentNode.removeChild(this);
- }
- }
- document.getElementsByTagName('head')[0].appendChild(domScript);
- }
- //判断对象是否为空对象{}
- function isNullObj(obj){
- for(var i in obj){
- if(obj.hasOwnProperty(i)){
- return false;
- }
- }
- return true;
- }
- var JyObjMessage = new Object();
- $(function(){
- if (mySysIsIos()){
- window.JyObj = {
- //读取复制内容
- readRight:function(){
- return window.webkit.messageHandlers.readRight.postMessage(JyObjMessage);
- },
- //写入复制内容
- wirteRight:function(txt){
- JyObjMessage["txt"]=txt;
- window.webkit.messageHandlers.wirteRight.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //清除复制内容
- clearRight:function(){
- window.webkit.messageHandlers.clearRight.postMessage(JyObjMessage);
- },
- //拨打电话
- callPhone:function(phone){
- JyObjMessage["phone"]=phone;
- window.webkit.messageHandlers.callPhone.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //抖音or快手其他应用appName:应用名称;appLink:应用链接
- openOtherAppLinks:function(appName,appLink){
- JyObjMessage["appName"]=appName;
- JyObjMessage["appLink"]=appLink;
- window.webkit.messageHandlers.openOtherAppLinks.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //调用接口修改消息通知的打开数
- openActivityPage:function(url,rectype,openid){
- JyObjMessage["url"]=url;
- JyObjMessage["rectype"]=rectype;
- JyObjMessage["openid"]=openid;
- window.webkit.messageHandlers.openActivityPage.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //清除 JyObjMessage
- clearMessage:function(){
- JyObjMessage = new Object();
- },
- //隐藏显示底部菜单栏 0:隐藏;1:显示
- hiddenBottom:function(val){
- JyObjMessage["hidden"]=val;
- window.webkit.messageHandlers.hiddenBottom.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //微信登录
- loginByWeixin:function(){
- window.webkit.messageHandlers.loginByWeixin.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //分享功能
- share:function(type,title,content,link){
- JyObjMessage["type"]=type
- JyObjMessage["title"]=title
- JyObjMessage["content"]=content
- JyObjMessage["link"]=link
- window.webkit.messageHandlers.share.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //保存用户token
- saveUserToken:function(val){
- JyObjMessage["token"]=val;
- window.webkit.messageHandlers.saveUserToken.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //获取用户token
- getUserToken:function(){
- return JyObj.IosCall("getUserToken")
- },
- //移除用户token
- removeUserToken:function(){
- window.webkit.messageHandlers.removeUserToken.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //查看开关状态 是否接受消息
- checkNoticePermission:function(){
- return JyObj.IosCall("checkNoticePermission")
- },
- //打开接受消息开关
- openSystemNotification:function(){
- window.webkit.messageHandlers.openSystemNotification.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //获取极光推送id
- getPushRid:function(){
- return JyObj.IosCall("getPushRid")
- },
- //跳转外部链接
- openExternalLink:function(url,title){
- JyObjMessage["url"]=url
- JyObjMessage["title"]=title
- window.webkit.messageHandlers.openExternalLink.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //获取当前版本号
- getVersion:function(){
- return JyObj.IosCall("getVersion")
- },
- alert:function(content){
- JyObjMessage["content"]=content
- window.webkit.messageHandlers.alert.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //是否安装了微信
- isInstallWeixin:function(){
- return JyObj.IosCall("isInstallWeixin")
- },
- //登录加密
- getCipherText:function(val){
- JyObjMessage["phone"]=val
- return JyObj.IosCall("getCipherText",JyObjMessage)
- },
- //刷新首页和订阅页面
- checkLab:function(){
- window.webkit.messageHandlers.checkLab.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //登录成功后向客户端传参
- loginSuccess:function(status){
- JyObjMessage["status"]=status
- window.webkit.messageHandlers.loginSuccess.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //客户端登录页面点击返回 跳转到搜索首页
- backUrl:function(val){
- JyObjMessage["status"] = val;
- window.webkit.messageHandlers.backUrl.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //清空通知栏消息
- clearPushMessage:function(){
- window.webkit.messageHandlers.clearPushMessage.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //隐藏小红点
- hideRedSpotOnMenu:function(menu){
- JyObjMessage["menu"] = menu;
- window.webkit.messageHandlers.hideRedSpotOnMenu.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //显示小红点
- showRedSpotOnMenu:function(menu){
- JyObjMessage["menu"] = menu;
- window.webkit.messageHandlers.showRedSpotOnMenu.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //微信支付
- wxPay:function(order){
- JyObjMessage["order"] = order;
- window.webkit.messageHandlers.wxPay.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //支付宝支付
- aliPay:function(order){
- JyObjMessage["order"] = order;
- window.webkit.messageHandlers.aliPay.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //获取原生的推送id
- getOtherPushRid:function(){
- return JyObj.IosCall("getOtherPushRid")
- },
- //获取手机型号
- getPhoneBrand:function(){
- return JyObj.IosCall("getPhoneBrand")
- },
- //获取定位
- getLocation:function(){
- return JyObj.IosCall("getLocation")
- },
- //切换菜单
- chooseTab:function(indexTab){
- JyObjMessage["indexTab"] = indexTab;
- window.webkit.messageHandlers.chooseTab.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //打开照相机
- skipCamera:function(){
- window.webkit.messageHandlers.skipCamera.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //打开相册
- skipAlbum:function(){
- window.webkit.messageHandlers.skipAlbum.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //点击返回调用
- judgeIsHidden:function(referer){
- JyObjMessage["referer"] = referer;
- window.webkit.messageHandlers.judgeIsHidden.postMessage(JyObjMessage);
- JyObj.clearMessage();
- },
- //返回值 处理
- IosCall: function (functionName,args){
- if (args!=""&&args!=undefined){
- JyObj.clearMessage();
- }
- var payload = {"jsName": functionName, "arguments": args};
- var res = prompt(JSON.stringify(payload));
- if (res!=""){
- var resObj=JSON.parse(res)
- var type = resObj.type
- switch (type){
- case "int":
- return parseInt(resObj.value)
- case "string":
- return resObj.value
- case "bool":
- if(resObj.value=="true"){
- return true
- }
- return false
- default:
- return ""
- }
- }
- return ""
- }
- }
- fixIOSInputBugs()
- }
- if(isIphoneX()){
- // $(".app-layout-header").css("padding-top"," 40px");//标题
- $(".app-back.jyapp-icon.jyapp-icon-zuojiantou").css("padding-top"," 40px");//返回
- $(".header-share").css("padding-top"," 40px");//分享
- // $(".app-layout-content-a, .app-layout-content-b").css("top","64px");//正文
- $(".feedback-nav").css("top","85px");//意见反馈
- $(".setpage .noticehead").css("top","85px");//关注项目
- $(".app-back.jyapp-icon.jyapp-icon-zuojiantou").addClass("jyapp-icon-zuojiantou-x");//登录
- $("#header.reg").css("padding-top","50px");//注册
- try{
- iphoneXInit();
- }catch(e){}
- }
- //自定义tap
- $(document).on("touchstart", function(e) {
- var $target = $(e.target);
- $target.data("isMoved", 0);
- $target.data("startTime", Date.now());
- });
- $(document).on("touchmove", function(e) {
- var $target = $(e.target);
- $target.data("isMoved", 1);
- });
- $(document).on("touchend", function(e) {
- var $target = $(e.target);
- var startTime = $target.data("startTime");
- if(Date.now()-startTime>200){
- return;
- }
- if($target.data("isMoved") == 1){
- return;
- }
- $target.trigger("tap",e);
- });
- $(".app-layout-header .app-back").unbind("click").on("click",function(){
- if(typeof(clickBack)=="function"){
- clickBack();
- }else{
- try{
- afterClickBack();
- }catch(e){}
- //可以自定义返回url,不过是跳转的方式
- if(typeof(backUrl) != "undefined" && backUrl != null){
- if(typeof(backUrl) == "string"){
- window.location.href = backUrl;
- }else if(typeof(backUrl) == "number"){
- window.history.go(backUrl);
- }
- }else{
- window.history.back();
- }
- }
- });
- // $(".app-layout-footer li").on("tap",function(){
- // if($(this).hasClass("active")){
- // return;
- // }
- // switch(this.id){
- // case "navbar-search":
- // if(sessionStorage){
- // sessionStorage.mainSearchReload = "1";
- // }
- // autoLogin("/jyapp/jylab/mainSearch");
- // break;
- // case "navbar-subscribe":
- // autoLogin("/jyapp/wxkeyset/keyset/index");
- // break;
- // case "navbar-laboratory":
- // autoLogin("/jyapp/jylab/index");
- // break;
- // case "navbar-me":
- // autoLogin("/jyapp/free/me");
- // break;
- // }
- // });
- // if(!mySysIsIos()){
- try{
- afterPageInit();
- //发送渠道统计
- sendChannelSign();
- }catch(e){}
- // }
- setInterval(function(){
- if(localStorage.chooseTab!=undefined){
- try{
- JyObj.hiddenBottom("1");
- JyObj.chooseTab(parseInt(localStorage.chooseTab));
- localStorage.removeItem("chooseTab");
- }catch(e){}
- }
- if(localStorage.reloadTab=="1"&&window.location.pathname=="/jyapp/swordfish/historypush"){
- localStorage.removeItem("reloadTab");
- window.location.reload();
- }
- },1000);
- });
- var EasyAlert = {
- timeout: null,
- waitTime: 1000,
- show: function(text,css,waitTime){
- if(this.timeout != null){
- clearTimeout(this.timeout);
- this.hide();
- this.timeout = null;
- }
- var thisClass = this;
- this.timeout = setTimeout(function(){
- thisClass.hide();
- thisClass.timeout = null;
- },waitTime?waitTime:this.waitTime);
- $("body").append('<div class="easyalert" id="easyAlert">'+text+'</div>');
- if(typeof(css) != "undefined"){
- $("#easyAlert").css(css);
- }
- $("#easyAlert").css({"left":"50%","margin-top":-($("#easyAlert").outerHeight()/2),"margin-left":-($("#easyAlert").outerWidth()/2)}).show();
- },
- hide: function(){
- $("#easyAlert").remove();
- }
- }
- var EasyPopup = function(id){
- this.id = id;
- var thisClass = this;
- document.getElementById(id).onclick = function(e){
- if(e.target.id == id){
- thisClass.hide();
- }
- }
- this.show = function(){
- $("#"+this.id).fadeIn();
- var mainObj = $("#"+id+">div:first");
- mainObj.css({"margin-top":-(mainObj.outerHeight()/2)});
- },
- this.hide = function(){
- $("#"+this.id).fadeOut();
- }
- }
- var Verification = {
- //手机号验证
- isPhone: function(value){
- return /^[1][3-9][0-9]{9}$/.test(value);
- }
- }
- //计算时差
- function timeDiff(date){
- var date1 = date;//开始时间
- var date2 = new Date();//结束时间
- var date3 = date2.getTime()-date1.getTime();//时间差的毫秒数
- //计算出相差天数
- var days = Math.floor(date3/(24*3600*1000));
- //计算出小时数
- var leave1 = date3%(24*3600*1000);//计算天数后剩余的毫秒数
- var hours = Math.floor(leave1/(3600*1000));
- //计算相差分钟数
- var leave2 = leave1%(3600*1000);//计算小时数后剩余的毫秒数
- var minutes = Math.floor(leave2/(60*1000));
- //计算相差秒数
- var td = "30秒前";
- if(days > 0){
- if (days > 10) {
- var date1year = date1.getFullYear();
- var date2year = date2.getFullYear();
- var date1month = date1.getMonth()+1;
- var date1day = date1.getDate();
- if(date1month < 10){
- date1month ="0"+date1month;
- }
- if(date1day < 10){
- date1day ="0"+date1day;
- }
- if (date1year<date2year){
- td = date1.getFullYear()+"-"+date1month+"-"+date1day;
- }else{
- td = date1month+"-"+date1day;
- }
- } else {
- td = days+"天前"
- }
- }else if(hours > 0){
- td = hours+"小时前";
- }else if(minutes > 0){
- td = minutes+"分钟前";
- }
- return td;
- }
- function newredirect(zbadd,link,sid,sds,index){
- if(link != null && typeof(link) != "undefined"){
- link = link.replace(/\n/g,"");
- if(!/^http/.test(link)){
- link="http://"+link
- }
- }
- var pt = ""
- if (index==1){
- pt="projectMatch=项目匹配"
- }
- if(sds){
- window.location.href=zbadd+"/jyapp/article/content/"+sid+".html?keywords="+encodeURIComponent(sds)+pt;
- }else{
- window.location.href=zbadd+"/jyapp/article/content/"+sid+".html?"+pt;
- }
- }
- function pcredirect(link,sid){
- window.open("/pcdetail/"+sid+".html");
- }
- function keyWordHighlight(value,oldChars,newChar){
- if(typeof(oldChars) == "undefined" || oldChars == null || typeof(newChar) == "undefined" || newChar == null || newChar == ""){
- return value;
- }
- var array = [];
- if(oldChars instanceof Array){
- array = oldChars.concat();
- }else{
- array.push(oldChars);
- }
- try{
- var map = {};
- for(var i=0;i<array.length;i++){
- var oldChar = array[i];
- if(oldChar.replace(/\s+/g,"") == "" || map[oldChar]){
- continue;
- }
- map[oldChar] = true;
- oldChar = oldChar.replace(/\$/g,"\\$");
- oldChar = oldChar.replace(/\(/g,"\\(");
- oldChar = oldChar.replace(/\)/g,"\\)");
- oldChar = oldChar.replace(/\*/g,"\\*");
- oldChar = oldChar.replace(/\+/g,"\\+");
- oldChar = oldChar.replace(/\./g,"\\.");
- oldChar = oldChar.replace(/\[/g,"\\[");
- oldChar = oldChar.replace(/\]/g,"\\]");
- oldChar = oldChar.replace(/\?/g,"\\?");
- oldChar = oldChar.replace(/\\/g,"\\");
- oldChar = oldChar.replace(/\//g,"\\/");
- oldChar = oldChar.replace(/\^/g,"\\^");
- oldChar = oldChar.replace(/\{/g,"\\{");
- oldChar = oldChar.replace(/\}/g,"\\}");
- oldChar = oldChar.replace(/\|/g,"\\|");
- value = value.replace(new RegExp("("+oldChar+")",'gmi'),newChar);
- }
- }catch(e){}
- return value;
- }
- function getWxVersion(){
- var wechatInfo = navigator.userAgent.match(/MicroMessenger\/([\d\.]+)/i);
- if(!wechatInfo) {
- return null;
- }
- return wechatInfo[1];
- }
- /**
- * 设置光标在短连接输入框中的位置
- * @param inpObj 输入框
- * @param pos
- */
- function setCursorPos(inpObj, pos){
- if(navigator.userAgent.indexOf("MSIE") > -1){
- var range = document.selection.createRange();
- var textRange = inpObj.createTextRange();
- textRange.moveStart('character',pos);
- textRange.collapse();
- textRange.select();
- }else{
- inpObj.setSelectionRange(pos,pos);
- }
- }
- /**
- * 获取光标在短连接输入框中的位置
- * @param inpObj 输入框
- */
- function getCursorPos(inpObj){
- if(navigator.userAgent.indexOf("MSIE") > -1) { // IE
- var range = document.selection.createRange();
- range.text = '';
- range.setEndPoint('StartToStart',inpObj.createTextRange());
- return range.text.length;
- } else {
- return inpObj.selectionStart;
- }
- }
- //获取url中参数
- function getUrlParam(name,type){
- var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
- var r = window.location.search.substr(1).match(reg);
- if(r != null)
- if(typeof(type) == "function"){
- return type(r[2]);
- }else{
- return unescape(r[2]);
- }
- return null;
- }
- //自动登录
- function autoLogin(url,callBack){
- var sign = "";
- try{
- sign = JyObj.getUserToken();
- }catch(e){}
- if(sign == "" || sign == null || typeof(sign) == "undefined"){
- if(callBack != null && typeof(callBack) != "undefined"){
- callBack(null);
- }else if(url != null && typeof(url) != "undefined"){
- window.location.href = "/jyapp/free/login?url="+encodeURIComponent(url);
- }
- return;
- }
- if(url != null && typeof(url) != "undefined"){
- window.location.href = "/jyapp/free/login?sign="+sign+"&url="+encodeURIComponent(url);
- return
- }
- $.ajax({
- url: "/jyapp/free/login?t="+new Date().getTime(),
- type: "post",
- data: {reqType:"signLogin",sign:sign},
- dataType: "json",
- success: function(r){
- //有回调函数不跳转
- if(callBack != null && typeof(callBack) != "undefined"){
- callBack(r.userInfo);
- return;
- }
- },
- error: function(){
- //alert("服务器连接超时!");
- }
- });
- }
- function loginSuccess(result){
- if(sessionStorage){
- sessionStorage.removeItem("alertKicked");
- }
- JyObj.saveUserToken(result.sign);
- //
- if(getUrlParam("to") == "back"){
- // sessionStorage.reloadHomePage=true;
- if(sessionStorage){
- afterLoginSuccess("",true);
- window.history.back();
- }else{
- afterLoginSuccess("S",false);//提示app定位搜索菜单
- //window.location.href = "/jyapp/jylab/mainSearch";
- location.replace("/jyapp/jylab/mainSearch");
- }
- return
- }
- //分销跳转
- if(getUrlParam("appUrl")!=null&&getUrlParam("appUrl").indexOf("distrib/redirectTo")>-1){
- location.replace(getUrlParam("appUrl"));
- return
- }
- //
- var callBackUrl = getUrlParam("url",decodeURIComponent);
- if(callBackUrl != null){
- afterLoginSuccess("",true);
- //window.location.href = callBackUrl;
- locationReplace(callBackUrl);
- return
- }
- //
- if(sessionStorage){
- sessionStorage.mainSearchReload = "1";
- }
- afterLoginSuccess("S",false);
- //window.location.href = "/jyapp/jylab/mainSearch";
- //location.replace("/jyapp/jylab/mainSearch");
- }
- //2020-05-30 android replace失效
- function locationReplace(url){
- if(history.replaceState){
- history.replaceState(null, document.title, url);
- history.go(0);
- }else{
- location.replace(url);
- }
- }
- function afterLoginSuccess(type,canBack){
- if(!canBack){
- prohibitBack();
- localStorage.reLogin = "1";
- }
- JyObj.loginSuccess(type);
- }
- //ios JyObj对象加载完成回调
- function afterPageInit(){
- setInterval(function(){
- redSpotOnMenu();
- },600000);
- try{
- afterJyObjInit();
- }catch(e){}
- var sign = JyObj.getUserToken();
- var rid = JyObj.getPushRid();
- var oid = getOtherPushId();
- $.post("/jyapp/free/afterPageLoadToCheck?t="+new Date().getTime(),{sign:sign,rid:rid,oid:oid,phoneType:getPhoneType(),version:JyObj.getVersion()},function(r){
- if(mySysIsIos()){
- if(r.updateflag&&r.update.ios_openUpdate){
- var version = JyObj.getVersion();
- if(needUpdate(version,r.update.ios_version)){
- //以后版本
- if(r.update.ios_mustupdate){
- JyObj.openExternalLink(r.webdomain+"/jyapp/free/goToUpdate?mustupdate=1","-1");
- }else{
- if(localStorage.onceTipUpdate != "1"){
- sessionStorage.onceTipUpdate = "1";
- localStorage.onceTipUpdate = "1";
- JyObj.openExternalLink(r.webdomain+"/jyapp/free/goToUpdate?mustupdate=1","去更新");
- }
- }
- return;
- }
- }
- }
- if(r.status == -3){
- window.location.href = "/jyapp/free/login?flag=kicked";
- }else if(r.status == 1){
- if(r.sign != ""&& r.sign != "exists"){
- JyObj.saveUserToken(r.sign);
- }
- }
- });
- //记录推送id
- savePushIdMsg();
- }
- function needUpdate(curVersion,upVersion){
- v1=curVersion.split(".");
- v2=upVersion.split(".");
- var maxlen=v1.length>v2.length?v1.length:v2.length;
- for(var i=0;i<maxlen;i++){
- if(v1[i]==v2[i]){
- continue
- }
- if(v1[i]==undefined){
- v1[i]=-1;
- }
- if(v2[i]==undefined){
- v2[i]=-1;
- }
- if(parseInt(v1[i])<parseInt(v2[i])){
- return true;
- }else{
- return false;
- }
- }
- return false;
- }
- function redSpotOnMenu(){
- var doAjax = true;
- if (localStorage.redSpotLastAjaxTime&&
- new Date().getTime()-parseInt(localStorage.redSpotLastAjaxTime)<1000*60){
- doAjax = false;
- }
- if (!doAjax && localStorage.redSpotRes){
- try{
- var lastAjaxRes = JSON.parse(localStorage.redSpotRes)
- redSpotBackFuc(lastAjaxRes,"false")
- return
- }catch(e){
- console.log("redSpotOnMenu",e)
- }
- }
- $.post("/jyapp/free/showRedSpotOnMenu?t="+new Date().getTime(),null,redSpotBackFuc);
- }
- function redSpotBackFuc(r,flag){
- var noticeCount = r.notice;
- //try{
- //JyObj.getUnReadMessageCount("");
- //}catch(e){}
- if(noticeCount > 0){
- //$("#notice .redspot").show(); //2.8.5 我的页面 改
- $(".dot").show();
- }else{
- //$("#notice .redspot").hide();
- $(".dot").hide();
- }
- if(r.follow_project > 0){
- $(".listOne .redspot").show();
- }else{
- $(".listOne .redspot").hide();
- }
- if(r.follow_ent > 0){
- $(".listTwo .redspot").show();
- }else{
- $(".listTwo .redspot").hide();
- }
- try{
- if(r.my == 0){
- JyObj.hideRedSpotOnMenu("my");
- }else{
- JyObj.showRedSpotOnMenu("my");
- }
- if(r.subscribe == 0){
- JyObj.hideRedSpotOnMenu("subscribe");
- }else{
- JyObj.showRedSpotOnMenu("subscribe");
- }
- if(r.my == 0 && r.subscribe == 0){
- //清空通知栏消息
- JyObj.clearPushMessage("");
- }
- }catch(e){}
- if(flag=="success"){
- localStorage.redSpotLastAjaxTime = new Date().getTime();
- localStorage.redSpotRes = JSON.stringify(r);
- }
- }
- //
- function setLiActive(obj){
- $(obj).addClass("jyapp-li-active");
- setTimeout(function(){
- $(obj).removeClass("jyapp-li-active");
- },500);
- }
- function mySysIsIos(){
- //ios终端
- var flag1 = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
- var flag2 = !!navigator.userAgent.match(/\(M[^;]+; Intel Mac OS X/);
- return flag1||flag2
-
- }
- function appQuit(isKicked){
- //清除小红点缓存
- localStorage.removeItem("redSpotLastAjaxTime");
- //清除token
- var sign = JyObj.getUserToken();
- JyObj.removeUserToken();
- //隐藏小红点
- try{
- JyObj.hideRedSpotOnMenu("my");
- JyObj.hideRedSpotOnMenu("subscribe");
- }catch(e){}
- $.ajax({
- url: "/jyapp/free/signOut?t="+new Date().getTime(),
- type: "post",
- data: {isKicked:isKicked,sign:sign},
- dataType: "json",
- success: function(r){
- if(!isKicked){
- window.location.href = "/jyapp/free/login?back=index&flag=quit";
- }
- sessionStorage.removeItem("userMergeFlag");
- },
- error: function(){
- if(!isKicked){
- window.location.href = "/jyapp/free/login?back=index&flag=quit";
- }
- }
- });
- }
- function checkRepeatLogin(){
- try{
- var sign = JyObj.getUserToken();
- if(sign == "" || sign == null || typeof(sign) == "undefined"){
- return;
- }
- $.post("/jyapp/free/timeCheckRepeatLogin?t="+new Date().getTime(),{sign:sign},function(r){
- if(r.status == -3){
- window.location.href = "/jyapp/free/login?flag=kicked";
- }
- });
- }catch(e){}
- }
- //更新极光id
- function checkRid(){
- if(localStorage && localStorage.checkRid == "1"){
- //return;
- }
- if(JyObj.getUserToken()==""){
- return;
- }
- var thisInterval = setInterval(function(){
- var rid = JyObj.getPushRid();
- var oid = getOtherPushId();
- if(!rid&&!oid){
- return;
- }
- clearInterval(thisInterval);
- $.post("/jyapp/free/updateRid?t="+new Date().getTime(),{rid:rid,oid:oid,phoneType:getPhoneType()},function(r){
- if(r.sign == ""){
- return;
- }
- if(localStorage){
- localStorage.checkRid = "1";
- }
- if(r.sign != "exists"){
- JyObj.saveUserToken(r.sign);
- }
- });
- },10000);
- }
- //随机获取分享文案
- var ShareText = [
- "我和投标伙伴都在用剑鱼标讯找项目,推荐你也试试",
- "我用剑鱼标讯免费查到超多招标信息,推荐你也试试",
- "我收到了剑鱼标讯免费推送的招标信息,推荐你也试试",
- "发现了一个投标神器,推荐你也试试"
- ]
- function getShareText(){
- return ShareText[randomNum(0,ShareText.length-1)];
- }
- function randomNum(Min,Max){
- var Range = Max - Min;
- var Rand = Math.random();
- var num = Min + Math.round(Rand * Range);
- return num;
- }
- function getCipherText(phone){
- return encodeURIComponent(JyObj.getCipherText(phone));
- }
- function getChannel(){
- var channel=""
- try{
- channel=JyObj.getChannel();
- }catch(e){}
- return channel
- }
- function getDeviceId(){
- var deviceId=""
- try{
- deviceId=JyObj.getIdentity();
- }catch(e){}
- return deviceId
- }
- function getPhoneType(){
- var phoneType = "";
- try{
- phoneType = JyObj.getPhoneBrand();
- }catch(e){}
- return phoneType;
- }
- function getOtherPushId(){
- var otherPushId = "";
- try{
- otherPushId = JyObj.getOtherPushRid();
- }catch(e){}
- return otherPushId;
- }
- function prohibitBack(){
- try{
- //禁止后退
- JyObj.prohibitBack();
- }catch(e){}
- }
- function sendChannelSign(){
- var first=localStorage.getItem("channelSigned")
- if(first=="1"){
- return
- }
- try{
- var sign=getChannel();
- var id=getDeviceId();
- if (sign==""||id==""){
- return
- }
- $.post("/jyapp/free/channelSign",{"sign":sign,"id":id},function(data){
- if(data.success){
- localStorage.setItem("channelSigned","1")
- }
- })
- }
- catch(err){
- alert(err)
- }
- }
- function savePushIdMsg(){
- var sign = JyObj.getUserToken();
- var save = sessionStorage.getItem("savePush")
- if(!(sign == ""||sign==undefined)||save=="1"){
- sessionStorage.setItem("savePush","1")//每次打开只执行一次
- return;
- }
- sessionStorage.setItem("savePush","1")//每次打开只执行一次
- try{
- var interval = setInterval(function(){
- var id=getDeviceId();
- var phoneType=getPhoneType();
- var rid = JyObj.getPushRid();
- var oid = getOtherPushId();
- var channel = getChannel();
- if(mySysIsIos()){
- phoneType="ios";
- channel="ios";
- }
- if(rid==""||rid==undefined){
- return
- }
- $.post("/jyapp/free/savePushIdMsg",{"id":id,"phoneType":phoneType,"rid":rid,"oid":oid,"channel":channel},function(data){
- if(data.success){
- clearInterval(interval);
- }
- })
- },1000)
- }
- catch(err){
- alert(err)
- }
- }
- function isIphoneX(){
- return /iphone/gi.test(navigator.userAgent) && (screen.height >= 812)
- }
- function myDomain(){
- return window.location.protocol+"//"+window.location.host;
- }
- /******* 获取url参数(正则)********/
- function getParam(name) {
- var search = document.location.search;
- // alert(search);
- var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
- var matcher = pattern.exec(search);
- var items = null;
- if (null != matcher) {
- try {
- items = decodeURIComponent(decodeURIComponent(matcher[1]));
- } catch (e) {
- try {
- items = decodeURIComponent(matcher[1]);
- } catch (e) {
- items = matcher[1];
- }
- }
- }
- return items;
- };
- //分销系统 客户端识别口令 调用
- var tipFlag = true;
- function distribInfo(tt){
- var myHref = window.location.href;
- // alert(myHref+"--:"+tt)
- if (myHref.indexOf("free/login")>-1&&(myHref.indexOf("appUrl=")>-1||myHref.indexOf("url=")>-1)){
- //清除客户端粘贴板
- try{
- JyObj.clearRight();
- }catch(e){}
- return false
- }
- if (tt!=""&&tt.indexOf("复制")>-1&&tt.indexOf("剑鱼标讯")>-1){
- var tt_last = tt.split(":")[1]//汉语:
- var discored = tt_last.split(",")[0]//汉语,获取口令
- if (discored!=""){
- $.ajax({
- url: "/distribution/share/getWordInfo?t="+new Date().getTime(),
- type: "POST",
- data: {copyTxt:tt},
- async:false,
- dataType: "json",
- success: function(r){
- // alert(JSON.stringify(r))
- if(r.error_code==0){
- //清除客户端粘贴板
- try{
- nowTime = new Date(formatDate(nowTime,true)+ " 00:00:00").getTime();
- localStorage.setItem("Active_Vip_Invite",nowTime);
- JyObj.clearRight();
- }catch(e){}
- tipFlag = false;
- var res = r.data
- var imgUrl = res["imgUrl"]=="undefined"?"":res["imgUrl"];//产品头像
- var modular = res["modular"]=="undefined"?"":res["modular"];//产品名称
- var nickName = res["shareNickname"]=="undefined"?"":res["shareNickname"];//分销者昵称
- var appUrl = res["appUrl"]=="undefined"?"":res["appUrl"];//跳转链接
- //日志中转链接
- appUrl = "/jyapp/distrib/redirectTo?url="+encodeURIComponent(appUrl+"&&"+modular)
- if (!res["isLogin"]&&appUrl!=""){
- if (myHref.indexOf("/free/login")>-1){
- var fh = "?"
- if (myHref.indexOf("?")>-1){
- fh="&"
- }
- history.replaceState(null,null,myHref+fh+"appUrl="+encodeURIComponent(appUrl))
- }else{
- appUrl = "/jyapp/free/login?url="+encodeURIComponent(appUrl);
- }
- }
- setTimeout(function(){
- DisWord_Tip_Invite(imgUrl,modular,nickName,appUrl);
- },500)
- }
- },
- error: function(){
- }
- });
- }
- }
- }
- //口令弹窗
- var DisWord_Tip_Invite = function(imgUrl,modular,nickName,appUrl){
- var html = '<div style="background: #fff;border-radius: 7px;">'
- +'<div style="display: flex;padding: 24px">'
- +'<div style="width: 54px;height: 54px;border-radius: 4px;margin-right: 10px;" class="_img">'
- +'<img style="border: 0;vertical-align: middle;max-width: 100%;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);" src="'+imgUrl+'"/>'
- +'</div>'
- +'<div style="padding: 4px 0px;" class="_info">'
- +'<p style="font-family: PingFang SC;font-style: normal;font-weight: normal;font-size: 15px;line-height: 22px;color:#000;">您的好友 '+nickName+'</p>'
- +'<p style="font-family: PingFang SC;font-style: normal;font-weight: normal;font-size: 13px;line-height: 22px;color:#5F5E64;margin-top: 4px;">向您推荐了剑鱼标讯 '+modular+'</p>'
- +'</div>'
- +'</div>'
- +'<div style="background: #2ABED1;border-radius: 4px;text-align: center;height: 40px;color: #F7F9FA;line-height: 40px;margin: 0 24px 10px;font-size: 16px;" class="goToPage">打开</div>'
- +'<div style="font-size: 12px;line-height: 18px;text-align: center;color: #9B9CA3;padding-bottom: 10px;">- 全国招标信息免费看,不遮挡 -</div>'
- +'</div>';
- $("body").append('<div class="modal fade" id="myModal-tap" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="true" style="z-index: 100001;">'
- +'<div class="modal-dialog" style="height:100%;margin:0px;">'
- +'<div style="width: 6rem;height: 7.2rem;position: relative;top: 5.5rem;left:48%;margin-left: -2.8rem;">'
- +'<img src="/jyapp/vipsubscribe/image/close.png?v=51430" style="position: absolute;width: 27px;top:-50.5px;right: 0rem;" onclick="DTIClose()">'
- +html
- +'</div>'
- +'</div>'
- +'</div>');
- $("body").append('<div class="modal-backdrop fade in"></div>')
- $("#myModal-tap").show();
- setTimeout(function(){
- $("#myModal-tap").addClass("in")
- },0);
- $(".modal-backdrop").css("z-index","100000");
- $(".goToPage").on("tap",function(){
- //app分销中转页面
- DTIClose();
- window.location.href = appUrl;
- });
- }
- //分销弹窗 关闭
- function DTIClose(){
- $("#myModal-tap").on('webkitTransitionEnd msTransitionend mozTransitionend transitionend', function(){
- $("#myModal-tap").hide();
- $(".modal-backdrop").remove();
- });
- $("#myModal-tap").removeClass("in");
- }
- //格式化时间
- function formatDate(date,hms) {
- if(date ===null || date==="" || date === 0){
- return "-"
- }
- var date = new Date(date);
- var YY = date.getFullYear() + '-';
- var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
- var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
- var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
- var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
- var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
- if(!hms){
- return YY + MM + DD + " " + hh + mm + ss
- }else{
- return YY + MM + DD
- }
- }
|