forked from typecho-fans/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request typecho-fans#71 from ghosx/master
新增一款插件
- Loading branch information
Showing
11 changed files
with
2,801 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* typecho 博客的一款返回顶部插件 | ||
* | ||
* @package TopTop | ||
* @author Heeeepin | ||
* @version 1.0.0 | ||
* @link http://heeeepin.com | ||
*/ | ||
|
||
class TopTop_Plugin implements Typecho_Plugin_Interface | ||
{ | ||
/** | ||
* 激活插件方法,如果激活失败,直接抛出异常 | ||
* | ||
* @access public | ||
* @return void | ||
* @throws Typecho_Plugin_Exception | ||
*/ | ||
public static function activate() { | ||
Typecho_Plugin::factory('Widget_Archive')->header = array('TopTop_Plugin', 'header'); | ||
Typecho_Plugin::factory('Widget_Archive')->footer = array('TopTop_Plugin', 'footer'); | ||
return "插件启动成功"; | ||
} | ||
|
||
/** | ||
* 禁用插件方法,如果禁用失败,直接抛出异常 | ||
* | ||
* @static | ||
* @access public | ||
* @return void | ||
* @throws Typecho_Plugin_Exception | ||
*/ | ||
public static function deactivate() { | ||
return "插件禁用成功"; | ||
} | ||
|
||
/** | ||
* 获取插件配置面板 | ||
* | ||
* @access public | ||
* @param Typecho_Widget_Helper_Form $form 配置面板 | ||
* @return void | ||
*/ | ||
public static function config(Typecho_Widget_Helper_Form $form) { | ||
$m1 = Helper::options()->pluginUrl . '/TopTop/models/1.png'; | ||
$m2 = Helper::options()->pluginUrl . '/TopTop/models/2.png'; | ||
$model1 = "<img src=$m1 alt='模型1'/>"; | ||
$model2 = "<img src=$m2 alt='模型2'/>"; | ||
$jquery = new Typecho_Widget_Helper_Form_Element_Checkbox('jquery', array('jquery' => '禁止加载jQuery'), false, _t('Jquery设置'), _t('插件需要加载jQuery,如果主题模板已经引用加载JQuery,则可以勾选。')); | ||
$model = new Typecho_Widget_Helper_Form_Element_Radio('model', array('model1' => $model1,'model2'=>$model2), 'model2', _t('模型设置'), _t('选择一个你喜欢的模型')); | ||
$form->addInput($jquery); | ||
$form->addInput($model); | ||
} | ||
|
||
|
||
/** | ||
* 个人用户的配置面板 | ||
* | ||
* @access public | ||
* @param Typecho_Widget_Helper_Form $form | ||
* @return void | ||
*/ | ||
public static function personalConfig(Typecho_Widget_Helper_Form $form) { | ||
|
||
} | ||
|
||
|
||
/** | ||
* 页头输出相关代码 | ||
* | ||
* @access public | ||
* @param unknown header | ||
* @return unknown | ||
*/ | ||
public static function header() { | ||
$path = Helper::options()->pluginUrl . '/TopTop/'; | ||
$options = Helper::options()->plugin('TopTop'); | ||
$model = $options->model; | ||
echo '<link rel="stylesheet" type="text/css" href="' . $path . 'css/'.$model.'.css" />'; | ||
} | ||
|
||
|
||
/** | ||
* 页脚输出相关代码 | ||
* | ||
* @access public | ||
* @param unknown footer | ||
* @return unknown | ||
*/ | ||
public static function footer() { | ||
$path = Helper::options()->pluginUrl . '/TopTop/'; | ||
$options = Helper::options()->plugin('TopTop'); | ||
echo '<div class="back-to-top" style="top: -700px;"></div>'; | ||
if (!$options->jquery) { | ||
echo '<script type="text/javascript" src="' . $path . 'js/jquery.min.js"></script>'; | ||
} | ||
echo '<script type="text/javascript" src="' . $path . 'js/toptop.js"></script>'; | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# TopTop | ||
|
||
typecho 博客的一款返回顶部插件 | ||
|
||
## 使用方法 | ||
|
||
Download ZIP, 解压 | ||
|
||
重命名文件夹为TopTop | ||
|
||
上传至usr/plugins目录 | ||
|
||
登录后台启用即可 | ||
|
||
## 主题 | ||
|
||
自带两套主题,欢迎提供想法 | ||
|
||
在线体验: [夜雨博客](https://heeeepin.com) | ||
|
||
 | ||
 | ||
|
||
|
||
## 感谢 | ||
|
||
[GoTop](/~https://github.com/NicoNicooooo/GoTop) | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@media (max-width: 1000px) { | ||
.back-to-top { | ||
display: none !important; | ||
} | ||
} | ||
|
||
.topButton { | ||
display: none; | ||
} | ||
|
||
.back-to-top { | ||
cursor: pointer; | ||
position: fixed; | ||
right: 80px; | ||
top: -999px; | ||
z-index: 2; | ||
width: 70px; | ||
height: 800px; | ||
background: url(../images/1.png); | ||
transition: all .5s ease-in-out; | ||
opacity: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@media (max-width: 1000px) { | ||
.back-to-top { | ||
display: none !important; | ||
} | ||
} | ||
|
||
.topButton { | ||
display: none; | ||
} | ||
|
||
.back-to-top { | ||
cursor: pointer; | ||
position: fixed; | ||
right: 80px; | ||
top: -999px; | ||
z-index: 2; | ||
width: 70px; | ||
height: 800px; | ||
background: url(../images/2.png); | ||
transition: all .5s ease-in-out; | ||
opacity: 1; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.