simplecov-html 0.10.2 → 0.12.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.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.rubocop.yml +42 -17
  4. data/.tool-versions +1 -0
  5. data/.travis.yml +15 -20
  6. data/CHANGELOG.md +72 -4
  7. data/Gemfile +10 -21
  8. data/Gemfile.lock +59 -0
  9. data/Guardfile +2 -0
  10. data/README.md +3 -3
  11. data/Rakefile +10 -5
  12. data/assets/javascripts/application.js +29 -34
  13. data/assets/javascripts/libraries/jquery-3.4.1.js +10598 -0
  14. data/assets/javascripts/plugins/jquery.colorbox.js +1101 -1086
  15. data/assets/javascripts/plugins/jquery.dataTables.js +15008 -0
  16. data/assets/javascripts/plugins/jquery.timeago.js +135 -44
  17. data/assets/stylesheets/plugins/datatables.css +462 -0
  18. data/assets/stylesheets/screen.css +316 -0
  19. data/lib/simplecov-html/version.rb +3 -1
  20. data/lib/simplecov-html.rb +28 -0
  21. data/public/DataTables-1.10.20/images/sort_asc.png +0 -0
  22. data/public/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  23. data/public/DataTables-1.10.20/images/sort_both.png +0 -0
  24. data/public/DataTables-1.10.20/images/sort_desc.png +0 -0
  25. data/public/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  26. data/public/application.css +1 -799
  27. data/public/application.js +7 -1707
  28. data/simplecov-html.gemspec +5 -4
  29. data/test/helper.rb +2 -0
  30. data/test/test_simple_cov-html.rb +3 -1
  31. data/views/covered_percent.erb +3 -0
  32. data/views/file_list.erb +63 -30
  33. data/views/layout.erb +8 -8
  34. data/views/source_file.erb +40 -9
  35. metadata +33 -40
  36. data/assets/javascripts/libraries/jquery-1.6.2.min.js +0 -18
  37. data/assets/javascripts/plugins/jquery.dataTables.min.js +0 -152
  38. data/assets/javascripts/plugins/jquery.url.js +0 -174
  39. data/assets/stylesheets/screen.css.sass +0 -220
  40. /data/public/{smoothness/images → images}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  41. /data/public/{smoothness/images → images}/ui-bg_flat_75_ffffff_40x100.png +0 -0
  42. /data/public/{smoothness/images → images}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  43. /data/public/{smoothness/images → images}/ui-bg_glass_65_ffffff_1x400.png +0 -0
  44. /data/public/{smoothness/images → images}/ui-bg_glass_75_dadada_1x400.png +0 -0
  45. /data/public/{smoothness/images → images}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  46. /data/public/{smoothness/images → images}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  47. /data/public/{smoothness/images → images}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  48. /data/public/{smoothness/images → images}/ui-icons_222222_256x240.png +0 -0
  49. /data/public/{smoothness/images → images}/ui-icons_2e83ff_256x240.png +0 -0
  50. /data/public/{smoothness/images → images}/ui-icons_454545_256x240.png +0 -0
  51. /data/public/{smoothness/images → images}/ui-icons_888888_256x240.png +0 -0
  52. /data/public/{smoothness/images → images}/ui-icons_cd0a0a_256x240.png +0 -0
@@ -1,35 +1,57 @@
1
- /*
2
- * timeago: a jQuery plugin, version: 0.9 (2010-06-21)
3
- * @requires jQuery v1.2.3 or later
4
- *
1
+ /**
5
2
  * Timeago is a jQuery plugin that makes it easy to support automatically
6
3
  * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
7
4
  *
5
+ * @name timeago
6
+ * @version 1.6.7
7
+ * @requires jQuery >=1.5.0 <4.0
8
+ * @author Ryan McGeary
9
+ * @license MIT License - http://www.opensource.org/licenses/mit-license.php
10
+ *
8
11
  * For usage and examples, visit:
9
12
  * http://timeago.yarp.com/
10
13
  *
11
- * Licensed under the MIT:
12
- * http://www.opensource.org/licenses/mit-license.php
13
- *
14
- * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
14
+ * Copyright (c) 2008-2019, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
15
15
  */
16
- (function($) {
17
- $.timeago = function(timestamp) {
18
- if (timestamp instanceof Date) return inWords(timestamp);
19
- else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
20
- else return inWords($.timeago.datetime(timestamp));
16
+
17
+ (function (factory) {
18
+ if (typeof define === 'function' && define.amd) {
19
+ // AMD. Register as an anonymous module.
20
+ define(['jquery'], factory);
21
+ } else if (typeof module === 'object' && typeof module.exports === 'object') {
22
+ factory(require('jquery'));
23
+ } else {
24
+ // Browser globals
25
+ factory(jQuery);
26
+ }
27
+ }(function ($) {
28
+ $.timeago = function (timestamp) {
29
+ if (timestamp instanceof Date) {
30
+ return inWords(timestamp);
31
+ } else if (typeof timestamp === "string") {
32
+ return inWords($.timeago.parse(timestamp));
33
+ } else if (typeof timestamp === "number") {
34
+ return inWords(new Date(timestamp));
35
+ } else {
36
+ return inWords($.timeago.datetime(timestamp));
37
+ }
21
38
  };
22
39
  var $t = $.timeago;
23
40
 
24
41
  $.extend($.timeago, {
25
42
  settings: {
26
43
  refreshMillis: 60000,
44
+ allowPast: true,
27
45
  allowFuture: false,
46
+ localeTitle: false,
47
+ cutoff: 0,
48
+ autoDispose: true,
28
49
  strings: {
29
50
  prefixAgo: null,
30
51
  prefixFromNow: null,
31
52
  suffixAgo: "ago",
32
53
  suffixFromNow: "from now",
54
+ inPast: "any moment now",
33
55
  seconds: "less than a minute",
34
56
  minute: "about a minute",
35
57
  minutes: "%d minutes",
@@ -41,10 +63,16 @@
41
63
  months: "%d months",
42
64
  year: "about a year",
43
65
  years: "%d years",
66
+ wordSeparator: " ",
44
67
  numbers: []
45
68
  }
46
69
  },
47
- inWords: function(distanceMillis) {
70
+
71
+ inWords: function (distanceMillis) {
72
+ if (!this.settings.allowPast && !this.settings.allowFuture) {
73
+ throw 'timeago allowPast and allowFuture settings can not both be set to false.';
74
+ }
75
+
48
76
  var $l = this.settings.strings;
49
77
  var prefix = $l.prefixAgo;
50
78
  var suffix = $l.suffixAgo;
@@ -53,17 +81,20 @@
53
81
  prefix = $l.prefixFromNow;
54
82
  suffix = $l.suffixFromNow;
55
83
  }
56
- distanceMillis = Math.abs(distanceMillis);
57
84
  }
58
85
 
59
- var seconds = distanceMillis / 1000;
86
+ if (!this.settings.allowPast && distanceMillis >= 0) {
87
+ return this.settings.strings.inPast;
88
+ }
89
+
90
+ var seconds = Math.abs(distanceMillis) / 1000;
60
91
  var minutes = seconds / 60;
61
92
  var hours = minutes / 60;
62
93
  var days = hours / 24;
63
94
  var years = days / 365;
64
95
 
65
96
  function substitute(stringOrFunction, number) {
66
- var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction;
97
+ var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
67
98
  var value = ($l.numbers && $l.numbers[number]) || number;
68
99
  return string.replace(/%d/i, value);
69
100
  }
@@ -73,46 +104,102 @@
73
104
  minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
74
105
  minutes < 90 && substitute($l.hour, 1) ||
75
106
  hours < 24 && substitute($l.hours, Math.round(hours)) ||
76
- hours < 48 && substitute($l.day, 1) ||
77
- days < 30 && substitute($l.days, Math.floor(days)) ||
78
- days < 60 && substitute($l.month, 1) ||
79
- days < 365 && substitute($l.months, Math.floor(days / 30)) ||
80
- years < 2 && substitute($l.year, 1) ||
81
- substitute($l.years, Math.floor(years));
82
-
83
- return $.trim([prefix, words, suffix].join(" "));
107
+ hours < 42 && substitute($l.day, 1) ||
108
+ days < 30 && substitute($l.days, Math.round(days)) ||
109
+ days < 45 && substitute($l.month, 1) ||
110
+ days < 365 && substitute($l.months, Math.round(days / 30)) ||
111
+ years < 1.5 && substitute($l.year, 1) ||
112
+ substitute($l.years, Math.round(years));
113
+
114
+ var separator = $l.wordSeparator || "";
115
+ if ($l.wordSeparator === undefined) { separator = " "; }
116
+ return $.trim([prefix, words, suffix].join(separator));
84
117
  },
85
- parse: function(iso8601) {
118
+
119
+ parse: function (iso8601) {
86
120
  var s = $.trim(iso8601);
87
- s = s.replace(/\.\d\d\d/,""); // remove milliseconds
88
- s = s.replace(/-/,"/").replace(/-/,"/");
89
- s = s.replace(/T/," ").replace(/Z/," UTC");
90
- s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
121
+ s = s.replace(/\.\d+/, ""); // remove milliseconds
122
+ s = s.replace(/-/, "/").replace(/-/, "/");
123
+ s = s.replace(/T/, " ").replace(/Z/, " UTC");
124
+ s = s.replace(/([\+\-]\d\d)\:?(\d\d)/, " $1$2"); // -04:00 -> -0400
125
+ s = s.replace(/([\+\-]\d\d)$/, " $100"); // +09 -> +0900
91
126
  return new Date(s);
92
127
  },
93
- datetime: function(elem) {
94
- // jQuery's `is()` doesn't play well with HTML5 in IE
95
- var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time");
96
- var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title");
128
+ datetime: function (elem) {
129
+ var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
97
130
  return $t.parse(iso8601);
131
+ },
132
+ isTime: function (elem) {
133
+ // jQuery's `is()` doesn't play well with HTML5 in IE
134
+ return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
98
135
  }
99
136
  });
100
137
 
101
- $.fn.timeago = function() {
102
- var self = this;
103
- self.each(refresh);
138
+ // functions that can be called via $(el).timeago('action')
139
+ // init is default when no action is given
140
+ // functions are called with context of a single element
141
+ var functions = {
142
+ init: function () {
143
+ functions.dispose.call(this);
144
+ var refresh_el = $.proxy(refresh, this);
145
+ refresh_el();
146
+ var $s = $t.settings;
147
+ if ($s.refreshMillis > 0) {
148
+ this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
149
+ }
150
+ },
151
+ update: function (timestamp) {
152
+ var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp);
153
+ $(this).data('timeago', { datetime: date });
154
+ if ($t.settings.localeTitle) {
155
+ $(this).attr("title", date.toLocaleString());
156
+ }
157
+ refresh.apply(this);
158
+ },
159
+ updateFromDOM: function () {
160
+ $(this).data('timeago', { datetime: $t.parse($t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title")) });
161
+ refresh.apply(this);
162
+ },
163
+ dispose: function () {
164
+ if (this._timeagoInterval) {
165
+ window.clearInterval(this._timeagoInterval);
166
+ this._timeagoInterval = null;
167
+ }
168
+ }
169
+ };
104
170
 
105
- var $s = $t.settings;
106
- if ($s.refreshMillis > 0) {
107
- setInterval(function() { self.each(refresh); }, $s.refreshMillis);
171
+ $.fn.timeago = function (action, options) {
172
+ var fn = action ? functions[action] : functions.init;
173
+ if (!fn) {
174
+ throw new Error("Unknown function name '" + action + "' for timeago");
108
175
  }
109
- return self;
176
+ // each over objects here and call the requested function
177
+ this.each(function () {
178
+ fn.call(this, options);
179
+ });
180
+ return this;
110
181
  };
111
182
 
112
183
  function refresh() {
184
+ var $s = $t.settings;
185
+
186
+ //check if it's still visible
187
+ if ($s.autoDispose && !$.contains(document.documentElement, this)) {
188
+ //stop if it has been removed
189
+ $(this).timeago("dispose");
190
+ return this;
191
+ }
192
+
113
193
  var data = prepareData(this);
194
+
114
195
  if (!isNaN(data.datetime)) {
115
- $(this).text(inWords(data.datetime));
196
+ if ($s.cutoff === 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
197
+ $(this).text(inWords(data.datetime));
198
+ } else {
199
+ if ($(this).attr('title').length > 0) {
200
+ $(this).text($(this).attr('title'));
201
+ }
202
+ }
116
203
  }
117
204
  return this;
118
205
  }
@@ -122,7 +209,11 @@
122
209
  if (!element.data("timeago")) {
123
210
  element.data("timeago", { datetime: $t.datetime(element) });
124
211
  var text = $.trim(element.text());
125
- if (text.length > 0) element.attr("title", text);
212
+ if ($t.settings.localeTitle) {
213
+ element.attr("title", element.data('timeago').datetime.toLocaleString());
214
+ } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
215
+ element.attr("title", text);
216
+ }
126
217
  }
127
218
  return element.data("timeago");
128
219
  }
@@ -138,4 +229,4 @@
138
229
  // fix for IE6 suckage
139
230
  document.createElement("abbr");
140
231
  document.createElement("time");
141
- })(jQuery);
232
+ }));