gulp listener on remotecontroller too, and updated remotecontroller.js

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-24 20:07:29 +02:00
parent 28ee75c750
commit 0dabed6f07
8 changed files with 29 additions and 16 deletions

View File

@@ -5,8 +5,8 @@ RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#Comment out the two folling lines when running server locally to fix issues with localhost #Comment out the two folling lines when running server locally to fix issues with localhost
RewriteCond %{HTTPS} !=on #RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] #RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^remote/(.*) php/controller.php?id=$1 [L] RewriteRule ^remote/(.*) php/controller.php?id=$1 [L]

View File

@@ -80,13 +80,13 @@
</form> </form>
<div class="rc" id="remote-controls"> <div class="rc" id="remote-controls">
<a class="remote-button chan-link waves-effect btn green" onclick="play();"> <a id="playbutton" class="remote-button chan-link waves-effect btn green">
<i id="remote_play" class="mdi-av-play-arrow"></i> <i id="remote_play" class="mdi-av-play-arrow"></i>
</a> </a>
<a class="remote-button chan-link waves-effect btn gray" onclick="pause();"> <a id="pausebutton" class="remote-button chan-link waves-effect btn gray">
<i id="remote_pause" class="mdi-av-pause"></i> <i id="remote_pause" class="mdi-av-pause"></i>
</a> </a>
<a class="remote-button chan-link waves-effect btn blue" onclick="skip();"> <a id="skipbutton" class="remote-button chan-link waves-effect btn blue">
<i id="remote_skip" class="mdi-av-skip-next"></i> <i id="remote_skip" class="mdi-av-skip-next"></i>
</a> </a>
</div> </div>
@@ -169,7 +169,6 @@
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="//cdn.socket.io/socket.io-1.2.0.js"></script> <script type="text/javascript" src="//cdn.socket.io/socket.io-1.2.0.js"></script>
<script type="text/javascript" src="/static/js/lib/materialize.js"></script> <script type="text/javascript" src="/static/js/lib/materialize.js"></script>
<script type="text/javascript" src="/static/js/remotecontroller.js"></script> <script type="text/javascript" src="/static/build-js/remotecontroller-min.js"></script>
<noscript><p><img src="//zoff.no/analyse/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
</body> </body>
</html> </html>

View File

@@ -25,7 +25,19 @@ gulp.task('nochan', function () {
.pipe(gulp.dest('../static/build-js')); .pipe(gulp.dest('../static/build-js'));
}); });
gulp.task('remotecontroller', function () {
gulp.src(['../static/js/remotecontroller.js'])
.pipe(uglify({
mangle: true,
compress: true,
enclose: true
}))
.pipe(concat('remotecontroller-min.js'))
.pipe(gulp.dest('../static/build-js'));
});
gulp.task('default', function(){ gulp.task('default', function(){
gulp.watch('../static/js/*.js', ['js']); gulp.watch('../static/js/*.js', ['js']);
gulp.watch('../static/js/nochan.js', ['nochan']); gulp.watch('../static/js/nochan.js', ['nochan']);
gulp.watch('../static/js/remotecontroller.js', ['remotecontroller']);
}); });

View File

@@ -4,7 +4,7 @@ var server;
This if for the localhost running This if for the localhost running
******/ ******/
localhost = false; localhost = true;
//https server //https server
if(localhost) if(localhost)

View File

@@ -0,0 +1 @@
!function(){function e(e){var n="",a=0;e.sort(t),pre_card=$(o);for(x in e){var i=e[x][3];if(20>a){var s=e[x][1],l=e[x][0],r="background-image:url('https://img.youtube.com/vi/"+s+"/hqdefault.jpg');",c=e[x][4],d=pre_card;d.find(".chan-name").text(i),d.find(".chan-name").attr("title",i),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",i),$("#channels").append(d.html())}n+="<option value='"+i+"'> ",a++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=n,$("#channels").fadeIn(800),$("#search").focus()}function t(e,t){var o=e[0],n=t[0],a=e[4],i=t[4];return n>o?1:o>n?-1:i>a?1:a>i?-1:0}var o,n;String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){o=$("#channels").html(),$("#channels").empty();var t=io.connect("//"+window.location.hostname+":3000");t.emit("frontpage_lists"),t.on("playlists",function(t){e(t)});var a=0;document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),n=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,n=$.parseJSON(n),$("#latest-commit").html("Latest Commit: <br>"+n[0].commit.author.date.substring(0,10)+": "+n[0].committer.login+"<br><a href='"+n[0].html_url+"'>"+n[0].sha.substring(0,10)+"</a>: "+n[0].commit.message+"<br")})}();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
!function(){function e(){o?(t||(t=$("#code-input").val().toLowerCase()),$("#code-input").val(""),o=!1,$(".rc").css("display","block"),document.getElementById("base").setAttribute("onsubmit","control(); return false;"),$("#remote-text").text("Controlling "+t),document.getElementById("search").setAttribute("length","18"),document.getElementById("search").setAttribute("maxlength","18"),$("#forsearch").html("Type new channel name to change to"),$("#volume-control").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,o){socket.emit("id",[t,"volume",o.value])}})):(socket.emit("id",[t,"channel",$("#search").val().toLowerCase()]),$("#search").val(""))}var t,o=!0;$(document).ready(function(){setTimeout(function(){$("#search").focus()},500),socket=io.connect("//"+window.location.hostname+":3000"),t=window.location.pathname.split("/")[2],t&&e()}),$("#playbutton").on("click",function(){socket.emit("id",[t,"play","mock"])}),$("#pausebutton").on("click",function(){socket.emit("id",[t,"pause","mock"])}),$("#skipbutton").on("click",function(){socket.emit("id",[t,"skip","mock"])})}();

View File

@@ -1,6 +1,5 @@
var start = true; var start = true;
var id; var id;
//var socket;
$(document).ready(function (){ $(document).ready(function (){
setTimeout(function(){$("#search").focus();},500); setTimeout(function(){$("#search").focus();},500);
@@ -13,20 +12,21 @@ $(document).ready(function (){
} }
}); });
function play() $("#playbutton").on("click", function()
{ {
socket.emit("id", [id, "play", "mock"]); socket.emit("id", [id, "play", "mock"]);
}; });
function pause() $("#pausebutton").on("click", function()
{ {
socket.emit("id", [id, "pause", "mock"]); socket.emit("id", [id, "pause", "mock"]);
}; });
function skip() $("#skipbutton").on("click", function()
{ {
socket.emit("id", [id, "skip", "mock"]); socket.emit("id", [id, "skip", "mock"]);
}; });
/* /*
document.getElementById("volume-control").addEventListener("click", function() document.getElementById("volume-control").addEventListener("click", function()
{ {