Copy Simply Johnny's

I just wanna copy something

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name Copy Simply Johnny's
// @namespace bambooom
// @version 0.3
// @description I just wanna copy something
// @author bambooom
// @homepageURL https://zhuzi.dev
// @supportURL https://zhuzi.dev
// @license MIT
// @match https://*.johnnys-net.jp/*
// @match https://*.johnnys-web.com/*
// @match https://*.johnny-associates.co.jp/*
// @match https://johnnys-shop.jp/*
// @match https://*.johnnys-shop.jp/*
// @match https://j-island.net/*
// @match https://*.j-island.net/*
// @run-at document-end
// @grant unsafeWindow
// ==/UserScript==

(function() {
  let css = `
    body{
      user-select: auto!important;
    }
    h1, h2, h3, h4, h5, p, span, img {
      user-select: auto!important;
    }
    *:not(input) {
      user-select: auto!important;
    }

    .visually-hidden {
      border: 0;
      clip: rect(0,0,0,0);
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      overflow: hidden;
      padding: 0;
     }
  `;
  let styleNode = document.createElement("style");
  styleNode.appendChild(document.createTextNode(css));
  (document.querySelector("head") || document.documentElement).appendChild(styleNode);

  let donot = [...document.querySelectorAll('script')].filter(n => /donot\.js$/.test(n.src));
  if (donot.length) {
    donot[0].remove();
  }
  unsafeWindow.KEY_ENABLE = 1;
  unsafeWindow.________J && unsafeWindow.________J.doNot({
      selectContent: null,
      captureImages: null,
     useContextMenu: null,
            useKeys: null,
  });

  if (/johnnys-web\.com/.test(unsafeWindow.location.hostname)) {
    unsafeWindow.navigator.userAgent = 'Mozilla/5.0 (iPad; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
    unsafeWindow.navigator.appVersion = '5.0 (iPad; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
    //location.href = 'https://www.johnnys-web.com/s/jwb/?ima=4442';
    var post = document.querySelector('.entry__content .entry__body');
    if (post) {
      post = post.textContent.trim();
      var row = document.querySelector('.entry__posted_on');
      var color = getComputedStyle(document.querySelector('.blog .section-article .entry__date')).color;
      var btn = document.createElement('button');
      btn.style.color = color;
      btn.style.border = 'solid 2px ' + color;
      btn.style.borderRadius = '3px';
      btn.style.padding = '4px 6px';
      btn.textContent = 'Copy Full Text';
      row.appendChild(btn);
      var input = document.createElement('textarea');
      input.classList.add('visually-hidden');
      input.id = 'copy-full-text';
      document.body.appendChild(input);
      btn.onclick = function () {
        input.value = post;
        input.select();
        let success = document.execCommand('copy');
        window.getSelection().removeAllRanges();
        if (success) {
          console.log('copied');
        }
      };
    }
  }
})();