Greasy Fork

Greasy Fork is available in English.

hipda 论坛热度高亮 + 只显示最近一周的帖子

参考论友 wu-lamplamp的 hipda 论坛热度高亮+top 按钮修复修改

当前为 2018-04-01 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        hipda 论坛热度高亮 + 只显示最近一周的帖子
// @description 参考论友 wu-lamplamp的 hipda 论坛热度高亮+top 按钮修复修改
// @description 0.10保留论坛高亮功能 去除top按钮功能 增加只显示最近一周的帖子帖子的功能
// @description 修改界面宽度,放大标题字体
// @description 0.20增加查看过的帖子在列表中隐藏的功能
// @namespace   www.91mdz.com
// @include     https://www.hi-pda.com/forum/forumdisplay.php?*
// @version     0.2.0
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.12.1/jquery.min.js
// @grant       none
// ==/UserScript==

var now_time = new Date();
var hide_space = 7 * 24 * 60 * 60 * 1000;
var jq = jQuery.noConflict();

var m = function (f) {
    return f.toString().split('\n').slice(1, - 1).join('\n');
};
loadCss = function () {
    var style = document.createElement('style');
    style.type = 'text/css';
    style.textContent = m(function () { /*
           #postlist{border: 1px solid #ccc;}
            #nav, #nav a {
               color: #000000;
            }
            body{
               background:#fff;
            }
            .postauthor .profile, .postbottom {
               display:none;
            }
            .t_msgfontfix {
               min-height:0px !important;
            }
            body{
               margin: 0 auto;
                width: 90%;
                font-size: 16px;
            }
            .wrap, #nav{
               width:100%;
            }
            a:visited{
                  color:#aaa;
            }
            div#header div.wrap h2{
                  display:none;
            }
            .main{border:1px #ccc solid;}
          */
    });
    var head = document.querySelector('head');
    head.appendChild(style);
};

function checkLink( url )
{
    //console.log( url + '__' + (localStorage.getItem( url ) > 0) );
	return localStorage.getItem( url ) > 0;
}

function saveLink( url )
{
	localStorage.setItem( url, 1 );
}

function onLinkClick( obj )
{
	saveLink(obj.target.href);
    //console.log( obj.target.href );
    jq( obj.target.parentNode.parentNode.parentNode ).hide();
}

loadCss();

jq( dispost );
function dispost(){
    jq('.threadlist tr').each(function () {
        var create_time = new Date(jq('.author em', this).text());
        create_time = Date.parse(create_time);

        var num = parseInt(jq('.nums strong', this).text());
        if( (now_time - create_time ) < hide_space )
        {
            if (num > 100)
            {
                jq(this).css('background', '#FFEBEB');
            }
            else if (num > 50)
            {
                jq(this).css('background', '#FFCDCD');
            }
            else if (num > 20)
            {
                jq(this).css('background', '#FFEBEB');
            }
        }
        else
        {
            jq( this ).hide();
        }

        link = jq('.subject a', this)[0];
        if ( link )
        {
            url = link.href;
            if( checkLink( url ) )
            {
               jq( this ).hide();
                //console.log(link);
            }
            else
            {
                //console.log(link);
                jq(link).attr('target', '_blank');
                jq(link).click(onLinkClick);
            }
        }
    });
}