Permalink
Browse files

Merge remote branch 'origin/two-alpha'

Conflicts:
	CollegeFootball.wdgt.zip
	CollegeFootball/Back.png
	build.sh
  • Loading branch information...
smith committed Aug 30, 2011
2 parents 2703902 + b8455a7 commit da11cdaf5c67008b786c56ee4eb5ddcd6ca74fdc
View
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,39 @@
+<html>
+ <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">
+ <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" src="images/blank.png" />
+ <h1></h1>
+ </header>
+ <table></table>
+ <div class="flipper" style="display:none"><a href="#">i</a></div>
+ </div>
+ <div id="back">
+ <h1>College Football</h1>
+ <form>
+ <label for="conferences">Conference</label>
+ <select id="conferences"></select>
+ <label for="teams">Team</label>
+ <select id="teams"></select>
+ <button>Done</button>
+ </form>
+ <a target="_blank" href="http://nlsmith.com/projects/college-football">nlsmith.com</a>
+ </div>
+ <script src="js/require-jquery.js" data-main="js/main"></script>
+ </body>
+</html>

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,75 @@
+/**
+ * jQuery.ajax mid - CROSS DOMAIN AJAX
+ * ---
+ * @author James Padolsey (http://james.padolsey.com)
+ * @version 0.11
+ * @updated 12-JAN-10
+ * ---
+ * Note: Read the README!
+ * ---
+ * @info http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
+ */
+
+jQuery.ajax = (function(_ajax){
+
+ var protocol = location.protocol,
+ hostname = location.hostname,
+ exRegex = RegExp(protocol + '//' + hostname),
+ YQL = 'http' + (/^https/.test(protocol)?'s':'') + '://query.yahooapis.com/v1/public/yql?callback=?',
+ query = 'select * from html where url="{URL}" and xpath="*"';
+
+ function isExternal(url) {
+ return !exRegex.test(url) && /:\/\//.test(url);
+ }
+
+ return function(o) {
+
+ var url = o.url;
+
+ if ( /get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url) ) {
+
+ // Manipulate options so that JSONP-x request is made to YQL
+
+ o.url = YQL;
+ o.dataType = 'json';
+
+ o.data = {
+ q: query.replace(
+ '{URL}',
+ url + (o.data ?
+ (/\?/.test(url) ? '&' : '?') + jQuery.param(o.data)
+ : '')
+ ),
+ format: 'xml'
+ };
+
+ // Since it's a JSONP request
+ // complete === success
+ if (!o.success && o.complete) {
+ o.success = o.complete;
+ delete o.complete;
+ }
+
+ o.success = (function(_success){
+ return function(data) {
+
+ if (_success) {
+ // Fake XHR callback.
+ _success.call(this, {
+ responseText: data.results[0]
+ // YQL screws with <script>s
+ // Get rid of them
+ .replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
+ }, 'success');
+ }
+
+ };
+ })(o.success);
+
+ }
+
+ return _ajax.apply(this, arguments);
+
+ };
+
+})(jQuery.ajax);
@@ -0,0 +1,3 @@
+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;
+ }
+ };
+});
Oops, something went wrong.

0 comments on commit da11cda

Please sign in to comment.