Soul+Linker

用于从魂+快速跳转到DLsite

As of 2022-04-19. See the latest version.

// ==UserScript==
// @name         Soul+Linker
// @name:en         Soul+Linker
// @name:zh         Soul+Linker
// @name:ja         Soul+Linker
// @namespace    [email protected]
// @version      1.0.1
// @description  用于从魂+快速跳转到DLsite
// @description:en  Used to jump from Soul+ to DLsite quickly
// @description:zh  用于从魂+快速跳转到DLsite
// @description:ja  Soul+からDLsiteにすばやくジャンプするために使用されます
// @author       Xiccnd

// @license GPL

// @match        *://*.white-plus.net/*
// @match        *://*.snow-plus.net/*
// @match        *://*.level-plus.net/*
// @match        *://*.east-plus.net/*
// @match        *://*.south-plus.net/*
// @match        *://*.north-plus.net/*
// @match        *://*.spring-plus.net/*
// @match        *://*.summer-plus.net/*
// @match        *://*.imoutolove.me/*

// @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
// @icon         https://www.white-plus.net/favicon.ico
// @grant        none
// ==/UserScript==

$(function () {

    'use strict';

    /*
    * 设置全局变量,开头加前缀避免重名
    * */
    //获取标题
    const XICCND_TITLE = $("h1#subject_tpc:contains('RJ')").html();
    //设置检查规则
    const XICCND_CHECK_RJ = new RegExp('RJ');

    /*
    * 开关插件功能
    * */

    //开启隐藏页头广告功能
    //xiccndAD()

    //开启隐藏网页头部功能
    //xiccndBanner()

    //开启隐藏网页底部功能
    xiccndFooter()

    //开启跳转功能
    xiccndRJ()

    //开启图片预览功能
    xiccndRJImg()

    /*
    * 隐藏页头广告
    * */
    function xiccndAD() {
        $('div#header div').eq(-2).css('display', 'none')
    }

    /*
    * 隐藏页头网页头部
    * */
    function xiccndBanner() {
        $('td.banner').css('display', 'none')
    }

    /*
    * 隐藏页头网页底部
    * */
    function xiccndFooter() {
        $('div#footer').css('display', 'none')
    }

    /*
    * 跳转
    * */
    function xiccndRJ() {

        /*
        * 检查标题是否含有RJ号
        * */
        if (XICCND_CHECK_RJ.test(XICCND_TITLE)) {//如果含有
            //获取RJ号
            const XICCND_RJ = XICCND_TITLE.substr(XICCND_TITLE.indexOf("RJ"), 8)
            $("h1#subject_tpc").on('mouseover', function () {//鼠标悬停效果
                $(this).css('cursor', 'pointer').css('color', 'pink')
            }).on('mouseout', function () {//鼠标离开效果
                $(this).css('color', '#bbbbbb')
            }).on('click', function () {//鼠标点击效果
                window.open("https://www.dlsite.com/maniax/work/=/product_id/" + XICCND_RJ + ".html");//跳转网页
            })
        } else {//如果不含有
            $("h1#subject_tpc").on('mouseover', function () {
                $(this).css('cursor', 'pointer').css('color', 'plum')
            }).on('mouseout', function () {
                $(this).css('color', '#bbbbbb')
            })
        }
    }

    /*
    * 图片预览
    * */
    function xiccndRJImg() {
        if (XICCND_CHECK_RJ.test(XICCND_TITLE)) {//检查标题是否含有RJ号
            //获取RJ号
            const XICCND_RJ = XICCND_TITLE.substr(XICCND_TITLE.indexOf("RJ"), 8)

            /*
            * 合成路径
            * */
            let RJPre = XICCND_RJ.substr(0, 4)
            let RJBody = parseInt(XICCND_RJ.substr(4, 1)) + 1

            if (RJBody === 10) {//当RJBody为9时,RJBody要变为0,前一个数字加1
                RJPre = RJPre.substr(0, 3) + (parseInt(RJPre.substr(3, 1)) + 1)
                RJBody = 0
            }

            const RJSRC = RJPre + RJBody + '000'//合成结束
            //合成图片地址
            const SRC = '//img.dlsite.jp/modpub/images2/work/doujin/' + RJSRC + '/' + XICCND_RJ + '_img_main.jpg'
            //创建图片
            const IMG = '<img id="xiccndImg" style="display: none; width: 15%; position: fixed; left: 1%;top: 10px;border: 5px dashed pink" alt="' + XICCND_TITLE + '" src= ' + '"' + SRC + '"' + '>'
            //网页中添加图片
            $('body').append(IMG)

            $("h1#subject_tpc").on('mouseover', function () {
                $(this).css('cursor', 'pointer').css('color', 'pink')
                $('img#xiccndImg').stop().fadeIn(1000)
            }).on('mouseout', function () {
                $(this).css('color', '#bbbbbb')
                $('img#xiccndImg').stop().fadeOut(1000)
            })
        }
    }

})