Skip to content

Commit

Permalink
Fix #56 - Allow for longer moves
Browse files Browse the repository at this point in the history
Also Fix #53 and updated FAQ accordignly
  • Loading branch information
Fertogo committed May 22, 2015
1 parent b74ce6f commit 2befb77
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
17 changes: 15 additions & 2 deletions Online Workout Manger/add-workout.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ $(document).ready(function(){
resetMove();
}

//Allow for longer moves - change max if near limit
$( "#min-slider-container").on('slidestop', function( event ) {
var currentVal = $("#minute-slider").val();
var currentMax = parseInt($("#minute-slider").attr("max"));
if (currentMax >= 90) return;
if (currentVal >= currentMax ) {
$( "#minute-slider" ).attr("max", (currentMax+15).toString());
$("#minute-slider").slider("refresh");
}
});

function resetMove() {
//Reset Values
$("#move-name").val("");
Expand Down Expand Up @@ -136,8 +147,8 @@ $(document).ready(function(){
$("#error-add-workout").fadeIn();
}

else if (title.indexOf(',') > 0){ //Valid title name (no commas)
$("#error-add-workout").html("Plase don't use commas in your title");
else if (title.indexOf(',') >= 0 || title.indexOf('/') >= 0 ){ //Valid title name (no commas or /)
$("#error-add-workout").html("Plase don't use commas (,) or slashes (/) in your title");
$("#error-add-workout").fadeIn();
}

Expand All @@ -161,4 +172,6 @@ $(document).ready(function(){
$("#add-workout-cancel-btn").click(function(){
resetAddWorkoutForm();
});


});
24 changes: 15 additions & 9 deletions Online Workout Manger/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ function timeText(time){
return "Error";
}

/**
* Populate the workouts HTML based on json.
* @param index index of workout to expand after populating
*/
function populateHTML(index) {

$("#workout-list").html(''); //Reset div. Yes, I am redrawing everytime, could be optimized.
Expand Down Expand Up @@ -96,18 +100,17 @@ function initWorkoutList(){
function initMoveList(){
$("#workout-list").children().each(function() {
var moveList = this.getElementsByClassName("move-list")[0];
console.log(moveList)
console.log(moveList);

moveList.addEventListener('slip:beforereorder', function(e){

console.log("Before order Moves")
console.log("Before order Moves");
console.log(e.target.id)

}, false);

moveList.addEventListener('slip:beforewait', function(e){
console.log("Move Wait");
console.log(e)
console.log(e);

if (e.target.className.indexOf('instant') > -1) e.preventDefault();
}, false);
Expand All @@ -120,18 +123,16 @@ function initMoveList(){

e.target.parentNode.insertBefore(e.target, e.detail.insertBefore);
console.log("Move from " + e.detail.originalIndex + " to " + e.detail.spliceIndex);
console.log("On workout " + id[0] + " move " + id[1])
console.log("On workout " + id[0] + " move " + id[1]);
json.workouts[id[0]].moves.move(e.detail.originalIndex, e.detail.spliceIndex)
populateHTML(id[0])//Update all ID's
populateHTML(id[0]);//Update all ID's
return false;
}, false);


new Slip(moveList);
})



}

Array.prototype.move = function(from, to) {
Expand Down Expand Up @@ -160,7 +161,12 @@ $(document).ready(function(){
document.location = "https://apps.getpebble.com/applications/53b8f8d4c09b06bcc7000007";
}
}
else $("#heart").show();
else {
$("#heart").show();
$("#new").show();


}

//Initialize Popup
$( "#edit-popup" ).enhanceWithin().popup();
Expand Down
4 changes: 4 additions & 0 deletions Online Workout Manger/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ a:link {
margin:0;
}

.slip-reordering {
box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

/* FAQ Page */
.ui-listview>li p, .ui-listview>.ui-li-static, .ui-listview>.ui-li-divider, .ui-listview>li>a.ui-btn{
overflow: visible;
Expand Down
19 changes: 13 additions & 6 deletions Online Workout Manger/workout-manager.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Pebble Workout timer. By Fernando Trujano
[email protected]
v2.0 Lets users see and edit workouts online.
v2.2 Lets users see and edit workouts online.
-->

<html>
Expand All @@ -17,6 +17,7 @@
<div data-role="content">
<div class="error" id="update" hidden><strong> There is an update for this app available on the Pebble appstore. <a href="pebble://appstore/53b8f8d4c09b06bcc7000007"> Click here to update! </a> </strong> </div>
<div class="success" id="heart" hidden > Like this app? Please give it a &hearts; on the <a href="pebble://appstore/53b8f8d4c09b06bcc7000007"> App Store. </a> This will encourage me to keep developing new features! </div>
<div class="success" id="new" hidden >New in version 3.2: Reorder moves by clicking and dragging to new location! </div>
<h2>Manage Workouts <a href="#info" data-transition="flip"><button data-inline="true" data-mini="true" data-icon="info"> FAQ </button></a></h2>
<div id="loading" class="info">Loading your workouts, please wait. </div>
<div data-role="collapsibleset" data-content-theme="a" data-iconpos="left" data-collapsed-icon="carat-d" data-expanded-icon="carat-u" id="workout-list">
Expand Down Expand Up @@ -47,8 +48,16 @@ <h3> <a href="#main" data-transition="flip"><button data-inline="true" data-mini
<p> Yes, after expanding the workout click on the add move button and fill in the info.</p> </li>
<li> Can I edit moves after I add them?
<p> Yes, after expanding the workout click on the move you'd like to edit. From there, you can change it's name, time or delete it. </p> </li>
<li> Can I reorder moves in my workout?
<p> Yes, after expanding the workout click and hold a move. From there, you can drag it around to its desidred position. Don't forget to save! </p> </li>
<li> What's the difference between a "rep" and a "time" move?
<p> When you add a move, you'll see a blue switch that will let you select between a rep and a time move. Time moves count down automatically and advance to the next move when the countdown reaches 0. Rep moves wait for you to manually advance the move the number of reps you specified before moving on </p> </li>
<li> How do I skip a rep move?
<p> In rep mode, the next button decrements the remaining reps by 1. To skip the move all together, simply press and hold the next button. </p> </li>
<li> Phone keyboards suck, can I do all of this from my computer?
<p> Yes, you can manage all of your workouts from your computer! Go back to the main page, and there should be a link at the bottom. Go to this link on your computer, make the necesary changes and save. To apply the changes to the Pebble, simply go back to the workout manager from your phone and click save. </p> </li>
<li> Can I have moves that are longer than 15 minutes?
<p> Yes! To make a longer move slide the minutes slider all the way to the right and let go, you can then drag it to the right again for a longer move. Repeat this for moves up to 90 minutes. </p> </li>
<li> How do I pause/resume a timer?
<p> While a timer is running, simply press the middle button to pause or resume. </p> </li>
<li> Can I suggest a new feature?
Expand All @@ -58,7 +67,7 @@ <h3> <a href="#main" data-transition="flip"><button data-inline="true" data-mini
<li> Who are you?
<p> Hi, I am <a href="http://www.fernandotrujano.com"> Fernando Trujano </a>, a happy Pebble owner and college sophomore. If you like this app please give it a "heart" on the Pebble appstore.I smile everytime I see the count go up :) </p> </li>
<li> Can I buy you a beer?
<p> Not legally, at least not until next year. In the meantime if you would like to support my work you can donate using Paypal below or with a credit/debit card using <a href="https://cash.me/$trujano"> Square Cash. </a> </p>
<p> Not legally, at least not until next year. In the meantime if you would like to support my work you can donate using Paypal below or with a credit/debit card with <a href="https://cash.me/$trujano"> Square Cash. </a> </p>
<form style="text-align:center" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCDJwiCPmsYsFVuuxZQ6Lrv/Z+1+VUT+J4xqxCNLeAljyBJbGp4a/vGiyxGssctbIYWraFule6Qxzds+EXhIfYlIFLTsc18Eg4YnD1IkEBL4+oxhqH3q67NoKHsSZ5kBN+N90S0jkpRiP/WWGQfqhZDh/PQb1DVfIyqMm5098BsojELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIZLvfb81M0kiAgZhedlj3TUvxDF+GWh7QkfphntubaXkBB3kF7kT1uv/5CsThZDZSWcRXoiFAjgVJyYZwfdya3BXQOC2W1Eq9Bo7iS6SiFh69EcAkHW7C8ffR9zpTI6jO9ATiz3LlD0qkemGJLvdAx+JKBw3UGfXGYmWnJxzNRJrQOhfiC29N1rwWPtZG3VQtW5qSPD9aevCkmZI/6WHppCGx16CC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H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE0MTEyNTA2MjYzM1owIwYJKoZIhvcNAQkEMRYEFPAaZoQPtuGHvUpHDjbm+D/t5DLVMA0GCSqGSIb3DQEBAQUABIGAhfyrkkH2k0HFNivrH4ddEyTmP6StjXz1xGpBDZJ8hxPsMhzdjzECc6aoO/lyaAy330gWiqzgf4xuTYoXCA4vzT4twP1CWlG8bSzRzxkT71/gjSGPzwkXxsqRqFR6JwngTGfmFTqTMVw/wLwGK/CV+GsnIFJp6LFLnCQmJBcez9o=-----END PKCS7-----
Expand All @@ -71,10 +80,8 @@ <h3> <a href="#main" data-transition="flip"><button data-inline="true" data-mini
<hr>
<h2> Known Issues </h2>
<ul data-role="listview">
<li> Workout name changes to a number
<p><strong> Temporary Fix: </strong> Go to the workout manager and save your workouts back to Pebble. </p> </li>
<li> I'm stuck on the loading screen
<p><strong> Temporary Fix: </strong> Wait a couple of seconds and check that your Pebble is connected to the phone. </p> </li>
<p><strong> Temporary Fix: </strong> Wait a couple of seconds and check that your Pebble is connected to the phone. Then try again. </p> </li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -158,10 +165,10 @@ <h3> <span id="popup-text"> </span> <button id = "edit-delete-btn" data-icon="de
<script src="add-workout.js"></script>
<script src="edit-workout.js"></script>
<script src="slip.js"></script>
<script src="main.js"></script>
<script>

</script>

<script src="main.js"></script>

</html>

0 comments on commit 2befb77

Please sign in to comment.