Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ socket.addEventListener('message', (event) => {

// Configuration and translation
switchTheme.checked = message.config.themeDark
buttonClose.title = translateElements.home.close
buttonClose.title = translateElements.home.close || 'n/a'
textVersion.textContent = message.config.version
if (message.config.version !== 'Error' && message.config.versionRelease !== 'Error' && compareVersions(message.config.version, message.config.versionRelease) === 1) {
const link = document.createElement('a')
Expand All @@ -48,12 +48,12 @@ socket.addEventListener('message', (event) => {
link.id = 'link-newVersion'
const button = document.createElement('button')
button.className = 'button-versionRelease'
button.title = translateElements.home.newVersionTitle
button.textContent = translateElements.home.newVersion + message.config.versionRelease
button.title = translateElements.home.newVersionTitle || 'n/a'
button.textContent = (translateElements.home.newVersion || 'n/a') + (message.config.versionRelease || 'n/a')
link.appendChild(button)
leftButtons.appendChild(link)
}
buttonWiki.title = translateElements.home.wiki
buttonWiki.title = translateElements.home.wiki || 'n/a'
if (message.config.themeDark) {
document.body.classList.remove('light-theme')
document.body.classList.add('dark-theme')
Expand All @@ -76,11 +76,11 @@ socket.addEventListener('message', (event) => {
? message.config.lang
: 'en'

titleCrono.textContent = translateElements.home.cronoTitle
titleCdown.textContent = translateElements.home.cdownTitle
titleCdowntime.textContent = translateElements.home.cdowntimeTitle
titleExtensible.textContent = translateElements.home.extensibleTitle
titleTime.textContent = translateElements.home.timeTitle
titleCrono.textContent = translateElements.home.cronoTitle || 'n/a'
titleCdown.textContent = translateElements.home.cdownTitle || 'n/a'
titleCdowntime.textContent = translateElements.home.cdowntimeTitle || 'n/a'
titleExtensible.textContent = translateElements.home.extensibleTitle || 'n/a'
titleTime.textContent = translateElements.home.timeTitle || 'n/a'

if (elementVariables && typeof elementVariables === 'object') {
// console.log('Variables loaded from the server.')
Expand Down Expand Up @@ -148,7 +148,7 @@ buttonContainer.addEventListener('click', (event) => {
copyTextToClipboard(copyText)

// Display a notification message
showNotification(translateElements.home.notycopy, button)
showNotification(translateElements.home.notycopy || 'n/a', button)
}
} else if (data[1] === 'copyButtonCrono') {
// Get the text to copy from the "data-copy-text" attribute
Expand All @@ -158,7 +158,7 @@ buttonContainer.addEventListener('click', (event) => {
copyTextToClipboard(copyText)

// Display a notification message
showNotification(translateElements.home.notycopy, button)
showNotification(translateElements.home.notycopy || 'n/a', button)
}
} else if (data[1] === 'copyButtonCdown') {
// Get the text to copy from the "data-copy-text" attribute
Expand All @@ -168,7 +168,7 @@ buttonContainer.addEventListener('click', (event) => {
copyTextToClipboard(copyText)

// Display a notification message
showNotification(translateElements.home.notycopy, button)
showNotification(translateElements.home.notycopy || 'n/a', button)
}
} else if (data[1] === 'removeButton') {
socket.send(JSON.stringify({ action: 'removeData', remove: data[0] }))
Expand Down
20 changes: 10 additions & 10 deletions core/template/cdown/control/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ socket.addEventListener('message', (event) => {
? message.config.lang
: 'en'

controlButton.textContent = translateElements.timer.buttons.start
resetButton.textContent = translateElements.timer.buttons.reset
controlButton.textContent = translateElements.timer.buttons.start || 'n/a'
resetButton.textContent = translateElements.timer.buttons.reset || 'n/a'

if (elementVariables && typeof elementVariables === 'object') {
checkTextTime = MsToText(elementVariables.textMilliseconds)
Expand All @@ -101,7 +101,7 @@ socket.addEventListener('message', (event) => {
// Perform necessary actions with the variables here
textMsg.textContent = elementVariables.msgEnd
if (elementVariables.msgEnd === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
timeText.value = MsToText(elementVariables.textMilliseconds)
Expand All @@ -122,7 +122,7 @@ socket.addEventListener('message', (event) => {
if (message[classElement].status !== 'started') {
textMsg.textContent = message[classElement].msgEnd
if (message[classElement].msgEnd === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
timeText.value = MsToText(message[classElement].textMilliseconds)
Expand Down Expand Up @@ -157,7 +157,7 @@ selectorLang.addEventListener('change', () => {
})

controlButton.addEventListener('click', () => {
if (controlButton.textContent === translateElements.timer.buttons.start) {
if (controlButton.textContent === translateElements.timer.buttons.start || 'n/a') {
socket.send(JSON.stringify({ action: 'startTimer', classElement }))
} else {
socket.send(JSON.stringify({ action: 'pauseCdown', classElement }))
Expand Down Expand Up @@ -218,7 +218,7 @@ subContainer.addEventListener('click', (event) => {
})

textMsg.addEventListener('focus', () => {
if (textMsg.textContent === translateElements.timer.phMsgEnd) {
if (textMsg.textContent === translateElements.timer.phMsgEnd || 'n/a') {
textMsg.textContent = ''
textMsg.style.color = '#000'
}
Expand All @@ -227,7 +227,7 @@ textMsg.addEventListener('focus', () => {
textMsg.addEventListener('blur', () => {
socket.send(JSON.stringify({ action: 'editMsg', msg: textMsg.textContent, classElement }))
if (textMsg.textContent === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
})
Expand Down Expand Up @@ -328,17 +328,17 @@ function updateControlButton (status) {
controlButton.style.width = maxWidth

if (status === 'started') {
controlButton.textContent = translateElements.timer.buttons.pause
controlButton.textContent = translateElements.timer.buttons.pause || 'n/a'
} else {
controlButton.textContent = translateElements.timer.buttons.start
controlButton.textContent = translateElements.timer.buttons.start || 'n/a'
}
}

function getMaxButtonWidth () {
const widths = []

Object.keys(translateElements.timer.buttons).forEach((value) => {
controlButton.textContent = translateElements.timer.buttons[value]
controlButton.textContent = translateElements.timer.buttons[value] || 'n/a'
widths.push(parseFloat(window.getComputedStyle(controlButton).getPropertyValue('width')))
})
// Get the maximum of the two widths
Expand Down
6 changes: 3 additions & 3 deletions core/template/cdowntime/control/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ socket.addEventListener('message', (event) => {
// Perform necessary actions with the variables here
textMsg.textContent = elementVariables.msgEnd
if (elementVariables.msgEnd === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
timeData.value = new Date(elementVariables.endDatetime).toLocaleString('en-CA', { timeZone: elementVariables.timezone, hour12: false }).replace(/,\s/, 'T')
Expand Down Expand Up @@ -189,7 +189,7 @@ subContainer.addEventListener('click', (event) => {
})

textMsg.addEventListener('focus', () => {
if (textMsg.textContent === translateElements.timer.phMsgEnd) {
if (textMsg.textContent === translateElements.timer.phMsgEnd || 'n/a') {
textMsg.textContent = ''
textMsg.style.color = '#000'
}
Expand All @@ -198,7 +198,7 @@ textMsg.addEventListener('focus', () => {
textMsg.addEventListener('blur', () => {
socket.send(JSON.stringify({ action: 'editMsg', msg: textMsg.textContent, classElement }))
if (textMsg.textContent === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
})
Expand Down
12 changes: 6 additions & 6 deletions core/template/crono/control/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ socket.addEventListener('message', (event) => {
? message.config.lang
: 'en'

controlButton.textContent = translateElements.timer.buttons.start
resetButton.textContent = translateElements.timer.buttons.reset
controlButton.textContent = translateElements.timer.buttons.start || 'n/a'
resetButton.textContent = translateElements.timer.buttons.reset || 'n/a'

if (elementVariables && typeof elementVariables === 'object') {
checkHexColor = elementVariables.colorText
Expand Down Expand Up @@ -139,7 +139,7 @@ languageSelector.addEventListener('change', () => {
})

controlButton.addEventListener('click', () => {
if (controlButton.textContent === translateElements.timer.buttons.start) {
if (controlButton.textContent === translateElements.timer.buttons.start || 'n/a') {
socket.send(JSON.stringify({ action: 'startTimer', classElement }))
} else {
socket.send(JSON.stringify({ action: 'pauseCrono', classElement }))
Expand Down Expand Up @@ -265,17 +265,17 @@ function updateControlButton (status) {
controlButton.style.width = maxWidth

if (status === 'started') {
controlButton.textContent = translateElements.timer.buttons.pause
controlButton.textContent = translateElements.timer.buttons.pause || 'n/a'
} else {
controlButton.textContent = translateElements.timer.buttons.start
controlButton.textContent = translateElements.timer.buttons.start || 'n/a'
}
}

function getMaxButtonWidth () {
const widths = []

Object.keys(translateElements.timer.buttons).forEach((value) => {
controlButton.textContent = translateElements.timer.buttons[value]
controlButton.textContent = translateElements.timer.buttons[value] || 'n/a'
widths.push(parseFloat(window.getComputedStyle(controlButton).getPropertyValue('width')))
})

Expand Down
24 changes: 12 additions & 12 deletions core/template/extensible/control/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ socket.addEventListener('message', (event) => {
? message.config.lang
: 'en'

controlButton.textContent = translateElements.timer.buttons.start
resetButton.textContent = translateElements.timer.buttons.reset
checkboxLabelStopAdd.textContent = translateElements.timer.enableStopAdd
checkboxLabelPauseAdd.textContent = translateElements.timer.enablePauseAdd
controlButton.textContent = translateElements.timer.buttons.start || 'n/a'
resetButton.textContent = translateElements.timer.buttons.reset || 'n/a'
checkboxLabelStopAdd.textContent = translateElements.timer.enableStopAdd || 'n/a'
checkboxLabelPauseAdd.textContent = translateElements.timer.enablePauseAdd || 'n/a'

if (elementVariables && typeof elementVariables === 'object') {
checkTextTime = MsToText(elementVariables.textMilliseconds)
Expand All @@ -116,7 +116,7 @@ socket.addEventListener('message', (event) => {
// Perform necessary actions with the variables here
textMsg.textContent = elementVariables.msgEnd
if (elementVariables.msgEnd === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
timeText.value = MsToText(elementVariables.textMilliseconds)
Expand All @@ -140,7 +140,7 @@ socket.addEventListener('message', (event) => {
if (message[classElement].status !== 'started') {
textMsg.textContent = message[classElement].msgEnd
if (message[classElement].msgEnd === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
timeText.value = MsToText(message[classElement].textMilliseconds)
Expand Down Expand Up @@ -179,7 +179,7 @@ selectorLang.addEventListener('change', () => {
})

controlButton.addEventListener('click', () => {
if (controlButton.textContent === translateElements.timer.buttons.start) {
if (controlButton.textContent === translateElements.timer.buttons.start || 'n/a') {
socket.send(JSON.stringify({ action: 'startTimer', classElement }))
} else {
socket.send(JSON.stringify({ action: 'pauseExtensible', classElement }))
Expand Down Expand Up @@ -248,7 +248,7 @@ checkboxPauseAdd.addEventListener('change', () => {
})

textMsg.addEventListener('focus', () => {
if (textMsg.textContent === translateElements.timer.phMsgEnd) {
if (textMsg.textContent === translateElements.timer.phMsgEnd || 'n/a') {
textMsg.textContent = ''
textMsg.style.color = '#000'
}
Expand All @@ -257,7 +257,7 @@ textMsg.addEventListener('focus', () => {
textMsg.addEventListener('blur', () => {
socket.send(JSON.stringify({ action: 'editMsg', msg: textMsg.textContent, classElement }))
if (textMsg.textContent === '') {
textMsg.textContent = translateElements.timer.phMsgEnd
textMsg.textContent = translateElements.timer.phMsgEnd || 'n/a'
textMsg.style.color = '#555'
} else { textMsg.style.color = '#000' }
})
Expand Down Expand Up @@ -362,17 +362,17 @@ function updateControlButton (status) {
controlButton.style.width = maxWidth

if (status === 'started') {
controlButton.textContent = translateElements.timer.buttons.pause
controlButton.textContent = translateElements.timer.buttons.pause || 'n/a'
} else {
controlButton.textContent = translateElements.timer.buttons.start
controlButton.textContent = translateElements.timer.buttons.start || 'n/a'
}
}

function getMaxButtonWidth () {
const widths = []

Object.keys(translateElements.timer.buttons).forEach((value) => {
controlButton.textContent = translateElements.timer.buttons[value]
controlButton.textContent = translateElements.timer.buttons[value] || 'n/a'
widths.push(parseFloat(window.getComputedStyle(controlButton).getPropertyValue('width')))
})
// Get the maximum of the two widths
Expand Down