//author: 声色视觉
//webSite: www.softboyo.cn
//blog.sina.com/k3man
//date:2022-01-21
//ver 1.1
function baseurl(){return"../cakeapi.dll/boyo/tencent/"}function GetServiceData(a,b){var c={async:!0,crossDomain:!0,url:baseurl()+a,type:"get"};$.ajax(c).done(function(a){b(a)}).fail(function(a){401!=a.status?b("error"):self.location="login.html"})}function PostServiceData(a,b,c){a={async:!1,crossDomain:!0,url:baseurl()+a,type:"POST",contentType:"multipart/form-data",data:b,dataType:"json"};$.ajax(a).done(function(a){c(a)}).fail(function(a){401!=a.status?c("error"):self.location="login.html"})}function PostServiceFiles(a,b,c){$.ajax({async:!0,crossDomain:!0,url:a,type:"POST",processData:!1,contentType:!1,mimeType:"multipart/form-data",data:b}).done(function(a){c(a)}).fail(function(a){401!=a.status?c("error"):self.location="login.html"})}String.format||(String.format=function(a){var b=Array.prototype.slice.call(arguments,1);return a.replace(/{(\d+)}/g,function(a,d){return"undefined"!=typeof b[d]?b[d]:a})});function beautySub(a,b){var c=/[\u4e00-\u9fa5]/g,d=a.substring(0,b),c=~~(d.match(c)&&d.match(c).length),d=2*d.length-c-1;return a.substr(0,d)+(d<a.length?"\u2026\u2026":"")}function ExtractURL(a){for(var b=window.location.search.substring(1).split("\x26"),c=0;c<b.length;c++){var d=b[c].split("\x3d");if(d[0]==a)return d[1]}return!1}$.cookie=function(a,b,c){if("undefined"!=typeof b){c=c||{};null===b&&(b="",c=$.extend({},c),c.expires=-1);var d="";c.expires&&("number"==typeof c.expires||c.expires.toUTCString)&&("number"==typeof c.expires?(d=new Date,d.setTime(d.getTime()+864E5*c.expires)):d=c.expires,d="; expires\x3d"+d.toUTCString());var f=c.path?"; path\x3d"+c.path:"",g=c.domain?"; domain\x3d"+c.domain:"";c=c.secure?"; secure":"";document.cookie=[a,"\x3d",encodeURIComponent(b),d,f,g,c].join("")}else{b=null;if(document.cookie&&""!=document.cookie)for(c=document.cookie.split(";"),d=0;d<c.length;d++)if(f=jQuery.trim(c[d]),f.substring(0,a.length+1)==a+"\x3d"){b=decodeURIComponent(f.substring(a.length+1));break}return b}};function writecookies(a){navigator.cookieEnabled?$.cookie("farmcar",JSON.stringify(a),{expires:7}):alert("\u8bf7\u5141\u8bb8\u63a5\u53d7Cookie\u624d\u80fd\u6b63\u5e38\u4f7f\u7528\u8d2d\u7269\u529f\u80fd\u3002")}function readcookies(){var a=$.cookie("farmcar");return null!=a?JSON.parse(a):null}function pushtocook(a,b,c,d,f,g){g=void 0===g?!1:g;var e={},h=[],k=readcookies();e.id=a;e.quan=parseInt(c);e.pri=d;e.name=b;e.thb=f;if(null!=k)if(h=k,0<compare(h,e))for(key in h)h[key].id===e.id&&(h[key].quan=1==g?h[key].quan+parseInt(c):parseInt(c));else h.push(e);else h.push(e);writecookies(h)}function compare(a,b){return a.filter(function(a){return a.id===b.id}).length}function emptycar(){$.cookie("farmcar",null,{expires:-1})}function rmzero(a){var b=readcookies();for(key in b)b[key].id===a&&(b.splice(key,1),writecookies(b))}function postmsg(){var a=$("#mc-phone").val(),b=$("#mc-content").val();""!=b&&""!=a?(a={tel:a,msg:b},$("#submsg").css("color","white"),$.ajax({type:"post",url:baseurl()+"/api/add/addbbs",data:JSON.stringify(a),dataType:"json",contentType:"application/json"}).done(function(a){$("#submsg").text("\u63d0\u4ea4\u6210\u529f\uff0c\u611f\u8c22\u60a8\u7684\u53cd\u9988\u3002")}).fail(function(a){$("#submsg").text("\u63d0\u4ea4\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u6216\u7a0d\u5019\u518d\u8bd5\u3002")})):($("#submsg").css("color","yellow"),$("#submsg").text("\u8bf7\u586b\u5199\u8054\u7cfb\u65b9\u5f0f\u548c\u54a8\u8be2\u5185\u5bb9\u3002"))}function GetDateTime(){var a=new Date,b=a.getFullYear(),c=a.getMonth()+1,d=a.getDate(),f=10>a.getHours()?"0"+a.getHours():a.getHours(),g=10>a.getMinutes()?"0"+a.getMinutes():a.getMinutes(),e=10>a.getSeconds()?"0"+a.getSeconds():a.getSeconds(),a=a.getMilliseconds();return b+""+c+""+d+""+f+""+g+""+e+""+a}$.formatDT=function(a,b){if(1==b){if(-1<a.search("T")){var c=a.split("T");return c[0]+" "+c[1].replace(".000Z","")}return a.replace(".0","")}return-1<a.search("T")?a.split("T")[0]:a.split(" ")[0]};$.datetime=function(a){var b=new Date(a);a=b.getFullYear();var c=10>b.getMonth()+1?"0"+(b.getMonth()+1):b.getMonth()+1,d=10>b.getDate()?"0"+b.getDate():b.getDate(),f=10>b.getHours()?"0"+b.getHours():b.getHours(),g=10>b.getMinutes()?"0"+b.getMinutes():b.getMinutes(),b=10>b.getSeconds()?"0"+b.getSeconds():b.getSeconds();return a+"-"+c+"-"+d+" "+f+":"+g+":"+b};$.date=function(a){var b=new Date(a);b.setMinutes(b.getMinutes()-b.getTimezoneOffset());a=b.getFullYear();var c=10>b.getMonth()+1?"0"+(b.getMonth()+1):b.getMonth()+1,b=10>b.getDate()?"0"+b.getDate()-1:b.getDate()-1;return a+"-"+c+"-"+b};function msgbox(a){(new NoticeJs({text:a,position:"bottomCenter",animation:{open:"animated flipInX",close:"animated flipOutX"}})).show()}function quit(){localStorage.removeItem("caketoken");self.location="login.html"};