php.net 隐藏 UserNotes

php.net 隐藏 user note

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         php.net 隐藏 UserNotes
// @namespace    phpNetHideUserNoteByConte
// @version      0.2
// @description  php.net 隐藏 user note
// @author       Conte
// @match        http://php.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // hide user notes
    var usernotes = document.getElementById('usernotes');
    if(!usernotes) return false;
    usernotes.setAttribute('style','display:none');

    // create button
    var newLi = document.createElement("li");
    var newA = document.createElement("a");
    newA.setAttribute('id','noteStatus');
    var newContent = document.createTextNode("ShowUserNote");
    newLi.appendChild(newA);
    newA.appendChild(newContent);
    document.getElementsByClassName('nav')[0].append(newLi);
    // listener
    newA.addEventListener('click',function (e){
        var usernotes = document.getElementById('usernotes');
        var disStatus = usernotes.getAttribute('style');
        var noteStatus = e.target;
        if(disStatus == 'display:none'){
            noteStatus.innerHTML = 'HideUserNote';
            usernotes.setAttribute('style','display:block !important');
        } else {
            noteStatus.innerHTML = 'ShowUserNote';
            usernotes.setAttribute('style','display:none');
        }
    });
})();