Skip to content

Instantly share code, notes, and snippets.

@innocenat
Created August 26, 2014 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save innocenat/fdb7044c605d0ce966b9 to your computer and use it in GitHub Desktop.
Save innocenat/fdb7044c605d0ce966b9 to your computer and use it in GitHub Desktop.
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