function $$(id) { return document.getelementbyid(id); } function $a(s) { alert(s); } function $af(s) { alert(s); return false; } function $r(s) { return s.replace(/ /g, "").replace(/ /g, ""); } function $rr(par) { $$(par).value = $r($$(par).value); } function $rrr(obj) { obj.value = $r(obj.value); } function $i(s1, s2) { if (s1.indexof(s2) != -1) return true; else return false; } function locahref() { var s = location.href; if (s.indexof("#") != -1) s = s.substring(0, s.indexof("#")); return s; } function $l(s, seconds) { if (s == "") s = location.href; if (s.indexof("#") != -1) s = s.substring(0, s.indexof("#")); function _f() { window.location = s; } if (seconds == null) _f(); else settimeout(_f, seconds * 1000); } function $lf(s, seconds) { $l(s, seconds); return false; } function $c(s, t) { if (confirm(t)) $l(s); } function $cf(s, t) { $c(s, t); return false; } function $n(obj) { obj.style.display = "none"; } function $h(obj, value) { if (value == 0) { obj.style.filter = "gray"; } else { obj.style.opacity = value; obj.style.filter = "alpha(opacity=" + value * 100 + ")"; } } function $s(obj, container) { var b = obj.parentnode.getelementsbytagname("li"); var v = $$(container).getelementsbytagname("blockquote"); for (i = 0; i < v.length; i++) { if (obj == b[i]) { b[i].classname = "on"; v[i].classname = "block"; } else { b[i].classname = ""; v[i].classname = "none"; } } } /**/ function regxnum() { return /^[\d]+$/; } function regxemail() { return /^[_a-za-z\d\-\.]+@[_a-za-z\d\-]+(\.[_a-za-z\d\-]+)+$/; } function regxtel() { return /^1[0-9]{10}$/; } function regxqq() { return /^[0-9]{4,15}$/; } /**/ function setcookie(name, value, seconds) { if (seconds == 0) { document.cookie = name + "=" + escape(value); } else { var exp = new date(); exp.settime(exp.gettime() + seconds * 1000); document.cookie = name + "=" + escape(value) + ";expires=" + exp.togmtstring(); } } function setcookieminutes(name, value, minutes) { setcookie(name, value, minutes * 60); } function setcookiehours(name, value, hours) { setcookie(name, value, hours * 60 * 60); } function setcookiedays(name, value, days) { setcookie(name, value, days * 24 * 60 * 60); } function getcookie(name) { var arr = document.cookie.match(new regexp("(^| )" + name + "=([^;]*)(;|$)")); if (arr != null) { return unescape(arr[2]); } else { return null; } } function delcookie(name) { var exp = new date(); exp.settime(exp.gettime() - 1000); var var1 = getcookie(name); if (var1 != null) { document.cookie = name + "=" + var1 + ";expires=" + exp.togmtstring(); } } /**/ function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } function lefttrim(str) { return str.replace(/(^\s*)/g, ""); } function righttrim(str) { return str.replace(/(\s*$)/g, ""); } function getlength(str) { var reallength = 0; var len = str.length; var charcode = -1; for (var i = 0; i < len; i++) { charcode = str.charcodeat(i); if (charcode >= 0 && charcode <= 128) { reallength += 1; } else { reallength += 2; } } return reallength; } /**/ function addfav(url, title) { if (url == "") url = location.href; if (title == "") title = document.title; try { window.external.addfavorite(url, title); } catch (e) { try { window.sidebar.addpanel(title, url, ""); } catch (e) { alert("该浏览器尚不支持,请您按ctrl+d进行收藏!"); } } } function sethome(obj, vrl, url) { try { obj.style.behavior = 'url(#default#homepage)'; obj.sethomepage(vrl); this.style.behavior = 'url(#default#homepage)'; this.sethomepage(url); } catch (e) { if (window.netscape) { try { netscape.security.privilegemanager.enableprivilege("universalxpconnect"); } catch (e) { alert("此操作被浏览器拒绝,请手动设置!"); } var prefs = components.classes['@mozilla.org/preferences-service;1'].getservice(components.interfaces.nsiprefbranch); prefs.setcharpref('browser.startup.homepage', vrl); } } } function copytoclipboard(text) { if (window.clipboarddata) { window.clipboarddata.cleardata(); window.clipboarddata.setdata("text", text); } else { alert("此操作被浏览器拒绝,请您手动复制!"); } } function resizepic(imgtag, fitwidth, fitheight) { var image = new image(); image.src = imgtag.src; if (image.width > 0 && image.height > 0) { if (image.width / image.height >= fitwidth / fitheight) { if (image.width > fitwidth) { imgtag.width = fitwidth; imgtag.height = (image.height * fitwidth) / image.width; } else { imgtag.width = image.width; imgtag.height = image.height; } } else { if (image.height > fitheight) { imgtag.height = fitheight; imgtag.width = (image.width * fitheight) / image.height; } else { imgtag.width = image.width; imgtag.height = image.height; } } } } function rolling(objbox_, obj1_, obj2_, speed) { var objbox = $$(objbox_); var obj1 = $$(obj1_); var obj2 = $$(obj2_); obj2.innerhtml = obj1.innerhtml; function marquee() { if (obj2.offsetwidth - objbox.scrollleft <= 0) { objbox.scrollleft -= obj1.offsetwidth } else { objbox.scrollleft++ } } var mymar = setinterval(marquee, speed); objbox.onmouseover = function() { clearinterval(mymar) } objbox.onmouseout = function() { mymar = setinterval(marquee, speed); } } /**/ var base64encodechars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/"; var base64decodechars = new array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); function base64encode(str) { var out, i, len; var c1, c2, c3; len = str.length; i = 0; out = ""; while (i < len) { c1 = str.charcodeat(i++) & 0xff; if (i == len) { out += base64encodechars.charat(c1 >> 2); out += base64encodechars.charat((c1 & 0x3) << 4); out += "=="; break; } c2 = str.charcodeat(i++); if (i == len) { out += base64encodechars.charat(c1 >> 2); out += base64encodechars.charat(((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4)); out += base64encodechars.charat((c2 & 0xf) << 2); out += "="; break; } c3 = str.charcodeat(i++); out += base64encodechars.charat(c1 >> 2); out += base64encodechars.charat(((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4)); out += base64encodechars.charat(((c2 & 0xf) << 2) | ((c3 & 0xc0) >> 6)); out += base64encodechars.charat(c3 & 0x3f); } return out; } function base64decode(str) { var c1, c2, c3, c4; var i, len, out; len = str.length; i = 0; out = ""; while (i < len) { /* c1 */ do { c1 = base64decodechars[str.charcodeat(i++) & 0xff]; } while (i < len && c1 == -1); if (c1 == -1) { break; } /* c2 */ do { c2 = base64decodechars[str.charcodeat(i++) & 0xff]; } while (i < len && c2 == -1); if (c2 == -1) { break; } out += string.fromcharcode((c1 << 2) | ((c2 & 0x30) >> 4)); /* c3 */ do { c3 = str.charcodeat(i++) & 0xff; if (c3 == 61) { return out; } c3 = base64decodechars[c3]; } while (i < len && c3 == -1); if (c3 == -1) { break; } out += string.fromcharcode(((c2 & 0xf) << 4) | ((c3 & 0x3c) >> 2)); /* c4 */ do { c4 = str.charcodeat(i++) & 0xff; if (c4 == 61) return out; c4 = base64decodechars[c4]; } while (i < len && c4 == -1); if (c4 == -1) { break; } out += string.fromcharcode(((c3 & 0x03) << 6) | c4); } return out; } function utf16to8(str) { var out, i, len, c; out = ""; len = str.length; for (i = 0; i < len; i++) { c = str.charcodeat(i); if ((c >= 0x0001) && (c <= 0x007f)) { out += str.charat(i); } else if (c > 0x07ff) { out += string.fromcharcode(0xe0 | ((c >> 12) & 0x0f)); out += string.fromcharcode(0x80 | ((c >> 6) & 0x3f)); out += string.fromcharcode(0x80 | ((c >> 0) & 0x3f)); } else { out += string.fromcharcode(0xc0 | ((c >> 6) & 0x1f)); out += string.fromcharcode(0x80 | ((c >> 0) & 0x3f)); } } return out; } function utf8to16(str) { var out, i, len, c; var char2, char3; out = ""; len = str.length; i = 0; while (i < len) { c = str.charcodeat(i++); switch (c >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: { // 0xxxxxxx out += str.charat(i - 1); break; } case 12: case 13: { // 110x xxxx 10xx xxxx char2 = str.charcodeat(i++); out += string.fromcharcode(((c & 0x1f) << 6) | (char2 & 0x3f)); break; } case 14: { // 1110 xxxx 10xx xxxx 10xx xxxx char2 = str.charcodeat(i++); char3 = str.charcodeat(i++); out += string.fromcharcode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0)); break; } } } return out; } function base64en(value) { return base64encode(utf16to8(value)).replace(/=/g, "_").replace(/\+/g, "!").replace(/\//g, "*"); //base64encode(utf16to8(value)) } function base64de(value) { return utf8to16(base64decode(value.replace(/\*/g, "/").replace(/\!/g, "+").replace(/_/g, "="))); //utf8to16(base64decode(value)) } /**/ function selectall(obj) { var objs = obj.parentnode.parentnode.parentnode.getelementsbytagname("input"); for (var i = 0; i < objs.length; i++) { if (objs[i] != obj && objs[i].type == "checkbox" && objs[i].style.display != "none" && objs[i].classname != "none") { if (objs[i].checked == true) objs[i].checked = false; else objs[i].checked = true; } } } function getselected(objid) { var result = ""; var objs; if (objid == null || objid == "") { objs = document.getelementsbytagname("input"); } else { objs = $$(objid).getelementsbytagname("input"); } for (var i = 0; i < objs.length; i++) { if (objs[i].type == "checkbox") { if (objs[i].checked == true) { result += "," + objs[i].value; } } } if (result.indexof(",0,") != -1) { result = result.replace(",0,", ""); } else { if (result.indexof(",") != -1) { result = result.substring(1); } } return result; } /**/ function editoron(onimg, offimg, content, width, height, _allowfilemanager, _filtermode, _resizetype, _imagesizelimit, _items, _submitbutton) { if ($$(onimg)) $$(onimg).style.display = "none"; if ($$(offimg)) $$(offimg).style.display = ""; if (document.all) { $$(content).style.width = width; $$(content).style.height = height; } else { $$(content).style.width = width + "px"; $$(content).style.height = height + "px"; } kindeditor.basepath = "/s/tool/editor/"; if (_items == null) { pub_editor1 = kindeditor.create("#" + content, { csspath: "/s/tool/editor/plugins/code/prettify.css", uploadjson: "/s/tool/editor/asp.net/upload_json.ashx", filemanagerjson: "/s/tool/editor/asp.net/file_manager_json.ashx", allowfilemanager: _allowfilemanager, filtermode: _filtermode, resizetype: _resizetype, aftertab: function() { this.inserthtml("  "); }, imagesizelimit: _imagesizelimit, aftercreate: function funsub() { var self = this; kindeditor.ctrl(self.edit.doc, 13, function() { self.sync(); if (_submitbutton != null && $$(_submitbutton)) { $$(_submitbutton).click(); } }); } }); } else { pub_editor1 = kindeditor.create("#" + content, { csspath: "/s/tool/editor/plugins/code/prettify.css", uploadjson: "/s/tool/editor/asp.net/upload_json.ashx", filemanagerjson: "/s/tool/editor/asp.net/file_manager_json.ashx", allowfilemanager: _allowfilemanager, filtermode: _filtermode, resizetype: _resizetype, aftertab: function() { this.inserthtml("  "); }, imagesizelimit: _imagesizelimit, items: _items, aftercreate: function funsub() { var self = this; kindeditor.ctrl(self.edit.doc, 13, function() { self.sync(); if (_submitbutton != null && $$(_submitbutton)) { $$(_submitbutton).click(); } }); } }); } } function editoroff(onimg, offimg, content, width, height) { if ($$(onimg)) $$(onimg).style.display = ""; if ($$(offimg)) $$(offimg).style.display = "none"; if (document.all) { $$(content).style.width = width; $$(content).style.height = height; } else { $$(content).style.width = width + "px"; $$(content).style.height = height + "px"; } if (pub_editor1) { pub_editor1.remove(); pub_editor1 = null; } } /**/ function uploadchange(fileupload1, previewobj, fakefield, limittype, submitbtn, pathtextlen) { var value = fileupload1.value; if (value == "") { return; } if ($$(submitbtn)) { $$(submitbtn).removeattribute("disabled"); } limittype = (limittype == "") ? ".jpg|.jpeg|.gif|.bmp|.png" : limittype; var reg = new regexp(limittype, "i"); if (!value.match(reg)) { alert("格式不正确,请上传" + limittype.touppercase().replace(/\./g, "").replace(/\|/g, "、") + "格式的文件!"); fileupload1.value = ""; if ($$(submitbtn)) { $$(submitbtn).setattribute("disabled", "disabled"); } return; } $$(fakefield).innerhtml = (pathtextlen > 0) ? (value.substring(0, pathtextlen) + ((value.length > pathtextlen) ? "..." : "")) : value; if (!$$(previewobj)) return; var img = $$(previewobj); if (navigator.useragent.indexof("firefox") != -1) { if (fileupload1.files) { img.src = fileupload1.files.item(0).getasdataurl(); img.style.display = ""; } } else if (navigator.useragent.indexof('msie') != -1) { var iver = navigator.useragent.substr(navigator.useragent.indexof('msie') + 5, 1); if (iver <= 6) { img.src = value; img.style.display = ""; if (iver == 6) { var image = new image(); image.dynsrc = value; var isize = math.round(image.filesize / 1024); if (isize > 200) alert("您选择的文件大小超过了200k,可能上传过程要等待更长的时间!"); } } else if (iver > 6) { img.filters.item("dximagetransform.microsoft.alphaimageloader").src = value; img.style.display = ""; } } } var tinytimeout, tinytimeout2; var tiny = {}; tiny.box = function() { var p, m, b, fn, ic, iu, iw, ih, ia, f = 0; return { show: function(c, u, w, h, a, t, k) { cleartimeout(tinytimeout); if (!f) { p = document.createelement('div'); p.id = 'tinybox'; if (k == 0) { p.style.padding = '0px'; p.style.borderwidth = '0px'; p.style.background = 'none'; } m = document.createelement('div'); m.id = 'tinymask'; b = document.createelement('div'); b.id = 'tinycontent'; document.body.appendchild(m); document.body.appendchild(p); p.appendchild(b); window.onresize = tiny.box.resize; f = 1; } if (!a && !u) { p.style.width = w ? w + 'px' : 'auto'; p.style.height = h ? h + 'px' : 'auto'; p.style.backgroundimage = 'none'; b.innerhtml = c; } else { b.style.display = 'none'; p.style.width = p.style.height = '100px' } this.mask(); ic = c; iu = u; iw = w; ih = h; ia = a; this.alpha(m, 1, 50, 1); if (t) { tinytimeout = settimeout(function() { tiny.box.hide() }, 1000 * t) } }, fill: function(c, u, w, h, a) { if (u) { p.style.backgroundimage = ''; var x = window.xmlhttprequest ? new xmlhttprequest() : new activexobject('microsoft.xmlhttp'); x.onreadystatechange = function() { if (x.readystate == 4 && x.status == 200) { tiny.box.psh(x.responsetext, w, h, a) } }; x.open('get', c, 1); x.send(null) } else { if (c.indexof(" w ? -1 : 1, hd = (oh - ho > h) ? -1 : 1; e.si = setinterval(function() { tiny.box.twsize(e, w, wo, wd, h, ho, hd, s) }, 20) }, twsize: function(e, w, wo, wd, h, ho, hd, s) { var ow = e.offsetwidth - wo, oh = e.offsetheight - ho; if (ow == w && oh == h) { clearinterval(e.si); p.style.backgroundimage = 'none'; b.style.display = 'block' } else { if (ow != w) { e.style.width = ow + (math.ceil(math.abs(w - ow) / s) * wd) + 'px' } if (oh != h) { e.style.height = oh + (math.ceil(math.abs(h - oh) / s) * hd) + 'px' } this.pos() } } } } (); tiny.page = function() { return { top: function() { return document.body.scrolltop || document.documentelement.scrolltop }, width: function() { return self.innerwidth || document.documentelement.clientwidth }, height: function() { return self.innerheight || document.documentelement.clientheight }, theight: function() { var d = document, b = d.body, e = d.documentelement; return math.max(math.max(b.scrollheight, e.scrollheight), math.max(b.clientheight, e.clientheight)) }, twidth: function() { var d = document, b = d.body, e = d.documentelement; return math.max(math.max(b.scrollwidth, e.scrollwidth), math.max(b.clientwidth, e.clientwidth)) } } } (); function $m(par1, par2, par3) { cleartimeout(tinytimeout2); tiny.box.show("
" + par2 + "
", 0, 0, 0, 0, par3, 0); if (par2.indexof("animatetophide") != -1) { var _millisecond = 3000; for (var i = 1; i <= 9; i++) { if (par2.indexof("animatetophide" + i) != -1) _millisecond = i * 1000; } tinytimeout2 = settimeout(function() { $("#tinymask").fadeout(1500); $("#tinybox").animate({ top: 0, opacity: "hide" }, 1500); }, _millisecond); } } var mobileplatformcase_ = { android: function() { return navigator.useragent.match(/android/i) ? "android" : ""; }, blackberry: function() { return navigator.useragent.match(/blackberry/i) ? "blackberry" : ""; }, ios: function() { return navigator.useragent.match(/iphone|ipad|ipod/i) ? "ios" : ""; }, windows: function() { return navigator.useragent.match(/iemobile/i) ? "windows phone" : ""; } }; function mobileplatform_() { return mobileplatformcase_.android() + mobileplatformcase_.blackberry() + mobileplatformcase_.ios() + mobileplatformcase_.windows(); } function ismobileplatform_() { if (navigator.platform.indexof("win32") != -1) return false; if (mobileplatform_() == "") return false; return true; } function redirectwap(par) { //var system={win:false,mac:false,xll:false};var _p=navigator.platform;system.win=_p.indexof("win")==0;system.mac=_p.indexof("mac")==0;system.x11=(_p=="x11")||(_p.indexof("linux")==0);if(!system.win&&!system.mac&&!system.xll)$l(par); if (ismobileplatform_()) $l(par); } //兼容ie11编辑器 setinterval( function() { if ($.browser.mozilla && $.browser.version == "11.0") { if ($(".ke-dialog-default").length > 0) $(".ke-dialog-default").css({ "left": ($(window).width() - $(".ke-dialog-default").width()) / 2 + "px", "top": ($(window).height() - $(".ke-dialog-default").height()) / 2 + "px" }); if ($(".ke-menu-default").length > 0) $(".ke-menu-default").css({ "left": ($(window).width() - $(".ke-menu-default").width()) / 2 + "px", "top": ($(window).height() - $(".ke-menu-default").height()) / 2 + "px" }); if ($(".ke-colorpicker-default").length > 0) $(".ke-colorpicker-default").css({ "left": ($(window).width() - $(".ke-colorpicker-default").width()) / 2 + "px", "top": ($(window).height() - $(".ke-colorpicker-default").height()) / 2 + "px" }); } } , 1000); var weixinenable = false; var absoluteroot = "http://www.zghhrl.com/";