camaleon_lazy_loader 0.1.0 → 0.1.2
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 +15 -0
- data/app/helpers/plugins/camaleon_lazy_loader/main_helper.rb +1 -1
- data/lib/camaleon_lazy_loader/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3ebe3fe992635e9876617be4a1939a968e1ae67a1b19500d1c0a48674c950277
         | 
| 4 | 
            +
              data.tar.gz: 3fe8bff63ae868bbd6a85851ae52d3e76b359e9a3310b190ec332dc994548b9a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 537d07364819de492a1b66d6b9f016cdc619c7207f3f86b28673366119bfe5fc8b270760fb1531458ba1293310118a7541a1c844b41618f178b9070274edbef5
         | 
| 7 | 
            +
              data.tar.gz: 2e0d5b5d7e28ebcc2d55e931386a27cf2954b0bd803243166631197c6779608e7acfd0f8e0c652e5e4047e981bbe42e66e399da6370c37bb075be080b713d03c
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,8 +1,23 @@ | |
| 1 | 
            +
            
         | 
| 2 | 
            +
            
         | 
| 3 | 
            +
            [](https://github.com/testdouble/standard)
         | 
| 4 | 
            +
            [](https://travis-ci.org/brian-kephart/camaleon_lazy_loader)
         | 
| 5 | 
            +
             | 
| 1 6 | 
             
            # CamaleonLazyLoader
         | 
| 2 7 | 
             
            This plugin adds a `loading="lazy"` attribute to `<img>` and `<iframe>` tags rendered by [Camaleon CMS](https://github.com/owen2345/camaleon-cms).
         | 
| 3 8 | 
             
            - This attribute will be added to tags on all server-rendered pages.
         | 
| 4 9 | 
             
            - Existing loading attributes will not be overwritten, so you can still set individual tags to `loading="eager"` or `loading="auto"`
         | 
| 5 10 |  | 
| 11 | 
            +
            ## How it works
         | 
| 12 | 
            +
            This plugin updates the body of the http response using the `front_after_load` hook provided by Camaleon, unless the page is cached with the Front Cache plugin.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            ### If the Front Cache plugin is active
         | 
| 15 | 
            +
            - For pages that are not cached, this plugin works as described above.
         | 
| 16 | 
            +
            - For pages that are cached:
         | 
| 17 | 
            +
                - The affects of this plugin are applied to the cache entry when it is saved using the `front_cache_writing_cache` hook.
         | 
| 18 | 
            +
                - There is no processing when reading from the cache.
         | 
| 19 | 
            +
            - Activating/deactivating this plugin will clear the Front Cache.
         | 
| 20 | 
            +
             | 
| 6 21 | 
             
            ## Usage
         | 
| 7 22 | 
             
            Just turn on the plugin in your admin settings.
         | 
| 8 23 |  | 
| @@ -7,7 +7,7 @@ module Plugins::CamaleonLazyLoader::MainHelper | |
| 7 7 | 
             
              end
         | 
| 8 8 |  | 
| 9 9 | 
             
              def apply_lazy_loading(html)
         | 
| 10 | 
            -
                doc = Nokogiri::HTML | 
| 10 | 
            +
                doc = Nokogiri::HTML.parse html
         | 
| 11 11 | 
             
                nodes = doc.css "img, iframe"
         | 
| 12 12 | 
             
                nodes.each { |node| node["loading"] ||= "lazy" }
         | 
| 13 13 | 
             
                doc.to_html
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: camaleon_lazy_loader
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Brian Kephart
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-07- | 
| 11 | 
            +
            date: 2020-07-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: camaleon_cms
         | 
| @@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 102 102 | 
             
                - !ruby/object:Gem::Version
         | 
| 103 103 | 
             
                  version: '0'
         | 
| 104 104 | 
             
            requirements: []
         | 
| 105 | 
            -
            rubygems_version: 3.1. | 
| 105 | 
            +
            rubygems_version: 3.1.4
         | 
| 106 106 | 
             
            signing_key: 
         | 
| 107 107 | 
             
            specification_version: 4
         | 
| 108 108 | 
             
            summary: Adds browser-native loading="lazy" attribute to images and iframes rendered
         |