Jandan Copy

强力解除煎蛋复制限制

Fra og med 29.11.2015. Se den nyeste version.

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!)

// ==UserScript==
// @name        Jandan Copy
// @namespace   -
// @description 强力解除煎蛋复制限制
// @include     http://jandan.net/*
// @version     0.2
// @rut-at      document-start
// @copyright   mistree
// @grant       none
// ==/UserScript==

EventTarget.prototype.addEventListenerBase = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener)
{
    if(type=="copy") return;
    if(!this.EventList) { this.EventList = []; }
    this.addEventListenerBase.apply(this, arguments);
    if(!this.EventList[type]) { this.EventList[type] = []; }
    var list = this.EventList[type];
    for(var index = 0; index != list.length; index++)
    {
        if(list[index] === listener) { return; }
    }
    list.push(listener);
};

EventTarget.prototype.removeEventListenerBase = EventTarget.prototype.removeEventListener;
EventTarget.prototype.removeEventListener = function(type, listener)
{
    if(!this.EventList) { this.EventList = []; }
    if(listener instanceof Function) { this.removeEventListenerBase.apply(this, arguments); }
    if(!this.EventList[type]) { return; }
    var list = this.EventList[type];
    for(var index = 0; index != list.length;)
    {
        var item = list[index];
        if(!listener)
        {
            this.removeEventListenerBase(type, item);
            list.splice(index, 1); continue;
        }
        else if(item === listener)
        {
            list.splice(index, 1); break;
        }
        index++;
    }
    if(list.length == 0) { delete this.EventList[type]; }
};

window.addEventListener("load", function()
{
    document.removeEventListener("copy");
});