Created
December 7, 2011 14:22
-
-
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.
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== | |
// @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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works also with Firefox greasemonkey