Massif Example Sentence Button

Generates a button linking to Massif, which shows more example sentences of the word.

目前為 2025-03-22 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Massif Example Sentence Button
  3. // @namespace Violentmonkey Scripts
  4. // @match https://jpdb.io/vocabulary/*
  5. // @grant none
  6. // @version 0.1
  7. // @author Alex Chapman 2025
  8. // @license MIT
  9. // @description Generates a button linking to Massif, which shows more example sentences of the word.
  10. // ==/UserScript==
  11.  
  12. const documentQuery = document.querySelector('.hbox');
  13. if (documentQuery) {
  14. // Grab current word
  15. let url = window.location.pathname;
  16. console.log(url);
  17. let word = url.split('/')[3];
  18. let decodedWord = decodeURIComponent(word);
  19.  
  20. // Insert button with link to Massif
  21. documentQuery.insertAdjacentHTML('afterend', `
  22. <div class="massif-button" style="font-size: 200%; text-align: left;">
  23. <a href="https://massif.la/ja/search?q=${word}">
  24. <button>Massif Examples for ${decodedWord}</button>
  25. </a>
  26. </div>
  27. `);
  28. }