Merge pull request #1 from mashirozx/master

update
This commit is contained in:
Ekkles 2019-10-25 07:18:20 +13:00 committed by GitHub
commit 6a5c480eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 178 additions and 149 deletions

View File

@ -7,7 +7,7 @@
* @package Sakura * @package Sakura
*/ */
define( 'SAKURA_VERSION', '3.2.4' ); define( 'SAKURA_VERSION', '3.2.7' );
define( 'BUILD_VERSION', '3' ); define( 'BUILD_VERSION', '3' );
define( 'JSDELIVR_VERSION', '3.6.7' ); define( 'JSDELIVR_VERSION', '3.6.7' );
@ -183,6 +183,7 @@ function sakura_scripts() {
wp_enqueue_style( 'saukra_css', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/style.min.css', array(), SAKURA_VERSION ); wp_enqueue_style( 'saukra_css', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/style.min.css', array(), SAKURA_VERSION );
wp_enqueue_script( 'app', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/js/sakura-app.min.js', array(), SAKURA_VERSION, true ); wp_enqueue_script( 'app', 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@' . SAKURA_VERSION . '/js/sakura-app.min.js', array(), SAKURA_VERSION, true );
} }
wp_enqueue_script( 'github_card', 'https://cdn.jsdelivr.net/github-cards/latest/widget.js', array(), SAKURA_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
@ -548,7 +549,7 @@ function get_link_items(){
$linkcats = get_terms( 'link_category' ); $linkcats = get_terms( 'link_category' );
if ( !empty($linkcats) ) { if ( !empty($linkcats) ) {
foreach( $linkcats as $linkcat){ foreach( $linkcats as $linkcat){
$result .= '<h3 class="link-title">'.$linkcat->name.'</h3>'; $result .= '<h3 class="link-title"><span class="link-fix">'.$linkcat->name.'</span></h3>';
if( $linkcat->description ) $result .= '<div class="link-description">' . $linkcat->description . '</div>'; if( $linkcat->description ) $result .= '<div class="link-description">' . $linkcat->description . '</div>';
$result .= get_the_link_items($linkcat->term_id); $result .= get_the_link_items($linkcat->term_id);
} }
@ -1515,7 +1516,7 @@ function html_tag_parser($content) {
if(!is_feed()) { if(!is_feed()) {
$content=preg_replace( $content=preg_replace(
'/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i', '/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i',
"<img\$1class=\"lazyload\" data-src=\"\$2\" src=\"https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"\$3 >\n<noscript>\$0</noscript>", "<img $1 class=\"lazyload\" data-src=\"$2\" src=\"https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
$content $content
); );
@ -1548,6 +1549,18 @@ function html_tag_parser($content) {
title="$1"><img src="$2" target="_blank" rel="nofollow" class="fancybox"></a>', title="$1"><img src="$2" target="_blank" rel="nofollow" class="fancybox"></a>',
$content $content
); );
//Github cards
$content=preg_replace(
'/\[github repo=[\'"]([^\'"]+)[\'"]\]/i',
'
<iframe frameborder="0" scrolling="0" allowtransparency="true"
src="https://api.2heng.xin/github-card/?repo=$1"
width="400" height="153"
style="margin-left: 50%; transform: translateX(-50%);"></iframe>
',
$content
);
} }
return $content; return $content;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 413 KiB

View File

@ -40,18 +40,14 @@ function get_avatar_profile_url(){
/* /*
* 首页随机背景图 * 随机图
* NB: I can think of this
*/ */
function get_random_bg_url(){ function get_random_bg_url(){
$arr = array(); if ( empty( akina_option('default_feature_image' )) ) {
for($i=0; $i<6; $i++){ return get_template_directory_uri().'/feature/index.php?'.rand(1,1000);
if(akina_option('focus_img_'.$i)){ } else {
$arr[] = akina_option('focus_img_'.$i); return akina_option('default_feature_image').'?'.rand(1,1000);
} }
}
$url = rand(0, count($arr)-1);
return $arr[$url];
} }

View File

@ -1,5 +1,5 @@
/* /*
* Sakura application bundle theme ver 3.2.0 * Sakura theme application bundle
* @author Mashiro * @author Mashiro
* @url https://2heng.xin * @url https://2heng.xin
* @date 2019.8.3 * @date 2019.8.3
@ -8,18 +8,19 @@ mashiro_global.variables = new function () {
this.skinSecter = true; this.skinSecter = true;
} }
mashiro_global.ini = new function () { mashiro_global.ini = new function () {
this.normalize = function () { this.normalize = function () { // initial functions when page first load (首次加载页面时的初始化函数)
lazyload(); lazyload();
social_share(); social_share();
mashiro_global.post_list_show_animation.ini(); post_list_show_animation();
copy_code_block(); copy_code_block();
coverVideoIni(); coverVideoIni();
checkskinSecter(); checkskinSecter();
scrollBar();
} }
this.pjax = function () { this.pjax = function () { // pjax reload functions (pjax 重载函数)
pjaxInit(); pjaxInit();
social_share(); social_share();
mashiro_global.post_list_show_animation.ini(); post_list_show_animation();
copy_code_block(); copy_code_block();
coverVideoIni(); coverVideoIni();
checkskinSecter(); checkskinSecter();
@ -64,31 +65,29 @@ function imgError(ele, type) {
} }
} }
mashiro_global.post_list_show_animation = new function () { function post_list_show_animation() {
this.ini = function (ajax) { if ($("article").hasClass("post-list-thumb")) {
$("article.post-list-thumb").each(function (i) { var options = {
if (ajax) { root: null,
var window_height = $(window).height(); threshold: [0.66]
} else { }
if ($(".headertop").hasClass("headertop-bar")) { var io = new IntersectionObserver(callback, options);
var window_height = 0; var articles = document.querySelectorAll('.post-list-thumb');
function callback(entries) {
entries.forEach((article) => {
if (article.target.classList.contains("post-list-show")) {
io.unobserve(article.target)
} else { } else {
if (mashiro_option.land_at_home) { if (article.isIntersecting) {
var window_height = $(window).height() - 300; article.target.classList.add("post-list-show");
} else { io.unobserve(article.target)
var window_height = $(window).height();
} }
} }
} })
var article_height = $("article.post-list-thumb").eq(i).offset().top; }
if ($(window).height() + $(window).scrollTop() >= article_height) articles.forEach((article) => {
$("article.post-list-thumb").eq(i).addClass('post-list-show'); io.observe(article)
$(window).scroll(function () { })
var scrolltop = $(window).scrollTop();
if (scrolltop + window_height >= article_height && scrolltop)
$("article.post-list-thumb").eq(i).addClass("post-list-show");
});
});
} }
} }
mashiro_global.font_control = new function () { mashiro_global.font_control = new function () {
@ -166,6 +165,7 @@ if (Poi.reply_link_version == 'new'){
} }
function attach_image() { function attach_image() {
var cached = $('.insert-image-tips');
$('#upload-img-file').change(function () { $('#upload-img-file').change(function () {
if (this.files.length > 10) { if (this.files.length > 10) {
addComment.createButterbar("每次上传上限为10张.<br>10 files max per request."); addComment.createButterbar("每次上传上限为10张.<br>10 files max per request.");
@ -187,13 +187,13 @@ function attach_image() {
contentType: false, contentType: false,
data: formData, data: formData,
beforeSend: function (xhr) { beforeSend: function (xhr) {
$('.insert-image-tips').html('<i class="fa fa-spinner rotating" aria-hidden="true"></i>'); cached.html('<i class="fa fa-spinner rotating" aria-hidden="true"></i>');
addComment.createButterbar("上传中...<br>Uploading..."); addComment.createButterbar("上传中...<br>Uploading...");
}, },
success: function (res) { success: function (res) {
$('.insert-image-tips').html('<i class="fa fa-check" aria-hidden="true"></i>'); cached.html('<i class="fa fa-check" aria-hidden="true"></i>');
setTimeout(function () { setTimeout(function () {
$('.insert-image-tips').html('<i class="fa fa-picture-o" aria-hidden="true"></i>'); cached.html('<i class="fa fa-picture-o" aria-hidden="true"></i>');
}, 1000); }, 1000);
var get_the_url = res.data.url; var get_the_url = res.data.url;
$('#upload-img-show').append('<img class="lazyload upload-image-preview" src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg" data-src="' + get_the_url + '" onclick="window.open(\'' + get_the_url + '\')" onerror="imgError(this)" />'); $('#upload-img-show').append('<img class="lazyload upload-image-preview" src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg" data-src="' + get_the_url + '" onclick="window.open(\'' + get_the_url + '\')" onerror="imgError(this)" />');
@ -202,10 +202,10 @@ function attach_image() {
grin(res.data.url.replace('https://i.loli.net/', '{UPLOAD}'), type = 'Img'); grin(res.data.url.replace('https://i.loli.net/', '{UPLOAD}'), type = 'Img');
}, },
error: function () { error: function () {
$('.insert-image-tips').html('<i class="fa fa-times" aria-hidden="true" style="color:red"></i>'); cached.html('<i class="fa fa-times" aria-hidden="true" style="color:red"></i>');
alert("上传失败,请重试.\nUpload failed, please try again."); alert("上传失败,请重试.\nUpload failed, please try again.");
setTimeout(function () { setTimeout(function () {
$('.insert-image-tips').html('<i class="fa fa-picture-o" aria-hidden="true"></i>'); cached.html('<i class="fa fa-picture-o" aria-hidden="true"></i>');
}, 1000); }, 1000);
} }
}) })
@ -231,7 +231,7 @@ function add_upload_tips() {
function click_to_view_image() { function click_to_view_image() {
$(".comment_inline_img").click(function () { $(".comment_inline_img").click(function () {
var temp_url = $(this).attr('src'); var temp_url = this.src;
window.open(temp_url); window.open(temp_url);
}); });
} }
@ -260,33 +260,33 @@ function cmt_showPopup(ele) {
function scrollBar() { function scrollBar() {
if (document.body.clientWidth > 860) { if (document.body.clientWidth > 860) {
$(window).scroll(function () { $(window).scroll(function () {
var s = $(window).scrollTop(); var s = $(window).scrollTop(),
var a = $(document).height(); a = $(document).height(),
var b = $(window).height(); b = $(window).height(),
var result = parseInt(s / (a - b) * 100); result = parseInt(s / (a - b) * 100),
$("#bar").css("width", result + "%"); cached = $("#bar");
cached.css("width", result + "%");
if (false) { if (false) {
if (result >= 0 && result <= 19) if (result >= 0 && result <= 19)
$("#bar").css("background", "#cccccc"); cached.css("background", "#cccccc");
if (result >= 20 && result <= 39) if (result >= 20 && result <= 39)
$("#bar").css("background", "#50bcb6"); cached.css("background", "#50bcb6");
if (result >= 40 && result <= 59) if (result >= 40 && result <= 59)
$("#bar").css("background", "#85c440"); cached.css("background", "#85c440");
if (result >= 60 && result <= 79) if (result >= 60 && result <= 79)
$("#bar").css("background", "#f2b63c"); cached.css("background", "#f2b63c");
if (result >= 80 && result <= 99) if (result >= 80 && result <= 99)
$("#bar").css("background", "#FF0000"); cached.css("background", "#FF0000");
if (result == 100) if (result == 100)
$("#bar").css("background", "#5aaadb"); cached.css("background", "#5aaadb");
} else { } else {
$("#bar").css("background", "orange"); cached.css("background", "orange");
} }
$(".toc-container").css("height", $(".site-content").outerHeight()); $(".toc-container").css("height", $(".site-content").outerHeight());
$(".skin-menu").removeClass('show'); $(".skin-menu").removeClass('show');
}); });
} }
} }
scrollBar();
function checkskinSecter() { function checkskinSecter() {
if (mashiro_global.variables.skinSecter === false) { if (mashiro_global.variables.skinSecter === false) {
@ -299,10 +299,10 @@ function checkskinSecter() {
} }
function checkBgImgCookie() { function checkBgImgCookie() {
var bgurl = getCookie("bgImgSetting"); var bgurl = getCookie("bgImgSetting");
if (bgurl != "") { if (!bgurl) {
$(".skin-menu #" + bgurl).click(); $("#white-bg").click();
} else { } else {
$(".skin-menu #white-bg").click(); $("#" + bgurl).click();
} }
} }
if (document.body.clientWidth > 860) { if (document.body.clientWidth > 860) {
@ -322,9 +322,10 @@ $(document).ready(function() {
return a == "none" ? "" : a return a == "none" ? "" : a
} }
function changeBG() { function changeBG() {
$(".menu-list li").each(function() { var cached=$(".menu-list");
cached.find("li").each(function() {
var tagid = this.id; var tagid = this.id;
$(".skin-menu #" + tagid).click(function() { cached.on("click", "#" + tagid, function(){
if (tagid == "white-bg") { if (tagid == "white-bg") {
mashiro_global.variables.skinSecter = true; mashiro_global.variables.skinSecter = true;
checkskinSecter(); checkskinSecter();
@ -422,8 +423,9 @@ if (document.body.clientWidth <= 860) {
} }
function timeSeriesReload(flag) { function timeSeriesReload(flag) {
var cached = $('#archives');
if (flag == true) { if (flag == true) {
$('#archives span.al_mon').click(function () { cached.find('span.al_mon').click(function () {
$(this).next().slideToggle(400); $(this).next().slideToggle(400);
return false; return false;
}); });
@ -433,26 +435,26 @@ function timeSeriesReload(flag) {
$('#al_expand_collapse,#archives span.al_mon').css({ $('#al_expand_collapse,#archives span.al_mon').css({
cursor: "s-resize" cursor: "s-resize"
}); });
$('#archives span.al_mon').each(function () { cached.find('span.al_mon').each(function () {
var num = $(this).next().children('li').length; var num = $(this).next().children('li').length;
$(this).children('#post-num').text(num); $(this).children('#post-num').text(num);
}); });
var $al_post_list = $('#archives ul.al_post_list'), var $al_post_list = cached.find('ul.al_post_list'),
$al_post_list_f = $('#archives ul.al_post_list:first'); $al_post_list_f = cached.find('ul.al_post_list:first');
$al_post_list.hide(1, function () { $al_post_list.hide(1, function () {
$al_post_list_f.show(); $al_post_list_f.show();
}); });
$('#archives span.al_mon').click(function () { cached.find('span.al_mon').click(function () {
$(this).next().slideToggle(400); $(this).next().slideToggle(400);
return false; return false;
}); });
if (document.body.clientWidth > 860) { if (document.body.clientWidth > 860) {
$('#archives li.al_li').mouseover(function () { cached.find('li.al_li').mouseover(function () {
$(this).children('.al_post_list').show(400); $(this).children('.al_post_list').show(400);
return false; return false;
}); });
if (false) { if (false) {
$('#archives li.al_li').mouseout(function () { cached.find('li.al_li').mouseout(function () {
$(this).children('.al_post_list').hide(400); $(this).children('.al_post_list').hide(400);
return false; return false;
}); });
@ -543,28 +545,19 @@ function tableOfContentScroll(flag) {
} else if ($("div").hasClass("have-toc") == false && $("div").hasClass("has-toc") == false) { } else if ($("div").hasClass("have-toc") == false && $("div").hasClass("has-toc") == false) {
$(".toc-container").remove(); $(".toc-container").remove();
} else { } else {
$(document).ready(function () {
if ($("div").hasClass("toc")) {
$(".toc-container").css("height", $(".site-content").outerHeight());
setTimeout(function () {
$(".toc-container").css("height", $(".site-content").outerHeight());
}, 1000);
setTimeout(function () {
$(".toc-container").css("height", $(".site-content").outerHeight());
}, 6000);
}
});
if (flag) { if (flag) {
var id = 1; var id = 1,
$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function () { heading_fix=$("article").hasClass("type-post") ? $("div").hasClass("pattern-attachment-img") ? -75 : 200 : 375;
$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function() {
var hyphenated = "toc-head-" + id; var hyphenated = "toc-head-" + id;
$(this).attr('id', hyphenated); this.id = hyphenated;
id++; id++;
}); });
tocbot.init({ tocbot.init({
tocSelector: '.toc', tocSelector: '.toc',
contentSelector: ['.entry-content', '.links'], contentSelector: ['.entry-content', '.links'],
headingSelector: 'h1, h2, h3, h4, h5', headingSelector: 'h1, h2, h3, h4, h5',
headingsOffset: heading_fix-window.innerHeight/2,
}); });
} }
} }
@ -607,7 +600,6 @@ var pjaxInit = function () {
timeSeriesReload(); timeSeriesReload();
add_copyright(); add_copyright();
tableOfContentScroll(flag = true); tableOfContentScroll(flag = true);
console.log($("#myscript").text());
} }
$(document).on("click", ".sm", function () { $(document).on("click", ".sm", function () {
var msg = "您真的要设为私密吗?"; var msg = "您真的要设为私密吗?";
@ -780,12 +772,16 @@ if(mashiro_option.float_player_on) {
lrcTag = 2; lrcTag = 2;
}); });
var apSwitchTag = 0; var apSwitchTag = 0;
var aplayerlist=$(".aplayer-list");
aplayerlist.removeClass( "aplayer-list-hide" ).css({maxHeight:'0px'});
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover"); $(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
$(".aplayer-miniswitcher").click(function(){ $(".aplayer-miniswitcher").click(function(){
if (apSwitchTag == 0) { if (apSwitchTag == 0) {
aplayerlist.removeClass( "aplayer-list-hide" ).animate({maxHeight:'250px'});
$(".aplayer.aplayer-fixed .aplayer-body").removeClass( "ap-hover" ); $(".aplayer.aplayer-fixed .aplayer-body").removeClass( "ap-hover" );
apSwitchTag = 1; apSwitchTag = 1;
} else { } else {
aplayerlist.css({maxHeight:'0px'});
$(".aplayer.aplayer-fixed .aplayer-body").addClass( "ap-hover" ); $(".aplayer.aplayer-fixed .aplayer-body").addClass( "ap-hover" );
apSwitchTag =0; apSwitchTag =0;
} }
@ -833,26 +829,26 @@ if(mashiro_option.float_player_on) {
} }
function getqqinfo() { function getqqinfo() {
var is_get_by_qq = false; var is_get_by_qq = false,cached = $('input');
if (!getCookie('user_qq') && !getCookie('user_qq_email') && !getCookie('user_author')) { if (!getCookie('user_qq') && !getCookie('user_qq_email') && !getCookie('user_author')) {
$('input#qq,input#author,input#email,input#url').val(''); cached.filter('#qq,#author,#email,#url').val('');
} }
if (getCookie('user_avatar') && getCookie('user_qq') && getCookie('user_qq_email')) { if (getCookie('user_avatar') && getCookie('user_qq') && getCookie('user_qq_email')) {
$('div.comment-user-avatar img').attr('src', getCookie('user_avatar')); $('div.comment-user-avatar img').attr('src', getCookie('user_avatar'));
$('input#author').val(getCookie('user_author')); cached.filter('#author').val(getCookie('user_author'));
$('input#email').val(getCookie('user_qq') + '@qq.com'); cached.filter('#email').val(getCookie('user_qq') + '@qq.com');
$('input#qq').val(getCookie('user_qq')); cached.filter('#qq').val(getCookie('user_qq'));
if (mashiro_option.qzone_autocomplete) { if (mashiro_option.qzone_autocomplete) {
$('input#url').val('https://user.qzone.qq.com/' + getCookie('user_qq')); cached.filter('#url').val('https://user.qzone.qq.com/' + getCookie('user_qq'));
} }
if ($('input#qq').val()) { if (cached.filter('#qq').val()) {
$('.qq-check').css('display', 'block'); $('.qq-check').css('display', 'block');
$('.gravatar-check').css('display', 'none'); $('.gravatar-check').css('display', 'none');
} }
} }
var emailAddressFlag = $('input#email').val(); var emailAddressFlag = cached.filter('#email').val();
$('input#author').on('blur', function () { cached.filter('#author').on('blur', function () {
var qq = $('input#author').val(); var qq = cached.filter('#author').val();
$.ajax({ $.ajax({
type: 'get', type: 'get',
url: mashiro_option.qq_api_url + '?type=getqqnickname&qq=' + qq, url: mashiro_option.qq_api_url + '?type=getqqnickname&qq=' + qq,
@ -860,15 +856,15 @@ function getqqinfo() {
jsonp: 'callback', jsonp: 'callback',
jsonpCallback: 'portraitCallBack', jsonpCallback: 'portraitCallBack',
success: function (data) { success: function (data) {
$('input#author').val(data[qq][6]); cached.filter('#author').val(data[qq][6]);
$('input#email').val($.trim(qq) + '@qq.com'); cached.filter('#email').val($.trim(qq) + '@qq.com');
if (mashiro_option.qzone_autocomplete) { if (mashiro_option.qzone_autocomplete) {
$('input#url').val('https://user.qzone.qq.com/' + $.trim(qq)); cached.filter('#url').val('https://user.qzone.qq.com/' + $.trim(qq));
} }
$('div.comment-user-avatar img').attr('src', 'https://q2.qlogo.cn/headimg_dl?dst_uin=' + qq + '&spec=100'); $('div.comment-user-avatar img').attr('src', 'https://q2.qlogo.cn/headimg_dl?dst_uin=' + qq + '&spec=100');
is_get_by_qq = true; is_get_by_qq = true;
$('input#qq').val($.trim(qq)); cached.filter('#qq').val($.trim(qq));
if ($('input#qq').val()) { if (cached.filter('#qq').val()) {
$('.qq-check').css('display', 'block'); $('.qq-check').css('display', 'block');
$('.gravatar-check').css('display', 'none'); $('.gravatar-check').css('display', 'none');
} }
@ -877,16 +873,16 @@ function getqqinfo() {
setCookie('is_user_qq', 'yes', 30); setCookie('is_user_qq', 'yes', 30);
setCookie('user_qq_email', qq + '@qq.com', 30); setCookie('user_qq_email', qq + '@qq.com', 30);
setCookie('user_email', qq + '@qq.com', 30); setCookie('user_email', qq + '@qq.com', 30);
emailAddressFlag = $('input#email').val(); emailAddressFlag = cached.filter('#email').val();
}, },
error: function () { error: function () {
$('input#qq').val(''); cached.filter('#qq').val('');
$('.qq-check').css('display', 'none'); $('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block'); $('.gravatar-check').css('display', 'block');
$('div.comment-user-avatar img').attr('src', get_gravatar($('input#email').val(), 80)); $('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
setCookie('user_qq', '', 30); setCookie('user_qq', '', 30);
setCookie('user_email', $('input#email').val(), 30); setCookie('user_email', cached.filter('#email').val(), 30);
setCookie('user_avatar', get_gravatar($('input#email').val(), 80), 30); setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
} }
}); });
$.ajax({ $.ajax({
@ -900,55 +896,55 @@ function getqqinfo() {
setCookie('user_avatar', data[qq], 30); setCookie('user_avatar', data[qq], 30);
}, },
error: function () { error: function () {
$('input#qq', 'input#email', 'input#url').val(''); cached.filter('#qq,#email,#url').val('');
if (!$('input#qq').val()) { if (!cached.filter('#qq').val()) {
$('.qq-check').css('display', 'none'); $('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block'); $('.gravatar-check').css('display', 'block');
setCookie('user_qq', '', 30); setCookie('user_qq', '', 30);
$('div.comment-user-avatar img').attr('src', get_gravatar($('input#email').val(), 80)); $('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
setCookie('user_avatar', get_gravatar($('input#email').val(), 80), 30); setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
} }
} }
}); });
}); });
if (getCookie('user_avatar') && getCookie('user_email') && getCookie('is_user_qq') == 'no' && !getCookie('user_qq_email')) { if (getCookie('user_avatar') && getCookie('user_email') && getCookie('is_user_qq') == 'no' && !getCookie('user_qq_email')) {
$('div.comment-user-avatar img').attr('src', getCookie('user_avatar')); $('div.comment-user-avatar img').attr('src', getCookie('user_avatar'));
$('input#email').val(getCookie('user_email')); cached.filter('#email').val(getCookie('user_email'));
$('input#qq').val(''); cached.filter('#qq').val('');
if (!$('input#qq').val()) { if (!cached.filter('#qq').val()) {
$('.qq-check').css('display', 'none'); $('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block'); $('.gravatar-check').css('display', 'block');
} }
} }
$('input#email').on('blur', function () { cached.filter('#email').on('blur', function () {
var emailAddress = $('input#email').val(); var emailAddress = cached.filter('#email').val();
if (is_get_by_qq == false || emailAddressFlag != emailAddress) { if (is_get_by_qq == false || emailAddressFlag != emailAddress) {
$('div.comment-user-avatar img').attr('src', get_gravatar(emailAddress, 80)); $('div.comment-user-avatar img').attr('src', get_gravatar(emailAddress, 80));
setCookie('user_avatar', get_gravatar(emailAddress, 80), 30); setCookie('user_avatar', get_gravatar(emailAddress, 80), 30);
setCookie('user_email', emailAddress, 30); setCookie('user_email', emailAddress, 30);
setCookie('user_qq_email', '', 30); setCookie('user_qq_email', '', 30);
setCookie('is_user_qq', 'no', 30); setCookie('is_user_qq', 'no', 30);
$('input#qq').val(''); cached.filter('#qq').val('');
if (!$('input#qq').val()) { if (!cached.filter('#qq').val()) {
$('.qq-check').css('display', 'none'); $('.qq-check').css('display', 'none');
$('.gravatar-check').css('display', 'block'); $('.gravatar-check').css('display', 'block');
} }
} }
}); });
if (getCookie('user_url')) { if (getCookie('user_url')) {
$('input#url').val(getCookie('user_url')); cached.filter('#url').val(getCookie('user_url'));
} }
$('input#url').on('blur', function () { cached.filter('#url').on('blur', function () {
var URL_Address = $('input#url').val(); var URL_Address = cached.filter('#url').val();
$('input#url').val(URL_Address); cached.filter('#url').val(URL_Address);
setCookie('user_url', URL_Address, 30); setCookie('user_url', URL_Address, 30);
}); });
if (getCookie('user_author')) { if (getCookie('user_author')) {
$('input#author').val(getCookie('user_author')); cached.filter('#author').val(getCookie('user_author'));
} }
$('input#author').on('blur', function () { cached.filter('#author').on('blur', function () {
var user_name = $('input#author').val(); var user_name = cached.filter('#author').val();
$('input#author').val(user_name); cached.filter('#author').val(user_name);
setCookie('user_author', user_name, 30); setCookie('user_author', user_name, 30);
}); });
} }
@ -1258,8 +1254,7 @@ var home = location.href,
s.oncanplay = function () { s.oncanplay = function () {
Siren.splay(); Siren.splay();
$('#video-add').show(); $('#video-add').show();
_btn.addClass('videolive'); _btn.addClass('videolive').addClass('haslive');
_btn.addClass('haslive');
} }
} else { } else {
if ($(this).hasClass('video-pause')) { if ($(this).hasClass('video-pause')) {
@ -1276,9 +1271,7 @@ var home = location.href,
s.onended = function () { s.onended = function () {
$('#bgvideo').attr('src', ''); $('#bgvideo').attr('src', '');
$('#video-add').hide(); $('#video-add').hide();
_btn.addClass('loadvideo').removeClass('video-pause'); _btn.addClass('loadvideo').removeClass('video-pause').removeClass('videolive').removeClass('haslive');
_btn.removeClass('videolive');
_btn.removeClass('haslive');
$('.focusinfo').css({ $('.focusinfo').css({
"top": "49.3%" "top": "49.3%"
}); });
@ -1497,25 +1490,14 @@ var home = location.href,
}); });
}, },
NH: function () { NH: function () {
var h1 = 0, var h1 = 0;
h2 = 50,
ss = $(document).scrollTop();
$(window).scroll(function () { $(window).scroll(function () {
var s = $(document).scrollTop(); var s = $(document).scrollTop(),cached = $('.site-header');
if (s == h1) { if (s == h1) {
$('.site-header').removeClass('yya'); cached.removeClass('yya');
} }
if (s > h1) { if (s > h1) {
$('.site-header').addClass('yya'); cached.addClass('yya');
}
if (s > h2) {
$('.site-header').addClass('gizle');
if (s > ss) {
$('.site-header').removeClass('sabit');
} else {
$('.site-header').addClass('sabit');
}
ss = s;
} }
}); });
}, },
@ -1554,7 +1536,7 @@ var home = location.href,
$("#pagination a").removeClass("loading").text("Previous"); $("#pagination a").removeClass("loading").text("Previous");
$('#add_post span').removeClass("loading").text(""); $('#add_post span').removeClass("loading").text("");
lazyload(); lazyload();
mashiro_global.post_list_show_animation.ini(50); post_list_show_animation();
if (nextHref != undefined) { if (nextHref != undefined) {
$("#pagination a").attr("href", nextHref); $("#pagination a").attr("href", nextHref);
//加载完成上滑 //加载完成上滑
@ -1746,6 +1728,7 @@ var home = location.href,
$('body,html').animate({ $('body,html').animate({
scrollTop: 0, scrollTop: 0,
}, scroll_top_duration); }, scroll_top_duration);
return false;
}); });
} }
} }
@ -1809,6 +1792,7 @@ $(function () {
Siren.PE(); Siren.PE();
Siren.CE(); Siren.CE();
timeSeriesReload(true); timeSeriesReload(true);
post_list_show_animation();
}, false); }, false);
} }
$.fn.postLike = function () { $.fn.postLike = function () {

View File

@ -252,6 +252,17 @@ function optionsframework_options() {
'round' => __('圆形', ''), 'round' => __('圆形', ''),
'square' => __('方形', '') 'square' => __('方形', '')
)); ));
$options[] = array(
'name' => __('首页文章特色图对齐方式(仅对图文风格生效,默认左右交替)', 'akina'),
'id' => 'feature_align',
'std' => "alternate",
'type' => "radio",
'options' => array(
'left' => __('向左对齐', ''),
'right' => __('向右对齐', ''),
'alternate' => __('左右交替', '')
));
$options[] = array( $options[] = array(
'name' => __('默认文章特色图', 'options_framework_theme'), 'name' => __('默认文章特色图', 'options_framework_theme'),

View File

@ -5,7 +5,7 @@ Theme URI: https://2heng.xin/theme-sakura/
Author: Mashiro, Louie, Fuzzz Author: Mashiro, Louie, Fuzzz
Author URI: http://2heng.xin Author URI: http://2heng.xin
Description: Akina主题分支原版地址 http://www.akina.pw/themeakina Description: Akina主题分支原版地址 http://www.akina.pw/themeakina
Version: 3.2.4 Version: 3.2.7
License: GNU General Public License v2 or later License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: akina Text Domain: akina
@ -2981,10 +2981,15 @@ span.sitename {
font-weight: 400; font-weight: 400;
color: #6D6D6D; color: #6D6D6D;
padding-left: 10px; padding-left: 10px;
border-left: 3px solid orange; border-left: none;
margin: 50px 0 20px margin: 50px 0 20px
} }
.link-title span.link-fix {
padding-left:10px;
border-left:3px solid orange;
}
.links ul li:before { .links ul li:before {
content: ""; content: "";
background-color: orange; background-color: orange;
@ -8048,7 +8053,8 @@ a.toc-link {
background: #fff; background: #fff;
color: #21252b color: #21252b
} }
.hljs span::selection,
.hljs::selection ,
.hljs-ln-line span::selection, .hljs-ln-line span::selection,
.hljs-ln-line::selection { .hljs-ln-line::selection {
background: #fff; background: #fff;
@ -8479,4 +8485,11 @@ td.hljs-ln-numbers {
background: #ddd; background: #ddd;
color: black; color: black;
} }
h1[id*=toc-head]::before,h2[id*=toc-head]::before,h3[id*=toc-head]::before,h4[id*=toc-head]::before,h5[id*=toc-head]::before,h6[id*=toc-head]::before {
display:block;
content:" ";
height:80px;
margin-top:-80px;
visibility:hidden
}

View File

@ -11,7 +11,19 @@
//} //}
//add_filter('the_excerpt', 'custom_short_excerpt'); //add_filter('the_excerpt', 'custom_short_excerpt');
$i=0; while ( have_posts() ) : the_post(); $i++; $i=0; while ( have_posts() ) : the_post(); $i++;
$class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数 switch (akina_option('feature_align')) {
case "left":
$class = 'post-list-thumb-left';
break;
case "right":
$class = '';
break;
case "alternate":
$class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数
break;
default:
$class = ($i%2 == 0) ? 'post-list-thumb-left' : '';
}
if(has_post_thumbnail()){ if(has_post_thumbnail()){
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
$post_img = $large_image_url[0]; $post_img = $large_image_url[0];