Commits

Seph Soliman committed 7f763cf Merge

added tag for 1.2

Comments (0)

Files changed (3)

src/css/widget.css

 #front.expanded { background-image: url('../images/bg-front.png'); }
 #back { background: transparent url('../images/bg-back.png') no-repeat 0px 0px; }
 
-label { width: 100px; float: left; clear: left; line-height: 21px; margin: 2px 0px; }
+label { width: 100px; float: left; clear: left; line-height: 21px; margin: 2px 0px; font-size: 12px; }
 input[type=text],
-input[type=password] { font-size: 14px; padding: 2px; }
+input[type=password] { font-size: 14px; padding: 2px; font-size: 12px; }
 #back input[type=text],
 #back input[type=password] { width: 140px; }
 #back p { margin: 0px 0px 10px; }
 #loginbtn { float: right; }
 
+#login_form p { margin: 0 0 5px; clear: both; }
+#login_form #pause_inactive_p label { line-height: 14px; }
+#feedback_login_p { padding-top: 5px; }
+
 #watch { background: transparent url('../images/watch.png') no-repeat center center; width: 56px; height: 63px; right: 25px; top: 40px; position: absolute; }
 
 input[type=text].error { background: #fcc; }
 
 #projects { font-size: 24px; width: 173px; }
 
-#your_user_id { position: absolute; bottom: 20px; right: 20px; color: #999; font-size: 9px; }
+#your_user_id { position: absolute; bottom: 22px; left: 75px; color: #999; font-size: 9px; }
 #debug { position: absolute; bottom: 35px; left: 20px; }
 #debug input { width: 95px; }
-#debugbtn { position: absolute; bottom: 20px; right: 70px; color: #999; font-size: 9px; background: transparent url('../images/debug.png') no-repeat left top; width: 51px; height: 14px; cursor: pointer; }
+#debugbtn { position: absolute; bottom: 20px; left: 20px; color: #999; font-size: 9px; background: transparent url('../images/debug.png') no-repeat left top; width: 51px; height: 14px; cursor: pointer; }
 
 #projects_container { position: absolute; top: 45px; left: 25px; }
 #time_container { position: absolute; top: 79px; left: 25px; height: 25px; width: 173px; text-align: center; font-size: 20px; }
 #reportdate_toggle:hover { color: #fff; }
 #reportdate { position: absolute; right: 0px; top: 0px; }
 #reportdate #reportdate_y { display: none; }
+#reportdate_text { position: absolute; top: 2px; left: 130px; }
+#reportdate_arrow { position: absolute; top: 2px; left: 130px; }
 #todolist { height: 70px; overflow: auto; width: 200px; }
 #todos { width: 248px; margin-top: 30px; }
 #reportbtn { position: absolute; top: 56px; right: 0px; }
 input[disabled] { opacity: .4; }
 input[type=text].fieldHelp { color: #999; }
 
+#give_feedback { position: absolute; bottom: 20px; left: 110px; font-size: 10px; }
+#version { position: absolute; bottom: 20px; right: 20px; color: #999; font-size: 9px; }
+
 .debug { visibility: hidden; }
 
 	if(BC_USER_ID == null || BC_USER_ID == 0) BC_USER_ID = 0;
 	BC_USER_ID = parseInt(BC_USER_ID); // * ensure it's an int when it gets read from settings
 	$("#your_user_id").text(BC_USER_ID);
+	$('#pause_inactive').get(0).checked = widget.preferenceForKey("pause_inactive") == 'true' ? true : false;
 	
 	ajaxOptions.username = BC_USERNAME;
 	ajaxOptions.password = BC_PASSWORD;
 	$("#reporthours").keydown(keyDownTime);
 	$("#roundtime").change(changeRoundTime);
 	$("#show_project").click(openProjectURL);
+	$("#pause_inactive").click(togglePauseInactive);
 	$("#reportdate_toggle").toggle(function() {
-		$('span:first', this).fadeIn(200);
-		$('span:last', this).fadeOut(250);
-		$("#reportdate").fadeIn(200)
+		$('#reportdate_arrow').fadeIn(200);
+		$('#reportdate_text').fadeOut(250);
+		$("#reportdate").fadeIn(200);
 	}, function() {
-		$('span:first', this).fadeOut(250);
-		$('span:last', this).fadeIn(200);
-		$("#reportdate").fadeOut(200)
+		$('#reportdate_arrow').fadeOut(250);
+		$("#reportdate").fadeOut(200);
+		$('#reportdate_text').text('on ' + monthNames[$('#reportdate_m').val()].short + ', ' + $('#reportdate_d').val());
+		$('#reportdate_text').fadeIn(200);
 	});
 	$("#reportcontainerbutton").toggle(function() {
 		$("#front").addClass("expanding");
 	var opts = $.extend({}, ajaxOptions);
 	
 	console.log('pulling projects data from login');
+	$("#projects").html('<option value="" disabled="disabled">Loading projects...</option>');
 
 	opts.url = projectsURL;
 	opts.success = function(root) { parseProjects(root); callback(); };
 	var opts = $.extend({}, ajaxOptions);
 	
 	console.log('pulling project todos from project ' + project_id);
+	$("#todos").html('<option value="" disabled="disabled">Loading to-do items...</option>');
 	
 	opts.url = todoURL;
 	opts.success = function(root) { parseProjectTodoLists(root, project_id); };
 	
 	// * setup the drop down
 	console.log('setting up projects drop down');
-	$("#projects").html('<option value="">Select a project &raquo;</option>');
+	$("#projects").html('<option value="" disabled="disabled">Select a project &raquo;</option>');
 	for(var i in allCompanies) {
 		var cmp = allCompanies[i];
 		var projects = cmp.getProjects();
 	console.log('parsing project todos');
 	
 	todolists = {};
+	$("#todos").html('<option value="" disabled="disabled">Select a to-do &raquo;</option>');
 	$(todoNode).find("todo-lists > todo-list").each(function(i) {
 		var t = $(this);
 		
 	
 	if(prj != null) {
 		var todolists = prj.todolists;
-		$("#todos").html('<option value="">Select a to-do &raquo;</option>');
 		for(var i in todolists) {
 			var list = todolists[i];
 			// * ignore complete lists
 		widget.openURL(BC_BASE_URL + '/projects/' + projectId + '/time_entries');
 }
 
+function togglePauseInactive() {
+	widget.setPreferenceForKey(this.checked ? 'true' : 'false', "pause_inactive");
+}
+
 var timerIdle = false;
 function onEnterIdle() {
 	console.log('entering idle state');
-	if(globalTimer.started && !timerIdle) {
+	if(globalTimer.started && !timerIdle && $('#pause_inactive').get(0).checked) {
 		timerIdle = true; // indicate that we may resume once active again
 		pauseTimer();
 		console.log('user idle, pausing timer');
 					<div>
 						<div id="reporttime">
 							<span>Time:<input type="text" value="0,0" id="reporthours" /> hours</span>
-							<div id="reportdate_toggle"><span style="display:none">&laquo;</span><span>today</span></div>
+							<div id="reportdate_toggle"><span style="display:none" id="reportdate_arrow">&laquo;</span><span id="reportdate_text">today</span></div>
 						</div>
 						<select id="todos"><option disabled="disabled" value="">Select a to-do &raquo;</option></select><br/>
 						<input type="text" value="" id="reportdescription" name="description" /><br/>
 							<option value="5">1/12 hour  (5 min)</option>
 						</select>
 					</p>
-					<p>
+					<p id="pause_inactive_p">
+						<label>Pause when inactive:</label>
+						<input type="checkbox" id="pause_inactive" />
+					</p>
+					<p id="feedback_login_p">
 						<input type="submit" id="loginbtn" value="Login" />
 					</p>
-					<p><a onclick="widget.openURL(this.getAttribute('href')); return false;" href="http://bitbucket.org/seph/basecamp-time-widget/issue/2/feedback">Give feedback</a></p>
+					<a id="give_feedback" onclick="widget.openURL(this.getAttribute('href')); return false;" href="http://bitbucket.org/seph/basecamp-time-widget/issue/2/feedback">Give feedback</a>
 				</form>
 				
 				<span class="debug" onclick="$('#debug').slideToggle(250)" id="debugbtn"></span><br/>
 					<input type="button" value="Show front" onclick="showFront()" /><br/>
 				</div>
 				<div class="debug" id="your_user_id">N/A</div>
+				<div id="version">v1.3</div>
 				
 				<div id="done">&nbsp;</div>
 			</div>