Parašė diadingo· 2009 Kov. 13 19:03:20
#1
Turiu cia toki scripta kuris atidaro langa su puslapio taisyklemis, ir jis turetu atsidaryti tik viena kart per diena(vienam zmogui) kiek suprantu cookies pagalba, bet deja neturiu ajax failo su script kurio jis reikalauja(isnarsiau visa google)
function accept_warning() {
$.ajax({
type: "GET",
url: addr + "accept_vert.php",
dataType: "script"
});
Pilnas kodas:
var addr = "/";
var warning;
var warning_opacity = 1;
var do_show = true;
var warning_data = '<table width="540" cellSpacing="0" cellPadding="0" border="0" class="tbTransparentmb" bgcolor="#FFFFFF" style="border: 3px solid #000000"> <tr> <td bgcolor="#FFFFFF" width="10"></td> <td class="tbTransparentCell" bgcolor="#FFFFFF" align="left"><!-- content --> <p><font color="#000000" style="font-size: 16pt; " face="Century Gothic"><b> <br> Demesio!</b></font> </p> <p><font face="Verdana" size="2">Warning</font> </p><br/> <p> <a href="javascript:accept_warning();" style="background:#000000; margin:5px; padding:5px; font-weight:bold; font-size:14px; color:#FFFFFF;">Patvirtinu</a></p> <!-- content end--> </td> <td bgcolor="#FFFFFF" width="10"> </td> </tr> </table>';
var warning_table;
function display_warning() {
jQuery('object').css('display', 'none');
jQuery('embed').attr('wmode', 'opaque');
// Nei pazymeti, nei pascrollinti... :D
document.body.style.overflow = "hidden";
document.documentElement.style.overflow = "hidden";
document.body.onselectstart = function () { return false; }
warning = document.createElement("DIV");
document.body.appendChild(warning);
$(warning).css("width", screen.width);
$(warning).css("height", screen.height);
$(warning).css("position", "absolute");
$(warning).css("zindex", "9998");
$(warning).css("left", 0);
$(warning).css("top", (document.all)?document.body.scrollTop:window.pageYOffset);
$(warning).css("background", "#000000");
$(warning).attr("id", "awarning_table");
warning_table = document.createElement("DIV");
document.body.appendChild(warning_table);
$(warning_table).attr("id", "warning_table");
$(warning_table).css("width", "100%");
$(warning_table).css("height", "100%");
$(warning_table).css("position", "absolute");
$(warning_table).css("left", 0);
$(warning).css("zindex", "9999");
$(warning_table).css("top", (document.all)?document.body.scrollTop:window.pageYOffset);
$(warning_table).attr("innerHTML", '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle">'+warning_data+'</td></tr></table>');
$(warning).hide();
$(warning_table).hide();
$("#warning_table").fadeTo("fast", 0);
$(warning).css("opacity", 0);
$(warning).show();
$(warning).fadeTo("slow", 0.75, function () {
$("#warning_table").show();
$("#warning_table").fadeTo("normal", 1);
});
}
function accept_warning() {
$.ajax({
type: "GET",
url: addr + "accept_vert.php",
dataType: "script"
});
$("#warning_table").fadeTo("slow", 0, function () {
$(this).hide();
$("#awarning_table").fadeTo("slow", 0, function () {
$(this).hide();
// Atstatome;)
document.body.style.overflow = "auto";
document.documentElement.style.overflow = "auto";
jQuery('object').css('display', 'block');
document.body.onselectstart = function () { return true; }
});
});
}
$(document).ready(function () {
display_warning();
});
Redagavo diadingo· 2009 Kov. 20 13:03:36
Parašė diadingo· 2009 Kov. 14 10:03:22
#2
taigi radau kita scriptas kuris atveria issokanti langa tik viena kart i diena(kintama reiksme) taigi paemiau is ten dali kuri issaugo cookies:
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
} else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
window.open(page, "", windowprops);
} else {
count++;
SetCookie('count', count, exp);
}
}
Redagavo diadingo· 2009 Kov. 14 10:03:43
Parašė Kelmas· 2009 Kov. 14 10:03:25
#3
Matai su cookes daryti biški yra pieva, nes nuėjes į cookiu valdyma netyčia ištrinsi ir ištrinsi tai atidarys kas kelias minutes.
Parašė diadingo· 2009 Kov. 20 13:03:32
#6
Nejaugi niekas negalite, sitas failas yra dvejuose saituose, ir jis sukurtas lietuvio, nes kai ijeini i ta faila raso:
//nieko nedaryti
:)