/[drupal]/contributions/modules/media/media.js
ViewVC logotype

Contents of /contributions/modules/media/media.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Tue Jul 21 04:34:45 2009 UTC (4 months, 1 week ago) by jmstacey
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-7--1
Changes since 1.2: +61 -63 lines
File MIME type: text/javascript
Some blind styling cleanup in preparation for work.
1 // $Id: media.js,v 1.2 2009/07/20 22:58:02 jmstacey Exp $
2
3 /**
4 * @file
5 * This file handles the JS for Media Module functions
6 */
7
8 /**
9 * This handles the activation of drawers on the media browser form
10 * @TODO make this a drupal behavior
11 */
12 $(document).ready( function () {
13 // hide the display information on page load
14 $('.media.browser.display').each(function() {
15 $(this).hide();
16 });
17
18 // Activate drawers when the page loads
19 $('.media.browser .ui-tabs-panel .drawers .item-list li.first').addClass('active');
20
21 // Activate displays when the page loads
22 $('.media.browser .ui-tabs-panel .display.first').addClass('active').show();
23
24 // now we need to bind click functionality on drawers to display
25 $('.media.browser .ui-tabs-panel .drawers .item-list ul li, .drawers li a').bind('click', function () {
26 // get the href id that we want to display
27 // is this an a element?
28 var display_id = $(this).attr('href');
29
30 if (display_id == undefined) {
31 var display_id = $(this).children('a').attr('href');
32 }
33
34 // we need to get the container that this drawer is in
35 var parent = $(this).parents('.ui-tabs-panel').attr('id');
36
37 // hide current active display
38 $('#'+parent+' .display.active').removeClass('active').hide();
39
40 // set any drawers to not active
41 $('#'+parent+' .drawers li.active').removeClass('active');
42
43 // make this drawer active
44 $(this).addClass('active');
45
46 // make the correct display active
47 $(display_id).addClass('active').show();
48 });
49 });
50
51 /**
52 * we need to hide any form elements that were replaced by the media browser form
53 * activate the add button, and hide the browser
54 */
55 $(document).ready(function () {
56 $('.media.replace').hide();
57
58 $('.media.browser.activation').each(function () {
59 $(this).next('.media.browser').hide();
60
61 $(this).click(function () {
62 $(this).next('.media.browser').slideDown('slow');
63 $(this).slideUp();
64 });
65 });
66 });
67
68 /**
69 * This handles passing the current file data from the media browser
70 * to the formater function and returns the correct form elements
71 */
72 $(document).ready(function () { });

  ViewVC Help
Powered by ViewVC 1.1.2