「MediaWiki:Tangle/定数表/dev.js」:修訂間差異

增加 202 位元組 、​ 2024年11月25日 (星期一)
無編輯摘要
(// Edit via Wikiplus)
無編輯摘要
行 1: 行 1:
$(function () {
$(function () {
   document.querySelector("#chart-constant-js-cut-in-1-box").style.display = "unset";
    const container = document.getElementById("chart-constant-js-cut-in-1");
    const container = document.getElementById("chart-constant-js-cut-in-1");


行 112: 行 113:


$(function () {
$(function () {
  const container = document.getElementById("chart-constant-js-cut-in-2");
   document.querySelector("#chart-constant-js-cut-in-1-box").style.display = "unset";
   const container = document.getElementById("chart-constant-js-cut-in-2");


  // 插入 HTML
   // 插入 HTML
  const htmlContent = `
   const htmlContent = `
    <div class="button-container">
    <div class="button-container">
     <button class="button single-toggle-button" data-color="#FF9500">
     <button class="button single-toggle-button" data-color="#FF9500">
行 123: 行 125:
   `;
   `;


  // 插入 CSS
   // 插入 CSS
  const cssContent = `
   const cssContent = `
    .button-container {
    .button-container {
     display: flex;
     display: flex;
行 158: 行 160:
   `;
   `;


  // 插入 JS
   // 插入 JS
  const jsContent = `
   const jsContent = `
    const button = document.querySelector(".single-toggle-button");
    const button = document.querySelector(".single-toggle-button");
    const targets = document.querySelectorAll(".chart-constant-single-part-b");
    const targets = document.querySelectorAll(".chart-constant-single-part-b");
行 189: 行 191:
   `;
   `;


  container.innerHTML = htmlContent;
   container.innerHTML = htmlContent;


  const styleElement = document.createElement("style");
   const styleElement = document.createElement("style");
  styleElement.innerHTML = cssContent;
   styleElement.innerHTML = cssContent;
  document.head.appendChild(styleElement);
   document.head.appendChild(styleElement);


  const scriptElement = document.createElement("script");
   const scriptElement = document.createElement("script");
  scriptElement.innerHTML = jsContent;
   scriptElement.innerHTML = jsContent;
  document.body.appendChild(scriptElement);
   document.body.appendChild(scriptElement);
});
});