Display adventure difficulty
This commit is contained in:
11
src/Page/AdventurePage.ts
Normal file
11
src/Page/AdventurePage.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { getNumber, trimPrefix } from '../Helpers/Convert';
|
||||
|
||||
export function showAdventureDifficulty() {
|
||||
jQuery('td.difficulty').each((index, el) => {
|
||||
const $el = jQuery(el);
|
||||
const $img = $el.find('img');
|
||||
const imgClass = $img.attr('class') || '';
|
||||
const level = getNumber(trimPrefix(imgClass, 'adventureDifficulty'));
|
||||
$img.after(` - ${level}`);
|
||||
});
|
||||
}
|
@@ -21,6 +21,11 @@ export function isHeroPage() {
|
||||
return p.pathname === '/hero.php';
|
||||
}
|
||||
|
||||
export function isAdventurePage() {
|
||||
const p = parseLocation();
|
||||
return p.pathname === '/hero.php' && p.query.t === '3';
|
||||
}
|
||||
|
||||
export function getBuildingPageAttributes(): BuildingPageAttributes {
|
||||
if (!isBuildingPage()) {
|
||||
throw Error('Not building page');
|
||||
|
Reference in New Issue
Block a user