1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

refactor: adjust wwads banner

This commit is contained in:
ruanyf 2023-01-10 17:04:19 +08:00
parent 536ac2251a
commit 010daf6830

View File

@ -45,7 +45,6 @@ var getHash = function (hash) {
}; };
var disqusCode = '<h3>留言</h3><div id="disqus_thread"></div>'; var disqusCode = '<h3>留言</h3><div id="disqus_thread"></div>';
var wwadsCode = '<div class="wwads-cn wwads-horizontal" data-id="197" style="max-width:100%;"></div>';
var menu = new Array(); var menu = new Array();
function initialize() { function initialize() {
@ -126,7 +125,7 @@ function searchbar_listener(event) {
if (q !== '') { if (q !== '') {
var url = 'https://github.com/ruanyf/es6tutorial/search?utf8=✓&q=' + encodeURIComponent(q); var url = 'https://github.com/ruanyf/es6tutorial/search?utf8=✓&q=' + encodeURIComponent(q);
window.open(url, '_blank'); window.open(url, '_blank');
win.focus(); window.focus();
} }
return false; return false;
/* /*
@ -244,6 +243,9 @@ function li_create_linkage(li_tag, header_level) {
} }
function create_banner(element) { 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日 // 2022年8月25日
var deadline = new Date(2022, 7, 25); var deadline = new Date(2022, 7, 25);
if (deadline - (new Date()) < 0) return; if (deadline - (new Date()) < 0) return;
@ -265,6 +267,7 @@ function create_banner(element) {
var banner = $('<a href="http://www.apeclass.com?did=12" style="color: #333333;" target="_blank"><div style="' + styleStr + '">' + text + '</div></a>') var banner = $('<a href="http://www.apeclass.com?did=12" style="color: #333333;" target="_blank"><div style="' + styleStr + '">' + text + '</div></a>')
.insertAfter(element); .insertAfter(element);
setTimeout(function () {if (banner.css('display') === 'none') {show_loading();show_error();} }, 500); setTimeout(function () {if (banner.css('display') === 'none') {show_loading();show_error();} }, 500);
*/
} }
function create_page_anchors() { function create_page_anchors() {
@ -359,6 +362,7 @@ function statistics() {
} }
function router() { function router() {
window.focus();
var path = location.hash.replace(/#([^#]*)(#.*)?/, './$1'); var path = location.hash.replace(/#([^#]*)(#.*)?/, './$1');
var hashArr = location.hash.split('#'); var hashArr = location.hash.split('#');
@ -394,7 +398,7 @@ function router() {
$.get(path, function(data) { $.get(path, function(data) {
$(ditto.error_id).hide(); $(ditto.error_id).hide();
$(ditto.content_id).html(marked(data) + wwadsCode + disqusCode); $(ditto.content_id).html(marked(data) + disqusCode);
if ($(ditto.content_id + " h1").text() === ditto.document_title) { if ($(ditto.content_id + " h1").text() === ditto.document_title) {
document.title = ditto.document_title; document.title = ditto.document_title;
} else { } else {