Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
v4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gogobody committed Sep 27, 2021
1 parent e4498ae commit 3bc4c88
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 45 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## onecircle 一个圈子,基于typecho

## 名字就叫一个圈子。
## version:4.4
## version:4.6
## 平台:typecho

### 想弄一个类社交圈子,开发了一部分,剩下慢慢折腾

## 下载说明:
4.0 之后懒得发 release 了,直接下载。如果是更新,把主题插件全部禁用启用一遍。
4.0 之后懒得发 release 了,直接下载。如果是更新,把主题插件全部禁用启用一遍。 更新建议看看 changeLog
必须装的:
[主题最新版下载](https://github.com/gogobody/onecircle/archive/refs/heads/master.zip)
[主题配套插件下载](https://github.com/gogobody/OneCircle_Plugin/archive/refs/heads/main.zip)
Expand Down Expand Up @@ -63,6 +63,7 @@ v2.8 添加 lazyload ,将默认的gallery 原始的background显示方式迁
v3.0 支持博客页
...
v4.3 支持私聊,支持 joe 主题编辑器(已获得作者授权),xxx 一系列更新
v4.6 修复登录bug,添加十年之约(更新,插件、主题)

## 关于文章类型
目前文章有一个自定义字段:
Expand Down
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<div class="outer">
<div class="react-tabs" data-tabs="true">
<div class="line"></div>
<ul class="react-tabs__tab-list">
<ul class="react-tabs__tab-list" id="archive_tabs">
<li id="react-tabs-1" data-tabindex="0" class="react-tabs__tab <?if($tabIndex==0){_e("react-tabs__tab--selected");}?>">动态</li>
<?php if ($this->is('author')):?>
<li id="react-tabs-2" data-tabindex="1" class="react-tabs__tab <?if($tabIndex==1){_e("react-tabs__tab--selected");}?>">关注</li>
Expand Down
2 changes: 1 addition & 1 deletion assets/css/onecircle.min.css

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions assets/css/onecircle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3895,6 +3895,27 @@ blog
transition: transform 0.35s, -webkit-transform 0.35s;
font-size: 14px;
}

.content-action{
position: relative;
}
.tenyear-hole {
color: #fff;
padding: 20px;
border-radius: 12px;
background: #000 url(/usr/themes/onecircle/assets/img/wormhole_1.gif) no-repeat right 20px center;
margin-bottom: 8px;
}

.tenyear-hole .text {
margin-right: 90px;
line-height: 20px;
height: 20px;
word-break: break-all;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
/**
usercenter
*/
Expand Down
Binary file added assets/img/wormhole_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 133 additions & 6 deletions assets/js/onecircle.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ $(function () {
});
})

Date.prototype.format = function(fmt) {
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt)) {
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}
for(var k in o) {
if(new RegExp("("+ k +")").test(fmt)){
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
}
}
return fmt;
}

var indexInput = {
init: function () {
Expand Down Expand Up @@ -122,6 +142,7 @@ var indexInput = {
this.hightInit()
this.annouceInit()
},

resetInputStatus: function () {// reset status when change nowtype
this.additionArray = []

Expand Down Expand Up @@ -279,6 +300,47 @@ var indexInput = {
}
})
},
load_10years_blog: function (page,load=false) {
if (load){
$(".j-loadmore a").text('loading...')
}
$.post({
url: gconf.index,
data:{
recommendRest: 1,
type: "fetch10apis",
page: page,
},
success: function (res) {
res=JSON.parse(res);
if (res.code===1){
let data = res.data.data;
let current_page= res.data.current_page;
let total_page = res.data.last_page;
let genhtml='';
data.forEach(function (ele) {
let tmp = `<article class="post-article"><div class="post-article-left"><a href="javascript:void(0);"><img class="avatar" src="${ele.avatar}" alt="${ele.author}"></a></div><div class="post-article-right"><div class="post-author"><div class="author-name"><a href="javascript:void(0);">${ele.author}</a></div><div class="post-addr"><a href="javascript:void(0);"><time>${new Date(ele.created_at).format("yyyy-MM-dd hh:mm")}</time></a></div></div><div class="post-content"><div class="row"><div class="post-content-inner-link col-xl-12"><p></p><div class=""><p>${ele.desc?ele.desc:ele.title}</p><a class="link-a" href="${ele.link}" target="_blank"><div class="link-container link-a"><div class="link-banner"><img src="/usr/themes/onecircle/assets/img/link.png"><div class="link-text">${ele.title}</div></div></div></a></div><p></p></div></div></div></div></article>`;
genhtml=genhtml+tmp;
})
let next = current_page+1;
if(next < total_page){
genhtml=genhtml+`<div class="j-loadmore" data-type="article"><a onclick="indexInput.load_10years_blog(${next},true)" class="next" title="">查看更多</a></div>`;
}
if(load){
// 删掉之前的 load
$(".j-loadmore").remove();
$(".item-container").append(genhtml);
}else{
$(".item-container").html(genhtml);
}
}
$.rmloading();
index_tab_loadfinish=true;
$(".j-loadmore a").text('查看更多')

}
})
},
indexEventInit: function () {
// init input
var that = this
Expand Down Expand Up @@ -362,7 +424,7 @@ var indexInput = {
renderItem: function (item, search) {
// search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
// var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
var tmpArr = new Array()
var tmpArr = []
tmpArr[0] = item[0]
tmpArr[1] = item[1]
if (item[1] === -1) {
Expand Down Expand Up @@ -445,7 +507,73 @@ var indexInput = {
$('.joe_aside__item.flatterer .change').on('click', () => toggle());
}
}
{

let react_tabs = $("#recommend-tabs")
if (react_tabs.length > 0) {
const baseoffset = react_tabs.first().offset().left;
const line = $('.line');
clicktabs=-1;// 防止重复点击
index_tab_loadfinish=false;
react_tabs.children().each(function (index, val) {
$(val).click(function (e) {
var tabindex = $(val).data("tabindex")
$(this).addClass('react-tabs__tab--selected').siblings().removeClass('react-tabs__tab--selected');
line.width($(val).width());
var left = $(val).offset().left - baseoffset;
line.css({
'transform': 'translateX(' + left + 'px)'
})
if(tabindex === clicktabs && index_tab_loadfinish === false) return;
clicktabs = tabindex;
index_tab_loadfinish=false;
// gen url
let tmp_url='';
$.showloading({
selector:'.react-tabs .item-container',
choice: 'prepend'
})
if(tabindex===0){
tmp_url = '/';
$.ajax({
url: tmp_url,
method: 'get',
success: function (res) {
var html_node = $.parseHTML(res)
try {
var items = $(".item-container", html_node)
if (items.length <= 0) {
return $.message({
title: "通知",
message: "服务器返回错误,请重试",
type: "error"
})
} else {
var real_html = items.html()
$(".item-container").html(real_html)
// 删除某个前缀开头的类
var archiveContent = $(".archive-content")
archiveContent.removeClass(function (index, className) {
return (className.match(/(^|\s)tabindex-\S+/g) || []).join('');
});
archiveContent.addClass('tabindex-' + tabindex)
}
} catch (e) {
console.log(e)
}
$.rmloading();
index_tab_loadfinish=true
}
})
}else if(tabindex===1){
let page = 1;
indexInput.load_10years_blog(page)
}

})
})
}
}
},
searchEventInit: function () {
// search blk
Expand Down Expand Up @@ -1025,7 +1153,6 @@ var archiveInit = {
setTimeout(function () { // 延迟100s 让css 充分渲染
var baseoffset = react_tabs.first().offset().left
var init_offset = react_tabs_li.first().offset().left - baseoffset
// alert(baseoffset+", "+react_tabs_li.first().offset().left +", "+init_offset)
var line = $('.line')
line.css({
'transform': 'translateX(' + init_offset + 'px)'
Expand All @@ -1042,11 +1169,11 @@ var archiveInit = {
},
archAuthorTabsClickInit: function () {
// archive tabs
var that = this
var react_tabs = $(".react-tabs__tab-list")
let that = this
let react_tabs = $("#archive_tabs")
if (react_tabs.length > 0) {
var baseoffset = react_tabs.first().offset().left
var line = $('.line')
const baseoffset = react_tabs.first().offset().left;
const line = $('.line');
react_tabs.children().each(function (index, val) {
$(val).click(function (e) {
var tabindex = $(val).data("tabindex")
Expand Down
Loading

0 comments on commit 3bc4c88

Please sign in to comment.