Skip to content

Commit

Permalink
! Do not call the function if its not available (such as ACP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spuds committed Jan 8, 2024
1 parent 52f2321 commit c423ff7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions themes/default/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,12 @@ public function addCodePrettify()
loadJavascriptFile('prettify.min.js', array('defer' => true));

addInlineJavascript('
document.addEventListener("DOMContentLoaded", () => {prettyPrint();});', true);
document.addEventListener("DOMContentLoaded", () => {
if (typeof prettyPrint === "function")
{
prettyPrint();
}
});', true);
}
}

Expand All @@ -606,7 +611,12 @@ public function autoEmbedVideo()
tiktok : ' . JavaScriptEscape($txt['tiktok']) . ',
dailymotion : ' . JavaScriptEscape($txt['dailymotion']) . '
});
document.addEventListener("DOMContentLoaded", () => {$().linkifyvideo(oEmbedtext);});', true);
document.addEventListener("DOMContentLoaded", () => {
if ($.isFunction($.fn.linkifyvideo))
{
$().linkifyvideo(oEmbedtext);
}
});', true);
}
}

Expand Down

0 comments on commit c423ff7

Please sign in to comment.