1/** 2 * 2007-2021 ETS-Soft 3 * 4 * NOTICE OF LICENSE 5 * 6 * This file is not open source! Each license that you purchased is only available for 1 wesite only. 7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses. 8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party. 9 * 10 * DISCLAIMER 11 * 12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 13 * versions in the future. If you wish to customize PrestaShop for your 14 * needs please contact us for extra customization service at an affordable price 15 * 16 * @author ETS-Soft <[email protected]> 17 * @copyright 2007-2021 ETS-Soft 18 * @license Valid for 1 website (or project) for each purchase of license 19 * International Registered Trademark & Property of ETS-Soft 20 */ 21 22(function() { 23 "use strict"; 24 var $, Animation, Growl, 25 __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; 26 27 $ = jQuery; 28 29 Animation = (function() { 30 function Animation() {} 31 32 Animation.transitions = { 33 "webkitTransition": "webkitTransitionEnd", 34 "mozTransition": "mozTransitionEnd", 35 "oTransition": "oTransitionEnd", 36 "transition": "transitionend" 37 }; 38 39 Animation.transition = function($el) { 40 var el, result, type, _ref; 41 el = $el[0]; 42 _ref = this.transitions; 43 for (type in _ref) { 44 result = _ref[type]; 45 if (el.style[type] != null) { 46 return result; 47 } 48 } 49 }; 50 51 return Animation; 52 53 })(); 54 55 Growl = (function() { 56 Growl.settings = { 57 namespace: 'growl', 58 duration: 3200, 59 close: "×", 60 location: "default", 61 style: "default", 62 size: "medium" 63 }; 64 65 Growl.growl = function(settings) { 66 if (settings == null) { 67 settings = {}; 68 } 69 this.initialize(); 70 return new Growl(settings); 71 }; 72 73 Growl.initialize = function() { 74 return $("body:not(:has(#growls))").append('<div id="growls" />'); 75 }; 76 77 function Growl(settings) { 78 if (settings == null) { 79 settings = {}; 80 } 81 this.html = __bind(this.html, this); 82 this.$growl = __bind(this.$growl, this); 83 this.$growls = __bind(this.$growls, this); 84 this.animate = __bind(this.animate, this); 85 this.remove = __bind(this.remove, this); 86 this.dismiss = __bind(this.dismiss, this); 87 this.present = __bind(this.present, this); 88 this.close = __bind(this.close, this); 89 this.cycle = __bind(this.cycle, this); 90 this.unbind = __bind(this.unbind, this); 91 this.bind = __bind(this.bind, this); 92 this.render = __bind(this.render, this); 93 this.settings = $.extend({}, Growl.settings, settings); 94 this.$growls().attr('class', this.settings.location); 95 this.render(); 96 } 97 98 Growl.prototype.render = function() { 99 var $growl; 100 $growl = this.$growl(); 101 this.$growls().append($growl); 102 this.cycle($growl); 103 }; 104 105 Growl.prototype.bind = function($growl) { 106 if ($growl == null) { 107 $growl = this.$growl(); 108 } 109 return $growl.find("." + this.settings.namespace + "-close").on("click", this.close); 110 }; 111 112 Growl.prototype.unbind = function($growl) { 113 if ($growl == null) { 114 $growl = this.$growl(); 115 } 116 return $growl.find("." + (this.settings.namespace - close)).off("click", this.close); 117 }; 118 119 Growl.prototype.cycle = function($growl) { 120 if ($growl == null) { 121 $growl = this.$growl(); 122 } 123 return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove); 124 }; 125 126 Growl.prototype.close = function(event) { 127 var $growl; 128 event.preventDefault(); 129 event.stopPropagation(); 130 $growl = this.$growl(); 131 return $growl.stop().queue(this.dismiss).queue(this.remove); 132 }; 133 134 Growl.prototype.present = function(callback) { 135 var $growl; 136 $growl = this.$growl(); 137 this.bind($growl); 138 return this.animate($growl, "" + this.settings.namespace + "-incoming", 'out',
138callback); 139 }; 140 141 Growl.prototype.dismiss = function(callback) { 142 var $growl; 143 $growl = this.$growl(); 144 this.unbind($growl); 145 return this.animate($growl, "" + this.settings.namespace + "-outgoing", 'in', callback); 146 }; 147 148 Growl.prototype.remove = function(callback) { 149 this.$growl().remove(); 150 return callback(); 151 }; 152 153 Growl.prototype.animate = function($element, name, direction, callback) { 154 var transition; 155 if (direction == null) { 156 direction = 'in'; 157 } 158 transition = Animation.transition($element); 159 $element[direction === 'in' ? 'removeClass' : 'addClass'](name); 160 $element.offset().position; 161 $element[direction === 'in' ? 'addClass' : 'removeClass'](name); 162 if (callback == null) { 163 return; 164 } 165 if (transition != null) { 166 $element.one(transition, callback); 167 } else { 168 callback(); 169 } 170 }; 171 172 Growl.prototype.$growls = function() { 173 return this.$_growls != null ? this.$_growls : this.$_growls = $('#growls'); 174 }; 175 176 Growl.prototype.$growl = function() { 177 return this.$_growl != null ? this.$_growl : this.$_growl = $(this.html()); 178 }; 179 180 Growl.prototype.html = function() { 181 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>"; 182 }; 183 184 return Growl; 185 186 })(); 187 188 $.growl = function(options) { 189 if (options == null) { 190 options = {}; 191 } 192 return Growl.growl(options); 193 }; 194 195 $.growl.error = function(options) { 196 var settings; 197 if (options == null) { 198 options = {}; 199 } 200 settings = { 201 title: "Error!", 202 style: "error" 203 }; 204 return $.growl($.extend(settings, options)); 205 }; 206 207 $.growl.notice = function(options) { 208 var settings; 209 if (options == null) { 210 options = {}; 211 } 212 settings = { 213 title: "Notice!", 214 style: "notice" 215 }; 216 return $.growl($.extend(settings, options)); 217 }; 218 219 $.growl.warning = function(options) { 220 var settings; 221 if (options == null) { 222 options = {}; 223 } 224 settings = { 225 title: "Warning!", 226 style: "warning" 227 }; 228 return $.growl($.extend(settings, options)); 229 }; 230 231}).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.