Skip to content

Commit

Permalink
πŸ’„ update main.js
Browse files Browse the repository at this point in the history
improved the method readability
  • Loading branch information
TheCubiq committed Aug 21, 2022
1 parent 475b9b3 commit 6936f25
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,14 @@ new MutationObserver(function () {


const vizzardReload = () => {
// check if we are in an editor by searching for an element #editor-base
// inject scripts that will run on any vizzy page
makeLogoClickable();

const editorBase = Selectors().editor;
if (!editorBase) {
// console.log("not in editor");
return;
}

// make sure we are in an editor
// make sure that the vizzard is not already injected
if (editorBase.classList.contains("vizzard-injected")) {
// console.log("vizzard is already injected");
return
}

if (!editorBase || editorBase?.classList.contains("vizzard-injected")) return;

// inject vizzard
injectVizzard();
editorBase.classList.add("vizzard-injected");
Expand Down

0 comments on commit 6936f25

Please sign in to comment.