Browse Source

Fixed wiketud controls hidden

Arnaud Vergnet 3 years ago
parent
commit
2d59912c1a

+ 4
- 0
src/components/Screens/WebViewScreen.js View File

@@ -21,6 +21,7 @@ type Props = {
21 21
     theme: CustomTheme,
22 22
     url: string,
23 23
     customJS: string,
24
+    customPaddingFunction: null | (padding: number) => string,
24 25
     collapsibleStack: Collapsible,
25 26
     onMessage: Function,
26 27
     onScroll: Function,
@@ -37,6 +38,7 @@ class WebViewScreen extends React.PureComponent<Props> {
37 38
     static defaultProps = {
38 39
         customJS: '',
39 40
         showAdvancedControls: true,
41
+        customPaddingFunction: null,
40 42
     };
41 43
 
42 44
     webviewRef: Object;
@@ -157,8 +159,10 @@ class WebViewScreen extends React.PureComponent<Props> {
157 159
     getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>;
158 160
 
159 161
     getJavascriptPadding(padding: number) {
162
+        const customPadding = this.props.customPaddingFunction != null ? this.props.customPaddingFunction(padding) : "";
160 163
         return (
161 164
             "document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" +
165
+            customPadding +
162 166
             "true;"
163 167
         );
164 168
     }

+ 12
- 0
src/screens/Services/Websites/WiketudWebsiteScreen.js View File

@@ -4,6 +4,17 @@ import * as React from 'react';
4 4
 import WebViewScreen from "../../../components/Screens/WebViewScreen";
5 5
 
6 6
 const URL = 'https://wiki.etud.insa-toulouse.fr/';
7
+
8
+const customPadding = (padding: string) => {
9
+    return (
10
+        "$('#p-logo-text').css('top', 10 + " + padding + ");" +
11
+        "$('#site-navigation h2').css('top', 10 + " + padding + ");" +
12
+        "$('#site-tools h2').css('top', 10 + " + padding + ");" +
13
+        "$('#user-tools h2').css('top', 10 + " + padding + ");"
14
+    );
15
+}
16
+
17
+
7 18
 /**
8 19
  * Class defining the app's available rooms screen.
9 20
  * This screen uses a webview to render the page
@@ -12,6 +23,7 @@ export const WiketudWebsiteScreen = (props: Object) => {
12 23
     return (
13 24
         <WebViewScreen
14 25
             {...props}
26
+            customPaddingFunction={customPadding}
15 27
             url={URL}/>
16 28
     );
17 29
 };

Loading…
Cancel
Save