SIMPLE JAVASCRIPT SNIPPET TO AVOID RUNNING SPECIFIC CODE ON SELECTED PAGES

SIMPLE JAVASCRIPT SNIPPET TO AVOID RUNNING SPECIFIC CODE ON SELECTED PAGES

The reason i’ve published this blip note because one reader reported me that after my recent
[decoration upgrade] i totally f#cked up cameraphone benchmark comparison pages,
where my preloader script interfered with existing functionality
making images not rendered on these pages at all.

I also removed .crt class on cameraphone comparison pages to get rid
of CRT monitor emulation since it is obviously not needed there.
People should be able to pixel-peep without any distractions like scanlines.

Here is a code, which avoids certain code execution on specified pages.

const currentPage = window.location.pathname;
if (currentPage !== 'iphuck-13-pro-hyper-max-vs-nokia-pureview-808-2021-vs-2012' && 'iphone-15-pro-max-vs-nokia-pureview-808-2023-vs-2012') {
return;
}

You can add as many pages as you like:

('1.html' && '2.html' && '3.html')

Of course we can do it by means of array,
but it is not so important after all since low amount of excluded pages.
Dropped another potion of decorations, hope that they will not spoil anything.