Skip to content

Commit d13d619

Browse files
committed
Update v1.9.7
* Finally fixed new Callbacks * New Design for MSK.Input * Bugfixes for MSK.Input
1 parent b5416b2 commit d13d619

File tree

7 files changed

+227
-81
lines changed

7 files changed

+227
-81
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.6
1+
1.9.7

client/cl_callback.lua

+13-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ local CallbackHandler = {}
33

44
AddEventHandler('onResourceStop', function(resource)
55
if CallbackHandler[resource] then
6-
RemoveEventHandler(CallbackHandler[resource])
6+
for k, handler in pairs(CallbackHandler[resource]) do
7+
RemoveEventHandler(handler)
8+
end
79
end
810
end)
911

@@ -14,14 +16,22 @@ MSK.RegisterClientCallback = function(eventName, cb)
1416
end)
1517

1618
local script = GetInvokingResource()
17-
if script then CallbackHandler[script] = handler end
19+
if script then
20+
if CallbackHandler[script] then
21+
table.insert(CallbackHandler[script], handler)
22+
else
23+
CallbackHandler[script] = {}
24+
table.insert(CallbackHandler[script], handler)
25+
end
26+
end
1827
end
28+
MSK.Register = MSK.RegisterClientCallback
1929
exports('RegisterClientCallback', MSK.RegisterClientCallback)
2030

2131
-- NEW Method for Server Callbacks
2232
MSK.Trigger = function(eventName, ...)
2333
local p = promise.new()
24-
local ticket = GetGameTimer() .. GetPlayerServerId(PlayerId())
34+
local ticket = tostring(GetGameTimer() .. GetPlayerServerId(PlayerId()))
2535

2636
SetTimeout(5000, function()
2737
p:reject("Request Timed Out (408)")

fxmanifest.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ games { 'gta5' }
44
author 'Musiker15 - MSK Scripts'
55
name 'msk_core'
66
description 'Core functions for MSK Scripts'
7-
version '1.9.6'
7+
version '1.9.7'
88

99
lua54 'yes'
1010

html/index.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
1717
<script src="script.js"></script>
1818

19-
<div class="msk-input-container"><span id="msk-input-title">Das ist eine Überschrift</span>
20-
<span id="close" onclick="closeInputUI()"><i class="fa-solid fa-xmark"></i></span>
19+
<div class="msk-input-container">
20+
<div class="msk-input-title-box">
21+
<div class="msk-input-title">
22+
<span class="msk-input-title-text"><i class="fa-solid fa-chevrons-left arrow-left"></i><span id="msk-input-title">This is a title</span><i class="fa-solid fa-chevrons-right arrow-right"></i></span>
23+
</div>
24+
</div>
2125
<textarea class="msk-input" rows="5" cols="50" id="big-input" placeholder=""></textarea>
2226
<textarea class="msk-input" rows="1" cols="50" id="small-input" placeholder=""></textarea>
23-
<button class="msk-submit-button" onclick="input()">Confirm</button>
27+
<button class="msk-submit-button"onclick="input()"><span class="msk-submit-button-text">Confirm</span></button>
2428
</div>
2529

2630
<div class="progress-container">

html/script.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ window.addEventListener('message', (event) => {
2424
document.getElementById(input).placeholder = data.placeholder;
2525
$(".msk-input-container").fadeIn()
2626
$("#msk-input-title").text(data.header)
27+
28+
document.getElementById('small-input').addEventListener("keydown", function(e) {
29+
if (e.key === "Enter") {
30+
if (e.shiftKey) {
31+
return;
32+
}
33+
e.preventDefault();
34+
}
35+
})
2736
} else if (event.data.action == 'progressBarStart') {
2837
event.data.id = currID
2938
progressBarStart(event.data);
@@ -119,16 +128,14 @@ closeInputUI = (send) => {
119128

120129
document.onkeyup = (data) => {
121130
if (data.which == 27) {
131+
var textfield = '#small-input'
132+
if (field) {textfield = '#big-input'}
133+
$(textfield).val('');
134+
122135
closeInputUI()
123136
}
124137
}
125138

126-
$("#small-input").keydown((event) => {
127-
if (event.keyCode == 13) {
128-
event.preventDefault();
129-
}
130-
})
131-
132139
input = () => {
133140
var textfield = '#small-input'
134141
if (field) {textfield = '#big-input'}

0 commit comments

Comments
 (0)