-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmarklet.html
11 lines (11 loc) · 1.58 KB
/
bookmarklet.html
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Bookmarklet</title>
</head>
<body>
Drag this link to your bookmarks or favorites bar
<a href="javascript:(function(w,d,c,s,e,i){c=d.createElement('div');s=c.style;s.position='fixed';s.top='0';s.right='0';s.backgroundColor='#ddd';s.padding='0.3em';s.margin='0%20auto';e=d.createElement('span');s=e.style;s.fontWeight='bold';s.marginRight='1em';e.innerHTML='Javascript%20Stacktrace:%20';c.appendChild(e);e=d.createElement('input');e.type='button';e.value='Load%20stacktrace.js';e.style.marginRight='1em';e.onclick=function(e,s){s=d.createElement('script');s.type='text/javascript';s.src='//rawgithub.com/stacktracejs/stacktrace.js/master/stacktrace.js';d.getElementsByTagName('head')[0].appendChild(s)};c.appendChild(e);e=d.createElement('input');e.type='button';e.value='Attach%20to%20window.onerror';e.style.marginRight='1em';e.onclick=function(){w.onerror=function(){alert(printStackTrace().join('\n'))}};c.appendChild(e);i=d.createElement('input');i.type='text';c.appendChild(i);e=d.createElement('input');e.type='button';e.value='Attach%20to%20custom%20function';e.style.marginRight='2em';e.onclick=function(e,fn){fn=i.value;eval('_old_'+fn+'='+fn+';'+fn+'=function(){alert(printStackTrace().join("\\n"));_old_'+fn+'.apply(this,arguments);}')};c.appendChild(e);e=d.createElement('a');e.onclick=function(){c.parentNode.removeChild(c)};s=e.style;s.textDecoration='none';s.cursor='pointer';e.innerHTML='×';c.appendChild(e);(d.body||d.getElementsByTagName('body')[0]).appendChild(c);})(window,document);">Stack Trace</a>
</body>
</html>