sports_db 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ /*global Application Class ClientBridge */
2
+
1
3
  if (window.location.search.indexOf("client=android") !== -1) {
2
4
  console.log('=> Using AndroidClient.js');
3
5
 
@@ -1,3 +1,4 @@
1
+ /*global Application Class Timer self */
1
2
  if (window.location.search.indexOf("client=ios") !== -1) {
2
3
  console.log('=> Using iOSClient.js');
3
4
 
@@ -1,3 +1,5 @@
1
+ /*global Class Timer Application Client History*/
2
+
1
3
  var Application = Class.extend({
2
4
  initialize: function() {
3
5
 
@@ -21,8 +23,6 @@ var Application = Class.extend({
21
23
 
22
24
  this.params = $.extend(window.CONFIG, this.params);
23
25
 
24
- var client = this.client.ios ? 'ios' : 'android';
25
-
26
26
  this.features.supportsClose = this.getConfigValue('clientSupportsClose', false);
27
27
  this.features.supportsAlert = this.getConfigValue('clientSupportsAlert', false);
28
28
  this.features.supportsNudgeNav = this.getConfigValue('clientSupportsNudgeNav', true);
@@ -184,9 +184,9 @@ var Application = Class.extend({
184
184
  var storage, fail, uid;
185
185
 
186
186
  try {
187
- uid = new Date;
187
+ uid = new Date();
188
188
  (storage = window.localStorage).setItem(uid, uid);
189
- fail = storage.getItem(uid) != uid;
189
+ fail = storage.getItem(uid) !== uid;
190
190
  storage.removeItem(uid);
191
191
  fail && (storage = false);
192
192
  } catch(e) {}
@@ -1,11 +1,11 @@
1
- /*global Class Application Client MOCK_FAVES_CONFIG */
1
+ /*global Class Application Client MOCK_FAVES_CONFIG confirm */
2
2
  //= require core/mock_config.js
3
3
 
4
4
  // Mock client interface
5
5
  window.Mock = Class.extend({
6
6
  initialize: function(client) {
7
7
  this.client = client;
8
- window.addEventListener("load", $.proxy(this._makeToolbar, this), true);
8
+ this._makeToolbar();
9
9
  },
10
10
  _makeToolbar: function(){
11
11
  var toolbar = document.createElement("div");
@@ -54,6 +54,37 @@ Client.notify = function(obj) {
54
54
  Client.callback("favesAndNotifs", MOCK_FAVES_CONFIG);
55
55
  }
56
56
 
57
+ if (obj.action === "setFaves" && Application.params.serverPath === "nfl4") {
58
+ var faves = MOCK_FAVES_CONFIG.faves;
59
+ var teamKey = Application.currentView.params.tsn_key;
60
+
61
+ // Inspect faves, see if teamKey is found.
62
+ if (faves.indexOf(teamKey) !== -1) {
63
+ console.log('Team is already faved. Remove them?');
64
+ var removeFromFaves = confirm("Do you really want to remove this team from my teams>?");
65
+
66
+ if (removeFromFaves) {
67
+ // remove all instances of teamKey from faves.
68
+ // ... should only be one
69
+ while (faves.indexOf(teamKey) !== -1) {
70
+ faves.splice(faves.indexOf(teamKey, 1));
71
+ }
72
+ } else {
73
+ console.log('User did not remove from faves');
74
+ }
75
+ setTimeout(function () {
76
+ Client.callback("favesAndNotifs", MOCK_FAVES_CONFIG);
77
+ }, 250);
78
+ } else {
79
+ console.log('Team is NOT already faved. Add them.');
80
+ faves.push(teamKey);
81
+
82
+ setTimeout(function () {
83
+ Client.callback("favesAndNotifs", MOCK_FAVES_CONFIG);
84
+ }, 250);
85
+ }
86
+ }
87
+
57
88
  // CFB2 only
58
89
  if (obj.action === "alert") {
59
90
  alert(obj.heading + "\n" + obj.text);
@@ -86,11 +117,8 @@ Client.makeTitle = function(title) {
86
117
  };
87
118
 
88
119
  setTimeout(function() {
89
- $('#mock-toolbar').on('click', 'action', function(e) {
90
- var name = $(e.target).attr('name');
91
- var value = $(e.target).attr('value');
92
-
93
- Application.onClientCallback(name, value);
120
+ $(document.body).on('click', '#mock-toolbar action', function() {
121
+ Application.onClientCallback($(this).attr('name'), $(this).attr('value'));
94
122
  });
95
123
  }, 400);
96
124
 
@@ -4,7 +4,13 @@
4
4
  window.Timer = Class.extend({
5
5
  initialize: function(func, period) {
6
6
  this.func = func;
7
- this.period = period;
7
+
8
+ if (!period) {
9
+ console.warn('## Timer: period arg not set. Using 30s for interval');
10
+ this.period = 30000;
11
+ } else {
12
+ this.period = period;
13
+ }
8
14
  this.interval = null;
9
15
  },
10
16
  // startNow: function() {
@@ -1,3 +1,4 @@
1
+ /*global Application Client macrojungle */
1
2
  ;(function($){
2
3
 
3
4
  var getMetricPrefix = function(view) {
@@ -62,7 +63,7 @@
62
63
 
63
64
  $('.share_btn')
64
65
  .off('click')
65
- .on('click', function(e) {
66
+ .on('click', function() {
66
67
  var $this = $(this);
67
68
  var c = {
68
69
  'title': $this.data('title'),
@@ -125,10 +126,10 @@
125
126
  Client.notify({
126
127
  'action': 'alert',
127
128
  'heading': 'An error occurred',
128
- 'text': 'The requested article could not be found.'
129
+ 'text': 'The requested article is no longer available.'
129
130
  });
130
131
  } else {
131
- alert('The requested article could not be found.');
132
+ alert('The requested article is no longer available.');
132
133
  }
133
134
  }
134
135
  // Mark that this notif has been viewed, or even though
@@ -1,3 +1,4 @@
1
+ /*global Application */
1
2
  ;(function() {
2
3
 
3
4
  // Delay loading of images to make sure they load last.
@@ -9,5 +9,5 @@
9
9
  # available as extensions to the MAJOR.MINOR.PATCH format.
10
10
 
11
11
  module SportsDb
12
- VERSION = "0.2.12"
12
+ VERSION = "0.2.13"
13
13
  end
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.12
4
+ version: 0.2.13
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-08-06 00:00:00.000000000 Z
12
+ date: 2013-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails