_javascript

Conversation Window

<html>
<head>
    <title>Chatroom Conversation</title>
    <script type="text/javascript">
        var dom_params = /^(.*)\.wdfiles\.com$/;
        var domain = dom_params.exec(window.location.host)[1];
        function refreshConvo(){
            document.getElementById("newest").src = 'http://' + domain + '.wikidot.com/chat:_newest';
            setTimeout('refreshConvo()', 15000);
        }
    </script>
</head>
<body onload="setTimeout('refreshConvo()', 15000)">
    <script type="text/javascript">
        var dom_params = /^(.*)\.wdfiles\.com$/;
        var domain = dom_params.exec(window.location.host)[1];
        document.write('<iframe src="http://snippets.wdfiles.com/local--code/code:mp3#http://' + domain + '.wdfiles.com/local--files/chatroom/alert.mp3#autoplay" align="" frameborder="0" height="" scrolling="no" width="" class="" style="width: 9px; height: 9px;"></iframe>');
        document.write('<iframe src="http://' + domain + '.wikidot.com/chat:_conversation" frameborder="0" scrolling="auto" style="width: 100%; height: 100%; min-width: 350px; margin: 0 auto;"></iframe>');
        document.write('<iframe id="newest" src="http://' + domain + '.wikidot.com/chat:_newest" style="display: none;"></iframe>');
    </script>
</body>
</html>

Update Check

<html>
<head>
    <title>Update Check</title>
</head>
<body>
    <script type="text/javascript">
        if (window.parent.parent.location.hash != window.location.hash) {
            window.parent.parent.location.href = 'http://' +window.parent.parent.location.hostname + window.parent.parent.location.pathname + window.location.hash;
            window.parent.parent.location.reload();
        }
    </script>
</body>
</html>

Post Comment Refresh

<html>
<head>
    <title>Chatroom New Comment Refresh</title>
</head>
<body>
    <script type="text/javascript">
        var dom_params = /^(.*)\.wdfiles\.com$/;
        var domain = dom_params.exec(window.location.host)[1];
        window.parent.parent.location = 'http://' + domain + '.wikidot.com/chatroom';
    </script>
</body>
</html>

Active Users

<html>
<head>
    <title>Chatroom Active Users</title>
</head>
<body>
    <script type="text/javascript">
        <!--
        /* Remove duplicate elements from array function taken from:
        http://www.martienus.com/code/javascript-remove-duplicates-from-array.html
        */
        function unique(a) {
            var r = new Array();
            o:for(var i = 0, n = a.length; i < n; i++) {
                for(var x = 0, y = r.length; x < y; x++) {
                    if(r[x]==a[i]) continue o;
                }
                r[r.length] = a[i];
            }
            return r;
        }
        //-->
        var dom_params = /^(.*)\.wdfiles\.com$/;
        var domain = dom_params.exec(window.location.host)[1];
        var newCSS = document.createElement('link');
        newCSS.rel = 'stylesheet';
        newCSS.href = 'data:text/css,' + escape('@import url("http://' + domain +'.wdfiles.com/local--code/chat:_css");');
        document.getElementsByTagName("head")[0].appendChild(newCSS);
 
        var string_users = unescape(window.location.hash);
        var users = new Array();
        var tmp_count = 0;
 
        while (0<=string_users.search(/#/)) {
            string_users = string_users.substring(string_users.search(/#/)+1);
            users[tmp_count] = string_users.substring(string_users.search(/#/)+1);
            if (0<=string_users.search(/#/))
                users[tmp_count] = string_users.substring(0,string_users.search(/#/));
            tmp_count = tmp_count+1;
        }
 
        users = unique(users);
        for (tmp_count=0;tmp_count<=users.length-1;tmp_count++) {
            document.write('<span class="active-users">' + users[tmp_count] + '</span><br />');
        }
    </script>
</body>
</html>

Edit Comment

<html>
<head>
    <title>Chatroom Edit Comment</title>
    <script type="text/javascript">
        function editConvo(){
            window.parent.parent.location = unescape(window.location.hash).substring(1);
        }
    </script>
</head>
<body class="edit" style="background: url(http://community.wikidot.com/local--files/nav:side/accessories-text-editor-32x32.png) no-repeat;" onclick="editConvo();">
<a href="javascript:editConvo();" style="position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%;"></a>
    <script type="text/javascript">
        var dom_params = /^(.*)\.wdfiles\.com$/;
        var domain = dom_params.exec(window.location.host)[1];
        var newCSS = document.createElement('link');
        newCSS.rel = 'stylesheet';
        newCSS.href = 'data:text/css,' + escape('@import url("http://' + domain +'.wdfiles.com/local--code/chat:_css");');
        document.getElementsByTagName("head")[0].appendChild(newCSS);
    </script>
</body>
</html>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License