Greasy Fork is available in English.

Menu Editor (Console).

Menu Editor

ეს სკრიპტი არ უნდა იყოს პირდაპირ დაინსტალირებული. ეს ბიბლიოთეკაა, სხვა სკრიპტებისთვის უნდა ჩართეთ მეტა-დირექტივაში // @require https://update.greasyfork.org/scripts/467897/1199988/Menu%20Editor%20%28Console%29.js.

  1. // ==UserScript==
  2. // @name Menu Editor (Console).
  3. // @version 0.2
  4. // @description Menu Editor
  5. // @author Zpayer./.AMiNE.
  6. // @match http://*/*
  7. // @match https://*/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. const SetEditor=(ConfigColor='#9598c5',ConfigFont='monospace')=>{
  13. let make=(cl)=>top.document.createElement(cl);
  14. let html=(id)=>top.document.getElementById(id);
  15. window.Editor=top.Editor={
  16. addCate:(name='unknown',clss='unknown')=>{
  17. let el=make('div');
  18. el.id=name+'_cate';
  19. el.textContent=name;
  20. el.className='_cate';
  21. el.style=`
  22. border-bottom:2px solid ${ConfigColor};
  23. width:98%;
  24. cursor:default;
  25. padding:4px;
  26. color:${ConfigColor};
  27. margin:10px 2px 2px 4px;
  28. transition: 0.5s;
  29. `;
  30. clss.appendChild(el);
  31.  
  32. return el;
  33. },
  34. addButton:(name='unknown',clss='unknown',func=()=>{},long=false)=>{
  35. let el=make('input');
  36. el.id='_button';
  37. el.button_name=name;
  38. el.value=name;
  39. el.className=clss+'_element';
  40. el.type='button';
  41. el.style=`color:#aaa;background-color:#4f545c;border-radius:5px;border:none;height:23px;width:${long?'98.5%':'49%'};margin:1px;`;
  42. el.addEventListener('click',func);
  43. clss.appendChild(el);
  44. return el;
  45. },
  46. addRange:(text,clss,value,Min,Max,func)=>{
  47. let div = document.createElement("div")
  48. div.className = "CheatRangeDiv"
  49. div.style= ` width: 100%;`
  50. let txt = document.createElement("div")
  51. txt.style = `
  52. font-family: ${ConfigFont};
  53. display: inline-block;
  54. width: 7%;
  55. font-size: 16px;
  56. left: 0%;
  57. color: rgb(219, 220, 220);
  58. position: relative;
  59. margin-right: 5%;
  60. text-align: left;
  61. `
  62. txt.textContent = text
  63. let el=document.createElement('input');
  64. el.id=text+'slider';
  65. el.value=value;
  66. el.className='slider';
  67. el.type='range';
  68. el.max = Max
  69. el.min = Min
  70. el.style=``;
  71. let num=make('input');
  72. num.value = value
  73. num.id=text+' num';
  74. num.type='number';
  75. num.max = Max
  76. num.min = Min
  77. num.style=`
  78. color:${ConfigColor};
  79. background-color: rgba(255, 255, 255, 0.06);
  80. border-radius: 1px;
  81. border: 1px solid;
  82. height: 25px;
  83. width: 35%;
  84. right: 0%;
  85. position: relative;
  86. display: inline;
  87. margin: 0px 1px;
  88. text-align: center;
  89. `;
  90. num.addEventListener('input',function(){
  91. el.value = num.value
  92. func()
  93. });
  94. el.addEventListener("input",function(){
  95. num.value = el.value
  96. func()
  97. });
  98. div.appendChild(txt);
  99. div.appendChild(el);
  100. div.appendChild(num);
  101. clss.appendChild(div);
  102. return {Number:num,Range:el,}
  103. },
  104. addField:(name='unknown',clss='unknown',n,Height=100,Width=95,top='l')=>{
  105. let field = document.createElement("fieldset")
  106. field.id = n+'field_box'
  107. field.className = 'scroller'
  108. field.style=`
  109. width:${Width}%;
  110. top: ${top}%;
  111. height:${Height}%;
  112. position: relative;
  113. background: transparent;
  114. border: 1px solid rgb(255 255 255 / 86%);
  115. display: inline-block;
  116. `
  117. clss.appendChild(field);
  118. let leg=make('legend');
  119. leg.id=name+'legend';
  120. leg.textContent =name
  121. leg.className='legend';
  122. leg.style=`
  123. font-size: 15px;
  124. font-weight: bold;
  125. text-align: left;
  126. text-transform: uppercase;
  127. padding: 3px;
  128. font-family:${ConfigFont};
  129. cursor: default;
  130. color:rgb(255 255 255 / 86%);
  131. width: 23%;
  132. `;
  133. field.appendChild(leg);
  134. return field
  135. },
  136. addToggle:(name='unknown',clss='unknown',func2=()=>{},func1=()=>{},check=false)=>{
  137. let div = document.createElement("div")
  138. div.className = "CheatRangeDiv"
  139.  
  140. let txt = document.createElement("h2")
  141. txt.style = `
  142. font-family: ${ConfigFont};
  143. display: inline-block;
  144. font-size: 16px;
  145. position: relative;
  146. text-align: left;
  147. /* left: -22%; */
  148. margin-left: -54%;
  149. }`
  150. txt.textContent = name
  151. let el=make('label');
  152. el.className = 'switcher'
  153. let checkbox=make('input');
  154. checkbox.type = 'checkbox'
  155. checkbox.checked=check
  156. checkbox.id = name+'_Switcher'
  157. el.onclick=()=>{
  158. if(checkbox.checked){
  159. func2()
  160. checkbox.checked=false;
  161. }else{
  162. func1()
  163. checkbox.checked=true;
  164. }
  165.  
  166. }
  167. el.appendChild(checkbox);
  168.  
  169. let slider=make('span');
  170. slider.className = 'toggle'
  171. el.appendChild(slider);
  172.  
  173. div.appendChild(txt);
  174. div.appendChild(el);
  175. clss.appendChild(div);
  176.  
  177. },
  178. addSelect:(txt, options, tab, confirm)=>{
  179. let div = document.createElement("div")
  180. div.className = "CheatSelectDiv"
  181. let select = document.createElement("select")
  182. select.className = "CheatSelect"
  183. select.defaultState = function(){
  184. select.options[0].selected = true
  185. }
  186. select.updateOptions = function(options){
  187. select.options.length = 0
  188. let option = document.createElement("option")
  189. option.textContent = txt
  190. option.disabled = true
  191. option.selected = true
  192. select.appendChild(option)
  193. options.forEach((opt)=>{
  194. let option = document.createElement("option")
  195. option.textContent = opt
  196. select.appendChild(option)
  197. })
  198. }
  199. let option = document.createElement("option")
  200. option.selected = true
  201. option.disabled = true
  202. option.textContent = txt
  203. select.appendChild(option)
  204. options.forEach((opt) => {
  205. let option = document.createElement("option")
  206. option.textContent = opt
  207. select.appendChild(option)
  208. })
  209. let input = document.createElement("input")
  210. input.className = "CheatButton"
  211. input.style = `
  212. height: 40px;
  213. width: 40px;
  214. margin-left: 10px;
  215. `
  216. input.type = "button"
  217. input.value = "✓"
  218. input.onclick = confirm
  219. div.appendChild(select)
  220. div.appendChild(input)
  221. tab.appendChild(div)
  222. return select
  223. },
  224. addPlaceHolder:(txt,clss,id,func=()=>{})=>{//----------------------------------------- super "All" Chat
  225. let el= make('input');
  226. el.id=id;
  227. el.type='placeholder';
  228. el.style=`
  229. color: rgb(219, 220, 220);
  230. background-color: rgba(163, 165, 167, 0.07);
  231. border-radius: 1px;
  232. border: 1px solid;
  233. height: 30px;
  234. width: 95%;
  235. margin: 1px 11px;`;
  236. el.placeholder = txt;
  237. el.addEventListener("keydown", function(e) {
  238. if (e.key == "Enter") {
  239. func()
  240. el.value = "";
  241. }
  242. });
  243. clss.appendChild(el);
  244. return el
  245. },
  246. addLister:(txt,options,tab,func)=>{
  247. let div = document.createElement("div")
  248. let div2_ = document.createElement("div")
  249. var divslist=[]
  250. //var ListOfSelected=[]
  251. var ListerSelector = addSelect(txt,options,tab,()=>{
  252. const Selected=GetSelected(ListerSelector)
  253. ListerSelector.Lister.push(Selected)
  254. let div2 = document.createElement("div")
  255. var tt = addButton(Selected,div2,()=>{})
  256. tt.style.width='80%'
  257. var yoptov= addButton("X",div2,()=>{
  258. const index = ListerSelector.Lister.indexOf(Selected);
  259. if (index > -1) { // only splice array when item is found
  260. ListerSelector.Lister.splice(index, 1); // 2nd parameter means remove one item only
  261. }
  262. div2.remove()
  263. })
  264. yoptov.style.width='15%'
  265. div2_.appendChild(div2);
  266. divslist.push(div2)
  267. })
  268. ListerSelector.Lister=[]
  269. div.appendChild(div2_);
  270. var ApplyButton=addButton('Apply',div,()=>{
  271. func()
  272. ListerSelector.Lister=[]
  273. divslist.forEach(k=>k.remove())
  274. },true)
  275. tab.appendChild(div);
  276. return ListerSelector
  277. },
  278. addBB:(name='unknown',id='unknown',box='unknown_box',choosen=0)=>{
  279. let el=make('div');
  280. var jo = el
  281. el.className='scroller'
  282. el.id=box;
  283. el.style=`
  284. position:absolute;
  285. display:${choosen?'block':'none'};
  286. width:75%;height:90%;
  287. top:10%;
  288. right:0px;
  289. `;
  290. html('console').appendChild(el);
  291. el=make('div');
  292. el.id='console_bar_'+id;
  293. el.className='bar_element bar_element_'+(choosen?'on':'off');
  294. el.textContent=name;
  295. el.addEventListener('click',function(e){
  296. if(this!=html('console_bar').cur){
  297. html(box).style.display='block';
  298. html('console').cur.style.display='none';
  299. html('console').cur=html(box);
  300. this.className='bar_element bar_element_on';
  301. html('console_bar').cur.className='bar_element bar_element_off';
  302. html('console_bar').cur=this;
  303. }
  304. });
  305. html('console_bar').appendChild(el);
  306. return jo
  307. },
  308. addColorPicker:(clss='unknown',value)=>{
  309. let el=make('input');
  310. el.className='color'+clss;
  311. el.value = value
  312. el.type='color';
  313. el.style=`
  314. background-color: rgb(192 192 192);
  315. border-radius: 2px;
  316. border: none;
  317. height: 37%;
  318. width: 40%;
  319. `;
  320. clss.appendChild(el);
  321. return el;
  322. },
  323. addFile:(clss='unknown')=>{
  324. let el=make('input');
  325. el.className='fileClass';
  326. el.type='file';
  327. el.id = 'fileu'
  328. el.style = 'position: fixed;right: 20000000000000%;'
  329. clss.appendChild(el);
  330. let button=make('input');
  331. button.className='NewfileClass';
  332. button.type='button';
  333. button.id = 'filebutton';
  334. button.value = 'Choose image';
  335. button.onclick = function(){el.click()}
  336. button.style = `
  337. color: ${ConfigColor};
  338. background-color: rgb(35 35 35);
  339. border-radius: 5px;
  340. border: 1px solid ${ConfigColor};
  341. height: 25px;
  342. width: 25%;
  343. margin: 1px;`
  344. clss.appendChild(button);
  345. return el;
  346. },
  347. addSwitcher:(name='unknown',clss='unknown',state=[],func=[],funcint=[],time=0,vehicle='')=>{
  348. let a=make('div');
  349. a.id=vehicle+name+'_switcher_settings';
  350. a.style=`
  351. display:flex;
  352. justify-content:center;
  353. align-items:center;
  354. margin:3px 0;
  355. `;
  356. clss.appendChild(a);
  357. let elm=make('div');
  358. elm.id=vehicle+name+'_switcher_attribute';
  359. elm.style=`
  360. color:#aaa;
  361. width:49%;
  362. display:flex;
  363. align-items:center;
  364. justify-content:center;
  365. margin:1px 11px;
  366. `;
  367. elm.textContent=name;
  368. a.appendChild(elm);
  369. var el=make('input');
  370. var switchinterval=0;
  371. var i=0;
  372. el.id=vehicle+name+'_switcher';
  373. el.button_name=vehicle+name;
  374. el.value=state[0];
  375. el.className=clss+'_element';
  376. el.type='button';
  377. el.style=`
  378. color:#aaa;
  379. background-color:#4f545c;
  380. border-radius:5px;
  381. border:none;
  382. height:23px;
  383. width:49%;
  384. margin:1px 11px;
  385. `;
  386. el.addEventListener('click',function(){
  387. if(i)clearInterval(switchinterval);
  388. i=++i%(state.length);
  389. el.value=state[i];
  390. if(func[i])func[i]();
  391. if(i&&funcint[i])switchinterval=setInterval(funcint[i],time);
  392. });
  393. a.appendChild(el);
  394. return a;
  395. },
  396. addList:(name,clss,list=[],func=[],Lists=Console_.Lists)=>{
  397. let edl=make('div');
  398. edl.id=name+'_list';
  399. edl.className='scroller'
  400. edl.setAttribute('style', `
  401. display:none;
  402. position: absolute;
  403. top: 0;
  404. left: 0;
  405. width: 100%;
  406. height: 100%;
  407. background-color: rgb(35 35 35 / 94%);
  408. direction: rtl;
  409. border: 1px solid rgb(54, 57, 63);
  410. `);
  411. clss.appendChild(edl);
  412. addCate(name,edl)
  413. edl.CurrentButtons=[]
  414. /*edl.UpdateFunctions=function(NewFunc){
  415. edl.CurrentButtons.forEach(m=>m.remove())
  416. edl.CurrentButtons=[]
  417. for (var i=0;i>=Math.min(list.length,func.length); i++) {
  418. var CB = addButton(list[i],edl,()=>{edl.style.display='none';NewFunc[i]();})
  419. edl.CurrentButtons.push(CB)
  420. }
  421. }
  422. edl.UpdateList=function(NewList){
  423. edl.CurrentButtons.forEach(m=>m.remove())
  424. edl.CurrentButtons=[]
  425. for (var i=0;i>=Math.min(list.length,func.length); i++) {
  426. var CB = addButton(NewList[i],edl,()=>{edl.style.display='none';func[i]();})
  427. edl.CurrentButtons.push(CB)
  428. }
  429. }*/
  430. edl.UpdateAll=function(NewList,NewFunc,time=10){
  431. if(Math.min(NewList.length,NewFunc.length)!=0){
  432. var i = 0
  433. var ButtonMakerInter = setInterval(()=>{
  434. if(i>=Math.min(NewList.length,NewFunc.length)){
  435. clearInterval(ButtonMakerInter);ButtonMakerInter=0;
  436. }else{
  437. i++
  438. var CB = addButton(NewList[i],edl,()=>{edl.style.display='none';NewFunc[i]();})
  439. edl.CurrentButtons.push(CB)
  440. }
  441. },time)
  442. }
  443. }
  444. if(Lists.Lists[name]==undefined){
  445. Lists.Lists[name]=[]
  446. }
  447. Lists.Lists[name].push(edl)
  448. if(Math.min(list.length,func.length)!=0){
  449. var i = 0
  450. var ButtonMakerInter = setInterval(()=>{
  451. if(i>=Math.min(list.length,func.length)){
  452. clearInterval(ButtonMakerInter);ButtonMakerInter=0;
  453. }else{
  454. i++
  455. var CB = addButton(list[i],edl,()=>{edl.style.display='none';func[i]();})
  456. edl.CurrentButtons.push(CB)
  457. }
  458. },10)
  459. }
  460. return edl
  461. },
  462. }
  463. var sheet=top.document.head.appendChild(make('style')).sheet;
  464. sheet.insertRules=rules=>rules.replace(/\}/g,'}^').split('^').map(r=>(r.indexOf('{')+1)&&sheet.insertRule(r));
  465. sheet.insertRules(`
  466. .scroller{overflow-y:auto;}
  467. .scroller::-webkit-scrollbar{
  468. width:10px;
  469. }
  470. .scroller::-webkit-scrollbar-thumb{
  471. background-color:rgba(0,0,0,.4);
  472. -webkit-box-shadow:inset 0 0 2px rgba(0,0,0,.5);
  473. box-shadow:inset 0 0 2px rgba(0,0,0,.5);
  474. }
  475. .scroller::-webkit-scrollbar-track{
  476. background-color:rgba(0,0,0,.3);
  477. }
  478. .scroller::-webkit-scrollbar-thumb{
  479. background:#000;
  480. }
  481. .bar_element:hover{
  482. opacity:0.9;
  483. background:#40444bAA;
  484. transition-duration: 0.3s;
  485. }
  486. .bar_element{
  487. color:#FFF;
  488. line-height: 200%;
  489. cursor:pointer;
  490. height:10%;
  491. width:100%;
  492. }
  493. .cheat_element:hover{
  494. color:#FFF !important;
  495. }
  496. .bar_element_off{
  497. opacity:0.5;
  498. background:#0000;
  499. }
  500. .bar_element_on{
  501. opacity:1;
  502. background:#40444b;
  503. }
  504. .CheatSelect {
  505. background-color: rgb(38 38 38 / 0%);
  506. color: rgb(219 220 220);
  507. height: 40px;
  508. box-sizing: border-box;
  509. border: 1px solid;
  510. width: 61%;
  511. opacity: 0.7;
  512. transition: all 0.5s ease 0s;
  513. display: inline-block;
  514. font-family: ${ConfigFont};
  515. }
  516. .CheatSelect:hover {
  517. opacity: 1;
  518. }
  519. .CheatButton {
  520. background-color: rgb(38 38 38 / 0%);
  521. color: rgb(219, 220, 220);
  522. height: 40px;
  523. width: 140px;
  524. text-align: center;
  525. box-sizing: border-box;
  526. border: 1px solid;
  527. outline: none;
  528. opacity: 0.7;
  529. transition: all 0.5s ease 0s;
  530. }
  531. .CheatButton:hover {
  532. opacity: 1;
  533. }
  534. .slider {
  535. appearance: none;
  536. width: 46%;
  537. height: 5px;
  538. background: rgb(219, 220, 220);
  539. outline: none;
  540. opacity: 0.7;
  541. transition: opacity 0.2s ease 0s;
  542. display: inline;
  543. margin: 6px;
  544. }
  545. .slider:hover {
  546. opacity: 1;
  547. }
  548. .slider::-webkit-slider-thumb {
  549. -webkit-appearance: none;
  550. appearance: none;
  551. width: 7px;
  552. height: 15px;
  553. background:${ConfigColor};
  554. cursor: pointer;
  555. }
  556. .switch {
  557. position: relative;
  558. display: inline-block;
  559. width: 60px;
  560. height: 34px;
  561. }
  562.  
  563. .switch input {
  564. opacity: 0;
  565. width: 0;
  566. height: 0;
  567. }
  568. .switcher {
  569. position: absolute;
  570. display: inline-block;
  571. width: 57px;
  572. height: 23px;
  573. left: 74%;
  574.  
  575. }
  576.  
  577. .switcher input {
  578. opacity: 0;
  579. width: 0;
  580. height: 0;
  581. }
  582. .toggle {
  583. position: absolute;
  584. cursor: pointer;
  585. top: 0;
  586. left: 0;
  587. right: 0;
  588. bottom: 0;
  589. background-color: #ccc;
  590. -webkit-transition: .4s;
  591. transition: .4s;
  592. }
  593.  
  594. .toggle:before {
  595. position: absolute;
  596. content: "";
  597. height: 21px;
  598. width: 20px;
  599. left: 8px;
  600. border-radius: 4px;
  601. bottom: 1px;
  602. background-color: white;
  603. transition: all 0.4s ease 0s;
  604. }
  605.  
  606. input:checked + .toggle {
  607. background-color:${ConfigColor};
  608. }
  609.  
  610. input:focus + .toggle {
  611. box-shadow: 0 0 1px #2196F3;
  612. }
  613.  
  614. input:checked + .toggle:before {
  615. -webkit-transform: translateX(26px);
  616. -ms-transform: translateX(26px);
  617. transform: translateX(26px);
  618. }
  619. `);
  620. return window.Editor
  621. }