Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
Got rid of the waiting stuff, it wasn't working. Also added toggle-ab…
Browse files Browse the repository at this point in the history
…le logging.
  • Loading branch information
lazyatom committed Sep 7, 2009
1 parent 156386b commit 1ccf1b8
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 41 deletions.
21 changes: 8 additions & 13 deletions FreeAgent.dcproj/james.wdgtuser
Expand Up @@ -3,14 +3,7 @@
<plist version="1.0">
<dict>
<key>Breakpoints</key>
<dict>
<key>free_agent.js:85</key>
<string></string>
<key>gui.js:120</key>
<string>-populateSelect</string>
<key>main.js:142</key>
<string>-postTime</string>
</dict>
<dict/>
<key>BreakpointsFrame</key>
<string>603 48 404 338 0 0 1440 878 </string>
<key>ContentSplitViewGeometry</key>
Expand All @@ -36,11 +29,11 @@
<key>Dashboard Widget Prefs</key>
<dict>
<key>id</key>
<string>f9313eff5555b041</string>
<string>ba4e67fa6055b041</string>
<key>in-layer</key>
<true/>
<key>path</key>
<string>/private/var/folders/OG/OGHFsoDxGYmTuil4f-W3M++++TI/-Tmp-/Dashcode/.FreeAgent.dcprojqlynds/FreeAgent.dcproj/project.wdgt/</string>
<string>/private/var/folders/OG/OGHFsoDxGYmTuil4f-W3M++++TI/-Tmp-/Dashcode/.FreeAgent.dcproj7pAx1x/FreeAgent.dcproj/project.wdgt/</string>
<key>percent-offset-x</key>
<integer>0</integer>
<key>percent-offset-y</key>
Expand All @@ -66,6 +59,8 @@
<true/>
<key>SavePath</key>
<string>/Users/james/Desktop</string>
<key>WidgetCompatibilityTag</key>
<integer>0</integer>
</dict>
<key>Design time language</key>
<string>en.lproj</string>
Expand Down Expand Up @@ -138,15 +133,15 @@
<array>
<array>
<integer>0</integer>
<integer>0</integer>
<integer>13</integer>
<integer>1</integer>
<integer>8</integer>
</array>
</array>
<key>Opened Steps</key>
<array/>
<key>Visible StackLayout Views</key>
<array>
<string>front</string>
<string>back</string>
</array>
</dict>
</plist>
18 changes: 9 additions & 9 deletions FreeAgent.dcproj/project.wdgt/free_agent.js
Expand Up @@ -21,14 +21,14 @@ FreeAgent = {
var results = [];
var things = xml.find(kind);
if (things.length == 0) {
alert("Found no " + kind + "s");
Logger.log("Found no " + kind + "s");
} else {
things.each(function() {
var thing = $(this);
if (checkFunction == null || checkFunction(thing)) {
var thing_id = thing.find("id").text();
var thing_name = thing.find("name").text();
alert("adding " + kind + " '" + thing_name + "'");
Logger.log("adding " + kind + " '" + thing_name + "'");
results.push({name:thing_name, id:thing_id});
}
});
Expand All @@ -39,7 +39,7 @@ FreeAgent = {
loadUser: function() {
this.loadXML("users", function(xml) {
FreeAgent.userID = xml.find("user<email:contains(" + FreeAgent.email + ")").find("id").text();
alert("loaded user id: " + FreeAgent.userID);
Logger.log("loaded user id: " + FreeAgent.userID);
});
},

Expand Down Expand Up @@ -112,7 +112,7 @@ FreeAgent = {
}
timeslipXML += "</timeslip>";

alert("xml: " + timeslipXML);
Logger.log("xml: " + timeslipXML);

this.ajax({
type: 'POST',
Expand All @@ -134,7 +134,7 @@ FreeAgent = {
this.ajax({
url: this.remoteUrl(resource),
success: function(xml, status) {
alert(FreeAgent.remoteUrl(resource) + " returned " + xml + " [status: " + status + "]");
Logger.log(FreeAgent.remoteUrl(resource) + " returned " + xml + " [status: " + status + "]");
callback($(xml));
}
});
Expand All @@ -149,7 +149,7 @@ FreeAgent = {
},

ajax: function(options) {
alert("loading from " + options.url);
Logger.log("loading from " + options.url);
$.ajax($.extend({
contentType: "application/xml",
dataType: "xml",
Expand All @@ -158,9 +158,9 @@ FreeAgent = {
},
// debug
error: function(xml, status, error) {
alert("xml: " + xml.responseText);
alert("error status: " + status);
alert("error: " + error);
Logger.log("xml: " + xml.responseText);
Logger.log("error status: " + status);
Logger.log("error: " + error);
}
}, options));
},
Expand Down
24 changes: 6 additions & 18 deletions FreeAgent.dcproj/project.wdgt/gui.js
Expand Up @@ -6,20 +6,6 @@ GUI = {
this.updateDuration(duration);
},

wait: function() {
alert('waiting');
this.wasEnabled = this.isEnabled();
this.disablePost();
},

ready: function() {
alert('ready');
if (this.wasEnabled) {
alert('... and willing.');
this.enablePost();
}
},

updateDuration: function(duration) {
this.displayTime(duration);
if (duration >= 60) {
Expand Down Expand Up @@ -86,9 +72,7 @@ GUI = {
},

selectProject: function(event) {
this.wait();
FreeAgent.setProject(this.selectedProjectID());
this.ready();
},

selectTask: function(event) {
Expand Down Expand Up @@ -137,7 +121,11 @@ GUI = {
showBack();
},

isEnabled: function() {
return (this.buttonText().css('color') == "rgb(0, 0, 0)");
updateLoggerStatus: function(status) {
if (status) {
$("#message").css('color', "#ff0");
} else {
$("#message").css('color', "#fff");
}
}
};
13 changes: 13 additions & 0 deletions FreeAgent.dcproj/project.wdgt/logger.js
@@ -0,0 +1,13 @@
Logger = {
on: false,

toggle: function() {
return (this.on = !this.on);
},

log: function(message) {
if (Logger.on) {
alert(message);
}
}
}
3 changes: 2 additions & 1 deletion FreeAgent.dcproj/project.wdgt/main.html
Expand Up @@ -13,6 +13,7 @@
<script type="text/javascript" src="Parts/InfoButton.js" charset="utf-8"></script>
<script type="text/javascript" src="Parts/GlassButton.js" charset="utf-8"></script>
<script type="text/javascript" src="jquery-1.3.2.js" charset="utf-8"></script>
<script type="text/javascript" src="logger.js" charset="utf-8"></script>
<script type="text/javascript" src="timer.js" charset="utf-8"></script>
<script type="text/javascript" src="free_agent.js" charset="utf-8"></script>
<script type="text/javascript" src="gui.js" charset="utf-8"></script>
Expand Down Expand Up @@ -51,7 +52,7 @@
<div apple-part="com.apple.Dashcode.part.text" class="apple-text apple-no-children" apple-default-image-visibility="hidden" apple-text-overflow="ellipsis" id="text1" apple-style="part-width-dependent: true;part-height-dependent: true;"></div>
<div apple-part="com.apple.Dashcode.part.text" class="apple-text apple-no-children" apple-default-image-visibility="hidden" apple-text-overflow="ellipsis" id="text2" apple-style="part-width-dependent: true;part-height-dependent: true;"></div>
<input type="text" name="" value="" class="apple-textfield apple-no-children" apple-part="com.apple.Dashcode.part.textfield" id="domain">
<div apple-part="com.apple.Dashcode.part.text" class="apple-text apple-no-children" apple-default-image-visibility="hidden" apple-text-overflow="ellipsis" id="message"></div>
<div apple-part="com.apple.Dashcode.part.text" class="apple-text apple-no-children" apple-default-image-visibility="hidden" apple-text-overflow="ellipsis" id="message" onclick="toggleLogger(event)"></div>
<div apple-part="com.apple.Dashcode.part.text" class="apple-text apple-no-children" apple-default-image-visibility="hidden" apple-text-overflow="ellipsis" id="text3" onclick="openFreeRange(event)"></div>
<div apple-part="com.apple.Dashcode.part.text" class="apple-text apple-no-children" apple-default-image-visibility="hidden" apple-text-overflow="ellipsis" id="text4" onclick="openLazyatom(event)"></div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions FreeAgent.dcproj/project.wdgt/main.js
Expand Up @@ -178,3 +178,6 @@ function visitSite(event) {
function openFreeRange(event) { widget.openURL("http://gofreerange.com"); }
function openLazyatom(event) { widget.openURL("http://lazyatom.com"); }

function toggleLogger(event) {
GUI.updateLoggerStatus(Logger.toggle());
}

0 comments on commit 1ccf1b8

Please sign in to comment.