跳转到内容

User:EtaoinWu/hide-rollback-link.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
if (['Watchlist', 'Recentchanges', 'Recentchangeslinked'].indexOf(mw.config.get('wgCanonicalSpecialPageName')) !== -1) {
  for (var i = document.getElementsByClassName('mw-rollback-link').length - 1; i >= 0; i--) {
    document.getElementsByClassName('mw-rollback-link')[i].style.display = 'none'
  }
}
if (mw.config.get('wgAction') === 'history') {
  for (var i = document.getElementsByClassName('mw-rollback-link').length - 1; i >= 0; i--) {
    document.getElementsByClassName('mw-rollback-link')[i].style.display = 'none'
  }
  function showrollbacklink () {
    for (var i = document.getElementsByClassName('mw-rollback-link').length - 1; i >= 0; i--) {
      document.getElementsByClassName('mw-rollback-link')[i].style.display = ''
    }
  }
  var node = document.createElement('input')
  node.id = 'rollbacklinkbtn'
  node.type = 'button'
  node.value = '顯示回退'
  pagehistory.previousSibling.insertBefore(node, pagehistory.previousSibling.children[1])
  rollbacklinkbtn.addEventListener('click', showrollbacklink)
}