// ==UserScript==
// @name Codepad URL Shortener
// @version 1.0.0
// @description Insert a "Get Short URL" button on top of the snippet page
// @author You
// @match https://codepad.co/snippet/*
// @match https://bitly.com/a/bitlinks*
// @grant none
// ==/UserScript==
/*************************************************************
** YOU MUST BE LOGGED IN ON 'bit.ly' TO THIS BOT WORKS **
*************************************************************/
(function() {
if (document.getElementsByClassName('snippet-page')[0]) {
var codepadURL = window.location;
$('.main.left').append("<li>"+
"<a href=\"https://bitly.com/a/bitlinks#"+codepadURL+"\">Get Short URL</a>"+
"</li>");
}
if (document.getElementById('shorten-url')) {
var getURL = /([^#]+$)/.exec(window.location)[0]+"";
document.getElementById('shorten-url').value=getURL;
document.getElementById('shorten-btn').click();
}
})();
View demo: http://i.imgur.com/mPdajl4.png
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.