Wayback Machine - toolbar toggler

A way to toggle the WaybackMachine's toolbar

目前为 2020-04-22 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Wayback Machine - toolbar toggler
  3. // @name:fr Wayback Machine - (dé)masquer barre d'outils
  4. // @namespace https://github.com/Procyon-b
  5. // @version 0.5
  6. // @description A way to toggle the WaybackMachine's toolbar
  7. // @description:fr Une méthode pour masquer/afficher la barre d'outils de WaybackMachine (web.archive.org)
  8. // @author Achernar
  9. // @match https://web.archive.org/web/*
  10. // @grant none
  11. // @noframes
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. "use strict";
  16.  
  17. function fix(ev) {
  18. var TO, st = document.createElement('style'), sts = document.getElementsByTagName('style');
  19. st.innerText='#wm-ipp-base {opacity:0; min-height:1px;position:absolute;} #wm-ipp-base:hover {opacity: 1;} #wm-ipp-base.forcePriority {oposition:relative; z-index:99999;}';
  20. (document.head || document.documentElement).appendChild(st);
  21.  
  22. for (st of sts) {
  23. if (st.innerText.search('.wb-autocomplete-suggestions')+1) {
  24. st.innerText='';
  25. break;
  26. }
  27. }
  28.  
  29. sts=document.querySelectorAll('link[rel=stylesheet]');
  30. for (st of sts) {
  31. if (st.href.startsWith('https://web.archive.org/_static/') && !(st.href.search('/iconochive.css')+1) ) {
  32. st.parentNode.removeChild(st);
  33. }
  34. }
  35.  
  36. this.removeEventListener('dblclick', fix);
  37. document.body.addEventListener('keydown',function(ev){
  38. force=ev.altKey && ev.ctrlKey;
  39. if (force && !forceState) {
  40. e.classList.add('forcePriority');
  41. forceState=force;
  42. if (TO) clearTimeout(TO);
  43. TO=setTimeout(function(){
  44. e.classList.remove('forcePriority');
  45. forceState=false;
  46. TO=0;
  47. },3000);
  48. }
  49. });
  50. }
  51.  
  52. var e=document.getElementById('wm-ipp-base'), force=false, forceState=false;
  53. if (e) {
  54. e.addEventListener('dblclick', fix);
  55. let ne=e.nextElementSibling;
  56. if (ne && (ne.id=='donato')) ne.parentNode.removeChild(ne);
  57. }
  58.  
  59. })();