Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function T(params) {
  2.   var Library = function(params) {
  3.     this.version = "0.1";
  4.  
  5.     var selector = document.querySelectorAll(params);
  6.     var i;
  7.     this.length = selector.length;
  8.  
  9.     for (i = 0; i < this.length; i++) {
  10.       this[i] = selector[i];
  11.     }
  12.  
  13.     return this;
  14.   }
  15.  
  16.   Library.prototype = {
  17.     hide: function() {
  18.       var len = this.length;
  19.       while (len--) {
  20.         this[len].style.display = 'none';
  21.       }
  22.  
  23.       return this;
  24.     },
  25.  
  26.     show: function() {
  27.       var len = this.length;
  28.       while (len--) {
  29.         this[len].style.display = 'block';
  30.       }
  31.       return this;
  32.     }
  33.   }  
  34.  
  35.   return new Library(params);
  36.  
  37. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement