Greasy Fork is available in English.

Menu Editor Fixed2! (Console).

Menu Editor

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greasyfork.org/scripts/470143/1236548/Menu%20Editor%20Fixed2%21%20%28Console%29.js

// ==UserScript==
// @name         Menu Editor Fixed2! (Console).
// @version      0.4
// @description  Menu Editor
// @author       Zpayer./.AMiNE.
// @match        http://*/*
// @match        https://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

const SetEditor=(ConfigColor='#9598c5',ConfigFont='monospace')=>{
var ConfigC=ConfigColor
var ConfigF=ConfigFont
ConfigColor='var(--config-color)'
ConfigFont='var(--config-font)'
function GetSelected(k) {
return k.options[k.selectedIndex].text
}
let make=(cl)=>top.document.createElement(cl);
let html=(id)=>top.document.getElementById(id);
var Editor = {
    addCate:(name='unknown',clss='unknown')=>{
		let el=make('div');
		el.id=name+'_cate';
		el.textContent=name;
		el.className='_cate';
		el.style=`
        border-bottom:2px solid ${ConfigColor};
        width:98%;
        cursor:default;
        padding:4px;
        color:${ConfigColor};
        margin:10px 2px 2px 4px;
        transition: 0.5s;
        `;
		clss.appendChild(el);

        return el;
	},
    addButton:(name='unknown',clss='unknown',func=()=>{},long=false)=>{
		let el=make('input');
		el.id='The_button';
        el.button_name=name;
		el.value=name;
		el.className=clss+'_element';
		el.type='button';
        el.style=`
        width:${long?'98.5%':'49%'};`;
		el.addEventListener('click',func);
		clss.appendChild(el);
        return el;
	},
        addSelect:(txt, options, tab, confirm)=>{
            let div = document.createElement("div")
            div.className = "CheatSelectDiv"
            div.style=`
                display: flex;
    justify-content: space-evenly;
    align-content: flex-start;
    align-items: flex-start;
    flex-wrap: nowrap;
    flex-direction: row;
            `
            let select = document.createElement("select")
            select.className = "CheatSelect"
            select.defaultState = function(){
                select.options[0].selected = true
            }
            select.updateOptions = function(options){
                select.options.length = 0
                let option = document.createElement("option")
                option.textContent = txt
                option.disabled = true
                option.selected = true
                select.appendChild(option)
                options.forEach((opt)=>{
                    let option = document.createElement("option")
                    option.textContent = opt
                    select.appendChild(option)
                })
            }
            let option = document.createElement("option")
            option.selected = true
            option.disabled = true
            option.textContent = txt
            select.appendChild(option)
            options.forEach((opt) => {
                let option = document.createElement("option")
                option.textContent = opt
                select.appendChild(option)
            })
            let input = document.createElement("input")
            input.className = "CheatButton"
            input.style = ``
            input.type = "button"
            input.value = "✓"
            input.onclick = confirm
            div.appendChild(select)
            div.appendChild(input)
            tab.appendChild(div)
    return select
        },
}
var gEditor={
    addRange:(text,clss,value,Min,Max,func)=>{
         let div = document.createElement("div")
        div.className = "CheatRangeDiv"
    div.style= ` width: 100%;`
        let txt = document.createElement("div")
        txt.style = `
font-family: ${ConfigFont};
    display: inline-block;
    width: 7%;
    font-size: 16px;
    left: 0%;
    color: rgb(219, 220, 220);
    position: relative;
    margin-right: 5%;
    text-align: left;
    font-weight: bold;
`
        txt.textContent = text
		let el=document.createElement('input');
		el.id=text+'slider';
		el.value=value;
		el.className='slider';
		el.type='range';
        el.max = Max
        el.min = Min
		el.style=``;
        let num=make('input');
        num.value = value
        num.id=text+' num';
        num.type='number';
        num.max = Max
        num.min = Min
        num.style=`
    color: white;
    background-color: rgb(33 37 42);
    border-radius: 9px;
    border: none;
    height: 25px;
    width: 35%;
    right: 0%;
    position: relative;
    display: inline;
    margin: 0px 1px;
    text-align: center;
        `;
        num.addEventListener('input',function(){
el.value = num.value
        func()
        });
        el.addEventListener("input",function(){
num.value = el.value
        func()
        });
        div.appendChild(txt);
        div.appendChild(el);
        div.appendChild(num);
        clss.appendChild(div);
return {Number:num,Range:el,}
	},
    addField:(name='unknown',clss='unknown',n,Height=100,Width=95,top='l')=>{
          	let field = document.createElement("fieldset")
            field.id = n+'field_box'
          field.className = 'scroller'
           field.style=`
           width:${Width}%;
    top: ${top}%;
    height:${Height}%;
position: relative;
background: transparent;
    border: 1px solid rgb(255 255 255 / 86%);
    display: inline-block;
           `
	 clss.appendChild(field);
			let leg=make('legend');
		leg.id=name+'legend';
        leg.textContent =name
		leg.className='legend';
          leg.style=`
    font-size: 15px;
    font-weight: bold;
    text-align: left;
    text-transform: uppercase;
    padding: 3px;
    font-family:${ConfigFont};
    cursor: default;
    color:rgb(255 255 255 / 86%);
    width: 23%;
        `;
     field.appendChild(leg);
return field
	},
    addToggle:(name='unknown',clss='unknown',func2=()=>{},func1=()=>{},check=false)=>{
         let div = document.createElement("div")
        div.className = "CheatRangeDiv"

        let txt = document.createElement("h2")
        txt.style = `
    font-family: ${ConfigFont};
    display: inline-block;
    font-size: 16px;
    position: relative;
    text-align: left;
    /* left: -22%; */
    margin-left: -54%;
}`
        txt.textContent = name
		let el=make('label');
        el.className = 'switcher'
        let checkbox=make('input');
        checkbox.type = 'checkbox'
        checkbox.checked=check
        checkbox.id = name+'_Switcher'
        el.onclick=()=>{
             if(checkbox.checked){
            func2()
checkbox.checked=false;
        }else{
            func1()
checkbox.checked=true;
        }

    }
el.appendChild(checkbox);

        let slider=make('span');
        slider.className = 'toggle'
el.appendChild(slider);

 div.appendChild(txt);
div.appendChild(el);
		clss.appendChild(div);

	},
    addPlaceHolder:(txt,clss,id,func=()=>{})=>{//----------------------------------------- super "All" Chat
		let el= make('input');
		el.id=id;
        el.type='placeholder';
        el.style=`
    color: rgb(219, 220, 220);
    background-color: rgba(163, 165, 167, 0.07);
    border-radius: 1px;
    border: 1px solid;
    height: 30px;
    width: 95%;
    margin: 1px 11px;`;
    el.placeholder = txt;
    el.addEventListener("keydown", function(e) {
        if (e.key == "Enter") {
func()
            el.value = "";
        }
    });
     clss.appendChild(el);
    return el
},
    addLister:(txt,options,tab,func)=>{
     let div = document.createElement("div")
     let div2_ = document.createElement("div")
var divslist=[]
//var ListOfSelected=[]
var ListerSelector = Editor.addSelect(txt,options,tab,()=>{
const Selected=GetSelected(ListerSelector)
ListerSelector.Lister.push(Selected)
let div2 = document.createElement("div")
var tt = Editor.addButton(Selected,div2,()=>{})
tt.style.width='80%'
var yoptov= Editor.addButton("X",div2,()=>{
const index = ListerSelector.Lister.indexOf(Selected);
if (index > -1) { // only splice array when item is found
  ListerSelector.Lister.splice(index, 1); // 2nd parameter means remove one item only
}
    div2.remove()
})
yoptov.style.width='15%'
div2_.appendChild(div2);
divslist.push(div2)
})
ListerSelector.Lister=[]
 div.appendChild(div2_);
 var ApplyButton=Editor.addButton('Apply',div,()=>{
 func()
ListerSelector.Lister=[]
 divslist.forEach(k=>k.remove())
 },true)
    tab.appendChild(div);
        return ListerSelector
    },
	addBB:(name='unknown',menu,bar,id='unknown',choosen=0)=>{
		let el=make('div');
        var jo = el
        el.className='scroller'
		el.id='something? ;-;';
		el.style=`
			position:absolute;
			display:${choosen?'block':'none'};
			width:75%;height:90%;
			top:10%;
			right:0px;
		`;
		menu.appendChild(el);
		el=make('div');
		el.id='console_bar_'+id;
		el.className='bar_element bar_element_'+(choosen?'on':'off');
		el.textContent=name;
		el.addEventListener('click',function(e){
			if(this!=bar.cur){
				jo.style.display='block';
				menu.cur.style.display='none';
				menu.cur=jo;
				this.className='bar_element bar_element_on';
				bar.cur.className='bar_element bar_element_off';
				bar.cur=this;
			}
		});
		bar.appendChild(el);
        return jo
	},
    addColorPicker:(clss='unknown',value)=>{
	let el=make('input');
	el.className='color'+clss;
    el.value = value
    el.type='color';
    el.style=`
    background-color: rgb(192 192 192);
    border-radius: 2px;
    border: none;
    height: 37%;
    width: 40%;
`;
		clss.appendChild(el);
        return el;
	},
    addFile:(clss='unknown')=>{
		let el=make('input');
    el.className='fileClass';
	el.type='file';
    el.id = 'fileu'
    el.style = 'position: fixed;right: 20000000000000%;'
		clss.appendChild(el);
       	let button=make('input');
		button.className='NewfileClass';
		button.type='button';
       button.id = 'filebutton';
       button.value = 'Choose File';
       button.onclick = function(){el.click()}
       button.style = `
       color: ${ConfigColor};
    background-color: rgb(35 35 35);
    border-radius: 5px;
    border: 1px solid ${ConfigColor};
    height: 25px;
    width: 100%;
    margin: 1px;`
		clss.appendChild(button);
        return el;
	},
    addSwitcher:(name='unknown',clss='unknown',state=[],func=[],funcint=[],time=0,vehicle='')=>{
        let a=make('div');
        a.id=vehicle+name+'_switcher_settings';
        a.style=`
        display:flex;
        justify-content:center;
        align-items:center;
        margin:3px 0;
        `;
        clss.appendChild(a);
		let elm=make('div');
		elm.id=vehicle+name+'_switcher_attribute';
        elm.style=`
        color:#aaa;
        width:49%;
        display:flex;
        align-items:center;
        justify-content:center;
        margin:1px 11px;
        `;
        elm.textContent=name;
		a.appendChild(elm);
		var el=make('input');
        var switchinterval=0;
        var i=0;
		el.id=vehicle+name+'_switcher';
        el.button_name=vehicle+name;
		el.value=state[0];
		el.className=clss+'_element';
		el.type='button';
        el.style=`
        color:#aaa;
        background-color:#4f545c;
        border-radius:5px;
        border:none;
        height:23px;
        width:49%;
        margin:1px 11px;
        `;
		el.addEventListener('click',function(){
        if(i)clearInterval(switchinterval);
        i=++i%(state.length);
        el.value=state[i];
        if(func[i])func[i]();
        if(i&&funcint[i])switchinterval=setInterval(funcint[i],time);
        });
		a.appendChild(el);
        return a;
	},
    addList:(name,clss,list=[],func=[],Lists)=>{
    let edl=make('div');
	edl.id=name+'_list';
    edl.className='scroller'
edl.setAttribute('style', `
	display:none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(35 35 35 / 94%);
    direction: rtl;
    border: 1px solid rgb(54, 57, 63);
`);
    clss.appendChild(edl);
    Editor.addCate(name,edl)
    edl.CurrentButtons=[]
    /*edl.UpdateFunctions=function(NewFunc){
    edl.CurrentButtons.forEach(m=>m.remove())
    edl.CurrentButtons=[]
  for (var i=0;i>=Math.min(list.length,func.length); i++) {
var CB = addButton(list[i],edl,()=>{edl.style.display='none';NewFunc[i]();})
edl.CurrentButtons.push(CB)
            }
    }
    edl.UpdateList=function(NewList){
    edl.CurrentButtons.forEach(m=>m.remove())
    edl.CurrentButtons=[]
  for (var i=0;i>=Math.min(list.length,func.length); i++) {
var CB = addButton(NewList[i],edl,()=>{edl.style.display='none';func[i]();})
edl.CurrentButtons.push(CB)
            }
    }*/
    edl.UpdateAll=function(NewList,NewFunc,time=10){
if(Math.min(NewList.length,NewFunc.length)!=0){
      var i = 0
var ButtonMakerInter = setInterval(()=>{
    if(i>=Math.min(NewList.length,NewFunc.length)){
clearInterval(ButtonMakerInter);ButtonMakerInter=0;
       }else{
           i++
var CB = addButton(NewList[i],edl,()=>{edl.style.display='none';NewFunc[i]();})
edl.CurrentButtons.push(CB)
        }
},time)
        }
    }
        if(Lists.Lists[name]==undefined){
    Lists.Lists[name]=[]
        }
    Lists.Lists[name].push(edl)
        if(Math.min(list.length,func.length)!=0){
      var i = 0
var ButtonMakerInter = setInterval(()=>{
    if(i>=Math.min(list.length,func.length)){
clearInterval(ButtonMakerInter);ButtonMakerInter=0;
       }else{
            i++
var CB = addButton(list[i],edl,()=>{edl.style.display='none';func[i]();})
edl.CurrentButtons.push(CB)
        }
},10)
        }
    return edl
    },
}
var sheet=top.document.head.appendChild(make('style')).sheet;
	sheet.insertRules=rules=>rules.replace(/\}/g,'}^').split('^').map(r=>(r.indexOf('{')+1)&&sheet.insertRule(r));
	sheet.insertRules(`
    :root {
  --config-color:${ConfigC};
  --config-font:${ConfigF};
}

		.scroller{overflow-y:auto;}
		.scroller::-webkit-scrollbar{
			width:5px;
		}
		.scroller::-webkit-scrollbar-thumb{
    background-color: ${ConfigC};
    border-radius: 10px;
		}
		.scroller::-webkit-scrollbar-track{
    background-color: grey;
    border-radius: 10px;
		}
		.bar_element:hover{
transform: translateX(5%);
		}
		.bar_element{
    color: white;
    line-height: 200%;
    cursor: pointer;
    height: 10%;
    display: flex;
    width: 86%;
    transition: all 0.5s cubic-bezier(0.25, 0.1, 0.37, 0.46) 0s;
    place-content: center space-around;
    align-items: center;
    font-weight: bold;
		}
		.cheat_element:hover{
			color:#FFF !important;
		}
		.bar_element_off{
			opacity:1;
			background:#0000;
		}
		.bar_element_on{
    opacity: 1;
    border-radius: 10px;
    background:${ConfigColor};
		}
               .CheatSelect {
    background-color: rgb(33 37 42);
    color: white;
    height: 34px;
    box-sizing: border-box;
    border: none;
    width: 70%;
    opacity: 0.7;
    transition: all 0.5s ease 0s;
    border-radius: 10px;
    display: inline-block;
    font-family: ${ConfigFont};
}
.CheatSelect:hover {
opacity: 1;
}
.CheatButton {
    color: rgb(255 255 255);
    text-align: center;
    box-sizing: border-box;
    outline: none;
    opacity: 0.7;
    transition: all 0.5s ease 0s;
    height: 34px;
    width: 24%;
    margin-left: 10px;
    border: none;
    background: #24272c;
    border-radius: 10px;
}
.CheatButton:hover {
opacity: 1;
}
#The_button:hover {
border: 1px solid ${ConfigColor};
}
#The_button {
    color: white;
    background-color: rgb(33, 37, 42);
    border-radius: 10px;
    height: 25px;
    margin-top: 6px;
    margin-bottom: 6px;
    margin-left: 2px;
    border: none;
    transition: ease 1s;
        }
.slider {
  -webkit-appearance: none;
    width: 46%;
    height: 12px;
    background: rgba(1, 17, 39, 0.32);
    opacity: 1;
    transition: opacity 0.2s ease 0s;
    display: inline;
    margin: 6px;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  border-radius:500%;
  width: 12px;
  height: 12px;
  border:2px solid rgb(33 37 42);
  cursor: pointer;
  box-shadow: -200px 0 0 200px ${ConfigColor};
    background:${ConfigColor};
}
.slider::-webkit-slider-runnable-track {
  background: rgb(33 37 42); /* Change this color for the track */
  border-radius: 5px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switcher {
    position: absolute;
    display: inline-block;
    width: 57px;
    height: 23px;
    left: 74%;

}

.switcher input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle {
    position: absolute;
    cursor: pointer;
    inset: 0px;
    background-color: rgb(33 37 42);
    transition: all 0.4s ease 0s;
    border-radius: 10px;
}

.toggle:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 8px;
    bottom: 1px;
    border: 2px solid #21252a;
    border-radius: 10px;
    background-color: var(--config-color);
    transition: all 0.4s ease 0s;
}

input:checked + .toggle {
    background-color:${ConfigColor};
}

input:focus + .toggle {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .toggle:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}
	`);
return Object.assign(gEditor,Editor,
                     {
setColorAndFont:(clr,font)=>{
if(clr==undefined)clr=getComputedStyle(document.documentElement).getPropertyValue('--config-color');
if(font==undefined)font=getComputedStyle(document.documentElement).getPropertyValue('--config-font');
document.documentElement.style.setProperty('--config-color',clr);
document.documentElement.style.setProperty('--config-font',font);
}
    
})
}