jav_r18

详情页添加r18.com预览

Verze ze dne 07. 01. 2018. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         jav_r18
// @version      0.0.1
// @include      http*://*javlibrary.com/*/?v=*
// @description  详情页添加r18.com预览
// @author       bilabila
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// @namespace https://greasyfork.org/users/164996
// ==/UserScript==
(()=> {
    'use strict';
    const parseHTML =  (str) => {
        var tmp = document.implementation.createHTMLDocument();
        tmp.body.innerHTML = str;
        return tmp;
    };
    const avid = document.title.split(' ')[0];
    const get_video_url = (avid, callback) => {
        GM_xmlhttpRequest({
            url: `http://www.r18.com/common/search/searchword=${avid}`,
            onload: (res) => callback(parseHTML(res.responseText).querySelector('.js-view-sample').getAttribute('data-video-high'))
        });
    };
    const add_to_doc = (video_url) => {
        document.querySelector('#video_favorite_edit').insertAdjacentHTML('beforeend',
            `<video id='jav_r18' style='postiton:absolute;z-order:1' src=${video_url} controls autoplay></video>`);
    };
    if (document.querySelector('#video_jacket_img'))
        get_video_url(avid, add_to_doc);
})();