gaodingWatermark

搞定|创客贴小助手。站内其它版本年久失修,佛系修复。点左上角“去除水印”然后自行截图或点击右上角下载(需手动开启)。

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

  1. // ==UserScript==
  2. // @name gaodingWatermark
  3. // @version 0.0.0.4
  4. // @description 搞定|创客贴小助手。站内其它版本年久失修,佛系修复。点左上角“去除水印”然后自行截图或点击右上角下载(需手动开启)。
  5. // @author pythonk
  6. // @icon https://st-gdx.dancf.com/assets/20190910-143541-210a.png
  7. // @icon https://dynamic-image.bear20.com/640x267/uploadImages/2020/289/34/9DTKT3Y2XR06.jpg
  8. // @match *://*.gaoding.com/design?id=*
  9. // @match *://*.chuangkit.com/odyssey/design?*
  10. // @match *://*.chuangkit.com/design*
  11. // @match https://*.818ps.com/*
  12. // @match https://www.eqxiu.com/*
  13. // @match https://bigesj.com/*
  14. // @require http://cdn.staticfile.org/jquery/1.8.3/jquery.min.js
  15. // @require https://unpkg.com/sweetalert2@10.16.6/dist/sweetalert2.min.js
  16. // @resource swalStyle https://unpkg.com/sweetalert2@10.16.6/dist/sweetalert2.min.css
  17. //
  18. // @grant unsafeWindow
  19. // @grant GM_openInTab
  20. // @grant GM_setValue
  21. // @grant GM_getValue
  22. // @grant GM_registerMenuCommand
  23. // @grant GM_getResourceText
  24. //
  25. // @run-at document-idle
  26. // @namespace https://greatest.deepsurf.us/zh-CN/users/184803-sevensky
  27. // ==/UserScript==
  28. // @re quire https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
  29.  
  30. /*
  31. *
  32. @run-at
  33. 定义脚本被注入的时刻。
  34. 与其他脚本处理程序相反, @run-at 定义了脚本想要运行的第一个可能时刻。这意味着可能会发生,使用 @require 标签的脚本可能会在文档加载后执行,导致获取所需脚本需要很长时间。无论如何,在给定注入时刻之后发生的所有 DOMNodeInserted 和 DOMContentLoaded 事件都被缓存并在注入时传递给脚本。
  35. 总共四种时刻
  36. @run-at document-start 脚本将尽快注入。
  37. @run-at document-body 如果 body 元素存在,脚本将被注入。
  38. @run-at document-end 该脚本将在调度 DOMContentLoaded 事件时或之后注入。
  39. @run-at document-idle 该脚本将在调度 DOMContentLoaded 事件后注入。如果没有给出@run-at 标签,这是默认值。
  40. @run-at context-menu 如果在浏览器上下文菜单中单击该脚本(仅限基于 Chrome 的桌面浏览器),则会注入该脚本。注意:如果使用此值,所有@include和@exclude语句都将被忽略,但将来可能会更改。
  41. */
  42.  
  43.  
  44. (function () {
  45. 'use strict';
  46. let util = {
  47. getValue(name) { return GM_getValue(name); }, setValue(name, value) { GM_setValue(name, value); },
  48. include(str, arr) {
  49. str = str.replace(/[-_]/ig, '');
  50. for (let i = 0, l = arr.length; i < l; i++) {
  51. let val = arr[i];
  52. if (val !== '' && str.toLowerCase().indexOf(val.toLowerCase()) > -1) {
  53. return true;
  54. }
  55. }
  56. return false;
  57. },
  58.  
  59. addStyle(id, tag, css) {
  60. tag = tag || 'style';
  61. let doc = document, styleDom = doc.getElementById(id);
  62. if (styleDom) return;
  63. let style = doc.createElement(tag);
  64. style.rel = 'stylesheet';
  65. style.id = id;
  66. tag === 'style' ? style.innerHTML = css : style.href = css;
  67. doc.head.appendChild(style);
  68. }
  69. };
  70. let main = {
  71. initValue() {
  72. let value = [{
  73. name: 'zoom_links',
  74. value: false
  75. },{
  76. name: 'enable_pdfprint',
  77. value: true
  78. }];
  79. value.forEach((v) => {
  80. util.getValue(v.name) === undefined && util.setValue(v.name, v.value);
  81. });
  82. },
  83. registerMenuCommand() {
  84. GM_registerMenuCommand('⚙️ 设置', () => {
  85. //alert('sd');
  86. let dom = `<div style="font-size: 1em;">
  87. <label class="instant-setting-label">PDF打印开关<input type="checkbox" id="S-2" ${util.getValue('enable_pdfprint') ? 'checked' : ''} class="instant-setting-checkbox"></label>
  88. <label class="instant-setting-label">缩放悬浮按钮<input type="checkbox" id="S-1" ${util.getValue('zoom_links') ? 'checked' : ''} class="instant-setting-checkbox"></label>
  89. </div>`;
  90. Swal.fire({
  91. title: '设置',
  92. html: dom,
  93. showCloseButton: true,
  94. confirmButtonText: '保存',
  95. footer: '<div style="text-align: center;font-size: 1em;"><a href="https://greatest.deepsurf.us/scripts/441367-gaodingwatermark/code/gaodingWatermark.user.js">检查更新</a><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="14" height="14"><path d="M445.956 138.812L240.916 493.9c-11.329 19.528-12.066 44.214 0 65.123 12.067 20.909 33.898 32.607 56.465 32.607h89.716v275.044c0 31.963 25.976 57.938 57.938 57.938h134.022c32.055 0 57.938-25.975 57.938-57.938V591.63h83.453c24.685 0 48.634-12.803 61.806-35.739 13.172-22.844 12.343-50.016 0-71.386l-199.42-345.693c-13.633-23.58-39.24-39.516-68.44-39.516-29.198 0-54.897 15.935-68.438 39.516z" fill="#d81e06"/></svg></div>',
  96. customClass: {
  97. popup: 'instant-popup',
  98. },
  99. }).then((res) => {
  100. if (res.isConfirmed) {
  101. history.go(0);
  102. }
  103. });
  104.  
  105. document.getElementById('S-1').addEventListener('change', (e) => {
  106. util.setValue('zoom_links', e.currentTarget.checked);
  107. });
  108. document.getElementById('S-2').addEventListener('change', (e) => {
  109. util.setValue('enable_pdfprint', e.currentTarget.checked);
  110. });
  111. });
  112. },
  113. addPluginStyle() {
  114. let style = `
  115. .instant-popup { font-size: 14px !important; }
  116. .instant-setting-label { display: flex;align-items: center;justify-content: space-between;padding-top: 15px; }
  117. .instant-setting-label-col { display: flex;align-items: flex-start;;padding-top: 15px;flex-direction:column }
  118. .instant-setting-checkbox { width: 16px;height: 16px; }
  119. .instant-setting-textarea { width: 100%; margin: 14px 0 0; height: 60px; resize: none; border: 1px solid #bbb; box-sizing: border-box; padding: 5px 10px; border-radius: 5px; color: #666; line-height: 1.2; }
  120. .instant-setting-input { border: 1px solid #bbb; box-sizing: border-box; padding: 5px 10px; border-radius: 5px; width: 100px}
  121. @keyframes instantAnminate { from { opacity: 1; } 50% { opacity: 0.4 } to { opacity: 0.9; }}
  122. .link-instanted { animation: instantAnminate 0.6s 1; animation-fill-mode:forwards }
  123. .link-instanted * { animation: instantAnminate 0.6s 1; animation-fill-mode:forwards }
  124. `;
  125.  
  126. if (document.head) {
  127. util.addStyle('swal-pub-style', 'style', GM_getResourceText('swalStyle'));
  128. util.addStyle('instant-style', 'style', style);
  129. }
  130.  
  131. const headObserver = new MutationObserver(() => {
  132. util.addStyle('swal-pub-style', 'style', GM_getResourceText('swalStyle'));
  133. util.addStyle('instant-style', 'style', style);
  134. });
  135. headObserver.observe(document.head, {childList: true, subtree: true});
  136. },
  137. init() {
  138. this.initValue();
  139. this.addPluginStyle();
  140. this.registerMenuCommand();
  141. }
  142. };
  143. main.init();
  144. console.log('gaoding去水印加载中')
  145. // 图片缩放按钮
  146. function addButton() {
  147. var div = `<div class="zoom-button"> <div class="zoom-icon">Zoom</div> </div>`
  148. $('body')[0].append($(div)[0]);
  149. $('.zoom-button').click(function () {
  150. changeImgSize(() => {
  151. console.log('100% 无水印。'); //图片渲染已阉掉 generate_img();
  152. })
  153. })
  154. }
  155. // 在下载之前将图片放到最大100%
  156. function changeImgSize(callback) {
  157. // $('.editor-bottom .eui-buttons-bar')[0].children[4].firstElementChild.innerText.indexOf('100%') !== -1;
  158. var childNode = $('.editor-bottom .eui-buttons-bar')[0].children[4] ;
  159. var isMax = childNode.firstElementChild.innerText.indexOf('100%') !== -1;
  160. if(!isMax) {
  161. childNode.click()
  162. }else
  163. childNode.click()
  164. // 放大之后 下载海报
  165. setTimeout(() => {
  166. callback( )
  167. }, 200)
  168. }
  169.  
  170. // $(document).ready(function () {
  171. var style = document.createElement('style');
  172. style.innerHTML = `
  173. .zoom-button {position:fixed; right:5%; bottom:20%; width: 60px; height: 60px; transition: all 0.5s ease; background: #3d78e2e6;border-radius: 50%; z-index: 99999; }
  174. .zoom-icon {text-align:center; line-height: 60px; color: #fff; }
  175. `;
  176. $('body').append(style);
  177. // });
  178.  
  179. document.addEventListener('DOMContentLoaded', () => {
  180. function removeTextWatermark() {
  181. let app_element = $('#app')[0]
  182. app_element.addEventListener("DOMNodeInserted", function (event) {
  183. if(event.target.className === 'remove-watermark') {
  184. $('.remove-watermark').remove() ; // 删除 "移除水印, 畅享高清模板" 文字
  185. // 移除会员无风险 字样
  186. document.querySelector("#app > div > div > div.eui-base-container > div.eui-header-container > div.eui-header-container__right > button.editor-header-button.editor-header-button-tip.gda-btn.gda-btn-text").remove();
  187. // 移除开通vip div
  188. // document.querySelector("#udesk_container").nextSibling.remove() // 费时间放弃了
  189. }
  190. }, false);
  191. };
  192. removeTextWatermark();
  193. if ( GM_getValue('zoom_links') ){
  194. addButton();
  195. }
  196. });
  197. var btn='<div style="width: 80px;height:30px;position:absolute;top:10px;left:13px;z-index: 99999;overflow: visible;">'+
  198. ' <button id="removeWatermark" style="background-color: rgb(34 84 244);width: 80px;height: 30px;color: white;">去除水印</button></div>';
  199. $("body").prepend(btn);
  200. $("button#removeWatermark").click(function(){
  201. var tit=document.title;
  202. if (/(稿定设计)/.test(tit)) {
  203. var gaoding="<style>.editor-watermark{position: static;z-index:-999}</style>"; $("body").prepend(gaoding);
  204. $("div.remove-watermark").remove();
  205. }
  206. else if (/(图怪兽)/.test(tit)) {
  207. $("div").remove(".image-watermark");
  208. }else if (/(易企秀)/.test(tit)) {
  209. $("div.eqc-watermark").css("position",'static');
  210. }else if (/(创客贴)/.test(tit)) {
  211. // $("#center-panel > div.page-wrap > div > div.canvas.canvas_slot.canvas-slot-wrapper > div > div.canvas.water-mark")
  212. $("div[style*='ckt-watermark']").remove();
  213. $("div").remove(".templateWaterMark");
  214. $("div").remove(".water-mark");
  215. }else if (/(比格设计)/.test(tit)) {
  216. $("div.water").css("position",'static');
  217. $("div.tool-bar-container").remove();
  218. }
  219. });
  220.  
  221.  
  222. // 搞定设计 || 创客贴 (屏蔽水印和会员小提示,下载PDF格式!!)
  223.  
  224. (function ($) {
  225. "use strict";
  226. // A nice closure for our definitions
  227. function getjQueryObject(string) {
  228. // Make string a vaild jQuery thing
  229. var jqObj = $("");
  230. try {
  231. jqObj = $(string)
  232. .clone();
  233. } catch (e) {
  234. jqObj = $("<span />")
  235. .html(string);
  236. }
  237. return jqObj;
  238. }
  239.  
  240. function printFrame(frameWindow, content, options) {
  241. // Print the selected window/iframe
  242. var def = $.Deferred();
  243. try {
  244. frameWindow = frameWindow.contentWindow || frameWindow.contentDocument || frameWindow;
  245. var wdoc = frameWindow.document || frameWindow.contentDocument || frameWindow;
  246. if(options.doctype) {
  247. wdoc.write(options.doctype);
  248. }
  249. wdoc.write(content);
  250. wdoc.close();
  251. var printed = false;
  252. var callPrint = function () {
  253. if(printed) {
  254. return;
  255. }
  256. // Fix for IE : Allow it to render the iframe
  257. frameWindow.focus();
  258. try {
  259. // Fix for IE11 - printng the whole page instead of the iframe content
  260. if (!frameWindow.document.execCommand('print', false, null)) {
  261. // document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891
  262. frameWindow.print();
  263. }
  264. // focus body as it is losing focus in iPad and content not getting printed
  265. $('body').focus();
  266. } catch (e) {
  267. frameWindow.print();
  268. }
  269. frameWindow.close();
  270. printed = true;
  271. def.resolve();
  272. }
  273. // Print once the frame window loads - seems to work for the new-window option but unreliable for the iframe
  274. $(frameWindow).on("load", callPrint);
  275. // Fallback to printing directly if the frame doesn't fire the load event for whatever reason
  276. setTimeout(callPrint, options.timeout);
  277. } catch (err) {
  278. def.reject(err);
  279. }
  280. return def;
  281. }
  282.  
  283. function printContentInIFrame(content, options) {
  284. var $iframe = $(options.iframe + "");
  285. var iframeCount = $iframe.length;
  286. if (iframeCount === 0) {
  287. // Create a new iFrame if none is given
  288. $iframe = $('<iframe height="0" width="0" border="0" wmode="Opaque"/>')
  289. .prependTo('body')
  290. .css({
  291. "position": "absolute",
  292. "top": -999,
  293. "left": -999
  294. });
  295. }
  296. var frameWindow = $iframe.get(0);
  297. return printFrame(frameWindow, content, options)
  298. .done(function () {
  299. // Success
  300. setTimeout(function () {
  301. // Wait for IE
  302. if (iframeCount === 0) {
  303. // Destroy the iframe if created here
  304. $iframe.remove();
  305. }
  306. }, 1000);
  307. })
  308. .fail(function (err) {
  309. // Use the pop-up method if iframe fails for some reason
  310. console.error("Failed to print from iframe", err);
  311. printContentInNewWindow(content, options);
  312. })
  313. .always(function () {
  314. try {
  315. options.deferred.resolve();
  316. } catch (err) {
  317. console.warn('Error notifying deferred', err);
  318. }
  319. });
  320. }
  321.  
  322. function printContentInNewWindow(content, options) {
  323. // Open a new window and print selected content
  324. var frameWindow = window.open();
  325. return printFrame(frameWindow, content, options)
  326. .always(function () {
  327. try {
  328. options.deferred.resolve();
  329. } catch (err) {
  330. console.warn('Error notifying deferred', err);
  331. }
  332. });
  333. }
  334.  
  335. function isNode(o) {
  336. /* http://stackoverflow.com/a/384380/937891 */
  337. return !!(typeof Node === "object" ? o instanceof Node : o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string");
  338. }
  339. $.print = $.fn.print = function () {
  340. // Print a given set of elements
  341. var options, $this, self = this;
  342. // console.log("Printing", this, arguments);
  343. if (self instanceof $) {
  344. // Get the node if it is a jQuery object
  345. self = self.get(0);
  346. }
  347. if (isNode(self)) {
  348. // If `this` is a HTML element, i.e. for
  349. // $(selector).print()
  350. $this = $(self);
  351. if (arguments.length > 0) {
  352. options = arguments[0];
  353. }
  354. } else {
  355. if (arguments.length > 0) {
  356. // $.print(selector,options)
  357. $this = $(arguments[0]);
  358. if (isNode($this[0])) {
  359. if (arguments.length > 1) {
  360. options = arguments[1];
  361. }
  362. } else {
  363. // $.print(options)
  364. options = arguments[0];
  365. $this = $("html");
  366. }
  367. } else {
  368. // $.print()
  369. $this = $("html");
  370. }
  371. }
  372. // Default options
  373. var defaults = {
  374. globalStyles: true,
  375. mediaPrint: false,
  376. stylesheet: null,
  377. noPrintSelector: ".no-print",
  378. iframe: true,
  379. append: null,
  380. prepend: null,
  381. manuallyCopyFormValues: true,
  382. deferred: $.Deferred(),
  383. timeout: 750,
  384. title: null,
  385. doctype: '<!doctype html>'
  386. };
  387. // Merge with user-options
  388. options = $.extend({}, defaults, (options || {}));
  389. var $styles = $("");
  390. if (options.globalStyles) {
  391. // Apply the stlyes from the current sheet to the printed page
  392. $styles = $("style, link, meta, base, title");
  393. } else if (options.mediaPrint) {
  394. // Apply the media-print stylesheet
  395. $styles = $("link[media=print]");
  396. }
  397. if (options.stylesheet) {
  398. // Add a custom stylesheet if given
  399. $styles = $.merge($styles, $('<link rel="stylesheet" href="' + options.stylesheet + '">'));
  400. }
  401. // Create a copy of the element to print
  402. var copy = $this.clone();
  403. // Wrap it in a span to get the HTML markup string
  404. copy = $("<span/>")
  405. .append(copy);
  406. // Remove unwanted elements
  407. copy.find(options.noPrintSelector)
  408. .remove();
  409. // Add in the styles
  410. copy.append($styles.clone());
  411. // Update title
  412. if (options.title) {
  413. var title = $("title", copy);
  414. if (title.length === 0) {
  415. title = $("<title />");
  416. copy.append(title);
  417. }
  418. title.text(options.title);
  419. }
  420. // Appedned content
  421. copy.append(getjQueryObject(options.append));
  422. // Prepended content
  423. copy.prepend(getjQueryObject(options.prepend));
  424. if (options.manuallyCopyFormValues) {
  425. // Manually copy form values into the HTML for printing user-modified input fields
  426. // http://stackoverflow.com/a/26707753
  427. copy.find("input")
  428. .each(function () {
  429. var $field = $(this);
  430. if ($field.is("[type='radio']") || $field.is("[type='checkbox']")) {
  431. if ($field.prop("checked")) {
  432. $field.attr("checked", "checked");
  433. }
  434. } else {
  435. $field.attr("value", $field.val());
  436. }
  437. });
  438. copy.find("select").each(function () {
  439. var $field = $(this);
  440. $field.find(":selected").attr("selected", "selected");
  441. });
  442. copy.find("textarea").each(function () {
  443. // Fix for https://github.com/DoersGuild/jQuery.print/issues/18#issuecomment-96451589
  444. var $field = $(this);
  445. $field.text($field.val());
  446. });
  447. }
  448. // Get the HTML markup string
  449. var content = copy.html();
  450. // Notify with generated markup & cloned elements - useful for logging, etc
  451. try {
  452. options.deferred.notify('generated_markup', content, copy);
  453. } catch (err) {
  454. console.warn('Error notifying deferred', err);
  455. }
  456. // Destroy the copy
  457. copy.remove();
  458. if (options.iframe) {
  459. // Use an iframe for printing
  460. try {
  461. printContentInIFrame(content, options);
  462. } catch (e) {
  463. // Use the pop-up method if iframe fails for some reason
  464. console.error("Failed to print from iframe", e.stack, e.message);
  465. printContentInNewWindow(content, options);
  466. }
  467. } else {
  468. // Use a new window for printing
  469. printContentInNewWindow(content, options);
  470. }
  471. return this;
  472. };
  473. })(jQuery);
  474. $(window).on('load', function () {
  475. var windowUrl = window.location.href;
  476. var GdurlReg = /gaoding.com/;
  477. var CkturlReg = /chuangkit.com/;
  478. var GddiyCss = `
  479. .editor-watermark,
  480. .editor-remove-watermark,
  481. .remove-watermark,
  482. .icon-vip-diamond,
  483. .gdd-material-card__vip,
  484. .g-popover__container:nth-child(2),
  485. #svePdf
  486. { display:none;}
  487. .eui-buttons-bar--dropdown > button:nth-child(1),
  488. .eui-buttons-bar--dropdown > button:nth-child(2)
  489. {pointer-events:none;}
  490. .eui-buttons-bar--dropdown{cursor: pointer;}
  491. `
  492. var CktdiyCss = `
  493. .templateWaterMark, .remove-cktTemplate-watermark,
  494. #renderer > div:nth-child(5) > div,
  495. #renderer > div:nth-child(2) > div > div:nth-child(2) > div,
  496. #renderer > div:nth-child(6) > div > div:nth-child(2) > div,
  497. #svePdf { display:none;}
  498. .design-header-download-span-newDown, .design-header-download-left-download { pointer-events:none; }
  499. `
  500. function addStyle(name) {
  501. $(document).ready(function () {
  502. var style = document.createElement('style');
  503. style.innerHTML = name;
  504. $('body').append(style);
  505. });
  506. }
  507. function yes(contentID,DownloadBut) {
  508. var divHtml = '<button type="button" id="svePdf">pdf</button>'
  509. setTimeout(function () {
  510. $(DownloadBut).append(divHtml)
  511. $(DownloadBut).on('click', function () {
  512. alert('艺术字体打印失真! -- 1⃣️打印机选择存储为PDF----2⃣️边距离无-----3⃣️选上背景图形')
  513. var diyPrtCss = `@media print {
  514. @page {
  515. size: `+ $(contentID).width() + `px ` + $(contentID).height() + `px;
  516. margin: 0; }
  517. body { margin: 0; }
  518. });`
  519. var prtStyle = document.createElement('style');
  520. prtStyle.innerHTML = diyPrtCss;
  521. $('body').append(prtStyle);
  522. $(contentID).print({
  523. globalStyles: true,//是否包含父文档的样式,默认为true
  524. mediaPrint: false,//是否包含media='print'的链接标签。会被globalStyles选项覆盖,默认为false
  525. stylesheet: null,//外部样式表的URL地址,默认为null
  526. noPrintSelector: ".no-print",//不想打印的元素的jQuery选择器,默认为".no-print"
  527. iframe: true,//是否使用一个iframe来替代打印表单的弹出窗口,true为在本页面进行打印,false就是说新开一个页面打印,默认为true
  528. append: null,//将内容添加到打印内容的后面
  529. prepend: null,//将内容添加到打印内容的前面,可以用来作为要打印内容
  530. deferred:
  531. $.Deferred()//回调函数
  532. });
  533. })
  534. }, 2000)
  535. }
  536. if ( util.getValue('enable_pdfprint') ){
  537. if (GdurlReg.test(windowUrl)) {//搞定
  538. addStyle(GddiyCss)
  539. // 画布 document.querySelector(".editor-canvas")
  540. // 下载菜单 document.querySelector(".editor-right-actions > .editor-right-actions__dropdown")
  541. yes('.editor-canvas','.editor-right-actions > .editor-right-actions__dropdown')
  542. }
  543. else if (CkturlReg.test(windowUrl)) { //创客贴
  544. addStyle(CktdiyCss)
  545. // 画布 document.querySelector("div.canvas.canvas_slot.canvas-slot-wrapper > div")
  546. // 下载菜单 document.querySelector(".design-header-download-newDown")
  547. yes('#center-panel > div.page-wrap > div > div.canvas.canvas_slot.canvas-slot-wrapper > div','.design-header-download-newDown')
  548. // yes('#page','.design-header-download-newDown')
  549. }
  550. }
  551. })
  552. })( jQuery );
  553.  
  554. (function () { })();
  555.  
  556.  
  557. /*
  558.  
  559. // 快速选择素材ID
  560. ;(function () {
  561. 'use strict'
  562.  
  563. document.addEventListener('DOMContentLoaded', () => {
  564. // 在素材详情页面 https://sucai.gaoding.com/material/33911264
  565. if (/gaoding.com\/material\/\d+/.test(window.location.href)) {
  566. const materialId = window.location.href.match(
  567. /gaoding.com\/material\/(\d+)/,
  568. )[1]
  569. //alt 按下 并点击素材图片
  570. document.querySelector('.gdd-material-detail').firstChild.addEventListener('click', (e) => {
  571. if (e.altKey) {
  572. const avalon = window.open(
  573. `https://avalon.gaoding.com/c/content/materials/${materialId}`,
  574. )
  575. }
  576. })
  577. }
  578.  
  579. // 其他页面
  580. document.addEventListener('click', function (e) {
  581. if (!e.altKey) {
  582. return
  583. }
  584. if (e.target.tagName === 'IMG' || e.target.tagName === 'VIDEO') {
  585. const link = e.target.closest('a')
  586. if (link && /\/material\/\d+\b/.test(link.href)) {
  587. e.preventDefault()
  588. const materialId = link.href.match(/\b\d+\b/)[0]
  589. const avalon = window.open(
  590. `https://avalon.gaoding.com/c/content/materials/${materialId}`,
  591. )
  592. }
  593. }
  594. })
  595. });
  596.  
  597. document.addEventListener('DOMContentLoaded', () => {
  598. const selectedIdContainer = document.createElement('div');
  599. selectedIdContainer.setAttribute('hidden', true);
  600. selectedIdContainer.style.cssText = `
  601. position: fixed;
  602. width: 363px;
  603. height: 286px;
  604. border: 1px solid rgb(204, 204, 204);
  605. z-index: 99999;
  606. top: 100px;
  607. left: 20px;
  608. background-color: rgb(238, 238, 238);
  609. resize: both;
  610. overflow: auto;
  611. padding: 10px;
  612. overflow-wrap: break-word;
  613. `
  614. document.body.appendChild(selectedIdContainer);
  615.  
  616. document.addEventListener('dblclick', () => {
  617. selectedIdContainer.toggleAttribute('hidden');
  618. });
  619.  
  620. const ids = new Set()
  621.  
  622. document.addEventListener('click', function (e) {
  623. if (!e.shiftKey) {
  624. return
  625. }
  626. e.preventDefault();
  627. e.stopImmediatePropagation()
  628. if (window.location.host === 'www.gaoding.com') { // 稿定主站上的逻辑
  629. if (e.target.tagName === 'IMG') {
  630. const card = e.target.closest('.gdd-material-card__preview');
  631. if (card) {
  632. const link = card.nextElementSibling;
  633. debugger;
  634. if (link && /\/template\/\d+\b/.test(link.href)) {
  635. e.preventDefault()
  636.  
  637. const id = link.href.match(/\b\d+\b/)[0]
  638.  
  639. if (ids.has(id)) {
  640. // 删除
  641. ids.delete(id)
  642. card.selectIcon.remove()
  643. } else {
  644. // 添加
  645. ids.add(id)
  646. toggleSelect(card)
  647. }
  648.  
  649. selectedIdContainer.innerHTML = [...ids].join(',')
  650. }
  651. }
  652. }
  653.  
  654. } else if (e.target.tagName === 'IMG' || e.target.tagName === 'VIDEO') { // 稿定素材站逻辑
  655. const link = e.target.closest('a')
  656. if (link && /\/material\/\d+\b/.test(link.href)) {
  657. e.preventDefault()
  658.  
  659. const id = link.href.match(/\b\d+\b/)[0]
  660.  
  661. if (ids.has(id)) {
  662. // 删除
  663. ids.delete(id)
  664. link.selectIcon.remove()
  665. } else {
  666. // 添加
  667. ids.add(id)
  668. toggleSelect(link)
  669. }
  670.  
  671. selectedIdContainer.innerHTML = [...ids].join(',')
  672. }
  673. }
  674. }, true);
  675.  
  676. function toggleSelect(ele) {
  677. const selectIcon = document.createElement('div')
  678. selectIcon.style.cssText = `
  679. position: absolute;
  680. width: 100%;
  681. height: 100%;
  682. background-color: rgba(0, 0, 0, 0.3);
  683. text-align: center;
  684. padding: 20px;
  685. box-sizing: border-box;
  686. font-size: 120px;
  687. color: red;
  688. text-shadow: 1px 3px 2px #fff;
  689. pointer-events: none;
  690. z-index: 9;
  691. top: 0;
  692. left: 0;
  693. font-family: none;
  694. `
  695. selectIcon.innerHTML = '✓'
  696. ele.appendChild(selectIcon)
  697. ele.selectIcon = selectIcon
  698. }
  699. })
  700. })();
  701.  
  702. */
  703.  
  704.  
  705.  
  706.