tdiary-contrib 5.0.10 → 5.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb143072e20a7214771fc7ef9c5013645bc2c621923429b3c5a3b47aee39acc9
4
- data.tar.gz: 617526cb318ab965bb3d732dbaffec3a9deac985c720655fc85aca21743d6958
3
+ metadata.gz: 0343f9efacec380a06456385bb96de2919b3e530f31e04e1843183fe68c362be
4
+ data.tar.gz: 1e45713addec8000837c6fe4dba4ea75d29ebd85126125704862f48e9b55afc5
5
5
  SHA512:
6
- metadata.gz: 979f6d4cd2cbcbd047ca38b6c00cd108061460df382a887d92de009a43c1e7bd95d38891f70c60814c2cf7b61885165dd1d4d86baea74f71b79dcea4ab9a5f6e
7
- data.tar.gz: eba7b2744d29ca221453daa174b432ec23d07250463411336e3b8992fab1443f8facd97eb233b2ed7bb7631fdf8a0f8d9eb45039a037b2973be2800312098e0d
6
+ metadata.gz: bd2567180fbc3b3ead53b48e3563a94f669d8ebf8b827fb228518177d82666251b5702f341f70ad7e8233b303cb7de257a0d783ab004b63254b88aa3413bd5c0
7
+ data.tar.gz: b5f8e36eb937d67a2db82c9bdb1d60fa7e8a2e2e9d50027ef8f30fa34235812313f96764961820dedaa5c370dd8b0c7f1744735f1e69f0a9e099b1b439ec191b
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * jquery.socialbutton - jQuery plugin for social networking websites
3
- * http://itra.jp/jquery_socialbutton_plugin/
3
+ * https://itra.jp/jquery_socialbutton_plugin/
4
4
  *
5
5
  * Copyright 2010, Itrans, Inc. http://itra.jp/
6
6
  *
7
7
  * Dual licensed under the MIT or GPL Version 2 licenses.
8
- * http://jquery.org/license
8
+ * https://jquery.org/license
9
9
  *
10
10
  * Version: 1.9.1
11
11
  */
@@ -15,7 +15,7 @@
15
15
  *
16
16
  *
17
17
  * mixi_check
18
- * http://developer.mixi.co.jp/connect/mixi_plugin/mixi_check/spec_mixi_check
18
+ * https://developer.mixi.co.jp/connect/mixi_plugin/mixi_check/spec_mixi_check
19
19
  *
20
20
  * $('#mixi_check').socialbutton('mixi_check', {
21
21
  * key: 'mixi-check-key'
@@ -24,12 +24,12 @@
24
24
  * $('#mixi_check').socialbutton('mixi_check', {
25
25
  * key: 'mixi-check-key',
26
26
  * button: 'button-1',
27
- * url: 'http://itra.jp/'
27
+ * url: 'https://itra.jp/'
28
28
  * });
29
29
  *
30
30
  *
31
31
  * mixi_like
32
- * http://developer.mixi.co.jp/connect/mixi_plugin/favorite_button/spec
32
+ * https://developer.mixi.co.jp/connect/mixi_plugin/favorite_button/spec
33
33
  *
34
34
  * $('#mixi_like').socialbutton('mixi_like', {
35
35
  * key: 'mixi-check-key',
@@ -37,7 +37,7 @@
37
37
  *
38
38
  * $('#mixi_like').socialbutton('mixi_like', {
39
39
  * key: 'mixi-check-key',
40
- * url: 'http://itra.jp/',
40
+ * url: 'https://itra.jp/',
41
41
  * width: 450,
42
42
  * height: 80,
43
43
  * show_faces: true,
@@ -46,13 +46,13 @@
46
46
  *
47
47
  *
48
48
  * facebook_like
49
- * http://developers.facebook.com/docs/reference/plugins/like
49
+ * https://developers.facebook.com/docs/reference/plugins/like
50
50
  *
51
51
  * $('#facebook_like').socialbutton('facebook_like');
52
52
  *
53
53
  * $('#facebook_like').socialbutton('facebook_like', {
54
54
  * button: 'standard', // synonym 'layout'
55
- * url: 'http://itra.jp',
55
+ * url: 'https://itra.jp',
56
56
  * show_faces: true,
57
57
  * width: 450,
58
58
  * height: 80,
@@ -64,25 +64,25 @@
64
64
  *
65
65
  *
66
66
  * facebook_share
67
- * http://developers.facebook.com/docs/share
67
+ * https://developers.facebook.com/docs/share
68
68
  *
69
69
  * $('#facebook_share').socialbutton('facebook_share');
70
70
  *
71
71
  * $('#facebook_share').socialbutton('facebook_share', {
72
72
  * button: 'button_count', // synonym 'type'
73
- * url: 'http://itra.jp',
73
+ * url: 'https://itra.jp',
74
74
  * text: 'Share'
75
75
  * });
76
76
  *
77
77
  *
78
78
  * Twitter
79
- * http://twitter.com/goodies/tweetbutton
79
+ * https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/overview.html
80
80
  *
81
81
  * $('#twitter').socialbutton('twitter');
82
82
  *
83
83
  * $('#twitter').socialbutton('twitter', {
84
84
  * button: 'vertical', // synonym 'count'
85
- * url: 'http://itra.jp/',
85
+ * url: 'https://itra.jp/',
86
86
  * text: 'tweet text',
87
87
  * lang: 'ja',
88
88
  * via: 'ishiiyoshinori',
@@ -90,84 +90,25 @@
90
90
  * });
91
91
  *
92
92
  *
93
- * GREE Social Feedback
94
- * http://developer.gree.co.jp/connect/plugins/sf
95
- *
96
- * $('#gree_sf').socialbutton('gree_sf');
97
- *
98
- * $('#gree_sf').socialbutton('gree_sf', {
99
- * button: 0, // synonym 'type'
100
- * url: 'http://itra.jp/',
101
- * width: 0, // auto
102
- * height: 20
103
- * });
104
- *
105
- *
106
- * Evernote Site Memory
107
- * http://www.evernote.com/about/developer/sitememory/
108
- *
109
- * $('#evernote').socialbutton('evernote');
110
- *
111
- * $('#evernote').socialbutton('evernote', {
112
- * button: 'article-clipper',
113
- * url: 'http://itra.jp/',
114
- * provider_name: 'itra.jp',
115
- * suggest_notebook: 'webclip',
116
- * content_id: 'element-id-to-clip',
117
- * code: 'your-affiliate-code',
118
- * title: 'note-title',
119
- * suggest_tags: 'comma-separated-tags,up-to-three-tags',
120
- * styling: 'full'
121
- * });
122
- *
123
- *
124
93
  * Hatena Bookmark
125
- * http://b.hatena.ne.jp/
94
+ * http://b.hatena.ne.jp/guide/bbutton
126
95
  *
127
96
  * $('#hatena').socialbutton('hatena');
128
97
  *
129
98
  * $('#hatena').socialbutton('hatena', {
130
99
  * button: 'standard',
131
- * url: 'http://itra.jp/',
100
+ * url: 'https://itra.jp/',
132
101
  * title: 'page-title'
133
102
  * });
134
103
  *
135
104
  *
136
- * Hatena Bookmark (Old Style)
137
- * http://b.hatena.ne.jp/
138
- *
139
- * $('#hatena').socialbutton('hatena_oldstyle');
140
- *
141
- * $('#hatena').socialbutton('hatena_oldstyle', {
142
- * button: '/path/to/your-icon.png',
143
- * url: 'http://itra.jp/',
144
- * padding: 10,
145
- * height: 15
146
- * });
147
- *
148
- *
149
- * Google +1 Button
150
- * http://www.google.com/webmasters/+1/button/
151
- *
152
- * $('#google').socialbutton('google_plusone');
153
- *
154
- * $('#google').socialbutton('google_plusone', {
155
- * button: 'standard', // synonym 'size'
156
- * url: 'http://itra.jp', // synonym 'href'
157
- * lang: 'ja',
158
- * parsetags: 'explicit',
159
- * callback: 'some_callback_function',
160
- * count: true
161
- * });
162
- *
163
- *
164
105
  * Pintarest Button
165
- * http://pinterest.com/about/goodies/
106
+ * https://developers.pinterest.com/docs/widgets/save/?
166
107
  *
167
108
  * $('#pinterest').socialbutton('pintarest', {
168
109
  * button: 'horizontal', // or 'vertical', 'none'
169
- * url: 'http://itra.jp',
170
- * media: 'http://itra.jp/image.jpg',
110
+ * url: 'https://itra.jp',
111
+ * media: 'https://itra.jp/image.jpg',
171
112
  * description: 'This is an image.'
172
113
  * });
173
114
  */
@@ -241,50 +182,11 @@ $.fn.socialbutton = function(service, options) {
241
182
  via: '',
242
183
  related: ''
243
184
  },
244
- gree_sf: {
245
- button: 0, // 0,1,2,3,4
246
- url: document.URL,
247
- width: 0, // auto
248
- height: 20,
249
-
250
- widths: {
251
- type0_16: 58, type0_20: 70, type0_23: 76,
252
- type1_16: 58, type1_20: 73, type1_23: 78,
253
- type2_16: 58, type2_20: 73, type2_23: 78,
254
- type3_16: 49, type3_20: 61, type3_23: 64,
255
- type4_16: 16, type4_22: 21, type4_32: 32
256
- }
257
- },
258
- evernote: {
259
- button: 'article-clipper', // article-clipper, article-clipper-remember, article-clipper-jp, article-clipper-rus, article-clipper-fr, article-clipper-es, article-clipper-de, article-clipper-vert, site-mem-32, site-mem-36, site-mem-22, site-mem-16
260
- url: '', // document.URL
261
- provider_name: '', // domain name
262
- suggest_notebook: '', // notebook name
263
- content_id: '', // element id for clip
264
- code: '', // affiliate code
265
- title: '',
266
- suggest_tags: '',
267
- styling: '' // none(text-only), full
268
- },
269
185
  hatena: {
270
186
  button: 'standard', // standard, vertical, simple
271
187
  url: document.URL,
272
188
  title: document.title
273
189
  },
274
- hatena_oldstyle: {
275
- button: 'https://d.hatena.ne.jp/images/b_append.gif',
276
- url: document.URL,
277
- height: 13,
278
- padding: 7
279
- },
280
- google_plusone: {
281
- button: '', // small, standard, medium, tall
282
- url: '',
283
- lang: '', // en-US
284
- parsetags: '', // none(onload), explicit
285
- callback: '',
286
- count: true // true, false
287
- },
288
190
  pinterest: {
289
191
  button: 'horizontal', // horizontal, vertical, none
290
192
  url: document.URL,
@@ -318,26 +220,10 @@ $.fn.socialbutton = function(service, options) {
318
220
  socialbutton_twitter(this, options, defaults.twitter, index, max_index);
319
221
  break;
320
222
 
321
- case 'gree_sf':
322
- socialbutton_gree_sf(this, options, defaults.gree_sf, index, max_index);
323
- break;
324
-
325
- case 'evernote':
326
- socialbutton_evernote(this, options, defaults.evernote, index, max_index);
327
- break;
328
-
329
223
  case 'hatena':
330
224
  socialbutton_hatena(this, options, defaults.hatena, index, max_index);
331
225
  break;
332
226
 
333
- case 'hatena_oldstyle':
334
- socialbutton_hatena_oldstyle(this, options, defaults.hatena_oldstyle, index, max_index);
335
- break;
336
-
337
- case 'google_plusone':
338
- socialbutton_google_plusone(this, options, defaults.google_plusone, index, max_index);
339
- break;
340
-
341
227
  case 'pinterest':
342
228
  socialbutton_pinterest(this, options, defaults.pinterest, index, max_index);
343
229
  break;
@@ -366,12 +252,12 @@ function socialbutton_mixi_check(target, options, defaults, index, max_index)
366
252
  'data-button': button
367
253
  });
368
254
 
369
- var tag = '<a href="http://mixi.jp/share.pl" class="mixi-check-button"' + attr + '>Check</a>';
255
+ var tag = '<a href="https://mixi.jp/share.pl" class="mixi-check-button"' + attr + '>Check</a>';
370
256
 
371
257
  $(target).html(tag);
372
258
 
373
259
  if (index == max_index) {
374
- $('body').append('<script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>');
260
+ $('body').append('<script type="text/javascript" src="https://static.mixi.jp/js/share.js"></script>');
375
261
  }
376
262
  }
377
263
 
@@ -415,7 +301,7 @@ function socialbutton_mixi_like(target, options, defaults, index, max_index)
415
301
  });
416
302
 
417
303
  var attr = merge_attributes({
418
- src: 'http://plugins.mixi.jp/favorite.pl?' + params,
304
+ src: 'https://plugins.mixi.jp/favorite.pl?' + params,
419
305
  scrolling: 'no',
420
306
  frameborder: '0',
421
307
  allowTransparency: 'true',
@@ -515,7 +401,7 @@ function socialbutton_facebook_share(target, options, defaults, index, max_index
515
401
  var tag = '<a name="fb_share"' + attr + '>' + text + '</a>';
516
402
 
517
403
  if(index == 0) {
518
- tag += '<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"></script>';
404
+ tag += '<script type="text/javascript" src="https://static.ak.fbcdn.net/connect.php/js/FB.Share"></script>';
519
405
  }
520
406
 
521
407
  $(target).html(tag);
@@ -540,7 +426,7 @@ function socialbutton_twitter(target, options, defaults, index, max_index)
540
426
  'data-related': related
541
427
  });
542
428
 
543
- var tag = '<a href="http://twitter.com/share" class="twitter-share-button"' + attr + '>Tweet</a>';
429
+ var tag = '<a href="https://twitter.com/share" class="twitter-share-button"' + attr + '>Tweet</a>';
544
430
 
545
431
  $(target).html(tag);
546
432
 
@@ -549,114 +435,6 @@ function socialbutton_twitter(target, options, defaults, index, max_index)
549
435
  }
550
436
  }
551
437
 
552
- function socialbutton_gree_sf(target, options, defaults, index, max_index)
553
- {
554
- var type = options.type || options.button || defaults.button;
555
- var url = options.url || defaults.url;
556
-
557
- var width = options.width != undefined ? options.width : defaults.width;
558
- var height = options.height != undefined ? options.height : defaults.height;
559
-
560
- if (options.url) {
561
- url = decodeURIComponent(url);
562
- }
563
- url = url_encode_rfc3986(url);
564
-
565
- switch (type) {
566
- case 0:
567
- case 1:
568
- case 2:
569
- case 3:
570
- if (height != 16 && height != 20 && height != 23) {
571
- height = 20;
572
- }
573
- break;
574
-
575
- case 4:
576
- if (height != 16 && height != 22 && height != 32) {
577
- height = 22;
578
- }
579
- break;
580
-
581
- default:
582
- type = 0;
583
- width = 0;
584
- height = 20;
585
- break;
586
- }
587
-
588
- if (width == 0) {
589
- width = defaults.widths['type' + type + '_' + height];
590
- }
591
-
592
- var params = merge_parameters({
593
- 'url': url,
594
- 'type': String(type),
595
- 'height': height
596
- });
597
-
598
- var tag = '<iframe src="http://share.gree.jp/share?' + params + '" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="border:none; overflow:hidden; width:' + width + 'px; height:' + height + 'px;" allowTransparency="true"></iframe>';
599
-
600
- $(target).html(tag);
601
- }
602
-
603
- function socialbutton_evernote(target, options, defaults, index, max_index)
604
- {
605
- var button = options.button || defaults.button;
606
- var url = options.url || defaults.url;
607
-
608
- var provider_name = options.provider_name || defaults.provider_name;
609
- var suggest_notebook = options.suggest_notebook || defaults.suggest_notebook;
610
- var content_id = options.content_id || defaults.content_id;
611
- var code = options.code || defaults.code;
612
- var title = options.title || defaults.title;
613
- var suggest_tags = options.suggest_tags || defaults.suggest_tags;
614
- var styling = options.styling || defaults.styling;
615
-
616
- if (button == 'article-clipper' ||
617
- button == 'article-clipper-remember' ||
618
- button == 'article-clipper-jp' ||
619
- button == 'article-clipper-rus' ||
620
- button == 'article-clipper-fr' ||
621
- button == 'article-clipper-es' ||
622
- button == 'article-clipper-de' ||
623
- button == 'article-clipper-vert' ||
624
- button == 'site-mem-32' ||
625
- button == 'site-mem-36' ||
626
- button == 'site-mem-22' ||
627
- button == 'site-mem-16'
628
- ) {
629
- button = 'http://static.evernote.com/' + button + '.png';
630
- }
631
-
632
- var clipoptions = {
633
- 'url': url,
634
- 'providerName': provider_name,
635
- 'suggestNotebook': suggest_notebook,
636
- 'contentId': content_id,
637
- 'code': code,
638
- 'title': title,
639
- 'suggestTags': suggest_tags,
640
- 'styling': styling
641
- };
642
-
643
- if (index == 0) {
644
- $('body').append('<script type="text/javascript" src="http://static.evernote.com/noteit.js"></script>');
645
- }
646
-
647
- var tag = $(document.createElement('a'))
648
- .attr({href: '#'})
649
- .click(function(){
650
- if (Evernote) {
651
- Evernote.doClip(clipoptions);
652
- }
653
- return false;
654
- })
655
- .append('<img src="' + button + '" alt="Clip to Evernote" style="border: none" />');
656
-
657
- $(target).html(tag);
658
- }
659
-
660
438
  function socialbutton_hatena(target, options, defaults, index, max_index)
661
439
  {
662
440
  var layout = options.layout || options.button || defaults.button;
@@ -681,86 +459,6 @@ function socialbutton_hatena(target, options, defaults, index, max_index)
681
459
  $(target).html(tag);
682
460
  }
683
461
 
684
- function socialbutton_hatena_oldstyle(target, options, defaults, index, max_index)
685
- {
686
- var button = options.button || defaults.button;
687
- var url = options.url || defaults.url;
688
-
689
- var height = options.height != undefined ? options.height : defaults.height;
690
- var padding = options.padding != undefined ? options.padding : defaults.padding;
691
-
692
- url = htmlspecialchars(url);
693
-
694
- var tag = '<span style="font-size: ' + height + 'px; line-height: 100%; ">'
695
- + '<span style="padding-right: ' + padding + 'px"><a href="https://b.hatena.ne.jp/entry/add/' + url + '" target="_blank"><img src="' + button + '" style="border: none; vertical-align: text-bottom" /></a></span>'
696
- + '<a href="https://b.hatena.ne.jp/entry/' + url + '" target="_blank"><img src="https://b.hatena.ne.jp/entry/image/' + url + '" style="border: none; vertical-align: text-bottom" /></a>'
697
- + '</span>';
698
-
699
- $(target).html(tag);
700
- }
701
-
702
- function socialbutton_google_plusone(target, options, defaults, index, max_index)
703
- {
704
- if (!$.support.tbody) {
705
- return;
706
- }
707
-
708
- var size = options.size || options.button || defaults.button;
709
- var href = options.href || options.url || defaults.url;
710
-
711
- var lang = options.lang || defaults.lang;
712
- var parsetags = options.parsetags || defaults.parsetags;
713
-
714
- var callback = options.callback || defaults.callback;
715
- var count = options.count != undefined ? options.count : defaults.count;
716
-
717
- switch (size) {
718
- case 'small':
719
- case 'standard':
720
- case 'medium':
721
- break;
722
-
723
- case 'tall':
724
- count = true;
725
- break;
726
-
727
- default:
728
- size = 'standard';
729
- count = true;
730
- }
731
-
732
- var tag = $('<div>')
733
- .attr({
734
- 'data-callback': callback,
735
- 'data-count': count ? 'true' : 'false',
736
- 'data-href': href,
737
- 'data-size': size
738
- }).addClass('g-plusone');
739
- $(target).append(tag);
740
-
741
- if (index == max_index) {
742
-
743
- var script_params = '';
744
-
745
- if (lang != '') {
746
- script_params += 'lang: "' + htmlspecialchars(lang) + '"';
747
- }
748
- if (parsetags != '') {
749
- script_params += script_params != '' ? ',' : '';
750
- script_params += 'parsetags: "' + htmlspecialchars(parsetags) + "'";
751
- }
752
- if (script_params != '') {
753
- script_params = '{' + script_params + '}';
754
- }
755
-
756
- if (typeof gapi === 'undefined' || typeof gapi.plusone === 'undefined') {
757
- $('body').append('<script type="text/javascript" src="https://apis.google.com/js/plusone.js">' + script_params + '</script>');
758
- } else {
759
- gapi.plusone.go();
760
- }
761
- }
762
- }
763
-
764
462
  function socialbutton_pinterest(target, options, defaults, index, max_index)
765
463
  {
766
464
  var url = options.url || defaults.url;
@@ -778,7 +476,7 @@ function socialbutton_pinterest(target, options, defaults, index, max_index)
778
476
  'description': description
779
477
  });
780
478
 
781
- var tag = '<a href="http://pinterest.com/pin/create/button/?' + params + '" class="pin-it-button" count-layout="' + button +'"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>'
479
+ var tag = '<a href="https://pinterest.com/pin/create/button/?' + params + '" class="pin-it-button" count-layout="' + button +'"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>'
782
480
 
783
481
  $(target).html(tag);
784
482
 
data/js/socialbutton.js CHANGED
@@ -56,26 +56,10 @@ $(function() {
56
56
  };
57
57
  },
58
58
 
59
- evernote: function(url, title) {
60
- return {
61
- url: url,
62
- title: title,
63
- button: 'article-clipper-jp'
64
- };
65
- },
66
-
67
- google_plusone: function(url, title) {
68
- return {
69
- href: url,
70
- size: 'medium',
71
- lang: $('html').attr('lang')
72
- };
73
- },
74
-
75
59
  pinterest: function(url, title) {
76
60
  return {
77
61
  url: url,
78
- media: $('p img:first', $('div.section h3 a[name=' + url.substr(-3) + ']').parent().parent()).attr('src'),
62
+ media: $('p img:first', $('div.section h3 a[name=' + url.substr(-3) + ']').parent().parent()).attr('src'),
79
63
  description: title,
80
64
  button: 'horizontal',
81
65
  };
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "5.0.10"
3
+ VERSION = "5.0.11"
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  add_header_proc do
6
6
  <<-EOS
7
- <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
7
+ <script src="https://cdn.jsdelivr.net/gh/google/code-prettify/loader/run_prettify.js"></script>
8
8
  EOS
9
9
  end
10
10
 
data/plugin/prettify.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  if /\A(?:latest|day|month|nyear)\z/ =~ @mode then
4
4
  add_header_proc do
5
5
  <<-HTML
6
- <script type="text/javascript" src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
6
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/google/code-prettify/loader/run_prettify.js"></script>
7
7
  <script type="text/javascript"><!--
8
8
  var initPrettyPrint = function() {
9
9
  var pres = document.querySelectorAll("div.body > div.section > pre");
@@ -36,7 +36,7 @@ add_conf_proc('socialbutton', @socialbutton_label_conf) do
36
36
  <h3>#{@socialbutton_label_enables}</h3>
37
37
  <ul>
38
38
  HTML
39
- ['twitter', 'hatena', 'evernote', 'facebook_like', 'google_plusone', 'pinterest'].each do |service|
39
+ ['twitter', 'hatena', 'facebook_like', 'pinterest'].each do |service|
40
40
  checked = @conf['socialbutton.enables'].index(service) ? 'checked' : ''
41
41
  id = "socialbutton.enables.#{service}"
42
42
  result << %Q|<li><input id="#{id}" name="socialbutton.enables" type="checkbox" value="#{service}" #{checked}>|
@@ -5,10 +5,15 @@
5
5
 
6
6
  def twitter_summary_card_description
7
7
  section_index = @cgi.params['p'][0]
8
- if @mode == 'day' and section_index
8
+ if @mode == 'day'
9
9
  diary = @diaries[@date.strftime('%Y%m%d')]
10
10
  sections = diary.instance_variable_get(:@sections)
11
- section = sections[section_index.to_i - 1].body_to_html
11
+ section = nil
12
+ if section_index
13
+ section = sections[section_index.to_i - 1].body_to_html
14
+ else
15
+ section = sections.first.body_to_html
16
+ end
12
17
  @conf.shorten(apply_plugin(section, true), 200)
13
18
  else
14
19
  @conf.description
@@ -16,13 +21,22 @@ def twitter_summary_card_description
16
21
  end
17
22
 
18
23
  add_header_proc do
24
+ card_type = 'summary'
25
+ image_src = @conf.banner
26
+ if @mode == 'day' && @conf['twitter_summary_card.use_attached_image']
27
+ images = image_list(@date.strftime('%Y%m%d'))
28
+ unless images.empty?
29
+ card_type = 'summary_large_image'
30
+ image_src = "#{@image_url}/#{images.first}"
31
+ end
32
+ end
19
33
  headers = {
20
- 'twitter:card' => 'summary',
34
+ 'twitter:card' => card_type,
21
35
  'twitter:site' => @conf['twitter_summary_card.site'] || @conf['twitter_summary_card.creator'],
22
36
  'twitter:creator' => @conf['twitter_summary_card.creator'],
23
37
  'twitter:title' => title_tag.match(/>([^<]+)/).to_a[1],
24
38
  'twitter:description' => twitter_summary_card_description,
25
- 'twitter:image:src' => @conf.banner
39
+ 'twitter:image:src' => image_src
26
40
  }
27
41
  headers = headers.select { |_, v| v && not(v.empty?) }
28
42
  headers = headers.map do |k, v|
@@ -36,6 +50,7 @@ add_conf_proc('Twitter Summary Card', 'Twitter Summary Card') do
36
50
  if @mode == 'saveconf'
37
51
  @conf['twitter_summary_card.site'] = @cgi.params['twitter_summary_card.site'][0]
38
52
  @conf['twitter_summary_card.creator'] = @cgi.params['twitter_summary_card.creator'][0]
53
+ @conf['twitter_summary_card.use_attached_image'] = @cgi.params['twitter_summary_card.use_attached_image'][0] == "on"
39
54
  end
40
55
 
41
56
  <<-HTML
@@ -43,7 +58,7 @@ add_conf_proc('Twitter Summary Card', 'Twitter Summary Card') do
43
58
  <p>
44
59
  Please refer to the following documentation at first.
45
60
  <ul>
46
- <li><a href="https://dev.twitter.com/docs/cards/types/summary-card" target="_blank">Summary Card | Twitter Developers</a></li>
61
+ <li><a href="https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards" target="_blank">About Twitter Cards Twitter Developers</a></li>
47
62
  </ul>
48
63
  </p>
49
64
 
@@ -52,5 +67,7 @@ add_conf_proc('Twitter Summary Card', 'Twitter Summary Card') do
52
67
 
53
68
  <h3>Creator's Twitter account </h3>
54
69
  <p><input name="twitter_summary_card.creator" value="#{h(@conf['twitter_summary_card.creator'])}"></p>
70
+
71
+ <p><label><input name="twitter_summary_card.use_attached_image" type="checkbox" value="on" #{@conf['twitter_summary_card.use_attached_image'] && "checked"}>Use attached image</label></p>
55
72
  HTML
56
73
  end
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.10
4
+ version: 5.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - tDiary contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-28 00:00:00.000000000 Z
11
+ date: 2018-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tdiary
@@ -507,8 +507,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
507
  - !ruby/object:Gem::Version
508
508
  version: '0'
509
509
  requirements: []
510
- rubyforge_project:
511
- rubygems_version: 2.7.6
510
+ rubygems_version: 3.0.1
512
511
  signing_key:
513
512
  specification_version: 4
514
513
  summary: tDiary contributions package