JSFiddle: open in JavaScript tab

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         JSFiddle: open in JavaScript tab
// @namespace    https://github.com/marcodallagatta/userscripts/raw/main/jsfiddle-open-js-tab
// @version      2022.08.28.12.16
// @description  Defaults to the JavaScript tab in JSFiddle. Tiny, but tiny savings compound!
// @author       Marco Dalla Gatta
// @match        https://jsfiddle.net/*
// @icon         https://icons.duckduckgo.com/ip2/jsfiddle.net.ico
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  window.addEventListener("load", function () {

      const tabs = document.querySelectorAll("#tabs > ul > .tabItem");

      tabs.forEach((tab, index) => {
        if (index === 1) {
          tab.classList.add("active");
        } else {
          tab.classList.remove("active");
        }
      });

      const screens = document.querySelectorAll('.tabsContainer .tabCont');

      screens.forEach((screen, index) => {
        if (index !== 1) {
          screen.classList.add("hidden");
        } else {
          screen.classList.remove("hidden");
        }
      });

    }, false);

})();