dblp filter

Filtering dblp result with including keywords and excluding keywords.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         dblp filter
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @license MIT
// @description  Filtering dblp result with including keywords and excluding keywords.
// @author       Laurentiusia
// @match        https://dblp.org/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=dblp.org
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...

    function handleSubmit(){
        var input1 = $('#textbox1').val();
        var input2 = $('#textbox2').val();
        $(".entry").each(function (index, item){
            $(item).show()
        })
        include_with(input1)
        exclude_with(input2)
    }

    function exclude_with(keywords){
        if (keywords === ""){
            return
        }
        keywords.split(';').forEach(function (keyword){
            $(".entry").each(function (index, item){
                var text = $(item).find("cite").find(".title").text()
                if (text.toLowerCase().includes(keyword.toLowerCase()))
                {
                    $(item).hide()
                }
            })
        })
    }

    function include_with(keywords){
        if (keywords === ""){
            return
        }
        keywords.split(';').forEach(function (keyword){
            $(".entry").each(function (index, item){
                var text = $(item).find("cite").find(".title").text()
                if (!text.toLowerCase().includes(keyword.toLowerCase()))
                {
                    $(item).hide()
                }
            }
                            )
        })
    }

    $(".publ-list").ready(function () {
        var $container = $('<div></div>')
        .attr('id', 'fixed-container')
        .css({
            position: 'fixed',
            right: '10px',
            top: '50%',
            transform: 'translateY(-50%)',
            width: '200px',
            padding: '10px',
            backgroundColor: '#f9f9f9',
            boxShadow: '0px 0px 10px rgba(0, 0, 0, 0.1)',
            border: '1px solid #ccc',
            borderRadius: '5px',
            textAlign: 'center'
        });

        var $textbox1 = $('<textarea>')
        .attr('type', 'text')
        .attr('id', 'textbox1')
        .attr('placeholder', 'include keywords, split with ;')
        .css({
            width: '90%',
            margin: '5px 0',
            padding: '5px',
            fontSize: '14px',
            border: '1px solid #ccc',
            borderRadius: '3px'
        });

        var $textbox2 = $('<textarea>')
        .attr('type', 'text')
        .attr('id', 'textbox2')
        .attr('placeholder', 'exclude keywords, split with ;')
        .css({
            width: '90%',
            margin: '5px 0',
            padding: '5px',
            fontSize: '14px',
            border: '1px solid #ccc',
            borderRadius: '3px'
        });

        var $button = $('<button></button>')
        .attr('id', 'submit-button')
        .text('Filter!')
        .css({
            width: '95%',
            padding: '5px',
            fontSize: '14px',
            backgroundColor: '#007bff',
            color: 'white',
            border: 'none',
            borderRadius: '3px',
            cursor: 'pointer'
        })
        .hover(
            function () {
                $(this).css('background-color', '#0056b3'); // 鼠标悬停
            },
            function () {
                $(this).css('background-color', '#007bff'); // 鼠标移出
            }
        )
        .click(function () {
            handleSubmit();
        });

        $('#textbox1, #textbox2').on('keydown', function (event) {
            if (event.key === 'Enter') {
                handleSubmit(); // 调用提交处理函数
            }
        });


        // 将文本框和按钮添加到容器中
        $container.append($textbox1).append($textbox2).append($button);

        // 将容器添加到页面的 body 中
        $('body').append($container);
        $('.publ-list').on('load.infiniteScroll', function(event, response, path) {
            handleSubmit();
        });
    });


})();