Skip to content

Commit 3d5f90a

Browse files
deadlyjackAjit Kumar
andauthored
fix(scrolling issue due changes in index.html) (#1500)
Co-authored-by: Ajit Kumar <dellevenjack@gmail>
1 parent 4dd8f05 commit 3d5f90a

File tree

2 files changed

+56
-67
lines changed

2 files changed

+56
-67
lines changed

hooks/post-process.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ deleteDirRecursively(resPath, [
2929
'xml',
3030
]);
3131
copyDirRecursively(localResPath, resPath);
32-
enableLegacyJni()
33-
enableStaticContext()
34-
patchTargetSdkVersion()
32+
enableLegacyJni();
33+
enableStaticContext();
34+
patchTargetSdkVersion();
3535

3636

3737
function patchTargetSdkVersion() {
@@ -48,19 +48,19 @@ function patchTargetSdkVersion() {
4848
const sdkRegex = /targetSdkVersion\s+(cordovaConfig\.SDK_VERSION|\d+)/;
4949

5050
if (sdkRegex.test(content)) {
51-
let api = "35"
51+
let api = "35";
5252
const froidFlag = path.join(prefix, 'fdroid.bool');
53-
54-
if(fs.existsSync(froidFlag)){
53+
54+
if (fs.existsSync(froidFlag)) {
5555
const fdroid = fs.readFileSync(froidFlag, 'utf-8').trim();
56-
if(fdroid == "true"){
57-
api = "28"
56+
if (fdroid == "true") {
57+
api = "28";
5858
}
5959
}
60-
61-
content = content.replace(sdkRegex, 'targetSdkVersion '+api);
60+
61+
content = content.replace(sdkRegex, 'targetSdkVersion ' + api);
6262
fs.writeFileSync(gradleFile, content, 'utf-8');
63-
console.log('[Cordova Hook] ✅ Patched targetSdkVersion to '+api);
63+
console.log('[Cordova Hook] ✅ Patched targetSdkVersion to ' + api);
6464
} else {
6565
console.warn('[Cordova Hook] ⚠️ targetSdkVersion not found');
6666
}

www/index.html

Lines changed: 45 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
<script>
99
(function () {
10+
var color = localStorage.getItem("__primary_color");
11+
var __bg_color = "#20202c";
12+
if (color) {
13+
__bg_color = color;
14+
}
15+
16+
document.querySelector(":root").style.cssText =
17+
"--bg-color: " + __bg_color;
18+
1019
var __testEl = document.createElement("div");
1120
var __testChildEl = document.createElement("div");
1221
if (__testEl.append) {
@@ -30,54 +39,50 @@
3039
this.appendChild(docFrag);
3140
};
3241
}
42+
})();
3343

34-
function startsWith(string, needle) {
35-
return string.indexOf(needle) === 0;
44+
// save all touch events added by ace editor so it can be use in src/ade/touchHandler.js
45+
var __oldAddEventListener = HTMLElement.prototype.addEventListener;
46+
HTMLElement.prototype.addEventListener = function (
47+
type,
48+
listener,
49+
useCapture,
50+
allowed,
51+
) {
52+
if (typeof useCapture === "boolean") {
53+
allowed = useCapture;
54+
useCapture = undefined;
3655
}
3756

38-
// save all touch events added by ace editor so it can be use in src/ade/touchHandler.js
39-
var __oldAddEventListener = HTMLElement.prototype.addEventListener;
40-
HTMLElement.prototype.addEventListener = function (
41-
type,
42-
listener,
43-
useCapture,
44-
allowed,
45-
) {
46-
if (typeof useCapture === "boolean") {
47-
allowed = useCapture;
48-
useCapture = undefined;
49-
}
57+
if (type === "contextmenu" && !allowed) {
58+
return;
59+
}
5060

51-
if (type === "contextmenu" && !allowed) {
52-
return;
53-
}
61+
if (allowed) {
62+
__oldAddEventListener.call(this, type, listener, useCapture);
63+
return;
64+
}
5465

55-
if (allowed) {
56-
__oldAddEventListener.call(this, type, listener, useCapture);
57-
return;
66+
if (
67+
this.classList.contains("editor-container") &&
68+
type.indexOf("touch") === 0
69+
) {
70+
if (!this.eventListeners) {
71+
this.eventListeners = {};
5872
}
5973

60-
if (
61-
this.classList.contains("editor-container") &&
62-
startsWith(type, "touch")
63-
) {
64-
if (!this.eventListeners) {
65-
this.eventListeners = {};
66-
}
67-
68-
if (!this.eventListeners[type]) {
69-
this.eventListeners[type] = [];
70-
}
71-
this.eventListeners[type].push({
72-
listener: listener,
73-
useCapture: useCapture,
74-
});
75-
76-
return;
74+
if (!this.eventListeners[type]) {
75+
this.eventListeners[type] = [];
7776
}
78-
__oldAddEventListener.call(this, type, listener, useCapture);
79-
};
80-
})();
77+
this.eventListeners[type].push({
78+
listener: listener,
79+
useCapture: useCapture,
80+
});
81+
82+
return;
83+
}
84+
__oldAddEventListener.call(this, type, listener, useCapture);
85+
};
8186
</script>
8287

8388
<script src="cordova.js"></script>
@@ -98,21 +103,6 @@
98103
<script src="./js/ace/ext-static_highlight.js"></script>
99104
<script src="./js/ace/ext-inline_autocomplete.js"></script>
100105

101-
<script>
102-
(function () {
103-
var color = localStorage.getItem("__primary_color");
104-
var __bg_color = "#20202c";
105-
if (color) {
106-
__bg_color = color;
107-
}
108-
109-
document.querySelector(":root").style.cssText =
110-
"--bg-color: " + __bg_color;
111-
})();
112-
</script>
113-
114-
<script></script>
115-
116106
<style>
117107
:root {
118108
--test-height: 45px;
@@ -162,7 +152,6 @@
162152

163153
<script src="./build/main.js"></script>
164154
<link rel="stylesheet" href="./build/main.css">
165-
166155
<title>Acode</title>
167156
</head>
168157

0 commit comments

Comments
 (0)