src/js/main.js
branchnew-model
changeset 868 a525cc2214e7
parent 866 3bf7aa8216e5
child 875 43629caa77bc
equal deleted inserted replaced
866:3bf7aa8216e5 868:a525cc2214e7
    32                 : null
    32                 : null
    33             )
    33             )
    34         )
    34         )
    35     )
    35     )
    36 }
    36 }
    37 
       
    38 IriSP.loadLibs = function(config, metadata_url, format, callback) {
       
    39     // Localize jQuery variable
       
    40     IriSP.jQuery = null;
       
    41     var $L = $LAB.script(IriSP.getLib("jQuery")).script(IriSP.getLib("swfObject")).wait().script(IriSP.getLib("jQueryUI"));
       
    42 
       
    43     if(config.player.type === "jwplayer" || config.player.type === "allocine") {
       
    44         // load our popcorn.js lookalike
       
    45         $L.script(IriSP.getLib("jwplayer"));
       
    46     } else {
       
    47         // load the real popcorn
       
    48         $L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code"));
       
    49         if(config.player.type === "youtube") {
       
    50             $L.script(IriSP.getLib("popcorn.youtube"));
       
    51         }
       
    52         if(config.player.type === "vimeo")
       
    53             $L.script(IriSP.getLib("popcorn.vimeo"));
       
    54 
       
    55         /* do nothing for html5 */
       
    56     }
       
    57 
       
    58     /* widget specific requirements */
       
    59     for(var idx in config.gui.widgets) {
       
    60         if(config.gui.widgets[idx].type === "PolemicWidget" || config.gui.widgets[idx].type === "StackGraphWidget" || config.gui.widgets[idx].type === "SparklineWidget") {
       
    61             $L.script(IriSP.getLib("raphael"));
       
    62         }
       
    63         if(config.gui.widgets[idx].type === "TraceWidget") {
       
    64             $L.script(IriSP.getLib("tracemanager"))
       
    65         }
       
    66     }
       
    67 
       
    68 
       
    69     $L.wait(function() {
       
    70         IriSP.jQuery = window.jQuery.noConflict(true);
       
    71 
       
    72         var css_link_jquery = IriSP.jQuery("<link>", {
       
    73             rel : "stylesheet",
       
    74             type : "text/css",
       
    75             href : IriSP.getLib("cssjQueryUI"),
       
    76             'class' : "dynamic_css"
       
    77         });
       
    78         var css_link_custom = IriSP.jQuery("<link>", {
       
    79             rel : "stylesheet",
       
    80             type : "text/css",
       
    81             href : config.gui.css,
       
    82             'class' : "dynamic_css"
       
    83         });
       
    84 
       
    85         css_link_jquery.appendTo('head');
       
    86         css_link_custom.appendTo('head');
       
    87 
       
    88         IriSP._directory = new IriSP.Model.Directory();
       
    89         IriSP._videoData = _directory.remoteSource({
       
    90             url : metadata_url,
       
    91             namespace : "metadataplayer",
       
    92             serializer : IriSP.serializers[format]
       
    93         });
       
    94         if (typeof callback !== "undefined") {
       
    95             IriSP._videoData.onLoad(callback);
       
    96         }
       
    97         
       
    98     });
       
    99 };