Breaking News

Report on Enterprise

0 0

-1&&window.location.href.indexOf(“cem1809”)>-1){var variant=localStorage.getItem(“Dw__header-cem1809|international”);var regwallbtn=doc.getElementsByClassName(“js-newsletter-wall-register”);var registerbtn=doc.getElementsByClassName(“js-onclick–register”);if(registerbtn)for(i=0;i

-1;var isSection=window.tgam.meta.isSectionPage===true;var isHermes=tgam.datalayer.hermesData;var meterCount=localStorage.getItem(“tgam.keytar.wall.subscriber.free”);var isArticle=window.location.href.indexOf(“/article”)>-1;var isPaywallArticle=isArticle?isHermes?getSegment(“hermesData.wall”,”redwall”):getSegment(“article.paywallStatus”, “crimson”)||getSegment(“article.paywallStatus”,”yellow”)&&meterCount!==null&&JSON.parse(meterCount).break up(/[(,*?)]/).size===6:false;var isRegwallArticle=isArticle?isHermes?getSegment(“hermesData.wall”,”regwall”):getSegment(“article.paywallStatus”,”crimson”)||getSegment(“article.paywallStatus”,”yellow”)&&meterCount!==null&&JSON.parse(meterCount).break up(/[(,*?)]/).size===3:false;var isNotAdv=isArticle?getSegment(“article.advContent”,false):true;var depend=depend||1;if(darwinState.hasOwnProperty(“cem1806”)&& depend==1&&darwinState.cem1806.variant){depend+=1;setDarwinVariant(“pencil-cem1806”,darwinState.cem1806.variant)}console.log(“cem-1806 phase begin: “,isNotSubscriber&&notIE&&isNotInteractive&&isNotPb&&isNotProduct&&(isQA||(isSection||!isPaywallArticle&&!isRegwallArticle))&&isNotAdv);return isNotSubscriber&&notIE&&isNotInteractive&&isNotPb&&isNotProduct&&(isQA||(isSection||!isPaywallArticle&&!isRegwallArticle))&&isNotAdv})}])}window.tgam.darwin.exams.segments.push(dwSegment_pencilcem1806);operate dwExecute_pencilcem1806(knowledge){window._dw.push([“global”, “ready”,function onReady(api){var variant=api.get(“pencil-cem1806”);var variantData=data;if(variant.is(“control”)){console.info(“pencils:cem-1806:control”);setUnitState(“cem1806″,”control”);updateHolidayPencil(“control”)}if(variant.is(“experience”)){console.info(“pencils:cem-1806:experience”);setUnitState(“cem1806″,”experience”);if(/CEMQA1806control/.test(window.location.search))updateHolidayPencil(“control”);else updateHolidayPencil(“experience”)}}])}window.tgam.darwin.exams.earlier than.push(dwExecute_pencilcem1806)})();]]> 0||doc.documentElement.scrollTop>0){if(doc.getElementById(“fixedpencil”).classList.incorporates(“collapse”)&&expand_subs){expand_subs=false;expandsubs()}}else if(doc.getElementById(“fixedpencil”).classList.incorporates(“develop”)){expand_subs=true;collapsesubs()}}); operate expandsubs(){doc.getElementById(“fixedpencil”).classList.take away(“collapse”);doc.getElementById(“fixedpencil”).className+=” develop”}operate collapsesubs(){doc.getElementById(“fixedpencil”).classList.take away(“develop”);doc.getElementById(“fixedpencil”).className+=” collapse”};]]>

-1; const isNotInteractive = window.location.href.indexOf(‘/article’) > -1 ? (!getSegment(‘article.pagesubtype’, ‘interactive’) && !getSegment(‘article.pagesubtype’, ‘longread’)) : true; const isDesktop = doc.documentElement.clientWidth>=768; var depend = depend || 1; if (darwinState.hasOwnProperty(‘cem1666’) && depend === 1 && darwinState.cem1666.variant) { depend += 1; setDarwinVariant(‘products-cem1666’, darwinState.cem1666.variant); } return (isQA || isNotSubscriber) && isNotPb && isNotInteractive && isDesktop; }); }]); } window.tgam.darwin.exams.segments.push(dwSegment_productscem1666); operate dwExecute_productscem1666(knowledge) { window._dw.push([‘global’, ‘ready’, function onReady(api) { var variant = api.get(“products-cem1666”); var variantData = data; if (variant.is(‘control’)) { console.info(‘products:cem-1666:control’); setUnitState(“cem1666”, “control”); } if (variant.is(‘experience’)) { console.info(‘products:cem-1666:experience’); setUnitState(“cem1666”, “experience”); updateSubscribeBtn(); } }]); } window.tgam.darwin.exams.earlier than.push(dwExecute_productscem1666); })(); ]]>

7&&/arc6735group=/.check(window.location.search))tenure=1;var firstVisits=tenure?tenure

tenMinutes); var showPublishedDateAsMoment = publishedLessThanThreeDaysAgo; var showUpdatedDateAsMoment = !isSectionPageContext && storyHasBeenUpdatedMoreThanTenMinutesSincePublication && updatedWasLessThanThreeDaysAgo; var subject = “printed”; // Which fields to indicate (printed, up to date, or each) var second = null; // Which fields to indicate in relative date (i.e., second) format if (storyHasBeenUpdatedMoreThanTenMinutesSincePublication) { if (publishedAndUpdatedAreTheSameDay && timeSinceUpdate < oneDay) { subject = "each"; // Don't present up to date date because it's the identical as printed date. } } if (showUpdatedDateAsMoment) { second = "up to date"; if (showPublishedDateAsMoment) { second = "each"; } } else if (showPublishedDateAsMoment) { second = "printed"; } return { printed: formattedPubDate, up to date: formattedUpDate, subject: subject, second: second }; } // Present "time in the past" timestamp operate humanTime(left, proper) { var quantity = parseInt(proper - left).toFixed(0); var ONE_MINUTE = 60; var ONE_HOUR = 3600; var ONE_DAY = 86400; var THREE_DAYS = 259200; var plural; if (quantity < ONE_MINUTE) { plural = quantity === 1 ? "" : "s"; return quantity + " second" + plural + " in the past"; } if (quantity = ONE_HOUR && quantity = ONE_DAY && quantity < THREE_DAYS) { amount = Math.round(amount / ONE_DAY); plural = amount === 1 ? "" : "s"; return amount + " day" + plural + " ago"; } return ""; } // Calculate time since published function since(storyDate) { var left = new Date(storyDate).getTime() / 1000; var right = Date.now() / 1000; return humanTime(left, right); } // ************************************************ // Following functionality // ************************************************ /** * Attach event listeners to following icons/buttons */ function addFollowingFunctionality() { var btns = qsa(".c-your-globe__overlay .c-topic-button"); if (!btns.length) { return; } btns.forEach(function fn(btn) { btn.addEventListener("mouseover", function fn() { btn.classList.remove("js-topic-clicked"); buttonToggle(btn, "over"); }); btn.addEventListener("mouseout", function fn() { buttonToggle(btn, "out"); }); btn.addEventListener("click", function fn() { updateFollowUnfollowStatus(btn); btn.classList.add("js-topic-clicked"); }); }); } /** * Follow or unfollow a topic * @param {HTMLElement} el - button element */ function updateFollowUnfollowStatus(el) { var status = el.getAttribute("data-status"); var topicSlug = el.getAttribute("data-slug"); var topicName = el.getAttribute("data-topic"); var isFollowingAuthor = el.dataset.topicType === "author"; var topicType = isFollowingAuthor ? "author" : "topic"; var action = status === "following" ? "unfollow" : "follow"; followUnfollowTopic(action, topicSlug, isFollowingAuthor) .then(function fn(res) { console.info("[ARC-6637] fetch success: ", res); var setStatus = "following"; var text = "following"; var ariaLabelText = "Unfollow this " + topicType + ": " + topicName; if (status === "following") { setStatus = "unfollowing"; text = "Follow"; ariaLabelText = "Follow this " + topicType + ": " + topicName; } analyticsLayer.push({ "event": "clickEvent", "clickEvent": { "type": "button", "feature": isFollowingAuthor ? "author" : "topic", "label": topicName.toLowerCase(), "action": action } }); el.dataset.status = setStatus; el.setAttribute("aria-label", ariaLabelText); qs(".c-button__text", el).innerText = text; }); } /** * Update icon state on mouseover/mouseout * @param {HTMLElement} el - button element * @param {String} action - either "out" or "over" */ function buttonToggle(el, action) { var status = el.getAttribute("data-status"); var text = "Follow"; var hoverText = "Follow"; if (status === "following") { text = "Following"; hoverText = "Unfollow"; } if (action === "out" && !el.classList.contains("js-topic-clicked")) { qs(".c-button__text", el).innerText = text; } else if (action === "out" && el.classList.contains("js-topic-clicked") && status === "unfollowing") { qs(".c-button__text", el).innerText = "Follow"; } else if (action === "over") { qs(".c-button__text", el).innerText = hoverText; } } // ************************************************ // Helper functions to build the markup // ************************************************ /** * Generate latest stories after some filtering * @param {Array} latest - array of days * @returns {Array} of filtered articles */ function generateLatestStories(latest) { // Latest is an array of days, so we need to create a new array of stories from last three days var articles = latest.reduce(function fn(result, item) { return result.concat(item.items); }, []); // We need to display only five latest articles to the user return articles.slice(0, 5); } /** * For every topic - generate one unique story * @param {Array} topics - array of topics (with five stories for every topic) * @returns {Array} - array of topics with one unique story */ function generateUniqueStory(topics) { var uniqueArticles = topics.map(function fn(t) { t.items = t.items.slice(0, 1); // Only one story is needed return t; }); return uniqueArticles; } /** * Generates image template * @param {Object} image - to render * @returns {String} */ function displayImage(image) { var template = ""; if (image.path) { template = [ "", " ", " ", " ]]>“, “” ].be a part of(“”); } return template; } /** * Generate a template for the label * @param {String} label – the label textual content * @returns {String} */ operate displayLabel(label) { var template = “”; if (label === “opinion”) { template = [ “

“, ” “, label, “”, “

“, ].be a part of(“”); } return template; } /** * Show “Observe”, “Following” buttons * @param {Object} tData * @returns {String} */ operate displayFollowingButton(tData) { var topicName = tData.topicName; var topicSlug = tData.topicSlug; var topicType = tData.topicType; var topicImg = tData.topicImg; var isAuthor = topicType === “creator”; var authorImg = isAuthor && topicImg ? “” : “”; var template = isAuthor ? “/authors/” : “/subjects/”; var href = window.tgam.env.baseRootAbsoluteUrl + template + topicSlug; var linkClasses = isAuthor ? “c-topic-link c-topic-link–author” : “c-topic-link”; return [ ” “, ].be a part of(“”); } /** * Generates story card markup * @param {Object} article – to show * @param {Object} topicData – (topicName, topicSlug, topicType, topicVariation, topicImg) * @param {Boolean} addFollowButton * @returns {String} story card markup */ operate storyCard(article, topicData, addFollowButton) { console.information(“[ARC-6637] storyCard”, { article: article, matter: topicData }); if (!article || !topicData) { return “”; } var tName = topicData.topicName; var tType = topicData.topicType; var tVariation = topicData.topicVariation; var followingTopic; var timeTemplate; var analyticsModifier = tType + “: “; if (addFollowButton) { // Show a comply with button beside the subject title followingTopic = displayFollowingButton(topicData); timeTemplate = displayDateTag(article); } var label = getLabel(article); var picture = getImage(article, label); var labelTemplate = displayLabel(label); var imageTemplate = displayImage(picture); var headline = article.headlines.primary; var href = window.tgam.env.baseUrl + article.canonical_url; var sophiId = article._id; var dataAnalyticsClick = JSON.stringify({ sort: “hyperlink”, function: “following feed”, contentId: sophiId, label: analyticsModifier + tName.toLowerCase() + “: ” + headline.toLowerCase(), web page: “sec:homepage:personalised feed:” + tVariation, hierarchy: 1 }); var cardMarkup = “”; if (!followingTopic) { cardMarkup = [ “”, ” “, ”

“, ” “, tName, “”, ”

“, ”

“, ” “, headline, “”, ”

“, labelTemplate, ” “, ”

“, imageTemplate, “

“, “” ].be a part of(“”); } else { cardMarkup = [ ”

“, followingTopic, ”

“, ” “, ” “, ”

“, ” “, headline, “”, ”

“, ” “, timeTemplate, “”, ” “, ”

“, imageTemplate, “

“, ” “, ].be a part of(“”); } return [ ”

“, cardMarkup, ”

“, ].be a part of(“”); } /** * Provides the overlay set off dot class * @param {String} sort – “unread” or “no-follow” */ operate addOverlayTriggerDot(sort) { overlayTriggerDotClasses.forEach(operate fn(dotClass) { if (dotClass === “c-your-globe__trigger–dot–” + sort) { overlayTrigger.classList.add(dotClass); } else { overlayTrigger.classList.take away(dotClass); } }); overlayTrigger.classList.add(“c-your-globe__trigger–dot”); } /** * Removes the overlay set off dot class */ operate removeOverlayTriggerDot() { overlayTriggerDotClasses.forEach(operate fn(dotClass) { overlayTrigger.classList.take away(dotClass); }); overlayTrigger.classList.take away(“c-your-globe__trigger–dot”); } /** * Returns a heading ingredient to be displayed contained in the overlay * @param {String} textual content * @returns {String} */ operate overlayLabel(textual content) { return “

” + textual content + “

“; } var overlayHeadingHasFollowed = ( overlayLabel(“The newest in subjects and authors you comply with”) + “

View extra in Following

” ); var overlayHeadingNoFollowed = ( overlayLabel(“Get began: construct your private information feed”) + “

    ” + “

  1. Observe subjects related to your studying pursuits.
  2. ” + “

  3. Test again right here or your Following web page to view the newest articles in your subjects.
  4. ” + “

” ); var upToDateMessage = “

You’re updated in your Following feed. Test once more later for brand new tales.

“; // ************************************************ // Parse API response and inject markup into overlay // ************************************************ // Story card markup /** * Tales initially got here from the next places within the API response: * – knowledge.articles[i].objects[i].subjects * – knowledge.articles[i].objects[i].authors * @param {Array} tales * @returns {String} story card markup */ operate latestStoryCards(tales) { console.information(“[ARC-6637] Show newest tales based mostly on these tales:”, tales); var storyCards = tales.map(operate fn(story) { // The “subjects” and “authors” arrays will solely comprise one merchandise // (i.e. the subject or creator that the consumer is following) var matter; var topicData; if (story.subjects && story.subjects.size) { // Regular matter matter = story.subjects[0]; topicData = { topicName: matter.title, topicSlug: matter.slug, topicType: “matter”, topicVariation: “following” }; } else if (story.authors && story.authors.size) { // Writer matter matter = story.authors[0]; // Solely authors have photographs related to them – regular subjects don’t var authorImg = matter.metadata && matter.metadata.picture ? matter.metadata.picture : null; topicData = { topicName: matter.byline, topicSlug: matter.slug, topicType: “creator”, topicVariation: “following”, topicImg: authorImg }; } // Do not show a comply with button beside the subject as a result of the consumer is already following it return storyCard(story, topicData, false); }).be a part of(“”); return storyCards; } /** * @param {Array} subjects * @param {String} variation – “advisable” or “trending” (used for the clicking monitoring analytics) * @returns {String} story card markup */ operate recommendedTrendingStoryCards(subjects, variation) { var uniqueStories = generateUniqueStory(subjects); var storyCards = uniqueStories.map(operate fn(matter) { // Seize one article var story = matter.objects[0]; // Solely authors have photographs related to them – regular subjects don’t var authorImg = matter.authorTopic && matter.authorMetadata && matter.authorMetadata.picture ? matter.authorMetadata.picture : null; // Usually we might show the entire subjects which might be assigned to an article, however // this API teams articles by matter, so we solely have entry to that one matter. // Even when we may show extra subjects, we would not need to becuase having // a number of comply with buttons would junk up the UI. var topicData = { topicName: matter.title, topicSlug: matter.slug, topicType: matter.authorTopic ? “creator” : “matter”, topicVariation: variation, topicImg: authorImg }; // Show the comply with button beside the subject as a result of we’re suggesting new subjects to comply with return storyCard(story, topicData, true); }).be a part of(“”); return storyCards; } /** * Matters initially got here from the next places within the API response: * – knowledge.recommendedAuthors * – knowledge.recommendedTopics * @param {Array} subjects * @returns {String} story card markup */ operate recommendedStoryCards(subjects) { console.information(“[ARC-6637] Show advisable tales based mostly on these subjects:”, subjects); return recommendedTrendingStoryCards(subjects, “advisable”); } /** * Matters initially got here from the next location within the API response: * – knowledge.trendingTopics * @param {Array} subjects * @returns {String} story card markup */ operate trendingStoryCards(subjects) { console.information(“[ARC-6637] Show trending tales based mostly on these subjects:”, subjects); return recommendedTrendingStoryCards(subjects, “trending”); } // Markup contained in the overlay /** * @param {Array} tales * @returns {Object} markup for the overlay’s header and physique content material areas */ operate showLatestStories(tales) { console.information(“[ARC-6637] State of affairs: newest tales”); var storyCardsMarkup = latestStoryCards(tales); return { header: overlayHeadingHasFollowed, physique: storyCardsMarkup }; } /** * @param {Array} subjects * @returns {Object} markup for the overlay’s header and physique content material areas */ operate upToDateShowRecommended(subjects) { console.information(“[ARC-6637] State of affairs: updated, present advisable”); var storyCardsMarkup = recommendedStoryCards(subjects); return { header: overlayHeadingHasFollowed, physique: ( upToDateMessage + overlayLabel(“Really useful for you”) + storyCardsMarkup ) }; } /** * @param {Array} subjects * @returns {Object} markup for the overlay’s header and physique content material areas */ operate upToDateShowTrending(subjects) { console.information(“[ARC-6637] State of affairs: updated, present trending”); var storyCardsMarkup = trendingStoryCards(subjects); return { header: overlayHeadingHasFollowed, physique: ( upToDateMessage + overlayLabel(“Trending subjects to comply with”) + storyCardsMarkup ) }; } /** * @param {Array} subjects * @returns {Object} markup for the overlay’s header and physique content material areas */ operate notFollowingShowRecommended(subjects) { console.information(“[ARC-6637] State of affairs: not following, present advisable”); var storyCardsMarkup = recommendedStoryCards(subjects); return { header: overlayHeadingNoFollowed, physique: ( overlayLabel(“Really useful for you”) + storyCardsMarkup ) }; } /** * @param {Array} subjects * @returns {Object} markup for the overlay’s header and physique content material areas */ operate notFollowingShowTrending(subjects) { console.information(“[ARC-6637] State of affairs: not following, present trending”); var storyCardsMarkup = trendingStoryCards(subjects); return { header: overlayHeadingNoFollowed, physique: ( overlayLabel(“Trending subjects to comply with”) + storyCardsMarkup ) }; } /** * Parse knowledge from the personalised API and inject markup into the overlay * @see https://confluence.theglobeandmail.com/show/ARC/Logic+for+Embedded+on+Homepage++and+Your+Globe+Overlay * @param {Object} knowledge – matter and story knowledge offered by the API */ operate parsePerzonalizedTopicsData(knowledge) { console.information(“[ARC-6637] parsePerzonalizedTopicsData”, knowledge); var overlayHeader = qs(“.c-your-globe__overlay-header”); var overlayHeaderText = qs(“.c-your-globe__overlay-header-text”); var overlayBody = qs(“.c-your-globe__overlay-body”); if (!overlayHeader || !overlayHeaderText || !overlayBody) { return; } var totalTopicsFollowed = knowledge.totalTopicsFollowed || 0; var totalAuthorsFollowed = knowledge.totalAuthorsFollowed || 0; var recommendedTopics = knowledge.recommendedTopics || []; var recommendedAuthors = knowledge.recommendedAuthors || []; var latestStories = knowledge.articles || []; var subjects = []; var tales = []; var markup = “”; var headerBorder = true; if (totalTopicsFollowed || totalAuthorsFollowed) { if (latestStories.size) { // State of affairs 1: “Newest tales” tales = generateLatestStories(latestStories); markup = showLatestStories(tales); // Much like displayLatestAndRecommended() in ARC-6292 addOverlayTriggerDot(“unread”); } else { if (recommendedTopics.size || recommendedAuthors.size) { // State of affairs 2: “Updated, present advisable” subjects = recommendedAuthors.concat(recommendedTopics); markup = upToDateShowRecommended(subjects); // Much like displayRecommendedTrendingTopicList(“rec”) in ARC-6292 } else } } else { subjects = recommendedAuthors.concat(recommendedTopics); if (subjects.size) { // State of affairs 4: “Not following, present advisable” markup = notFollowingShowRecommended(subjects); // Much like displayThreeTopicsOneStory(“rec”) in ARC-6292 } else []; markup = notFollowingShowTrending(subjects); // Much like displayThreeTopicsOneStory(“pattern”) in ARC-6292 addOverlayTriggerDot(“no-follow”); headerBorder = false; } console.information(“[ARC-6637] Append markup”); var spinner = qs(“.c-spinner”); spinner && spinner.parentElement.removeChild(spinner); overlayHeaderText.insertAdjacentHTML(“afterbegin”, markup.header); overlayBody.insertAdjacentHTML(“afterbegin”, markup.physique); if (!headerBorder) { overlayHeader.classList.add(“c-your-globe__overlay-header–no-border”); } addFollowingFunctionality(); } // ************************************************ // API calls // ************************************************ /** * Get the personalised feed * @param {String} hashId – consumer’s hash id * @param {String} env – setting * @see https://confluence.theglobeandmail.com/show/ARC/Logic+for+Embedded+on+Homepage++and+Your+Globe+Overlay * @returns {Promise

Source

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *