!function () { var z = window.zving = window.zving || { version : 2.1 }; var getcurrentscript = function (base) { if (document.currentscript) { return document.currentscript.src; //ff,chrome }; var stack; try { a.b.c(); //强制报错,以便捕获e.stack } catch (e) { //safari的错误对象只有line,sourceid,sourceurl stack = e.stack; if (!stack && window.opera) { //opera 9没有e.stack,但有e.backtrace,但不能直接取得,需要对e对象转字符串进行抽取 stack = (string(e).match(/of linked script \s+/g) || []).join(" "); } } if (stack) { stack = stack.split(/[@ ]/g).pop(); //取得最后一行,最后一个空格或@之后的部分 stack = stack[0] === "(" ? stack.slice(1, -1) : stack.replace(/\s/, ""); //去掉换行符 return stack.replace(/(:\d+)?:\d+$/i, ""); //去掉行号与或许存在的出错字符起始位置 } var nodes = (base ? document : document.head).getelementsbytagname("script"); //只在head标签中寻找 for (var i = nodes.length, node; node = nodes[--i]; ) { if (node.readystate === "interactive") { return node.src; } } var node=nodes[nodes.length - 1]; return node.hasattribute ? node.src : node.getattribute("src", 4); } var jspath = getcurrentscript(true); var scripts = document.getelementsbytagname('script'), script = document.currentscript || scripts[scripts.length - 1]; z.jslibpath = jspath.substr(0, jspath.lastindexof('/') + 1); z.contextpath = script.getattribute('contextpath'); z.config= { namespace: 'window' }; if (z.jslibpath.indexof(location.protocol + '//' + location.host + '/') == 0) { z.jslibpath = z.jslibpath.replace(location.protocol + '//' + location.host, ''); } //再外部没配置应用路径时才使用默认路径 if(!z.contextpath){ z.contextpath = z.jslibpath.replace(/[^\/]+\/?$/, ''); if(z.contextpath.indexof('/preview/') != -1){ z.contextpath=z.contextpath.substr(0,z.contextpath.indexof('preview/')); } } z.importjs = z.importjs = function(url) { if (!/^\/|^\w+\:\/\//.test(url)) { url = z.jslibpath + url; } document.write('