Greasy Fork

Greasy Fork is available in English.

jvc-nocaps

Get rid of POSTS on JVC where WORDS are UPPERCASED for some REASON.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         jvc-nocaps
// @version      0.1
// @description  Get rid of POSTS on JVC where WORDS are UPPERCASED for some REASON.
// @author       kikakouti
// @match        http://www.jeuxvideo.com/forums/*
// @grant        none
// @namespace http://greasyfork.icu/users/125911
// ==/UserScript==

(function() {
    'use strict';

    function regularReplacer(match, offset, string){
        return match.toLowerCase();
    }

    function removeUppercase(element) {

        if (element.childNodes && element.childNodes.length > 0) {
            for (var i in element.childNodes) {
                removeUppercase(element.childNodes[i]);
            }
        }

        if (element.nodeType == Node.TEXT_NODE && /\S/.test(element.nodeValue)) {
            var text = element.nodeValue;
            element.nodeValue = text.replace(/([A-ZÀÁÂÄÅÃÆÇÉÈÊËÍÌÎÏÑÓÒÔÖØÕOEÚÙÛÜÝY]{3,})/g, regularReplacer);
        }
    }

    var posts = document.getElementsByClassName("txt-msg");
    for (var i in posts) {
        removeUppercase(posts[i]);
    }

    var title = document.getElementById("bloc-title-forum");
    if (title) {
        removeUppercase(title);
    }

    var arianeCrumbs = document.getElementsByClassName("bloc-fil-ariane-crumb-forum");
    for (var j in arianeCrumbs) {
        removeUppercase(arianeCrumbs[j]);
    }

    var topicTitles = document.getElementsByClassName("topic-title");
    for (var k in topicTitles) {
        removeUppercase(topicTitles[k]);
    }

})();