1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
function setCookie(name, value, expires, path, domain, secure) {
document.cookie=name+"="+escape(value)+
((expires==undefined) ? "" : ("; expires="+expires.toGMTString()))+
((path==undefined) ? "" : ("; path="+path))+
((domain==undefined) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
}
function getCookie(name) {
if (document.cookie.length==0) {
return null; }
var regCookies=new RegExp("(; )","g");
var cookies=document.cookie.split(regCookies);
for (var i=0; i<cookies.length ; i++) {
var regInfo=new RegExp("=","g");
var infos=cookies.split(regInfo);
if (infos[0]==name) {
return unescape(infos[1]);
}
}
return null;
}
function closeNotice(element) {
new Effect.Fade('notice', 3);
if(container.style.opacity == 0.7) {
new Effect.Opacity('container', { from: 0.7, to: 1.0, duration: 0.5 });
new Effect.Pulsate('notice_mini', 1);
}
childNodes = $('container').childNodes;
for(i=0;i<childNodes.length;i++) {
for(j=0;j<childNodes[i].attributes.length;j++) {
if(childNodes[i].attributes[j].nodeName == 'id') {
if(childNodes[i].style.opacity == 0.7 || childNodes[i].filters.alpha.opacity == 70 ) {
new Effect.Appear(childNodes[i].attributes[j].nodeValue, { from: 0.7, to: 1, duration: 0.5 });
new Effect.Pulsate('notice_mini', 1);
}
}
}
}
}
function notice(actionner) {
if(actionner == 'nav')
setCookie('notice','');
new Ajax.Request('ajax/notice', {
method: 'get',
parameters:
{
format: 'json',
},
onSuccess: function(transport) {
alert(transport.responseText);
alert("ok");
json = transport.responseText.evalJSON();
if(!(getCookie('notice') == 'viewed')) {
new Effect.Opacity('container', { from: 1, to: 0.7, duration: 0.5 });
new Effect.Appear('notice', { from: 0, to: 1, duration: 0.5 });
$('notice_content').innerHTML = json.notice[0].notice;
dtCurrent = new Date();
dtExpiration = new Date(dtCurrent.getUTCFullYear(),dtCurrent.getUTCMonth(),dtCurrent.getUTCDate());
dtExpiration.setTime(dtExpiration.getTime() + 86400000);
setCookie('notice','viewed',dtExpiration);
childNodes = $('container').childNodes;
for(i=0;i<childNodes.length;i++) {
for(j=0;j<childNodes[i].attributes.length;j++) {
if(childNodes[i].attributes[j].nodeName == 'id') {
new Effect.Fade(childNodes[i].attributes[j].nodeValue, { from: 1, to: 0.7, duration: 0.5 });
}
}
}
}
}
});
}
Event.observe(window, 'load', function() {
notice('body');
}); |
Partager