Skip to content

Instantly share code, notes, and snippets.

@JEEN
Created November 17, 2009 07:04
Show Gist options
  • Save JEEN/236729 to your computer and use it in GitHub Desktop.
Save JEEN/236729 to your computer and use it in GitHub Desktop.
// inspired by Instapaper Bookmarklet
var title,d=document,l=d.location,href=l.href;
if (/www\.aladdin\.co\.kr\/shop\/wproduct\.aspx/.test(l)) {
href.match(/ISBN=(.+)$/);
var isbn = RegExp.$1;
if (isbn) {
i = document.createElement('iframe');
i.setAttribute('name', 'dl2');
i.setAttribute('id', 'dl2');
document.body.appendChild(i);
i.onload = function() { setTimeout(_close, 350); }
window['dl2'].document.write('<html><body><form action="http://localhost:8080/bookmarklet/add" method="post" id="f">'
+ '<input type="hidden" name="id" value="'+isbn+'"/>'
+ '</form>'
+ '<scr' + 'ipt>setTimeout(function() { document.getElementById("f").submit(); }, 1);</scr' + 'ipt>'
+ '</body></html>');
}
} else {
alert('WTF?');
}
function _close() {
var f = document.getElementById('dl2');
f.style.display = 'none';
f.parentNode.removeChild(f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment