jzip 1.0.10 → 1.0.11

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.
Files changed (30) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.textile +32 -8
  3. data/VERSION +1 -1
  4. data/jzip.gemspec +2 -2
  5. data/lib/jzip.rb +2 -0
  6. data/lib/jzip/actionpack/action_controller/base.rb +5 -5
  7. data/lib/jzip/assets.rb +6 -6
  8. data/lib/jzip/core/string/analyzation.rb +4 -4
  9. data/lib/jzip/engine.rb +24 -22
  10. data/lib/jzip/engine/requirement.rb +12 -12
  11. data/lib/jzip/engine/support/minifier.rb +7 -7
  12. data/lib/jzip/engine/support/notifier.rb +10 -5
  13. data/lib/jzip/engine/template.rb +28 -28
  14. data/lib/jzip/plugin.rb +2 -2
  15. data/tasks/jzip.rake +2 -2
  16. data/test/actionpack/action_controller/base_test.rb +11 -11
  17. data/test/core/string/analyzation_test.rb +5 -5
  18. data/test/javascripts/after/uncompressed/public/javascripts/backend.js +103 -103
  19. data/test/javascripts/after/uncompressed/public/javascripts/frontend.js +103 -103
  20. data/test/javascripts/after/uncompressed/tmp/jzip/public/javascripts/shared/_shared.js +102 -102
  21. data/test/javascripts/assets/jzip/code_heroes/backend.js +1 -1
  22. data/test/javascripts/assets/jzip/code_heroes/frontend.js +1 -1
  23. data/test/javascripts/assets/jzip/shared/code_heroes.js +2 -2
  24. data/test/javascripts/assets/jzip/shared/code_heroes/ajaxify.js +1 -1
  25. data/test/javascripts/assets/jzip/shared/jquery/ajax_setup.js +2 -2
  26. data/test/javascripts/assets/jzip/shared/jquery/class.js +51 -51
  27. data/test/javascripts/assets/jzip/shared/jquery/extensions/core.js +1 -1
  28. data/test/javascripts/assets/jzip/shared/jquery/extensions/deparam.js +23 -23
  29. data/test/javascripts/assets/jzip/shared/jquery/seat_holder.js +22 -22
  30. metadata +4 -4
@@ -6,7 +6,7 @@ CodeHeroes.Backend = (function() {
6
6
  event.preventDefault();
7
7
  });
8
8
  };
9
-
9
+
10
10
  return {
11
11
  init: function() {
12
12
  bind();
@@ -6,7 +6,7 @@ CodeHeroes.Frontend = (function() {
6
6
  event.preventDefault();
7
7
  });
8
8
  };
9
-
9
+
10
10
  return {
11
11
  init: function() {
12
12
  bind();
@@ -5,7 +5,7 @@ CodeHeroes = (function() {
5
5
  initSubModules(module);
6
6
  });
7
7
  };
8
-
8
+
9
9
  var initSubModules = function(mod) {
10
10
  if (mod.init) {
11
11
  mod.init();
@@ -14,7 +14,7 @@ CodeHeroes = (function() {
14
14
  initSubModules(m);
15
15
  });
16
16
  };
17
-
17
+
18
18
  return {
19
19
  init: function() {
20
20
  initModules();
@@ -6,7 +6,7 @@ CodeHeroes.Ajaxify = (function() {
6
6
  event.preventDefault();
7
7
  });
8
8
  };
9
-
9
+
10
10
  return {
11
11
  init: function() {
12
12
  bind();
@@ -1,6 +1,6 @@
1
- //
1
+ //
2
2
  // This ensures IE7 support
3
- //
3
+ //
4
4
 
5
5
  $.ajaxSetup({
6
6
  xhr: function() {
@@ -3,29 +3,29 @@
3
3
  *
4
4
  * Copyright (c) 2008, Digg, Inc.
5
5
  * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
8
  * modification, are permitted provided that the following conditions are met:
9
9
  *
10
- * - Redistributions of source code must retain the above copyright notice,
10
+ * - Redistributions of source code must retain the above copyright notice,
11
11
  * this list of conditions and the following disclaimer.
12
- * - Redistributions in binary form must reproduce the above copyright notice,
13
- * this list of conditions and the following disclaimer in the documentation
12
+ * - Redistributions in binary form must reproduce the above copyright notice,
13
+ * this list of conditions and the following disclaimer in the documentation
14
14
  * and/or other materials provided with the distribution.
15
- * - Neither the name of the Digg, Inc. nor the names of its contributors
16
- * may be used to endorse or promote products derived from this software
15
+ * - Neither the name of the Digg, Inc. nor the names of its contributors
16
+ * may be used to endorse or promote products derived from this software
17
17
  * without specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
29
  * POSSIBILITY OF SUCH DAMAGE.
30
30
  *
31
31
  * @module Class
@@ -52,41 +52,41 @@ Class = {
52
52
  arguments[arguments.length - 1].constructor == Boolean) ? //...and the last one is Boolean...
53
53
  arguments[arguments.length - 1] : //...then it's the static flag...
54
54
  false; //...otherwise default to a dynamic class
55
-
55
+
56
56
  //static: Object, dynamic: Function
57
57
  var c = s ? {} : function() {
58
58
  this.init.apply(this, arguments);
59
59
  };
60
-
60
+
61
61
  //all of our classes have these in common
62
62
  var methods = {
63
63
  //a basic namespace container to pass objects through
64
64
  ns: [],
65
-
65
+
66
66
  //a container to hold one level of overwritten methods
67
67
  supers: {},
68
-
68
+
69
69
  //a constructor
70
70
  init: function() {},
71
-
71
+
72
72
  //our namespace function
73
73
  namespace:function(ns) {
74
74
  //don't add nothing
75
75
  if (!ns) return null;
76
-
76
+
77
77
  //closures are neat
78
78
  var _this = this;
79
-
79
+
80
80
  //handle ['ns1', 'ns2'... 'nsN'] format
81
81
  if(ns.constructor == Array) {
82
82
  //call namespace normally for each array item...
83
83
  $.each(ns, function() {
84
84
  _this.namespace.apply(_this, [this]);
85
85
  });
86
-
86
+
87
87
  //...then get out of this call to namespace
88
88
  return;
89
-
89
+
90
90
  //handle {'ns': contents} format
91
91
  } else if(ns.constructor == Object) {
92
92
  //loop through the object passed to namespace
@@ -95,26 +95,26 @@ Class = {
95
95
  if([Object, Function].indexOf(ns[key].constructor) > -1) {
96
96
  //in case this.ns has been deleted
97
97
  if(!this.ns) this.ns = [];
98
-
98
+
99
99
  //copy the namespace into an array holder
100
100
  this.ns[key] = ns[key];
101
-
101
+
102
102
  //apply namespace, this will be caught by the ['ns1', 'ns2'... 'nsN'] format above
103
103
  this.namespace.apply(this, [key]);
104
104
  }
105
105
  }
106
-
106
+
107
107
  //we're done with namespace for now
108
108
  return;
109
109
  }
110
-
110
+
111
111
  //note: [{'ns': contents}, {'ns2': contents2}... {'nsN': contentsN}] is inherently handled by the above two cases
112
-
112
+
113
113
  var levels = ns.split(".");
114
-
114
+
115
115
  //if init && constructor == Object or Function
116
116
  var nsobj = this.prototype ? this.prototype : this;
117
-
117
+
118
118
  $.each(levels, function() {
119
119
  /* When adding a namespace check to see, in order:
120
120
  * 1) does the ns exist in our ns passthrough object?
@@ -126,38 +126,38 @@ Class = {
126
126
  * 4) if none of the above, make a new static class
127
127
  */
128
128
  nsobj[this] = _this.ns[this] || nsobj[this] || window[this] || Class.create(true);
129
-
129
+
130
130
  //remove our temp passthrough if it exists
131
131
  delete _this.ns[this];
132
-
132
+
133
133
  //move one level deeper for the next iteration
134
134
  nsobj = nsobj[this];
135
135
  });
136
-
136
+
137
137
  //TODO: do we really need to return this? it's not that useful anymore
138
138
  return nsobj;
139
139
  },
140
-
140
+
141
141
  /* create exists inside classes too. neat huh?
142
142
  usage differs slightly: MyClass.create('MySubClass', { myMethod: function() }); */
143
143
  create: function() {
144
144
  //turn arguments into a regular Array
145
145
  var args = Array.prototype.slice.call(arguments);
146
-
146
+
147
147
  //pull the name of the new class out
148
148
  var name = args.shift();
149
-
149
+
150
150
  //create a new class with the rest of the arguments
151
151
  var temp = Class.create.apply(Class, args);
152
-
152
+
153
153
  //load our new class into the {name: class} format to pass it into namespace()
154
154
  var ns = {};
155
155
  ns[name] = temp;
156
-
156
+
157
157
  //put the new class into the current one
158
158
  this.namespace(ns);
159
159
  },
160
-
160
+
161
161
  //call the super of a method
162
162
  sup: function() {
163
163
  try {
@@ -168,20 +168,20 @@ Class = {
168
168
  }
169
169
  }
170
170
  };
171
-
171
+
172
172
  //static: doesn't need a constructor
173
173
  s ? delete methods.init : null;
174
-
174
+
175
175
  //put default stuff in the thing before the other stuff
176
176
  $.extend(c, methods);
177
-
177
+
178
178
  //double copy methods for dynamic classes
179
179
  //they get our common utils in their class definition AND their prototype
180
180
  if(!s) $.extend(c.prototype, methods);
181
-
181
+
182
182
  //static: extend the Object, dynamic: extend the prototype
183
183
  var extendee = s ? c : c.prototype;
184
-
184
+
185
185
  //loop through arguments. if they're the right type, tack them on
186
186
  $.each(arguments, function() {
187
187
  //either we're passing in an object full of methods, or the prototype of an existing class
@@ -195,17 +195,17 @@ Class = {
195
195
  if(extendee[i] && extendee[i].constructor == Function && ['namespace','create','sup'].indexOf(i) == -1) {
196
196
  //since Function.name is almost never set for us, do it manually
197
197
  this[i].name = extendee[i].name = i;
198
-
198
+
199
199
  //throw the existing function into this.supers before it's overwritten
200
200
  extendee.supers[i] = extendee[i];
201
201
  }
202
-
202
+
203
203
  //extend the current property into our class
204
204
  extendee[i] = this[i];
205
205
  }
206
206
  }
207
207
  });
208
-
208
+
209
209
  //shiny new class, ready to go
210
210
  return c;
211
211
  }
@@ -30,7 +30,7 @@ $.fn.extend({
30
30
  }
31
31
  }
32
32
  });
33
-
33
+
34
34
  return hash;
35
35
  }
36
36
  });
@@ -1,29 +1,29 @@
1
1
  // Section: Deparam (from string)
2
- //
2
+ //
3
3
  // Method: jQuery.deparam
4
- //
4
+ //
5
5
  // Deserialize a params string into an object, optionally coercing numbers,
6
6
  // booleans, null and undefined values; this method is the counterpart to the
7
7
  // internal jQuery.param method.
8
- //
8
+ //
9
9
  // Usage:
10
- //
10
+ //
11
11
  // > jQuery.deparam( params [, coerce ] );
12
- //
12
+ //
13
13
  // Arguments:
14
- //
14
+ //
15
15
  // params - (String) A params string to be parsed.
16
16
  // coerce - (Boolean) If true, coerces any numbers or true, false, null, and
17
17
  // undefined to their actual value. Defaults to false if omitted.
18
- //
18
+ //
19
19
  // Returns:
20
- //
20
+ //
21
21
  // (Object) An object representing the deserialized params string.
22
22
 
23
23
  $.deparam = function( params, coerce ) {
24
24
  var obj = {},
25
25
  coerce_types = { 'true': !0, 'false': !1, 'null': null };
26
-
26
+
27
27
  // Iterate over all name=value pairs.
28
28
  $.each( params.replace( /\+/g, ' ' ).split( '&' ), function(j,v){
29
29
  var param = v.split( '=' ),
@@ -31,32 +31,32 @@ $.deparam = function( params, coerce ) {
31
31
  val,
32
32
  cur = obj,
33
33
  i = 0,
34
-
34
+
35
35
  // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
36
36
  // into its component parts.
37
37
  keys = key.split( '][' ),
38
38
  keys_last = keys.length - 1;
39
-
39
+
40
40
  // If the first keys part contains [ and the last ends with ], then []
41
41
  // are correctly balanced.
42
42
  if ( /\[/.test( keys[0] ) && /\]$/.test( keys[ keys_last ] ) ) {
43
43
  // Remove the trailing ] from the last keys part.
44
44
  keys[ keys_last ] = keys[ keys_last ].replace( /\]$/, '' );
45
-
45
+
46
46
  // Split first keys part into two parts on the [ and add them back onto
47
47
  // the beginning of the keys array.
48
48
  keys = keys.shift().split('[').concat( keys );
49
-
49
+
50
50
  keys_last = keys.length - 1;
51
51
  } else {
52
52
  // Basic 'foo' style key.
53
53
  keys_last = 0;
54
54
  }
55
-
55
+
56
56
  // Are we dealing with a name=value pair, or just a name?
57
57
  if ( param.length === 2 ) {
58
58
  val = decodeURIComponent( param[1] );
59
-
59
+
60
60
  // Coerce values.
61
61
  if ( coerce ) {
62
62
  val = val && !isNaN(val) ? +val // number
@@ -64,11 +64,11 @@ $.deparam = function( params, coerce ) {
64
64
  : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
65
65
  : val; // string
66
66
  }
67
-
67
+
68
68
  if ( keys_last ) {
69
69
  // Complex key, build deep object structure based on a few rules:
70
70
  // * The 'cur' pointer starts at the object top-level.
71
- // * [] = array push (n is set to array length), [n] = array if n is
71
+ // * [] = array push (n is set to array length), [n] = array if n is
72
72
  // numeric, otherwise object.
73
73
  // * If at the last keys part, set the value.
74
74
  // * For each keys part, if the current level is undefined create an
@@ -81,26 +81,26 @@ $.deparam = function( params, coerce ) {
81
81
  ? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] )
82
82
  : val;
83
83
  }
84
-
84
+
85
85
  } else {
86
86
  // Simple key, even simpler rules, since only scalars and shallow
87
87
  // arrays are allowed.
88
-
88
+
89
89
  if ( $.isArray( obj[key] ) ) {
90
90
  // val is already an array, so push on the next value.
91
91
  obj[key].push( val );
92
-
92
+
93
93
  } else if ( obj[key] !== undefined ) {
94
94
  // val isn't an array, but since a second value has been specified,
95
95
  // convert val into an array.
96
96
  obj[key] = [ obj[key], val ];
97
-
97
+
98
98
  } else {
99
99
  // val is a scalar.
100
100
  obj[key] = val;
101
101
  }
102
102
  }
103
-
103
+
104
104
  } else if ( key ) {
105
105
  // No value was defined, so set something meaningful.
106
106
  obj[key] = coerce
@@ -108,6 +108,6 @@ $.deparam = function( params, coerce ) {
108
108
  : '';
109
109
  }
110
110
  });
111
-
111
+
112
112
  return obj;
113
113
  };
@@ -6,7 +6,7 @@ var scriptElement = (function deriveScriptElement() {
6
6
 
7
7
  var dummyScript = document.getElementById(id);
8
8
  var element = dummyScript.previousSibling;
9
-
9
+
10
10
  while (element && element.tagName.toLowerCase() != "script") {
11
11
  element = element.previousSibling;
12
12
  }
@@ -34,9 +34,9 @@ var scriptHost = (function deriveScriptHost() {
34
34
 
35
35
  SeatHolder = (function() {
36
36
  var hintClass = "sh_hint", hideClass = "sh_hide";
37
-
37
+
38
38
  var injectCode = function() {
39
- var style = "<style>" +
39
+ var style = "<style>" +
40
40
  "." + hintClass + " { color: " + SeatHolder.hintColor +" !important } " +
41
41
  "." + hideClass + " { display: none !important }" +
42
42
  "</style>";
@@ -45,7 +45,7 @@ SeatHolder = (function() {
45
45
  };
46
46
  var bind = function() {
47
47
  var hintedElements = [];
48
-
48
+
49
49
  jQuery.each(jQuery(SeatHolder.selector), function(i, element) {
50
50
  element = jQuery(element);
51
51
  var seatholder = element.attr("seatholder");
@@ -59,11 +59,11 @@ SeatHolder = (function() {
59
59
  } else {
60
60
  hintedElements.push(element);
61
61
  }
62
-
62
+
63
63
  element.focus(onFocus)
64
64
  .blur(onBlur);
65
65
  });
66
-
66
+
67
67
  jQuery.each(hintedElements, function(i, element) {
68
68
  element = jQuery(element);
69
69
  var hintElement = element.data("hint_element");
@@ -75,29 +75,29 @@ SeatHolder = (function() {
75
75
  .attr("readonly", true)
76
76
  .data("hinted_element", element)
77
77
  .focus(onHintFocus);
78
-
78
+
79
79
  jQuery.each(["class", "size", "cols", "rows"], function(index, attribute) {
80
80
  switch(attribute) {
81
81
  case "class":
82
82
  hintElement.attr(attribute, element.attr(attribute).replace(hideClass, "")); break;
83
83
  default:
84
84
  hintElement.attr(attribute, element.attr(attribute));
85
- }
85
+ }
86
86
  });
87
-
87
+
88
88
  hintElement.addClass(hintClass);
89
89
  element.data("hint_element", hintElement)
90
90
  .before(hintElement);
91
91
  }
92
-
92
+
93
93
  hintElement.val(element.attr("seatholder"));
94
94
  onBlur(null, element);
95
95
  });
96
96
  };
97
-
97
+
98
98
  var onHintFocus = function(event) {
99
99
  var hintElement = jQuery(event.target).addClass(hideClass);
100
-
100
+
101
101
  hintElement.data("hinted_element")
102
102
  .removeClass(hideClass)
103
103
  .focus();
@@ -105,13 +105,13 @@ SeatHolder = (function() {
105
105
  var onFocus = function(event) {
106
106
  var element = jQuery(event.target);
107
107
  var seatholder = element.attr("seatholder");
108
-
108
+
109
109
  if (element.val() == seatholder.replace(/^&/, "")) {
110
110
  element.val("");
111
111
  }
112
-
112
+
113
113
  var input = element.get(0);
114
-
114
+
115
115
  if (input.createTextRange) {
116
116
  var oRange = input.createTextRange();
117
117
  oRange.moveStart("character", 0);
@@ -125,20 +125,20 @@ SeatHolder = (function() {
125
125
  if (element == null) {
126
126
  element = jQuery(event.target);
127
127
  }
128
-
128
+
129
129
  var seatholder = element.attr("seatholder");
130
130
  var hintElement = element.data("hint_element");
131
131
  if (typeof(hintElement) == "undefined") {
132
132
  hintElement = null;
133
133
  }
134
-
134
+
135
135
  if ((element.val().length > 0 && element.val() != seatholder.replace(/^&/, ""))) {
136
136
  if (hintElement) {
137
137
  hintElement.addClass(hideClass);
138
138
  }
139
139
  return;
140
140
  }
141
-
141
+
142
142
  if (seatholder.match(/^&/)) {
143
143
  element.val(seatholder.replace(/^&/, ""));
144
144
  } else {
@@ -147,7 +147,7 @@ SeatHolder = (function() {
147
147
  hintElement.removeClass(hideClass);
148
148
  }
149
149
  };
150
-
150
+
151
151
  return {
152
152
  version: "0.8",
153
153
  selector: "[seatholder]",
@@ -166,16 +166,16 @@ SeatHolder = (function() {
166
166
 
167
167
  (function () {
168
168
  var missing_libs = [];
169
-
169
+
170
170
  if (typeof(jQuery) == "undefined") {
171
171
  missing_libs.push("core");
172
172
  }
173
-
173
+
174
174
  if (missing_libs.length == 0) {
175
175
  SeatHolder.init();
176
176
  } else {
177
177
  var src = scriptElement.getAttribute("src").replace(/(development\/)?seat_holder(\-min)?\.js.*$/, "jquery/" + missing_libs.sort().join(".") + ".js");
178
- document.write('<script src="' + src + '" type="text/javascript" ' +
178
+ document.write('<script src="' + src + '" type="text/javascript" ' +
179
179
  'onload="SeatHolder.init()" onreadystatechange="SeatHolder.init()">' +
180
180
  '</script>');
181
181
  }