plugins/gallery/gallery-bits.js
author Dan Fuhry <dan@enanocms.org>
Sat, 21 Aug 2010 23:35:20 -0400
changeset 43 7df4993be0b0
parent 42 7c6e2e97aa08
permissions -rw-r--r--
Some minimal no-javascript safety for the uploader
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     1
/*
10
b38afb86dcad Merging with bugfixes on Scribus
Dan
parents: 0
diff changeset
     2
 * Misc functions for Snapr.
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     3
 */
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     4
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     5
function gal_toggle(elem, img, img_open, img_close)
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
     6
{
42
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
     7
	if ( !img_close || !img_open )
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
     8
	{
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
     9
		img_close = scriptPath + '/plugins/gallery/toggle-closed.png';
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    10
		img_open  = scriptPath + '/plugins/gallery/toggle-open.png';
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    11
	}
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    12
	if ( elem.style.display == 'none' || !elem.style.display )
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    13
	{
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    14
		elem.style.display = 'block';
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    15
		try {
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    16
			img.src = img_open;
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    17
		} catch(e) {};
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    18
	}
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    19
	else
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    20
	{
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    21
		elem.style.display = 'none';
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    22
		try {
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    23
			img.src = img_close;
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    24
		} catch(e) {};
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    25
	}
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    26
}
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    27
42
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    28
function gal_unset_radios(name)
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    29
{
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    30
	var radios = document.getElementsByTagName('input');
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    31
	for ( var i = 0; i < radios.length; i++ )
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    32
	{
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    33
		var radio = radios[i];
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    34
		if ( radio.name == name )
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    35
		{
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    36
			radio.checked = false;
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    37
		}
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    38
	}
7c6e2e97aa08 Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents: 10
diff changeset
    39
}
0
7caf561c50ee Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff changeset
    40