|
@@ -15,27 +15,42 @@ const PLANEX_URL = 'http://planex.insa-toulouse.fr/';
|
15
|
15
|
const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/planex/customMobile2.css';
|
16
|
16
|
const CUSTOM_CSS_NIGHTMODE = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/planex/customDark2.css';
|
17
|
17
|
|
18
|
|
-// Remove transparency to planex items to prevent invisible items
|
19
|
|
-const REMOVE_ALPHA_FUNCTION_INJECTED =
|
20
|
|
- 'function removeAlpha() {' +
|
21
|
|
- ' $(".fc-event-container .fc-event").each(function(index) {' +
|
22
|
|
- ' let bg = $(this).css("background-color");' +
|
23
|
|
- ' if (bg.match("^rgba")) {' +
|
24
|
|
- ' let a = bg.slice(5).split(\',\');' +
|
25
|
|
- ' let newBg = \'rgb(\' + a[0] + \',\' + parseInt(a[1]) + \',\' + parseInt(a[2]) + \')\';' +
|
26
|
|
- ' $(this).css("background-color", newBg);' +
|
27
|
|
- ' };' +
|
28
|
|
- ' });' +
|
29
|
|
- '}';
|
|
18
|
+// JS + JQuery functions used to remove alpha from events. Copy paste in browser console for quick testing
|
|
19
|
+// function removeAlpha(node) {
|
|
20
|
+// console.log(node);
|
|
21
|
+// let bg = node.css("background-color");
|
|
22
|
+// if (bg.match("^rgba")) {
|
|
23
|
+// let a = bg.slice(5).split(',');
|
|
24
|
+// let newBg ='rgb(' + a[0] + ',' + parseInt(a[1]) + ',' + parseInt(a[2]) + ')';
|
|
25
|
+// node.css("background-color", newBg);
|
|
26
|
+// }
|
|
27
|
+// }
|
|
28
|
+// let observer = new MutationObserver(function(mutations) {
|
|
29
|
+// for (let i = 0; i < mutations.length; i++) {
|
|
30
|
+// if (mutations[i]['addedNodes'].length > 0 && $(mutations[i]['addedNodes'][0]).hasClass("fc-event"))
|
|
31
|
+// removeAlpha($(mutations[i]['addedNodes'][0]))
|
|
32
|
+// }
|
|
33
|
+// });
|
|
34
|
+// observer.observe(document.querySelector(".fc-body"), {attributes: false, childList: true, characterData: false, subtree:true});
|
30
|
35
|
|
31
|
36
|
// Watch for changes in the calendar and call the remove alpha function
|
32
|
37
|
const OBSERVE_MUTATIONS_INJECTED =
|
33
|
|
- 'let observer = new MutationObserver(function(mutations) {' +
|
34
|
|
- ' removeAlpha();' +
|
35
|
|
- '});' +
|
36
|
|
- 'observer.observe(document.querySelector(".fc-body"), {attributes: false, childList: true, characterData: false, subtree:true});';
|
37
|
|
-
|
38
|
|
-
|
|
38
|
+ 'function removeAlpha(node) {\n' +
|
|
39
|
+ ' console.log(node);\n' +
|
|
40
|
+ ' let bg = node.css("background-color");\n' +
|
|
41
|
+ ' if (bg.match("^rgba")) {\n' +
|
|
42
|
+ ' let a = bg.slice(5).split(\',\');\n' +
|
|
43
|
+ ' let newBg =\'rgb(\' + a[0] + \',\' + parseInt(a[1]) + \',\' + parseInt(a[2]) + \')\';\n' +
|
|
44
|
+ ' node.css("background-color", newBg);\n' +
|
|
45
|
+ ' }\n' +
|
|
46
|
+ '}' +
|
|
47
|
+ 'let observer = new MutationObserver(function(mutations) {\n' +
|
|
48
|
+ ' for (let i = 0; i < mutations.length; i++) {\n' +
|
|
49
|
+ ' if (mutations[i][\'addedNodes\'].length > 0 && $(mutations[i][\'addedNodes\'][0]).hasClass("fc-event"))\n' +
|
|
50
|
+ ' removeAlpha($(mutations[i][\'addedNodes\'][0]))\n' +
|
|
51
|
+ ' }\n' +
|
|
52
|
+ '});\n' +
|
|
53
|
+ 'observer.observe(document.querySelector(".fc-body"), {attributes: false, childList: true, characterData: false, subtree:true});\n';
|
39
|
54
|
/**
|
40
|
55
|
* Class defining the app's planex screen.
|
41
|
56
|
* This screen uses a webview to render the planex page
|
|
@@ -48,7 +63,6 @@ export default class PlanexScreen extends React.Component<Props> {
|
48
|
63
|
super();
|
49
|
64
|
this.customInjectedJS =
|
50
|
65
|
'$(document).ready(function() {' +
|
51
|
|
- REMOVE_ALPHA_FUNCTION_INJECTED +
|
52
|
66
|
OBSERVE_MUTATIONS_INJECTED +
|
53
|
67
|
'$("head").append(\'<meta name="viewport" content="width=device-width, initial-scale=1.0">\');' +
|
54
|
68
|
'$("head").append(\'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\');';
|