felladrin / online-visitors-counter

Real-time online visitors counter using Ajax, PHP PDO and SQLite.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Mobile Version Not working

ankitsingh101 opened this issue · comments

I have Changed this code to not show iframe

`/*

/**

  • Adds a function to be executed when window has finished loading.
  • @param func Function to be executed when window is ready.
    */
    function initialize(func)
    {
    if (window.addEventListener)
    window.addEventListener('load', func, false);
    else if (window.attachEvent)
    window.attachEvent('onload', func);
    }

/**

  • Gets the current directory of this script.
  • @returns {string} Current directory of this script.
    /
    var onlineVisitorsCounterScriptPath = function ()
    {
    var scripts = document.getElementsByTagName('script');
    var path = '';
    if (scripts && scripts.length > 0)
    {
    for (var i in scripts)
    {
    if (scripts[i].src && scripts[i].src.match(//counter.js$/))
    {
    path = scripts[i].src.replace(/(.
    )/counter.js$/, '$1');
    break;
    }
    }
    }
    return path;
    };

/**

  • Updates the counter.
    */
    function updateOnlineVisitorsCounter()
    {
    var page_title = window.document.title;
    var page_url = window.location.href;
    var xmlhttp = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');

    xmlhttp.onreadystatechange = function ()
    {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
    {
    document.getElementById('online-visitors-counter').innerHTML = xmlhttp.responseText;
    }
    };

    xmlhttp.open('POST', onlineVisitorsCounterScriptPath() + '/counter.php', true);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.send('page_title=' + encodeURIComponent(page_title) + '&' + 'page_url=' + encodeURIComponent(page_url));
    setTimeout(updateOnlineVisitorsCounter, 4000);
    }

/**

  • Creates the counter element, or adjust it if it already exists.
    */
    function createOnlineVisitorsCounterElement()
    {
    var existingElement = document.getElementById('online-visitors-counter');

    if (existingElement === null) // Only creates a new element if does not exist yet.
    {
    var button = document.createElement('strong');
    button.id = 'online-visitors-counter';
    button.style.cssText = 'text-decoration:none;';
    document.getElementById('useronline-count').appendChild(button);
    }
    }

/**

  • Creates an iframe to show where are other visitors.
    */
    // Initializes the conter as soon as the page finishes loading.
    initialize(function ()
    {
    createOnlineVisitorsCounterElement();
    updateOnlineVisitorsCounter();
    });`

inside config.php

$linkFormat = '%1$d';

can you paste properly ?

The explanation for avoid showing the iframe can be found here: #2 (comment)