-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.jsp
76 lines (68 loc) · 3.93 KB
/
view.jsp
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
<%@ include file="/init.jsp" %>
<%@ page import="com.liferay.portal.kernel.servlet.BrowserSnifferUtil" %>
<%@ page import="com.liferay.portal.kernel.util.SessionParamUtil" %>
<%@ page import="com.liferay.portal.kernel.theme.ThemeDisplay" %>
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>
<%@ page import="com.liferay.portal.kernel.util.PortalUtil" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%
String browser = BrowserSnifferUtil.getBrowserId(request);
float version = BrowserSnifferUtil.getMajorVersion(request);
boolean isWebkit = BrowserSnifferUtil.isWebKit(request);
boolean isSafari = BrowserSnifferUtil.isSafari(request);
boolean hasModule = ( version >= 16 && BrowserSnifferUtil.isEdge (request) )
|| ( version >= 60 && BrowserSnifferUtil.isFirefox (request) )
|| ( version >= 61 && BrowserSnifferUtil.isChrome (request) )
|| ( version >= 11 && BrowserSnifferUtil.isSafari (request) )
|| ( version >= 48 && BrowserSnifferUtil.isOpera (request) )
;
boolean hasWebComponent
= ( version >= 75 && BrowserSnifferUtil.isEdge (request) )
|| ( version >= 63 && BrowserSnifferUtil.isFirefox (request) )
|| ( version >= 67 && BrowserSnifferUtil.isChrome (request) )
|| ( version >= 12.1 && BrowserSnifferUtil.isSafari (request) )
|| ( version >= 58 && BrowserSnifferUtil.isOpera (request) )
;
String jsProfile = (hasModule && hasWebComponent) ? "esm-bundled" : hasWebComponent? "es6-bundled": "es5-bundled";
boolean themeJsFastLoad = themeDisplay.isThemeJsFastLoad();// SessionParamUtil.getBoolean( request, "js_fast_load", false );
if( !themeJsFastLoad && hasModule && hasWebComponent )
jsProfile = "esm-unbundled";
String jsBundle = ParamUtil.getString(PortalUtil.getOriginalServletRequest(request), "jsBundle");
if( null!= jsBundle && jsBundle.length()>0 )
jsProfile = jsBundle;
%>
<script src="<%= request.getContextPath() %>/js/main.js" type="text/javascript"></script>
<link href="<%= request.getContextPath() %>/css/main.css" rel="stylesheet">
<p class="polymer-portlet">
<img src="<%= request.getContextPath() %>/image/p-logo.svg" />
<b><liferay-ui:message key="polymer.caption"/></b>
<img src="<%= request.getContextPath() %>/image/logoLiferay.svg" />
</p>
Browser: <%=browser%> <%=version%> <%=isWebkit?"Webkit":""%> <%=isSafari?"Safari":""%> •
Selected bundle: <b><%=jsProfile%></b>
| <a href="./?jsBundle=esm-unbundled">esm-unbundled</a>
| <a href="./?jsBundle=esm-bundled">esm-bundled</a>
| <a href="./?jsBundle=es6-bundled">es6-bundled</a>
| <a href="./?jsBundle=es5-bundled">es5-bundled</a>
• Debug: <a href="./?js_fast_load=0&css_fast_load=0&strip=0">js_fast_load=0</a>
<%--<base href="<%=currentURL%>"/>--%>
<%--<j sp:include page="/polymer3-demo/build/${ jsProfile }/index.html" flush="true" />--%>
<%--<j sp:include page="/polymer3-demo/build/<%= jsProfile %>/index.html" flush="true" />--%>
<% if( !hasModule ) { %><script src="<%=request.getContextPath()%>/polymer3-demo/build/<%=jsProfile%>/node_modules/@babel/polyfill/dist/polyfill.min.js"></script><% }%>
<% if("esm-unbundled".equals(jsProfile) ) { %><jsp:include page="/polymer3-demo/build/esm-unbundled/index.html" /><% }%>
<% if("esm-bundled" .equals(jsProfile) ) { %><jsp:include page="/polymer3-demo/build/esm-bundled/index.html" /><% }%>
<% if("es6-bundled" .equals(jsProfile) ) { %><jsp:include page="/polymer3-demo/build/es6-bundled/index.html" /><% }%>
<% if("es5-bundled" .equals(jsProfile) ) { %><jsp:include page="/polymer3-demo/build/es5-bundled/index.html" /><% }%>
<% if( hasModule ) { %>
<script>
$( function()
{ $( 'script[type="module"]' ).each( function(n,el)
{ el.injected || $('<'+'script type="module"><'+'/script>')
.prop('injected', el.injected =1 )
.attr('src', el.src )
.insertAfter( el );
});
});
</script>
<% }%>
<polymer3-demo-app root-path="<%= request.getContextPath() %>/polymer3-demo/"></polymer3-demo-app>