Browse Source

first commit

Ubuntu 8 years ago
parent
commit
02a0cb5afa

+ 7 - 2
README.md

@@ -1,2 +1,7 @@
-# hexo-theme-diaspora
-A clear theme for Hexo http://fech.in
+# Diaspora
+
+A [Hexo](https://hexo.io/) theme based on [Diaspora](https://github.com/LoeiFy/Diaspora), licensed under the MIT License (same as the original theme).
+
+Thanks original auther @Loeify .
+
+- [Preview](http://fech.in)

+ 23 - 0
_config.yml

@@ -0,0 +1,23 @@
+# Header Menu. title: link
+menu:
+  About: /about
+  Github: https://github.com/Fechin
+  Twitter: https://twitter.com/FechinLi
+
+
+# 查看文章时是否自动播放音乐
+autoplay: true
+# 博客文章默认音乐, 优先级: 1.文章头mp3参数> 2.在这里配置
+mp3: http://link.hhtjim.com/163/425570952.mp3
+# 首页封面图, 优先级: 1.在这里配置> 2.文章头cover参数;
+welcome_cover: /img/welcome-cover.jpg
+# 文章封面图, 优先级: 1.文章头cover参数 > 2.在这里配置
+cover: /img/cover.jpg
+
+
+keywords: 
+# 要使用google_analytics进行统计的话,这里需要配置ID
+google_analytics: 
+# 网站ico
+favicon: /img/favicon.png
+rss: atom.xml

+ 19 - 0
languages/default.yml

@@ -0,0 +1,19 @@
+categories: Categories
+search: Search
+tags: Tags
+tagcloud: Tag Cloud
+tweets: Tweets
+prev: Prev
+next: Next
+comment: Comments
+archive_a: Archives
+archive_b: "Archives: %s"
+page: Page %d
+recent_posts: Recent Posts
+newer: Newer
+older: Older
+share: Share
+powered_by: Powered by
+rss_feed: RSS Feed
+category: Category
+tag: Tag

+ 19 - 0
languages/fr.yml

@@ -0,0 +1,19 @@
+categories: Catégories
+search: Rechercher
+tags: Mot-clés
+tagcloud: Nuage de mot-clés
+tweets: Tweets
+prev: Précédent
+next: Suivant
+comment: Commentaires
+archive_a: Archives
+archive_b: "Archives: %s"
+page: Page %d
+recent_posts: Articles récents
+newer: Récent
+older: Ancien
+share: Partager
+powered_by: Propulsé by
+rss_feed: Flux RSS
+category: Catégorie
+tag: Mot-clé

+ 20 - 0
languages/nl.yml

@@ -0,0 +1,20 @@
+
+categories: Categorieën
+search: Zoeken
+tags: Labels
+tagcloud: Tag Cloud
+tweets: Tweets
+prev: Vorige
+next: Volgende
+comment: Commentaren
+archive_a: Archieven
+archive_b: "Archieven: %s"
+page: Pagina %d
+recent_posts: Recente berichten
+newer: Nieuwer
+older: Ouder
+share: Delen
+powered_by: Powered by
+rss_feed: RSS Feed
+category: Categorie
+tag: Label

+ 19 - 0
languages/no.yml

@@ -0,0 +1,19 @@
+categories: Kategorier
+search: Søk
+tags: Tags
+tagcloud: Tag Cloud
+tweets: Tweets
+prev: Forrige
+next: Neste
+comment: Kommentarer
+archive_a: Arkiv
+archive_b: "Arkiv: %s"
+page: Side %d
+recent_posts: Siste innlegg
+newer: Newer
+older: Older
+share: Share
+powered_by: Powered by
+rss_feed: RSS Feed
+category: Category
+tag: Tag

+ 19 - 0
languages/ru.yml

@@ -0,0 +1,19 @@
+categories: Категории
+search: Поиск
+tags: Метки
+tagcloud: Облако меток
+tweets: Твиты
+prev: Назад
+next: Вперед
+comment: Комментарии
+archive_a: Архив
+archive_b: "Архив: %s"
+page: Страница %d
+recent_posts: Недавние записи
+newer: Следующий
+older: Предыдущий
+share: Поделиться
+powered_by: Создано с помощью
+rss_feed: RSS-каналы
+category: Категория
+tag: Метка

+ 19 - 0
languages/zh-CN.yml

@@ -0,0 +1,19 @@
+categories: 分类
+search: 搜索
+tags: 标签
+tagcloud: 标签云
+tweets: 推文
+prev: 上一页
+next: 下一页
+comment: 留言
+archive_a: 归档
+archive_b: 归档:%s
+page: 第 %d 页
+recent_posts: 最新文章
+newer: Newer
+older: Older
+share: Share
+powered_by: Powered by
+rss_feed: RSS Feed
+category: Category
+tag: Tag

+ 19 - 0
languages/zh-TW.yml

@@ -0,0 +1,19 @@
+categories: 分類
+search: 搜尋
+tags: 標籤
+tagcloud: 標籤雲
+tweets: 推文
+prev: 上一頁
+next: 下一頁
+comment: 留言
+archive_a: 彙整
+archive_b: 彙整:%s
+page: 第 %d 頁
+recent_posts: 最新文章
+newer: Newer
+older: Older
+share: Share
+powered_by: Powered by
+rss_feed: RSS Feed
+category: Category
+tag: Tag

BIN
layout/.DS_Store


BIN
layout/_partial/.DS_Store


+ 14 - 0
layout/_partial/google-analytics.ejs

@@ -0,0 +1,14 @@
+<% if (theme.google_analytics){ %>
+<!-- Google Analytics -->
+<script type="text/javascript">
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ga('create', '<%= theme.google_analytics %>', 'auto');
+ga('send', 'pageview');
+
+</script>
+<!-- End Google Analytics -->
+<% } %>

+ 39 - 0
layout/_partial/head.ejs

@@ -0,0 +1,39 @@
+<%
+var keywords = '';
+var description = '';
+(function() {
+    if (theme.keywords) {
+        keywords += theme.keywords;
+        keywords += ',';
+    }
+    if (page.keywords) {
+        keywords += page.keywords;
+    }
+    if (config.description) {
+        description += config.description;
+        description += ',';
+    }
+    if  (is_post()) {
+        description += truncate(strip_html(page.content), {length: 100, omission: ','});
+    }
+})();
+%>
+<!DOCTYPE html>
+<html lang="<%= config.language %>" class="loading">
+<head>
+    <meta charset="UTF-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
+    <title><%= config.title %><% if (config.subtitle){ %> - <%- config.subtitle %><%}%></title>
+
+    <meta name="apple-mobile-web-app-capable" content="yes" />
+    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
+    <meta name="google" content="notranslate" />
+    <% if (keywords) { %><meta name="keywords" content="<%= keywords %>"> <% } %>
+    <% if (description) { %><meta name="description" content="<%= description %>"> <% } %>
+    <% if (config.author){ %><meta name="author" content="<%= config.author %>"> <% } %>
+    <% if (theme.rss){ %><link rel="alternative" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml"> <% } %>
+    <% if (theme.favicon){ %><link rel="icon" href="<%- url_for(theme.favicon) %>"> <% } %>
+    <%- css(['css/diaspora'])%>
+
+</head>

+ 8 - 0
layout/_partial/list.ejs

@@ -0,0 +1,8 @@
+<%
+    page.posts.sort("date", "desc").each(function(post, i){
+    if (page.prev == 0 && i < start) {
+        return true;
+    }
+%>
+<%- partial('post/item', {post: post}) %>
+<% }) %>

+ 15 - 0
layout/_partial/menu.ejs

@@ -0,0 +1,15 @@
+<div class="nav">
+    <ul id="menu-menu" class="menu">
+        <% for (var i in theme.menu){ %>
+        <li class="pview menu-item menu-item-type-post_type menu-item-object-page">
+            <%- link_to(url_for(theme.menu[i]), i)%>
+        </li>
+        <%}%>
+    </ul>
+    <p>
+        &copy; <%= date(new Date(), 'YYYY') %> <%= config.author || config.title %>.
+        Powered by <%- link_to("http://hexo.io/", "Hexo", {external: true})%>
+        Theme <%- link_to("https://github.com/Fechin/diaspora", "Diaspora", {external: true})%>
+        by Fechin
+    </p>
+</div>

+ 16 - 0
layout/_partial/post/article.ejs

@@ -0,0 +1,16 @@
+<div class="article">
+    <div>
+        <h1 class="title"><%- page.title %></h1>
+        <div class="stuff">
+            <span><%- page.date.locale("zh-cn").format("MMMM DD, YYYY") %></span>
+        </div>
+        <div class="content markdown">
+            <%- page.content %>
+            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
+            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="<%- theme.autoplay || "false" %>">
+                <source type="audio/mpeg" src="<%- page.mp3 || theme.mp3 %>">
+            </audio>
+        </div>
+        <!--<div class="comment link">添加评论</div>-->
+    </div>
+</div>

+ 18 - 0
layout/_partial/post/header.ejs

@@ -0,0 +1,18 @@
+<div id="top" style="display: block;">
+    <div class="bar" style="width: 0;"></div>
+    <a class="icon-home image-icon" href="javascript:;"></a>
+    <div title="播放/暂停" class="icon-play"></div>
+    <h3 class="subtitle"><%- page.title %></h3>
+    <div class="social">
+        <!--<div class="like-icon">-->
+            <!--<a href="javascript:;" class="likeThis active"><span class="icon-like"></span><span class="count">76</span></a>-->
+        <!--</div>-->
+        <div>
+            <div class="share">
+                <a title="获取二维码" class="icon-scan" href="javascript:;"></a>
+            </div>
+            <div id="qr"></div>
+        </div>
+    </div>
+    <div class="scrollbar"></div>
+</div>

+ 10 - 0
layout/_partial/post/item.ejs

@@ -0,0 +1,10 @@
+<div class="post">
+    <a href="<%- url_for(post.path) %>" title="<%- post.title || "Untitled" %>">
+        <%- image_tag(post.cover || theme.cover, {class: "cover", width: 680, height: 440}) %>
+    </a>
+    <div class="else">
+        <p><%- post.date.locale("zh-cn").format("MMMM DD, YYYY") %></p>
+        <h3><%- link_to(url_for(post.path), post.title || "Untitled", {class: "posttitle"}) %></h3>
+        <p><%- truncate(strip_html(post.content), {length: 120, omission: '...'}) %></p>
+    </div>
+</div>

+ 26 - 0
layout/_partial/screen.ejs

@@ -0,0 +1,26 @@
+<% var first = site.posts.sort("date", "desc").eq(0); %>
+<div id="screen">
+    <div id="mark">
+        <div class="layer" data-depth="0.4">
+            <%- image_tag(theme.welcome_cover || first.cover, {id: "cover", crossorigin: "anonymous", width: 1920, height: 1080}) %>
+        </div>
+    </div>
+    <div id="vibrant">
+        <svg viewBox="0 0 2880 1620" height="100%" preserveAspectRatio="xMaxYMax slice">
+            <polygon opacity="0.7" points="2000,1620 0,1620 0,0 600,0 "/>
+        </svg>
+        <div></div>
+    </div>
+    <div id="header">
+        <div>
+            <a class="image-logo" href="/"></a>
+            <div class="icon-menu switchmenu"></div>
+        </div>
+    </div>
+    <% if ( first ) { %>
+    <div id="post0">
+        <p><%- first.date.locale("zh-cn").format("MMMM DD, YYYY") %></p>
+        <h2><%- link_to(url_for(first.path), first.title || config.title, {class: "posttitle"}) %></h2>
+    </div>
+    <% } %>
+</div>

+ 1 - 0
layout/_partial/scripts.ejs

@@ -0,0 +1 @@
+<%- js(['js/jquery.min.js', 'js/plugin.js', 'js/diaspora.js'])%>

+ 0 - 0
layout/archive.ejs


+ 0 - 0
layout/category.ejs


+ 11 - 0
layout/index.ejs

@@ -0,0 +1,11 @@
+<%- partial("_partial/menu", null, {cache: true}) %>
+<div id="container">
+    <%- partial("_partial/screen", null, {cache: true}) %>
+    <div id="primary">
+        <%- partial('_partial/list', {start: 1}) %>
+    </div>
+    <% if (page.total > 1 && page.next_link){ %>
+    <div id="pager"><a href="<%- url_for(page.next_link) %>" class="more">加载更多</a></div>
+    <% } %>
+</div>
+<div id="preview" class="trans"></div>

+ 8 - 0
layout/layout.ejs

@@ -0,0 +1,8 @@
+<%- partial('_partial/head', null, {cache: true}) %>
+<body class="loading">
+    <div id="loader"></div>
+    <%- body %>
+</body>
+<%- partial('_partial/scripts', null, {cache: true}) %>
+<%- partial("_partial/google-analytics", {cache: true}) %>
+</html>

+ 15 - 0
layout/page.ejs

@@ -0,0 +1,15 @@
+<div id="single" class="page">
+    <div id="top">
+        <a class="icon-left image-icon" href="javascript:history.back()"></a>
+    </div>
+    <div class="section">
+        <div class="images">
+        </div><div class="article">
+            <div>
+                <div class="content">
+                    <%- page.content %>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 6 - 0
layout/post.ejs

@@ -0,0 +1,6 @@
+<div id="single">
+    <%- partial("_partial/post/header")%>
+    <div class="section">
+        <%- partial("_partial/post/article")%>
+    </div>
+</div>

+ 0 - 0
layout/tag.ejs


BIN
source/.DS_Store


BIN
source/css/.DS_Store


File diff suppressed because it is too large
+ 209 - 0
source/css/diaspora.css


BIN
source/img/.DS_Store


BIN
source/img/cover.jpg


BIN
source/img/favicon.png


BIN
source/img/logo.png


BIN
source/img/welcome-cover.jpg


+ 527 - 0
source/js/diaspora.js

@@ -0,0 +1,527 @@
+/*
+ * Diaspora
+ * @author LoeiFy
+ * @url http://lorem.in
+ */
+var Home = location.href,
+    Pages = 4,
+    xhr,
+    xhrUrl = '';
+
+var Diaspora = {
+
+    L: function(url, f, err) {
+        if (url == xhrUrl) {
+            return false
+        }
+
+        xhrUrl = url;
+
+        if (xhr) {
+            xhr.abort()
+        }
+
+        xhr = $.ajax({
+            type: 'GET',
+            url: url,
+            timeout: 10000,
+            success: function(data) {
+                f(data)
+                xhrUrl = '';
+            },
+            error: function(a, b, c) {
+                if (b == 'abort') {
+                    err && err()
+                } else {
+                    window.location.href = url
+                }
+                xhrUrl = '';
+            }
+        })
+    },
+
+    P: function() {
+        return !!('ontouchstart' in window);
+    },
+
+    PS: function() {
+        if (!(window.history && history.pushState)) return;
+
+        history.replaceState({u: Home, t: document.title}, document.title, Home)
+
+        window.addEventListener('popstate', function(e) {
+            var state = e.state;
+
+            if (!state) return;
+
+            document.title = state.t;
+
+            if (state.u == Home) {
+                $('#preview').css('position', 'fixed')
+                setTimeout(function() {
+                    $('#preview').removeClass('show').addClass('trans')
+                    $('#container').show()
+                    window.scrollTo(0, parseInt($('#container').data('scroll')))
+                    setTimeout(function() {
+                        $('#preview').html('')
+                        $(window).trigger('resize')
+                    }, 300)
+                }, 0)
+            } else {
+                Diaspora.loading()
+
+                Diaspora.L(state.u, function(data) {
+
+                    document.title = state.t;
+
+                    $('#preview').html($(data).filter('#single'))
+
+                    Diaspora.preview()
+
+                    setTimeout(function() { Diaspora.player() }, 0)
+                })
+            }
+
+        })
+    },
+
+    HS: function(tag, flag) {
+        var id = tag.data('id') || 0,
+            url = tag.attr('href'),
+            title = tag.attr('title') || tag.text();
+
+        if (!$('#preview').length || !(window.history && history.pushState)) location.href = url;
+
+        Diaspora.loading()
+
+        var state = {d: id, t: title, u: url};
+
+        Diaspora.L(url, function(data) {
+
+            if (!$(data).filter('#single').length) {
+                location.href = url;
+                return
+            }
+
+            switch (flag) {
+
+                case 'push':
+                    history.pushState(state, title, url)
+                    break;
+
+                case 'replace':
+                    history.replaceState(state, title, url)
+                    break;
+
+            }
+
+            document.title = title;
+
+            $('#preview').html($(data).filter('#single'))
+
+            switch (flag) {
+
+                case 'push':
+                    Diaspora.preview()
+                    break;
+
+                case 'replace':
+                    window.scrollTo(0, 0)
+                    Diaspora.loaded()
+                    break;
+            }
+
+            setTimeout(function() {
+                Diaspora.player()
+
+                if (flag == 'replace') {
+                    $('#top').show()
+                }
+            }, 0)
+
+        })
+    },
+
+    preview: function() {
+        setTimeout(function() {
+            $('#preview').addClass('show')
+            $('#container').data('scroll', window.scrollY)
+            setTimeout(function() {
+                $('#container').hide()
+                setTimeout(function() {
+                    $('#preview').css({
+                        'position': 'static',
+                        'overflow-y': 'auto'
+                    }).removeClass('trans')
+                    $('#top').show()
+
+                    Diaspora.loaded()
+                }, 500)
+            }, 300)
+        }, 0)
+    },
+
+    player: function() {
+        var p = $('#audio');
+
+        if (!p.length) {
+            $('.icon-play').css({
+                'color': '#dedede',
+                'cursor': 'not-allowed'
+            })
+            return
+        }
+
+        if (p.eq(0).data("autoplay") == true) {
+            p[0].play();
+        }
+
+        p.on({
+            'timeupdate': function() {
+                var progress = p[0].currentTime / p[0].duration * 100;
+                $('.bar').css('width', progress + '%');
+                if (progress / 5 <= 1) {
+                    p[0].volume = progress / 5;
+                }else {
+                    p[0].volume = 1;
+                }
+            },
+            'ended': function() {
+                $('.icon-pause').removeClass('icon-pause').addClass('icon-play')
+            },
+            'playing': function() {
+                $('.icon-play').removeClass('icon-play').addClass('icon-pause')
+            }
+        })
+    },
+
+    loading: function() {
+        var w = window.innerWidth;
+        var css = '<style class="loaderstyle" id="loaderstyle'+ w +'">'+
+            '@-moz-keyframes loader'+ w +'{100%{background-position:'+ w +'px 0}}'+
+            '@-webkit-keyframes loader'+ w +'{100%{background-position:'+ w +'px 0}}'+
+            '.loader'+ w +'{-webkit-animation:loader'+ w +' 3s linear infinite;-moz-animation:loader'+ w +' 3s linear infinite;}'+
+            '</style>';
+        $('.loaderstyle').remove()
+        $('head').append(css)
+
+        $('#loader').removeClass().addClass('loader'+ w).show()
+    },
+
+    loaded: function() {
+        $('#loader').removeClass().hide()
+    },
+
+    F: function(id, w, h) {
+        var _height = $(id).parent().height(),
+            _width = $(id).parent().width(),
+            ratio = h / w;
+
+        if (_height / _width > ratio) {
+            id.style.height = _height +'px';
+            id.style.width = _height / ratio +'px';
+        } else {
+            id.style.width = _width +'px';
+            id.style.height = _width * ratio +'px';
+        }
+
+        id.style.left = (_width - parseInt(id.style.width)) / 2 +'px';
+        id.style.top = (_height - parseInt(id.style.height)) / 2 +'px';
+    }
+
+}
+
+$(function() {
+
+    if (Diaspora.P()) {
+        $('body').addClass('touch')
+    }
+
+    if ($('#preview').length) {
+
+        var cover = {};
+        cover.t = $('#cover');
+        cover.w = cover.t.attr('width');
+        cover.h = cover.t.attr('height');
+
+        ;(cover.o = function() {
+            $('#mark').height(window.innerHeight)
+        })();
+
+        if (cover.t.prop('complete')) {
+            // why setTimeout ?
+            setTimeout(function() { cover.t.load() }, 0)
+        }
+
+        cover.t.on('load', function() {
+
+            ;(cover.f = function() {
+
+                var _w = $('#mark').width(), _h = $('#mark').height(), x, y, i, e;
+
+                e = (_w >= 1000 || _h >= 1000) ? 1000 : 500;
+
+                if (_w >= _h) {
+                    i = _w / e * 50;
+                    y = i;
+                    x = i * _w / _h;
+                } else {
+                    i = _h / e * 50;
+                    x = i;
+                    y = i * _h / _w;
+                }
+
+                $('.layer').css({
+                    'width': _w + x,
+                    'height': _h + y,
+                    'marginLeft': - 0.5 * x,
+                    'marginTop': - 0.5 * y
+                })
+
+                if (!cover.w) {
+                    cover.w = cover.t.width();
+                    cover.h = cover.t.height();
+                }
+
+                Diaspora.F($('#cover')[0], cover.w, cover.h)
+
+            })();
+
+            setTimeout(function() {
+                $('html, body').removeClass('loading')
+            }, 1000)
+
+            $('#mark').parallax()
+
+            var vibrant = new Vibrant(cover.t[0]);
+            var swatches = vibrant.swatches()
+
+            if (swatches['DarkVibrant']) {
+                $('#vibrant polygon').css('fill', swatches['DarkVibrant'].getHex())
+                $('#vibrant div').css('background-color', swatches['DarkVibrant'].getHex())
+            }
+            if (swatches['Vibrant']) {
+                $('.icon-menu').css('color', swatches['Vibrant'].getHex())
+            }
+
+        })
+
+        if (!cover.t.attr('src')) {
+            alert('Please set the post thumbnail')
+        }
+
+        $('#preview').css('min-height', window.innerHeight)
+
+        Diaspora.PS()
+
+        $('.pview a').addClass('pviewa')
+
+        var T;
+        $(window).on('resize', function() {
+            clearTimeout(T)
+
+            T = setTimeout(function() {
+                if (!Diaspora.P() && location.href == Home) {
+                    cover.o()
+                    cover.f()
+                }
+
+                if ($('#loader').attr('class')) {
+                    Diaspora.loading()
+                }
+            }, 500)
+        })
+
+    } else {
+
+        $('#single').css('min-height', window.innerHeight)
+
+        setTimeout(function() {
+            $('html, body').removeClass('loading')
+        }, 1000)
+
+        window.addEventListener('popstate', function(e) {
+
+            if (e.state) location.href = e.state.u;
+
+        })
+
+        Diaspora.player();
+
+        $('.icon-icon, .image-icon').attr('href', '/')
+
+        $('#top').show()
+
+    }
+
+    $(window).on('scroll', function() {
+        if ($('.scrollbar').length && !Diaspora.P() && !$('.icon-images').hasClass('active')) {
+            var st = $(window).scrollTop(),
+                ct = $('.content').height();
+
+            if (st > ct) {
+                st = ct
+            }
+
+            $('.scrollbar').width((50 + st) / ct * 100 +'%')
+
+            if (st > 80 && window.innerWidth > 800) {
+                $('.subtitle').fadeIn()
+            } else {
+                $('.subtitle').fadeOut()
+            }
+        }
+    })
+
+    $(window).on('touchmove', function(e) {
+        if ($('body').hasClass('mu')) {
+            e.preventDefault()
+        }
+    })
+
+    $('body').on('click', function(e) {
+        var tag = $(e.target).attr('class') || '',
+            rel = $(e.target).attr('rel') || '';
+
+        if (!tag && !rel) return;
+
+        switch (true) {
+
+            // nav menu
+            case (tag.indexOf('switchmenu') != -1):
+                window.scrollTo(0, 0)
+                $('html, body').toggleClass('mu');
+
+                break;
+
+            // next page
+            case (tag.indexOf('more') != -1):
+                tag = $('.more');
+
+                if (tag.data('status') == 'loading') {
+                    return false
+                }
+
+                var num = parseInt(tag.data('page')) || 1;
+
+                if (num == 1) {
+                    tag.data('page', 1)
+                }
+
+                if (num >= Pages) {
+                    return
+                }
+
+                tag.html('加载中..').data('status', 'loading')
+                Diaspora.loading()
+
+                Diaspora.L(tag.attr('href'), function(data) {
+                    var link = $(data).find('.more').attr('href');
+                    if (link != undefined) {
+                        tag.attr('href', link).html('加载更多').data('status', 'loaded')
+                        tag.data('page', parseInt(tag.data('page')) + 1)
+                    } else {
+                        $('#pager').remove()
+                    }
+
+                    $('#primary').append($(data).find('.post'))
+
+                    Diaspora.loaded()
+                }, function() {
+                    tag.html('加载更多').data('status', 'loaded')
+                })
+
+                return false;
+                break;
+
+            // home
+            case (tag.indexOf('icon-home') != -1):
+                if ($('#preview').hasClass('show')) {
+                    history.back();
+                } else {
+                    location.href = "/";
+                }
+                break;
+
+
+            // qrcode
+            case (tag.indexOf('icon-scan') != -1):
+                if ($('.icon-scan').hasClass('tg')) {
+                    $('#qr').toggle()
+                } else {
+                    $('.icon-scan').addClass('tg')
+                    $('#qr').qrcode({ width: 128, height: 128, text: location.href}).toggle()
+                }
+                break;
+
+            // audio play
+            case (tag.indexOf('icon-play') != -1):
+                $('#audio')[0].play()
+                $('.icon-play').removeClass('icon-play').addClass('icon-pause')
+                break;
+
+            // audio pause
+            case (tag.indexOf('icon-pause') != -1):
+                $('#audio')[0].pause()
+                $('.icon-pause').removeClass('icon-pause').addClass('icon-play')
+                break;
+
+
+            // history state
+            case (tag.indexOf('cover') != -1):
+                Diaspora.HS($(e.target).parent(), 'push')
+                return false;
+                break;
+
+            // history state
+            case (tag.indexOf('posttitle') != -1):
+                Diaspora.HS($(e.target), 'push')
+                return false;
+                break;
+
+            // relate post
+            case (tag.indexOf('relatea') != -1):
+                Diaspora.HS($(e.target), 'replace')
+                return false;
+                break;
+
+            // relate post
+            case (tag.indexOf('relateimg') != -1):
+                Diaspora.HS($(e.target).parent(), 'replace')
+                return false;
+                break;
+
+            // prev, next post
+            case (rel == 'prev' || rel == 'next'):
+                if (rel == 'prev') {
+                    var t = $('#prev_next a')[0].text
+                } else {
+                    var t = $('#prev_next a')[1].text
+                }
+                $(e.target).attr('title', t)
+
+                Diaspora.HS($(e.target), 'replace')
+                return false;
+                break;
+
+            // quick view
+            case (tag.indexOf('pviewa') != -1):
+                $('body').removeClass('mu')
+
+                setTimeout(function() {
+                    Diaspora.HS($(e.target), 'push')
+                }, 300)
+
+                return false;
+                break;
+
+            default:
+                return;
+                break;
+        }
+
+    })
+
+    console.log("%c Github %c","background:#24272A; color:#ffffff","","https://github.com/Fechin/hexo-theme-diaspora")
+
+})

File diff suppressed because it is too large
+ 1 - 0
source/js/jquery.min.js


File diff suppressed because it is too large
+ 7 - 0
source/js/plugin.js


Some files were not shown because too many files changed in this diff