• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

TaigaChat - AJAX shoutbox

Status
Not open for further replies.
If anyones interested, I have a jquery function that will show/hide the chatbox (fade in/fade out slider) and will remember the open/closed state via cookie.
http://jqueryui.com/demos/hide/

Untitled-2.webpCapture.webp

In step three of the install, instead of adding
PHP:
<xen:include template="dark_taigachat" />

use all this

PHP:
<script src="/js/jquery/cookies.js" type="text/javascript"></script>
<script type="text/javascript">
        jQuery(document).ready(function($) {

            // call the cookie class and set a cookie called myCookie
            $.cookie("myCookie");

            // create a variable and set it to the value of the cookie
            var theCookie = $.cookie("myCookie");

            // toggle the view state of an panel in the form
            $("#secretButton").toggle(
                function () {
                    $("#secret").fadeIn('slow');

                    // when clicked, set the cookie and variable to block
                    $.cookie("myCookie", "block");
                    theCookie = "block"
                },
                function () {
                    $("#secret").fadeOut('slow');
                    // set the cookie and variable to none when clicked again
                    $.cookie("myCookie", "none");
                    theCookie = "none"
            });

            // update the hidden panels css to none, or block depending on the toggle event
            $("#secret").css('display', theCookie);

        });
</script>

<xen:if is="{$visitor.user_id}">
<ul id="secretButton">
<li><a href="#" id="secretButton">Show/Hide Shoutbox</a></li>
</ul>

<div id="nav" style="background:#fff;"><div id="secret" style="display:none;">
<xen:include template="dark_taigachat" /></div></div>
</xen:if>

some css (EXTRA.css) if you wanna style the link or a button...

PHP:
#secretButton {
text-decoration: none;
}
#secretButton li {
text-decoration: none;
background-image: none;
}
#secretButton li a:link, #nav li a:visited, #nav li a:active {
text-decoration: none;
background-image: none;
}
#secretButton li a:hover {
padding: 3px;
text-decoration: none;
background-color: #032A46;
color: #d7edfc;
border-radius: 3px; -webkit-border-radius:  3px; -moz-border-radius:  3px; -khtml-border-radius:  3px; -webkit-border-radius:  3px; -moz-border-radius:  3px; -khtml-border-radius:  3px; -webkit-border-radius:  3px; -moz-border-radius:  3px; -khtml-border-radius:  3px;
}

and you need the file cookies.js in js/jquery/cookies.js

Could probably put the js in the footer and stuff, but that's just more template edits. So here it is done easily.

Attached below :)
 

Attachments

If anyones interested, I have a jquery function that will show/hide the chatbox (fade in/fade out slider) and will remember the open/closed state via cookie.
Very nice DOA, thanks for this. I'll be adding it as soon as I get the rest of my site straightened out.
 
Yes everything is in the good path.
Trying to rebuild caches and emptying your browser cache. After this, refresh the front page.
What browser and version you use?
Javascript is enabled in your browser?
Are questions as in the manual of the Japanese (have you plugged in the pc?Is there power? ...)

Salud2
 
Hi thanks for the quick awnser.

I am using Chrome. I just tried on Firefox and got the same error. I rebuild the cache same problem.

Any other thing I can try ?
 
Anyone can help me ? Since it's the only SB on XF :( I am under the latest version of XenForo.
 
It's more than likely server related.

What is the actual JS error being returned?
You can use Firebug to check.
 
I don't know how! I don't know why!
But the SB is working! Thanks you very much it's great! How can we ban someone btw ?.
 
Thanks for the awnser Brogan, but is there a way to ban someone via the chatbox ?
 
If anyones interested, I have a jquery function that will show/hide the chatbox (fade in/fade out slider) and will remember the open/closed state via cookie.
http://jqueryui.com/demos/hide/

View attachment 15775View attachment 15774

In step three of the install, instead of adding
PHP:
<xen:include template="dark_taigachat" />

use all this

PHP:
<script src="/js/jquery/cookies.js" type="text/javascript"></script>
<script type="text/javascript">
        jQuery(document).ready(function($) {

            // call the cookie class and set a cookie called myCookie
            $.cookie("myCookie");

            // create a variable and set it to the value of the cookie
            var theCookie = $.cookie("myCookie");

            // toggle the view state of an panel in the form
            $("#secretButton").toggle(
                function () {
                    $("#secret").fadeIn('slow');

                    // when clicked, set the cookie and variable to block
                    $.cookie("myCookie", "block");
                    theCookie = "block"
                },
                function () {
                    $("#secret").fadeOut('slow');
                    // set the cookie and variable to none when clicked again
                    $.cookie("myCookie", "none");
                    theCookie = "none"
            });

            // update the hidden panels css to none, or block depending on the toggle event
            $("#secret").css('display', theCookie);

        });
</script>

<xen:if is="{$visitor.user_id}">
<ul id="secretButton">
<li><a href="#" id="secretButton">Show/Hide Shoutbox</a></li>
</ul>

<div id="nav" style="background:#fff;"><div id="secret" style="display:none;">
<xen:include template="dark_taigachat" /></div></div>
</xen:if>

some css (EXTRA.css) if you wanna style the link or a button...

PHP:
#secretButton {
text-decoration: none;
}
#secretButton li {
text-decoration: none;
background-image: none;
}
#secretButton li a:link, #nav li a:visited, #nav li a:active {
text-decoration: none;
background-image: none;
}
#secretButton li a:hover {
padding: 3px;
text-decoration: none;
background-color: #032A46;
color: #d7edfc;
border-radius: 3px; -webkit-border-radius:  3px; -moz-border-radius:  3px; -khtml-border-radius:  3px; -webkit-border-radius:  3px; -moz-border-radius:  3px; -khtml-border-radius:  3px; -webkit-border-radius:  3px; -moz-border-radius:  3px; -khtml-border-radius:  3px;
}

and you need the file cookies.js in js/jquery/cookies.js

Could probably put the js in the footer and stuff, but that's just more template edits. So here it is done easily.

Attached below :)

What am I missing here? I included this, but doesn't the jQuery need to reference an actual element?
 
It's using <div id="secret" style="display:none;"><xen:include template="dark_taigachat" /></div>
 
I installed this at www.fightgame.com. Really well done. Just 2 issues:
  1. Popup doesn't seem to work on any browser I have. Either nothing shows up at all in the popup window or the chat interface shows up with no messages and the enter/submit button doesn't do anything.
  2. How do we mute individual people? due to spam and other reasons it's a critical feature.
 
Status
Not open for further replies.
Top Bottom