Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit 74673ba

Browse files
committed
v1.1.0.4 Release
Fixed bug where channels display videos in the incorrect order
1 parent 6b89dc1 commit 74673ba

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelog
33
## v1.1.0.4 (XX-XX-2015)
44
* Decreased update interval from every 10 minutes to every 5 minutes
55
* Fixed channel information not updating properly
6+
* Fixed videos not showing the right video order for notifications and displays
67
## v1.1.0.3 (10-27-2015)
78
* Implemented 'Add to YouTube Notifications" button to videos, channels and subscription lists
89
* Added a first launch screen

js/background.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function checkYoutubeStatus(){
192192
}
193193
},
194194
error: function(XMLHttpRequest, textStatus, error) {
195-
if(XMLHttpRequest.statusText != "OK"){
195+
if(XMLHttpRequest.statusText != "OK" && XMLHttpRequest.status != 404){
196196
wyn.isConnected = false;
197197
chrome.extension.sendMessage({type: "createSnackbar", message: wyn.strings.connect_failed});
198198
console.log(wyn.strings.log_color_prefix + wyn.strings.connect_failed, wyn.strings.log_color_green);
@@ -358,7 +358,7 @@ function checkYoutube(num, refresh, batch) {
358358
wyn.activeCheckings[num] = true;
359359

360360
var channels = JSON.parse(localStorage.getItem("channels"));
361-
var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=1&playlistId=" + channels[num].playlistId + "&key=" + wyn.apiKey;
361+
var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=5&playlistId=" + channels[num].playlistId + "&key=" + wyn.apiKey;
362362

363363
console.log(wyn.strings.notification_log_check + channels[num].name);
364364
$.ajax({
@@ -367,6 +367,14 @@ function checkYoutube(num, refresh, batch) {
367367
wyn.activeCheckings[num] = false;
368368
},
369369
success: function(data) {
370+
data.items.sort(function(a, b){
371+
var a = new Date(a.snippet.publishedAt),
372+
b = new Date(b.snippet.publishedAt);
373+
if(a > b) return -1;
374+
if(a < b) return 1;
375+
return 0;
376+
});
377+
370378
var videoId = data.items[0].snippet.resourceId.videoId,
371379
url = "https://www.googleapis.com/youtube/v3/videos?part=statistics,contentDetails&maxResults=1&id=" + videoId + "&key=" + wyn.apiKey,
372380
prevVideoId = channels[num].latestVideo.id;

js/settings.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ function getChannelVideos(){
453453
* @param {object} data The data recived from function: getChannelVideos
454454
*/
455455
function setChannelVideos(data){
456+
data.sort(function(a, b){
457+
var a = a.timestamp,
458+
b = b.timestamp;
459+
if(a > b) return -1;
460+
if(a < b) return 1;
461+
return 0;
462+
});
463+
456464
for(var i = 0; i < data.length; i++) {
457465
var date = new Date(parseInt(data[i].timestamp)*1000);
458466
date = timeSince(date);

settings.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ <h2 class="mdl-card__title-text">Changelog</h2>
183183
<div class="card-header">v1.1.0.4</div>
184184
<ul>
185185
<li>Decreased update interval from every 10 minutes to every 5 minutes</li>
186+
<li>Fixed channel information not updating properly</li>
187+
<li>Fixed videos not showing the right order</li>
186188
</ul>
187189
</div>
188190
<div class="mdl-card__actions mdl-card--border">

0 commit comments

Comments
 (0)