Widget:File upload: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 62: | Regel 62: | ||
} | } | ||
− | function createWikitext(filename){ | + | function createWikitext(filename, caption){ |
var output = settingsFilepageparameters; | var output = settingsFilepageparameters; | ||
var regex = /<(\w+)>/gm; | var regex = /<(\w+)>/gm; | ||
Regel 91: | Regel 91: | ||
output = output.replace(':','='); | output = output.replace(':','='); | ||
output = output.replace(';','|'); | output = output.replace(';','|'); | ||
− | output = '{{'+settingsFilepagetemplate+'|'+output+'}}'; | + | if(caption){ |
+ | output = '{{'+settingsFilepagetemplate+'|'+output+'|caption='+caption+'}}'; | ||
+ | }else{ | ||
+ | output = '{{'+settingsFilepagetemplate+'|'+output+'}}'; | ||
+ | } | ||
return output; | return output; | ||
} | } | ||
Regel 194: | Regel 198: | ||
var caption = document.querySelector('[data="'+file+'"]').value; | var caption = document.querySelector('[data="'+file+'"]').value; | ||
− | |||
− | |||
− | |||
− | var newWikitextEdit = | + | var newWikitextEdit = createWikitext(file, caption); |
var params = { | var params = { | ||
action: 'edit', | action: 'edit', | ||
− | title: 'File:'+createFilename( | + | title: 'File:'+createFilename(file), |
text: newWikitextEdit, | text: newWikitextEdit, | ||
format: 'json' | format: 'json' |
Versie van 7 sep 2020 09:46
This is the Widget:Multi upload page. It should be called in the following format:
{{#widget:Multi upload }}