One of the things that annoys me the most when doing reviews is that I can not search for words I don’t know / want to add. So I made myself a user-script for this.
If you mark some text it will show a little “search on bunpro” button which then will open search for the word in a new tab.
Only tested on Firefox with Greasemonkey.
Just in case this is helpful to anyone
Version that only works on Bunpro Reviews:
// ==UserScript==
// @name Bunpro Search on Text Select
// @namespace https://bunpro.jp/
// @version 1.0
// @description Show a quick search link when selecting text on Bunpro reviews
// @match https://bunpro.jp/reviews*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let popup = document.createElement('div');
popup.style.position = 'absolute';
popup.style.padding = '4px 8px';
popup.style.background = '#2c3e50';
popup.style.color = '#fff';
popup.style.borderRadius = '6px';
popup.style.fontSize = '13px';
popup.style.cursor = 'pointer';
popup.style.zIndex = '9999';
popup.style.display = 'none';
popup.textContent = 'Search on Bunpro';
document.body.appendChild(popup);
document.addEventListener('mouseup', function(e) {
const selection = window.getSelection().toString().trim();
if (selection.length > 0) {
const range = window.getSelection().getRangeAt(0);
const rect = range.getBoundingClientRect();
popup.style.top = (window.scrollY + rect.top - 30) + 'px';
popup.style.left = (window.scrollX + rect.left) + 'px';
popup.style.display = 'block';
popup.onclick = () => {
const url = 'https://bunpro.jp/search?query=' + encodeURIComponent(selection);
window.open(url, '_blank');
popup.style.display = 'none';
};
} else {
popup.style.display = 'none';
}
});
document.addEventListener('scroll', () => popup.style.display = 'none');
})();
So then I thought why stop here?
I often see words on X or other immersion sources and want to add them to Bunpro…
Therefore:
Version that works everywhere if you mark Japanese text (might break on a lot of websites):

// ==UserScript==
// @name Bunpro Search on Text Select
// @namespace https://bunpro.jp/
// @version 1.0
// @description Show a quick search link when selecting text on Bunpro reviews
// @grant none
// ==/UserScript==
(function() {
'use strict';
const jpRegex = /[\u3040-\u30FF\u4E00-\u9FFF]/;
const popup = document.createElement('div');
popup.style.position = 'absolute';
popup.style.padding = '4px 8px';
popup.style.background = '#2c3e50';
popup.style.color = '#fff';
popup.style.borderRadius = '6px';
popup.style.fontSize = '13px';
popup.style.cursor = 'pointer';
popup.style.zIndex = '9999';
popup.style.display = 'none';
popup.textContent = 'Search on Bunpro';
document.body.appendChild(popup);
document.addEventListener('mouseup', function() {
const selection = window.getSelection().toString().trim();
if (selection.length > 0 && jpRegex.test(selection)) {
const range = window.getSelection().getRangeAt(0);
const rect = range.getBoundingClientRect();
popup.style.top = (window.scrollY + rect.top - 30) + 'px';
popup.style.left = (window.scrollX + rect.left) + 'px';
popup.style.display = 'block';
popup.onclick = () => {
const url = 'https://bunpro.jp/search?query=' + encodeURIComponent(selection);
window.open(url, '_blank');
popup.style.display = 'none';
};
} else {
popup.style.display = 'none';
}
});
document.addEventListener('scroll', () => popup.style.display = 'none');
})();
!!
you can only install one of the scripts, not both. If you install both, it might not work. Script 2 does everything that Script 1 does, too.
!!

