Skip to content

Instantly share code, notes, and snippets.

@BackEndTea
Created April 11, 2017 11:16
Show Gist options
  • Select an option

  • Save BackEndTea/d767009c87f5db553d0b57271fbab543 to your computer and use it in GitHub Desktop.

Select an option

Save BackEndTea/d767009c87f5db553d0b57271fbab543 to your computer and use it in GitHub Desktop.
Adds a button to the kittysplit new entry page that deselects all participants.
// ==UserScript==
// @name Kittysplit deseletc all buton
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a deselect all button to the kittysplit add new expense screen.
// @author You
// @match *.kittysplit.com/*/entries/new/expense
// @grant none
// ==/UserScript==
(function() {
'use strict';
addButton();
})();
function addButton () {
var collection = document.getElementById('entry-expense-parties');
var button = document.createElement('button');
button.innerHTML = "Deselect All";
button.type = 'button';
button.onclick = deSelectAll;
collection.insertBefore(button, collection.childNodes[0]);
}
function deSelectAll() {
var boxes = document.getElementsByClassName('checkbox');
for( i = 0; i < boxes.length; i++)
{
var checkbox = boxes[i].children[0].children[0];
console.log(checkbox);
checkbox.checked = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment