JavBus library trailer

JavBus&library图书馆预告片花Direct,番号页封面下直接显示,默认不播放

Ajankohdalta 15.9.2022. Katso uusin versio.

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         JavBus library trailer
// @name:zh-CN   JavBus&library图书馆预告片花Direct
// @namespace    https://greasyfork.org/zh-CN/scripts/441120-javbus-library-trailer
// @homepageURL  https://greasyfork.org/zh-CN/scripts/441120-javbus-library-trailer
// @version      2022.0916.0030
// @description         JavBus&library图书馆预告片花Direct,番号页封面下直接显示,默认不播放
// @description:zh-cn   JavBus&library图书馆预告片花Direct,番号页封面下直接显示,默认不播放
// @author       匿名
// @license      GPL
// @include     /^.*(jav|bus|dmm|see|cdn|fan){2}\..*$/
// @include      *://*.javlib.com/*
// @include      *://*.javlibrary.com/*
// @include     *://*/cn/?v=jav*
// @include     *://*/en/?v=jav*
// @include     *://*/tw/?v=jav*
// @include     *://*/ja/?v=jav*
// @include      *://*/tw/movie/jav*
// @match      *://*.javlib.com/*
// @match      *://*.javlibrary.com/*
// @match      *://www.javbus.com/*
// @connect      btsow.club
// ==/UserScript==

/**
 *  - 2022-09-15 重新对片花地址进行修正,支持bus和图书馆,并公开分享脚本,期待愈加完善
 *  - 以下为历史记录
 *  - 2022-03-08
 *    脚本由 https://greasyfork.org/zh-CN/scripts/400267-javbus 二次修改以兼容老司机脚本
 *  - 只保留 预告片 功能,其它剔除
 *  - 可根据电脑分辨率自行调整播放器宽度,高度会自适应(搜索1120px修改合适值)
 *  - (脚本是在和老司机脚本做兼容,不保证兼容其它脚本,水平有限,仅作自用,不予公开)
 */
(function () {
    'use strict';
    function GM_addStyle(css) {
        const style = document.getElementById("GM_addStyleBy8626") || (function () {
            const style = document.createElement('style');
            style.type = 'text/css';
            style.id = "GM_addStyleBy8626";
            document.head.appendChild(style);
            return style;
        })();
        style.innerHTML = css;
    }
    /**
     * 左则补零
     * @param num
     * @param len
     * @returns {*}
     */
    function format_zero(num, len) {
        if (String(num).length > len) return num;
        return (Array(len).join(0) + num).slice(-len);
    }
    //瀑布流
    class Waterfull {
        //获取数据
        getData() {
            let url = $(this.config['next']).attr('href');
            let _this = this;
            if (url !== undefined) {
                this.done = false;
                fetch(url, {credentials: 'same-origin'})
                    .then(function (response) {
                        return response.text();
                    })
                    .then(function (html) {
                        let dom = new DOMParser().parseFromString(html, 'text/html');
                        dom = $(dom);
                        let avatarBox = dom.find(_this.config['items']).find('.avatar-box');
                        if (avatarBox.length > 0) {
                            avatarBox.parent().remove();
                        }
                        let elems = dom.find(_this.config['items']);
                        elems.each(function (i) {
                            $(this).attr('style', '');
                            $(this).find('a').attr('target', '_blank')
                            if (_this.config['selector'] === 'div#video_comments') {
                                let text = $(this).find('textarea').val();
                                text = text.replace(/\[url=([^\[\]]*?)\](.*?)\[\/url\]/g, '<a href="redirect.php?url=$1" target="_blank">$2</a>')
                                text = text.replace(/\[color=([^\[\]]*?)\](.*?)\[\/color\]/g, '<span style="color:$1">$2</span>')
                                text = text.replace(/\[b\](.*?)\[\/b\]/g, '<b>$1</b>')
                                $(this).find('.text').html(text).css('width', '442px');
                            }
                        });
                        $(_this.config['pagination']).html(dom.find(_this.config['pagination']).html());
                        $(_this.config['selector']).append(elems);
                        if (_this.config['useMasonry']) {
                            _this.masonryObj.masonry('appended', elems).masonry();
                        }
                        _this.done = true;
                    })
            }
        }
    }
    class Request {
        constructor() {
            this.lock = [];
        }
        send(url, successCallback) {
            let _this = this;
            return new Promise(function (resolve, reject) {
                let index = _this.lock.indexOf(url);
                if (index === -1) {
                    _this.lock.push(url);
                    GM_xmlhttpRequest({
                        url,
                        method   : 'GET',
                        headers  : {
                            "Cache-Control": "no-cache"
                        },
                        timeout  : 30000,
                        onload   : function (response) {
                            console.log(url + ' success');
                            _this.lock.splice(index, 1);
                            resolve(response);
                        },
                        onabort  : (e) => {
                            console.log(url + " abort");
                            reject("wrong");
                        },
                        onerror  : (e) => {
                            console.log(url + " error");
                            console.log(e);
                            reject("wrong");
                        },
                        ontimeout: (e) => {
                            console.log(url + " timeout");
                            reject("wrong");
                        },
                    });
                } else {
                    reject("发送请求ing");
                }
            }).then(function (response) {
                successCallback(response);
            }, function (err) {
                console.log(err)
            });
        }
    }
    class Base {
        addVideo(code, obj) {
            let codeArr = code.split('-');
            let videoSeries = codeArr[0].toLowerCase();
            let videoNo = format_zero(codeArr[1], 5);
            let videoUrl = '//cc3001.dmm.co.jp/litevideo/freepv/' + videoSeries[0] + '/' + videoSeries.substr(0, 3) + '/' + videoSeries + videoNo + '/' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl2 = '//cc3001.dmm.co.jp/litevideo/freepv/' + videoSeries[0] + '/' + videoSeries.substr(0, 3) + '/' + videoSeries + codeArr[1] + '/' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl3 = '//cc3001.dmm.co.jp/litevideo/freepv/1/1' + videoSeries.substr(0, 2) + '/1' + videoSeries + codeArr[1] + '/1' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl4 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1324' + videoSeries + codeArr[1] + '/h_1324' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl5 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1472' + videoSeries + videoNo + '/h_1472' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl6 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_113' + videoSeries + codeArr[1] + '/h_113' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl7 = '//cc3001.dmm.co.jp/litevideo/freepv/1/118/118' + videoSeries + videoNo + '/118' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl8 = '//cc3001.dmm.co.jp/litevideo/freepv/1/118/118' + videoSeries + codeArr[1] + '/118' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl9 = '//cc3001.dmm.co.jp/litevideo/freepv/5/53d/53' + videoSeries + codeArr[1] + '/53' + videoSeries + codeArr[1] + '_sm_s.mp4';
            let videoUrl10 = '//cc3001.dmm.co.jp/litevideo/freepv/1/13g/13' + videoSeries + codeArr[1] + '/13' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl11 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_6/h_687' + videoSeries + codeArr[1] + '/h_687' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl12 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1594' + videoSeries + videoNo + '/h_1594' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl13 = '//cc3001.dmm.co.jp/litevideo/freepv/1/1si/1' + videoSeries + videoNo + '/1' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl14 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1100' + videoSeries + codeArr[1] + '/h_1100' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl15 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_2/h_283' + videoSeries + codeArr[1] + '/h_283' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl16 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_4/h_491' + videoSeries + codeArr[1] + '/h_491' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl17 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1616' + videoSeries + videoNo + '/h_1616' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl18 = '//cc3001.dmm.co.jp/litevideo/freepv/1/1ft/1' + videoSeries + videoNo + '/1' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl19 = '//cc3001.dmm.co.jp/litevideo/freepv/1/1sh/1' + videoSeries + videoNo + '/1' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl20 = '//cc3001.dmm.co.jp/litevideo/freepv/5/55t/55' + videoSeries + codeArr[1] + '/55' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl21 = '//cc3001.dmm.co.jp/litevideo/freepv/1/12l/12' + videoSeries + codeArr[1] + '/12' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl22 = '//cc3001.dmm.co.jp/vrsample/h/h_9/h_955' + videoSeries + videoNo + '/h_955' + videoSeries + videoNo + 'vrlite.mp4';
            let videoUrl23 = '//cc3001.dmm.co.jp/vrsample/2/24d/24' + videoSeries + videoNo + '/24' + videoSeries + videoNo + 'vrlite.mp4';
            let videoUrl24 = '//cc3001.dmm.co.jp/vrsample/h/h_1/h_1321' + videoSeries + videoNo + '/h_1321' + videoSeries + videoNo + 'vrlite.mp4';
            let videoUrl25 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1560' + videoSeries + videoNo + '/h_1560' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl26 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1160' + videoSeries + codeArr[1] + '/h_1160' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl27 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_2/h_254' + videoSeries + codeArr[1] + '/h_254' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl28 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_2/h_227' + videoSeries + videoNo + '/h_227' + videoSeries + videoNo + '_dmb_w.mp4';
            let videoUrl29 = '//cc3001.dmm.co.jp/litevideo/freepv/1/125/125' + videoSeries + codeArr[1] + '/125' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl30 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_3/h_346' + videoSeries + codeArr[1] + '/h_346' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            let videoUrl31 = '//cc3001.dmm.co.jp/litevideo/freepv/h/h_1/h_1495' + videoSeries + codeArr[1] + '/h_1495' + videoSeries + codeArr[1] + '_dmb_w.mp4';
            if (code.indexOf('ABW') !== -1) {
                videoUrl = 'https://www.prestige-av.com/sample_movie/TKT' + code + '.mp4'
            }
            let video = $('<div style="text-align: center;padding: 10px;border-radius: 4px;border: 1px solid #ccc;margin: 10px 0;">\
                          <video controls style="width: 1120px;">\
                          <source src="' + videoUrl + '" type="video/mp4" />\
                          <source src="' + videoUrl2 + '" type="video/mp4" />\
                          <source src="' + videoUrl3 + '" type="video/mp4" />\
                          <source src="' + videoUrl4 + '" type="video/mp4" />\
                          <source src="' + videoUrl5 + '" type="video/mp4" />\
                          <source src="' + videoUrl6 + '" type="video/mp4" />\
                          <source src="' + videoUrl7 + '" type="video/mp4" />\
                          <source src="' + videoUrl8 + '" type="video/mp4" />\
                          <source src="' + videoUrl9 + '" type="video/mp4" />\
                          <source src="' + videoUrl10 + '" type="video/mp4" />\
                          <source src="' + videoUrl11 + '" type="video/mp4" />\
                          <source src="' + videoUrl12 + '" type="video/mp4" />\
                          <source src="' + videoUrl13 + '" type="video/mp4" />\
                          <source src="' + videoUrl14 + '" type="video/mp4" />\
                          <source src="' + videoUrl15 + '" type="video/mp4" />\
                          <source src="' + videoUrl16 + '" type="video/mp4" />\
                          <source src="' + videoUrl17 + '" type="video/mp4" />\
                          <source src="' + videoUrl18 + '" type="video/mp4" />\
                          <source src="' + videoUrl19 + '" type="video/mp4" />\
                          <source src="' + videoUrl20 + '" type="video/mp4" />\
                          <source src="' + videoUrl21 + '" type="video/mp4" />\
                          <source src="' + videoUrl22 + '" type="video/mp4" />\
                          <source src="' + videoUrl23 + '" type="video/mp4" />\
                          <source src="' + videoUrl24 + '" type="video/mp4" />\
                          <source src="' + videoUrl25 + '" type="video/mp4" />\
                          <source src="' + videoUrl26 + '" type="video/mp4" />\
                          <source src="' + videoUrl27 + '" type="video/mp4" />\
                          <source src="' + videoUrl28 + '" type="video/mp4" />\
                          <source src="' + videoUrl29 + '" type="video/mp4" />\
                          <source src="' + videoUrl30 + '" type="video/mp4" />\
                          <source src="' + videoUrl31 + '" type="video/mp4" />\
                          </video>\
                          </div>');
            $(obj).before(video)
        }
    }
    class JavBus extends Base {
        constructor(Request, Waterfull) {
            super(Request, Waterfull);
             GM_addStyle(`
                .info a.red {color:red;padding-right:15px;}
            `);
            if ($('.col-md-3.info').length > 0) {
                this.detailPage();
            }
        }
        detailPage() {
            let _this = this;
            let info = $('.col-md-3.info');
            let codeRow = info.find('p').eq(0);
            let code = codeRow.find('span').eq(1).html();
            //添加预告视频观看按钮
            this.addVideo(code, '#mag-submit-show')
            //添加跳转到javlibrary链接
            info.append("<p><a class='red' href='http://www.javlibrary.com/cn/vl_searchbyid.php?keyword=" + code + "' target='_blank'>javlibrary</a><a class='red' href='https://javdb005.com/search?q=" + code + "' target='_blank'>javdb</a></p>");
        }
    }
    class JavLibrary extends Base {
        constructor(Request, Waterfull) {
            super(Request, Waterfull);
            GM_addStyle(`
                .header a.red {color:red;padding-right:15px;}
            `);
            if ($('#video_info').length > 0) {
                this.detailPage();
            }
        }
        detailPage() {
            let _this = this;
            let info = $('#video_info');
            let codeRow = info.find('.item').eq(0);
            let code = codeRow.find('.text').html();
            //添加跳转到javlibrary链接
            info.append("<div class='item'><table><tbody><tr><td class='header'><a class='red' href='https://www.busfan.blog/" + code + "' target='_blank'>javbus</a><a class='red' href='https://javdb005.com/search?q=" + code + "' target='_blank'>javdb</a></td></tr></tbody></table></div>");
            //添加预告视频观看按钮
            this.addVideo(code, '#video_favorite_edit')
        }
    }
    class Main {
        constructor() {
            if ($("footer:contains('JavBus')").length) {
                this.site = 'javBus';
            } else if ($("#bottomcopyright:contains('JAVLibrary')").length) {
                this.site = 'javLibrary'
            }
        }
        make() {
            let WaterfullObj = new Waterfull();
            let requestObj = new Request();
            let obj;
            switch (this.site) {
                case 'javBus':
                    obj = new JavBus(requestObj, WaterfullObj);
                    break;
                case 'javLibrary':
                    obj = new JavLibrary(requestObj, WaterfullObj);
                    break;
            }
            return obj;
        }
    }
    let main = new Main();
    main.make();
})();