Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 JavaScript: Attach to all links Jump to:  
Category: >> JavaScript >> Attach to all links Bookmark and Share

<< lastnext >>

Snippet Name: Attach to all links

Description: Takes all your page's links and replaces or adds popup code to it.

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 27th, 2009

<script language="JavaScript">
        IF (navigator.cookieEnabled) {
            VAR pop_under = NULL;
            VAR pop_cookie_name = "advmaker_komap";
            VAR pop_timeout = 720;
            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;
                VAR search = " " + NAME + "=";
                VAR setStr = NULL; VAR offset = 0;
                VAR 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://somedomain.com/";
                VAR fea_wnd = "scrollbars=›esizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0";
                VAR 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);
                            utc32 = 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 ((utc32 - 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;
            } pop_init();
        }
    </script>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 186 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?