User:Thundercraft5/ModuleIDE.js

/* jshint undef:true */ $.when(	$.get('/load.php?mode=articles&only=styles&articles=User:Thundercraft5/FullscreenCodeEditor.css/active.css'),	$.get('/load.php?mode=articles&only=styles&articles=User:Thundercraft5/FullscreenCodeEditor.css'),	$.Deferred(def => { var int = setInterval( => {			if ($('#debugConsole').length) def.resolve, clearInterval(int);			}); }) ).then((activeStyles, styles) => {	console.log(styles, activeStyles);	var style = $(mw.util.addCSS(activeStyles[0]).ownerNode).remove;	mw.util.addCSS(styles[0]);	var oldX, oldY;	mw.hook('dev.cgnb.change').add(function(collapsed) { var interval = setInterval(function {			ace.editor.resize;		}, 0); ace.editor.interval = interval; });	$('.global-navigation').on('trasitionend', function { clearInterval(ace.editor.interval); delete ace.editor.interval; });	var bodyStyles = getComputedStyle(document.documentElement);	var height = bodyStyles.getPropertyValue("--codeEditor-height").trim;

$('.page-side-tools').append($(' ', { html: $(' ', {			class: "wds-icon",			html: $(" ", { "xlink:href": "#wds-icons-zoom-in", html: ' ', }),		}),		click: function { oldX = window.scrollX; oldY = window.scrollY; window.scrollTo(0, 0); $([ace.editor.container, $('.ui-resizable')[0]]).css({				position: "absolute",				height,			}); style.appendTo('head'); ace.editor.resize; },		title: "Enter Code Editor fullscreen", class: "page-side-tool codeeditor-fullscreen", "data-wds-tooltip": "Collapse", "data-wds-tooltip-position": "right", "data-tooltip-attached": 1, }));	$('.codeEditor-status-message').append($(' ', { for: "codeeditor-consoletoggle", class: "codeeditor-consoletoggle-label", title: "Toggle Debug Console [alt-shift-d]", accesskey: "d", }));	$('#mw-scribunto-console').before($(' ', { id: "codeeditor-consoletoggle", name: "codeeditor-consoletoggle", type: "checkbox", class: "wds-is-hidden", change { $('.mw-editform').toggleClass('codeeditor-console-open'); },	}));	$(window).on('keyup', function(e) {		if (e.key.toLowerCase === "escape") {			window.scrollTo(oldX, oldY);			style.remove;			$([ace.editor.container, $('.ui-resizable')[0]]).css({ position: "relative", height, });			ace.editor.resize;		}	}); scrollStyles: { let styles = window.getComputedStyle($('#mw-scribunto-output')[0]); let borderHeight = parseInt(styles.borderTopWidth) + parseInt(styles.borderBottomWidth); $('#mw-scribunto-output')[0].addEventListener('scroll', function {			var $this = $(this);			if (-Math.floor(this.scrollTop) < 5) 				$this.addClass('scroll-bottom').removeClass('scroll-top');			else if (Math.ceil(Math.floor((-$this.scrollTop)) + borderHeight + $this.innerHeight) + 5 > this.scrollHeight) 				$this.addClass('scroll-top').removeClass('scroll-bottom');			else $this.removeClass('scroll-bottom').removeClass('scroll-top');		}, { passive: true }); } });