Browse files

fixed show radio stations if player is stopped; changed for more coff…

…e-scripted style
  • Loading branch information...
1 parent 868d6de commit 0f18bf126e965eb8a98551b129f5b7fd07cc24a5 @msoap committed Feb 3, 2013
Showing with 8 additions and 8 deletions.
  1. +4 −4 mojolicious-radio-box.pl
  2. +4 −4 src/radio-box-client.coffee
View
8 mojolicious-radio-box.pl
@@ -555,15 +555,15 @@ sub _cmus_parse_info {
$("#div_info").html("<b>" + App.info.tag.title + position + "</b>");
}
}
- if (App.info.radio_title || App.info.file.match(/https?:\/\//)) {
+ if (App.info.radio_title || (App.info.file != null) && App.info.file.match(/https?:\/\//)) {
$("#radio_stations").show();
if (App.radio_stations.length) {
App.render_select_radio();
} else {
App.do_get_radio();
}
}
- if (App.info.volume !== void 0) {
+ if (App.info.volume != null) {
return $('input#volume_slider').val(App.info.volume);
}
},
@@ -577,7 +577,7 @@ sub _cmus_parse_info {
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
new_option = new Option(item.title, item.url);
- if (App.info.file.match(/https?:\/\//) && App.info.file === item.url) {
+ if ((App.info.file != null) && App.info.file.match(/https?:\/\//) && App.info.file === item.url) {
new_option.selected = true;
}
_results.push(select_input.options.add(new_option));
@@ -680,7 +680,7 @@ sub _cmus_parse_info {
return;
}
return App._change_valume_tid = window.setTimeout(function() {
- if (new_volume !== void 0 && new_volume !== App.info.volume) {
+ if ((new_volume != null) && new_volume !== App.info.volume) {
App.info.volume = new_volume;
$("#volume_slider").val(new_volume);
return $.post('/set_volume', {
View
8 src/radio-box-client.coffee
@@ -75,14 +75,14 @@ window.App =
<b>#{App.info.tag.title}#{position}</b>
"""
- if App.info.radio_title || App.info.file.match(/https?:\/\//)
+ if App.info.radio_title || App.info.file? && App.info.file.match(/https?:\/\//)
$("#radio_stations").show()
if App.radio_stations.length
App.render_select_radio()
else
App.do_get_radio()
- if App.info.volume != undefined
+ if App.info.volume?
$('input#volume_slider').val(App.info.volume)
# ...........................................
@@ -93,7 +93,7 @@ window.App =
select_input.options.add(new Option(' - please select station -', ''))
for item in App.radio_stations
new_option = new Option(item.title, item.url)
- if App.info.file.match(/https?:\/\//) && App.info.file == item.url
+ if App.info.file? && App.info.file.match(/https?:\/\//) && App.info.file == item.url
new_option.selected = true
select_input.options.add(new_option)
@@ -180,7 +180,7 @@ window.App =
App._change_valume_tid = window.setTimeout(
() ->
- if new_volume != undefined && new_volume != App.info.volume
+ if new_volume? && new_volume != App.info.volume
App.info.volume = new_volume
$("#volume_slider").val(new_volume)
$.post '/set_volume'

0 comments on commit 0f18bf1

Please sign in to comment.