Skip to content

Instantly share code, notes, and snippets.

@moesoha
Last active April 4, 2018 07:41
Show Gist options
  • Save moesoha/ce09516a370893be4bd8c353267d23f5 to your computer and use it in GitHub Desktop.
Save moesoha/ce09516a370893be4bd8c353267d23f5 to your computer and use it in GitHub Desktop.
Load vConsole when `console` appears in `document.location.search` with one-line snippet
window.document.location.search.substr(1).split('&').forEach(function (v){
if(v.split('=')[0] == 'console'){
if(!window.VConsole){
var s = document.createElement('script');
s.src = 'https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js';
window.document.body.appendChild(s);
}
var c=setInterval(function (){
if(window.VConsole){
clearInterval(c);
window.vConsole = new VConsole();
}
},1000);
}
});
window.document.location.search.substr(1).split('&').forEach(function (v){if(v.split('=')[0]=='console'){if(!window.VConsole){var s=document.createElement('script');s.src='https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js';window.document.body.appendChild(s);}var c=setInterval(function (){if(window.VConsole){clearInterval(c);window.vConsole=new VConsole();}},1000);}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment