Added translations for hints

Added toast exception for hide toast on click
This commit is contained in:
RemixDev 2020-07-25 17:22:31 +02:00
parent 8a3eded47a
commit a0d23f5a39
3 changed files with 17 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -7,10 +7,10 @@ const it = {
by: 'di {0}', by: 'di {0}',
in: 'in {0}', in: 'in {0}',
download_hint: 'Scarica', download_hint: 'Scarica',
play_hint: 'Play', play_hint: 'Riproduci',
toggle_download_tab_hint: 'Expand/Collapse', toggle_download_tab_hint: 'Espandi/Riduci',
clean_queue_hint: 'Clear Finished', clean_queue_hint: 'Pulisci Lista',
cancel_queue_hint: 'Cancel All', cancel_queue_hint: 'Cancella tutti i download',
listTabs: { listTabs: {
all: 'tutto', all: 'tutto',
top_result: 'miglior risultato', top_result: 'miglior risultato',

View File

@ -18,6 +18,7 @@ export const toast = function(msg, icon = null, dismiss = true, id = null) {
toastDOM.find('.toast-icon').html(icon) toastDOM.find('.toast-icon').html(icon)
} }
if (dismiss !== null && dismiss) { if (dismiss !== null && dismiss) {
toastDOM.addClass('dismissable')
setTimeout(function() { setTimeout(function() {
toastObj.hideToast() toastObj.hideToast()
delete toastsWithId[id] delete toastsWithId[id]
@ -32,8 +33,16 @@ export const toast = function(msg, icon = null, dismiss = true, id = null) {
duration: dismiss ? 3000 : 0, duration: dismiss ? 3000 : 0,
gravity: 'bottom', gravity: 'bottom',
position: 'left', position: 'left',
className: dismiss ? 'dismissable' : '',
onClick: function(){ onClick: function(){
if (toastObj) { let dismissable = true
if (id){
let toastClasses = document.querySelector(`div.toastify[toast_id=${id}]`).classList
if (toastClasses){
dismissable = toastClasses.indexOf('dismissable') != -1
}
}
if (toastObj && dismissable) {
toastObj.hideToast() toastObj.hideToast()
} }
} }