IQA Maker Plus

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

Από την 30/08/2018. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
//     }
// }