FuckOsu

Remove comments on music163

اعتبارا من 12-09-2016. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         FuckOsu
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Remove comments on music163
// @author       You
// @match        http://music.163.com//*
// @grant        none
// @require      http://code.jquery.com/jquery-1.12.4.min.js
// ==/UserScript==

var canFuck = function(text){
    text = text.toLowerCase();
    if(text.indexOf("osu") >= 0 || text.indexOf("藕苏") >= 0 || text.indexOf("屙屎") >= 0 || text.indexOf("b站") >= 0 || text.indexOf("节奏大师") >= 0){
        return true;
    }
    return false;
};

(function() {
    $(document).ready(function(){
        // Your code here...
        var count = 0;
        var child = $(".cmmts").children(".itm");
        if(child.size() === 0) return;
        for(var i=child.size()-1;i>=0;i--){
            var item = child.eq(i);
            var text = item.find(".cntwrap .cnt").text();
            if(canFuck(text)){
                item.remove();
                count++;
                continue;
            }
            //评论节点
            var sub = item.find(".cntwrap .que");
            if(sub.size() === 0) continue;
            text = sub.text();
            if(canFuck(text)){
                count++;
                item.remove();
            }
        }
        console.log("Fucked " + count +"! Have fun");
    });
})();