Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / Всплытие кликандера каждые 24 часа / 3 сообщений из 3, страница 1 из 1
30.05.2013, 19:01
    #38280731
9_Dima_9
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Всплытие кликандера каждые 24 часа
Добрый вечер всем. Есть js скрипт кликандера, в котором окно всплывает каждую минута, а нужно каждые 24 часа. Помогите пожалуйста исправить.

Код: javascript
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.
if (navigator.cookieEnabled){
    var pop_under = null, pop_cookie_name = "ub50111112", pop_timeout = 1;

    function pop_cookie_enabled(){
        var is_enabled = false;
        if (!window.opera && !navigator.cookieEnabled)
            return is_enabled;
        if (typeof document.cookie == 'string')
            if (document.cookie.length == 0){
                document.cookie = "test";
                is_enabled = document.cookie == 'test';
                document.cookie = '';
        } else {
            is_enabled = true;
        }
        return is_enabled;
    }

    function pop_getCookie(name){
        var cookie = " " + document.cookie, search = " " + name + "=", setStr = null, offset = 0, end = 0;
        if (cookie.length > 0){
            offset = cookie.indexOf(search);
            if (offset != -1){
                offset += search.length;
                end = cookie.indexOf(";", offset);
                if (end == -1){
                    end = cookie.length;
                }
                setStr = unescape(cookie.substring(offset, end));
            }
        }
        return(setStr);
    }

    function pop_setCookie (name, value){
        document.cookie = name + "=" + escape(value) + ";expires=Friday,31-Dec-50 23:59:59 GMT; path=/;";
    }

    function show_pop(){
        var pop_wnd = "http://site.ru/", fea_wnd = "scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0", need_open = true;
        if (document.onclick_copy != null)
            document.onclick_copy();
        if (document.body.onbeforeunload_copy != null)
            document.body.onbeforeunload_copy();
        if (pop_under != null){
            if (!pop_under.closed)
                need_open = false;
        }
        if (need_open){
            if (pop_cookie_enabled()){
                val = pop_getCookie(pop_cookie_name);
                if (val != null){
                    now = new Date();
                    val2 = new Date(val);
                    utc1 = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
                    utc2 = Date.UTC(val2.getFullYear(), val2.getMonth(), val2.getDate(), val2.getHours(), val2.getMinutes(), val2.getSeconds());
                    if ((utc1 - utc2)/1000 < pop_timeout*60){
                        need_open = false;
                    }
                }
            }
        }
        if (need_open){
            under = window.open(pop_wnd, "", fea_wnd);
            under.blur();
            window.focus();
            if (pop_cookie_enabled()){
                now = new Date();
                pop_setCookie(pop_cookie_name, now);
            }
        }
    }

    function pop_init(){
        var ver = parseFloat(navigator.appVersion);
        var ver2 = (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )&&(navigator.userAgent.indexOf('Opera') == -1)&&(navigator.appName != 'Netscape') &&(navigator.userAgent.indexOf('MSIE') > -1) &&(navigator.userAgent.indexOf('SV1') > -1) &&(ver >= 4);
        if (ver2){
            if (document.links){
                for (var i=0; i<document.links.length; i++){
                    if (document.links[i].target != "_blank"){
                        document.links[i].onclick_copy = document.links[i].onclick;
                        document.links[i].onclick = show_pop;
                    }
                }
            }
        }
        document.onclick_copy = document.onclick;
        document.onmouseup = show_pop;return true;
    }
    pop_init();
}

onunload="window.location.replace('site.ru/');"
...
Рейтинг: 0 / 0
30.05.2013, 23:14
    #38280906
IDVsbruck
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Всплытие кликандера каждые 24 часа
Не забывай форматировать код.
А если вдруг человек зайдет не с Windows 95 или Windows 98, а с Windows 3.1 или даже Windows 3.11? Это же не теплый ламповый код! Надо гарантийно, железобетонно обеспечить НЕпросачивание таких наглых юзеров!
...
Рейтинг: 0 / 0
31.05.2013, 10:37
    #38281190
artas
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Всплытие кликандера каждые 24 часа
9_Dima_9,

Код: javascript
1.
var pop_under = null, pop_cookie_name = "ub50111112", pop_timeout = 1440;


а так ?
...
Рейтинг: 0 / 0
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / Всплытие кликандера каждые 24 часа / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]