Greasy Fork

Greasy Fork is available in English.

heiseTickerKommentare11

this is not a good idea 'cos all the article pages of the day must be loaded in background to get this little text...

当前为 2016-12-09 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name             heiseTickerKommentare11
// @version          0.1.1
// @author           _leBluem_
// @description      this is not a good idea 'cos all the article pages of the day must be loaded in background to get this little text...
// @info             but its fun to see ;)
// @grant            none
// @namespace        http://greasyfork.icu/de/scripts/25552-heisetickerkommentare10/
// @match            http://www.heise.de/newsticker/*
// @match            https://www.heise.de/newsticker/*
// ==/UserScript==

(function() {
    // add "Kommentare laden" link to date that calls GetComments
    $("h4.published.archiv_woche_published").each(function(){
        var s = '<font size="1">&nbsp;<a href="#" onclick="GetComments(this);return false;">Kommentare laden</a></font>';
        $(this).append(s);
    });

    // find all comments for this day
    window.GetComments = function GetComments(e){
        // <archiv_woche_published><font><a>
        var ulist=$(e).parent().parent().next().children();

        // clear all previous loaded comments
        $('span[id*="plugin-page-"]').each(function(){
            $(this).remove();
        });

        // make a span-tag to hold the comments-tag
        var urls = [];
        var j = 0;
        $(ulist).each(function(){
            if ( $(this).find('a').attr('href') ) {
                urls.push($(this).find('a').attr('href'));
                // #plugin-page-0 .. #plugin-page-1 .. #plugin-page-2 ..
                $(this).append('<font size="1"><span id="plugin-page-' + j++ + '"></span></font>');
            }
        });
        // make the span-tag actually load the comments-tag
        if ( urls.length > 0 ) {
            for (var i = 0; i<= urls.length; i++) {
                // var re = new RegExp(/Kommentare lesen(.*)\(([^)]+)\)/); // does not compute anywhere
                $("#plugin-page-"+i).load(urls[i] + " div.link_forum_beitrag.news p a");
            }
        }
    };
})();