diff options
Diffstat (limited to 'js/main.js')
-rw-r--r-- | js/main.js | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -387,6 +387,41 @@ $(document).ready(function(){ updateClasses(); }); + $('#backup-to-textarea').button(); + $('#backup-to-textarea').click(function (){ + var text = ""; + var i = 0; + for (i = 0; i < classes.length; i++) + { + text = text + + 'Class: ' + + classes[i].grade + + '-' + + classes[i].clas + + "\t" + + 'Points: ' + + classes[i].points + + "\t" + + 'Time wasted this week so far (seconds): ' + + classes[i].time + + "\n"; + } + $('#backup').html('<textarea id="backup-textarea">' + text + "</textarea>"); + + // select all text in the textarea on click: http://stackoverflow.com/a/5797700 + $("#backup-textarea").focus(function() { + var $this = $(this); + $this.select(); + + // Work around Chrome's little problem + $this.mouseup(function() { + // Prevent further mouseup intervention + $this.unbind("mouseup"); + return false; + }); + }); + }); + updateClasses(); }); |