소스 검색

links are now fixed on ajax2 pages

master
Haku 4 년 전
부모
커밋
04660635b5
2개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. +6
    -0
      build/manifest.json
  2. +9
    -0
      src/ajax.ts

+ 6
- 0
build/manifest.json 파일 보기

@@ -31,6 +31,12 @@
"exclude_matches": ["https://forum.nationstates.net/*"],
"run_at": "document_idle",
"js": ["scripts/settings.js"]
},
{
"matches": ["https://www.nationstates.net/page=ajax2/*"],
"exclude_matches": ["https://forum.nationstates.net/*"],
"run_at": "document_idle",
"js": ["scripts/ajax.js"]
}
]
}

+ 9
- 0
src/ajax.ts 파일 보기

@@ -0,0 +1,9 @@
const links: NodeList = document.querySelectorAll('a');
for (let i = 0; i < links.length; i++) {
const link: HTMLAnchorElement = links[i] as HTMLAnchorElement;
const linkParams = getUrlParameters(link.href);
if (linkParams['nation'])
link.href = `/template-overall=none/nation=${linkParams['nation']}`;
else if (linkParams['region'])
link.href = `/template-overall=none/region=${linkParams['region']}`;
}

불러오는 중...
취소
저장