Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Valar authored and Valar committed Apr 18, 2017
1 parent 8d8112f commit 52de809
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 45 deletions.
4 changes: 4 additions & 0 deletions css/simple-sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,7 @@ ul.stations a {
#wrapper button.hamburger > span {
background-color: white;
}

.navbar.navbar-inverse {
height: 76px;
}
21 changes: 5 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<!-- Make sure the <html> tag is set to the .full CSS class. Change the background image in the full.css file. -->

<html
lang="en">
<head>

<meta charset="utf-8">
Expand All @@ -10,23 +9,13 @@
<meta name="description" content="">
<meta name="author" content="">

<!-- <title>Live Radio Streams</title> -->

<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="css/simple-sidebar.css" rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

</head>

<body>
Expand Down Expand Up @@ -75,13 +64,13 @@
</div>
<!-- /#wrapper -->

<div class="hide">
<video controls="true" autoplay="true" name="media" id="audio-src"></video>
</div>

<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-bottom" role="navigation">
<div class="container-fluid">
<div class="hide">
<video controls="true" autoplay="true" name="media" id="audio-src"></video>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="navbar-collapse">
<ul class="nav navbar-nav">
Expand Down
51 changes: 22 additions & 29 deletions js/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@ $(document).ready(function() {

var liveRadioListUrl = "https://gist.githubusercontent.com/valarpirai/473305f09f8433f1d338634ed42c437d/raw/live-radio.json";

window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContext(); // Audio context
var audioSource;

var stationList = {};
var selectedStationList = [];
var selectedCity = "";
var previousBg = 1;

var trigger = $('.hamburger'),
overlay = $('.overlay'),
isClosed = false;

// ========================================================================
Expand Down Expand Up @@ -49,36 +44,16 @@ $(document).ready(function() {
function hamburger_cross() {

if (isClosed == true) {
overlay.hide();
trigger.removeClass('is-open');
trigger.addClass('is-closed');
isClosed = false;
} else {
overlay.show();
trigger.removeClass('is-closed');
trigger.addClass('is-open');
isClosed = true;
}
}

// ========================================================================
// Download Station List data
// ========================================================================
$.ajax({
url : liveRadioListUrl
}).done(function(res) {
res = JSON.parse(res);

for(var i in res) {
stationList[res[i].name] = res[i];
}

console.log(stationList);
renderCityList();
renderStationList();
});
// ========================================================================

// ========================================================================
// Background Image change
// ========================================================================
Expand Down Expand Up @@ -141,10 +116,6 @@ $(document).ready(function() {
var obj = list[i];
stations.append('<li><a data-id="' + obj.id + '"><h3>' + obj.name + '</h3></a></li>');
}

setTimeout(function () {
playSelectedStation();
}, 200);
}

// ========================================================================
Expand Down Expand Up @@ -223,4 +194,26 @@ $(document).ready(function() {
}
};

// ========================================================================
// Download Station List data
// ========================================================================
$.ajax({
url : liveRadioListUrl
}).done(function(res) {
res = JSON.parse(res);

for(var i in res) {
stationList[res[i].name] = res[i];
}

console.log(stationList);
renderCityList();
renderStationList();

setTimeout(function () {
playSelectedStation();
}, 200);
});
// ========================================================================

});

0 comments on commit 52de809

Please sign in to comment.