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

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

目前为 2018-03-27 提交的版本。查看 最新版本

// ==UserScript==
// @name        hipda 论坛热度高亮 + 只显示最近一周的帖子
// @description 参考论友 wu-lamplamp的 hipda 论坛热度高亮+top 按钮修复修改
// @description 保留论坛高亮功能 去除top按钮功能 增加只显示最近一周的帖子帖子的功能
// @description 修改界面宽度,放大标题字体
// @namespace   www.91mdz.com
// @include     https://www.hi-pda.com/forum/forumdisplay.php?*
// @version     0.1
// @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);
};
loadCss();
jq(function () {

    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');
            }
            jq(this).attr('target', '_blank');
        }
        else
        {
           if( num  < 100 )
           {
               jq( this ).hide();
           }
        }
    });
});