- Files:
-
- 30 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
/trunk/J_Freebox.js
r20 r30 1 var Freebox_browserIE = false; 2 var Freebox_parseXml = undefined; 3 4 var FREEBOX_SID = 'urn:freebox-fr:serviceId:Freebox1'; 1 var Freebox = { 2 timeoutVar : undefined, 3 timeoutVar2 : undefined, 4 browserIE : false, 5 parseXml : undefined, 6 7 prevNetDevices : undefined, 8 prevPhoneCalls : undefined, 9 10 SID : 'urn:freebox-fr:serviceId:Freebox1', 11 12 buttonBgColor : '#3295F8', 13 offButtonBgColor : '#3295F8', 14 onButtonBgColor : '#025CB6', 15 tableTitleBgColor : '#025CB6' 16 }; 5 17 6 18 function Freebox_showNetDevices (device) 7 19 { 20 if (typeof Freebox.timeoutVar != 'undefined') { 21 clearTimeout(Freebox.timeoutVar); 22 } 23 8 24 Freebox_detectBrowser(); 25 Freebox_defineUIStyle(); 9 26 10 27 Freebox_initXMLParser(); … … 16 33 html += '<tr>'; 17 34 html += '<td>'; 18 html += '<select id="filter" >';35 html += '<select id="filter" onChange="Freebox_refreshNetDevices('+device+', true);">'; 19 36 html += '<option selected value="ALL">Tous les peripheriques</option>'; 20 37 html += '<option value="REACHABLE">Peripheriques joignables</option>'; 21 38 html += '<option value="UNREACHABLE">Peripheriques injoignables</option>'; 22 39 html += '</select>'; 23 html += '<button type="button" style="margin-left: 10px; background-color: lightblue; height: 25px; width: 50px" onclick="Freebox_filterNetDevices('+device+');">Filtrer</button>';40 html += '<button type="button" style="margin-left: 10px; background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 75px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_updateNetDevices('+device+');">Rafraichir</button>'; 24 41 html += '</td>'; 25 42 html += '</tr>'; … … 34 51 set_panel_html(html); 35 52 36 Freebox_filterNetDevices(device); 37 } 38 39 function Freebox_filterNetDevices(device) 40 { 41 if ($('filter').selectedIndex >= 0) { 42 var filter = $('filter').options[$('filter').selectedIndex].value; 43 Freebox_updateNetDevicesTable(device, filter); 44 } 45 } 46 47 function Freebox_updateNetDevicesTable (device, filter) 48 { 49 var html = '<table border="1" >'; 50 html += '<tr align="center" bgcolor="LightBlue">'; 51 html += '<th>Nom</td>'; 52 html += '<th>IP</td>'; 53 html += '<th>MAC</td>'; 54 html += '<th>Wifi</td>'; 55 if (filter == 'ALL') { 56 html += '<th>Joignable</td>'; 57 } 58 html += '</tr>'; 59 html += '<tr>'; 60 61 var xmlnetDevices 62 var netDevices = get_device_state(device, FREEBOX_SID, "PeripheriquesReseau", 1); 63 if (netDevices != undefined && netDevices != "") { 64 xmlnetDevices = Freebox_parseXml(netDevices); 65 } 66 if (typeof xmlnetDevices != 'undefined') { 67 var device = xmlnetDevices.getElementsByTagName("device"); 68 if (device.length > 0) { 69 for (i=0; i<device.length; i++) { 70 var reachable = Freebox_extractXmlTag(device[i], 'reachable'); 71 if (filter == 'ALL' 72 || (filter == 'REACHABLE' && reachable == 'true') 73 || (filter == 'UNREACHABLE' && reachable != 'true')) { 74 var name = Freebox_extractXmlTag(device[i], 'name'); 75 var mac = Freebox_extractXmlTag(device[i], 'mac'); 76 var ip = Freebox_extractXmlTag(device[i], 'ip'); 77 var wifi = Freebox_extractXmlTag(device[i], 'wifi'); 78 if (filter == 'ALL') { 53 Freebox.prevNetDevices = undefined; 54 55 Freebox_refreshNetDevices(device, false); 56 } 57 58 function Freebox_updateNetDevices(device) 59 { 60 Freebox_call_action (device, Freebox.SID, 'RafraichirReseau', {} ); 61 } 62 63 function Freebox_refreshNetDevices (device, force) 64 { 65 var netDevices = get_device_state(device, Freebox.SID, "PeripheriquesReseau", 1); 66 if (force || (netDevices != Freebox.prevNetDevices)) { 67 var filter = 'ALL'; 68 if (jQuery('#filter option:selected').index() >= 0) { 69 filter = jQuery('#filter').val(); 70 } 71 72 var html = '<table border="1" >'; 73 html += '<tr align="center" style="background-color: '+ Freebox.tableTitleBgColor + '; color: white">'; 74 html += '<th>Nom</td>'; 75 html += '<th>IP</td>'; 76 html += '<th>MAC</td>'; 77 html += '<th>Wifi</td>'; 78 if (filter == 'ALL') { 79 html += '<th>Joignable</td>'; 80 } 81 html += '</tr>'; 82 html += '<tr>'; 83 84 var xmlnetDevices 85 if (netDevices != undefined && netDevices != "") { 86 xmlnetDevices = Freebox.parseXml(netDevices); 87 } 88 if (typeof xmlnetDevices != 'undefined') { 89 var devices = xmlnetDevices.getElementsByTagName("device"); 90 if (devices.length > 0) { 91 for (i=0; i<devices.length; i++) { 92 var reachable = Freebox_extractXmlTag(devices[i], 'reachable'); 93 if (filter == 'ALL' 94 || (filter == 'REACHABLE' && reachable == 'true') 95 || (filter == 'UNREACHABLE' && reachable != 'true')) { 96 var name = Freebox_extractXmlTag(devices[i], 'name'); 97 var mac = Freebox_extractXmlTag(devices[i], 'mac'); 98 var ip = Freebox_extractXmlTag(devices[i], 'ip'); 99 var wifi = Freebox_extractXmlTag(devices[i], 'wifi'); 100 if (filter == 'ALL') { 101 if (reachable == 'true') { 102 html += '<tr align="center">'; 103 } 104 else { 105 html += '<tr align="center" bgcolor="LightGrey">'; 106 } 107 } 108 else { 109 html += '<tr align="center">'; 110 } 111 html += '<td>' + name + '</td>'; 112 html += '<td>' + ip + '</td>'; 113 html += '<td>' + mac + '</td>'; 79 114 if (reachable == 'true') { 80 html += '<tr align="center">'; 115 if (wifi == 'true') { 116 html += '<td>oui</td>'; 117 } 118 else { 119 html += '<td>non</td>'; 120 } 81 121 } 82 122 else { 83 html += '<tr align="center" bgcolor="LightGrey">'; 84 } 123 html += '<td></td>'; 124 } 125 if (filter == 'ALL') { 126 if (reachable == 'true') { 127 html += '<td>oui</td>'; 128 } 129 else { 130 html += '<td>non</td>'; 131 } 132 } 133 html += '</tr>'; 85 134 } 86 else {87 html += '<tr align="center">';88 }89 html += '<td>' + name + '</td>';90 html += '<td>' + ip + '</td>';91 html += '<td>' + mac + '</td>';92 if (reachable == 'true') {93 if (wifi == 'true') {94 html += '<td>oui</td>';95 }96 else {97 html += '<td>non</td>';98 }99 }100 else {101 html += '<td></td>';102 }103 if (filter == 'ALL') {104 if (reachable == 'true') {105 html += '<td>oui</td>';106 }107 else {108 html += '<td>non</td>';109 }110 }111 html += '</tr>';112 135 } 113 136 } 114 137 } 115 } 116 html += '</table>'; 117 118 $('devicesTable').innerHTML = html; 138 html += '</table>'; 139 140 jQuery('#devicesTable').html(html); 141 142 Freebox.prevNetDevices = netDevices; 143 } 144 145 if (force == false) { 146 Freebox.timeoutVar = setTimeout("Freebox_refreshNetDevices("+device+", false)", 1000); 147 } 119 148 } 120 149 121 150 function Freebox_showPhoneCalls (device) 122 151 { 152 if (typeof Freebox.timeoutVar2 != 'undefined') { 153 clearTimeout(Freebox.timeoutVar2); 154 } 155 123 156 Freebox_detectBrowser(); 157 Freebox_defineUIStyle(); 124 158 125 159 Freebox_initXMLParser(); … … 131 165 html += '<tr>'; 132 166 html += '<td>'; 133 html += '<select id="filter" >';167 html += '<select id="filter" onChange="Freebox_refreshPhoneCalls('+device+', true);">'; 134 168 html += '<option value="ALL">Tous les appels</option>'; 135 169 html += '<option selected value="UNREAD">Appels non lus</option>'; … … 138 172 html += '<option value="OUTGOING">Appels sortants</option>'; 139 173 html += '</select>'; 140 html += '<button type="button" style="margin-left: 10px; background-color: lightblue; height: 25px; width: 50px" onclick="Freebox_filterPhoneCalls('+device+');">Filtrer</button>';141 html += '<button type="button" style="margin-left: 10px; background-color: lightblue; height: 25px; width: 170px" onclick="Freebox_markPhoneCallsAsRead('+device+');">Tout marquer comme lu</button>';142 html += '<button type="button" style="margin-left: 10px; background-color: lightblue; height: 25px; width: 120px" onclick="Freebox_removePhoneCalls('+device+');">Vider historique</button>';174 html += '<button type="button" style="margin-left: 10px; background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 170px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_markPhoneCallsAsRead('+device+');">Tout marquer comme lu</button>'; 175 html += '<button type="button" style="margin-left: 10px; background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 120px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_removePhoneCalls('+device+');">Vider historique</button>'; 176 html += '<button type="button" style="margin-left: 10px; background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 75px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_updatePhoneCalls('+device+');">Rafraichir</button>'; 143 177 html += '</td>'; 144 178 html += '</tr>'; … … 153 187 set_panel_html(html); 154 188 155 Freebox_filterPhoneCalls(device); 156 } 157 158 function Freebox_filterPhoneCalls(device) 159 { 160 if ($('filter').selectedIndex >= 0) { 161 var filter = $('filter').options[$('filter').selectedIndex].value; 162 Freebox_updatePhoneCallsTable(device, filter); 163 } 189 Freebox.prevPhoneCalls = undefined; 190 191 Freebox_refreshPhoneCalls(device, false); 192 } 193 194 function Freebox_updatePhoneCalls(device) 195 { 196 Freebox_call_action (device, Freebox.SID, 'RafraichirAppels', {} ); 164 197 } 165 198 166 199 function Freebox_markPhoneCallsAsRead(device) 167 200 { 168 Freebox_call_action (device, F REEBOX_SID, 'MarquerAppelsCommeLus', {} );201 Freebox_call_action (device, Freebox.SID, 'MarquerAppelsCommeLus', {} ); 169 202 } 170 203 171 204 function Freebox_removePhoneCalls(device) 172 205 { 173 Freebox_call_action (device, FREEBOX_SID, 'ViderHistoriqueAppels', {} ); 174 } 175 176 function Freebox_updatePhoneCallsTable (device, filter) 177 { 178 var html = '<table border="1">'; 179 html += '<tr align="center" bgcolor="LightBlue">'; 180 html += '<th>Numeros</td>'; 181 if (filter == 'ALL' || filter == 'UNREAD' || filter == 'IN') { 182 html += '<th>Type</td>'; 183 } 184 html += '<th>Date et heure</td>'; 185 html += '<th>Duree</td>'; 186 html += '</tr>'; 187 html += '<tr>'; 188 189 var xmlphoneCalls 190 var phoneCalls = get_device_state(device, FREEBOX_SID, "Appels", 1); 191 if (phoneCalls != undefined && phoneCalls != "") { 192 xmlphoneCalls = Freebox_parseXml(phoneCalls); 193 } 194 if (typeof xmlphoneCalls != 'undefined') { 195 var call = xmlphoneCalls.getElementsByTagName("call"); 196 if (call.length > 0) { 197 for (i=0; i<call.length; i++) { 198 var type = Freebox_extractXmlTag(call[i], 'type'); 199 var unread = Freebox_extractXmlTag(call[i], 'unread'); 200 if (filter == 'ALL' 201 || (filter == 'IN' && (type == 'accepted' || type == 'missed')) 202 || (filter == 'MISSED' && type == 'missed') 203 || (filter == 'OUTGOING' && type == 'outgoing') 204 || (filter == 'UNREAD' && unread == 'true')) { 205 var number = Freebox_extractXmlTag(call[i], 'number'); 206 if (number == '') { 207 number = 'Numero masque'; 206 Freebox_call_action (device, Freebox.SID, 'ViderHistoriqueAppels', {} ); 207 } 208 209 function Freebox_refreshPhoneCalls (device, force) 210 { 211 var phoneCalls = get_device_state(device, Freebox.SID, "Appels", 1); 212 if (force || (phoneCalls != Freebox.prevPhoneCalls)) { 213 var filter = 'ALL'; 214 if (jQuery('#filter option:selected').index() >= 0) { 215 filter = jQuery('#filter').val(); 216 } 217 218 var html = '<table border="1">'; 219 html += '<tr align="center" style="background-color: '+ Freebox.tableTitleBgColor + '; color: white">'; 220 html += '<th>Numeros</td>'; 221 if (filter == 'ALL' || filter == 'UNREAD' || filter == 'IN') { 222 html += '<th>Type</td>'; 223 } 224 html += '<th>Date et heure</td>'; 225 html += '<th>Duree</td>'; 226 html += '</tr>'; 227 html += '<tr>'; 228 229 var xmlphoneCalls 230 if (phoneCalls != undefined && phoneCalls != "") { 231 xmlphoneCalls = Freebox.parseXml(phoneCalls); 232 } 233 if (typeof xmlphoneCalls != 'undefined') { 234 var call = xmlphoneCalls.getElementsByTagName("call"); 235 if (call.length > 0) { 236 for (i=0; i<call.length; i++) { 237 var type = Freebox_extractXmlTag(call[i], 'type'); 238 var unread = Freebox_extractXmlTag(call[i], 'unread'); 239 if (filter == 'ALL' 240 || (filter == 'IN' && (type == 'accepted' || type == 'missed')) 241 || (filter == 'MISSED' && type == 'missed') 242 || (filter == 'OUTGOING' && type == 'outgoing') 243 || (filter == 'UNREAD' && unread == 'true')) { 244 var number = Freebox_extractXmlTag(call[i], 'number'); 245 if (number == '') { 246 number = 'Numero masque'; 247 } 248 var name = Freebox_extractXmlTag(call[i], 'name'); 249 if (name != '') { 250 number = name + ' (' + number + ')'; 251 } 252 if (type == 'missed') { 253 type = 'entrant non decroche'; 254 } 255 else if (type == 'accepted') { 256 type = 'entrant decroche'; 257 } 258 else if (type == 'outgoing') { 259 type = 'sortant'; 260 } 261 var datetime = Freebox_extractXmlTag(call[i], 'datetime'); 262 var duration = Freebox_extractXmlTag(call[i], 'duration'); 263 html += '<tr align="center">'; 264 html += '<td>' + number + '</td>'; 265 if (filter == 'ALL' || filter == 'UNREAD' || filter == 'IN') { 266 html += '<td>' + type + '</td>'; 267 } 268 html += '<td>' + datetime + '</td>'; 269 html += '<td>' + duration + ' s</td>'; 270 html += '</tr>'; 208 271 } 209 var name = Freebox_extractXmlTag(call[i], 'name');210 if (name != '') {211 number = name + ' (' + number + ')';212 }213 if (type == 'missed') {214 type = 'entrant non decroche';215 }216 else if (type == 'accepted') {217 type = 'entrant decroche';218 }219 else if (type == 'outgoing') {220 type = 'sortant';221 }222 var datetime = Freebox_extractXmlTag(call[i], 'datetime');223 var duration = Freebox_extractXmlTag(call[i], 'duration');224 html += '<tr align="center">';225 html += '<td>' + number + '</td>';226 if (filter == 'ALL' || filter == 'UNREAD' || filter == 'IN') {227 html += '<td>' + type + '</td>';228 }229 html += '<td>' + datetime + '</td>';230 html += '<td>' + duration + ' s</td>';231 html += '</tr>';232 272 } 233 273 } 234 274 } 235 } 236 html += '</table>'; 237 238 $('callsTable').innerHTML = html; 275 html += '</table>'; 276 277 jQuery('#callsTable').html(html); 278 279 Freebox.prevPhoneCalls = phoneCalls; 280 } 281 282 if (force == false) { 283 Freebox.timeoutVar2 = setTimeout("Freebox_refreshPhoneCalls("+device+", false)", 1000); 284 } 239 285 } 240 286 … … 242 288 { 243 289 Freebox_detectBrowser(); 290 Freebox_defineUIStyle(); 244 291 245 292 var players = [ [ "PLAYER1", "Player 1" ], … … 255 302 ]; 256 303 257 var defaultPlayer = get_device_state(device, F REEBOX_SID, "Player", 1);304 var defaultPlayer = get_device_state(device, Freebox.SID, "Player", 1); 258 305 if (defaultPlayer == 'hd2.freebox.fr') { 259 306 defaultPlayer = 'PLAYER2'; … … 263 310 } 264 311 265 var remoteID = get_device_state(device, F REEBOX_SID, "Telecommande", 1);312 var remoteID = get_device_state(device, Freebox.SID, "Telecommande", 1); 266 313 if (remoteID == undefined) { 267 314 remoteID = ''; … … 283 330 } 284 331 html += '</select>'; 285 html += '<button type="button" style="background-color: lightblue; height: 25px; width: 75px" onclick="Freebox_setRemote('+device+');">Sauver</button>';332 html += '<button type="button" style="background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 75px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_setRemote('+device+');">Sauver</button>'; 286 333 html += '</DIV>'; 287 334 … … 313 360 html += '<label>Nombre (numero chaine):</label>'; 314 361 html += '<input id="number" type="text" size="3" maxlength="3" style="margin-left: 10px"/>'; 315 html += '<button type="button" style="margin-left: 10px; background-color: lightblue; height: 25px; width: 75px" onclick="Freebox_runPlayerNumberCmd('+device+');">Envoyer</button>';362 html += '<button type="button" style="margin-left: 10px; background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 75px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_runPlayerNumberCmd('+device+');">Envoyer</button>'; 316 363 html += '</DIV>'; 317 364 … … 323 370 function Freebox_setRemote (device) 324 371 { 325 var remoteID = $('remoteID').value;326 var player = $('player').value;372 var remoteID = jQuery('#remoteID').val(); 373 var player = jQuery('#player').val(); 327 374 if (remoteID != '') { 328 Freebox_call_action (device, F REEBOX_SID, 'DefinirTelecommande', {'Player':player, 'Telecommande':remoteID} );375 Freebox_call_action (device, Freebox.SID, 'DefinirTelecommande', {'Player':player, 'Telecommande':remoteID} ); 329 376 } 330 377 } … … 332 379 function Freebox_runPlayerCmd (device, key, longPress) 333 380 { 334 var remoteID = $('remoteID').value;335 var player = $('player').value;381 var remoteID = jQuery('#remoteID').val(); 382 var player = jQuery('#player').val(); 336 383 if (remoteID != '') { 337 // $('debug').innerHTML = player + ' ' + remoteID + ' ' + key + ' ' + longPress;338 Freebox_call_action (device, F REEBOX_SID, 'CommanderPlayer', {'Player':player, 'Telecommande':remoteID, 'Touche':key, 'AppuiLong':longPress} );384 //jQuery('#debug').html(player + ' ' + remoteID + ' ' + key + ' ' + longPress); 385 Freebox_call_action (device, Freebox.SID, 'CommanderPlayer', {'Player':player, 'Telecommande':remoteID, 'Touche':key, 'AppuiLong':longPress} ); 339 386 } 340 387 } … … 342 389 function Freebox_runPlayerNumberCmd (device) 343 390 { 344 var key = $('number').value;391 var key = jQuery('#number').val(); 345 392 if (key != '') { 346 Freebox_call_action (device, F REEBOX_SID, 'CommanderPlayer', {'Touche':key} );393 Freebox_call_action (device, Freebox.SID, 'CommanderPlayer', {'Touche':key} ); 347 394 } 348 395 } … … 351 398 { 352 399 Freebox_detectBrowser(); 400 Freebox_defineUIStyle(); 353 401 354 402 var html = ''; … … 359 407 var engines = [ [ "GOOGLE", "Google" ], 360 408 [ "OSX_TTS_SERVER", 'OSX TTS server' ] ]; 361 var defaultEngine = get_device_state(device, F REEBOX_SID, "MoteurTTS", 1);409 var defaultEngine = get_device_state(device, Freebox.SID, "MoteurTTS", 1); 362 410 if (defaultEngine == undefined) { 363 411 defaultEngine = 'GOOGLE'; … … 368 416 [ "es", "Espagnol" ], 369 417 [ "ru", 'Russe' ] ]; 370 var defaultLanguage = get_device_state(device, F REEBOX_SID, "LangueTTS", 1);418 var defaultLanguage = get_device_state(device, Freebox.SID, "LangueTTS", 1); 371 419 if (defaultLanguage == undefined) { 372 420 defaultLanguage = 'en'; 373 421 } 374 422 375 var serverURL = get_device_state(device, F REEBOX_SID, "URLServeurOSXTTS", 1);423 var serverURL = get_device_state(device, Freebox.SID, "URLServeurOSXTTS", 1); 376 424 if (serverURL == undefined) { 377 425 serverURL = ''; … … 399 447 } 400 448 html += '</select>'; 401 html += '<input id="language" type="text" value="' + defaultLanguage + '" style="margin-left: 5px; width: 20px"/>';449 html += '<input id="language" type="text" value="' + defaultLanguage + '" style="margin-left: 5px; width: 30px"/>'; 402 450 html += '</td>'; 403 451 html += '</tr>'; … … 427 475 html += '<tr>'; 428 476 html += '<td>'; 429 html += '<button id="say" type="button" style="background-color: lightblue; height: 25px; width: 75px" onclick="Freebox_say('+device+');">Dire</button>';477 html += '<button id="say" type="button" style="background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 75px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_say('+device+');">Dire</button>'; 430 478 html += '</td>'; 431 479 html += '<td></td>'; … … 435 483 html += '<td>Langue par defaut:</td>'; 436 484 html += '<td>'; 437 html += '<input id="defaultLanguage" type="text" value="' + defaultLanguage + '" style="width: 20px"/>';485 html += '<input id="defaultLanguage" type="text" value="' + defaultLanguage + '" style="width: 30px"/>'; 438 486 html += '</td>'; 439 487 html += '</tr>'; … … 463 511 html += '<tr>'; 464 512 html += '<td>'; 465 html += '<button id="setupTTS" type="button" style="background-color: lightblue; height: 25px; width: 75px" onclick="Freebox_setupTTS('+device+');">Modifier</button>';513 html += '<button id="setupTTS" type="button" style="background-color:' + Freebox.buttonBgColor + '; color: white; height: 25px; width: 75px; -moz-border-radius: 6px; -webkit-border-radius: 6px; -khtml-border-radius: 6px; border-radius: 6px" onclick="Freebox_setupTTS('+device+');">Modifier</button>'; 466 514 html += '</td>'; 467 515 html += '<td></td>'; … … 477 525 function Freebox_selectLang() 478 526 { 479 if ( $('language1').selectedIndex>= 0) {480 $('language').value = $('language1').options[$('language1').selectedIndex].value;527 if (jQuery('#language1 option:selected').index() >= 0) { 528 jQuery('#language').val(jQuery('#language1').val()); 481 529 } 482 530 } … … 484 532 function Freebox_say(device) 485 533 { 486 var text = $('text').value;487 var language = $('language').value;488 var engine = $('engine').value;489 var receiver = $('receiver').value;490 // $('debug').innerHTML = text + ' ' + language + ' ' + engine + ' ' + receiver;534 var text = encodeURIComponent(jQuery('#text').val()); 535 var language = jQuery('#language').val(); 536 var engine = jQuery('#engine').val(); 537 var receiver = encodeURIComponent(jQuery('#receiver').val()); 538 //jQuery('#debug').html(text + ' ' + language + ' ' + engine + ' ' + receiver); 491 539 if (text != "") { 492 Freebox_call_action (device, F REEBOX_SID, 'Dire', {'Destinataire':receiver, 'Texte':text, 'Langue':language, 'Moteur':engine} );540 Freebox_call_action (device, Freebox.SID, 'Dire', {'Destinataire':receiver, 'Texte':text, 'Langue':language, 'Moteur':engine} ); 493 541 } 494 542 } … … 496 544 function Freebox_setupTTS(device) 497 545 { 498 var language = $('defaultLanguage').value;499 var engine = $('defaultEngine').value;500 var url = $('TTSserverURL').value;501 Freebox_call_action (device, F REEBOX_SID, 'ConfigurerTTS', {'Langue':language, 'Moteur':engine, 'URLServeurOSX':url} );546 var language = jQuery('#defaultLanguage').val(); 547 var engine = jQuery('#defaultEngine').val(); 548 var url = encodeURIComponent(jQuery('#TTSserverURL').val()); 549 Freebox_call_action (device, Freebox.SID, 'ConfigurerTTS', {'Langue':language, 'Moteur':engine, 'URLServeurOSX':url} ); 502 550 } 503 551 504 552 function Freebox_detectBrowser() 505 553 { 506 var place = navigator.userAgent.toLowerCase().indexOf('msie');507 if (place == -1) {508 Freebox _browserIE = false;554 if (navigator.userAgent.toLowerCase().indexOf('msie') >= 0 555 || navigator.userAgent.toLowerCase().indexOf('trident') >= 0) { 556 Freebox.browserIE = true; 509 557 } 510 558 else { 511 Freebox_browserIE = true; 559 Freebox.browserIE = false; 560 } 561 } 562 563 function Freebox_defineUIStyle() 564 { 565 if (typeof api !== 'undefined') { 566 Freebox.buttonBgColor = '#006E47'; 567 Freebox.offButtonBgColor = '#006E47'; 568 Freebox.onButtonBgColor = '#00A652'; 569 Freebox.tableTitleBgColor = '#00A652'; 570 } 571 else { 572 Freebox.buttonBgColor = '#3295F8'; 573 Freebox.offButtonBgColor = '#3295F8'; 574 Freebox.onButtonBgColor = '#025CB6'; 575 Freebox.tableTitleBgColor = '#025CB6'; 512 576 } 513 577 } … … 515 579 function Freebox_initXMLParser() 516 580 { 517 if (typeof Freebox _parseXml == 'undefined') {581 if (typeof Freebox.parseXml == 'undefined') { 518 582 if (typeof window.DOMParser != "undefined") { 519 Freebox _parseXml = function(xmlStr) {583 Freebox.parseXml = function(xmlStr) { 520 584 return ( new window.DOMParser() ).parseFromString(xmlStr, "text/xml"); 521 585 }; 522 586 } 523 587 else if (typeof window.ActiveXObject != "undefined" && new window.ActiveXObject("Microsoft.XMLDOM")) { 524 Freebox _parseXml = function(xmlStr) {588 Freebox.parseXml = function(xmlStr) { 525 589 var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM"); 526 590 xmlDoc.async = "false"; … … 530 594 } 531 595 else { 532 Freebox _parseXml = function(xmlStr) {596 Freebox.parseXml = function(xmlStr) { 533 597 return undefined; 534 598 }; … … 557 621 'action':actname 558 622 }; 559 var key, count = 0; 560 for(key in args) { 561 count++; 562 } 563 if (count > 0) { 564 Object.extend(q, args); 565 } 566 if (Freebox_browserIE) { 567 Object.extend(q, {timestamp: new Date().getTime()}); //we need this to avoid IE caching of the AJAX get 623 var key; 624 for (key in args) { 625 q[key] = args[key]; 626 } 627 if (Freebox.browserIE) { 628 q['timestamp'] = new Date().getTime(); //we need this to avoid IE caching of the AJAX get 568 629 } 569 630 new Ajax.Request (command_url+'/data_request', { -
/trunk/L_Freebox.lua
r20 r30 15 15 16 16 17 local PLUGIN_VERSION = "0. 5"17 local PLUGIN_VERSION = "0.7" 18 18 19 19 local THIS_DEVICE = 0 … … 744 744 745 745 -- Search for the receiver and check its capabilities 746 local receiverNameOk = false 746 747 local receiverOk = false 747 748 local url = string.format(baseUrl, serverIp) .. "/airmedia/receivers/" … … 760 761 break 761 762 end 763 if (data.result[i].name == receiverName) then 764 receiverNameOk = true 765 end 762 766 if (mediaLocation ~= nil and mediaLocation ~= "" 763 767 and data.result[i].name == receiverName … … 807 811 warning("Echec requête: " .. data.msg .. " ( " .. data.error_code .. " )") 808 812 end 813 elseif (not receiverNameOk) then 814 warning("Nom du destinataire AirMedia inconnu") 815 task("Nom du destinataire AirMedia inconnu", TASK_ERROR) 816 else 817 warning("Type media incompatible avec le destinataire AirMedia") 818 task("Type media incompatible avec le destinataire AirMedia", TASK_ERROR) 809 819 end 810 820 end … … 1174 1184 task("Démarrage plugin Freebox", TASK_SUCCESS) 1175 1185 1186 luup.set_failure(false) 1187 1176 1188 THIS_DEVICE = lul_device 1177 1189 -
/trunk/D_Freebox.json
r20 r30 1 1 { 2 2 "flashicon": "http://t0.gstatic.com/images?q=tbn:ANd9GcRGh4fNzwueLZvpdS_F7x6fnc-ybolpFnmVj6csFTFnCojEH5MzZA", 3 "default_icon": "http://t0.gstatic.com/images?q=tbn:ANd9GcRGh4fNzwueLZvpdS_F7x6fnc-ybolpFnmVj6csFTFnCojEH5MzZA", 3 4 "imgIconBody": "", 4 5 "imgIconDimmable": "", … … 29 30 "scenegroup": "1", 30 31 "isSingle": "1" 32 }, 33 { 34 "id": "2", 35 "scenegroup": "2", 36 "isSingle": "1" 37 }, 38 { 39 "id": "3", 40 "scenegroup": "3", 41 "isSingle": "1" 42 }, 43 { 44 "id": "4", 45 "scenegroup": "4", 46 "isSingle": "1" 31 47 } 32 48 ], … … 37 53 "left": "0", 38 54 "x": "2", 39 "y": "4" 55 "y": "1" 56 }, 57 { 58 "id": "2", 59 "top": "1", 60 "left": "0", 61 "x": "2", 62 "y": "1" 63 }, 64 { 65 "id": "3", 66 "top": "2", 67 "left": "0", 68 "x": "2", 69 "y": "1" 70 }, 71 { 72 "id": "4", 73 "top": "3", 74 "left": "0", 75 "x": "2", 76 "y": "1" 40 77 } 41 78 ], … … 51 88 }, 52 89 "Display": { 53 "Top": 1 5,90 "Top": 10, 54 91 "Left": 25, 55 92 "Width": 75, … … 65 102 "Service": "urn:freebox-fr:serviceId:Freebox1", 66 103 "Variable": "PluginVersion", 67 "Top": 1 5,104 "Top": 10, 68 105 "Left": 135, 69 106 "Width": 75, … … 72 109 }, 73 110 { 74 "ControlGroup": " 1",75 "ControlType": "label", 76 "top": " 1.25",111 "ControlGroup": "2", 112 "ControlType": "label", 113 "top": "0.25", 77 114 "left": "0", 78 115 "Label": { … … 81 118 }, 82 119 "Display": { 83 "Top": 1 5,120 "Top": 10, 84 121 "Left": 300, 85 122 "Width": 75, … … 88 125 }, 89 126 { 90 "ControlGroup": " 1",127 "ControlGroup": "2", 91 128 "ControlType": "variable", 92 "top": " 1.25",129 "top": "0.25", 93 130 "left": "1", 94 131 "Display": { 95 132 "Service": "urn:freebox-fr:serviceId:Freebox1", 96 133 "Variable": "EtatConnexion", 97 "Top": 1 5,134 "Top": 10, 98 135 "Left": 400, 99 136 "Width": 75, … … 108 145 }, 109 146 "Display": { 110 "Top": 40,147 "Top": 38, 111 148 "Left": 25, 112 149 "Width": 100, … … 126 163 "Service": "urn:freebox-fr:serviceId:Freebox1", 127 164 "Variable": "StatusAuthentification", 128 "Top": 3 5,165 "Top": 30, 129 166 "Left": 135, 130 167 "Width": 200, … … 141 178 }, 142 179 "Display": { 143 "Top": 50,180 "Top": 45, 144 181 "Left": 135, 145 182 "Width": 200, … … 154 191 }, 155 192 "Display": { 156 "Top": 75,193 "Top": 66, 157 194 "Left": 25, 158 195 "Width": 75, … … 165 202 "Service": "urn:freebox-fr:serviceId:Freebox1", 166 203 "Variable": "FrequenceMiseAJourReseau", 167 "Top": 75,204 "Top": 66, 168 205 "Left": 300, 169 206 "Width": 25, … … 178 215 }, 179 216 "Display": { 180 "Top": 75,217 "Top": 66, 181 218 "Left": 340, 182 219 "Width": 40, … … 189 226 "Style": "numeric", 190 227 "Display":{ 191 "Top": 70,228 "Top": 65, 192 229 "Left": 410, 193 230 "Width": 30, … … 202 239 }, 203 240 "Display": { 204 "Top": 70,241 "Top": 65, 205 242 "Left": 450, 206 243 "Width": 75, … … 225 262 }, 226 263 "Display": { 227 "Top": 105,264 "Top": 96, 228 265 "Left": 25, 229 266 "Width": 75, … … 236 273 "Service": "urn:freebox-fr:serviceId:Freebox1", 237 274 "Variable": "FrequenceMiseAJourAppels", 238 "Top": 105,275 "Top": 96, 239 276 "Left": 300, 240 277 "Width": 25, … … 249 286 }, 250 287 "Display": { 251 "Top": 105,288 "Top": 96, 252 289 "Left": 340, 253 290 "Width": 40, … … 260 297 "Style": "numeric", 261 298 "Display":{ 262 "Top": 100,299 "Top": 95, 263 300 "Left": 410, 264 301 "Width": 30, … … 273 310 }, 274 311 "Display": { 275 "Top": 100,312 "Top": 95, 276 313 "Left": 450, 277 314 "Width": 75, … … 296 333 }, 297 334 "Display": { 298 "Top": 1 35,335 "Top": 126, 299 336 "Left": 25, 300 337 "Width": 75, … … 307 344 "Service": "urn:freebox-fr:serviceId:Freebox1", 308 345 "Variable": "StatusConfigFreebox", 309 "Top": 1 35,346 "Top": 126, 310 347 "Left": 300, 311 348 "Width": 100, … … 320 357 }, 321 358 "Display": { 322 "Top": 1 30,359 "Top": 125, 323 360 "Left": 400, 324 361 "Width": 85, … … 338 375 }, 339 376 "Display": { 340 "Top": 1 65,377 "Top": 156, 341 378 "Left": 25, 342 379 "Width": 75, … … 354 391 "Variable": "WifiActif", 355 392 "Value": "1", 356 "Top": 1 60,393 "Top": 155, 357 394 "Left": 100, 358 395 "Width": 85, … … 375 412 "Variable": "WifiActif", 376 413 "Value": "0", 377 "Top": 1 60,414 "Top": 155, 378 415 "Left": 200, 379 416 "Width": 85, … … 393 430 }, 394 431 "Display": { 395 "Top": 1 65,432 "Top": 156, 396 433 "Left": 300, 397 434 "Width": 75, … … 409 446 "Variable": "FtpActif", 410 447 "Value": "1", 411 "Top": 1 60,448 "Top": 155, 412 449 "Left": 400, 413 450 "Width": 85, … … 430 467 "Variable": "FtpActif", 431 468 "Value": "0", 432 "Top": 1 60,469 "Top": 155, 433 470 "Left": 500, 434 471 "Width": 85, … … 448 485 }, 449 486 "Display": { 450 "Top": 1 95,487 "Top": 186, 451 488 "Left": 25, 452 489 "Width": 75, … … 464 501 "Variable": "UPnPAVActif", 465 502 "Value": "1", 466 "Top": 1 90,503 "Top": 185, 467 504 "Left": 100, 468 505 "Width": 85, … … 485 522 "Variable": "UPnPAVActif", 486 523 "Value": "0", 487 "Top": 1 90,524 "Top": 185, 488 525 "Left": 200, 489 526 "Width": 85, … … 503 540 }, 504 541 "Display": { 505 "Top": 1 95,542 "Top": 186, 506 543 "Left": 300, 507 544 "Width": 75, … … 519 556 "Variable": "AirMediaActif", 520 557 "Value": "1", 521 "Top": 1 90,558 "Top": 185, 522 559 "Left": 400, 523 560 "Width": 85, … … 540 577 "Variable": "AirMediaActif", 541 578 "Value": "0", 542 "Top": 1 90,579 "Top": 185, 543 580 "Left": 500, 544 581 "Width": 85, … … 558 595 }, 559 596 "Display": { 560 "Top": 2 25,597 "Top": 216, 561 598 "Left": 25, 562 599 "Width": 75, … … 574 611 "Variable": "PartageFichiersWinActif", 575 612 "Value": "1", 576 "Top": 2 20,613 "Top": 215, 577 614 "Left": 300, 578 615 "Width": 85, … … 595 632 "Variable": "PartageFichiersWinActif", 596 633 "Value": "0", 597 "Top": 2 20,634 "Top": 215, 598 635 "Left": 400, 599 636 "Width": 85, … … 613 650 }, 614 651 "Display": { 615 "Top": 2 55,652 "Top": 246, 616 653 "Left": 25, 617 654 "Width": 75, … … 629 666 "Variable": "PartageImprimantesWinActif", 630 667 "Value": "1", 631 "Top": 2 50,668 "Top": 245, 632 669 "Left": 300, 633 670 "Width": 85, … … 650 687 "Variable": "PartageImprimantesWinActif", 651 688 "Value": "0", 652 "Top": 2 50,689 "Top": 245, 653 690 "Left": 400, 654 691 "Width": 85, … … 662 699 }, 663 700 { 664 "ControlGroup": " 1",665 "ControlType": "label", 666 "top": " 2.25",701 "ControlGroup": "3", 702 "ControlType": "label", 703 "top": "0.25", 667 704 "left": "0", 668 705 "Label": { … … 671 708 }, 672 709 "Display": { 673 "Top": 315,710 "Top": 276, 674 711 "Left": 25, 675 712 "Width": 75, … … 678 715 }, 679 716 { 680 "ControlGroup": " 1",681 "ControlType": "button", 682 "top": " 2",717 "ControlGroup": "3", 718 "ControlType": "button", 719 "top": "0", 683 720 "left": "1", 684 721 "Label": { … … 687 724 }, 688 725 "Display": { 689 "Top": 310, 726 "Service": "urn:freebox-fr:serviceId:Freebox1", 727 "Top": 275, 690 728 "Left": 135, 691 729 "Width": 85, … … 699 737 }, 700 738 { 701 "ControlGroup": " 1",702 "ControlType": "label", 703 "top": " 3.25",739 "ControlGroup": "4", 740 "ControlType": "label", 741 "top": "0.25", 704 742 "left": "0", 705 743 "Label": { … … 708 746 }, 709 747 "Display": { 710 "Top": 315,748 "Top": 276, 711 749 "Left": 300, 712 750 "Width": 75, … … 715 753 }, 716 754 { 717 "ControlGroup": " 1",718 "ControlType": "button", 719 "top": " 3",755 "ControlGroup": "4", 756 "ControlType": "button", 757 "top": "0", 720 758 "left": "1", 721 759 "Label": { … … 724 762 }, 725 763 "Display": { 726 "Top": 310, 764 "Service": "urn:freebox-fr:serviceId:Freebox1", 765 "Top": 275, 727 766 "Left": 400, 728 767 "Width": 85, … … 794 833 { 795 834 "Label": { 796 "lang_tag": "logs",797 "text": "Logs"798 },799 "Position": "6",800 "TabType": "javascript",801 "ScriptName": "shared.js",802 "Function": "device_logs"803 },804 {805 "Label": {806 835 "lang_tag": "notifications", 807 836 "text": "Notifications" 808 837 }, 809 "Position": " 7",838 "Position": "6", 810 839 "TabType": "javascript", 811 840 "ScriptName": "shared.js",
Note: See TracChangeset
for help on using the changeset viewer.