├── .gitignore
├── LICENSE
├── NotificationsModule.php
├── README.md
├── assets
├── jquery.timeago.js
├── locales
│ ├── README.md
│ ├── jquery.timeago.ar.js
│ ├── jquery.timeago.bg.js
│ ├── jquery.timeago.bs.js
│ ├── jquery.timeago.ca.js
│ ├── jquery.timeago.cs.js
│ ├── jquery.timeago.cy.js
│ ├── jquery.timeago.da.js
│ ├── jquery.timeago.de.js
│ ├── jquery.timeago.dv.js
│ ├── jquery.timeago.el.js
│ ├── jquery.timeago.en-short.js
│ ├── jquery.timeago.en.js
│ ├── jquery.timeago.es-short.js
│ ├── jquery.timeago.es.js
│ ├── jquery.timeago.et.js
│ ├── jquery.timeago.fa.js
│ ├── jquery.timeago.fi.js
│ ├── jquery.timeago.fr-short.js
│ ├── jquery.timeago.fr.js
│ ├── jquery.timeago.gl.js
│ ├── jquery.timeago.he.js
│ ├── jquery.timeago.hr.js
│ ├── jquery.timeago.hu.js
│ ├── jquery.timeago.hy.js
│ ├── jquery.timeago.id.js
│ ├── jquery.timeago.is.js
│ ├── jquery.timeago.it-short.js
│ ├── jquery.timeago.it.js
│ ├── jquery.timeago.ja.js
│ ├── jquery.timeago.jv.js
│ ├── jquery.timeago.ko.js
│ ├── jquery.timeago.ky.js
│ ├── jquery.timeago.lt.js
│ ├── jquery.timeago.mk.js
│ ├── jquery.timeago.nl.js
│ ├── jquery.timeago.no.js
│ ├── jquery.timeago.pl.js
│ ├── jquery.timeago.pt-br-short.js
│ ├── jquery.timeago.pt-br.js
│ ├── jquery.timeago.pt.js
│ ├── jquery.timeago.ro.js
│ ├── jquery.timeago.rs.js
│ ├── jquery.timeago.ru.js
│ ├── jquery.timeago.rw.js
│ ├── jquery.timeago.si.js
│ ├── jquery.timeago.sk.js
│ ├── jquery.timeago.sl.js
│ ├── jquery.timeago.sv.js
│ ├── jquery.timeago.th.js
│ ├── jquery.timeago.tr.js
│ ├── jquery.timeago.uk.js
│ ├── jquery.timeago.uz.js
│ ├── jquery.timeago.vi.js
│ ├── jquery.timeago.zh-CN.js
│ └── jquery.timeago.zh-TW.js
├── notifications.css
├── notifications.js
├── notifications.less
└── themes
│ ├── growl.css
│ ├── growl.js
│ ├── notie.css
│ ├── notie.js
│ ├── notifit.css
│ ├── notifit.js
│ ├── notify.js
│ ├── noty.js
│ ├── pnotify.css
│ ├── pnotify.js
│ ├── toastr.css
│ └── toastr.js
├── commands
└── NotificationsController.php
├── composer.json
├── controllers
└── NotificationsController.php
├── docs
├── Concept.md
├── Configuration.md
├── Contributors.md
├── Installation.md
├── README.md
├── Todo.md
├── Usage.md
├── growl.png
├── list.png
└── main.png
├── migrations
├── m151008_162401_create_notification_table.php
├── m160509_211405_add_flashed_to_notification.php
└── m160921_171124_alter_notification_table.php
├── models
└── Notification.php
└── widgets
├── NotificationsAsset.php
└── NotificationsWidget.php
/.gitignore:
--------------------------------------------------------------------------------
1 | composer.phar
2 | vendor/
3 | .idea
4 |
5 | # Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
6 | # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
7 | # composer.lock
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Mehdi Achour
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/NotificationsModule.php:
--------------------------------------------------------------------------------
1 | userId)) {
48 | $this->userId = call_user_func($this->userId);
49 | }
50 | parent::init();
51 |
52 | if (Yii::$app instanceof \yii\console\Application) {
53 | $this->controllerNamespace = 'machour\yii2\notifications\commands';
54 | }
55 | }
56 |
57 | /**
58 | * Creates a notification
59 | *
60 | * @param Notification $notification The notification class
61 | * @param string $key The notification key
62 | * @param integer $user_id The user id that will get the notification
63 | * @param string $key_id The key unique id
64 | * @param string $type The notification type
65 | * @return bool Returns TRUE on success, FALSE on failure
66 | * @throws Exception
67 | */
68 | public static function notify($notification, $key, $user_id, $key_id = null, $type = Notification::TYPE_DEFAULT)
69 | {
70 |
71 | if (!in_array($key, $notification::$keys)) {
72 | throw new Exception("Not a registered notification key: $key");
73 | }
74 |
75 | if (!in_array($type, Notification::$types)) {
76 | throw new Exception("Unknown notification type: $type");
77 | }
78 |
79 | /** @var Notification $instance */
80 | $instance = $notification::findOne(['user_id' => $user_id, 'key' => $key, 'key_id' => (string)$key_id]);
81 | if (!$instance || \Yii::$app->getModule('notifications')->allowDuplicate) {
82 | $instance = new $notification([
83 | 'key' => $key,
84 | 'type' => $type,
85 | 'seen' => 0,
86 | 'flashed' => 0,
87 | 'user_id' => $user_id,
88 | 'key_id' => (string)$key_id,
89 | 'created_at' => new Expression('NOW()'),
90 | ]);
91 | return $instance->save();
92 | }
93 | return true;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | A complete notifications module for your Yii 2 powered application.
2 |
3 | [](https://packagist.org/packages/machour/yii2-notifications)
4 | [](https://packagist.org/packages/machour/yii2-notifications)
5 | [](https://packagist.org/packages/machour/yii2-notifications)
6 | [](https://packagist.org/packages/machour/yii2-notifications)
7 |
8 | This module will install it's own table, and quickly allow you to:
9 |
10 | * Trigger notifications to your users
11 | * Toast these notifications on the screen using one of the supported UI libraries
12 | * Manage a HTML list of notifications
13 |
14 | 
15 |
16 | A documentation is available in the [docs](docs/README.md) folder of this repository.
17 | You can also check this [live demo](https://machour.idk.tn/yii2-kitchen-sink/site/yii2-notifications).
18 |
--------------------------------------------------------------------------------
/assets/jquery.timeago.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Timeago is a jQuery plugin that makes it easy to support automatically
3 | * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
4 | *
5 | * @name timeago
6 | * @version 1.4.3
7 | * @requires jQuery v1.2.3+
8 | * @author Ryan McGeary
9 | * @license MIT License - http://www.opensource.org/licenses/mit-license.php
10 | *
11 | * For usage and examples, visit:
12 | * http://timeago.yarp.com/
13 | *
14 | * Copyright (c) 2008-2015, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
15 | */
16 |
17 | (function (factory) {
18 | if (typeof define === 'function' && define.amd) {
19 | // AMD. Register as an anonymous module.
20 | define(['jquery'], factory);
21 | } else if (typeof module === 'object' && typeof module.exports === 'object') {
22 | factory(require('jquery'));
23 | } else {
24 | // Browser globals
25 | factory(jQuery);
26 | }
27 | }(function ($) {
28 | $.timeago = function(timestamp) {
29 | if (timestamp instanceof Date) {
30 | return inWords(timestamp);
31 | } else if (typeof timestamp === "string") {
32 | return inWords($.timeago.parse(timestamp));
33 | } else if (typeof timestamp === "number") {
34 | return inWords(new Date(timestamp));
35 | } else {
36 | return inWords($.timeago.datetime(timestamp));
37 | }
38 | };
39 | var $t = $.timeago;
40 |
41 | $.extend($.timeago, {
42 | settings: {
43 | refreshMillis: 60000,
44 | allowPast: true,
45 | allowFuture: false,
46 | localeTitle: false,
47 | cutoff: 0,
48 | strings: {
49 | prefixAgo: null,
50 | prefixFromNow: null,
51 | suffixAgo: "ago",
52 | suffixFromNow: "from now",
53 | inPast: 'any moment now',
54 | seconds: "less than a minute",
55 | minute: "about a minute",
56 | minutes: "%d minutes",
57 | hour: "about an hour",
58 | hours: "about %d hours",
59 | day: "a day",
60 | days: "%d days",
61 | month: "about a month",
62 | months: "%d months",
63 | year: "about a year",
64 | years: "%d years",
65 | wordSeparator: " ",
66 | numbers: []
67 | }
68 | },
69 |
70 | inWords: function(distanceMillis) {
71 | if(!this.settings.allowPast && ! this.settings.allowFuture) {
72 | throw 'timeago allowPast and allowFuture settings can not both be set to false.';
73 | }
74 |
75 | var $l = this.settings.strings;
76 | var prefix = $l.prefixAgo;
77 | var suffix = $l.suffixAgo;
78 | if (this.settings.allowFuture) {
79 | if (distanceMillis < 0) {
80 | prefix = $l.prefixFromNow;
81 | suffix = $l.suffixFromNow;
82 | }
83 | }
84 |
85 | if(!this.settings.allowPast && distanceMillis >= 0) {
86 | return this.settings.strings.inPast;
87 | }
88 |
89 | var seconds = Math.abs(distanceMillis) / 1000;
90 | var minutes = seconds / 60;
91 | var hours = minutes / 60;
92 | var days = hours / 24;
93 | var years = days / 365;
94 |
95 | function substitute(stringOrFunction, number) {
96 | var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
97 | var value = ($l.numbers && $l.numbers[number]) || number;
98 | return string.replace(/%d/i, value);
99 | }
100 |
101 | var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
102 | seconds < 90 && substitute($l.minute, 1) ||
103 | minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
104 | minutes < 90 && substitute($l.hour, 1) ||
105 | hours < 24 && substitute($l.hours, Math.round(hours)) ||
106 | hours < 42 && substitute($l.day, 1) ||
107 | days < 30 && substitute($l.days, Math.round(days)) ||
108 | days < 45 && substitute($l.month, 1) ||
109 | days < 365 && substitute($l.months, Math.round(days / 30)) ||
110 | years < 1.5 && substitute($l.year, 1) ||
111 | substitute($l.years, Math.round(years));
112 |
113 | var separator = $l.wordSeparator || "";
114 | if ($l.wordSeparator === undefined) { separator = " "; }
115 | return $.trim([prefix, words, suffix].join(separator));
116 | },
117 |
118 | parse: function(iso8601) {
119 | var s = $.trim(iso8601);
120 | s = s.replace(/\.\d+/,""); // remove milliseconds
121 | s = s.replace(/-/,"/").replace(/-/,"/");
122 | s = s.replace(/T/," ").replace(/Z/," UTC");
123 | s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
124 | s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900
125 | return new Date(s);
126 | },
127 | datetime: function(elem) {
128 | var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
129 | return $t.parse(iso8601);
130 | },
131 | isTime: function(elem) {
132 | // jQuery's `is()` doesn't play well with HTML5 in IE
133 | return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
134 | }
135 | });
136 |
137 | // functions that can be called via $(el).timeago('action')
138 | // init is default when no action is given
139 | // functions are called with context of a single element
140 | var functions = {
141 | init: function(){
142 | var refresh_el = $.proxy(refresh, this);
143 | refresh_el();
144 | var $s = $t.settings;
145 | if ($s.refreshMillis > 0) {
146 | this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
147 | }
148 | },
149 | update: function(time){
150 | var parsedTime = $t.parse(time);
151 | $(this).data('timeago', { datetime: parsedTime });
152 | if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString());
153 | refresh.apply(this);
154 | },
155 | updateFromDOM: function(){
156 | $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) });
157 | refresh.apply(this);
158 | },
159 | dispose: function () {
160 | if (this._timeagoInterval) {
161 | window.clearInterval(this._timeagoInterval);
162 | this._timeagoInterval = null;
163 | }
164 | }
165 | };
166 |
167 | $.fn.timeago = function(action, options) {
168 | var fn = action ? functions[action] : functions.init;
169 | if(!fn){
170 | throw new Error("Unknown function name '"+ action +"' for timeago");
171 | }
172 | // each over objects here and call the requested function
173 | this.each(function(){
174 | fn.call(this, options);
175 | });
176 | return this;
177 | };
178 |
179 | function refresh() {
180 | //check if it's still visible
181 | if(!$.contains(document.documentElement,this)){
182 | //stop if it has been removed
183 | $(this).timeago("dispose");
184 | return this;
185 | }
186 |
187 | var data = prepareData(this);
188 | var $s = $t.settings;
189 |
190 | if (!isNaN(data.datetime)) {
191 | if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
192 | $(this).text(inWords(data.datetime));
193 | }
194 | }
195 | return this;
196 | }
197 |
198 | function prepareData(element) {
199 | element = $(element);
200 | if (!element.data("timeago")) {
201 | element.data("timeago", { datetime: $t.datetime(element) });
202 | var text = $.trim(element.text());
203 | if ($t.settings.localeTitle) {
204 | element.attr("title", element.data('timeago').datetime.toLocaleString());
205 | } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
206 | element.attr("title", text);
207 | }
208 | }
209 | return element.data("timeago");
210 | }
211 |
212 | function inWords(date) {
213 | return $t.inWords(distance(date));
214 | }
215 |
216 | function distance(date) {
217 | return (new Date().getTime() - date.getTime());
218 | }
219 |
220 | // fix for IE6 suckage
221 | document.createElement("abbr");
222 | document.createElement("time");
223 | }));
224 |
--------------------------------------------------------------------------------
/assets/locales/README.md:
--------------------------------------------------------------------------------
1 | # Locale override examples for timeago
2 |
3 | You can represent time statements in most western languages where
4 | a prefix and/or suffix is used.
5 |
6 | The default case is to use suffix only (as in English), which you
7 | do by providing the `suffixAgo` and `suffixFromNow` settings in
8 | the strings hash (earlier versions of timeago used the deprecated
9 | `ago` and `fromNow` options). If present, they are used.
10 |
11 | 2 minutes [suffixAgo]
12 | 2 minutes [suffixFromNow]
13 |
14 | In case you want to use prefix only instead of
15 | suffix (e.g. Greek), you provide the `prefixAgo` and
16 | `prefixFromNow` options in the strings hash and leave `suffixAgo`
17 | and `suffixFromNow` empty or null.
18 |
19 | [prefixAgo] 2 minutes
20 | [prefixFromNow] 2 minutes
21 |
22 | For languages where you want to use a prefix only for future
23 | tense and prefix/suffix for past tense (for example swedish), you
24 | can combine the prefix and suffixes as needed.
25 |
26 | [prefixAgo] 2 minutes [suffixAgo]
27 | [prefixFromNow] 2 minutes
28 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ar.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | function numpf(n, a) {
3 | return a[plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5];
4 | }
5 |
6 | jQuery.timeago.settings.strings = {
7 | prefixAgo: "منذ",
8 | prefixFromNow: "بعد",
9 | suffixAgo: null,
10 | suffixFromNow: null, // null OR "من الآن"
11 | second: function(value) { return numpf(value, [
12 | 'أقل من ثانية',
13 | 'ثانية واحدة',
14 | 'ثانيتين',
15 | '%d ثوانٍ',
16 | '%d ثانية',
17 | '%d ثانية']); },
18 | seconds: function(value) { return numpf(value, [
19 | 'أقل من ثانية',
20 | 'ثانية واحدة',
21 | 'ثانيتين',
22 | '%d ثوانٍ',
23 | '%d ثانية',
24 | '%d ثانية']); },
25 | minute: function(value) { return numpf(value, [
26 | 'أقل من دقيقة',
27 | 'دقيقة واحدة',
28 | 'دقيقتين',
29 | '%d دقائق',
30 | '%d دقيقة',
31 | 'دقيقة']); },
32 | minutes: function(value) { return numpf(value, [
33 | 'أقل من دقيقة',
34 | 'دقيقة واحدة',
35 | 'دقيقتين',
36 | '%d دقائق',
37 | '%d دقيقة',
38 | 'دقيقة']); },
39 | hour: function(value) { return numpf(value, [
40 | 'أقل من ساعة',
41 | 'ساعة واحدة',
42 | 'ساعتين',
43 | '%d ساعات',
44 | '%d ساعة',
45 | '%d ساعة']); },
46 | hours: function(value) { return numpf(value, [
47 | 'أقل من ساعة',
48 | 'ساعة واحدة',
49 | 'ساعتين',
50 | '%d ساعات',
51 | '%d ساعة',
52 | '%d ساعة']); },
53 | day: function(value) { return numpf(value, [
54 | 'أقل من يوم',
55 | 'يوم واحد',
56 | 'يومين',
57 | '%d أيام',
58 | '%d يومًا',
59 | '%d يوم']); },
60 | days: function(value) { return numpf(value, [
61 | 'أقل من يوم',
62 | 'يوم واحد',
63 | 'يومين',
64 | '%d أيام',
65 | '%d يومًا',
66 | '%d يوم']); },
67 | month: function(value) { return numpf(value, [
68 | 'أقل من شهر',
69 | 'شهر واحد',
70 | 'شهرين',
71 | '%d أشهر',
72 | '%d شهرًا',
73 | '%d شهر']); },
74 | months: function(value) { return numpf(value, [
75 | 'أقل من شهر',
76 | 'شهر واحد',
77 | 'شهرين',
78 | '%d أشهر',
79 | '%d شهرًا',
80 | '%d شهر']); },
81 | year: function(value) { return numpf(value, [
82 | 'أقل من عام',
83 | 'عام واحد',
84 | '%d عامين',
85 | '%d أعوام',
86 | '%d عامًا']);
87 | },
88 | years: function(value) { return numpf(value, [
89 | 'أقل من عام',
90 | 'عام واحد',
91 | 'عامين',
92 | '%d أعوام',
93 | '%d عامًا',
94 | '%d عام']);}
95 | };
96 | })();
97 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.bg.js:
--------------------------------------------------------------------------------
1 | // Bulgarian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "преди",
4 | prefixFromNow: "след",
5 | suffixAgo: null,
6 | suffixFromNow: null,
7 | seconds: "по-малко от минута",
8 | minute: "една минута",
9 | minutes: "%d минути",
10 | hour: "един час",
11 | hours: "%d часа",
12 | day: "един ден",
13 | days: "%d дни",
14 | month: "един месец",
15 | months: "%d месеца",
16 | year: "една година",
17 | years: "%d години"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.bs.js:
--------------------------------------------------------------------------------
1 | // Bosnian
2 | (function() {
3 | var numpf;
4 |
5 | numpf = function(n, f, s, t) {
6 | var n10;
7 | n10 = n % 10;
8 | if (n10 === 1 && (n === 1 || n > 20)) {
9 | return f;
10 | } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
11 | return s;
12 | } else {
13 | return t;
14 | }
15 | };
16 |
17 | jQuery.timeago.settings.strings = {
18 | prefixAgo: "prije",
19 | prefixFromNow: "za",
20 | suffixAgo: null,
21 | suffixFromNow: null,
22 | second: "sekund",
23 | seconds: function(value) {
24 | return numpf(value, "%d sekund", "%d sekunde", "%d sekundi");
25 | },
26 | minute: "oko minut",
27 | minutes: function(value) {
28 | return numpf(value, "%d minut", "%d minute", "%d minuta");
29 | },
30 | hour: "oko sat",
31 | hours: function(value) {
32 | return numpf(value, "%d sat", "%d sata", "%d sati");
33 | },
34 | day: "oko jednog dana",
35 | days: function(value) {
36 | return numpf(value, "%d dan", "%d dana", "%d dana");
37 | },
38 | month: "mjesec dana",
39 | months: function(value) {
40 | return numpf(value, "%d mjesec", "%d mjeseca", "%d mjeseci");
41 | },
42 | year: "prije godinu dana ",
43 | years: function(value) {
44 | return numpf(value, "%d godinu", "%d godine", "%d godina");
45 | },
46 | wordSeparator: " "
47 | };
48 |
49 | }).call(this);
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ca.js:
--------------------------------------------------------------------------------
1 | // Catalan
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "fa",
4 | prefixFromNow: "d'aqui a",
5 | suffixAgo: null,
6 | suffixFromNow: null,
7 | seconds: "menys d'1 minut",
8 | minute: "1 minut",
9 | minutes: "uns %d minuts",
10 | hour: "1 hora",
11 | hours: "unes %d hores",
12 | day: "1 dia",
13 | days: "%d dies",
14 | month: "aproximadament un mes",
15 | months: "%d mesos",
16 | year: "aproximadament un any",
17 | years: "%d anys"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.cs.js:
--------------------------------------------------------------------------------
1 | // Czech
2 | (function() {
3 | function f(n, d, a) {
4 | return a[d>=0 ? 0 : a.length==2 || n<5 ? 1 : 2];
5 | }
6 |
7 | jQuery.timeago.settings.strings = {
8 | prefixAgo: 'před',
9 | prefixFromNow: 'za',
10 | suffixAgo: null,
11 | suffixFromNow: null,
12 | seconds: function(n, d) {return f(n, d, ['méně než minutou', 'méně než minutu']);},
13 | minute: function(n, d) {return f(n, d, ['minutou', 'minutu']);},
14 | minutes: function(n, d) {return f(n, d, ['%d minutami', '%d minuty', '%d minut']);},
15 | hour: function(n, d) {return f(n, d, ['hodinou', 'hodinu']);},
16 | hours: function(n, d) {return f(n, d, ['%d hodinami', '%d hodiny', '%d hodin']);},
17 | day: function(n, d) {return f(n, d, ['%d dnem', '%d den']);},
18 | days: function(n, d) {return f(n, d, ['%d dny', '%d dny', '%d dní']);},
19 | month: function(n, d) {return f(n, d, ['%d měsícem', '%d měsíc']);},
20 | months: function(n, d) {return f(n, d, ['%d měsíci', '%d měsíce', '%d měsíců']);},
21 | year: function(n, d) {return f(n, d, ['%d rokem', '%d rok']);},
22 | years: function(n, d) {return f(n, d, ['%d lety', '%d roky', '%d let']);}
23 | };
24 | })();
25 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.cy.js:
--------------------------------------------------------------------------------
1 | // Welsh
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "yn ôl",
6 | suffixFromNow: "o hyn",
7 | seconds: "llai na munud",
8 | minute: "am funud",
9 | minutes: "%d munud",
10 | hour: "tua awr",
11 | hours: "am %d awr",
12 | day: "y dydd",
13 | days: "%d diwrnod",
14 | month: "tua mis",
15 | months: "%d mis",
16 | year: "am y flwyddyn",
17 | years: "%d blynedd",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.da.js:
--------------------------------------------------------------------------------
1 | // Danish
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "for",
4 | prefixFromNow: "om",
5 | suffixAgo: "siden",
6 | suffixFromNow: "",
7 | seconds: "mindre end et minut",
8 | minute: "ca. et minut",
9 | minutes: "%d minutter",
10 | hour: "ca. en time",
11 | hours: "ca. %d timer",
12 | day: "en dag",
13 | days: "%d dage",
14 | month: "ca. en måned",
15 | months: "%d måneder",
16 | year: "ca. et år",
17 | years: "%d år"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.de.js:
--------------------------------------------------------------------------------
1 | // German
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "vor",
4 | prefixFromNow: "in",
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "wenigen Sekunden",
8 | minute: "etwa einer Minute",
9 | minutes: "%d Minuten",
10 | hour: "etwa einer Stunde",
11 | hours: "%d Stunden",
12 | day: "etwa einem Tag",
13 | days: "%d Tagen",
14 | month: "etwa einem Monat",
15 | months: "%d Monaten",
16 | year: "etwa einem Jahr",
17 | years: "%d Jahren"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.dv.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Dhivehi time in Thaana for timeago.js
3 | **/
4 | jQuery.timeago.settings.strings = {
5 | prefixAgo: null,
6 | prefixFromNow: null,
7 | suffixAgo: "ކުރިން",
8 | suffixFromNow: "ފަހުން",
9 | seconds: "ސިކުންތުކޮޅެއް",
10 | minute: "މިނިޓެއްވަރު",
11 | minutes: "%d މިނިޓު",
12 | hour: "ގަޑިއެއްވަރު",
13 | hours: "ގާތްގަނޑަކަށް %d ގަޑިއިރު",
14 | day: "އެއް ދުވަސް",
15 | days: "މީގެ %d ދުވަސް",
16 | month: "މަހެއްވަރު",
17 | months: "މީގެ %d މަސް",
18 | year: "އަހަރެއްވަރު",
19 | years: "މީގެ %d އަހަރު",
20 | wordSeparator: " ",
21 | numbers: []
22 | };
23 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.el.js:
--------------------------------------------------------------------------------
1 | // Greek
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "πριν",
4 | prefixFromNow: "σε",
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "λιγότερο από ένα λεπτό",
8 | minute: "περίπου ένα λεπτό",
9 | minutes: "%d λεπτά",
10 | hour: "περίπου μία ώρα",
11 | hours: "περίπου %d ώρες",
12 | day: "μία μέρα",
13 | days: "%d μέρες",
14 | month: "περίπου ένα μήνα",
15 | months: "%d μήνες",
16 | year: "περίπου ένα χρόνο",
17 | years: "%d χρόνια"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.en-short.js:
--------------------------------------------------------------------------------
1 | // English shortened
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "1m",
8 | minute: "1m",
9 | minutes: "%dm",
10 | hour: "1h",
11 | hours: "%dh",
12 | day: "1d",
13 | days: "%dd",
14 | month: "1mo",
15 | months: "%dmo",
16 | year: "1yr",
17 | years: "%dyr",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.en.js:
--------------------------------------------------------------------------------
1 | // English (Template)
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "ago",
6 | suffixFromNow: "from now",
7 | seconds: "less than a minute",
8 | minute: "about a minute",
9 | minutes: "%d minutes",
10 | hour: "about an hour",
11 | hours: "about %d hours",
12 | day: "a day",
13 | days: "%d days",
14 | month: "about a month",
15 | months: "%d months",
16 | year: "about a year",
17 | years: "%d years",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.es-short.js:
--------------------------------------------------------------------------------
1 | // Spanish shortened
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "1m",
8 | minute: "1m",
9 | minutes: "%dm",
10 | hour: "1h",
11 | hours: "%dh",
12 | day: "1d",
13 | days: "%dd",
14 | month: "1me",
15 | months: "%dme",
16 | year: "1a",
17 | years: "%da",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.es.js:
--------------------------------------------------------------------------------
1 | // Spanish
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "hace",
4 | prefixFromNow: "dentro de",
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "menos de un minuto",
8 | minute: "un minuto",
9 | minutes: "unos %d minutos",
10 | hour: "una hora",
11 | hours: "%d horas",
12 | day: "un día",
13 | days: "%d días",
14 | month: "un mes",
15 | months: "%d meses",
16 | year: "un año",
17 | years: "%d años"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.et.js:
--------------------------------------------------------------------------------
1 | // Estonian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "tagasi",
6 | suffixFromNow: "pärast",
7 | seconds: function(n, d) { return d < 0 ? "vähem kui minuti aja" : "vähem kui minut aega"; },
8 | minute: function(n, d) { return d < 0 ? "umbes minuti aja" : "umbes minut aega"; },
9 | minutes: function(n, d) { return d < 0 ? "%d minuti" : "%d minutit"; },
10 | hour: function(n, d) { return d < 0 ? "umbes tunni aja" : "umbes tund aega"; },
11 | hours: function(n, d) { return d < 0 ? "%d tunni" : "%d tundi"; },
12 | day: function(n, d) { return d < 0 ? "umbes päeva" : "umbes päev"; },
13 | days: function(n, d) { return d < 0 ? "%d päeva" : "%d päeva"; },
14 | month: function(n, d) { return d < 0 ? "umbes kuu aja" : "umbes kuu aega"; },
15 | months: function(n, d) { return d < 0 ? "%d kuu" : "%d kuud"; },
16 | year: function(n, d) { return d < 0 ? "umbes aasta aja" : "umbes aasta aega"; },
17 | years: function(n, d) { return d < 0 ? "%d aasta" : "%d aastat"; }
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.fa.js:
--------------------------------------------------------------------------------
1 |
2 | // Persian
3 | // Use DIR attribute for RTL text in Persian Language for ABBR tag .
4 | // By MB.seifollahi@gmail.com
5 | jQuery.timeago.settings.strings = {
6 | prefixAgo: null,
7 | prefixFromNow: null,
8 | suffixAgo: "پیش",
9 | suffixFromNow: "از حال",
10 | seconds: "کمتر از یک دقیقه",
11 | minute: "حدود یک دقیقه",
12 | minutes: "%d دقیقه",
13 | hour: "حدود یک ساعت",
14 | hours: "حدود %d ساعت",
15 | day: "یک روز",
16 | days: "%d روز",
17 | month: "حدود یک ماه",
18 | months: "%d ماه",
19 | year: "حدود یک سال",
20 | years: "%d سال",
21 | wordSeparator: " "
22 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.fi.js:
--------------------------------------------------------------------------------
1 | // Finnish
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "sitten",
6 | suffixFromNow: "tulevaisuudessa",
7 | seconds: "alle minuutti",
8 | minute: "minuutti",
9 | minutes: "%d minuuttia",
10 | hour: "tunti",
11 | hours: "%d tuntia",
12 | day: "päivä",
13 | days: "%d päivää",
14 | month: "kuukausi",
15 | months: "%d kuukautta",
16 | year: "vuosi",
17 | years: "%d vuotta"
18 | };
19 |
20 | // The above is not a great localization because one would usually
21 | // write "2 days ago" in Finnish as "2 päivää sitten", however
22 | // one would write "2 days into the future" as "2:n päivän päästä"
23 | // which cannot be achieved with localization support this simple.
24 | // This is because Finnish has word suffixes (attached directly
25 | // to the end of the word). The word "day" is "päivä" in Finnish.
26 | // As workaround, the above localizations will say
27 | // "2 päivää tulevaisuudessa" which is understandable but
28 | // not as fluent.
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.fr-short.js:
--------------------------------------------------------------------------------
1 | // French shortened
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "il y a",
4 | prefixFromNow: "d'ici",
5 | seconds: "moins d'une minute",
6 | minute: "une minute",
7 | minutes: "%d minutes",
8 | hour: "une heure",
9 | hours: "%d heures",
10 | day: "un jour",
11 | days: "%d jours",
12 | month: "un mois",
13 | months: "%d mois",
14 | year: "un an",
15 | years: "%d ans"
16 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.fr.js:
--------------------------------------------------------------------------------
1 | // French
2 | jQuery.timeago.settings.strings = {
3 | // environ ~= about, it's optional
4 | prefixAgo: "il y a",
5 | prefixFromNow: "d'ici",
6 | seconds: "moins d'une minute",
7 | minute: "environ une minute",
8 | minutes: "environ %d minutes",
9 | hour: "environ une heure",
10 | hours: "environ %d heures",
11 | day: "environ un jour",
12 | days: "environ %d jours",
13 | month: "environ un mois",
14 | months: "environ %d mois",
15 | year: "un an",
16 | years: "%d ans"
17 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.gl.js:
--------------------------------------------------------------------------------
1 | // Galician
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "hai",
4 | prefixFromNow: "dentro de",
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "menos dun minuto",
8 | minute: "un minuto",
9 | minutes: "uns %d minutos",
10 | hour: "unha hora",
11 | hours: "%d horas",
12 | day: "un día",
13 | days: "%d días",
14 | month: "un mes",
15 | months: "%d meses",
16 | year: "un ano",
17 | years: "%d anos"
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.he.js:
--------------------------------------------------------------------------------
1 | // Hebrew
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "לפני",
4 | prefixFromNow: "עוד",
5 | seconds: "פחות מדקה",
6 | minute: "דקה",
7 | minutes: "%d דקות",
8 | hour: "שעה",
9 | hours: function(number){return (number==2) ? "שעתיים" : "%d שעות";},
10 | day: "יום",
11 | days: function(number){return (number==2) ? "יומיים" : "%d ימים";},
12 | month: "חודש",
13 | months: function(number){return (number==2) ? "חודשיים" : "%d חודשים";},
14 | year: "שנה",
15 | years: function(number){return (number==2) ? "שנתיים" : "%d שנים";}
16 | };
17 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.hr.js:
--------------------------------------------------------------------------------
1 | // Croatian
2 | (function () {
3 | var numpf;
4 |
5 | numpf = function (n, f, s, t) {
6 | var n10;
7 | n10 = n % 10;
8 | if (n10 === 1 && (n === 1 || n > 20)) {
9 | return f;
10 | } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
11 | return s;
12 | } else {
13 | return t;
14 | }
15 | };
16 |
17 | jQuery.timeago.settings.strings = {
18 | prefixAgo: "prije",
19 | prefixFromNow: "za",
20 | suffixAgo: null,
21 | suffixFromNow: null,
22 | second: "sekundu",
23 | seconds: function (value) {
24 | return numpf(value, "%d sekundu", "%d sekunde", "%d sekundi");
25 | },
26 | minute: "oko minutu",
27 | minutes: function (value) {
28 | return numpf(value, "%d minutu", "%d minute", "%d minuta");
29 | },
30 | hour: "oko jedan sat",
31 | hours: function (value) {
32 | return numpf(value, "%d sat", "%d sata", "%d sati");
33 | },
34 | day: "jedan dan",
35 | days: function (value) {
36 | return numpf(value, "%d dan", "%d dana", "%d dana");
37 | },
38 | month: "mjesec dana",
39 | months: function (value) {
40 | return numpf(value, "%d mjesec", "%d mjeseca", "%d mjeseci");
41 | },
42 | year: "prije godinu dana",
43 | years: function (value) {
44 | return numpf(value, "%d godinu", "%d godine", "%d godina");
45 | },
46 | wordSeparator: " "
47 | };
48 |
49 | }).call(this);
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.hu.js:
--------------------------------------------------------------------------------
1 | // Hungarian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: null,
6 | suffixFromNow: null,
7 | seconds: "kevesebb mint egy perce",
8 | minute: "körülbelül egy perce",
9 | minutes: "%d perce",
10 | hour: "körülbelül egy órája",
11 | hours: "körülbelül %d órája",
12 | day: "körülbelül egy napja",
13 | days: "%d napja",
14 | month: "körülbelül egy hónapja",
15 | months: "%d hónapja",
16 | year: "körülbelül egy éve",
17 | years: "%d éve"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.hy.js:
--------------------------------------------------------------------------------
1 | // Armenian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "առաջ",
6 | suffixFromNow: "հետո",
7 | seconds: "վայրկյաններ",
8 | minute: "մեկ րոպե",
9 | minutes: "%d րոպե",
10 | hour: "մեկ ժամ",
11 | hours: "%d ժամ",
12 | day: "մեկ օր",
13 | days: "%d օր",
14 | month: "մեկ ամիս",
15 | months: "%d ամիս",
16 | year: "մեկ տարի",
17 | years: "%d տարի"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.id.js:
--------------------------------------------------------------------------------
1 | // Indonesian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "yang lalu",
6 | suffixFromNow: "dari sekarang",
7 | seconds: "kurang dari semenit",
8 | minute: "sekitar satu menit",
9 | minutes: "%d menit",
10 | hour: "sekitar sejam",
11 | hours: "sekitar %d jam",
12 | day: "sehari",
13 | days: "%d hari",
14 | month: "sekitar sebulan",
15 | months: "%d bulan",
16 | year: "sekitar setahun",
17 | years: "%d tahun"
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.is.js:
--------------------------------------------------------------------------------
1 | jQuery.timeago.settings.strings = {
2 | prefixAgo: "fyrir",
3 | prefixFromNow: "eftir",
4 | suffixAgo: "síðan",
5 | suffixFromNow: null,
6 | seconds: "minna en mínútu",
7 | minute: "mínútu",
8 | minutes: "%d mínútum",
9 | hour: "klukkutíma",
10 | hours: "um %d klukkutímum",
11 | day: "degi",
12 | days: "%d dögum",
13 | month: "mánuði",
14 | months: "%d mánuðum",
15 | year: "ári",
16 | years: "%d árum",
17 | wordSeparator: " ",
18 | numbers: []
19 | };
20 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.it-short.js:
--------------------------------------------------------------------------------
1 | // Italian shortened
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "1m",
8 | minute: "1m",
9 | minutes: "%dm",
10 | hour: "1h",
11 | hours: "%dh",
12 | day: "1g",
13 | days: "%dg",
14 | month: "1me",
15 | months: "%dme",
16 | year: "1a",
17 | years: "%da",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.it.js:
--------------------------------------------------------------------------------
1 | // Italian
2 | jQuery.timeago.settings.strings = {
3 | suffixAgo: "fa",
4 | suffixFromNow: "da ora",
5 | seconds: "meno di un minuto",
6 | minute: "circa un minuto",
7 | minutes: "%d minuti",
8 | hour: "circa un'ora",
9 | hours: "circa %d ore",
10 | day: "un giorno",
11 | days: "%d giorni",
12 | month: "circa un mese",
13 | months: "%d mesi",
14 | year: "circa un anno",
15 | years: "%d anni"
16 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ja.js:
--------------------------------------------------------------------------------
1 | // Japanese
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "",
4 | prefixFromNow: "今から",
5 | suffixAgo: "前",
6 | suffixFromNow: "後",
7 | seconds: "1 分未満",
8 | minute: "約 1 分",
9 | minutes: "%d 分",
10 | hour: "約 1 時間",
11 | hours: "約 %d 時間",
12 | day: "約 1 日",
13 | days: "約 %d 日",
14 | month: "約 1 月",
15 | months: "約 %d 月",
16 | year: "約 1 年",
17 | years: "約 %d 年",
18 | wordSeparator: ""
19 | };
20 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.jv.js:
--------------------------------------------------------------------------------
1 | // Javanesse (Boso Jowo)
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "kepungkur",
6 | suffixFromNow: "seko saiki",
7 | seconds: "kurang seko sakmenit",
8 | minute: "kurang luwih sakmenit",
9 | minutes: "%d menit",
10 | hour: "kurang luwih sakjam",
11 | hours: "kurang luwih %d jam",
12 | day: "sedina",
13 | days: "%d dina",
14 | month: "kurang luwih sewulan",
15 | months: "%d wulan",
16 | year: "kurang luwih setahun",
17 | years: "%d tahun"
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ko.js:
--------------------------------------------------------------------------------
1 | // Korean
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "전",
6 | suffixFromNow: "후",
7 | seconds: "1분",
8 | minute: "약 1분",
9 | minutes: "%d분",
10 | hour: "약 1시간",
11 | hours: "약 %d시간",
12 | day: "하루",
13 | days: "%d일",
14 | month: "약 1개월",
15 | months: "%d개월",
16 | year: "약 1년",
17 | years: "%d년",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ky.js:
--------------------------------------------------------------------------------
1 | // Russian
2 | (function() {
3 | function numpf(n, f, s, t) {
4 | // f - 1, 21, 31, ...
5 | // s - 2-4, 22-24, 32-34 ...
6 | // t - 5-20, 25-30, ...
7 | var n10 = n % 10;
8 | if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
9 | return f;
10 | } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
11 | return s;
12 | } else {
13 | return t;
14 | }
15 | }
16 |
17 | jQuery.timeago.settings.strings = {
18 | prefixAgo: null,
19 | prefixFromNow: "через",
20 | suffixAgo: "мурун",
21 | suffixFromNow: null,
22 | seconds: "1 минуттан аз",
23 | minute: "минута",
24 | minutes: function(value) { return numpf(value, "%d минута", "%d минута", "%d минут"); },
25 | hour: "саат",
26 | hours: function(value) { return numpf(value, "%d саат", "%d саат", "%d саат"); },
27 | day: "күн",
28 | days: function(value) { return numpf(value, "%d күн", "%d күн", "%d күн"); },
29 | month: "ай",
30 | months: function(value) { return numpf(value, "%d ай", "%d ай", "%d ай"); },
31 | year: "жыл",
32 | years: function(value) { return numpf(value, "%d жыл", "%d жыл", "%d жыл"); }
33 | };
34 | })();
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.lt.js:
--------------------------------------------------------------------------------
1 | //Lithuanian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "prieš",
4 | prefixFromNow: null,
5 | suffixAgo: null,
6 | suffixFromNow: "nuo dabar",
7 | seconds: "%d sek.",
8 | minute: "min.",
9 | minutes: "%d min.",
10 | hour: "val.",
11 | hours: "%d val.",
12 | day: "1 d.",
13 | days: "%d d.",
14 | month: "mėn.",
15 | months: "%d mėn.",
16 | year: "metus",
17 | years: "%d metus",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.mk.js:
--------------------------------------------------------------------------------
1 | // Macedonian
2 | (function() {
3 | jQuery.timeago.settings.strings={
4 | prefixAgo: "пред",
5 | prefixFromNow: "за",
6 | suffixAgo: null,
7 | suffixFromNow: null,
8 | seconds: "%d секунди",
9 | minute: "%d минута",
10 | minutes: "%d минути",
11 | hour: "%d час",
12 | hours: "%d часа",
13 | day: "%d ден",
14 | days: "%d денови" ,
15 | month: "%d месец",
16 | months: "%d месеци",
17 | year: "%d година",
18 | years: "%d години"
19 | };
20 | })();
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.nl.js:
--------------------------------------------------------------------------------
1 | // Dutch
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: "over",
5 | suffixAgo: "geleden",
6 | suffixFromNow: null,
7 | seconds: "minder dan een minuut",
8 | minute: "ongeveer een minuut",
9 | minutes: "%d minuten",
10 | hour: "ongeveer een uur",
11 | hours: "ongeveer %d uur",
12 | day: "een dag",
13 | days: "%d dagen",
14 | month: "ongeveer een maand",
15 | months: "%d maanden",
16 | year: "ongeveer een jaar",
17 | years: "%d jaar",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.no.js:
--------------------------------------------------------------------------------
1 | // Norwegian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "for",
4 | prefixFromNow: "om",
5 | suffixAgo: "siden",
6 | suffixFromNow: "",
7 | seconds: "mindre enn et minutt",
8 | minute: "ca. et minutt",
9 | minutes: "%d minutter",
10 | hour: "ca. en time",
11 | hours: "ca. %d timer",
12 | day: "en dag",
13 | days: "%d dager",
14 | month: "ca. en måned",
15 | months: "%d måneder",
16 | year: "ca. et år",
17 | years: "%d år"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.pl.js:
--------------------------------------------------------------------------------
1 | // Polish
2 | (function() {
3 | function numpf(n, s, t) {
4 | // s - 2-4, 22-24, 32-34 ...
5 | // t - 5-21, 25-31, ...
6 | var n10 = n % 10;
7 | if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
8 | return s;
9 | } else {
10 | return t;
11 | }
12 | }
13 |
14 | jQuery.timeago.settings.strings = {
15 | prefixAgo: null,
16 | prefixFromNow: "za",
17 | suffixAgo: "temu",
18 | suffixFromNow: null,
19 | seconds: "mniej niż minutę",
20 | minute: "minutę",
21 | minutes: function(value) { return numpf(value, "%d minuty", "%d minut"); },
22 | hour: "godzinę",
23 | hours: function(value) { return numpf(value, "%d godziny", "%d godzin"); },
24 | day: "dzień",
25 | days: "%d dni",
26 | month: "miesiąc",
27 | months: function(value) { return numpf(value, "%d miesiące", "%d miesięcy"); },
28 | year: "rok",
29 | years: function(value) { return numpf(value, "%d lata", "%d lat"); }
30 | };
31 | })();
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.pt-br-short.js:
--------------------------------------------------------------------------------
1 | // Portuguese Brasil shortened
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "1m",
8 | minute: "1m",
9 | minutes: "%dm",
10 | hour: "1h",
11 | hours: "%dh",
12 | day: "1d",
13 | days: "%dd",
14 | month: "1M",
15 | months: "%dM",
16 | year: "1a",
17 | years: "%da",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.pt-br.js:
--------------------------------------------------------------------------------
1 | // Brazilian Portuguese
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "há",
4 | prefixFromNow: "em",
5 | suffixAgo: null,
6 | suffixFromNow: null,
7 | seconds: "alguns segundos",
8 | minute: "um minuto",
9 | minutes: "%d minutos",
10 | hour: "uma hora",
11 | hours: "%d horas",
12 | day: "um dia",
13 | days: "%d dias",
14 | month: "um mês",
15 | months: "%d meses",
16 | year: "um ano",
17 | years: "%d anos"
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.pt.js:
--------------------------------------------------------------------------------
1 | // Portuguese
2 | jQuery.timeago.settings.strings = {
3 | suffixAgo: "atrás",
4 | suffixFromNow: "a partir de agora",
5 | seconds: "menos de um minuto",
6 | minute: "cerca de um minuto",
7 | minutes: "%d minutos",
8 | hour: "cerca de uma hora",
9 | hours: "cerca de %d horas",
10 | day: "um dia",
11 | days: "%d dias",
12 | month: "cerca de um mês",
13 | months: "%d meses",
14 | year: "cerca de um ano",
15 | years: "%d anos"
16 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ro.js:
--------------------------------------------------------------------------------
1 | // Romanian
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "acum",
4 | prefixFromNow: "in timp de",
5 | suffixAgo: "",
6 | suffixFromNow: "",
7 | seconds: "mai putin de un minut",
8 | minute: "un minut",
9 | minutes: "%d minute",
10 | hour: "o ora",
11 | hours: "%d ore",
12 | day: "o zi",
13 | days: "%d zile",
14 | month: "o luna",
15 | months: "%d luni",
16 | year: "un an",
17 | years: "%d ani"
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.rs.js:
--------------------------------------------------------------------------------
1 | // Serbian
2 | (function () {
3 | var numpf;
4 |
5 | numpf = function (n, f, s, t) {
6 | var n10;
7 | n10 = n % 10;
8 | if (n10 === 1 && (n === 1 || n > 20)) {
9 | return f;
10 | } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
11 | return s;
12 | } else {
13 | return t;
14 | }
15 | };
16 |
17 | jQuery.timeago.settings.strings = {
18 | prefixAgo: "pre",
19 | prefixFromNow: "za",
20 | suffixAgo: null,
21 | suffixFromNow: null,
22 | second: "sekund",
23 | seconds: function (value) {
24 | return numpf(value, "%d sekund", "%d sekunde", "%d sekundi");
25 | },
26 | minute: "oko minut",
27 | minutes: function (value) {
28 | return numpf(value, "%d minut", "%d minuta", "%d minuta");
29 | },
30 | hour: "oko jedan sat",
31 | hours: function (value) {
32 | return numpf(value, "%d sat", "%d sata", "%d sati");
33 | },
34 | day: "jedan dan",
35 | days: function (value) {
36 | return numpf(value, "%d dan", "%d dana", "%d dana");
37 | },
38 | month: "mesec dana",
39 | months: function (value) {
40 | return numpf(value, "%d mesec", "%d meseca", "%d meseci");
41 | },
42 | year: "godinu dana",
43 | years: function (value) {
44 | return numpf(value, "%d godinu", "%d godine", "%d godina");
45 | },
46 | wordSeparator: " "
47 | };
48 |
49 | }).call(this);
50 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.ru.js:
--------------------------------------------------------------------------------
1 | // Russian
2 | (function() {
3 | function numpf(n, f, s, t) {
4 | // f - 1, 21, 31, ...
5 | // s - 2-4, 22-24, 32-34 ...
6 | // t - 5-20, 25-30, ...
7 | var n10 = n % 10;
8 | if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
9 | return f;
10 | } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
11 | return s;
12 | } else {
13 | return t;
14 | }
15 | }
16 |
17 | jQuery.timeago.settings.strings = {
18 | prefixAgo: null,
19 | prefixFromNow: "через",
20 | suffixAgo: "назад",
21 | suffixFromNow: null,
22 | seconds: "меньше минуты",
23 | minute: "минуту",
24 | minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); },
25 | hour: "час",
26 | hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); },
27 | day: "день",
28 | days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); },
29 | month: "месяц",
30 | months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); },
31 | year: "год",
32 | years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); }
33 | };
34 | })();
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.rw.js:
--------------------------------------------------------------------------------
1 | // Kinyarwanda
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "hashize",
4 | prefixFromNow: "mu",
5 | suffixAgo: null,
6 | suffixFromNow: null,
7 | seconds: "amasegonda macye",
8 | minute: "umunota",
9 | minutes: "iminota %d",
10 | hour: "isaha",
11 | hours: "amasaha %d",
12 | day: "umunsi",
13 | days: "iminsi %d",
14 | month: "ukwezi",
15 | months: "amezi %d",
16 | year: "umwaka",
17 | years: "imyaka %d",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.si.js:
--------------------------------------------------------------------------------
1 | // Sinhalese (SI)
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "පෙර",
6 | suffixFromNow: "පසුව",
7 | seconds: "තත්පර කිහිපයකට",
8 | minute: "මිනිත්තුවකට පමණ",
9 | minutes: "මිනිත්තු %d කට",
10 | hour: "පැයක් පමණ ",
11 | hours: "පැය %d කට පමණ",
12 | day: "දවසක ට",
13 | days: "දවස් %d කට ",
14 | month: "මාසයක් පමණ",
15 | months: "මාස %d කට",
16 | year: "වසරක් පමණ",
17 | years: "වසරක් %d කට පමණ"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.sk.js:
--------------------------------------------------------------------------------
1 | // Slovak
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "pred",
4 | prefixFromNow: null,
5 | suffixAgo: null,
6 | suffixFromNow: null,
7 | seconds: "menej než minútou",
8 | minute: "minútou",
9 | minutes: "%d minútami",
10 | hour: "hodinou",
11 | hours: "%d hodinami",
12 | day: "1 dňom",
13 | days: "%d dňami",
14 | month: "1 mesiacom",
15 | months: "%d mesiacmi",
16 | year: "1 rokom",
17 | years: "%d rokmi"
18 | };
19 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.sl.js:
--------------------------------------------------------------------------------
1 | // Slovenian with support for dual
2 | (function () {
3 | var numpf;
4 | numpf = function (n, a) {
5 | return a[n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0];
6 | };
7 |
8 | jQuery.timeago.settings.strings = {
9 | prefixAgo: null,
10 | prefixFromNow: "čez",
11 | suffixAgo: "nazaj",
12 | suffixFromNow: null,
13 | second: "sekundo",
14 | seconds: function (value) {
15 | return numpf(value, ["%d sekund", "%d sekundo", "%d sekundi", "%d sekunde"]);
16 | },
17 | minute: "minuto",
18 | minutes: function (value) {
19 | return numpf(value, ["%d minut", "%d minuto", "%d minuti", "%d minute"]);
20 | },
21 | hour: "eno uro",
22 | hours: function (value) {
23 | return numpf(value, ["%d ur", "%d uro", "%d uri", "%d ure"]);
24 | },
25 | day: "en dan",
26 | days: function (value) {
27 | return numpf(value, ["%d dni", "%d dan", "%d dneva", "%d dni"]);
28 | },
29 | month: "en mesec",
30 | months: function (value) {
31 | return numpf(value, ["%d mescov", "%d mesec", "%d mesca", "%d mesce"]);
32 | },
33 | year: "eno leto",
34 | years: function (value) {
35 | return numpf(value, ["%d let", "%d leto", "%d leti", "%d leta"]);
36 | },
37 | wordSeparator: " "
38 | };
39 |
40 | }).call(this);
41 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.sv.js:
--------------------------------------------------------------------------------
1 | // Swedish
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: "för",
4 | prefixFromNow: "om",
5 | suffixAgo: "sedan",
6 | suffixFromNow: "",
7 | seconds: "mindre än en minut",
8 | minute: "ungefär en minut",
9 | minutes: "%d minuter",
10 | hour: "ungefär en timme",
11 | hours: "ungefär %d timmar",
12 | day: "en dag",
13 | days: "%d dagar",
14 | month: "ungefär en månad",
15 | months: "%d månader",
16 | year: "ungefär ett år",
17 | years: "%d år"
18 | };
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.th.js:
--------------------------------------------------------------------------------
1 | // Thai
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: null,
5 | suffixAgo: "ที่แล้ว",
6 | suffixFromNow: "จากตอนนี้",
7 | seconds: "น้อยกว่าหนึ่งนาที",
8 | minute: "ประมาณหนึ่งนาที",
9 | minutes: "%d นาที",
10 | hour: "ประมาณหนึ่งชั่วโมง",
11 | hours: "ประมาณ %d ชั่วโมง",
12 | day: "หนึ่งวัน",
13 | days: "%d วัน",
14 | month: "ประมาณหนึ่งเดือน",
15 | months: "%d เดือน",
16 | year: "ประมาณหนึ่งปี",
17 | years: "%d ปี",
18 | wordSeparator: "",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.tr.js:
--------------------------------------------------------------------------------
1 | // Turkish
2 | jQuery.timeago.settings.strings = {
3 | suffixAgo: 'önce',
4 | suffixFromNow: null,
5 | seconds: '1 dakikadan',
6 | minute: '1 dakika',
7 | minutes: '%d dakika',
8 | hour: '1 saat',
9 | hours: '%d saat',
10 | day: '1 gün',
11 | days: '%d gün',
12 | month: '1 ay',
13 | months: '%d ay',
14 | year: '1 yıl',
15 | years: '%d yıl'
16 | };
17 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.uk.js:
--------------------------------------------------------------------------------
1 | // Ukrainian
2 | (function() {
3 | function numpf(n, f, s, t) {
4 | // f - 1, 21, 31, ...
5 | // s - 2-4, 22-24, 32-34 ...
6 | // t - 5-20, 25-30, ...
7 | var n10 = n % 10;
8 | if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
9 | return f;
10 | } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
11 | return s;
12 | } else {
13 | return t;
14 | }
15 | }
16 |
17 | jQuery.timeago.settings.strings = {
18 | prefixAgo: null,
19 | prefixFromNow: "через",
20 | suffixAgo: "тому",
21 | suffixFromNow: null,
22 | seconds: "менше хвилини",
23 | minute: "хвилина",
24 | minutes: function(value) { return numpf(value, "%d хвилина", "%d хвилини", "%d хвилин"); },
25 | hour: "година",
26 | hours: function(value) { return numpf(value, "%d година", "%d години", "%d годин"); },
27 | day: "день",
28 | days: function(value) { return numpf(value, "%d день", "%d дні", "%d днів"); },
29 | month: "місяць",
30 | months: function(value) { return numpf(value, "%d місяць", "%d місяці", "%d місяців"); },
31 | year: "рік",
32 | years: function(value) { return numpf(value, "%d рік", "%d роки", "%d років"); }
33 | };
34 | })();
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.uz.js:
--------------------------------------------------------------------------------
1 | //Uzbek
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: "keyin",
5 | suffixAgo: "avval",
6 | suffixFromNow: null,
7 | seconds: "bir necha soniya",
8 | minute: "1 daqiqa",
9 | minutes: function(value) { return "%d daqiqa"; },
10 | hour: "1 soat",
11 | hours: function(value) { return "%d soat"; },
12 | day: "1 kun",
13 | days: function(value) { return "%d kun"; },
14 | month: "1 oy",
15 | months: function(value) { return "%d oy"; },
16 | year: "1 yil",
17 | years: function(value) { return "%d yil"; },
18 | wordSeparator: " "
19 | };
20 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.vi.js:
--------------------------------------------------------------------------------
1 | // Vietnamese
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: 'cách đây',
4 | prefixFromNow: null,
5 | suffixAgo: null,
6 | suffixFromNow: "trước",
7 | seconds: "chưa đến một phút",
8 | minute: "khoảng một phút",
9 | minutes: "%d phút",
10 | hour: "khoảng một tiếng",
11 | hours: "khoảng %d tiếng",
12 | day: "một ngày",
13 | days: "%d ngày",
14 | month: "khoảng một tháng",
15 | months: "%d tháng",
16 | year: "khoảng một năm",
17 | years: "%d năm",
18 | wordSeparator: " ",
19 | numbers: []
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.zh-CN.js:
--------------------------------------------------------------------------------
1 | // Simplified Chinese
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: "从现在开始",
5 | suffixAgo: "之前",
6 | suffixFromNow: null,
7 | seconds: "不到1分钟",
8 | minute: "大约1分钟",
9 | minutes: "%d分钟",
10 | hour: "大约1小时",
11 | hours: "大约%d小时",
12 | day: "1天",
13 | days: "%d天",
14 | month: "大约1个月",
15 | months: "%d月",
16 | year: "大约1年",
17 | years: "%d年",
18 | numbers: [],
19 | wordSeparator: ""
20 | };
21 |
--------------------------------------------------------------------------------
/assets/locales/jquery.timeago.zh-TW.js:
--------------------------------------------------------------------------------
1 | // Traditional Chinese, zh-tw
2 | jQuery.timeago.settings.strings = {
3 | prefixAgo: null,
4 | prefixFromNow: "從現在開始",
5 | suffixAgo: "之前",
6 | suffixFromNow: null,
7 | seconds: "不到1分鐘",
8 | minute: "大約1分鐘",
9 | minutes: "%d分鐘",
10 | hour: "大約1小時",
11 | hours: "%d小時",
12 | day: "大約1天",
13 | days: "%d天",
14 | month: "大約1個月",
15 | months: "%d個月",
16 | year: "大約1年",
17 | years: "%d年",
18 | numbers: [],
19 | wordSeparator: ""
20 | };
21 |
--------------------------------------------------------------------------------
/assets/notifications.css:
--------------------------------------------------------------------------------
1 | .notification {
2 | background: #fefefe;
3 | padding: 2px 5px;
4 | cursor: pointer;
5 | border-bottom: 1px solid #b5b5b5;
6 | }
7 | .notification.notification-danger {
8 | background: #b995a9;
9 | }
10 | .notification.notification-warning {
11 | background: #fcffcd;
12 | }
13 | .notification.notification-success {
14 | background: #00ca6d;
15 | }
16 | .notification .title {
17 | font-weight: bold;
18 | }
19 | .notification .description {
20 | display: none;
21 | }
22 | .notification .timeago {
23 | color: #555;
24 | font-style: italic;
25 | font-size: 12px;
26 | }
27 | .notification .actions .fa {
28 | color: #aaa;
29 | display: block;
30 | font-size: 10px;
31 | margin: 4px 0;
32 | }
33 | .notification .actions .fa:hover {
34 | color: #333;
35 | }
36 |
--------------------------------------------------------------------------------
/assets/notifications.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Notifications
3 | *
4 | * @class
5 | * @param {Object} options Optional configuration options
6 | * @return {Notifications} Notifications main instance
7 | */
8 | var Notifications = (function(options) {
9 |
10 | /**
11 | * The declared UI libraries
12 | *
13 | * Each property of this variable must be an object with the `show` callback
14 | * field defined, and an optional `types` translation map that will be used
15 | * to translate natives types into the used library notification type.
16 | *
17 | * @type Object
18 | */
19 | this.themes = {
20 | /**
21 | * jQuery Growl
22 | * @see https://github.com/ksylvest/jquery-growl
23 | */
24 | growl: {
25 | types: {
26 | success: 'notice'
27 | },
28 | show: function (object) {
29 | $.growl($.extend({
30 | duration: self.opts.delay,
31 | title: object.title,
32 | message: object.description,
33 | url: object.url,
34 | style: getType(object.type),
35 | }, self.opts.options));
36 | }
37 | },
38 |
39 | /**
40 | * Notie
41 | * @see https://jaredreich.com/projects/notie/
42 | */
43 | notie: {
44 | types: {
45 | 'default': 4,
46 | error: 3,
47 | warning: 2,
48 | success: 1
49 | },
50 | show: function (object) {
51 | notie.alert(getType(object.type), object.description, self.opts.delay / 999);
52 | }
53 | },
54 |
55 | /**
56 | * NotifIt!
57 | * @see http://naoxink.hol.es/notifIt/
58 | */
59 | notifit: {
60 | types: {
61 | 'default': 'info'
62 | },
63 | show: function (object) {
64 | notif($.extend({
65 | timeout: self.opts.delay,
66 | clickable: true,
67 | multiline: true,
68 | msg: "" + object.title + "
" + object.description,
69 | type: getType(object.type)
70 | }, self.opts.options));
71 | $("#ui_notifIt").click(function(e) {
72 | document.location = object.url;
73 | });
74 | }
75 | },
76 |
77 | /**
78 | * Notify.js
79 | * @see https://notifyjs.com/
80 | */
81 | notify: {
82 | types: {
83 | warning: 'warn',
84 | 'default': 'info'
85 | },
86 | show: function (object) {
87 | $.notify(object.title, getType(object.type), $.extend({
88 | autoHideDelay: self.opts.delay,
89 | }, self.opts.options));
90 | }
91 | },
92 |
93 | /**
94 | * Noty
95 | * @see http://ned.im/noty/
96 | */
97 | noty: {
98 | types: {
99 | 'default': 'information'
100 | },
101 | show: function (object) {
102 | noty($.extend({
103 | text: object.title,
104 | type: getType(object.type),
105 | dismissQueue: false,
106 | timeout: self.opts.delay,
107 | layout: 'topRight',
108 | theme: 'defaultTheme',
109 | callback: {
110 | onCloseClick: function () {
111 | document.location = object.url;
112 | }
113 | }
114 | }, self.opts.options));
115 | }
116 | },
117 |
118 | /**
119 | * PNotify
120 | * @see http://sciactive.com/pnotify/
121 | */
122 | pnotify: {
123 | types: {
124 | warning: 'notice',
125 | 'default': 'info'
126 | },
127 | show: function (object) {
128 | new PNotify($.extend({
129 | title: object.title,
130 | text: '' + object.description + '',
131 | type: getType(object.type),
132 | delay: self.opts.delay
133 | }, self.opts.options));
134 | }
135 | },
136 |
137 | /**
138 | * Toastr
139 | * @see https://codeseven.github.io/toastr/
140 | */
141 | toastr: {
142 | types: {
143 | 'default': 'info'
144 | },
145 | show: function (object) {
146 | toastr[getType(object.type)](object.description, object.title, $.extend({
147 | timeOut: self.opts.delay,
148 | onclick: function() {
149 | document.location = object.url;
150 | }
151 | }, self.opts.options));
152 | }
153 | }
154 | };
155 |
156 |
157 | var self = this;
158 |
159 | /**
160 | * Options
161 | * @type {Object}
162 | */
163 | this.opts = $.extend({
164 | seenUrl: '', // Overwritten by widget
165 | seenAllUrl: '', // Overwritten by widget
166 | deleteUrl: '', // Overwritten by widget
167 | deleteAllUrl: '', // Overwritten by widget
168 | flashUrl: '',
169 | pollInterval: 5000,
170 | pollSeen: false,
171 | xhrTimeout: 2000,
172 | delay: 5000,
173 | theme: null,
174 | counters: [],
175 | markAllSeenSelector: null,
176 | deleteAllSelector: null,
177 | listSelector: null,
178 | listItemTemplate:
179 | '
' +
180 | '
' +
181 | '
{title}
' +
182 | '
{description}
' +
183 | '
{timeago}
' +
184 | '
' +
185 | '
' +
186 | '
{seen}{delete}
' +
187 | '
' +
188 | '
',
189 | listItemBeforeRender: function (elem) {
190 | return elem;
191 | }
192 | }, options);
193 |
194 | /**
195 | * Already displayed notifications cache
196 | * @type {Array}
197 | */
198 | this.displayed = [];
199 |
200 | /**
201 | * Renders a notification row
202 | *
203 | * @param object The notification instance
204 | * @returns {jQuery|HTMLElement|*}
205 | */
206 | this.renderRow = function (object) {
207 | var keywords = ['id', 'title', 'description', 'url', 'type'];
208 | var ret, html = self.opts.listItemTemplate;
209 |
210 | html = '' +
213 | html +
214 | '
';
215 |
216 | for (var i = 0; i < keywords.length; i++) {
217 | html = html.replace(new RegExp('{' + keywords[i] + '}', 'g'), object[keywords[i]]);
218 | }
219 |
220 | html = html.replace(/\{seen}/g, '');
221 | html = html.replace(/\{delete}/g, '');
222 | html = html.replace(/\{timeago}/g, '');
223 | ret = $(html);
224 | ret.find('.notification-seen').click(function() {
225 | self.markSeen($(this).parents('.notification').data('id'));
226 | $(this).parents('.notification').hide();
227 |
228 | // Update all counters
229 | for (var i = 0; i < self.opts.counters.length; i++) {
230 | if ($(self.opts.counters[i]).text() != parseInt($(self.opts.counters[i]).html())-1) {
231 | $(self.opts.counters[i]).text(parseInt($(self.opts.counters[i]).html())-1);
232 | }
233 | }
234 |
235 | return false;
236 | });
237 | ret.find('.notification-timeago').text($.timeago(object['date']));
238 | ret.find('.notification-delete').click(function() {
239 | self.delete($(this).parents('.notification').data('id'));
240 | return false;
241 | });
242 | return ret;
243 | };
244 |
245 | /**
246 | * Marks a notification as seen
247 | * @param {int} id The notification id
248 | */
249 | this.markSeen = function (id) {
250 | $.get(this.opts.seenUrl, {id: id}, function () {
251 |
252 | });
253 | };
254 |
255 | /**
256 | * Deletes a notification
257 | * @param {int} id The notification id
258 | */
259 | this.delete = function (id) {
260 | $.get(this.opts.deleteUrl, {id: id}, function () {
261 | $('.notification[data-id=' + id + ']').remove();
262 | });
263 | };
264 |
265 | this.flash = function (id) {
266 | $.get(this.opts.flashUrl, {id: id});
267 | };
268 |
269 | /**
270 | * Translates a native type to a theme type
271 | *
272 | * @param type
273 | * @returns The translated theme type
274 | */
275 | function getType(type) {
276 |
277 | var types = this.themes[this.opts.theme].types;
278 | var translation;
279 |
280 | if (typeof types !== "undefined") {
281 | translation = types[type];
282 | if (typeof translation !== "undefined") {
283 | return translation;
284 | }
285 | }
286 | return type;
287 | }
288 |
289 | /**
290 | * Polls the server
291 | */
292 | this.poll = function() {
293 | $.ajax({
294 | url: this.opts.url,
295 | type: "GET",
296 | data: {
297 | seen: this.opts.pollSeen ? 1 : 0
298 | },
299 | success: function(data) {
300 | var engine = self.themes[self.opts.theme];
301 | var elem, difference, notifId;
302 | var returned = [];
303 |
304 | $.each(data, function (index, object) {
305 | returned.push(object.id);
306 | });
307 |
308 | //find difference between displayed and returned notifications
309 | difference = $.grep(self.displayed, function(x) {return $.inArray(x, returned) < 0});
310 |
311 | //remove old notifications
312 | if (difference.length > 0) {
313 | //iterate over displayed notification
314 | $(self.opts.listSelector + ' > div').each(function (index) {
315 | notifId = $(this).data('id');
316 | if (difference.indexOf(notifId) !== -1) {
317 | $(this).remove();
318 | position = self.displayed.indexOf(notifId);
319 | self.displayed.splice(position, 1);
320 | }
321 | });
322 | }
323 |
324 | $.each(data, function (index, object) {
325 | if (self.displayed.indexOf(object.id) !== -1) {
326 | return;
327 | }
328 |
329 | self.displayed.push(object.id);
330 |
331 | if (self.opts.theme !== null && object.flashed === 0) {
332 | if (typeof engine !== "undefined") {
333 | engine.show(object);
334 | self.flash(object.id);
335 | } else {
336 | console.warn("Unknown engine: " + self.opts.theme);
337 | }
338 | }
339 |
340 | if (self.opts.listSelector !== null) {
341 | elem = self.renderRow(object);
342 | elem = self.opts.listItemBeforeRender(elem);
343 | elem.click(function() {
344 | document.location = $(this).data('route');
345 | }).appendTo(self.opts.listSelector);
346 | }
347 | });
348 |
349 | // Update all counters
350 | for (var i = 0; i < self.opts.counters.length; i++) {
351 | if ($(self.opts.counters[i]).text() != data.length) {
352 | $(self.opts.counters[i]).text(data.length);
353 | }
354 | }
355 |
356 | },
357 | dataType: "json",
358 | complete: setTimeout(function() {
359 | self.poll(opts)
360 | }, opts.pollInterval),
361 | timeout: opts.xhrTimeout
362 | });
363 | };
364 |
365 | /**
366 | * Register click event on selector
367 | */
368 | this.registerClickEvents = function () {
369 | if (self.opts.markAllSeenSelector !== null) {
370 | $(self.opts.markAllSeenSelector).click(function() {
371 | self.markAllSeen();
372 | });
373 | }
374 | if (self.opts.deleteAllSelector !== null) {
375 | $(self.opts.deleteAllSelector).click(function() {
376 | self.deleteAll();
377 | });
378 | }
379 | };
380 |
381 | /**
382 | * Return array of all notification IDs displayed in listSelector
383 | *
384 | * @returns {Array}
385 | */
386 | this.getNotificationIds = function() {
387 | var notificationIdList = [];
388 | $(self.opts.listSelector + ' > div').each(function(index) {
389 | notificationIdList.push($(this).data('id'));
390 | });
391 |
392 | return notificationIdList;
393 | };
394 |
395 | /**
396 | * Marks all notification as seen
397 | */
398 | this.markAllSeen = function () {
399 | var ids = this.getNotificationIds();
400 | $.post(this.opts.seenAllUrl, {ids: ids}, function () {
401 | //hide all
402 | var idsLength = ids.length;
403 | for (var i = 0; i < idsLength; i++) {
404 | $('.notification[data-id=' + ids[i] + ']').hide();
405 | }
406 | });
407 | };
408 |
409 | /**
410 | * Delete all notifications
411 | */
412 | this.deleteAll = function () {
413 | var ids = this.getNotificationIds();
414 | $.post(this.opts.deleteAllUrl, {ids: ids}, function () {
415 | //remove all
416 | var idsLength = ids.length;
417 | for (var i = 0; i < idsLength; i++) {
418 | $('.notification[data-id=' + ids[i] + ']').remove();
419 | }
420 | });
421 | };
422 |
423 | // register click events on jQuery elements
424 | this.registerClickEvents();
425 |
426 | // Fire the initial poll
427 | this.poll();
428 |
429 | });
430 |
--------------------------------------------------------------------------------
/assets/notifications.less:
--------------------------------------------------------------------------------
1 | .notification {
2 | background: #fefefe;
3 | padding: 2px 5px;
4 | cursor: pointer;
5 | border-bottom: 1px solid #b5b5b5;
6 |
7 | &.notification-danger {
8 | background: #b995a9;
9 | }
10 | &.notification-warning {
11 | background: #fcffcd;
12 | }
13 | &.notification-success {
14 | background: #00ca6d;
15 | }
16 |
17 | .title {
18 | font-weight: bold;
19 | }
20 |
21 | .description {
22 | display: none;
23 | }
24 |
25 | .timeago {
26 | color: #555;
27 | font-style: italic;
28 | font-size: 12px;
29 | }
30 |
31 | .actions {
32 | .fa {
33 | color: #aaa;
34 | display: block;
35 | font-size: 10px;
36 | margin: 4px 0;
37 | &:hover {
38 | color: #333;
39 | }
40 | }
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/assets/themes/growl.css:
--------------------------------------------------------------------------------
1 | /* jQuery Growl
2 | * Copyright 2015 Kevin Sylvestre
3 | * 1.3.1
4 | */
5 | #growls {
6 | z-index: 50000;
7 | position: fixed; }
8 | #growls.default {
9 | top: 10px;
10 | right: 10px; }
11 | #growls.tl {
12 | top: 10px;
13 | left: 10px; }
14 | #growls.tr {
15 | top: 10px;
16 | right: 10px; }
17 | #growls.bl {
18 | bottom: 10px;
19 | left: 10px; }
20 | #growls.br {
21 | bottom: 10px;
22 | right: 10px; }
23 | #growls.tc {
24 | top: 10px;
25 | right: 10px;
26 | left: 10px; }
27 | #growls.bc {
28 | bottom: 10px;
29 | right: 10px;
30 | left: 10px; }
31 | #growls.tc .growl, #growls.bc .growl {
32 | margin-left: auto;
33 | margin-right: auto; }
34 |
35 | .growl {
36 | opacity: 0.8;
37 | filter: alpha(opacity=80);
38 | position: relative;
39 | border-radius: 4px;
40 | -webkit-transition: all 0.4s ease-in-out;
41 | -moz-transition: all 0.4s ease-in-out;
42 | transition: all 0.4s ease-in-out; }
43 | .growl.growl-incoming {
44 | opacity: 0;
45 | filter: alpha(opacity=0); }
46 | .growl.growl-outgoing {
47 | opacity: 0;
48 | filter: alpha(opacity=0); }
49 | .growl.growl-small {
50 | width: 200px;
51 | padding: 5px;
52 | margin: 5px; }
53 | .growl.growl-medium {
54 | width: 250px;
55 | padding: 10px;
56 | margin: 10px; }
57 | .growl.growl-large {
58 | width: 300px;
59 | padding: 15px;
60 | margin: 15px; }
61 | .growl.growl-default {
62 | color: #FFF;
63 | background: #7f8c8d; }
64 | .growl.growl-error {
65 | color: #FFF;
66 | background: #C0392B; }
67 | .growl.growl-notice {
68 | color: #FFF;
69 | background: #2ECC71; }
70 | .growl.growl-warning {
71 | color: #FFF;
72 | background: #F39C12; }
73 | .growl .growl-close {
74 | cursor: pointer;
75 | float: right;
76 | font-size: 14px;
77 | line-height: 18px;
78 | font-weight: normal;
79 | font-family: helvetica, verdana, sans-serif; }
80 | .growl .growl-title {
81 | font-size: 18px;
82 | line-height: 24px; }
83 | .growl .growl-message {
84 | font-size: 14px;
85 | line-height: 18px; }
86 |
--------------------------------------------------------------------------------
/assets/themes/growl.js:
--------------------------------------------------------------------------------
1 | // Generated by CoffeeScript 1.9.3
2 |
3 | /*
4 | jQuery Growl
5 | Copyright 2015 Kevin Sylvestre
6 | 1.3.1
7 | */
8 |
9 | (function() {
10 | "use strict";
11 | var $, Animation, Growl,
12 | bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
13 |
14 | $ = jQuery;
15 |
16 | Animation = (function() {
17 | function Animation() {}
18 |
19 | Animation.transitions = {
20 | "webkitTransition": "webkitTransitionEnd",
21 | "mozTransition": "mozTransitionEnd",
22 | "oTransition": "oTransitionEnd",
23 | "transition": "transitionend"
24 | };
25 |
26 | Animation.transition = function($el) {
27 | var el, ref, result, type;
28 | el = $el[0];
29 | ref = this.transitions;
30 | for (type in ref) {
31 | result = ref[type];
32 | if (el.style[type] != null) {
33 | return result;
34 | }
35 | }
36 | };
37 |
38 | return Animation;
39 |
40 | })();
41 |
42 | Growl = (function() {
43 | Growl.settings = {
44 | namespace: 'growl',
45 | duration: 3200,
46 | close: "×",
47 | location: "default",
48 | style: "default",
49 | size: "medium"
50 | };
51 |
52 | Growl.growl = function(settings) {
53 | if (settings == null) {
54 | settings = {};
55 | }
56 | this.initialize();
57 | return new Growl(settings);
58 | };
59 |
60 | Growl.initialize = function() {
61 | return $("body:not(:has(#growls))").append('');
62 | };
63 |
64 | function Growl(settings) {
65 | if (settings == null) {
66 | settings = {};
67 | }
68 | this.container = bind(this.container, this);
69 | this.content = bind(this.content, this);
70 | this.html = bind(this.html, this);
71 | this.$growl = bind(this.$growl, this);
72 | this.$growls = bind(this.$growls, this);
73 | this.animate = bind(this.animate, this);
74 | this.remove = bind(this.remove, this);
75 | this.dismiss = bind(this.dismiss, this);
76 | this.present = bind(this.present, this);
77 | this.cycle = bind(this.cycle, this);
78 | this.close = bind(this.close, this);
79 | this.click = bind(this.click, this);
80 | this.unbind = bind(this.unbind, this);
81 | this.bind = bind(this.bind, this);
82 | this.render = bind(this.render, this);
83 | this.settings = $.extend({}, Growl.settings, settings);
84 | this.$growls().attr('class', this.settings.location);
85 | this.render();
86 | }
87 |
88 | Growl.prototype.render = function() {
89 | var $growl;
90 | $growl = this.$growl();
91 | this.$growls().append($growl);
92 | if (this.settings.fixed) {
93 | this.present();
94 | } else {
95 | this.cycle();
96 | }
97 | };
98 |
99 | Growl.prototype.bind = function($growl) {
100 | if ($growl == null) {
101 | $growl = this.$growl();
102 | }
103 | $growl.on("click", this.click);
104 | return $growl.on("contextmenu", this.close).find("." + this.settings.namespace + "-close").on("click", this.close);
105 | };
106 |
107 | Growl.prototype.unbind = function($growl) {
108 | if ($growl == null) {
109 | $growl = this.$growl();
110 | }
111 | $growl.off("click", this.click);
112 | return $growl.off("contextmenu", this.close).find("." + this.settings.namespace + "-close").off("click", this.close);
113 | };
114 |
115 | Growl.prototype.click = function(event) {
116 | if (this.settings.url != null) {
117 | event.preventDefault();
118 | event.stopPropagation();
119 | return window.open(this.settings.url);
120 | }
121 | };
122 |
123 | Growl.prototype.close = function(event) {
124 | var $growl;
125 | event.preventDefault();
126 | event.stopPropagation();
127 | $growl = this.$growl();
128 | return $growl.stop().queue(this.dismiss).queue(this.remove);
129 | };
130 |
131 | Growl.prototype.cycle = function() {
132 | var $growl;
133 | $growl = this.$growl();
134 | return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
135 | };
136 |
137 | Growl.prototype.present = function(callback) {
138 | var $growl;
139 | $growl = this.$growl();
140 | this.bind($growl);
141 | return this.animate($growl, this.settings.namespace + "-incoming", 'out', callback);
142 | };
143 |
144 | Growl.prototype.dismiss = function(callback) {
145 | var $growl;
146 | $growl = this.$growl();
147 | this.unbind($growl);
148 | return this.animate($growl, this.settings.namespace + "-outgoing", 'in', callback);
149 | };
150 |
151 | Growl.prototype.remove = function(callback) {
152 | this.$growl().remove();
153 | return callback();
154 | };
155 |
156 | Growl.prototype.animate = function($element, name, direction, callback) {
157 | var transition;
158 | if (direction == null) {
159 | direction = 'in';
160 | }
161 | transition = Animation.transition($element);
162 | $element[direction === 'in' ? 'removeClass' : 'addClass'](name);
163 | $element.offset().position;
164 | $element[direction === 'in' ? 'addClass' : 'removeClass'](name);
165 | if (callback == null) {
166 | return;
167 | }
168 | if (transition != null) {
169 | $element.one(transition, callback);
170 | } else {
171 | callback();
172 | }
173 | };
174 |
175 | Growl.prototype.$growls = function() {
176 | return this.$_growls != null ? this.$_growls : this.$_growls = $('#growls');
177 | };
178 |
179 | Growl.prototype.$growl = function() {
180 | return this.$_growl != null ? this.$_growl : this.$_growl = $(this.html());
181 | };
182 |
183 | Growl.prototype.html = function() {
184 | return this.container(this.content());
185 | };
186 |
187 | Growl.prototype.content = function() {
188 | return "" + this.settings.close + "
\n" + this.settings.title + "
\n" + this.settings.message + "
";
189 | };
190 |
191 | Growl.prototype.container = function(content) {
192 | return "\n " + content + "\n
";
193 | };
194 |
195 | return Growl;
196 |
197 | })();
198 |
199 | this.Growl = Growl;
200 |
201 | $.growl = function(options) {
202 | if (options == null) {
203 | options = {};
204 | }
205 | return Growl.growl(options);
206 | };
207 |
208 | $.growl.error = function(options) {
209 | var settings;
210 | if (options == null) {
211 | options = {};
212 | }
213 | settings = {
214 | title: "Error!",
215 | style: "error"
216 | };
217 | return $.growl($.extend(settings, options));
218 | };
219 |
220 | $.growl.notice = function(options) {
221 | var settings;
222 | if (options == null) {
223 | options = {};
224 | }
225 | settings = {
226 | title: "Notice!",
227 | style: "notice"
228 | };
229 | return $.growl($.extend(settings, options));
230 | };
231 |
232 | $.growl.warning = function(options) {
233 | var settings;
234 | if (options == null) {
235 | options = {};
236 | }
237 | settings = {
238 | title: "Warning!",
239 | style: "warning"
240 | };
241 | return $.growl($.extend(settings, options));
242 | };
243 |
244 | }).call(this);
245 |
--------------------------------------------------------------------------------
/assets/themes/notie.css:
--------------------------------------------------------------------------------
1 | .notie-transition {
2 | -moz-transition: all 0.3s ease;
3 | -webkit-transition: all 0.3s ease;
4 | transition: all 0.3s ease; }
5 |
6 | .notie-background-success {
7 | background-color: #57BF57; }
8 |
9 | .notie-background-warning {
10 | background-color: #D6A14D; }
11 |
12 | .notie-background-error {
13 | background-color: #E1715B; }
14 |
15 | .notie-background-info {
16 | background-color: #4D82D6; }
17 |
18 | #notie-alert-outer, #notie-confirm-outer, #notie-input-outer, #notie-select-outer {
19 | position: fixed;
20 | top: 0;
21 | left: 0;
22 | z-index: 999999999;
23 | height: auto;
24 | width: 100%;
25 | display: none;
26 | text-align: center;
27 | cursor: pointer;
28 | font-size: 24px;
29 | -o-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5);
30 | -ms-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5);
31 | -moz-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5);
32 | -webkit-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5);
33 | box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5); }
34 | @media (max-width: 600px) {
35 | #notie-alert-outer, #notie-confirm-outer, #notie-input-outer, #notie-select-outer {
36 | font-size: 18px; } }
37 |
38 | #notie-alert-inner {
39 | padding: 20px;
40 | display: table-cell; }
41 |
42 | #notie-alert-content {
43 | max-width: 900px;
44 | margin: 0 auto; }
45 |
46 | #notie-alert-text {
47 | color: #FFFFFF; }
48 |
49 | #notie-confirm-outer {
50 | cursor: default; }
51 |
52 | #notie-confirm-inner, #notie-input-inner, #notie-select-inner {
53 | box-sizing: border-box;
54 | width: 100%;
55 | padding: 20px;
56 | display: block;
57 | cursor: default;
58 | background-color: #4D82D6; }
59 |
60 | #notie-confirm-text {
61 | color: #FFFFFF; }
62 |
63 | #notie-confirm-text-yes {
64 | color: #FFFFFF; }
65 |
66 | #notie-confirm-text-no {
67 | color: #FFFFFF; }
68 |
69 | #notie-confirm-yes, #notie-confirm-no, #notie-input-no, #notie-input-yes {
70 | float: left;
71 | height: 50px;
72 | line-height: 50px;
73 | width: 50%;
74 | cursor: pointer;
75 | background-color: #57BF57; }
76 |
77 | #notie-confirm-no, #notie-input-no {
78 | float: right;
79 | background-color: #E1715B; }
80 |
81 | #notie-confirm-background, #notie-input-background, #notie-select-background {
82 | position: fixed;
83 | top: 0;
84 | left: 0;
85 | z-index: 999999980;
86 | height: 100%;
87 | width: 100%;
88 | display: none;
89 | background-color: #FFFFFF;
90 | opacity: 0; }
91 |
92 | /* INPUT */
93 | #notie-input-outer {
94 | cursor: default; }
95 |
96 | #notie-input-field {
97 | display: block;
98 | box-sizing: border-box;
99 | height: 55px;
100 | width: 100%;
101 | text-align: center;
102 | outline: 0;
103 | border: 0;
104 | background-color: #FFFFFF;
105 | font-family: inherit;
106 | font-size: 24px; }
107 | @media (max-width: 600px) {
108 | #notie-input-field {
109 | font-size: 18px; } }
110 |
111 | #notie-input-text {
112 | color: #FFFFFF; }
113 |
114 | #notie-input-text-yes {
115 | color: #FFFFFF; }
116 |
117 | #notie-input-text-no {
118 | color: #FFFFFF; }
119 |
120 | #notie-select-outer {
121 | top: auto;
122 | bottom: 0;
123 | cursor: default; }
124 |
125 | #notie-select-text {
126 | color: #FFFFFF; }
127 |
128 | #notie-select-choices, .notie-select-choice {
129 | background-color: #57BF57; }
130 |
131 | .notie-select-choice {
132 | height: 50px;
133 | line-height: 50px;
134 | color: #FFFFFF;
135 | cursor: pointer; }
136 |
137 | #notie-select-cancel {
138 | height: 60px;
139 | line-height: 60px;
140 | color: #FFFFFF;
141 | cursor: pointer;
142 | background-color: #A0A0A0; }
143 |
--------------------------------------------------------------------------------
/assets/themes/notie.js:
--------------------------------------------------------------------------------
1 | var notie=function(){function e(e){for(var t in e)h[t]=e[t]}function t(e,t,i){h.colorText.length>0&&(C.style.color=h.colorText),f(),H++,setTimeout(function(){H--},h.animationDelay+10),1===H&&(D?(clearTimeout(x),clearTimeout(E),n(function(){o(e,t,i)})):o(e,t,i))}function o(e,t,o){D=!0;var i=0;if("undefined"==typeof o||0===o)var i=864e5;else i=o>0&&1>o?1e3:1e3*o;switch(y(k,"notie-background-success"),y(k,"notie-background-warning"),y(k,"notie-background-error"),y(k,"notie-background-info"),e){case 1:h.colorSuccess.length>0?k.style.backgroundColor=h.colorSuccess:p(k,"notie-background-success");break;case 2:h.colorWarning.length>0?k.style.backgroundColor=h.colorWarning:p(k,"notie-background-warning");break;case 3:h.colorError.length>0?k.style.backgroundColor=h.colorError:p(k,"notie-background-error");break;case 4:h.colorInfo.length>0?k.style.backgroundColor=h.colorInfo:p(k,"notie-background-info")}C.innerHTML=t,k.style.top="-10000px",k.style.display="table",k.style.top="-"+k.offsetHeight-5+"px",x=setTimeout(function(){p(k,"notie-transition"),k.style.top=0,E=setTimeout(function(){n(function(){})},i)},20)}function n(e){k.style.top="-"+k.offsetHeight-5+"px",setTimeout(function(){y(k,"notie-transition"),k.style.top="-10000px",D=!1,e&&e()},h.animationDelay+10)}function i(e,t,o,i,l){h.colorInfo.length>0&&(L.style.backgroundColor=h.colorInfo),h.colorSuccess.length>0&&(M.style.backgroundColor=h.colorSuccess),h.colorError.length>0&&(S.style.backgroundColor=h.colorError),h.colorText.length>0&&(I.style.color=h.colorText,A.style.color=h.colorText,N.style.color=h.colorText),f(),D?(clearTimeout(x),clearTimeout(E),n(function(){c(e,t,o,i,l)})):c(e,t,o,i,l)}function c(e,t,o,n,i){function c(){I.innerHTML=e,A.innerHTML=t,N.innerHTML=o,w.style.top="-10000px",w.style.display="table",w.style.top="-"+w.offsetHeight-5+"px",W.style.display="block",setTimeout(function(){p(w,"notie-transition"),w.style.top=0,W.style.opacity="0.75",setTimeout(function(){V=!0},h.animationDelay+10)},20)}g(),M.onclick=function(){l(),n&&setTimeout(function(){n()},h.animationDelay+10)},S.onclick=function(){l(),i&&setTimeout(function(){i()},h.animationDelay+10)},V?(l(),setTimeout(function(){c()},h.animationDelay+10)):c()}function l(){w.style.top="-"+w.offsetHeight-5+"px",W.style.opacity="0",setTimeout(function(){y(w,"notie-transition"),w.style.top="-10000px",W.style.display="none",b(),V=!1},h.animationDelay+10)}function r(e,t,o,i,c,l){h.colorInfo.length>0&&(z.style.backgroundColor=h.colorInfo),h.colorSuccess.length>0&&(R.style.backgroundColor=h.colorSuccess),h.colorError.length>0&&($.style.backgroundColor=h.colorError),h.colorText.length>0&&(q.style.color=h.colorText,F.style.color=h.colorText,G.style.color=h.colorText),f(),"undefined"!=typeof e.type&&e.type?O.setAttribute("type",e.type):O.setAttribute("type","text"),"undefined"!=typeof e.placeholder&&e.placeholder&&O.setAttribute("placeholder",e.placeholder),"undefined"!=typeof e.prefilledValue&&e.prefilledValue?O.value=e.prefilledValue:O.value="",D?(clearTimeout(x),clearTimeout(E),n(function(){a(t,o,i,c,l)})):a(t,o,i,c,l)}function a(e,t,o,n,i){function c(){q.innerHTML=e,F.innerHTML=t,G.innerHTML=o,j.style.top="-10000px",j.style.display="table",j.style.top="-"+j.offsetHeight-5+"px",B.style.display="block",setTimeout(function(){p(j,"notie-transition"),j.style.top=0,B.style.opacity="0.75",setTimeout(function(){J=!0,O.focus()},h.animationDelay+10)},20)}g(),R.onclick=function(){d(),n&&setTimeout(function(){n(O.value)},h.animationDelay+10)},$.onclick=function(){d(),i&&setTimeout(function(){i(O.value)},h.animationDelay+10)},J?(d(),setTimeout(function(){c()},h.animationDelay+10)):c()}function d(){j.style.top="-"+j.offsetHeight-5+"px",B.style.opacity="0",setTimeout(function(){y(j,"notie-transition"),B.style.display="none",j.style.top="-10000px",b(),J=!1},h.animationDelay+10)}function u(e,t){h.colorInfo.length>0&&(P.style.backgroundColor=h.colorInfo),h.colorNeutral.length>0&&(Y.style.backgroundColor=h.colorNeutral),h.colorText.length>0&&(Q.style.color=h.colorText,Y.style.color=h.colorText);for(var o=[],i=0;i0&&(l.style.color=h.colorText),t[c].type)switch(t[c].type){case 1:h.colorSuccess.length>0?l.style.backgroundColor=h.colorSuccess:p(l,"notie-background-success");break;case 2:h.colorWarning.length>0?l.style.backgroundColor=h.colorWarning:p(l,"notie-background-warning");break;case 3:h.colorError.length>0?l.style.backgroundColor=h.colorError:p(l,"notie-background-error");break;case 4:h.colorInfo.length>0?l.style.backgroundColor=h.colorInfo:p(l,"notie-background-info")}else t[c].color&&(l.style.backgroundColor=t[c].color);c>0&&l.style.backgroundColor===i.style.backgroundColor&&(i.style.borderBottom="1px solid rgba(255, 255, 255, 0.2)"),l.onclick=function(e){return function(){m(),setTimeout(function(){o[e]()},h.animationDelay+10)}}(c),i=l}ee?(m(),setTimeout(function(){n(e)},h.animationDelay+10)):n(e)}function m(){K.style.bottom="-"+K.offsetHeight-5+"px",U.style.opacity="0",setTimeout(function(){y(K,"notie-transition"),K.style.bottom="-10000px",U.style.display="none",b(),ee=!1},h.animationDelay+10)}function p(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function y(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function f(){document.activeElement.blur()}function g(){Z=document.body.style.height,_=document.body.style.overflow,document.body.style.height="100%",document.body.style.overflow="hidden"}function b(){document.body.style.height=Z,document.body.style.overflow=_}var h={colorSuccess:"",colorWarning:"",colorError:"",colorInfo:"",colorNeutral:"",colorText:"",animationDelay:300,backgroundClickDismiss:!0},k=document.createElement("div");k.id="notie-alert-outer",k.onclick=function(){clearTimeout(x),clearTimeout(E),n()},document.body.appendChild(k);var v=document.createElement("div");v.id="notie-alert-inner",k.appendChild(v);var T=document.createElement("div");T.id="notie-alert-content",v.appendChild(T);var C=document.createElement("span");C.id="notie-alert-text",T.appendChild(C);var x,E,D=!1,H=0,w=document.createElement("div");w.id="notie-confirm-outer";var L=document.createElement("div");L.id="notie-confirm-inner",w.appendChild(L);var I=document.createElement("span");I.id="notie-confirm-text",L.appendChild(I);var M=document.createElement("div");M.id="notie-confirm-yes",w.appendChild(M);var S=document.createElement("div");S.id="notie-confirm-no",w.appendChild(S);var A=document.createElement("span");A.id="notie-confirm-text-yes",M.appendChild(A);var N=document.createElement("span");N.id="notie-confirm-text-no",S.appendChild(N);var W=document.createElement("div");W.id="notie-confirm-background",p(W,"notie-transition"),W.onclick=function(){h.backgroundClickDismiss&&l()},document.body.appendChild(w),document.body.appendChild(W);var V=!1,j=document.createElement("div");j.id="notie-input-outer";var B=document.createElement("div");B.id="notie-input-background",p(B,"notie-transition");var z=document.createElement("div");z.id="notie-input-inner",j.appendChild(z);var O=document.createElement("input");O.id="notie-input-field",O.setAttribute("autocomplete","off"),O.setAttribute("autocorrect","off"),O.setAttribute("autocapitalize","off"),O.setAttribute("spellcheck","false"),j.appendChild(O);var R=document.createElement("div");R.id="notie-input-yes",j.appendChild(R);var $=document.createElement("div");$.id="notie-input-no",j.appendChild($);var q=document.createElement("span");q.id="notie-input-text",z.appendChild(q);var F=document.createElement("span");F.id="notie-input-text-yes",R.appendChild(F);var G=document.createElement("span");G.id="notie-input-text-no",$.appendChild(G),document.body.appendChild(j),document.body.appendChild(B),B.onclick=function(){h.backgroundClickDismiss&&d()};var J=!1,K=document.createElement("div");K.id="notie-select-outer";var P=document.createElement("div");P.id="notie-select-inner",K.appendChild(P);var Q=document.createElement("span");Q.id="notie-select-text",P.appendChild(Q);var U=document.createElement("div");U.id="notie-select-background",p(U,"notie-transition");var X=document.createElement("div");X.id="notie-select-choices",K.appendChild(X);var Y=document.createElement("div");Y.id="notie-select-cancel",Y.innerHTML="Cancel",K.appendChild(Y),document.body.appendChild(K),document.body.appendChild(U),U.onclick=function(){h.backgroundClickDismiss&&m()},Y.onclick=function(){m()};var Z,_,ee=!1;return window.addEventListener("keydown",function(e){var t=13==e.which||13==e.keyCode,o=27==e.which||27==e.keyCode;D?(t||o)&&(clearTimeout(x),clearTimeout(E),n()):V?t?M.click():o&&l():J?t?R.click():o&&d():ee&&o&&m()}),{setOptions:e,alert:t,confirm:i,input:r,select:u}}();"object"==typeof module&&module.exports&&(module.exports=notie);
2 |
--------------------------------------------------------------------------------
/assets/themes/notifit.css:
--------------------------------------------------------------------------------
1 | #ui_notifIt{
2 | position: fixed;
3 | top: 10px;
4 | right: 10px;
5 | cursor: pointer;
6 | overflow: hidden;
7 | -webkit-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.3);
8 | -moz-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.3);
9 | -o-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.3);
10 | box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.3);
11 | -wekbit-border-radius: 5px;
12 | -moz-border-radius: 5px;
13 | -o-border-radius: 5px;
14 | border-radius: 5px;
15 | z-index: 2000;
16 | }
17 | #ui_notifIt:hover{
18 | opacity: 1 !important;
19 | }
20 | #ui_notifIt p{
21 | text-align: center;
22 | font-family: sans-serif;
23 | font-size: 14px;
24 | padding: 0;
25 | margin: 0;
26 | }
27 |
28 | /* Color setup */
29 | /* You are free to change all of this */
30 | #ui_notifIt.success{
31 | background-color: yellowgreen;
32 | color: white;
33 | }
34 | #ui_notifIt.error{
35 | background-color: orangered;
36 | color: white;
37 | }
38 | #ui_notifIt.warning{
39 | background-color: orange;
40 | color: white;
41 | }
42 | #ui_notifIt.info{
43 | background-color: deepskyblue;
44 | color: white;
45 | }
46 | #ui_notifIt.default{
47 | background-color: #EEE;
48 | color: #444;
49 | }
--------------------------------------------------------------------------------
/assets/themes/notifit.js:
--------------------------------------------------------------------------------
1 | !function(a,b){if("function"==typeof define&&define.amd)define(b);else{var c=b(a.b);a.notif=c.notif,a.notifit_dismiss=c.notifit_dismiss}}(this,function(){function a(a){var c=function(){return e("",{id:"notifIt_close",html:"×"})},d=function(){var a=e("",{id:"ui_notifIt"}),b=e("
",{html:h.msg});return a.append(b),a};window.notifit_timeout=null;var e=jQuery,f=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)/2,g=["left","center","right","bottom"],h={type:"default",width:400,height:60,position:"right",autohide:1,msg:"This is my default message",opacity:1,multiline:0,fade:0,bgcolor:"",color:"",timeout:5e3,zindex:null,offset:0,callback:null,clickable:!1,animation:"slide"};if(e.extend(h,a),h.animations={},h.animations.slide={center:{css_start:{top:parseInt(0-(h.height+10)),left:f-parseInt(h.width/2)},"in":{top:parseInt(10+h.offset)},out:{start:{top:parseInt(h.height-h.height/2)},end:{top:parseInt(0-2*h.height)}}},bottom:{css_start:{top:"auto",bottom:parseInt(0-(h.height+10)),left:f-parseInt(h.width/2)},"in":{bottom:parseInt(10+h.offset)},out:{start:{bottom:parseInt(h.height-h.height/2)},end:{bottom:parseInt(0-2*h.height)}}},right:{css_start:{right:parseInt(0-(h.width+10)),right:parseInt(0-2*h.width)},"in":{right:parseInt(10+h.offset)},out:{start:{right:parseFloat(h.width-.9*h.width)},end:{right:parseInt(0-2*h.width)}}},left:{css_start:{left:parseInt(0-(h.width+10))},"in":{left:parseInt(10+h.offset)},out:{start:{left:parseFloat(h.width-.9*h.width)},end:{left:parseInt(0-2*h.width)}}}},h.animations.zoom={center:{css_start:{top:10,left:f-parseInt(h.width/2),zoom:.01},"in":{zoom:1},out:{start:{zoom:1.3},end:{zoom:.01}}},bottom:{css_start:{top:"auto",bottom:10,left:f-parseInt(h.width/2),zoom:.01},"in":{zoom:1},out:{start:{zoom:1.3},end:{zoom:.01}}},right:{css_start:{right:10,zoom:.01},"in":{right:parseInt(10+h.offset),zoom:1},out:{start:{zoom:1.3},end:{zoom:.01}}},left:{css_start:{left:10,zoom:.01},"in":{zoom:1},out:{start:{zoom:1.3},end:{zoom:.01}}}},h.available_animations=Object.keys(h.animations),!h.available_animations.length)throw new Error("No animations");if(!g.length)throw new Error("No available positions");-1===g.indexOf(h.position)&&(h.position=g[0]),-1===h.available_animations.indexOf(h.animation)&&(h.animation=h.available_animations[0]),"function"!=typeof h.callback&&(h.callback=null),h.width>0?h.width=h.width:"all"===h.width?h.width=screen.width-60:h.width=400,h.height<100&&h.height>0&&(height=h.height);var i=d();h.clickable&&i.append(c());var j=function(){e("#ui_notifIt").remove(),clearInterval(window.notifit_timeout)};return j(),e("body").append(i),h.zindex&&e("#ui_notifIt").css("z-index",h.zindex),h.multiline?e("#ui_notifIt").css("padding",15):(e("#ui_notifIt").css("height",height),e("#ui_notifIt p").css("line-height",height+"px")),e("#ui_notifIt").css({width:h.width,opacity:h.opacity,"background-color":h.bgcolor,color:h.color}),e("#ui_notifIt").addClass(h.type),h.animations[h.animation][h.position].css_start?e("#ui_notifIt").css(h.animations[h.animation][h.position].css_start):e("#ui_notifIt").css(h.animations[h.available_animations[0]][h.position].css_start),e("#ui_notifIt").animate(h.animations[h.animation][h.position]["in"]),h.clickable||e("#ui_notifIt").click(function(a){a.stopPropagation(),b(h)}),e("body").on("click","#ui_notifIt #notifIt_close",function(){b(h)}),h.autohide&&(isNaN(h.timeout)||(window.notifit_timeout=setTimeout(function(){b(h)},h.timeout))),{destroy:j}}function b(a){if(clearTimeout(window.notifit_timeout),"fade"!=a.animation){if(a.animations&&a.animations[a.animation]&&a.animations[a.animation][a.position]&&a.animations[a.animation][a.position].out&&a.animations[a.animation][a.position].out.start&&a.animations[a.animation][a.position].out.end)animation1=a.animations[a.animation][a.position].out.start,animation2=a.animations[a.animation][a.position].out.end;else{if(!(a.animations[a.available_animations[0]]&&a.animations[a.available_animations[0]][a.position]&&a.animations[a.available_animations[0]][a.position].out&&a.animations[a.available_animations[0]][a.position].out.start&&a.animations[a.available_animations[0]][a.position].out.end))throw new Error("Invalid animation");animation1=a.animations[a.available_animations[0]][a.position].out.start,animation2=a.animations[a.available_animations[0]][a.position].out.end}$("#ui_notifIt").animate(animation1,100,function(){$("#ui_notifIt").animate(animation2,100,function(){$("#ui_notifIt").remove(),a.callback&&a.callback()})})}else $("#ui_notifIt").fadeOut("slow",function(){$("#ui_notifIt").remove(),a.callback&&a.callback()})}return{notif:a,notifit_dismiss:b}});
--------------------------------------------------------------------------------
/assets/themes/notify.js:
--------------------------------------------------------------------------------
1 | /* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
2 | (function(window, document, $, undefined) {
3 | "use strict";
4 | //IE8 indexOf polyfill
5 | var indexOf = [].indexOf || function(item) {
6 | for (var i = 0, l = this.length; i < l; i++) {
7 | if (i in this && this[i] === item) {
8 | return i;
9 | }
10 | }
11 | return -1;
12 | };
13 |
14 | var pluginName = "notify";
15 | var pluginClassName = pluginName + "js";
16 | var blankFieldName = pluginName + "!blank";
17 |
18 | var positions = {
19 | t: "top",
20 | m: "middle",
21 | b: "bottom",
22 | l: "left",
23 | c: "center",
24 | r: "right"
25 | };
26 | var hAligns = ["l", "c", "r"];
27 | var vAligns = ["t", "m", "b"];
28 | var mainPositions = ["t", "b", "l", "r"];
29 | var opposites = {
30 | t: "b",
31 | m: null,
32 | b: "t",
33 | l: "r",
34 | c: null,
35 | r: "l"
36 | };
37 |
38 | var parsePosition = function(str) {
39 | var pos;
40 | pos = [];
41 | $.each(str.split(/\W+/), function(i, word) {
42 | var w;
43 | w = word.toLowerCase().charAt(0);
44 | if (positions[w]) {
45 | return pos.push(w);
46 | }
47 | });
48 | return pos;
49 | };
50 |
51 | var styles = {};
52 |
53 | var coreStyle = {
54 | name: "core",
55 | html: "
",
56 | css: "." + pluginClassName + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + pluginClassName + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + pluginClassName + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n}\n\n." + pluginClassName + "-hidable {\n cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n position: relative;\n}\n\n." + pluginClassName + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
57 | };
58 |
59 | var stylePrefixes = {
60 | "border-radius": ["-webkit-", "-moz-"]
61 | };
62 |
63 | var getStyle = function(name) {
64 | return styles[name];
65 | };
66 |
67 | var addStyle = function(name, def) {
68 | var cssText, elem, fields, ref;
69 | if (!name) {
70 | throw "Missing Style name";
71 | }
72 | if (!def) {
73 | throw "Missing Style definition";
74 | }
75 | if (!def.html) {
76 | throw "Missing Style HTML";
77 | }
78 | if ((ref = styles[name]) != null ? ref.cssElem : void 0) {
79 | if (window.console) {
80 | console.warn(pluginName + ": overwriting style '" + name + "'");
81 | }
82 | styles[name].cssElem.remove();
83 | }
84 | def.name = name;
85 | styles[name] = def;
86 | cssText = "";
87 | if (def.classes) {
88 | $.each(def.classes, function(className, props) {
89 | cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
90 | $.each(props, function(name, val) {
91 | if (stylePrefixes[name]) {
92 | $.each(stylePrefixes[name], function(i, prefix) {
93 | return cssText += " " + prefix + name + ": " + val + ";\n";
94 | });
95 | }
96 | return cssText += " " + name + ": " + val + ";\n";
97 | });
98 | return cssText += "}\n";
99 | });
100 | }
101 | if (def.css) {
102 | cssText += "/* styles for " + def.name + " */\n" + def.css;
103 | }
104 | if (cssText) {
105 | def.cssElem = insertCSS(cssText);
106 | def.cssElem.attr("id", "notify-" + def.name);
107 | }
108 | fields = {};
109 | elem = $(def.html);
110 | findFields("html", elem, fields);
111 | findFields("text", elem, fields);
112 | return def.fields = fields;
113 | };
114 |
115 | var insertCSS = function(cssText) {
116 | var e, elem, error;
117 | elem = createElem("style");
118 | elem.attr("type", 'text/css');
119 | $("head").append(elem);
120 | try {
121 | elem.html(cssText);
122 | } catch (error) {
123 | e = error;
124 | elem[0].styleSheet.cssText = cssText;
125 | }
126 | return elem;
127 | };
128 |
129 | var findFields = function(type, elem, fields) {
130 | var attr;
131 | if (type !== "html") {
132 | type = "text";
133 | }
134 | attr = "data-notify-" + type;
135 | return find(elem, "[" + attr + "]").each(function() {
136 | var name;
137 | name = $(this).attr(attr);
138 | if (!name) {
139 | name = blankFieldName;
140 | }
141 | return fields[name] = type;
142 | });
143 | };
144 |
145 | var find = function(elem, selector) {
146 | if (elem.is(selector)) {
147 | return elem;
148 | } else {
149 | return elem.find(selector);
150 | }
151 | };
152 |
153 | var pluginOptions = {
154 | clickToHide: true,
155 | autoHide: true,
156 | autoHideDelay: 5000,
157 | arrowShow: true,
158 | arrowSize: 5,
159 | breakNewLines: true,
160 | elementPosition: "bottom",
161 | globalPosition: "top right",
162 | style: "bootstrap",
163 | className: "error",
164 | showAnimation: "slideDown",
165 | showDuration: 400,
166 | hideAnimation: "slideUp",
167 | hideDuration: 200,
168 | gap: 5
169 | };
170 |
171 | var inherit = function(a, b) {
172 | var F;
173 | F = function() {};
174 | F.prototype = a;
175 | return $.extend(true, new F(), b);
176 | };
177 |
178 | var defaults = function(opts) {
179 | return $.extend(pluginOptions, opts);
180 | };
181 |
182 | var createElem = function(tag) {
183 | return $("<" + tag + ">" + tag + ">");
184 | };
185 |
186 | var globalAnchors = {};
187 |
188 | var getAnchorElement = function(element) {
189 | var radios;
190 | if (element.is('[type=radio]')) {
191 | radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) {
192 | return $(e).attr("name") === element.attr("name");
193 | });
194 | element = radios.first();
195 | }
196 | return element;
197 | };
198 |
199 | var incr = function(obj, pos, val) {
200 | var opp, temp;
201 | if (typeof val === "string") {
202 | val = parseInt(val, 10);
203 | } else if (typeof val !== "number") {
204 | return;
205 | }
206 | if (isNaN(val)) {
207 | return;
208 | }
209 | opp = positions[opposites[pos.charAt(0)]];
210 | temp = pos;
211 | if (obj[opp] !== undefined) {
212 | pos = positions[opp.charAt(0)];
213 | val = -val;
214 | }
215 | if (obj[pos] === undefined) {
216 | obj[pos] = val;
217 | } else {
218 | obj[pos] += val;
219 | }
220 | return null;
221 | };
222 |
223 | var realign = function(alignment, inner, outer) {
224 | if (alignment === "l" || alignment === "t") {
225 | return 0;
226 | } else if (alignment === "c" || alignment === "m") {
227 | return outer / 2 - inner / 2;
228 | } else if (alignment === "r" || alignment === "b") {
229 | return outer - inner;
230 | }
231 | throw "Invalid alignment";
232 | };
233 |
234 | var encode = function(text) {
235 | encode.e = encode.e || createElem("div");
236 | return encode.e.text(text).html();
237 | };
238 |
239 | function Notification(elem, data, options) {
240 | if (typeof options === "string") {
241 | options = {
242 | className: options
243 | };
244 | }
245 | this.options = inherit(pluginOptions, $.isPlainObject(options) ? options : {});
246 | this.loadHTML();
247 | this.wrapper = $(coreStyle.html);
248 | if (this.options.clickToHide) {
249 | this.wrapper.addClass(pluginClassName + "-hidable");
250 | }
251 | this.wrapper.data(pluginClassName, this);
252 | this.arrow = this.wrapper.find("." + pluginClassName + "-arrow");
253 | this.container = this.wrapper.find("." + pluginClassName + "-container");
254 | this.container.append(this.userContainer);
255 | if (elem && elem.length) {
256 | this.elementType = elem.attr("type");
257 | this.originalElement = elem;
258 | this.elem = getAnchorElement(elem);
259 | this.elem.data(pluginClassName, this);
260 | this.elem.before(this.wrapper);
261 | }
262 | this.container.hide();
263 | this.run(data);
264 | }
265 |
266 | Notification.prototype.loadHTML = function() {
267 | var style;
268 | style = this.getStyle();
269 | this.userContainer = $(style.html);
270 | this.userFields = style.fields;
271 | };
272 |
273 | Notification.prototype.show = function(show, userCallback) {
274 | var args, callback, elems, fn, hidden;
275 | callback = (function(_this) {
276 | return function() {
277 | if (!show && !_this.elem) {
278 | _this.destroy();
279 | }
280 | if (userCallback) {
281 | return userCallback();
282 | }
283 | };
284 | })(this);
285 | hidden = this.container.parent().parents(':hidden').length > 0;
286 | elems = this.container.add(this.arrow);
287 | args = [];
288 | if (hidden && show) {
289 | fn = "show";
290 | } else if (hidden && !show) {
291 | fn = "hide";
292 | } else if (!hidden && show) {
293 | fn = this.options.showAnimation;
294 | args.push(this.options.showDuration);
295 | } else if (!hidden && !show) {
296 | fn = this.options.hideAnimation;
297 | args.push(this.options.hideDuration);
298 | } else {
299 | return callback();
300 | }
301 | args.push(callback);
302 | return elems[fn].apply(elems, args);
303 | };
304 |
305 | Notification.prototype.setGlobalPosition = function() {
306 | var align, anchor, css, key, main, pAlign, pMain, ref;
307 | ref = this.getPosition(), pMain = ref[0], pAlign = ref[1];
308 | main = positions[pMain];
309 | align = positions[pAlign];
310 | key = pMain + "|" + pAlign;
311 | anchor = globalAnchors[key];
312 | if (!anchor) {
313 | anchor = globalAnchors[key] = createElem("div");
314 | css = {};
315 | css[main] = 0;
316 | if (align === "middle") {
317 | css.top = '45%';
318 | } else if (align === "center") {
319 | css.left = '45%';
320 | } else {
321 | css[align] = 0;
322 | }
323 | anchor.css(css).addClass(pluginClassName + "-corner");
324 | $("body").append(anchor);
325 | }
326 | return anchor.prepend(this.wrapper);
327 | };
328 |
329 | Notification.prototype.setElementPosition = function() {
330 | var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, j, k, len, len1, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, ref, wrapPos;
331 | position = this.getPosition();
332 | pMain = position[0], pAlign = position[1], pArrow = position[2];
333 | elemPos = this.elem.position();
334 | elemH = this.elem.outerHeight();
335 | elemW = this.elem.outerWidth();
336 | elemIH = this.elem.innerHeight();
337 | elemIW = this.elem.innerWidth();
338 | wrapPos = this.wrapper.position();
339 | contH = this.container.height();
340 | contW = this.container.width();
341 | mainFull = positions[pMain];
342 | opp = opposites[pMain];
343 | oppFull = positions[opp];
344 | css = {};
345 | css[oppFull] = pMain === "b" ? elemH : pMain === "r" ? elemW : 0;
346 | incr(css, "top", elemPos.top - wrapPos.top);
347 | incr(css, "left", elemPos.left - wrapPos.left);
348 | ref = ["top", "left"];
349 | for (j = 0, len = ref.length; j < len; j++) {
350 | pos = ref[j];
351 | margin = parseInt(this.elem.css("margin-" + pos), 10);
352 | if (margin) {
353 | incr(css, pos, margin);
354 | }
355 | }
356 | gap = Math.max(0, this.options.gap - (this.options.arrowShow ? arrowSize : 0));
357 | incr(css, oppFull, gap);
358 | if (!this.options.arrowShow) {
359 | this.arrow.hide();
360 | } else {
361 | arrowSize = this.options.arrowSize;
362 | arrowCss = $.extend({}, css);
363 | arrowColor = this.userContainer.css("border-color") || this.userContainer.css("background-color") || "white";
364 | for (k = 0, len1 = mainPositions.length; k < len1; k++) {
365 | pos = mainPositions[k];
366 | posFull = positions[pos];
367 | if (pos === opp) {
368 | continue;
369 | }
370 | color = posFull === mainFull ? arrowColor : "transparent";
371 | arrowCss["border-" + posFull] = arrowSize + "px solid " + color;
372 | }
373 | incr(css, positions[opp], arrowSize);
374 | if (indexOf.call(mainPositions, pAlign) >= 0) {
375 | incr(arrowCss, positions[pAlign], arrowSize * 2);
376 | }
377 | }
378 | if (indexOf.call(vAligns, pMain) >= 0) {
379 | incr(css, "left", realign(pAlign, contW, elemW));
380 | if (arrowCss) {
381 | incr(arrowCss, "left", realign(pAlign, arrowSize, elemIW));
382 | }
383 | } else if (indexOf.call(hAligns, pMain) >= 0) {
384 | incr(css, "top", realign(pAlign, contH, elemH));
385 | if (arrowCss) {
386 | incr(arrowCss, "top", realign(pAlign, arrowSize, elemIH));
387 | }
388 | }
389 | if (this.container.is(":visible")) {
390 | css.display = "block";
391 | }
392 | this.container.removeAttr("style").css(css);
393 | if (arrowCss) {
394 | return this.arrow.removeAttr("style").css(arrowCss);
395 | }
396 | };
397 |
398 | Notification.prototype.getPosition = function() {
399 | var pos, ref, ref1, ref2, ref3, ref4, ref5, text;
400 | text = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition);
401 | pos = parsePosition(text);
402 | if (pos.length === 0) {
403 | pos[0] = "b";
404 | }
405 | if (ref = pos[0], indexOf.call(mainPositions, ref) < 0) {
406 | throw "Must be one of [" + mainPositions + "]";
407 | }
408 | if (pos.length === 1 || ((ref1 = pos[0], indexOf.call(vAligns, ref1) >= 0) && (ref2 = pos[1], indexOf.call(hAligns, ref2) < 0)) || ((ref3 = pos[0], indexOf.call(hAligns, ref3) >= 0) && (ref4 = pos[1], indexOf.call(vAligns, ref4) < 0))) {
409 | pos[1] = (ref5 = pos[0], indexOf.call(hAligns, ref5) >= 0) ? "m" : "l";
410 | }
411 | if (pos.length === 2) {
412 | pos[2] = pos[1];
413 | }
414 | return pos;
415 | };
416 |
417 | Notification.prototype.getStyle = function(name) {
418 | var style;
419 | if (!name) {
420 | name = this.options.style;
421 | }
422 | if (!name) {
423 | name = "default";
424 | }
425 | style = styles[name];
426 | if (!style) {
427 | throw "Missing style: " + name;
428 | }
429 | return style;
430 | };
431 |
432 | Notification.prototype.updateClasses = function() {
433 | var classes, style;
434 | classes = ["base"];
435 | if ($.isArray(this.options.className)) {
436 | classes = classes.concat(this.options.className);
437 | } else if (this.options.className) {
438 | classes.push(this.options.className);
439 | }
440 | style = this.getStyle();
441 | classes = $.map(classes, function(n) {
442 | return pluginClassName + "-" + style.name + "-" + n;
443 | }).join(" ");
444 | return this.userContainer.attr("class", classes);
445 | };
446 |
447 | Notification.prototype.run = function(data, options) {
448 | var d, datas, name, type, value;
449 | if ($.isPlainObject(options)) {
450 | $.extend(this.options, options);
451 | } else if ($.type(options) === "string") {
452 | this.options.className = options;
453 | }
454 | if (this.container && !data) {
455 | this.show(false);
456 | return;
457 | } else if (!this.container && !data) {
458 | return;
459 | }
460 | datas = {};
461 | if ($.isPlainObject(data)) {
462 | datas = data;
463 | } else {
464 | datas[blankFieldName] = data;
465 | }
466 | for (name in datas) {
467 | d = datas[name];
468 | type = this.userFields[name];
469 | if (!type) {
470 | continue;
471 | }
472 | if (type === "text") {
473 | d = encode(d);
474 | if (this.options.breakNewLines) {
475 | d = d.replace(/\n/g, '
');
476 | }
477 | }
478 | value = name === blankFieldName ? '' : '=' + name;
479 | find(this.userContainer, "[data-notify-" + type + value + "]").html(d);
480 | }
481 | this.updateClasses();
482 | if (this.elem) {
483 | this.setElementPosition();
484 | } else {
485 | this.setGlobalPosition();
486 | }
487 | this.show(true);
488 | if (this.options.autoHide) {
489 | clearTimeout(this.autohideTimer);
490 | this.autohideTimer = setTimeout(this.show.bind(this, false), this.options.autoHideDelay);
491 | }
492 | };
493 |
494 | Notification.prototype.destroy = function() {
495 | return this.wrapper.remove();
496 | };
497 |
498 | $[pluginName] = function(elem, data, options) {
499 | if ((elem && elem.nodeName) || elem.jquery) {
500 | $(elem)[pluginName](data, options);
501 | } else {
502 | options = data;
503 | data = elem;
504 | new Notification(null, data, options);
505 | }
506 | return elem;
507 | };
508 |
509 | $.fn[pluginName] = function(data, options) {
510 | $(this).each(function() {
511 | var inst;
512 | inst = getAnchorElement($(this)).data(pluginClassName);
513 | if (inst) {
514 | return inst.run(data, options);
515 | } else {
516 | return new Notification($(this), data, options);
517 | }
518 | });
519 | return this;
520 | };
521 |
522 | $.extend($[pluginName], {
523 | defaults: defaults,
524 | addStyle: addStyle,
525 | pluginOptions: pluginOptions,
526 | getStyle: getStyle,
527 | insertCSS: insertCSS
528 | });
529 |
530 | //always include the default bootstrap style
531 | addStyle("bootstrap", {
532 | html: "
\n\n
",
533 | classes: {
534 | base: {
535 | "font-weight": "bold",
536 | "padding": "8px 15px 8px 14px",
537 | "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
538 | "background-color": "#fcf8e3",
539 | "border": "1px solid #fbeed5",
540 | "border-radius": "4px",
541 | "white-space": "nowrap",
542 | "padding-left": "25px",
543 | "background-repeat": "no-repeat",
544 | "background-position": "3px 7px"
545 | },
546 | error: {
547 | "color": "#B94A48",
548 | "background-color": "#F2DEDE",
549 | "border-color": "#EED3D7",
550 | "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
551 | },
552 | success: {
553 | "color": "#468847",
554 | "background-color": "#DFF0D8",
555 | "border-color": "#D6E9C6",
556 | "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
557 | },
558 | info: {
559 | "color": "#3A87AD",
560 | "background-color": "#D9EDF7",
561 | "border-color": "#BCE8F1",
562 | "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
563 | },
564 | warn: {
565 | "color": "#C09853",
566 | "background-color": "#FCF8E3",
567 | "border-color": "#FBEED5",
568 | "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
569 | }
570 | }
571 | });
572 |
573 | $(function() {
574 | insertCSS(coreStyle.css).attr("id", "core-notify");
575 | $(document).on("click", "." + pluginClassName + "-hidable", function(e) {
576 | return $(this).trigger("notify-hide");
577 | });
578 | return $(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
579 | var elem = $(this).data(pluginClassName);
580 | if(elem) {
581 | elem.show(false);
582 | }
583 | });
584 | });
585 |
586 | }).call(this, window, document, jQuery);
--------------------------------------------------------------------------------
/assets/themes/noty.js:
--------------------------------------------------------------------------------
1 | !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b});var b={init:function(b){return this.options=a.extend({},a.noty.defaults,b),this.options.layout=this.options.custom?a.noty.layouts.inline:a.noty.layouts[this.options.layout],a.noty.themes[this.options.theme]?this.options.theme=a.noty.themes[this.options.theme]:b.themeClassName=this.options.theme,delete b.layout,delete b.theme,this.options=a.extend({},this.options,this.options.layout.options),this.options.id="noty_"+(new Date).getTime()*Math.floor(1e6*Math.random()),this.options=a.extend({},this.options,b),this._build(),this},_build:function(){var b=a('
').attr("id",this.options.id);if(b.append(this.options.template).find(".noty_text").html(this.options.text),this.$bar=null!==this.options.layout.parent.object?a(this.options.layout.parent.object).css(this.options.layout.parent.css).append(b):b,this.options.themeClassName&&this.$bar.addClass(this.options.themeClassName).addClass("noty_container_type_"+this.options.type),this.options.buttons){this.options.closeWith=[],this.options.timeout=!1;var c=a("
").addClass("noty_buttons");null!==this.options.layout.parent.object?this.$bar.find(".noty_bar").append(c):this.$bar.append(c);var d=this;a.each(this.options.buttons,function(b,c){var e=a("
").addClass(c.addClass?c.addClass:"gray").html(c.text).attr("id",c.id?c.id:"button-"+b).attr("title",c.title).appendTo(d.$bar.find(".noty_buttons")).on("click",function(b){a.isFunction(c.onClick)&&c.onClick.call(e,d,b)})})}this.$message=this.$bar.find(".noty_message"),this.$closeButton=this.$bar.find(".noty_close"),this.$buttons=this.$bar.find(".noty_buttons"),a.noty.store[this.options.id]=this},show:function(){var b=this;return b.options.custom?b.options.custom.find(b.options.layout.container.selector).append(b.$bar):a(b.options.layout.container.selector).append(b.$bar),b.options.theme&&b.options.theme.style&&b.options.theme.style.apply(b),"function"===a.type(b.options.layout.css)?this.options.layout.css.apply(b.$bar):b.$bar.css(this.options.layout.css||{}),b.$bar.addClass(b.options.layout.addClass),b.options.layout.container.style.apply(a(b.options.layout.container.selector),[b.options.within]),b.showing=!0,b.options.theme&&b.options.theme.style&&b.options.theme.callback.onShow.apply(this),a.inArray("click",b.options.closeWith)>-1&&b.$bar.css("cursor","pointer").one("click",function(a){b.stopPropagation(a),b.options.callback.onCloseClick&&b.options.callback.onCloseClick.apply(b),b.close()}),a.inArray("hover",b.options.closeWith)>-1&&b.$bar.one("mouseenter",function(){b.close()}),a.inArray("button",b.options.closeWith)>-1&&b.$closeButton.one("click",function(a){b.stopPropagation(a),b.close()}),-1==a.inArray("button",b.options.closeWith)&&b.$closeButton.remove(),b.options.callback.onShow&&b.options.callback.onShow.apply(b),"string"==typeof b.options.animation.open?(b.$bar.css("height",b.$bar.innerHeight()),b.$bar.on("click",function(a){b.wasClicked=!0}),b.$bar.show().addClass(b.options.animation.open).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b.options.callback.afterShow&&b.options.callback.afterShow.apply(b),b.showing=!1,b.shown=!0,b.hasOwnProperty("wasClicked")&&(b.$bar.off("click",function(a){b.wasClicked=!0}),b.close())})):b.$bar.animate(b.options.animation.open,b.options.animation.speed,b.options.animation.easing,function(){b.options.callback.afterShow&&b.options.callback.afterShow.apply(b),b.showing=!1,b.shown=!0}),b.options.timeout&&b.$bar.delay(b.options.timeout).promise().done(function(){b.close()}),this},close:function(){if(!(this.closed||this.$bar&&this.$bar.hasClass("i-am-closing-now"))){var b=this;if(this.showing)return void b.$bar.queue(function(){b.close.apply(b)});if(!this.shown&&!this.showing){var c=[];return a.each(a.noty.queue,function(a,d){d.options.id!=b.options.id&&c.push(d)}),void(a.noty.queue=c)}b.$bar.addClass("i-am-closing-now"),b.options.callback.onClose&&b.options.callback.onClose.apply(b),"string"==typeof b.options.animation.close?b.$bar.addClass(b.options.animation.close).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b.options.callback.afterClose&&b.options.callback.afterClose.apply(b),b.closeCleanUp()}):b.$bar.clearQueue().stop().animate(b.options.animation.close,b.options.animation.speed,b.options.animation.easing,function(){b.options.callback.afterClose&&b.options.callback.afterClose.apply(b)}).promise().done(function(){b.closeCleanUp()})}},closeCleanUp:function(){var b=this;b.options.modal&&(a.notyRenderer.setModalCount(-1),0==a.notyRenderer.getModalCount()&&a(".noty_modal").fadeOut(b.options.animation.fadeSpeed,function(){a(this).remove()})),a.notyRenderer.setLayoutCountFor(b,-1),0==a.notyRenderer.getLayoutCountFor(b)&&a(b.options.layout.container.selector).remove(),"undefined"!=typeof b.$bar&&null!==b.$bar&&("string"==typeof b.options.animation.close?(b.$bar.css("transition","all 100ms ease").css("border",0).css("margin",0).height(0),b.$bar.one("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){b.$bar.remove(),b.$bar=null,b.closed=!0,b.options.theme.callback&&b.options.theme.callback.onClose&&b.options.theme.callback.onClose.apply(b)})):(b.$bar.remove(),b.$bar=null,b.closed=!0)),delete a.noty.store[b.options.id],b.options.theme.callback&&b.options.theme.callback.onClose&&b.options.theme.callback.onClose.apply(b),b.options.dismissQueue||(a.noty.ontap=!0,a.notyRenderer.render()),b.options.maxVisible>0&&b.options.dismissQueue&&a.notyRenderer.render()},setText:function(a){return this.closed||(this.options.text=a,this.$bar.find(".noty_text").html(a)),this},setType:function(a){return this.closed||(this.options.type=a,this.options.theme.style.apply(this),this.options.theme.callback.onShow.apply(this)),this},setTimeout:function(a){if(!this.closed){var b=this;this.options.timeout=a,b.$bar.delay(b.options.timeout).promise().done(function(){b.close()})}return this},stopPropagation:function(a){a=a||window.event,"undefined"!=typeof a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},closed:!1,showing:!1,shown:!1};a.notyRenderer={},a.notyRenderer.init=function(c){var d=Object.create(b).init(c);return d.options.killer&&a.noty.closeAll(),d.options.force?a.noty.queue.unshift(d):a.noty.queue.push(d),a.notyRenderer.render(),"object"==a.noty.returns?d:d.options.id},a.notyRenderer.render=function(){var b=a.noty.queue[0];"object"===a.type(b)?b.options.dismissQueue?b.options.maxVisible>0?a(b.options.layout.container.selector+" > li").length
").addClass("noty_modal").addClass(b.options.theme).data("noty_modal_count",0);b.options.theme.modal&&b.options.theme.modal.css&&c.css(b.options.theme.modal.css),c.prependTo(a("body")).fadeIn(b.options.animation.fadeSpeed),a.inArray("backdrop",b.options.closeWith)>-1&&c.on("click",function(b){a.noty.closeAll()})}},a.notyRenderer.getLayoutCountFor=function(b){return a(b.options.layout.container.selector).data("noty_layout_count")||0},a.notyRenderer.setLayoutCountFor=function(b,c){return a(b.options.layout.container.selector).data("noty_layout_count",a.notyRenderer.getLayoutCountFor(b)+c)},a.notyRenderer.getModalCount=function(){return a(".noty_modal").data("noty_modal_count")||0},a.notyRenderer.setModalCount=function(b){return a(".noty_modal").data("noty_modal_count",a.notyRenderer.getModalCount()+b)},a.fn.noty=function(b){return b.custom=a(this),a.notyRenderer.init(b)},a.noty={},a.noty.queue=[],a.noty.ontap=!0,a.noty.layouts={},a.noty.themes={},a.noty.returns="object",a.noty.store={},a.noty.get=function(b){return a.noty.store.hasOwnProperty(b)?a.noty.store[b]:!1},a.noty.close=function(b){return a.noty.get(b)?a.noty.get(b).close():!1},a.noty.setText=function(b,c){return a.noty.get(b)?a.noty.get(b).setText(c):!1},a.noty.setType=function(b,c){return a.noty.get(b)?a.noty.get(b).setType(c):!1},a.noty.clearQueue=function(){a.noty.queue=[]},a.noty.closeAll=function(){a.noty.clearQueue(),a.each(a.noty.store,function(a,b){b.close()})};var c=window.alert;return a.noty.consumeAlert=function(b){window.alert=function(c){b?b.text=c:b={text:c},a.notyRenderer.init(b)}},a.noty.stopConsumeAlert=function(){window.alert=c},a.noty.defaults={layout:"top",theme:"defaultTheme",type:"alert",text:"",dismissQueue:!0,template:'',animation:{open:{height:"toggle"},close:{height:"toggle"},easing:"swing",speed:500,fadeSpeed:"fast"},timeout:!1,force:!1,modal:!1,maxVisible:5,killer:!1,closeWith:["click"],callback:{onShow:function(){},afterShow:function(){},onClose:function(){},afterClose:function(){},onCloseClick:function(){}},buttons:!1},a(window).on("resize",function(){a.each(a.noty.layouts,function(b,c){c.container.style.apply(a(c.container.selector))})}),window.noty=function(b){return a.notyRenderer.init(b)},a.noty.layouts.bottom={name:"bottom",options:{},container:{object:'',selector:"ul#noty_bottom_layout_container",style:function(){a(this).css({bottom:0,left:"5%",position:"fixed",width:"90%",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:9999999})}},parent:{object:"",selector:"li",css:{}},css:{display:"none"},addClass:""},a.noty.layouts.bottomCenter={name:"bottomCenter",options:{},container:{object:'',selector:"ul#noty_bottomCenter_layout_container",style:function(){a(this).css({bottom:20,left:0,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),a(this).css({left:(a(window).width()-a(this).outerWidth(!1))/2+"px"})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.bottomLeft={name:"bottomLeft",options:{},container:{object:'',selector:"ul#noty_bottomLeft_layout_container",style:function(){a(this).css({bottom:20,left:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&a(this).css({left:5})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.bottomRight={name:"bottomRight",options:{},container:{object:'',selector:"ul#noty_bottomRight_layout_container",style:function(){a(this).css({bottom:20,right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&a(this).css({right:5})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.center={name:"center",options:{},container:{object:'',selector:"ul#noty_center_layout_container",style:function(){a(this).css({position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});var b=a(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");a("body").append(b),b.find(".i-am-closing-now").remove(),b.find("li").css("display","block");var c=b.height();b.remove(),a(this).hasClass("i-am-new")?a(this).css({left:(a(window).width()-a(this).outerWidth(!1))/2+"px",top:(a(window).height()-c)/2+"px"}):a(this).animate({left:(a(window).width()-a(this).outerWidth(!1))/2+"px",top:(a(window).height()-c)/2+"px"},500)}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.centerLeft={name:"centerLeft",options:{},container:{object:'',selector:"ul#noty_centerLeft_layout_container",style:function(){a(this).css({left:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});var b=a(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");a("body").append(b),b.find(".i-am-closing-now").remove(),b.find("li").css("display","block");var c=b.height();b.remove(),a(this).hasClass("i-am-new")?a(this).css({top:(a(window).height()-c)/2+"px"}):a(this).animate({top:(a(window).height()-c)/2+"px"},500),window.innerWidth<600&&a(this).css({left:5})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.centerRight={name:"centerRight",options:{},container:{object:'',selector:"ul#noty_centerRight_layout_container",style:function(){a(this).css({right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});var b=a(this).clone().css({visibility:"hidden",display:"block",position:"absolute",top:0,left:0}).attr("id","dupe");a("body").append(b),b.find(".i-am-closing-now").remove(),b.find("li").css("display","block");var c=b.height();b.remove(),a(this).hasClass("i-am-new")?a(this).css({top:(a(window).height()-c)/2+"px"}):a(this).animate({top:(a(window).height()-c)/2+"px"},500),window.innerWidth<600&&a(this).css({right:5})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.inline={name:"inline",options:{},container:{object:'',selector:"ul.noty_inline_layout_container",style:function(){a(this).css({width:"100%",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:9999999})}},parent:{object:"",selector:"li",css:{}},css:{display:"none"},addClass:""},a.noty.layouts.top={name:"top",options:{},container:{object:'',selector:"ul#noty_top_layout_container",style:function(){a(this).css({top:0,left:"5%",position:"fixed",width:"90%",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:9999999})}},parent:{object:"",selector:"li",css:{}},css:{display:"none"},addClass:""},a.noty.layouts.topCenter={name:"topCenter",options:{},container:{object:'',selector:"ul#noty_topCenter_layout_container",style:function(){a(this).css({top:20,left:0,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),a(this).css({left:(a(window).width()-a(this).outerWidth(!1))/2+"px"})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.topLeft={name:"topLeft",options:{},container:{object:'',selector:"ul#noty_topLeft_layout_container",style:function(){a(this).css({top:20,left:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&a(this).css({left:5})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.layouts.topRight={name:"topRight",options:{},container:{object:'',selector:"ul#noty_topRight_layout_container",style:function(){a(this).css({top:20,right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7}),window.innerWidth<600&&a(this).css({right:5})}},parent:{object:"",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""},a.noty.themes.bootstrapTheme={name:"bootstrapTheme",modal:{css:{position:"fixed",width:"100%",height:"100%",backgroundColor:"#000",zIndex:1e4,opacity:.6,display:"none",left:0,top:0}},style:function(){var b=this.options.layout.container.selector;switch(a(b).addClass("list-group"),this.$closeButton.append('×Close'),this.$closeButton.addClass("close"),this.$bar.addClass("list-group-item").css("padding","0px"),this.options.type){case"alert":case"notification":this.$bar.addClass("list-group-item-info");break;case"warning":this.$bar.addClass("list-group-item-warning");break;case"error":this.$bar.addClass("list-group-item-danger");break;case"information":this.$bar.addClass("list-group-item-info");break;case"success":this.$bar.addClass("list-group-item-success")}this.$message.css({fontSize:"13px",lineHeight:"16px",textAlign:"center",padding:"8px 10px 9px",width:"auto",position:"relative"})},callback:{onShow:function(){},onClose:function(){}}},a.noty.themes.defaultTheme={name:"defaultTheme",helpers:{borderFix:function(){if(this.options.dismissQueue){var b=this.options.layout.container.selector+" "+this.options.layout.parent.selector;switch(this.options.layout.name){case"top":a(b).css({borderRadius:"0px 0px 0px 0px"}),a(b).last().css({borderRadius:"0px 0px 5px 5px"});break;case"topCenter":case"topLeft":case"topRight":case"bottomCenter":case"bottomLeft":case"bottomRight":case"center":case"centerLeft":case"centerRight":case"inline":a(b).css({borderRadius:"0px 0px 0px 0px"}),a(b).first().css({"border-top-left-radius":"5px","border-top-right-radius":"5px"}),a(b).last().css({"border-bottom-left-radius":"5px","border-bottom-right-radius":"5px"});break;case"bottom":a(b).css({borderRadius:"0px 0px 0px 0px"}),a(b).first().css({borderRadius:"5px 5px 0px 0px"})}}}},modal:{css:{position:"fixed",width:"100%",height:"100%",backgroundColor:"#000",zIndex:1e4,opacity:.6,display:"none",left:0,top:0}},style:function(){switch(this.$bar.css({overflow:"hidden",background:"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAQAAAClM0ndAAAAhklEQVR4AdXO0QrCMBBE0bttkk38/w8WRERpdyjzVOc+HxhIHqJGMQcFFkpYRQotLLSw0IJ5aBdovruMYDA/kT8plF9ZKLFQcgF18hDj1SbQOMlCA4kao0iiXmah7qBWPdxpohsgVZyj7e5I9KcID+EhiDI5gxBYKLBQYKHAQoGFAoEks/YEGHYKB7hFxf0AAAAASUVORK5CYII=') repeat-x scroll left top #fff"}),this.$message.css({fontSize:"13px",lineHeight:"16px",textAlign:"center",padding:"8px 10px 9px",width:"auto",position:"relative"}),this.$closeButton.css({position:"absolute",top:4,right:4,width:10,height:10,background:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAxUlEQVR4AR3MPUoDURSA0e++uSkkOxC3IAOWNtaCIDaChfgXBMEZbQRByxCwk+BasgQRZLSYoLgDQbARxry8nyumPcVRKDfd0Aa8AsgDv1zp6pYd5jWOwhvebRTbzNNEw5BSsIpsj/kurQBnmk7sIFcCF5yyZPDRG6trQhujXYosaFoc+2f1MJ89uc76IND6F9BvlXUdpb6xwD2+4q3me3bysiHvtLYrUJto7PD/ve7LNHxSg/woN2kSz4txasBdhyiz3ugPGetTjm3XRokAAAAASUVORK5CYII=)",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.on({mouseenter:function(){a(this).find(".noty_close").stop().fadeTo("normal",1)},mouseleave:function(){a(this).find(".noty_close").stop().fadeTo("normal",0)}}),this.options.layout.name){case"top":this.$bar.css({borderRadius:"0px 0px 5px 5px",borderBottom:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"});break;case"topCenter":case"center":case"bottomCenter":case"inline":this.$bar.css({borderRadius:"5px",border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}),this.$message.css({fontSize:"13px",textAlign:"center"});break;case"topLeft":case"topRight":case"bottomLeft":case"bottomRight":case"centerLeft":case"centerRight":this.$bar.css({borderRadius:"5px",border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}),this.$message.css({fontSize:"13px",textAlign:"left"});break;case"bottom":this.$bar.css({borderRadius:"5px 5px 0px 0px",borderTop:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",boxShadow:"0 -2px 4px rgba(0, 0, 0, 0.1)"});break;default:this.$bar.css({border:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"})}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"})}},callback:{onShow:function(){a.noty.themes.defaultTheme.helpers.borderFix.apply(this)},onClose:function(){a.noty.themes.defaultTheme.helpers.borderFix.apply(this)}}},a.noty.themes.relax={name:"relax",helpers:{},modal:{css:{position:"fixed",width:"100%",height:"100%",backgroundColor:"#000",zIndex:1e4,opacity:.6,display:"none",left:0,top:0}},style:function(){switch(this.$bar.css({overflow:"hidden",margin:"4px 0",borderRadius:"2px"}),this.$message.css({fontSize:"14px",lineHeight:"16px",textAlign:"center",padding:"10px",width:"auto",position:"relative"}),this.$closeButton.css({position:"absolute",top:4,right:4,width:10,height:10,background:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAxUlEQVR4AR3MPUoDURSA0e++uSkkOxC3IAOWNtaCIDaChfgXBMEZbQRByxCwk+BasgQRZLSYoLgDQbARxry8nyumPcVRKDfd0Aa8AsgDv1zp6pYd5jWOwhvebRTbzNNEw5BSsIpsj/kurQBnmk7sIFcCF5yyZPDRG6trQhujXYosaFoc+2f1MJ89uc76IND6F9BvlXUdpb6xwD2+4q3me3bysiHvtLYrUJto7PD/ve7LNHxSg/woN2kSz4txasBdhyiz3ugPGetTjm3XRokAAAAASUVORK5CYII=)",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.on({mouseenter:function(){a(this).find(".noty_close").stop().fadeTo("normal",1)},mouseleave:function(){a(this).find(".noty_close").stop().fadeTo("normal",0)}}),this.options.layout.name){case"top":this.$bar.css({borderBottom:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",borderTop:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"});break;case"topCenter":case"center":case"bottomCenter":case"inline":this.$bar.css({border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}),this.$message.css({fontSize:"13px",textAlign:"center"});break;case"topLeft":case"topRight":case"bottomLeft":case"bottomRight":case"centerLeft":case"centerRight":this.$bar.css({border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}),this.$message.css({fontSize:"13px",textAlign:"left"});break;case"bottom":this.$bar.css({borderTop:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",borderBottom:"2px solid #eee",boxShadow:"0 -2px 4px rgba(0, 0, 0, 0.1)"});break;default:this.$bar.css({border:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"})}switch(this.options.type){case"alert":case"notification":this.$bar.css({backgroundColor:"#FFF",borderColor:"#dedede",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:"#FF8181",borderColor:"#e25353",color:"#FFF"}),this.$message.css({fontWeight:"bold"}),this.$buttons.css({borderTop:"1px solid darkred"});break;case"information":this.$bar.css({backgroundColor:"#78C5E7",borderColor:"#3badd6",color:"#FFF"}),this.$buttons.css({borderTop:"1px solid #0B90C4"});break;case"success":this.$bar.css({backgroundColor:"#BCF5BC",borderColor:"#7cdd77",color:"darkgreen"}),this.$buttons.css({borderTop:"1px solid #50C24E"});break;default:this.$bar.css({backgroundColor:"#FFF",borderColor:"#CCC",color:"#444"})}},callback:{onShow:function(){},onClose:function(){}}},window.noty});
--------------------------------------------------------------------------------
/assets/themes/pnotify.css:
--------------------------------------------------------------------------------
1 | .ui-pnotify{top:25px;right:25px;position:absolute;height:auto;z-index:9999}html>body>.ui-pnotify{position:fixed}.ui-pnotify .ui-pnotify-shadow{-webkit-box-shadow:0 2px 10px rgba(50,50,50,.5);-moz-box-shadow:0 2px 10px rgba(50,50,50,.5);box-shadow:0 2px 10px rgba(50,50,50,.5)}.ui-pnotify-container{background-position:0 0;padding:.8em;height:100%;margin:0}.ui-pnotify-container.ui-pnotify-sharp{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ui-pnotify-title{display:block;margin-bottom:.4em;margin-top:0}.ui-pnotify-text{display:block}.ui-pnotify-icon,.ui-pnotify-icon span{display:block;float:left;margin-right:.2em}.ui-pnotify.stack-bottomleft,.ui-pnotify.stack-topleft{left:25px;right:auto}.ui-pnotify.stack-bottomleft,.ui-pnotify.stack-bottomright{bottom:25px;top:auto}.brighttheme{-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.brighttheme-notice{background-color:#FFFF67;border:1px solid #FF0;color:#292900}.brighttheme-info{background-color:#5FC9E2;border:1px solid #05C7F4;color:#001519}.brighttheme-success{background-color:#85F362;border:1px solid #3CFB00;color:#082300}.brighttheme-error{background-color:#FF7567;background-image:repeating-linear-gradient(135deg,transparent,transparent 35px,rgba(255,255,255,.3) 35px,rgba(255,255,255,.3) 70px);border:1px solid #FF1800;color:#290400}.brighttheme-icon-closer,.brighttheme-icon-info,.brighttheme-icon-notice,.brighttheme-icon-sticker,.brighttheme-icon-success{position:relative;width:16px;height:16px;font-size:12px;font-weight:700;line-height:16px;font-family:"Courier New",Courier,monospace;border-radius:50%}.brighttheme-icon-closer:after,.brighttheme-icon-info:after,.brighttheme-icon-notice:after,.brighttheme-icon-sticker:after,.brighttheme-icon-success:after{position:absolute;top:0;left:4px}.brighttheme-icon-notice{background-color:#292900;color:#FFFF67}.brighttheme-icon-notice:after{content:"!"}.brighttheme-icon-info{background-color:#001519;color:#5FC9E2}.brighttheme-icon-info:after{content:"i"}.brighttheme-icon-success{background-color:#082300;color:#85F362}.brighttheme-icon-success:after{content:"\002713"}.brighttheme-icon-error{position:relative;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:16px solid #290400;font-size:0;line-height:0;color:#FF7567}.brighttheme-icon-error:after{position:absolute;top:1px;left:-4px;font-size:12px;font-weight:700;line-height:16px;font-family:"Courier New",Courier,monospace;content:"!"}.brighttheme-icon-closer,.brighttheme-icon-sticker{display:inline-block}.brighttheme-icon-closer:after{top:-4px;content:"\002715"}.brighttheme-icon-sticker:after{top:-5px;content:"\01D1BC";-moz-transform:rotate(-90deg);-webkit-transform:rotate(-90deg);-o-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}.brighttheme-icon-sticker.brighttheme-icon-stuck:after{-moz-transform:rotate(180deg);-webkit-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.ui-pnotify-closer,.ui-pnotify-sticker{float:right;margin-left:.2em}
--------------------------------------------------------------------------------
/assets/themes/pnotify.js:
--------------------------------------------------------------------------------
1 | /*
2 | PNotify 2.1.0 sciactive.com/pnotify/
3 | (C) 2015 Hunter Perrin
4 | license GPL/LGPL/MPL
5 | */
6 | (function(c){"object"===typeof exports&&"undefined"!==typeof module?module.exports=c(require("jquery")):"function"===typeof define&&define.amd?define("pnotify",["jquery"],c):c(jQuery)})(function(c){var q={dir1:"down",dir2:"left",push:"bottom",spacing1:25,spacing2:25,context:c("body")},e,f,h=c(window),p=function(){f=c("body");PNotify.prototype.options.stack.context=f;h=c(window);h.bind("resize",function(){e&&clearTimeout(e);e=setTimeout(function(){PNotify.positionAll(!0)},10)})};PNotify=function(b){this.parseOptions(b);
7 | this.init()};c.extend(PNotify.prototype,{version:"2.1.0",options:{title:!1,title_escape:!1,text:!1,text_escape:!1,styling:"brighttheme",addclass:"",cornerclass:"",auto_display:!0,width:"300px",min_height:"16px",type:"notice",icon:!0,opacity:1,animation:"fade",animate_speed:"slow",position_animate_speed:500,shadow:!0,hide:!0,delay:8E3,mouse_reset:!0,remove:!0,insert_brs:!0,destroy:!0,stack:q},modules:{},runModules:function(b,a){var m,c;for(c in this.modules)if(m="object"===typeof a&&c in a?a[c]:a,
8 | "function"===typeof this.modules[c][b])this.modules[c][b](this,"object"===typeof this.options[c]?this.options[c]:{},m)},state:"initializing",timer:null,styles:null,elem:null,container:null,title_container:null,text_container:null,animating:!1,timerHide:!1,init:function(){var b=this;this.modules={};c.extend(!0,this.modules,PNotify.prototype.modules);this.styles="object"===typeof this.options.styling?this.options.styling:PNotify.styling[this.options.styling];this.elem=c("",{"class":"ui-pnotify "+
9 | this.options.addclass,css:{display:"none"},"aria-live":"assertive",mouseenter:function(a){if(b.options.mouse_reset&&"out"===b.animating){if(!b.timerHide)return;b.cancelRemove()}b.options.hide&&b.options.mouse_reset&&b.cancelRemove()},mouseleave:function(a){b.options.hide&&b.options.mouse_reset&&"out"!==b.animating&&b.queueRemove();PNotify.positionAll()}});this.container=c("",{"class":this.styles.container+" ui-pnotify-container "+("error"===this.options.type?this.styles.error:"info"===this.options.type?
10 | this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice),role:"alert"}).appendTo(this.elem);""!==this.options.cornerclass&&this.container.removeClass("ui-corner-all").addClass(this.options.cornerclass);this.options.shadow&&this.container.addClass("ui-pnotify-shadow");!1!==this.options.icon&&c("",{"class":"ui-pnotify-icon"}).append(c("",{"class":!0===this.options.icon?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:
11 | "success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container);this.title_container=c("",{"class":"ui-pnotify-title"}).appendTo(this.container);!1===this.options.title?this.title_container.hide():this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title);this.text_container=c("",{"class":"ui-pnotify-text"}).appendTo(this.container);!1===this.options.text?this.text_container.hide():
12 | this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,"
"):this.options.text);"string"===typeof this.options.width&&this.elem.css("width",this.options.width);"string"===typeof this.options.min_height&&this.container.css("min-height",this.options.min_height);PNotify.notices="top"===this.options.stack.push?c.merge([this],PNotify.notices):c.merge(PNotify.notices,[this]);"top"===this.options.stack.push&&
13 | this.queuePosition(!1,1);this.options.stack.animation=!1;this.runModules("init");this.options.auto_display&&this.open();return this},update:function(b){var a=this.options;this.parseOptions(a,b);this.options.cornerclass!==a.cornerclass&&this.container.removeClass("ui-corner-all "+a.cornerclass).addClass(this.options.cornerclass);this.options.shadow!==a.shadow&&(this.options.shadow?this.container.addClass("ui-pnotify-shadow"):this.container.removeClass("ui-pnotify-shadow"));!1===this.options.addclass?
14 | this.elem.removeClass(a.addclass):this.options.addclass!==a.addclass&&this.elem.removeClass(a.addclass).addClass(this.options.addclass);!1===this.options.title?this.title_container.slideUp("fast"):this.options.title!==a.title&&(this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title),!1===a.title&&this.title_container.slideDown(200));!1===this.options.text?this.text_container.slideUp("fast"):this.options.text!==a.text&&(this.options.text_escape?
15 | this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,"
"):this.options.text),!1===a.text&&this.text_container.slideDown(200));this.options.type!==a.type&&this.container.removeClass(this.styles.error+" "+this.styles.notice+" "+this.styles.success+" "+this.styles.info).addClass("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:
16 | this.styles.notice);if(this.options.icon!==a.icon||!0===this.options.icon&&this.options.type!==a.type)this.container.find("div.ui-pnotify-icon").remove(),!1!==this.options.icon&&c("",{"class":"ui-pnotify-icon"}).append(c("",{"class":!0===this.options.icon?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container);this.options.width!==
17 | a.width&&this.elem.animate({width:this.options.width});this.options.min_height!==a.min_height&&this.container.animate({minHeight:this.options.min_height});this.options.opacity!==a.opacity&&this.elem.fadeTo(this.options.animate_speed,this.options.opacity);this.options.hide?a.hide||this.queueRemove():this.cancelRemove();this.queuePosition(!0);this.runModules("update",a);return this},open:function(){this.state="opening";this.runModules("beforeOpen");var b=this;this.elem.parent().length||this.elem.appendTo(this.options.stack.context?
18 | this.options.stack.context:f);"top"!==this.options.stack.push&&this.position(!0);"fade"===this.options.animation||"fade"===this.options.animation.effect_in?this.elem.show().fadeTo(0,0).hide():1!==this.options.opacity&&this.elem.show().fadeTo(0,this.options.opacity).hide();this.animateIn(function(){b.queuePosition(!0);b.options.hide&&b.queueRemove();b.state="open";b.runModules("afterOpen")});return this},remove:function(b){this.state="closing";this.timerHide=!!b;this.runModules("beforeClose");var a=
19 | this;this.timer&&(window.clearTimeout(this.timer),this.timer=null);this.animateOut(function(){a.state="closed";a.runModules("afterClose");a.queuePosition(!0);a.options.remove&&a.elem.detach();a.runModules("beforeDestroy");if(a.options.destroy&&null!==PNotify.notices){var b=c.inArray(a,PNotify.notices);-1!==b&&PNotify.notices.splice(b,1)}a.runModules("afterDestroy")});return this},get:function(){return this.elem},parseOptions:function(b,a){this.options=c.extend(!0,{},PNotify.prototype.options);this.options.stack=
20 | PNotify.prototype.options.stack;for(var m=[b,a],g,e=0;e(a.context.is(f)?h.height():a.context.prop("scrollHeight"))||"up"===a.dir1&&a.nextpos1+c.height()>(a.context.is(f)?h.height():a.context.prop("scrollHeight"))||"left"===a.dir1&&a.nextpos1+c.width()>(a.context.is(f)?h.width():a.context.prop("scrollWidth"))||"right"===a.dir1&&a.nextpos1+
26 | c.width()>(a.context.is(f)?h.width():a.context.prop("scrollWidth")))a.nextpos1=a.firstpos1,a.nextpos2+=a.addpos2+("undefined"===typeof a.spacing2?25:a.spacing2),a.addpos2=0;if(a.animation&&a.nextpos2a.addpos2&&
27 | (a.addpos2=c.height());break;case "left":case "right":c.outerWidth(!0)>a.addpos2&&(a.addpos2=c.width())}if("number"===typeof a.nextpos1)if(a.animation&&(b>a.nextpos1||d.top||d.bottom||d.right||d.left))switch(a.dir1){case "down":d.top=a.nextpos1+"px";break;case "up":d.bottom=a.nextpos1+"px";break;case "left":d.right=a.nextpos1+"px";break;case "right":d.left=a.nextpos1+"px"}else c.css(k,a.nextpos1+"px");(d.top||d.bottom||d.right||d.left)&&c.animate(d,{duration:this.options.position_animate_speed,queue:!1});
28 | switch(a.dir1){case "down":case "up":a.nextpos1+=c.height()+("undefined"===typeof a.spacing1?25:a.spacing1);break;case "left":case "right":a.nextpos1+=c.width()+("undefined"===typeof a.spacing1?25:a.spacing1)}}return this}},queuePosition:function(b,a){e&&clearTimeout(e);a||(a=10);e=setTimeout(function(){PNotify.positionAll(b)},a);return this},cancelRemove:function(){this.timer&&window.clearTimeout(this.timer);"closing"===this.state&&(this.elem.stop(!0),this.state="open",this.animating="in",this.elem.css("height",
29 | "auto").animate({width:this.options.width,opacity:this.options.opacity},"fast"));return this},queueRemove:function(){var b=this;this.cancelRemove();this.timer=window.setTimeout(function(){b.remove(!0)},isNaN(this.options.delay)?0:this.options.delay);return this}});c.extend(PNotify,{notices:[],removeAll:function(){c.each(PNotify.notices,function(){this.remove&&this.remove(!1)})},positionAll:function(b){e&&clearTimeout(e);e=null;if(PNotify.notices&&PNotify.notices.length)c.each(PNotify.notices,function(){var a=
30 | this.options.stack;a&&(a.nextpos1=a.firstpos1,a.nextpos2=a.firstpos2,a.addpos2=0,a.animation=b)}),c.each(PNotify.notices,function(){this.position()});else{var a=PNotify.prototype.options.stack;a&&(delete a.nextpos1,delete a.nextpos2)}},styling:{brighttheme:{container:"brighttheme",notice:"brighttheme-notice",notice_icon:"brighttheme-icon-notice",info:"brighttheme-info",info_icon:"brighttheme-icon-info",success:"brighttheme-success",success_icon:"brighttheme-icon-success",error:"brighttheme-error",
31 | error_icon:"brighttheme-icon-error"},jqueryui:{container:"ui-widget ui-widget-content ui-corner-all",notice:"ui-state-highlight",notice_icon:"ui-icon ui-icon-info",info:"",info_icon:"ui-icon ui-icon-info",success:"ui-state-default",success_icon:"ui-icon ui-icon-circle-check",error:"ui-state-error",error_icon:"ui-icon ui-icon-alert"},bootstrap2:{container:"alert",notice:"",notice_icon:"icon-exclamation-sign",info:"alert-info",info_icon:"icon-info-sign",success:"alert-success",success_icon:"icon-ok-sign",
32 | error:"alert-error",error_icon:"icon-warning-sign"},bootstrap3:{container:"alert",notice:"alert-warning",notice_icon:"glyphicon glyphicon-exclamation-sign",info:"alert-info",info_icon:"glyphicon glyphicon-info-sign",success:"alert-success",success_icon:"glyphicon glyphicon-ok-sign",error:"alert-danger",error_icon:"glyphicon glyphicon-warning-sign"}}});PNotify.styling.fontawesome=c.extend({},PNotify.styling.bootstrap3);c.extend(PNotify.styling.fontawesome,{notice_icon:"fa fa-exclamation-circle",info_icon:"fa fa-info",
33 | success_icon:"fa fa-check",error_icon:"fa fa-warning"});document.body?p():c(p);return PNotify});
34 | (function(c){"object"===typeof exports&&"undefined"!==typeof module?module.exports=c(require("jquery"),require("pnotify")):"function"===typeof define&&define.amd?define("pnotify.buttons",["jquery","pnotify"],c):c(jQuery,PNotify)})(function(c,e){e.prototype.options.buttons={closer:!0,closer_hover:!0,sticker:!0,sticker_hover:!0,show_on_nonblock:!1,labels:{close:"Close",stick:"Stick"}};e.prototype.modules.buttons={myOptions:null,closer:null,sticker:null,init:function(a,b){var d=this;this.myOptions=b;
35 | a.elem.on({mouseenter:function(b){!d.myOptions.sticker||a.options.nonblock&&a.options.nonblock.nonblock&&!d.myOptions.show_on_nonblock||d.sticker.trigger("pnotify_icon").css("visibility","visible");!d.myOptions.closer||a.options.nonblock&&a.options.nonblock.nonblock&&!d.myOptions.show_on_nonblock||d.closer.css("visibility","visible")},mouseleave:function(a){d.myOptions.sticker_hover&&d.sticker.css("visibility","hidden");d.myOptions.closer_hover&&d.closer.css("visibility","hidden")}});this.sticker=
36 | c("",{"class":"ui-pnotify-sticker",css:{cursor:"pointer",visibility:b.sticker_hover?"hidden":"visible"},click:function(){a.options.hide=!a.options.hide;a.options.hide?a.queueRemove():a.cancelRemove();c(this).trigger("pnotify_icon")}}).bind("pnotify_icon",function(){c(this).children().removeClass(a.styles.pin_up+" "+a.styles.pin_down).addClass(a.options.hide?a.styles.pin_up:a.styles.pin_down)}).append(c("",{"class":a.styles.pin_up,title:b.labels.stick})).prependTo(a.container);(!b.sticker||
37 | a.options.nonblock&&a.options.nonblock.nonblock&&!b.show_on_nonblock)&&this.sticker.css("display","none");this.closer=c("",{"class":"ui-pnotify-closer",css:{cursor:"pointer",visibility:b.closer_hover?"hidden":"visible"},click:function(){a.remove(!1);d.sticker.css("visibility","hidden");d.closer.css("visibility","hidden")}}).append(c("",{"class":a.styles.closer,title:b.labels.close})).prependTo(a.container);(!b.closer||a.options.nonblock&&a.options.nonblock.nonblock&&!b.show_on_nonblock)&&
38 | this.closer.css("display","none")},update:function(a,b){this.myOptions=b;!b.closer||a.options.nonblock&&a.options.nonblock.nonblock&&!b.show_on_nonblock?this.closer.css("display","none"):b.closer&&this.closer.css("display","block");!b.sticker||a.options.nonblock&&a.options.nonblock.nonblock&&!b.show_on_nonblock?this.sticker.css("display","none"):b.sticker&&this.sticker.css("display","block");this.sticker.trigger("pnotify_icon");b.sticker_hover?this.sticker.css("visibility","hidden"):a.options.nonblock&&
39 | a.options.nonblock.nonblock&&!b.show_on_nonblock||this.sticker.css("visibility","visible");b.closer_hover?this.closer.css("visibility","hidden"):a.options.nonblock&&a.options.nonblock.nonblock&&!b.show_on_nonblock||this.closer.css("visibility","visible")}};c.extend(e.styling.brighttheme,{closer:"brighttheme-icon-closer",pin_up:"brighttheme-icon-sticker",pin_down:"brighttheme-icon-sticker brighttheme-icon-stuck"});c.extend(e.styling.jqueryui,{closer:"ui-icon ui-icon-close",pin_up:"ui-icon ui-icon-pin-w",
40 | pin_down:"ui-icon ui-icon-pin-s"});c.extend(e.styling.bootstrap2,{closer:"icon-remove",pin_up:"icon-pause",pin_down:"icon-play"});c.extend(e.styling.bootstrap3,{closer:"glyphicon glyphicon-remove",pin_up:"glyphicon glyphicon-pause",pin_down:"glyphicon glyphicon-play"});c.extend(e.styling.fontawesome,{closer:"fa fa-times",pin_up:"fa fa-pause",pin_down:"fa fa-play"})});
41 | (function(e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e(require("jquery"),require("pnotify")):"function"===typeof define&&define.amd?define("pnotify.desktop",["jquery","pnotify"],e):e(jQuery,PNotify)})(function(e,d){var c,f=function(a,b){f="Notification"in window?function(a,b){return new Notification(a,b)}:"mozNotification"in navigator?function(a,b){return navigator.mozNotification.createNotification(a,b.body,b.icon).show()}:"webkitNotifications"in window?function(a,b){return window.webkitNotifications.createNotification(b.icon,
42 | a,b.body)}:function(a,b){return null};return f(a,b)};d.prototype.options.desktop={desktop:!1,fallback:!0,icon:null,tag:null};d.prototype.modules.desktop={tag:null,icon:null,genNotice:function(a,b){this.icon=null===b.icon?"http://sciactive.com/pnotify/includes/desktop/"+a.options.type+".png":!1===b.icon?null:b.icon;if(null===this.tag||null!==b.tag)this.tag=null===b.tag?"PNotify-"+Math.round(1E6*Math.random()):b.tag;a.desktop=f(a.options.title,{icon:this.icon,body:a.options.text,tag:this.tag});!("close"in
43 | a.desktop)&&"cancel"in a.desktop&&(a.desktop.close=function(){a.desktop.cancel()});a.desktop.onclick=function(){a.elem.trigger("click")};a.desktop.onclose=function(){"closing"!==a.state&&"closed"!==a.state&&a.remove()}},init:function(a,b){b.desktop&&(c=d.desktop.checkPermission(),0!==c?b.fallback||(a.options.auto_display=!1):this.genNotice(a,b))},update:function(a,b,d){0!==c&&b.fallback||!b.desktop||this.genNotice(a,b)},beforeOpen:function(a,b){0!==c&&b.fallback||!b.desktop||a.elem.css({left:"-10000px",
44 | display:"none"})},afterOpen:function(a,b){0!==c&&b.fallback||!b.desktop||(a.elem.css({left:"-10000px",display:"none"}),"show"in a.desktop&&a.desktop.show())},beforeClose:function(a,b){0!==c&&b.fallback||!b.desktop||a.elem.css({left:"-10000px",display:"none"})},afterClose:function(a,b){0!==c&&b.fallback||!b.desktop||(a.elem.css({left:"-10000px",display:"none"}),"close"in a.desktop&&a.desktop.close())}};d.desktop={permission:function(){"undefined"!==typeof Notification&&"requestPermission"in Notification?
45 | Notification.requestPermission():"webkitNotifications"in window&&window.webkitNotifications.requestPermission()},checkPermission:function(){return"undefined"!==typeof Notification&&"permission"in Notification?"granted"===Notification.permission?0:1:"webkitNotifications"in window?0==window.webkitNotifications.checkPermission()?0:1:1}};c=d.desktop.checkPermission()});
46 |
--------------------------------------------------------------------------------
/assets/themes/toastr.css:
--------------------------------------------------------------------------------
1 | .toast-title{font-weight:bold}.toast-message{-ms-word-wrap:break-word;word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}#toast-container{position:fixed;z-index:9999}#toast-container>div{margin:0 0 6px;padding:15px 15px 15px 50px;width:300px;-moz-border-radius:3px 3px 3px 3px;-webkit-border-radius:3px 3px 3px 3px;border-radius:3px 3px 3px 3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;color:#fff;opacity:.8;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";filter:alpha(opacity=80)}.toast{background-color:#030303}.toast-success{background-color:#51a351}.toast-error{background-color:#bd362f}.toast-info{background-color:#2f96b4}.toast-warning{background-color:#f89406}#toast-container>:hover{-moz-box-shadow:0 0 12px #000;-webkit-box-shadow:0 0 12px #000;box-shadow:0 0 12px #000;opacity:1;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);cursor:pointer}#toast-container>.toast-info{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=")!important}#toast-container>.toast-error{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=")!important}#toast-container>.toast-success{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==")!important}#toast-container>.toast-warning{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=")!important}@media all and (max-width:240px){#toast-container>div{padding:8px 8px 8px 50px;width:108px}}@media all and (min-width:241px)and (max-width:320px){#toast-container>div{padding:8px 8px 8px 50px;width:128px}}@media all and (min-width:321px)and (max-width:480px){#toast-container>div{padding:8px 8px 8px 50px;width:192px}}@media all and (min-width:481px)and (max-width:768px){#toast-container>div{padding:15px 15px 15px 50px;width:300px}}#toast-container.toast-top-full-width>div,#toast-container.toast-bottom-full-width>div{width:100%;margin:1px 0 1px 0}
--------------------------------------------------------------------------------
/assets/themes/toastr.js:
--------------------------------------------------------------------------------
1 | (function(n){n(["jquery"],function(n){return function(){function u(r){return(r||(r=i()),container=n("#"+r.containerId),container.children().length)?container:(container=n("").attr("id",r.containerId).addClass(r.positionClass),container.appendTo(n(r.target)),t=container,container)}function i(){return n.extend({},o,f.options)}function e(n){(t||(t=u()),n.is(":visible"))||(n.remove(),n=null,t.children().length===0&&t.remove())}var t,o={tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,fadeIn:300,fadeOut:1e3,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",target:"body"},s=function(n,t,u){return r({iconClass:i().iconClasses.error,message:n,optionsOverride:u,title:t})},h=function(n,t,u){return r({iconClass:i().iconClasses.info,message:n,optionsOverride:u,title:t})},r=function(t){function o(){if(!(n(":focus",f).length>0))return f.fadeOut(r.fadeOut,function(){e(f)})}function y(){(r.timeOut>0||r.extendedTimeOut>0)&&(h=setTimeout(o,r.extendedTimeOut))}function p(){clearTimeout(h),f.stop(!0,!0).fadeIn(r.fadeIn)}var r=i(),s=t.iconClass||r.iconClass;typeof t.optionsOverride!="undefined"&&(r=n.extend(r,t.optionsOverride),s=t.optionsOverride.iconClass||s);var h=null,a=u(r),f=n(""),c=n(""),l=n(""),v={options:r,map:t};return t.iconClass&&f.addClass(r.toastClass).addClass(s),t.title&&(c.append(t.title).addClass(r.titleClass),f.append(c)),t.message&&(l.append(t.message).addClass(r.messageClass),f.append(l)),f.hide(),a.prepend(f),f.fadeIn(r.fadeIn),r.timeOut>0&&(h=setTimeout(o,r.timeOut)),f.hover(p,y),!r.onclick&&r.tapToDismiss&&f.click(o),r.onclick&&f.click(function(){r.onclick()&&o()}),r.debug&&console&&console.log(v),f},c=function(n,t,u){return r({iconClass:i().iconClasses.success,message:n,optionsOverride:u,title:t})},l=function(n,t,u){return r({iconClass:i().iconClasses.warning,message:n,optionsOverride:u,title:t})},a=function(r){var f=i();if(t||u(f),r&&n(":focus",r).length===0){r.fadeOut(f.fadeOut,function(){e(r)});return}t.children().length&&t.fadeOut(f.fadeOut,function(){t.remove()})},f={clear:a,error:s,getContainer:u,info:h,options:{},success:c,version:"1.2.2",warning:l};return f}()})})(typeof define=="function"&&define.amd?define:function(n,t){typeof module!="undefined"&&module.exports?module.exports=t(require(n[0])):window.toastr=t(window.jQuery)})
--------------------------------------------------------------------------------
/commands/NotificationsController.php:
--------------------------------------------------------------------------------
1 | module->notificationClass;
17 |
18 | // Delete all notifications seen or flashed
19 | $criteria = ['or', ['seen=1'], ['flashed=1']];
20 |
21 | // Delete old notification according to expiration time setting
22 | if ( $this->module->expirationTime > 0 ) {
23 | $criteria[] = ['<', 'created_at', time()-$this->module->expirationTime ];
24 | }
25 |
26 | $records_deleted = $class::deleteAll($criteria);
27 |
28 | echo "$records_deleted obsolete notifications removed\n";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "machour/yii2-notifications",
3 | "description": "Notifications for your Yii2 app",
4 | "keywords": ["yii", "notification", "growl", "noty", "notify"],
5 | "type": "yii2-extension",
6 | "license": "MIT",
7 | "support": {
8 | "source": "https://github.com/machour/yii2-notifications"
9 | },
10 | "authors": [
11 | {
12 | "name": "Mehdi Achour",
13 | "email": "machour@gmail.com"
14 | }
15 | ],
16 | "require": {
17 | "yiisoft/yii2": "*",
18 | "rmrevin/yii2-fontawesome": "~2.15"
19 | },
20 | "autoload": {
21 | "psr-4": {
22 | "machour\\yii2\\notifications\\": ""
23 | }
24 | },
25 | "extra": {
26 | "branch-alias": {
27 | "dev-master": "1.0-dev"
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/controllers/NotificationsController.php:
--------------------------------------------------------------------------------
1 | response->format = Response::FORMAT_JSON;
30 |
31 | $this->user_id = $this->module->userId;
32 | $this->notificationClass = $this->module->notificationClass;
33 | parent::init();
34 | }
35 |
36 | /**
37 | * Poll action
38 | *
39 | * @param int $seen Whether to show already seen notifications
40 | * @return array
41 | */
42 | public function actionPoll($seen = 0)
43 | {
44 | $seen = $seen ? 'true' : 'false';
45 |
46 | /** @var Notification $class */
47 | $class = $this->notificationClass;
48 | $models = $class::find()
49 | ->where(['user_id' => $this->user_id])
50 | ->andWhere(['or', "seen=$seen", 'flashed=false'])
51 | ->orderBy('created_at DESC')
52 | ->all();
53 |
54 | $results = [];
55 |
56 | foreach ($models as $model) {
57 |
58 | // give user a chance to parse the date as needed
59 | $date = \DateTime::createFromFormat($this->module->dbDateFormat, $model->created_at)
60 | ->format('Y-m-d H:i:s');
61 |
62 | /** @var Notification $model */
63 | $results[] = [
64 | 'id' => $model->id,
65 | 'type' => $model->type,
66 | 'title' => $model->getTitle(),
67 | 'description' => $model->getDescription(),
68 | 'url' => Url::to(['notifications/rnr', 'id' => $model->id]),
69 | 'key' => $model->key,
70 | 'flashed' => $model->flashed,
71 | 'date' => $date,
72 | ];
73 | }
74 | return $results;
75 | }
76 |
77 | /**
78 | * Marks a notification as read and redirects the user to the final route
79 | *
80 | * @param int $id The notification id
81 | * @return Response
82 | * @throws HttpException Throws an exception if the notification is not
83 | * found, or if it don't belongs to the logged in user
84 | */
85 | public function actionRnr($id)
86 | {
87 | $notification = $this->actionRead($id);
88 | return $this->redirect(Url::to($notification->getRoute()));
89 | }
90 |
91 | /**
92 | * Marks a notification as read
93 | *
94 | * @param int $id The notification id
95 | * @return Notification The updated notification record
96 | * @throws HttpException Throws an exception if the notification is not
97 | * found, or if it don't belongs to the logged in user
98 | */
99 | public function actionRead($id)
100 | {
101 | $notification = $this->getNotification($id);
102 |
103 | $notification->seen = 1;
104 | $notification->save();
105 |
106 | return $notification;
107 | }
108 |
109 | /**
110 | * Marks all notification as read
111 | *
112 | * @throws HttpException Throws an exception if the notification is not
113 | * found, or if it don't belongs to the logged in user
114 | */
115 | public function actionReadAll()
116 | {
117 | $notificationsIds = Yii::$app->request->post('ids', []);
118 |
119 | foreach ($notificationsIds as $id) {
120 | $notification = $this->getNotification($id);
121 |
122 | $notification->seen = 1;
123 | $notification->save();
124 | }
125 |
126 | return true;
127 | }
128 |
129 | /**
130 | * Delete all notifications
131 | *
132 | * @throws HttpException Throws an exception if the notification is not
133 | * found, or if it don't belongs to the logged in user
134 | */
135 | public function actionDeleteAll()
136 | {
137 | $notificationsIds = Yii::$app->request->post('ids', []);
138 |
139 | foreach ($notificationsIds as $id) {
140 | $notification = $this->getNotification($id);
141 |
142 | $notification->delete();
143 | }
144 |
145 | return true;
146 | }
147 |
148 | /**
149 | * Deletes a notification
150 | *
151 | * @param int $id The notification id
152 | * @return int|false Returns 1 if the notification was deleted, FALSE otherwise
153 | * @throws HttpException Throws an exception if the notification is not
154 | * found, or if it don't belongs to the logged in user
155 | */
156 | public function actionDelete($id)
157 | {
158 | $notification = $this->getNotification($id);
159 | return $notification->delete();
160 | }
161 |
162 | public function actionFlash($id)
163 | {
164 | $notification = $this->getNotification($id);
165 |
166 | $notification->flashed = 1;
167 | $notification->save();
168 |
169 | return $notification;
170 | }
171 |
172 |
173 | /**
174 | * Gets a notification by id
175 | *
176 | * @param int $id The notification id
177 | * @return Notification
178 | * @throws HttpException Throws an exception if the notification is not
179 | * found, or if it don't belongs to the logged in user
180 | */
181 | private function getNotification($id)
182 | {
183 | /** @var Notification $notification */
184 | $class = $this->notificationClass;
185 | $notification = $class::findOne($id);
186 | if (!$notification) {
187 | throw new HttpException(404, "Unknown notification");
188 | }
189 |
190 | if ($notification->user_id != $this->user_id) {
191 | throw new HttpException(500, "Not your notification");
192 | }
193 |
194 | return $notification;
195 | }
196 | }
197 |
--------------------------------------------------------------------------------
/docs/Concept.md:
--------------------------------------------------------------------------------
1 |
2 | Concepts
3 | --------
4 |
5 | Usually, a notification displayed to the end user (on your web interface, or a push message), is made of a title (New
6 | friendship request), a description (Foo Bar wants to be your friend), and a action url (/friends/add/FOOBAR_ID).
7 |
8 | Notifications texts often needs to be translated, changed based on the current time or other parameters. The approach
9 | taken by this module is to compute the notification title, description and url at run time, in order to give you a good
10 | flexibility.
11 |
12 | A notification may also be tied to a foreign object. In our friend ship request above, the foreign object will be the
13 | record representing the user Foo Bar.
14 |
15 | This module represents a notification in the database using the following structure:
16 |
17 | | Field | Description |
18 | | ---------- | ------------------------------------------------------------------------------------- |
19 | | id | The unique ID for the notification |
20 | | type | The notification severity (can be of `notification`, `success`, `error` or `warning`) |
21 | | key | The notification key (You decide here, for example: new_message, canceled_event) |
22 | | key_id | The foreign object id, tied to your notification key. Defaults to NULL. |
23 | | user_id | The notified user id |
24 | | seen | Is the notification seen by the user or not |
25 | | created_at | Notification creation date |
26 |
27 | See the *Declaring your notifications* in the **Usage** section to see how to declare your available notifications types
28 | and dynamically compute their data.
29 |
30 |
--------------------------------------------------------------------------------
/docs/Configuration.md:
--------------------------------------------------------------------------------
1 | Configuration
2 | -------------
3 |
4 | Before using this module, you have to run its migrations scripts:
5 |
6 | ```bash
7 | ./yii migrate/up --migrationPath=vendor/machour/yii2-notifications/migrations/
8 | ```
9 |
10 | You also need to enable the module in Yii `modules` section of the application configuration file:
11 | ```php
12 | return [
13 | // ...
14 | 'modules' => [
15 | 'notifications' => [
16 | 'class' => 'machour\yii2\notifications\NotificationsModule',
17 | // Point this to your own Notification class
18 | // See the "Declaring your notifications" section below
19 | 'notificationClass' => 'common\components\Notification',
20 | // Allow to have notification with same (user_id, key, key_id)
21 | // Default to FALSE
22 | 'allowDuplicate' => false,
23 | // Allow custom date formatting in database
24 | 'dbDateFormat' => 'Y-m-d H:i:s',
25 | // This callable should return your logged in user Id
26 | 'userId' => function () {
27 | return \Yii::$app->user->id;
28 | },
29 | ],
30 | // your other modules ..
31 | ],
32 | // ...
33 | ]
34 | ```
35 | ### If UrlManager for url rewriting is active add these lines on your rules
36 | ```php
37 | 'urlManager' => [
38 | // ...
39 | 'rules' => [
40 | // ...
41 | 'notifications/poll' => '/notifications/notifications/poll',
42 | 'notifications/rnr' => '/notifications/notifications/rnr',
43 | 'notifications/read' => '/notifications/notifications/read',
44 | 'notifications/read-all' => '/notifications/notifications/read-all',
45 | 'notifications/delete-all' => '/notifications/notifications/delete-all',
46 | 'notifications/delete' => '/notifications/notifications/delete',
47 | 'notifications/flash' => '/notifications/notifications/flash',
48 | // ...
49 | ]
50 | // ...
51 | ]
52 |
53 | ```
54 |
55 | ### Declaring your notifications in common\components\Notification.php
56 |
57 | ```php
58 |
59 | namespace common\components;
60 |
61 | use Yii;
62 | use common\models\Meeting;//example models
63 | use common\models\Message;//example models
64 | use machour\yii2\notifications\models\Notification as BaseNotification;
65 |
66 | class Notification extends BaseNotification
67 | {
68 |
69 | /**
70 | * A new message notification
71 | */
72 | const KEY_NEW_MESSAGE = 'new_message';
73 | /**
74 | * A meeting reminder notification
75 | */
76 | const KEY_MEETING_REMINDER = 'meeting_reminder';
77 | /**
78 | * No disk space left !
79 | */
80 | const KEY_NO_DISK_SPACE = 'no_disk_space';
81 |
82 | /**
83 | * @var array Holds all usable notifications
84 | */
85 | public static $keys = [
86 | self::KEY_NEW_MESSAGE,
87 | self::KEY_MEETING_REMINDER,
88 | self::KEY_NO_DISK_SPACE,
89 | ];
90 |
91 | /**
92 | * @inheritdoc
93 | */
94 | public function getTitle()
95 | {
96 | switch ($this->key) {
97 | case self::KEY_MEETING_REMINDER:
98 | return Yii::t('app', 'Meeting reminder');
99 |
100 | case self::KEY_NEW_MESSAGE:
101 | return Yii::t('app', 'You got a new message');
102 |
103 | case self::KEY_NO_DISK_SPACE:
104 | return Yii::t('app', 'No disk space left');
105 | }
106 | }
107 |
108 | /**
109 | * @inheritdoc
110 | */
111 | public function getDescription()
112 | {
113 | switch ($this->key) {
114 | case self::KEY_MEETING_REMINDER:
115 | $meeting = Meeting::findOne($this->key_id);
116 | return Yii::t('app', 'You are meeting with {customer}', [
117 | 'customer' => $meeting->customer->name
118 | ]);
119 |
120 | case self::KEY_NEW_MESSAGE:
121 | $message = Message::findOne($this->key_id);
122 | return Yii::t('app', '{customer} sent you a message', [
123 | 'customer' => $meeting->customer->name
124 | ]);
125 |
126 | case self::KEY_NO_DISK_SPACE:
127 | // We don't have a key_id here, simple message
128 | return 'Please buy more space immediately';
129 | }
130 | }
131 |
132 | /**
133 | * @inheritdoc
134 | */
135 | public function getRoute()
136 | {
137 | switch ($this->key) {
138 | case self::KEY_MEETING_REMINDER:
139 | return ['meeting', 'id' => $this->key_id];
140 |
141 | case self::KEY_NEW_MESSAGE:
142 | return ['message/read', 'id' => $this->key_id];
143 |
144 | case self::KEY_NO_DISK_SPACE:
145 | return 'https://aws.amazon.com/';//simple route on external link
146 | };
147 | }
148 |
149 | }
150 | ```
151 |
--------------------------------------------------------------------------------
/docs/Contributors.md:
--------------------------------------------------------------------------------
1 | Contributors
2 | ------------
3 |
4 | The following people contributed to this extension:
5 |
6 | * Stunc0:
7 | * Change `key_id` to string for more flexibility
8 | * Allow duplicate notifications
9 |
--------------------------------------------------------------------------------
/docs/Installation.md:
--------------------------------------------------------------------------------
1 | Installation
2 | ------------
3 |
4 | The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
5 |
6 | Either run
7 |
8 | ```
9 | php composer.phar require machour/yii2-notifications "*"
10 | ```
11 |
12 | or add
13 |
14 | ```
15 | "machour/yii2-notifications": "*"
16 | ```
17 |
18 | to the require section of your `composer.json` file.
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # yii2-notifications documentation
2 |
3 | * [Installation](Installation.md)
4 | * [Concept](Concept.md)
5 | * [Configuration](Configuration.md)
6 | * [Usage](Usage.md)
7 | * [Todo](Todo.md)
8 | * [Contributors](Contributors.md)
9 |
--------------------------------------------------------------------------------
/docs/Todo.md:
--------------------------------------------------------------------------------
1 | TODO
2 | ----
3 |
4 | * Email sending ?
5 | * Android Push / Apple Push integration ?
--------------------------------------------------------------------------------
/docs/Usage.md:
--------------------------------------------------------------------------------
1 | Usage
2 | -----
3 |
4 | ### Triggering a notification
5 |
6 |
7 | ```php
8 |
9 | // $message was just created by the logged in user, and sent to $recipient_id
10 | Notification::notify(Notification::KEY_NEW_MESSAGE, $recipient_id, $message->id);
11 |
12 | // You may also use the following static methods to set the notification type:
13 | Notification::warning(Notification::KEY_NEW_MESSAGE, $recipient_id, $message->id);
14 | Notification::success(Notification::ORDER_PLACED, $admin_id, $order->id);
15 | Notification::error(Notification::KEY_NO_DISK_SPACE, $admin_id);
16 |
17 | ```
18 |
19 | ### Listening and showing notifications in the UI
20 |
21 | This package comes with a `NotificationsWidget` that is used to regularly poll the server for new
22 | notifications.
23 |
24 | The widget will then trigger visual notifications using the library selected with the `theme` option.
25 | Here's an example using `NotificationsWidget::THEME_GROWL`:
26 |
27 | 
28 |
29 | The widget can also maintain a HTML list of notifications in your UI as well as updating one or more
30 | notifications counters, if the `listSelector` option is defined.
31 | Here's an example of a notification menu in the application header:
32 |
33 | 
34 |
35 | When clicked, a notification will be marked as seen, and the user will be redirected to the notification
36 | route.
37 |
38 | The samples images were generated using this code in my main layout file:
39 |
40 | ```php
41 |
42 | NotificationsWidget::widget([
43 | 'theme' => NotificationsWidget::THEME_GROWL,
44 | 'clientOptions' => [
45 | 'location' => 'br',
46 | ],
47 | 'counters' => [
48 | '.notifications-header-count',
49 | '.notifications-icon-count'
50 | ],
51 | 'markAllSeenSelector' => '#notification-seen-all',
52 | 'listSelector' => '#notifications',
53 | ]);
54 |
55 | ?>
56 |
57 |
72 | ```
73 |
74 | | Parameter | Description | Default |
75 | | -------------------- | --------------------------------------------------------------------------- | -----------:|
76 | | theme | One of the THEME_XXX constants. See supported libraries for a full list | null |
77 | | clientOptions | An array of options to be passed to the underlying UI notifications library | [] |
78 | | delay | The time to leave the notification shown on screen | 5000 |
79 | | pollInterval | The delay in milliseconds between polls | 5000 |
80 | | pollSeen | Whether to show already seen notifications | false |
81 | | xhrTimeout | The XHR request timeout in milliseconds | 2000 |
82 | | counters | An array of jQuery selectors to update with the current notifications count | [] |
83 | | markAllSeenSelector | A jQuery selector on which click mark all seen event will be fired | null |
84 | | deleteAllSelector | A jQuery selector on which click delete all event will be fired | null |
85 | | listSelector | A jQuery selector for your UI element that will holds the notification list | null |
86 | | listItemTemplate | An optional template for the list item. | built-in |
87 | | listItemBeforeRender | An optional callback to tweak the list item layout before rendering | empty cb |
88 |
89 |
90 | Supported libraries
91 | -------------------
92 |
93 | Currently supported libraries are:
94 |
95 | | Library | Constant | Shipped version | Project homepage |
96 | | -------------- | ------------- | --------------- | ---------------------------------------- |
97 | | jQuery Growl | THEME_GROWL | 1.3.1 | https://github.com/ksylvest/jquery-growl |
98 | | Notify.js | THEME_NOTIFY | 0.3.4 | https://notifyjs.com/ |
99 | | Noty | THEME_NOTY | 2.3.7 | http://ned.im/noty/ |
100 | | PNotify | THEME_PNOTIFY | 2.1 | http://sciactive.com/pnotify/ |
101 | | Toastr | THEME_TOASTR | 1.2.2 | https://github.com/CodeSeven/toastr |
102 | | NotifIt! | THEME_NOTIFIT | master | http://naoxink.hol.es/notifIt/ |
103 |
104 | If you'de like to add support for another notification UI library, edit the `assets/notifications.js` file
105 | ad add a new entry into the `Notification.themes` property.
106 |
107 | Your library must be added as an object with the `show` callback field defined and used to trigger the visual
108 | notification, and an optional `types` translation map that will be used to translate natives types into the
109 | used library notification type.
110 |
111 | You will also need to add the library javascript file and optional CSS file to the `assets/themes/` directory,
112 | and declare the new theme in `widgets/NotificationsWidget.php`.
113 |
114 | Don't forget to send a patch afterwards!
115 |
--------------------------------------------------------------------------------
/docs/growl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/machour/yii2-notifications/56c1dcb593c024f06ce4701818096e20c845e950/docs/growl.png
--------------------------------------------------------------------------------
/docs/list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/machour/yii2-notifications/56c1dcb593c024f06ce4701818096e20c845e950/docs/list.png
--------------------------------------------------------------------------------
/docs/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/machour/yii2-notifications/56c1dcb593c024f06ce4701818096e20c845e950/docs/main.png
--------------------------------------------------------------------------------
/migrations/m151008_162401_create_notification_table.php:
--------------------------------------------------------------------------------
1 | createTable(self::TABLE_NAME, [
12 | 'id' => $this->primaryKey(),
13 | 'key' => $this->string()->notNull(),
14 | 'key_id' => $this->integer(),
15 | 'type' => $this->string()->notNull(),
16 | 'user_id' => $this->integer()->notNull(),
17 | 'seen' => $this->boolean()->notNull(),
18 | 'created_at' => $this->dateTime()->notNull(),
19 | ]);
20 | }
21 |
22 | public function down()
23 | {
24 | $this->dropTable(self::TABLE_NAME);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/migrations/m160509_211405_add_flashed_to_notification.php:
--------------------------------------------------------------------------------
1 | addColumn('{{%notification}}', 'flashed', $this->boolean()->notNull());
10 | }
11 |
12 | public function down()
13 | {
14 | $this->dropColumn('{{%notification}}', 'flashed');
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/migrations/m160921_171124_alter_notification_table.php:
--------------------------------------------------------------------------------
1 | alterColumn(self::TABLE_NAME, 'key_id', $this->string());
12 | }
13 |
14 | public function down()
15 | {
16 | $this->alterColumn(self::TABLE_NAME, 'key_id', $this->integer());
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/models/Notification.php:
--------------------------------------------------------------------------------
1 |
20 | * use machour\yii2\notifications\widgets\NotificationsWidget;
21 | *
22 | * NotificationsWidget::widget([
23 | * 'theme' => NotificationsWidget::THEME_GROWL,
24 | * // If the notifications count changes, the $('.notifications-count') element
25 | * // will be updated with the current count
26 | * 'counters' => ['.notifications-count'],
27 | * 'clientOptions' => [
28 | * 'size' => 'large',
29 | * ],
30 | * ]);
31 | *
32 | *
33 | * @package machour\yii2\notifications\widgets
34 | */
35 | class NotificationsWidget extends Widget
36 | {
37 | /**
38 | * Use jQuery Growl
39 | * @see http://ksylvest.github.io/jquery-growl/
40 | */
41 | const THEME_GROWL = 'growl';
42 | /**
43 | * Use Noty
44 | * @see http://ned.im/noty/
45 | */
46 | const THEME_NOTY = 'noty';
47 | /**
48 | * Use Notie
49 | * @see https://jaredreich.com/projects/notie/
50 | */
51 | const THEME_NOTIE = 'notie';
52 | /**
53 | * Use NotifIt!
54 | * @see http://naoxink.hol.es/notifIt/
55 | */
56 | const THEME_NOTIFIT = 'notifit';
57 | /**
58 | * Use Notify
59 | * @see https://notifyjs.com/
60 | */
61 | const THEME_NOTIFY = 'notify';
62 | /**
63 | * Use Pnotify
64 | * @see http://sciactive.com/pnotify/
65 | */
66 | const THEME_PNOTIFY = 'pnotify';
67 | /**
68 | * Use Toastr
69 | * @see https://github.com/CodeSeven/toastr
70 | */
71 | const THEME_TOASTR = 'toastr';
72 |
73 | /**
74 | * @var array additional options to be passed to the notification library.
75 | * Please refer to the plugin project page for available options.
76 | */
77 | public $clientOptions = [];
78 |
79 | /**
80 | * @var string the library name to be used for notifications
81 | * One of the THEME_XXX constants
82 | */
83 | public $theme = null;
84 |
85 | /**
86 | * @var integer The time to leave the notification shown on screen
87 | */
88 | public $delay = 5000;
89 |
90 | /**
91 | * @var integer the XHR timeout in milliseconds
92 | */
93 | public $xhrTimeout = 2000;
94 |
95 | /**
96 | * @var integer The delay between pulls
97 | */
98 | public $pollInterval = 5000;
99 |
100 | /**
101 | * @var boolean Whether to show already seen notifications
102 | */
103 | public $pollSeen = false;
104 |
105 | /**
106 | * @var array An array of jQuery selector to be updated with the current
107 | * notifications count
108 | */
109 | public $counters = [];
110 |
111 | /**
112 | * @var string The locale to be used for jQuery timeago. Defaults to the
113 | * current Yii language
114 | */
115 | public $timeAgoLocale;
116 |
117 | /**
118 | * @var string A jQuery selector on which click mark all seen event
119 | * will be fired
120 | */
121 | public $markAllSeenSelector = null;
122 |
123 | /**
124 | * @var string A jQuery selector on which click delete all event
125 | * will be fired
126 | */
127 | public $deleteAllSelector = null;
128 |
129 | /**
130 | * @var string The jQuery selector in which the notifications list should
131 | * be rendered
132 | */
133 | public $listSelector = null;
134 |
135 | /**
136 | * @var string The list item HTML template
137 | */
138 | public $listItemTemplate = null;
139 |
140 | /**
141 | * @var string The list item before render callback
142 | */
143 | public $listItemBeforeRender = null;
144 |
145 | /**
146 | * @var array List of built in themes
147 | */
148 | protected static $_builtinThemes = [
149 | self::THEME_GROWL,
150 | self::THEME_NOTY,
151 | self::THEME_NOTIFY,
152 | self::THEME_NOTIE,
153 | self::THEME_PNOTIFY,
154 | self::THEME_TOASTR,
155 | self::THEME_NOTIFIT
156 | ];
157 |
158 | /**
159 | * @inheritdoc
160 | */
161 | public function run()
162 | {
163 | if (!isset($this->timeAgoLocale)) {
164 | $this->timeAgoLocale = Yii::$app->language;
165 | }
166 | $this->registerAssets();
167 | }
168 |
169 | /**
170 | * Registers the needed assets
171 | */
172 | public function registerAssets()
173 | {
174 | $view = $this->getView();
175 |
176 | $asset = NotificationsAsset::register($view);
177 |
178 | // Register the theme assets
179 | if (!is_null($this->theme)) {
180 | if (!in_array($this->theme, self::$_builtinThemes)) {
181 | throw new Exception("Unknown theme: " . $this->theme, 501);
182 | }
183 | foreach (['js' => 'registerJsFile', 'css' => 'registerCssFile'] as $type => $method) {
184 | $filename = NotificationsAsset::getFilename($this->theme, $type);
185 | if ($filename) {
186 | $view->$method($asset->baseUrl . '/' . $filename, [
187 | 'depends' => NotificationsAsset::className()
188 | ]);
189 | }
190 | }
191 | }
192 |
193 | // Register timeago i18n file
194 | if ($filename = NotificationsAsset::getTimeAgoI18n($this->timeAgoLocale)) {
195 | $view->registerJsFile($asset->baseUrl . '/' . $filename, [
196 | 'depends' => NotificationsAsset::className()
197 | ]);
198 | }
199 |
200 | $params = [
201 | 'url' => Url::to(['/notifications/notifications/poll']),
202 | 'xhrTimeout' => Html::encode($this->xhrTimeout),
203 | 'delay' => Html::encode($this->delay),
204 | 'options' => $this->clientOptions,
205 | 'pollSeen' => !!$this->pollSeen,
206 | 'pollInterval' => Html::encode($this->pollInterval),
207 | 'counters' => $this->counters,
208 | ];
209 |
210 | if ($this->theme) {
211 | $params['theme'] = Html::encode($this->theme);
212 | }
213 |
214 | if ($this->markAllSeenSelector) {
215 | $params['markAllSeenSelector'] = $this->markAllSeenSelector;
216 | $params['seenAllUrl'] = Url::to(['/notifications/notifications/read-all']);
217 | }
218 |
219 | if ($this->deleteAllSelector) {
220 | $params['deleteAllSelector'] = $this->deleteAllSelector;
221 | $params['deleteAllUrl'] = Url::to(['/notifications/notifications/delete-all']);
222 | }
223 |
224 | if ($this->listSelector) {
225 | $params['seenUrl'] = Url::to(['/notifications/notifications/read']);
226 | $params['deleteUrl'] = Url::to(['/notifications/notifications/delete']);
227 | $params['flashUrl'] = Url::to(['/notifications/notifications/flash']);
228 | $params['listSelector'] = $this->listSelector;
229 | if ($this->listItemTemplate) {
230 | $params['listItemTemplate'] = $this->listItemTemplate;
231 | }
232 | if ($this->listItemBeforeRender instanceof JsExpression) {
233 | $params['listItemBeforeRender'] = $this->listItemBeforeRender;
234 | }
235 | }
236 |
237 | $js = 'Notifications(' . Json::encode($params) . ');';
238 |
239 | $view->registerJs($js);
240 | }
241 |
242 | }
243 |
--------------------------------------------------------------------------------