blinker / firefox.plugin / data / lib / notify.js @ master
History | View | Annotate | Download (21.071 KB)
1 | a03cd52e | Thies Pfeiffer | /** Notify.js - v0.3.1 - 2014/06/29
|
---|---|---|---|
2 | * http://notifyjs.com/
|
||
3 | * Copyright (c) 2014 Jaime Pillora - MIT
|
||
4 | */
|
||
5 | (function(window,document,$,undefined) { |
||
6 | 'use strict';
|
||
7 | |||
8 | var Notification, addStyle, blankFieldName, coreStyle, createElem, defaults, encode, find, findFields, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
|
||
9 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; |
||
10 | |||
11 | pluginName = 'notify';
|
||
12 | |||
13 | pluginClassName = pluginName + 'js';
|
||
14 | |||
15 | blankFieldName = pluginName + "!blank";
|
||
16 | |||
17 | positions = { |
||
18 | t: 'top', |
||
19 | m: 'middle', |
||
20 | b: 'bottom', |
||
21 | l: 'left', |
||
22 | c: 'center', |
||
23 | r: 'right' |
||
24 | }; |
||
25 | |||
26 | hAligns = ['l', 'c', 'r']; |
||
27 | |||
28 | vAligns = ['t', 'm', 'b']; |
||
29 | |||
30 | mainPositions = ['t', 'b', 'l', 'r']; |
||
31 | |||
32 | opposites = { |
||
33 | t: 'b', |
||
34 | m: null, |
||
35 | b: 't', |
||
36 | l: 'r', |
||
37 | c: null, |
||
38 | r: 'l' |
||
39 | }; |
||
40 | |||
41 | parsePosition = function(str) { |
||
42 | var pos;
|
||
43 | pos = []; |
||
44 | $.each(str.split(/\W+/), function(i, word) { |
||
45 | var w;
|
||
46 | w = word.toLowerCase().charAt(0);
|
||
47 | if (positions[w]) {
|
||
48 | return pos.push(w);
|
||
49 | } |
||
50 | }); |
||
51 | return pos;
|
||
52 | }; |
||
53 | |||
54 | styles = {}; |
||
55 | |||
56 | coreStyle = { |
||
57 | name: 'core', |
||
58 | html: "<div class=\"" + pluginClassName + "-wrapper\">\n <div class=\"" + pluginClassName + "-arrow\"></div>\n <div class=\"" + pluginClassName + "-container\"></div>\n</div>", |
||
59 | 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}" |
||
60 | }; |
||
61 | |||
62 | stylePrefixes = { |
||
63 | "border-radius": ["-webkit-", "-moz-"] |
||
64 | }; |
||
65 | |||
66 | getStyle = function(name) { |
||
67 | return styles[name];
|
||
68 | }; |
||
69 | |||
70 | addStyle = function(name, def) { |
||
71 | var cssText, elem, fields, _ref;
|
||
72 | if (!name) {
|
||
73 | throw "Missing Style name"; |
||
74 | } |
||
75 | if (!def) {
|
||
76 | throw "Missing Style definition"; |
||
77 | } |
||
78 | if (!def.html) {
|
||
79 | throw "Missing Style HTML"; |
||
80 | } |
||
81 | if ((_ref = styles[name]) != null ? _ref.cssElem : void 0) { |
||
82 | if (window.console) {
|
||
83 | console.warn("" + pluginName + ": overwriting style '" + name + "'"); |
||
84 | } |
||
85 | styles[name].cssElem.remove(); |
||
86 | } |
||
87 | def.name = name; |
||
88 | styles[name] = def; |
||
89 | cssText = "";
|
||
90 | if (def.classes) {
|
||
91 | $.each(def.classes, function(className, props) { |
||
92 | cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n"; |
||
93 | $.each(props, function(name, val) { |
||
94 | if (stylePrefixes[name]) {
|
||
95 | $.each(stylePrefixes[name], function(i, prefix) { |
||
96 | return cssText += " " + prefix + name + ": " + val + ";\n"; |
||
97 | }); |
||
98 | } |
||
99 | return cssText += " " + name + ": " + val + ";\n"; |
||
100 | }); |
||
101 | return cssText += "}\n"; |
||
102 | }); |
||
103 | } |
||
104 | if (def.css) {
|
||
105 | cssText += "/* styles for " + def.name + " */\n" + def.css; |
||
106 | } |
||
107 | if (cssText) {
|
||
108 | def.cssElem = insertCSS(cssText); |
||
109 | def.cssElem.attr('id', "notify-" + def.name); |
||
110 | } |
||
111 | fields = {}; |
||
112 | elem = $(def.html);
|
||
113 | findFields('html', elem, fields);
|
||
114 | findFields('text', elem, fields);
|
||
115 | return def.fields = fields;
|
||
116 | }; |
||
117 | |||
118 | insertCSS = function(cssText) { |
||
119 | var elem;
|
||
120 | elem = createElem("style");
|
||
121 | elem.attr('type', 'text/css'); |
||
122 | $("head").append(elem); |
||
123 | try {
|
||
124 | elem.html(cssText); |
||
125 | } catch (e) {
|
||
126 | elem[0].styleSheet.cssText = cssText;
|
||
127 | } |
||
128 | return elem;
|
||
129 | }; |
||
130 | |||
131 | findFields = function(type, elem, fields) { |
||
132 | var attr;
|
||
133 | if (type !== 'html') { |
||
134 | type = 'text';
|
||
135 | } |
||
136 | attr = "data-notify-" + type;
|
||
137 | return find(elem, "[" + attr + "]").each(function() { |
||
138 | var name;
|
||
139 | name = $(this).attr(attr); |
||
140 | if (!name) {
|
||
141 | name = blankFieldName; |
||
142 | } |
||
143 | return fields[name] = type;
|
||
144 | }); |
||
145 | }; |
||
146 | |||
147 | find = function(elem, selector) { |
||
148 | if (elem.is(selector)) {
|
||
149 | return elem;
|
||
150 | } else {
|
||
151 | return elem.find(selector);
|
||
152 | } |
||
153 | }; |
||
154 | |||
155 | pluginOptions = { |
||
156 | clickToHide: true, |
||
157 | autoHide: true, |
||
158 | autoHideDelay: 5000, |
||
159 | arrowShow: true, |
||
160 | arrowSize: 5, |
||
161 | breakNewLines: true, |
||
162 | elementPosition: 'bottom', |
||
163 | globalPosition: 'top right', |
||
164 | style: 'bootstrap', |
||
165 | className: 'error', |
||
166 | showAnimation: 'slideDown', |
||
167 | showDuration: 400, |
||
168 | hideAnimation: 'slideUp', |
||
169 | hideDuration: 200, |
||
170 | gap: 5 |
||
171 | }; |
||
172 | |||
173 | inherit = function(a, b) { |
||
174 | var F;
|
||
175 | F = function() {}; |
||
176 | F.prototype = a; |
||
177 | return $.extend(true, new F(), b); |
||
178 | }; |
||
179 | |||
180 | defaults = function(opts) { |
||
181 | return $.extend(pluginOptions, opts); |
||
182 | }; |
||
183 | |||
184 | createElem = function(tag) { |
||
185 | return $("<" + tag + "></" + tag + ">"); |
||
186 | }; |
||
187 | |||
188 | globalAnchors = {}; |
||
189 | |||
190 | getAnchorElement = function(element) { |
||
191 | var radios;
|
||
192 | if (element.is('[type=radio]')) { |
||
193 | radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) { |
||
194 | return $(e).attr('name') === element.attr('name'); |
||
195 | }); |
||
196 | element = radios.first(); |
||
197 | } |
||
198 | return element;
|
||
199 | }; |
||
200 | |||
201 | incr = function(obj, pos, val) { |
||
202 | var opp, temp;
|
||
203 | if (typeof val === 'string') { |
||
204 | val = parseInt(val, 10);
|
||
205 | } else if (typeof val !== 'number') { |
||
206 | return;
|
||
207 | } |
||
208 | if (isNaN(val)) {
|
||
209 | return;
|
||
210 | } |
||
211 | opp = positions[opposites[pos.charAt(0)]];
|
||
212 | temp = pos; |
||
213 | if (obj[opp] !== undefined) { |
||
214 | pos = positions[opp.charAt(0)];
|
||
215 | val = -val; |
||
216 | } |
||
217 | if (obj[pos] === undefined) { |
||
218 | obj[pos] = val; |
||
219 | } else {
|
||
220 | obj[pos] += val; |
||
221 | } |
||
222 | return null; |
||
223 | }; |
||
224 | |||
225 | realign = function(alignment, inner, outer) { |
||
226 | if (alignment === 'l' || alignment === 't') { |
||
227 | return 0; |
||
228 | } else if (alignment === 'c' || alignment === 'm') { |
||
229 | return outer / 2 - inner / 2; |
||
230 | } else if (alignment === 'r' || alignment === 'b') { |
||
231 | return outer - inner;
|
||
232 | } |
||
233 | throw "Invalid alignment"; |
||
234 | }; |
||
235 | |||
236 | encode = function(text) { |
||
237 | encode.e = encode.e || createElem("div");
|
||
238 | return encode.e.text(text).html();
|
||
239 | }; |
||
240 | |||
241 | Notification = (function() {
|
||
242 | |||
243 | function Notification(elem, data, options) { |
||
244 | if (typeof options === 'string') { |
||
245 | options = { |
||
246 | className: options
|
||
247 | }; |
||
248 | } |
||
249 | this.options = inherit(pluginOptions, $.isPlainObject(options) ? options : {}); |
||
250 | this.loadHTML();
|
||
251 | this.wrapper = $(coreStyle.html); |
||
252 | if (this.options.clickToHide) { |
||
253 | this.wrapper.addClass("" + pluginClassName + "-hidable"); |
||
254 | } |
||
255 | this.wrapper.data(pluginClassName, this); |
||
256 | this.arrow = this.wrapper.find("." + pluginClassName + "-arrow"); |
||
257 | this.container = this.wrapper.find("." + pluginClassName + "-container"); |
||
258 | this.container.append(this.userContainer); |
||
259 | if (elem && elem.length) {
|
||
260 | this.elementType = elem.attr('type'); |
||
261 | this.originalElement = elem;
|
||
262 | this.elem = getAnchorElement(elem);
|
||
263 | this.elem.data(pluginClassName, this); |
||
264 | this.elem.before(this.wrapper); |
||
265 | } |
||
266 | this.container.hide();
|
||
267 | this.run(data);
|
||
268 | } |
||
269 | |||
270 | Notification.prototype.loadHTML = function() { |
||
271 | var style;
|
||
272 | style = this.getStyle();
|
||
273 | this.userContainer = $(style.html); |
||
274 | return this.userFields = style.fields; |
||
275 | }; |
||
276 | |||
277 | Notification.prototype.show = function(show, userCallback) { |
||
278 | var args, callback, elems, fn, hidden,
|
||
279 | _this = this;
|
||
280 | callback = function() { |
||
281 | if (!show && !_this.elem) {
|
||
282 | _this.destroy(); |
||
283 | } |
||
284 | if (userCallback) {
|
||
285 | return userCallback();
|
||
286 | } |
||
287 | }; |
||
288 | hidden = this.container.parent().parents(':hidden').length > 0; |
||
289 | elems = this.container.add(this.arrow); |
||
290 | args = []; |
||
291 | if (hidden && show) {
|
||
292 | fn = 'show';
|
||
293 | } else if (hidden && !show) { |
||
294 | fn = 'hide';
|
||
295 | } else if (!hidden && show) { |
||
296 | fn = this.options.showAnimation;
|
||
297 | args.push(this.options.showDuration);
|
||
298 | } else if (!hidden && !show) { |
||
299 | fn = this.options.hideAnimation;
|
||
300 | args.push(this.options.hideDuration);
|
||
301 | } else {
|
||
302 | return callback();
|
||
303 | } |
||
304 | args.push(callback); |
||
305 | return elems[fn].apply(elems, args);
|
||
306 | }; |
||
307 | |||
308 | Notification.prototype.setGlobalPosition = function() { |
||
309 | var align, anchor, css, key, main, pAlign, pMain, _ref;
|
||
310 | _ref = this.getPosition(), pMain = _ref[0], pAlign = _ref[1]; |
||
311 | main = positions[pMain]; |
||
312 | align = positions[pAlign]; |
||
313 | key = pMain + "|" + pAlign;
|
||
314 | anchor = globalAnchors[key]; |
||
315 | if (!anchor) {
|
||
316 | anchor = globalAnchors[key] = createElem("div");
|
||
317 | css = {}; |
||
318 | css[main] = 0;
|
||
319 | if (align === 'middle') { |
||
320 | css.top = '45%';
|
||
321 | } else if (align === 'center') { |
||
322 | css.left = '45%';
|
||
323 | } else {
|
||
324 | css[align] = 0;
|
||
325 | } |
||
326 | anchor.css(css).addClass("" + pluginClassName + "-corner"); |
||
327 | $("body").append(anchor); |
||
328 | } |
||
329 | return anchor.prepend(this.wrapper); |
||
330 | }; |
||
331 | |||
332 | Notification.prototype.setElementPosition = function() { |
||
333 | var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, wrapPos, _i, _j, _len, _len1, _ref;
|
||
334 | position = this.getPosition();
|
||
335 | pMain = position[0], pAlign = position[1], pArrow = position[2]; |
||
336 | elemPos = this.elem.position();
|
||
337 | elemH = this.elem.outerHeight();
|
||
338 | elemW = this.elem.outerWidth();
|
||
339 | elemIH = this.elem.innerHeight();
|
||
340 | elemIW = this.elem.innerWidth();
|
||
341 | wrapPos = this.wrapper.position();
|
||
342 | contH = this.container.height();
|
||
343 | contW = this.container.width();
|
||
344 | mainFull = positions[pMain]; |
||
345 | opp = opposites[pMain]; |
||
346 | oppFull = positions[opp]; |
||
347 | css = {}; |
||
348 | css[oppFull] = pMain === 'b' ? elemH : pMain === 'r' ? elemW : 0; |
||
349 | incr(css, 'top', elemPos.top - wrapPos.top);
|
||
350 | incr(css, 'left', elemPos.left - wrapPos.left);
|
||
351 | _ref = ['top', 'left']; |
||
352 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
||
353 | pos = _ref[_i]; |
||
354 | margin = parseInt(this.elem.css("margin-" + pos), 10); |
||
355 | if (margin) {
|
||
356 | incr(css, pos, margin); |
||
357 | } |
||
358 | } |
||
359 | gap = Math.max(0, this.options.gap - (this.options.arrowShow ? arrowSize : 0)); |
||
360 | incr(css, oppFull, gap); |
||
361 | if (!this.options.arrowShow) { |
||
362 | this.arrow.hide();
|
||
363 | } else {
|
||
364 | arrowSize = this.options.arrowSize;
|
||
365 | arrowCss = $.extend({}, css);
|
||
366 | arrowColor = this.userContainer.css("border-color") || this.userContainer.css("background-color") || 'white'; |
||
367 | for (_j = 0, _len1 = mainPositions.length; _j < _len1; _j++) { |
||
368 | pos = mainPositions[_j]; |
||
369 | posFull = positions[pos]; |
||
370 | if (pos === opp) {
|
||
371 | continue;
|
||
372 | } |
||
373 | color = posFull === mainFull ? arrowColor : 'transparent';
|
||
374 | arrowCss["border-" + posFull] = "" + arrowSize + "px solid " + color; |
||
375 | } |
||
376 | incr(css, positions[opp], arrowSize); |
||
377 | if (__indexOf.call(mainPositions, pAlign) >= 0) { |
||
378 | incr(arrowCss, positions[pAlign], arrowSize * 2);
|
||
379 | } |
||
380 | } |
||
381 | if (__indexOf.call(vAligns, pMain) >= 0) { |
||
382 | incr(css, 'left', realign(pAlign, contW, elemW));
|
||
383 | if (arrowCss) {
|
||
384 | incr(arrowCss, 'left', realign(pAlign, arrowSize, elemIW));
|
||
385 | } |
||
386 | } else if (__indexOf.call(hAligns, pMain) >= 0) { |
||
387 | incr(css, 'top', realign(pAlign, contH, elemH));
|
||
388 | if (arrowCss) {
|
||
389 | incr(arrowCss, 'top', realign(pAlign, arrowSize, elemIH));
|
||
390 | } |
||
391 | } |
||
392 | if (this.container.is(":visible")) { |
||
393 | css.display = 'block';
|
||
394 | } |
||
395 | this.container.removeAttr('style').css(css); |
||
396 | if (arrowCss) {
|
||
397 | return this.arrow.removeAttr('style').css(arrowCss); |
||
398 | } |
||
399 | }; |
||
400 | |||
401 | Notification.prototype.getPosition = function() { |
||
402 | var pos, text, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
||
403 | text = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition); |
||
404 | pos = parsePosition(text); |
||
405 | if (pos.length === 0) { |
||
406 | pos[0] = 'b'; |
||
407 | } |
||
408 | if (_ref = pos[0], __indexOf.call(mainPositions, _ref) < 0) { |
||
409 | throw "Must be one of [" + mainPositions + "]"; |
||
410 | } |
||
411 | 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))) { |
||
412 | pos[1] = (_ref5 = pos[0], __indexOf.call(hAligns, _ref5) >= 0) ? 'm' : 'l'; |
||
413 | } |
||
414 | if (pos.length === 2) { |
||
415 | pos[2] = pos[1]; |
||
416 | } |
||
417 | return pos;
|
||
418 | }; |
||
419 | |||
420 | Notification.prototype.getStyle = function(name) { |
||
421 | var style;
|
||
422 | if (!name) {
|
||
423 | name = this.options.style;
|
||
424 | } |
||
425 | if (!name) {
|
||
426 | name = 'default';
|
||
427 | } |
||
428 | style = styles[name]; |
||
429 | if (!style) {
|
||
430 | throw "Missing style: " + name; |
||
431 | } |
||
432 | return style;
|
||
433 | }; |
||
434 | |||
435 | Notification.prototype.updateClasses = function() { |
||
436 | var classes, style;
|
||
437 | classes = ['base'];
|
||
438 | if ($.isArray(this.options.className)) { |
||
439 | classes = classes.concat(this.options.className);
|
||
440 | } else if (this.options.className) { |
||
441 | classes.push(this.options.className);
|
||
442 | } |
||
443 | style = this.getStyle();
|
||
444 | classes = $.map(classes, function(n) { |
||
445 | return "" + pluginClassName + "-" + style.name + "-" + n; |
||
446 | }).join(' ');
|
||
447 | return this.userContainer.attr('class', classes); |
||
448 | }; |
||
449 | |||
450 | Notification.prototype.run = function(data, options) { |
||
451 | var d, datas, name, type, value,
|
||
452 | _this = this;
|
||
453 | if ($.isPlainObject(options)) { |
||
454 | $.extend(this.options, options); |
||
455 | } else if ($.type(options) === 'string') { |
||
456 | this.options.className = options;
|
||
457 | } |
||
458 | if (this.container && !data) { |
||
459 | this.show(false); |
||
460 | return;
|
||
461 | } else if (!this.container && !data) { |
||
462 | return;
|
||
463 | } |
||
464 | datas = {}; |
||
465 | if ($.isPlainObject(data)) { |
||
466 | datas = data; |
||
467 | } else {
|
||
468 | datas[blankFieldName] = data; |
||
469 | } |
||
470 | for (name in datas) { |
||
471 | d = datas[name]; |
||
472 | type = this.userFields[name];
|
||
473 | if (!type) {
|
||
474 | continue;
|
||
475 | } |
||
476 | if (type === 'text') { |
||
477 | d = encode(d); |
||
478 | if (this.options.breakNewLines) { |
||
479 | d = d.replace(/\n/g, '<br/>'); |
||
480 | } |
||
481 | } |
||
482 | value = name === blankFieldName ? '' : '=' + name; |
||
483 | find(this.userContainer, "[data-notify-" + type + value + "]").html(d); |
||
484 | } |
||
485 | this.updateClasses();
|
||
486 | if (this.elem) { |
||
487 | this.setElementPosition();
|
||
488 | } else {
|
||
489 | this.setGlobalPosition();
|
||
490 | } |
||
491 | this.show(true); |
||
492 | if (this.options.autoHide) { |
||
493 | clearTimeout(this.autohideTimer);
|
||
494 | return this.autohideTimer = setTimeout(function() { |
||
495 | return _this.show(false); |
||
496 | }, this.options.autoHideDelay);
|
||
497 | } |
||
498 | }; |
||
499 | |||
500 | Notification.prototype.destroy = function() { |
||
501 | return this.wrapper.remove(); |
||
502 | }; |
||
503 | |||
504 | return Notification;
|
||
505 | |||
506 | })(); |
||
507 | |||
508 | $[pluginName] = function(elem, data, options) { |
||
509 | if ((elem && elem.nodeName) || elem.jquery) {
|
||
510 | $(elem)[pluginName](data, options);
|
||
511 | } else {
|
||
512 | options = data; |
||
513 | data = elem; |
||
514 | new Notification(null, data, options); |
||
515 | } |
||
516 | return elem;
|
||
517 | }; |
||
518 | |||
519 | $.fn[pluginName] = function(data, options) { |
||
520 | $(this).each(function() { |
||
521 | var inst;
|
||
522 | inst = getAnchorElement($(this)).data(pluginClassName); |
||
523 | if (inst) {
|
||
524 | return inst.run(data, options);
|
||
525 | } else {
|
||
526 | return new Notification($(this), data, options); |
||
527 | } |
||
528 | }); |
||
529 | return this; |
||
530 | }; |
||
531 | |||
532 | $.extend($[pluginName], { |
||
533 | defaults: defaults,
|
||
534 | addStyle: addStyle,
|
||
535 | pluginOptions: pluginOptions,
|
||
536 | getStyle: getStyle,
|
||
537 | insertCSS: insertCSS
|
||
538 | }); |
||
539 | |||
540 | $(function() { |
||
541 | insertCSS(coreStyle.css).attr('id', 'core-notify'); |
||
542 | $(document).on('click', "." + pluginClassName + "-hidable", function(e) { |
||
543 | return $(this).trigger('notify-hide'); |
||
544 | }); |
||
545 | return $(document).on('notify-hide', "." + pluginClassName + "-wrapper", function(e) { |
||
546 | var _ref;
|
||
547 | return (_ref = $(this).data(pluginClassName)) != null ? _ref.show(false) : void 0; |
||
548 | }); |
||
549 | }); |
||
550 | |||
551 | }(window,document,jQuery)); |
||
552 | |||
553 | $.notify.addStyle("bootstrap", { |
||
554 | html: "<div>\n<span data-notify-text></span>\n</div>", |
||
555 | classes: {
|
||
556 | base: {
|
||
557 | "font-weight": "bold", |
||
558 | "padding": "8px 15px 8px 14px", |
||
559 | "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)", |
||
560 | "background-color": "#fcf8e3", |
||
561 | "border": "1px solid #fbeed5", |
||
562 | "border-radius": "4px", |
||
563 | "white-space": "nowrap", |
||
564 | "padding-left": "25px", |
||
565 | "background-repeat": "no-repeat", |
||
566 | "background-position": "3px 7px" |
||
567 | }, |
||
568 | error: {
|
||
569 | "color": "#B94A48", |
||
570 | "background-color": "#F2DEDE", |
||
571 | "border-color": "#EED3D7", |
||
572 | "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=)" |
||
573 | }, |
||
574 | success: {
|
||
575 | "color": "#468847", |
||
576 | "background-color": "#DFF0D8", |
||
577 | "border-color": "#D6E9C6", |
||
578 | "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==)" |
||
579 | }, |
||
580 | info: {
|
||
581 | "color": "#3A87AD", |
||
582 | "background-color": "#D9EDF7", |
||
583 | "border-color": "#BCE8F1", |
||
584 | "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=)" |
||
585 | }, |
||
586 | warn: {
|
||
587 | "color": "#C09853", |
||
588 | "background-color": "#FCF8E3", |
||
589 | "border-color": "#FBEED5", |
||
590 | "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)" |
||
591 | } |
||
592 | } |
||
593 | }); |