Greasy Fork

Greasy Fork is available in English.

显示nga头像

在正常模式和lite模式下无视内容长度显示用户头像

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         显示nga头像
// @namespace    http://tampermonkey.net/
// @version      0.3.2
// @description  在正常模式和lite模式下无视内容长度显示用户头像
// @author       wfel
// @match        *://bbs.ngacn.cc/*
// @match        *://bbs.nga.cn/*
// @match        *://nga.178.com/*
// @match        *://ngabbs.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    // from js_commonui.js line 3075
    console.log('Show Avatar: running!');
    window.commonui = Object.defineProperties(window.commonui?window.commonui:{}, {
        'avatarUrl': {
            value: function(y, uid) {
                if (y.charAt(0) == '.' && (i = y.match(/^\.a\/(\d+)_(\d+)\.(jpg|png|gif)\?(\d+)/)))
                    y = __AVATAR_BASE_VIEW + '/' + ('000000000' + (i[1] | 0).toString(16)).replace(/.+?([0-9a-z]{3})([0-9a-z]{3})([0-9a-z]{3})$/, '$3/$2/$1') + '/' + i[1] + '_' + i[2] + '.' + i[3] + '?' + i[4]
                else if (y.charAt(0) == 'h' && y.match(/^https?:\/\/([^\/]+)\//)) {
                    //if (!y.match(_ALL_IMG_HOST_REG) && uid != window.__CURRENT_UID)
                    //    y = ''
                    //some of the old attach servers can not be detected
                } else if (y)
                    y = __IMGPATH + '/face/' + y
                else
                    y = ''
                if (this.correctAttachUrl)
                    y = this.correctAttachUrl(y)
                return y
            },
            writable: false
        },
        // feature是cLength的计算方法导致的
        // js_read.js Line 379: a.cLength = this.postDispCalcContentLength(a.contentC);
        'postDispCalcContentLength': {
            value: function() {
                return 21;
            },
            writable: false
        }
    });
})();