Created
May 11, 2010 00:42
-
-
Save memememomo/396758 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name hatena reference link creater | |
// @namespace http://memememomo.org/download/ | |
// @include * | |
// ==/UserScript== | |
(function() { | |
var url = location.href; | |
var title = (document.getElementsByTagName('title'))[0].innerText; | |
var hatena_link = "[" + url + ":title=" + title + "]"; | |
var textarea = document.createElement("textarea"); | |
textarea.value = hatena_link; | |
textarea.addEventListener('onclick', function() { | |
textarea.select(); | |
}); | |
var button = document.createElement("input"); | |
button.type = "button"; | |
button.value = "選択"; | |
button.addEventListener('click', function() { | |
textarea.select(); | |
}); | |
var elm = (document.getElementsByTagName('body')[0]); | |
elm.appendChild(textarea); | |
elm.appendChild(button); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment