Trying to fix the JavaScript error in inline gallery (#859)