hkirat / notification-logger

Desktop notification for your console Logs
http://hkirat.github.io/notification-logger
1.02k stars 57 forks source link

Bookmarklet #13

Open Nolanus opened 7 years ago

Nolanus commented 7 years ago

Using the following javascript one may include and init the notification logger at any page without having to put dev-only dependencies or script tags into the code:

if (typeof window.logger === 'undefined') {
    var script = document.createElement('script');
    script.src = 'http://singhharkirat.com/notification-logger/notification-logger.js'; 
    document.body.appendChild(script);
}
window.logger.init();

Putting that as a bookmarklet link and you've got a quick way to activate notification-logger on any page:

<a href="javascript:if(typeof window.logger=='undefined'){var script=document.createElement('script');script.src='http://singhharkirat.com/notification-logger/notification-logger.js';document.body.appendChild(script);}window.logger.init();">Bookmarklet</a>

Maybe you want to add that to the description page.

zeckdude commented 7 years ago

Wouldn't that bookmarklet need to be clicked every time the page is refreshed?

Nolanus commented 7 years ago

Yes, that's correct. The document change is only temporarily.

An alternative to overcome this could be a browser extension that performs the "insertion" on every page load. But that might be a