Merge pull request #276 from mozilla/disable-move-242

for #242: disable move when incompatible add-ons detected
This commit is contained in:
luke crouch
2017-02-27 15:19:54 -06:00
committed by GitHub
3 changed files with 55 additions and 9 deletions
+7 -1
View File
@@ -427,7 +427,13 @@ span ~ .panel-header-text {
margin-block-start: 4px;
}
.container-info-tab-row:not(.clickable) {
#container-info-movetabs-incompat {
font-size: 10px;
opacity: 0.3;
}
.container-info-tab-row:not(.clickable),
.select-row:not(.clickable) {
opacity: 0.3;
}
+30 -7
View File
@@ -302,13 +302,36 @@ Logic.registerPanel(P_CONTAINER_INFO, {
});
});
document.querySelector("#container-info-movetabs").addEventListener("click", () => {
return browser.runtime.sendMessage({
method: "moveTabsToWindow",
userContextId: Logic.currentIdentity().userContextId,
}).then(() => {
window.close();
});
// Check if the user has incompatible add-ons installed
browser.runtime.sendMessage({
method: "checkIncompatibleAddons"
}).then(incompatible => {
const moveTabsEl = document.querySelector("#container-info-movetabs");
if (incompatible) {
const fragment = document.createDocumentFragment();
const incompatEl = document.createElement("div");
moveTabsEl.classList.remove("clickable");
moveTabsEl.setAttribute("title", "Moving container tabs is incompatible with Pulse, PageShot, and SnoozeTabs.");
fragment.appendChild(incompatEl);
incompatEl.setAttribute("id", "container-info-movetabs-incompat");
incompatEl.innerText = "Incompatible with other Experiments.";
incompatEl.classList.add("container-info-tab-row");
moveTabsEl.parentNode.insertBefore(fragment, moveTabsEl.nextSibling);
} else {
moveTabsEl.addEventListener("click", () => {
return browser.runtime.sendMessage({
method: "moveTabsToWindow",
userContextId: Logic.currentIdentity().userContextId,
}).then(() => {
window.close();
});
});
}
}).catch(() => {
throw new Error("Could not check for incompatible add-ons.");
});
},