Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Userscript for Fanboi.ch
// ==UserScript==
// @name Add Load More Post to Fanboi.ch
// @namespace http://innocen.at
// @version 0.1
// @description enter something useful
// @match https://fanboi.ch/*/*/*/
// @copyright 2014 innocenat
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
(function() {
var p = window.location.pathname;
// Trim first and last slash(es)
if (p[0] == '/') p = p.substr(1);
if (p[p.length-1] == '/') p = p.substr(0,p.length-1);
// Split url
var pit = p.toLowerCase().split('/');
console.log(p);
var nextUrl = '';
if (pit[2] == 'recent') nextUrl = 'l60';
else {
var n = pit[2].substr(1);
n = parseInt(n);
n += 30;
nextUrl = 'l' + n.toString();
}
var link = "https://fanboi.ch/" + pit[0] + "/" + pit[1] + "/" + nextUrl + "/";
var injected_html = '<article id="__next_link" class="post"><div class="container"><header><a href="' + link + '" style="border:1px solid #8d9ca1;background:#fff;display:block;width:100%;text-align:center;font-style:italic;font-size:150%;line-height:150%">Load More</a></header></div></article>';
$('#main div.posts').prepend(injected_html);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.