mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-01-01 07:06:17 +00:00
Opening for better integration with fetching and sending title-events
This commit is contained in:
2
server/public/assets/dist/embed.min.js
vendored
2
server/public/assets/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
2
server/public/assets/dist/main.min.js
vendored
2
server/public/assets/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -18,6 +18,11 @@
|
|||||||
<script>
|
<script>
|
||||||
function receiveMessage(event)
|
function receiveMessage(event)
|
||||||
{
|
{
|
||||||
|
if(event.data == "parent") {
|
||||||
|
//console.log(event);
|
||||||
|
window.parentWindow = event.source;
|
||||||
|
window.parentOrigin = event.origin;
|
||||||
|
}
|
||||||
if(event.data == "lower") {
|
if(event.data == "lower") {
|
||||||
window.setVolume(10);
|
window.setVolume(10);
|
||||||
}else if(event.data == "reset") {
|
}else if(event.data == "reset") {
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ var Player = {
|
|||||||
song_title = obj.np[0].title;
|
song_title = obj.np[0].title;
|
||||||
duration = obj.np[0].duration;
|
duration = obj.np[0].duration;
|
||||||
|
|
||||||
|
if(embed) {
|
||||||
|
if(window.parentWindow && window.parentOrigin) {
|
||||||
|
window.parentWindow.postMessage({type: "np", title: obj.np[0].title}, window.parentOrigin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(mobile_beginning && Helper.mobilecheck() && seekTo === 0 && !chromecastAvailable) {
|
if(mobile_beginning && Helper.mobilecheck() && seekTo === 0 && !chromecastAvailable) {
|
||||||
seekTo = 1;
|
seekTo = 1;
|
||||||
}
|
}
|
||||||
@@ -411,7 +417,7 @@ var Player = {
|
|||||||
|
|
||||||
notifyUser: function(id, title) {
|
notifyUser: function(id, title) {
|
||||||
title = title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
|
title = title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
|
||||||
if (Notification.permission === "granted" && document.hidden) {
|
if (Notification.permission === "granted" && document.hidden && !embed) {
|
||||||
var notification = new Notification("Now Playing", {body: title, icon: "https://i.ytimg.com/vi/"+id+"/mqdefault.jpg", iconUrl: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg"});
|
var notification = new Notification("Now Playing", {body: title, icon: "https://i.ytimg.com/vi/"+id+"/mqdefault.jpg", iconUrl: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg"});
|
||||||
notification.onclick = function(x) { window.focus(); this.cancel(); };
|
notification.onclick = function(x) { window.focus(); this.cancel(); };
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user