jekyll-google-photos 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bb7ae1fdffcb3907a967bf77c6aec0862803172c
4
+ data.tar.gz: 522b31b1cf8985086d371b49d4a15cbb09f65c8a
5
+ SHA512:
6
+ metadata.gz: c5d7d0de9d3bf09ce125b20a0e42af016c230f0983b213138401ccf824f8e624404b66e2aaf3cd8ec513a79d79d79aedc86b92520cd466af68f6f4fa624eda2b
7
+ data.tar.gz: 88694193593b3c7a94b678eb61d1a09191b86304bef8008006d78e2843346fb958cdd6c8a45333bfd18dbb25c697691873696665986ddb951790b2cdd2f64762
data/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ trim_trailing_whitespace = true
7
+ insert_final_newline = true
8
+
9
+ [*.{md,rb,gemspec},Makefile]
10
+ charset = utf-8
11
+
12
+ [Makefile]
13
+ indent_style = tab
14
+
15
+ [*.md]
16
+ trim_trailing_whitespace = false
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ _site
2
+ .sass-cache
3
+ .jekyll-metadata
4
+ *.gem
5
+ .DS_Store
6
+
data/404.html ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <style type="text/css" media="screen">
6
+ .container {
7
+ margin: 10px auto;
8
+ max-width: 600px;
9
+ text-align: center;
10
+ }
11
+ h1 {
12
+ margin: 30px 0;
13
+ font-size: 4em;
14
+ line-height: 1;
15
+ letter-spacing: -1px;
16
+ }
17
+ </style>
18
+
19
+ <div class="container">
20
+ <h1>404</h1>
21
+
22
+ <p><strong>Page not found :(</strong></p>
23
+ <p>The requested page could not be found.</p>
24
+ </div>
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "jekyll", "~> 3.7.2"
4
+ gem "minima", "~> 2.0"
5
+
6
+ group :jekyll_plugins do
7
+ gem "jekyll-feed", "~> 0.6"
8
+ end
9
+
10
+ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
11
+ gem "wdm", "~> 0.1.0" if Gem.win_platform?
12
+
13
+ gem "nokogiri", "~> 1.10"
14
+
15
+ gem "image_size", "~> 2.0"
16
+
17
+ gem "fastimage", "~> 2.1"
data/Gemfile.lock ADDED
@@ -0,0 +1,82 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.6.0)
5
+ public_suffix (>= 2.0.2, < 4.0)
6
+ colorator (1.1.0)
7
+ concurrent-ruby (1.1.5)
8
+ em-websocket (0.5.1)
9
+ eventmachine (>= 0.12.9)
10
+ http_parser.rb (~> 0.6.0)
11
+ eventmachine (1.2.7)
12
+ fastimage (2.1.5)
13
+ ffi (1.11.1)
14
+ forwardable-extended (2.6.0)
15
+ http_parser.rb (0.6.0)
16
+ i18n (0.9.5)
17
+ concurrent-ruby (~> 1.0)
18
+ image_size (2.0.1)
19
+ jekyll (3.7.4)
20
+ addressable (~> 2.4)
21
+ colorator (~> 1.0)
22
+ em-websocket (~> 0.5)
23
+ i18n (~> 0.7)
24
+ jekyll-sass-converter (~> 1.0)
25
+ jekyll-watch (~> 2.0)
26
+ kramdown (~> 1.14)
27
+ liquid (~> 4.0)
28
+ mercenary (~> 0.3.3)
29
+ pathutil (~> 0.9)
30
+ rouge (>= 1.7, < 4)
31
+ safe_yaml (~> 1.0)
32
+ jekyll-feed (0.12.1)
33
+ jekyll (>= 3.7, < 5.0)
34
+ jekyll-sass-converter (1.5.2)
35
+ sass (~> 3.4)
36
+ jekyll-seo-tag (2.6.1)
37
+ jekyll (>= 3.3, < 5.0)
38
+ jekyll-watch (2.2.1)
39
+ listen (~> 3.0)
40
+ kramdown (1.17.0)
41
+ liquid (4.0.3)
42
+ listen (3.1.5)
43
+ rb-fsevent (~> 0.9, >= 0.9.4)
44
+ rb-inotify (~> 0.9, >= 0.9.7)
45
+ ruby_dep (~> 1.2)
46
+ mercenary (0.3.6)
47
+ mini_portile2 (2.4.0)
48
+ minima (2.5.0)
49
+ jekyll (~> 3.5)
50
+ jekyll-feed (~> 0.9)
51
+ jekyll-seo-tag (~> 2.1)
52
+ nokogiri (1.10.3)
53
+ mini_portile2 (~> 2.4.0)
54
+ pathutil (0.16.2)
55
+ forwardable-extended (~> 2.6)
56
+ public_suffix (3.1.0)
57
+ rb-fsevent (0.10.3)
58
+ rb-inotify (0.10.0)
59
+ ffi (~> 1.0)
60
+ rouge (3.3.0)
61
+ ruby_dep (1.5.0)
62
+ safe_yaml (1.0.5)
63
+ sass (3.7.4)
64
+ sass-listen (~> 4.0.0)
65
+ sass-listen (4.0.0)
66
+ rb-fsevent (~> 0.9, >= 0.9.4)
67
+ rb-inotify (~> 0.9, >= 0.9.7)
68
+
69
+ PLATFORMS
70
+ ruby
71
+
72
+ DEPENDENCIES
73
+ fastimage (~> 2.1)
74
+ image_size (~> 2.0)
75
+ jekyll (~> 3.7.2)
76
+ jekyll-feed (~> 0.6)
77
+ minima (~> 2.0)
78
+ nokogiri (~> 1.10)
79
+ tzinfo-data
80
+
81
+ BUNDLED WITH
82
+ 1.17.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 heychirag <i@chira.ga> (https://chira.ga
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,36 @@
1
+ CWD := $(shell pwd)
2
+
3
+ .PHONY: all
4
+ all: build
5
+
6
+ .PHONY: start
7
+ start:
8
+ @bundle exec jekyll serve --verbose
9
+
10
+ .PHONY: build
11
+ build: clean
12
+ @gem build *.gemspec
13
+ @echo ::: BUILD :::
14
+
15
+ .PHONY: install
16
+ install: deps
17
+ -@rm -f Gemfile.lock &>/dev/null || true
18
+ @bundle install
19
+ @echo ::: INSTALL :::
20
+
21
+ .PHONY: push
22
+ push: build
23
+ @gem push *.gem
24
+ @echo ::: PUSH :::
25
+
26
+ .PHONY: clean
27
+ clean:
28
+ -@rm -rf *.gem &>/dev/null || true
29
+ @echo ::: CLEAN :::
30
+
31
+ .PHONY: deps
32
+ deps: bundle
33
+ @echo ::: DEPS :::
34
+ .PHONY: bundle
35
+ bundle:
36
+ @if ! o=$$(which bundle); then gem install bundle jekyll; fi
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # jekyll-google-photos
2
+
3
+ > 💎 Embedd Google Photos Album to your Jekyll Site
data/_config.yml ADDED
@@ -0,0 +1,14 @@
1
+ title: Your awesome title
2
+ email: your-email@example.com
3
+ description: >-
4
+ Write an awesome description for your new site here. You can edit this
5
+ line in _config.yml. It will appear in your document head meta (for
6
+ Google search results) and in your feed.xml site description.
7
+ baseurl: ""
8
+ url: ""
9
+ twitter_username: jekyllrb
10
+ github_username: jekyll
11
+ markdown: kramdown
12
+ theme: minima
13
+ plugins:
14
+ - jekyll-feed
@@ -0,0 +1 @@
1
+ require_relative "../lib/jekyll-google-photos"
@@ -0,0 +1,28 @@
1
+ ---
2
+ layout: post
3
+ title: "Welcome to Jekyll!"
4
+ date: 2018-02-22 18:29:32 +0000
5
+ categories: jekyll update
6
+ ---
7
+
8
+ {% google_photos https://photos.app.goo.gl/zSvo8gbDizZE4EKu5 %}
9
+
10
+ You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
11
+
12
+ To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
13
+
14
+ Jekyll also offers powerful support for code snippets:
15
+
16
+ {% highlight ruby %}
17
+ def print_hi(name)
18
+ puts "Hi, #{name}"
19
+ end
20
+ print_hi('Tom')
21
+ #=> prints 'Hi, Tom' to STDOUT.
22
+ {% endhighlight %}
23
+
24
+ Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
25
+
26
+ [jekyll-docs]: https://jekyllrb.com/docs/home
27
+ [jekyll-gh]: https://github.com/jekyll/jekyll
28
+ [jekyll-talk]: https://talk.jekyllrb.com/
data/about.md ADDED
@@ -0,0 +1,18 @@
1
+ ---
2
+ layout: page
3
+ title: About
4
+ permalink: /about/
5
+ ---
6
+
7
+ This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)
8
+
9
+ You can find the source code for Minima at GitHub:
10
+ [jekyll][jekyll-organization] /
11
+ [minima](https://github.com/jekyll/minima)
12
+
13
+ You can find the source code for Jekyll at GitHub:
14
+ [jekyll][jekyll-organization] /
15
+ [jekyll](https://github.com/jekyll/jekyll)
16
+
17
+
18
+ [jekyll-organization]: https://github.com/jekyll
data/index.md ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ # You don't need to edit this file, it's empty on purpose.
3
+ # Edit theme's home layout instead if you wanna make some changes
4
+ # See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
5
+ layout: home
6
+ ---
@@ -0,0 +1,21 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "jekyll-google-photos/version"
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "jekyll-google-photos"
6
+ spec.summary = "Embedd Google Photos Album to your Jekyll Site"
7
+ spec.description = "Embedd Google Photos Album to your Jekyll Site"
8
+ spec.version = JekyllGooglePhotos::VERSION
9
+ spec.authors = ["heychirag"]
10
+ spec.email = ["i@chira.ga"]
11
+ spec.homepage = "https://github.com/heychirag/jekyll-google-photos"
12
+ spec.licenses = ["MIT"]
13
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
14
+ spec.require_paths = ["lib"]
15
+ spec.add_dependency "jekyll", "~> 3.0"
16
+ spec.add_development_dependency "rake", "~> 11.0"
17
+ spec.add_development_dependency "rspec", "~> 3.5"
18
+ spec.add_development_dependency "rubocop", "~> 0.52"
19
+ spec.add_development_dependency "nokogiri", "~> 1.10"
20
+ spec.add_development_dependency "fastimage", "~> 2.1"
21
+ end
@@ -0,0 +1,88 @@
1
+ require "jekyll"
2
+ require 'open-uri'
3
+ require 'nokogiri'
4
+ require 'fastimage'
5
+
6
+ # https://jekyllrb.com/docs/plugins/#tags
7
+
8
+ module JekyllGooglePhotos
9
+ class Tag < Liquid::Tag
10
+ def initialize(tagName, url, tokens)
11
+ super
12
+ @url = url
13
+
14
+ @doc = Nokogiri::HTML(open(@url.strip).read)
15
+
16
+ @scripts = @doc.xpath("//script")
17
+
18
+ for $x in @scripts do
19
+ if $x.inner_html.match(/initDataCallback\(/)
20
+ @jsonString = $x.inner_html
21
+ @jsonString = @jsonString.sub(/.*function\(\)\{return /,"")
22
+ @jsonString["\n}});"] = ""
23
+ end
24
+ end
25
+
26
+ @json = JSON.parse(@jsonString)
27
+ @imgChildren = @json[1]
28
+ $i = 0
29
+ @margin = 7;
30
+ @imgDOMS = %Q{<div class="google-photos-album" style="position:relative;margin-left:-#{@margin}px;margin-top:-#{@margin}px;">}
31
+ for $x in @imgChildren do
32
+ @dims = FastImage.size($x[1][0]);
33
+ @imgDOMS += (%Q{<img src="#{$x[1][0]}" width="#{@dims[0]}" height="#{@dims[1]}" style="margin-left:#{@margin}px;margin-top:#{@margin}px;" />})
34
+ puts $i
35
+ $i += 1
36
+ end
37
+ @imgDOMS += %Q{</div>}
38
+
39
+ @imgDOMS += %Q{<script>#{insertScript()}</script>}
40
+ end
41
+
42
+ def insertScript
43
+ result = 'var album = document.getElementsByClassName("google-photos-album")[0];'
44
+ result += 'var albumImages = album.getElementsByTagName("img");'
45
+ result += 'var minPicHeight = 200; var albumMargin ='+@margin.to_s+'; var noPics = 4;'
46
+ result += 'var containerWidth = album.parentElement.clientWidth;'
47
+ result += 'var xcoor = 0; var ycoor = 0;'
48
+ result += '/*var setHeight = 0;*/'
49
+ result += 'for(var i=0;i<albumImages.length;i+=noPics) {'
50
+ result += 'var currMinHeight = 999999999;'
51
+ result += 'for(var j=i;j<i+noPics&&j<albumImages.length;j++) {'
52
+ result += 'if(albumImages[j].height<currMinHeight)'
53
+ result += 'currMinHeight = albumImages[j].height;'
54
+ result += '}'
55
+ result += 'for(var j=i;j<i+noPics&&j<albumImages.length;j++) {'
56
+ result += 'albumImages[j].width *= currMinHeight/albumImages[j].height;'
57
+ result += 'albumImages[j].height = currMinHeight;'
58
+ result += '}'
59
+ result += 'var currWidth = (noPics)*albumMargin;'
60
+ result += 'for(var j=i;j<i+noPics&&j<albumImages.length;j++) {'
61
+ result += 'currWidth += albumImages[j].width;'
62
+ result += '}'
63
+ result += 'var k; var limitWidth = 0;'
64
+ result += 'for(var k=i;k<i+noPics-1&&k<albumImages.length;k++) {'
65
+ result += 'albumImages[k].width *= containerWidth/currWidth;'
66
+ result += 'limitWidth = limitWidth + albumImages[k].width + albumMargin;'
67
+ result += 'albumImages[k].height *= containerWidth/currWidth;'
68
+ result += '}'
69
+ result += 'albumImages[k].width = containerWidth-limitWidth;'
70
+ result += 'albumImages[k].height *= containerWidth/currWidth;'
71
+ result += '/*var setWidth = 0;'
72
+ result += 'for(var j=i;j<i+noPics&&j<albumImages.length;j++) {'
73
+ result += 'albumImages[j].style.transform = "translate3d($setWidth,$setHeight,0px)";'
74
+ result += 'setWidth += albumImages[j].width;'
75
+ result += 'setWidth += albumMargin;'
76
+ result += '}'
77
+ result += 'setHeight += albumImages[i].height;'
78
+ result += 'setHeight += albumMargin;*/'
79
+ result += '}'
80
+ end
81
+
82
+ def render(context)
83
+ "#{@imgDOMS}"
84
+ end
85
+ end
86
+ end
87
+
88
+ Liquid::Template.register_tag('google_photos', JekyllGooglePhotos::Tag)
@@ -0,0 +1,3 @@
1
+ module JekyllGooglePhotos
2
+ VERSION = "0.0.2".freeze
3
+ end
@@ -0,0 +1,5 @@
1
+ require_relative "jekyll-google-photos/version"
2
+ require_relative "jekyll-google-photos/tag"
3
+
4
+ module JekyllGooglePhotos
5
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-google-photos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - heychirag
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '11.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '11.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.52'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.52'
69
+ - !ruby/object:Gem::Dependency
70
+ name: nokogiri
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: fastimage
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.1'
97
+ description: Embedd Google Photos Album to your Jekyll Site
98
+ email:
99
+ - i@chira.ga
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".editorconfig"
105
+ - ".gitignore"
106
+ - 404.html
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE
110
+ - Makefile
111
+ - README.md
112
+ - _config.yml
113
+ - _plugins/jekyll-google-photos.rb
114
+ - _posts/2018-02-22-welcome-to-jekyll.markdown
115
+ - about.md
116
+ - index.md
117
+ - jekyll-google-photos.gemspec
118
+ - lib/jekyll-google-photos.rb
119
+ - lib/jekyll-google-photos/tag.rb
120
+ - lib/jekyll-google-photos/version.rb
121
+ homepage: https://github.com/heychirag/jekyll-google-photos
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.5.2.3
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Embedd Google Photos Album to your Jekyll Site
145
+ test_files: []