跳转到内容

User:PhiLiP/aFourteenASevenANineAndLychees.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// Usage:
// importScript( 'User:PhiLiP/aFourteenASevenANineAndLychees.js' );

function aFourteenASevenANineAndLychees() {

  var featured = document.evaluate(
    "//*[contains(text(), '\u5178\u8303')]",
    document.body
  );
  var allNodes = [];
  try {
    var node = null;
    
    do {
      node = featured.iterateNext();
      for (var idx=0; idx < node.childNodes.length; idx ++) {
      	var childNode = node.childNodes[idx];
        if (childNode.nodeType === 3) {
          allNodes.push(childNode);
        }
      }
    }
    while (node);
  }
  catch(e) {
    console.warn('I like their tiny little trees!');
  }
  for (var jdx=0; jdx < allNodes.length; jdx ++) {
  	var _node = allNodes[jdx];
  	_node.nodeValue = _node.nodeValue.replace(/\u5178\u8303/g, '\u70b9\u83dc');
  }

}

if (document.body.classList.contains('page-Wikipedia_首页')) {
  aFourteenASevenANineAndLychees();
}