zerojudge 隱藏標籤

不顯示題目標籤,按下「顯示標籤」後再顯示

  1. // ==UserScript==
  2. // @name zerojudge 隱藏標籤
  3. // @namespace https://github.com/zica87/self-made-userscipts
  4. // @version 0.1
  5. // @description 不顯示題目標籤,按下「顯示標籤」後再顯示
  6. // @author zica
  7. // @match https://zerojudge.tw/*
  8. // @license GPL-2.0
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. const tags = document.getElementsByClassName('tag');
  16. for(const e of tags){
  17. e.hidden = true;
  18. const show = document.createElement('button');
  19. show.innerText = '顯示標籤';
  20. show.onclick = function(){
  21. this.nextSibling.hidden = false;
  22. this.remove();
  23. };
  24. e.before(show);
  25. }
  26. })();