commit
5c415480fa
|
@ -199,9 +199,9 @@ function sakura_scripts()
|
|||
$movies = akina_option('focus_amv') ? array('url' => akina_option('amv_url'), 'name' => akina_option('amv_title'), 'live' => $mv_live) : 'close';
|
||||
$auto_height = akina_option('focus_height') ? 'fixed' : 'auto';
|
||||
$code_lamp = 'close';
|
||||
if (wp_is_mobile()) {
|
||||
$auto_height = 'fixed';
|
||||
}
|
||||
// if (wp_is_mobile()) {
|
||||
// $auto_height = 'fixed';
|
||||
// }
|
||||
//拦截移动端
|
||||
version_compare($GLOBALS['wp_version'], '5.1', '>=') ? $reply_link_version = 'new' : $reply_link_version = 'old';
|
||||
wp_localize_script('app', 'Poi', array(
|
||||
|
|
13
inc/api.php
13
inc/api.php
|
@ -268,21 +268,24 @@ function SMMS_API($image)
|
|||
*/
|
||||
function cache_search_json()
|
||||
{
|
||||
global $more;
|
||||
$vowels = array("[", "{", "]", "}", "<", ">", "\r\n", "\r", "\n", "-", "'", '"', '`', " ", ":", ";", '\\', " ", "toc");
|
||||
$regex = <<<EOS
|
||||
/<\/?[a-zA-Z]+("[^"]*"|'[^']*'|[^'">])*>|begin[\S\s]*\/begin|hermit[\S\s]*\/hermit|img[\S\s]*\/img|{{.*?}}|:.*?:/m
|
||||
EOS;
|
||||
$more = 1;
|
||||
|
||||
$posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
|
||||
while ($posts->have_posts()): $posts->the_post();
|
||||
$output .= '{"type":"post","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', get_the_content()))) . '},';
|
||||
$output .= '{"type":"post","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters( 'the_content', get_the_content())))) . '},';
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
$pages = get_pages();
|
||||
foreach ($pages as $page) {
|
||||
$output .= '{"type":"page","link":"' . get_page_link($page) . '","title":' . json_encode($page->post_title) . ',"comments":"' . $page->comment_count . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', $page->post_content))) . '},';
|
||||
}
|
||||
$pages = new WP_Query('posts_per_page=-1&post_status=publish&post_type=page');
|
||||
while ($pages->have_posts()): $pages->the_post();
|
||||
$output .= '{"type":"page","link":"' . get_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters( 'the_content', get_the_content())))) . '},';
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
$tags = get_tags();
|
||||
foreach ($tags as $tag) {
|
||||
|
|
|
@ -73,6 +73,7 @@ mashiro_option.float_player_on = true;
|
|||
|
||||
mashiro_option.cover_api = "<?php echo rest_url('sakura/v1/image/cover'); ?>";
|
||||
|
||||
mashiro_option.windowheight = /Mobile|Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? 'fixed' : 'auto';
|
||||
/*End of Initial Variables*/
|
||||
</script>
|
||||
<?php }
|
||||
|
|
140
js/sakura-app.js
140
js/sakura-app.js
|
@ -78,10 +78,12 @@ function post_list_show_animation() {
|
|||
function callback(entries) {
|
||||
entries.forEach((article) => {
|
||||
if (article.target.classList.contains("post-list-show")) {
|
||||
article.target.style.willChange = 'auto';
|
||||
io.unobserve(article.target)
|
||||
} else {
|
||||
if (article.isIntersecting) {
|
||||
article.target.classList.add("post-list-show");
|
||||
article.target.style.willChange = 'auto';
|
||||
io.unobserve(article.target)
|
||||
}
|
||||
}
|
||||
|
@ -417,22 +419,15 @@ $(document).ready(function () {
|
|||
preBG();
|
||||
});
|
||||
});
|
||||
if (document.body.clientWidth <= 860) {
|
||||
window.onscroll = function () {
|
||||
scrollFunction()
|
||||
};
|
||||
|
||||
function scrollFunction() {
|
||||
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
||||
addComment.I("moblieGoTop").style.display = "block";
|
||||
} else {
|
||||
addComment.I("moblieGoTop").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function topFunction() {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
function topFunction() {
|
||||
if ('scrollBehavior' in document.documentElement.style) {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth"
|
||||
})
|
||||
} else {
|
||||
window.scrollSmoothTo(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,10 +472,20 @@ function timeSeriesReload(flag) {
|
|||
var al_expand_collapse_click = 0;
|
||||
$('#al_expand_collapse').click(function () {
|
||||
if (al_expand_collapse_click == 0) {
|
||||
$al_post_list.show(400);
|
||||
$al_post_list.each(function(index){
|
||||
var $this = $(this),
|
||||
s = setTimeout(function() {
|
||||
$this.show(400);
|
||||
}, 50 * index);
|
||||
});
|
||||
al_expand_collapse_click++;
|
||||
} else if (al_expand_collapse_click == 1) {
|
||||
$al_post_list.hide(400);
|
||||
$al_post_list.each(function(index){
|
||||
var $this = $(this),
|
||||
h = setTimeout(function() {
|
||||
$this.hide(400);
|
||||
}, 50 * index);
|
||||
});
|
||||
al_expand_collapse_click--;
|
||||
}
|
||||
});
|
||||
|
@ -1229,13 +1234,6 @@ var home = location.href,
|
|||
Siren = {
|
||||
MN: function () {
|
||||
$('.iconflat').on('click', function () {
|
||||
if ($("#main-container").hasClass("open")) {
|
||||
$('.iconflat').css('width', '50px').css('height', '50px');
|
||||
$('.openNav').css('height', '50px');
|
||||
} else {
|
||||
$('.iconflat').css('width', '100%').css('height', '100%');
|
||||
$('.openNav').css('height', '100%');
|
||||
}
|
||||
$('body').toggleClass('navOpen');
|
||||
$('#main-container,#mo-nav,.openNav').toggleClass('open');
|
||||
});
|
||||
|
@ -1334,25 +1332,15 @@ var home = location.href,
|
|||
});
|
||||
},
|
||||
AH: function () {
|
||||
if (Poi.windowheight == 'auto') {
|
||||
if (Poi.windowheight == 'auto' && mashiro_option.windowheight == 'auto') {
|
||||
if ($('h1.main-title').length > 0) {
|
||||
var _height = $(window).height() + "px";
|
||||
$('#centerbg').css({
|
||||
'height': _height
|
||||
'height': '100vh'
|
||||
});
|
||||
$('#bgvideo').css({
|
||||
'min-height': _height
|
||||
'min-height': '100vh'
|
||||
});
|
||||
window.resizeFlag = null;
|
||||
$(window).resize(function () {
|
||||
//直接resize性能爆炸,改成延时
|
||||
if (resizeFlag = null) {
|
||||
clearTimeout(resizeFlag);
|
||||
}
|
||||
resizeFlag = setTimeout(function () {
|
||||
Siren.AH();
|
||||
}, 1000);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
$('.headertop').addClass('headertop-bar');
|
||||
|
@ -1547,17 +1535,19 @@ var home = location.href,
|
|||
});
|
||||
},
|
||||
NH: function () {
|
||||
var h1 = 0;
|
||||
$(window).scroll(function () {
|
||||
var s = $(document).scrollTop(),
|
||||
cached = $('.site-header');
|
||||
if (s == h1) {
|
||||
cached.removeClass('yya');
|
||||
}
|
||||
if (s > h1) {
|
||||
cached.addClass('yya');
|
||||
}
|
||||
if(document.body.clientWidth > 860){
|
||||
var h1 = 0;
|
||||
$(window).scroll(function () {
|
||||
var s = $(document).scrollTop(),
|
||||
cached = $('.site-header');
|
||||
if (s == h1) {
|
||||
cached.removeClass('yya');
|
||||
}
|
||||
if (s > h1) {
|
||||
cached.addClass('yya');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
XLS: function () {
|
||||
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
|
||||
|
@ -1732,6 +1722,7 @@ var home = location.href,
|
|||
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
|
||||
$('body').on('click', '#comments-navi a', function (e) {
|
||||
e.preventDefault();
|
||||
var path = $(this)[0].pathname;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: $(this).attr('href'),
|
||||
|
@ -1768,36 +1759,43 @@ var home = location.href,
|
|||
document.body.addEventListener('input', POWERMODE)
|
||||
},
|
||||
GT: function () {
|
||||
var offset = 100,
|
||||
offset_opacity = 1200,
|
||||
scroll_top_duration = 700,
|
||||
$back_to_top = $('.cd-top');
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() > offset) {
|
||||
$back_to_top.addClass('cd-is-visible');
|
||||
$(".changeSkin-gear").css("bottom", "0");
|
||||
if ($(window).height() > 950) {
|
||||
$(".cd-top.cd-is-visible").css("top", "0");
|
||||
var cwidth = document.body.clientWidth,
|
||||
cheight = window.innerHeight,
|
||||
pc_to_top = document.querySelector(".cd-top"),
|
||||
mb_to_top = document.querySelector("#moblieGoTop"),
|
||||
changeskin = document.querySelector(".changeSkin-gear");
|
||||
|
||||
$(window).scroll(function() {
|
||||
if (cwidth <= 860) {
|
||||
if ($(this).scrollTop() > 20) {
|
||||
mb_to_top.style.transform = "scale(1)";
|
||||
} else {
|
||||
$(".cd-top.cd-is-visible").css("top", ($(window).height() - 950) + "px");
|
||||
mb_to_top.style.transform = "scale(0)";
|
||||
}
|
||||
} else {
|
||||
$(".changeSkin-gear").css("bottom", "-999px");
|
||||
$(".cd-top.cd-is-visible").css("top", "-900px");
|
||||
$back_to_top.removeClass('cd-is-visible cd-fade-out');
|
||||
}
|
||||
if ($(this).scrollTop() > offset_opacity) {
|
||||
$back_to_top.addClass('cd-fade-out');
|
||||
if ($(this).scrollTop() > 100) {
|
||||
pc_to_top.classList.add("cd-is-visible");
|
||||
changeskin.style.bottom = "0";
|
||||
if (cheight > 950) {
|
||||
pc_to_top.style.top = "0";
|
||||
} else {
|
||||
pc_to_top.style.top = cheight - 950 + "px";
|
||||
}
|
||||
} else {
|
||||
changeskin.style.bottom = "-999px";
|
||||
pc_to_top.style.top = "-999px";
|
||||
pc_to_top.classList.remove("cd-fade-out", "cd-is-visible");
|
||||
}
|
||||
if ($(this).scrollTop() > 1200) {
|
||||
pc_to_top.classList.add("cd-fade-out");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//smooth scroll to top
|
||||
$back_to_top.on('click', function (event) {
|
||||
event.preventDefault();
|
||||
$('body,html').animate({
|
||||
scrollTop: 0,
|
||||
}, scroll_top_duration);
|
||||
return false;
|
||||
});
|
||||
pc_to_top.onclick = function() {
|
||||
topFunction();
|
||||
}
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
|
|
44
style.css
44
style.css
|
@ -5,7 +5,7 @@ Theme URI: https://github.com/mashirozx/Sakura/
|
|||
Author: Mashiro, Spirit, Louie, Fuzzz
|
||||
Author URI: http://2heng.xin
|
||||
Description: A wonderful branch of theme Akina
|
||||
Version: 3.3.6
|
||||
Version: 3.3.7
|
||||
License: GNU General Public License v2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Text Domain: sakura
|
||||
|
@ -1086,6 +1086,7 @@ a:hover {
|
|||
display: block
|
||||
}
|
||||
|
||||
|
||||
.m-nav {
|
||||
display: none
|
||||
}
|
||||
|
@ -1142,6 +1143,23 @@ a:hover {
|
|||
max-width: 100%
|
||||
}
|
||||
|
||||
@media(max-width:1200px) {
|
||||
.site-top .lower nav{
|
||||
right: calc(-150px - 100%);
|
||||
position: absolute;
|
||||
float: right;
|
||||
animation: searchbox .2s;
|
||||
min-width: 860px;
|
||||
z-index: -1
|
||||
}
|
||||
.site-top .lower nav.navbar {
|
||||
right: calc(-50px - 100%);
|
||||
}
|
||||
.site-top .lower nav.navbar ul {
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
#show-nav {
|
||||
position: relative;
|
||||
float: right;
|
||||
|
@ -1443,6 +1461,7 @@ i.iconfont.hotpost {
|
|||
}
|
||||
|
||||
.post-list-thumb {
|
||||
will-change: transform;
|
||||
float: left;
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
|
@ -1456,7 +1475,7 @@ i.iconfont.hotpost {
|
|||
|
||||
@media (max-width:860px) {
|
||||
.post-list-thumb {
|
||||
margin: 0;
|
||||
margin: 10px 0 10px;
|
||||
height: auto
|
||||
}
|
||||
}
|
||||
|
@ -1870,7 +1889,6 @@ h1.page-title.mb- {
|
|||
}
|
||||
|
||||
#moblieGoTop {
|
||||
display: none;
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
|
@ -1884,9 +1902,9 @@ h1.page-title.mb- {
|
|||
border-radius: 10px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 0 2px 0 rgba(0, 0, 0, .12), 0 2px 2px 0 rgba(0, 0, 0, .24);
|
||||
transition: box-shadow .2s ease
|
||||
transform: scale(0);
|
||||
transition:transform .3s
|
||||
}
|
||||
|
||||
#moblieGoTop:hover {
|
||||
background-color: #fff;
|
||||
opacity: .8
|
||||
|
@ -4260,7 +4278,7 @@ i.iconfont.js-toggle-search.iconsearch {
|
|||
|
||||
.s-search input {
|
||||
font-size: 1rem;
|
||||
background: #none;
|
||||
background: none;
|
||||
padding: 12px 24px 12px 64px;
|
||||
width: 100%;
|
||||
outline: 0;
|
||||
|
@ -4711,6 +4729,11 @@ i.iconfont.js-toggle-search.iconsearch {
|
|||
margin-top: 0;
|
||||
padding: 0
|
||||
}
|
||||
.wp-smiley {
|
||||
height: 2em !important;
|
||||
max-height: 2em !important;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
embed,
|
||||
iframe,
|
||||
|
@ -6840,9 +6863,9 @@ input[type=radio]:checked:before {
|
|||
margin-right: 22px
|
||||
}
|
||||
|
||||
@media (max-width:800px) {
|
||||
@media (max-width:860px) {
|
||||
.changeSkin-gear {
|
||||
visibility: hidden
|
||||
visibility: hidden !important
|
||||
}
|
||||
.changeSkin-gear span::before {
|
||||
content: ""
|
||||
|
@ -7567,6 +7590,11 @@ a.toc-link {
|
|||
}
|
||||
|
||||
@media (max-width:860px) {
|
||||
.wp-smiley {
|
||||
height:20px !important;
|
||||
max-height:20px !important;
|
||||
vertical-align:middle
|
||||
}
|
||||
.bili-container,
|
||||
.tieba-container {
|
||||
padding-left: 0
|
||||
|
|
Loading…
Reference in New Issue