Skip to content

Commit 2430b71

Browse files
authored
Merge pull request #5 from BrowserSourcesForOBS/dev
v1.0.3
2 parents e1e31dd + a85a763 commit 2430b71

File tree

25 files changed

+1621
-135
lines changed

25 files changed

+1621
-135
lines changed

core/client.js

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const buttonContainer = document.getElementById('button-container')
33
const buttonCronoContainer = document.getElementById('button-container-crono')
44
const buttonCdownContainer = document.getElementById('button-container-cdown')
55
const buttonCdowntimeContainer = document.getElementById('button-container-cdowntime')
6+
const buttonExtensibleContainer = document.getElementById('button-container-extensible')
67
const buttonTimeContainer = document.getElementById('button-container-time')
78
const buttonClose = document.getElementById('stop-code')
89
const buttonWiki = document.getElementById('button-wiki')
@@ -11,7 +12,7 @@ const switchTheme = document.getElementById('switch-theme')
1112
const titleCrono = document.getElementById('crono-title')
1213
const titleCdown = document.getElementById('cdown-title')
1314
const titleCdowntime = document.getElementById('cdowntime-title')
14-
const titleTwitchExt = document.getElementById('twitchext-title')
15+
const titleExtensible = document.getElementById('extensible-title')
1516
const titleTime = document.getElementById('time-title')
1617
// const test = document.getElementById('test')
1718
const socket = new WebSocket('ws://localhost:3000')
@@ -63,7 +64,7 @@ socket.addEventListener('message', (event) => {
6364
titleCrono.textContent = translateElements.home.cronoTitle
6465
titleCdown.textContent = translateElements.home.cdownTitle
6566
titleCdowntime.textContent = translateElements.home.cdowntimeTitle
66-
titleTwitchExt.textContent = translateElements.home.twitchextTitle
67+
titleExtensible.textContent = translateElements.home.extensibleTitle
6768
titleTime.textContent = translateElements.home.timeTitle
6869

6970
if (elementVariables && typeof elementVariables === 'object') {
@@ -120,6 +121,10 @@ buttonContainer.addEventListener('click', (event) => {
120121
window.open(`/${data[0]}/view`, '_blank', 'width=800,height=600')
121122
} else if (data[1] === 'controlButton') {
122123
window.open(`/${data[0]}/control`, '_blank', 'width=800,height=600')
124+
} else if (data[1] === 'viewButtonCrono') {
125+
window.open(`/${data[0]}/viewCrono`, '_blank', 'width=800,height=600')
126+
} else if (data[1] === 'viewButtonCdown') {
127+
window.open(`/${data[0]}/viewCdown`, '_blank', 'width=800,height=600')
123128
} else if (data[1] === 'copyButton') {
124129
// Get the text to copy from the "data-copy-text" attribute
125130
const copyText = `http://localhost:3000/${data[0]}/view`
@@ -128,7 +133,27 @@ buttonContainer.addEventListener('click', (event) => {
128133
copyTextToClipboard(copyText)
129134

130135
// Display a notification message
131-
showNotification(translateElements.home.notycopycrono, button)
136+
showNotification(translateElements.home.notycopy, button)
137+
}
138+
} else if (data[1] === 'copyButtonCrono') {
139+
// Get the text to copy from the "data-copy-text" attribute
140+
const copyText = `http://localhost:3000/${data[0]}/viewCrono`
141+
142+
if (copyText) {
143+
copyTextToClipboard(copyText)
144+
145+
// Display a notification message
146+
showNotification(translateElements.home.notycopy, button)
147+
}
148+
} else if (data[1] === 'copyButtonCdown') {
149+
// Get the text to copy from the "data-copy-text" attribute
150+
const copyText = `http://localhost:3000/${data[0]}/viewCdown`
151+
152+
if (copyText) {
153+
copyTextToClipboard(copyText)
154+
155+
// Display a notification message
156+
showNotification(translateElements.home.notycopy, button)
132157
}
133158
} else if (data[1] === 'removeButton') {
134159
socket.send(JSON.stringify({ action: 'removeData', remove: data[0] }))
@@ -178,6 +203,46 @@ function loadButtons (list) {
178203
copyButton.id = element + '-copyButton'
179204
blockSpan.appendChild(copyButton)
180205

206+
const controlButton = createIconButton('fas fa-gear')
207+
controlButton.id = element + '-controlButton'
208+
blockSpan.appendChild(controlButton)
209+
} else if (element.startsWith('extensible')) {
210+
const iconCrono = document.createElement('i')
211+
iconCrono.className = 'fas fa-clock'
212+
iconCrono.style.marginRight = '10px'
213+
iconCrono.style.color = '#494949'
214+
iconCrono.style.fontSize = '20px'
215+
blockSpan.appendChild(iconCrono)
216+
217+
const viewButtonCrono = createIconButton('fas fa-eye')
218+
viewButtonCrono.id = element + '-viewButtonCrono'
219+
blockSpan.appendChild(viewButtonCrono)
220+
221+
const copyButtonCrono = createIconButton('fas fa-copy', 'OBS')
222+
copyButtonCrono.className = 'button-copy'
223+
copyButtonCrono.id = element + '-copyButtonCrono'
224+
blockSpan.appendChild(copyButtonCrono)
225+
226+
blockSpan.appendChild(document.createElement('br'))
227+
228+
const iconCdown = document.createElement('i')
229+
iconCdown.className = 'fas fa-stopwatch'
230+
iconCdown.style.marginRight = '10px'
231+
iconCdown.style.color = '#494949'
232+
iconCdown.style.fontSize = '20px'
233+
blockSpan.appendChild(iconCdown)
234+
235+
const viewButtonCdown = createIconButton('fas fa-eye')
236+
viewButtonCdown.id = element + '-viewButtonCdown'
237+
blockSpan.appendChild(viewButtonCdown)
238+
239+
const copyButtonCdown = createIconButton('fas fa-copy', 'OBS')
240+
copyButtonCdown.className = 'button-copy'
241+
copyButtonCdown.id = element + '-copyButtonCdown'
242+
blockSpan.appendChild(copyButtonCdown)
243+
244+
blockSpan.appendChild(document.createElement('br'))
245+
181246
const controlButton = createIconButton('fas fa-gear')
182247
controlButton.id = element + '-controlButton'
183248
blockSpan.appendChild(controlButton)
@@ -194,6 +259,8 @@ function loadButtons (list) {
194259
buttonCdowntimeContainer.insertBefore(blockSpan, buttonCdowntimeContainer.firstChild)
195260
} else if (element.startsWith('cdown')) {
196261
buttonCdownContainer.insertBefore(blockSpan, buttonCdownContainer.firstChild)
262+
} else if (element.startsWith('extensible')) {
263+
buttonExtensibleContainer.insertBefore(blockSpan, buttonExtensibleContainer.firstChild)
197264
} else if (element.startsWith('time')) {
198265
buttonTimeContainer.insertBefore(blockSpan, buttonTimeContainer.firstChild)
199266
}

core/formats.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ cdowntime:
3434
- 'MM:ss'
3535
- 'SS.000'
3636
- 'SS'
37+
extensible:
38+
- 'HH:mm:ss.000'
39+
- 'HH:mm:ss'
40+
- '(HH:)(mm:)ss.000'
41+
- '(HH:)(mm:)ss'
42+
- '(HH:)mm:ss.000'
43+
- '(HH:)mm:ss'
44+
- 'MM:ss.000'
45+
- 'MM:ss'
46+
- 'SS.000'
47+
- 'SS'
3748
time:
3849
- 'DD/MM/YYYY hh:mm:ss'
3950
- 'DD/MM/YYYY hh:mm'

core/index.html

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,24 @@
2222
<button class="close-button" id="stop-code">
2323
<i class="fas fa-x"></i>
2424
</button>
25-
<button class="link-button" title="GitHub">
26-
<a
27-
href="https://github.com/BrowserSourcesForOBS/obs-timer-controller"
28-
target="_blank"
29-
id="github-button"
30-
><i class="fa-brands fa-github"></i
31-
></a>
32-
</button>
33-
<button class="link-button" id="button-wiki">
34-
<a
35-
href="https://github.com/BrowserSourcesForOBS/obs-timer-controller/wiki"
36-
target="_blank"
37-
id="wiki-button"
38-
><i class="fas fa-book-open"></i
39-
></a>
40-
</button>
25+
<a
26+
href="https://github.com/BrowserSourcesForOBS/obs-timer-controller"
27+
target="_blank"
28+
id="github-button"
29+
>
30+
<button class="link-button" title="GitHub">
31+
<i class="fa-brands fa-github"></i>
32+
</button>
33+
</a>
34+
<a
35+
href="https://github.com/BrowserSourcesForOBS/obs-timer-controller/wiki"
36+
target="_blank"
37+
id="wiki-button"
38+
>
39+
<button class="link-button" id="button-wiki">
40+
<i class="fas fa-book-open"></i>
41+
</button>
42+
</a>
4143
</span>
4244
<span class="language-span"
4345
><i class="fas fa-language"></i>
@@ -79,9 +81,11 @@ <h1 class="title" id="cdowntime-title"></h1>
7981
</div>
8082
</div>
8183
<div class="column">
82-
<h1 class="title" id="twitchext-title"></h1>
83-
<div class="button-container" id="button-container-twitchext">
84-
<span class="add-button">COMING SOON...</span>
84+
<h1 class="title" id="extensible-title"></h1>
85+
<div class="button-container" id="button-container-extensible">
86+
<button class="add-button" id="add-extensible">
87+
<i class="fas fa-plus"></i>
88+
</button>
8589
</div>
8690
<h1 class="title" id="time-title"></h1>
8791
<div class="button-container" id="button-container-time">

core/template/cdown/control/control.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ socket.addEventListener('message', (event) => {
8686
resetButton.textContent = translateElements.timer.buttons.reset
8787

8888
if (elementVariables && typeof elementVariables === 'object') {
89-
checkTextTime = MsToText(elementVariables.textmilliseconds)
89+
checkTextTime = MsToText(elementVariables.textMilliseconds)
9090
checkHexColor = elementVariables.colorText
9191

9292
// Format selector options
@@ -101,10 +101,10 @@ socket.addEventListener('message', (event) => {
101101
// Perform necessary actions with the variables here
102102
textMsg.textContent = elementVariables.msgEnd
103103
if (elementVariables.msgEnd === '') {
104-
textMsg.textContent = translateElements.timer.ph_msgend
104+
textMsg.textContent = translateElements.timer.phMsgEnd
105105
textMsg.style.color = '#555'
106106
} else { textMsg.style.color = '#000' }
107-
timeText.value = MsToText(elementVariables.textmilliseconds)
107+
timeText.value = MsToText(elementVariables.textMilliseconds)
108108
formatSelector.value = elementVariables.formatTime
109109
fontSelect.value = elementVariables.font
110110
fontSize.value = elementVariables.size
@@ -122,10 +122,10 @@ socket.addEventListener('message', (event) => {
122122
if (message[classElement].status !== 'started') {
123123
textMsg.textContent = message[classElement].msgEnd
124124
if (message[classElement].msgEnd === '') {
125-
textMsg.textContent = translateElements.timer.ph_msgend
125+
textMsg.textContent = translateElements.timer.phMsgEnd
126126
textMsg.style.color = '#555'
127127
} else { textMsg.style.color = '#000' }
128-
timeText.value = MsToText(message[classElement].textmilliseconds)
128+
timeText.value = MsToText(message[classElement].textMilliseconds)
129129
formatSelector.value = message[classElement].formatTime
130130
fontSelect.value = message[classElement].font
131131
fontSize.value = message[classElement].size
@@ -172,7 +172,7 @@ timeText.addEventListener('change', () => {
172172
const textTime = timeText.value.trim()
173173

174174
// Regular expression to check the correct time format
175-
const timeRegex = /^([0-9]+):([0-5]?[0-9]):([0-5]?[0-9])$/
175+
const timeRegex = /^(\d+):([0-5]?\d):([0-5]?\d)$/
176176

177177
if (timeRegex.test(textTime)) {
178178
checkTextTime = textTime
@@ -218,7 +218,7 @@ subContainer.addEventListener('click', (event) => {
218218
})
219219

220220
textMsg.addEventListener('focus', () => {
221-
if (textMsg.textContent === translateElements.timer.ph_msgend) {
221+
if (textMsg.textContent === translateElements.timer.phMsgEnd) {
222222
textMsg.textContent = ''
223223
textMsg.style.color = '#000'
224224
}
@@ -227,17 +227,17 @@ textMsg.addEventListener('focus', () => {
227227
textMsg.addEventListener('blur', () => {
228228
socket.send(JSON.stringify({ action: 'editMsgCdown', msg: textMsg.textContent, classElement }))
229229
if (textMsg.textContent === '') {
230-
textMsg.textContent = translateElements.timer.ph_msgend
230+
textMsg.textContent = translateElements.timer.phMsgEnd
231231
textMsg.style.color = '#555'
232232
} else { textMsg.style.color = '#000' }
233233
})
234234

235235
formatSelector.addEventListener('change', () => {
236-
socket.send(JSON.stringify({ action: 'changeFormatCdown', format: formatSelector.value, classElement }))
236+
socket.send(JSON.stringify({ action: 'changeFormat', format: formatSelector.value, classElement }))
237237
})
238238

239239
fontSelect.addEventListener('change', () => {
240-
socket.send(JSON.stringify({ action: 'changeFontCdown', font: fontSelect.value, classElement }))
240+
socket.send(JSON.stringify({ action: 'changeFont', font: fontSelect.value, classElement }))
241241
})
242242

243243
fontSize.addEventListener('change', () => {
@@ -255,37 +255,37 @@ fontSize.addEventListener('change', () => {
255255
}
256256

257257
// Send the new size to the server
258-
socket.send(JSON.stringify({ action: 'changeSizeCdown', size: newSize, classElement }))
258+
socket.send(JSON.stringify({ action: 'changeSize', size: newSize, classElement }))
259259
})
260260

261261
boldButton.addEventListener('click', () => {
262-
socket.send(JSON.stringify({ action: 'textFormatCdown', format: 'bold', classElement }))
262+
socket.send(JSON.stringify({ action: 'textFormat', format: 'bold', classElement }))
263263
})
264264

265265
italicButton.addEventListener('click', () => {
266-
socket.send(JSON.stringify({ action: 'textFormatCdown', format: 'italic', classElement }))
266+
socket.send(JSON.stringify({ action: 'textFormat', format: 'italic', classElement }))
267267
})
268268

269269
underlineButton.addEventListener('click', () => {
270-
socket.send(JSON.stringify({ action: 'textFormatCdown', format: 'underline', classElement }))
270+
socket.send(JSON.stringify({ action: 'textFormat', format: 'underline', classElement }))
271271
})
272272

273273
alignLeftButton.addEventListener('click', () => {
274-
socket.send(JSON.stringify({ action: 'alignCdown', align: 'left', classElement }))
274+
socket.send(JSON.stringify({ action: 'align', align: 'left', classElement }))
275275
})
276276

277277
alignCenterButton.addEventListener('click', () => {
278-
socket.send(JSON.stringify({ action: 'alignCdown', align: 'center', classElement }))
278+
socket.send(JSON.stringify({ action: 'align', align: 'center', classElement }))
279279
})
280280

281281
alignRightButton.addEventListener('click', () => {
282-
socket.send(JSON.stringify({ action: 'alignCdown', align: 'right', classElement }))
282+
socket.send(JSON.stringify({ action: 'align', align: 'right', classElement }))
283283
})
284284

285285
colorPicker.addEventListener('change', () => {
286286
checkHexColor = colorPicker.value.toUpperCase()
287287
// If the hexadecimal code is valid, send the color to the server
288-
socket.send(JSON.stringify({ action: 'changeColorCdown', color: colorPicker.value.toUpperCase(), classElement }))
288+
socket.send(JSON.stringify({ action: 'changeColor', color: colorPicker.value.toUpperCase(), classElement }))
289289
colorHex.value = checkHexColor
290290
})
291291

@@ -298,7 +298,7 @@ colorHex.addEventListener('change', () => {
298298
if (hexRegex.test(hexColor)) {
299299
checkHexColor = hexColor.toUpperCase()
300300
// If the hexadecimal code is valid, send the color to the server
301-
socket.send(JSON.stringify({ action: 'changeColorCdown', color: checkHexColor, classElement }))
301+
socket.send(JSON.stringify({ action: 'changeColor', color: checkHexColor, classElement }))
302302
colorPicker.value = checkHexColor
303303
colorHex.value = checkHexColor
304304
} else {

core/template/cdown/view/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ socket.addEventListener('message', (event) => {
3939
}
4040

4141
formatTimeVar = message[classElement].formatTime
42-
if (message[classElement].status === 'stopped') {
42+
if (message[classElement].status === 'ended') {
4343
if (message[classElement].milliseconds !== 0) {
4444
updateTimeDisplay(formatTimeVar, message[classElement].milliseconds)
4545
} else if (message[classElement].msgEnd !== '') {

0 commit comments

Comments
 (0)