Revision 4453,
1.1 KB
checked in by rafaelraymundo, 13 years ago
(diff) |
Ticket #1726 - Adicionando jabberit_messenger da comunidade.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | function JsLoader() |
---|
2 | { |
---|
3 | this._loadedJS = []; |
---|
4 | this._loadedCss = []; |
---|
5 | |
---|
6 | this.load = function(pFilesArray) |
---|
7 | { |
---|
8 | for(var i = 0; i < pFilesArray.length; i++) |
---|
9 | { |
---|
10 | var pFiles = pFilesArray[i]; |
---|
11 | |
---|
12 | if( pFiles.indexOf(".js") > -1 ) |
---|
13 | { |
---|
14 | var js = pFiles.toLowerCase(); |
---|
15 | |
---|
16 | if(!this._loadedJS[js]) |
---|
17 | { |
---|
18 | document.getElementsByTagName("head")[0].appendChild(this.loadJavaScript(js)); |
---|
19 | this._loadedJS[js] = true; |
---|
20 | } |
---|
21 | } |
---|
22 | else if( pFiles.indexOf(".css") > -1 ) |
---|
23 | { |
---|
24 | var css = pFiles.toLowerCase(); |
---|
25 | |
---|
26 | if(!this._loadedCss[css]) |
---|
27 | { |
---|
28 | document.getElementsByTagName("head")[0].appendChild(this.loadStyleSheet(css)); |
---|
29 | this._loadedCss[css] = true; |
---|
30 | } |
---|
31 | } |
---|
32 | } |
---|
33 | }; |
---|
34 | |
---|
35 | this.loadJavaScript = function(pJs) |
---|
36 | { |
---|
37 | var _script = document.createElement("script"); |
---|
38 | _script.type = "text/javascript"; |
---|
39 | _script.src = pJs; |
---|
40 | |
---|
41 | return _script; |
---|
42 | }; |
---|
43 | |
---|
44 | this.loadStyleSheet=function(pCss) |
---|
45 | { |
---|
46 | var _style = document.createElement("link"); |
---|
47 | _style.rel = "stylesheet"; |
---|
48 | _style.type = "text/css"; |
---|
49 | _style.href = pCss; |
---|
50 | return _style; |
---|
51 | }; |
---|
52 | } |
---|
53 | |
---|
54 | JSLoader = new JsLoader(); |
---|
Note: See
TracBrowser
for help on using the repository browser.