handsome主题魔改

代码类

添加影视解析功能

新建独立页面/文章,输入以下代码即可,若解析接口失效请自行修改接口
[collapse status=“false” title=“安利两个不错的影视解析接口”]

思古解析:https://api.sigujx.com/?url=

91解析:https://www.91jxs.com/jiexi/?url=

[/collapse]

!!!
<script type="text/javascript">eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('b a(){0 6=1.2("9").4;0 5=1.2("3");0 3=1.2("3").c;0 8=5.e[3].4;0 7=1.2("f");7.d=8+6}',16,16,'var|document|getElementById|jk|value|jkurl|diz|cljurl|jkv|url|dihejk|function|selectedIndex|src|options|player'.split('|'),0,{}))
function dihejk2() {var diz =document.getElementById("url").value;var jkurl =document.getElementById("jk");var jk =document.getElementById("jk").selectedIndex;var jkv =jkurl.options[jk].value;var cljurl =document.getElementById("player");window.open(jkv + diz,"_blank");}
</script>
</head>
<div class="language">
</a>
</div>
</p>
</section>
</section>
</section>
<div class="col-md-14 column">
<div class="panel panel-default">
<div id="kj" class="panel-body">
<iframe src="https://www.8090g.cn/jiexi/?url=" style="background-color: black;" id="player"width="100%"height="400px"allowTransparency="true"allowfullscreen="true"frameborder="0"scrolling="no"></iframe>
</div>
</div>
<script>if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){document.getElementById("sdfdf").style.display ="block";}
</script>
</div>
<div class="input-group" style="width: 100%;">
<span class="input-group-addon input-lg" style="width: 80px; ">选择接口</span>
<select class="form-control input-lg" id="jk">
<option value="https://www.8090g.cn/jiexi/?url=" selected="">蓝光路线</option>
<option value="解析网站" selected="">自己添加</option>
</select>
</div>
<br>
<div class="input-group" style="width: 100%;">
<span class="input-group-addon input-lg" style="width: 80px;">播放地址</span>
<input class="form-control input-lg" type="search" placeholder="电脑使用Ctrl+V粘贴网址-手机直接长按粘贴网址" id="url">
</div>
<br>
<div>
<button id="bf" type="button" class="btn btn-primary btn-round btn-block" onClick="dihejk()">Go-点击开始解析</button>
<button id="bf" type="button" class="btn btn-success btn-round btn-block" onClick="dihejk2()">New-点击全屏解析</button>
</div>
</div>
<div id="coin" class="coin"><script>var Coin =true;</script></div>
<div class="panel-body" style="text-align: center;">
<div class="container-fluid">
</button>
!!!

顶部滚动条显示位置百分比

首先打开模板的header.php文件,复制以下代码,粘贴在网页之后

<div id="percentageCounter"></div>

后台-设置外观-开发者设置-自定义JS 添加以下代码

$(window).scroll(function() {
    var a = $(window).scrollTop(),
    c = $(document).height(),
    b = $(window).height();
    scrollPercent = a / (c - b) * 100;
    scrollPercent = scrollPercent.toFixed(1);
    $("#percentageCounter").css({
        width: scrollPercent + "%"
    });
}).trigger("scroll");

后台-设置外观-开发者设置-自定义CSS 添加以下代码

position:fixed;
    left:0;
    top:0;
    height:3px;
    z-index:99999;
    background-color:#448EF6;
}

统计全站字数

由于Handsome主题无法直接将代码加入到function.php中,我们这里选择放在 sidebar.php开头或者 libs/Content.php结尾,效果是一样的。

<?php
//字数统计
function allOfCharacters() {
    $chars = 0;
    $db = Typecho_Db::get();
    $select = $db ->select('text')->from('table.contents');
    $rows = $db->fetchAll($select);
    foreach ($rows as $row) { $chars += mb_strlen(trim($row['text']), 'UTF-8'); }
    $unit = '';
    if($chars >= 10000)     { $chars /= 10000; $unit = 'w'; } 
    else if($chars >= 1000) { $chars /= 1000;  $unit = 'k'; }
    $out = sprintf('%.2lf %s',$chars, $unit);
    return $out;
}
?>

除此之外,我们还需要将其进行调用,在 sidebar.php<!--博客信息-->相应位置添加以下代码:

<li class="list-group-item text-second"><span class="blog-info-icons"><i data-feather="edit-3"></i></span><span class="badge pull-right"><?php echo allOfCharacters(); ?></span><?php _me("全站字数") ?></li>

复制弹窗

首先将以下代码添加至后台主题 自定义输出body尾部的HTML代码

<!--引用复制弹窗js-->
<script src="//lib.baomitu.com/layer/3.1.1/layer.js"></script>

后台-设置外观-开发者设置-自定义JS 添加以下代码

<!--复制弹窗-->
document.body.oncopy = function() {layer.msg('复制成功,若要转载请务必保留原文链接!');};

文章正文到此结束

在主题文件 post.php

<?php echo Content::postContent($this,$this->user->hasLogin());?>

在此代码下方加上

<div class="entry-content l-h-2x">
  <div style="border-top: 2px dotted #8e8e8e96;height: 0px;margin: 20px 0px;text-align: center;width: 100%;">
  <span style="background-color: #23b7e5;color: #fff;padding: 6px 10px;position: relative;top: -14px;border-radius: 14px;">正文到此结束</span>
</div>

文章版权声明

在主题文件 post.php内,刚刚加的正文到此结束下加上

<div style="padding: 10px;background: rgba(220, 220, 220, 0.22);font-size: 13px;border-left: 3px solid;text-align: left;">
  <span>本文作者:<a href="<?php $this->author->permalink(); ?>" rel="author"> <?php $this->author(); ?></a></span>
  <span>文章标题:<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a><br>
  <span>本文地址:<a href="<?php $this->permalink() ?>"><?php $this->permalink() ?></a><br>
  <span>版权说明:若无注明,本文皆 <a href="<?php $this->options->siteUrl(); ?>" target="_blank" data-original-title="<?php $this->options->title() ?>"><?php $this->options->title() ?></a> 原创,转载请保留文章出处。</span>
</div>

添加高级删除线

在主题文件 header.php内底部 head上面添加以下代码

<!--高级删除线-->
<style type="text/css"> 
span.CA a.external,span.CA a.external:visited,span.CA a.extiw,span.CA a.extiw:visited {
    color: #252525
}
.CA,.CA a,a .CA,.CA a.new {
    background-color: #252525;
    color: #252525;
    text-shadow: none
}
body:not(.CA_toggle_on) .CA:hover,body:not(.CA_toggle_on) .CA:active,body:not(.CA_toggle_on) .CA.off {
    transition: color .13s linear;
    color: #fff
}
body:not(.CA_toggle_on) .CA:hover a,body:not(.CA_toggle_on) a:hover .CA,body:not(.CA_toggle_on) .CA.off a,body:not(.CA_toggle_on) a:hover .CA.off {
    transition: color .13s linear;
    color: #add8e6
}
body:not(.CA_toggle_on) .CA.off .new,body:not(.CA_toggle_on) .CA.off .new:hover,body:not(.CA_toggle_on) .new:hover .CA.off,body:not(.CA_toggle_on) .CA.off .new,body:not(.CA_toggle_on) .CA.off .new:hover,body:not(.CA_toggle_on) .new:hover .CA.off {
    transition: color .13s linear;
    color: #ba0000
}
</style>

食用方法

!!!
<span class="CA" title="你知道的太多了">你想说啥</span>
!!!

文章标题居中

后台-设置外观-开发者设置-自定义CSS 添加以下代码

/*文章标题居中*/
.panel h2{
    text-align: center; 
}
.post-item-foot-icon{
    text-align: center;
}

首页文章版式圆角化

后台-设置外观-开发者设置-自定义CSS 添加以下代码

#圆角大小可修改15px数值(别复制该行)
/*首页文章版式圆角化*/
.panel{
    border: none;
    border-radius: 15px;
}

.panel-small{
    border: none;
    border-radius: 15px;
}

.item-thumb{
    border-radius: 15px;  
}

歌单圆角化

后台-设置外观-开发者设置-自定义CSS 添加以下代码

/*歌单圆角化*/
    #skPlayer .skPlayer-list {
        border-radius: 1px 1px 10px 10px; 
    }
    #skPlayer .skPlayer-list .skPlayer-list-sign{
        background-color: #b822c1;
    }

手机界面隐藏

后台-设置外观-开发者设置-自定义CSS 添加以下代码

/*手机不显示*/
/* #tag_cloud-2为标签云,#tabs-4为博客评论随机文章,#a_d_sidebar为广告,#blog_info为博客信息,可自行组合显示或隐藏*/
@media (max-width:767px) {
    #blog_info,#tag_cloud-2,#tabs-4,#a_d_sidebar {
        display: none;
    }
}

彩色标签云

后台-设置外观-开发者设置-自定义JS 添加以下代码

<!--彩色标签云-->
let tags = document.querySelectorAll("#tag_cloud-2 a");
let colorArr = ["#428BCA", "#AEDCAE", "#ECA9A7", "#DA99FF", "#FFB380", 
"#D9B999"];
tags.forEach(tag => {
    tagsColor = colorArr[Math.floor(Math.random() * colorArr.length)];
    tag.style.backgroundColor = tagsColor;
});

插件类

Mac风格代码高亮

插件下载:[button color=“success” icon=“fontello fontello-gratipay” url=“https://sublog.lanzous.com/iegvcf4j92j” type=""]点击下载[/button]

食用方法

  1. 下载本插件,解压到usr/pugins/目录中
  2. 进入网站后台-控制台-插件-激活插件
  3. 设置:选择主题风格,是否显示行号等,默认开启
  4. 修改(替换)/usr/themes/handsome/assets/css/下的handsome.min.css文件

下载文件

[hide]

Handsome 6.0.0 CSS文件:[button color=“info” url=“https://sublog.lanzous.com/i4zlnf4jjxa” type=""]点击下载[/button]

Handsome 7.2.1 版本(7.x版本通用:[button color=“success” url=“https://pan.baidu.com/share/init?surl=vfeXOlrzgtcnfw4G_hOVFQ” type=""]点击下载[/button] 提取码:1122

[/hide]

应用方法

/```php
<?php
$aa=60;
echo 'hello '.'xxx'.$aa."\n";
echo date('Y-m-d H:i:s',time())."\n";
echo "PHP版本:".phpversion();
?>
/```

将上方 / 去掉即可

Hansome主题专用的UserAgent插件

食用指南

  1. 操作前请做好相应备份工作
  2. 此插件只适用于Handsome主题,未对其它主题优化!!!
  3. 请先将插件置于Typechoplugins目录下,且插件目录名应为UserAgent,注意大小写,否则将无法正常食用!!!
  4. 修改Handsome主题,component目录下的comments.php代码文件,大概第60~80行左右,
<span class="comment-author vcard">
    <b class="fn"><?php echo $author; ?></b><?php echo $Identity; ?>
</span>

添加代码 <?php UserAgent_Plugin::get_useragent($comments->agent,$comments->ip); ?> ,修改后代码如下:

<span class="comment-author vcard">
    <b class="fn"><?php echo $author; ?></b><?php echo $Identity; ?><?php UserAgent_Plugin::get_useragent($comments->agent,$comments->ip); ?>
</span>

获取真实IP

Typecho开启CDN后,可能无法获取访客真实IP,只能取得CDN节点IP,为此可以在Typecho博客网站的根目录的 config.inc.php插入下面的代码:

//** 防止CDN造成无法获取客户真实IP地址 */
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) 
{
    $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
    $_SERVER['REMOTE_ADDR'] = $list[0];
}

详细说明

松鼠博客-安利一款Hansome主题专用的UserAgent插件

插件****下载

[button color=“success” icon=“glyphicon glyphicon-send” url=“https://doge.uk/wp-content/uploads/2020/03/1583421311-1902984185.zip” type=""]UserAgent-1.1.1.zip[/button]
[button color=“info” icon=“glyphicon glyphicon-send” url=“https://doge.uk/wp-content/uploads/2020/03/1583421390-1651853883.zip” type=""]UserAgent-1.1.0.zip[/button]

写在最后

[scode type=“share”]后续持续完善[/scode]

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

拾柒代号007

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值