diff --git a/dist/vconsole.min.js b/dist/vconsole.min.js index 496e7705..cc0db88b 100644 --- a/dist/vconsole.min.js +++ b/dist/vconsole.min.js @@ -3,5 +3,5 @@ * Copyright 2016, WechatFE Team * MIT license */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vConsole=t():e.vConsole=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),l=n(r),i=o(14),a=n(i),c=o(15),s=n(c),d=o(22),u=n(d),v=o(24),f=n(v),p=new l["default"];p.addPlugin(s["default"]),p.addPlugin(u["default"]),p.addPlugin(f["default"]),p.VConsolePlugin=a["default"],t["default"]=p,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var o=0;ot||Math.abs(o.pageY-r)>t)&&(l=!0)}),this.$dom.addEventListener("touchend",function(t){l===!1&&t.timeStamp-o0){var n=o.touches[0].pageX-e.switchPos.startX,r=o.touches[0].pageY-e.switchPos.startY,l=e.switchPos.x-n,i=e.switchPos.y-r;l<0&&(l=0),i<0&&(i=0),l+t.offsetWidth>document.body.offsetWidth&&(l=document.body.offsetWidth-t.offsetWidth),i+t.offsetHeight>document.body.offsetHeight&&(i=document.body.offsetHeight-t.offsetHeight),t.style.right=l+"px",t.style.bottom=i+"px",e.switchPos.endX=l,e.switchPos.endY=i,o.preventDefault()}}),v["default"].bind(v["default"].one(".vc-switch",e.$dom),"click",function(){e.show()}),v["default"].bind(v["default"].one(".vc-hide",e.$dom),"click",function(){e.hide()}),v["default"].bind(v["default"].one(".vc-mask",e.$dom),"click",function(t){return t.target==v["default"].one(".vc-mask")&&void e.hide()}),v["default"].delegate(v["default"].one(".vc-tabbar",e.$dom),"click",".vc-tab",function(t){var o=this.dataset.tab;o!=e.activedTab&&e.showTab(o)})}},{key:"_autoRun",value:function(){this.isReady=!0;for(var e in this.pluginList)this._initPlugin(this.pluginList[e]);this.showTab(this.tabList[0])}},{key:"_initPlugin",value:function(e){var t=this;e.trigger("init"),e.trigger("renderTab",function(o){t.tabList.push(e.id);var n=v["default"].render(g["default"],{id:e.id,name:e.name});v["default"].one(".vc-tabbar",t.$dom).appendChild(n);var r=v["default"].render(m["default"],{id:e.id});o&&(d.isString(o)?r.innerHTML+=o:d.isFunction(o.appendTo)?o.appendTo(r):d.isElement(o)&&r.appendChild(o)),v["default"].one(".vc-content",t.$dom).appendChild(r)}),e.trigger("addTool",function(t){if(t)for(var o=v["default"].one(".vc-tool-last"),n=0;n0?new Date(e):new Date,o=t.getDate()<10?"0"+t.getDate():t.getDate(),n=t.getMonth()<9?"0"+(t.getMonth()+1):t.getMonth()+1,r=t.getFullYear(),l=t.getHours()<10?"0"+t.getHours():t.getHours(),i=t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes(),a=t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds(),c=t.getMilliseconds()<10?"0"+t.getMilliseconds():t.getMilliseconds();return c<100&&(c="0"+c),{time:+t,year:r,month:n,day:o,hour:l,minute:i,second:a,millisecond:c}}function n(e){return"[object Number]"==Object.prototype.toString.call(e)}function r(e){return"[object String]"==Object.prototype.toString.call(e)}function l(e){return"[object Array]"==Object.prototype.toString.call(e)}function i(e){return"[object Boolean]"==Object.prototype.toString.call(e)}function a(e){return"[object Undefined]"==Object.prototype.toString.call(e)}function c(e){return"[object Null]"==Object.prototype.toString.call(e)}function s(e){return"[object Symbol]"==Object.prototype.toString.call(e)}function d(e){return!("[object Object]"!=Object.prototype.toString.call(e)&&(n(e)||r(e)||i(e)||l(e)||c(e)||u(e)||a(e)||s(e)))}function u(e){return"[object Function]"==Object.prototype.toString.call(e)}function v(e){return"object"===("undefined"==typeof HTMLElement?"undefined":y(HTMLElement))?e instanceof HTMLElement:e&&"object"===("undefined"==typeof e?"undefined":y(e))&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}function f(e){return document.createElement("a").appendChild(document.createTextNode(e)).parentNode.innerHTML}function p(e){function t(e){for(var t=p.length-1;t>=0;t--)if(p[t].child==e)return!0;return!1}function o(e){if(d(e)){if(t(e))return void(v+="CircularObject");p.push({parent:parent,child:e});var b=Object.keys(e);v+="{",f++;for(var g=0;g0&&(n=Array.prototype.slice.call(o)),n},a.addClass=function(e,t){if(e){(0,r.isArray)(e)||(e=[e]);for(var o=0;o-1||(l.push(t),e[o].className=l.join(" "))}}},a.removeClass=function(e,t){if(e){(0,r.isArray)(e)||(e=[e]);for(var o=0;o=0&&y.splice(t,1)}function a(e){var t=document.createElement("style");return t.type="text/css",l(e,t),t}function c(e){var t=document.createElement("link");return t.rel="stylesheet",l(e,t),t}function s(e,t){var o,n,r;if(t.singleton){var l=m++;o=h||(h=a(t)),n=d.bind(null,o,l,!1),r=d.bind(null,o,l,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=c(t),n=v.bind(null,o),r=function(){i(o),o.href&&URL.revokeObjectURL(o.href)}):(o=a(t),n=u.bind(null,o),r=function(){i(o)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}function d(e,t,o,n){var r=o?"":n.css;if(e.styleSheet)e.styleSheet.cssText=_(t,r);else{var l=document.createTextNode(r),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(l,i[t]):e.appendChild(l)}}function u(e,t){var o=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}function v(e,t){var o=t.css,n=t.sourceMap;n&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var r=new Blob([o],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(r),l&&URL.revokeObjectURL(l)}var f={},p=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},b=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=p(function(){return document.head||document.getElementsByTagName("head")[0]}),h=null,m=0,y=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=b()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var o=r(e);return n(o,t),function(e){for(var l=[],i=0;i
vConsole
'},function(e,t){e.exports="{{name}}"},function(e,t){e.exports="
"},function(e,t){e.exports='{{name}}'},function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o0&&(r=l[1].toLowerCase())}if(r?o=r==this.id:0==this.allowUnformattedLog&&(o=!1),!o)return void(e.noOrigin||this.printOriginLog(e));if(e.date||(e.date=+new Date),!this.isReady)return void this.logList.push(e);if(u.isString(t[0])&&(t[0]=t[0].replace(n,""),""===t[0]&&t.shift()),!e.meta){var i=u.getDate(e.date);e.meta=i.hour+":"+i.minute+":"+i.second}for(var a=f["default"].render(h["default"],{logType:e.logType,noMeta:!!e.noMeta,meta:e.meta,style:e.style||""}),s=f["default"].one(".vc-item-content",a),d=0;d")}catch(p){v.innerHTML=" ["+c(t[d])+"]"}v&&s.appendChild(v)}u.isObject(e.content)&&s.appendChild(e.content),f["default"].one(".vc-log",this.$tabbox).appendChild(a),f["default"].one(".vc-content").scrollTop=f["default"].one(".vc-content").scrollHeight,e.noOrigin||this.printOriginLog(e)}}},{key:"getFoldedLine",value:function(e,t){var o=this;if(!t){var n=u.JSONStringify(e),r=n.substr(0,26);t=u.getObjName(e),n.length>26&&(r+="..."),t+=" "+r}var l=f["default"].render(y["default"],{outer:t,lineType:"obj"});return f["default"].bind(f["default"].one(".vc-fold-outer",l),"click",function(t){t.preventDefault(),t.stopPropagation(),f["default"].hasClass(l,"vc-toggle")?(f["default"].removeClass(l,"vc-toggle"),f["default"].removeClass(f["default"].one(".vc-fold-inner",l),"vc-toggle"),f["default"].removeClass(f["default"].one(".vc-fold-outer",l),"vc-toggle")):(f["default"].addClass(l,"vc-toggle"),f["default"].addClass(f["default"].one(".vc-fold-inner",l),"vc-toggle"),f["default"].addClass(f["default"].one(".vc-fold-outer",l),"vc-toggle"));var n=f["default"].one(".vc-fold-inner",l);if(0==n.children.length&&e){for(var r=u.getObjAllKeys(e),i=0;i {{if (!noMeta)}}{{meta}}{{/if}}
'},function(e,t){e.exports="
{{if (lineType == 'obj')}} {{outer}}
{{else if (lineType == 'value')}} {{value}} {{else if (lineType == 'kv')}} {{key}}: {{value}} {{/if}}
"},function(e,t){e.exports=' {{key}}: {{value}} '},function(e,t){e.exports=''},function(e,t){e.exports='
{{content}}
'},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var o=0;o
'},function(e,t,o){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var o=0;o0?n.costTime+"ms":"-",header:n.header,response:v.htmlEncode(n.response)};n.readyState<=1?l.status="Pending":n.readyState<4&&(l.status="Loading");var i=d["default"].render(_["default"],l),a=this.domList[e];n.status>=400&&d["default"].addClass(d["default"].one(".vc-group-preview",i),"vc-table-row-error"),a?a.parentNode.replaceChild(i,a):d["default"].one(".vc-log",this.$tabbox).appendChild(i),this.domList[e]=i;var c=Object.keys(this.reqList).length;c!=o&&this.renderHeader()}},{key:"mockAjax",value:function(){var e=window.XMLHttpRequest;if(e){var t=this,o=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.open=function(){var e=this,n=[].slice.call(arguments),r=n[1],l=t.getUniqueID();e._requestID=l;var i=e.onreadystatechange||function(){};return e.onreadystatechange=function(){var o=t.reqList[l]||{};if(o.url=r,o.readyState=e.readyState,0==e.readyState)o.startTime=+new Date;else if(1==e.readyState)o.startTime=+new Date;else if(2==e.readyState){o.header={};for(var n=e.getAllResponseHeaders()||"",a=n.split("\n"),c=0;c
"},function(e,t){e.exports='
Name {{if (count > 0)}}({{count}}){{/if}}
Status
Time
'},function(e,t){e.exports='
{{url}}
{{status}}
{{costTime}}
Headers
{{for (var key in header)}}
{{key}}
{{header[key]}}
{{/for}}
Response
{{response}}
'}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vConsole=t():e.vConsole=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),l=n(r),a=o(14),i=n(a),c=o(15),s=n(c),d=o(22),u=n(d),v=o(24),f=n(v),p=new l["default"];p.addPlugin(s["default"]),p.addPlugin(u["default"]),p.addPlugin(f["default"]),p.VConsolePlugin=i["default"],t["default"]=p,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var o=0;ot||Math.abs(o.pageY-r)>t)&&(l=!0)}),this.$dom.addEventListener("touchend",function(t){l===!1&&t.timeStamp-o0){var n=o.touches[0].pageX-e.switchPos.startX,r=o.touches[0].pageY-e.switchPos.startY,l=e.switchPos.x-n,a=e.switchPos.y-r;l<0&&(l=0),a<0&&(a=0),l+t.offsetWidth>document.body.offsetWidth&&(l=document.body.offsetWidth-t.offsetWidth),a+t.offsetHeight>document.body.offsetHeight&&(a=document.body.offsetHeight-t.offsetHeight),t.style.right=l+"px",t.style.bottom=a+"px",e.switchPos.endX=l,e.switchPos.endY=a,o.preventDefault()}}),v["default"].bind(v["default"].one(".vc-switch",e.$dom),"click",function(){e.show()}),v["default"].bind(v["default"].one(".vc-hide",e.$dom),"click",function(){e.hide()}),v["default"].bind(v["default"].one(".vc-mask",e.$dom),"click",function(t){return t.target==v["default"].one(".vc-mask")&&void e.hide()}),v["default"].delegate(v["default"].one(".vc-tabbar",e.$dom),"click",".vc-tab",function(t){var o=this.dataset.tab;o!=e.activedTab&&e.showTab(o)}),v["default"].bind(v["default"].one(".vc-panel",e.$dom),"transitionend webkitTransitionEnd oTransitionEnd otransitionend",function(t){return t.target==v["default"].one(".vc-panel")&&void(v["default"].hasClass(e.$dom,"vc-toggle")||(t.target.style.display="none"))})}},{key:"_autoRun",value:function(){this.isReady=!0;for(var e in this.pluginList)this._initPlugin(this.pluginList[e]);this.showTab(this.tabList[0])}},{key:"_initPlugin",value:function(e){var t=this;e.trigger("init"),e.trigger("renderTab",function(o){t.tabList.push(e.id);var n=v["default"].render(g["default"],{id:e.id,name:e.name});v["default"].one(".vc-tabbar",t.$dom).appendChild(n);var r=v["default"].render(m["default"],{id:e.id});o&&(d.isString(o)?r.innerHTML+=o:d.isFunction(o.appendTo)?o.appendTo(r):d.isElement(o)&&r.appendChild(o)),v["default"].one(".vc-content",t.$dom).appendChild(r)}),e.trigger("addTool",function(t){if(t)for(var o=v["default"].one(".vc-tool-last"),n=0;n0?new Date(e):new Date,o=t.getDate()<10?"0"+t.getDate():t.getDate(),n=t.getMonth()<9?"0"+(t.getMonth()+1):t.getMonth()+1,r=t.getFullYear(),l=t.getHours()<10?"0"+t.getHours():t.getHours(),a=t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes(),i=t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds(),c=t.getMilliseconds()<10?"0"+t.getMilliseconds():t.getMilliseconds();return c<100&&(c="0"+c),{time:+t,year:r,month:n,day:o,hour:l,minute:a,second:i,millisecond:c}}function n(e){return"[object Number]"==Object.prototype.toString.call(e)}function r(e){return"[object String]"==Object.prototype.toString.call(e)}function l(e){return"[object Array]"==Object.prototype.toString.call(e)}function a(e){return"[object Boolean]"==Object.prototype.toString.call(e)}function i(e){return"[object Undefined]"==Object.prototype.toString.call(e)}function c(e){return"[object Null]"==Object.prototype.toString.call(e)}function s(e){return"[object Symbol]"==Object.prototype.toString.call(e)}function d(e){return!("[object Object]"!=Object.prototype.toString.call(e)&&(n(e)||r(e)||a(e)||l(e)||c(e)||u(e)||i(e)||s(e)))}function u(e){return"[object Function]"==Object.prototype.toString.call(e)}function v(e){return"object"===("undefined"==typeof HTMLElement?"undefined":y(HTMLElement))?e instanceof HTMLElement:e&&"object"===("undefined"==typeof e?"undefined":y(e))&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}function f(e){return document.createElement("a").appendChild(document.createTextNode(e)).parentNode.innerHTML}function p(e){function t(e){for(var t=p.length-1;t>=0;t--)if(p[t].child==e)return!0;return!1}function o(e){if(d(e)){if(t(e))return void(v+="CircularObject");p.push({parent:parent,child:e});var b=Object.keys(e);v+="{",f++;for(var g=0;g0&&(n=Array.prototype.slice.call(o)),n},i.addClass=function(e,t){if(e){(0,r.isArray)(e)||(e=[e]);for(var o=0;o-1||(l.push(t),e[o].className=l.join(" "))}}},i.removeClass=function(e,t){if(e){(0,r.isArray)(e)||(e=[e]);for(var o=0;o=0&&y.splice(t,1)}function i(e){var t=document.createElement("style");return t.type="text/css",l(e,t),t}function c(e){var t=document.createElement("link");return t.rel="stylesheet",l(e,t),t}function s(e,t){var o,n,r;if(t.singleton){var l=m++;o=h||(h=i(t)),n=d.bind(null,o,l,!1),r=d.bind(null,o,l,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=c(t),n=v.bind(null,o),r=function(){a(o),o.href&&URL.revokeObjectURL(o.href)}):(o=i(t),n=u.bind(null,o),r=function(){a(o)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}function d(e,t,o,n){var r=o?"":n.css;if(e.styleSheet)e.styleSheet.cssText=_(t,r);else{var l=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(l,a[t]):e.appendChild(l)}}function u(e,t){var o=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}function v(e,t){var o=t.css,n=t.sourceMap;n&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var r=new Blob([o],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(r),l&&URL.revokeObjectURL(l)}var f={},p=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},b=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=p(function(){return document.head||document.getElementsByTagName("head")[0]}),h=null,m=0,y=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=b()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var o=r(e);return n(o,t),function(e){for(var l=[],a=0;a
vConsole
'},function(e,t){e.exports="{{name}}"},function(e,t){e.exports="
"},function(e,t){e.exports='{{name}}'},function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o0&&(r=l[1].toLowerCase())}if(r?o=r==this.id:0==this.allowUnformattedLog&&(o=!1),!o)return void(e.noOrigin||this.printOriginLog(e));if(e.date||(e.date=+new Date),!this.isReady)return void this.logList.push(e);if(u.isString(t[0])&&(t[0]=t[0].replace(n,""),""===t[0]&&t.shift()),!e.meta){var a=u.getDate(e.date);e.meta=a.hour+":"+a.minute+":"+a.second}for(var i=f["default"].render(h["default"],{logType:e.logType,noMeta:!!e.noMeta,meta:e.meta,style:e.style||""}),s=f["default"].one(".vc-item-content",i),d=0;d")}catch(p){v.innerHTML=" ["+c(t[d])+"]"}v&&s.appendChild(v)}u.isObject(e.content)&&s.appendChild(e.content),f["default"].one(".vc-log",this.$tabbox).appendChild(i),f["default"].one(".vc-content").scrollTop=f["default"].one(".vc-content").scrollHeight,e.noOrigin||this.printOriginLog(e)}}},{key:"getFoldedLine",value:function(e,t){var o=this;if(!t){var n=u.JSONStringify(e),r=n.substr(0,26);t=u.getObjName(e),n.length>26&&(r+="..."),t+=" "+r}var l=f["default"].render(y["default"],{outer:t,lineType:"obj"});return f["default"].bind(f["default"].one(".vc-fold-outer",l),"click",function(t){t.preventDefault(),t.stopPropagation(),f["default"].hasClass(l,"vc-toggle")?(f["default"].removeClass(l,"vc-toggle"),f["default"].removeClass(f["default"].one(".vc-fold-inner",l),"vc-toggle"),f["default"].removeClass(f["default"].one(".vc-fold-outer",l),"vc-toggle")):(f["default"].addClass(l,"vc-toggle"),f["default"].addClass(f["default"].one(".vc-fold-inner",l),"vc-toggle"),f["default"].addClass(f["default"].one(".vc-fold-outer",l),"vc-toggle"));var n=f["default"].one(".vc-fold-inner",l);if(0==n.children.length&&e){for(var r=u.getObjAllKeys(e),a=0;a {{if (!noMeta)}}{{meta}}{{/if}}
'},function(e,t){e.exports="
{{if (lineType == 'obj')}} {{outer}}
{{else if (lineType == 'value')}} {{value}} {{else if (lineType == 'kv')}} {{key}}: {{value}} {{/if}}
"},function(e,t){e.exports=' {{key}}: {{value}} '},function(e,t){e.exports=''},function(e,t){e.exports='
{{content}}
'},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var o=0;o
'},function(e,t,o){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var o=0;o0?n.costTime+"ms":"-",header:n.header,response:v.htmlEncode(n.response)};n.readyState<=1?l.status="Pending":n.readyState<4&&(l.status="Loading");var a=d["default"].render(_["default"],l),i=this.domList[e];n.status>=400&&d["default"].addClass(d["default"].one(".vc-group-preview",a),"vc-table-row-error"),i?i.parentNode.replaceChild(a,i):d["default"].one(".vc-log",this.$tabbox).appendChild(a),this.domList[e]=a;var c=Object.keys(this.reqList).length;c!=o&&this.renderHeader()}},{key:"mockAjax",value:function(){var e=window.XMLHttpRequest;if(e){var t=this,o=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.open=function(){var e=this,n=[].slice.call(arguments),r=n[1],l=t.getUniqueID();e._requestID=l;var a=e.onreadystatechange||function(){};return e.onreadystatechange=function(){var o=t.reqList[l]||{};if(o.url=r,o.readyState=e.readyState,0==e.readyState)o.startTime=+new Date;else if(1==e.readyState)o.startTime=+new Date;else if(2==e.readyState){o.header={};for(var n=e.getAllResponseHeaders()||"",i=n.split("\n"),c=0;c
"},function(e,t){e.exports='
Name {{if (count > 0)}}({{count}}){{/if}}
Status
Time
'},function(e,t){e.exports='
{{url}}
{{status}}
{{costTime}}
Headers
{{for (var key in header)}}
{{key}}
{{header[key]}}
{{/for}}
Response
{{response}}
'}])}); \ No newline at end of file diff --git a/src/core/core.js b/src/core/core.js index 64fd5480..ac942ed7 100644 --- a/src/core/core.js +++ b/src/core/core.js @@ -203,6 +203,16 @@ class VConsole { that.showTab(tabName); }); + // after console panel, trigger a transitionend event to make panel's property 'display' change from 'block' to 'none' + $.bind($.one('.vc-panel', that.$dom), 'transitionend webkitTransitionEnd oTransitionEnd otransitionend', function(e) { + if (e.target != $.one('.vc-panel')) { + return false; + } + if (!$.hasClass(that.$dom, 'vc-toggle')) { + e.target.style.display = 'none'; + } + }); + }; /** @@ -319,10 +329,18 @@ class VConsole { * @public */ show() { - $.addClass(this.$dom, 'vc-toggle'); - this._triggerPluginsEvent('showConsole'); - let mask = $.one('.vc-mask', this.$dom); - mask.style.display = 'block'; + let that = this; + // before show console panel, trigger a transitionstart event to make panel's property 'display' change from 'none' to 'block' + let panel = $.one('.vc-panel', this.$dom); + panel.style.display = 'block'; + + // set 10ms delay to fix confict between display and transition + setTimeout(function() { + $.addClass(that.$dom, 'vc-toggle'); + that._triggerPluginsEvent('showConsole'); + let mask = $.one('.vc-mask', that.$dom); + mask.style.display = 'block'; + }, 10); } /**