diff --git a/build/manifest.json b/build/manifest.json index bd386a9..4fc847a 100644 --- a/build/manifest.json +++ b/build/manifest.json @@ -38,7 +38,22 @@ "matches": ["https://www.nationstates.net/page=ajax2/*"], "exclude_matches": ["https://forum.nationstates.net/*"], "run_at": "document_idle", - "js": ["scripts/ajax.js"] + "js": ["scripts/ajax.js"], + "css": ["css/mvp.css"] + }, + { + "matches": ["https://www.nationstates.net/template-overall=none/page=reports"], + "exclude_matches": ["https://forum.nationstates.net/*"], + "run_at": "document_idle", + "js": ["scripts/reports.js"], + "css": ["css/mvp.css"] + }, + { + "matches": ["https://www.nationstates.net/template-overall=none/region=*"], + "exclude_matches": ["https://forum.nationstates.net/*"], + "run_at": "document_idle", + "js": ["scripts/region.js"], + "css": ["css/mvp.css"] } ] } \ No newline at end of file diff --git a/src/reports.ts b/src/reports.ts new file mode 100644 index 0000000..b8517a8 --- /dev/null +++ b/src/reports.ts @@ -0,0 +1,17 @@ +(() => +{ + const button = document.createElement('input'); + button.setAttribute('type', 'button'); + button.setAttribute('value', 'Refresh'); + button.setAttribute('id', 'action'); + button.addEventListener('click', (e) => + { + (e.target as HTMLInputElement).disabled = true; + const moveRegion: HTMLAnchorElement = document.querySelector('.rlink:nth-of-type(3)'); + if (moveRegion && moveRegion.parentElement.innerHTML.indexOf('relocated from') !== -1) + moveRegion.click(); + else + location.reload(); + }); + document.body.insertBefore(button, document.querySelector('h1').nextSibling); +})(); \ No newline at end of file