sports_db 0.2.3 → 0.2.4

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.
Files changed (32) hide show
  1. data/app/assets/javascripts/core/App.js +256 -0
  2. data/app/assets/javascripts/core/BaseView.js +13 -10
  3. data/app/assets/javascripts/core/History.js +2 -2
  4. data/app/assets/javascripts/core/Mock.js +7 -9
  5. data/app/assets/javascripts/core/Timer.js +3 -1
  6. data/app/assets/javascripts/core/View.js +2 -1
  7. data/app/assets/javascripts/core/utilities.js +8 -6
  8. data/app/assets/javascripts/plugins/articles.js +195 -0
  9. data/app/assets/javascripts/plugins/assert.js +1 -1
  10. data/app/assets/javascripts/plugins/calnav.js +2 -1
  11. data/app/assets/javascripts/plugins/collapsible.js +1 -0
  12. data/app/assets/javascripts/plugins/delayed_load.js +42 -0
  13. data/app/assets/javascripts/plugins/flash.js +1 -1
  14. data/app/assets/javascripts/plugins/jquery.zumobi-0.2.js +2 -3
  15. data/app/assets/javascripts/plugins/loading.js +1 -0
  16. data/app/assets/javascripts/plugins/resizeable.js +1 -0
  17. data/app/assets/javascripts/plugins/zepto.filterable.js +1 -13
  18. data/app/assets/javascripts/plugins/zepto.preload.js +2 -1
  19. data/app/assets/javascripts/plugins/zepto.tabs.js +3 -3
  20. data/app/assets/stylesheets/_articles.css.scss +153 -0
  21. data/app/assets/stylesheets/_base.css.scss +16 -1
  22. data/app/assets/stylesheets/_filterable.css.scss +3 -11
  23. data/app/assets/stylesheets/_gradients.css.scss +26 -0
  24. data/app/assets/stylesheets/_logo.css.scss +12 -0
  25. data/app/assets/stylesheets/_table_base.scss +40 -4
  26. data/app/assets/stylesheets/_table_collapsible.css.scss +24 -0
  27. data/app/assets/stylesheets/_tabs.css.scss +59 -0
  28. data/app/assets/stylesheets/_toolbar.css.scss +38 -0
  29. data/app/models/twitter.rb +5 -4
  30. data/app/views/shared/_articles.html.erb +66 -0
  31. data/lib/sports_db/version.rb +1 -1
  32. metadata +12 -2
@@ -0,0 +1,42 @@
1
+ ;(function() {
2
+
3
+ // Delay loading of images to make sure they load last.
4
+ // Also, enable retina images.
5
+ var delayed_load = function() {
6
+
7
+ $('.delayed_load').not('.processed').each(function() {
8
+
9
+ var src = $(this).data('src');
10
+
11
+ if (window.devicePixelRatio > 1) {
12
+ src = src.replace(/\.png/g, '@2x.png');
13
+ }
14
+
15
+ if (src) {
16
+ $(this)
17
+ .attr('src', src)
18
+ .addClass('processed');
19
+ } else {
20
+ $(this).remove();
21
+ console.log("Removing image: " + this);
22
+ }
23
+
24
+ });
25
+
26
+ };
27
+
28
+ $(document.body)
29
+ .on('Application:viewAppended', delayed_load)
30
+ .on('tabUpdated', delayed_load);
31
+
32
+ $(document.body).on('Logo:Error', function(e) {
33
+ if ($(e.target).data('fxdlogo')) return;
34
+
35
+ // NBA3 should use `Application.params.MISSING_LOGO`
36
+ $(e.target)
37
+ .attr('src', Application.params.imageHost + 'logos/DivisionIAA_25x25@2x.png')
38
+ .data('fxdlogo', true);
39
+
40
+ });
41
+
42
+ })();
@@ -16,6 +16,6 @@
16
16
  };
17
17
 
18
18
  $(document.body).on("hashchange", function() {
19
- $('#flash').hide()
19
+ $('#flash').hide();
20
20
  });
21
21
  })(Zepto);
@@ -1,3 +1,4 @@
1
+ /*global Application */
1
2
  /**
2
3
  * Tap highlight behavior for elements and elements in lists.
3
4
  * Copied from //webclient/... Adjusted slightly.
@@ -66,7 +67,7 @@
66
67
  .off($.touchEvents.endOnly, selector)
67
68
  .on($.touchEvents.start, selector, start)
68
69
  .on($.touchEvents.move, selector, clear)
69
- .on(endEvent, selector, end)
70
+ .on(endEvent, selector, end);
70
71
 
71
72
  function hl() {
72
73
  $el.addClass(HL);
@@ -125,5 +126,3 @@
125
126
  }
126
127
  };
127
128
  }(Zepto));
128
-
129
-
@@ -1,3 +1,4 @@
1
+ /*global Application */
1
2
  ;(function($){
2
3
  var load_timer;
3
4
  var LOADING_TEXT = 'Loading…';
@@ -1,3 +1,4 @@
1
+ /*global Application Client */
1
2
  ;(function($){
2
3
  var MIN = 13;
3
4
  var MAX = 17;
@@ -1,3 +1,4 @@
1
+ /*global Application */
1
2
  // ### Allows a view to retrieve a new view via a `<select>`.
2
3
  (function($) {
3
4
 
@@ -26,16 +27,3 @@
26
27
  });
27
28
 
28
29
  })(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);
@@ -1,3 +1,4 @@
1
+ /*global Application */
1
2
  ;(function($){
2
3
  $.preload = function(imgs) {
3
4
  $.assert($.isArray(imgs), '$.preload only accepts an array.');
@@ -9,5 +10,5 @@
9
10
  var image = new Image();
10
11
  image.src = src;
11
12
  });
12
- }
13
+ };
13
14
  })(Zepto);
@@ -1,10 +1,10 @@
1
+ /*global Application Client */
2
+
1
3
  // Behavior for tabs.
2
4
  ;(function($){
3
5
  $.fn.tabs = function(custom_opts) {
4
6
 
5
7
  return this.each(function() {
6
- console.log('++++ initializing tabs');
7
-
8
8
  var $tabs = $(this);
9
9
  var view = Application.currentView;
10
10
 
@@ -27,7 +27,7 @@
27
27
  var set = function(thing) {
28
28
  var $tab, $content;
29
29
 
30
- if (typeof thing == "string") {
30
+ if (typeof thing === "string") {
31
31
  $tab = $tabs.find(opts.tab_selector).eq(thing);
32
32
  } else {
33
33
  $tab = $(thing);
@@ -0,0 +1,153 @@
1
+ .news {
2
+ background-color: #fff;
3
+
4
+ .is_video_prefix {
5
+ color: $hl_color;
6
+ font-weight: bold;
7
+ }
8
+
9
+ .summaries {
10
+ background-color: $zebra_strip_even;
11
+
12
+ .summary {
13
+ padding: 8px 20px 8px 8px;
14
+
15
+ h3 {
16
+ margin: 0;
17
+ }
18
+ h3.tweet {
19
+ font-weight: normal;
20
+ word-wrap: break-word;
21
+ }
22
+ h3.tweet a {
23
+ color: $hl_color;
24
+ }
25
+
26
+ .thumb {
27
+ width: 55px;
28
+ height: 55px;
29
+ -webkit-background-size: cover;
30
+ background-size: cover;
31
+ background-position: center;
32
+ }
33
+ .thumb_bx {
34
+ display: block;
35
+ margin-right: 10px;
36
+ // bug 23865 Twitter Icons Reveal SN Placeholder Picture.
37
+ // background-image: url(#{$imghost}video_thumb@2x.png);
38
+ @extend .thumb;
39
+ > div {
40
+ @extend .thumb;
41
+ }
42
+ }
43
+ .author_and_date {
44
+ margin: 3px 0 0;
45
+ line-height: 1.1;
46
+ color: $unhl_color;
47
+ }
48
+ }
49
+ .summary:first-child {
50
+ margin-top: 0;
51
+ }
52
+ .summary.hl {
53
+ background-color: #ccc !important;
54
+ }
55
+
56
+ }
57
+ .summaries.has_stripes .summary:nth-of-type(2n) {
58
+ background-color: $zebra_strip_odd;
59
+ border: 1px solid #DDD;
60
+ border-width: 1px 0;
61
+ }
62
+ .articles {
63
+ .article {
64
+ border: 4px solid $tab_content_bg;
65
+ }
66
+ .resizeable_text {
67
+ padding: 8px;
68
+ }
69
+ .poster {
70
+ width: 286px;
71
+ height: 180px;
72
+ -webkit-background-size: cover;
73
+ background-size: cover;
74
+ background-position: center;
75
+ }
76
+ .poster_bx {
77
+ display: block;
78
+ margin-bottom: 10px;
79
+ background-image: url(#{$imghost}video_thumb@2x.png);
80
+
81
+ @extend .poster;
82
+ > div {
83
+ @extend .poster;
84
+ }
85
+ img {
86
+ height: 0;
87
+ width: 0;
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ .summary h3,
94
+ .article h3.article_heading {
95
+ font-size: 15px;
96
+ line-height: 1.2;
97
+ font-weight: bold;
98
+ margin: 0 0 1px;
99
+ }
100
+
101
+ .has_articles .summary {
102
+ background-image: url(#{$imghost}disclosureIndicator@2x.png);
103
+ background-position: 98% center;
104
+ -webkit-background-size: 8px 12px;
105
+ background-size: 8px 12px;
106
+ }
107
+
108
+ .article_contents {
109
+ h1,h2,h3,h4,h5,h6 {
110
+ font-weight: bold;
111
+ background-color: transparent;
112
+ text-align: left;
113
+ margin: 10px 0;
114
+ }
115
+ ul {
116
+ list-style-type: disc;
117
+ margin-left: 18px;
118
+ }
119
+ li {
120
+ margin-bottom: 3px;
121
+ }
122
+ a {
123
+ font-weight: bold;
124
+ color: $hl_color;
125
+ &:active {
126
+ text-decoration: underline;
127
+ }
128
+ }
129
+ }
130
+ .article_contents,
131
+ .article_contents p,
132
+ .article_contents ul {
133
+ line-height: 1.3;
134
+ }
135
+ .article {
136
+ p, ul {
137
+ margin: 0 0 13px;
138
+ }
139
+ }
140
+
141
+ // Resizeable text.
142
+ .author_and_date,
143
+ .article_contents,
144
+ .article_contents * {
145
+ font-size: 100%;
146
+ }
147
+ .article h3.article_heading {
148
+ font-size: 110%;
149
+ }
150
+
151
+ .articles .article_wrapper {
152
+ display: none;
153
+ }
@@ -28,7 +28,7 @@ html, body {
28
28
  }
29
29
  body {
30
30
  font-size: $default_font_size;
31
- color: $default_color;
31
+ font-family: $default_font;
32
32
  margin: 0 auto;
33
33
  }
34
34
  body.ios {
@@ -48,3 +48,18 @@ table {
48
48
  a {
49
49
  text-decoration: none;
50
50
  }
51
+ // From 960gs
52
+ .clear {
53
+ clear: both;
54
+ display: block;
55
+ overflow: hidden;
56
+ visibility: hidden;
57
+ width: 0;
58
+ height: 0;
59
+ }
60
+ h1,h2,h3,h4,h5,h6,p,div,li,td,th,select {
61
+ color: $default_color;
62
+ }
63
+ tr[href] {
64
+ cursor: pointer;
65
+ }
@@ -3,17 +3,9 @@
3
3
  display: block;
4
4
  width: 310px;
5
5
  height: 48px;
6
- -webkit-background-size: 310px 192px;
7
- font-weight: bold;
8
- border: 0;
9
6
  padding-left: 10px;
10
- color: #666;
11
- margin: 0 auto 5px;
7
+ font-weight: bold;
12
8
  font-size: 18px;
13
-
14
- background-image: url(#{$imghost}dropdown_sprite@2x.png);
15
-
16
- &.hl {
17
- background-position: 0 -48px;
18
- }
9
+ margin: 0 auto 5px;
10
+ line-height: 1.3; // FIXED FB#24805
19
11
  }
@@ -0,0 +1,26 @@
1
+ @mixin linear_gradient($top,$btm,$clr: $default_color) {
2
+ color: $clr;
3
+ background-image: -webkit-gradient(
4
+ linear,
5
+ left top,
6
+ left bottom,
7
+ color-stop(0, $top),
8
+ color-stop(1, $btm)
9
+ );
10
+ }
11
+
12
+ .hl_gradient {
13
+ @include linear_gradient($hl_bg_pri,$hl_bg_alt,$hl_txt_color);
14
+ }
15
+ .neutral_mid_gradient {
16
+ @include linear_gradient($neutral_mid_bg_pri,$neutral_mid_bg_alt);
17
+ }
18
+ .neutral_mid_active_gradient {
19
+ @include linear_gradient($neutral_mid_bg_pri_active,$neutral_mid_bg_alt_active);
20
+ }
21
+ .neutral_hi_gradient {
22
+ @include linear_gradient($neutral_hi_bg_pri,$neutral_hi_bg_alt);
23
+ }
24
+ .neutral_hi_active_gradient {
25
+ @include linear_gradient($neutral_hi_bg_pri_active,$neutral_hi_bg_alt_active);
26
+ }
@@ -0,0 +1,12 @@
1
+ .size_65 {
2
+ width: 65px;
3
+ height: 65px;
4
+ }
5
+ .size_45 {
6
+ width: 45px;
7
+ height: 45px;
8
+ }
9
+ .size_25 {
10
+ width: 25px;
11
+ height: 25px;
12
+ }
@@ -30,7 +30,7 @@
30
30
  background-color: #ccc !important;
31
31
  }
32
32
 
33
- td.has_logo { padding-left: 5px; padding-right: 5px; }
33
+ td.has_logo { text-align: center; }
34
34
  td.has_logo.size_65x65 { width: 65px; }
35
35
  td.has_logo.size_45x45 { width: 45px; }
36
36
  td.has_logo.size_25x25 { width: 25px; }
@@ -44,14 +44,14 @@
44
44
  background-color: $zebra_strip_even;
45
45
  }
46
46
  thead.has_gradient th {
47
- @extend .primary_gradient;
47
+ @extend .hl_gradient;
48
48
  @extend .txt_shadow;
49
49
  color: #fff;
50
50
  }
51
51
  thead.has_dark_bg th {
52
- background-color: $txt_gray;
52
+ background-color: #666;
53
53
  color: #fff;
54
- text-shadow: $h3_bg;
54
+ text-shadow: #777;
55
55
  }
56
56
  tbody {
57
57
  tr.winning_team td { font-weight: bold; }
@@ -66,6 +66,8 @@
66
66
  thead th.upcase {
67
67
  text-transform: uppercase;
68
68
  }
69
+ tbody tr:first-child td { padding-top: 8px; }
70
+ tbody tr:last-child td { padding-bottom: 8px; }
69
71
  tbody td:first-child,
70
72
  thead th:first-child {
71
73
  padding-left: 5px;
@@ -83,6 +85,15 @@
83
85
  line-height: 1;
84
86
  background-color: #f2f2f2;
85
87
  }
88
+ // Add Tap Highlight style
89
+ tr.hl td {
90
+ background-color: #c3daed;
91
+ }
92
+ .stat_cell {
93
+ width: 20px;
94
+ text-align: center;
95
+ }
96
+
86
97
  }
87
98
  .base_table.has_stripes {
88
99
  > tbody > tr:nth-of-type(2n) td {
@@ -92,6 +103,10 @@
92
103
  border: 1px solid #DDD;
93
104
  border-width: 1px 0;
94
105
  }
106
+ // Add Tap Highlight style
107
+ > tbody > tr:nth-of-type(2n).hl > td {
108
+ background-color: #c3daed;
109
+ }
95
110
  }
96
111
  //.clip {
97
112
  // text-overflow: ellipsis;
@@ -119,3 +134,24 @@ body.android .base_table {
119
134
  }
120
135
  }
121
136
  }
137
+
138
+
139
+ .base_table.neutral_color {
140
+ thead th {
141
+ background-color: #EDEDED;
142
+ background-image: none;
143
+ color: $default_color;
144
+ text-shadow: none;
145
+ }
146
+ }
147
+
148
+ .base_table.is_transparent {
149
+ background-color: transparent;
150
+ td { background-color: transparent; }
151
+ }
152
+
153
+ body table.base_table.has_nested_table {
154
+ > tbody > tr > td {
155
+ padding: 0;
156
+ }
157
+ }
@@ -0,0 +1,24 @@
1
+ html body .collapsible_table {
2
+ thead th {
3
+ padding-top: 2px !important;
4
+ padding-bottom: 0 !important;
5
+ padding-right: 5px;
6
+ line-height: 35px;
7
+ font-size: 14px;
8
+
9
+ .arrow {
10
+ display: block;
11
+ font-size: 10px;
12
+ text-indent: -10000px;
13
+ width: 15px;
14
+ height: 7px;
15
+ background-image: url(#{$imghost}collapsiblearrow@2x.png);
16
+ }
17
+ }
18
+ .collapsible {
19
+ float: right;
20
+ margin-top: 12px;
21
+ margin-right: 5px;
22
+ font-size: 10px;
23
+ }
24
+ }
@@ -0,0 +1,59 @@
1
+ .tabs {
2
+ display: -webkit-box;
3
+ -webkit-box-orient: horizontal;
4
+ padding: 5px 0 0 0;
5
+
6
+ .tab {
7
+ @extend .neutral_mid_gradient;
8
+
9
+ display: -webkit-box;
10
+ -webkit-box-pack: center;
11
+ -webkit-box-align: center;
12
+ -webkit-box-flex: 1;
13
+
14
+ padding: 8px;
15
+
16
+ color: #fff;
17
+ border: 1px solid #A09E9E;
18
+ border-bottom: 1px solid #414142;
19
+ text-shadow: $txt_shadow;
20
+
21
+ &:first-child {
22
+ border-left: 0 !important;
23
+ }
24
+ &:last-child {
25
+ border-right: 0 !important;
26
+ }
27
+ // tap state for tab
28
+ &.hl {
29
+ @extend .neutral_mid_active_gradient;
30
+ color: #fff;
31
+ }
32
+ // don't show the tap state for the active tab
33
+ &.activeTab.hl {
34
+ @extend .neutral_hi_gradient;
35
+ color: #fff;
36
+ }
37
+ // the active tab
38
+ &.activeTab {
39
+ @extend .neutral_hi_gradient;
40
+ cursor: default;
41
+ color: $default_color;
42
+ border: 1px solid #A09E9E;
43
+ border-bottom: 1px solid rgb(237,237,237);
44
+ text-shadow: none;
45
+ }
46
+ }
47
+ .spacer {
48
+ width: 3px;
49
+ background-color: transparent;
50
+ display: -webkit-box;
51
+ -webkit-box-flex: 0;
52
+ border-bottom: 1px solid #A09E9E;
53
+ }
54
+ }
55
+ .tab_content {
56
+ overflow-x: hidden;
57
+ padding: 5px;
58
+ background-color: $neutral_hi_bg_alt;
59
+ }
@@ -0,0 +1,38 @@
1
+ .toolbar {
2
+ background-color: lighten($body_background_color, 5%);
3
+ padding: 8px;
4
+ margin: 0 0 10px;
5
+
6
+ .col {
7
+ margin: 0 8px 0;
8
+ &:first-child { margin-left: 0; }
9
+ &:last-child { margin-right: 0; }
10
+ }
11
+ .btn {
12
+ @extend .neutral_mid_gradient;
13
+ color: #fff;
14
+ border-radius: 0;
15
+
16
+ height: 30px;
17
+ line-height: 1.2;
18
+
19
+ &.hl {
20
+ @extend .neutral_mid_active_gradient;
21
+ }
22
+ &.disabled {
23
+ background-image: none;
24
+ background-color: #aaa;
25
+ }
26
+ &.up, &.down {
27
+ min-width: 35px;
28
+ }
29
+ &.up {
30
+ font-size: 110%;
31
+ line-height: 1;
32
+ }
33
+ &.down {
34
+ font-size: 90%;
35
+ line-height: 1.4;
36
+ }
37
+ }
38
+ }
@@ -1,14 +1,15 @@
1
1
  class Twitter < ActiveRecord::Base
2
-
2
+
3
3
  def is_twitter?
4
4
  true
5
5
  end
6
-
7
- def is_video?
6
+
7
+ def is_video?
8
8
  false
9
9
  end
10
-
10
+
11
11
  def is_article?
12
12
  false
13
13
  end
14
+
14
15
  end
@@ -0,0 +1,66 @@
1
+ <div class="news <%= "has_articles" unless is_twitter %>">
2
+ <% if articles.blank? %>
3
+ <p class="blank">
4
+ No articles available.
5
+ </p>
6
+ <% end %>
7
+ <div id="summaries" class="summaries has_stripes">
8
+ <% articles.each_with_index do |item, index| %>
9
+ <% if is_twitter %>
10
+ <div class="summary">
11
+ <% else %>
12
+ <div class="summary summary_link" for="detail_<%= item.digest %>">
13
+ <% end %>
14
+ <div class="row">
15
+ <div class="col">
16
+ <% if item.is_video? %>
17
+ <a target="_blank" class="thumb_bx play br" href="<%= item.high_bandwidth_url %>">
18
+ <div style="background-image: url(<%= item.thumbnail_url %>)"></div>
19
+ </a>
20
+ <% elsif item.is_twitter? && item.thumb_image_url.present? %>
21
+ <div class="thumb_bx twttr_thumb_bx">
22
+ <div style="background-image: url(<%= item.thumb_image_url %>)"></div>
23
+ </div>
24
+ <% elsif item.thumb_image_url.present? %>
25
+ <div class="thumb_bx">
26
+ <div style="background-image: url(<%= item.thumb_image_url %>)"></div>
27
+ </div>
28
+ <% end %>
29
+ </div>
30
+ <div class="col stretch">
31
+ <%= render 'shared/heading', :item => item %>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <% end %>
36
+ </div>
37
+ <% unless is_twitter %>
38
+ <div id="articles" class="articles">
39
+ <% articles.each_with_index do |item, index| %>
40
+ <div
41
+ class="article_wrapper"
42
+ id="detail_<%= item.digest %>"
43
+ <% if articles[(index - 1)].present? %>
44
+ data-prev="detail_<%= articles[(index - 1).to_i].digest %>"
45
+ <% end %>
46
+ <% if articles[(index + 1)].present? %>
47
+ data-next="detail_<%= articles[(index + 1).to_i].digest %>"
48
+ <% end %>
49
+ >
50
+ <div class="article">
51
+ <%= render 'shared/toolbar', :item => item %>
52
+ <div class="resizeable_text">
53
+ <%= render 'shared/heading', :item => item %>
54
+ <%= render 'shared/poster', :item => item %>
55
+ <div class="article_contents">
56
+ <p>
57
+ <%= item.contents.html_safe unless item.contents.blank? %>
58
+ </p>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <% end %>
64
+ </div>
65
+ <% end %>
66
+ </news>
@@ -1,3 +1,3 @@
1
1
  module SportsDb
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end