class AcpUiDevtoolsProjectSync {
private readonly buttons = new Map<string, HTMLButtonElement>();
private readonly buttonStatus = new Map<string, HTMLElement>();
- private buttonSyncAll?: HTMLAnchorElement = undefined;
+ private readonly buttonSyncAll: HTMLButtonElement = document.getElementById("devtoolsSyncAll") as HTMLButtonElement;
private readonly container = document.getElementById("syncPipMatches")!;
private readonly pips: PipData[] = [];
private readonly projectId: number;
}
}
- const syncAll = document.createElement("li");
- syncAll.innerHTML = `<a href="#" class="button"><fa-icon name="arrows-rotate" solid></fa-icon> ${Language.get(
- "wcf.acp.devtools.sync.syncAll",
- )}</a>`;
- this.buttonSyncAll = syncAll.children[0] as HTMLAnchorElement;
- this.buttonSyncAll.addEventListener("click", this.syncAll.bind(this));
-
- const list = document.querySelector(".contentHeaderNavigation > ul") as HTMLUListElement;
- list.insertAdjacentElement("afterbegin", syncAll);
+ this.buttonSyncAll.addEventListener("click", () => this.syncAll());
}
private sync(pluginName: string, target: string): void {
});
}
- private syncAll(event: MouseEvent): void {
- event.preventDefault();
-
- if (this.buttonSyncAll!.classList.contains("disabled")) {
+ private syncAll(): void {
+ if (this.buttonSyncAll.classList.contains("disabled")) {
return;
}
- this.buttonSyncAll!.classList.add("disabled");
+ this.buttonSyncAll.classList.add("disabled");
this.queue = [];
this.pips.forEach((pip) => {
private syncNext(): void {
if (this.queue.length === 0) {
- this.buttonSyncAll!.classList.remove("disabled");
+ this.buttonSyncAll.classList.remove("disabled");
UiNotification.show();
}
});
- this.buttonSyncAll!.classList.remove("disabled");
+ this.buttonSyncAll.classList.remove("disabled");
return true;
}
<nav class="contentHeaderNavigation">
<ul>
{if $object->validate() === ''}
+ <li>
+ <button class="button" id="devtoolsSyncAll">
+ {icon name='arrows-rotate' type='solid'}
+ {lang}wcf.acp.devtools.sync.syncAll{/lang}
+ </button>
+ </li>
<li><a href="{link controller='DevtoolsProjectPipList' id=$object->getObjectID()}{/link}" class="button">{icon name='list'} <span>{lang}wcf.acp.devtools.project.pips{/lang}</span></a></li>
{/if}
<li><a href="{link controller='DevtoolsProjectEdit' id=$object->getObjectID()}{/link}" class="button">{icon name='pencil'} <span>{lang}wcf.acp.devtools.project.edit{/lang}</span></a></li>
class AcpUiDevtoolsProjectSync {
buttons = new Map();
buttonStatus = new Map();
- buttonSyncAll = undefined;
+ buttonSyncAll = document.getElementById("devtoolsSyncAll");
container = document.getElementById("syncPipMatches");
pips = [];
projectId;
break;
}
}
- const syncAll = document.createElement("li");
- syncAll.innerHTML = `<a href="#" class="button"><fa-icon name="arrows-rotate" solid></fa-icon> ${Language.get("wcf.acp.devtools.sync.syncAll")}</a>`;
- this.buttonSyncAll = syncAll.children[0];
- this.buttonSyncAll.addEventListener("click", this.syncAll.bind(this));
- const list = document.querySelector(".contentHeaderNavigation > ul");
- list.insertAdjacentElement("afterbegin", syncAll);
+ this.buttonSyncAll.addEventListener("click", () => this.syncAll());
}
sync(pluginName, target) {
const identifier = this.getButtonIdentifier(pluginName, target);
},
});
}
- syncAll(event) {
- event.preventDefault();
+ syncAll() {
if (this.buttonSyncAll.classList.contains("disabled")) {
return;
}