Skip to content
油猴脚本demo

金山文档解除复制限制

js
// ==UserScript==
// @name         金山文档解除复制限制
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.kdocs.cn/l/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=kdocs.cn
// @grant        none
// @downloadURL https://update.greasyfork.org/scripts/449305/%E9%87%91%E5%B1%B1%E6%96%87%E6%A1%A3%E8%A7%A3%E9%99%A4%E5%A4%8D%E5%88%B6%E9%99%90%E5%88%B6.user.js
// @updateURL https://update.greasyfork.org/scripts/449305/%E9%87%91%E5%B1%B1%E6%96%87%E6%A1%A3%E8%A7%A3%E9%99%A4%E5%A4%8D%E5%88%B6%E9%99%90%E5%88%B6.meta.js
// ==/UserScript==

(function() {
    'use strict';

    window.onload = function(){
	window.APP.canCopy=function a(){ return true;}
}
    // Your code here...
})();

1688商品详情页面数据获取

js
// ==UserScript==
// @name         1688商品详情数据获取
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  打印 window.context.result.data 并 POST 上传到接口
// @author       You
// @match        https://detail.1688.com/offer/*
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// ==/UserScript==

(function () {
  'use strict';

  function addButton() {
    const btn = document.createElement('button');
    btn.innerText = '上传商品数据';
    btn.style.position = 'fixed';
    btn.style.top = '10px';
    btn.style.right = '10px';
    btn.style.zIndex = '9999';
    btn.style.padding = '8px 12px';
    btn.style.backgroundColor = '#409eff';
    btn.style.color = '#fff';
    btn.style.border = 'none';
    btn.style.borderRadius = '4px';
    btn.style.cursor = 'pointer';

    btn.addEventListener('click', () => {
      const ctx = unsafeWindow.context; // ✅ 用 unsafeWindow 访问页面真实 window

      if (ctx && ctx.result && ctx.result.data) {
        const data = ctx.result.data;
        console.log('✅ 商品数据:', data);
      } else {
        alert('❌ 未找到 window.context.result.data');
      }
    });

    document.body.appendChild(btn);
  }

  if (document.readyState === 'complete') {
    addButton();
  } else {
    window.addEventListener('load', addButton);
  }
})();