Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bradp committed Jul 20, 2024
1 parent 988f5e0 commit e2d0cf4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 35 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@sentry/cli": "^2.32.2",
"@sprout2000/esbuild-copy-plugin": "^1.1.15",
"@wordpress/eslint-plugin": "^20.0.0",
"@wordpress/eslint-plugin": "^19.2.0",
"archiver": "^7.0.1",
"chalk": "^5.3.0",
"chrome-webstore-upload-cli": "^3.3.0",
Expand Down
42 changes: 19 additions & 23 deletions src/modules/better-journal/modules/journal-list/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { addStyles, getData, getSetting, makeElement, onJournalEntry } from '@utils';
import {
addStyles,
getData,
getSetting,
makeElement,
onJournalEntry
} from '@utils';

import styles from './styles.css';

Expand Down Expand Up @@ -33,8 +39,8 @@ const otherStrings = [
'Inside, I found</b>',
'Loyalty Chest and received:',
'I sifted through my Dragon Nest and found</b>',
"my Skyfarer's Oculus and discovered the following loot:",
"my Skyfarer's Oculus and discovered:",
'my Skyfarer\'s Oculus and discovered the following loot:',
'my Skyfarer\'s Oculus and discovered:',
];

const classesToSkip = [
Expand Down Expand Up @@ -63,6 +69,7 @@ const makeListItems = (itemList) => {
};

let allItems = null;
let linkItems = null;
/**
* Split the text into items.
*
Expand All @@ -72,34 +79,21 @@ let allItems = null;
*/
const splitText = async (text) => {
const items = text.split(/<br>|, (?=\d)| and (?=\d)/);
let itemsToReturn = items;

if (! allItems) {
allItems = await getData('items');
}

if (getSetting('better-journal-list.link-all-items')) {
itemsToReturn = items.map((item) => {
// If it's a link, return it as is.
if (item.includes('<a')) {
return item.trim();
}

console.log(`looking up "${item.trim()}"`);

return items.map((item) => {
if (linkItems) {
const itemData = allItems.find((i) => i.name === item.trim().replace(/^\d+ /, ''));

if (! itemData) {
return item.trim();
if (itemData) {
return `<a class="loot" title="" href="https://www.mousehuntgame.com/item.php?item_type=${itemData.type}" onclick="hg.views.ItemView.show('${itemData.type}'); return false;">${item}</a>`;
}
}

return `<a class="loot" title="" href="https://www.mousehuntgame.com/item.php?item_type=${itemData.type}" onclick="hg.views.ItemView.show('${itemData.type}'); return false;">${item}</a>`;
}).filter(Boolean);
} else {
itemsToReturn = items.map((item) => item.trim()).filter(Boolean);
}

return itemsToReturn;
return item.trim();
}).filter(Boolean);
};

/**
Expand Down Expand Up @@ -229,5 +223,7 @@ const formatAsList = async (entry) => {
export default async () => {
addStyles(styles, 'better-journal-list');

linkItems = getSetting('better-journal-list.link-all-items');

onJournalEntry(formatAsList, 3000);
};
11 changes: 1 addition & 10 deletions src/modules/better-maps/modules/highlighting.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,7 @@ const areaHighlightingFloatingIslands = () => {

const islandPowerType = powerTypeMappings[fiAtts.island_power_type] || '';

let floorCategory;

console.log(islandType, islandPowerType);

if ('sp' === islandType) {
floorCategory = document.querySelector('.mouse-category-wrapper.mouse-category-esp-sky_palace');
} else {
floorCategory = document.querySelector(`.mouse-category-wrapper.mouse-category-esp-${islandPowerType}`);
}

const floorCategory = 'sp' === islandType ? document.querySelector('.mouse-category-wrapper.mouse-category-esp-sky_palace') : document.querySelector(`.mouse-category-wrapper.mouse-category-esp-${islandPowerType}`);
if (! floorCategory) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/shared/open-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { getSetting, onNavigation, waitForElement } from '@utils';
/**
* Replace the convertible open action.
*
* @param {HTMLElement} element The element.
* @param {HTMLElement} element The element.
* @param {boolean} allButOne If all but one should be opened.
*/
const useConvertible = async (element, allButOne = false) => {
if ((element.getAttribute('data-item-action') !== 'all-but-one') && (element.getAttribute('data-item-action') !== 'all')) {
Expand Down

0 comments on commit e2d0cf4

Please sign in to comment.