Copy text from fanfiction.net

Allow copy from fanfiction.net

目前為 2017-08-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Copy text from fanfiction.net
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Allow copy from fanfiction.net
// @author       scuzz
// @match        https://www.fanfiction.net/s*
// @grant        none
// ==/UserScript==
(function () {
  'use strict';
  var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutationRecord) {
      var elementStyle = document.getElementById('storytextp').style;
      if (elementStyle['-webkit-touch-callout'] != 'text' || elementStyle['-webkit-user-select'] != 'text' || elementStyle['-khtml-user-select'] != 'text' || elementStyle['-moz-user-select'] != 'text' || elementStyle['-ms-user-select'] != 'text' || elementStyle['user-select'] != 'text') {
        elementStyle['-webkit-touch-callout'] = 'text';
        elementStyle['-webkit-user-select'] = 'text';
        elementStyle['-khtml-user-select'] = 'text';
        elementStyle['-moz-user-select'] = 'text';
        elementStyle['-ms-user-select'] = 'text';
        elementStyle['user-select'] = 'text';
        console.log('Fuck you ff net');
      }
    });
  });
  var target = document.getElementById('storytextp');
  observer.observe(target, {
    attributes: true,
    attributeFilter: [
      'style'
    ]
  });
  setUserSelectText(document.getElementById('storytextp').style);
}) ();