Pixiv Medium Page Replace With Original

Replace Pixiv medium page's image with original image

As of 2018-06-24. See the latest version.

// ==UserScript==
// @name         Pixiv Medium Page Replace With Original
// @namespace    https://blog.maple3142.net/
// @version      0.1
// @description  Replace Pixiv medium page's image with original image
// @author       maple3142
// @match        https://www.pixiv.net/member_illust.php?mode=medium&illust_id=*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict'

    const PREFIX=Math.random().toString(36)
    Object.defineProperty(Object.prototype,'props',{
        set(v){
            this[PREFIX+'_props']=v
            if(v.urls)onTarget(this)
        },
        get(v){
            return this[PREFIX+'_props']
        }
    })
    function onTarget(target){
        const url=target.props.urls.original
        target.props.urls=new Proxy({},{
            get: ()=>url
        })
    }
})()