CB2 Introduces Art Patron, A New Collection Developed in Partnership with Portia de Rossi’s General Public
- promoMarkupnotifMarkup
“,panelEmptyTemplate=”
emptyPanelMsg
“,panelErrorTemplate=”
errorMsg
“,panelParentTemplate=””,notifOnboardPromoTemplate=”
notifOnboardMsg
“,EXPANDED_PANEL=”expanded_panel”,ERROR_PANEL=”error_panel”,NotificationView=function(){function e(n,t)classCallCheck(this,e);var i=this;i._config=n,i._panelNode=null,i._store=treturn createClass(e,[key:”_generatePanelMarkup”,value:function(e,n)var t=this._config,i=void 0,o=void 0;”undefined”!=typeof window&&(i=window.Notification&&”default”===window.Notification.permission,o=t.promos.bypassEligibleClassCheck,{key:”render”,value:function(e,n)var t=this;if(t._panelNode)var i=void 0,o=t._panelNode,r=void 0,s=void 0;switch(e)case EXPANDED_PANEL:i=panelTemplate,s=t._store.getNotifications(),r=t._generatePanelMarkup(i,s),o.innerHTML=r;break;case ERROR_PANEL:r=(i=panelErrorTemplate).replace(“errorMsg”,t._config.panel.errorMsg),o.innerHTML=rn&&n()else n&&n(new Error(“No panel parent”))},key:”createPanelParentNode”,value:function(e)e&&(e.innerHTML=panelParentTemplate,this._panelNode=document.getElementById(constants.panelNodeId)),key:”updateBadgeNode”,value:function(e)if(e)var n=this._store.getNotifications().newCount,t=this._config.badge.maxCount;if(n)var i=n>t?t+”+”:n;e.innerHTML=ielse e.innerHTML=””,key:”addStyles”,value:function(e)if(e&&”undefined”!=typeof window)((n=document.createElement(“style”)).type=”text/css”,n.id=this._config.panel.styleTagId,n.innerText=e,document.head.appendChild(n))]),e}(),EXPANDED_PANEL$1=”expanded_panel”,ERROR_PANEL$1=”error_panel”,PanelController=function()function e(n,t,i)classCallCheck(this,e);var o=this;o._store=t,o._view=i,o._config=n;var r=o._config.panel;o._panelParentNode=document.querySelector(r.parentSelector),o._badgeNode=o._config.badge.selector&&document.querySelector(o._config.badge.selector),o._indicatorNode=r.indicatorSelector&&document.querySelector(r.indicatorSelector)return createClass(e,[key:”createPanelParentNode”,value:function()this._view.createPanelParentNode(this._panelParentNode),this._notifPanelNode=document.getElementById(constants.panelNodeId),key:”refreshPanelNode”,value:function(e,n)var t=this;addClass(t._notifPanelNode,constants.panelLoading),t._store.fetchNotifications(e,(function(e,i)var o=window.wafer&&window.wafer.base;o&&o.destroy(t._notifPanelNode),e?t._notifPanelNode.innerHTML)),key:”resetBadge”,value:function()var e=this;e._store.resetNewCount(),e._view.updateBadgeNode(e._badgeNode),addClass(e._badgeNode,e._config.badge.hideClass),key:”_showIndicator”,value:function()this._indicatorNode&&(this._store.getNotifications().newCount?addClass(this._indicatorNode,this._config.panel.indicatorClass):removeClass(this._indicatorNode,this._config.panel.indicatorClass)),key:”_showBadge”,value:function()var e=this;e._store.getNotifications().newCount?removeClass(e._badgeNode,e._config.badge.hideClass):addClass(e._badgeNode,e._config.badge.hideClass)]),e(),config=promos:eligibleBodyClass:”display-push-promos”,enableNotifOnboard:!0,bypassEligibleClassCheck:!1,notifOnboardBtnLabel:”Notify Me”,notifOnboardMsg:”Get alerts for breaking news and top stories”,promoLogo:”https://s.yimg.com/cv/apiv2/ae/news/circle_bell.png”,showYahooLogo:!0,subscriptionTopic:”gondor_homerun_news”,badge:hideClass:””,maxCount:5,selector:””,panel:80″,indicatorClass:”yns-indicator”,indicatorSelector:null,maxCount:6,notificationCenterNavMsg:”View all newCount notifications”,notificationCenterPath:””,notificationTypes:””,parentSelector:null,styleTagId:”notificationStyles”,theme:”default”,service:attemptCount:2,attemptDelay:1,url:null,resetUrl:null,isRMP:!1,responseType:”json”,timeout:1500,Main=function(){function e(n)classCallCheck(this,e);var t=this;t.config=t._parseConfig(n),t._validateRequiredConfigs()&&(t._request=new NotificationRequest(t.config),t._store=new NotificationStore(t.config,t._request),t._view=new NotificationView(t.config,t._store),t._panelController=new PanelController(t.config,t._store,t._view),t._panelController.createPanelParentNode(),t._assignHelperMethods())return createClass(e,[key:”_parseConfig”,value:function(e)var n=;for(var t in objectAssign(n,config),n)if(n.hasOwnProperty(t))var i=n[t],o=e[t];”object”===(void 0===i?”undefined”:_typeof(i))?objectAssign(i,o):n[t]=e[t]return n,key:”_validateRequiredConfigs”,value:function()!e.service.url),key:”_assignHelperMethods”,value:function()var e=this;e.helpers=refreshPanelNode:e._panelController.refreshPanelNode.bind(e._panelController),resetBadge:e._panelController.resetBadge.bind(e._panelController),resetIndicator:function()removeClass(e._panelController._indicatorNode,e.config.panel.indicatorClass)]),e}(),notificationClient_module_min=Main,notificationClient=NotificationClient:notificationClient_module_min,CONSUMPTION_STORAGE_KEY=”lnct”,NotifClient=function(){function e()void 0===n?void 0:n.match(/ybar-variant-([a-z]*)/),this.client=new notificationClient.NotificationClient(this.getConfig())return e.prototype.refreshPanel=function(),e.prototype.resetBadge=function()this.client.helpers.resetBadge(),this.setTimeStamp(),e.prototype.getConfig=function(),e.prototype.mergeConfigs=function(e,n)var t=__assign(,e);for(var i in e)t[i]=__assign(__assign(,e[i]),n[i]);return t,e.prototype.getTimeStamp=function()var e;return null===(e=window.localStorage),e.prototype.setTimeStamp=function(),e}(),notifClient=new NotifClient,getNotifClient=function()return notifClient,reInit=function()notifClient=new NotifClient,ybarRapid,ybarRapidInterval,ybarRapidErrMsg=””,beaconQueue=[],noop=function(),logRapidError=function()window.removeEventListener(“beforeunload”,logRapidError),””!==ybarRapidErrMsg&&logError(“Rapid not found on page”,new Error(ybarRapidErrMsg)),findRapidWithSpaceid=function(e)var n=void 0;if(e&&e.length>0)for(var t=0;t
/*!**********************!*
!*** ./src/index.js ***!
**********************/function(__unused_webpack_module,__unused_webpack_exports,__webpack_require__){eval(“var I18n = __webpack_require__(/*! ./lib/I18n */ “./src/lib/I18n.js”);nn(function (win, doc) {n “use strict”;nn var defaultConfig = n uiLang: ‘en-US’,n speechLang: ‘en-US’,n voiceButton: ‘#voice-btn’,n searchBox: n form: ‘#sf’,n input: ‘#yschsp’,n params: n fr: ”,n fr2: ”n n ,n enable_voice_trending: false,n trending: n market: “en-us”n ,n ui: n speechOverlay: n disableBlur: falsen n ,n browsers: n edge: falsen n ;nn function VoiceSearch(config) {n var self = this;n self.config = Object.assign(defaultConfig, config || );n self.i18n = new VoiceSearch.I18n(n lang: self.config.uiLangn );n self.renderPermissionGuide(self);n self.renderSpeechPanel(self);n self.speechResult=””;n self.noSpeech = true;n self.isRecognitionStart = false;n self.recognition = null;n self.voiceButton = doc.querySelector(self.config.voiceButton);n self.searchBoxForm = doc.querySelector(self.config.searchBox.form);n self.searchBoxQuery = doc.querySelector(self.config.searchBox.input);n self.speechPanel = doc.querySelector(‘#spch’);n self.speechButtonContainer = doc.querySelector(‘#spchbc’);n self.speechButton = doc.querySelector(‘#spchbc-btn’);n self.speechText = doc.querySelector(‘#spcht’);n self.speechOverlay = doc.getElementById(‘spch-overlay’);n self.retryLink = doc.querySelector(‘#spcht-retry’);n self.trending = doc.getElementById(‘spch-trending’);n self.trendingTerms = doc.getElementById(‘trending-terms’);n self.termSpans = doc.getElementsByClassName(“trending-term”);n self.closeButton = doc.querySelector(‘#spchx’);n self.startAudio = new Audio(‘https://s.yimg.com/pv/static/misc/voice-start-202105050733.wav’);n self.resultAudio = new Audio(‘https://s.yimg.com/pv/static/misc/voice-result-202105050733.wav’);n self.errorAudio = new Audio(‘https://s.yimg.com/pv/static/misc/voice-error-202105050733.wav’);n self.closeAudio = new Audio(‘https://s.yimg.com/pv/static/misc/voice-close-202105050733.wav’);n self.permissionGuide = doc.querySelector(‘#spchp’);n self.permissionGuideClose = doc.querySelector(‘#spchpx’);n self.permissionGuideTimer = null;nn self.onEscKeyDown = function (e) n if (e.code !== ‘Escape’) n return;n nn self.recognition.stop();n self.sendBeacon(‘keybrd’, ‘voicesearch_cancel_esc’); // The clean up should put inside closePanel() instead of here,n // or func won’t be cleaned up if user close panel with btn or overlaynn self.closePanel(self);n ;nn if (self.isBrowserSupported()) {n var SpeechRecognition = win.SpeechRecognition || win.webkitSpeechRecognition;n var SpeechGrammarList = win.SpeechGrammarList || win.webkitSpeechGrammarList;n var speechGrammar=”#JSGF V1.0;”;n self.recognition = new SpeechRecognition();n var speechRecognitionList = new SpeechGrammarList();nn if (speechRecognitionList.addFromString) n speechRecognitionList.addFromString(speechGrammar, 1);n nn self.recognition.grammars = speechRecognitionList;n self.recognition.continuous = false;n self.recognition.lang = self.config.speechLang;n self.recognition.interimResults = false;n self.recognition.maxAlternatives = 1;n /* Listeners */nn if (self.voiceButton) n self.voiceButton.onclick = function () n self.recognition.start();nn if (self.permissionGuideTimer) n win.clearTimeout(self.permissionGuideTimer);n nn self.permissionGuideTimer = win.setTimeout(function () n if (!self.isRecognitionStart) n self.showPermissionGuide(self);n n , 300); // Also close when pressing escnn doc.addEventListener(‘keydown’, self.onEscKeyDown);n self.sendBeacon(‘clk’, ‘voicesearch’);n ;n nn if (self.speechButton) n self.speechButton.onclick = function () n if (!self.isRecognitionStart) n self.recognition.start();n self.sendBeacon(‘clk’, ‘voicesearch_panel_mic_restart’);n else n self.recognition.stop();n self.sendBeacon(‘clk’, ‘voicesearch_panel_mic_close’);n self.closePanel(self);n n ;n nn if (self.retryLink) n self.retryLink.onclick = function () n if (!self.isRecognitionStart) n self.recognition.start();n self.sendBeacon(‘clk’, ‘voicesearch_panel_retry’);n n ;n nn if (self.speechOverlay) n self.speechOverlay.onclick = function () n self.recognition.stop();n self.sendBeacon(‘clk’, ‘voicesearch_cancel_outside’);n self.closePanel(self);n ;n nn if (self.closeButton) n self.closeButton.onclick = functionn /*event*/n () n self.recognition.stop();n self.sendBeacon(‘clk’, ‘voicesearch_cancel’);n self.closePanel(self);n ;n nn if (self.permissionGuideClose) n self.permissionGuideClose.onclick = functionn /*event*/n () n self.recognition.stop();n self.sendBeacon(‘clk’, ‘voicesearch_permission_close’);n self.closeAudio.play();n self.hidePermissionGuide(self);n ;n n /* Recognition Events */nnn self.recognition.onresult = function (event) n // The SpeechRecognitionEvent results property returns a SpeechRecognitionResultList objectn // The SpeechRecognitionResultList object contains SpeechRecognitionResult objects.n // It has a getter so it can be accessed like an arrayn // The first [0] returns the SpeechRecognitionResult at the last position.n // Each SpeechRecognitionResult object contains SpeechRecognitionAlternative objects that contain individual results.n // These also have getters so they can be accessed like arrays.n // The second [0] returns the SpeechRecognitionAlternative at position 0.n // We then return the transcript property of the SpeechRecognitionAlternative objectn // console.log(‘Confidence: ‘ + event.results[0][0].confidence);n self.speechResult = event.results[0][0].transcript;n /* Punctuation Handling: Check last character and strip it if necessary */nn self.handlePunctuation(self);nn if (self.speechText) n self.speechText.innerText = self.speechResult;n nn if (self.searchBoxQuery) n self.searchBoxQuery.value = self.speechResult;n nn self.resultAudio.play();n win.setTimeout(function () n if (self.speechPanel) n self.speechPanel.classList.remove(“s2tb”);n self.speechPanel.classList.add(“s2tb-h”);n nn self.hideRetryLink(self);nn if (self.searchBoxForm) n var inputFr = self.searchBoxForm.querySelector(‘[name=fr]’);n var inputFr2 = self.searchBoxForm.querySelector(‘[name=fr2]’);nn if (inputFr && self.config.searchBox && self.config.searchBox.params && self.config.searchBox.params.fr) n inputFr.value = config.searchBox.params.fr;n inputFr.disabled = false; // for homepage casen nn if (inputFr2 && self.config.searchBox && self.config.searchBox.params && self.config.searchBox.params.fr2) n inputFr2.value = config.searchBox.params.fr2;n inputFr2.disabled = false; // for homepage casen nn self.searchBoxForm.submit();n n , 1000);n ;nn self.recognition.onspeechstart = functionn /*event*/n () // Fired when speech startsn ;nn self.recognition.onspeechend = function () n // Fired when speech endsn self.recognition.stop();n ;nn self.recognition.onerror = functionn /*event*/n () n // console.log(‘Error occurred in recognition: ‘ + event.error);n if (self.speechText) n self.speechText.innerText = self.i18n.t(‘search.voice.recognition_error’);n nn self.hideTrending(self);n self.showRetryLink(self);n self.errorAudio.play();n ;nn self.recognition.onaudiostart = functionn /*event*/n () n // Fired when the user agent has started to capture audio.n if (self.speechButtonContainer) n self.speechButtonContainer.classList.add(“listening”);n n ;nn self.recognition.onaudioend = functionn /*event*/n () n // Fired when the user agent has finished capturing audio.n if (self.speechButtonContainer) n self.speechButtonContainer.classList.remove(“listening”);n n ;nn self.recognition.onsoundstart = functionn /*event*/n () n // Fired when any sound — recognisable speech or not — has been detected.n self.hideTrending(self);n self.noSpeech = false;nn if (self.speechButtonContainer) n self.speechButtonContainer.classList.remove(“listening”);n self.speechButtonContainer.classList.add(“speaking”);n n ;nn self.recognition.onsoundend = functionn /*event*/n () n // Fired when no sound presentn if (self.speechButtonContainer) n self.speechButtonContainer.classList.remove(“speaking”);n n ;nn self.recognition.onstart = functionn /*event*/n () n // Fired when the speech recognition service has begun listeningn self.recognitionInit(self);n self.startRecognition(self);n ;nn self.recognition.onend = functionn /*event*/n () n // Fired when the speech recognition service has disconnected.n self.isRecognitionStart = false;nn if (self.noSpeech == false && self.speechResult == ”) n // No match: Fired when the speech recognition can’t recognise speechn if (self.speechText) n self.speechText.innerText = self.i18n.t(‘search.voice.recognition_nomatch’);n nn self.hideTrending(self);n self.showRetryLink(self);n self.errorAudio.play();n n ; // trigger onReady event when initializednnn if (document && document.dispatchEvent) n document.dispatchEvent(new Event(‘VOICE_JS_READY’));n n }n } // static membersnnn VoiceSearch.I18n = I18n; // instance membersnn VoiceSearch.prototype.renderPermissionGuide = function (self) n var tmpl = “\n
\n “);n var dom = new DOMParser().parseFromString(tmpl, ‘text/html’);n document.body.appendChild(dom.body.children[0]);n ;nn VoiceSearch.prototype.renderSpeechPanel = function (self) n var tmpl = “\n
\n
\n \n \n “.concat(self.i18n.t(‘search.voice.recognition_retry’), “\n
\n
\n
\n
\n
\n “).concat(self.i18n.t(‘search.voice.trending_title’), “\n \n
\n
\n
\n “);n var dom = new DOMParser().parseFromString(tmpl, ‘text/html’);nn if (self && self.config && self.config.ui && self.config.ui.speechOverlay && self.config.ui.speechOverlay.disableBlur) n dom.body.children[0].classList.add(‘disable-blur-overlay’);n nn document.body.appendChild(dom.body.children[0]);n ;nn VoiceSearch.prototype.isBrowserSupported = function () n var isSupported = false;n var self = this;n var isChromium = Boolean(window.chrome);n var isIOSChrome = /CriOS/.test(window.navigator.userAgent);n var isEdge = /Edg\//.test(window.navigator.userAgent);n var isLegacyEdge = /Edge\//.test(window.navigator.userAgent);n var isOpera = Boolean(window.opr);n var isBrave = Boolean(window.navigator.brave);n var browsers = [// chromen n checkEnabled: function checkEnabled() n return true;n ,n checkBrowser: function checkBrowser() n return isChromium && !isIOSChrome && !isEdge && !isOpera && !isBrave;n ,n checkAPI: function checkAPI() ‘webkitSpeechRecognition’ in win) && (‘SpeechGrammarList’ in win n , // edgen n checkEnabled: function checkEnabled() n return self && self.config && self.config.browsers && self.config.browsers.edge;n ,n checkBrowser: function checkBrowser() n return isChromium && isEdge && !isLegacyEdge;n ,n checkAPI: function checkAPI() ‘webkitSpeechRecognition’ in win) && (‘SpeechGrammarList’ in win n ];nn for (var b = 0; b 0) n ;nn VoiceSearch.prototype.sendBeacon = function (actn, slk) n var ULT = win.YAHOO.ULT ;nn VoiceSearch.prototype.ajaxReq = function (url, callback) ,normalizeAndEscapeUserRecord=function(e)n.alias,n,createAccountItemElement=function(e,n,t){var i=t.ybarAccMenuItemTemplate,o=t.crumb;if(i){var r=(n+1).toString(),s=i.getAttribute(“data-signedOutState”),a=i.getAttribute(“data-done”)||””,c=getTemplateContent(i),l=c.children&&c.children[0];if(!l&&c.childNodes)for(var d=0;d