IQA Maker Plus

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

2018-08-30 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 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);
//     }
// }