Javascript

Conversation Window

<html>
<head>
    <title>Chatroom Conversation</title>
    <!-- © James Kanjo 2011 -->
    <script type="text/javascript">
        var str_raw = unescape(window.location.hash).substring(1);
        var str_domain = /^([^#]+)#/.exec(str_raw)[1];
 
        function refreshConvo(){
            document.getElementById("newest").src = 'http://' + str_domain + '/chat:_newest';
            setTimeout('refreshConvo()', 15000);
        }
    </script>
</head>
<body onload="setTimeout('refreshConvo()', 15000)" style="margin: 0;">
    <script type="text/javascript">
        var str_raw = unescape(window.location.hash).substring(1);
        var str_domain = /^([^#]+)#/.exec(str_raw)[1];
        document.write('<audio autoplay="autoplay">\n<source src="http://chat.wikidot.com/local--files/alert/alert_2011.mp3" type="audio/mpeg" />\n<source src="http://chat.wikidot.com/local--files/alert/alert_2011.wav" type="audio/wav" />\n<iframe src="http://snippets.wdfiles.com/local--code/code:mp3#http://chat.wikidot.com/local--files/alert/alert_2011.mp3#autoplay" align="" frameborder="0" height="" scrolling="no" width="" class="" style="width: 9px; height: 9px;"></iframe>\n</audio>')
        document.write('<iframe src="http://' + str_domain + '/chatarchive/category/chat/order/created_at%20desc/limit/50/offset/10?theme_url=http://chat.wdfiles.com/local--code/css:2" frameborder="0" scrolling="no" style="width: 100%; height: 100%; min-width: 350px; margin: 0 auto;"></iframe>');
        document.write('<iframe id="newest" src="http://' + str_domain + '/chat:_newest" style="display: none;"></iframe>');
    </script>
</body>
</html>

Update Check

<html>
<head>
    <title>Update Check</title>
    <!-- © James Kanjo 2011 -->
</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>
    <!-- © James Kanjo 2011 -->
</head>
<body>
    <script type="text/javascript">
        var str_domain = unescape(window.location.hash).substring(1);
        window.parent.parent.location = 'http://' + str_domain + '/chatroom';
    </script>
</body>
</html>

Active Users

<html>
<head>
    <title>Chatroom Active Users</title>
    <!-- © James Kanjo 2011 -->
    <style type="text/css">
        a {text-decoration: none; font-style: italic;}
    </style>
</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 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(/##/)+2);
            users[tmp_count] = string_users.substring(0);
            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('<a href="http://www.wikidot.com/user:info/' + users[tmp_count].substring(0,users[tmp_count].search(/#/)) + '" target="_top">' + users[tmp_count].substring(users[tmp_count].search(/#/)+1) + '</a><br />');
        }
    </script>
</body>
</html>

Edit Comment

<html>
<head>
    <title>Chatroom Edit Comment</title>
    <!-- © James Kanjo 2011 -->
    <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>
</body>
</html>

Conversation Window Mini

<html>
<head>
    <title>Chatroom Conversation Mini</title>
    <!-- © James Kanjo 2011 -->
    <script type="text/javascript">
        var str_raw = unescape(window.location.hash).substring(1);
        var str_domain = /^([^#]+)#/.exec(str_raw)[1];
 
        function refreshConvo(){
            document.getElementById("newest").src = 'http://' + str_domain + '/chat:_newest';
            setTimeout('refreshConvo()', 15000);
        }
    </script>
</head>
<body onload="setTimeout('refreshConvo()', 15000)" style="margin: 0;">
    <script type="text/javascript">
        var str_raw = unescape(window.location.hash).substring(1);
        var str_domain = /^([^#]+)#/.exec(str_raw)[1];
        document.write('<audio autoplay="autoplay">\n<source src="http://chat.wikidot.com/local--files/alert/alert_2011.mp3" type="audio/mpeg" />\n<source src="http://chat.wikidot.com/local--files/alert/alert_2011.wav" type="audio/wav" />\n<iframe src="http://snippets.wdfiles.com/local--code/code:mp3#http://chat.wikidot.com/local--files/alert/alert_2011.mp3#autoplay" align="" frameborder="0" height="" scrolling="no" width="" class="" style="width: 9px; height: 9px;"></iframe>\n</audio>')
        document.write('<iframe src="http://' + str_domain + '/chatarchive/category/chat/order/created_at%20desc/limit/50/offset/10?theme_url=http://chat.wdfiles.com/local--code/css:3" frameborder="0" scrolling="auto" style="width: 100%; height: 100%; min-width: 200px; margin: 0 auto;"></iframe>');
        document.write('<iframe id="newest" src="http://' + str_domain + '/chat:_newest" style="display: none;"></iframe>');
    </script>
</body>
</html>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License