-
Notifications
You must be signed in to change notification settings - Fork 12
/
module.js
70 lines (60 loc) · 2.1 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* Javascript for loading generico
*
* @copyright © 2012 Justin Hunt
* @author [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package filter_poodll
*/
M.filter_generico = {
allopts: {},
extscripts: {},
csslinks: Array(),
gyui: null,
injectcss: function (csslink) {
var link = document.createElement("link");
link.href = csslink;
if (csslink.toLowerCase().lastIndexOf('.html') == csslink.length - 5) {
link.rel = 'import';
} else {
link.type = "text/css";
link.rel = "stylesheet";
}
document.getElementsByTagName("head")[0].appendChild(link);
},
// Replace poodll_flowplayer divs with flowplayers
loadgenerico: function (Y, opts) {
//stash our Y and opts for later use
this.gyui = Y;
//console.log(opts);
//load our css in head if required
//only do it once per extension though
if (opts['CSSLINK']) {
if (this.csslinks.indexOf(opts['CSSLINK']) < 0) {
this.csslinks.push(opts['CSSLINK']);
this.injectcss(opts['CSSLINK']);
}
}
//load our css in head if required
//only do it once per extension though
if (opts['CSSUPLOAD']) {
if (this.csslinks.indexOf(opts['CSSUPLOAD']) < 0) {
this.csslinks.push(opts['CSSUPLOAD']);
this.injectcss(opts['CSSUPLOAD']);
}
}
//load our css in head if required
//only do it once per extension though
if (opts['CSSCUSTOM']) {
if (this.csslinks.indexOf(opts['CSSCUSTOM']) < 0) {
this.csslinks.push(opts['CSSCUSTOM']);
this.injectcss(opts['CSSCUSTOM']);
}
}
if (typeof filter_generico_extfunctions != 'undefined') {
if (typeof filter_generico_extfunctions[opts['TEMPLATEID']] == 'function') {
filter_generico_extfunctions[opts['TEMPLATEID']](opts);
}
}
}//end of function
}//end of class