Skip to content

Instantly share code, notes, and snippets.

@szimek
Created December 7, 2011 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szimek/1442977 to your computer and use it in GitHub Desktop.
Save szimek/1442977 to your computer and use it in GitHub Desktop.
Adds a button on time entries page to create a daily report for a user.
// ==UserScript==
// @match https://objectreload.basecamphq.com/projects/*
// ==/UserScript==
var container = document.getElementById('report_link_block'),
link = document.createElement('a'),
content = document.createTextNode('Create a daily report'),
date = new Date(),
user,
path;
if (container) {
user = document.querySelector('#settings_signout_and_help a:first-child').href.split("/").slice(-2, -1);
date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
path = '/report?subject_id=' + user + '&from=' + date + '&to=' + date;
link.appendChild(content);
link.className = "admin";
link.href = document.location.href + path;
container.appendChild(document.createTextNode(' | '));
container.appendChild(link);
}
@morgoth
Copy link

morgoth commented Dec 7, 2011

Works also with Firefox greasemonkey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment