Skip to content

Commit

Permalink
show-if: display none important did not work in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Pick committed Nov 9, 2021
1 parent 1fe8ef2 commit 58460a7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/dist/frontend.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dist/frontend.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/lookup/get_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function get_info_cached() {
try {
response = await get_info_raw();
} catch (err) {
console.log('Uncaught ERROR ??');
console.log('Weird: Uncaught error...', err);
response = err.responseJSON || err;
}

Expand Down
4 changes: 3 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { options } from './lookup/get_info';
let firstCall = true;

export function main() {
console.log('Do Main');
if (process.env.NODE_ENV !== 'production') {
console.log('Do Main');
}

if (firstCall) {
do_shortcodes_init();
Expand Down
8 changes: 6 additions & 2 deletions js/shortcodes/onchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ function event_listener_autosave_on_change(event) {

const target = event.target;
if (target.matches('.js-geoip-detect-input-autosave')) {
console.log('autosave on change', target);

if (process.env.NODE_ENV !== 'production') {
console.log('autosave on change', target);
}

const property = get_options(target).property;
const value = target.value;

if (value) {
_change_counter++;
if (_listener_active || _change_counter > 100) {
console.warn('Thats weird! autosave change detected a recursion!');
console.warn('Error: Thats weird! autosave change detected a recursion! Please file a bug report about this.');
debugger;
return;
} else {
Expand Down
6 changes: 5 additions & 1 deletion js/shortcodes/show-if.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ export function do_shortcode_show_if(el, record) {
const evaluated = geoip_detect2_shortcode_evaluate_conditions(opt.parsed, opt, record);

if (!evaluated) {
el.style.display = "none !important";
el.style.display = "none";
el.classList.add('geoip-hidden');
el.classList.remove('geoip-shown');
} else {
el.style.display = '';
el.classList.remove('geoip-hidden');
el.classList.add('geoip-shown');
}
}

Expand Down

0 comments on commit 58460a7

Please sign in to comment.