File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
userscripts/nourishd-meal-highlighter Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 9
9
// @supportURL https://github.com/0xdevalias/userscripts/issues
10
10
// @downloadURL https://github.com/0xdevalias/userscripts/raw/main/userscripts/nourishd-meal-highlighter/nourishd-meal-highlighter.user.js
11
11
// @namespace https://www.devalias.net/
12
- // @version 0.1.11
12
+ // @version 0.1.12
13
13
// @match https://nourishd.com.au/menu
14
14
// @grant GM_registerMenuCommand
15
15
// ==/UserScript==
Original file line number Diff line number Diff line change 6
6
// @supportURL https://github.com/0xdevalias/userscripts/issues
7
7
// @downloadURL https://github.com/0xdevalias/userscripts/raw/main/userscripts/nourishd-meal-highlighter/nourishd-meal-highlighter.user.js
8
8
// @namespace https://www.devalias.net/
9
- // @version 0.1.11
9
+ // @version 0.1.12
10
10
// @match https://nourishd.com.au/menu
11
11
// @grant GM_registerMenuCommand
12
12
// ==/UserScript==
161
161
162
162
const validPortionSizes = [ 'R' , 'L' , 'XL' ] ;
163
163
164
+ const dietaryCheckboxSelector = '[wire\\:model="dietaryPreference"]' ;
164
165
const mealsContainerSelector = 'main .container > div > div:nth-child(2)' ;
165
166
const mealsSelector = '[x-data="{ sizeGuide: false }"] > div:nth-child(1)' ;
166
167
const mealTitleSelector = '.text-center > div > h3 > a' ;
416
417
}
417
418
} ;
418
419
420
+ // Uncheck the dietary preferences checkbox when the page first loads
421
+ observeTargetElement ( dietaryCheckboxSelector , ( { observedElement } ) => {
422
+ if ( observedElement . dataset . dietaryPreferenceUnchecked === 'true' ) return ;
423
+
424
+ if ( observedElement . checked ) {
425
+ observedElement . checked = false ;
426
+ observedElement . dispatchEvent ( new Event ( 'click' ) ) ;
427
+ observedElement . dataset . dietaryPreferenceUnchecked = 'true' ;
428
+ }
429
+ } ) ;
430
+
419
431
observeTargetElement ( mealsContainerSelector , processMeals ) ;
420
432
421
433
// const mealsContainer = document.querySelector(mealsContainerSelector);
You can’t perform that action at this time.
0 commit comments