mirror of
https://github.com/Dreamer-Paul/Pio.git
synced 2025-04-14 13:31:36 +08:00
Merge Settings
删除“自定内容选择器”功能,把它和“自定提示内容”整合到了一块,变为“交互提示扩展”
This commit is contained in:
parent
924ade6167
commit
4b943a701c
17
Plugin.php
17
Plugin.php
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* 一个简易的 Live2D 插件,建立在 <a href="https://github.com/journey-ad/live2d_src">@Jad</a> 的项目上
|
||||
* 一个简易的 Live2D 插件,在 <a href="https://github.com/journey-ad/live2d_src">@Jad</a> 的项目上增加交互功能
|
||||
*
|
||||
* @package Pio
|
||||
* @author Dreamer-Paul
|
||||
* @version 2.3
|
||||
* @version 2.4
|
||||
* @link https://paugram.com
|
||||
*/
|
||||
|
||||
@ -39,7 +39,7 @@ class Pio_Plugin implements Typecho_Plugin_Interface{
|
||||
|
||||
echo "</div>";
|
||||
}
|
||||
paul_update("Pio", "2.3");
|
||||
paul_update("Pio", "2.4");
|
||||
|
||||
// 读取模型文件夹
|
||||
$models = array();
|
||||
@ -106,13 +106,9 @@ class Pio_Plugin implements Typecho_Plugin_Interface{
|
||||
'0', _t('时间小贴士'), _t('开启后将在没有访问来源的情况下展示,覆盖入站提示'));
|
||||
$form -> addInput($tips);
|
||||
|
||||
// 自定义文字配置
|
||||
$dialog = new Typecho_Widget_Helper_Form_Element_Textarea('dialog', NULL, NULL, _t('自定义提示内容'), _t('在这里填入你的自定义看板娘提示内容,如想保持默认,请留空'));
|
||||
// 交互提示扩展
|
||||
$dialog = new Typecho_Widget_Helper_Form_Element_Textarea('dialog', NULL, NULL, _t('交互提示扩展'), _t('在这里填入你的自定义交互提示配置信息,如想保持默认,请留空'));
|
||||
$form -> addInput($dialog);
|
||||
|
||||
// 自定义选择器配置
|
||||
$selector = new Typecho_Widget_Helper_Form_Element_Textarea('selector', NULL, NULL, _t('自定义内容选择器'), _t('在这里填入部分功能所用到的自定义选择器,如不想启用此类功能,请留空'));
|
||||
$form -> addInput($selector);
|
||||
}
|
||||
|
||||
/* 个人用户的配置方法 */
|
||||
@ -138,8 +134,7 @@ class Pio_Plugin implements Typecho_Plugin_Interface{
|
||||
$config = array(
|
||||
"mode" => $plugin -> custom_mode,
|
||||
"hidden" => $plugin -> hidden == 1 ? true : false,
|
||||
"content" => $plugin -> dialog ? json_decode($plugin -> dialog, true) : array(),
|
||||
"selector" => $plugin -> selector ? json_decode($plugin -> selector, true) : array()
|
||||
"content" => $plugin -> dialog ? json_decode($plugin -> dialog, true) : array()
|
||||
);
|
||||
|
||||
if($plugin -> custom_model){
|
||||
|
@ -16,9 +16,10 @@
|
||||
6. 你可以通过 [选择](https://docs.paul.ren/pio/#/?id=选择模型) 或 [外链](https://docs.paul.ren/pio/#/?id=选择外链模型) 的方式引用你获得的模型资源
|
||||
7. 想了解更多的玩法,欢迎阅读 [插件文档](https://docs.paul.ren/pio)。如果对本项目有任何的建议和想法,欢迎随时提出~
|
||||
|
||||
## 项目故事
|
||||
## 项目相关
|
||||
|
||||
详见我的博文:[给你的博客增加动态看板娘](https://paugram.com/coding/add-poster-girl-with-plugin.html),帮助文档及常见问题均在这里即时更新。
|
||||
- 开发故事:[给你的博客增加动态看板娘](https://paugram.com/coding/add-poster-girl-with-plugin.html)
|
||||
- 帮助文档 & 常见问题:[传送门](https://docs.paul.ren/pio)
|
||||
|
||||
## 开源协议
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Pio Plugin
|
||||
# By: Dreamer-Paul
|
||||
# Last Update: 2019.8.8
|
||||
# Last Update: 2019.8.18
|
||||
|
||||
一个支持更换 Live2D 模型的 Typecho 插件。
|
||||
|
||||
@ -58,6 +58,7 @@ var Paul_Pio = function (prop) {
|
||||
// 移除方法
|
||||
destroy: function () {
|
||||
current.body.parentNode.removeChild(current.body);
|
||||
document.cookie = "posterGirl=false;" + "path=/";
|
||||
}
|
||||
};
|
||||
|
||||
@ -115,33 +116,14 @@ var Paul_Pio = function (prop) {
|
||||
modules.render(text);
|
||||
}
|
||||
else{
|
||||
prop.content.welcome ? modules.render(prop.content.welcome) : modules.render("欢迎来到本站!");
|
||||
}
|
||||
},
|
||||
// 文章
|
||||
article: function () {
|
||||
if(prop.selector.articles){
|
||||
var obj = document.querySelectorAll(prop.selector.articles);
|
||||
|
||||
for(var i = 0; i < obj.length; i++){
|
||||
obj[i].onmouseover = function () {
|
||||
modules.render("想阅读 %t 吗?".replace(/%t/, "“" + this.innerText + "”"));
|
||||
}
|
||||
}
|
||||
modules.render(prop.content.welcome || "欢迎来到本站!");
|
||||
}
|
||||
},
|
||||
// 触摸
|
||||
touch: function () {
|
||||
if(prop.content.touch){
|
||||
current.canvas.onclick = function () {
|
||||
modules.render(prop.content.touch);
|
||||
}
|
||||
}
|
||||
else{
|
||||
current.canvas.onclick = function () {
|
||||
modules.render(["你在干什么?", "再摸我就报警了!", "HENTAI!", "你够了喔!"]);
|
||||
}
|
||||
}
|
||||
current.canvas.onclick = function () {
|
||||
modules.render(prop.content.touch || ["你在干什么?", "再摸我就报警了!", "HENTAI!", "不可以这样欺负我啦!"]);
|
||||
};
|
||||
},
|
||||
// 右侧按钮
|
||||
buttons: function () {
|
||||
@ -150,7 +132,7 @@ var Paul_Pio = function (prop) {
|
||||
location.href = current.root;
|
||||
};
|
||||
elements.home.onmouseover = function () {
|
||||
prop.content.home ? modules.render(prop.content.home) : modules.render("点击这里回到首页!");
|
||||
modules.render(prop.content.home || "点击这里回到首页!");
|
||||
};
|
||||
current.menu.appendChild(elements.home);
|
||||
|
||||
@ -166,7 +148,7 @@ var Paul_Pio = function (prop) {
|
||||
|
||||
// 关于我
|
||||
elements.info.onclick = function () {
|
||||
prop.content.link ? window.open(prop.content.link) : window.open("https://paugram.com/coding/add-poster-girl-with-plugin.html");
|
||||
window.open(prop.content.link || "https://paugram.com/coding/add-poster-girl-with-plugin.html");
|
||||
};
|
||||
elements.info.onmouseover = function () {
|
||||
modules.render("想了解更多关于我的信息吗?");
|
||||
@ -189,19 +171,31 @@ var Paul_Pio = function (prop) {
|
||||
modules.destroy();
|
||||
};
|
||||
elements.close.onmouseover = function () {
|
||||
prop.content.close ? modules.render(prop.content.close) : modules.render("QWQ 下次再见吧~");
|
||||
modules.render(prop.content.close || "QWQ 下次再见吧~");
|
||||
};
|
||||
current.menu.appendChild(elements.close);
|
||||
document.cookie = "posterGirl=false;" + "path=/";
|
||||
},
|
||||
custom: function () {
|
||||
prop.content.custom.forEach(function (t) {
|
||||
if(!t.type) t.type = "default";
|
||||
var e = document.querySelectorAll(t.selector);
|
||||
|
||||
if(e.length){
|
||||
for(var j = 0; j < e.length; j++){
|
||||
e[j].onmouseover = function () {
|
||||
modules.render(t.text);
|
||||
if(t.type === "read"){
|
||||
e[j].onmouseover = function () {
|
||||
modules.render("想阅读 %t 吗?".replace(/%t/, "“" + this.innerText + "”"));
|
||||
}
|
||||
}
|
||||
else if(t.type === "link"){
|
||||
e[j].onmouseover = function () {
|
||||
modules.render("想了解一下 %t 吗?".replace(/%t/, "“" + this.innerText + "”"));
|
||||
}
|
||||
}
|
||||
else if(t.text){
|
||||
e[j].onmouseover = function () {
|
||||
modules.render(t.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,14 +206,13 @@ var Paul_Pio = function (prop) {
|
||||
/* - 运行 */
|
||||
var begin = {
|
||||
static: function () {
|
||||
action.welcome(); action.article();
|
||||
current.body.classList.add("static");
|
||||
},
|
||||
fixed: function () {
|
||||
action.welcome(); action.article(); action.touch(); action.buttons();
|
||||
action.touch(); action.buttons();
|
||||
},
|
||||
draggable: function () {
|
||||
action.welcome(); action.article(); action.touch(); action.buttons();
|
||||
action.touch(); action.buttons();
|
||||
|
||||
var body = current.body;
|
||||
body.onmousedown = function () {
|
||||
@ -250,6 +243,8 @@ var Paul_Pio = function (prop) {
|
||||
current.body.classList.add("hidden");
|
||||
}
|
||||
else{
|
||||
action.welcome();
|
||||
|
||||
switch (prop.mode){
|
||||
case "static": begin.static(); break;
|
||||
case "fixed": begin.fixed(); break;
|
||||
|
Loading…
Reference in New Issue
Block a user