mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-06-15 04:31:06 +00:00
prevent js from being executed multiple times
This commit is contained in:
parent
2d30ff934e
commit
e18320acb3
1 changed files with 5 additions and 4 deletions
|
|
@ -4,13 +4,15 @@ import chroma from "chroma-js";
|
|||
import $ from "jquery";
|
||||
import moment from "moment";
|
||||
|
||||
// Break if Dribbblish has already been initialized
|
||||
if ($("html").attr("dribbblish-js-installed") != undefined) throw new Error("Dribbblish has already been initialized");
|
||||
// Remove not installed message
|
||||
$("html").attr("dribbblish-js-installed", " ");
|
||||
|
||||
import { waitForElement, copyToClipboard, capitalizeFirstLetter, getClosestToNum, randomFromArray, debounce } from "./Util";
|
||||
import { default as _Dribbblish } from "./Dribbblish";
|
||||
import "./Folders";
|
||||
|
||||
// Remove not installed message
|
||||
$("html").attr("dribbblish-js-installed", " ");
|
||||
|
||||
// To expose to external scripts
|
||||
const Dribbblish = new _Dribbblish();
|
||||
window.Dribbblish = Dribbblish;
|
||||
|
|
@ -64,7 +66,6 @@ Dribbblish.on("ready", () => {
|
|||
defaultValue: true,
|
||||
onChange: (val) => $("#main").attr("search-box", val ? "" : null),
|
||||
onAppended: () => {
|
||||
if ($("#dribbblish-search-box").length != 0) return;
|
||||
const input = document.createElement("input");
|
||||
input.id = "dribbblish-search-box";
|
||||
input.type = "search";
|
||||
|
|
|
|||
Loading…
Reference in a new issue