“
Save time by making it easy to scan all the latest stories on topics you follow in one place.
“,
“
“,
“
”
].join(“”);
var content2 = [
““,
“
“
Adding topics. Click on the + symbol to save the topic to your Following page.
“,
“
“,
“
(Step 1 of 3)
“,
“
“,
““,
““,
“
”
].join(“”);
var content3 = [
““,
“
“
Clicking on the topic’s name will bring you to a page where you can view all the articles that pertain to that topic.
“,
“
“,
“
(Step 2 of 3)
“,
“
“,
““,
““,
“
”
].join(“”);
var content4 = [
““,
“
““,
“
Access your following topics by clicking on your display name. The number in your display name indicates the number of new articles you haven’t read from your following topics.
“,
“
“,
“
(Step 3 of 3)
“,
“
“,
““,
““,
“
”
].join(“”);
var contentMarkup = [content1, content2, content3, content4];
function createTourtip() {
var relatedTopics = document.querySelector(“#main-content-area .pb-f-topics-article-related .c-topic-group__body ul”);
var topicPageTitle = document.querySelector(“.o-primary-header–section .c-topic”);
// If the following topics buttons are present on the page, set up the tourtips
if (relatedTopics || topicPageTitle) {
var modifier = relatedTopics ? ‘darwin-arc6134–article’ : ‘darwin-arc6134–topic-page’
var dataAnalyticsClick = JSON.stringify({
testId: “arc6134”,
type: “button”,
feature: “topic tour tip”,
label: “show tooltip”
});
var el = relatedTopics ? document.createElement(“li”) : document.createElement(“div”);
el.classList.add(“darwin-arc6134”);
el.classList.add(modifier);
el.innerHTML = “
“+contentMarkup[0] + “
“;
relatedTopics ? relatedTopics.appendChild(el) : topicPageTitle.appendChild(el);
// Remove follow topics onboarding messages and activation tooltips
setTimeout(function() {
var onboardingMessages = document.querySelectorAll(“.c-topic-group__body .c-onboarding-message”);
var tooltips = document.querySelectorAll(“.c-topic-group__body .c-tooltip”);
console.log(“[ARC-6134]: onboardingMessages: “, onboardingMessages);
Array.from(onboardingMessages).forEach(function(el) {
el.parentNode.removeChild(el);
});
Array.from(tooltips).forEach(function(el) {
el.parentNode.removeChild(el);
});
}, 3000);
}
}
function analyticsPush(type, panel, action) {
if (type === “simple”) {
analyticsLayer.push({
“event”: “simpleEvent”,
“simpleEvent”: {
“testId”: “arc6134”,
“action”: “view tour slide”,
“label”: “slide “+panel
}
});
}
if (type === “click”) {
analyticsLayer.push({
“event”:”clickEvent”,
“clickEvent”: {
“testId”: “arc6134”,
“feature”: “topic tour tip”,
“type”: “button”,
“label”: action,
}
});
}
}
function tourtipActions() {
// Open tourtips
var container = document.querySelector(“.darwin-arc6134”);
var activateIcon = document.querySelector(“.js-tourtip-activate”);
var tourtipContainer = document.querySelector(“.darwin-arc6134__tourtip”);
activateIcon.addEventListener(“click”, function() {
if (!container.classList.contains(“darwin-arc6134–open”)) {
container.classList.add(“darwin-arc6134–open”);
tourtipContainer.removeAttribute(“hidden”);
keepInViewport();
localStorage.setItem(“tgam.tourtip_icon_clicked”, true);
analyticsPush(“click”, 1, “show tooltip”);
analyticsPush(“simple”, 1, “”);
}
});
// Advance tourtip panels
tourtipContainer.addEventListener(‘click’, function(e) {
var tourtipPanel = tourtipContainer.getAttribute(“data-panel”);
var activateIcon = document.querySelector(“.js-tourtip-activate”);
var el = e.target || e.srcElement;
var action = el.getAttribute(“data-action”);
if (action === “next”) {
tourtipPanel++;
analyticsPush(“simple”, tourtipPanel, action);
} else if (action === “prev”) {
tourtipPanel–;
analyticsPush(“simple”, tourtipPanel, action);
} else {
tourtipPanel = 1;
tourtipContainer.setAttribute(“hidden”, true);
container.classList.remove(“darwin-arc6134–open”);
tourtipContainer.classList.remove(“darwin-arc6134__tourtip–leftOut”);
tourtipContainer.classList.remove(“darwin-arc6134__tourtip–rightOut”);
activateIcon.classList.remove(“darwin-arc6134__tourtip–leftOut”);
activateIcon.classList.remove(“darwin-arc6134__tourtip–rightOut”);
tourtipContainer.classList.remove(“js-tourtip–centred”);
tourtipContainer.style.removeProperty(“left”);
}
analyticsPush(“click”, tourtipPanel, action);
tourtipPanel === 4 ? tourtipContainer.classList.add(“darwin-arc6134__tourtip–last-panel”) : tourtipContainer.classList.remove(“darwin-arc6134__tourtip–last-panel”);
tourtipContainer.innerHTML = contentMarkup[tourtipPanel-1];
tourtipContainer.dataset.panel = tourtipPanel;
});
}
function init() {
console.log(“[ARC-6134] init”);
var testIsEnabled = /token=arc6134/.test(window.location.search);
console.log(“ARC-6134 testIsEnabled: “, testIsEnabled);
var testGroup = userTestGroup();
if (testGroup === “variant” || testIsEnabled) {
setUnitState(“arc6134”, “variant”);
console.log(“[ARC-6134] test group: variant”);
createTourtip();
tourtipActions();
intersectTourtip();
}
if (testGroup === “control”) {
console.log(“[ARC-6134] test group: control”);
setUnitState(“arc6134”, “control”);
}
}
init();
}]);
}
window.tgam.darwin.tests.after.push(dwExecute_UXTestARC6134);
})();
]]>