Commit 610ac485 authored by dionoea's avatar dionoea
Browse files

Some more IE (crap) fixes

parent 32dc8391
......@@ -205,6 +205,12 @@ function checked( id ){ return document.getElementById( id ).checked; }
function value( id ){ return document.getElementById( id ).value; }
function setclass( obj, value )
{
obj.setAttribute( 'class', value ); /* Firefox */
obj.setAttribute( 'className', value ); /* IE */
}
function radio_value( name )
{
var radio = document.getElementsByName( name );
......@@ -220,7 +226,7 @@ function radio_value( name )
function check_and_replace_int( id, val )
{
var objRegExp = /^\d\d*$/;
var objRegExp = /^\d+$/;
if( value( id ) != ''
&& ( !objRegExp.test( value( id ) )
|| parseInt( value( id ) ) < 1 ) )
......@@ -461,21 +467,21 @@ function parse_status()
var randomtag = status.getElementsByTagName( 'random' );
if( randomtag.length > 0 ? randomtag[0].firstChild.data == "1" : 0)
document.getElementById( 'btn_shuffle').setAttribute( 'class', 'on' );
setclass( document.getElementById( 'btn_shuffle'), 'on' );
else
document.getElementById( 'btn_shuffle').setAttribute( 'class', 'off' );
setclass( document.getElementById( 'btn_shuffle'), 'off' );
var looptag = status.getElementsByTagName( 'loop' );
if( looptag.length > 0 ? looptag[0].firstChild.data == "1" : 0)
document.getElementById( 'btn_loop').setAttribute( 'class', 'on' );
setclass( document.getElementById( 'btn_loop'), 'on' );
else
document.getElementById( 'btn_loop').setAttribute( 'class', 'off' );
setclass( document.getElementById( 'btn_loop'), 'off' );
var repeattag = status.getElementsByTagName( 'repeat' );
if( repeattag.length > 0 ? repeattag[0].firstChild.data == "1" : 0 )
document.getElementById( 'btn_repeat').setAttribute( 'class', 'on' );
setclass( document.getElementById( 'btn_repeat'), 'on' );
else
document.getElementById( 'btn_repeat').setAttribute( 'class', 'off' );
setclass( document.getElementById( 'btn_repeat'), 'off' );
var tree = document.createElement( "ul" );
var categories = status.getElementsByTagName( 'category' );
......@@ -558,7 +564,7 @@ function parse_playlist()
}
var nd = document.createElement( "div" );
nd.setAttribute( 'class', 'pl_node' );
setclass( nd, 'pl_node' );
nd.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) );
pos.appendChild( nd );
}
......@@ -567,12 +573,12 @@ function parse_playlist()
if( pos.hasChildNodes() )
pos.appendChild( document.createElement( "br" ) );
var pl = document.createElement( "a" );
pl.setAttribute( 'class', 'pl_leaf' );
setclass( pl, 'pl_leaf' );
pl.setAttribute( 'href', 'javascript:pl_play('+elt.getAttribute( 'id' )+');' );
pl.setAttribute( 'id', 'pl_'+elt.getAttribute( 'id' ) );
if( elt.getAttribute( 'current' ) == 'current' )
{
pl.setAttribute( 'style', 'font-weight: bold;' );
pl.style.fontWeight = 'bold';
var nowplaying = document.getElementById( 'nowplaying' );
clear_children( nowplaying );
nowplaying.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
......@@ -647,7 +653,7 @@ function parse_browse_dir( )
if( elt.nodeName == "element" )
{
var item = document.createElement( "a" );
item.setAttribute( 'class', 'browser' );
setclass( item, 'browser' );
if( elt.getAttribute( 'type' ) == 'directory' )
{
item.setAttribute( 'href', 'javascript:browse_dir(\''+escapebackslashes(addslashes(elt.getAttribute( 'path' )))+'\');');
......@@ -662,7 +668,7 @@ function parse_browse_dir( )
{
pos.appendChild( document.createTextNode( ' ' ) );
var item = document.createElement( "a" );
item.setAttribute( 'class', 'browser' );
setclass( item, 'browser' );
item.setAttribute( 'href', 'javascript:browse_path(\''+escapebackslashes(addslashes(elt.getAttribute( 'path' )))+'\');');
item.appendChild( document.createTextNode( '(select)' ) );
pos.appendChild( item );
......
......@@ -86,7 +86,7 @@ function mosaic_size_change()
{
var mdt = document.createElement( 'div' );
mdt.setAttribute( 'id', 'mosaic_dt' );
mdt.setAttribute( 'class', 'mosaic_tbl' );
setclass( mdt, 'mosaic_tbl' );
mdt.style.width = mosaic_width + "px";
mdt.style.height = mosaic_height + "px";
......@@ -108,19 +108,13 @@ function mosaic_size_change()
for( x = 0; x < mosaic_cols; x++ )
{
var mcell = document.createElement( 'td' );
mcell.setAttribute( 'class', 'mosaic_itm' );
setclass( mcell, 'mosaic_itm' );
mcell.style.width = cell_width + "px";
mcell.style.height = cell_height + "px";
var melt = document.createElement( 'input' );
melt.setAttribute( 'type', 'button' );
var id = x+'_'+y;
var melt = create_button( cells[id] ? cells[id] : '?', 'mosaic_elt_choose(\"'+id+'\");' );
melt.setAttribute( 'id', id );
melt.setAttribute( 'onclick', 'mosaic_elt_choose(\''+id+'\');' );
if( cells[id] )
melt.setAttribute( 'value', cells[id] );
else
melt.setAttribute( 'value', '?' );
melt.setAttribute( 'title', 'Click to choose stream' );
mcell.appendChild( melt );
......
......@@ -262,10 +262,17 @@ function clear_vlm_add()
function create_button( caption, action )
{
var link = document.createElement( "input" );
link.setAttribute( 'type', 'button' );
link.setAttribute( 'onclick', action );
link.setAttribute( 'value', caption );
/* var link = document.createElement( "input" );
link.setAttribute( 'type', 'button' );*/
/* link.setAttribute( 'onclick', action ); */
/* Above doesn't work on ie. You need to use something like
* link.onclick = function() { alert( 'pouet' ); };
* instead ... conclusion: IE is crap */
/* link.setAttribute( 'value', caption );*/
var d = document.createElement( 'div' );
d.innerHTML = "<input type='button' onclick='"+action+"' value='"+caption+"' />"; /* other IE work around ... still crap. Use double quotes only in action */
var link = d.firstChild;
return link;
}
function create_option( caption, value )
......@@ -327,7 +334,7 @@ function parse_vlm_elements()
if( elt.nodeName == "broadcast" || elt.nodeName == "vod" )
{
var nb = document.createElement( 'div' );
nb.setAttribute( 'class', 'list_element' );
setclass( nb, 'list_element' );
if( elt.nodeName == "broadcast" )
{
vlmb.appendChild( nb );
......@@ -340,41 +347,31 @@ function parse_vlm_elements()
nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
nb.appendChild( nbname );
var link = document.createElement( 'input' );
link.setAttribute( 'type', 'button' );
if( elt.getAttribute( 'enabled' ) == 'yes' )
{
nb.appendChild( document.createTextNode( " enabled " ) );
link.setAttribute( 'onclick', 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' );
link.setAttribute( 'value', "Disable" );
nb.appendChild( create_button( "Disable", 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' ) );
}
else
{
nb.appendChild( document.createTextNode( " disabled " ) );
link.setAttribute( 'onclick', 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' );
link.setAttribute( 'value', "Enable" );
nb.appendChild( create_button( "Enable", 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' ) );
}
nb.appendChild( link );
if( elt.nodeName == "broadcast" )
{
link = document.createElement( 'input' );
link.setAttribute( 'type', 'button' );
if( elt.getAttribute( 'loop' ) == 'yes' )
{
nb.appendChild( document.createTextNode( " loop " ) );
link.setAttribute( 'onclick', 'vlm_unloop("'+elt.getAttribute( 'name' ) + '");' );
link.setAttribute( 'value', "Un-loop" );
nb.appendChild( create_button( 'Un-loop', 'vlm_unloop("'+elt.getAttribute( 'name' ) + '");' ) );
}
else
{
nb.appendChild( document.createTextNode( " play once " ) );
nb.appendChild( create_button( 'Loop', 'vlm_loop("'+elt.getAttribute( 'name' ) + '");' ) );
link.setAttribute( 'onclick', 'vlm_loop("'+elt.getAttribute( 'name' ) + '");' );
link.setAttribute( 'value', "Loop" );
}
nb.appendChild( link );
if( elt.getAttribute( 'enabled' ) == 'yes' )
{
......@@ -515,28 +512,23 @@ function parse_vlm_elements()
else if( elt.nodeName == "schedule" )
{
var nb = document.createElement( 'div' );
nb.setAttribute( 'class', 'list_element' );
setclass( nb, 'list_element' );
vlms.appendChild( nb );
var nbname = document.createElement( 'b' );
nbname.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
nb.appendChild( nbname );
var link = document.createElement( 'input' );
link.setAttribute( 'type', 'button' );
if( elt.getAttribute( 'enabled' ) == 'yes' )
{
nb.appendChild( document.createTextNode( " enabled " ) );
link.setAttribute( 'onclick', 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' );
link.setAttribute( 'value', "Disable" );
nb.appendChild( create_button( "Disable", 'vlm_disable("'+elt.getAttribute( 'name' ) + '");' ) );
}
else
{
nb.appendChild( document.createTextNode( " disabled " ) );
link.setAttribute( 'onclick', 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' );
link.setAttribute( 'value', "Enable" );
nb.appendChild( create_button( "Enable", 'vlm_enable("'+elt.getAttribute( 'name' ) + '");' ) );
}
nb.appendChild( link );
nb.appendChild( document.createTextNode( " " ) );
nb.appendChild( create_button( "Delete", 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
......
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