upgrade jgrowl

This commit is contained in:
Mario Vavti
2019-05-13 10:53:10 +02:00
parent fbe8d6144a
commit 1d5fff9f58
20 changed files with 1222 additions and 6 deletions

View File

@@ -0,0 +1,103 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml" debug="true">
<head>
<title>jGrowl Examples</title>
<link rel="stylesheet" href="../jquery.jgrowl.css" type="text/css"/>
<style type="text/css">
html,
body {
font-family: "Helvetica neue", Helvetica, Arial, sans-serif;
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5 {
margin-top: 2px;
margin-bottom: 2px;
}
.jGrowl .manilla {
background-color: #FFF1C2;
color: navy;
}
.jGrowl .flora {
background: #E6F7D4 url(flora-notification.png) no-repeat;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
opacity: 1;
filter: alpha(opacity = 100);
width: 270px;
height: 90px;
padding: 0px;
overflow: hidden;
border-color: #5ab500;
}
.jGrowl .flora .message {
padding: 5px;
color: #000;
}
.jGrowl .flora .header {
background: url(flora-header.png) no-repeat;
padding: 5px;
}
.jGrowl .flora .close {
background: url(flora-close.png) no-repeat;
padding: 5px;
color: transparent;
padding: 0px;
margin: 5px;
width: 17px;
}
#dummyNav {
position: fixed;
background: green;
width: 100%;
height: 50px;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript" src="../jquery.jgrowl.js"></script>
<script type="text/javascript">
// In case you don't have firebug...
if(typeof console === "undefined") {
console = { log: function() { } };
}
(function($){
$(function(){
$.jGrowl.defaults.closerTemplate = "<div>[ xxxxx ]</div>";
$.jGrowl.defaults.appendTo = "div#dummyNav";
$.jGrowl("This message is sticky and clickable", {
sticky: true,
click: function(msg) {
alert("You clicked me");
}
});
$.jGrowl("This message is sticky and clickable");
$.jGrowl("This message is sticky and clickable");
$.jGrowl("This message is sticky and clickable");
$.jGrowl("This message is sticky and clickable");
$.jGrowl("This message is sticky and clickable");
$.jGrowl("This message is sticky and clickable");
});
})(jQuery);
</script>
</head>
<body>
<div id="dummyNav">I'm the dummy navigation</div>
<h1>Append To Another DOM-Object</h1>
</body>
</html>

View File

@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>jGrowl and Bootstrap</title>
<link rel="stylesheet" href="../jquery.jgrowl.css" type="text/css"/>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
body {
padding-top: 50px;
}
</style>
</head>
<body>
<div id="jGrowl-container1" class="jGrowl top-right"></div>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">jGrowl</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div>
<h1>jGrowl and Bootstrap</h1>
<p class="lead">This is a Bootstrap starter template with jGrowl integrated. As you can see it's extremely easy to make jGrowl look and feel like part of Bootstrap.</p>
</div>
<div id="jGrowl-container2" class="jGrowl"></div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../jquery.jgrowl.js"></script>
<script type="text/javascript">
(function($){
$(function(){
$.jGrowl.defaults.closerTemplate = '<div class="alert alert-info">Close All</div>';
var alertTypes = ['success', 'info', 'warning', 'danger'];
for (var i=0; i<10; i++) {
setTimeout(function(){
var alertType = alertTypes[Math.floor(Math.random()*alertTypes.length)];
$('#jGrowl-container1').jGrowl({
header: alertType.substring(0, 1).toUpperCase() + alertType.substring(1) + ' Notification',
message: 'Hello world ',
group: 'alert-' + alertType,
life: 5000
});
}, i*2000);
}
});
})(jQuery);
</script>
</body>
</html>

View File

@@ -0,0 +1,171 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml" debug="true">
<head>
<title>jGrowl Examples</title>
<link rel="stylesheet" href="../jquery.jgrowl.css" type="text/css"/>
<style type="text/css">
body {
font-family: "Helvetica neue", Helvetica, Arial, sans-serif;
}
h1, h2, h3, h4, h5 {
margin-top: 2px;
margin-bottom: 2px;
}
.jGrowl .manilla {
background-color: #FFF1C2;
color: navy;
}
.jGrowl .flora {
background: #E6F7D4 url(flora-notification.png) no-repeat;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
opacity: 1;
filter: alpha(opacity = 100);
width: 270px;
height: 90px;
padding: 0px;
overflow: hidden;
border-color: #5ab500;
}
.jGrowl .flora .message {
padding: 5px;
color: #000;
}
.jGrowl .flora .header {
background: url(flora-header.png) no-repeat;
padding: 5px;
}
.jGrowl .flora .close {
background: url(flora-close.png) no-repeat;
padding: 5px;
color: transparent;
padding: 0px;
margin: 5px;
width: 17px;
}
#random {
padding: 20px;
width: 1500px;
background-color: #ff7070;
}
#logs {
margin-top: 30px;
background-color: #efefef;
border: 1px solid #aaa;
padding: 10px;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript" src="../jquery.jgrowl.js"></script>
<script type="text/javascript">
// In case you don't have firebug...
if(typeof console === "undefined") {
console = { log: function() { } };
}
(function($){
$(function(){
$.jGrowl.defaults.pool = 5;
$.jGrowl.defaults.closerTemplate = '<div>hide all notifications</div>';
// This value can be true, false or a function to be used as a callback when the closer is clciked
$.jGrowl.defaults.closer = function() {
console.log("Closing everything!", this);
};
// A callback for logging notifications.
$.jGrowl.defaults.log = function(e,m,o) {
$('#logs').append("<div><strong>#" + $(e).attr('id') + "</strong> <em>" + (new Date()).getTime() + "</em>: " + m + " (" + o.theme + ")</div>")
}
$.jGrowl("Sticky notifications don't have an end of life", { sticky: true });
$.jGrowl("Custom theme, custom animations, header, longer life and a whole bunch of callbacks...", {
header: 'Header',
life: 5000,
theme: 'manilla',
speed: 'slow',
beforeOpen: function(e,m,o) {
console.log("I am going to be opened!", this);
},
open: function(e,m,o) {
console.log("I have been opened!", this);
},
beforeClose: function(e,m,o) {
console.log("I am going to be closed!", this);
},
close: function(e,m,o) {
console.log("I have been closed!", this);
},
animateOpen: {
height: "show",
width: "show"
},
animateClose: {
height: "hide",
width: "show"
}
});
$.jGrowl("This message will not open because we have a callback that returns false.", {
beforeOpen: function() {
console.log("Going to open a notification, but not really...");
},
open: function() {
return false;
}
});
$.jGrowl("This message will not close because we have a callback that returns false.", {
beforeClose: function() {
return false;
}
});
$('#test1').jGrowl("Testing a custom container.", {
closer: false,
sticky: true,
glue: 'before'
});
$('#test1').jGrowl("This will be prepended before the last message.", {
glue: 'before'
});
$.jGrowl("This message is sticky and clickable", {
sticky: true,
click: function(msg) {
alert("You clicked me");
}
});
});
})(jQuery);
</script>
</head>
<body>
<h1>jGrowl Tests</h1>
<p><a href="javascript:void(0);" onclick="$.jGrowl('One more message...');">Create a new message.</a></p>
<p><a href="javascript:void(0);" onclick="$('#test1').jGrowl('shutdown');">Shutdown bottom-left container.</a></p>
<div id="random">An extra wide node, watch as the jGrowl containers stay put in the corners of the screen..</div>
<div id="logs"><h3>Log:</h3></div>
<div id="test1" class="bottom-left"></div>
</body>
</html>