1// Put instance on global _placester object 2window._placester = window._placester || {}; 3 4window._placester.entitlementsHandler = (function () { 5 // Instance stores a reference to the Singleton 6 var instance; 7 8 function init() { 9 // Private methods and variables 10 var _entitlements = (window._placester && window._placester.entitlements) ? window._placester.entitlements : null; 11 var is_site_disabled = (window._placester && window._placester.site_disabled) ? window._placester.site_disabled : false; 12 13 function getEntitlement(key) { 14 var value = false; 15 if (key && _entitlements && _entitlements[key]) { 16 value = true; 17 } 18 return value; 19 } 20 function shouldDisableGoogleMaps() { 21 // PROM-6229 - Disable maps on non launched site, with preview token 22 var keyValue = document.cookie.match('(^|;) ?' + 'preview_site' + '=([^;]*)(;|$)'); 23 cookie = keyValue ? keyValue[2] : null; 24 25 if ( ( is_site_disabled && !cookie ) || ( is_site_disabled && cookie !== 'enabled' ) ) { 26 return true; 27 } 28 } 29 30 return { 31 // Public methods and variables 32 shouldShowTestimonials: function() { 33 return getEntitlement('sites:testimonials'); 34 }, 35 36 shouldShowMapSearch: function() { 37 if ( shouldDisableGoogleMaps() ) { 38 return false; 39 } 40 41 return getEntitlement('map_search'); 42 }, 43 44 shouldShowStandardMaps: function() { 45 if ( shouldDisableGoogleMaps() ) { 46 return false; 47 } 48 49 return getEntitlement('sites:widgets:maps'); 50 }, 51 52 shouldShowLoginRegister: function() { 53 return getEntitlement('sites:users:login'); 54 }, 55 56 shouldShowFeaturedListings: function() { 57 return getEntitlement('sites:featlistings'); 58 }, 59 60 shouldShowHomepageBlogs: function() { 61 return getEntitlement('sites:posts'); 62 }, 63 64 shouldShowSavedSearch: function() { 65 return getEntitlement('sites:savedsearch'); 66 }, 67 68 shouldShowFavListingLink: function() { 69 return getEntitlement('sites:favlistings'); 70 }, 71 72 shouldFireFbPixelLeadEvent: function() { 73 return getEntitlement('sites:fbpixel:event:lead'); 74 }, 75 76 shouldShowColorImages: function() { 77 return getEntitlement('sites:color_images'); 78 }, 79 80 shouldShowLogo: function() { 81 return getEntitlement('sites:logo'); 82 }, 83 84 shouldHideFreeAd: function() { 85 return getEntitlement('sites:no_ad'); 86 } 87 }; 88 }; 89 90 return { 91 // Get the Singleton instance if one exists or create one if it doesn't 92 getInstance: function() { 93 if (!instance) { 94 instance = init(); 95 } 96 return instance; 97 } 98 }; 99})().getInstance();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.