Skip to content

Commit 09a4657

Browse files
committed
refactor: adjust wwads banner
1 parent 010daf6 commit 09a4657

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

js/ditto.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var ditto = {
1515
theme_button: true,
1616
save_progress: true, // 保存阅读进度
1717
search_bar: true,
18+
wwads: true,
1819

1920
// initialize function
2021
run: initialize
@@ -78,6 +79,10 @@ function init_sidebar_section() {
7879
init_searchbar();
7980
}
8081

82+
if (ditto.wwads) {
83+
init_wwads();
84+
}
85+
8186
// 初始化内容数组
8287
var menuOL = $(ditto.sidebar_id + ' ol');
8388
menuOL.attr('start', 0);
@@ -139,6 +144,11 @@ function searchbar_listener(event) {
139144
*/
140145
}
141146

147+
function init_wwads() {
148+
var wwads = '<div class="wwads-cn wwads-horizontal" data-id="197" style="max-width:100%;"></div>';
149+
$(ditto.sidebar_id).find('h2').first().before($(wwads));
150+
}
151+
142152
function init_theme_button() {
143153
$(ditto.theme_id).show();
144154
// 默认主题
@@ -243,9 +253,6 @@ function li_create_linkage(li_tag, header_level) {
243253
}
244254

245255
function create_banner(element) {
246-
var banner = $('<div class="wwads-cn wwads-horizontal" data-id="197" style="max-width:100%;"></div>')
247-
.insertAfter(element);
248-
/*
249256
// 2022年8月25日
250257
var deadline = new Date(2022, 7, 25);
251258
if (deadline - (new Date()) < 0) return;
@@ -267,7 +274,6 @@ function create_banner(element) {
267274
var banner = $('<a href="http://www.apeclass.com?did=12" style="color: #333333;" target="_blank"><div style="' + styleStr + '">' + text + '</div></a>')
268275
.insertAfter(element);
269276
setTimeout(function () {if (banner.css('display') === 'none') {show_loading();show_error();} }, 500);
270-
*/
271277
}
272278

273279
function create_page_anchors() {
@@ -362,7 +368,6 @@ function statistics() {
362368
}
363369

364370
function router() {
365-
window.focus();
366371
var path = location.hash.replace(/#([^#]*)(#.*)?/, './$1');
367372

368373
var hashArr = location.hash.split('#');

0 commit comments

Comments
 (0)