Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

Recently I found a solution to run a javascript to temporary apply changes on a web site.

I had 2 cases where I changed some stuff in 3rd party webpage. Of course it's a temporary change until the page is reloaded.

In one case I need to remove the class "hidden-print" because the print invoice do not print some info. I need that but the supplier never fix it.

 

The following javascript is runnable from console and remove the class "hidden-print" from each elementb. You can run it from Browser console but it's not confortable like a bookmark.

// Remove the class hidden-print from the current webpage
// This works only in the browser console of the inspector (F12 for Chrome and others)
document.querySelector('.hidden-print').classList.remove('hidden-print');

 

In order to run the above javascript as a browser bookmark we have to use the following as url 

// use me as URL as bookmark in the browser
javascript:(function(){
const aElements = document.querySelectorAll('.hidden-print');
aElements.forEach(e => {
e.classList.remove('hidden-print');
});
})();

 

SUGGEST

If your script has a lot of lines or it has multi-lines you should consider to minified-compress your code.In the references section there is a good link.

Here the same script minified. 

javascript:!function(){let e=document.querySelectorAll(".hidden-print");e.forEach(e=>{e.classList.remove("hidden-print")})}();

 

 

 

 

 

 

DISQUS - Leave your comments here