Narou Index scroller

小説家になろうの目次で前後の章に移動するアイコンをつける

21.07.2017 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Narou Index scroller
// @namespace    http://ncode.syosetu.com/
// @version      0.3
// @description  小説家になろうの目次で前後の章に移動するアイコンをつける
// @author       b2ox
// @match        http://ncode.syosetu.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var chapters = $('div.index_box > div.chapter_title');
    var n = chapters.length;
    chapters.each(function(i,e){
        var nav = $('<span>');
        var _up = $('<span>').text('⇧').attr('title','前章へ移動').css('cursor','pointer').click(function(){$('#ct'+(i-1))[0].scrollIntoView();window.scrollBy(0,-20);});
        var _down = $('<span>').text('⇩').attr('title','次章へ移動').css('cursor','pointer').click(function(){$('#ct'+(i+1))[0].scrollIntoView();window.scrollBy(0,-20);});
        if (i>0) nav.append(_up);
        if (i<n-1) nav.append(_down);
        $(e).attr('id','ct'+i).prepend(nav);
    });
})();