Trying all on one page, hereby enabling webapps from mobile

This commit is contained in:
Kasper Rynning-Tønnesen
2016-04-12 14:42:41 +02:00
parent 3d0ff98a4f
commit 39e8b8b6d8
8 changed files with 2916 additions and 70 deletions

View File

@@ -4,12 +4,12 @@ var gulp = require('gulp'),
concat = require('gulp-concat');
gulp.task('js', function () {
gulp.src(['static/js/*.js', '!static/js/embed*', '!static/js/nochan*', '!static/js/remotecontroller.js'])
.pipe(uglify({
gulp.src(['static/js/*.js', '!static/js/embed*', '!static/js/remotecontroller.js'])
/*.pipe(uglify({
mangle: true,
compress: true,
enclose: true
}))
}))*/
.pipe(concat('main.min.js'))
.pipe(gulp.dest('static/dist'));
});
@@ -25,6 +25,7 @@ gulp.task('embed', function () {
.pipe(gulp.dest('static/dist'));
});
/*
gulp.task('nochan', function () {
gulp.src(['static/js/nochan.js', 'static/js/helpers.js'])
.pipe(uglify({
@@ -34,7 +35,7 @@ gulp.task('nochan', function () {
}))
.pipe(concat('frontpage.min.js'))
.pipe(gulp.dest('static/dist'));
});
});*/
gulp.task('remotecontroller', function () {
gulp.src(['static/js/remotecontroller.js'])
@@ -50,6 +51,6 @@ gulp.task('remotecontroller', function () {
gulp.task('default', function(){
gulp.watch('static/js/*.js', ['js']);
gulp.watch('static/js/*.js', ['embed']);
gulp.watch('static/js/*.js', ['nochan']);
//gulp.watch('static/js/*.js', ['nochan']);
gulp.watch('static/js/remotecontroller.js', ['remotecontroller']);
});

View File

@@ -10,6 +10,8 @@
<meta name="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 name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
<meta charset="UTF-8"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#2D2D2D" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta property="og:image" content="/static/images/favicon.png" />

View File

@@ -173,7 +173,7 @@ if(isset($_GET['chan'])){
<?php include("php/footer.php"); ?>
<div id="scripts">
<script type="text/javascript" src="static/dist/frontpage.min.js"></script>
<script type="text/javascript" src="static/dist/main.min.js"></script>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

2862
static/dist/main.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -33,7 +33,7 @@ var List = {
populate_list: function(msg)
{
if(list_html == undefined) list_html = $("#list-song-html").html();
full_playlist = msg;
List.sortList();
@@ -49,7 +49,12 @@ var List = {
if(lazy_load){
if(window.mobilecheck()) $(".list-image").lazyload({});
else $(".list-image").lazyload({container: $("#wrapper")}).removeClass("lazy");
else{
$(".list-image").lazyload({container: $("#wrapper")}).removeClass("lazy");
document.getElementById('wrapper').scrollTop += 1;
document.getElementById('wrapper').scrollTop += -1;
}
}
}else{
List.empty = true;

View File

@@ -52,21 +52,22 @@ var connection_options = {
};
$().ready(function(){
if(!window.fromFront) init();
console.log(window.location);
if(!window.fromFront && window.location.pathname != "/") init();
});
function init(){
chan = $("#chan").html();
mobile_beginning = window.mobilecheck();
window.onpopstate = function(e){
onepage_load();
}
share_link_modifier();
share_link_modifier_channel();
chan = $("#chan").html();
if(window.location.hostname == "zoff.no") add = "https://zoff.no";
else add = "localhost";
@@ -162,7 +163,7 @@ function init(){
closeOnClick: false // Closes side-nav on <a> clicks, useful for Angular/Meteor
});
$(".drag-target")[1].remove();
if($(".drag-target").length > 0) $(".drag-target")[1].remove();
if(!Helper.msieversion()) Notification.requestPermission();
@@ -461,7 +462,7 @@ $(document).on("click", "#bottom-button", function(){
List.scrollBottom();
});
function share_link_modifier(){
function share_link_modifier_channel(){
$("#facebook-code-link").attr("href", "https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/" + chan.toLowerCase());
$("#facebook-code-link").attr("onclick", "window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/" + chan.toLowerCase() + "', 'Share Playlist','width=600,height=300'); return false;");
$("#twitter-code-link").attr("href", "http://twitter.com/intent/tweet?url=https://zoff.no/" + chan.toLowerCase() + "&amp;text=Check%20out%20this%20playlist%20" + chan.toLowerCase() + "%20on%20Zöff!&amp;via=zoffmusic")
@@ -509,51 +510,39 @@ function onepage_load(){
document.getElementById("playpause").removeEventListener("click", Playercontrols.play_pause);
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
//setTimeout(function(){
video_id = "";
song_title = "";
video_id = "";
song_title = "";
$("meta[name=theme-color]").attr("content", "#2D2D2D");
$("meta[name=theme-color]").attr("content", "#2D2D2D");
Player.ytplayer.destroy();
Player.ytplayer.destroy();
$(".drag-target").remove();
$("#sidenav-overlay").remove();
$("main").attr("class", "center-align container");
$("body").attr("id", "");
$("body").attr("style", "");
console.log($($(e)));
$("header").html($($(e)[57]).html());
$($(e)[59]).insertAfter("header");
$($(e)[61]).insertAfter(".mega");
$("main").html($($(e)[65]).html());
$(".drag-target").remove();
$("#sidenav-overlay").remove();
$("main").attr("class", "center-align container");
$("body").attr("id", "");
$("body").attr("style", "");
$("header").html($($(e)[53]).html());
$($(e)[55]).insertAfter("header");
$($(e)[57]).insertAfter(".mega");
$("main").html($($(e)[61]).html());
if($("#alreadyfp").length == 1){
window.initfp();
}else {
window.fromChannel = true;
window.initfp();
}
if($("#alreadyfp").length == 1){
window.initfp();
}else {
if(window.location.hostname == "zoff.no") number = 47;
else number = 65;
window.fromChannel = true;
//$("#scripts").append($($(e)[number]).html());
var scriptScript = document.createElement('script');
scriptScript.type = "text/javascript";
scriptScript.src = "/static/dist/frontpage.min.js";
//scriptScript.async = true;
//$.holdReady( true );
scriptScript.onreadystatechange = scriptScript.onload = function() {
window.initfp();
}
document.getElementById("scripts").appendChild(scriptScript);
}
if($("#alreadychannel").length == 0){
$("head").append("<div id='alreadychannel'></div")
}
$("#channel-load").css("display", "none");
//}, 1000);
if($("#alreadychannel").length == 0){
$("head").append("<div id='alreadychannel'></div")
}
$("#channel-load").css("display", "none");
document.title = "Zöff";
window.initfp();
}
});

View File

@@ -239,25 +239,16 @@ var Nochan = {
$(".mobile-search").remove();
$("main").attr("class", "container center-align main");
$("body").attr("id", "channelpage");
$("header").html($($(e)[53]).html());
$("main").html($($(e)[57]).html());
console.log($($(e)));
console.log($($(e)));
$("header").html($($(e)[57]).html());
$("main").html($($(e)[61]).html());
$("#search").attr("placeholder", "Find song on youtube");
if($("#alreadychannel").length == 1){
window.init();
}else{
window.fromFront = true;
//console.log($($(e)[55]).html());
//$("#scripts").append($($(e)[55]).html());
var scriptScript = document.createElement('script');
scriptScript.type = "text/javascript";
scriptScript.src = "/static/dist/main.min.js";
//scriptScript.async = true;
//$.holdReady( true );
scriptScript.onreadystatechange = scriptScript.onload = function() {
window.init();
}
document.getElementById("scripts").appendChild(scriptScript);
window.init();
}
if($("#alreadyfp").length == 0) $("head").append("<div id='alreadyfp'></div>");
}
@@ -271,10 +262,10 @@ String.prototype.capitalizeFirstLetter = function() {
}
$().ready(function(){
if(!window.fromChannel) initfp();
if(!window.fromChannel && window.location.pathname == "/") initfp();
});
function share_link_modifier(){
function share_link_modifier_frontpage(){
$("#facebook-code-link").attr("href", "https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/");
$("#facebook-code-link").attr("onclick", "window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.no/', 'Share Zöff','width=600,height=300'); return false;");
$("#twitter-code-link").attr("href", "http://twitter.com/intent/tweet?url=https://zoff.no/&amp;text=Check%20out%20Zöff!&amp;via=zoffmusic")
@@ -304,7 +295,7 @@ function initfp(){
channel_list = $("#channel-list-container").html();
share_link_modifier();
share_link_modifier_frontpage();
var connection_options = {
'secure': true,