Widget:File upload: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 36: | Regel 36: | ||
var regex = /<(\w+)>/gm; | var regex = /<(\w+)>/gm; | ||
var m; | var m; | ||
+ | var name = filenem.split('.')[0]; | ||
+ | var type = filenem.split('.')[1]; | ||
while ((m = regex.exec(settingsFilename)) !== null) { | while ((m = regex.exec(settingsFilename)) !== null) { | ||
Regel 47: | Regel 49: | ||
if(match == "FILENAME"){ | if(match == "FILENAME"){ | ||
− | output = output.replace('<'+match+'>', | + | output = output.replace('<'+match+'>', name); |
}else{ | }else{ | ||
var input = fileInput.closest('form').querySelector('[name="'+match+'"]'); | var input = fileInput.closest('form').querySelector('[name="'+match+'"]'); | ||
Regel 59: | Regel 61: | ||
}); | }); | ||
} | } | ||
− | return output; | + | return output+'.'+type; |
} | } | ||
Regel 66: | Regel 68: | ||
var regex = /<(\w+)>/gm; | var regex = /<(\w+)>/gm; | ||
var m; | var m; | ||
+ | var name = filenem.split('.')[0]; | ||
+ | var type = filenem.split('.')[1]; | ||
while ((m = regex.exec(settingsFilepageparameters)) !== null) { | while ((m = regex.exec(settingsFilepageparameters)) !== null) { | ||
Regel 77: | Regel 81: | ||
if(match == "FILENAME"){ | if(match == "FILENAME"){ | ||
− | output = output.replace('<'+match+'>', | + | output = output.replace('<'+match+'>', name); |
}else{ | }else{ | ||
var input = fileInput.closest('form').querySelector('[name="'+match+'"]'); | var input = fileInput.closest('form').querySelector('[name="'+match+'"]'); | ||
Regel 92: | Regel 96: | ||
output = output.replace(';','|'); | output = output.replace(';','|'); | ||
if(caption){ | if(caption){ | ||
− | output = '{{'+settingsFilepagetemplate+'|'+output+'|caption='+caption+'}}'; | + | output = '{{'+settingsFilepagetemplate+'|'+output+'|caption='+caption+'|type='+type+'}}'; |
}else{ | }else{ | ||
− | output = '{{'+settingsFilepagetemplate+'|'+output+'}}'; | + | output = '{{'+settingsFilepagetemplate+'|'+output+'|type='+type+'}}'; |
} | } | ||
return output; | return output; |
Versie van 7 sep 2020 10:07
This is the Widget:Multi upload page. It should be called in the following format:
{{#widget:Multi upload }}