Menu
I need to convert this code into 1 function so that if I send it a URL, it returns the tinyURL. I’m using it in a Greasemonkey script, so the code below as-is will not work with the onload parameters.
[CODE]
<script type=”text/javascript” charset=”utf-8″>
window.onload = function() {
var s = document.createElement(‘script’);
var v = document.getElementById(‘url’).value;
s.setAttribute(‘src’, ‘http://remysharp.com/tinyurlapi?callback=tinyurlCallback&url=’ + v);
document.body.appendChild(s);
}
function tinyurlCallback(url) {
alert(‘URL converted to: ‘ + url);
}
</script>