Last active
January 21, 2019 15:46
-
-
Save bfritscher/0521b90c347c89cf40ff5e4258975ae0 to your computer and use it in GitHub Desktop.
Mozilla Thimble Projects Sorter
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 Mozilla Thimble Projects Sorter | |
// @namespace https://gist.github.com/bfritscher/0521b90c347c89cf40ff5e4258975ae0 | |
// @version 2 | |
// @match https://thimble.mozilla.org/* | |
// @grant none | |
// ==/UserScript== | |
document.querySelectorAll('.glitch-banner').forEach( it => it.remove()); | |
document.querySelectorAll('.glitch > .btn.export-button').forEach( it => it.remove()); | |
document.querySelector('.navbar-thimble').style.marginTop = 0; | |
const projectList = document.getElementById("project-list"); | |
if (projectList) { | |
let ps = [... projectList.children]; | |
ps = ps.filter( a => a.hasAttribute("data-project-title") ) | |
ps.sort((a, b) => a.getAttribute("data-project-title").localeCompare(b.getAttribute("data-project-title"))); | |
let cat = ""; | |
ps.forEach(p => { | |
const pcat = p.getAttribute("data-project-title").split(" ")[0]; | |
if (pcat !== cat) { | |
cat = document.createElement("div"); | |
cat.innerHTML = `<h3>${pcat}<h3>`; | |
projectList.append(cat); | |
} | |
cat = pcat; | |
projectList.append(p) | |
}); | |
} else { | |
document.querySelector('.bramble-toolbar').style.top = '60px'; | |
document.getElementById('webmaker-bramble').style.top = '120px'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment