jekyll-google-photos 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4adcab6389d74279f43e50c63312cce573f7d6d2
4
- data.tar.gz: aa245f98c010fcf3d786006fcf2bdb010513f79c
3
+ metadata.gz: 3fe68c97c44ab51081e25a9601f378cfeccbf261
4
+ data.tar.gz: b0f516a1e5cec8261eb3f28d022816fb2b129179
5
5
  SHA512:
6
- metadata.gz: 8ebedcde5633762d541ef07015a89cabd5b05f345aa5fc58b5c2586494e611fe72ea8829cbceda1724ac5a2fcd952d0a1f099f1ae77dc600a4622966e8348c9c
7
- data.tar.gz: d34415433391bdb72760ad448bf5f015bcdd3256b6d78de00993f0b1ad81c86560475efdd2ddf38a5a9d6c35572e037f09269c99c38bc786363f0413e1dfc5a1
6
+ metadata.gz: 20567c39f741858f611a579bdd9ab05e27e229929e82ec54adac8d88b533d17312684b7233e44e834f46fe2e4fb3dcf8c16b11e6362c850c86c323b1bbd32563
7
+ data.tar.gz: 69b9a35bd59ea14e6941597e72225dd81ceb0aeebe62511f6f462a137691bf2d2b9b46c782781c9e29c56a4d3efd405fff88ae0d31b8d55ad3dec041410a7b82
data/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  [Check out the Demo](http://chira.ga/trip-to-annecy/)
7
7
 
8
+ > :warning: Please note that this plugin is **NOT** supported by GitHub pages. Here is a [list of all plugins supported](https://pages.github.com/versions/). However you can follow [this GitHub guide](https://help.github.com/articles/adding-jekyll-plugins-to-a-github-pages-site/) to enable it or by using [Travis CI](https://ayastreb.me/deploy-jekyll-to-github-pages-with-travis-ci/). GitLab supposedly supports [any plugin](https://about.gitlab.com/comparison/gitlab-pages-vs-github-pages.html).
9
+
8
10
  # Installing
9
11
 
10
12
  Install the gem using:
@@ -6,11 +6,19 @@ categories: jekyll update
6
6
  gallery_urls:
7
7
  - https://photos.app.goo.gl/bhWukds8QVodFU246
8
8
  - https://photos.app.goo.gl/bhWukds8QVodFU246
9
+ album_settings:
10
+ delay: 5
11
+ title: "Trip to Annecy"
12
+ image_width: 0
13
+ image_height: 0
14
+ frame_height: "200px"
15
+ frame_width: "300px"
9
16
  ---
10
17
 
11
- {% google_photos page.gallery_urls none %}
18
+ {% google_photos page.gallery_urls page.album_settings %}
12
19
 
13
20
  <script src="https://cdn.jsdelivr.net/npm/publicalbum@latest/embed-ui.min.js" async></script>
21
+
14
22
  <div class="pa-gallery-player-widget" style="width:100%; height:480px; display:none;"
15
23
  data-link="<Album link>"
16
24
  data-title="<Album Name>"
@@ -18,12 +26,11 @@ gallery_urls:
18
26
  data-delay="5"
19
27
  id="MyAlbum1">
20
28
  </div>
29
+
21
30
  <script>
22
31
  let MyAlbum1 = document.getElementById('MyAlbum1');
23
32
  let imageWidth = '0';
24
33
  for(var i in googlePhotos.urls) {
25
- console.log(googlePhotos.urls[i]);
26
- console.log(MyAlbum1);
27
34
  let picture = document.createElement('object');
28
35
  picture.setAttribute("data", googlePhotos.urls[i] + '=w' + imageWidth);
29
36
  MyAlbum1.appendChild(picture);
@@ -3,6 +3,7 @@ require 'open-uri'
3
3
  require 'nokogiri'
4
4
  require 'net/http'
5
5
  require_relative 'css'
6
+ require_relative 'js'
6
7
 
7
8
  module JekyllGooglePhotos
8
9
  class Tag < Liquid::Tag
@@ -10,21 +11,20 @@ module JekyllGooglePhotos
10
11
  super
11
12
  args = args.split(" ")
12
13
  @albumUrls = args[0]
13
- @maxWidth = args[1]
14
+ @albumSettings = args[1]
14
15
  end
15
16
 
16
17
  def getImageLinks(url)
17
18
  doc = Nokogiri::HTML(open(url.strip).read)
18
19
  scripts = doc.xpath("//script")
20
+ jsonString = ""
19
21
  for x in scripts do
20
22
  if x.inner_html.match(/initDataCallback\(/)
21
23
  jsonString = x.inner_html
22
- jsonString = jsonString.sub(/.*function\(\)\{return /,"")
23
- jsonString["\n}});"] = ""
24
+ jsonString = jsonString.scan(/\[\"(http.*googleusercontent.com\/[^((?!\/a\/).)*$].*)\"/)
24
25
  end
25
26
  end
26
- json = JSON.parse(jsonString)
27
- return json[1]
27
+ return jsonString
28
28
  end
29
29
 
30
30
  def flexbinCSS()
@@ -33,39 +33,40 @@ module JekyllGooglePhotos
33
33
  end
34
34
 
35
35
  def URLsInJSON()
36
- sp = "googlePhotos.urls = ["
37
- for x in @imgLinks
38
- sp += "\"#{x}\","
39
- end
40
- sp += "];"
36
+ sp = 'googlePhotos.urls = ["'
37
+ newImgLinks = @imgLinks.uniq.join('", "')
38
+ sp += "#{newImgLinks}"
39
+ sp += '"];'
41
40
  return sp
42
41
  end
43
42
 
44
- def createDOM()
43
+ def createDOM(albumSettings)
45
44
  sp = "<script>"
46
45
  sp += "googlePhotos = {};"
47
46
  sp += URLsInJSON()
48
47
  sp += "</script>"
49
- if(@maxWidth != "none")
50
- sp += %Q{<style>}
51
- sp += flexbinCSS()
52
- sp += %Q{</style>}
53
- sp += addImages()
54
- end
48
+ #puts albumSettings
49
+ ##if(albumSettings != "none")
50
+ ##sp += JekyllGooglePhotos::PublicalbumJS()
51
+ ##sp += addImages(albumSettings)
52
+ ##end
55
53
  return sp
56
54
  end
57
-
58
- def addImages()
59
- sp = %Q{<div class="flexbin">}
60
- idx = 0
55
+
56
+ def imageObject(url)
57
+ sp = %Q{
58
+ <object data="#{url}=w#{@maxWidth}"></object>
59
+ }
60
+ return sp
61
+ end
62
+
63
+ def addImages(albumSettings)
64
+ sp = %Q{<div class="pa-gallery-player-widget" style="width:#{albumSettings["frame_width"]}; height:#{albumSettings["frame_height"]}; display:none;"
65
+ data-title="#{albumSettings["title"]}"
66
+ data-delay="#{albumSettings["delay"]}">
67
+ }
61
68
  for x in @imgLinks
62
- link = x + "=w#{@maxWidth}"
63
- sp += %Q{
64
- <div onclick="showSlides(#{idx});" class="slideImgs">
65
- <img src="#{link}" />
66
- </div>
67
- }
68
- idx += 1
69
+ sp += %Q{<object data="#{x}=w#{albumSettings["image_width"]}-h#{albumSettings["image_height"]}"></object>}
69
70
  end
70
71
  sp += %Q{</div>}
71
72
  return sp
@@ -83,11 +84,15 @@ module JekyllGooglePhotos
83
84
  end
84
85
  for albumUrl in albumUrls
85
86
  imageLinks = getImageLinks(albumUrl)
87
+ #puts imageLinks[0]
86
88
  for link in imageLinks
87
- @imgLinks.push(link[1][0])
89
+ @imgLinks.push(link)
88
90
  end
91
+ end
92
+ if @albumSettings != "none"
93
+ albumSettings = context[@albumSettings.strip]
89
94
  end
90
- createDOM()
95
+ createDOM(albumSettings)
91
96
  end
92
97
  end
93
98
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllGooglePhotos
2
- VERSION = "1.4.1".freeze
2
+ VERSION = "1.4.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-google-photos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chirag Arora
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll