NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is three + seven?

Go back

Topic review (newest first)

Waccoon
12-07-2005 04:36:01

This is the code I'm using for smiley insertion right now.

Code:

function insertText(id, newtext) {
    // Works for IE and Mozilla, but not many others
    var box = document.getElementById(id);
    box.focus();

    if (box.createTextRange) {
        // IE (use this instead of caretPos)
        document.selection.createRange().text += newtext;
    } else if (box.setSelectionRange) {
        // Mozilla, some others
        var len = box.selectionEnd;
        box.value = box.value.substr(0, len) + newtext + box.value.substr(len);
        box.setSelectionRange(len + newtext.length, len + newtext.length);
    } else {
        // DOM
        box.value += newtext;
    }
}

I'm not sure how to make the interface to customize smilies, so I may save that feature for 1.3.  I didn't get a chance to work on 1.2.5 last weekend (relatives came over... grumble), so I'll aim for next week.

kendra
12-06-2005 11:40:20

I have been working on this idea of adding smilies codes via click.

// put this .js function into the head section of the page


<script language="javascript">
<!--
function writeImgTag(code)
{
var cache = document.form_name.text.value;
this.code = code;
document.form_name.text.value = cache + " <img src='/images/" + code + ".gif'> ";
document.form_name.text.focus();
}
//-->
</script>


1) change form_name to the name of the form specified in the <form> tag
2) change text to the name of the textarea form element you want the code to be written into
3) change the image path to wherever you keep your images.



Example html for Inserting a emoticon: I added a space or smile will show in example not code.

<img onClick="writeImgTag('smile')" src=": )" border=0>

or insert the image:
<img onClick="writeImgTag('smile')" src="/smiles/happy.gif" border=0>

[b]Note:[.b]
You will need to specify the correct path and image names. I tend to keep all .js files in seperate files then just call them using

<script language="JavaScript" src="emoticon.js"></script>

Ill post more as I refine it, I think it might bet better to let the emoticon be interpeted with a keystroke other then inserting the actual image,

Waccoon
12-01-2005 04:16:17

I forgot to add a list of smilies to the comment page in Wacintaki.  I've already fixed that in 1.2.5 (my own board), and I'll be releasing it, soon.

What I really want to do is make smilies customizable.  That requires a database change, but it'll be worth it.  I'll also update the code to detect duplicates, so both :-) and :) will use the same image.  Hopefully, I won't get sidetracked again this weekend.

kendra
11-30-2005 15:02:35

Are you talking about these forums or Waci?

For the forums there is a emoticon mod , its not to hard to implement. We had it done then a stupid upgrade came out and i never thought of it so we lost them.

You can see it here

http://www.punres.org/viewtopic.php?id=194

Hope that helps

~Kendra~

Waccoon
11-12-2005 03:49:06

I want to have a nice JavaScript thing on the comment screen that lets people add smilies with a mouse click, but as usual, I'm a lazy.

In the meantime (the next six years), here's a reference.  You shouldn't have much trouble telling which is which:

>:D
>:)
:)
:|
:(
:D
:o
;)
:/
:P
:lol:
:mad:
:rolleyes:
:cool:
:duh:
:blush:
:cry:
:boohoo:
:crazy:
:what:
:sneaky:
:gamer:
:barf:

Max
11-11-2005 12:47:54

Ok can somebody tell me the complete list of smiles and what symbold make them? because i only can figure out 5

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB