| author | veltr |
| Wed, 11 Apr 2012 17:06:11 +0200 | |
| changeset 857 | fa614dc66b0b |
| parent 842 | 4ae2247a59f4 |
| child 866 | 3bf7aa8216e5 |
| child 901 | 12b2cd7e9159 |
| permissions | -rw-r--r-- |
|
358
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
1 |
/* main file */ |
| 842 | 2 |
// Why is it called main ? It only loads the libs ! |
|
520
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
511
diff
changeset
|
3 |
|
|
358
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
4 |
if ( window.IriSP === undefined && window.__IriSP === undefined ) { |
|
520
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
511
diff
changeset
|
5 |
/** |
| 531 | 6 |
@class |
7 |
the object under which everything goes. |
|
|
520
fe008e95a716
added jsdoc support, and a script to generate the docs.
hamidouk
parents:
511
diff
changeset
|
8 |
*/ |
| 531 | 9 |
IriSP = {}; |
10 |
|
|
11 |
/** Alias to IriSP for backward compatibility */ |
|
12 |
__IriSP = IriSP; |
|
|
358
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
13 |
} |
|
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
14 |
|
|
743
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
15 |
/* underscore comes bundled with the player and we need |
|
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
16 |
it ASAP, so load it that way |
|
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
17 |
*/ |
|
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
18 |
|
|
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
19 |
IriSP._ = window._.noConflict(); |
|
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
20 |
IriSP.underscore = IriSP._; |
|
69a9969daa41
better defaults - paths are now computed at run-time.
hamidouk
parents:
662
diff
changeset
|
21 |
|
| 842 | 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 ) { |
|
| 498 | 39 |
// Localize jQuery variable |
|
358
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
40 |
IriSP.jQuery = null; |
| 842 | 41 |
var $L = $LAB.script(IriSP.getLib("jQuery")).script(IriSP.getLib("swfObject")).wait() |
42 |
.script(IriSP.getLib("jQueryUI")); |
|
| 498 | 43 |
|
| 835 | 44 |
if (config.player.type === "jwplayer" || config.player.type === "allocine") { |
| 498 | 45 |
// load our popcorn.js lookalike |
| 842 | 46 |
$L.script(IriSP.getLib("jwplayer")); |
| 498 | 47 |
} else { |
48 |
// load the real popcorn |
|
| 842 | 49 |
$L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code")); |
| 501 | 50 |
if (config.player.type === "youtube") { |
| 842 | 51 |
$L.script(IriSP.getLib("popcorn.youtube")); |
| 501 | 52 |
} |
53 |
if (config.player.type === "vimeo") |
|
| 842 | 54 |
$L.script(IriSP.getLib("popcorn.vimeo")); |
| 498 | 55 |
|
56 |
/* do nothing for html5 */ |
|
57 |
} |
|
58 |
|
|
59 |
/* widget specific requirements */ |
|
60 |
for (var idx in config.gui.widgets) { |
|
| 662 | 61 |
if (config.gui.widgets[idx].type === "PolemicWidget" || |
| 834 | 62 |
config.gui.widgets[idx].type === "StackGraphWidget" || |
63 |
config.gui.widgets[idx].type === "SparklineWidget") { |
|
| 842 | 64 |
$L.script(IriSP.getLib("raphael")); |
| 498 | 65 |
} |
| 835 | 66 |
if (config.gui.widgets[idx].type === "TraceWidget") { |
| 842 | 67 |
$L.script(IriSP.getLib("tracemanager")) |
| 835 | 68 |
} |
| 498 | 69 |
} |
70 |
|
|
71 |
// same for modules |
|
72 |
/* |
|
73 |
for (var idx in config.modules) { |
|
74 |
if (config.modules[idx].type === "PolemicWidget") |
|
| 842 | 75 |
$L.script(IriSP.getLib("raphaelJs")); |
| 498 | 76 |
} |
77 |
*/ |
|
|
358
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
78 |
|
| 498 | 79 |
$L.wait(function() { |
80 |
IriSP.jQuery = window.jQuery.noConflict( true ); |
|
81 |
|
|
82 |
var css_link_jquery = IriSP.jQuery( "<link>", { |
|
83 |
rel: "stylesheet", |
|
84 |
type: "text/css", |
|
| 842 | 85 |
href: IriSP.getLib("cssjQueryUI"), |
| 498 | 86 |
'class': "dynamic_css" |
87 |
} ); |
|
88 |
var css_link_custom = IriSP.jQuery( "<link>", { |
|
89 |
rel: "stylesheet", |
|
90 |
type: "text/css", |
|
91 |
href: config.gui.css, |
|
92 |
'class': "dynamic_css" |
|
93 |
} ); |
|
94 |
|
|
95 |
css_link_jquery.appendTo('head'); |
|
96 |
css_link_custom.appendTo('head'); |
|
97 |
|
|
98 |
IriSP.setupDataLoader(); |
|
99 |
IriSP.__dataloader.get(metadata_url, |
|
100 |
function(data) { |
|
101 |
/* save the data so that we could re-use it to |
|
102 |
configure the video |
|
103 |
*/ |
|
104 |
IriSP.__jsonMetadata = data; |
|
105 |
callback.call(window) }); |
|
106 |
}); |
|
107 |
}; |