/*global YUI, window, Y, ucs */ YUI.add('ucs-disclaimer-seed', function (Y) { Y.namespace('ucs'); Y.ucs.DisclaimerSeed = { /** * check if eup subcookie has been set * load js and css if not set * @method init */ init: function () { var suppress = false, property = Y.one('#yucs-disclaimer').getAttribute('data-property'), lang = Y.one('#yucs-disclaimer').getAttribute('data-lang'), excluded = { 'bn-in':true, 'en-au':true, 'en-hk':true, 'en-in':true, 'en-my':true, 'en-nz':true, 'en-ph':true, 'en-sg':true, 'fil-ph':true, 'gu-in':true, 'hi-in':true, 'id-id':true, 'kn-in':true, 'ml-in':true, 'mr-in':true, 'ms-my':true, 'ta-in':true, 'te-in':true, 'th-th':true, 'vi-vn':true, 'zh-hk':true, 'zh-hant-hk':true, 'zh-hant-tw':true, 'zh-tw':true }, cleanUp = false, suppressClean = false, isCookieSet = Y.Cookie.getSub('ucs', 'disclaimer', Number), oSubCookie = Y.Cookie.getSub('AO', 'o') ? Y.Cookie.getSub('AO', 'o') : Y.Cookie.getSub('AO', '"o'), uSubCookie = Y.Cookie.getSub('AO', 'u') ? Y.Cookie.getSub('AO', 'u') : Y.Cookie.getSub('AO', '"u'), tSubCookie = Y.Cookie.getSub('AO', 't') ? Y.Cookie.getSub('AO', 't') : Y.Cookie.getSub('AO', '"t'), // Not setting it to Number because there is a bug in some of // the AO cookie packages where it adds "" around the value dnt = Y.Cookie.getSub('AO', 'dnt') ? Y.Cookie.getSub('AO', 'dnt') : Y.Cookie.getSub('AO', '"dnt'); // removing \" and \' if present if (dnt) { dnt = dnt.replace('"',''); dnt = dnt.replace("'",''); } if (uSubCookie) { uSubCookie = uSubCookie.replace('"',''); uSubCookie = uSubCookie.replace("'",''); } if (oSubCookie) { oSubCookie = oSubCookie.replace('"',''); oSubCookie = oSubCookie.replace("'",''); } else { suppress = true; } if (dnt && dnt == 1) { if (oSubCookie && oSubCookie == 1 && uSubCookie && uSubCookie == 1) { suppress = true; suppressClean = true; } if (!isCookieSet && oSubCookie && oSubCookie == 0) { suppress = true; suppressClean = true; } } if (tSubCookie) { suppress = true; } if (property === "flickr") { suppress = true; } if (property !== "mail" && excluded[lang]) { suppress = true; cleanUp = true; } this.jsPath = 'https://s.yimg.com/zz/combo?kx/yucs/uh3/disclaimer/js/188/disclaimer_standalone.js'; this.cssPath = 'https://s.yimg.com/zz/combo?kx/yucs/uh3/disclaimer/css/188/disclaimer_standalone-min.css'; //this.jsPath = '../../js/disclaimer.js?r=' + Math.random(); //this.cssPath = '../../css/disclaimer.css?r=' + Math.random(); if (dnt == 1 && suppress === false) { if (!isCookieSet || isCookieSet < 2) { this.loadCSS(); } } if (dnt && dnt == 1 && cleanUp === true && suppressClean === false) { dnt = Y.Cookie.get('AO', {raw:true}); dnt = dnt.replace('o=1', 'o=0'); Y.Cookie.set('AO', dnt, {expires: new Date('January 12, 2025'), path: '/', domain: 'yahoo.com', raw:true}); } }, /** * load css file if cookie not set and load js after css has been loaded * @method loadCSS */ loadCSS: function () { var callback = { onSuccess: function () { this.loadJS(); }, onFailure: function () { this.loadCSS(); }, context: this }; Y.Get.css(this.cssPath, callback); }, /** * load js file * @method loadJS */ loadJS: function () { var callback = { onFailure: function () { this.loadJS(); }, context: this }; Y.Get.script(this.jsPath, callback); } }; }, '1.0', {requires: ['node', 'cookie']}); /*global YUI, window, Y, ucs */ (function () { if (typeof Y == 'undefined') { YUI().use('ucs-disclaimer-seed', function (Y) { Y.ucs.DisclaimerSeed.init(); }); } else { Y.use('ucs-disclaimer-seed', function (Y) { Y.ucs.DisclaimerSeed.init(); }); } }());