GolemMultiPage

Lade alle Seiten von mehrteiligen Artikeln in die erste Seite.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name             GolemMultiPage
// @version          0.1.0
// @author           _leBluem_
// @description      Lade alle Seiten von mehrteiligen Artikeln in die erste Seite.
// @namespace        https://greasyfork.org/de/users/83368-lebluem
// @include          http://www.golem.de/news/*
// @clean-include    true
// @run-at           document-ready
// @include-jquery   true
// @use-greasemonkey true
// ==/UserScript==

(function () {
    $(window).load(function(){
        //Multipage stuff after pageload
        if ( $( "ol.list-pages" ).length ) {
            var urls = [];
            //get the urls from the a href of each li
            $( "ol.list-pages" ).children().each(function(){
                urls.push($(this).find('a').attr('href'));
            });
            urls.pop(); //The last link is next page, is not needed again
            //<header class="cluster-header">
            if ( urls.length > 0 ) {
                $("header[class^='cluster-header']").append('<div align="center"><font size="1.5">Seite 1 von ' + (urls.length) + '</font></div>');
                for (var i = 1; i < urls.length; i++) {
                    var divid = "plugin-page-" + i;
                    //append page numbers for info
                    $("div.formatted").append('<div align="center" ><font size="1.5">Seite ' + (i+1) + ' von ' + (urls.length) + '</font></div><br />');
                    //append a new div
                    $("div.formatted").append('<div id="' + divid + '"></div>');
                    //load the content of the page's article into the fresh div
                    $('#' + divid).load(urls[i] + ' article');
                }
            }
        }
    });

})();