Projet

Général

Profil

Télécharger (1,21 ko) Statistiques
| Branche: | Tag: | Révision:

root / static / js / msp.js @ c182b1ab

1
$(function() {
2
  var iframe = $('<iframe frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>');
3
  var dialog = $("<div></div>").append(iframe).appendTo("body").dialog({
4
        autoOpen: false,
5
        modal: true,
6
        resizable: false,
7
        width: "auto",
8
        height: "auto",
9
        close: function () {
10
            iframe.attr("src", "");
11
        }
12
  });
13
  $('p.use-file-from-msp span').click(function(e) {
14
    e.preventDefault();
15
    var base_widget = $(this).parents('.file-upload-widget');
16
    document.set_token = function (token, title) {
17
       if (token) {
18
         $(base_widget).find('.filename').text(title);
19
         $(base_widget).find('.fileinfo').show();
20
         $(base_widget).find('input[type=hidden]').val(token);
21
         $(base_widget).find('input[type=file]').hide();
22
       }
23
       document.set_token = undefined;
24
       dialog.dialog('close');
25
    }
26
    var src = $(this).data('src');
27
    var title = $(this).data("title");
28
    var width = $(this).data("width");
29
    var height = $(this).data("height");
30
    iframe.attr({
31
        width: +width,
32
        height: +height,
33
        src: src
34
    });
35
    dialog.dialog("option", "title", title);
36
    dialog.dialog("open");
37
  });
38
});
(1-1/2)