forked from stacktracejs/stacktrace.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
stacktrace-bookmarklet.js
1 lines (1 loc) · 1.43 KB
/
stacktrace-bookmarklet.js
1
javascript:(function(window,document){ldJS=function(){s=document.createElement('script');s.type='text/javascript';s.src='https://github.com/eriwen/javascript-stacktrace/raw/master/stacktrace.js';document.getElementsByTagName('head')[0].appendChild(s);};aT=function(){alert(printStackTrace().join('\n'))};aTWE=function(){window.onerror=aT};aTCF=function(fn){eval('_old_'+fn+'='+fn+';function%20'+fn+'(args){aT();_old_'+fn+'.call(this,args);}')};c=document.createElement('div');cs=c.style;cs.position='fixed';cs.top='0';cs.right='0';cs.backgroundColor='#ddd';cs.padding='0.3em';cs.margin='0%20auto';t=document.createElement('span');ts=t.style;ts.fontWeight='bold';t.innerHTML='Javascript%20Stacktrace:%20';c.appendChild(t);b0=document.createElement('input');b0.type='button';b0.value='Load%20stacktrace.js';b0.style.margin='0%201em';b0.onclick=ldJS;c.appendChild(b0);b1=document.createElement('input');b1.type='button';b1.value='Attach%20to%20window.onerror';b1.style.margin='0%201em';b1.onclick=aTWE;c.appendChild(b1);i=document.createElement('input');i.type='text';c.appendChild(i);b2=document.createElement('input');b2.type='button';b2.value='Attach%20to%20custom%20function';b2.style.marginRight='2em';b2.onclick=function(){aTCF(i.value)};c.appendChild(b2);cl=document.createElement('A');cl.href='javascript:void(0);';cl.onclick=function(){c.parentNode.removeChild(c);};cl.innerHTML='close';c.appendChild(cl);document.body.appendChild(c);})(window,document);