sports_db 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/core/BaseView.js +2 -3
- data/app/assets/javascripts/core/History.js +3 -3
- data/app/assets/javascripts/core/utilities.js +19 -148
- data/app/assets/javascripts/plugins/calnav.js +16 -13
- data/app/assets/javascripts/plugins/collapsible.js +42 -0
- data/app/assets/javascripts/plugins/detect.js +1 -1
- data/app/assets/javascripts/plugins/flash.js +3 -1
- data/app/assets/javascripts/plugins/jquery.zumobi-0.2.js +108 -36
- data/app/assets/javascripts/plugins/resizeable.js +2 -2
- data/app/assets/javascripts/plugins/zepto.filterable.js +41 -0
- data/app/assets/javascripts/plugins/zepto.mask.js +34 -0
- data/app/assets/javascripts/plugins/zepto.preload.js +13 -0
- data/app/assets/javascripts/plugins/zepto.tabs.js +151 -0
- data/lib/sports_db/version.rb +1 -1
- metadata +7 -4
- data/app/assets/javascripts/plugins/filterable.js +0 -12
- data/app/assets/javascripts/plugins/params.js +0 -27
|
@@ -36,7 +36,7 @@ var BaseView = View.extend({
|
|
|
36
36
|
return this.params.metric || "/" + this.params.view.capitalize();
|
|
37
37
|
},
|
|
38
38
|
setMetric: function(metric) {
|
|
39
|
-
|
|
39
|
+
console.log('((( setMetric '+ metric +' )))');
|
|
40
40
|
return this.params.metric = metric;
|
|
41
41
|
},
|
|
42
42
|
getButtons: function() {
|
|
@@ -72,7 +72,6 @@ var BaseView = View.extend({
|
|
|
72
72
|
} else {
|
|
73
73
|
// NBA3 only
|
|
74
74
|
if ($.highResifyLogosForRetinaAndAndroid) {
|
|
75
|
-
console.log('adjusting Android');
|
|
76
75
|
response = $.highResifyLogosForRetinaAndAndroid(response);
|
|
77
76
|
}
|
|
78
77
|
|
|
@@ -94,7 +93,7 @@ var BaseView = View.extend({
|
|
|
94
93
|
});
|
|
95
94
|
},
|
|
96
95
|
onClientCallback: function(name, value) {
|
|
97
|
-
|
|
96
|
+
console.log('BaseView.onClientCallback({' + name + ': ' + value + '})');
|
|
98
97
|
},
|
|
99
98
|
// If HTML returned from the server includes a `<div id="html_data" data-params=""></div>` element,
|
|
100
99
|
// this should contain an object literal (JSON string) with values that will be merged into
|
|
@@ -6,7 +6,7 @@ var History = (function() {
|
|
|
6
6
|
var currentHash = null;
|
|
7
7
|
|
|
8
8
|
function getMemo() {
|
|
9
|
-
return currentHash
|
|
9
|
+
return $.deserialize(currentHash);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function getHash() {
|
|
@@ -34,8 +34,8 @@ var History = (function() {
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
|
-
add: function(
|
|
38
|
-
window.location.hash = "#" + $.
|
|
37
|
+
add: function(obj) {
|
|
38
|
+
window.location.hash = "#" + $.serialize(obj);
|
|
39
39
|
},
|
|
40
40
|
currentHash: function() {
|
|
41
41
|
return getHash();
|
|
@@ -1,36 +1,18 @@
|
|
|
1
|
-
var console = console || {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
return dim;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Take a query string and return and object.
|
|
21
|
-
String.prototype.toParameters = function() {
|
|
22
|
-
if (this.indexOf('=') == -1) {
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
var params = {};
|
|
26
|
-
|
|
27
|
-
this.split("&").forEach(function(pair) {
|
|
28
|
-
var s = pair.split("=");
|
|
29
|
-
params[decodeURIComponent(s[0].replace(/\+/g, ' '))] = decodeURIComponent(s[1].replace(/\+/g, ' '));
|
|
30
|
-
});
|
|
31
|
-
return params;
|
|
32
|
-
}
|
|
33
|
-
|
|
1
|
+
var console = console || {log:function(){},warn:function(){},error:function(){}};
|
|
2
|
+
|
|
3
|
+
// Take a string, make an object.
|
|
4
|
+
$.deserialize = function(str) {
|
|
5
|
+
var obj = {};
|
|
6
|
+
str.split("&").forEach(
|
|
7
|
+
function(p) {
|
|
8
|
+
var s = p.split("=");
|
|
9
|
+
obj[s[0].replace(/^\?/, '')] = decodeURIComponent(s[1]);
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
return obj;
|
|
13
|
+
};
|
|
14
|
+
// Take a object, make an string (of parameters).
|
|
15
|
+
$.serialize = $.param;
|
|
34
16
|
|
|
35
17
|
// Replace values in a string, e.g. `"foo {boo}".format({boo: 'hoo'}) = 'foo hoo'`.
|
|
36
18
|
//
|
|
@@ -45,130 +27,19 @@ String.prototype.format = function(hash, translate_key) {
|
|
|
45
27
|
return s;
|
|
46
28
|
}
|
|
47
29
|
|
|
30
|
+
window.$id = function(id) {
|
|
31
|
+
return document.getElementById(id);
|
|
32
|
+
}
|
|
33
|
+
|
|
48
34
|
// Capitalize the first character of a string.
|
|
49
35
|
String.prototype.capitalize = function() {
|
|
50
36
|
return this.charAt(0).toUpperCase() + this.substr(1).toLowerCase();
|
|
51
37
|
}
|
|
52
38
|
|
|
53
|
-
// Sets the object to which `this` refers to.
|
|
54
|
-
Function.prototype.bind = function() {
|
|
55
|
-
if (arguments.length < 2 && typeof arguments[0] == "undefined") return this;
|
|
56
|
-
var __method = this, args = $A(arguments), object = args.shift();
|
|
57
|
-
return function() {
|
|
58
|
-
return __method.apply(object, args.concat($A(arguments)));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Take a DOM node collection and return an `Array`
|
|
63
|
-
function $A(arraylike) {
|
|
64
|
-
if (!arraylike) return [];
|
|
65
|
-
var length = arraylike.length || 0, results = new Array(length);
|
|
66
|
-
while (length--) results[length] = arraylike[length];
|
|
67
|
-
return results;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Takes an object and returns the type.
|
|
71
|
-
function type_of(v) {
|
|
72
|
-
if (typeof(v) == "object") {
|
|
73
|
-
if (v === null) return "null";
|
|
74
|
-
if (v.constructor == (new Array).constructor) return "array";
|
|
75
|
-
if (v.constructor == (new Date).constructor) return "date";
|
|
76
|
-
if (v.constructor == (new RegExp).constructor) return "regex";
|
|
77
|
-
return "object";
|
|
78
|
-
}
|
|
79
|
-
return typeof(v);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function macrojungle(tmpl) {
|
|
83
|
-
// This is kind of stupid.
|
|
84
|
-
// But at least it's only written once.
|
|
85
|
-
var html = $('#tmp').empty().microjungle(tmpl).html();
|
|
86
|
-
// If we don't actually want to get any html back (just a string),
|
|
87
|
-
// we wrap the string in <tmp>string</tmp> and then remove
|
|
88
|
-
// the tags here.
|
|
89
|
-
return html.replace(/<(\/){0,1}tmp>/g, '');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Convert from device-independent px to device px.
|
|
94
|
-
var get_device_px = function(px) {
|
|
95
|
-
return (Application.client.ios || navigator.userAgent.match(/Intel Mac/i)) ? px : (window.outerWidth / 320) * px;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
var get_viewport_dims = function(){
|
|
99
|
-
var dim = {
|
|
100
|
-
'width': (window.innerWidth || document.documentElement.clientWidth || document.body.offsetWidth),
|
|
101
|
-
'height': (window.innerHeight || document.documentElement.clientHeight || document.body.offsetHeight)
|
|
102
|
-
};
|
|
103
|
-
return dim;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// A dumb method to flip Plural => Singular.
|
|
108
|
-
String.prototype.singularize = function() {
|
|
109
|
-
return this.slice(0, -1);
|
|
110
|
-
};
|
|
111
|
-
String.prototype.contains = function(str){
|
|
112
|
-
return (this.indexOf(str) !== -1) ? true : false;
|
|
113
|
-
};
|
|
114
39
|
// zepto/querySelector, understandably, can't deal with periods in the id attr.
|
|
115
40
|
String.prototype.dotToBar = function() {
|
|
116
41
|
return this.replace(/\./g,"_");
|
|
117
42
|
};
|
|
118
|
-
String.prototype.barToDot = function() {
|
|
119
|
-
return this.replace(/_/g, '.');
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// ======================
|
|
123
|
-
// = Element Prototypes =
|
|
124
|
-
// ======================
|
|
125
|
-
|
|
126
|
-
// highlight changes
|
|
127
|
-
Element.prototype.hilite = function() {
|
|
128
|
-
var el = this;
|
|
129
|
-
$(el).addClass('hilite');
|
|
130
|
-
// the 3rd param is the context. does not work in IE but we don't care. cstuart 2010-03-18
|
|
131
|
-
window.setTimeout(function() {
|
|
132
|
-
$(el).removeClass('hilite');
|
|
133
|
-
}, 2200, el);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// =====================
|
|
137
|
-
// = Number Prototypes =
|
|
138
|
-
// =====================
|
|
139
|
-
|
|
140
|
-
Number.prototype.isInt = function() {
|
|
141
|
-
return this % 1 === 0;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// =====================
|
|
145
|
-
// = Utility Functions =
|
|
146
|
-
// =====================
|
|
147
|
-
|
|
148
|
-
// Takes an object and returns the type.
|
|
149
|
-
// var type_of = function(v) {
|
|
150
|
-
// if (typeof(v) == "object") {
|
|
151
|
-
// if (v === null) return "null";
|
|
152
|
-
// if (v.constructor == (new Array).constructor) return "array";
|
|
153
|
-
// if (v.constructor == (new Date).constructor) return "date";
|
|
154
|
-
// if (v.constructor == (new RegExp).constructor) return "regex";
|
|
155
|
-
// if (v.constructor == (new String).constructor) return "string";
|
|
156
|
-
// if (v.constructor == (new Number).constructor) return "number";
|
|
157
|
-
// return "object";
|
|
158
|
-
// }
|
|
159
|
-
// return typeof(v);
|
|
160
|
-
// };
|
|
161
|
-
|
|
162
|
-
$.fixImage = function(elem, src) {
|
|
163
|
-
if (!elem.fixed) {
|
|
164
|
-
elem.src = src;
|
|
165
|
-
} else {
|
|
166
|
-
elem.style.visibility = 'hidden';
|
|
167
|
-
}
|
|
168
|
-
elem.fixed = true;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
|
|
172
43
|
|
|
173
44
|
var macrojungle = function(tmpl) {
|
|
174
45
|
// This is kind of stupid.
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
// Behavior for calendar (schedule) navigation.
|
|
2
|
-
(function($){
|
|
2
|
+
;(function($){
|
|
3
3
|
$.calnav = function(){
|
|
4
|
-
$('calnav item')
|
|
5
|
-
.
|
|
6
|
-
.
|
|
7
|
-
var el = $(e.target)
|
|
8
|
-
if (!el.attr('href')) {
|
|
9
|
-
el = el.closest('item');
|
|
10
|
-
}
|
|
11
|
-
if (!el.attr('href')) return ;
|
|
4
|
+
$('.calnav .item[href]')
|
|
5
|
+
.off('click')
|
|
6
|
+
.on('click', function(e) {
|
|
12
7
|
Application.showView(
|
|
13
|
-
|
|
8
|
+
$.deserialize(this.getAttribute('href'))
|
|
14
9
|
);
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// CFB2 only
|
|
13
|
+
$('#calnav_dropdown').filterable();
|
|
14
|
+
|
|
15
|
+
// CFB2 only
|
|
16
|
+
var weekLabel = $id('week_label');
|
|
17
|
+
if (weekLabel) {
|
|
18
|
+
weekLabel.innerHTML = $id('calnav_dropdown').options[$id('calnav_dropdown').selectedIndex].text;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
18
21
|
})(Zepto);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
;(function($){
|
|
2
|
+
$.fn.collapsible = function() {
|
|
3
|
+
|
|
4
|
+
var storage = Application.storage();
|
|
5
|
+
|
|
6
|
+
return this.each(function() {
|
|
7
|
+
|
|
8
|
+
if (storage && storage.getItem(this.id) === 'collapsed') {
|
|
9
|
+
$(this)
|
|
10
|
+
.data('is_collapsed', true)
|
|
11
|
+
.find('tbody').hide().end()
|
|
12
|
+
.find('.arrow')
|
|
13
|
+
.animate({ rotate: '90deg' }, 200, 'ease-out');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$(this)
|
|
17
|
+
.off('click', 'th')
|
|
18
|
+
.on('click', 'th', function() {
|
|
19
|
+
var $table = $(this).closest('table');
|
|
20
|
+
|
|
21
|
+
if ($table.data('is_collapsed')) {
|
|
22
|
+
if (storage) storage.setItem($table.attr('id'), 'expanded');
|
|
23
|
+
|
|
24
|
+
$table
|
|
25
|
+
.data('is_collapsed', false)
|
|
26
|
+
.find('tbody').show().end()
|
|
27
|
+
.find('.arrow')
|
|
28
|
+
.animate({ rotate: '0' }, 200, 'ease-out');
|
|
29
|
+
} else {
|
|
30
|
+
if (storage) storage.setItem($table.attr('id'), 'collapsed');
|
|
31
|
+
|
|
32
|
+
$table
|
|
33
|
+
.data('is_collapsed', true)
|
|
34
|
+
.find('tbody').hide().end()
|
|
35
|
+
.find('.arrow')
|
|
36
|
+
.animate({ rotate: '90deg' }, 200, 'ease-out');
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
})(Zepto);
|
|
@@ -1,57 +1,129 @@
|
|
|
1
|
-
// This was taken from //webclient.
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* Tap highlight behavior for elements and elements in lists.
|
|
3
|
+
* Copied from //webclient/... Adjusted slightly.
|
|
5
4
|
*/
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
;(function($) {
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Set event type based on browser support of touch events.
|
|
10
|
+
* The desktop browsers, and mobile IE do not support touch events.
|
|
11
11
|
*/
|
|
12
12
|
var touch = ("ontouchstart" in document.body);
|
|
13
13
|
$.touchEvents = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
cancel: (touch) ? "touchend touchcancel touchmove" : "mouseup mousemove mouseout",
|
|
14
|
+
start: (touch) ? "touchstart" : "mousedown",
|
|
15
|
+
move: (touch) ? "touchmove" : "mousemove",
|
|
16
|
+
end: (touch) ? "touchend" : "mouseup mouseout",
|
|
17
|
+
endOnly: (touch) ? "touchend touchcancel" : "mouseup",
|
|
18
|
+
cancel: (touch) ? "touchend touchcancel touchmove" : "mouseup mousemove mouseout",
|
|
20
19
|
getTarget: function(e) {
|
|
21
20
|
return touch ?
|
|
22
21
|
$(e.originalEvent.touches[0].target) :
|
|
23
22
|
$(e.target);
|
|
24
|
-
},
|
|
25
|
-
getCoord: function(e) {
|
|
26
|
-
// e.originalEvent is necessary because you are using jQuery.
|
|
27
|
-
return touch ?
|
|
28
|
-
{x: e.originalEvent.touches[0].pageX, y: e.originalEvent.touches[0].pageY} :
|
|
29
|
-
{x: e.pageX, y: e.pageY};
|
|
30
23
|
}
|
|
24
|
+
// ,
|
|
25
|
+
// getCoord: function(e) {
|
|
26
|
+
// // e.originalEvent is necessary because you are using jQuery.
|
|
27
|
+
// return touch ?
|
|
28
|
+
// {x: e.originalEvent.touches[0].pageX, y: e.originalEvent.touches[0].pageY} :
|
|
29
|
+
// {x: e.pageX, y: e.pageY};
|
|
30
|
+
// }
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* the element has a class token of "disabled", then the press effect will not
|
|
36
|
-
* be applied.
|
|
37
|
-
*
|
|
38
|
-
* DO NOT use pressable() to emulate list selection behavior. It won't work when
|
|
39
|
-
* you then try and embed an actionable control within the list (e.g. a play button
|
|
40
|
-
* for a video, or a favoriting star). Instead, use the List mixin behavior.
|
|
34
|
+
* Highlight a single element
|
|
41
35
|
*
|
|
36
|
+
* Finds elements with .hhl, adds .hl when active.
|
|
42
37
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
.on($.touchEvents.start, function(
|
|
48
|
-
|
|
49
|
-
if (!$this.hasClass("disabled")) {
|
|
50
|
-
$this.addClass(HL_CLASS);
|
|
51
|
-
}
|
|
38
|
+
;(function() {
|
|
39
|
+
var SELECTOR = '.hhl';
|
|
40
|
+
var CSS_CLASS = 'hl';
|
|
41
|
+
$(document.body)
|
|
42
|
+
.on($.touchEvents.start, SELECTOR, function() {
|
|
43
|
+
$(this).closest(SELECTOR).addClass(CSS_CLASS);
|
|
52
44
|
})
|
|
53
|
-
.on($.touchEvents.cancel, function(
|
|
54
|
-
$(this).removeClass(
|
|
45
|
+
.on($.touchEvents.cancel, SELECTOR, function() {
|
|
46
|
+
$(this).closest(SELECTOR).removeClass(CSS_CLASS);
|
|
55
47
|
});
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Highlight elements in a list.
|
|
52
|
+
*/
|
|
53
|
+
$.fn.list_hl = function(selector, func) {
|
|
54
|
+
var $this = this,
|
|
55
|
+
HL = "hl",
|
|
56
|
+
$el = null,
|
|
57
|
+
timer = null;
|
|
58
|
+
|
|
59
|
+
var endEvent = window.location.search.indexOf('client=ios') !== -1 ? $.touchEvents.endOnly : 'click';
|
|
60
|
+
|
|
61
|
+
$(selector).removeClass(HL);
|
|
62
|
+
|
|
63
|
+
$this
|
|
64
|
+
.off($.touchEvents.start, selector)
|
|
65
|
+
.off($.touchEvents.move, selector)
|
|
66
|
+
.off($.touchEvents.endOnly, selector)
|
|
67
|
+
.on($.touchEvents.start, selector, start)
|
|
68
|
+
.on($.touchEvents.move, selector, clear)
|
|
69
|
+
.on(endEvent, selector, end)
|
|
70
|
+
|
|
71
|
+
function hl() {
|
|
72
|
+
$el.addClass(HL);
|
|
73
|
+
}
|
|
74
|
+
function start(e) {
|
|
75
|
+
// Do not proceed if another element is
|
|
76
|
+
// set. Wait until clear() runs.
|
|
77
|
+
if ($el) return;
|
|
78
|
+
|
|
79
|
+
$el = $.touchEvents.getTarget(e).closest(selector);
|
|
80
|
+
|
|
81
|
+
if (Application.client.ios) {
|
|
82
|
+
timer = setTimeout(hl, 90);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function clear() {
|
|
86
|
+
if (!$el) return;
|
|
87
|
+
|
|
88
|
+
$el.removeClass(HL);
|
|
89
|
+
$el = null;
|
|
90
|
+
if (timer) {
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
timer = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// iOS: runs on `touchend` and `touchcancel`
|
|
96
|
+
// Android: runs on `click`
|
|
97
|
+
//
|
|
98
|
+
// If you use "touchend" as the last event for Android
|
|
99
|
+
// it will fire a click event even if you run e.preventDefault()
|
|
100
|
+
// This click event will then likely fire on the next view, and
|
|
101
|
+
// it will inadvertanly navigate or click a tab, etc.
|
|
102
|
+
// By using "click", there are no more events to run, so it
|
|
103
|
+
// can't fuck up.
|
|
104
|
+
// Note this issue is more common, or maybe only present, on
|
|
105
|
+
// Android OS v2.x.
|
|
106
|
+
// And on iOS, if you try to use the click event as the last event
|
|
107
|
+
// nothing happens, and it works and is faster to use touchend.
|
|
108
|
+
function end(e) {
|
|
109
|
+
if (!$el) return;
|
|
110
|
+
|
|
111
|
+
hl();
|
|
112
|
+
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
|
|
115
|
+
if (Application.client.ios) {
|
|
116
|
+
func(e, $el);
|
|
117
|
+
setTimeout(clear, 400);
|
|
118
|
+
}
|
|
119
|
+
if (Application.client.android) {
|
|
120
|
+
setTimeout(function() {
|
|
121
|
+
func(e, $el);
|
|
122
|
+
clear();
|
|
123
|
+
}, 200);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
56
126
|
};
|
|
57
127
|
}(Zepto));
|
|
128
|
+
|
|
129
|
+
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
}
|
|
24
24
|
function handlers(el) {
|
|
25
25
|
el
|
|
26
|
-
.
|
|
27
|
-
.
|
|
26
|
+
.off("click")
|
|
27
|
+
.on("click", function() {
|
|
28
28
|
var new_size = size + parseInt($(this).data('dir'), 10);
|
|
29
29
|
if (new_size <= MAX && new_size >= MIN) {
|
|
30
30
|
size = set(new_size, true);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// ### Allows a view to retrieve a new view via a `<select>`.
|
|
2
|
+
(function($) {
|
|
3
|
+
|
|
4
|
+
$.extend($.fn, {
|
|
5
|
+
filterable: function() {
|
|
6
|
+
return this.each(function() {
|
|
7
|
+
var $app_wrapper = $('#app_wrapper');
|
|
8
|
+
|
|
9
|
+
$(this)
|
|
10
|
+
.off('click')
|
|
11
|
+
.on('click', function() {
|
|
12
|
+
$app_wrapper.mask({ 'freeze': true });
|
|
13
|
+
})
|
|
14
|
+
.off('change')
|
|
15
|
+
.on('change', function(e) {
|
|
16
|
+
$app_wrapper.mask({ 'unmask': true });
|
|
17
|
+
Application.showView( $.deserialize(e.target.value.substring(1)) );
|
|
18
|
+
})
|
|
19
|
+
.off('blur')
|
|
20
|
+
.on('blur', function() {
|
|
21
|
+
$app_wrapper.mask({ 'unmask': true });
|
|
22
|
+
});
|
|
23
|
+
$.preload(['@2x/filterlist_press@2x.png']);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
})(Zepto);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// // ### Allows a view to retrieve a new view via a `<select>`.
|
|
32
|
+
// (function($){
|
|
33
|
+
// $.fn.filterable = function() {
|
|
34
|
+
// this
|
|
35
|
+
// .off('change')
|
|
36
|
+
// .on('change', function(e) {
|
|
37
|
+
// // Prevents history from being created
|
|
38
|
+
// Application.showView( $.deserialize(e.target.value.substring(1)) );
|
|
39
|
+
// });
|
|
40
|
+
// };
|
|
41
|
+
// })(Zepto);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
;(function($){
|
|
2
|
+
|
|
3
|
+
$.extend($.fn, {
|
|
4
|
+
mask: function(opts) {
|
|
5
|
+
|
|
6
|
+
var params = $.extend({ 'unmask': false, 'freeze': false }, opts);
|
|
7
|
+
|
|
8
|
+
return this.each(function() {
|
|
9
|
+
// This won't work in some versions of Android.
|
|
10
|
+
// http://code.google.com/p/android/issues/detail?id=5491
|
|
11
|
+
// http://code.google.com/p/android/issues/detail?id=4549
|
|
12
|
+
|
|
13
|
+
var freeze = function(e){ e.preventDefault(); };
|
|
14
|
+
|
|
15
|
+
if (params.unmask) {
|
|
16
|
+
if (params.freeze) {
|
|
17
|
+
$(this).find('.mask').off('touchmove', freeze);
|
|
18
|
+
}
|
|
19
|
+
$(this).find('.mask').remove();
|
|
20
|
+
|
|
21
|
+
} else {
|
|
22
|
+
if ($(this).find('.mask').size() === 0) {
|
|
23
|
+
$(this).append('<div class=mask></div>');
|
|
24
|
+
|
|
25
|
+
if (params.freeze) {
|
|
26
|
+
$(this).find('.mask').on('touchmove', freeze);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
})(Zepto);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
;(function($){
|
|
2
|
+
$.preload = function(imgs) {
|
|
3
|
+
$.assert($.isArray(imgs), '$.preload only accepts an array.');
|
|
4
|
+
|
|
5
|
+
imgs.forEach(function(src) {
|
|
6
|
+
if (src.indexOf('http://') === -1) {
|
|
7
|
+
src = Application.params.imageHost + src;
|
|
8
|
+
}
|
|
9
|
+
var image = new Image();
|
|
10
|
+
image.src = src;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
})(Zepto);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Behavior for tabs.
|
|
2
|
+
;(function($){
|
|
3
|
+
$.fn.tabs = function(custom_opts) {
|
|
4
|
+
|
|
5
|
+
return this.each(function() {
|
|
6
|
+
console.log('++++ initializing tabs');
|
|
7
|
+
|
|
8
|
+
var $tabs = $(this);
|
|
9
|
+
var view = Application.currentView;
|
|
10
|
+
|
|
11
|
+
var defaults = {
|
|
12
|
+
'tab_selector': '.tab',
|
|
13
|
+
'tab_content_selector': '.tab_content',
|
|
14
|
+
'activeTab': '0'
|
|
15
|
+
};
|
|
16
|
+
var opts = $.extend(defaults, custom_opts);
|
|
17
|
+
|
|
18
|
+
var activeTab = opts.activeTab;
|
|
19
|
+
var activeTabFromParams = view.params.activeTab;
|
|
20
|
+
activeTab = activeTabFromParams || activeTab;
|
|
21
|
+
|
|
22
|
+
var reset = function() {
|
|
23
|
+
$tabs.find(opts.tab_content_selector).hide();
|
|
24
|
+
$tabs.find(opts.tab_selector).removeClass('activeTab');
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var set = function(thing) {
|
|
28
|
+
var $tab, $content;
|
|
29
|
+
|
|
30
|
+
if (typeof thing == "string") {
|
|
31
|
+
$tab = $tabs.find(opts.tab_selector).eq(thing);
|
|
32
|
+
} else {
|
|
33
|
+
$tab = $(thing);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
view.params.activeTab = $tab.get(0);
|
|
37
|
+
|
|
38
|
+
$content = $($tab.data('for'));
|
|
39
|
+
|
|
40
|
+
$tab.addClass('activeTab');
|
|
41
|
+
$content.show();
|
|
42
|
+
|
|
43
|
+
$(document.body).trigger('tabChange', [$tab]);
|
|
44
|
+
|
|
45
|
+
if (!view.params.pageYOffset) {
|
|
46
|
+
window.scrollTo(0,0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// The user clicks a tab
|
|
50
|
+
if (view.params.hasSentMetrics) {
|
|
51
|
+
Client.notify({
|
|
52
|
+
'refreshAd': true,
|
|
53
|
+
'metric': $tab.data('metric')
|
|
54
|
+
});
|
|
55
|
+
// The view is loading and the default
|
|
56
|
+
// tab is being set
|
|
57
|
+
} else {
|
|
58
|
+
// Do not refresh the ad when a
|
|
59
|
+
// Game(s)View auto-updates.
|
|
60
|
+
if (!view.params.isAutoUpdating) {
|
|
61
|
+
Client.notify({
|
|
62
|
+
'refreshAd': true
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
view.setMetric( $tab.data('metric') );
|
|
66
|
+
} else {
|
|
67
|
+
view.setMetric( $tab.data('metric') + '/AutoUpdate');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
reset();
|
|
74
|
+
set(activeTab);
|
|
75
|
+
|
|
76
|
+
$tabs
|
|
77
|
+
.find(opts.tab_selector)
|
|
78
|
+
.off('click')
|
|
79
|
+
.on('click', function() {
|
|
80
|
+
if ($(this).hasClass('activeTab')) return;
|
|
81
|
+
|
|
82
|
+
reset();
|
|
83
|
+
set(this);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
})(Zepto);
|
|
89
|
+
|
|
90
|
+
//
|
|
91
|
+
// // Behavior for tabs.
|
|
92
|
+
// (function($){
|
|
93
|
+
// function handlers() {
|
|
94
|
+
// $('tab').bind('click', function(e) {
|
|
95
|
+
// reset();
|
|
96
|
+
// set( $(e.target), true );
|
|
97
|
+
// });
|
|
98
|
+
// }
|
|
99
|
+
// function reset() {
|
|
100
|
+
// $('tab_content').hide();
|
|
101
|
+
// $('tab').removeClass('active');
|
|
102
|
+
// }
|
|
103
|
+
// function set(tab, should_send_metric) {
|
|
104
|
+
// $(tab.attr('for')).show();
|
|
105
|
+
// tab.addClass('active');
|
|
106
|
+
// Application.currentView.params.activeTab = tab.attr('for').substring(1);
|
|
107
|
+
// if (should_send_metric) {
|
|
108
|
+
// send_metrics(tab.attr('metric'));
|
|
109
|
+
// }
|
|
110
|
+
// }
|
|
111
|
+
// function send_metrics(metric) {
|
|
112
|
+
// Client.notify({
|
|
113
|
+
// "metric": metric,
|
|
114
|
+
// "title": Application.currentView.getTitle()
|
|
115
|
+
// });
|
|
116
|
+
// }
|
|
117
|
+
// $.tabs = function(idx){
|
|
118
|
+
// // Exit if we don't have reqd html
|
|
119
|
+
// if (($('tabs').size() < 1)) return;
|
|
120
|
+
//
|
|
121
|
+
// var active_tab = Application.currentView.params.activeTab || idx;
|
|
122
|
+
//
|
|
123
|
+
// var el;
|
|
124
|
+
//
|
|
125
|
+
// reset();
|
|
126
|
+
// handlers();
|
|
127
|
+
//
|
|
128
|
+
// if (active_tab) {
|
|
129
|
+
// // Allows you to set the active tab via the url using an integer, ex:
|
|
130
|
+
// //
|
|
131
|
+
// // #view=foo&activeTab=1
|
|
132
|
+
// if (active_tab.length === 1) {
|
|
133
|
+
// el = $( $('tab').get(parseInt(active_tab)) );
|
|
134
|
+
// } else {
|
|
135
|
+
// // Allows you to set the active tab via the url using a string, ex:
|
|
136
|
+
// //
|
|
137
|
+
// // #view=foo&activeTab=tab_content_news
|
|
138
|
+
// el = $('tab[for=\"#'+active_tab+'\"]');
|
|
139
|
+
// }
|
|
140
|
+
// }
|
|
141
|
+
// if (!el || el.size() === 0) {
|
|
142
|
+
// el = $('tab').first();
|
|
143
|
+
// }
|
|
144
|
+
//
|
|
145
|
+
// // Set the metric to the active tab
|
|
146
|
+
// Application.currentView.params.metric = el.attr('metric');
|
|
147
|
+
//
|
|
148
|
+
// // Don't send a metric on initialization, because the view has already sent one.
|
|
149
|
+
// set( el, false );
|
|
150
|
+
// }
|
|
151
|
+
// })(Zepto);
|
data/lib/sports_db/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sports_db
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-06-
|
|
12
|
+
date: 2013-06-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -77,14 +77,17 @@ files:
|
|
|
77
77
|
- app/assets/javascripts/libs/zepto-v1.0rc1/zepto.js
|
|
78
78
|
- app/assets/javascripts/plugins/assert.js
|
|
79
79
|
- app/assets/javascripts/plugins/calnav.js
|
|
80
|
+
- app/assets/javascripts/plugins/collapsible.js
|
|
80
81
|
- app/assets/javascripts/plugins/detect.js
|
|
81
|
-
- app/assets/javascripts/plugins/filterable.js
|
|
82
82
|
- app/assets/javascripts/plugins/flash.js
|
|
83
83
|
- app/assets/javascripts/plugins/jquery.zumobi-0.2.js
|
|
84
84
|
- app/assets/javascripts/plugins/loading.js
|
|
85
|
-
- app/assets/javascripts/plugins/params.js
|
|
86
85
|
- app/assets/javascripts/plugins/resizeable.js
|
|
86
|
+
- app/assets/javascripts/plugins/zepto.filterable.js
|
|
87
87
|
- app/assets/javascripts/plugins/zepto.freeze.js
|
|
88
|
+
- app/assets/javascripts/plugins/zepto.mask.js
|
|
89
|
+
- app/assets/javascripts/plugins/zepto.preload.js
|
|
90
|
+
- app/assets/javascripts/plugins/zepto.tabs.js
|
|
88
91
|
- app/assets/stylesheets/_base.css.scss
|
|
89
92
|
- app/assets/stylesheets/_filterable.css.scss
|
|
90
93
|
- app/assets/stylesheets/_flash.css.scss
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// ### Allows a view to retrieve a new view via a `<select>`.
|
|
2
|
-
(function($){
|
|
3
|
-
$.fn.filterable = function() {
|
|
4
|
-
this
|
|
5
|
-
.unbind()
|
|
6
|
-
.bind('change', function(e) {
|
|
7
|
-
// Prevents history from being created
|
|
8
|
-
Application.showView( e.target.value.substring(1).toParameters() );
|
|
9
|
-
})
|
|
10
|
-
.pressable();
|
|
11
|
-
};
|
|
12
|
-
})(Zepto);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
;(function($){
|
|
2
|
-
$.strToObj = function(str) {
|
|
3
|
-
var obj = {};
|
|
4
|
-
str.split("&").forEach(
|
|
5
|
-
function(p) {
|
|
6
|
-
var s = p.split("=");
|
|
7
|
-
obj[s[0].replace(/^\?/, '')] = decodeURIComponent(s[1]);
|
|
8
|
-
}
|
|
9
|
-
);
|
|
10
|
-
return obj;
|
|
11
|
-
};
|
|
12
|
-
$.objToQueryStr = function(obj) {
|
|
13
|
-
var arr = [];
|
|
14
|
-
for (var prop in obj) {
|
|
15
|
-
if (typeof obj[prop] !== "function") {
|
|
16
|
-
arr.push( encodeURIComponent(prop) +"="+ encodeURIComponent(obj[prop]) );
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return arr.join("&")+'';
|
|
20
|
-
};
|
|
21
|
-
$.queryStrToObj = function() {
|
|
22
|
-
return $.strToObj( window.location.search.substring(1) );
|
|
23
|
-
};
|
|
24
|
-
$.hashStrToObj = function() {
|
|
25
|
-
return $.strToObj( window.location.hash.substring(1) );
|
|
26
|
-
};
|
|
27
|
-
})(Zepto);
|