Yahoo Hong Kong 雅虎香港 (2022)

' + '

(Video) 胡‧說樓市|邊個屋苑係隱藏負資產高危? | Yahoo Hong Kong

' + '

';var panelEmptyTemplate = '

  • ' + '

    ' + '{emptyPanelMsg}' + '

    ' + '
  • ';var panelErrorTemplate = '

    (Video) 胡‧說樓市|加息期轉按之三大考慮點! | Yahoo Hong Kong

    ' + ' {errorMsg} ' + '

    ';var panelParentTemplate = '

    ';var notifOnboardPromoTemplate = '

  • ' + '

    ' + 'Yahoo Hong Kong 雅虎香港 (2)' + '

    ' + '' + '{notifOnboardMsg}' + '' + '' + '' + '' + '

    ' + '

    ' + '
  • ';/* global document, window */var EXPANDED_PANEL = 'expanded_panel';var ERROR_PANEL = 'error_panel';var NotificationView = function () { function NotificationView(config, store) { classCallCheck(this, NotificationView); var self = this; self._config = config; self._panelNode = null; self._store = store; } /** * _renderPanel * Renders the notification panel * @param {string} template - Notification panel template * @param {object} panelData - Notification panel data * @return {object} notification panel display markup */ createClass(NotificationView, [{ key: '_generatePanelMarkup', value: function _generatePanelMarkup(template, panelData) { var config = this._config; var isNotifPermissionDefault = void 0; var isClientPromoEligible = void 0; if (typeof window !== 'undefined') { isNotifPermissionDefault = window.Notification && window.Notification.permission === 'default'; isClientPromoEligible = config.promos.bypassEligibleClassCheck || hasClass(document.body, config.promos.eligibleBodyClass); } var shouldShowNotifOnboardPromo = config.promos.enableNotifOnboard && isNotifPermissionDefault && isClientPromoEligible; var promoMarkup = shouldShowNotifOnboardPromo ? notifOnboardPromoTemplate : ''; if (promoMarkup) { var promoLogoClass = config.promos.showYahooLogo ? '' : 'yns-no-logo'; promoMarkup = promoMarkup.replace('{notifOnboardBtnLabel}', config.promos.notifOnboardBtnLabel).replace('{notifOnboardMsg}', config.promos.notifOnboardMsg).replace('{subscriptionTopic}', config.promos.subscriptionTopic).replace('{noLogoClass}', promoLogoClass).replace('{promoLogo}', config.promos.promoLogo); } var hasAdditionalNotifs = panelData.newCount > config.panel.maxCount; var newCount = hasAdditionalNotifs ? panelData.newCount : ''; var notifCenterPath = config.panel.notificationCenterPath; var notifCenterLinkClass = notifCenterPath ? '' : constants.panelHideElement; var panelHeaderDisplayClass = config.panel.headerMsg ? '' : ' ' + constants.panelHideElement; var paddingClass = notifCenterPath ? constants.panelPaddingBtm : ''; var notifMarkup = void 0; if (panelData.count) { notifMarkup = panelData.markup; } else { var panelEmptyMarkup = panelEmptyTemplate; notifMarkup = panelEmptyMarkup.replace('{emptyPanelMsg}', config.panel.emptyPanelMsg); } template = template.replace('{notifMarkup}', notifMarkup).replace('{promoMarkup}', promoMarkup).replace('{hideClass}', notifCenterLinkClass).replace('{notifCenterLink}', notifCenterPath).replace('{paddingClass}', paddingClass).replace('{headerMsg}', config.panel.headerMsg).replace('{hideHeaderClass}', panelHeaderDisplayClass).replace(/{notificationCenterNavMsg}/g, config.panel.notificationCenterNavMsg).replace(/{newCount}/g, newCount); return template; } /** * render * Renders the panel based on type - collapsed, expanded, toast * @param {string} templateType - template type to be used * @param {Function} callback - The callback function * @return {void} */ }, { key: 'render', value: function render(templateType, callback) { var self = this; if (!self._panelNode) { callback && callback(new Error('No panel parent')); return; } var template = void 0; var parent = self._panelNode; var panelMarkup = void 0; var panelData = void 0; switch (templateType) { case EXPANDED_PANEL: template = panelTemplate || ''; panelData = self._store.getNotifications(); panelMarkup = self._generatePanelMarkup(template, panelData); parent.innerHTML = panelMarkup; break; case ERROR_PANEL: template = panelErrorTemplate || ''; panelMarkup = template.replace('{errorMsg}', self._config.panel.errorMsg); parent.innerHTML = panelMarkup; break; default: break; } callback && callback(); } /** * createPanelParentNode * Create the panel DOM structure * @param {object} panelParentNode - Panel's parent node - from consumer * @return {void} */ }, { key: 'createPanelParentNode', value: function createPanelParentNode(panelParentNode) { if (!panelParentNode) { return; } panelParentNode.innerHTML = panelParentTemplate; // Store the panel node this._panelNode = document.getElementById(constants.panelNodeId); } /** * updateBadgeNode * Updates the badge node if needed * @param {object} badgeNode badge HTML node * @return {void} */ }, { key: 'updateBadgeNode', value: function updateBadgeNode(badgeNode) { if (badgeNode) { var _store$getNotificatio = this._store.getNotifications(), newCount = _store$getNotificatio.newCount; var maxBadgeCount = this._config.badge.maxCount; if (newCount) { var badgeCount = newCount > maxBadgeCount ? maxBadgeCount + '+' : newCount; badgeNode.innerHTML = badgeCount; } else { badgeNode.innerHTML = ''; } } } /** * addStyles * Add panel css returned by service to page once * @param {object} styles css style blob * @return {void} */ }, { key: 'addStyles', value: function addStyles(styles) { if (styles) { if (typeof window !== 'undefined') { var styleTag = document.getElementById(this._config.panel.styleTagId); if (!styleTag) { styleTag = document.createElement('style'); styleTag.type = 'text/css'; styleTag.id = this._config.panel.styleTagId; styleTag.innerText = styles; document.head.appendChild(styleTag); } } } } }]); return NotificationView;}();/* global document *//* Updates the notification store when needed Controls the notification view */var EXPANDED_PANEL$1 = 'expanded_panel';var ERROR_PANEL$1 = 'error_panel';var PanelController = function () { function PanelController(config, store, view) { classCallCheck(this, PanelController); var self = this; self._store = store; self._view = view; self._config = config; var panelConfig = self._config.panel; self._panelParentNode = document.querySelector(panelConfig.parentSelector); self._badgeNode = self._config.badge.selector && document.querySelector(self._config.badge.selector); self._indicatorNode = panelConfig.indicatorSelector && document.querySelector(panelConfig.indicatorSelector); } /** * createPanelParentNode * Creates the base node for panel * @return {void} */ createClass(PanelController, [{ key: 'createPanelParentNode', value: function createPanelParentNode() { this._view.createPanelParentNode(this._panelParentNode); this._notifPanelNode = document.getElementById(constants.panelNodeId); } /** * refreshPanelNode * Shows the expanded panel - fetches data from store, calls view to render, attached delegates * @param {object} requestOverride - matrix params to over ride the reqeust * @param {Function} callback - The callback function * @return {void} */ }, { key: 'refreshPanelNode', value: function refreshPanelNode(requestOverride, callback) { var self = this; addClass(self._notifPanelNode, constants.panelLoading); self._store.fetchNotifications(requestOverride, function handleExpandedFetch(err, response) { var waferBase = window.wafer && window.wafer.base; // destroy bound wafers before markup is updated waferBase && waferBase.destroy(self._notifPanelNode); if (err) { if (!self._notifPanelNode.innerHTML) { self._view.render(ERROR_PANEL$1); addClass(self._notifPanelNode, constants.panelLoading); } } else { self._view.render(EXPANDED_PANEL$1); self._view.updateBadgeNode(self._badgeNode); self._showBadge(); self._showIndicator(); self._view.addStyles(response.css); } removeClass(self._notifPanelNode, constants.panelLoading); // sync new wafers after markup is created waferBase && waferBase.sync(self._notifPanelNode.parentNode); callback && callback(err, response); }); } /** * resetBadge * Reset the badge count * @return {void} */ }, { key: 'resetBadge', value: function resetBadge() { var self = this; self._store.resetNewCount(); self._view.updateBadgeNode(self._badgeNode); addClass(self._badgeNode, self._config.badge.hideClass); } /** * _showIndicator * Add class to indicator node * @return {void} */ }, { key: '_showIndicator', value: function _showIndicator() { if (!this._indicatorNode) { return; } var _store$getNotificatio = this._store.getNotifications(), newCount = _store$getNotificatio.newCount; if (newCount) { addClass(this._indicatorNode, this._config.panel.indicatorClass); } else { removeClass(this._indicatorNode, this._config.panel.indicatorClass); } } /** * _showBadge * Show/hide the badge count * @return {void} */ }, { key: '_showBadge', value: function _showBadge() { var self = this; var _self$_store$getNotif = self._store.getNotifications(), newCount = _self$_store$getNotif.newCount; if (newCount) { removeClass(self._badgeNode, self._config.badge.hideClass); } else { addClass(self._badgeNode, self._config.badge.hideClass); } } }]); return PanelController;}();var config = { promos: { eligibleBodyClass: 'display-push-promos', enableNotifOnboard: true, bypassEligibleClassCheck: false, 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: true, subscriptionTopic: 'gondor_homerun_news' }, badge: { hideClass: '', maxCount: 5, selector: '' }, panel: { emptyPanelMsg: 'You have no new notifications.', errorMsg: '', headerMsg: 'Notifications', imageTag: 'img:40x40|2|80', indicatorClass: 'yns-indicator', indicatorSelector: null, maxCount: 6, notificationCenterNavMsg: 'View all {newCount} notifications', notificationCenterPath: '', notificationTypes: '', parentSelector: null, // required styleTagId: 'notificationStyles', theme: 'default' }, service: { attemptCount: 2, attemptDelay: 1, url: null, // required resetUrl: null, isRMP: false, responseType: 'json', timeout: 1500 }};var Main = function () { function Main(config$$1) { classCallCheck(this, Main); var self = this; self.config = self._parseConfig(config$$1); var validConfigs = self._validateRequiredConfigs(); // silently return if required configs are missing if (!validConfigs) { return; } self._request = new NotificationRequest(self.config); self._store = new NotificationStore(self.config, self._request); self._view = new NotificationView(self.config, self._store); self._panelController = new PanelController(self.config, self._store, self._view); self._panelController.createPanelParentNode(); // Once all the internal modules are init, create helper method reference. self._assignHelperMethods(); } /** * _parseConfig * Parses the provided config and updates default. The configs are expected to be max one level deep * @param {object} config - The config object * @return {object} request configuration */ createClass(Main, [{ key: '_parseConfig', value: function _parseConfig(config$$1) { var defaultConfig = {}; objectAssign(defaultConfig, config); for (var key in defaultConfig) { if (defaultConfig.hasOwnProperty(key)) { var orig = defaultConfig[key]; var extn = config$$1[key]; if ((typeof orig === 'undefined' ? 'undefined' : _typeof(orig)) === 'object') { objectAssign(orig, extn); } else { defaultConfig[key] = config$$1[key]; } } } return defaultConfig; } /** * _validateRequiredConfigs * Validates if required configs are being passed by consumer * @return {boolean} validity of configs */ }, { key: '_validateRequiredConfigs', value: function _validateRequiredConfigs() { var _config = this.config; return !!(_config.panel.parentSelector && _config.service.url); } /** * _assignHelperMethods * This function creates helper methods that refer to internal functions, binds correct context * @return {void} */ }, { key: '_assignHelperMethods', value: function _assignHelperMethods() { var self = this; self.helpers = { refreshPanelNode: self._panelController.refreshPanelNode.bind(self._panelController), resetBadge: self._panelController.resetBadge.bind(self._panelController), resetIndicator: function resetIndicator() { removeClass(self._panelController._indicatorNode, self.config.panel.indicatorClass); } }; } }]); return Main;}();return Main;}());//# sourceMappingURL=notificationClient.min.js.map!function(){var r,l,i,n="lnct";function t(e,n){var t=this;t.config=e||{},t.accordion=l.querySelector(e.accordionSelector),t.countBadge=l.querySelector(e.countBadgeSelector),t.notificationButton=l.querySelector(e.notificationButtonSelector),t.profileButton=l.querySelector(e.profileButtonSelector),t.notificationClient=n,t.visibilityMetaTag="";function i(){t.visibilityMetaTag=r.wafer.features.visibilityMeta.hidden||""}var o=r.wafer&&r.wafer.ready;o?o(i):document.body.addEventListener("wafer:ready",i);function a(e){t.visibilityMetaTag&&l[t.visibilityMetaTag]||t.refreshPanel.call(t,e)}t.attachEventListeners(),a(t.handleBackgroundRefresh),e.pollingInterval&&setInterval(a,1e3*e.pollingInterval,t.handleBackgroundRefresh)}function e(){if(r.NotificationClient){var e=new window.NotificationClient(i);e&&e.helpers&&new t(i.adapter,e)}}function o(e,n,t){r=e,l=n,i=t||{"adapter":{"accordionSelector":"#profile-notification-accordion","countBadgeSelector":"#header-notification-badge","initializeImmediately":false,"lang":"zh-Hant-HK","loadInHpViewer":false,"notificationButtonSelector":"#header-notification-button","partner":"none","pollingInterval":300,"profileButtonSelector":"#header-profile-button","rapidModuleId":"applet_p_50000372","region":"HK"},"badge":{"hideClass":"D(n)","selector":"#header-notification-badge"},"panel":{"emptyPanelMsg":"你沒有新通知。","errorMsg":"請稍後再回來查看。","headerMsg":"通知","indicatorSelector":"#header-notification-indicator","maxCount":4,"notificationCenterNavMsg":"","notificationCenterPath":null,"parentSelector":"#header-notification-panel"},"promos":{"eligibleBodyClass":"display-push-promos","enableNotifOnboard":true,"notifOnboardBtnLabel":"通知我","notifOnboardMsg":"獲取每天焦點新聞通知","showYahooLogo":true,"subscriptionTopic":"gondor_homerun_news"},"service":{"url":"/tdv2_fp/api/resource/NotificationHistory.getHistory?partner=none"}}}t.prototype={attachEventListeners:function(){var e=this;e.profileButton&&e.profileButton.addEventListener("click",function(){e.refreshPanel.call(e)}),e.accordion&&e.accordion.addEventListener("click",function(){e.handlePanelOpen.call(e)}),e.notificationButton&&(e.notificationButton.addEventListener("mouseenter",function(){e.handlePanelOpen.call(e)}),e.notificationButton.addEventListener("focus",function(){e.handlePanelOpen.call(e)}))},getConsumptionTime:function(){return r.localStorage&&r.localStorage.getItem(n)},handleBackgroundRefresh:function(e,n){var t=this,i=r.YAHOO&&r.YAHOO.i13n&&r.YAHOO.i13n.rapidInstance||r.rapidInstance;if(i&&t.countBadge&&t.countBadge.className.indexOf("D(n)")<0){var o={_links:[{cat:t.countBadge.innerText,elm:"btn",slk:"notification",subsec:"notification-badge"}],sec:"hd"};i.beaconLinkViews([o],0,{pp:{usergenf:0}})}},handlePanelOpen:function(){var e=this,n=r.YAHOO&&r.YAHOO.i13n&&r.YAHOO.i13n.rapidInstance||r.rapidInstance;e.stampConsumptionTime(),e.notificationClient.helpers.resetBadge(),e.notificationClient.helpers.resetIndicator(),n&&n.isModuleTracked(e.config.rapidModuleId)&&n.refreshModule(e.config.rapidModuleId)},stampConsumptionTime:function(){var e=""+Math.floor((new Date).getTime()/1e3);return r.localStorage&&r.localStorage.setItem(n,e),e},refreshPanel:function(t){var i=this,e=i.getConsumptionTime()||i.stampConsumptionTime(),n=i.config.region,o=i.config.lang,a=i.config.partner,r=i.config.loadInHpViewer,l={lastUpdate:e};n&&o&&(l.lang=o,l.region=n),a&&(l.partner=a),r&&(l.loadInHpViewer=r),i.notificationClient.helpers.refreshPanelNode({matrixParams:l},function(e,n){t&&t.call(i,e,n)})}},"undefined"!=typeof module?(module.exports.NotificationClientAdapter=t,module.exports.defineGlobals=o,module.exports.initNotificationClient=e):(o(window,document),i.adapter&&i.adapter.initializeImmediately?e():window.addEventListener("load",e))}();

    Videos

    1. 【娛樂問呢啲 之 粉絲福利社】七師傅解答眾多香港人最想知嘅問題係....... | Yahoo Hong Kong
    (雅虎香港 Yahoo Hong Kong)
    2. 日本「蛇形機器人」災難中救命 能爬樓梯、穿越狹窄空間超靈活 | Yahoo Hong Kong
    (雅虎香港 Yahoo Hong Kong)
    3. 【娛樂訪談】張敬軒:姜濤心態好,值得借鑒 | Yahoo Hong Kong
    (雅虎香港 Yahoo Hong Kong)
    4. 胡‧說樓市|疫後首發新盤:Monaco Marine四大注意點! | Yahoo Hong Kong
    (雅虎香港 Yahoo Hong Kong)
    5. 普京「被罰站1分鐘」尷尬畫面曝光 遭「甜蜜復仇」枯等土耳其總統 | Yahoo Hong Kong
    (雅虎香港 Yahoo Hong Kong)
    6. 夏威夷海邊浪漫婚宴突見「不速之客」6米大浪淹沒場地賓客急逃 | Yahoo Hong Kong
    (雅虎香港 Yahoo Hong Kong)

    You might also like

    Latest Posts

    Article information

    Author: Carlyn Walter

    Last Updated: 08/10/2022

    Views: 5285

    Rating: 5 / 5 (70 voted)

    Reviews: 93% of readers found this page helpful

    Author information

    Name: Carlyn Walter

    Birthday: 1996-01-03

    Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

    Phone: +8501809515404

    Job: Manufacturing Technician

    Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

    Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.