FIMFiction - Simplified Read Flow

Adds the ability to scroll down the story page to the clicked-on paragraph.

目前為 2016-02-24 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        FIMFiction - Simplified Read Flow
// @namespace   Selbi
// @include     http*://*fimfiction.net/story/*/*
// @include     http*://*fimfiction.net/chapter/*
// @version     2.1
// @grant       none
// @description Adds the ability to scroll down the story page to the clicked-on paragraph.
// ==/UserScript==

// Set some constants.
const MARGIN_TOP = 20;
const SCROLL_SPEED = 500;

const FADE_IN  = "all 200ms ease-out";
const FADE_OUT = "all 200ms ease-in";


// Get all paragraphs of this chapter page.
var paragraphs = $("#chapter_container p");


// Create an event listener for clicking on any of these paragraphs.
// Scroll the entire page down to a little over the clicked paragraph.
$(paragraphs).click(function() {

	$('html,body').animate({
		scrollTop:	($(this).offset().top) - MARGIN_TOP
	}, SCROLL_SPEED);
});


// Add some cosmetic effects for hovering over a paragraph.
$(paragraphs).hover(
	// Fade-in
	function(){
		$(this).css({
			cursor :		"pointer",
			filter :		"invert(100%)",
			"-webkit-transition" :	FADE_IN,
			"-moz-transition" :	FADE_IN,
			"-o-transition" :	FADE_IN,
			"transition" :		FADE_IN
		});
	}
,
	// Fade-out
	function(){
		$(this).css({
			filter :		"invert(000%)",
			"-webkit-transition" :	FADE_OUT,
			"-moz-transition" :	FADE_OUT,
			"-o-transition" :	FADE_OUT,
			"transition" :		FADE_OUT
		});
	}
);