Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making alerts prettier without rewriting many lines

I know there are many good plugins for pretty alert boxes, but I have already made so many alerts, so I wanted to ask if it's possible to make those alerts prettier without rewriting all alert function calls in the code and replacing this function with other?

like image 200
good_evening Avatar asked May 23 '11 20:05

good_evening


People also ask

How do you stop prettier in VS code splitting attributes onto multiple lines?

A quick fix is to go to Prettier Extension Settings (ctrl + shift + X) and in Prettier Extension Settings search for "Print Width" set it to 250 or anything that works for you. 2: Change the value of Print Width to your liking. To disable format code on save.


1 Answers

You can hijack the default window.alert function:

window.__oldAlert__ = window.alert;
window.alert = function () {
    // your custom alert code here
};

Demo: http://jsfiddle.net/mattball/jMEha/


Edit

what do I need to write to change it to this plugin? http://thrivingkings.com/apprise

Your page will need jQuery, and the Apprise JS and CSS files.

window.__oldAlert__ = window.alert;
window.alert = function () {
    apprise.apply(this, arguments);
};

Demo: http://jsfiddle.net/mattball/exgBs/

like image 78
Matt Ball Avatar answered Sep 21 '22 08:09

Matt Ball