-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmodule.js
116 lines (92 loc) · 3.25 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**
* Javascript for loading swf widgets , espec flowplayer for PoodLL
*
* @copyright © 2012 Justin Hunt
* @author [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package filter_poodll
*/
M.filter_poodll = {
getwhiteboardcanvas: Array(),
timeouthandles: Array(),
poodllopts: Array(),
gyui: null,
/*
* Image methods: To download an image to desktop
*/
getCanvasBackgroundImage: function () {
var cvs = this.getwhiteboardcanvas();
return cvs.toDataURL("image/png");
},
downloadCanvasBackgroundImage: function () {
var img = this.getImg();
img = img.replace("image/png", "image/octet-stream");
window.location.href = img;
},
//function to call the callback function with arguments
executeFunctionByName: function (functionName, context, args) {
//var args = Array.prototype.slice.call(arguments).splice(2);
var namespaces = functionName.split(".");
var func = namespaces.pop();
for (var i = 0; i < namespaces.length; i++) {
context = context[namespaces[i]];
}
return context[func].call(this, args);
}
};//end of M.filter_poodll
M.filter_poodll.laszlohelper = {
init: function (Y, opts) {
lz.embed.swf(Y.JSON.parse(opts['widgetjson']));
}
};
//PoodLL Templates
M.filter_poodll_templates = {
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);
},
// load templates CSS for poodll filter templates, if AMD not ok
loadtemplate: 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_poodll_extfunctions != 'undefined') {
if (typeof filter_poodll_extfunctions[opts['TEMPLATEID']] == 'function') {
filter_poodll_extfunctions[opts['TEMPLATEID']](opts);
}
}
}//end of function
}//end of class