1/*! 2 * 3 * ÐазовÑй абÑÑÑакÑнÑй клаÑÑ 4 * ТолÑко каÑÐºÐ°Ñ 5 * 6 * @author Semenov Alexander <[email protected]> 7 * @link http://skeeks.com/ 8 * @copyright 2010-2014 SkeekS (Sx) 9 * @date 28.01.2015 10 * @since 1.0.0 11 */ 12(function(sx, $, _) 13{ 14 sx.createNamespace('classes.notify', sx); 15 16 sx.classes.notify._Notify = sx.classes.Component.extend({ 17 18 /** 19 * УÑÑановка Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼ÑÑ Ð´Ð°Ð½Ð½ÑÑ 20 * @param text 21 * @param opts 22 */ 23 construct: function(text, opts) 24 { 25 opts = opts || {}; 26 opts.text = text; 27 28 this.applyParentMethod(sx.classes.Component, 'construct', [opts]); 29 }, 30 31 _init: function() 32 { 33 this.defaultOpts({ 34 "autoShow" : true 35 }); 36 37 if (this.isAutoShow()) 38 { 39 this.show(); 40 } 41 }, 42 43 /** 44 * @returns {sx.classes._Notify} 45 */ 46 show: function() 47 { 48 this.trigger('beforeShow'); 49 this._show(); 50 51 return this; 52 }, 53 54 close: function() 55 { 56 this.trigger('beforeClose'); 57 this._close(); 58 }, 59 60 /** 61 * @returns {sx.classes._Notify} 62 * @private 63 */ 64 _show: function() 65 { 66 this.trigger('afterShow'); 67 throw new Error('this is abstract class'); 68 return this; 69 }, 70 71 /** 72 * @returns {sx.classes._Notify} 73 * @private 74 */ 75 _close: function() 76 { 77 this.trigger('afterClose'); 78 throw new Error('this is abstract class'); 79 return this; 80 }, 81 82 /** 83 * @returns {boolean} 84 */ 85 isAutoShow: function() 86 { 87 return Boolean(this.get("autoShow")); 88 } 89 }); 90 91 sx.classes.notify.Defaul = sx.classes.notify._Notify.extend({}); 92 93 sx.classes.notify.Notice = sx.classes.notify.Defaul.extend({}); 94 sx.classes.notify.Success = sx.classes.notify.Defaul.extend({}); 95 sx.classes.notify.Warning = sx.classes.notify.Defaul.extend({}); 96 sx.classes.notify.Error = sx.classes.notify.Defaul.extend({}); 97 sx.classes.notify.Fail = sx.classes.notify.Defaul.extend({}); 98 sx.classes.notify.Info = sx.classes.notify.Defaul.extend({}); 99 100 /** 101 * @type {{defaul: Function, notice: Function, success: Function, warning: Function, error: Function, fail: Function, info: Function}} 102 */ 103 sx.notify = 104 { 105 /** 106 * @param text 107 * @param options 108 * @returns {sx.classes.notify.Defaul} 109 */ 110 defaul: function(text, options) 111 { 112 return new sx.classes.notify.Defaul(text, options); 113 }, 114 115 /** 116 * @param text 117 * @param options 118 * @returns {sx.classes.notify.Notice} 119 */ 120 notice: function(text, options) 121 { 122 return new sx.classes.notify.Notice(text, options); 123 }, 124 125 /** 126 * @param text 127 * @param options 128 * @returns {sx.classes.notify.Success} 129 */ 130 success: function(text, options) 131 { 132 return new sx.classes.notify.Success(text, options); 133 }, 134 135 /** 136 * @param text 137 * @param options 138 * @returns {sx.classes.notify.Warning} 139 */ 140 warning: function(text, options) 141 { 142 return new sx.classes.notify.Warning(text, options); 143 }, 144 145 /** 146 * @param text 147 * @param options 148 * @returns {jQuery.Error} 149 */ 150 error: function(text, options) 151 { 152 return new sx.classes.notify.Error(text, options); 153 }, 154 155 /** 156 * @param text 157 * @param options 158 * @returns {sx.classes.notify.Fail} 159 */ 160 fail: function(text, options) 161 { 162 return new sx.classes.notify.Fail(text, options); 163 }, 164 165 /** 166 * @param text 167 * @param options 168 * @returns {sx.classes.notify.Info} 169 */ 170 info: function(text, options) 171 { 172 return new sx.classes.notify.Info(text, options); 173 }, 174 }; 175 176 177 /** 178 * Ð¥ÑÐ½Ð´Ð»ÐµÑ ajax, Ð´Ð»Ñ Ð¿Ð¾ÐºÐ°Ð·Ð° Ñведомлений 179 */ 180 sx.classes.AjaxHandlerNotify = sx.classes.AjaxHandler.extend({ 181 182 _init: function() 183 { 184 var self = this; 185 186 var allow = this.get('allow', ['error', 'success']); 187 188 //ÐÑклÑÑаем внÑÑÑенний подÑÑÐµÑ ÑоÑÑоÑÐ½Ð¸Ñ ajax запÑоÑа 189 this.getAjaxQuery() 190 .onError(function(e, data) 191 { 192 if ( _.indexOf(allow, 'error') >= 0 ) 193 { 194 sx.notify.error(self.get('error', 'Ðо вÑÐµÐ¼Ñ ajax запÑоÑа пÑоизоÑла оÑибка')); 195 } 196 }) 197 .onSuccess(function(e, data) 198 { 199 if ( _.indexOf(allow, 'success') >= 0 ) 200 { 201 sx.notify.success(self.get('success', 'ÐапÑÐ¾Ñ Ð²Ð¿Ð¾Ð»Ð½ÐµÐ½ ÑÑпеÑно')); 202 } 203 }) 204 ; 205 } 206 });
207 208 sx.classes.AjaxHandlerNotifyErrors = sx.classes.AjaxHandler.extend({ 209 _init: function() 210 { 211 this.set('allow', ['error']); 212 this.applyParentMethod(sx.classes.AjaxHandler, '_init'); 213 } 214 }); 215 216})(sx, sx.$, sx._);
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.