|
|
|
@@ -11,7 +11,8 @@ const keybinds: Keybind[] = [ |
|
|
|
functionName: 'move', |
|
|
|
displayName: null, |
|
|
|
callback: () => { |
|
|
|
const moveButton: HTMLButtonElement = document.querySelector('button[name=move_region]') as HTMLButtonElement; |
|
|
|
const moveButton: HTMLButtonElement = |
|
|
|
document.querySelector('button[name=move_region]') as HTMLButtonElement; |
|
|
|
if (moveButton) |
|
|
|
moveButton.click(); |
|
|
|
}, |
|
|
|
@@ -21,7 +22,8 @@ const keybinds: Keybind[] = [ |
|
|
|
functionName: 'endorse', |
|
|
|
displayName: null, |
|
|
|
callback: () => { |
|
|
|
const endorseButton: HTMLButtonElement = (document.querySelector('button[class="endorse button icon wa"]') as HTMLButtonElement); |
|
|
|
const endorseButton: HTMLButtonElement = |
|
|
|
(document.querySelector('button[class="endorse button icon wa"]') as HTMLButtonElement); |
|
|
|
if (endorseButton) |
|
|
|
endorseButton.click(); |
|
|
|
}, |
|
|
|
@@ -31,7 +33,8 @@ const keybinds: Keybind[] = [ |
|
|
|
} |
|
|
|
else if (urlParams['nation']) { |
|
|
|
let nationsToEndorse: string[] = await getStorageValue('nationstoendorse'); |
|
|
|
const endorseButton: HTMLButtonElement = (document.querySelector('button[class="endorse button icon wa"]') as HTMLButtonElement); |
|
|
|
const endorseButton: HTMLButtonElement = |
|
|
|
(document.querySelector('button[class="endorse button icon wa"]') as HTMLButtonElement); |
|
|
|
if (endorseButton && (nationsToEndorse.indexOf(urlParams['nation']) !== -1)) |
|
|
|
endorseButton.click(); |
|
|
|
else if (nationsToEndorse.indexOf(urlParams['nation']) !== -1) { |
|
|
|
@@ -57,7 +60,8 @@ const keybinds: Keybind[] = [ |
|
|
|
functionName: 'dossier', |
|
|
|
displayName: null, |
|
|
|
callback: () => { |
|
|
|
const dossierButton: HTMLButtonElement = document.querySelector('button[value=add]') as HTMLButtonElement; |
|
|
|
const dossierButton: HTMLButtonElement = |
|
|
|
document.querySelector('button[value=add]') as HTMLButtonElement; |
|
|
|
if (dossierButton) |
|
|
|
dossierButton.click(); |
|
|
|
}, |
|
|
|
@@ -67,7 +71,8 @@ const keybinds: Keybind[] = [ |
|
|
|
} |
|
|
|
else if (urlParams['nation']) { |
|
|
|
let nationsToDossier: string[] = await getStorageValue('nationstodossier'); |
|
|
|
const dossierButton: HTMLButtonElement = document.querySelector('button[value=add]') as HTMLButtonElement; |
|
|
|
const dossierButton: HTMLButtonElement = |
|
|
|
document.querySelector('button[value=add]') as HTMLButtonElement; |
|
|
|
if (dossierButton && (nationsToDossier.indexOf(urlParams['nation']) !== -1)) |
|
|
|
dossierButton.click(); |
|
|
|
else { |
|
|
|
@@ -81,7 +86,8 @@ const keybinds: Keybind[] = [ |
|
|
|
} |
|
|
|
else if (urlParams['page'] === 'dossier') { |
|
|
|
let nationsToDossier: string[] = await getStorageValue('nationstodossier'); |
|
|
|
const currentNation: string = new RegExp('nation=(.+)$').exec((document.querySelector('.info > a') as HTMLAnchorElement).href)[1]; |
|
|
|
const currentNation: string = new RegExp('nation=(.+)$') |
|
|
|
.exec((document.querySelector('.info > a') as HTMLAnchorElement).href)[1]; |
|
|
|
const nextNation: string = nationsToDossier[nationsToDossier.indexOf(currentNation) + 1]; |
|
|
|
if (!nextNation) |
|
|
|
return; |
|
|
|
@@ -95,7 +101,8 @@ const keybinds: Keybind[] = [ |
|
|
|
functionName: 'backtojp', |
|
|
|
displayName: "Move Back to Jump Point", |
|
|
|
callback: async () => { |
|
|
|
const moveButton: HTMLButtonElement = document.querySelector('button[name=move_region]') as HTMLButtonElement; |
|
|
|
const moveButton: HTMLButtonElement = |
|
|
|
document.querySelector('button[name=move_region]') as HTMLButtonElement; |
|
|
|
const jumpPoint: string = await getStorageValue('jp'); |
|
|
|
if ((urlParams['region'] === jumpPoint) && moveButton) |
|
|
|
moveButton.click(); |
|
|
|
@@ -108,11 +115,13 @@ const keybinds: Keybind[] = [ |
|
|
|
functionName: 'endodel', |
|
|
|
displayName: "Endorse WA Delegate", |
|
|
|
callback: () => { |
|
|
|
const delegate: HTMLAnchorElement = document.querySelector('#regioncontent > p:nth-child(1) > a') as HTMLAnchorElement; |
|
|
|
const delegate: HTMLAnchorElement = |
|
|
|
document.querySelector('#regioncontent > p:nth-child(1) > a') as HTMLAnchorElement; |
|
|
|
if (urlParams['region']) |
|
|
|
delegate.click(); |
|
|
|
else if (urlParams['nation']) { |
|
|
|
const endorseButton: HTMLButtonElement = (document.querySelector('button[class="endorse button icon wa"]') as HTMLButtonElement); |
|
|
|
const endorseButton: HTMLButtonElement = |
|
|
|
(document.querySelector('button[class="endorse button icon wa"]') as HTMLButtonElement); |
|
|
|
if (endorseButton) |
|
|
|
endorseButton.click(); |
|
|
|
} |
|
|
|
@@ -133,8 +142,10 @@ const keybinds: Keybind[] = [ |
|
|
|
callback: () => { |
|
|
|
if (urlParams['template-overall']) |
|
|
|
window.location.href = document.URL.replace('template-overall=none/', ''); |
|
|
|
else |
|
|
|
window.location.href = `/template-overall=none/${document.URL.replace('https://www.nationstates.net/', '')}`; |
|
|
|
else { |
|
|
|
window.location.href = `/template-overall=none/ |
|
|
|
${document.URL.replace('https://www.nationstates.net/', '')}`; |
|
|
|
} |
|
|
|
}, |
|
|
|
modifiedCallback: null |
|
|
|
}, |
|
|
|
@@ -164,8 +175,10 @@ const keybinds: Keybind[] = [ |
|
|
|
functionName: 'regionajax', |
|
|
|
displayName: "Open Region Ajax2 Page", |
|
|
|
callback: () => { |
|
|
|
if (urlParams['region']) |
|
|
|
window.location.href = `/page=ajax2/a=reports/view=region.${urlParams['region']}/filter=move+member+endo`; |
|
|
|
if (urlParams['region']) { |
|
|
|
window.location.href = |
|
|
|
`/page=ajax2/a=reports/view=region.${urlParams['region']}/filter=move+member+endo`; |
|
|
|
} |
|
|
|
}, |
|
|
|
modifiedCallback: null |
|
|
|
} |
|
|
|
|