Skip to content

Commit

Permalink
Silence logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Nov 19, 2016
1 parent 0b3c586 commit 054f49d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions public/js/live.js
@@ -1,3 +1,6 @@
log=function(){};
// log=console.log;

if (!localStorage.facebook) {
localStorage.facebook = JSON.stringify({
token: "",
Expand Down Expand Up @@ -191,12 +194,12 @@ function poll() {
this.response.forEach(function(r, i) {
var a = facebook.accounts[i];
if (r.code != 200) {
console.log(r);
log(r);
return;
}
var data = JSON.parse(r.body).data;
var live_videos = data.filter(function(v){ return v.live_status }).slice(0, 3);
console.log("facebook", a.username, new Date, live_videos);
log("facebook", a.username, new Date, live_videos);
live_videos.reverse().forEach(function(v) {
var tbody = $(`tbody[data-facebook-id="${a.id}"]`);
var tr_id = `${v.live_status}-${v.id}`;
Expand Down Expand Up @@ -252,7 +255,7 @@ function poll() {
xhr2.responseType = "json";
xhr2.open("GET", `https://www.googleapis.com/youtube/v3/videos?part=snippet,liveStreamingDetails&id=${ids.join(",")}&key=${youtube.key}`);
xhr2.addEventListener("load", function() {
console.log("youtube", a.username, new Date, this.response.items);
log("youtube", a.username, new Date, this.response.items);
var tbody = $(`tbody[data-youtube-id="${a.id}"]`);
this.response.items.reverse().forEach(function(v) {
var live_status, live_text, notification_text;
Expand Down Expand Up @@ -311,7 +314,7 @@ function poll() {
xhr.setRequestHeader("Client-ID", twitch.client_id);
xhr.addEventListener("load", function() {
var live_videos = this.response.videos.slice(0, 3);
console.log("twitch", a.username, new Date, live_videos);
log("twitch", a.username, new Date, live_videos);
var tbody = $(`tbody[data-twitch-id="${a.id}"]`);
live_videos.reverse().forEach(function(v) {
var tr_id = `twitch-${v.status}-${v._id}`;
Expand Down Expand Up @@ -607,7 +610,7 @@ $(document).ready(function() {
$('input[type="search"]').val(args.q);
}

console.log(`Notification permissions: ${Notification.permission}`);
log(`Notification permissions: ${Notification.permission}`);
if (Notification.permission !== "granted") {
Notification.requestPermission();
}
Expand Down

0 comments on commit 054f49d

Please sign in to comment.