Last active
July 14, 2017 15:19
-
-
Save botmtl/7574c74e7c1badd868a4d7ebfdc80033 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 gaydemon epub download helper | |
// @namespace botmtl | |
// @version 0.2 | |
// @description add download epub button on story list page | |
// @author botmtl | |
// @updateurl https://gist.githubusercontent.com/botmtl/7574c74e7c1badd868a4d7ebfdc80033/raw/697398c3f1dab4829625cc2090c70d33d69db8c1/GaydemonEpubDownloadHelper.user.js | |
// @icon http://www.gaydemon.com/apple-touch-icon-precomposed.png | |
// @match http://www.gaydemon.com/stories/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var t = document.querySelectorAll('h3 a'); | |
for(var i=0; i<t.length; i++) { | |
var href = t[i].href; | |
var storynumber = href.match(/(\d{4,7})\.html/)[1]; | |
var container = document.createElement("span"); | |
container.style="margin-left:50px;"; | |
container.innerHTML = '<a class="btn btn-primary btn-small" href="http://www.gaydemon.com/stories/epub/' + storynumber + '">EPUB</a>'; | |
t[i].appendChild(container); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment