Skip to content

Commit

Permalink
0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanDecode committed Nov 18, 2018
1 parent 8563787 commit aea6fc9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
15 changes: 8 additions & 7 deletions Plugin.php
Expand Up @@ -7,11 +7,11 @@
*
* @package DoubanBoard
* @author 熊猫小A
* @version 0.3
* @link https://imalan.cn
* @version 0.4
* @link https://www.imalan.cn
*/

define('DoubanBoard_Plugin_VERSION', '0.3');
define('DoubanBoard_Plugin_VERSION', '0.4');

class DoubanBoard_Plugin implements Typecho_Plugin_Interface
{
Expand Down Expand Up @@ -59,9 +59,9 @@ public static function config(Typecho_Widget_Helper_Form $form){
更多介绍:<a href="https://blog.imalan.cn/archives/168/" target="_blank">Typecho-Plugin-DoubanBoard</a>';
$ID = new Typecho_Widget_Helper_Form_Element_Text('ID', NULL, '', _t('豆瓣 ID'), _t('填写豆瓣ID'));
$form->addInput($ID);
$PageSize = new Typecho_Widget_Helper_Form_Element_Text('PageSize', NULL, '', _t('每次加载的数量'), _t('填写每次加载的数量,不填默认为 10。注意:豆瓣限制最多取得 100 条数据。'));
$PageSize = new Typecho_Widget_Helper_Form_Element_Text('PageSize', NULL, '10', _t('每次加载的数量'), _t('填写每次加载的数量,不填默认为 10。注意:豆瓣限制最多取得 100 条数据。'));
$form->addInput($PageSize);
$ValidTimeSpan = new Typecho_Widget_Helper_Form_Element_Text('ValidTimeSpan', NULL, '', _t('缓存过期时间'), _t('填写缓存过期时间,单位秒。默认 24 小时。'));
$ValidTimeSpan = new Typecho_Widget_Helper_Form_Element_Text('ValidTimeSpan', NULL, '86400', _t('缓存过期时间'), _t('填写缓存过期时间,单位秒。默认 24 小时。'));
$form->addInput($ValidTimeSpan);
$loadJQ= new Typecho_Widget_Helper_Form_Element_Checkbox('loadJQ', array('jq'=>_t('配置是否引入 JQuery:勾选则引入不勾选则不引入<br>')),array('jq'), _t('基本设置'));
$form->addInput($loadJQ);
Expand All @@ -83,7 +83,8 @@ public static function personalConfig(Typecho_Widget_Helper_Form $form){}
*/
public static function header()
{
echo '<link rel="stylesheet" href="/usr/plugins/DoubanBoard/assets/DoubanBoard.0.3.css?v='.DoubanBoard_Plugin_VERSION.'" />';
echo '<link rel="stylesheet" href="/usr/plugins/DoubanBoard/assets/DoubanBoard.04.css?v='.DoubanBoard_Plugin_VERSION.'" />';
echo '<script>var DoubanPageSize='.Helper::options()->plugin('DoubanBoard')->PageSize.'</script>';
if (!empty(Helper::options()->plugin('DoubanBoard')->loadJQ) && in_array('jq', Helper::options()->plugin('DoubanBoard')->loadJQ))
{
echo '<script src="/usr/plugins/DoubanBoard/assets/jquery.min.js"></script>';
Expand All @@ -98,7 +99,7 @@ public static function header()
*/
public static function footer()
{
echo '<script type="text/javascript" src="/usr/plugins/DoubanBoard/assets/DoubanBoard.0.3.js?v='.DoubanBoard_Plugin_VERSION.'"></script>';
echo '<script type="text/javascript" src="/usr/plugins/DoubanBoard/assets/DoubanBoard.04.js?v='.DoubanBoard_Plugin_VERSION.'"></script>';
}
}
?>
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -18,6 +18,10 @@

### 日志

**Ver 0.4**

* bug fix

**Ver 0.2**

* 增加了单部展示的缓存,防止因访问量过大被豆瓣限制 IP
Expand Down
File renamed without changes.
10 changes: 4 additions & 6 deletions assets/DoubanBoard.0.3.js → assets/DoubanBoard.04.js
@@ -1,8 +1,7 @@
// RAW.js
// Author: 熊猫小A
// Link: https://imalan.cn
// Link: https://www.imalan.cn

console.log(`%c DoubanBoard 0.3 %c https://blog.imalan.cn/archives/168/`, `color: #fadfa3; background: #23b7e5; padding:5px 0;`, `background: #1c2b36; padding:5px 0;`);
console.log(`%c DoubanBoard 0.4 %c https://blog.imalan.cn/archives/168/`, `color: #fadfa3; background: #23b7e5; padding:5px 0;`, `background: #1c2b36; padding:5px 0;`);


var curBooks_read=0;
Expand Down Expand Up @@ -69,7 +68,7 @@ DoubanBoard = {
var api="/index.php/DoubanBoard?type=book&from="+String(curBooks)+"&status="+status;
$.getJSON(api,function(result){
$(`#loadMoreBooks_`+status).html("加载更多");
if(result.length<10){
if(result.length<DoubanPageSize){
$(`#loadMoreBooks_`+status).html("没有啦");
}
$.each(result,function(i,item){
Expand Down Expand Up @@ -102,7 +101,7 @@ DoubanBoard = {
$("#loadMoreMovies").html("加载中...");
$.getJSON("/index.php/DoubanBoard?type=movie&from="+String(curMovies),function(result){
$("#loadMoreMovies").html("加载更多");
if(result.length<10){
if(result.length<DoubanPageSize){
$("#loadMoreMovies").html("没有啦");
}
$.each(result,function(i,item){
Expand All @@ -127,7 +126,6 @@ $(document).on('pjax:end', function() {

$(document).click(function(e){
var target=e.target;
console.log(target);
$(".doubanboard-item").removeClass("doubanboard-info-show");
$(".doubanboard-item").each(function(){
if($(target).parent()[0]==$(this)[0] || $(target)==$(this)[0]){
Expand Down

0 comments on commit aea6fc9

Please sign in to comment.