tdiary-contrib 5.0.5 → 5.0.6
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/js/google_photos.js +8 -4
- data/lib/tdiary/contrib/version.rb +1 -1
- data/plugin/google_photos.rb +16 -3
- data/plugin/plantuml.rb +70 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a05b3f25047b6bc6e9017c6c7994464cefac13fd
|
4
|
+
data.tar.gz: c95af7773f37e017db01f658171af17335a47586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea47a5edc86322387c752dc256a9510e1871218a67ab1880aac45a2773e71462378c970547c4fdb489dc3e0c2d7bfd8d72097172ca21623e7fea07592608413
|
7
|
+
data.tar.gz: 765627b88d1e2e0f64b5249ad8aa26477f357396c250fdbd6491e5f786416a2fbceb7b963e0395d0e39bcf9027111d5e9abe9966deb11b74ac524cf779ba3ce6
|
data/js/google_photos.js
CHANGED
@@ -48,16 +48,20 @@ $(function() {
|
|
48
48
|
.setDeveloperKey(developerKey)
|
49
49
|
.setLocale('ja')
|
50
50
|
.setCallback(pickerCallback)
|
51
|
+
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
|
51
52
|
.build();
|
52
53
|
picker.setVisible(true);
|
53
54
|
}
|
54
55
|
|
55
56
|
function pickerCallback(data) {
|
56
57
|
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
|
57
|
-
var
|
58
|
-
var
|
59
|
-
|
60
|
-
|
58
|
+
var tag = [];
|
59
|
+
for (var i = 0; i < data[google.picker.Response.DOCUMENTS].length; i++) {
|
60
|
+
var doc = data[google.picker.Response.DOCUMENTS][i];
|
61
|
+
var image = doc.thumbnails[doc.thumbnails.length - 1];
|
62
|
+
tag.push($.makePluginTag("google_photos '" + image.url + "', '" + image.width + "', '" + image.height + "'"));
|
63
|
+
}
|
64
|
+
$('#body').insertAtCaret(tag.join("\n") + "\n");
|
61
65
|
}
|
62
66
|
}
|
63
67
|
});
|
data/plugin/google_photos.rb
CHANGED
@@ -5,15 +5,24 @@
|
|
5
5
|
# Distributed under the GPL
|
6
6
|
#
|
7
7
|
|
8
|
-
def google_photos(src, width, height, alt="photo", place="photo")
|
8
|
+
def google_photos(src, width, height, alt="photo", place="photo", scale=nil)
|
9
|
+
scale = scale || @conf['google_photos.scale'] || 100
|
10
|
+
width = width.to_i * (scale.to_f / 100)
|
11
|
+
height = height.to_i * (scale.to_f / 100)
|
9
12
|
%Q|<img title="#{alt}" width="#{width}" height="#{height}" alt="#{alt}" src="#{src}" class="#{place} google">|
|
10
13
|
end
|
11
14
|
|
12
|
-
def google_photos_left(src, width, height, alt="photo")
|
15
|
+
def google_photos_left(src, width, height, alt="photo", scale=nil)
|
16
|
+
scale = scale || @conf['google_photos.scale'] || 100
|
17
|
+
width = width.to_i * (scale.to_f / 100)
|
18
|
+
height = height.to_i * (scale.to_f / 100)
|
13
19
|
google_photos(src, width, height, alt, 'left')
|
14
20
|
end
|
15
21
|
|
16
|
-
def google_photos_right(src, width, height, alt="photo")
|
22
|
+
def google_photos_right(src, width, height, alt="photo", scale=nil)
|
23
|
+
scale = scale || @conf['google_photos.scale'] || 100
|
24
|
+
width = width.to_i * (scale.to_f / 100)
|
25
|
+
height = height.to_i * (scale.to_f / 100)
|
17
26
|
google_photos(src, width, height, alt, 'right')
|
18
27
|
end
|
19
28
|
|
@@ -40,6 +49,8 @@ add_conf_proc('google_photos', 'Googleフォト') do
|
|
40
49
|
if @mode == 'saveconf'
|
41
50
|
@conf['google_photos.api_key'] = @cgi.params['google_photos.api_key'][0]
|
42
51
|
@conf['google_photos.client_id'] = @cgi.params['google_photos.client_id'][0]
|
52
|
+
@conf['google_photos.scale'] = @cgi.params['google_photos.scale'][0]
|
53
|
+
@conf['google_photos.scale'] = 100 if @conf['google_photos.scale'].nil? || @conf['google_photos.scale'].empty?
|
43
54
|
end
|
44
55
|
|
45
56
|
r = <<-_HTML
|
@@ -63,5 +74,7 @@ add_conf_proc('google_photos', 'Googleフォト') do
|
|
63
74
|
<p><input type="text" name="google_photos.api_key" size="100" value="#{@conf['google_photos.api_key']}"></p>
|
64
75
|
<h3>認証用クライアントID</h3>
|
65
76
|
<p><input type="text" name="google_photos.client_id" size="100" value="#{@conf['google_photos.client_id']}"></p>
|
77
|
+
<h3>サムネイルからの縮小率 (単位%。数値1〜100)</h3>
|
78
|
+
<p><input type="text" name="google_photos.scale" size="100" value="#{@conf['google_photos.scale']}"></p>
|
66
79
|
_HTML
|
67
80
|
end
|
data/plugin/plantuml.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# create image by PlantUML http://plantuml.com/
|
3
|
+
#
|
4
|
+
# Copyright (c) tamoot <tamoot+tdiary@gmail.com>
|
5
|
+
# Distributed under the GPL
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'uri'
|
9
|
+
require 'zlib'
|
10
|
+
require 'digest/md5'
|
11
|
+
|
12
|
+
module ::PlantUML
|
13
|
+
module Deflate
|
14
|
+
|
15
|
+
CHARS ||= ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a + ['-', '_']
|
16
|
+
|
17
|
+
def self.compress(text)
|
18
|
+
compressed = Zlib::Deflate.deflate(text, Zlib::BEST_COMPRESSION)
|
19
|
+
compressed.chars.each_slice(3).map do |chars|
|
20
|
+
append3bytes(chars[0].ord, chars[1]&.ord.to_i, chars[2]&.ord.to_i)
|
21
|
+
end.join
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.append3bytes(b1, b2, b3)
|
27
|
+
[
|
28
|
+
b1 >> 2,
|
29
|
+
((b1 & 0x3) << 4) | (b2 >> 4),
|
30
|
+
((b2 & 0xF) << 2) | (b3 >> 6),
|
31
|
+
b3 & 0x3F,
|
32
|
+
].map { |c| CHARS[c & 0x3F] || '?' }.join
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def plantuml(text)
|
39
|
+
html = %Q|<div class="plantuml">|
|
40
|
+
|
41
|
+
begin
|
42
|
+
uri = URI::parse( @conf['plantuml.server'] )
|
43
|
+
uri.path.gsub!(/\/+$/, "")
|
44
|
+
uri.path << '/png/' << PlantUML::Deflate::compress(text)
|
45
|
+
html << %Q|<img src=#{uri}></img>|
|
46
|
+
rescue
|
47
|
+
html << %Q|Error: #{$!.message}|
|
48
|
+
end
|
49
|
+
|
50
|
+
html << %Q|</div>|
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
add_conf_proc('plantuml_server', 'PlantUMLサーバ') do
|
55
|
+
if @mode == 'saveconf'
|
56
|
+
@conf['plantuml.server'] = @cgi.params['plantuml.server'][0]
|
57
|
+
end
|
58
|
+
|
59
|
+
r = <<-_HTML
|
60
|
+
<h3>Summary</h3>
|
61
|
+
<p>The image is generated by using specified PlantUML server.</p>
|
62
|
+
<h3>URL</h3>
|
63
|
+
<p>Please specify the PlantUML server URL (official site or your own PlantUML server)
|
64
|
+
<li> Official PlantUML server: http://www.plantuml.com/plantuml/</li>
|
65
|
+
<p><input type="text" name="plantuml.server" size="100" value="#{@conf['plantuml.server']}"></p>
|
66
|
+
_HTML
|
67
|
+
|
68
|
+
r
|
69
|
+
end
|
70
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdiary-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tDiary contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tdiary
|
@@ -315,6 +315,7 @@ files:
|
|
315
315
|
- plugin/openid.rb
|
316
316
|
- plugin/opensearch_ad.rb
|
317
317
|
- plugin/picasa.rb
|
318
|
+
- plugin/plantuml.rb
|
318
319
|
- plugin/playstore.rb
|
319
320
|
- plugin/plugin_checker.rb
|
320
321
|
- plugin/popit.rb
|
@@ -505,7 +506,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
505
506
|
version: '0'
|
506
507
|
requirements: []
|
507
508
|
rubyforge_project:
|
508
|
-
rubygems_version: 2.6.
|
509
|
+
rubygems_version: 2.6.13
|
509
510
|
signing_key:
|
510
511
|
specification_version: 4
|
511
512
|
summary: tDiary contributions package
|