BioTorrents.de’s version of Gazelle
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.

jquery.noty.packaged.js 52KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876
  1. !function(root, factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. define(['jquery'], factory);
  4. } else if (typeof exports === 'object') {
  5. module.exports = factory(require('jquery'));
  6. } else {
  7. factory(root.jQuery);
  8. }
  9. }(this, function($) {
  10. /*!
  11. @package noty - jQuery Notification Plugin
  12. @version version: 2.4.1
  13. @contributors https://github.com/needim/noty/graphs/contributors
  14. @documentation Examples and Documentation - http://needim.github.com/noty/
  15. @license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php
  16. */
  17. if (typeof Object.create !== 'function') {
  18. Object.create = function (o) {
  19. function F() {
  20. }
  21. F.prototype = o;
  22. return new F();
  23. };
  24. }
  25. var NotyObject = {
  26. init: function (options) {
  27. // Mix in the passed in options with the default options
  28. this.options = $.extend({}, $.noty.defaults, options);
  29. this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout];
  30. if ($.noty.themes[this.options.theme]) {
  31. this.options.theme = $.noty.themes[this.options.theme];
  32. if (this.options.theme.template)
  33. this.options.template = this.options.theme.template;
  34. if (this.options.theme.animation)
  35. this.options.animation = this.options.theme.animation;
  36. }
  37. else {
  38. this.options.themeClassName = this.options.theme;
  39. }
  40. this.options = $.extend({}, this.options, this.options.layout.options);
  41. if (this.options.id) {
  42. if ($.noty.store[this.options.id]) {
  43. return $.noty.store[this.options.id];
  44. }
  45. } else {
  46. this.options.id = 'noty_' + (new Date().getTime() * Math.floor(Math.random() * 1000000));
  47. }
  48. // Build the noty dom initial structure
  49. this._build();
  50. // return this so we can chain/use the bridge with less code.
  51. return this;
  52. }, // end init
  53. _build: function () {
  54. // Generating noty bar
  55. var $bar = $('<div class="noty_bar noty_type_' + this.options.type + '"></div>').attr('id', this.options.id);
  56. $bar.append(this.options.template).find('.noty_text').html(this.options.text);
  57. this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar;
  58. if (this.options.themeClassName)
  59. this.$bar.addClass(this.options.themeClassName).addClass('noty_container_type_' + this.options.type);
  60. // Set buttons if available
  61. if (this.options.buttons) {
  62. var $buttons;
  63. // Try find container for buttons in presented template, and create it if not found
  64. if (this.$bar.find('.noty_buttons').length > 0) {
  65. $buttons = this.$bar.find('.noty_buttons');
  66. } else {
  67. $buttons = $('<div/>').addClass('noty_buttons');
  68. (this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($buttons) : this.$bar.append($buttons);
  69. }
  70. var self = this;
  71. $.each(this.options.buttons, function (i, button) {
  72. var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text).attr('id', button.id ? button.id : 'button-' + i)
  73. .attr('title', button.title)
  74. .appendTo($buttons)
  75. .on('click', function (event) {
  76. if ($.isFunction(button.onClick)) {
  77. button.onClick.call($button, self, event);
  78. }
  79. });
  80. });
  81. } else {
  82. // If buttons is not available, then remove containers if exist
  83. this.$bar.find('.noty_buttons').remove();
  84. }
  85. if (this.options.progressBar && this.options.timeout) {
  86. var $progressBar = $('<div/>').addClass('noty_progress_bar');
  87. (this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($progressBar) : this.$bar.append($progressBar);
  88. }
  89. // For easy access
  90. this.$message = this.$bar.find('.noty_message');
  91. this.$closeButton = this.$bar.find('.noty_close');
  92. this.$buttons = this.$bar.find('.noty_buttons');
  93. this.$progressBar = this.$bar.find('.noty_progress_bar');
  94. $.noty.store[this.options.id] = this; // store noty for api
  95. }, // end _build
  96. show: function () {
  97. var self = this;
  98. (self.options.custom) ? self.options.custom.find(self.options.layout.container.selector).append(self.$bar) : $(self.options.layout.container.selector).append(self.$bar);
  99. if (self.options.theme && self.options.theme.style)
  100. self.options.theme.style.apply(self);
  101. ($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {});
  102. self.$bar.addClass(self.options.layout.addClass);
  103. self.options.layout.container.style.apply($(self.options.layout.container.selector), [self.options.within]);
  104. self.showing = true;
  105. if (self.options.theme && self.options.theme.style)
  106. self.options.theme.callback.onShow.apply(this);
  107. if ($.inArray('click', self.options.closeWith) > -1)
  108. self.$bar.css('cursor', 'pointer').on('click', function (evt) {
  109. self.stopPropagation(evt);
  110. if (self.options.callback.onCloseClick) {
  111. self.options.callback.onCloseClick.apply(self);
  112. }
  113. self.close();
  114. });
  115. if ($.inArray('hover', self.options.closeWith) > -1)
  116. self.$bar.one('mouseenter', function () {
  117. self.close();
  118. });
  119. if ($.inArray('button', self.options.closeWith) > -1)
  120. self.$closeButton.one('click', function (evt) {
  121. self.stopPropagation(evt);
  122. self.close();
  123. });
  124. if ($.inArray('button', self.options.closeWith) == -1)
  125. self.$closeButton.remove();
  126. if (self.options.callback.beforeShow)
  127. self.options.callback.beforeShow.apply(self);
  128. if (typeof self.options.animation.open == 'string') {
  129. self.animationTypeOpen = 'css';
  130. self.$bar.css('min-height', self.$bar.innerHeight());
  131. self.$bar.on('click', function (e) {
  132. self.wasClicked = true;
  133. });
  134. self.$bar.show();
  135. if (self.options.callback.onShow)
  136. self.options.callback.onShow.apply(self);
  137. self.$bar.addClass(self.options.animation.open).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
  138. if (self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
  139. self.showing = false;
  140. self.shown = true;
  141. self.bindTimeout();
  142. if (self.hasOwnProperty('wasClicked')) {
  143. self.$bar.off('click', function (e) {
  144. self.wasClicked = true;
  145. });
  146. self.close();
  147. }
  148. });
  149. } else if (typeof self.options.animation.open == 'object' && self.options.animation.open == null) {
  150. self.animationTypeOpen = 'none';
  151. self.showing = false;
  152. self.shown = true;
  153. self.$bar.show();
  154. self.bindTimeout();
  155. if (self.options.callback.onShow)
  156. self.options.callback.onShow.apply(self);
  157. self.$bar.queue(function () {
  158. if (self.options.callback.afterShow)
  159. self.options.callback.afterShow.apply(self);
  160. });
  161. } else {
  162. self.animationTypeOpen = 'anim';
  163. if (self.options.callback.onShow)
  164. self.options.callback.onShow.apply(self);
  165. self.$bar.animate(
  166. self.options.animation.open,
  167. self.options.animation.speed,
  168. self.options.animation.easing,
  169. function () {
  170. if (self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
  171. self.showing = false;
  172. self.shown = true;
  173. self.bindTimeout();
  174. });
  175. }
  176. return this;
  177. }, // end show
  178. bindTimeout: function () {
  179. var self = this;
  180. // If noty is have a timeout option
  181. if (self.options.timeout) {
  182. if (self.options.progressBar && self.$progressBar) {
  183. self.$progressBar.css({
  184. transition: 'all ' + self.options.timeout + 'ms linear',
  185. width: '0%'
  186. });
  187. }
  188. self.queueClose(self.options.timeout);
  189. self.$bar.on('mouseenter', self.dequeueClose.bind(self));
  190. self.$bar.on('mouseleave', self.queueClose.bind(self, self.options.timeout));
  191. }
  192. },
  193. dequeueClose: function () {
  194. var self = this;
  195. if (self.options.progressBar) {
  196. this.$progressBar.css({
  197. transition: 'none',
  198. width: '100%'
  199. });
  200. }
  201. if (!this.closeTimer) return;
  202. clearTimeout(this.closeTimer);
  203. this.closeTimer = null;
  204. },
  205. queueClose: function (timeout) {
  206. var self = this;
  207. if (self.options.progressBar) {
  208. self.$progressBar.css({
  209. transition: 'all ' + self.options.timeout + 'ms linear',
  210. width: '0%'
  211. });
  212. }
  213. if (this.closeTimer) return;
  214. self.closeTimer = window.setTimeout(function () {
  215. self.close();
  216. }, timeout);
  217. return self.closeTimer;
  218. },
  219. close: function () {
  220. if (this.$progressBar) {
  221. this.$progressBar.remove();
  222. }
  223. if (this.closeTimer) this.dequeueClose();
  224. if (this.closed) return;
  225. if (this.$bar && this.$bar.hasClass('i-am-closing-now')) return;
  226. var self = this;
  227. if (this.showing && (this.animationTypeOpen == 'anim' || this.animationTypeOpen == 'none')) {
  228. self.$bar.queue(
  229. function () {
  230. self.close.apply(self);
  231. }
  232. );
  233. return;
  234. } else if (this.showing && this.animationTypeOpen == 'css') {
  235. self.$bar.on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
  236. self.close();
  237. });
  238. }
  239. if (!this.shown && !this.showing) { // If we are still waiting in the queue just delete from queue
  240. var queue = [];
  241. $.each($.noty.queue, function (i, n) {
  242. if (n.options.id != self.options.id) {
  243. queue.push(n);
  244. }
  245. });
  246. $.noty.queue = queue;
  247. return;
  248. }
  249. self.$bar.addClass('i-am-closing-now');
  250. if (self.options.callback.onClose) {
  251. self.options.callback.onClose.apply(self);
  252. }
  253. if (typeof self.options.animation.close == 'string') {
  254. self.$bar.removeClass(self.options.animation.open).addClass(self.options.animation.close).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
  255. if (self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
  256. self.closeCleanUp();
  257. });
  258. } else if (typeof self.options.animation.close == 'object' && self.options.animation.close == null) {
  259. self.$bar.dequeue().hide(0, function () {
  260. if (self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
  261. self.closeCleanUp();
  262. });
  263. } else {
  264. self.$bar.clearQueue().stop().animate(
  265. self.options.animation.close,
  266. self.options.animation.speed,
  267. self.options.animation.easing,
  268. function () {
  269. if (self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
  270. })
  271. .promise().done(function () {
  272. self.closeCleanUp();
  273. });
  274. }
  275. }, // end close
  276. closeCleanUp: function () {
  277. var self = this;
  278. // Modal Cleaning
  279. if (self.options.modal) {
  280. $.notyRenderer.setModalCount(-1);
  281. if ($.notyRenderer.getModalCount() == 0 && !$.noty.queue.length) $('.noty_modal').fadeOut(self.options.animation.fadeSpeed, function () {
  282. $(this).remove();
  283. });
  284. }
  285. // Layout Cleaning
  286. $.notyRenderer.setLayoutCountFor(self, -1);
  287. if ($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();
  288. // Make sure self.$bar has not been removed before attempting to remove it
  289. if (typeof self.$bar !== 'undefined' && self.$bar !== null) {
  290. if (typeof self.options.animation.close == 'string') {
  291. self.$bar.css('transition', 'all 10ms ease').css('border', 0).css('margin', 0).height(0);
  292. self.$bar.one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () {
  293. self.$bar.remove();
  294. self.$bar = null;
  295. self.closed = true;
  296. if (self.options.theme.callback && self.options.theme.callback.onClose) {
  297. self.options.theme.callback.onClose.apply(self);
  298. }
  299. self.handleNext();
  300. });
  301. } else {
  302. self.$bar.remove();
  303. self.$bar = null;
  304. self.closed = true;
  305. self.handleNext();
  306. }
  307. } else {
  308. self.handleNext();
  309. }
  310. }, // end close clean up
  311. handleNext: function () {
  312. var self = this;
  313. delete $.noty.store[self.options.id]; // deleting noty from store
  314. if (self.options.theme.callback && self.options.theme.callback.onClose) {
  315. self.options.theme.callback.onClose.apply(self);
  316. }
  317. if (!self.options.dismissQueue) {
  318. // Queue render
  319. $.noty.ontap = true;
  320. $.notyRenderer.render();
  321. }
  322. if (self.options.maxVisible > 0 && self.options.dismissQueue) {
  323. $.notyRenderer.render();
  324. }
  325. },
  326. setText: function (text) {
  327. if (!this.closed) {
  328. this.options.text = text;
  329. this.$bar.find('.noty_text').html(text);
  330. }
  331. return this;
  332. },
  333. setType: function (type) {
  334. if (!this.closed) {
  335. this.options.type = type;
  336. this.options.theme.style.apply(this);
  337. this.options.theme.callback.onShow.apply(this);
  338. }
  339. return this;
  340. },
  341. setTimeout: function (time) {
  342. if (!this.closed) {
  343. var self = this;
  344. this.options.timeout = time;
  345. self.$bar.delay(self.options.timeout).promise().done(function () {
  346. self.close();
  347. });
  348. }
  349. return this;
  350. },
  351. stopPropagation: function (evt) {
  352. evt = evt || window.event;
  353. if (typeof evt.stopPropagation !== "undefined") {
  354. evt.stopPropagation();
  355. }
  356. else {
  357. evt.cancelBubble = true;
  358. }
  359. },
  360. closed : false,
  361. showing: false,
  362. shown : false
  363. }; // end NotyObject
  364. $.notyRenderer = {};
  365. $.notyRenderer.init = function (options) {
  366. // Renderer creates a new noty
  367. var notification = Object.create(NotyObject).init(options);
  368. if (notification.options.killer)
  369. $.noty.closeAll();
  370. (notification.options.force) ? $.noty.queue.unshift(notification) : $.noty.queue.push(notification);
  371. $.notyRenderer.render();
  372. return ($.noty.returns == 'object') ? notification : notification.options.id;
  373. };
  374. $.notyRenderer.render = function () {
  375. var instance = $.noty.queue[0];
  376. if ($.type(instance) === 'object') {
  377. if (instance.options.dismissQueue) {
  378. if (instance.options.maxVisible > 0) {
  379. if ($(instance.options.layout.container.selector + ' > li').length < instance.options.maxVisible) {
  380. $.notyRenderer.show($.noty.queue.shift());
  381. }
  382. else {
  383. }
  384. }
  385. else {
  386. $.notyRenderer.show($.noty.queue.shift());
  387. }
  388. }
  389. else {
  390. if ($.noty.ontap) {
  391. $.notyRenderer.show($.noty.queue.shift());
  392. $.noty.ontap = false;
  393. }
  394. }
  395. }
  396. else {
  397. $.noty.ontap = true; // Queue is over
  398. }
  399. };
  400. $.notyRenderer.show = function (notification) {
  401. if (notification.options.modal) {
  402. $.notyRenderer.createModalFor(notification);
  403. $.notyRenderer.setModalCount(+1);
  404. }
  405. // Where is the container?
  406. if (notification.options.custom) {
  407. if (notification.options.custom.find(notification.options.layout.container.selector).length == 0) {
  408. notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
  409. }
  410. else {
  411. notification.options.custom.find(notification.options.layout.container.selector).removeClass('i-am-new');
  412. }
  413. }
  414. else {
  415. if ($(notification.options.layout.container.selector).length == 0) {
  416. $('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
  417. }
  418. else {
  419. $(notification.options.layout.container.selector).removeClass('i-am-new');
  420. }
  421. }
  422. $.notyRenderer.setLayoutCountFor(notification, +1);
  423. notification.show();
  424. };
  425. $.notyRenderer.createModalFor = function (notification) {
  426. if ($('.noty_modal').length == 0) {
  427. var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0);
  428. if (notification.options.theme.modal && notification.options.theme.modal.css)
  429. modal.css(notification.options.theme.modal.css);
  430. modal.prependTo($('body')).fadeIn(notification.options.animation.fadeSpeed);
  431. if ($.inArray('backdrop', notification.options.closeWith) > -1)
  432. modal.on('click', function () {
  433. $.noty.closeAll();
  434. });
  435. }
  436. };
  437. $.notyRenderer.getLayoutCountFor = function (notification) {
  438. return $(notification.options.layout.container.selector).data('noty_layout_count') || 0;
  439. };
  440. $.notyRenderer.setLayoutCountFor = function (notification, arg) {
  441. return $(notification.options.layout.container.selector).data('noty_layout_count', $.notyRenderer.getLayoutCountFor(notification) + arg);
  442. };
  443. $.notyRenderer.getModalCount = function () {
  444. return $('.noty_modal').data('noty_modal_count') || 0;
  445. };
  446. $.notyRenderer.setModalCount = function (arg) {
  447. return $('.noty_modal').data('noty_modal_count', $.notyRenderer.getModalCount() + arg);
  448. };
  449. // This is for custom container
  450. $.fn.noty = function (options) {
  451. options.custom = $(this);
  452. return $.notyRenderer.init(options);
  453. };
  454. $.noty = {};
  455. $.noty.queue = [];
  456. $.noty.ontap = true;
  457. $.noty.layouts = {};
  458. $.noty.themes = {};
  459. $.noty.returns = 'object';
  460. $.noty.store = {};
  461. $.noty.get = function (id) {
  462. return $.noty.store.hasOwnProperty(id) ? $.noty.store[id] : false;
  463. };
  464. $.noty.close = function (id) {
  465. return $.noty.get(id) ? $.noty.get(id).close() : false;
  466. };
  467. $.noty.setText = function (id, text) {
  468. return $.noty.get(id) ? $.noty.get(id).setText(text) : false;
  469. };
  470. $.noty.setType = function (id, type) {
  471. return $.noty.get(id) ? $.noty.get(id).setType(type) : false;
  472. };
  473. $.noty.clearQueue = function () {
  474. $.noty.queue = [];
  475. };
  476. $.noty.closeAll = function () {
  477. $.noty.clearQueue();
  478. $.each($.noty.store, function (id, noty) {
  479. noty.close();
  480. });
  481. };
  482. var windowAlert = window.alert;
  483. $.noty.consumeAlert = function (options) {
  484. window.alert = function (text) {
  485. if (options)
  486. options.text = text;
  487. else
  488. options = {text: text};
  489. $.notyRenderer.init(options);
  490. };
  491. };
  492. $.noty.stopConsumeAlert = function () {
  493. window.alert = windowAlert;
  494. };
  495. $.noty.defaults = {
  496. layout : 'topRight',
  497. theme : 'relax',
  498. type : 'alert',
  499. text : '',
  500. progressBar : false,
  501. dismissQueue: true,
  502. template : '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
  503. animation : {
  504. open : {height: 'toggle'},
  505. close : {height: 'toggle'},
  506. easing : 'swing',
  507. speed : 500,
  508. fadeSpeed: 'fast'
  509. },
  510. timeout : false,
  511. force : false,
  512. modal : false,
  513. maxVisible : 5,
  514. killer : false,
  515. closeWith : ['click'],
  516. callback : {
  517. beforeShow : function () {
  518. },
  519. onShow : function () {
  520. },
  521. afterShow : function () {
  522. },
  523. onClose : function () {
  524. },
  525. afterClose : function () {
  526. },
  527. onCloseClick: function () {
  528. }
  529. },
  530. buttons : false
  531. };
  532. $(window).on('resize', function () {
  533. $.each($.noty.layouts, function (index, layout) {
  534. layout.container.style.apply($(layout.container.selector));
  535. });
  536. });
  537. // Helpers
  538. window.noty = function noty(options) {
  539. return $.notyRenderer.init(options);
  540. };
  541. $.noty.layouts.bottom = {
  542. name : 'bottom',
  543. options : {},
  544. container: {
  545. object : '<ul id="noty_bottom_layout_container" />',
  546. selector: 'ul#noty_bottom_layout_container',
  547. style : function() {
  548. $(this).css({
  549. bottom : 0,
  550. left : '5%',
  551. position : 'fixed',
  552. width : '90%',
  553. height : 'auto',
  554. margin : 0,
  555. padding : 0,
  556. listStyleType: 'none',
  557. zIndex : 9999999
  558. });
  559. }
  560. },
  561. parent : {
  562. object : '<li />',
  563. selector: 'li',
  564. css : {}
  565. },
  566. css : {
  567. display: 'none'
  568. },
  569. addClass : ''
  570. };
  571. $.noty.layouts.bottomCenter = {
  572. name : 'bottomCenter',
  573. options : { // overrides options
  574. },
  575. container: {
  576. object : '<ul id="noty_bottomCenter_layout_container" />',
  577. selector: 'ul#noty_bottomCenter_layout_container',
  578. style : function() {
  579. $(this).css({
  580. bottom : 20,
  581. left : 0,
  582. position : 'fixed',
  583. width : '310px',
  584. height : 'auto',
  585. margin : 0,
  586. padding : 0,
  587. listStyleType: 'none',
  588. zIndex : 10000000
  589. });
  590. $(this).css({
  591. left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px'
  592. });
  593. }
  594. },
  595. parent : {
  596. object : '<li />',
  597. selector: 'li',
  598. css : {}
  599. },
  600. css : {
  601. display: 'none',
  602. width : '310px'
  603. },
  604. addClass : ''
  605. };
  606. $.noty.layouts.bottomLeft = {
  607. name : 'bottomLeft',
  608. options : { // overrides options
  609. },
  610. container: {
  611. object : '<ul id="noty_bottomLeft_layout_container" />',
  612. selector: 'ul#noty_bottomLeft_layout_container',
  613. style : function() {
  614. $(this).css({
  615. bottom : 20,
  616. left : 20,
  617. position : 'fixed',
  618. width : '310px',
  619. height : 'auto',
  620. margin : 0,
  621. padding : 0,
  622. listStyleType: 'none',
  623. zIndex : 10000000
  624. });
  625. if(window.innerWidth < 600) {
  626. $(this).css({
  627. left: 5
  628. });
  629. }
  630. }
  631. },
  632. parent : {
  633. object : '<li />',
  634. selector: 'li',
  635. css : {}
  636. },
  637. css : {
  638. display: 'none',
  639. width : '310px'
  640. },
  641. addClass : ''
  642. };
  643. $.noty.layouts.bottomRight = {
  644. name : 'bottomRight',
  645. options : { // overrides options
  646. },
  647. container: {
  648. object : '<ul id="noty_bottomRight_layout_container" />',
  649. selector: 'ul#noty_bottomRight_layout_container',
  650. style : function() {
  651. $(this).css({
  652. bottom : 20,
  653. right : 20,
  654. position : 'fixed',
  655. width : '310px',
  656. height : 'auto',
  657. margin : 0,
  658. padding : 0,
  659. listStyleType: 'none',
  660. zIndex : 10000000
  661. });
  662. if(window.innerWidth < 600) {
  663. $(this).css({
  664. right: 5
  665. });
  666. }
  667. }
  668. },
  669. parent : {
  670. object : '<li />',
  671. selector: 'li',
  672. css : {}
  673. },
  674. css : {
  675. display: 'none',
  676. width : '310px'
  677. },
  678. addClass : ''
  679. };
  680. $.noty.layouts.center = {
  681. name : 'center',
  682. options : { // overrides options
  683. },
  684. container: {
  685. object : '<ul id="noty_center_layout_container" />',
  686. selector: 'ul#noty_center_layout_container',
  687. style : function() {
  688. $(this).css({
  689. position : 'fixed',
  690. width : '310px',
  691. height : 'auto',
  692. margin : 0,
  693. padding : 0,
  694. listStyleType: 'none',
  695. zIndex : 10000000
  696. });
  697. // getting hidden height
  698. var dupe = $(this).clone().css({visibility: "hidden", display: "block", position: "absolute", top: 0, left: 0}).attr('id', 'dupe');
  699. $("body").append(dupe);
  700. dupe.find('.i-am-closing-now').remove();
  701. dupe.find('li').css('display', 'block');
  702. var actual_height = dupe.height();
  703. dupe.remove();
  704. if($(this).hasClass('i-am-new')) {
  705. $(this).css({
  706. left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px',
  707. top : ($(window).height() - actual_height) / 2 + 'px'
  708. });
  709. }
  710. else {
  711. $(this).animate({
  712. left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px',
  713. top : ($(window).height() - actual_height) / 2 + 'px'
  714. }, 500);
  715. }
  716. }
  717. },
  718. parent : {
  719. object : '<li />',
  720. selector: 'li',
  721. css : {}
  722. },
  723. css : {
  724. display: 'none',
  725. width : '310px'
  726. },
  727. addClass : ''
  728. };
  729. $.noty.layouts.centerLeft = {
  730. name : 'centerLeft',
  731. options : { // overrides options
  732. },
  733. container: {
  734. object : '<ul id="noty_centerLeft_layout_container" />',
  735. selector: 'ul#noty_centerLeft_layout_container',
  736. style : function() {
  737. $(this).css({
  738. left : 20,
  739. position : 'fixed',
  740. width : '310px',
  741. height : 'auto',
  742. margin : 0,
  743. padding : 0,
  744. listStyleType: 'none',
  745. zIndex : 10000000
  746. });
  747. // getting hidden height
  748. var dupe = $(this).clone().css({visibility: "hidden", display: "block", position: "absolute", top: 0, left: 0}).attr('id', 'dupe');
  749. $("body").append(dupe);
  750. dupe.find('.i-am-closing-now').remove();
  751. dupe.find('li').css('display', 'block');
  752. var actual_height = dupe.height();
  753. dupe.remove();
  754. if($(this).hasClass('i-am-new')) {
  755. $(this).css({
  756. top: ($(window).height() - actual_height) / 2 + 'px'
  757. });
  758. }
  759. else {
  760. $(this).animate({
  761. top: ($(window).height() - actual_height) / 2 + 'px'
  762. }, 500);
  763. }
  764. if(window.innerWidth < 600) {
  765. $(this).css({
  766. left: 5
  767. });
  768. }
  769. }
  770. },
  771. parent : {
  772. object : '<li />',
  773. selector: 'li',
  774. css : {}
  775. },
  776. css : {
  777. display: 'none',
  778. width : '310px'
  779. },
  780. addClass : ''
  781. };
  782. $.noty.layouts.centerRight = {
  783. name : 'centerRight',
  784. options : { // overrides options
  785. },
  786. container: {
  787. object : '<ul id="noty_centerRight_layout_container" />',
  788. selector: 'ul#noty_centerRight_layout_container',
  789. style : function() {
  790. $(this).css({
  791. right : 20,
  792. position : 'fixed',
  793. width : '310px',
  794. height : 'auto',
  795. margin : 0,
  796. padding : 0,
  797. listStyleType: 'none',
  798. zIndex : 10000000
  799. });
  800. // getting hidden height
  801. var dupe = $(this).clone().css({visibility: "hidden", display: "block", position: "absolute", top: 0, left: 0}).attr('id', 'dupe');
  802. $("body").append(dupe);
  803. dupe.find('.i-am-closing-now').remove();
  804. dupe.find('li').css('display', 'block');
  805. var actual_height = dupe.height();
  806. dupe.remove();
  807. if($(this).hasClass('i-am-new')) {
  808. $(this).css({
  809. top: ($(window).height() - actual_height) / 2 + 'px'
  810. });
  811. }
  812. else {
  813. $(this).animate({
  814. top: ($(window).height() - actual_height) / 2 + 'px'
  815. }, 500);
  816. }
  817. if(window.innerWidth < 600) {
  818. $(this).css({
  819. right: 5
  820. });
  821. }
  822. }
  823. },
  824. parent : {
  825. object : '<li />',
  826. selector: 'li',
  827. css : {}
  828. },
  829. css : {
  830. display: 'none',
  831. width : '310px'
  832. },
  833. addClass : ''
  834. };
  835. $.noty.layouts.inline = {
  836. name : 'inline',
  837. options : {},
  838. container: {
  839. object : '<ul class="noty_inline_layout_container" />',
  840. selector: 'ul.noty_inline_layout_container',
  841. style : function() {
  842. $(this).css({
  843. width : '100%',
  844. height : 'auto',
  845. margin : 0,
  846. padding : 0,
  847. listStyleType: 'none',
  848. zIndex : 9999999
  849. });
  850. }
  851. },
  852. parent : {
  853. object : '<li />',
  854. selector: 'li',
  855. css : {}
  856. },
  857. css : {
  858. display: 'none'
  859. },
  860. addClass : ''
  861. };
  862. $.noty.layouts.top = {
  863. name : 'top',
  864. options : {},
  865. container: {
  866. object : '<ul id="noty_top_layout_container" />',
  867. selector: 'ul#noty_top_layout_container',
  868. style : function() {
  869. $(this).css({
  870. top : 0,
  871. left : '5%',
  872. position : 'fixed',
  873. width : '90%',
  874. height : 'auto',
  875. margin : 0,
  876. padding : 0,
  877. listStyleType: 'none',
  878. zIndex : 9999999
  879. });
  880. }
  881. },
  882. parent : {
  883. object : '<li />',
  884. selector: 'li',
  885. css : {}
  886. },
  887. css : {
  888. display: 'none'
  889. },
  890. addClass : ''
  891. };
  892. $.noty.layouts.topCenter = {
  893. name : 'topCenter',
  894. options : { // overrides options
  895. },
  896. container: {
  897. object : '<ul id="noty_topCenter_layout_container" />',
  898. selector: 'ul#noty_topCenter_layout_container',
  899. style : function() {
  900. $(this).css({
  901. top : 20,
  902. left : 0,
  903. position : 'fixed',
  904. width : '310px',
  905. height : 'auto',
  906. margin : 0,
  907. padding : 0,
  908. listStyleType: 'none',
  909. zIndex : 10000000
  910. });
  911. $(this).css({
  912. left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px'
  913. });
  914. }
  915. },
  916. parent : {
  917. object : '<li />',
  918. selector: 'li',
  919. css : {}
  920. },
  921. css : {
  922. display: 'none',
  923. width : '310px'
  924. },
  925. addClass : ''
  926. };
  927. $.noty.layouts.topLeft = {
  928. name : 'topLeft',
  929. options : { // overrides options
  930. },
  931. container: {
  932. object : '<ul id="noty_topLeft_layout_container" />',
  933. selector: 'ul#noty_topLeft_layout_container',
  934. style : function() {
  935. $(this).css({
  936. top : 20,
  937. left : 20,
  938. position : 'fixed',
  939. width : '310px',
  940. height : 'auto',
  941. margin : 0,
  942. padding : 0,
  943. listStyleType: 'none',
  944. zIndex : 10000000
  945. });
  946. if(window.innerWidth < 600) {
  947. $(this).css({
  948. left: 5
  949. });
  950. }
  951. }
  952. },
  953. parent : {
  954. object : '<li />',
  955. selector: 'li',
  956. css : {}
  957. },
  958. css : {
  959. display: 'none',
  960. width : '310px'
  961. },
  962. addClass : ''
  963. };
  964. $.noty.layouts.topRight = {
  965. name : 'topRight',
  966. options : { // overrides options
  967. },
  968. container: {
  969. object : '<ul id="noty_topRight_layout_container" />',
  970. selector: 'ul#noty_topRight_layout_container',
  971. style : function() {
  972. $(this).css({
  973. top : 20,
  974. right : 20,
  975. position : 'fixed',
  976. width : '310px',
  977. height : 'auto',
  978. margin : 0,
  979. padding : 0,
  980. listStyleType: 'none',
  981. zIndex : 10000000
  982. });
  983. if(window.innerWidth < 600) {
  984. $(this).css({
  985. right: 5
  986. });
  987. }
  988. }
  989. },
  990. parent : {
  991. object : '<li />',
  992. selector: 'li',
  993. css : {}
  994. },
  995. css : {
  996. display: 'none',
  997. width : '310px'
  998. },
  999. addClass : ''
  1000. };
  1001. $.noty.themes.bootstrapTheme = {
  1002. name : 'bootstrapTheme',
  1003. modal : {
  1004. css: {
  1005. position : 'fixed',
  1006. width : '100%',
  1007. height : '100%',
  1008. backgroundColor: '#000',
  1009. zIndex : 10000,
  1010. opacity : 0.6,
  1011. display : 'none',
  1012. left : 0,
  1013. top : 0,
  1014. wordBreak : 'break-all'
  1015. }
  1016. },
  1017. style : function () {
  1018. var containerSelector = this.options.layout.container.selector;
  1019. $(containerSelector).addClass('list-group');
  1020. this.$closeButton.append('<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>');
  1021. this.$closeButton.addClass('close');
  1022. this.$bar.addClass("list-group-item").css('padding', '0px').css('position', 'relative');
  1023. this.$progressBar.css({
  1024. position : 'absolute',
  1025. left : 0,
  1026. bottom : 0,
  1027. height : 4,
  1028. width : '100%',
  1029. backgroundColor: '#000000',
  1030. opacity : 0.2,
  1031. '-ms-filter' : 'progid:DXImageTransform.Microsoft.Alpha(Opacity=20)',
  1032. filter : 'alpha(opacity=20)'
  1033. });
  1034. switch (this.options.type) {
  1035. case 'alert':
  1036. case 'notification':
  1037. this.$bar.addClass("list-group-item-info");
  1038. break;
  1039. case 'warning':
  1040. this.$bar.addClass("list-group-item-warning");
  1041. break;
  1042. case 'error':
  1043. this.$bar.addClass("list-group-item-danger");
  1044. break;
  1045. case 'information':
  1046. this.$bar.addClass("list-group-item-info");
  1047. break;
  1048. case 'success':
  1049. this.$bar.addClass("list-group-item-success");
  1050. break;
  1051. }
  1052. this.$message.css({
  1053. textAlign: 'center',
  1054. padding : '8px 10px 9px',
  1055. width : 'auto',
  1056. position : 'relative'
  1057. });
  1058. },
  1059. callback: {
  1060. onShow : function () { },
  1061. onClose: function () { }
  1062. }
  1063. };
  1064. $.noty.themes.defaultTheme = {
  1065. name : 'defaultTheme',
  1066. helpers : {
  1067. borderFix: function () {
  1068. if (this.options.dismissQueue) {
  1069. var selector = this.options.layout.container.selector + ' ' + this.options.layout.parent.selector;
  1070. switch (this.options.layout.name) {
  1071. case 'top':
  1072. $(selector).css({borderRadius: '0px 0px 0px 0px'});
  1073. $(selector).last().css({borderRadius: '0px 0px 5px 5px'});
  1074. break;
  1075. case 'topCenter':
  1076. case 'topLeft':
  1077. case 'topRight':
  1078. case 'bottomCenter':
  1079. case 'bottomLeft':
  1080. case 'bottomRight':
  1081. case 'center':
  1082. case 'centerLeft':
  1083. case 'centerRight':
  1084. case 'inline':
  1085. $(selector).css({borderRadius: '0px 0px 0px 0px'});
  1086. $(selector).first().css({'border-top-left-radius': '5px', 'border-top-right-radius': '5px'});
  1087. $(selector).last().css({'border-bottom-left-radius': '5px', 'border-bottom-right-radius': '5px'});
  1088. break;
  1089. case 'bottom':
  1090. $(selector).css({borderRadius: '0px 0px 0px 0px'});
  1091. $(selector).first().css({borderRadius: '5px 5px 0px 0px'});
  1092. break;
  1093. default:
  1094. break;
  1095. }
  1096. }
  1097. }
  1098. },
  1099. modal : {
  1100. css: {
  1101. position : 'fixed',
  1102. width : '100%',
  1103. height : '100%',
  1104. backgroundColor: '#000',
  1105. zIndex : 10000,
  1106. opacity : 0.6,
  1107. display : 'none',
  1108. left : 0,
  1109. top : 0
  1110. }
  1111. },
  1112. style : function () {
  1113. this.$bar.css({
  1114. overflow : 'hidden',
  1115. background: "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAQAAAClM0ndAAAAhklEQVR4AdXO0QrCMBBE0bttkk38/w8WRERpdyjzVOc+HxhIHqJGMQcFFkpYRQotLLSw0IJ5aBdovruMYDA/kT8plF9ZKLFQcgF18hDj1SbQOMlCA4kao0iiXmah7qBWPdxpohsgVZyj7e5I9KcID+EhiDI5gxBYKLBQYKHAQoGFAoEks/YEGHYKB7hFxf0AAAAASUVORK5CYII=') repeat-x scroll left top #fff",
  1116. position : 'relative'
  1117. });
  1118. this.$progressBar.css({
  1119. position : 'absolute',
  1120. left : 0,
  1121. bottom : 0,
  1122. height : 4,
  1123. width : '100%',
  1124. backgroundColor: '#000000',
  1125. opacity : 0.2,
  1126. '-ms-filter' : 'progid:DXImageTransform.Microsoft.Alpha(Opacity=20)',
  1127. filter : 'alpha(opacity=20)'
  1128. });
  1129. this.$message.css({
  1130. textAlign: 'center',
  1131. padding : '8px 10px 9px',
  1132. width : 'auto',
  1133. position : 'relative'
  1134. });
  1135. this.$closeButton.css({
  1136. position : 'absolute',
  1137. top : 4, right: 4,
  1138. width : 10, height: 10,
  1139. background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAxUlEQVR4AR3MPUoDURSA0e++uSkkOxC3IAOWNtaCIDaChfgXBMEZbQRByxCwk+BasgQRZLSYoLgDQbARxry8nyumPcVRKDfd0Aa8AsgDv1zp6pYd5jWOwhvebRTbzNNEw5BSsIpsj/kurQBnmk7sIFcCF5yyZPDRG6trQhujXYosaFoc+2f1MJ89uc76IND6F9BvlXUdpb6xwD2+4q3me3bysiHvtLYrUJto7PD/ve7LNHxSg/woN2kSz4txasBdhyiz3ugPGetTjm3XRokAAAAASUVORK5CYII=)",
  1140. display : 'none',
  1141. cursor : 'pointer'
  1142. });
  1143. this.$buttons.css({
  1144. padding : 5,
  1145. textAlign : 'right',
  1146. borderTop : '1px solid #ccc',
  1147. backgroundColor: '#fff'
  1148. });
  1149. this.$buttons.find('button').css({
  1150. marginLeft: 5
  1151. });
  1152. this.$buttons.find('button:first').css({
  1153. marginLeft: 0
  1154. });
  1155. this.$bar.on({
  1156. mouseenter: function () {
  1157. $(this).find('.noty_close').stop().fadeTo('normal', 1);
  1158. },
  1159. mouseleave: function () {
  1160. $(this).find('.noty_close').stop().fadeTo('normal', 0);
  1161. }
  1162. });
  1163. switch (this.options.layout.name) {
  1164. case 'top':
  1165. this.$bar.css({
  1166. borderRadius: '0px 0px 5px 5px',
  1167. borderBottom: '2px solid #eee',
  1168. borderLeft : '2px solid #eee',
  1169. borderRight : '2px solid #eee',
  1170. boxShadow : "0 2px 4px rgba(0, 0, 0, 0.1)"
  1171. });
  1172. break;
  1173. case 'topCenter':
  1174. case 'center':
  1175. case 'bottomCenter':
  1176. case 'inline':
  1177. this.$bar.css({
  1178. borderRadius: '5px',
  1179. border : '1px solid #eee',
  1180. boxShadow : "0 2px 4px rgba(0, 0, 0, 0.1)"
  1181. });
  1182. this.$message.css({textAlign: 'center'});
  1183. break;
  1184. case 'topLeft':
  1185. case 'topRight':
  1186. case 'bottomLeft':
  1187. case 'bottomRight':
  1188. case 'centerLeft':
  1189. case 'centerRight':
  1190. this.$bar.css({
  1191. borderRadius: '5px',
  1192. border : '1px solid #eee',
  1193. boxShadow : "0 2px 4px rgba(0, 0, 0, 0.1)"
  1194. });
  1195. this.$message.css({textAlign: 'left'});
  1196. break;
  1197. case 'bottom':
  1198. this.$bar.css({
  1199. borderRadius: '5px 5px 0px 0px',
  1200. borderTop : '2px solid #eee',
  1201. borderLeft : '2px solid #eee',
  1202. borderRight : '2px solid #eee',
  1203. boxShadow : "0 -2px 4px rgba(0, 0, 0, 0.1)"
  1204. });
  1205. break;
  1206. default:
  1207. this.$bar.css({
  1208. border : '2px solid #eee',
  1209. boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
  1210. });
  1211. break;
  1212. }
  1213. switch (this.options.type) {
  1214. case 'alert':
  1215. case 'notification':
  1216. this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'});
  1217. break;
  1218. case 'warning':
  1219. this.$bar.css({backgroundColor: '#FFEAA8', borderColor: '#FFC237', color: '#826200'});
  1220. this.$buttons.css({borderTop: '1px solid #FFC237'});
  1221. break;
  1222. case 'error':
  1223. this.$bar.css({backgroundColor: 'red', borderColor: 'darkred', color: '#FFF'});
  1224. this.$message.css({fontWeight: 'bold'});
  1225. this.$buttons.css({borderTop: '1px solid darkred'});
  1226. break;
  1227. case 'information':
  1228. this.$bar.css({backgroundColor: '#57B7E2', borderColor: '#0B90C4', color: '#FFF'});
  1229. this.$buttons.css({borderTop: '1px solid #0B90C4'});
  1230. break;
  1231. case 'success':
  1232. this.$bar.css({backgroundColor: 'lightgreen', borderColor: '#50C24E', color: 'darkgreen'});
  1233. this.$buttons.css({borderTop: '1px solid #50C24E'});
  1234. break;
  1235. default:
  1236. this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'});
  1237. break;
  1238. }
  1239. },
  1240. callback: {
  1241. onShow : function () {
  1242. $.noty.themes.defaultTheme.helpers.borderFix.apply(this);
  1243. },
  1244. onClose: function () {
  1245. $.noty.themes.defaultTheme.helpers.borderFix.apply(this);
  1246. }
  1247. }
  1248. };
  1249. $.noty.themes.metroui = {
  1250. name : 'metroui',
  1251. helpers : {},
  1252. modal : {
  1253. css: {
  1254. position : 'fixed',
  1255. width : '100%',
  1256. height : '100%',
  1257. backgroundColor: '#000',
  1258. zIndex : 10000,
  1259. opacity : 0.6,
  1260. display : 'none',
  1261. left : 0,
  1262. top : 0
  1263. }
  1264. },
  1265. style : function () {
  1266. this.$bar.css({
  1267. overflow : 'hidden',
  1268. margin : '4px 0',
  1269. borderRadius: '0',
  1270. position : 'relative'
  1271. });
  1272. this.$progressBar.css({
  1273. position : 'absolute',
  1274. left : 0,
  1275. bottom : 0,
  1276. height : 4,
  1277. width : '100%',
  1278. backgroundColor: '#000000',
  1279. opacity : 0.2,
  1280. '-ms-filter' : 'progid:DXImageTransform.Microsoft.Alpha(Opacity=20)',
  1281. filter : 'alpha(opacity=20)'
  1282. });
  1283. this.$message.css({
  1284. textAlign: 'center',
  1285. padding : '1.25rem',
  1286. width : 'auto',
  1287. position : 'relative'
  1288. });
  1289. this.$closeButton.css({
  1290. position : 'absolute',
  1291. top : '.25rem', right: '.25rem',
  1292. width : 10, height: 10,
  1293. background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAxUlEQVR4AR3MPUoDURSA0e++uSkkOxC3IAOWNtaCIDaChfgXBMEZbQRByxCwk+BasgQRZLSYoLgDQbARxry8nyumPcVRKDfd0Aa8AsgDv1zp6pYd5jWOwhvebRTbzNNEw5BSsIpsj/kurQBnmk7sIFcCF5yyZPDRG6trQhujXYosaFoc+2f1MJ89uc76IND6F9BvlXUdpb6xwD2+4q3me3bysiHvtLYrUJto7PD/ve7LNHxSg/woN2kSz4txasBdhyiz3ugPGetTjm3XRokAAAAASUVORK5CYII=)",
  1294. display : 'none',
  1295. cursor : 'pointer'
  1296. });
  1297. this.$buttons.css({
  1298. padding : 5,
  1299. textAlign : 'right',
  1300. borderTop : '1px solid #ccc',
  1301. backgroundColor: '#fff'
  1302. });
  1303. this.$buttons.find('button').css({
  1304. marginLeft: 5
  1305. });
  1306. this.$buttons.find('button:first').css({
  1307. marginLeft: 0
  1308. });
  1309. this.$bar.on({
  1310. mouseenter: function () {
  1311. $(this).find('.noty_close').stop().fadeTo('normal', 1);
  1312. },
  1313. mouseleave: function () {
  1314. $(this).find('.noty_close').stop().fadeTo('normal', 0);
  1315. }
  1316. });
  1317. switch (this.options.layout.name) {
  1318. case 'top':
  1319. this.$bar.css({
  1320. border : 'none',
  1321. boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.3)"
  1322. });
  1323. break;
  1324. case 'topCenter':
  1325. case 'center':
  1326. case 'bottomCenter':
  1327. case 'inline':
  1328. this.$bar.css({
  1329. border : 'none',
  1330. boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.3)"
  1331. });
  1332. this.$message.css({textAlign: 'center'});
  1333. break;
  1334. case 'topLeft':
  1335. case 'topRight':
  1336. case 'bottomLeft':
  1337. case 'bottomRight':
  1338. case 'centerLeft':
  1339. case 'centerRight':
  1340. this.$bar.css({
  1341. border : 'none',
  1342. boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.3)"
  1343. });
  1344. this.$message.css({textAlign: 'left'});
  1345. break;
  1346. case 'bottom':
  1347. this.$bar.css({
  1348. border : 'none',
  1349. boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.3)"
  1350. });
  1351. break;
  1352. default:
  1353. this.$bar.css({
  1354. border : 'none',
  1355. boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.3)"
  1356. });
  1357. break;
  1358. }
  1359. switch (this.options.type) {
  1360. case 'alert':
  1361. case 'notification':
  1362. this.$bar.css({backgroundColor: '#fff', border: 'none', color: '#1d1d1d'});
  1363. break;
  1364. case 'warning':
  1365. this.$bar.css({backgroundColor: '#FA6800', border: 'none', color: '#fff'});
  1366. this.$buttons.css({borderTop: '1px solid #FA6800'});
  1367. break;
  1368. case 'error':
  1369. this.$bar.css({backgroundColor: '#CE352C', border: 'none', color: '#fff'});
  1370. this.$message.css({fontWeight: 'bold'});
  1371. this.$buttons.css({borderTop: '1px solid #CE352C'});
  1372. break;
  1373. case 'information':
  1374. this.$bar.css({backgroundColor: '#1BA1E2', border: 'none', color: '#fff'});
  1375. this.$buttons.css({borderTop: '1px solid #1BA1E2'});
  1376. break;
  1377. case 'success':
  1378. this.$bar.css({backgroundColor: '#60A917', border: 'none', color: '#fff'});
  1379. this.$buttons.css({borderTop: '1px solid #50C24E'});
  1380. break;
  1381. default:
  1382. this.$bar.css({backgroundColor: '#fff', border: 'none', color: '#1d1d1d'});
  1383. break;
  1384. }
  1385. },
  1386. callback: {
  1387. onShow : function () {
  1388. },
  1389. onClose: function () {
  1390. }
  1391. }
  1392. };
  1393. $.noty.themes.relax = {
  1394. name : 'relax',
  1395. helpers : {},
  1396. modal : {
  1397. css: {
  1398. position : 'fixed',
  1399. width : '100%',
  1400. height : '100%',
  1401. backgroundColor: '#000',
  1402. zIndex : 10000,
  1403. opacity : 0.6,
  1404. display : 'none',
  1405. left : 0,
  1406. top : 0
  1407. }
  1408. },
  1409. style : function () {
  1410. this.$bar.css({
  1411. overflow : 'hidden',
  1412. margin : '4px 0',
  1413. borderRadius: '2px',
  1414. position : 'relative'
  1415. });
  1416. this.$progressBar.css({
  1417. position : 'absolute',
  1418. left : 0,
  1419. bottom : 0,
  1420. height : 4,
  1421. width : '100%',
  1422. backgroundColor: '#000000',
  1423. opacity : 0.2,
  1424. '-ms-filter' : 'progid:DXImageTransform.Microsoft.Alpha(Opacity=20)',
  1425. filter : 'alpha(opacity=20)'
  1426. });
  1427. this.$message.css({
  1428. textAlign: 'center',
  1429. padding : '10px',
  1430. width : 'auto',
  1431. position : 'relative'
  1432. });
  1433. this.$closeButton.css({
  1434. position : 'absolute',
  1435. top : 4, right: 4,
  1436. width : 10, height: 10,
  1437. background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAxUlEQVR4AR3MPUoDURSA0e++uSkkOxC3IAOWNtaCIDaChfgXBMEZbQRByxCwk+BasgQRZLSYoLgDQbARxry8nyumPcVRKDfd0Aa8AsgDv1zp6pYd5jWOwhvebRTbzNNEw5BSsIpsj/kurQBnmk7sIFcCF5yyZPDRG6trQhujXYosaFoc+2f1MJ89uc76IND6F9BvlXUdpb6xwD2+4q3me3bysiHvtLYrUJto7PD/ve7LNHxSg/woN2kSz4txasBdhyiz3ugPGetTjm3XRokAAAAASUVORK5CYII=)",
  1438. display : 'none',
  1439. cursor : 'pointer'
  1440. });
  1441. this.$buttons.css({
  1442. padding : 5,
  1443. textAlign : 'right',
  1444. borderTop : '1px solid #ccc',
  1445. backgroundColor: '#fff'
  1446. });
  1447. this.$buttons.find('button').css({
  1448. marginLeft: 5
  1449. });
  1450. this.$buttons.find('button:first').css({
  1451. marginLeft: 0
  1452. });
  1453. this.$bar.on({
  1454. mouseenter: function () {
  1455. $(this).find('.noty_close').stop().fadeTo('normal', 1);
  1456. },
  1457. mouseleave: function () {
  1458. $(this).find('.noty_close').stop().fadeTo('normal', 0);
  1459. }
  1460. });
  1461. switch (this.options.layout.name) {
  1462. case 'top':
  1463. this.$bar.css({
  1464. borderBottom: '2px solid #eee',
  1465. borderLeft : '2px solid #eee',
  1466. borderRight : '2px solid #eee',
  1467. borderTop : '2px solid #eee',
  1468. boxShadow : "0 2px 4px rgba(0, 0, 0, 0.1)"
  1469. });
  1470. break;
  1471. case 'topCenter':
  1472. case 'center':
  1473. case 'bottomCenter':
  1474. case 'inline':
  1475. this.$bar.css({
  1476. border : '1px solid #eee',
  1477. boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
  1478. });
  1479. this.$message.css({textAlign: 'center'});
  1480. break;
  1481. case 'topLeft':
  1482. case 'topRight':
  1483. case 'bottomLeft':
  1484. case 'bottomRight':
  1485. case 'centerLeft':
  1486. case 'centerRight':
  1487. this.$bar.css({
  1488. border : '1px solid #eee',
  1489. boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
  1490. });
  1491. this.$message.css({textAlign: 'left'});
  1492. break;
  1493. case 'bottom':
  1494. this.$bar.css({
  1495. borderTop : '2px solid #eee',
  1496. borderLeft : '2px solid #eee',
  1497. borderRight : '2px solid #eee',
  1498. borderBottom: '2px solid #eee',
  1499. boxShadow : "0 -2px 4px rgba(0, 0, 0, 0.1)"
  1500. });
  1501. break;
  1502. default:
  1503. this.$bar.css({
  1504. border : '2px solid #eee',
  1505. boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
  1506. });
  1507. break;
  1508. }
  1509. switch (this.options.type) {
  1510. case 'alert':
  1511. case 'notification':
  1512. this.$bar.css({backgroundColor: '#FFF', borderColor: '#dedede', color: '#444'});
  1513. break;
  1514. case 'warning':
  1515. this.$bar.css({backgroundColor: '#FFEAA8', borderColor: '#FFC237', color: '#826200'});
  1516. this.$buttons.css({borderTop: '1px solid #FFC237'});
  1517. break;
  1518. case 'error':
  1519. this.$bar.css({backgroundColor: '#FF8181', borderColor: '#e25353', color: '#FFF'});
  1520. this.$message.css({fontWeight: 'bold'});
  1521. this.$buttons.css({borderTop: '1px solid darkred'});
  1522. break;
  1523. case 'information':
  1524. this.$bar.css({backgroundColor: '#78C5E7', borderColor: '#3badd6', color: '#FFF'});
  1525. this.$buttons.css({borderTop: '1px solid #0B90C4'});
  1526. break;
  1527. case 'success':
  1528. this.$bar.css({backgroundColor: '#BCF5BC', borderColor: '#7cdd77', color: 'darkgreen'});
  1529. this.$buttons.css({borderTop: '1px solid #50C24E'});
  1530. break;
  1531. default:
  1532. this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'});
  1533. break;
  1534. }
  1535. },
  1536. callback: {
  1537. onShow : function () {
  1538. },
  1539. onClose: function () {
  1540. }
  1541. }
  1542. };
  1543. $.noty.themes.semanticUI = {
  1544. name: 'semanticUI',
  1545. template: '<div class="ui message"><div class="content"><div class="header"></div></div></div>',
  1546. animation: {
  1547. open : {
  1548. animation: 'fade',
  1549. duration : '800ms'
  1550. },
  1551. close: {
  1552. animation: 'fade left',
  1553. duration : '800ms'
  1554. }
  1555. },
  1556. modal : {
  1557. css: {
  1558. position : 'fixed',
  1559. width : '100%',
  1560. height : '100%',
  1561. backgroundColor: '#000',
  1562. zIndex : 10000,
  1563. opacity : 0.6,
  1564. display : 'none',
  1565. left : 0,
  1566. top : 0
  1567. }
  1568. },
  1569. style : function () {
  1570. this.$message = this.$bar.find('.ui.message');
  1571. this.$message.find('.header').html(this.options.header);
  1572. this.$message.find('.content').append(this.options.text);
  1573. this.$bar.css({
  1574. margin : '0.5em',
  1575. position: 'relative'
  1576. });
  1577. if (this.options.icon) {
  1578. this.$message.addClass('icon').prepend($('<i/>').addClass(this.options.icon));
  1579. }
  1580. this.$progressBar.css({
  1581. position : 'absolute',
  1582. left : 0,
  1583. bottom : 0,
  1584. height : 4,
  1585. width : '100%',
  1586. backgroundColor: '#000000',
  1587. opacity : 0.2,
  1588. '-ms-filter' : 'progid:DXImageTransform.Microsoft.Alpha(Opacity=20)',
  1589. filter : 'alpha(opacity=20)'
  1590. });
  1591. switch (this.options.size) {
  1592. case 'mini':
  1593. this.$message.addClass('mini');
  1594. break;
  1595. case 'tiny':
  1596. this.$message.addClass('tiny');
  1597. break;
  1598. case 'small':
  1599. this.$message.addClass('small');
  1600. break;
  1601. case 'large':
  1602. this.$message.addClass('large');
  1603. break;
  1604. case 'big':
  1605. this.$message.addClass('big');
  1606. break;
  1607. case 'huge':
  1608. this.$message.addClass('huge');
  1609. break;
  1610. case 'massive':
  1611. this.$message.addClass('massive');
  1612. break;
  1613. }
  1614. switch (this.options.type) {
  1615. case 'info':
  1616. this.$message.addClass('info');
  1617. break;
  1618. case 'warning':
  1619. this.$message.addClass('warning');
  1620. break;
  1621. case 'error':
  1622. this.$message.addClass('error');
  1623. break;
  1624. case 'negative':
  1625. this.$message.addClass('negative');
  1626. break;
  1627. case 'success':
  1628. this.$message.addClass('success');
  1629. break;
  1630. case 'positive':
  1631. this.$message.addClass('positive');
  1632. break;
  1633. case 'floating':
  1634. this.$message.addClass('floating');
  1635. break;
  1636. }
  1637. },
  1638. callback: {
  1639. onShow : function () {
  1640. // Enable transition
  1641. this.$bar.addClass('transition');
  1642. // Actual transition
  1643. this.$bar.transition(this.options.animation.open);
  1644. },
  1645. onClose: function () {
  1646. this.$bar.transition(this.options.animation.close);
  1647. }
  1648. }
  1649. };
  1650. return window.noty;
  1651. });