mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 03:25:51 +00:00
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
(function(){
|
|
if (window.frameElement) {
|
|
window.frameElement.style.height = 'auto';
|
|
}
|
|
function getGlobal() {
|
|
if (typeof self !== 'undefined') { return self; }
|
|
if (typeof window !== 'undefined') { return window; }
|
|
if (typeof global !== 'undefined') { return global; }
|
|
throw new Error('unable to locate global object');
|
|
}
|
|
const globalScope = getGlobal();
|
|
if (globalScope.generate_send_button_onclick) {
|
|
globalScope.generate_send_button_onclick_old = globalScope.generate_send_button_onclick;
|
|
globalScope.generate_send_button_onclick = function(event) {
|
|
try {
|
|
const textarea = document.getElementById('send_textarea');
|
|
if (textarea && textarea.value) {
|
|
const customEvent = new CustomEvent('xb-send-message', {
|
|
detail: {
|
|
message: textarea.value,
|
|
event: event
|
|
},
|
|
bubbles: true,
|
|
cancelable: true
|
|
});
|
|
if (!window.dispatchEvent(customEvent)) {
|
|
return;
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.error('Error in xb-send-message event dispatch:', e);
|
|
}
|
|
globalScope.generate_send_button_onclick_old(event);
|
|
};
|
|
}
|
|
})();
|