JSFiddle: open in JavaScript tab

Defaults to the JavaScript tab in JSFiddle. Tiny, but tiny savings compound!

目前為 2022-08-29 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name JSFiddle: open in JavaScript tab
  3. // @namespace https://github.com/marcodallagatta/userscripts/raw/main/jsfiddle-open-js-tab
  4. // @version 2022.08.28.12.16
  5. // @description Defaults to the JavaScript tab in JSFiddle. Tiny, but tiny savings compound!
  6. // @author Marco Dalla Gatta
  7. // @match https://jsfiddle.net/*
  8. // @icon https://icons.duckduckgo.com/ip2/jsfiddle.net.ico
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. "use strict";
  14.  
  15. window.addEventListener("load", function () {
  16.  
  17. const tabs = document.querySelectorAll("#tabs > ul > .tabItem");
  18.  
  19. tabs.forEach((tab, index) => {
  20. if (index === 1) {
  21. tab.classList.add("active");
  22. } else {
  23. tab.classList.remove("active");
  24. }
  25. });
  26.  
  27. const screens = document.querySelectorAll('.tabsContainer .tabCont');
  28.  
  29. screens.forEach((screen, index) => {
  30. if (index !== 1) {
  31. screen.classList.add("hidden");
  32. } else {
  33. screen.classList.remove("hidden");
  34. }
  35. });
  36.  
  37. }, false);
  38.  
  39. })();