plusui-native-core 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Core/Features/Window/webview.cpp +38 -31
- package/package.json +1 -1
|
@@ -90,49 +90,56 @@ Window Window::create(void *windowHandle, const WindowConfig &config) {
|
|
|
90
90
|
.c_str(),
|
|
91
91
|
nullptr);
|
|
92
92
|
|
|
93
|
-
// Hide scrollbars if disabled via
|
|
93
|
+
// Hide scrollbars if disabled via CSS injection
|
|
94
94
|
if (!pImpl->config.scrollbars) {
|
|
95
95
|
std::string scrollbarScript = R"(
|
|
96
96
|
(function() {
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
document.documentElement
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
// Apply inline styles directly - immediate effect
|
|
98
|
+
try {
|
|
99
|
+
if (document.documentElement) {
|
|
100
|
+
document.documentElement.style.overflow = 'hidden';
|
|
101
|
+
document.documentElement.style.margin = '0';
|
|
102
|
+
document.documentElement.style.padding = '0';
|
|
103
|
+
}
|
|
104
|
+
} catch (e) {}
|
|
104
105
|
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
function applyStyle() {
|
|
111
|
-
try {
|
|
112
|
-
if (document.head) {
|
|
113
|
-
document.head.insertBefore(style, document.head.firstChild);
|
|
114
|
-
} else if (document.documentElement) {
|
|
115
|
-
document.documentElement.insertBefore(style, document.documentElement.firstChild);
|
|
116
|
-
} else {
|
|
117
|
-
setTimeout(applyStyle, 10);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
} catch (e) {}
|
|
121
|
-
}
|
|
106
|
+
// Inject CSS stylesheet
|
|
107
|
+
try {
|
|
108
|
+
var style = document.createElement('style');
|
|
109
|
+
style.textContent = 'html{overflow:hidden!important;margin:0!important;padding:0!important;height:100%!important;}body{overflow:hidden!important;margin:0!important;padding:0!important;height:100%!important;}::-webkit-scrollbar{display:none!important;width:0!important;height:0!important;}';
|
|
122
110
|
|
|
123
|
-
|
|
111
|
+
if (document.head) {
|
|
112
|
+
document.head.appendChild(style);
|
|
113
|
+
} else if (document.documentElement) {
|
|
114
|
+
document.documentElement.appendChild(style);
|
|
115
|
+
} else {
|
|
116
|
+
setTimeout(function() {
|
|
117
|
+
if (document.head) {
|
|
118
|
+
document.head.appendChild(style);
|
|
119
|
+
} else if (document.documentElement) {
|
|
120
|
+
document.documentElement.appendChild(style);
|
|
121
|
+
}
|
|
122
|
+
}, 10);
|
|
123
|
+
}
|
|
124
|
+
} catch (e) {}
|
|
124
125
|
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
// Reapply on DOMContentLoaded
|
|
127
|
+
try {
|
|
128
|
+
var reapply = function() {
|
|
128
129
|
if (document.documentElement) {
|
|
129
130
|
document.documentElement.style.overflow = 'hidden';
|
|
130
131
|
}
|
|
131
132
|
if (document.body) {
|
|
132
133
|
document.body.style.overflow = 'hidden';
|
|
133
134
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
if (document.readyState === 'loading') {
|
|
138
|
+
document.addEventListener('DOMContentLoaded', reapply);
|
|
139
|
+
} else {
|
|
140
|
+
reapply();
|
|
141
|
+
}
|
|
142
|
+
} catch (e) {}
|
|
136
143
|
})();
|
|
137
144
|
)";
|
|
138
145
|
pImpl->webview->AddScriptToExecuteOnDocumentCreated(
|