比格设计去水印

设计工具比格设计去水印

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         比格设计去水印
// @description  设计工具比格设计去水印
// @namespace    https://greatest.deepsurf.us/zh-CN/users/869004
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://bigesj.com/bill/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bigesj.com
// @grant        GM_addStyle
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

GM_addStyle(`.water,.water-tip{display:none!important}`);


const toast = (content, time) => {
  return new Promise((resolve, reject) => {
    let elAlertMsg = document.querySelector("#fehelper_alertmsg");
    if (!elAlertMsg) {
      let elWrapper = document.createElement("div");
      elWrapper.innerHTML =
        '<div id="fehelper_alertmsg" style="position:fixed;top:100px;left:0;right:0;z-index:1000;display:flex">' +
        '<p style="background:#4caf50;display:inline-block;color:#fff;text-align:center;' +
        'padding:10px 10px;margin:0 auto;font-size:14px;border-radius:4px;">' +
        content +
        "</p></div>";
      elAlertMsg = elWrapper.childNodes[0];
      document.body.appendChild(elAlertMsg);
    } else {
      elAlertMsg.querySelector("p").innerHTML = content;
      elAlertMsg.style.display = "flex";
    }

    window.setTimeout(function () {
      elAlertMsg.style.display = "none";
      resolve && resolve();
    }, time || 1000);
  });
};

const headers = {
  Authorization: `Token ${localStorage.getItem("__token__")}`,
};

function requestDownload(id) {
  toast("已加入下载队列,请稍候。", 2000).then(() => {
    $.ajax({
      method: "GET",
      url: `/new/udesign/checkdownload/${id}`,
      headers,
      dataType: "json",
    }).then((res) => {
      if (res.code === 203) {
        requestDownload(id);
        return false;
      }
      window.open(res.data.url, "_blank");
    });
  });
}

setTimeout(() => {
  const container = document.querySelectorAll(".ant-space-item")[10];
  $(container)
    .css({ display: "flex" })
    .append(
      '<buttton id="tm-download" style="margin-left: 8px;align-items: center;display: flex;height: 48px;" class="ant-btn ant-btn-primary">无水印下载</button>'
    );
  $("#tm-download").on("click", () => {
      const queryString = window.location.search;
      const urlParams = new URLSearchParams(queryString);
      const bid=urlParams.get('bid')
    $.ajax({
      method: "GET",
      url: `/new/udesign/downloadAsync/${bid}`,
      headers,
      dataType: "json",
      data: {
        width: parseInt($('.canvas-view-item').text()),
        height: parseInt($('.canvas-view-item:eq(1)').text()),
        id: bid,
        format: "png",
        watermark: 0,
        role_type: 3,
        preview_path: "/bill/output",
        fast_download: false,
      },
    }).then((res) => {
      console.log(res);
      requestDownload(res.data.uid);
    });
  });
}, 1000);




})()