Skip to content

Commit

Permalink
refactor: adjust wwads banner
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanyf committed Jan 10, 2023
1 parent 010daf6 commit 09a4657
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions js/ditto.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var ditto = {
theme_button: true,
save_progress: true, // 保存阅读进度
search_bar: true,
wwads: true,

// initialize function
run: initialize
Expand Down Expand Up @@ -78,6 +79,10 @@ function init_sidebar_section() {
init_searchbar();
}

if (ditto.wwads) {
init_wwads();
}

// 初始化内容数组
var menuOL = $(ditto.sidebar_id + ' ol');
menuOL.attr('start', 0);
Expand Down Expand Up @@ -139,6 +144,11 @@ function searchbar_listener(event) {
*/
}

function init_wwads() {
var wwads = '<div class="wwads-cn wwads-horizontal" data-id="197" style="max-width:100%;"></div>';
$(ditto.sidebar_id).find('h2').first().before($(wwads));
}

function init_theme_button() {
$(ditto.theme_id).show();
// 默认主题
Expand Down Expand Up @@ -243,9 +253,6 @@ function li_create_linkage(li_tag, header_level) {
}

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

function create_page_anchors() {
Expand Down Expand Up @@ -362,7 +368,6 @@ function statistics() {
}

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

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

0 comments on commit 09a4657

Please sign in to comment.