| author | veltr |
| Tue, 17 Apr 2012 15:03:40 +0200 | |
| branch | new-model |
| changeset 866 | 3bf7aa8216e5 |
| parent 842 | 4ae2247a59f4 |
| child 868 | a525cc2214e7 |
| 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 |
|
| 866 | 4 |
if(window.IriSP === undefined && window.__IriSP === undefined) { |
5 |
/** |
|
6 |
@class |
|
7 |
the object under which everything goes. |
|
8 |
*/ |
|
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 |
|
| 866 | 15 |
/* underscore comes bundled with the player and we need |
16 |
it ASAP, so load it that way |
|
17 |
*/ |
|
|
743
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 |
||
| 866 | 38 |
IriSP.loadLibs = function(config, metadata_url, format, callback) { |
| 498 | 39 |
// Localize jQuery variable |
| 866 | 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")); |
|
| 498 | 46 |
} else { |
| 866 | 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 |
||
| 498 | 58 |
/* widget specific requirements */ |
| 866 | 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 |
} |
|
| 498 | 66 |
} |
| 866 | 67 |
|
|
358
430c1a7a09de
got rid of useless LdtPlayer.js -moved the necessary lines of code in main.js
hamidouk
parents:
diff
changeset
|
68 |
|
| 498 | 69 |
$L.wait(function() { |
| 866 | 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 |
|
|
| 498 | 98 |
}); |
| 866 | 99 |
}; |