Due to either incompetence or unwillingness of computer futures it seems impossible to add worksheet hours in a normal way, this script makes it easier by making the hours pasteable. Just paste them as 1 line per day and start time + end time split by space. Note, it only supports 1 start/stop time per day currently.
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 Computer Futures Worksheet Filler | |
// @namespace http://wol.ph/ | |
// @version 1.1 | |
// @description | |
// @match https://worksheets.computerfutures.com/index.php?dir=timesheet* | |
// @match http://worksheets.computerfutures.com/index.php?dir=timesheet* | |
// @copyright 2015, Wolph | |
// @run-at document-end | |
// ==/UserScript== | |
var text = $('<textarea id="text">'); | |
var parent = $('div#cwsUnderTopBar'); | |
parent.append(text); | |
console.log(parent); | |
function get(id){ | |
id = id.replace(/([\[\]])/g, '\\$1'); | |
console.log('looking for %s', id); | |
return $(id); | |
} | |
function update(e){ | |
console.log(e); | |
var lines = $('textarea#text').val().split('\n'); | |
var i = lines.length; | |
while(i--){ | |
var times = lines[i].split('\t'); | |
get('#tsGrid[' + i + '][0][from]').val(times[0]); | |
get('#tsGrid[' + i + '][0][to]').val(times[1]); | |
} | |
} | |
text.bind('keyup', update); | |
text.bind('paste', function(e){ | |
setTimeout(update); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment