Fanfiction+

Makes subtle improvements to improve readability on fanfiction.net

As of 2016-04-20. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Fanfiction+
// @namespace   DanielVestol.Fanfiction.net
// @description Makes subtle improvements to improve readability on fanfiction.net
// @include     https://www.fanfiction.net/s/*
// @version     1.3
// @grant       none
// ==/UserScript==
document.addEventListener("DOMContentLoaded", function(event) {
	console.log("DOM fully loaded and parsed");
	document.getElementById('content_wrapper').style.maxWidth = '800px';
	review = document.getElementById('review')
	review.getElementsByTagName('TD')[0].remove();
	review.getElementsByTagName('TD')[0].remove(); // Remove element 1 which is now 0
	review.getElementsByTagName('DIV')[0].style.maxWidth = '765px';
	review.getElementsByTagName('DIV')[0].style.margin = '10px';
	document.getElementById('review_name_value').style.maxWidth = '780px';
	document.getElementById('review_review').style.maxWidth = '780px';
	
	// Better change between mobile and desktop edition.
	// Credits to SirCxyrtyx for snippet
	var mobileVersion = 'location = "https://m.fanfiction.net' + document.location.pathname + '"'
	// console.log(mobileVersion);
	document.getElementsByClassName('icon-kub-mobile')[0].setAttribute('onclick', mobileVersion);
	
	// Show whole book function
	$('#content_wrapper_inner > span:nth-child(7)').append('<button id="myShit" class="btn" type="BUTTON">Show whole book</button>');
	document.getElementById('myShit').addEventListener('click', function() {
		for (i = chapter; i < document.getElementById('chap_select').options.length; i++) {
			var $div = $('<div>');
			$div.load('https://www.fanfiction.net/s/7211094/' + i + ' #storytext', function(){
				// now $(this)[0].innerHTML contains #storytext
				$("#storytextp").append($(this)[0].innerHTML);
			});
		}
	});
});