Permalink
Browse files

more widgetness

  • Loading branch information...
1 parent 98a3ee2 commit e9c6ed5fe63700db922f8f9babc16498985acc27 @smith committed Aug 24, 2011
@@ -2,21 +2,29 @@
<head>
<meta charset="utf-8" />
<title>College Football Widget</title>
+
+ <meta name="HandheldFriendly" content="True"/>
+ <meta name="MobileOptimized" content="320"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="front">
- <img id="logo" />
- <h1></h1>
<ul>
<li><a id="stats" target="_blank" href="">Stats</a></li>
<li><a id="news" target="_blank" href="">News</a></li>
</ul>
+ <header>
+ <img id="logo" />
+ <h1></h1>
+ </header>
<table></table>
- <a class="flipper" href="">i</a>
+ <div class="flipper"><a href="">i</a></div>
</div>
<div id="back">
- <h1>College Football Widget</h1>
+ <h1>College Football</h1>
<form>
<label for="conferences">Conference</label>
<select id="conferences"></select>
@@ -1,3 +1,3 @@
-require(["ui"], function (ui, team) {
+require(["./ui", "./widget"], function (ui) {
ui.load();
});
@@ -0,0 +1,47 @@
+// Get or set preferences, using either localStorage or Dashboard prefs
+define(function (require, exports) {
+ var w = window.widget, engine, prefs = {}; // fallback
+
+ function supportsLocalStorage() {
+ try {
+ return 'localStorage' in window && window['localStorage'] !== null;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ // Determine storage method
+ if (w) { engine = "widget"; }
+ else if (supportsLocalStorage()) { engine = "localStorage"; }
+
+ exports.get = function (pref) {
+ var v;
+ switch (engine) {
+ case "localStorage":
+ v = localStorage.getItem(pref);
+ break;
+ case "widget":
+ v = w.preferenceForKey(pref);
+ break;
+ default:
+ v = prefs[pref];
+ break;
+ }
+ return v;
+ };
+
+ exports.set = function (pref, value) {
+ switch (engine) {
+ case "localStorage":
+ localStorage.setItem(pref, value);
+ break;
+ case "widget":
+ w.setPreferenceForKey(pref, value);
+ prefs[pref] = value;
+ break;
+ default:
+ prefs[pref] = value;
+ break;
+ }
+ };
+});
@@ -2,7 +2,7 @@ define(["require", "exports", "jquery"], function (require, exports, $) {
var cellMethods;
function convertTZ(time) {
- console.log(time);
+ // TODO
return time;
}
@@ -36,7 +36,12 @@ define(["require", "exports", "jquery"], function (require, exports, $) {
},
resultTime: function (cell, o) {
var rt = o.resultTime = cell.find("p").text();
- if (/ET\s?$/.test(rt)) { rt = convertTZ(rt); }
+ // If there's " ET " (eastern time)
+ if (/\sET\s?/.test(rt)) {
+ // Remove everything after the "ET "
+ rt = rt.replace(/\sET\s?(.*)$/, "");
+ rt = convertTZ(rt);
+ }
o.resultTime = rt;
},
recordTickets: function (cell, o) {}
Oops, something went wrong.

0 comments on commit e9c6ed5

Please sign in to comment.