mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
ITS WORKIIING
This commit is contained in:
2
static/dist/frontpage.min.js
vendored
2
static/dist/frontpage.min.js
vendored
File diff suppressed because one or more lines are too long
4
static/dist/main.min.js
vendored
4
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -53,7 +53,6 @@ socket.on("get_list", function(){
|
||||
});
|
||||
|
||||
socket.on("suggested", function(params){
|
||||
console.log(params);
|
||||
var single = true;
|
||||
if(params.id == undefined)
|
||||
single = false;
|
||||
@@ -72,7 +71,6 @@ $(document).ready(function()
|
||||
localStorage.setItem("list_update", "13.06.15");
|
||||
window.location.reload(true);
|
||||
}
|
||||
console.log(Youtube);
|
||||
Youtube.setup_youtube_listener(chan);
|
||||
Admin.admin_listener();
|
||||
List.channel_listener();
|
||||
@@ -354,7 +352,10 @@ $(document).on('click', '#toast-container', function(){
|
||||
|
||||
$(".brand-logo").click(function(e){
|
||||
e.preventDefault();
|
||||
console.log("Hellooo");
|
||||
|
||||
console.log("move to frontpage")
|
||||
|
||||
window.history.pushState("to the frontpage!", "Title", "/");
|
||||
onepage_load();
|
||||
});
|
||||
|
||||
@@ -432,28 +433,18 @@ function onepage_load(){
|
||||
delete socket;
|
||||
delete window.onYouTubeIframeAPIReady;
|
||||
|
||||
document.title = "Zöff";
|
||||
|
||||
$("main").attr("class", "center-align container");
|
||||
$("body").attr("id", "");
|
||||
$("body").attr("style", "");
|
||||
$("header").html($($(e)[0]).html());
|
||||
$($(e)[2]).insertAfter("header");
|
||||
$($(e)[4]).insertAfter(".mega");
|
||||
$("main").html($($(e)[6]).html());
|
||||
|
||||
removejscssfile("main.min", "js");
|
||||
|
||||
$("#scripts").html($($(e)[8]).html());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removejscssfile(filename, filetype){
|
||||
var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from
|
||||
var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
|
||||
var allsuspects=document.getElementsByTagName(targetelement)
|
||||
for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
|
||||
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
|
||||
allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ var Nochan = {
|
||||
}
|
||||
},
|
||||
|
||||
to_channel: function(chan){
|
||||
to_channel: function(chan, popstate){
|
||||
|
||||
$.ajax({
|
||||
url: chan + "/php/channel.php",
|
||||
@@ -208,7 +208,9 @@ var Nochan = {
|
||||
delete Nochan
|
||||
|
||||
socket.disconnect();
|
||||
window.history.pushState("to the channel!", "Title", "/" + chan);
|
||||
|
||||
if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan);
|
||||
|
||||
$.holdReady(true);
|
||||
$(".mega").remove();
|
||||
$(".mobile-search").remove();
|
||||
@@ -223,6 +225,14 @@ var Nochan = {
|
||||
|
||||
}
|
||||
|
||||
window.onpopstate = function(e){
|
||||
var url_split = window.location.href.split("/");
|
||||
|
||||
if(url_split[3] != "" || url_split[3].substring(0,1) != "#"){
|
||||
Nochan.to_channel(url_split[3], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
String.prototype.capitalizeFirstLetter = function() {
|
||||
@@ -313,7 +323,7 @@ $(document).on('click', '#toast-container', function(){
|
||||
|
||||
$(document).on('click', ".chan-link", function(e){
|
||||
e.preventDefault();
|
||||
Nochan.to_channel($(this).attr("href"));
|
||||
Nochan.to_channel($(this).attr("href"), false);
|
||||
});
|
||||
|
||||
$(".listen-button").click(function(e){
|
||||
|
||||
@@ -6,7 +6,6 @@ var Youtube = {
|
||||
|
||||
setup_youtube_listener: function(channel)
|
||||
{
|
||||
console.log("Setup shit");
|
||||
socket.on("np", function(obj)
|
||||
{
|
||||
Youtube.loaded = false;
|
||||
@@ -224,7 +223,6 @@ var Youtube = {
|
||||
},
|
||||
|
||||
onYouTubeIframeAPIReady: function() {
|
||||
console.log("helloo?");
|
||||
ytplayer = new YT.Player('player', {
|
||||
videoId: "asd",
|
||||
playerVars: { rel:"0", wmode:"transparent", controls: "0" , iv_load_policy: "3", theme:"light", color:"white"},
|
||||
@@ -237,7 +235,9 @@ var Youtube = {
|
||||
},
|
||||
|
||||
loadPlayer: function() {
|
||||
if($(document.getElementsByTagName('script')[0]).attr("src") == "https://www.youtube.com/iframe_api"){
|
||||
console.log($("script[src='https://www.youtube.com/iframe_api']")["length"]);
|
||||
if($("script[src='https://www.youtube.com/iframe_api']")["length"] == 1){
|
||||
console.log("script exists");
|
||||
Youtube.onYouTubeIframeAPIReady();
|
||||
}else{
|
||||
tag = document.createElement('script');
|
||||
|
||||
Reference in New Issue
Block a user