diff --git a/functions.php b/functions.php
index 8887051..462c883 100644
--- a/functions.php
+++ b/functions.php
@@ -952,6 +952,8 @@ function rt_add_link_target( $content ){
foreach( $bits as $key=>$bit ){
// fix the target="_blank" bug after the link
if ( strpos( $bit, 'href' ) === false ) continue;
+ // fix the target="_blank" bug in the codeblock
+ if ( strpos( preg_replace('/code([\s\S]*?)\/code[\s]*/m','temp',$content), $bit ) === false ) continue;
// find the end of each link
$pos = strpos( $bit, '>' );
// check if there is an end (only fails with malformed markup)
diff --git a/index.php b/index.php
index bd8b996..fe01946 100644
--- a/index.php
+++ b/index.php
@@ -65,6 +65,7 @@ get_header();
+
') ?>') ?>
diff --git a/js/sakura-app.js b/js/sakura-app.js
index 5cf578c..12eb48b 100644
--- a/js/sakura-app.js
+++ b/js/sakura-app.js
@@ -1321,7 +1321,7 @@ var home = location.href,
AH: function () {
if (Poi.windowheight == 'auto') {
if ($('h1.main-title').length > 0) {
- var _height = $(window).height();
+ var _height = $(window).height()+"px";
$('#centerbg').css({
'height': _height
});
@@ -1431,27 +1431,53 @@ var home = location.href,
},
XLS: function () {
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
+ var load_post_timer;
+ var intersectionObserver = new IntersectionObserver(function (entries) {
+ if (entries[0].intersectionRatio <= 0) return;
+ var page_next = $('#pagination a').attr("href");
+ var load_key = document.getElementById("add_post_time");
+ if(page_next!=undefined && load_key ){
+ var load_time = document.getElementById("add_post_time").title;
+ if(load_time !="233"){
+ console.log("%c 自动加载时倒计时 %c","background:#9a9da2; color:#ffffff; border-radius:4px;","","",load_time);
+ load_post_timer=setTimeout(function(){load_post();},load_time*1000);
+ }
+ }
+ });
+ intersectionObserver.observe(
+ document.querySelector('.footer-device')
+ );
$('body').on('click', '#pagination a', function () {
- $(this).addClass("loading").text("");
+ clearTimeout(load_post_timer);
+ load_post();
+ return false;
+ });
+ function load_post() {
+ $('#pagination a').addClass("loading").text("");
$.ajax({
type: "POST",
- url: $(this).attr("href") + "#main",
+ url: $('#pagination a').attr("href") + "#main",
success: function (data) {
result = $(data).find("#main .post");
nextHref = $(data).find("#pagination a").attr("href");
$("#main").append(result.fadeIn(500));
$("#pagination a").removeClass("loading").text("Previous");
+ $('#add_post span').removeClass("loading").text("");
lazyload();
mashiro_global.post_list_show_animation.ini(50);
if (nextHref != undefined) {
$("#pagination a").attr("href", nextHref);
+ //加载完成上滑
+ var tempScrollTop = $(window).scrollTop();
+ $(window).scrollTop(tempScrollTop);
+ $body.animate({ scrollTop: tempScrollTop + 300 }, 666)
} else {
$("#pagination").html("很高兴你翻到这里,但是真的没有了... ");
}
}
});
return false;
- });
+ }
},
XCS: function () {
var __cancel = jQuery('#cancel-comment-reply-link'),
diff --git a/options.php b/options.php
index 1849610..3370b45 100644
--- a/options.php
+++ b/options.php
@@ -258,6 +258,27 @@ function optionsframework_options() {
'ajax' => __('ajax加载', ''),
'np' => __('上一页和下一页', '')
));
+
+ $options[] = array(
+ 'name' => __('自动加载下一页', 'options_framework_theme'),
+ 'desc' => __('(秒)设置自动加载下一页时间,默认不自动加载', 'options_framework_theme'),
+ 'id' => 'auto_load_post',
+ 'std' => '233',
+ 'type' => 'select',
+ 'options'=>array(
+ '0'=> __('0秒',''),
+ '1'=> __('1秒',''),
+ '2'=> __('2秒',''),
+ '3'=> __('3秒',''),
+ '4'=> __('4秒',''),
+ '5'=> __('5秒',''),
+ '6'=> __('6秒',''),
+ '7'=> __('7秒',''),
+ '8'=> __('8秒',''),
+ '9'=> __('9秒',''),
+ '10'=> __('10秒',''),
+ '233'=> __('233秒,即不倒计时自动加载',''),
+ ));
$options[] = array(
'name' => __('博主描述', 'options_framework_theme'),