jquery-unveil-rails 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
 - data/README.md +4 -17
 - data/jquery-unveil-rails-0.1.0.gem +0 -0
 - data/lib/jquery/unveil/rails.rb +2 -7
 - data/lib/jquery/unveil/rails/version.rb +1 -1
 - data/vendor/assets/javascripts/jquery.unveil.js +56 -0
 - metadata +3 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 83d4ba88c17841ef747346a7046ed11d9db46021
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fd2bc97c1ba9b53d249ad8c3069967b840464ff6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 74d35fca577a5fb51a7d78ef0e9fca22eb3d250c6c5130f4d82b1ef32fe7dd160029dcf96ec47d35249da81f72cbd79906d38379a552c47bc81952f6b22c5c43
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d12e5ea4133da9bbea27ea539428e556fb0e58f598b25cf84ace0e8972cb3edc63fe70688f2761af2dc669aa9ae7ffd44e72af10990ac61477ec7b6a5d7b7fb7
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -22,20 +22,7 @@ Or install it yourself as: 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            ## Usage
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
            ## Contributing
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jquery-unveil-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            ## License
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
            Add to your application.js
         
     | 
| 
      
 26 
     | 
    
         
            +
            ```
         
     | 
| 
      
 27 
     | 
    
         
            +
            //= require jquery.unveil
         
     | 
| 
      
 28 
     | 
    
         
            +
            ```
         
     | 
| 
         Binary file 
     | 
    
        data/lib/jquery/unveil/rails.rb
    CHANGED
    
    | 
         @@ -1,13 +1,8 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require "jquery/unveil/rails/version"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            module Jquery
         
     | 
| 
       4 
2 
     | 
    
         
             
              module Unveil
         
     | 
| 
       5 
3 
     | 
    
         
             
                module Rails
         
     | 
| 
       6 
     | 
    
         
            -
                   
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                      app.config.assets.precompile += ['jquery.unveil.js']
         
     | 
| 
       9 
     | 
    
         
            -
                    end
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
      
 4 
     | 
    
         
            +
                  require "jquery/unveil/rails/version"
         
     | 
| 
      
 5 
     | 
    
         
            +
                  require "jquery/unveil/rails/engine"
         
     | 
| 
       11 
6 
     | 
    
         
             
                end
         
     | 
| 
       12 
7 
     | 
    
         
             
              end
         
     | 
| 
       13 
8 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /**
         
     | 
| 
      
 2 
     | 
    
         
            +
             * jQuery Unveil
         
     | 
| 
      
 3 
     | 
    
         
            +
             * A very lightweight jQuery plugin to lazy load images
         
     | 
| 
      
 4 
     | 
    
         
            +
             * http://luis-almeida.github.com/unveil
         
     | 
| 
      
 5 
     | 
    
         
            +
             *
         
     | 
| 
      
 6 
     | 
    
         
            +
             * Licensed under the MIT license.
         
     | 
| 
      
 7 
     | 
    
         
            +
             * Copyright 2013 Luís Almeida
         
     | 
| 
      
 8 
     | 
    
         
            +
             * https://github.com/luis-almeida
         
     | 
| 
      
 9 
     | 
    
         
            +
             */
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ;(function($) {
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              $.fn.unveil = function(threshold, callback) {
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                var $w = $(window),
         
     | 
| 
      
 16 
     | 
    
         
            +
                    th = threshold || 0,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    retina = window.devicePixelRatio > 1,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    attrib = retina? "data-src-retina" : "data-src",
         
     | 
| 
      
 19 
     | 
    
         
            +
                    images = this,
         
     | 
| 
      
 20 
     | 
    
         
            +
                    loaded;
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                this.one("unveil", function() {
         
     | 
| 
      
 23 
     | 
    
         
            +
                  var source = this.getAttribute(attrib);
         
     | 
| 
      
 24 
     | 
    
         
            +
                  source = source || this.getAttribute("data-src");
         
     | 
| 
      
 25 
     | 
    
         
            +
                  if (source) {
         
     | 
| 
      
 26 
     | 
    
         
            +
                    this.setAttribute("src", source);
         
     | 
| 
      
 27 
     | 
    
         
            +
                    if (typeof callback === "function") callback.call(this);
         
     | 
| 
      
 28 
     | 
    
         
            +
                  }
         
     | 
| 
      
 29 
     | 
    
         
            +
                });
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                function unveil() {
         
     | 
| 
      
 32 
     | 
    
         
            +
                  var inview = images.filter(function() {
         
     | 
| 
      
 33 
     | 
    
         
            +
                    var $e = $(this);
         
     | 
| 
      
 34 
     | 
    
         
            +
                    if ($e.is(":hidden")) return;
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    var wt = $w.scrollTop(),
         
     | 
| 
      
 37 
     | 
    
         
            +
                        wb = wt + $w.height(),
         
     | 
| 
      
 38 
     | 
    
         
            +
                        et = $e.offset().top,
         
     | 
| 
      
 39 
     | 
    
         
            +
                        eb = et + $e.height();
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                    return eb >= wt - th && et <= wb + th;
         
     | 
| 
      
 42 
     | 
    
         
            +
                  });
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  loaded = inview.trigger("unveil");
         
     | 
| 
      
 45 
     | 
    
         
            +
                  images = images.not(loaded);
         
     | 
| 
      
 46 
     | 
    
         
            +
                }
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                $w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                unveil();
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                return this;
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              };
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            })(window.jQuery || window.Zepto);
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: jquery-unveil-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kirill
         
     | 
| 
         @@ -69,9 +69,11 @@ files: 
     | 
|
| 
       69 
69 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       70 
70 
     | 
    
         
             
            - bin/console
         
     | 
| 
       71 
71 
     | 
    
         
             
            - bin/setup
         
     | 
| 
      
 72 
     | 
    
         
            +
            - jquery-unveil-rails-0.1.0.gem
         
     | 
| 
       72 
73 
     | 
    
         
             
            - jquery-unveil-rails.gemspec
         
     | 
| 
       73 
74 
     | 
    
         
             
            - lib/jquery/unveil/rails.rb
         
     | 
| 
       74 
75 
     | 
    
         
             
            - lib/jquery/unveil/rails/version.rb
         
     | 
| 
      
 76 
     | 
    
         
            +
            - vendor/assets/javascripts/jquery.unveil.js
         
     | 
| 
       75 
77 
     | 
    
         
             
            homepage: https://github.com/cderche/jquery-unveil-rails
         
     | 
| 
       76 
78 
     | 
    
         
             
            licenses:
         
     | 
| 
       77 
79 
     | 
    
         
             
            - MIT
         
     |