Skip to content

Commit

Permalink
fix context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
hankxdev committed Jun 23, 2020
1 parent 3eaaf27 commit e04b061
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 9 deletions.
118 changes: 118 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"dot-json": "^1.2.0",
"eslint": "^6.8.0",
"eslint-plugin-svelte3": "^2.7.3",
"husky": "^4.2.5",
"npm-run-all": "^4.1.5",
"rollup": "^2.6.1",
"rollup-plugin-copy-glob": "^0.3.1",
Expand All @@ -77,5 +78,10 @@
"svelte": "^3.20.1",
"web-ext": "^4.1.0",
"xo": "^0.29.1"
},
"husky":{
"hooks":{
"pre-commit": "npm run fix"
}
}
}
8 changes: 4 additions & 4 deletions source/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
});
});
// Show extra buttons on right click on the name
// Toggle extra buttons on right click on the name
let onContextMenu;
$: onContextMenu = showExtras ? () => {} : (event => {
showExtras = true;
$: onContextMenu = event => {
showExtras = !showExtras;
event.preventDefault();
});
};
</script>

<svelte:window on:keydown={keyboardNavigationHandler}/>
Expand Down
5 changes: 1 addition & 4 deletions source/Extension.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
<button type="button" class="ext-name" on:click={toggleExtension} on:contextmenu>
<img alt="" src={getIcon(icons, 16)}>{name}
</button>

{#if enabled}
{#if optionsUrl}
{#if showExtras || (optionsUrl && enabled)}
<a href='chrome://extensions/?options={id}' title={getI18N('gotoOpt')} on:click={openInTab}>
<img src="icons/options.svg" alt="">
</a>
Expand All @@ -69,5 +67,4 @@
<img src="icons/bin.svg" alt="">
</button>
{/if}
{/if}
</li>
2 changes: 1 addition & 1 deletion source/lib/open-in-tab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** Required for chrome:// links */
export default function openInTab(event) {
browser.tabs.create({url: event.target.href});
browser.tabs.create({url: event.currentTarget.href});
event.preventDefault();
}

0 comments on commit e04b061

Please sign in to comment.