Projet

Général

Profil

Paste
Télécharger (1,26 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / media_youtube / js / media-youtube.browser.js @ 70a4c29b

1
/**
2
 * @file
3
 * Handles the JS for the views file browser. Note that this does not currently
4
 * support multiple file selection
5
 */
6

    
7

    
8
(function ($) {
9

    
10
  Drupal.behaviors.mediaYouTubeBrowser = {
11
    attach: function (context, settings) {
12

    
13
      // Container for the files that get passed back to the browser
14
      var files = {};
15

    
16
      // Disable the links on media items list
17
      $('ul#media-browser-library-list a').click(function() {
18
        return false;
19
      });
20

    
21
      // Catch the click on a media item
22
      $('#media-youtube-add .media-item').bind('click', function () {
23
        // Remove all currently selected files
24
        $('.media-item').removeClass('selected');
25
        // Set the current item to active
26
        $(this).addClass('selected');
27
        // Add this FID to the array of selected files
28
        var uri = $(this).parent('li.media-youtube-wrapper[data-uri]').attr('data-uri');
29
        // Get the file from the settings which was stored in
30
        // template_preprocess_media_views_view_media_browser()
31
        var file = Drupal.settings.media.files[uri];
32
        var files = new Array();
33
        files.push(file);
34
        Drupal.media.browser.selectMedia(files);
35
        $("input[name='submitted-video']").val(uri);
36
      });
37

    
38
//      $('.')
39
    }
40
  }
41

    
42
}(jQuery));