popup: USO workaround for finding extension styles

This commit is contained in:
tophf 2017-09-30 03:01:07 +03:00
parent 0978308325
commit 7cf27601ae
2 changed files with 7 additions and 6 deletions

View File

@ -114,7 +114,8 @@
<div class="left-gutter"></div>
<div class="main-controls">
<div id="find-styles">
<a id="find-styles-link" href="#" i18n-text="findStylesForSite"></a>
<a id="find-styles-link" href="https://userstyles.org/styles/browse/"
i18n-text="findStylesForSite"></a>
</div>
<div id="write-style">
<span id="write-style-for" i18n-text="writeStyleFor"></span>

View File

@ -74,7 +74,6 @@ function initPopup(url) {
};
setupLivePrefs();
$('#find-styles-link').onclick = handleEvent.openURLandHide;
Object.assign($('#popup-manage-button'), {
onclick: handleEvent.openManager,
onmouseup: handleEvent.openManager,
@ -96,10 +95,11 @@ function initPopup(url) {
installed);
}
// find styles link
$('#find-styles a').href =
'https://userstyles.org/styles/browse/all/' +
encodeURIComponent(url.startsWith('file:') ? 'file:' : 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);
if (!url) {
document.body.classList.add('blocked');