Updated what to cache, and updated offline-page

This commit is contained in:
Kasper Rynning-Tønnesen
2016-08-15 16:05:21 +02:00
parent 3f152acc57
commit 85081497aa
16 changed files with 88 additions and 110 deletions

View File

@@ -21,19 +21,12 @@
<meta property="og:description" content="The Shared (free) YouTube radio. Being built around the YouTube search and video API it enables the creation of collaborative and shared live playlists, with billions of videos and songs to choose from, all for free and without registration. Enjoy!"/> <meta property="og:description" content="The Shared (free) YouTube radio. Being built around the YouTube search and video API it enables the creation of collaborative and shared live playlists, with billions of videos and songs to choose from, all for free and without registration. Enjoy!"/>
<meta property="og:type" content="website"/> <meta property="og:type" content="website"/>
<link rel="manifest" href="/manifest.json"> <link rel="manifest" href="/manifest.json">
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css">
<link tyle="text/css" rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link type="text/css" rel="stylesheet" href="/static/css/materialize.min.css" /> <link type="text/css" rel="stylesheet" href="/static/css/materialize.min.css" />
<link rel="stylesheet" type="text/css" href="/static/css/style.css" title="Default" /> <link rel="stylesheet" type="text/css" href="/static/css/style.css" title="Default" />
<link rel="icon" id="favicon" type="image/png" href="/static/images/favicon.png"/> <link rel="icon" id="favicon" type="image/png" href="/static/images/favicon.png"/>
<script type="text/javascript" src="/static/dist/lib/jquery-2.1.3.min.js"></script> <script type="text/javascript" src="/static/dist/lib/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="/static/dist/lib/jquery-ui-1.10.3.min.js"></script> <script type="text/javascript" src="/static/dist/lib/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="/static/dist/lib/materialize.min.js"></script> <script type="text/javascript" src="/static/dist/lib/materialize.min.js"></script>
<script type="text/javascript" src="/static/dist/lib/socket.io-1.4.5.js"></script>
<script type="text/javascript" src="/static/dist/lib/jquery.lazyload.js"></script>
<script type="text/javascript" src="/static/dist/lib/color-thief.js"></script>
<script type="text/javascript" src="/static/dist/lib/sha256.js"></script>
<script type="text/javascript" src="/static/dist/lib/aes.js"></script>
</head> </head>
<body class="noselect cursor-default"> <body class="noselect cursor-default">
<header> <header>
@@ -45,7 +38,6 @@
<a href="//zoff.no" class="brand-logo hide-on-med-and-up">Zöff</a> <a href="//zoff.no" class="brand-logo hide-on-med-and-up">Zöff</a>
<ul id="nav-mobile" class="right hide-on-med-and-down"> <ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a class="modal-trigger waves-effect waves-red" title="Need help with the site?" onclick="$('#help').openModal()">Help</a></li> <li><a class="modal-trigger waves-effect waves-red" title="Need help with the site?" onclick="$('#help').openModal()">Help</a></li>
<li><a class="waves-effect green" title="Remote control a Zöff player" href="https://remote.zoff.no">Remote</a></li>
<li><a class="modal-trigger waves-effect waves-orange" onclick="$('#about').openModal()">About</a></li> <li><a class="modal-trigger waves-effect waves-orange" onclick="$('#about').openModal()">About</a></li>
<li><a class="modal-trigger waves-effect waves-yellow" onclick="$('#legal').openModal()">Legal</a></li> <li><a class="modal-trigger waves-effect waves-yellow" onclick="$('#legal').openModal()">Legal</a></li>
<li><a class="waves-effect waves-purple" href="https://github.com/zoff-music/">GitHub</a></li> <li><a class="waves-effect waves-purple" href="https://github.com/zoff-music/">GitHub</a></li>
@@ -180,12 +172,7 @@
<ul id="footer-buttons"> <ul id="footer-buttons">
<li> <li>
<a class="modal-trigger waves-effect cyan darken-2 btn help-button-footer" title="Need help with the site?" onclick="$('#help').openModal()"> <a class="modal-trigger waves-effect cyan darken-2 btn help-button-footer" title="Need help with the site?" onclick="$('#help').openModal()">
<i class="material-icons left footer-button-icon">info_outline</i>HELP <i class="mdi-action-info left footer-button-icon"></i>HELP
</a>
</li>
<li>
<a class="modal-trigger waves-effect blue-grey darken-2 btn help-button-footer hide-on-small-only" id="embed-button" title="Want to embed this channel?" onclick="$('#embed').openModal()">
<i class="material-icons left footer-button-icon">code</i>EMBED
</a> </a>
</li> </li>
<li> <li>
@@ -219,11 +206,6 @@
<i class="mdi-action-payment left footer-button-icon"></i>Donate <i class="mdi-action-payment left footer-button-icon"></i>Donate
</a> </a>
</form> </form>
<p class="hide-on-small-only">
<a id="qr-code-link" target="_blank" href="//chart.googleapis.com/chart?chs=500x500&amp;cht=qr&amp;chl=https://zoff.no&amp;choe=UTF-8&amp;chld=L%7C1" >
<img id="qr-code-image-link" class="card rounded" src="//chart.googleapis.com/chart?chs=150x150&amp;cht=qr&amp;chl=https://zoff.no&amp;choe=UTF-8&amp;chld=L%7C1" alt="QRCode for link" title="QR code for this page, for easy sharing!" />
</a>
</p>
</li> </li>
</ul> </ul>
</div> </div>

View File

@@ -56,7 +56,7 @@
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Close</a> <a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Close</a>
@@ -77,9 +77,9 @@
</p> </p>
<ul id="footer-buttons"> <ul id="footer-buttons">
<li> <li>
<a class="modal-trigger waves-effect cyan darken-2 btn help-button-footer" title="Need help with the site?" onclick="$('#help').openModal()"> <a class="modal-trigger waves-effect cyan darken-2 btn help-button-footer" title="Need help with the site?" onclick="$('#help').openModal()">
<i class="material-icons left footer-button-icon">info_outline</i>HELP <i class="mdi-action-info left footer-button-icon"></i>HELP
</a> </a>
</li> </li>
<li> <li>
<a class="modal-trigger waves-effect blue-grey darken-2 btn help-button-footer hide-on-small-only" id="embed-button" title="Want to embed this channel?" onclick="$('#embed').openModal()"> <a class="modal-trigger waves-effect blue-grey darken-2 btn help-button-footer hide-on-small-only" id="embed-button" title="Want to embed this channel?" onclick="$('#embed').openModal()">
@@ -135,4 +135,4 @@
&nbsp;&nbsp;All Rights Reserved. &nbsp;&nbsp;All Rights Reserved.
</div> </div>
</div> </div>
</footer> </footer>

View File

@@ -1,17 +1,10 @@
var version = 'v2.7'; var version = 'v2.8';
var CACHE_FILES = [ var CACHE_FILES = [
'https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.no/&choe=UTF-8&chld=L%7C1',
'https://fonts.googleapis.com/icon?family=Material+Icons',
'/static/dist/lib/jquery-2.1.3.min.js', '/static/dist/lib/jquery-2.1.3.min.js',
'/static/dist/lib/jquery-ui-1.10.3.min.js',
'/static/images/favicon.png', '/static/images/favicon.png',
'/static/css/materialize.min.css', '/static/css/materialize.min.css',
'/static/css/style.css', '/static/css/style.css',
'/static/dist/lib/materialize.min.js', '/static/dist/lib/materialize.min.js',
'/static/dist/lib/socket.io-1.4.5.js',
'/static/dist/lib/jquery.lazyload.js',
'/static/dist/lib/color-thief.js',
'/static/dist/main.min.js',
'/static/images/squareicon_small.png', '/static/images/squareicon_small.png',
'/static/images/GitHub_Logo.png', '/static/images/GitHub_Logo.png',
'/static/images/facebook.png', '/static/images/facebook.png',
@@ -19,8 +12,7 @@ var CACHE_FILES = [
'/offline.html', '/offline.html',
'/static/font/roboto/Roboto-Light.woff2', '/static/font/roboto/Roboto-Light.woff2',
'/static/font/roboto/Roboto-Regular.woff2', '/static/font/roboto/Roboto-Regular.woff2',
'/static/font/roboto/Roboto-Thin.woff2', '/static/font/roboto/Roboto-Thin.woff2'
'/static/images/loading.png'
]; ];
self.addEventListener("install", function(event) { self.addEventListener("install", function(event) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -97,4 +97,4 @@ var Chat = {
}, 1000); }, 1000);
} }
} };

View File

@@ -17,8 +17,8 @@ var Crypt = {
Crypt.conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase()); Crypt.conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase());
} }
Hostcontroller.change_enabled(conf_arr.remote); Hostcontroller.change_enabled(conf_arr.remote);
if(conf_arr["width"] != 100) Player.set_width(conf_arr["width"]); if(conf_arr.width != 100) Player.set_width(conf_arr.width);
if(conf_arr["name"] != undefined && conf_arr["name"] != "") Chat.namechange(conf_arr["name"]); if(conf_arr.name !== undefined && conf_arr.name !== "") Chat.namechange(conf_arr.name);
}, },
decrypt: function(cookie, name){ decrypt: function(cookie, name){
@@ -60,8 +60,8 @@ var Crypt = {
padding: CryptoJS.pad.Pkcs7 padding: CryptoJS.pad.Pkcs7
} }
); );
var CookieDate = new Date; var CookieDate = new Date();
CookieDate.setFullYear(CookieDate.getFullYear( ) +1); CookieDate.setFullYear(CookieDate.getFullYear( ) +1);
document.cookie = cookie+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/;"; document.cookie = cookie+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/;";
}, },
@@ -103,7 +103,7 @@ var Crypt = {
} }
); );
var CookieDate = new Date; var CookieDate = new Date();
CookieDate.setFullYear(CookieDate.getFullYear( ) +1); CookieDate.setFullYear(CookieDate.getFullYear( ) +1);
document.cookie = name+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/;"; document.cookie = name+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/;";
@@ -133,7 +133,7 @@ var Crypt = {
}, },
get_pass: function(chan){ get_pass: function(chan){
if(Crypt.conf_pass != undefined) return Crypt.conf_pass.passwords[chan]; if(Crypt.conf_pass !== undefined) return Crypt.conf_pass.passwords[chan];
return undefined; return undefined;
}, },
@@ -159,11 +159,11 @@ var Crypt = {
}, },
get_width: function(){ get_width: function(){
return conf_arr["width"]; return conf_arr.width;
}, },
set_width: function(val){ set_width: function(val){
conf_arr["width"] = val; conf_arr.width = val;
Crypt.encrypt(conf_arr, "_opt"); Crypt.encrypt(conf_arr, "_opt");
}, },
@@ -172,4 +172,4 @@ var Crypt = {
var parts = value.split("; " + name + "="); var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift(); if (parts.length == 2) return parts.pop().split(";").shift();
} }
} };

View File

@@ -22,7 +22,7 @@ var autoplay = false;
var connection_options = { var connection_options = {
'sync disconnect on unload':true, 'sync disconnect on unload':true,
'secure': true, 'secure': true,
'force new connection': true 'force new connection': true
}; };
$(document).ready(function(){ $(document).ready(function(){
@@ -40,7 +40,7 @@ $(document).ready(function(){
socket = io.connect(''+add+':8880', connection_options); socket = io.connect(''+add+':8880', connection_options);
socket.on("get_list", function(){ socket.on("get_list", function(){
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000); setTimeout(function(){socket.emit('list', chan.toLowerCase());},1000);
}); });
socket.on("viewers", function(view) socket.on("viewers", function(view)
@@ -85,4 +85,4 @@ $(document).on( "click", "#zoffbutton", function(e){
$(document).on( "click", ".vote-container", function(e){ $(document).on( "click", ".vote-container", function(e){
var id = $(this).attr("data-video-id"); var id = $(this).attr("data-video-id");
List.vote(id, "pos"); List.vote(id, "pos");
}); });

View File

@@ -7,7 +7,7 @@ var Helper = {
mobilecheck: function() { mobilecheck: function() {
var check = false; var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera);
return check; return check;
}, },
predicate: function() { predicate: function() {
@@ -110,7 +110,7 @@ var Helper = {
sample: function() { sample: function() {
if (Date.now() - lastSample >= SAMPLE_RATE * 2) { if (Date.now() - lastSample >= SAMPLE_RATE * 2) {
socket.removeAllListeners() socket.removeAllListeners();
socket.disconnect(); socket.disconnect();
socket.connect(); socket.connect();
Player.setup_all_listeners(); Player.setup_all_listeners();
@@ -146,8 +146,12 @@ var Helper = {
}, },
rgbToHsl: function(arr, light){ rgbToHsl: function(arr, light){
r = arr[0], g = arr[1], b = arr[2]; r = arr[0];
r /= 255, g /= 255, b /= 255; g = arr[1];
b = arr[2];
r /= 255;
g /= 255;
b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b); var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2; var h, s, l = (max + min) / 2;
@@ -191,8 +195,8 @@ var Helper = {
send_mail: function(from, message){ send_mail: function(from, message){
if(from != "" && message != ""){ if(from !== "" && message !== ""){
$("#submit-contact-form").addClass("hide"); $("#submit-contact-form").addClass("hide");
$("#send-loader").removeClass("hide"); $("#send-loader").removeClass("hide");
@@ -214,16 +218,16 @@ var Helper = {
} }
} }
});*/ });*/
var from = $("#contact-form-from").val(); from = $("#contact-form-from").val();
var message = $("#contact-form-message").val(); message = $("#contact-form-message").val();
$("#contact-container").empty(); $("#contact-container").empty();
newWindow = window.open("mailto:contact@zoff.no?Subject=Contact%20Zoff&Body=" + message, "_blank"); newWindow = window.open("mailto:contact@zoff.no?Subject=Contact%20Zoff&Body=" + message, "_blank");
$("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.no?Subject=Contact%20Zoff&Body=" + message + "'>contact@zoff.no</a>"); $("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.no?Subject=Contact%20Zoff&Body=" + message + "'>contact@zoff.no</a>");
setTimeout(function(){newWindow.close()},500); setTimeout(function(){newWindow.close();},500);
} }
} }
} };
$(document).on('submit', '#contact-form', function(e){ $(document).on('submit', '#contact-form', function(e){
e.preventDefault(); e.preventDefault();
@@ -237,7 +241,7 @@ $(document).on('submit', '#contact-form', function(e){
Element.prototype.remove = function() { Element.prototype.remove = function() {
this.parentElement.removeChild(this); this.parentElement.removeChild(this);
} };
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() { NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
for(var i = 0, len = this.length; i < len; i++) { for(var i = 0, len = this.length; i < len; i++) {
@@ -245,10 +249,10 @@ NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
this[i].parentElement.removeChild(this[i]); this[i].parentElement.removeChild(this[i]);
} }
} }
} };
String.prototype.startsWith = function(searchString, position) { String.prototype.startsWith = function(searchString, position) {
position = position || 0; position = position || 0;
return this.indexOf(searchString, position) === position; return this.indexOf(searchString, position) === position;
} };

View File

@@ -6,7 +6,7 @@ var Hostcontroller = {
host_listener: function(id) { host_listener: function(id) {
if(Hostcontroller.old_id == null) Hostcontroller.old_id = id; if(Hostcontroller.old_id === null) Hostcontroller.old_id = id;
else else
{ {
socket.removeAllListeners(id); socket.removeAllListeners(id);
@@ -14,7 +14,7 @@ var Hostcontroller = {
Hostcontroller.old_id = id; Hostcontroller.old_id = id;
} }
var codeURL = "https://remote."+window.location.hostname+"/"+id; var codeURL = "https://remote."+window.location.hostname+"/"+id;
$("#code-text").text(id) $("#code-text").text(id);
$("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL); $("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL);
$("#code-link").attr("href", codeURL); $("#code-link").attr("href", codeURL);
if(!began) if(!began)
@@ -48,7 +48,7 @@ var Hostcontroller = {
window.history.pushState("object or string", "Title", "/"+chan.toLowerCase()); window.history.pushState("object or string", "Title", "/"+chan.toLowerCase());
}else if(arr[0] == "pause") }else if(arr[0] == "pause")
Player.ytplayer.pauseVideo() Player.ytplayer.pauseVideo();
else if(arr[0] == "play") else if(arr[0] == "play")
Player.ytplayer.playVideo(); Player.ytplayer.playVideo();
else if(arr[0] == "skip") else if(arr[0] == "skip")
@@ -60,4 +60,4 @@ var Hostcontroller = {
enabled = val; enabled = val;
document.getElementsByName("remote_switch")[0].checked = enabled; document.getElementsByName("remote_switch")[0].checked = enabled;
} }
} };

View File

@@ -34,7 +34,7 @@ var List = {
if(!song_info.now_playing){ if(!song_info.now_playing){
var add = List.generateSong(song_info, transition, false, true, false); var add = List.generateSong(song_info, transition, false, true, false);
if(i == 0) { if(i === 0) {
$("#wrapper").prepend(add); $("#wrapper").prepend(add);
} else { } else {
$("#wrapper > div:nth-child(" + (i) + ")").after(add); $("#wrapper > div:nth-child(" + (i) + ")").after(add);
@@ -314,4 +314,4 @@ var List = {
scrollBottom: function(){ scrollBottom: function(){
$("#wrapper").scrollTop($("#wrapper")[0].scrollHeight); $("#wrapper").scrollTop($("#wrapper")[0].scrollHeight);
} }
} };

View File

@@ -2,7 +2,7 @@ var Mobile_remote = {
id: "", id: "",
get_input: function(value) { get_input: function(value) {
if(Mobile_remote.id == "") { if(Mobile_remote.id === "") {
Mobile_remote.set_id(value.toLowerCase()); Mobile_remote.set_id(value.toLowerCase());
} else { } else {
Mobile_remote.set_channel(value.toLowerCase()); Mobile_remote.set_channel(value.toLowerCase());
@@ -56,4 +56,4 @@ var Mobile_remote = {
}); });
} }
} };

View File

@@ -22,7 +22,7 @@ var Player = {
console.log("video_id variable: " + video_id); console.log("video_id variable: " + video_id);
console.log("---------------------------------"); console.log("---------------------------------");
} }
if(obj.length == 0){ if(obj.length === 0){
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!"; document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
$("#player_overlay").height($("#player").height()); $("#player_overlay").height($("#player").height());
@@ -35,19 +35,19 @@ var Player = {
} }
else{ else{
//console.log("gotten new song"); //console.log("gotten new song");
if(previous_video_id == undefined) if(previous_video_id === undefined)
previous_video_id = obj[0][0]["id"]; previous_video_id = obj[0][0].id;
else if(previous_video_id != video_id) else if(previous_video_id != video_id)
previous_video_id = video_id; previous_video_id = video_id;
video_id = obj[0][0]["id"]; video_id = obj[0][0].id;
conf = obj[1][0]; conf = obj[1][0];
time = obj[2]; time = obj[2];
seekTo = time - conf["startTime"]; seekTo = time - conf.startTime;
song_title = obj[0][0]["title"]; song_title = obj[0][0].title;
duration = obj[0][0]["duration"]; duration = obj[0][0].duration;
if(mobile_beginning && Helper.mobilecheck() && seekTo == 0) if(mobile_beginning && Helper.mobilecheck() && seekTo === 0)
seekTo = 1; seekTo = 1;
try{ try{
@@ -56,13 +56,13 @@ var Player = {
} }
Suggestions.fetchYoutubeSuggests(video_id); Suggestions.fetchYoutubeSuggests(video_id);
}catch(e){} }catch(e){}
Player.getTitle(song_title, viewers); Player.getTitle(song_title, viewers);
Player.setBGimage(video_id); Player.setBGimage(video_id);
//if(player_ready && !Helper.mobilecheck()) //if(player_ready && !Helper.mobilecheck())
if(player_ready && !window.MSStream) if(player_ready && !window.MSStream)
{ {
try{ try{
if(Player.ytplayer.getVideoUrl().split('v=')[1] != video_id) if(Player.ytplayer.getVideoUrl().split('v=')[1] != video_id)
{ {
@@ -79,7 +79,7 @@ var Player = {
if(!durationBegun) if(!durationBegun)
Player.durationSetter(); Player.durationSetter();
} }
if(Player.ytplayer.getDuration() > seekTo || Player.ytplayer.getDuration() == 0) if(Player.ytplayer.getDuration() > seekTo || Player.ytplayer.getDuration() === 0)
Player.ytplayer.seekTo(seekTo); Player.ytplayer.seekTo(seekTo);
Player.after_load = video_id; Player.after_load = video_id;
@@ -170,8 +170,8 @@ var Player = {
errorHandler: function(newState) errorHandler: function(newState)
{ {
if(newState.data == 5 || newState.data == 100 if(newState.data == 5 || newState.data == 100 ||
|| newState.data == 101 || newState.data == 150) newState.data == 101 || newState.data == 150)
{ {
/*if(Player.count == 2){ /*if(Player.count == 2){
Player.count = 0;*/ Player.count = 0;*/
@@ -181,10 +181,10 @@ var Player = {
console.log(Player.before_load == Player.ytplayer.getVideoUrl);*/ console.log(Player.before_load == Player.ytplayer.getVideoUrl);*/
curr_playing = Player.ytplayer.getVideoUrl().replace("https://www.youtube.com/watch?v=", ""); curr_playing = Player.ytplayer.getVideoUrl().replace("https://www.youtube.com/watch?v=", "");
socket.emit("skip", {error: newState.data, id: video_id, pass: adminpass, channel: chan.toLowerCase}); socket.emit("skip", {error: newState.data, id: video_id, pass: adminpass, channel: chan.toLowerCase});
//console.log(video_id, Player.ytplayer.getVideoUrl(), Player.ytplayer.getPlayerState()); //console.log(video_id, Player.ytplayer.getVideoUrl(), Player.ytplayer.getPlayerState());
/*}else{ /*}else{
setTimeout(function(){ setTimeout(function(){
Player.ytplayer.loadVideoById(video_id); Player.ytplayer.loadVideoById(video_id);
@@ -298,12 +298,12 @@ var Player = {
/*try{ /*try{
//duration = Player.ytplayer.getDuration(); //duration = Player.ytplayer.getDuration();
}catch(e){};*/ }catch(e){};*/
if(duration != undefined){ if(duration !== undefined){
try{ try{
if(!Player.stopInterval) durationBegun = true; if(!Player.stopInterval) durationBegun = true;
dMinutes = Math.floor(duration / 60); dMinutes = Math.floor(duration / 60);
dSeconds = duration - dMinutes * 60; dSeconds = duration - dMinutes * 60;
currDurr = Player.ytplayer.getCurrentTime() != undefined ? Math.floor(Player.ytplayer.getCurrentTime()) : seekTo; currDurr = Player.ytplayer.getCurrentTime() !== undefined ? Math.floor(Player.ytplayer.getCurrentTime()) : seekTo;
if(currDurr > duration) if(currDurr > duration)
currDurr = duration; currDurr = duration;
minutes = Math.floor(currDurr / 60); minutes = Math.floor(currDurr / 60);
@@ -312,18 +312,18 @@ var Player = {
per = (100 / duration) * currDurr; per = (100 / duration) * currDurr;
if(per >= 100) if(per >= 100)
per = 100; per = 100;
else if(duration == 0) else if(duration === 0)
per = 0; per = 0;
$("#bar").width(per+"%"); $("#bar").width(per+"%");
}catch(e){ }catch(e){
} }
} }
if(!Player.stopInterval) setTimeout(Player.durationSetter, 1000); if(!Player.stopInterval) setTimeout(Player.durationSetter, 1000);
}, },
loadPlayer: function() { loadPlayer: function() {
if($("script[src='https://www.youtube.com/iframe_api']")["length"] == 1){ if($("script[src='https://www.youtube.com/iframe_api']").length == 1){
Player.onYouTubeIframeAPIReady(); Player.onYouTubeIframeAPIReady();
}else{ }else{
tag = document.createElement('script'); tag = document.createElement('script');
@@ -333,4 +333,4 @@ var Player = {
} }
} }
} };

View File

@@ -60,7 +60,7 @@ var Playercontrols = {
$(".video-container").toggleClass("click-through"); $(".video-container").toggleClass("click-through");
$(".page-footer").toggleClass("padding-bottom-extra"); $(".page-footer").toggleClass("padding-bottom-extra");
} }
}else if(Player.ytplayer.getPlayerState() == 2 || Player.ytplayer.getPlayerState() == 0) } else if(Player.ytplayer.getPlayerState() == 2 || Player.ytplayer.getPlayerState() === 0)
{ {
Player.ytplayer.playVideo(); Player.ytplayer.playVideo();
if(Helper.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){ if(Helper.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
@@ -116,7 +116,7 @@ var Playercontrols = {
}, },
choose_button: function(vol, mute) choose_button: function(vol, mute)
{ {
if(!mute){ if(!mute){
if(vol >= 0 && vol <= 33){ if(vol >= 0 && vol <= 33){
if(document.getElementById("v-full").className.split(" ").length == 1) if(document.getElementById("v-full").className.split(" ").length == 1)
@@ -193,4 +193,4 @@ var Playercontrols = {
} }
} };

View File

@@ -3,7 +3,7 @@ var start = true;
mobilecheck = function() { mobilecheck = function() {
var check = false; var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera);
return check; return check;
}; };
$(document).ready(function (){ $(document).ready(function (){
@@ -29,16 +29,16 @@ $(document).ready(function (){
}).responseText; }).responseText;
git_info = $.parseJSON(git_info); git_info = $.parseJSON(git_info);
$("#latest-commit").html("Latest Commit: <br>" $("#latest-commit").html("Latest Commit: <br>" +
+ git_info[0].commit.author.date.substring(0,10) git_info[0].commit.author.date.substring(0,10) +
+ ": " + git_info[0].committer.login ": " + git_info[0].committer.login +
+ "<br><a href='"+git_info[0].html_url+"'>" "<br><a href='"+git_info[0].html_url+"'>" +
+ git_info[0].sha.substring(0,10) + "</a>: " git_info[0].sha.substring(0,10) + "</a>: " +
+ git_info[0].commit.message+"<br"); git_info[0].commit.message+"<br");
/*var _isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; /*var _isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
setTimeout(function(){ setTimeout(function(){
if (_isChrome && !document.getElementById('extension-is-installed') && !mobilecheck()) if (_isChrome && !document.getElementById('extension-is-installed') && !mobilecheck())
Materialize.toast("<a href='#' onclick='installRemote();' style='pointer-events:all;color:white;'>Install the extension!</a>", 100000); Materialize.toast("<a href='#' onclick='installRemote();' style='pointer-events:all;color:white;'>Install the extension!</a>", 100000);
}, 5); }, 5);
window.installRemote = installRemote; window.installRemote = installRemote;
@@ -104,7 +104,7 @@ var Remotecontroller = {
$(".rc").css("display", "block"); $(".rc").css("display", "block");
//document.getElementById("base").setAttribute("onsubmit", "control(); return false;"); //document.getElementById("base").setAttribute("onsubmit", "control(); return false;");
$("#remote-text").text("Controlling "+ id.toUpperCase()) $("#remote-text").text("Controlling "+ id.toUpperCase());
document.getElementById("search").setAttribute("length", "18"); document.getElementById("search").setAttribute("length", "18");
document.getElementById("search").setAttribute("maxlength", "18"); document.getElementById("search").setAttribute("maxlength", "18");
$("#forsearch").html("Type new channel name to change to"); $("#forsearch").html("Type new channel name to change to");
@@ -133,4 +133,4 @@ var Remotecontroller = {
} }
} };

View File

@@ -4,7 +4,7 @@ var Suggestions = {
if(single){ if(single){
Suggestions.createSuggested(params); Suggestions.createSuggested(params);
}else{ }else{
for(x in params){ for(var x in params){
Suggestions.createSuggested(params[x]); Suggestions.createSuggested(params[x]);
} }
} }
@@ -54,7 +54,7 @@ var Suggestions = {
var video_id = song.id; var video_id = song.id;
var video_title = song.snippet.title; var video_title = song.snippet.title;
duration = duration.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s") duration = duration.replace("PT","").replace("H","h ").replace("M","m ").replace("S","s");
$("#suggest-song-html").append(List.generateSong({id: video_id, title: video_title, length: secs, duration: duration}, false, false, false)); $("#suggest-song-html").append(List.generateSong({id: video_id, title: video_title, length: secs, duration: duration}, false, false, false));
}); });
@@ -65,8 +65,8 @@ var Suggestions = {
}, },
checkUserEmpty: function(){ checkUserEmpty: function(){
var length = $("#user-suggest-html").children().length var length = $("#user-suggest-html").children().length;
if(length == 0){ if(length === 0){
if(!Helper.contains($("#user_suggests").attr("class").split(" "), "hide")) if(!Helper.contains($("#user_suggests").attr("class").split(" "), "hide"))
$("#user_suggests").addClass("hide"); $("#user_suggests").addClass("hide");
}else{ }else{
@@ -74,4 +74,4 @@ var Suggestions = {
} }
}, },
} };