IQA Maker Plus

给轻文的编辑器添加素材库隐藏 预览添加命令

目前為 2018-08-30 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @icon         http://www.iqing.com/iriya/img/人物.0a09b6d.png
// @name         IQA Maker Plus
// @namespace    http://www.iqing.com/
// @version      0.88888
// @description  给轻文的编辑器添加素材库隐藏 预览添加命令
// @author       Ts8zs
// @include      *//www.iqing.com/preview.html*
// @include      *//www.iqing.com/iriya.html*
// @update       https://greasyfork.org/scripts/371697-iqamakerremote/code/IQAMakerRemote.user.js
// ==/UserScript==

//预览指令控制
if (/.*preview.*/.test(location.href)) {
    document.getElementsByClassName('nav')[0].innerHTML +=
        `<div style="position:fixed;z-index:100000;right:0;bottom:0;left:0;">
<datalist id="iqacmd">
<option>@jump</option>
<option>@in</option>
<option>@sel</option>
<option>@clear</option>
<option>@action</option>
<option>@play</option>
<option>@stop</option>
<option>@add</option>
<option>@break</option>
<option>@random</option>
</datalist>
<input id="command" list="iqacmd" style="width:100%;font-size: 24px;" placeholder="输入指令回车执行">
`;
    command.onkeyup = function (e) {
        console.log(e);
        if (e.keyCode == 13) {
            console.log(command.value);
            previewIframe.contentWindow.game.logic.Stage_exec.insert(command.value);
            command.value = '';
        }
    };
}

document.domain = "iqing.com";

function iriya() {
    //素材列表隐藏
    document.getElementsByClassName('editor-top')[0].innerHTML +=
        `<button id="fold" class="el-button  el-button--small" style="margin-left:10px;"  onclick="
if(document.getElementsByClassName('material-list-panel')[0].style.display=='block')
{ document.getElementsByClassName('material-list-panel')[0].style.display='none'; fold.innerText='<显示素材列表'}
else { document.getElementsByClassName('material-list-panel')[0].style.display='block';fold.innerText='隐藏素材列表>' }
">
隐藏素材列表>
</button>
`
    //素材列表过滤
    document.querySelector('.material-top').outerHTML +=
        `<div style="width: 100%;display: flex;">
<input type="text" style="width: 100%;height: 15px;" id="mtfilter" placeholder="素材过滤" onkeyup="
        document.querySelectorAll('.item').forEach(function (e) {
            if(e.querySelector('p').innerText.indexOf(mtfilter.value)==-1){
                e.style.display='none';
            }else{
                e.style.display = '';
            }
        })
    "></div>
<script>
`
    //修正添加过滤框后的列表高度
    document.querySelector('.material-main').style.height = "calc(100% - 60px)";

}
if (/.*iriya.*/.test(location.href))
    setTimeout(iriya, 1000);


// todo 点击素材名插入代码
// document.querySelector('.material-list-wrap').onclick = function (e) {
//     if (e.toElement.tagName == 'P') {
//         console.log(e.toElement.innerText);
//     }
// }