QuickWaddle

在CoCo中添加Waddle相关功能

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         QuickWaddle
// @namespace    https://cocotais.cn/
// @version      0.2
// @description  在CoCo中添加Waddle相关功能
// @author       小鱼yuzifu & Cocotais
// @match        *://coco.codemao.cn/editor/*
// @icon         https://static.codemao.cn/coco/player/unstable/Syysxk49p.image/png?hash=FjxRSuma3-zmaTIij5IW_rnZqV4L
// @require      https://cdn.staticfile.org/layui/2.9.7/layui.js
// @require      https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js
// @license      GPLv3

// ==/UserScript==

(function () {
  "use strict";
  $("head").append(`
  <link href="https://cdn.staticfile.org/layui/2.9.7/css/layui.css" rel="stylesheet">
  <style>
  .layui-layer {
    border-radius: 10px;
  }
  </style>
  `);
  let loading = setInterval(() => {
    if (!document.querySelector(".open-waddle")) {
      let openWaddle = false;
      let index;
      /*let waddleImport = document.createElement("div");
        waddleImport.className = "coco-menu-item waddle-import";
        waddleImport.innerHTML = '<div class="Header_itemContent__1PHwD">从Waddle导入</div>';
        insertAfter(waddleImport, document.querySelector(".coco-menu-item:has(.coco-upload-button.Header_itemUploadButton__12gPJ)"));*/
      $(".style_users__1_LCz").after(`<button class="open-waddle coco-button coco-button-circle Header_packageBtn__uKJgR" style="width:90px">Waddle</button>`);
      $("button.open-waddle").on("click", function () {
        if (!openWaddle) {
          index = layer.open({
            type: 2,
            title: "Waddle",
            maxmin: true,
            area: ["900px", "600px"],
            content: "https://waddle.cocotais.cn/",
            shade: 0,
            closeBtn: 1,
            end: function () {
              openWaddle = false;
            },
          });
          openWaddle = true;
        } else {
          layer.close(index);
          openWaddle = false;
        }
      });
      document.clearInterval(loading);
    }
  }, 100);
})();