ZhihuZhuangbilityExterminator

turn every fuckin' Zhihu-style right quote into normal quote 让逼乎直角引号见乔布斯去吧!只要看见狗日的直角引号,点点按钮它们就能全部消失不见

目前為 2017-08-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        ZhihuZhuangbilityExterminator
// @namespace   nein
// @author      ddOs
// @description turn every fuckin' Zhihu-style right quote into normal quote 让逼乎直角引号见乔布斯去吧!只要看见狗日的直角引号,点点按钮它们就能全部消失不见
// @include     http://*.zhihu.com/*
// @include     https://*.zhihu.com/*
// @version     1
// @grant       GM_addStyle
// ==/UserScript==

// references: 
// https://greasyfork.org/en/scripts/25776-coincidence-detector for replacing method
// https://stackoverflow.com/questions/6480082/add-a-javascript-button-using-greasemonkey-or-tampermonkey for button

var zNode = document.createElement('div');
zNode.innerHTML = '<button id="myButton" type="button">'+ 'Fuck 果乎/逼乎/绿乎/whatever乎<br /> right in the pussy! </button>';
zNode.setAttribute('id', 'myContainer');
document.body.appendChild(zNode);
//position = document.getElementByClass('CornerButtons')
//position.appendChild(zNode);
//--- Activate the newly added button.
document.getElementById('myButton').addEventListener('click', ButtonClickAction, false
);
function ButtonClickAction(zEvent) {
  (function () {
    function walk(node) {
      // I stole this function from here:
      // http://is.gd/mwZp7E
      var child,
      next;
      switch (node.nodeType)
        {
        case 1:
        case 9:
        case 11:
          child = node.firstChild;
          while (child)
          {
            next = child.nextSibling;
            walk(child);
            child = next;
          }
          break;
        case 3:
          handleText(node);
          break;
      }
    }
    function handleText(textNode) {
      textNode.nodeValue = textNode.nodeValue.replace('「', '“');
      textNode.nodeValue = textNode.nodeValue.replace('」', '”');
      textNode.nodeValue = textNode.nodeValue.replace('『', '‘');
      textNode.nodeValue = textNode.nodeValue.replace('』', '’');
    }
    walk(document.body);
  }) ();
}//--- Style our newly added elements using CSS.

GM_addStyle(multilineStr(function () { /*!
    #myContainer {
        position:               fixed;
        top:                    0;
        left:                   0;
        font-size:              20px;
        background:             orange;
        border:                 3px outset black;
        margin:                 5px;
        opacity:                0.9;
        z-index:                1100;
        padding:                5px 20px;
    }
    #myButton {
        cursor:                 pointer;
    }
    #myContainer p {
        color:                  red;
        background:             white;
    }
*/
}));
function multilineStr(dummyFunc) {
  var str = dummyFunc.toString();
  str = str.replace(/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  .replace(/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  .replace(/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  ;
  return str;
}