Skip to content

Instantly share code, notes, and snippets.

@karlgroves
Created June 24, 2015 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlgroves/1d73f80f2a0dcc78f82f to your computer and use it in GitHub Desktop.
Save karlgroves/1d73f80f2a0dcc78f82f to your computer and use it in GitHub Desktop.
*Super* rudimentary bookmarklet for testing document source with Tenon
javascript:(function(){var html=document.documentElement.innerHTML;var loaded=0;var iframe=document.createElement('iframe');iframe.name='bookmarklet-'+Math.floor((Math.random()*10000)+1);iframe.style.display='none';iframe.onload=function(){if(++loaded==1){return}document.body.removeChild(iframe)};var form=document.createElement('form');form.method="POST";form.action="https://tenon.io/api/";form.target=iframe.name;var hidden=document.createElement('input');hidden.type='hidden';hidden.name='key';hidden.value='ADD_YOUR_API_KEY_HERE';var store=document.createElement('input');store.type='hidden';store.name='store';store.value='1';var textarea=document.createElement('textarea');textarea.name='src';textarea.value=html;form.appendChild(hidden);form.appendChild(store);form.appendChild(textarea);iframe.appendChild(form);document.body.appendChild(iframe);form.submit()})();
@karlgroves
Copy link
Author

To use this successfully you'll need to replace the string 'ADD_YOUR_API_KEY_HERE' with your API key that you can get over at https://tenon.io/register.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment