Bug 1104927 - UITour: Add Loop conversation view target for email/copy link buttons. r=Unfocused,mixedpuppy

This commit is contained in:
Matthew Noorenberghe 2014-12-11 21:05:54 -08:00
parent df3b4e7def
commit df034e2a1e
3 changed files with 26 additions and 5 deletions

View File

@ -669,6 +669,12 @@
if (event.target != otherWin.document)
return;
let detachEvent = new aChatbox.contentWindow.CustomEvent("socialFrameDetached", {
bubbles: true,
cancelable: true,
});
aChatbox.contentDocument.dispatchEvent(detachEvent);
otherWin.removeEventListener("load", _chatLoad, true);
let otherChatbox = otherWin.document.getElementById("chatter");
aChatbox.swapDocShells(otherChatbox);

View File

@ -828,9 +828,15 @@ let MozLoopServiceInternal = {
let window = chatbox.contentWindow;
window.addEventListener("unload", function onUnloadChat(evt) {
UITour.notify("Loop:ChatWindowClosed");
});
function socialFrameChanged(eventName) {
UITour.availableTargetsCache.clear();
UITour.notify(eventName);
}
window.addEventListener("socialFrameHide", socialFrameChanged.bind(null, "Loop:ChatWindowHidden"));
window.addEventListener("socialFrameShow", socialFrameChanged.bind(null, "Loop:ChatWindowShown"));
window.addEventListener("socialFrameDetached", socialFrameChanged.bind(null, "Loop:ChatWindowDetached"));
window.addEventListener("unload", socialFrameChanged.bind(null, "Loop:ChatWindowClosed"));
injectLoopAPI(window);

View File

@ -142,6 +142,16 @@ this.UITour = {
return loopBrowser.contentDocument.querySelector(".room-list");
},
}],
["loop-selectedRoomButtons", {
infoPanelPosition: "leftcenter bottomright",
query: (aDocument) => {
let chatbox = aDocument.querySelector("chatbox[src^='about\:loopconversation'][selected]");
if (!chatbox || !chatbox.contentDocument) {
return null;
}
return chatbox.contentDocument.querySelector(".call-action-group");
},
}],
["loop-signInUpLink", {
query: (aDocument) => {
let loopBrowser = aDocument.querySelector("#loop-notification-panel > #loop");
@ -1375,8 +1385,7 @@ this.UITour = {
hideLoopPanelAnnotations: function(aEvent) {
UITour.hideAnnotationsForPanel(aEvent, (aTarget) => {
// TODO: Bug 1104927 - Handle the conversation targets separately.
return aTarget.targetName.startsWith("loop-");
return aTarget.targetName.startsWith("loop-") && aTarget.targetName != "loop-selectedRoomButtons";
});
},