tailog 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,324 +3,4 @@
3
3
  // author : Dru Nelson
4
4
  // license : MIT
5
5
  // http://github.com/drudru/ansi_up
6
-
7
- (function (Date, undefined) {
8
-
9
- var ansi_up,
10
- VERSION = "1.3.0",
11
-
12
- // check for nodeJS
13
- hasModule = (typeof module !== 'undefined'),
14
-
15
- // Normal and then Bright
16
- ANSI_COLORS = [
17
- [
18
- { color: "27, 27, 27", 'class': "ansi-black" },
19
- { color: "182, 80, 47", 'class': "ansi-red" },
20
- { color: "141, 161, 88", 'class': "ansi-green" },
21
- { color: "220, 175, 95", 'class': "ansi-yellow" },
22
- { color: "126, 170, 199", 'class': "ansi-blue" },
23
- { color: "176, 101, 152", 'class': "ansi-magenta" },
24
- { color: "141, 220, 217", 'class': "ansi-cyan" },
25
- { color: "217, 217, 217", 'class': "ansi-white" }
26
- ], [
27
- { color: "27, 27, 27", 'class': "ansi-bright-black" },
28
- { color: "182, 80, 47", 'class': "ansi-bright-red" },
29
- { color: "141, 161, 88", 'class': "ansi-bright-green" },
30
- { color: "220, 175, 95", 'class': "ansi-bright-yellow" },
31
- { color: "126, 170, 199", 'class': "ansi-bright-blue" },
32
- { color: "176, 101, 152", 'class': "ansi-bright-magenta" },
33
- { color: "141, 220, 217", 'class': "ansi-bright-cyan" },
34
- { color: "217, 217, 217", 'class': "ansi-bright-white" }
35
- ]
36
- ],
37
-
38
- // 256 Colors Palette
39
- PALETTE_COLORS;
40
-
41
- function Ansi_Up() {
42
- this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null;
43
- this.bright = 0;
44
- }
45
-
46
- Ansi_Up.prototype.setup_palette = function() {
47
- PALETTE_COLORS = [];
48
- // Index 0..15 : System color
49
- (function() {
50
- var i, j;
51
- for (i = 0; i < 2; ++i) {
52
- for (j = 0; j < 8; ++j) {
53
- PALETTE_COLORS.push(ANSI_COLORS[i][j]['color']);
54
- }
55
- }
56
- })();
57
-
58
- // Index 16..231 : RGB 6x6x6
59
- // https://gist.github.com/jasonm23/2868981#file-xterm-256color-yaml
60
- (function() {
61
- var levels = [0, 95, 135, 175, 215, 255];
62
- var format = function (r, g, b) { return levels[r] + ', ' + levels[g] + ', ' + levels[b] };
63
- var r, g, b;
64
- for (r = 0; r < 6; ++r) {
65
- for (g = 0; g < 6; ++g) {
66
- for (b = 0; b < 6; ++b) {
67
- PALETTE_COLORS.push(format.call(this, r, g, b));
68
- }
69
- }
70
- }
71
- })();
72
-
73
- // Index 232..255 : Grayscale
74
- (function() {
75
- var level = 8;
76
- var format = function(level) { return level + ', ' + level + ', ' + level };
77
- var i;
78
- for (i = 0; i < 24; ++i, level += 10) {
79
- PALETTE_COLORS.push(format.call(this, level));
80
- }
81
- })();
82
- };
83
-
84
- Ansi_Up.prototype.escape_for_html = function (txt) {
85
- return txt.replace(/[&<>]/gm, function(str) {
86
- if (str == "&") return "&amp;";
87
- if (str == "<") return "&lt;";
88
- if (str == ">") return "&gt;";
89
- });
90
- };
91
-
92
- Ansi_Up.prototype.linkify = function (txt) {
93
- return txt.replace(/(https?:\/\/[^\s]+)/gm, function(str) {
94
- return "<a href=\"" + str + "\">" + str + "</a>";
95
- });
96
- };
97
-
98
- Ansi_Up.prototype.ansi_to_html = function (txt, options) {
99
- return this.process(txt, options, true);
100
- };
101
-
102
- Ansi_Up.prototype.ansi_to_text = function (txt) {
103
- var options = {};
104
- return this.process(txt, options, false);
105
- };
106
-
107
- Ansi_Up.prototype.process = function (txt, options, markup) {
108
- var self = this;
109
- var raw_text_chunks = txt.split(/\033\[/);
110
- var first_chunk = raw_text_chunks.shift(); // the first chunk is not the result of the split
111
-
112
- var color_chunks = raw_text_chunks.map(function (chunk) {
113
- return self.process_chunk(chunk, options, markup);
114
- });
115
-
116
- color_chunks.unshift(first_chunk);
117
-
118
- return color_chunks.join('');
119
- };
120
-
121
- Ansi_Up.prototype.process_chunk = function (text, options, markup) {
122
-
123
- // Are we using classes or styles?
124
- options = typeof options == 'undefined' ? {} : options;
125
- var use_classes = typeof options.use_classes != 'undefined' && options.use_classes;
126
- var key = use_classes ? 'class' : 'color';
127
-
128
- // Each 'chunk' is the text after the CSI (ESC + '[') and before the next CSI/EOF.
129
- //
130
- // This regex matches four groups within a chunk.
131
- //
132
- // The first and third groups match code type.
133
- // We supported only SGR command. It has empty first group and 'm' in third.
134
- //
135
- // The second group matches all of the number+semicolon command sequences
136
- // before the 'm' (or other trailing) character.
137
- // These are the graphics or SGR commands.
138
- //
139
- // The last group is the text (including newlines) that is colored by
140
- // the other group's commands.
141
- var matches = text.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);
142
-
143
- if (!matches) return text;
144
-
145
- var orig_txt = matches[4];
146
- var nums = matches[2].split(';');
147
-
148
- // We currently support only "SGR" (Select Graphic Rendition)
149
- // Simply ignore if not a SGR command.
150
- if (matches[1] !== '' || matches[3] !== 'm') {
151
- return orig_txt;
152
- }
153
-
154
- if (!markup) {
155
- return orig_txt;
156
- }
157
-
158
- var self = this;
159
-
160
- while (nums.length > 0) {
161
- var num_str = nums.shift();
162
- var num = parseInt(num_str);
163
-
164
- if (isNaN(num) || num === 0) {
165
- self.fg = self.bg = null;
166
- self.bright = 0;
167
- } else if (num === 1) {
168
- self.bright = 1;
169
- } else if (num == 39) {
170
- self.fg = null;
171
- } else if (num == 49) {
172
- self.bg = null;
173
- } else if ((num >= 30) && (num < 38)) {
174
- self.fg = ANSI_COLORS[self.bright][(num % 10)][key];
175
- } else if ((num >= 90) && (num < 98)) {
176
- self.fg = ANSI_COLORS[1][(num % 10)][key];
177
- } else if ((num >= 40) && (num < 48)) {
178
- self.bg = ANSI_COLORS[0][(num % 10)][key];
179
- } else if ((num >= 100) && (num < 108)) {
180
- self.bg = ANSI_COLORS[1][(num % 10)][key];
181
- } else if (num === 38 || num === 48) { // extend color (38=fg, 48=bg)
182
- (function() {
183
- var is_foreground = (num === 38);
184
- if (nums.length >= 1) {
185
- var mode = nums.shift();
186
- if (mode === '5' && nums.length >= 1) { // palette color
187
- var palette_index = parseInt(nums.shift());
188
- if (palette_index >= 0 && palette_index <= 255) {
189
- if (!use_classes) {
190
- if (!PALETTE_COLORS) {
191
- self.setup_palette.call(self);
192
- }
193
- if (is_foreground) {
194
- self.fg = PALETTE_COLORS[palette_index];
195
- } else {
196
- self.bg = PALETTE_COLORS[palette_index];
197
- }
198
- } else {
199
- var klass = (palette_index >= 16)
200
- ? ('ansi-palette-' + palette_index)
201
- : ANSI_COLORS[palette_index > 7 ? 1 : 0][palette_index % 8]['class'];
202
- if (is_foreground) {
203
- self.fg = klass;
204
- } else {
205
- self.bg = klass;
206
- }
207
- }
208
- }
209
- } else if(mode === '2' && nums.length >= 3) { // true color
210
- var r = parseInt(nums.shift());
211
- var g = parseInt(nums.shift());
212
- var b = parseInt(nums.shift());
213
- if ((r >= 0 && r <= 255) && (g >= 0 && g <= 255) && (b >= 0 && b <= 255)) {
214
- var color = r + ', ' + g + ', ' + b;
215
- if (!use_classes) {
216
- if (is_foreground) {
217
- self.fg = color;
218
- } else {
219
- self.bg = color;
220
- }
221
- } else {
222
- if (is_foreground) {
223
- self.fg = 'ansi-truecolor';
224
- self.fg_truecolor = color;
225
- } else {
226
- self.bg = 'ansi-truecolor';
227
- self.bg_truecolor = color;
228
- }
229
- }
230
- }
231
- }
232
- }
233
- })();
234
- }
235
- }
236
-
237
- if ((self.fg === null) && (self.bg === null)) {
238
- return orig_txt;
239
- } else {
240
- var styles = [];
241
- var classes = [];
242
- var data = {};
243
- var render_data = function (data) {
244
- var fragments = [];
245
- var key;
246
- for (key in data) {
247
- if (data.hasOwnProperty(key)) {
248
- fragments.push('data-' + key + '="' + this.escape_for_html(data[key]) + '"');
249
- }
250
- }
251
- return fragments.length > 0 ? ' ' + fragments.join(' ') : '';
252
- };
253
-
254
- if (self.fg) {
255
- if (use_classes) {
256
- classes.push(self.fg + "-fg");
257
- if (self.fg_truecolor !== null) {
258
- data['ansi-truecolor-fg'] = self.fg_truecolor;
259
- self.fg_truecolor = null;
260
- }
261
- } else {
262
- styles.push("color:rgb(" + self.fg + ")");
263
- }
264
- }
265
- if (self.bg) {
266
- if (use_classes) {
267
- classes.push(self.bg + "-bg");
268
- if (self.bg_truecolor !== null) {
269
- data['ansi-truecolor-bg'] = self.bg_truecolor;
270
- self.bg_truecolor = null;
271
- }
272
- } else {
273
- styles.push("background-color:rgb(" + self.bg + ")");
274
- }
275
- }
276
- if (use_classes) {
277
- return '<span class="' + classes.join(' ') + '"' + render_data.call(self, data) + '>' + orig_txt + '</span>';
278
- } else {
279
- return '<span style="' + styles.join(';') + '"' + render_data.call(self, data) + '>' + orig_txt + '</span>';
280
- }
281
- }
282
- };
283
-
284
- // Module exports
285
- ansi_up = {
286
-
287
- escape_for_html: function (txt) {
288
- var a2h = new Ansi_Up();
289
- return a2h.escape_for_html(txt);
290
- },
291
-
292
- linkify: function (txt) {
293
- var a2h = new Ansi_Up();
294
- return a2h.linkify(txt);
295
- },
296
-
297
- ansi_to_html: function (txt, options) {
298
- var a2h = new Ansi_Up();
299
- return a2h.ansi_to_html(txt, options);
300
- },
301
-
302
- ansi_to_text: function (txt) {
303
- var a2h = new Ansi_Up();
304
- return a2h.ansi_to_text(txt);
305
- },
306
-
307
- ansi_to_html_obj: function () {
308
- return new Ansi_Up();
309
- }
310
- };
311
-
312
- // CommonJS module is defined
313
- if (hasModule) {
314
- module.exports = ansi_up;
315
- }
316
- /*global ender:false */
317
- if (typeof window !== 'undefined' && typeof ender === 'undefined') {
318
- window.ansi_up = ansi_up;
319
- }
320
- /*global define:false */
321
- if (typeof define === "function" && define.amd) {
322
- define("ansi_up", [], function () {
323
- return ansi_up;
324
- });
325
- }
326
- })(Date);
6
+ !function(r,t){function n(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0}var o,s,e="undefined"!=typeof module,i=[[{color:"27, 27, 27","class":"ansi-black"},{color:"182, 80, 47","class":"ansi-red"},{color:"141, 161, 88","class":"ansi-green"},{color:"220, 175, 95","class":"ansi-yellow"},{color:"126, 170, 199","class":"ansi-blue"},{color:"176, 101, 152","class":"ansi-magenta"},{color:"141, 220, 217","class":"ansi-cyan"},{color:"217, 217, 217","class":"ansi-white"}],[{color:"27, 27, 27","class":"ansi-bright-black"},{color:"182, 80, 47","class":"ansi-bright-red"},{color:"141, 161, 88","class":"ansi-bright-green"},{color:"220, 175, 95","class":"ansi-bright-yellow"},{color:"126, 170, 199","class":"ansi-bright-blue"},{color:"176, 101, 152","class":"ansi-bright-magenta"},{color:"141, 220, 217","class":"ansi-bright-cyan"},{color:"217, 217, 217","class":"ansi-bright-white"}]];n.prototype.setup_palette=function(){s=[],function(){var r,t;for(r=0;2>r;++r)for(t=0;8>t;++t)s.push(i[r][t].color)}(),function(){var r,t,n,o=[0,95,135,175,215,255],e=function(r,t,n){return o[r]+", "+o[t]+", "+o[n]};for(r=0;6>r;++r)for(t=0;6>t;++t)for(n=0;6>n;++n)s.push(e.call(this,r,t,n))}(),function(){var r,t=8,n=function(r){return r+", "+r+", "+r};for(r=0;24>r;++r,t+=10)s.push(n.call(this,t))}()},n.prototype.escape_for_html=function(r){return r.replace(/[&<>]/gm,function(r){return"&"==r?"&amp;":"<"==r?"&lt;":">"==r?"&gt;":t})},n.prototype.linkify=function(r){return r.replace(/(https?:\/\/[^\s]+)/gm,function(r){return'<a href="'+r+'">'+r+"</a>"})},n.prototype.ansi_to_html=function(r,t){return this.process(r,t,!0)},n.prototype.ansi_to_text=function(r){var t={};return this.process(r,t,!1)},n.prototype.process=function(r,t,n){var o=this,s=r.split(/\033\[/),e=s.shift(),i=s.map(function(r){return o.process_chunk(r,t,n)});return i.unshift(e),i.join("")},n.prototype.process_chunk=function(r,n,o){n=t===n?{}:n;var e=t!==n.use_classes&&n.use_classes,l=e?"class":"color",a=r.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!a)return r;var c=a[4],u=a[2].split(";");if(""!==a[1]||"m"!==a[3])return c;if(!o)return c;for(var f=this;u.length>0;){var g=u.shift(),h=parseInt(g);isNaN(h)||0===h?(f.fg=f.bg=null,f.bright=0):1===h?f.bright=1:39==h?f.fg=null:49==h?f.bg=null:h>=30&&38>h?f.fg=i[f.bright][h%10][l]:h>=90&&98>h?f.fg=i[1][h%10][l]:h>=40&&48>h?f.bg=i[0][h%10][l]:h>=100&&108>h?f.bg=i[1][h%10][l]:(38===h||48===h)&&!function(){var r=38===h;if(u.length>=1){var t=u.shift();if("5"!==t||u.length<1){if("2"===t&&u.length>=3){var n=parseInt(u.shift()),o=parseInt(u.shift()),l=parseInt(u.shift());if(!(0>n||n>255||0>o||o>255||0>l||l>255)){var a=n+", "+o+", "+l;e?r?(f.fg="ansi-truecolor",f.fg_truecolor=a):(f.bg="ansi-truecolor",f.bg_truecolor=a):r?f.fg=a:f.bg=a}}}else{var c=parseInt(u.shift());if(c>=0&&255>=c)if(e){var g=16>c?i[c>7?1:0][c%8]["class"]:"ansi-palette-"+c;r?f.fg=g:f.bg=g}else s||f.setup_palette.call(f),r?f.fg=s[c]:f.bg=s[c]}}}()}if(null===f.fg&&null===f.bg)return c;var p=[],_=[],b={},v=function(r){var t,n=[];for(t in r)r.hasOwnProperty(t)&&n.push("data-"+t+'="'+this.escape_for_html(r[t])+'"');return n.length>0?" "+n.join(" "):""};return f.fg&&(e?(_.push(f.fg+"-fg"),null!==f.fg_truecolor&&(b["ansi-truecolor-fg"]=f.fg_truecolor,f.fg_truecolor=null)):p.push("color:rgb("+f.fg+")")),f.bg&&(e?(_.push(f.bg+"-bg"),null!==f.bg_truecolor&&(b["ansi-truecolor-bg"]=f.bg_truecolor,f.bg_truecolor=null)):p.push("background-color:rgb("+f.bg+")")),e?'<span class="'+_.join(" ")+'"'+v.call(f,b)+">"+c+"</span>":'<span style="'+p.join(";")+'"'+v.call(f,b)+">"+c+"</span>"},o={escape_for_html:function(r){var t=new n;return t.escape_for_html(r)},linkify:function(r){var t=new n;return t.linkify(r)},ansi_to_html:function(r,t){var o=new n;return o.ansi_to_html(r,t)},ansi_to_text:function(r){var t=new n;return t.ansi_to_text(r)},ansi_to_html_obj:function(){return new n}},e&&(module.exports=o),"undefined"!=typeof window&&"undefined"==typeof ender&&(window.ansi_up=o),"function"==typeof define&&define.amd&&define("ansi_up",[],function(){return o})}(Date);
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * jQuery Form Plugin
3
+ * version: 3.51.0-2014.06.20
4
+ * Requires jQuery v1.5 or later
5
+ * Copyright (c) 2014 M. Alsup
6
+ * Examples and documentation at: http://malsup.com/jquery/form/
7
+ * Project repository: https://github.com/malsup/form
8
+ * Dual licensed under the MIT and GPL licenses.
9
+ * https://github.com/malsup/form#copyright-and-license
10
+ */
11
+ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var i=this;if(i.clk=r,"image"==r.type)if(void 0!==t.offsetX)i.clk_x=t.offsetX,i.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();i.clk_x=t.pageX-o.left,i.clk_y=t.pageY-o.top}else i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop;setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var i=!!e.fn.prop;e.fn.attr2=function(){if(!i)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,i=e.param(r,t.traditional).split("&"),o=i.length,s=[];for(a=0;o>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,i=0;i<a.length;i++)n.append(a[i].name,a[i].value);if(t.extraData){var o=r(t.extraData);for(i=0;i<o.length;i++)o[i]&&n.append(o[i][0],o[i][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){r.data=t.formData?t.formData:n,c&&c.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){a("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function o(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){a("Server abort: ",r," (",r.name,")"),s(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),i=f.attr2("action"),o="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||o;w.setAttribute("target",p),(!u||/post/i.test(u))&&w.setAttribute("method","POST"),i!=m.url&&w.setAttribute("action",m.url),m.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(j=setTimeout(function(){T=!0,s(D)},m.timeout));var l=[];try{if(m.extraData)for(var d in m.extraData)m.extraData.hasOwnProperty(d)&&l.push(e.isPlainObject(m.extraData[d])&&m.extraData[d].hasOwnProperty("name")&&m.extraData[d].hasOwnProperty("value")?e('<input type="hidden" name="'+m.extraData[d].name+'">').val(m.extraData[d].value).appendTo(w)[0]:e('<input type="hidden" name="'+d+'">').val(m.extraData[d]).appendTo(w)[0]);m.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(h){var x=document.createElement("form").submit;x.apply(w)}}finally{w.setAttribute("action",i),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=m.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,i="success";try{if(T)throw"timeout";var o="xml"==m.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+o),!o&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,o&&(m.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":m.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(m.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||m.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var p=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];p?x.responseText=p.textContent?p.textContent:p.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,m)}catch(y){i="parsererror",x.error=r=y||i}}catch(y){a("error caught: ",y),i="error",x.error=r=y||i}x.aborted&&(a("upload aborted"),i=null),x.status&&(i=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===i?(m.success&&m.success.call(m.context,E,"success",x),S.resolve(x.responseText,"success",x),d&&e.event.trigger("ajaxSuccess",[x,m])):i&&(void 0===r&&(r=x.statusText),m.error&&m.error.call(m.context,x,i,r),S.reject(x,"error",r),d&&e.event.trigger("ajaxError",[x,m,r])),d&&e.event.trigger("ajaxComplete",[x,m]),d&&!--e.active&&e.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,x,i),F=!0,m.timeout&&clearTimeout(j),setTimeout(function(){m.iframeTarget?v.attr("src",m.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,m,d,p,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l<h.length;l++)c=e(h[l]),i?c.prop("disabled",!1):c.removeAttr("disabled");if(m=e.extend(!0,{},e.ajaxSettings,t),m.context=m.context||m,p="jqFormIO"+(new Date).getTime(),m.iframeTarget?(v=e(m.iframeTarget),b=v.attr2("name"),b?p=b:v.attr2("name",p)):(v=e('<iframe name="'+p+'" src="'+m.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(n){}v.attr("src",m.iframeSrc),x.error=r,m.error&&m.error.call(m.context,x,r,t),d&&e.event.trigger("ajaxError",[x,m,r]),m.complete&&m.complete.call(m.context,x,r)}},d=m.global,d&&0===e.active++&&e.event.trigger("ajaxStart"),d&&e.event.trigger("ajaxSend",[x,m]),m.beforeSend&&m.beforeSend.call(m.context,x,m)===!1)return m.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(m.extraData=m.extraData||{},m.extraData[b]=y.value,"image"==y.type&&(m.extraData[b+".x"]=w.clk_x,m.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(m.extraData=m.extraData||{},m.extraData[L]=A),m.forceSync?o():setTimeout(o,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",i="xml"===r||!r&&n.indexOf("xml")>=0,o=i?t.responseXML:t.responseText;return i&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,r)),"string"==typeof o&&("json"===r||!r&&n.indexOf("json")>=0?o=C(o):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var m={};if(this.trigger("form-pre-serialize",[this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var d=t.traditional;void 0===d&&(d=e.ajaxSettings.traditional);var p,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,p=e.param(t.data,d)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,m]),m.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,d);p&&(g=g?g+"&"+p:p),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,i=0,o=x.length;o>i;i++)x[i].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?o(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;E<h.length;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var i={s:this.selector,c:this.context};return!e.isReady&&i.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(i.s,i.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var i,o=this[0],s=this.attr("id"),u=t?o.getElementsByTagName("*"):o.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(i=e(':input[form="'+s+'"]').get(),i.length&&(u=(u||[]).concat(i))),!u||!u.length)return a;var c,l,f,m,d,p,h;for(c=0,p=u.length;p>c;c++)if(d=u[c],f=d.name,f&&!d.disabled)if(t&&o.clk&&"image"==d.type)o.clk==d&&(a.push({name:f,value:e(d).val(),type:d.type}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}));else if(m=e.fieldValue(d,!0),m&&m.constructor==Array)for(r&&r.push(d),l=0,h=m.length;h>l;l++)a.push({name:f,value:m[l]});else if(n.fileapi&&"file"==d.type){r&&r.push(d);var v=d.files;if(v.length)for(l=0;l<v.length;l++)a.push({name:f,value:v[l],type:d.type});else a.push({name:f,value:"",type:d.type})}else null!==m&&"undefined"!=typeof m&&(r&&r.push(d),a.push({name:f,value:m,type:d.type,required:d.required}));if(!t&&o.clk){var g=e(o.clk),x=g[0];f=x.name,f&&!x.disabled&&"image"==x.type&&(a.push({name:f,value:g.val()}),a.push({name:f+".x",value:o.clk_x},{name:f+".y",value:o.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var i=0,o=n.length;o>i;i++)r.push({name:a,value:n[i]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;n>a;a++){var i=this[a],o=e.fieldValue(i,t);null===o||"undefined"==typeof o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(r,o):r.push(o))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,i=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==i&&-1==t.selectedIndex))return null;if("select"==i){var o=t.selectedIndex;if(0>o)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?o+1:u.length,f=c?o:0;l>f;f++){var m=u[f];if(m.selected){var d=m.value;if(d||(d=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),c)return d;s.push(d)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1});
@@ -4,149 +4,8 @@
4
4
  * Based on highlight v3 by Johann Burkard
5
5
  * http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
6
6
  *
7
- * Code a little bit refactored and cleaned (in my humble opinion).
8
- * Most important changes:
9
- * - has an option to highlight only entire words (wordsOnly - false by default),
10
- * - has an option to be case sensitive (caseSensitive - false by default)
11
- * - highlight element tag and class names can be specified in options
12
- *
13
- * Usage:
14
- * // wrap every occurrence of text 'lorem' in content
15
- * // with <span class='highlight'> (default options)
16
- * $('#content').highlight('lorem');
17
- *
18
- * // search for and highlight more terms at once
19
- * // so you can save some time on traversing DOM
20
- * $('#content').highlight(['lorem', 'ipsum']);
21
- * $('#content').highlight('lorem ipsum');
22
- *
23
- * // search only for entire word 'lorem'
24
- * $('#content').highlight('lorem', { wordsOnly: true });
25
- *
26
- * // search only for the entire word 'C#'
27
- * // and make sure that the word boundary can also
28
- * // be a 'non-word' character, as well as a regex latin1 only boundary:
29
- * $('#content').highlight('C#', { wordsOnly: true , wordsBoundary: '[\\b\\W]' });
30
- *
31
- * // don't ignore case during search of term 'lorem'
32
- * $('#content').highlight('lorem', { caseSensitive: true });
33
- *
34
- * // wrap every occurrence of term 'ipsum' in content
35
- * // with <em class='important'>
36
- * $('#content').highlight('ipsum', { element: 'em', className: 'important' });
37
- *
38
- * // remove default highlight
39
- * $('#content').unhighlight();
40
- *
41
- * // remove custom highlight
42
- * $('#content').unhighlight({ element: 'em', className: 'important' });
43
- *
44
- *
45
7
  * Copyright (c) 2009 Bartek Szopka
46
- *
47
8
  * Licensed under MIT license.
48
- *
49
9
  */
50
10
 
51
- (function (factory) {
52
- if (typeof define === 'function' && define.amd) {
53
- // AMD. Register as an anonymous module.
54
- define(['jquery'], factory);
55
- } else if (typeof exports === 'object') {
56
- // Node/CommonJS
57
- factory(require('jquery'));
58
- } else {
59
- // Browser globals
60
- factory(jQuery);
61
- }
62
- }(function (jQuery) {
63
- jQuery.extend({
64
- highlight: function (node, re, nodeName, className) {
65
- if (node.nodeType === 3) {
66
- var match = node.data.match(re);
67
- if (match) {
68
- // The new highlight Element Node
69
- var highlight = document.createElement(nodeName || 'span');
70
- highlight.className = className || 'highlight';
71
- // Note that we use the captured value to find the real index
72
- // of the match. This is because we do not want to include the matching word boundaries
73
- var capturePos = node.data.indexOf( match[1] , match.index );
74
-
75
- // Split the node and replace the matching wordnode
76
- // with the highlighted node
77
- var wordNode = node.splitText(capturePos);
78
- wordNode.splitText(match[1].length);
79
-
80
- var wordClone = wordNode.cloneNode(true);
81
- highlight.appendChild(wordClone);
82
- wordNode.parentNode.replaceChild(highlight, wordNode);
83
- return 1; //skip added node in parent
84
- }
85
- } else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
86
- !/(script|style)/i.test(node.tagName) && // ignore script and style nodes
87
- !(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
88
- for (var i = 0; i < node.childNodes.length; i++) {
89
- i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
90
- }
91
- }
92
- return 0;
93
- }
94
- });
95
-
96
- jQuery.fn.unhighlight = function (options) {
97
- var settings = {
98
- className: 'highlight',
99
- element: 'span'
100
- };
101
-
102
- jQuery.extend(settings, options);
103
-
104
- return this.find(settings.element + '.' + settings.className).each(function () {
105
- var parent = this.parentNode;
106
- parent.replaceChild(this.firstChild, this);
107
- parent.normalize();
108
- }).end();
109
- };
110
-
111
- jQuery.fn.highlight = function (words, options) {
112
- var settings = {
113
- className: 'highlight',
114
- element: 'span',
115
- caseSensitive: false,
116
- wordsOnly: false,
117
- wordsBoundary: '\\b'
118
- };
119
-
120
- jQuery.extend(settings, options);
121
-
122
- if (typeof words === 'string') {
123
- words = [words];
124
- }
125
- words = jQuery.grep(words, function(word, i){
126
- return word != '';
127
- });
128
- words = jQuery.map(words, function(word, i) {
129
- return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
130
- });
131
-
132
- if (words.length === 0) {
133
- return this;
134
- };
135
-
136
- var flag = settings.caseSensitive ? '' : 'i';
137
- // The capture parenthesis will make sure we can match
138
- // only the matching word
139
- var pattern = '(' + words.join('|') + ')';
140
- if (settings.wordsOnly) {
141
- pattern =
142
- (settings.wordsBoundaryStart || settings.wordsBoundary) +
143
- pattern +
144
- (settings.wordsBoundaryEnd || settings.wordsBoundary);
145
- }
146
- var re = new RegExp(pattern, flag);
147
-
148
- return this.each(function () {
149
- jQuery.highlight(this, re, settings.element, settings.className);
150
- });
151
- };
152
- }));
11
+ !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){t.extend({highlight:function(n,r,e,o){if(3===n.nodeType){var s=n.data.match(r);if(s){var i=document.createElement(e||"span");i.className=o||"highlight";var a=n.data.indexOf(s[1],s.index),l=n.splitText(a);l.splitText(s[1].length);var c=l.cloneNode(!0);return i.appendChild(c),l.parentNode.replaceChild(i,l),1}}else if(1===n.nodeType&&n.childNodes&&!/(script|style)/i.test(n.tagName)&&(n.tagName!==e.toUpperCase()||n.className!==o))for(var u=0;u<n.childNodes.length;u++)u+=t.highlight(n.childNodes[u],r,e,o);return 0}}),t.fn.unhighlight=function(n){var r={className:"highlight",element:"span"};return t.extend(r,n),this.find(r.element+"."+r.className).each(function(){var t=this.parentNode;t.replaceChild(this.firstChild,this),t.normalize()}).end()},t.fn.highlight=function(n,r){var e={className:"highlight",element:"span",caseSensitive:!1,wordsOnly:!1,wordsBoundary:"\\b"};if(t.extend(e,r),"string"==typeof n&&(n=[n]),n=t.grep(n,function(t){return""!=t}),n=t.map(n,function(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}),0===n.length)return this;var o=e.caseSensitive?"":"i",s="("+n.join("|")+")";e.wordsOnly&&(s=(e.wordsBoundaryStart||e.wordsBoundary)+s+(e.wordsBoundaryEnd||e.wordsBoundary));var i=RegExp(s,o);return this.each(function(){t.highlight(this,i,e.element,e.className)})}});