fix logic for append_javascript

PR #2911 results in appending javascript even if dynamic is false, so in
current master all javascript outputs are actually run at load.