Merge pull request #4 from mashirozx/master

update to master
pull/180/head
Ekkles 2019-10-29 20:15:57 +13:00 committed by GitHub
commit 2d9e032c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 16 deletions

View File

@ -565,7 +565,7 @@ function get_link_items(){
*/
function gravatar_cn( $url ){
$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 );
@ -763,7 +763,7 @@ function custom_html() {
if ( akina_option('login_bg') ) {
$loginbg = akina_option('login_bg');
}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">'."\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>",
$content
);
}
}
//Fancybox
/* Markdown Regex Pattern 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]
$content=preg_replace(
'/!\{([^\{\}]+)*\}\('.$url_regex.'\)\['.$url_regex.'\]/i',
'<a data-fancybox="gallery"
data-caption="$1"
class="fancybox"
href="$2"
alt="$1"
title="$1"><img src="$15" target="_blank" rel="nofollow" class="fancybox"></a>',
$content
);
if (preg_match_all('/\!\{.*?\)\[.*?\]/i', $content,$matches)){
$i=0;
foreach ($matches as $val) {
$content=str_replace($val[$i],preg_replace(
'/!\{([^\{\}]+)*\}\('.$url_regex.'\)\['.$url_regex.'\]/i',
'<a data-fancybox="gallery"
data-caption="$1"
class="fancybox"
href="$2"
alt="$1"
title="$1"><img src="$7" target="_blank" rel="nofollow" class="fancybox"></a>',
$val[$i]),
$content);
$i++;
}
}
//Without Thumbnail :!{alt}(url)
$content=preg_replace(

View File

@ -60,6 +60,7 @@ mashiro_option.entry_content_theme_src = "<?php echo get_template_directory_uri(
<?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', ''); ?>";
<?php } ?>
mashiro_option.entry_content_theme = "<?php echo akina_option('entry_content_theme'); ?>";
<?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', ''); ?>";
@ -81,4 +82,4 @@ mashiro_option.cover_api = "<?php echo $imgurl; ?>";
/*End of Initial Variables*/
</script>
<?php }
add_action('wp_head', 'font_end_js_control');
add_action('wp_head', 'font_end_js_control');

View File

@ -555,7 +555,7 @@ function tableOfContentScroll(flag) {
} else {
if (flag) {
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() {
var hyphenated = "toc-head-" + id;
this.id = hyphenated;