mirror of
https://github.com/mashirozx/sakura.git
synced 2025-05-29 01:49:21 +08:00
commit
2d9e032c90
@ -565,7 +565,7 @@ function get_link_items(){
|
|||||||
*/
|
*/
|
||||||
function gravatar_cn( $url ){
|
function gravatar_cn( $url ){
|
||||||
$gravatar_url = array('0.gravatar.com','1.gravatar.com','2.gravatar.com','secure.gravatar.com');
|
$gravatar_url = array('0.gravatar.com','1.gravatar.com','2.gravatar.com','secure.gravatar.com');
|
||||||
return str_replace( $gravatar_url, 'gravatar.shino.cc', $url );
|
return str_replace( $gravatar_url, 'cn.gravatar.com', $url );
|
||||||
}
|
}
|
||||||
add_filter( 'get_avatar_url', 'gravatar_cn', 4 );
|
add_filter( 'get_avatar_url', 'gravatar_cn', 4 );
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ function custom_html() {
|
|||||||
if ( akina_option('login_bg') ) {
|
if ( akina_option('login_bg') ) {
|
||||||
$loginbg = akina_option('login_bg');
|
$loginbg = akina_option('login_bg');
|
||||||
}else{
|
}else{
|
||||||
$loginbg = get_bloginfo('template_directory').'/images/hd.png';
|
$loginbg = 'https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.2.7/images/hd.png';
|
||||||
}
|
}
|
||||||
echo '<script type="text/javascript" src="'.get_site_url().'/wp-content/themes/Sakura/js/login.js"></script>'."\n";
|
echo '<script type="text/javascript" src="'.get_site_url().'/wp-content/themes/Sakura/js/login.js"></script>'."\n";
|
||||||
echo '<script type="text/javascript">'."\n";
|
echo '<script type="text/javascript">'."\n";
|
||||||
@ -1520,25 +1520,31 @@ function html_tag_parser($content) {
|
|||||||
"<img $1 class=\"lazyload\" data-src=\"$2\" src=\"".akina_option('lazyload_spinner')."\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
|
"<img $1 class=\"lazyload\" data-src=\"$2\" src=\"".akina_option('lazyload_spinner')."\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
|
||||||
$content
|
$content
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fancybox
|
//Fancybox
|
||||||
/* Markdown Regex Pattern for Matching URLs:
|
/* Markdown Regex Pattern for Matching URLs:
|
||||||
* https://daringfireball.net/2010/07/improved_regex_for_matching_urls
|
* https://daringfireball.net/2010/07/improved_regex_for_matching_urls
|
||||||
*/
|
*/
|
||||||
$url_regex ='(((http|https):\/\/)?(\w(\:\w)?@)?([0-9a-z_-]+\.)*?([a-z0-9-]+\.[a-z]{2,6}(\.[a-z]{2})?(\:[0-9]{2,6})?)((\/[^?#<>\/\\*":]*)+(\?[^#]*)?(#.*)?)?)';
|
$url_regex ='((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))';
|
||||||
|
|
||||||
//With Thumbnail: !{alt}(url)[th_url]
|
//With Thumbnail: !{alt}(url)[th_url]
|
||||||
$content=preg_replace(
|
if (preg_match_all('/\!\{.*?\)\[.*?\]/i', $content,$matches)){
|
||||||
'/!\{([^\{\}]+)*\}\('.$url_regex.'\)\['.$url_regex.'\]/i',
|
$i=0;
|
||||||
'<a data-fancybox="gallery"
|
foreach ($matches as $val) {
|
||||||
data-caption="$1"
|
$content=str_replace($val[$i],preg_replace(
|
||||||
class="fancybox"
|
'/!\{([^\{\}]+)*\}\('.$url_regex.'\)\['.$url_regex.'\]/i',
|
||||||
href="$2"
|
'<a data-fancybox="gallery"
|
||||||
alt="$1"
|
data-caption="$1"
|
||||||
title="$1"><img src="$15" target="_blank" rel="nofollow" class="fancybox"></a>',
|
class="fancybox"
|
||||||
$content
|
href="$2"
|
||||||
);
|
alt="$1"
|
||||||
|
title="$1"><img src="$7" target="_blank" rel="nofollow" class="fancybox"></a>',
|
||||||
|
$val[$i]),
|
||||||
|
$content);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Without Thumbnail :!{alt}(url)
|
//Without Thumbnail :!{alt}(url)
|
||||||
$content=preg_replace(
|
$content=preg_replace(
|
||||||
|
@ -60,6 +60,7 @@ mashiro_option.entry_content_theme_src = "<?php echo get_template_directory_uri(
|
|||||||
<?php }elseif(akina_option('entry_content_theme') == "github") {?>
|
<?php }elseif(akina_option('entry_content_theme') == "github") {?>
|
||||||
mashiro_option.entry_content_theme_src = "<?php echo get_template_directory_uri() ?>/cdn/theme/github.css?<?php echo SAKURA_VERSION.akina_option('cookie_version', ''); ?>";
|
mashiro_option.entry_content_theme_src = "<?php echo get_template_directory_uri() ?>/cdn/theme/github.css?<?php echo SAKURA_VERSION.akina_option('cookie_version', ''); ?>";
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
mashiro_option.entry_content_theme = "<?php echo akina_option('entry_content_theme'); ?>";
|
||||||
|
|
||||||
<?php if(akina_option('jsdelivr_cdn_test')){ ?>
|
<?php if(akina_option('jsdelivr_cdn_test')){ ?>
|
||||||
mashiro_option.jsdelivr_css_src = "<?php echo get_template_directory_uri() ?>/cdn/css/lib.css?<?php echo SAKURA_VERSION.akina_option('cookie_version', ''); ?>";
|
mashiro_option.jsdelivr_css_src = "<?php echo get_template_directory_uri() ?>/cdn/css/lib.css?<?php echo SAKURA_VERSION.akina_option('cookie_version', ''); ?>";
|
||||||
@ -81,4 +82,4 @@ mashiro_option.cover_api = "<?php echo $imgurl; ?>";
|
|||||||
/*End of Initial Variables*/
|
/*End of Initial Variables*/
|
||||||
</script>
|
</script>
|
||||||
<?php }
|
<?php }
|
||||||
add_action('wp_head', 'font_end_js_control');
|
add_action('wp_head', 'font_end_js_control');
|
||||||
|
@ -555,7 +555,7 @@ function tableOfContentScroll(flag) {
|
|||||||
} else {
|
} else {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
var id = 1,
|
var id = 1,
|
||||||
heading_fix=$("article").hasClass("type-post") ? $("div").hasClass("pattern-attachment-img") ? -75 : 200 : 375;
|
heading_fix = mashiro_option.entry_content_theme == "sakura" ? $("article").hasClass("type-post") ? $("div").hasClass("pattern-attachment-img") ? -75 : 200 : 375 : window.innerHeight / 2;
|
||||||
$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function() {
|
$(".entry-content , .links").children("h1,h2,h3,h4,h5").each(function() {
|
||||||
var hyphenated = "toc-head-" + id;
|
var hyphenated = "toc-head-" + id;
|
||||||
this.id = hyphenated;
|
this.id = hyphenated;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user