PageSourceSearch

https://kingfisher.kz/assets/f4e7e6c2/js/jquery.custom.growl.js

js kingfisher.kz collected 2026-09-24 10:12:12 UTC 7,086 bytes, 238 lines download raw bytes

1// Generated by CoffeeScript 1.9.2
2
3/*
4jQuery Growl
5Copyright 2015 Kevin Sylvestre
61.2.7
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('<div id="growls" />');
62    };
63
64    function Growl(settings) {
65      if (settings == null) {
66        settings = {};
67      }
68      this.html = bind(this.html, this);
69      this.$growl = bind(this.$growl, this);
70      this.$growls = bind(this.$growls, this);
71      this.animate = bind(this.animate, this);
72      this.remove = bind(this.remove, this);
73      this.dismiss = bind(this.dismiss, this);
74      this.present = bind(this.present, this);
75      this.cycle = bind(this.cycle, this);
76      this.close = bind(this.close, this);
77      this.unbind = bind(this.unbind, this);
78      this.bind = bind(this.bind, this);
79      this.render = bind(this.render, this);
80      this.settings = $.extend({}, Growl.settings, settings);
81      this.$growls().attr('class', this.settings.location);
82      this.render();
83    }
84
85    Growl.prototype.render = function() {
86      var $growl;
87      $growl = this.$growl();
88      this.$growls().append($growl);
89      if (this.settings['static'] != null) {
90        if (typeof console !== "undefined" && console !== null) {
91          if (typeof console.debug === "function") {
92            console.debug('jquery.growl DEPRECATION: "static" has been renamed to "fixed" and will be removed in the next release');
93          }
94        }
95        this.settings['fixed'] = this.settings['static'];
96      }
97      if (this.settings.fixed) {
98        this.present();
99      } else {
100        this.cycle();
101      }
102    };
103
104    Growl.prototype.bind = function($growl) {
105      if ($growl == null) {
106        $growl = this.$growl();
107      }
108      return $growl.on("contextmenu", this.close).find("." + this.settings.namespace + "-close").on("click", this.close);
109    };
110
111    Growl.prototype.unbind = function($growl) {
112      if ($growl == null) {
113        $growl = this.$growl();
114      }
115      return $growl.off("contextmenu", this.close).find("." + this.settings.namespace + "-close").off("click", this.close);
116    };
117
118    Growl.prototype.close = function(event) {
119      var $growl;
120      event.preventDefault();
121      event.stopPropagation();
122      $growl = this.$growl();
123      return $growl.stop().queue(this.dismiss).queue(this.remove);
124    };
125
126    Growl.prototype.cycle = function() {
127      var $growl;
128      $growl = this.$growl();
129      return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
130    };
131
132    Growl.prototype.present = function(callback) {
133      var $growl;
134      $growl = this.$growl();
135      this.bind($growl);
136      return this.animate($growl, this.settings.namespace + "-incoming", 'out', callback);
137    };
138
139    Growl.prototype.dismiss = function(callback) {
140      var $growl;
141      $growl = this.$growl();
142      this.unbind($growl);
143      return this.animate($growl, this.settings.namespace + "-outgoing", 'in', callback);
144    };
145
146    Growl.prototype.remove = function(callback) {
147      this.$growl().remove();
148      return callback();
149    };
150
151    Growl.prototype.animate = function($element, name, direction, callback) {
152      var transition;
153      if (direction == null) {
154        direction = 'in';
155      }
156      transition = Animation.transition($element);
157      $element[direction === 'in' ? 'removeClass' : 'addClass'](name);
158      $element.offset().position;
159      $element[direction === 'in' ? 'addClass' : 'removeClass'](name);
160      if (callback == null) {
161        return;
162      }
163      if (transition != null) {
164        $element.one(transition, callback);
165      } else {
166        callback();
167      }
168    };
169
170    Growl.prototype.$growls = function() {
171      return this.$_growls != null ? this.$_growls : this.$_growls = $('#growls');
172    };
173
174    Growl.prototype.$growl = function() {
175      return this.$_growl != null ? this.$_growl : this.$_growl = $(this.html());
176    };
177
178    Growl.prototype.html = function() {
179      if (typeof this.settings.title !== 'undefined') {
180        this.settings.title = "<div class='" + this.settings.namespace + "-title'>" + this.settings.title + "</div>\n";
181      } else {
182        this.settings.title = '';
183      }
184      return "<div class='" + this.settings.namespace + " " + this.settings.namespace + "-" + this.settings.style + " " + this.settings.namespace + "-" + this.settings.size + "'>\n  <div class='" + this.settings.namespace + "-close'>" + this.settings.close + "</div>\n" + this.settings.title + "<div class='" + this.settings.namespace + "-message'>" + this.settings.message + "</div>\n</div>";
185    };
186
187    // Growl.prototype.html = function() {
188    //   return "<div class='" + this.settings.namespace + " " + this.settings.namespace + "-" + this.settings.style + " " + this.settings.namespace + "-" + this.settings.size + "'>\n  <div class='" + this.settings.namespace + "-close'>" + this.settings.close + "</div>\n  <div class='" + this.settings.namespace + "-title'>" + this.settings.title + "</div>\n  <div class='" + this.settings.namespace + "-message'>" + this.settings.message + "</div>\n</div>";
189    // };
190
191    return Growl;
192
193  })();
194
195  $.growl = function(options) {
196    if (options == null) {
197      options = {};
198    }
199    return Growl.growl(options);
200  };
201
202  $.growl.error = function(options) {
203    var settings;
204    if (options == null) {
205      options = {};
206    }
207    settings = {
208      title: "Error!",
209      style: "error"
210    };
211    return $.growl($.extend(settings, options));
212  };
213
214  $.growl.notice = function(options) {
215    var settings;
216    if (options == null) {
217      options = {};
218    }
219    settings = {
220      title: "Notice!",
221      style: "notice"
222    };
223    return $.growl($.extend(settings, options));
224  };
225
226  $.growl.warning = function(options) {
227    var settings;
228    if (options == null) {
229      options = {};
230    }
231    settings = {
232      title: "Warning!",
233      style: "warning"
234    };
235    return $.growl($.extend(settings, options));
236  };
237
238}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.