Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加网易云音乐插件,并修改微博插件样式 #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions languages/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ page: Page %d
recent_posts: Recent Posts
menu: Menu
weibo: Weibo
music: music
links: Links
rss: RSS
showsidebar: Show Sidebar
Expand Down
1 change: 1 addition & 0 deletions languages/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ recent_posts: 近期文章
menu: 菜单
links: 友情链接
weibo: 新浪微博
music: 云音乐
rss: RSS 订阅
showsidebar: 显示侧边栏
hidesidebar: 隐藏侧边栏
Expand Down
1 change: 1 addition & 0 deletions languages/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ recent_posts: 近期文章
menu: 菜單
links: 友情鏈接
weibo: 新浪微博
music: 雲音楽
rss: RSS 訂閱
showsidebar: 顯示側邊欄
hidesidebar: 隱藏側邊欄
Expand Down
37 changes: 29 additions & 8 deletions layout/_partial/after_footer.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script src="<%- config.root %>js/jquery-2.0.3.min.js"></script>
<script src="<%- config.root %>js/jquery.imagesloaded.min.js"></script>
<script src="<%- config.root %>js/gallery.js"></script>
<script src="<%- config.root %>js/jquery.qrcode-0.12.0.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
Expand Down Expand Up @@ -90,8 +91,8 @@ $(document).ready(function(){
tsina = $this.attr('data-tsina'),
description = $this.attr('description');
var html = [
'<a href="#" class="overlay" id="qrcode"></a>',
'<div class="qrcode clearfix"><span>扫描二维码分享到微信朋友圈</span><a class="qrclose" href="#nothing"></a><strong>Loading...Please wait</strong><img id="qrcode-pic" data-src="http://s.jiathis.com/qrcode.php?url=' + encodedUrl + '"/></div>',
'<div class="hoverqrcode clearfix"></div>',
'<a class="overlay" id="qrcode"></a>',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件的代码,修改了二维码, 与网易云插件代码不相关,所以最好移除这部分的修改。

'<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
'<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
'<a href="#qrcode" class="article-share-qrcode" title="微信"></a>',
Expand All @@ -100,14 +101,34 @@ $(document).ready(function(){
'<span title="Share to"></span>'
].join('');
$this.append(html);

$('.hoverqrcode').hide();

var myWidth = 0;
function updatehoverqrcode(){
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
} else if( document.documentElement && document.documentElement.clientWidth) {
myWidth = document.documentElement.clientWidth;
};
var qrsize = myWidth > 1024 ? 200:100;
var options = {render: 'image', size: qrsize, fill: '#2ca6cb', text: url, radius: 0.5, quiet: 1};
var p = $('.article-share-qrcode').position();
$('.hoverqrcode').empty().css('width', qrsize).css('height', qrsize)
.css('left', p.left-qrsize/2+20).css('top', p.top-qrsize-10)
.qrcode(options);
};
$(window).resize(function(){
$('.hoverqrcode').hide();
});
$('.article-share-qrcode').click(function(){
var imgSrc = $('#qrcode-pic').attr('data-src');
$('#qrcode-pic').attr('src', imgSrc);
$('#qrcode-pic').load(function(){
$('.qrcode strong').text(' ');
});
updatehoverqrcode();
$('.hoverqrcode').toggle();
});
$('.article-share-qrcode').hover(function(){}, function(){
$('.hoverqrcode').hide();
});
});
});
</script>
<% } %>

Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<a href="https://www.douban.com/people/<%=theme.author.douban %>" target="_blank" class="icon-douban" title="豆瓣"></a>
<% } %>
<% if(theme.author.zhihu){ %>
<a href="https://www.zhihu.com/people/<%=theme.author.zhihu %>" target="_blank" class="icon-zhihu" title="知乎"></a>
<a href="http://www.zhihu.com/people/<%=theme.author.zhihu %>" target="_blank" class="icon-zhihu" title="知乎"></a>
<% } %>
<% if(theme.author.google_plus){ %>
<a href="https://plus.google.com/<%=theme.author.google_plus %>?rel=author" target="_blank" class="icon-google_plus" title="Google+"></a>
Expand Down
4 changes: 4 additions & 0 deletions layout/_widget/music.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="music">
<p class="asidetitle"><%= __('music') %></p>
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=100% height=52 src="http://music.163.com/outchain/player?type=0&id=<%= theme.author.music_id %>&auto=1&height=32"></iframe>
</div>
4 changes: 2 additions & 2 deletions layout/_widget/weibo.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="weiboshow">
<p class="asidetitle"><%= __('weibo') %></p>
<iframe width="100%" height="119" class="share_self" frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=119&fansRow=2&ptype=1&speed=0&skin=9&isTitle=1&noborder=1&isWeibo=0&isFans=0&uid=<%= theme.author.tsina %>&verifier=<%- theme.author.weibo_verifier %>&dpc=1"></iframe>
</div>
<iframe width="100%" height="550" class="share_self" frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=550&fansRow=2&ptype=1&speed=0&skin=1&isTitle=1&noborder=0&isWeibo=1&isFans=0&uid=<%= theme.author.tsina %>&verifier=<%- theme.author.weibo_verifier %>&dpc=1"></iframe>
</div>
14 changes: 14 additions & 0 deletions source/css/_partial/aside.styl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@
iframe
padding 0.5em 0

//netease-music
.music
margin-top 0.5em
@media mini
width 45%
float left
margin 0 5% 0 0
@media tablet
width 100%
float none
margin 1em 0 0
iframe
padding 0.5em 0

//douban
.doubanshow
margin-top 0.5em
Expand Down