1 /*****************************************************************************
2 * mosaic.js: VLC media player web interface - Mosaic specific functions
3 *****************************************************************************
4 * Copyright (C) 2005-2006 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /**********************************************************************
26 *********************************************************************/
28 function mosaic_size_change()
30 check_and_replace_int( "mosaic_rows", "1" );
31 mr = value( "mosaic_rows" );
32 check_and_replace_int( "mosaic_cols", "1" );
33 mc = value( "mosaic_cols" );
35 mlayout = document.getElementById( "mosaic_layout" );
36 while( mlayout.hasChildNodes() )
37 mlayout.removeChild( mlayout.firstChild );
41 for( y = 0; y < mr; y++ )
43 mrow = document.createElement( 'div' );
44 mrow.setAttribute( 'class', 'mosaic_row' );
45 for( x = 0; x < mc; x++ )
47 melt = document.createElement( 'input' );
48 melt.setAttribute( 'type', 'button' );
49 melt.setAttribute( 'id', 'mosaic_'+x+'_'+y );
50 melt.setAttribute( 'class', 'mosaic_element' );
51 melt.setAttribute( 'onclick', 'mosaic_elt_choose(\'mosaic_'+x+'_'+y+'\');' );
52 melt.setAttribute( 'value', '(click)' );
53 mrow.appendChild( melt );
55 mlayout.appendChild( mrow );
60 function mosaic_add_input()
62 mlist = document.getElementById( "mosaic_list" );
63 minput = document.createElement( 'a' );
64 minput.setAttribute( 'href', 'javascript:mosaic_elt_select(\'mosaic_'+value('mosaic_input_name')+'\');');
65 minput.setAttribute( 'id', 'mosaic_'+value('mosaic_input_name') );
66 minput.setAttribute( 'value', value('mosaic_input') );
67 minput.setAttribute( 'title', value('mosaic_input') );
68 minputtxt = document.createTextNode( value('mosaic_input_name') );
69 minput.appendChild( minputtxt );
70 mlist.appendChild( minput );
71 mlist.appendChild( document.createElement( 'br' ) );
74 function mosaic_elt_select( id )
76 hide( 'mosaic_list' );
77 document.getElementById( document.getElementById( 'mosaic_list' ).value ).value =
78 document.getElementById( id ).getAttribute( 'value' );
81 function mosaic_elt_choose( id )
83 document.getElementById( 'mosaic_list' ).value = id;
84 show( 'mosaic_list' );