Skip to content

Commit

Permalink
Checking for multiple script tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin-Fredericks committed Aug 31, 2023
1 parent 12ae29f commit baee3b2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions hx.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,19 @@ var HXGlobalJS = function () {
}
});

let hx_js_script_src = hx_js_script_tag[0].attributes.src.value.replace(
'hx.js',
''
);
if (hx_js_script_tag.length === 1) {
script_asset_url = hx_js_script_src;
// If there's no script tag, we are running locally from /static/
if (hx_js_script_tag.length === 0) {
script_asset_url = course_asset_url;
} else {
script_asset_url = hx_js_script_tag[0].attributes.src.value.replace(
'hx.js',
''
);
}
if (hx_js_script_tag.length > 1){
logThatThing({ error: 'More than one hx.js script tag on this page.' });
}

logThatThing({ 'script asset url': script_asset_url });

// Are we in Studio? If so, stop trying to run anything. Just quit.
Expand Down

0 comments on commit baee3b2

Please sign in to comment.