|
@@ -0,0 +1,91 @@
|
|
1
|
+// @flow
|
|
2
|
+
|
|
3
|
+import * as React from 'react';
|
|
4
|
+import ThemeManager from "../../utils/ThemeManager";
|
|
5
|
+import WebViewScreen from "../../components/WebViewScreen";
|
|
6
|
+import i18n from "i18n-js";
|
|
7
|
+
|
|
8
|
+type Props = {
|
|
9
|
+ navigation: Object,
|
|
10
|
+}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+const URL = 'https://ent.insa-toulouse.fr/';
|
|
14
|
+
|
|
15
|
+const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/ent/customMobile.css';
|
|
16
|
+
|
|
17
|
+// let stylesheet = document.createElement('link');
|
|
18
|
+// stylesheet.type = 'text/css';
|
|
19
|
+// stylesheet.rel = 'stylesheet';
|
|
20
|
+// stylesheet.href = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/ent/customMobile.css';
|
|
21
|
+// let mobileSpec = document.createElement('meta');
|
|
22
|
+// mobileSpec.name = 'viewport';
|
|
23
|
+// mobileSpec.content = 'width=device-width, initial-scale=1.0';
|
|
24
|
+// document.getElementsByTagName('head')[0].appendChild(mobileSpec);
|
|
25
|
+// // document.getElementsByTagName('head')[0].appendChild(stylesheet);
|
|
26
|
+// document.getElementsByClassName('preference-items')[0].style.display = 'none';
|
|
27
|
+// document.getElementsByClassName('logoInsa')[0].style.display = 'none';
|
|
28
|
+// document.getElementsByClassName('logoPress')[0].style.display = 'none';
|
|
29
|
+// document.getElementsByClassName('ent')[0].style.display = 'none';
|
|
30
|
+// document.getElementById('portal-page-header').style.margin = 0;
|
|
31
|
+// document.querySelectorAll('.uportal-navigation-category').forEach(element => {
|
|
32
|
+// element.style.cssText = "width: 100%; display: flex; height: 50px;";
|
|
33
|
+// if (element.children.length > 0)
|
|
34
|
+// element.children[0].style.margin = 'auto';
|
|
35
|
+// });
|
|
36
|
+// true;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+/**
|
|
40
|
+ * Class defining the app's ent screen.
|
|
41
|
+ * This screen uses a webview to render the ent page
|
|
42
|
+ */
|
|
43
|
+export default class EntScreen extends React.Component<Props> {
|
|
44
|
+
|
|
45
|
+ customInjectedJS: string;
|
|
46
|
+
|
|
47
|
+ constructor() {
|
|
48
|
+ super();
|
|
49
|
+ this.customInjectedJS =
|
|
50
|
+ 'let stylesheet = document.createElement(\'link\');\n' +
|
|
51
|
+ 'stylesheet.type = \'text/css\';\n' +
|
|
52
|
+ 'stylesheet.rel = \'stylesheet\';\n' +
|
|
53
|
+ 'stylesheet.href = \'' + CUSTOM_CSS_GENERAL +'\';\n' +
|
|
54
|
+ 'let mobileSpec = document.createElement(\'meta\');\n' +
|
|
55
|
+ 'mobileSpec.name = \'viewport\';\n' +
|
|
56
|
+ 'mobileSpec.content = \'width=device-width, initial-scale=1.0\';\n' +
|
|
57
|
+ 'document.getElementsByTagName(\'head\')[0].appendChild(mobileSpec);\n' +
|
|
58
|
+ 'document.getElementsByTagName(\'head\')[0].appendChild(stylesheet);\n' +
|
|
59
|
+ 'document.getElementsByClassName(\'preference-items\')[0].style.display = \'none\';\n' +
|
|
60
|
+ 'document.getElementsByClassName(\'logoInsa\')[0].style.display = \'none\';\n' +
|
|
61
|
+ 'document.getElementsByClassName(\'logoPress\')[0].style.display = \'none\';\n' +
|
|
62
|
+ 'document.getElementsByClassName(\'ent\')[0].style.display = \'none\';\n' +
|
|
63
|
+ 'document.getElementById(\'portal-page-header\').style.margin = 0;\n' +
|
|
64
|
+ 'document.querySelectorAll(\'.uportal-navigation-category\').forEach(element => {\n' +
|
|
65
|
+ ' element.style.cssText = "width: 100%; display: flex; height: 50px;";\n' +
|
|
66
|
+ ' if (element.children.length > 0)\n' +
|
|
67
|
+ ' element.children[0].style.margin = \'auto\';\n' +
|
|
68
|
+ '});' +
|
|
69
|
+ 'true;';
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ render() {
|
|
73
|
+ const nav = this.props.navigation;
|
|
74
|
+ return (
|
|
75
|
+ <WebViewScreen
|
|
76
|
+ navigation={nav}
|
|
77
|
+ data={[
|
|
78
|
+ {
|
|
79
|
+ url: URL,
|
|
80
|
+ icon: '',
|
|
81
|
+ name: '',
|
|
82
|
+ customJS: this.customInjectedJS
|
|
83
|
+ },
|
|
84
|
+ ]}
|
|
85
|
+ headerTitle={i18n.t('screens.ent')}
|
|
86
|
+ hasHeaderBackButton={true}
|
|
87
|
+ hasSideMenu={false}/>
|
|
88
|
+ );
|
|
89
|
+ }
|
|
90
|
+}
|
|
91
|
+
|