Created
May 22, 2013 22:44
-
-
Save brettneese/5631550 to your computer and use it in GitHub Desktop.
Version 2 of MediumTippr
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 MediumTippr | |
// @include https://medium.com/* | |
// @require jquery.js | |
// @version 2 | |
// ==/UserScript== | |
var link = window.document.createElement('link'); | |
link.rel = 'stylesheet'; | |
link.type = 'text/css'; | |
link.href = 'https://www.dwolla.com/content/button.min.css'; | |
document.getElementsByTagName("HEAD")[0].appendChild(link); | |
var cur_loc = window.location.href; | |
var i = setInterval(function() { | |
if(cur_loc != window.location.href){ | |
cur_loc = window.location.href; | |
window.location.reload(); | |
} | |
}, 10); | |
$('.d-btn-legacy').remove(); | |
var a_href = $('a.post-author-name').attr('href'); | |
var post_title = "\"" + $('h1.post-title').html() + "!\""; | |
var text=a_href.replace("/","") + " Enjoyed your Medium post, " + post_title + " Have $1.00 for your awesomeness. #dwolla #mediumtippr"; | |
var related = "brettneese"; | |
var twitter_href = "http://twitter.com/intent/tweet" + "?text=" + encodeURIComponent(text) + "&related=" + related; | |
var html_for_button = "<a href='" + twitter_href + "' class='d-btn d-btn-legacy' target='_blank' id='tip_button'><span class='d-btn-text'>Tip This Author</span><span class='d-btn-icon'></span></a>"; | |
$(".btn-set").append(html_for_button); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment