Created
February 23, 2019 16:46
-
-
Save a2intl/293a76ae3323ec21d7cdceb6f7cd63af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Resizeable Jenkins Script Editor | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Display pipeline options in wide screen, make script editor resizeable. | |
// @author Andrew Allen (credit to Victor Toulouse for previous version) | |
// @match http://jenkins-ci.org | |
// @grant none | |
// ==/UserScript== | |
/** | |
* Wait for the script editor to appear. | |
*/ | |
function check(changes, observer) { | |
var ace_editors = document.querySelectorAll('.ace_editor'); | |
ace_editors.forEach(function(editor) { | |
if(!editor.made_wide) { | |
var container = editor.closest('tr.dropdownList-container'); | |
if(container) { | |
container.querySelector(':scope > td:nth-child(1)').style.display = 'none'; | |
container.querySelector(':scope > td:nth-child(2)').colSpan = '3'; | |
editor.made_wide = true; | |
} | |
} | |
if(!editor.made_resizeable) { | |
var jquery_ui = editor.closest('.jquery-ui-1'); | |
if(jquery_ui) { | |
jquery_ui.style.resize = 'both'; | |
jquery_ui.style.overflow = 'scroll'; | |
jquery_ui.style.height='750px'; | |
editor.style.height='100%'; | |
const resizeObserver = new ResizeObserver(entries => { | |
for (let entry of entries) { | |
if(entry.target.aceEditor) entry.target.aceEditor.resize(); | |
} | |
}); | |
resizeObserver.observe(editor); | |
editor.made_resizeable = true; | |
} | |
} | |
}); | |
} | |
(function() { | |
'use strict'; | |
document.querySelector('.container').style.width = '100%'; | |
document.querySelector('.container').style.padding = '0'; | |
document.querySelector('.col-md-offset-2').style.width = '100%'; | |
document.querySelector('.col-md-offset-2').style.margin = '0'; | |
(new MutationObserver(check)).observe(document, {childList: true, subtree: true}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@a2int, thanks for the help. Using Jenkins 2.176.1 unfortunately does not works.