17 */ |
17 */ |
18 |
18 |
19 IriSP._ = window._.noConflict(); |
19 IriSP._ = window._.noConflict(); |
20 IriSP.underscore = IriSP._; |
20 IriSP.underscore = IriSP._; |
21 |
21 |
22 IriSP.loadLibs = function( libs, config, metadata_url, callback ) { |
22 IriSP.getLib = function(lib) { |
|
23 return ( |
|
24 IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string" |
|
25 ? IriSP.libFiles.cdn[lib] |
|
26 : ( |
|
27 typeof IriSP.libFiles.locations[lib] == "string" |
|
28 ? IriSP.libFiles.locations[lib] |
|
29 : ( |
|
30 typeof IriSP.libFiles.inDefaultDir[lib] == "string" |
|
31 ? IriSP.libFiles.defaultDir + IriSP.libFiles.inDefaultDir[lib] |
|
32 : null |
|
33 ) |
|
34 ) |
|
35 ) |
|
36 } |
|
37 |
|
38 IriSP.loadLibs = function( config, metadata_url, callback ) { |
23 // Localize jQuery variable |
39 // Localize jQuery variable |
24 IriSP.jQuery = null; |
40 IriSP.jQuery = null; |
25 var $L = $LAB.script(libs.jQuery).script(libs.swfObject).wait() |
41 var $L = $LAB.script(IriSP.getLib("jQuery")).script(IriSP.getLib("swfObject")).wait() |
26 .script(libs.jQueryUI); |
42 .script(IriSP.getLib("jQueryUI")); |
27 |
43 |
28 if (config.player.type === "jwplayer" || config.player.type === "allocine") { |
44 if (config.player.type === "jwplayer" || config.player.type === "allocine") { |
29 // load our popcorn.js lookalike |
45 // load our popcorn.js lookalike |
30 $L.script(libs.jwplayer); |
46 $L.script(IriSP.getLib("jwplayer")); |
31 } else { |
47 } else { |
32 // load the real popcorn |
48 // load the real popcorn |
33 $L.script(libs.popcorn).script(libs["popcorn.code"]); |
49 $L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code")); |
34 if (config.player.type === "youtube") { |
50 if (config.player.type === "youtube") { |
35 $L.script(libs["popcorn.youtube"]); |
51 $L.script(IriSP.getLib("popcorn.youtube")); |
36 } |
52 } |
37 if (config.player.type === "vimeo") |
53 if (config.player.type === "vimeo") |
38 $L.script(libs["popcorn.vimeo"]); |
54 $L.script(IriSP.getLib("popcorn.vimeo")); |
39 |
55 |
40 /* do nothing for html5 */ |
56 /* do nothing for html5 */ |
41 } |
57 } |
42 |
58 |
43 /* widget specific requirements */ |
59 /* widget specific requirements */ |
44 for (var idx in config.gui.widgets) { |
60 for (var idx in config.gui.widgets) { |
45 if (config.gui.widgets[idx].type === "PolemicWidget" || |
61 if (config.gui.widgets[idx].type === "PolemicWidget" || |
46 config.gui.widgets[idx].type === "StackGraphWidget" || |
62 config.gui.widgets[idx].type === "StackGraphWidget" || |
47 config.gui.widgets[idx].type === "SparklineWidget") { |
63 config.gui.widgets[idx].type === "SparklineWidget") { |
48 $L.script(libs.raphael); |
64 $L.script(IriSP.getLib("raphael")); |
49 } |
65 } |
50 if (config.gui.widgets[idx].type === "TraceWidget") { |
66 if (config.gui.widgets[idx].type === "TraceWidget") { |
51 $L.script(libs.tracemanager) |
67 $L.script(IriSP.getLib("tracemanager")) |
52 } |
68 } |
53 } |
69 } |
54 |
70 |
55 // same for modules |
71 // same for modules |
56 /* |
72 /* |
57 for (var idx in config.modules) { |
73 for (var idx in config.modules) { |
58 if (config.modules[idx].type === "PolemicWidget") |
74 if (config.modules[idx].type === "PolemicWidget") |
59 $L.script(libs.raphaelJs); |
75 $L.script(IriSP.getLib("raphaelJs")); |
60 } |
76 } |
61 */ |
77 */ |
62 |
78 |
63 $L.wait(function() { |
79 $L.wait(function() { |
64 IriSP.jQuery = window.jQuery.noConflict( true ); |
80 IriSP.jQuery = window.jQuery.noConflict( true ); |
65 |
81 |
66 var css_link_jquery = IriSP.jQuery( "<link>", { |
82 var css_link_jquery = IriSP.jQuery( "<link>", { |
67 rel: "stylesheet", |
83 rel: "stylesheet", |
68 type: "text/css", |
84 type: "text/css", |
69 href: libs.cssjQueryUI, |
85 href: IriSP.getLib("cssjQueryUI"), |
70 'class': "dynamic_css" |
86 'class': "dynamic_css" |
71 } ); |
87 } ); |
72 var css_link_custom = IriSP.jQuery( "<link>", { |
88 var css_link_custom = IriSP.jQuery( "<link>", { |
73 rel: "stylesheet", |
89 rel: "stylesheet", |
74 type: "text/css", |
90 type: "text/css", |