1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.plugin.skinx; |
21 |
|
|
22 |
|
import org.apache.commons.lang3.BooleanUtils; |
23 |
|
import org.apache.commons.lang3.StringUtils; |
24 |
|
|
25 |
|
import com.xpn.xwiki.XWikiContext; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@version |
31 |
|
@since |
32 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 7 |
Complexity Density: 0.64 |
|
33 |
|
public class JsResourceSkinExtensionPlugin extends AbstractResourceSkinExtensionPlugin |
34 |
|
{ |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
public static final String DEFER_DEFAULT_PARAM = "xwiki.plugins.skinx.deferred.default"; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
@param |
45 |
|
@param |
46 |
|
@param |
47 |
|
@see |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0 |
public JsResourceSkinExtensionPlugin(String name, String className, XWikiContext context)... |
50 |
|
{ |
51 |
0 |
super(name, className, context); |
52 |
|
} |
53 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
0 |
@Override... |
55 |
|
public String getName() |
56 |
|
{ |
57 |
0 |
return "jsrx"; |
58 |
|
} |
59 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
0 |
@Override... |
61 |
|
protected String getAction() |
62 |
|
{ |
63 |
0 |
return "jsx"; |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
66 |
0 |
@Override... |
67 |
|
protected String generateLink(String url, String resourceName, XWikiContext context) |
68 |
|
{ |
69 |
0 |
StringBuilder result = new StringBuilder("<script type='text/javascript' src='").append(url).append("'"); |
70 |
|
|
71 |
0 |
String defaultDeferString = context.getWiki().Param(DEFER_DEFAULT_PARAM); |
72 |
0 |
Boolean defaultDefer = (!StringUtils.isEmpty(defaultDeferString)) ? Boolean.valueOf(defaultDeferString) : true; |
73 |
0 |
if (BooleanUtils.toBooleanDefaultIfNull((Boolean) getParameter("defer", resourceName, context), defaultDefer)) { |
74 |
0 |
result.append(" defer='defer'"); |
75 |
|
} |
76 |
0 |
result.append("></script>\n"); |
77 |
0 |
return result.toString(); |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
@inheritDoc |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
@see |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
0 |
@Override... |
90 |
|
public String endParsing(String content, XWikiContext context) |
91 |
|
{ |
92 |
0 |
return super.endParsing(content, context); |
93 |
|
} |
94 |
|
} |