popup: USO bug workaround for find-styles link url

fixes #273
This commit is contained in:
tophf 2017-12-03 06:02:30 +03:00
parent 9314fa0e8a
commit 387193d347

View File

@ -105,11 +105,12 @@ function initPopup(url) {
installed);
}
const u = new URL(url);
$('#find-styles-link').onclick = handleEvent.openURLandHide;
$('#find-styles-link').href +=
url.startsWith(location.protocol) ?
'?search_terms=Stylus' :
'all/' + encodeURIComponent(url.startsWith('file:') ? 'file:' : url);
url.startsWith(location.protocol) ? '?search_terms=Stylus' :
u.protocol === 'file:' ? 'file:' :
u.hostname.replace(/^www\.|(\.com?)?\.\w+$/g, '').split('.').pop();
if (!url) {
document.body.classList.add('blocked');