From 6bb82fdc53c0ad8654ae1746d4ca2df056b619fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A5=87=E8=B6=A3=E4=BF=9D=E7=BD=97?=
 <dreamer_paul@126.com>
Date: Wed, 2 Jan 2019 13:21:47 +0800
Subject: [PATCH] Fix Bugs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

修复了在部分浏览器下启用“隐藏看板娘”功能之后导致浏览器卡顿的问题
---
 Plugin.php    | 10 +++++-----
 static/pio.js | 26 ++++++++++++++++----------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/Plugin.php b/Plugin.php
index 6883dfa..0117c0e 100644
--- a/Plugin.php
+++ b/Plugin.php
@@ -4,7 +4,7 @@
  *
  * @package Pio
  * @author Dreamer-Paul
- * @version 2.1
+ * @version 2.1.5
  * @link https://paugram.com
  */
 
@@ -39,7 +39,7 @@ class Pio_Plugin implements Typecho_Plugin_Interface{
 
             echo "</div>";
         }
-        paul_update("Pio", "2.1");
+        paul_update("Pio", "2.1.5");
 
         // 读取模型文件夹
         $models = array();
@@ -88,13 +88,13 @@ class Pio_Plugin implements Typecho_Plugin_Interface{
             'static', _t('展现模式'), _t('自定义看板娘的展现模式。静态模式将不启用按钮交互功能'));
         $form -> addInput($custom_mode);
 
-        // 是否在手机上隐藏
+        // 隐藏看板娘
         $hidden = new Typecho_Widget_Helper_Form_Element_Radio('hidden',
             array(
               '0' => _t('关闭'),
               '1' => _t('开启'),
             ),
-            '0', _t('浏览体验'), _t('是否在手机版上隐藏看板娘'));
+            '0', _t('隐藏看板娘'), _t('开启后将在移动设备上隐藏看板娘'));
         $form -> addInput($hidden);
 
         // 是否开启时间小贴士
@@ -103,7 +103,7 @@ class Pio_Plugin implements Typecho_Plugin_Interface{
               '0' => _t('关闭'),
               '1' => _t('开启'),
             ),
-            '0', _t('时间小贴士'), _t('是否开启时间小贴士,在没有访问来源的情况下展示,将覆盖入站提示'));
+            '0', _t('时间小贴士'), _t('开启后将在没有访问来源的情况下展示,覆盖入站提示'));
         $form -> addInput($tips);
 
         // 自定义文字配置
diff --git a/static/pio.js b/static/pio.js
index 9e2faa9..992829c 100644
--- a/static/pio.js
+++ b/static/pio.js
@@ -2,7 +2,7 @@
 
 # Pio Plugin
 # By: Dreamer-Paul
-# Last Update: 2018.12.30
+# Last Update: 2019.1.2
 
 一个支持换模型的 Live2D 插件,供 Typecho 使用。
 
@@ -232,16 +232,22 @@ var Paul_Girl = function (prop) {
         }
     };
 
-    // 判断模式并运行
-    switch (prop.mode){
-        case "static": begin.static(); break;
-        case "fixed":  begin.fixed(); break;
-        case "draggable": begin.draggable(); break;
-    }
+    // 运行
+    this.init = function () {
+        if(prop.hidden === true && window.innerWidth < 400){
+            current.body.classList.add("hidden");
+        }
+        else{
+            switch (prop.mode){
+                case "static": begin.static(); break;
+                case "fixed":  begin.fixed(); break;
+                case "draggable": begin.draggable(); break;
+            }
 
-    if(prop.hidden === true){ current.body.classList.add("hidden") }
-
-    loadlive2d("pio", prop.model[0]);
+            loadlive2d("pio", prop.model[0]);
+        }
+    };
+    this.init();
 };
 
 // 请保留版权说明