'Load styles' link below 'Find styles for this site' -- does nothing

This commit is contained in:
derv82 2017-11-17 00:17:23 -08:00
parent 9689288bdc
commit d23342b171
3 changed files with 15 additions and 0 deletions

View File

@ -333,6 +333,10 @@
} }
} }
}, },
"loadStylesForSite": {
"message": "Load Styles",
"description": "Text for a link that loads styles within the popup"
},
"findStylesForSite": { "findStylesForSite": {
"message": "Find more styles for this site", "message": "Find more styles for this site",
"description": "Text for a link that gets a list of styles for the current site" "description": "Text for a link that gets a list of styles for the current site"

View File

@ -113,6 +113,10 @@
</div> </div>
<div class="left-gutter"></div> <div class="left-gutter"></div>
<div class="main-controls"> <div class="main-controls">
<div id="load-styles">
<a id="load-styles-link" href="#"
i18n-text="loadStylesForSite"></a>
</div>
<div id="find-styles"> <div id="find-styles">
<a id="find-styles-link" href="https://userstyles.org/styles/browse/" <a id="find-styles-link" href="https://userstyles.org/styles/browse/"
i18n-text="findStylesForSite"></a> i18n-text="findStylesForSite"></a>

View File

@ -106,6 +106,8 @@ function initPopup(url) {
installed); installed);
} }
$('#load-styles-link').onclick = handleEvent.loadRemoteStyles;
$('#find-styles-link').onclick = handleEvent.openURLandHide; $('#find-styles-link').onclick = handleEvent.openURLandHide;
$('#find-styles-link').href += $('#find-styles-link').href +=
url.startsWith(location.protocol) ? url.startsWith(location.protocol) ?
@ -389,6 +391,11 @@ Object.assign(handleEvent, {
} }
}, },
loadRemoteStyles(event) {
event.preventDefault();
console.log("loadRemoteStyles event:", event);
},
openURLandHide(event) { openURLandHide(event) {
event.preventDefault(); event.preventDefault();
openURL({url: this.href || this.dataset.href}) openURL({url: this.href || this.dataset.href})