Skip to content

Instantly share code, notes, and snippets.

@bvst
Last active June 23, 2017 10:13
Show Gist options
  • Save bvst/a558543c6ae7a830b9e928a85c964e1d to your computer and use it in GitHub Desktop.
Save bvst/a558543c6ae7a830b9e928a85c964e1d to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Expand confluence
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Gjøre expand-knappen i confluence mer intuitiv
// @author Bjørn-Vegard Thoresen
// @match https://confluence*
// @match https://confluence.helsedirektoratet.no/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var __idToFind = 'plusminus';
var __setColor = function (area) {
area.querySelectorAll('*[id^=' + __idToFind + ']').forEach(function (expandable) {
expandable.style['background-color'] = 'lightgray'; //Change color to w/e you want
var id = expandable.getAttribute('id');
id = id.replace(__idToFind, '');
expandable.onclick = function(event) { __setColorToChild('children'+id); };
}, this);
};
var __setColorToChild = function(id) {
var area = document.getElementById(id);
setTimeout(function() {
__setColor(area);
}, 100);
};
__setColor(document);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment