feat: wiki

This commit is contained in:
Alexander Drozdov
2020-03-08 21:55:57 +02:00
parent 4f82b16f2a
commit 6efda7ebb2
5 changed files with 29 additions and 2 deletions
@@ -26,6 +26,12 @@
<hotkey-input v-model="config.priceCheckLocked" :forbidden="['C','V']" class="w-48" />
</div>
</div>
<div class="mb-8">
<div class="flex">
<div class="flex-1">Open wiki</div>
<hotkey-input v-model="config.wikiKey" :forbidden="['C','V']" class="w-48" />
</div>
</div>
<div class="mb-2">
<div class="flex-1 mb-1">Custom commands</div>
<div class="mb-4" v-for="(command, idx) in config.commands" :key="idx">
+1 -1
View File
@@ -28,7 +28,7 @@ class PoeWindowClass extends EventEmitter {
this.bounds = (await windowManager.getActiveWindowContentBounds())!
this.pid = (await windowManager.getActiveWindowId())!
}
}, 1000)
}, 500)
}
}
+5 -1
View File
@@ -7,6 +7,7 @@ import { showWindow, lockWindow, poeUserInterfaceWidth } from './positioning'
import { KeyCodeToName } from '@/components/settings/KeyToCode'
import { config } from './config'
import { PoeWindow } from './PoeWindow'
import { openWiki } from './wiki'
export let isPollingClipboard = false
export let checkPressPosition: Point | undefined
@@ -14,7 +15,7 @@ export let checkPressPosition: Point | undefined
function priceCheck (lockedMode: boolean) {
if (!isPollingClipboard) {
isPollingClipboard = true
pollClipboard(32, 1000)
pollClipboard(32, 500)
.then(async (clipboard) => {
win.webContents.send('price-check', clipboard)
await showWindow()
@@ -59,6 +60,9 @@ export function setupShortcuts () {
priceCheck(false)
} else if (pressed === config.get('priceCheckLocked')) {
priceCheck(true)
} else if (pressed === config.get('wikiKey')) {
pollClipboard(32, 500).then(openWiki).catch(() => {})
robotjs.keyTap('key_c', ['control'])
} else {
const command = config.get('commands').find(c => c.hotkey === pressed)
if (command) {
+15
View File
@@ -0,0 +1,15 @@
import { shell } from 'electron'
import { parseClipboard, ItemRarity } from '../components/parser'
const WIKI_URL = 'https://pathofexile.gamepedia.com'
export function openWiki (clipboard: string) {
const item = parseClipboard(clipboard)
if (!item) return
const pageName = (item.rarity === ItemRarity.Unique)
? item.name
: item.baseType || item.name
shell.openExternal(`${WIKI_URL}/${pageName}`)
}
+2
View File
@@ -8,6 +8,7 @@ export interface Config {
priceCheckKey: string
priceCheckKeyHold: string
priceCheckLocked: string
wikiKey: string
commands: Array<{
text: string
hotkey: string
@@ -19,6 +20,7 @@ export const defaultConfig: Config = {
priceCheckKey: 'D',
priceCheckKeyHold: 'Ctrl',
priceCheckLocked: 'Ctrl + Alt + D',
wikiKey: 'Alt + W',
commands: [{
text: '/hideout',
hotkey: 'F5'