TitleSearch

try to take over the world!

目前為 2019-09-29 提交的版本,檢視 最新版本

// ==UserScript==
// @name         TitleSearch
// @namespace    http://tampermonkey.net/
// @version      1
// @description  try to take over the world!
// @author       TitleSearch
// @match        *://www.abooky.com/*
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// ==/UserScript==

(function () {
    'use strict';

    var urllist = [
        { name: 'abooky', url: /www\.abooky\.com/, titleid: '.ts', nosign: '' },
    ];

    function make(obj) {
        if (obj.url.test(location.href)) {
            let t = $(obj.titleid).text();
            if (t) {
                console.log(t);
                let lnum, rnum, title;
                lnum = t.indexOf('《');
                if (lnum > 0) {
                    rnum = t.indexOf('》');
                    if (rnum > 0) {
                        title = t.substring(lnum + 1, rnum);
                    }
                } else {
                    lnum = t.indexOf('<');
                    if (lnum > 0) {
                        rnum = t.indexOf('>');
                        if (rnum > 0) {
                            title = t.substring(lnum + 1, rnum);
                        }
                    }
                }
                console.log(title);
                if (title) {
                    let b = $('<button></button>');
                    b.text('优书网');
                    b.css({
                        "color": " #666",
                        "background-color": " #EEE",
                        "border-color": " #EEE",
                        "font-weight": " 300",
                        "font-size": " 16px",
                        "text-decoration": " none",
                        "text-align": " center",
                        "line-height": " 25px",
                        "height": " 25px",
                        "padding": " 0 15px",
                        "margin": " 0",
                        "display": " inline-block",
                        "appearance": " none",
                        "cursor": " pointer",
                        "border": " none",
                        "-webkit-box-sizing": " border-box",
                        "-moz-box-sizing": " border-box",
                        "box-sizing": " border-box",
                        "-webkit-transition-property": " all",
                        "transition-property": " all",
                        "-webkit-transition-duration": " .3s",
                        "transition-duration": " .3s",
                        "border-radius": " 4px"
                    });
                    b.click(function () {
                        var content = document.createElement("a");
                        content.href = 'http://yousuu.com/search/?SearchType=title&SearchValue=' + title;
                        content.target = '_blank';
                        document.body.appendChild(content);
                        content.click();
                        document.body.removeChild(content);
                    });
                    $(obj.titleid).after(b);
                }
            }

        }
    }

    function run() {
        urllist.forEach(make);
    }

    run();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址