浏览代码

manifest: Applied Sakura CSS stylesheets to no-template reports and region pages.

reports: Added a new button which refreshes the page or opens up the region link depending on whether raiders have moved or not.
master
Haku 3 年前
父节点
当前提交
3103b20e39
共有 2 个文件被更改,包括 33 次插入1 次删除
  1. +16
    -1
      build/manifest.json
  2. +17
    -0
      src/reports.ts

+ 16
- 1
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"]
}
]
}

+ 17
- 0
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);
})();

正在加载...
取消
保存