Ultima attività 1 week ago

针对柳神更新后不适配anzhiyu主题的情况

LixdHappy's Avatar LixdHappy ha revisionato questo gist 1 week ago. Vai alla revisione

3 files changed, 424 insertions

fcircle.pug(file creato)

@@ -0,0 +1,63 @@
1 + if theme.friends_lite.enable
2 + link(rel="stylesheet", href=theme.friends_lite.fclite_css_url)
3 + style.
4 + #random-article {
5 + display: none!important;
6 + }
7 + .card:hover,
8 + #random-article:hover {
9 + border: var(--style-border-hover)!important;
10 + }
11 + #modal-author-name-link,
12 + .modal-article .modal-article-title:hover,
13 + .card-title:hover{
14 + color: var(--anzhiyu-theme)!important;
15 + }
16 + .modal-article,
17 + #modal-articles-container {
18 + border-top-color: var(--anzhiyu-theme)!important;
19 + border-bottom-color: var(--anzhiyu-theme)!important;
20 + }
21 + #load-more-btn:hover {
22 + background: var(--anzhiyu-theme)!important;
23 + }
24 + .card-title {
25 + margin-bottom: 16px!important;
26 + }
27 + .fcircle_page
28 + .author-content.author-content-item.fcirclePage.single(style=`background: url(${theme.friends_lite.top_background}) center / cover no-repeat !important;`)
29 + .card-content
30 + .author-content-item-tips 朋友圈
31 + span.author-content-item-title 最新文章订阅
32 + .content-bottom
33 + .tips= theme.friends_lite.top_tips
34 + .banner-button-group
35 + a.banner-button(onclick='pjax.loadUrl("/subscribe")')
36 + i.anzhiyufont.anzhiyu-icon-arrow-circle-right(style='font-size: 22px; margin-right: 0.25rem')
37 + span.banner-button-text(gbtip="查看本站的订阅方式") 订阅本站
38 + .title-h2-a
39 + .title-h2-a-left
40 + h2(style='padding-top:0;margin:.6rem 0 .6rem') 🎣 钓鱼
41 + a.random-post-start(gbtip="钓钓更健康" href='javascript:fetchRandomPost();')
42 + i.anzhiyufont.anzhiyu-icon-arrow-rotate-right
43 + .title-h2-a-right
44 + a.random-post-all( gbtip="查看本站的朋友们" href='/link/') 全部友链
45 + .fishing-card
46 + #friend-stats
47 + .fishing-tip 🎲 这里不给钓鱼( ̄^ ̄)
48 + #random-post
49 + .title-h2-a
50 + .title-h2-a-left
51 + h2 🐟 鱼塘
52 + #friend-circle-lite-root
53 +
54 + script.
55 + if (typeof UserConfig === 'undefined') {
56 + var UserConfig = {
57 + private_api_url: '#{theme.friends_lite.private_api_url}',
58 + page_turning_number: #{theme.friends_lite.page_turning_number},
59 + error_img: '#{theme.friends_lite.error_img}'
60 + }
61 + }
62 + script(src=theme.friends_lite.fclite_js_url)
63 + script(defer data-pjax src=url_for(theme.asset.random_friends_post_js))

friends.css(file creato)

@@ -0,0 +1,169 @@
1 + /* 顶部样式 */
2 + .fcircle_page .author-content.fcirclePage {
3 + height: 19rem;
4 + color: var(--anzhiyu-white);
5 + overflow: hidden;
6 + margin-top: 0px;
7 + }
8 + body[data-type="fcircle"] #web_bg {
9 + background-color: #f7f9fe;
10 + }
11 +
12 + [data-theme="dark"] body[data-type="fcircle"] #web_bg {
13 + background-color: #000;
14 + }
15 +
16 + body[data-type="fcircle"] #page .page-title {
17 + display: none;
18 + }
19 +
20 + body[data-type="fcircle"] #page {
21 + border: 0;
22 + box-shadow: none !important;
23 + padding: 0 !important;
24 + background: transparent !important;
25 + }
26 + .fcircle_page a {
27 + border-bottom: none !important;
28 + }
29 + .fcircle_page .cf-article-avatar a:hover {
30 + background: none !important;
31 + color: var(--anzhiyu-fontcolor) !important;
32 + }
33 + /* 随机文章样式 */
34 +
35 + .title-h2-a {
36 + display: flex;
37 + align-items: center;
38 + justify-content: space-between;
39 + margin-top: 0.5rem;
40 + }
41 + .title-h2-a-left {
42 + display: flex;
43 + align-items: center;
44 + }
45 + .title-h2-a-left h2 {
46 + margin-top: 0 !important;
47 + margin-bottom: 0 !important;
48 + }
49 + .title-h2-a a {
50 + margin-left: 0.5rem;
51 + color: var(--anzhiyu-fontcolor);
52 + font-weight: 700;
53 + }
54 + #article-container .title-h2-a a:hover {
55 + color: var(--anzhiyu-hovertext) !important;
56 + }
57 + .fcircle_page .title-h2-a-right a.random-post-all {
58 + color: var(--anzhiyu-fontcolor);
59 + }
60 + #cf-overshow.cf-show-now p a.cf-article-title:hover,
61 + .fcircle_page #fcircleContainer .cf-article a.cf-article-title:hover,
62 + .fcircle_page .title-h2-a-right a.random-post-all:hover,
63 + .fcircle_page .title-h2-a-left a.random-post-start:hover {
64 + background: none;
65 + box-shadow: none;
66 + color: var(--anzhiyu-theme);
67 + }
68 + .fcircle_page .fish-pond-item .cf-article .cf-article-title {
69 + line-height: 2;
70 + }
71 +
72 + /* 钓鱼统一卡片 */
73 + .fishing-card {
74 + background: var(--card-bg);
75 + border: var(--style-border-always);
76 + box-shadow: var(--anzhiyu-shadow-border);
77 + border-radius: 12px;
78 + margin-top: 8px;
79 + padding: 20px 30px;
80 + }
81 +
82 + /* 朋友圈统计 */
83 + #friend-stats .stats-grid {
84 + display: grid;
85 + grid-template-columns: repeat(4, 1fr);
86 + gap: 8px;
87 + }
88 +
89 + #friend-stats .stats-item {
90 + display: flex;
91 + flex-direction: column;
92 + align-items: center;
93 + justify-content: center;
94 + background: var(--anzhiyu-card-bg);
95 + border: var(--style-border-always);
96 + border-radius: 6px;
97 + padding: 12px 8px;
98 + transition: border-color 0.3s ease;
99 + cursor: default;
100 + }
101 +
102 + #friend-stats .stats-item:hover {
103 + border-color: var(--anzhiyu-theme);
104 + }
105 +
106 + #friend-stats .stats-num {
107 + font-size: 24px;
108 + font-weight: 700;
109 + color: var(--anzhiyu-theme);
110 + line-height: 1;
111 + margin-bottom: 4px;
112 + }
113 +
114 + #friend-stats .stats-label {
115 + font-size: 12px;
116 + color: var(--anzhiyu-fontcolor);
117 + opacity: 0.5;
118 + }
119 +
120 + .fishing-tip {
121 + margin-top: 12px;
122 + font-size: 14px;
123 + font-weight: 700;
124 + color: var(--anzhiyu-fontcolor);
125 + opacity: 0.5;
126 + border-top: 1px dashed var(--anzhiyu-theme);
127 + padding-top: 8px;
128 + }
129 +
130 + /* random-post 降级为内嵌区块 */
131 + .fishing-card #random-post {
132 + background: transparent;
133 + border: none;
134 + box-shadow: none;
135 + padding: 8px 0 0;
136 + margin-top: 0;
137 + border-radius: 0;
138 + }
139 +
140 + #random-post {
141 + min-height: 32px;
142 + background: var(--card-bg);
143 + border: var(--style-border-always);
144 + box-shadow: var(--anzhiyu-shadow-border);
145 + padding: 20px 30px;
146 + border-radius: 12px;
147 + margin-top: 8px;
148 + }
149 + #random-post .random-friends-post {
150 + text-decoration: none;
151 + border-bottom: 2px solid var(--anzhiyu-lighttext) !important;
152 + color: var(--anzhiyu-fontcolor);
153 + font-weight: 700;
154 + padding: 0 4px;
155 + }
156 + #random-post .random-friends-post:hover {
157 + text-decoration: none;
158 + border-bottom: 2px solid var(--anzhiyu-none) !important;
159 + color: var(--anzhiyu-white) !important;
160 + background: var(--anzhiyu-main) !important;
161 + border-radius: 4px;
162 + box-shadow: var(--anzhiyu-shadow-main);
163 + }
164 +
165 + @media screen and (max-width: 500px) {
166 + #friend-stats .stats-grid {
167 + grid-template-columns: repeat(2, 1fr);
168 + }
169 + }

random_friends_post.js(file creato)

@@ -0,0 +1,192 @@
1 + var fdata = { defaultFish: 100, hungryFish: 100 };
2 + if (typeof fdataUser !== "undefined") {
3 + for (var key in fdataUser) {
4 + if (fdataUser[key]) fdata[key] = fdataUser[key];
5 + }
6 + }
7 +
8 + var randomPostTimes = 0;
9 + var randomPostWorking = false;
10 + var randomPostTips = [
11 + "钓到了绝世好文!",
12 + "在河边打了个喷嚏,吓跑了",
13 + "你和小伙伴抢夺着",
14 + "你击败了巨龙,在巢穴中发现了",
15 + "挖掘秦始皇坟时找到了",
16 + "在路边闲逛的时候随手买了一个",
17 + "从学校班主任那拿来了孩子上课偷偷看的",
18 + "你的同桌无情的从你的语文书中撕下了那篇你最喜欢的",
19 + "考古学家近日发现了",
20 + "外星人降临地球学习地球文化,落地时被你塞了",
21 + "从图书馆顶层的隐秘角落里发现了闪着金光的",
22 + "徒弟修炼走火入魔,为师立刻掏出了",
23 + "在大山中唱山歌,隔壁的阿妹跑来了,带着",
24 + "隔壁家的孩子数学考了满分,都是因为看了",
25 + "隔壁家的孩子英语考了满分,都是因为看了",
26 + "小米研发了全新一代MIX手机,据说灵感",
27 + "修炼渡劫成功,还好提前看了",
28 + "库克坐上了苹果CEO的宝座,因为他面试的时候看了",
29 + "阿里巴巴大喊芝麻开门,映入眼帘的就是",
30 + "师傅说练武要先炼心,然后让我好生研读",
31 + "科考队在南极大陆发现了被冰封的",
32 + "飞机窗户似乎被一张纸糊上了,仔细一看是",
33 + "历史上满写的仁义道德四个字,透过字缝里却全是",
34 + "十几年前的录音机似乎还能够使用,插上电发现正在播的是",
35 + "新版语文书拟增加一篇熟读并背诵的",
36 + "经调查,99%的受访者都没有背诵过",
37 + "今年的高考满分作文是",
38 + "唐僧揭开了佛祖压在五指山上的",
39 + "科学家发现能够解决衰老的秘密,就是每日研读",
40 + "英特尔发布了全新的至强处理器,其芯片的制造原理都是",
41 + "新的iPhone产能很足,新的进货渠道是",
42 + "今年亩产突破了八千万斤,多亏了",
43 + "陆隐一统天上宗,在无数祖境高手的目光下宣读了",
44 + "黑钻风跟白钻风说道,吃了唐僧肉能长生不老,他知道是因为看了",
45 + "上卫生间没带纸,直接提裤跑路也不愿意玷污手中",
46 + "种下一篇文章就会产生很多很多文章,我种下了",
47 + "三十年河东,三十年河西,莫欺我没有看过",
48 + "踏破铁血无觅处,得来全靠",
49 + "今日双色球中了两千万,预测全靠",
50 + "因为卷子上没写名字,老师罚抄",
51 + "为了抗议世间的不公,割破手指写下了",
52 + "在艺术大街上被贴满了相同的纸,走近一看是",
53 + "这区区迷阵岂能难得住我?其实能走出来多亏了",
54 + "今日被一篇文章顶上了微博热搜,它是",
55 + "你送给乞丐一个暴富秘籍,它是",
56 + "UZI一个走A拿下五杀,在事后采访时说他当时回想起了",
57 + "科学家解刨了第一个感染丧尸病毒的人,发现丧尸抗体存在于",
58 + "如果你有梦想的话,就要努力去看",
59 + "决定我们成为什么样人的,不是我们的能力,而是是否看过",
60 + "有信心不一定会成功,没信心就去看",
61 + "你真正是谁并不重要,重要的是你看没看过",
62 + "玄天境重要的是锻体,为师赠你此书,好好修炼去吧,这是",
63 + "上百祖境高手在天威湖大战三天三夜为了抢夺",
64 + "这化仙池水乃上古真仙对后人的考校,要求熟读并背诵",
65 + "庆氏三千年根基差点竟被你小子毁于一旦,能够被我拯救全是因为我看了",
66 + "我就是神奇宝贝大师!我这只皮卡丘可是",
67 + "我就是神奇宝贝大师!我这只小火龙可是",
68 + "我就是神奇宝贝大师!我这只可达鸭可是",
69 + "我就是神奇宝贝大师!我这只杰尼龟可是",
70 + "上古遗迹中写道,只要习得此书,便得成功。你定睛一看,原来是",
71 + "奶奶的,玩阴的是吧,我就是双料特工代号穿山甲,",
72 + "你的背景太假了,我的就逼真多了,学到这个技术全是因为看了",
73 + "我是云南的,云南怒江的,怒江芦水市,芦水市六库,六库傈僳族,傈僳族是",
74 + "我真的栓Q了,我真的会谢如果你看",
75 + "你已经习得退退退神功,接下来的心法已经被记录在",
76 + "人生无常大肠包小肠,小肠包住了",
77 + "你抽到了普通文章,它是",
78 + "你收到了稀有文章,它是",
79 + "你抽到了金色普通文章,它是",
80 + "你抽到了金色稀有文章,它是",
81 + "你抽到了传说文章!它是",
82 + "哇!金色传说!你抽到了金色传说文章,它是",
83 + "报告!侦察兵说在前往300米有一个男子在偷偷看一本书,上面赫然写着",
84 + "芷莲姑娘大摆擂台,谁若是能读完此书,便可娶了她。然后从背后掏出了",
85 + "请问你的梦想是什么?我的梦想是能读到",
86 + "读什么才能增智慧?当然是读",
87 + "纳兰嫣然掏出了退婚书,可是发现出门带错了,结果拿出了一本",
88 + "你要尽全力保护你的梦想。那些嘲笑你的人,他们必定会失败,他们想把你变成和他们一样的人。如果你有梦想的话,就要努力去读",
89 + "走人生的路就像爬山一样,看起来走了许多冤枉的路,崎岖的路,但终究需要读完",
90 + "游戏的规则就是这么的简单,你听懂了吗?管你听没听懂,快去看",
91 + ];
92 +
93 + var randomPostClick = 0;
94 +
95 + function fetchRandomPost() {
96 + if (!document.getElementById("random-post")) return;
97 + if (randomPostWorking) return;
98 + randomPostWorking = true;
99 +
100 + let randomRotate = randomPostTimes * 360;
101 + let randomPostTipsItem = randomPostTips[Math.floor(Math.random() * randomPostTips.length)];
102 + let randomPostLevel = getRandomPostLevel(randomPostTimes);
103 +
104 + document.getElementById("random-post").innerHTML = randomPostTimes >= 5 ?
105 + `钓鱼中... (Lv.` + randomPostTimes + ` 当前称号:` + randomPostLevel + `)` :
106 + `钓鱼中...`;
107 +
108 + let randomTime = randomPostTimes == 0 ? 0 : randomNum(1000, 3000);
109 +
110 + document.querySelector(".random-post-start").style.opacity = "0.2";
111 + document.querySelector(".random-post-start").style.transitionDuration = "0.3s";
112 + document.querySelector(".random-post-start").style.transform = "rotate(" + randomRotate + "deg)";
113 +
114 + if (randomPostClick * fdata.hungryFish + fdata.defaultFish < randomPostTimes && Math.round(Math.random()) == 0) {
115 + document.getElementById("random-post").innerHTML =
116 + "因为只钓鱼不吃鱼,过分饥饿导致本次钓鱼失败...(点击任意一篇钓鱼获得的文章即可恢复)";
117 + randomPostWorking = false;
118 + } else {
119 + fetch(UserConfig.private_api_url + 'all.json')
120 + .then(res => res.json())
121 + .then(json => {
122 + let randomArticle = json.article_data[Math.floor(Math.random() * json.article_data.length)];
123 + let { title, link, author } = randomArticle;
124 +
125 + var statsEl = document.getElementById("friend-stats");
126 + if (statsEl && !statsEl.dataset.populated) {
127 + var s = json.statistical_data;
128 + statsEl.innerHTML =
129 + '<div class="stats-grid">' +
130 + '<div class="stats-item"><span class="stats-num">' + s.friends_num + '</span><span class="stats-label">订阅</span></div>' +
131 + '<div class="stats-item"><span class="stats-num">' + s.active_num + '</span><span class="stats-label">活跃</span></div>' +
132 + '<div class="stats-item"><span class="stats-num">' + s.article_num + '</span><span class="stats-label">文章</span></div>' +
133 + '<div class="stats-item"><span class="stats-num">' + s.error_num + '</span><span class="stats-label">失败</span></div>' +
134 + '</div>';
135 + statsEl.dataset.populated = "1";
136 + }
137 + window.setTimeout(() => {
138 + document.getElementById("random-post").innerHTML =
139 + randomPostTipsItem +
140 + `来自友链 <b>` +
141 + author +
142 + `</b> 的文章:<a class="random-friends-post" onclick="randomClickLink()" target="_blank" href="` +
143 + link +
144 + `" rel="external nofollow">` +
145 + title +
146 + `</a>`;
147 + randomPostTimes += 1;
148 + localStorage.setItem("randomPostTimes", randomPostTimes);
149 + document.querySelector(".random-post-start").style.opacity = "1";
150 + }, randomTime);
151 + })
152 + .catch(error => {
153 + console.error('Error fetching data:', error);
154 + document.getElementById("random-post").innerHTML = "获取文章失败,请稍后再试。";
155 + })
156 + .finally(() => {
157 + randomPostWorking = false;
158 + });
159 + }
160 + }
161 +
162 + function initRandomPost() {
163 + if (localStorage.randomPostTimes) {
164 + randomPostTimes = parseInt(localStorage.randomPostTimes);
165 + randomPostClick = parseInt(localStorage.randomPostClick);
166 + document.querySelector(".random-post-start").style.transitionDuration = "0.3s";
167 + document.querySelector(".random-post-start").style.transform = "rotate(" + 360 * randomPostTimes + "deg)";
168 + }
169 + fetchRandomPost();
170 + }
171 +
172 + function randomClickLink() {
173 + randomPostClick += 1;
174 + localStorage.setItem("randomPostClick", randomPostClick);
175 + }
176 +
177 + function randomNum(minNum, maxNum) {
178 + return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
179 + }
180 +
181 + function getRandomPostLevel(times) {
182 + if (times > 10000) return "愿者上钩";
183 + if (times > 1000) return "俯览天下";
184 + if (times > 100) return "绝世渔夫";
185 + if (times > 75) return "钓鱼王者";
186 + if (times > 50) return "钓鱼宗师";
187 + if (times > 20) return "钓鱼专家";
188 + if (times > 5) return "钓鱼高手";
189 + return "钓鱼新手";
190 + }
191 +
192 + initRandomPost();
Più nuovi Più vecchi