Skip to content

Commit

Permalink
change JS loading (part of #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Jan 21, 2020
1 parent b25c081 commit 4dbaa70
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Drafts/resources/assets/js/cp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
window.addEventListener("DOMContentLoaded", function () {
if (document.readyState !== 'loading') {
addDrafts();
} else {
document.addEventListener('DOMContentLoaded', function () {
addDrafts();
});
}

function addDrafts() {
let html = `
<button aria-expanded="false" aria-haspopup="true" class="btn dropdown-toggle" data-toggle="dropdown" type="button">
<span class="caret"></span> <span class="sr-only">Toggle Dropdown</span>
Expand All @@ -13,4 +21,4 @@ window.addEventListener("DOMContentLoaded", function () {
buttonGroup
.addClass('btn-group')
.append(html);
});
}

0 comments on commit 4dbaa70

Please sign in to comment.