Commit bc86e746 authored by Valentin Samir's avatar Valentin Samir

[tv] Affichage d'un message d'erreur si le plugin web vlc n'est pas disponible

parent d196cfba
......@@ -8,15 +8,13 @@
</head>
<body>
<div id="mainTitle">{% block h1 %}<h1>Crans Intranet</h1>{% endblock %}</div>
{% if messages %}
<div class="errors">
<ul>
<ul id="errors_list">
{% for mess in messages %}
<li class="{{mess.tags}}">{{ mess|safe|linebreaksbr }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="main_div">
{% block content %}{% endblock %}
</div>
......
......@@ -85,6 +85,9 @@ function add(url, vlc){
}catch(e){}
}
function play(url){
if(!test_vlc_plugin()){
return false;
}
if(url==playing){
return false;
} else {
......@@ -100,7 +103,43 @@ function play(url){
return false;
}
function test_vlc_plugin(){
var vlc = document.getElementById("vlc");
if(typeof vlc.playlist != 'undefined'){
unwarn_vlc_plugin();
return true;
} else {
warn_vlc_plugin();
return false;
}
}
function warn_vlc_plugin(){
if(!document.getElementById("warning_vlc_plugin")){
var ul = document.getElementById("errors_list");
var a = document.createElement("a");
a.setAttribute("href", "http://kiss92.free.fr/applications/Aide-pour-installer-VLC-PLUG-IN-sur-PC-Linux.html");
a.appendChild(document.createTextNode('plugin vlc'));
var li = document.createElement("li");
li.appendChild(document.createTextNode('Le '));
li.appendChild(a);
li.appendChild(document.createTextNode(' est nécessaire pour regarder la télévision ou écouter la radio.'));
li.setAttribute("class","warning");
li.setAttribute("id","warning_vlc_plugin");
ul.appendChild(li);
}
}
function unwarn_vlc_plugin(){
if(document.getElementById("warning_vlc_plugin")){
document.getElementById("warning_vlc_plugin").remove();
}
}
function play_radio(url){
if(!test_vlc_plugin()){
return false;
}
document.getElementById('player_div').style.visibility="hidden";
if(url==playing){
return false;
......@@ -131,6 +170,7 @@ function init(){
document.getElementById("range").innerHTML= document.getElementById("volume_slide").value + "%";
document.getElementById("range2").innerHTML= document.getElementById("volume_slide").value + "%";
document.getElementById("volume_slide2").innerHTML= document.getElementById("volume_slide").value;
test_vlc_plugin();
}
</script>
{% endblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment