Created
December 11, 2019 17:57
-
-
Save flarn2006/314cf69e088e41f85f462dd8eb29b143 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 All GauGAN Labels | |
// @version 1 | |
// @grant none | |
// @include http://34.216.122.111/gaugan/ | |
// ==/UserScript== | |
function selectCategoryAll() | |
{ | |
var palette = document.getElementById('palette'); | |
palette.innerHTML = '<table><tbody></tbody><table>'; | |
palette = palette.querySelector('tbody'); | |
[].forEach.call(unsafeWindow.labels, function(lbl) { | |
var tr = document.createElement('tr'); | |
var th = document.createElement('th'); | |
var button = document.createElement('button'); | |
button.classList.add('btnclr'); | |
button.classList.add(lbl); | |
button.innerText = lbl[4].toUpperCase() + lbl.slice(5); | |
button.onclick = function() { | |
unsafeWindow.current_color = unsafeWindow.colors[unsafeWindow.labels.indexOf(lbl)]; | |
}; | |
th.appendChild(button); | |
tr.appendChild(th); | |
palette.appendChild(tr); | |
}); | |
} | |
window.addEventListener('load', function() { | |
var pstyle = document.getElementById('palette').style; | |
pstyle.maxHeight = '360px'; | |
pstyle.overflowY = 'scroll'; | |
var categoryList = document.querySelector('#category tr').parentNode; | |
var tr = document.createElement('tr'); | |
var th = document.createElement('th'); | |
var button = document.createElement('button'); | |
button.classList.add('btncat'); | |
button.classList.add('cat-all'); | |
button.innerText = 'All'; | |
button.onclick = selectCategoryAll; | |
th.appendChild(button); | |
tr.appendChild(th); | |
categoryList.appendChild(tr); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment