You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
5.1 KiB

;(function($) {
$.noty.themes.defaultTheme = {
name: 'defaultTheme',
helpers: {
borderFix: function() {
if (this.options.dismissQueue) {
var selector = this.options.layout.container.selector + ' ' + this.options.layout.parent.selector;
switch (this.options.layout.name) {
case 'top':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).last().css({borderRadius: '0px 0px 0px 0px'}); break;
case 'topCenter': case 'topLeft': case 'topRight':
case 'bottomCenter': case 'bottomLeft': case 'bottomRight':
case 'center': case 'centerLeft': case 'centerRight': case 'inline':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).first().css({'border-top-left-radius': '0px', 'border-top-right-radius': '0px'});
$(selector).last().css({'border-bottom-left-radius': '0px', 'border-bottom-right-radius': '0px'}); break;
case 'bottom':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).first().css({borderRadius: '0px 0px 0px 0px'}); break;
default: break;
}
}
}
},
modal: {
css: {
position: 'fixed',
width: '100%',
height: '100%',
backgroundColor: '#000',
zIndex: 10000,
opacity: 0.6,
display: 'none',
left: 0,
top: 0
}
},
style: function() {
this.$bar.css({
overflow: 'hidden',
background: "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAYAAAAPOoFWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPZJREFUeNq81tsOgjAMANB2ov7/7ypaN7IlIwi9rGuT8QSc9EIDAsAznxvY4pXPKr05RUE5MEVB+TyWfCEl9LZApYopCmo9C4FKSMtYoI8Bwv79aQJU4l6hXXCZrQbokJEksxHo9KMOgc6w1atHXM8K9DVC7FQnJ0i8iK3QooGgbnyKgMDygBWyYFZoqx4qS27KqLZJjA1D0jK6QJcYEQEiWv9PGkTsbqxQ8oT+ZtZB6AkdsJnQDnMoHXHLGKOgDYuCWmYhEERCI5gaamW0bnHdA3k2ltlIN+2qKRyCND0bhqSYCyTB3CAOc4WusBEIpkeBuPgJMAAX8Hs1NfqHRgAAAABJRU5ErkJggg==') repeat-x scroll left top #fff"
});
this.$message.css({
fontSize: '12px',
lineHeight: '16px',
textAlign: 'center',
padding: '10px',
width: 'auto',
position: 'relative'
});
this.$closeButton.html('<span class="m-r-n-sm m-t-n-sm"><i class="glyphicon glyphicon-remove"></i></span>');
this.$closeButton.css({
position: 'absolute',
top: 2,
right: 4,
display: 'none',
cursor: 'pointer'
});
this.$buttons.css({
padding: 5,
textAlign: 'right',
borderTop: '1px solid #ccc',
backgroundColor: '#fff'
});
this.$buttons.find('button').css({
marginLeft: 5
});
this.$buttons.find('button:first').css({
marginLeft: 0
});
this.$bar.bind({
mouseenter: function() { $(this).find('.noty_close').stop().fadeTo('normal',1); },
mouseleave: function() { $(this).find('.noty_close').stop().fadeTo('normal',0); }
});
switch (this.options.layout.name) {
case 'top':
this.$bar.css({
borderRadius: 'none',
borderBottom: 'none',
borderLeft: 'none',
borderRight: 'none',
boxShadow: "none"
});
break;
case 'topCenter': case 'center': case 'bottomCenter': case 'inline':
this.$bar.css({
borderRadius: 'none',
border: 'none',
boxShadow: "none"
});
this.$message.css({fontSize: '13px', textAlign: 'center'});
break;
case 'topLeft': case 'topRight':
case 'bottomLeft': case 'bottomRight':
case 'centerLeft': case 'centerRight':
this.$bar.css({
borderRadius: '0px',
border: '1px solid #ffffff',
boxShadow: "0 2px 10px rgba(0,0,0,0.25)"
});
this.$message.css({fontSize: '12px', textAlign: 'left'});
break;
case 'bottom':
this.$bar.css({
borderRadius: 'none',
borderTop: 'none',
borderLeft: 'none',
borderRight: 'none',
boxShadow: "none"
});
break;
default:
this.$bar.css({
border: 'none',
boxShadow: "none"
});
break;
}
switch (this.options.type) {
case 'alert': case 'notification':
this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'}); break;
case 'warning':
this.$bar.css({backgroundColor: '#FFEAA8', borderColor: '#FFC237', color: '#826200'});
this.$buttons.css({borderTop: '1px solid #FFC237'}); break;
case 'error':
this.$bar.css({backgroundColor: 'red', borderColor: 'darkred', color: '#FFF'});
this.$message.css({fontWeight: 'bold'});
this.$buttons.css({borderTop: '1px solid darkred'}); break;
case 'information':
this.$bar.css({backgroundColor: '#57B7E2', borderColor: '#0B90C4', color: '#FFF'});
this.$buttons.css({borderTop: '1px solid #0B90C4'}); break;
case 'success':
this.$bar.css({backgroundColor: 'lightgreen', borderColor: '#50C24E', color: 'darkgreen'});
this.$buttons.css({borderTop: '1px solid #50C24E'});break;
default:
this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'}); break;
}
},
callback: {
onShow: function() { $.noty.themes.defaultTheme.helpers.borderFix.apply(this); },
onClose: function() { $.noty.themes.defaultTheme.helpers.borderFix.apply(this); }
}
};
})(jQuery);