Created
September 16, 2008 17:02
-
-
Save aitor/11069 to your computer and use it in GitHub Desktop.
This file contains 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
// | |
// copied from: http://www.tek-tips.com/viewthread.cfm?qid=1465395&page=5 | |
// TODO: reference original author... | |
// | |
function copy(rubyurl) { | |
var flashcopier = 'flashcopier'; | |
if(!document.getElementById(flashcopier)) { | |
var divholder = document.createElement('div'); | |
divholder.id = flashcopier; | |
document.body.appendChild(divholder); | |
} | |
document.getElementById(flashcopier).innerHTML = ''; | |
var divinfo = '<embed src="/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(rubyurl)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'; | |
document.getElementById(flashcopier).innerHTML = divinfo; | |
$('x_copy_button').hide(); | |
$('x_copied').show(); | |
} | |
Event.observe(window, 'load', function() { | |
// Watch for user's click on "Auto Copy" checkbox | |
if ($('auto_copy')) | |
Event.observe('auto_copy', 'change', function(event) { document.cookie = 'auto_copy='+($F('auto_copy') ? 1 : 0); }); | |
// Perform auto-copy if prudent | |
if ((link = $$('#url.arrow a')).length && document.cookie.match(/auto_copy=1/)) | |
copy(link[0].href); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment