script.jsscrapbox.PopupMenu.addButton({
title: 'youtube',
onClick: text => {
if( text.match(/^\[[\S]*\]$/g) ){
text = text.replace(/\[/g, '');
}else{
text = text.replace(/\[[\S]*/g, '');
}
text = text.replace(/\]/g, '').replace(/^\s+/, '');
let uri = encodeURI(text.replace(' ', '+'));
window.open(`https://www.youtube.com/results?search_query=${uri}`);
}
})