jzip 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -228,37 +228,37 @@ $.fn.extend({
228
228
  }
229
229
  }
230
230
  });
231
-
231
+
232
232
  return hash;
233
233
  }
234
234
  });
235
235
 
236
236
  // Section: Deparam (from string)
237
- //
237
+ //
238
238
  // Method: jQuery.deparam
239
- //
239
+ //
240
240
  // Deserialize a params string into an object, optionally coercing numbers,
241
241
  // booleans, null and undefined values; this method is the counterpart to the
242
242
  // internal jQuery.param method.
243
- //
243
+ //
244
244
  // Usage:
245
- //
245
+ //
246
246
  // > jQuery.deparam( params [, coerce ] );
247
- //
247
+ //
248
248
  // Arguments:
249
- //
249
+ //
250
250
  // params - (String) A params string to be parsed.
251
251
  // coerce - (Boolean) If true, coerces any numbers or true, false, null, and
252
252
  // undefined to their actual value. Defaults to false if omitted.
253
- //
253
+ //
254
254
  // Returns:
255
- //
255
+ //
256
256
  // (Object) An object representing the deserialized params string.
257
257
 
258
258
  $.deparam = function( params, coerce ) {
259
259
  var obj = {},
260
260
  coerce_types = { 'true': !0, 'false': !1, 'null': null };
261
-
261
+
262
262
  // Iterate over all name=value pairs.
263
263
  $.each( params.replace( /\+/g, ' ' ).split( '&' ), function(j,v){
264
264
  var param = v.split( '=' ),
@@ -266,32 +266,32 @@ $.deparam = function( params, coerce ) {
266
266
  val,
267
267
  cur = obj,
268
268
  i = 0,
269
-
269
+
270
270
  // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
271
271
  // into its component parts.
272
272
  keys = key.split( '][' ),
273
273
  keys_last = keys.length - 1;
274
-
274
+
275
275
  // If the first keys part contains [ and the last ends with ], then []
276
276
  // are correctly balanced.
277
277
  if ( /\[/.test( keys[0] ) && /\]$/.test( keys[ keys_last ] ) ) {
278
278
  // Remove the trailing ] from the last keys part.
279
279
  keys[ keys_last ] = keys[ keys_last ].replace( /\]$/, '' );
280
-
280
+
281
281
  // Split first keys part into two parts on the [ and add them back onto
282
282
  // the beginning of the keys array.
283
283
  keys = keys.shift().split('[').concat( keys );
284
-
284
+
285
285
  keys_last = keys.length - 1;
286
286
  } else {
287
287
  // Basic 'foo' style key.
288
288
  keys_last = 0;
289
289
  }
290
-
290
+
291
291
  // Are we dealing with a name=value pair, or just a name?
292
292
  if ( param.length === 2 ) {
293
293
  val = decodeURIComponent( param[1] );
294
-
294
+
295
295
  // Coerce values.
296
296
  if ( coerce ) {
297
297
  val = val && !isNaN(val) ? +val // number
@@ -299,11 +299,11 @@ $.deparam = function( params, coerce ) {
299
299
  : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
300
300
  : val; // string
301
301
  }
302
-
302
+
303
303
  if ( keys_last ) {
304
304
  // Complex key, build deep object structure based on a few rules:
305
305
  // * The 'cur' pointer starts at the object top-level.
306
- // * [] = array push (n is set to array length), [n] = array if n is
306
+ // * [] = array push (n is set to array length), [n] = array if n is
307
307
  // numeric, otherwise object.
308
308
  // * If at the last keys part, set the value.
309
309
  // * For each keys part, if the current level is undefined create an
@@ -316,26 +316,26 @@ $.deparam = function( params, coerce ) {
316
316
  ? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] )
317
317
  : val;
318
318
  }
319
-
319
+
320
320
  } else {
321
321
  // Simple key, even simpler rules, since only scalars and shallow
322
322
  // arrays are allowed.
323
-
323
+
324
324
  if ( $.isArray( obj[key] ) ) {
325
325
  // val is already an array, so push on the next value.
326
326
  obj[key].push( val );
327
-
327
+
328
328
  } else if ( obj[key] !== undefined ) {
329
329
  // val isn't an array, but since a second value has been specified,
330
330
  // convert val into an array.
331
331
  obj[key] = [ obj[key], val ];
332
-
332
+
333
333
  } else {
334
334
  // val is a scalar.
335
335
  obj[key] = val;
336
336
  }
337
337
  }
338
-
338
+
339
339
  } else if ( key ) {
340
340
  // No value was defined, so set something meaningful.
341
341
  obj[key] = coerce
@@ -343,13 +343,13 @@ $.deparam = function( params, coerce ) {
343
343
  : '';
344
344
  }
345
345
  });
346
-
346
+
347
347
  return obj;
348
348
  };
349
349
 
350
- //
350
+ //
351
351
  // This ensures IE7 support
352
- //
352
+ //
353
353
 
354
354
  $.ajaxSetup({
355
355
  xhr: function() {
@@ -376,29 +376,29 @@ $.ajaxSetup({
376
376
  *
377
377
  * Copyright (c) 2008, Digg, Inc.
378
378
  * All rights reserved.
379
- *
380
- * Redistribution and use in source and binary forms, with or without
379
+ *
380
+ * Redistribution and use in source and binary forms, with or without
381
381
  * modification, are permitted provided that the following conditions are met:
382
382
  *
383
- * - Redistributions of source code must retain the above copyright notice,
383
+ * - Redistributions of source code must retain the above copyright notice,
384
384
  * this list of conditions and the following disclaimer.
385
- * - Redistributions in binary form must reproduce the above copyright notice,
386
- * this list of conditions and the following disclaimer in the documentation
385
+ * - Redistributions in binary form must reproduce the above copyright notice,
386
+ * this list of conditions and the following disclaimer in the documentation
387
387
  * and/or other materials provided with the distribution.
388
- * - Neither the name of the Digg, Inc. nor the names of its contributors
389
- * may be used to endorse or promote products derived from this software
388
+ * - Neither the name of the Digg, Inc. nor the names of its contributors
389
+ * may be used to endorse or promote products derived from this software
390
390
  * without specific prior written permission.
391
- *
392
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
393
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
394
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
395
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
396
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
397
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
398
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
399
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
400
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
401
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
391
+ *
392
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
393
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
394
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
395
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
396
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
397
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
398
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
399
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
400
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
401
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
402
402
  * POSSIBILITY OF SUCH DAMAGE.
403
403
  *
404
404
  * @module Class
@@ -425,41 +425,41 @@ Class = {
425
425
  arguments[arguments.length - 1].constructor == Boolean) ? //...and the last one is Boolean...
426
426
  arguments[arguments.length - 1] : //...then it's the static flag...
427
427
  false; //...otherwise default to a dynamic class
428
-
428
+
429
429
  //static: Object, dynamic: Function
430
430
  var c = s ? {} : function() {
431
431
  this.init.apply(this, arguments);
432
432
  };
433
-
433
+
434
434
  //all of our classes have these in common
435
435
  var methods = {
436
436
  //a basic namespace container to pass objects through
437
437
  ns: [],
438
-
438
+
439
439
  //a container to hold one level of overwritten methods
440
440
  supers: {},
441
-
441
+
442
442
  //a constructor
443
443
  init: function() {},
444
-
444
+
445
445
  //our namespace function
446
446
  namespace:function(ns) {
447
447
  //don't add nothing
448
448
  if (!ns) return null;
449
-
449
+
450
450
  //closures are neat
451
451
  var _this = this;
452
-
452
+
453
453
  //handle ['ns1', 'ns2'... 'nsN'] format
454
454
  if(ns.constructor == Array) {
455
455
  //call namespace normally for each array item...
456
456
  $.each(ns, function() {
457
457
  _this.namespace.apply(_this, [this]);
458
458
  });
459
-
459
+
460
460
  //...then get out of this call to namespace
461
461
  return;
462
-
462
+
463
463
  //handle {'ns': contents} format
464
464
  } else if(ns.constructor == Object) {
465
465
  //loop through the object passed to namespace
@@ -468,26 +468,26 @@ Class = {
468
468
  if([Object, Function].indexOf(ns[key].constructor) > -1) {
469
469
  //in case this.ns has been deleted
470
470
  if(!this.ns) this.ns = [];
471
-
471
+
472
472
  //copy the namespace into an array holder
473
473
  this.ns[key] = ns[key];
474
-
474
+
475
475
  //apply namespace, this will be caught by the ['ns1', 'ns2'... 'nsN'] format above
476
476
  this.namespace.apply(this, [key]);
477
477
  }
478
478
  }
479
-
479
+
480
480
  //we're done with namespace for now
481
481
  return;
482
482
  }
483
-
483
+
484
484
  //note: [{'ns': contents}, {'ns2': contents2}... {'nsN': contentsN}] is inherently handled by the above two cases
485
-
485
+
486
486
  var levels = ns.split(".");
487
-
487
+
488
488
  //if init && constructor == Object or Function
489
489
  var nsobj = this.prototype ? this.prototype : this;
490
-
490
+
491
491
  $.each(levels, function() {
492
492
  /* When adding a namespace check to see, in order:
493
493
  * 1) does the ns exist in our ns passthrough object?
@@ -499,38 +499,38 @@ Class = {
499
499
  * 4) if none of the above, make a new static class
500
500
  */
501
501
  nsobj[this] = _this.ns[this] || nsobj[this] || window[this] || Class.create(true);
502
-
502
+
503
503
  //remove our temp passthrough if it exists
504
504
  delete _this.ns[this];
505
-
505
+
506
506
  //move one level deeper for the next iteration
507
507
  nsobj = nsobj[this];
508
508
  });
509
-
509
+
510
510
  //TODO: do we really need to return this? it's not that useful anymore
511
511
  return nsobj;
512
512
  },
513
-
513
+
514
514
  /* create exists inside classes too. neat huh?
515
515
  usage differs slightly: MyClass.create('MySubClass', { myMethod: function() }); */
516
516
  create: function() {
517
517
  //turn arguments into a regular Array
518
518
  var args = Array.prototype.slice.call(arguments);
519
-
519
+
520
520
  //pull the name of the new class out
521
521
  var name = args.shift();
522
-
522
+
523
523
  //create a new class with the rest of the arguments
524
524
  var temp = Class.create.apply(Class, args);
525
-
525
+
526
526
  //load our new class into the {name: class} format to pass it into namespace()
527
527
  var ns = {};
528
528
  ns[name] = temp;
529
-
529
+
530
530
  //put the new class into the current one
531
531
  this.namespace(ns);
532
532
  },
533
-
533
+
534
534
  //call the super of a method
535
535
  sup: function() {
536
536
  try {
@@ -541,20 +541,20 @@ Class = {
541
541
  }
542
542
  }
543
543
  };
544
-
544
+
545
545
  //static: doesn't need a constructor
546
546
  s ? delete methods.init : null;
547
-
547
+
548
548
  //put default stuff in the thing before the other stuff
549
549
  $.extend(c, methods);
550
-
550
+
551
551
  //double copy methods for dynamic classes
552
552
  //they get our common utils in their class definition AND their prototype
553
553
  if(!s) $.extend(c.prototype, methods);
554
-
554
+
555
555
  //static: extend the Object, dynamic: extend the prototype
556
556
  var extendee = s ? c : c.prototype;
557
-
557
+
558
558
  //loop through arguments. if they're the right type, tack them on
559
559
  $.each(arguments, function() {
560
560
  //either we're passing in an object full of methods, or the prototype of an existing class
@@ -568,17 +568,17 @@ Class = {
568
568
  if(extendee[i] && extendee[i].constructor == Function && ['namespace','create','sup'].indexOf(i) == -1) {
569
569
  //since Function.name is almost never set for us, do it manually
570
570
  this[i].name = extendee[i].name = i;
571
-
571
+
572
572
  //throw the existing function into this.supers before it's overwritten
573
573
  extendee.supers[i] = extendee[i];
574
574
  }
575
-
575
+
576
576
  //extend the current property into our class
577
577
  extendee[i] = this[i];
578
578
  }
579
579
  }
580
580
  });
581
-
581
+
582
582
  //shiny new class, ready to go
583
583
  return c;
584
584
  }
@@ -593,7 +593,7 @@ var scriptElement = (function deriveScriptElement() {
593
593
 
594
594
  var dummyScript = document.getElementById(id);
595
595
  var element = dummyScript.previousSibling;
596
-
596
+
597
597
  while (element && element.tagName.toLowerCase() != "script") {
598
598
  element = element.previousSibling;
599
599
  }
@@ -621,9 +621,9 @@ var scriptHost = (function deriveScriptHost() {
621
621
 
622
622
  SeatHolder = (function() {
623
623
  var hintClass = "sh_hint", hideClass = "sh_hide";
624
-
624
+
625
625
  var injectCode = function() {
626
- var style = "<style>" +
626
+ var style = "<style>" +
627
627
  "." + hintClass + " { color: " + SeatHolder.hintColor +" !important } " +
628
628
  "." + hideClass + " { display: none !important }" +
629
629
  "</style>";
@@ -632,7 +632,7 @@ SeatHolder = (function() {
632
632
  };
633
633
  var bind = function() {
634
634
  var hintedElements = [];
635
-
635
+
636
636
  jQuery.each(jQuery(SeatHolder.selector), function(i, element) {
637
637
  element = jQuery(element);
638
638
  var seatholder = element.attr("seatholder");
@@ -646,11 +646,11 @@ SeatHolder = (function() {
646
646
  } else {
647
647
  hintedElements.push(element);
648
648
  }
649
-
649
+
650
650
  element.focus(onFocus)
651
651
  .blur(onBlur);
652
652
  });
653
-
653
+
654
654
  jQuery.each(hintedElements, function(i, element) {
655
655
  element = jQuery(element);
656
656
  var hintElement = element.data("hint_element");
@@ -662,29 +662,29 @@ SeatHolder = (function() {
662
662
  .attr("readonly", true)
663
663
  .data("hinted_element", element)
664
664
  .focus(onHintFocus);
665
-
665
+
666
666
  jQuery.each(["class", "size", "cols", "rows"], function(index, attribute) {
667
667
  switch(attribute) {
668
668
  case "class":
669
669
  hintElement.attr(attribute, element.attr(attribute).replace(hideClass, "")); break;
670
670
  default:
671
671
  hintElement.attr(attribute, element.attr(attribute));
672
- }
672
+ }
673
673
  });
674
-
674
+
675
675
  hintElement.addClass(hintClass);
676
676
  element.data("hint_element", hintElement)
677
677
  .before(hintElement);
678
678
  }
679
-
679
+
680
680
  hintElement.val(element.attr("seatholder"));
681
681
  onBlur(null, element);
682
682
  });
683
683
  };
684
-
684
+
685
685
  var onHintFocus = function(event) {
686
686
  var hintElement = jQuery(event.target).addClass(hideClass);
687
-
687
+
688
688
  hintElement.data("hinted_element")
689
689
  .removeClass(hideClass)
690
690
  .focus();
@@ -692,13 +692,13 @@ SeatHolder = (function() {
692
692
  var onFocus = function(event) {
693
693
  var element = jQuery(event.target);
694
694
  var seatholder = element.attr("seatholder");
695
-
695
+
696
696
  if (element.val() == seatholder.replace(/^&/, "")) {
697
697
  element.val("");
698
698
  }
699
-
699
+
700
700
  var input = element.get(0);
701
-
701
+
702
702
  if (input.createTextRange) {
703
703
  var oRange = input.createTextRange();
704
704
  oRange.moveStart("character", 0);
@@ -712,20 +712,20 @@ SeatHolder = (function() {
712
712
  if (element == null) {
713
713
  element = jQuery(event.target);
714
714
  }
715
-
715
+
716
716
  var seatholder = element.attr("seatholder");
717
717
  var hintElement = element.data("hint_element");
718
718
  if (typeof(hintElement) == "undefined") {
719
719
  hintElement = null;
720
720
  }
721
-
721
+
722
722
  if ((element.val().length > 0 && element.val() != seatholder.replace(/^&/, ""))) {
723
723
  if (hintElement) {
724
724
  hintElement.addClass(hideClass);
725
725
  }
726
726
  return;
727
727
  }
728
-
728
+
729
729
  if (seatholder.match(/^&/)) {
730
730
  element.val(seatholder.replace(/^&/, ""));
731
731
  } else {
@@ -734,7 +734,7 @@ SeatHolder = (function() {
734
734
  hintElement.removeClass(hideClass);
735
735
  }
736
736
  };
737
-
737
+
738
738
  return {
739
739
  version: "0.8",
740
740
  selector: "[seatholder]",
@@ -753,16 +753,16 @@ SeatHolder = (function() {
753
753
 
754
754
  (function () {
755
755
  var missing_libs = [];
756
-
756
+
757
757
  if (typeof(jQuery) == "undefined") {
758
758
  missing_libs.push("core");
759
759
  }
760
-
760
+
761
761
  if (missing_libs.length == 0) {
762
762
  SeatHolder.init();
763
763
  } else {
764
764
  var src = scriptElement.getAttribute("src").replace(/(development\/)?seat_holder(\-min)?\.js.*$/, "jquery/" + missing_libs.sort().join(".") + ".js");
765
- document.write('<script src="' + src + '" type="text/javascript" ' +
765
+ document.write('<script src="' + src + '" type="text/javascript" ' +
766
766
  'onload="SeatHolder.init()" onreadystatechange="SeatHolder.init()">' +
767
767
  '</script>');
768
768
  }
@@ -776,7 +776,7 @@ CodeHeroes = (function() {
776
776
  initSubModules(module);
777
777
  });
778
778
  };
779
-
779
+
780
780
  var initSubModules = function(mod) {
781
781
  if (mod.init) {
782
782
  mod.init();
@@ -785,7 +785,7 @@ CodeHeroes = (function() {
785
785
  initSubModules(m);
786
786
  });
787
787
  };
788
-
788
+
789
789
  return {
790
790
  init: function() {
791
791
  initModules();
@@ -802,7 +802,7 @@ CodeHeroes.Ajaxify = (function() {
802
802
  event.preventDefault();
803
803
  });
804
804
  };
805
-
805
+
806
806
  return {
807
807
  init: function() {
808
808
  bind();