parent
ef4a6ead5f
commit
c9ee3e75bc
4 changed files with 282 additions and 0 deletions
@ -0,0 +1,166 @@ |
||||
<?php |
||||
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; |
||||
/** |
||||
* Copyright for Typecho |
||||
* |
||||
* @package Copyright |
||||
* @author Yves X |
||||
* @version 1.0.3 |
||||
* @link https://github.com/Yves-X/Copyright-for-Typecho |
||||
*/ |
||||
|
||||
class Copyright_Plugin implements Typecho_Plugin_Interface { |
||||
/** |
||||
* 激活插件方法,如果激活失败,直接抛出异常 |
||||
* |
||||
* @access public |
||||
* @return void |
||||
* @throws Typecho_Plugin_Exception |
||||
*/ |
||||
public static function activate() { |
||||
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Copyright_Plugin', 'Copyright'); |
||||
} |
||||
|
||||
/** |
||||
* 禁用插件方法,如果禁用失败,直接抛出异常 |
||||
* |
||||
* @static |
||||
* @access public |
||||
* @return void |
||||
* @throws Typecho_Plugin_Exception |
||||
*/ |
||||
public static function deactivate() { |
||||
} |
||||
|
||||
/** |
||||
* 获取插件配置面板 |
||||
* |
||||
* @access public |
||||
* @param Typecho_Widget_Helper_Form $form 配置面板 |
||||
* @return void |
||||
*/ |
||||
public static function config(Typecho_Widget_Helper_Form $form) { |
||||
echo '<p>欢迎使用 Typecho 版权插件。</p>'; |
||||
echo '<p>此插件帮助你设置文章与独立页面的版权声明,它会附在内容末尾。你也可以对特定某篇内容设置版权信息。</p>'; |
||||
echo '<p>版权信息借助插件与 Typecho 的自定义字段功能实现,只与插件或特定内容关联,而不会修改其内容本身,也不会在数据库中与文本混同。</p>'; |
||||
echo '<hr />'; |
||||
echo '<p>此处为<b>全局设置</b></p>'; |
||||
echo '<p>如需对特定某篇内容设置版权信息,请参阅<b><a href="https://github.com/Yves-X/Copyright-for-Typecho">详细说明</a></b>'; |
||||
echo '<p>特定设置的优先级始终高于全局设置,所以如果你给某篇文章单独设置了版权信息,你所设置的部分将会覆盖全局设置</p>'; |
||||
echo '<hr />'; |
||||
echo '作者曾有很长一段时间没有维护此插件,这期间它随 Typecho 1.1 更新而失效。感谢该网友修复了此插件,使得它可以在 Typecho 1.1 下继续工作:<a href="https://lolico.moe" target="_blank">神代綺凜</a>'; |
||||
echo '<hr />'; |
||||
$author = new Typecho_Widget_Helper_Form_Element_Text('author', NULL, _t('作者名称'), _t('作者')); |
||||
$form->addInput($author); |
||||
$notice = new Typecho_Widget_Helper_Form_Element_Text('notice', NULL, _t('转载时须注明出处及本声明'), _t('声明')); |
||||
$form->addInput($notice); |
||||
$showURL = new Typecho_Widget_Helper_Form_Element_Checkbox('showURL', array(1 => _t('显示原(本)文链接')), NULL, NULL, NULL); |
||||
$form->addInput($showURL); |
||||
$showOnPost = new Typecho_Widget_Helper_Form_Element_Checkbox('showOnPost', array(1 => _t('在文章显示')), NULL, NULL, NULL); |
||||
$form->addInput($showOnPost); |
||||
$showOnPage = new Typecho_Widget_Helper_Form_Element_Checkbox('showOnPage', array(1 => _t('在独立页面显示')), NULL, NULL, NULL); |
||||
$form->addInput($showOnPage); |
||||
} |
||||
|
||||
/** |
||||
* 个人用户的配置面板 |
||||
* |
||||
* @access public |
||||
* @param Typecho_Widget_Helper_Form $form |
||||
* @return void |
||||
*/ |
||||
public static function personalConfig(Typecho_Widget_Helper_Form $form) { |
||||
} |
||||
|
||||
/** |
||||
* 插件实现方法 |
||||
* |
||||
* @access public |
||||
* @return void |
||||
*/ |
||||
|
||||
public static function Copyright($content, $widget, $lastResult) { |
||||
$content = empty($lastResult) ? $content : $lastResult; |
||||
$cr = self::apply($widget); |
||||
$cr_html = self::render($cr); |
||||
$content = $content . $cr_html; |
||||
return $content; |
||||
} |
||||
|
||||
private static function globalCopyright($widget) { |
||||
$cr = array('show_on_post' => '', 'show_on_page' => '', 'show_url' => '', 'author' => '', 'url' => '', 'notice' => ''); |
||||
$cr['show_on_post'] = Typecho_Widget::widget('Widget_Options')->plugin('Copyright')->showOnPost; |
||||
$cr['show_on_page'] = Typecho_Widget::widget('Widget_Options')->plugin('Copyright')->showOnPage; |
||||
$cr['show_url'] = Typecho_Widget::widget('Widget_Options')->plugin('Copyright')->showURL[0]; |
||||
$cr['author'] = Typecho_Widget::widget('Widget_Options')->plugin('Copyright')->author; |
||||
$cr['url'] = Typecho_Widget::widget('Widget_Options')->plugin('Copyright')->url; |
||||
$cr['notice'] = Typecho_Widget::widget('Widget_Options')->plugin('Copyright')->notice; |
||||
return $cr; |
||||
} |
||||
|
||||
private static function localCopyright($widget) { |
||||
$cr = array('switch_on' => '', 'author' => '', 'url' => '', 'notice' => ''); |
||||
if ($widget->fields->switch) { |
||||
$cr['switch_on'] = 1; |
||||
} |
||||
$cr['author'] = $widget->fields->author; |
||||
$cr['url'] = $widget->fields->url; |
||||
$cr['notice'] = $widget->fields->notice; |
||||
return $cr; |
||||
} |
||||
|
||||
private static function apply($widget) { |
||||
$gcr = self::globalCopyright($widget); |
||||
$lcr = self::localCopyright($widget); |
||||
$cr = array('is_enable' => '', 'is_original' => '', 'author' => '', 'url' => '', 'notice' => ''); |
||||
if ($widget->is('single')) { |
||||
$cr['is_enable'] = 1; |
||||
} |
||||
if ($widget->parameter->type == 'post' && $gcr['show_on_post'] == 0) { |
||||
$cr['is_enable'] = 0; |
||||
} |
||||
if ($widget->parameter->type == 'page' && $gcr['show_on_page'] == 0) { |
||||
$cr['is_enable'] = 0; |
||||
} |
||||
if ($lcr['switch_on'] != '') { |
||||
$cr['is_enable'] = $lcr['switch_on']; |
||||
} |
||||
if ($gcr['show_url'] == 0) { |
||||
$cr['url'] = 0; |
||||
} |
||||
$cr['url'] = $lcr['url'] != '' ? $lcr['url'] : $gcr['url']; |
||||
if ($gcr['show_url'] == 1 && $lcr['url'] == '') { |
||||
$cr['is_original'] = 1; |
||||
$cr['url'] = $widget->permalink; |
||||
} |
||||
$cr['author'] = $lcr['author'] != '' ? $lcr['author'] : $gcr['author']; |
||||
$cr['notice'] = $lcr['notice'] != '' ? $lcr['notice'] : $gcr['notice']; |
||||
return $cr; |
||||
} |
||||
|
||||
private static function render($cr) { |
||||
$copyright_html = ''; |
||||
$t_author = ''; |
||||
$t_notice = ''; |
||||
$t_url = ''; |
||||
if ($cr['is_enable']) { |
||||
if ($cr['author']) { |
||||
$t_author = '<p class="content-copyright">版权属于:' . $cr['author'] . '</p>'; |
||||
} |
||||
if ($cr['url']) { |
||||
if ($cr['is_original']) { |
||||
$t_url = '<p class="content-copyright">本文链接:<a class="content-copyright" href="' . $cr['url'] . '">' . $cr['url'] . '</a></p>'; |
||||
} else { |
||||
$t_url = '<p class="content-copyright">原文链接:<a class="content-copyright" target="_blank" href="' . $cr['url'] . '">' . $cr['url'] . '</a></p>'; |
||||
} |
||||
} |
||||
if ($cr['notice']) { |
||||
$t_notice = '<p class="content-copyright">' . $cr['notice'] . '</p>'; |
||||
} |
||||
$copyright_html = '<hr class="content-copyright" style="margin-top:50px" /><blockquote class="content-copyright" style="margin-top:50px;padding:16px;background-color:rgba(255,255,255,0.7);border-left:5px solid rgba(114,102,186,0.7);">' . $t_author . $t_url . $t_notice . '</blockquote>'; |
||||
} |
||||
return $copyright_html; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,80 @@ |
||||
/*Modifi-css for handsome 4.4.x*/ |
||||
/*all*/ |
||||
.no-margin { |
||||
margin: 0!important |
||||
} |
||||
/*scrollbar*/ |
||||
*::-webkit-scrollbar { |
||||
width: 8px!important; |
||||
height: 8px!important |
||||
} |
||||
|
||||
*::-webkit-scrollbar-thumb { |
||||
border-radius: 4px; |
||||
background-color: #999!important |
||||
} |
||||
|
||||
*::-webkit-scrollbar-track-piece { |
||||
background: #eee!important |
||||
} |
||||
|
||||
*::-webkit-scrollbar-thumb:hover { |
||||
background-color: #777!important |
||||
} |
||||
|
||||
*::-webkit-scrollbar-thumb:active { |
||||
background-color: #555!important |
||||
} |
||||
/*app&toc*/ |
||||
|
||||
|
||||
|
||||
aside.col.w-md.no-border-xs { |
||||
transition: all .3s |
||||
} |
||||
|
||||
.visible-xs-inline { |
||||
display: inline-block!important |
||||
} |
||||
|
||||
@media screen and (min-width:768px) and (max-width:1140px) { |
||||
.visible-xs-inline { |
||||
display: none!important |
||||
} |
||||
} |
||||
|
||||
.tocify-item { |
||||
background-color: rgba(255,255,255,.8) |
||||
} |
||||
|
||||
.tocify-item.active { |
||||
color: #7266ba; |
||||
font-weight: 700 |
||||
}/*kotori*/#kotori { |
||||
position: absolute; |
||||
left: -15px; |
||||
bottom: -15px; |
||||
max-height: 110px; |
||||
transition: all .3s |
||||
} |
||||
|
||||
#kotori:hover { |
||||
left: 0; |
||||
bottom: 0 |
||||
} |
||||
|
||||
#kotori.hidekotori { |
||||
left: -110px; |
||||
bottom: -110px |
||||
} |
||||
|
||||
@media screen and (max-width:767px) { |
||||
#kotori { |
||||
display: none |
||||
} |
||||
|
||||
.blog-post>.panel:hover .index-post-img .item-thumb { |
||||
transform: none!important |
||||
} |
||||
} |
||||
|
@ -0,0 +1,2 @@ |
||||
(function webpackUniversalModuleDefinition(a,b){if(typeof exports==="object"&&typeof module==="object"){module.exports=b()}else{if(typeof define==="function"&&define.amd){define([],b)}else{if(typeof exports==="object"){exports["POWERMODE"]=b()}else{a["POWERMODE"]=b()}}}})(this,function(){return(function(a){var b={};function c(e){if(b[e]){return b[e].exports}var d=b[e]={exports:{},id:e,loaded:false};a[e].call(d.exports,d,d.exports,c);d.loaded=true;return d.exports}c.m=a;c.c=b;c.p="";return c(0)})([function(c,g,b){var d=document.createElement("canvas");d.width=window.innerWidth;d.height=window.innerHeight;d.style.cssText="position:fixed;top:0;left:0;pointer-events:none;z-index:999999";window.addEventListener("resize",function(){d.width=window.innerWidth;d.height=window.innerHeight});document.body.appendChild(d);var a=d.getContext("2d");var n=[];var j=0;var k=120;var f=k;var p=false;o.shake=true;function l(r,q){return Math.random()*(q-r)+r}function m(r){if(o.colorful){var q=l(0,360);return"hsla("+l(q-10,q+10)+", 100%, "+l(50,80)+"%, "+1+")"}else{return window.getComputedStyle(r).color}}function e(){var t=document.activeElement;var v;if(t.tagName==="TEXTAREA"||(t.tagName==="INPUT"&&t.getAttribute("type")==="text")){var u=b(1)(t,t.selectionStart);v=t.getBoundingClientRect();return{x:u.left+v.left,y:u.top+v.top,color:m(t)}}var s=window.getSelection();if(s.rangeCount){var q=s.getRangeAt(0);var r=q.startContainer;if(r.nodeType===document.TEXT_NODE){r=r.parentNode}v=q.getBoundingClientRect();return{x:v.left,y:v.top,color:m(r)}}return{x:0,y:0,color:"transparent"}}function h(q,s,r){return{x:q,y:s,alpha:1,color:r,velocity:{x:-1+Math.random()*2,y:-3.5+Math.random()*2}}}function o(){var t=e();var s=5+Math.round(Math.random()*10);while(s--){n[j]=h(t.x,t.y,t.color);j=(j+1)%500}f=k;if(!p){requestAnimationFrame(i)}if(o.shake){var r=1+2*Math.random();var q=r*(Math.random()>0.5?-1:1);var u=r*(Math.random()>0.5?-1:1);document.body.style.marginLeft=q+"px";document.body.style.marginTop=u+"px";setTimeout(function(){document.body.style.marginLeft="";document.body.style.marginTop=""},75)}}o.colorful=false;function i(){if(f>0){requestAnimationFrame(i);f--;p=true}else{p=false}a.clearRect(0,0,d.width,d.height);for(var q=0;q<n.length;++q){var r=n[q];if(r.alpha<=0.1){continue}r.velocity.y+=0.075;r.x+=r.velocity.x;r.y+=r.velocity.y;r.alpha*=0.96;a.globalAlpha=r.alpha;a.fillStyle=r.color;a.fillRect(Math.round(r.x-1.5),Math.round(r.y-1.5),3,3)}}requestAnimationFrame(i);c.exports=o},function(b,a){(function(){var d=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"];var e=window.mozInnerScreenX!=null;function c(k,l,o){var h=o&&o.debug||false;if(h){var i=document.querySelector("#input-textarea-caret-position-mirror-div");if(i){i.parentNode.removeChild(i)}}var f=document.createElement("div");f.id="input-textarea-caret-position-mirror-div";document.body.appendChild(f);var g=f.style;var j=window.getComputedStyle?getComputedStyle(k):k.currentStyle;g.whiteSpace="pre-wrap";if(k.nodeName!=="INPUT"){g.wordWrap="break-word"}g.position="absolute";if(!h){g.visibility="hidden"}d.forEach(function(p){g[p]=j[p]});if(e){if(k.scrollHeight>parseInt(j.height)){g.overflowY="scroll"}}else{g.overflow="hidden"}f.textContent=k.value.substring(0,l);if(k.nodeName==="INPUT"){f.textContent=f.textContent.replace(/\s/g,"\u00a0")}var n=document.createElement("span");n.textContent=k.value.substring(l)||".";f.appendChild(n);var m={top:n.offsetTop+parseInt(j["borderTopWidth"]),left:n.offsetLeft+parseInt(j["borderLeftWidth"])};if(h){n.style.backgroundColor="#aaa"}else{document.body.removeChild(f)}return m}if(typeof b!="undefined"&&typeof b.exports!="undefined"){b.exports=c}else{window.getCaretCoordinates=c}}())}])}); |
||||
POWERMODE.colorful=true;POWERMODE.shake=false;document.body.addEventListener("input",POWERMODE); |
Loading…
Reference in new issue