Skip to content

Commit 55a5313

Browse files
committed
この記事による「ソーシャルシェアボタン」のコミット分を取り込む。 plusjade/jekyll-bootstrap#105
1 parent 342460a commit 55a5313

File tree

9 files changed

+165
-35
lines changed

9 files changed

+165
-35
lines changed

_config.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,21 @@ JB :
5555
idsite : '1' # the id of the site on Piwik
5656

5757
sharing :
58-
provider : false
59-
58+
provider : all
59+
twitter :
60+
size :
61+
via :
62+
count :
63+
facebook :
64+
appid : 205602882797935
65+
layout : button_count
66+
font :
67+
faces : false
68+
width : 90
69+
googleplus :
70+
size : medium
71+
width :
72+
annotation : bubble
73+
linkedin :
74+
counter : right
75+

_includes/JB/sharing

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
{% include JB/is_production %}
2-
{% if is_production and site.JB.sharing.provider and page.JB.sharing != false %}
1+
{% if site.JB.sharing.provider and page.sharing != false %}
32

4-
{% case site.JB.sharing.provider %}
5-
{% when "custom" %}
6-
{% include custom/sharing %}
7-
{% endcase %}
3+
{% case site.JB.sharing.provider %}
4+
{% when "like" %}
5+
{% include JB/sharing-providers/facebook %}
6+
{% when "tweet" %}
7+
{% include JB/sharing-providers/twitter %}
8+
{% when "plusone" %}
9+
{% include JB/sharing-providers/googleplus %}
10+
{% when "linkedin" %}
11+
{% include JB/sharing-providers/linkedin %}
12+
{% when "hn" %}
13+
{% include JB/sharing-providers/hn %}
14+
{% when "all" %}
15+
{% include JB/sharing-providers/global %}
16+
{% endcase %}
817

9-
{% endif %}
18+
{% endif %}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div id="fb-root"></div>
2+
<script>(function(d, s, id) {
3+
var js, fjs = d.getElementsByTagName(s)[0];
4+
if (d.getElementById(id)) return;
5+
js = d.createElement(s); js.id = id;
6+
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId={{ site.JB.sharing.facebook.appid }}";
7+
fjs.parentNode.insertBefore(js, fjs);
8+
}(document, 'script', 'facebook-jssdk'));</script>
9+
10+
<div class="fb-like" data-send="false" data-layout="{{ site.JB.sharing.facebook.layout }}" data-width="{{ site.JB.sharing.facebook.width }}" data-show-faces="{{ site.JB.sharing.facebook.faces }}" data-font="{{ site.JB.sharing.facebook.font }}"></div>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<div id="fb-root"></div>
2+
3+
<ul class="post-share ulno mob">
4+
5+
<!-- Hacker News -->
6+
<li class="hn"><span id="hnews"></span>
7+
8+
<!-- Twitter -->
9+
<li class="tw"><a href="https://twitter.com/share" class="twitter-share-button" data-text="{{ page.title }}" data-via="{{ site.JB.sharing.twitter.via }}" data-related="{{ site.author.twitter }}" data-count="{{ site.JB.sharing.twitter.count }}" data-size="{{ site.JB.sharing.twitter.size }}">Tweet</a>
10+
11+
<!-- Google+ -->
12+
<li class="gp"><div class="g-plusone" data-size="{{ site.JB.sharing.googleplus.size }}" data-annotation="{{ site.JB.sharing.googleplus.annotation }}" data-width="{{ site.JB.sharing.googleplus.width }}"></div>
13+
14+
<!-- Facebook -->
15+
<li class="fb"><div class="fb-like" data-send="false" data-layout="{{ site.JB.sharing.facebook.layout }}" data-width="{{ site.JB.sharing.facebook.width }}" data-show-faces="{{ site.JB.sharing.facebook.faces }}" data-font="{{ site.JB.sharing.facebook.font }}"></div>
16+
17+
<!-- Reddit -->
18+
<li><script type="text/javascript" src="http://www.reddit.com/buttonlite.js?i=4"></script>
19+
</ul>
20+
21+
<script>
22+
23+
(function(doc, script) {
24+
25+
//Async Social Buttons
26+
var js,
27+
fjs = doc.getElementsByTagName(script)[0],
28+
add = function(url, id) {
29+
if (doc.getElementById(id)) {return;}
30+
js = doc.createElement(script);
31+
js.src = url;
32+
id && (js.id = id);
33+
fjs.parentNode.insertBefore(js, fjs);
34+
};
35+
36+
// Twitter SDK
37+
add('//platform.twitter.com/widgets.js', 'twitter-wjs');
38+
39+
// Google+ button
40+
add('https://apis.google.com/js/plusone.js');
41+
42+
// Facebook SDK
43+
add('//connect.facebook.net/en_GB/all.js#xfbml=1&appId={{ site.JB.sharing.facebook.appid }}', 'facebook-jssdk');
44+
45+
//Hacker News Button
46+
var hn_like = document.createElement('iframe');
47+
hn_like.frameborder="no";
48+
hn_like.scrolling="no";
49+
hn_like.height="28px";
50+
hn_like.width="110px";
51+
hn_like.src = "http://hnlike.com/upvote.php?link="
52+
+ encodeURIComponent(document.location)
53+
+ "&title="
54+
+ encodeURIComponent("{{ page.title }}");
55+
hn_like.innerHTML="iframes not supported by your browser";
56+
57+
var where = document.getElementById("hnews");
58+
where.parentNode.insertBefore(
59+
hn_like,
60+
where
61+
);
62+
}(document, 'script'));
63+
64+
</script>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="g-plusone" data-size="{{ site.JB.sharing.googleplus.size }}" data-annotation="{{ site.JB.sharing.googleplus.annotation }}" data-width="{{ site.JB.sharing.googleplus.width }}"></div>
2+
3+
<script type="text/javascript">
4+
(function() {
5+
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
6+
po.src = 'https://apis.google.com/js/plusone.js';
7+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
8+
})();
9+
</script>

_includes/JB/sharing-providers/hn

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<span id="hnews"></span>
2+
<script>
3+
(function(){
4+
var hn_like = document.createElement('iframe');
5+
hn_like.frameborder="no";
6+
hn_like.scrolling="no";
7+
hn_like.height="28px";
8+
hn_like.width="110px";
9+
hn_like.src = "http://hnlike.com/upvote.php?link="
10+
+ encodeURIComponent(document.location)
11+
+ "&title="
12+
+ encodeURIComponent("{{ page.title }}");
13+
hn_like.innerHTML="iframes not supported by your browser";
14+
15+
var where = document.getElementById("hnews");
16+
where.parentNode.insertBefore(
17+
hn_like,
18+
where
19+
);
20+
})();
21+
</script>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
2+
<script type="IN/Share" data-counter="{{ site.JB.sharing.linkedin.counter }}"></script>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<a href="https://twitter.com/share" class="twitter-share-button" data-text="{{ page.title }}" data-via="{{ site.JB.sharing.twitter.via }}" data-related="{{ site.author.twitter }}" data-count="{{ site.JB.sharing.twitter.count }}" data-size="{{ site.JB.sharing.twitter.size }}">Tweet</a>
2+
3+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

_includes/themes/twitter/post.html

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
11
<div class="page-header">
2-
<h1>{{ page.title }} {% if page.tagline %}<small>{{page.tagline}}</small>{% endif %}</h1>
2+
<h1>{{ page.title }} <small>Supporting tagline</small></h1>
33
</div>
44

5-
<div class="row-fluid post-full">
6-
<div class="span12">
7-
<div class="date">
8-
<span>{{ page.date | date_to_long_string }}</span>
9-
</div>
10-
<div class="content">
11-
{{ content }}
12-
</div>
13-
14-
{% unless page.categories == empty %}
15-
<ul class="tag_box inline">
16-
<li><i class="icon-folder-open"></i></li>
17-
{% assign categories_list = page.categories %}
18-
{% include JB/categories_list %}
19-
</ul>
20-
{% endunless %}
21-
22-
{% unless page.tags == empty %}
23-
<ul class="tag_box inline">
24-
<li><i class="icon-tags"></i></li>
25-
{% assign tags_list = page.tags %}
26-
{% include JB/tags_list %}
27-
</ul>
28-
{% endunless %}
29-
5+
<div class="row">
6+
<div class="span8">
7+
{{ content }}
308
<hr>
319
<div class="pagination">
3210
<ul>
@@ -44,6 +22,24 @@ <h1>{{ page.title }} {% if page.tagline %}<small>{{page.tagline}}</small>{% endi
4422
</ul>
4523
</div>
4624
<hr>
25+
26+
<div class="post-sharing">
27+
{% include JB/sharing %}
28+
</div>
29+
4730
{% include JB/comments %}
4831
</div>
32+
33+
<div class="span4">
34+
<h4>Published</h4>
35+
<div class="date"><span>{{ page.date | date_to_long_string }}</span></div>
36+
37+
{% unless page.tags == empty %}
38+
<h4>Tags</h4>
39+
<ul class="tag_box">
40+
{% assign tags_list = page.tags %}
41+
{% include JB/tags_list %}
42+
</ul>
43+
{% endunless %}
44+
</div>
4945
</div>

0 commit comments

Comments
 (0)