Difference between revisions of "User:Fbstj/gadget/history-test.js"

m
try this
m (don't change page when no new files)
m (try this)
// don't change the page if there's nothing to change
if (new_files.length == 0) { return; }
if (edit.value += "\n\n<gallery>\n"+ new_files.joinincludes("\n") +"\n'</gallery>\n"')) {
// add the lines to the end of the current gallery
edit.value.replace('</gallery>', new_files.join("\n") +"\n</gallery>")
} else {
// create a gallery at the bottom of the page
edit.value += "\n\n<gallery>\n"+ new_files.join("\n") +"\n</gallery>\n"
}
})