复制版权提醒代码
把以下代码加入到footer.php
<script>
document.body.addEventListener('copy', function (e) {
if (window.getSelection().toString() && window.getSelection().toString().length > 42) {
setClipboardText(e);
alert('商业转载请联系作者获得授权,非商业转载请注明出处,谢谢合作。');
}
});
function setClipboardText(event) {
var clipboardData = event.clipboardData || window.clipboardData;
if (clipboardData) {
event.preventDefault();
var htmlData = ''
+ '著作权归作者所有。<br>'
+ '商业转载请联系作者获得授权,非商业转载请注明出处。<br>'
+ '作者:<?php $this->author() ?><br>'
+ '链接:' + window.location.href + '<br>'
+ '来源:<?php $this->options->siteUrl(); ?><br><br>'
+ window.getSelection().toString();
var textData = ''
+ '著作权归作者所有。\n'
+ '商业转载请联系作者获得授权,非商业转载请注明出处。\n'
+ '作者:<?php $this->author() ?>\n'
+ '链接:' + window.location.href + '\n'
+ '来源:<?php $this->options->siteUrl(); ?>\n\n'
+ window.getSelection().toString();
clipboardData.setData('text/html', htmlData);
clipboardData.setData('text/plain',textData);
}
}
</script>
网站不同时间问候语
<div class="sidebar">
<div class="widget widget_ui_textads widget_twitter"><a class="style01"><strong>温馨提示:</strong>
<br><br><font size="2" color="#999">
<script language="JavaScript">
day = new Date( )
nge_Hour = day.getHours( )
var nge_warmprompt = "";
if (nge_Hour == 0)
nge_warmprompt = "现在已经过凌晨了,身体是无价的资本喔,小伙伴早点休息吧! --Laoyao"
if (nge_Hour == 1)
nge_warmprompt = "凌晨1点多了,工作是永远都做不完的,小伙伴别熬坏身子! --Laoyao"
if (nge_Hour == 2)
nge_warmprompt = "亲爱的小伙伴该休息了,身体可是革命的本钱啊! --Laoyao"
if (nge_Hour == 3)
nge_warmprompt = "夜深了,熬夜很容易导致身体内分泌失调,长痘痘的! --Laoyao"
if (nge_Hour == 4)
nge_warmprompt = "四点过了额(⊙o⊙)…,你明天不学习工作吗??? --Laoyao"
if (nge_Hour == 5)
nge_warmprompt = "你知道吗,此时是国内网络速度最快的时候! --Laoyao"
if (nge_Hour == 6)
nge_warmprompt = "清晨好,这么早就来网站啦,谢谢小伙伴的关注哦,昨晚做的梦好吗? --Laoyao "
if (nge_Hour == 7)
nge_warmprompt = "新的一天又开始了,祝你过得快乐! --Laoyao"
if (nge_Hour == 8)
nge_warmprompt = "小伙伴早上好哦,一天之际在于晨,又是美好的一天! --Laoyao"
if ((nge_Hour == 9) || (nge_Hour ==10))
nge_warmprompt = "上午好!今天你看上去好精神哦! --Laoyao"
if (( nge_Hour == 11) || (nge_Hour == 12))
nge_warmprompt = "小伙伴啊!该吃午饭啦!有什么好吃的?您有中午休息的好习惯吗? --Laoyao"
if (( nge_Hour >= 13) && (nge_Hour <= 17))
nge_warmprompt = "下午好!外面的天气好吗?记得朵朵白云曾捎来朋友殷殷的祝福。 --Laoyao"
if (( nge_Hour >= 17) && (nge_Hour <= 18))
nge_warmprompt = "太阳落山了!快看看夕阳吧!如果外面下雨,就不必了 ^_^ --Laoyao"
if (( nge_Hour >= 18) && (nge_Hour <= 19))
nge_warmprompt = "晚上好,小伙伴今天的心情怎么样?去留言板诉说一下吧! --Laoyao"
if (( nge_Hour >= 19) && (nge_Hour <= 21))
nge_warmprompt = "忙碌了一天,累了吧?去看看最新的新闻资讯醒醒脑吧! --Laoyao"
if (( nge_Hour >= 22) && (nge_Hour <= 23))
nge_warmprompt = "这么晚了,小伙伴还在上网?早点洗洗睡吧,睡前记得洗洗脸喔!明天一天都会萌萌哒! --Laoyao"
document.write("<div><i class='fa fa-beer'></i> ")
document.write(nge_warmprompt)
document.write("</div>")
</script>
</font><br>
</a>
</div>
</div>
</div>
博客加对联
<SCRIPT language="JavaScript">
lastScrollY = 0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
//alert(diffY);
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("leftDiv").style.top = parseInt(document.getElementById("leftDiv").style.top)+percent+"px";
document.getElementById("rightDiv").style.top = parseInt(document.getElementById("rightDiv").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
//下面这段删除后,对联将不跟随屏幕而移动。
window.setInterval("heartBeat()",1);
//-->
//关闭按钮
function close_left2(){
left2.style.visibility='hidden';
}
function close_right2(){
right2.style.visibility='hidden';
}
//显示样式
document.writeln("<style type=\"text\/css\">");
document.writeln("#leftDiv,#rightDiv{position:absolute;}");
document.writeln(".itemFloat{width:100px;height:auto;line-height:5px}");
document.writeln("<\/style>");
//以下为主要内容
document.writeln("<div id=\"leftDiv\" style=\"top:112px;left:50px\">");
//------左侧各块开始
//---L2
document.writeln("<div id=\"left2\" class=\"itemFloat\">");
document.writeln("<a href="//www.mantouxia.com/usr/uploads/img/duilianzuo.png" class="highslide" onclick="return hs.expand(this,{slideshowGroup:'images'})"><img border=0 src=//www.mantouxia.com/usr/uploads/img/duilianzuo.png></a>");
document.writeln("<br><a href=\"javascript:close_left2();\" title=\"关闭上面的广告\">×<\/a>");
document.writeln("<\/div>");
//------左侧各块结束
document.writeln("<\/div>");
document.writeln("<div id=\"rightDiv\" style=\"top:112px;right:50px\">");
//------右侧各块结束
//---R2
document.writeln("<div id=\"right2\" class=\"itemFloat\">");
document.writeln("<a href="//www.mantouxia.com/usr/uploads/img/duilianyou.png" class="highslide" onclick="return hs.expand(this,{slideshowGroup:'images'})"><img border=0 src=//www.mantouxia.com/usr/uploads/img/duilianyou.png></a>");
document.writeln("<br><a href=\"javascript:close_right2();\" title=\"关闭上面的广告\">×<\/a>");
document.writeln("<\/div>");
//------右侧各块结束
document.writeln("<\/div>");
</SCRIPT>
首页文章列表悬停上浮
/*首页文章列表悬停上浮*/
.blog-post .panel:not(article) {
transition: all 0.3s;
}
.blog-post .panel:not(article):hover {
transform: translateY(-10px);
box-shadow: 0 8px 10px rgb(88,0,0);
}
头像呼吸光环和鼠标悬停旋转放大
/*头像呼吸光环和鼠标悬停旋转放大*/
.img-full {
border-radius: 50%;
animation: light 4s ease-in-out infinite;
transition: 0.5s;
}
.img-full:hover {
transform: scale(1.15) rotate(720deg);
}
@keyframes light {
0% {
box-shadow: 0 0 4px #f00;
}
25% {
box-shadow: 0 0 16px #0f0;
}
50% {
box-shadow: 0 0 4px #00f;
}
75% {
box-shadow: 0 0 16px #0f0;
}
100% {
box-shadow: 0 0 4px #f00;
}
}
修改 Typecho 主题时,需要判断当前用户角色,对于管理员角色,显示内容,可使用如下:
<?php $currGroup = get_object_vars($this->user) ['row']['group'];if ($currGroup == "administrator"): ?>
若为管理员,显示此区域内容
<?php else: ?>//else可去
非管理员,显示此区域内容
<?php endif;?>
评论