Boomer Text

Background boomer music

当前为 2022-11-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Boomer Text
// @version      0.1
// @license      MIT
// @author       @roescoe
// @grant        GM_openInTab
// @match        *://*/*
// @description  Background boomer music
// @namespace https://greasyfork.org/users/985766
// ==/UserScript==

(function() {
    let phrases =[
        "boomer",
        "boomers",
        "back in my day",
        "kids these days",
        "spending the kid's inheritance",
        "spending the kids' inheritance",
        "spending the kids' inheritance",
        "bootstraps",
        "values of responsibility",
        "value of responsibility",
        "respect our elders",
        "respect our elder",
        "respect your elders",
        "respect your elder",
        "pay off your student loans",
        "get the job",
    ];
    document.addEventListener('mouseup', function(){
    var thetext = getSelectionText()
        if (thetext.length > 0){ // check there's some text selected
            for (let i in phrases) {
                if (thetext.toUpperCase().includes(phrases[i].toUpperCase())) {
                    window.getSelection().removeAllRanges();
                    playMusic();
                    break;
                    }
            }
        }
    }, false)
    function getSelectionText() {
    var text = "";
    if (window.getSelection) {
        text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
        text = document.selection.createRange().text;
    }
    return text;
    }


 function playMusic() {
        var boomerMusic = GM_openInTab ("https://on.soundcloud.com/GDeUT");
        console.log("boomer Music plays...");
    };

})();