Definition Button for spellbee.org

Click on the words found to go to its definition on Merriam Webster

スクリプトをインストールするには、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         Definition Button for spellbee.org
// @author       Minjae Kim
// @version      1.05
// @description  Click on the words found to go to its definition on Merriam Webster
// @match        https://spellbee.org/
// @icon         https://spellbee.org/assets/img/spelling-bee-game.png?v2
// @run-at       document-idle
// @grant        none
// @license      MIT
// @namespace    https://greasyfork.org/en/users/1529082-minjae-kim
// ==/UserScript==

addDefinition();

const enterButton = document.querySelector('#submit_button');
enterButton.addEventListener('click', (event) => {
   addDefinition();
});


window.addEventListener('keydown', (event) => {
    if (event.key === 'Enter') {
        event.preventDefault();
        addDefinition();
        }
});

function addDefinition() {
    'use strict';

    let wordList = document.querySelectorAll('.block-words-select__dropdown-els li');

    wordList.forEach((element) => {
        let word = element.innerText.trim();
        element.style.cursor = 'pointer';
        element.style.backgroundColor = 'rgba(222, 206, 31, 0.4)';
        element.addEventListener('click', () => {
            const url = `https://www.merriam-webster.com/dictionary/${word}`;
            window.open(url, '_blank'); // Opens the definition in a new tab
        });
    });

}