mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added update to the offline service-worker file
This commit is contained in:
@@ -10,11 +10,12 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="theme-color" content="#2D2D2D" />
|
<meta name="theme-color" content="#2D2D2D" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<meta property="og:image" content="/assets/images/favicon.png" />
|
<meta property="og:image" content="/assets/images/favicon.ico" />
|
||||||
<meta property="og:title" content="Zoff"/>
|
<meta property="og:title" content="Zoff"/>
|
||||||
<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="/assets/manifest.json">
|
<link rel="manifest" href="/assets/manifest.json">
|
||||||
|
<link rel="shortcut icon" href="/assets/images/favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="center-text" style="cursor:default;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;color: #2d2d2d;font-family:Helvetica;width: 60%;text-align: left;margin: auto;position: absolute;left: 0;right: 0;top: 50%;transform: translateY(-50%);">
|
<div id="center-text" style="cursor:default;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;color: #2d2d2d;font-family:Helvetica;width: 60%;text-align: left;margin: auto;position: absolute;left: 0;right: 0;top: 50%;transform: translateY(-50%);">
|
||||||
|
|||||||
@@ -118,6 +118,35 @@ var Helper = {
|
|||||||
} : null;
|
} : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hslToHex: function(h, s, l) {
|
||||||
|
h /= 360;
|
||||||
|
s /= 100;
|
||||||
|
l /= 100;
|
||||||
|
var r, g, b;
|
||||||
|
if (s === 0) {
|
||||||
|
r = g = b = l; // achromatic
|
||||||
|
} else {
|
||||||
|
var hue2rgb = function(p, q, t) {
|
||||||
|
if (t < 0) t += 1;
|
||||||
|
if (t > 1) t -= 1;
|
||||||
|
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
||||||
|
if (t < 1 / 2) return q;
|
||||||
|
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
||||||
|
return p;
|
||||||
|
};
|
||||||
|
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
||||||
|
var p = 2 * l - q;
|
||||||
|
r = hue2rgb(p, q, h + 1 / 3);
|
||||||
|
g = hue2rgb(p, q, h);
|
||||||
|
b = hue2rgb(p, q, h - 1 / 3);
|
||||||
|
}
|
||||||
|
var toHex = function(x) {
|
||||||
|
var hex = Math.round(x * 255).toString(16);
|
||||||
|
return hex.length === 1 ? '0' + hex : hex;
|
||||||
|
};
|
||||||
|
return '#' + toHex(r) + "" + toHex(g) + "" + toHex(b);
|
||||||
|
},
|
||||||
|
|
||||||
hslToRgb: function(h, s, l) {
|
hslToRgb: function(h, s, l) {
|
||||||
var r, g, b;
|
var r, g, b;
|
||||||
|
|
||||||
@@ -419,78 +448,78 @@ var Helper = {
|
|||||||
|
|
||||||
hexToComplimentary: function(hex){
|
hexToComplimentary: function(hex){
|
||||||
|
|
||||||
// Convert hex to rgb
|
// Convert hex to rgb
|
||||||
// Credit to Denis http://stackoverflow.com/a/36253499/4939630
|
// Credit to Denis http://stackoverflow.com/a/36253499/4939630
|
||||||
var rgb = 'rgb(' + (hex = hex.replace('#', '')).match(new RegExp('(.{' + hex.length/3 + '})', 'g')).map(function(l) { return parseInt(hex.length%2 ? l+l : l, 16); }).join(',') + ')';
|
var rgb = 'rgb(' + (hex = hex.replace('#', '')).match(new RegExp('(.{' + hex.length/3 + '})', 'g')).map(function(l) { return parseInt(hex.length%2 ? l+l : l, 16); }).join(',') + ')';
|
||||||
|
|
||||||
// Get array of RGB values
|
// Get array of RGB values
|
||||||
rgb = rgb.replace(/[^\d,]/g, '').split(',');
|
rgb = rgb.replace(/[^\d,]/g, '').split(',');
|
||||||
|
|
||||||
var r = rgb[0], g = rgb[1], b = rgb[2];
|
var r = rgb[0], g = rgb[1], b = rgb[2];
|
||||||
|
|
||||||
// Convert RGB to HSL
|
// Convert RGB to HSL
|
||||||
// Adapted from answer by 0x000f http://stackoverflow.com/a/34946092/4939630
|
// Adapted from answer by 0x000f http://stackoverflow.com/a/34946092/4939630
|
||||||
r /= 255.0;
|
r /= 255.0;
|
||||||
g /= 255.0;
|
g /= 255.0;
|
||||||
b /= 255.0;
|
b /= 255.0;
|
||||||
var max = Math.max(r, g, b);
|
var max = Math.max(r, g, b);
|
||||||
var min = Math.min(r, g, b);
|
var min = Math.min(r, g, b);
|
||||||
var h, s, l = (max + min) / 2.0;
|
var h, s, l = (max + min) / 2.0;
|
||||||
|
|
||||||
if(max == min) {
|
if(max == min) {
|
||||||
h = s = 0; //achromatic
|
h = s = 0; //achromatic
|
||||||
} else {
|
} else {
|
||||||
var d = max - min;
|
var d = max - min;
|
||||||
s = (l > 0.5 ? d / (2.0 - max - min) : d / (max + min));
|
s = (l > 0.5 ? d / (2.0 - max - min) : d / (max + min));
|
||||||
|
|
||||||
if(max == r && g >= b) {
|
if(max == r && g >= b) {
|
||||||
h = 1.0472 * (g - b) / d ;
|
h = 1.0472 * (g - b) / d ;
|
||||||
} else if(max == r && g < b) {
|
} else if(max == r && g < b) {
|
||||||
h = 1.0472 * (g - b) / d + 6.2832;
|
h = 1.0472 * (g - b) / d + 6.2832;
|
||||||
} else if(max == g) {
|
} else if(max == g) {
|
||||||
h = 1.0472 * (b - r) / d + 2.0944;
|
h = 1.0472 * (b - r) / d + 2.0944;
|
||||||
} else if(max == b) {
|
} else if(max == b) {
|
||||||
h = 1.0472 * (r - g) / d + 4.1888;
|
h = 1.0472 * (r - g) / d + 4.1888;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
h = h / 6.2832 * 360.0 + 0;
|
h = h / 6.2832 * 360.0 + 0;
|
||||||
|
|
||||||
// Shift hue to opposite side of wheel and convert to [0-1] value
|
// Shift hue to opposite side of wheel and convert to [0-1] value
|
||||||
h+= 180;
|
h+= 180;
|
||||||
if (h > 360) { h -= 360; }
|
if (h > 360) { h -= 360; }
|
||||||
h /= 360;
|
h /= 360;
|
||||||
|
|
||||||
// Convert h s and l values into r g and b values
|
// Convert h s and l values into r g and b values
|
||||||
// Adapted from answer by Mohsen http://stackoverflow.com/a/9493060/4939630
|
// Adapted from answer by Mohsen http://stackoverflow.com/a/9493060/4939630
|
||||||
if(s === 0){
|
if(s === 0){
|
||||||
r = g = b = l; // achromatic
|
r = g = b = l; // achromatic
|
||||||
} else {
|
} else {
|
||||||
var hue2rgb = function hue2rgb(p, q, t){
|
var hue2rgb = function hue2rgb(p, q, t){
|
||||||
if(t < 0) t += 1;
|
if(t < 0) t += 1;
|
||||||
if(t > 1) t -= 1;
|
if(t > 1) t -= 1;
|
||||||
if(t < 1/6) return p + (q - p) * 6 * t;
|
if(t < 1/6) return p + (q - p) * 6 * t;
|
||||||
if(t < 1/2) return q;
|
if(t < 1/2) return q;
|
||||||
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
||||||
return p;
|
return p;
|
||||||
};
|
};
|
||||||
|
|
||||||
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
||||||
var p = 2 * l - q;
|
var p = 2 * l - q;
|
||||||
|
|
||||||
r = hue2rgb(p, q, h + 1/3);
|
r = hue2rgb(p, q, h + 1/3);
|
||||||
g = hue2rgb(p, q, h);
|
g = hue2rgb(p, q, h);
|
||||||
b = hue2rgb(p, q, h - 1/3);
|
b = hue2rgb(p, q, h - 1/3);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = Math.round(r * 255);
|
r = Math.round(r * 255);
|
||||||
g = Math.round(g * 255);
|
g = Math.round(g * 255);
|
||||||
b = Math.round(b * 255);
|
b = Math.round(b * 255);
|
||||||
|
|
||||||
// Convert r b and g values to hex
|
// Convert r b and g values to hex
|
||||||
rgb = b | (g << 8) | (r << 16);
|
rgb = b | (g << 8) | (r << 16);
|
||||||
return "#" + (0x1000000 | rgb).toString(16).substring(1);
|
return "#" + (0x1000000 | rgb).toString(16).substring(1);
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -512,42 +541,42 @@ String.prototype.startsWith = function(searchString, position) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function similarity(s1, s2) {
|
function similarity(s1, s2) {
|
||||||
var longer = s1;
|
var longer = s1;
|
||||||
var shorter = s2;
|
var shorter = s2;
|
||||||
if (s1.length < s2.length) {
|
if (s1.length < s2.length) {
|
||||||
longer = s2;
|
longer = s2;
|
||||||
shorter = s1;
|
shorter = s1;
|
||||||
}
|
}
|
||||||
var longerLength = longer.length;
|
var longerLength = longer.length;
|
||||||
if (longerLength == 0) {
|
if (longerLength == 0) {
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength);
|
return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
function editDistance(s1, s2) {
|
function editDistance(s1, s2) {
|
||||||
s1 = s1.toLowerCase();
|
s1 = s1.toLowerCase();
|
||||||
s2 = s2.toLowerCase();
|
s2 = s2.toLowerCase();
|
||||||
|
|
||||||
var costs = new Array();
|
var costs = new Array();
|
||||||
for (var i = 0; i <= s1.length; i++) {
|
for (var i = 0; i <= s1.length; i++) {
|
||||||
var lastValue = i;
|
var lastValue = i;
|
||||||
for (var j = 0; j <= s2.length; j++) {
|
for (var j = 0; j <= s2.length; j++) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
costs[j] = j;
|
costs[j] = j;
|
||||||
else {
|
else {
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
var newValue = costs[j - 1];
|
var newValue = costs[j - 1];
|
||||||
if (s1.charAt(i - 1) != s2.charAt(j - 1))
|
if (s1.charAt(i - 1) != s2.charAt(j - 1))
|
||||||
newValue = Math.min(Math.min(newValue, lastValue),
|
newValue = Math.min(Math.min(newValue, lastValue),
|
||||||
costs[j]) + 1;
|
costs[j]) + 1;
|
||||||
costs[j - 1] = lastValue;
|
costs[j - 1] = lastValue;
|
||||||
lastValue = newValue;
|
lastValue = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (i > 0)
|
||||||
|
costs[s2.length] = lastValue;
|
||||||
}
|
}
|
||||||
if (i > 0)
|
return costs[s2.length];
|
||||||
costs[s2.length] = lastValue;
|
|
||||||
}
|
|
||||||
return costs[s2.length];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -630,7 +630,12 @@ var Player = {
|
|||||||
document.getElementById("main-container").style.backgroundColor = Helper.rgbToHsl(color,true);
|
document.getElementById("main-container").style.backgroundColor = Helper.rgbToHsl(color,true);
|
||||||
$("#nav").css("background-color", Helper.rgbToHsl(color, true));
|
$("#nav").css("background-color", Helper.rgbToHsl(color, true));
|
||||||
$(".title-container").css("background-color", Helper.rgbToHsl(color, true));
|
$(".title-container").css("background-color", Helper.rgbToHsl(color, true));
|
||||||
$("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2]));
|
var hexHsl = Helper.rgbToHex(color[0], color[1], color[2]);
|
||||||
|
try {
|
||||||
|
var hsl = Helper.rgbToHsl(color, true).replace("hsl(", "").replace(")", "").replace("%", "").replace(/ /g,'').replace("%", "").split(",");
|
||||||
|
hexHsl = Helper.hslToHex(parseInt(hsl[0]), parseInt(hsl[1]), parseInt(hsl[2]));
|
||||||
|
} catch(e) {}
|
||||||
|
$("meta[name=theme-color]").attr("content", hexHsl);
|
||||||
if(!client) {
|
if(!client) {
|
||||||
var new_color = Helper.rgbToHex(color[0], color[1], color[2]);
|
var new_color = Helper.rgbToHex(color[0], color[1], color[2]);
|
||||||
new_color = Helper.hexToComplimentary(new_color);
|
new_color = Helper.hexToComplimentary(new_color);
|
||||||
|
|||||||
Reference in New Issue
Block a user