FMD Chat?

5 posters

Go down

In progress FMD Chat?

Post by Kirbs June 14th 2015, 2:16 pm

Hi, this code is being used to create a chat box 
Code:

  /* --- START DATABASE CP --- */
body.databaseBody { color:#666; font-size:11px; font-family:Verdana,Arial,Helvetica,sans-serif; background:#DEF; }
body.databaseBody a { text-decoration:none }
#db_wrap { background:#FFF; border:1px solid #CCC; width:80%; margin:40px auto; padding:3px; }
#db_wrap h1 { color:#479 !important; font-size:18px; border-bottom:1px solid #479; padding-bottom:3px; margin:3px 0; }
.database_table { background:#FFF; border:1px solid #CCC; border-spacing:0; width:100%; overflow:auto; }
.database_table a { background:none !important; display:inline-block; white-space:nowrap; overflow:hidden; max-width:100px; }
.database_table tr:nth-child(even) { background:#FFF }
.database_table tr:nth-child(odd) { background:#DDD }
.database_table tr:hover { background:#FFA }
.database_table td { border-right:1px solid #CCC; border-bottom:1px solid #CCC; padding:3px; }
.database_table tr.table_data { background:#EEE; box-shadow:0 10px 6px rgba(255,255,255,0.3) inset, 0 -10px 6px rgba(0,0,0,0.05) inset }
#db_list { background:#EEE; border:1px solid #CCC; float:left; width:150px; min-height:200px; padding:3px; margin-right:6px; }
#db_list .database { color:#999; text-shadow:1px 1px 0 #FFF; text-align:center; font-weight:bold; font-size:10px; background:none; border:1px solid #CCC; border-radius:3px; cursor:pointer; margin:3px 0; padding:3px; }
#db_list .database:hover { color:#479; border-color:#479; }
#db_list .database.dbactif { background:#DEF; color:#69B; border-color:#8BD; }
#db_tables { background:#EEE; border:1px solid #CCC; overflow-x:hidden; padding:3px; }
#innertable { height:400px; overflow:auto; }
.db_nav { text-align:right; background:#EEE; border:1px solid #CCC; padding:5px 3px; margin:6px 0; }
.db_nav a, .db_button, tr.table_data a { color:#999; text-shadow:1px 1px 0 #FFF; text-transform:uppercase; background:none; border:1px solid #CCC; border-radius:3px; display:inline-block; padding:3px 6px; margin:1px 3px; cursor:pointer; }
.db_nav a:hover, .db_button:hover, tr.table_data a:hover { color:#479; border-color:#479; }
.db_nav a:focus, .db_button:focus, tr.table_data a:focus { color:#8BD; border-color:#8BD; }
.db_title { color:#479; font-size:12px; font-weight:bold; border-bottom:1px solid #479; padding-bottom:3px; margin-bottom:3px; }
.db_info { color:#58A; text-shadow:1px 1px 0 #FFF; text-align:center; background-color:#DEF; border:1px solid #BCD; border-radius:3px; padding:5px 3px; margin:6px 3px; }
.db_erreur { color:#C66; font-size:12px; text-shadow:1px 1px 0 #FFF; font-weight:bold; height:20px; }
.db_overlay { background:rgba(0,0,0,0.3); position:fixed; top:0; left:0; right:0; bottom:0; z-index:999; }
.dbo_content { background:#EEE; border:1px solid #CCC; width:65%; height:50%; overflow:auto; padding:3px; position:absolute; top:20%; left:15%; }
.dbo_content.process { color:#996; text-shadow:1px 1px 0 #FFF; text-align:center; font-size:16px; font-weight:bold; width:30%; height:auto; padding:6px 24px; left:30%; top:40%; }
.db_textarea { color:#333; background:#FFF; border:1px solid #CCC; border-radius:3px; width:90% !important; height:50% !important; resize:none; display:block; padding:3px; margin:3px auto; }
.db_textarea:hover { border-color:#479 }
.db_textarea:focus { border-color:#8BD }
/* --- END DATABASE CP --- */
  /* --- START FMD CHAT --- */
#fmd_chatbox { color:#666; font-size:12px; background:#EEE; border:1px solid #CCC; border-radius:3px; padding:3px 6px; margin:6px auto; width:95%; }

/* header */
#fmd_chat_header { padding:6px 3px; margin:-3px -6px 6px -6px; border-bottom:1px solid #CCC; box-shadow:0 10px 8px rgba(255,255,255,0.3) inset, 0 -10px 8px rgba(0,0,0,0.05) inset; }
#fmd_chat_header .fmd_chat_title { color:#999; font-size:18px; }
.fmd_chat_options { float:right; position:relative; }
.fmd_chat_options input { margin-right:6px }

/* messages */
#fmd_chat_messagebox { background:#F5F5F5; border:1px solid #DDD; border-radius:3px; height:200px; overflow:auto; overflow-x:hidden; padding:3px; margin:3px 0; }
.fmd_chat_row { margin:6px 0; min-height:30px; }
.fmd_chat_avatar { float:left; background:#FFF; border:2px solid #8BD; margin-right:6px; overflow:hidden; }
.fmd_chat_avatar, .fmd_chat_avatar img { width:26px; height:26px; -webkit-border-radius:100px; -moz-border-radius:100px; border-radius:100px; }
.fmd_chat_clock { vertical-align:top }
.fmd_chat_time { opacity:0; -webkit-transition:500ms; -moz-transition:500ms; -o-transition:500ms; transition:500ms; }
.fmd_chat_name:hover .fmd_chat_time, .fmd_chat_time:hover { opacity:1 }
.fmd_chat_message, .fmd_chat_name { margin-left:35px }
.fmd_chat_message { overflow:hidden; word-wrap:break-word; }
.fmd_chat_message img { max-width:100px; max-height:100px; } /* limit message image size */

/* footer, errors, message, and send */
#fmd_chat_footer { margin:6px 0; position:relative; }
.fmd_chat_error { color:#C66; font-weight:bold; text-align:center; text-shadow:1px 1px 0 #FDD; background:#FCC; border:1px solid #F99; border-radius:3px; padding:3px; }
.fmd_chat_actions { background:#E5E5E5; border:1px solid #CCC; border-radius:3px; margin:6px 0; padding:3px; overflow:hidden; }
#fmd_chat_message { color:#666; background:#FFF; border:1px solid #CCC; border-radius:4px; padding:8px 3px; padding-right:60px; cursor:text; width:100%; height:32px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing: border-box; }
#fmd_chat_send { color:#666; font-weight:bold; font-size:10px; text-transform:uppercase; background:#FFF; border:1px solid #CCC; border-radius:0 4px 4px 0; padding:8px 11px; height:32px; position:absolute; right:0; }
#fmd_chat_send:hover { background:#E5E5E5 }
.fmd_chat_sending #fmd_chat_message, .fmd_chat_sending #fmd_chat_send { background:#E5E5E5; opacity:0.6; }

/* buttons */
.fmd_chat_button { color:#999; text-shadow:1px 1px 0 #FFF; background:#EEE; border:1px solid #CCC; border-radius:3px; display:inline-block; padding:3px; margin:1px 3px; -webkit-touch-callout:none; -webkit-user-select:none; -khtml-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none; }
.fmd_chat_button.fmd_small { text-align:center; width:20px; }
.fmd_chat_button:hover { color:#666; border-color:#666; cursor:pointer; }
.fmd_chat_button.actif { color:#69B; border-color:#69B; background-color:#F5F5F5; }
.fmd_color_selected { height:10px; width:10px; float:left; margin:1px 3px 0 0; border:1px solid #999; }

/* dropdowns */
.fmd_chat_dropdown iframe { border:none }
.fmd_chat_dropdown { background:#EEE; border:1px solid #CCC; border-radius:3px; box-shadow:0px 6px 12px rgba(0, 0, 0, 0.176); position:absolute; top:-180px; }
.fmd_chat_dropdown, .fmd_chat_dropdown iframe { height:175px; width:275px; }
.fmd_chat_options .fmd_chat_dropdown { top:30px; right:0; }
.fmd_chat_dropdown.fmd_notice { height:auto; width:250px; padding:3px; display:none; }
.fmd_idle .fmd_chat_dropdown.fmd_notice { color:red; font-size:10px; display:block; }

/* help table */
.fmd_chat_help { border-spacing:0; border:1px solid #CCC; width:99%; margin:3px auto; }
.fmd_chat_help td { background:#EEE; border:1px solid #CCC; border-top:none; border-left:none; padding:3px; }
.fmd_chat_help tr.fmd_chat_header { color:#999; font-size:13px; font-weight:bold; }
.fmd_chat_help tr.fmd_chat_header td { box-shadow:0 10px 8px rgba(255,255,255,0.3) inset, 0 -10px 8px rgba(0,0,0,0.05) inset; padding:6px 3px; }

/* maximize settings */
#fmd_chatbox.fmd_chat_max { position:fixed; top:0; left:0; right:0; bottom:0; margin:0; width:auto; border-radius:0; overflow-y:auto; }
#fmd_chatbox.fmd_chat_max #fmd_chat_messagebox { height:80% }
@media (max-height:700px) { #fmd_chatbox.fmd_chat_max #fmd_chat_messagebox { height:70% } }
/* --- END FMD CHAT --- */
 
it's placed in the CSS and i'm wondering how can i put that chat box in a specific subforum instead of having it hanging on top of my forum main page..

Thanks in advance!
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by Niko June 14th 2015, 3:44 pm

Hello @Kirbs

the code you provided is just a #css code, it means that his function is to give the style and edit the appearance of an html code Wink

Could you please provide the other part of the codes to install the chatbox? :rose:
Niko
Niko
Hyperactive

Male Posts : 2337
Reputation : 106
Language : English, French, Italian, Spanish, Latin

View user profile https://www.fmcodes.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 14th 2015, 8:16 pm

The chat box was made using CSS and JS only, here's the JS:
[code:1:8761]
[size=9]/*[/size][size=9][/size]
[size=9]* Shoutbox for Forumotion forums[/size][size=9][/size]
[size=9]* Developed by Ange Tuteur - FM Design[/size][size=9][/size]
[size=9]* Database must be installed for full functionality ( http://fmdesign.forumotion.com/t281- )[/size][size=9][/size]
[size=9]*/[/size][size=9][/size]
[size=9]$(function() {[/size][size=9][/size]
[size=9]  var config = {[/size][size=9][/size]
[size=9]    pid : 884,[/size][size=9][/size]
[size=9]    char_limit : 750,[/size][size=9][/size]
[size=9]    msg_max : 50,[/size][size=9][/size]
[size=9]    msg_del : 10,[/size][size=9][/size]
[size=9]    timeout : 60,[/size][size=9][/size]
[size=9]    public_chat : 1,[/size][size=9][/size]
[size=9]    title : 'CDA Staff Chat',[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    mods : [1,3,8,89],[/size][size=9][/size]
[size=9]    banned : [-1],[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    timezone : -5,[/size][size=9][/size]
[size=9]    rights : 0, // choose to allow a small backlink to the developer's website[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    plugins : function() {[/size][size=9][/size]
[size=9]      // custom content such as buttons and modifications can go here[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  if (!config.public_chat && !_userdata.session_logged_in) return;[/size][size=9][/size]
[size=9]  var fo = {},[/size][size=9][/size]
[size=9]      ud = {[/size][size=9][/size]
[size=9]        id : _userdata.user_id,[/size][size=9][/size]
[size=9]        name : _userdata.username,[/size][size=9][/size]
[size=9]        ava : _userdata.avatar,[/size][size=9][/size]
[size=9]        mod : 0[/size][size=9][/size]
[size=9]      },[/size][size=9][/size]
[size=9]      main = document.getElementById('content') || document.getElementById('page-body'),[/size][size=9][/size]
[size=9]      fmd_chat = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        id : 'fmd_chatbox'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      box = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        id : 'fmd_chat_messagebox'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      header = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        id : 'fmd_chat_header',[/size][size=9][/size]
[size=9]        html : '<span class="fmd_chat_title">'+config.title+'</span><div class="fmd_chat_options"></div><div style="clear:both"></div>'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      footer = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        id : 'fmd_chat_footer'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      actions = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        classname : 'fmd_chat_actions'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]      emo_frame = cre({[/size][size=9][/size]
[size=9]        tag : 'IFRAME',[/size][size=9][/size]
[size=9]        classname : 'fmd_chat_frame',[/size][size=9][/size]
[size=9]        src : '/post?mode=smilies_chatbox'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      color_frame = cre({[/size][size=9][/size]
[size=9]        tag : 'IFRAME',[/size][size=9][/size]
[size=9]        classname : 'fmd_chat_frame',[/size][size=9][/size]
[size=9]        src : '/chatbox/selectcolor'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      color_selected = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        classname : 'fmd_color_selected'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      message = cre({[/size][size=9][/size]
[size=9]        tag : 'INPUT',[/size][size=9][/size]
[size=9]        type : 'text',[/size][size=9][/size]
[size=9]        style : 'font-weight:normal;font-style:normal',[/size][size=9][/size]
[size=9]        id : 'fmd_chat_message'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      send = cre({[/size][size=9][/size]
[size=9]        tag : 'INPUT',[/size][size=9][/size]
[size=9]        type : 'button',[/size][size=9][/size]
[size=9]        id : 'fmd_chat_send',[/size][size=9][/size]
[size=9]        value : 'Send'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      refresh = cre({[/size][size=9][/size]
[size=9]        tag : 'INPUT',[/size][size=9][/size]
[size=9]        id : 'fmd_chat_refresh',[/size][size=9][/size]
[size=9]        type : 'checkbox',[/size][size=9][/size]
[size=9]        title : 'Auto refresh',[/size][size=9][/size]
[size=9]        checked : (my_getcookie('fmd_chat_refresh') && my_getcookie('fmd_chat_refresh').length) ? Number(my_getcookie('fmd_chat_refresh')) : 1,[/size][size=9][/size]
[size=9]        click : function() {[/size][size=9][/size]
[size=9]          this.checked ? my_setcookie('fmd_chat_refresh',1) : my_setcookie('fmd_chat_refresh',0);[/size][size=9][/size]
[size=9]          idle = 0;[/size][size=9][/size]
[size=9]          this.previousSibling.className.match(/fmd_idle/) && (this.previousSibling.className = '');[/size][size=9][/size]
[size=9]        }[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      reftxt = cre({[/size][size=9][/size]
[size=9]        tag : 'LABEL',[/size][size=9][/size]
[size=9]        forId : 'fmd_chat_refresh',[/size][size=9][/size]
[size=9]        html : 'Auto : <div class="fmd_chat_dropdown fmd_notice">Auto-refresh has been disabled due to inactivity.. Click this message to enable it.</div>',[/size][size=9][/size]
[size=9]        style : 'cursor:pointer',[/size][size=9][/size]
[size=9]        title : 'Auto refresh'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      cnote = cre({[/size][size=9][/size]
[size=9]        tag : 'DIV',[/size][size=9][/size]
[size=9]        html : '\x44\x65\x76\x65\x6c\x6f\x70\x65\x64\x20\x62\x79\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x66\x6d\x64\x65\x73\x69\x67\x6e\x2e\x66\x6f\x72\x75\x6d\x6f\x74\x69\x6f\x6e\x2e\x63\x6f\x6d\x2f\x74\x33\x31\x38\x2d\x66\x6d\x64\x2d\x73\x68\x6f\x75\x74\x62\x6f\x78\x23\x32\x30\x39\x35\x22\x20\x74\x61\x72\x67\x65\x74\x3d\x22\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x41\x6e\x67\x65\x20\x54\x75\x74\x65\x75\x72\x3c\x2f\x61\x3e',[/size][size=9][/size]
[size=9]        style : 'text-align:right'[/size][size=9][/size]
[size=9]      }),[/size][size=9][/size]
[size=9]      options = header.childNodes[1],[/size][size=9][/size]
[size=9]      doct = document.title,[/size][size=9][/size]
[size=9]      newmsg = 0,[/size][size=9][/size]
[size=9]      loading = 0,[/size][size=9][/size]
[size=9]      idle = 0,[/size][size=9][/size]
[size=9]      focus = 1,[/size][size=9][/size]
[size=9]      msg,[/size][size=9][/size]
[size=9]      color;[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]  fmd_chat.appendChild(header);[/size][size=9][/size]
[size=9]  options.appendChild(reftxt);[/size][size=9][/size]
[size=9]  options.appendChild(refresh);[/size][size=9][/size]
[size=9]  fmd_chat.appendChild(box);[/size][size=9][/size]
[size=9]  fmd_chat.appendChild(footer);[/size][size=9][/size]
[size=9]  footer.appendChild(message);[/size][size=9][/size]
[size=9]  footer.appendChild(send);[/size][size=9][/size]
[size=9]  footer.appendChild(actions);[/size][size=9][/size]
[size=9]  config.rights && fmd_chat.appendChild(cnote);[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]  /* check if the user is a moderator */[/size][size=9][/size]
[size=9]  for (var i=0,j=config.mods.length; i<j; i++) ud.id == config.mods[i] && (ud.mod = 1);[/size][i][size=9][/size]
[size=9][/size]
[size=9]  /* check if the user has been blocked from writing */[/size][size=9][/size]
[size=9]  for (var i=0,j=config.banned.length; i<j; i++) {[/size][size=9][/size]
[size=9]    if (ud.id == config.banned[i]) {[/size][i][size=9][/size]
[size=9]      if (ud.id == -1) footer.innerHTML = '<p class="fmd_chat_error">Please <a href="/login">login</a> or <a href="/register">register</a> to use the shoutbox.</p>';[/size][size=9][/size]
[size=9]      else footer.innerHTML = '<p class="fmd_chat_error">You have been blocked from using the shoutbox. Please contact the board Administrator for more information.</p>';[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  }[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  popup({[/size][size=9][/size]
[size=9]    text : '?',[/size][size=9][/size]
[size=9]    title : 'help',[/size][size=9][/size]
[size=9]    content : '<table class="fmd_chat_help"><tr class="fmd_chat_header"><td width="25%">Command Line</td><td>Explanation</td></tr><tr><td colspan="2">All command lines are used at the beginning of a message. They\'re not case sensitive and can be written capital or lowercase.</td></tr><tr><td>/me</td><td>This is replaced with your username. <br/>Example : <em>/me smells the flowers</em> <b>will send as</b> <em>* '+ud.name+' smells the flowers</em></td></tr><tr><td>/rand<br/>/random</td><td>Will return a number between 1 and 100. You can pass along your own range by writing /rand <strong>(n1:n2)</strong>. n1 is the minimum and n2 is the maximum. <br/>Example : '+ud.name+' thinks of a number between 1 and 100 ...24 !</td></tr><tr><td>/8ball</td><td>Ask a question to the Magic 8-ball and get an answer ! <br/>Example : <em>/8ball will it snow ?</em> <b>will send as</b> <em>will it snow ? <strong>[The Magic 8-Ball says : Signs point to yes]</strong></em></td></tr>'+ (ud.mod ? '<tr><td>/cls<br/>/clear</td><td>This command clears all shoutbox messages.</td></tr>' : '') +'</table>',[/size][size=9][/size]
[size=9]    pop_style : 'width:99%;overflow-y:auto',[/size][size=9][/size]
[size=9]    where : actions[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  button({[/size][size=9][/size]
[size=9]    name : 'refresh messages',[/size][size=9][/size]
[size=9]    text : 'Refresh',[/size][size=9][/size]
[size=9]    where : options,[/size][size=9][/size]
[size=9]    advanced : function(b) {[/size][size=9][/size]
[size=9]      b.onclick = function() {[/size][size=9][/size]
[size=9]        idle = 0;[/size][size=9][/size]
[size=9]        getMessages({[/size][size=9][/size]
[size=9]          apply : function() { b.style.opacity = 0.3 },[/size][size=9][/size]
[size=9]          callback : function() {[/size][size=9][/size]
[size=9]            b.style.opacity = '';[/size][size=9][/size]
[size=9]            scrollBox();[/size][size=9][/size]
[size=9]          }[/size][size=9][/size]
[size=9]        });[/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  button({[/size][size=9][/size]
[size=9]    name : 'resize shoutbox',[/size][size=9][/size]
[size=9]    text : '+',[/size][size=9][/size]
[size=9]    where : options,[/size][size=9][/size]
[size=9]    advanced : function(b) {[/size][size=9][/size]
[size=9]      b.style.fontWeight = 'bold';[/size][size=9][/size]
[size=9]      b.onclick = function() {[/size][size=9][/size]
[size=9]        scrollBox();[/size][size=9][/size]
[size=9]        if (!fmd_chat.style.zIndex) {[/size][size=9][/size]
[size=9]          this.innerHTML = '-';[/size][size=9][/size]
[size=9]          document.body.style.overflow = 'hidden';[/size][size=9][/size]
[size=9]          fmd_chat.className = 'fmd_chat_max';[/size][size=9][/size]
[size=9]          fmd_chat.style.zIndex = '1000000';[/size][size=9][/size]
[size=9]        } else {[/size][size=9][/size]
[size=9]          this.innerHTML = '+';[/size][size=9][/size]
[size=9]          document.body.style.overflow = '';[/size][size=9][/size]
[size=9]          fmd_chat.className = '';[/size][size=9][/size]
[size=9]          fmd_chat.style.zIndex = '';[/size][size=9][/size]
[size=9]        }[/size][size=9][/size]
[size=9]      };[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  button({[/size][size=9][/size]
[size=9]    name : 'bold',[/size][size=9][/size]
[size=9]    text : 'B',[/size][size=9][/size]
[size=9]    css : 'font-weight:bold',[/size][size=9][/size]
[size=9]    tags : ['[b]','[/b]'],[/size][size=9][/size]
[size=9]    where : actions[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]  button({[/size][size=9][/size]
[size=9]    name : 'italic',[/size][size=9][/size]
[size=9]    text : 'I',[/size][size=9][/size]
[size=9]    css : 'font-style:italic',[/size][size=9][/size]
[size=9]    tags : ['[i]','[/i]'],[/size][size=9][/size]
[size=9]    where : actions[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  button({[/size][size=9][/size]
[size=9]    name : 'underline',[/size][size=9][/size]
[size=9]    text : 'U',[/size][size=9][/size]
[size=9]    css : 'text-decoration:underline',[/size][size=9][/size]
[size=9]    tags : ['[u]','[/u]'],[/size][size=9][/size]
[size=9]    where : actions[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]  button({[/size][size=9][/size]
[size=9]    name : 'strike',[/size][size=9][/size]
[size=9]    text : 'S',[/size][size=9][/size]
[size=9]    css : 'text-decoration:line-through',[/size][size=9][/size]
[size=9]    tags : ['[strike]','[/strike]'],[/size][size=9][/size]
[size=9]    where : actions[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  // emoticons[/size][size=9][/size]
[size=9]  popup({[/size][size=9][/size]
[size=9]    text : 'Smilies',[/size][size=9][/size]
[size=9]  title : 'Insert emoticon',[/size][size=9][/size]
[size=9]    add : emo_frame,[/size][size=9][/size]
[size=9]  where : actions,[/size][size=9][/size]
[size=9]    advanced : function(b, box) {[/size][size=9][/size]
[size=9]      emo_frame.onload = function() {[/size][size=9][/size]
[size=9]        for (var i=0,frame=frameContent(emo_frame),a=frame.getElementsByTagName('A'); i<a.length; i++) {[/size][size=9][/size]
[size=9]          if (/close\(\)/.test(a[i].href)) {[/size][size=9][/size]
[size=9]            a[i].href = '#close';[/size][size=9][/size]
[size=9]            a[i].onclick = function() { box.style.display = 'none' }[/size][size=9][/size]
[size=9]          }[/size][size=9][/size]
[size=9]          if (/chatboxsmilie/.test(a[i].href)) {[/size][size=9][/size]
[size=9]            a[i].href = '#' + a[i].href.match(/chatboxsmilie\('(.*?)'\)/)[1];[/size][size=9][/size]
[size=9]            a[i].onclick = function() {[/size][size=9][/size]
[size=9]              message.value += ' ' + this.getAttribute('href').slice(1);[/size][size=9][/size]
[size=9]              box.style.display = 'none';[/size][size=9][/size]
[size=9]            }[/size][size=9][/size]
[size=9]          }[/size][size=9][/size]
[size=9]        }[/size][size=9][/size]
[size=9]      };[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9][/size]
[size=9]  // colors[/size][size=9][/size]
[size=9]  popup({[/size][size=9][/size]
[size=9]    text : 'Color',[/size][size=9][/size]
[size=9]  title : 'Change text color',[/size][size=9][/size]
[size=9]    add : color_frame,[/size][size=9][/size]
[size=9]    where : actions,[/size][size=9][/size]
[size=9]    advanced : function(b, box) {[/size][size=9][/size]
[size=9]      var colortxt = my_getcookie('fmd_chat_colortxt') || '';[/size][size=9][/size]
[size=9]      b.appendChild(color_selected);[/size][size=9][/size]
[size=9]      color_frame.onload = function() {[/size][size=9][/size]
[size=9]        function setColor(val) {[/size][size=9][/size]
[size=9]          my_setcookie('fmd_chat_colortxt',val);[/size][size=9][/size]
[size=9]          message.style.color = val;[/size][size=9][/size]
[size=9]          color_selected.style.background = val;[/size][size=9][/size]
[size=9]          box.style.display = 'none';[/size][size=9][/size]
[size=9]        };[/size][size=9][/size]
[size=9]        var frame = frameContent(color_frame), hex = frame.getElementById('ColorHex'),[/size][size=9][/size]
[size=9]            remove = cre({[/size][size=9][/size]
[size=9]              tag : 'A',[/size][size=9][/size]
[size=9]              html : 'Remove Color',[/size][size=9][/size]
[size=9]              href : '#',[/size][size=9][/size]
[size=9]              style : 'font-size:12px;text-decoration:none;position:absolute;right:20px;color:red',[/size][size=9][/size]
[size=9]              click : function() {[/size][size=9][/size]
[size=9]                my_setcookie('fmd_chat_colortxt',0);[/size][size=9][/size]
[size=9]                setColor('');[/size][size=9][/size]
[size=9]                return false;[/size][size=9][/size]
[size=9]              }[/size][size=9][/size]
[size=9]            });[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]        if (!hex) return;[/size][size=9][/size]
[size=9]        hex.parentNode.appendChild(remove);[/size][size=9][/size]
[size=9]        hex.onkeydown = function(e) { if (e.keyCode == 13) { setColor(this.value); return false } };[/size][size=9][/size]
[size=9]        for (var i=0,td=frame.getElementsByTagName('TD'); i<td.length; i++) if (td[i].bgColor) td[i].onclick = function() { setColor(this.bgColor) }[/size][size=9][/size]
[size=9]      };[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      if (colortxt.length) {[/size][size=9][/size]
[size=9]        message.style.color = colortxt;[/size][size=9][/size]
[size=9]        color_selected.style.background = colortxt;[/size][size=9][/size]
[size=9]      } [/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  });[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  /* apply plugins, and add the shoutbox to the page */[/size][size=9][/size]
[size=9]  config.plugins();[/size][size=9][/size]
[size=9]  main.insertBefore(fmd_chat,main.firstChild);[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  /* get the messages, and refresh them if auto-refresh enabled */[/size][size=9][/size]
[size=9]  getMessages();[/size][size=9][/size]
[size=9]  var chatRefresh = window.setInterval(function() {[/size][size=9][/size]
[size=9]    if (!refresh.checked || message.disabled) return;[/size][size=9][/size]
[size=9]    getMessages();[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    /*[/size][size=9][/size]
[size=9]    * idle time is 5*60(5mins) without typing[/size][size=9][/size]
[size=9]    * used to prevent extra requests and members appearing active if they left their browser unattended[/size][size=9][/size]
[size=9]    */[/size][size=9][/size]
[size=9]    idle++;[/size][size=9][/size]
[size=9]    if (idle > config.timeout) {[/size][size=9][/size]
[size=9]      refresh.checked = 0;[/size][size=9][/size]
[size=9]      reftxt.className = 'fmd_idle';[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  },5000);[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  /* determine the window state */[/size][size=9][/size]
[size=9]  window.onblur = function() { focus = 0 };[/size][size=9][/size]
[size=9]  window.onfocus = function() {[/size][size=9][/size]
[size=9]    if (!focus) {[/size][size=9][/size]
[size=9]      focus = 1;[/size][size=9][/size]
[size=9]      newmsg = 0;[/size][size=9][/size]
[size=9]      document.title = doct;[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  /* typing and message submission */[/size][size=9][/size]
[size=9]  message.onkeydown = function(e) {[/size][size=9][/size]
[size=9]    if (e.keyCode == 8) return true;[/size][size=9][/size]
[size=9]    else if (this.value.length > config.char_limit) e.preventDefault(); /* prevent further typing if char limit is reached */[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  message.onkeyup = function(e) {[/size][size=9][/size]
[size=9]    e.keyCode == 13 && sendMessage();[/size][size=9][/size]
[size=9]    idle > 0 && (idle = 0);[/size][size=9][/size]
[size=9]    if (reftxt.className.match(/fmd_idle/)) {[/size][size=9][/size]
[size=9]      reftxt.className = '';[/size][size=9][/size]
[size=9]      refresh.checked = 1;[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  send.onclick = function() { sendMessage() };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  /* get message rows from the database */[/size][size=9][/size]
[size=9]  function getMessages(o) {[/size][size=9][/size]
[size=9]    if (loading) return;[/size][size=9][/size]
[size=9]    (o && o.apply) && o.apply();[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    loading = 1;[/size][size=9][/size]
[size=9]    $.get(_database.tid, function(data) {[/size][size=9][/size]
[size=9]      var table = $('#fmd_chat',data), dbr=$('#fmd_chat .db_chat_row',data), sbr = box.childNodes, idset = [];[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      /* check if the last sent message is in the database, if not we'll resend the message */[/size][size=9][/size]
[size=9]      if (o && o.last && !table.find('#'+o.last).length) {[/size][size=9][/size]
[size=9]        message.value = o.msg;[/size][size=9][/size]
[size=9]        sendMessage('Error detected, resending message...');[/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      /* remove shouts from database that exceed the maximum limit */[/size][size=9][/size]
[size=9]      if (dbr.length > config.msg_max) {[/size][size=9][/size]
[size=9]        $.get('/post?p='+config.pid+'&mode=editpost',function(data){[/size][size=9][/size]
[size=9]          var rows = $('#text_editor_textarea',data).val().match(/\[tr id="shout_u.*?" class="db_chat_row"\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[\/tr\]/g);[/size][tr id="shout_u.*?" class="db_chat_row"\][size=9][/size]
[size=9]          $.post('/post?p='+config.pid+'&mode=editpost',{[/size][size=9][/size]
[size=9]            subject : _database.name,[/size][size=9][/size]
[size=9]            message : '[table id="fmd_chat" class="database_table"][tr][td]User[/td][td]Avatar[/td][td]Message[/td][/tr]'+rows.slice(Number(rows.length - config.msg_max) + config.msg_del,rows.length).join('')+'[/table]',[/size][size=9][/size]
[size=9]            post : 1[/size][size=9][/size]
[size=9]          });[/size][size=9][/size]
[size=9]        }); [/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      /* remove messages from the shoutbox that aren't in the database */[/size][size=9][/size]
[size=9]      for (var i=0,j=sbr.length; i<j; i++) !table.find('#'+sbr[i].id).length && idset.push(sbr[i].id);[/size][size=9][/size]
[size=9]      for (var i=0,j=idset.length; i<j; i++) box.removeChild(document.getElementById(idset[i]));[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      /* apply new messages */[/size][size=9][/size]
[size=9]      if (sbr.length < dbr.length) {[/size][size=9][/size]
[size=9]        for (var i=0,j=dbr.length,rid; i<j; i++) {[/size][size=9][/size]
[size=9]          rid = dbr[i].id;[/size][size=9][/size]
[size=9]          if (!document.getElementById(rid)) {[/size][size=9][/size]
[size=9]            var uid = dbr[i].firstChild.innerHTML.match(/(.*?):.*?:.*/)[1], unm = dbr[i].firstChild.innerHTML.match(/.*?:(.*?):.*/)[1],[/size][size=9][/size]
[size=9]            crow = cre({[/size][size=9][/size]
[size=9]              tag : 'DIV',[/size][size=9][/size]
[size=9]              id : rid,[/size][size=9][/size]
[size=9]              classname : 'fmd_chat_row',[/size][size=9][/size]
[size=9]              html : '<div class="fmd_chat_avatar"><a href="/u'+uid+'" title="View '+unm+'\'s profile"><img src="'+(dbr[i].childNodes[1].firstChild.tagName == 'A' ? dbr[i].childNodes[1].firstChild.innerHTML : dbr[i].childNodes[1].innerHTML)+'" alt="avatar"/></a></div><div class="fmd_chat_name">&nbsp;<span class="fmd_chat_time"><img class="fmd_chat_clock" src="http://i38.servimg.com/u/f38/18/45/41/65/time10.png" alt="time :"/> '+dbr[i].firstChild.innerHTML.match(/.*?:.*?:(.*)/)[1]+'</span></div><div class="fmd_chat_message">'+dbr[i].lastChild.innerHTML.replace(/\[custom (.*?)\]/ig,'<span $1>').replace(/\[\/custom\]/ig,'</span>')+'</div>'[/size][size=9][/size]
[size=9]            }),[/size][size=9][/size]
[size=9]            ulink = cre({[/size][size=9][/size]
[size=9]              tag : 'A',[/size][size=9][/size]
[size=9]              href : '/u' + uid,[/size][size=9][/size]
[size=9]              html : unm,[/size][size=9][/size]
[size=9]              title : 'Mention ' + unm,[/size][size=9][/size]
[size=9]              click : function() {[/size][size=9][/size]
[size=9]                message.focus();[/size][size=9][/size]
[size=9]                message.value += '@"'+this.innerHTML+'" ';[/size][size=9][/size]
[size=9]                return false;[/size][size=9][/size]
[size=9]              }[/size][size=9][/size]
[size=9]            });[/size][size=9][/size]
[size=9]            [/size][size=9][/size]
[size=9]            crow.childNodes[1].insertBefore(ulink,crow.childNodes[1].firstChild);[/size][size=9][/size]
[size=9]            box.appendChild(crow);[/size][size=9][/size]
[size=9]            !focus && newmsg++;[/size][size=9][/size]
[size=9]          }[/size][size=9][/size]
[size=9]        }[/size][size=9][/size]
[size=9]        !focus && (document.title = '** '+newmsg+' NEW MESSAGE'+ (newmsg > 1 ? 'S' : '') +' **');[/size][size=9][/size]
[size=9]        scrollBox();[/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]      [/size][size=9][/size]
[size=9]      (o && o.callback) && o.callback();[/size][size=9][/size]
[size=9]      loading = 0;[/size][size=9][/size]
[size=9]    });[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9][/size]
[size=9]  /* post a message to the database */[/size][size=9][/size]
[size=9]  function sendMessage(txt) {[/size][size=9][/size]
[size=9]    /* filter out tags */[/size][size=9][/size]
[size=9]    msg = message.value.replace(/(\[td\]|\[\/td\]|\[tr\]|\[\/tr\]|\[table\]|\[\/table\]|\[th\]|\[\/th\]|\[tbody\]|\[\/tbody\]|\[quote\]|\[quote=.*?\]|\[\/quote\]|\[code\]|\[\/code\]|\[hide\]|\[\/hide\]|\[spoiler\]|\[spoiler=.*?\]|\[\/spoiler\])/gi,'');[/size][size=9][/size]
[size=9][/size]
[size=9]    if (!msg.length || msg.length > config.char_limit + 1 || message.disabled) return;[/size][size=9][/size]
[size=9]    message.value = txt ? txt : 'Sending...';[/size][size=9][/size]
[size=9]    message.disabled = true;[/size][size=9][/size]
[size=9]    footer.className = 'fmd_chat_sending';[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    /* command lines */[/size][size=9][/size]
[size=9]    /^\/me/i.test(msg) && (msg = '[b]* ' + msg.replace(/^\/me/i,ud.name) + '[/b]');[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    /^\/8ball/i.test(msg) && (msg = msg.replace(/^\/8ball/i,'') + ' [b][The Magic 8-Ball says : ' + ['It is certain','It is decidedly so','Without a doubt','Yes definitely','You may rely on it','As I see it, yes','Most likely','Outlook good','Yes','Signs point to yes','Reply hazy try again','Ask again later','Better not tell you now','Cannot predict now','Concentrate and ask again','Don\'t count on it','My reply is no','My sources say no','Outlook not so good','Very doubtful'][Math.floor(Math.random()*20)] + '][/b]');[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    if (/^(\/random|\/rand)/i.test(msg)) {[/size][size=9][/size]
[size=9]      var min = 1, max = 100, n = Math.floor(Math.random() * (max - min + 1)) + min;[/size][size=9][/size]
[size=9]      if (msg.match(/\(\d+:\d+\)/)) {[/size][size=9][/size]
[size=9]        min = Number(msg.match(/\((\d+):\d+\)/)[1]), max = Number(msg.match(/\(\d+:(\d+)\)/)[1]);[/size][size=9][/size]
[size=9]        n = Math.floor(Math.random() * (max - min + 1)) + min;[/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]      msg = ud.name + ' thinks of a number between ' + min + ' and ' + max + ' ...' + n + ' !';[/size][size=9][/size]
[size=9]    };[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    if (/^(\/clear|\/cls)/i.test(msg) && ud.mod) {[/size][size=9][/size]
[size=9]      message.value = 'Clearing messages...';[/size][size=9][/size]
[size=9]      $.post('/post?p='+config.pid+'&mode=editpost',{[/size][size=9][/size]
[size=9]        subject : _database.name,[/size][size=9][/size]
[size=9]        message : '[table id="fmd_chat" class="database_table"][tr][td]User[/td][td]Avatar[/td][td]Message[/td][/tr][tr id="shout_u' + ud.id + '-' + +new Date + '" class="db_chat_row"][td]'+ud.id+':Shout Monster:'+setDate()+'[/td][td]http://i38.servimg.com/u/f38/18/21/60/73/sm11.png[/td][td][b]MESSAGES HAVE BEEN CLEARED BY '+ud.name.toUpperCase()+'[/b][/td][/tr][/table]',[/size][size=9][/size]
[size=9]        post : 1[/size][size=9][/size]
[size=9]      },function() {[/size][size=9][/size]
[size=9]        msgEnabled();[/size][size=9][/size]
[size=9]        getMessages();[/size][size=9][/size]
[size=9]      });[/size][size=9][/size]
[size=9]      return;[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    // formatting[/size][size=9][/size]
[size=9]    if (message.style.length) for (var i in fo) RegExp(fo[i].d.a[1], 'i').test(message.style[fo[i].d.a[0]]) && (msg = fo[i].d.b[0] + msg + fo[i].d.b[1]);[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    // coloring[/size][size=9][/size]
[size=9]    if (message.style.color) {[/size][size=9][/size]
[size=9]      color = message.style.color.replace(/\s/g,'').toUpperCase();[/size][size=9][/size]
[size=9]      color.match(/RGB/) ? msg = '[color='+toHex(color.match(/RGB\((\d+),\d+,\d+\)/)[1], color.match(/RGB\(\d+,(\d+),\d+\)/)[1], color.match(/RGB\(\d+,\d+,(\d+)\)/)[1])+']' + msg + '[/color]' : msg = '[color='+color+']' + msg + '[/color]';[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    var rid = 'shout_u' + ud.id + '-' + +new Date;[/size][size=9][/size]
[size=9]    _database.post({[/size][size=9][/size]
[size=9]      pid : config.pid,[/size][size=9][/size]
[size=9]      tableid : 'null',[/size][size=9][/size]
[size=9]      update : ['null','null'],[/size][size=9][/size]
[size=9]      newRow : '[tr id="'+rid+'" class="db_chat_row"][td]'+ud.id+':'+ud.name+':'+setDate()+'[/td][td]'+ud.ava.match(/src="(.*?)"/)[1]+'[/td][td]'+msg+'[/td][/tr]',[/size][size=9][/size]
[size=9]      callback : function(state) {[/size][size=9][/size]
[size=9]        msgEnabled();[/size][size=9][/size]
[size=9]        getMessages({ last : rid, msg : msg });[/size][size=9][/size]
[size=9]        state == 'ERROR' && ( footer.innerHTML = '<p class="fmd_chat_error">An error occured : You don\'t have permission to send messages. Please contact the board Administrator for more information.</p>' );[/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]    });[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function msgEnabled() { message.disabled = false; footer.className = ''; message.value = ''; message.focus() };[/size][size=9][/size]
[size=9]  function scrollBox() { box.scrollTop = 99999 };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function setDate() {[/size][size=9][/size]
[size=9]    var a=new Date(), b=new Date(a.getTime()+(a.getTimezoneOffset()*60000)+(3600000*config.timezone));[/size][size=9][/size]
[size=9]    function set(i) { return i > 9 ? i : '0' + i };[/size][size=9][/size]
[size=9]    return b.getDate() + '/' + (b.getMonth() + 1) + '/' + b.getFullYear() + ' - ' + set(b.getHours()) + ':' + set(b.getMinutes()) + ':' + set(b.getSeconds());[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function toHex() {[/size][size=9][/size]
[size=9]    for (var i=0, n=arguments, j=n.length, colorString = '#', h; i<j; i++) {[/size][size=9][/size]
[size=9]      h = Number(n[i]).toString(16);[/size][size=9][/size]
[size=9]      colorString += (h.length < 2 ? '0' + h : h);[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]    return colorString.toUpperCase();[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function cre(o) {[/size][size=9][/size]
[size=9]    var el = document.createElement(o.tag);[/size][size=9][/size]
[size=9]    o.html && (el.innerHTML = o.html);[/size][size=9][/size]
[size=9]    o.id && (el.id = o.id);[/size][size=9][/size]
[size=9]    o.forId && (el.htmlFor = o.forId);[/size][size=9][/size]
[size=9]    o.classname && (el.className = o.classname);[/size][size=9][/size]
[size=9]    o.src && (el.src = o.src);[/size][size=9][/size]
[size=9]    o.type && (el.type = o.type);[/size][size=9][/size]
[size=9]    o.href && (el.href = o.href);[/size][size=9][/size]
[size=9]    o.title && (el.title = o.title);[/size][size=9][/size]
[size=9]    o.value && (el.value = o.value);[/size][size=9][/size]
[size=9]    o.checked && (el.checked = o.checked);[/size][size=9][/size]
[size=9]    if (o.style) {[/size][size=9][/size]
[size=9]      o.style = o.style.split(';');[/size][size=9][/size]
[size=9]      for (var i = 0, j = o.style.length, d; i<j; i++) {[/size][size=9][/size]
[size=9]        if (o.style[i].length) {[/size][size=9][/size]
[size=9]          d = o.style[i].split(':');[/size][size=9][/size]
[size=9]          el.style[d[0]] = d[1];[/size][size=9][/size]
[size=9]        }[/size][size=9][/size]
[size=9]      }[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    o.click && (el.onclick = o.click);[/size][size=9][/size]
[size=9]    o.mouseup && (el.onmouseup = o.mouseup);[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    return el;[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function frameContent(frame) {[/size][size=9][/size]
[size=9]    if (frame.contentDocument) frame = frame.contentDocument;[/size][size=9][/size]
[size=9]    else if (frame.contentWindow) frame = frame.contentWindow.document;[/size][size=9][/size]
[size=9]    frame.body.style.background = 'none';[/size][size=9][/size]
[size=9]    return frame;[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function button(o) {[/size][size=9][/size]
[size=9]    var actif = my_getcookie('fmd_chat_'+o.name) == 1,font,a;[/size][size=9][/size]
[size=9]    if (o.tags) {[/size][size=9][/size]
[size=9]      a = o.css.split(':'), font = a[0].match(/(font-weight|font-style)/);[/size][size=9][/size]
[size=9]      fo[o.name] = {[/size][size=9][/size]
[size=9]        d : { a : a, b : o.tags },[/size][size=9][/size]
[size=9]        press : function() {[/size][size=9][/size]
[size=9]          if (message.style[a[0]].match(RegExp(a[1],'i'))) {[/size][size=9][/size]
[size=9]            message.style[a[0]] = message.style[a[0]].replace(RegExp(a[1],'i'),(font ? 'normal' : ''));[/size][size=9][/size]
[size=9]            this.className = this.className.replace(/actif/,'');[/size][size=9][/size]
[size=9]            my_setcookie('fmd_chat_'+o.name,0);[/size][size=9][/size]
[size=9]          } else {[/size][size=9][/size]
[size=9]            font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1];[/size][size=9][/size]
[size=9]            this.className += ' actif';[/size][size=9][/size]
[size=9]            my_setcookie('fmd_chat_'+o.name,1);[/size][size=9][/size]
[size=9]          }[/size][size=9][/size]
[size=9]        }[/size][size=9][/size]
[size=9]      };[/size][size=9][/size]
[size=9]      actif && (font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1]);[/size][size=9][/size]
[size=9]    }[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    var button = cre({[/size][size=9][/size]
[size=9]      tag : 'DIV',[/size][size=9][/size]
[size=9]      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : '') + (actif ? ' actif' : ''),[/size][size=9][/size]
[size=9]      html : o.text,[/size][size=9][/size]
[size=9]      title : o.name,[/size][size=9][/size]
[size=9]      style : (o.style ? o.style : ''),[/size][size=9][/size]
[size=9]      mouseup : (fo[o.name] ? fo[o.name].press : '')[/size][size=9][/size]
[size=9]    });[/size][size=9][/size]
[size=9]    [/size][size=9][/size]
[size=9]    o.where.appendChild(button);[/size][size=9][/size]
[size=9]    o.advanced && o.advanced(button);[/size][size=9][/size]
[size=9]  };[/size][size=9][/size]
[size=9]  [/size][size=9][/size]
[size=9]  function popup(o) {[/size][size=9][/size]
[size=9]    var box = cre({[/size][size=9][/size]
[size=9]      tag : 'DIV',[/size][size=9][/size]
[size=9]      classname : 'fmd_chat_dropdown',[/size][size=9][/size]
[size=9]      style : 'display:none;z-index:10000;' + (o.pop_style ? o.pop_style : ''),[/size][size=9][/size]
[size=9]      html : (o.content ? o.content : '')[/size][size=9][/size]
[size=9]    }),[/size][size=9][/size]
[size=9]    button = cre({[/size][size=9][/size]
[si
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by Niko June 14th 2015, 8:42 pm

Could you add it not in WYSIWYG mode?
because the js code is full of [ size ] tags now Razz
Niko
Niko
Hyperactive

Male Posts : 2337
Reputation : 106
Language : English, French, Italian, Spanish, Latin

View user profile https://www.fmcodes.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 14th 2015, 8:46 pm

how do i do that?
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by brandon_g June 14th 2015, 9:31 pm

Simply go out of WYSIWYG Mode... the little icon that looks like a sheet of paper.
brandon_g
brandon_g
Manager
Manager

Male Posts : 9726
Reputation : 889
Language : English
Location : USA

View user profile https://www.broadcastingduo.com

Back to top Go down

In progress Re: FMD Chat?

Post by SLGray June 15th 2015, 12:24 am

Copy and paste the JavaScript code again, but make sure that you press the last button in the editor.


CSS - FMD Chat? Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 49647
Reputation : 3439
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 15th 2015, 12:42 am

Code:
/*
* Shoutbox for Forumotion forums
* Developed by Ange Tuteur - FM Design
* Database must be installed for full functionality ( http://fmdesign.forumotion.com/t281- )
*/
$(function() {
 var config = {
   pid : 884,
   char_limit : 750,
   msg_max : 50,
   msg_del : 10,
   timeout : 60,
   public_chat : 1,
   title : 'CDA Staff Chat',
   
   mods : [1,3,8,89],
   banned : [-1],
   
   timezone : -5,
   rights : 0, // choose to allow a small backlink to the developer's website
   
   plugins : function() {
     // custom content such as buttons and modifications can go here
   }
 };
 
 if (!config.public_chat && !_userdata.session_logged_in) return;
 var fo = {},
     ud = {
       id : _userdata.user_id,
       name : _userdata.username,
       ava : _userdata.avatar,
       mod : 0
     },
     main = document.getElementById('content') || document.getElementById('page-body'),
     fmd_chat = cre({
       tag : 'DIV',
       id : 'fmd_chatbox'
     }),
     
     box = cre({
       tag : 'DIV',
       id : 'fmd_chat_messagebox'
     }),
     
     header = cre({
       tag : 'DIV',
       id : 'fmd_chat_header',
       html : '<span class="fmd_chat_title">'+config.title+'</span><div class="fmd_chat_options"></div><div style="clear:both"></div>'
     }),
     
     footer = cre({
       tag : 'DIV',
       id : 'fmd_chat_footer'
     }),
     
     actions = cre({
       tag : 'DIV',
       classname : 'fmd_chat_actions'
     }),
 
     emo_frame = cre({
       tag : 'IFRAME',
       classname : 'fmd_chat_frame',
       src : '/post?mode=smilies_chatbox'
     }),
     
     color_frame = cre({
       tag : 'IFRAME',
       classname : 'fmd_chat_frame',
       src : '/chatbox/selectcolor'
     }),
     
     color_selected = cre({
       tag : 'DIV',
       classname : 'fmd_color_selected'
     }),
     
     message = cre({
       tag : 'INPUT',
       type : 'text',
       style : 'font-weight:normal;font-style:normal',
       id : 'fmd_chat_message'
     }),
     
     send = cre({
       tag : 'INPUT',
       type : 'button',
       id : 'fmd_chat_send',
       value : 'Send'
     }),
     
     refresh = cre({
       tag : 'INPUT',
       id : 'fmd_chat_refresh',
       type : 'checkbox',
       title : 'Auto refresh',
       checked : (my_getcookie('fmd_chat_refresh') && my_getcookie('fmd_chat_refresh').length) ? Number(my_getcookie('fmd_chat_refresh')) : 1,
       click : function() {
         this.checked ? my_setcookie('fmd_chat_refresh',1) : my_setcookie('fmd_chat_refresh',0);
         idle = 0;
         this.previousSibling.className.match(/fmd_idle/) && (this.previousSibling.className = '');
       }
     }),
     
     reftxt = cre({
       tag : 'LABEL',
       forId : 'fmd_chat_refresh',
       html : 'Auto : <div class="fmd_chat_dropdown fmd_notice">Auto-refresh has been disabled due to inactivity.. Click this message to enable it.</div>',
       style : 'cursor:pointer',
       title : 'Auto refresh'
     }),
     
     cnote = cre({
       tag : 'DIV',
       html : '\x44\x65\x76\x65\x6c\x6f\x70\x65\x64\x20\x62\x79\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x66\x6d\x64\x65\x73\x69\x67\x6e\x2e\x66\x6f\x72\x75\x6d\x6f\x74\x69\x6f\x6e\x2e\x63\x6f\x6d\x2f\x74\x33\x31\x38\x2d\x66\x6d\x64\x2d\x73\x68\x6f\x75\x74\x62\x6f\x78\x23\x32\x30\x39\x35\x22\x20\x74\x61\x72\x67\x65\x74\x3d\x22\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x41\x6e\x67\x65\x20\x54\x75\x74\x65\x75\x72\x3c\x2f\x61\x3e',
       style : 'text-align:right'
     }),
     options = header.childNodes[1],
     doct = document.title,
     newmsg = 0,
     loading = 0,
     idle = 0,
     focus = 1,
     msg,
     color;
     
 fmd_chat.appendChild(header);
 options.appendChild(reftxt);
 options.appendChild(refresh);
 fmd_chat.appendChild(box);
 fmd_chat.appendChild(footer);
 footer.appendChild(message);
 footer.appendChild(send);
 footer.appendChild(actions);
 config.rights && fmd_chat.appendChild(cnote);
   
 /* check if the user is a moderator */
 for (var i=0,j=config.mods.length; i<j; i++) ud.id == config.mods[i] && (ud.mod = 1);

  /* check if the user has been blocked from writing */
  for (var i=0,j=config.banned.length; i<j; i++) {
    if (ud.id == config.banned[i]) {
      if (ud.id == -1) footer.innerHTML = '<p class="fmd_chat_error">Please <a href="/login">login</a> or <a href="/register">register</a> to use the shoutbox.</p>';
      else footer.innerHTML = '<p class="fmd_chat_error">You have been blocked from using the shoutbox. Please contact the board Administrator for more information.</p>';
    }
  }
  
  
  popup({
    text : '?',
    title : 'help',
    content : '<table class="fmd_chat_help"><tr class="fmd_chat_header"><td width="25%">Command Line</td><td>Explanation</td></tr><tr><td colspan="2">All command lines are used at the beginning of a message. They\'re not case sensitive and can be written capital or lowercase.</td></tr><tr><td>/me</td><td>This is replaced with your username. <br/>Example : <em>/me smells the flowers</em> <b>will send as</b> <em>* '+ud.name+' smells the flowers</em></td></tr><tr><td>/rand<br/>/random</td><td>Will return a number between 1 and 100. You can pass along your own range by writing /rand <strong>(n1:n2)</strong>. n1 is the minimum and n2 is the maximum. <br/>Example : '+ud.name+' thinks of a number between 1 and 100 ...24 !</td></tr><tr><td>/8ball</td><td>Ask a question to the Magic 8-ball and get an answer ! <br/>Example : <em>/8ball will it snow ?</em> <b>will send as</b> <em>will it snow ? <strong>[The Magic 8-Ball says : Signs point to yes]</strong></em></td></tr>'+ (ud.mod ? '<tr><td>/cls<br/>/clear</td><td>This command clears all shoutbox messages.</td></tr>' : '') +'</table>',
    pop_style : 'width:99%;overflow-y:auto',
    where : actions
  });
  
  
  button({
    name : 'refresh messages',
    text : 'Refresh',
    where : options,
    advanced : function(b) {
      b.onclick = function() {
        idle = 0;
        getMessages({
          apply : function() { b.style.opacity = 0.3 },
          callback : function() {
            b.style.opacity = '';
            scrollBox();
          }
        });
      }
    }
  });
  
  button({
    name : 'resize shoutbox',
    text : '+',
    where : options,
    advanced : function(b) {
      b.style.fontWeight = 'bold';
      b.onclick = function() {
        scrollBox();
        if (!fmd_chat.style.zIndex) {
          this.innerHTML = '-';
          document.body.style.overflow = 'hidden';
          fmd_chat.className = 'fmd_chat_max';
          fmd_chat.style.zIndex = '1000000';
        } else {
          this.innerHTML = '+';
          document.body.style.overflow = '';
          fmd_chat.className = '';
          fmd_chat.style.zIndex = '';
        }
      };
    }
  });
  
  button({
    name : 'bold',
    text : 'B',
    css : 'font-weight:bold',
    tags : ['[b]','[/b]'],
    where : actions
  });
      
  button({
    name : 'italic',
    text : 'I',
    css : 'font-style:italic',
    tags : ['[i]','[/i]'],
    where : actions
  });
  
  button({
    name : 'underline',
    text : 'U',
    css : 'text-decoration:underline',
    tags : ['[u]','[/u]'],
    where : actions
  });
      
  button({
    name : 'strike',
    text : 'S',
    css : 'text-decoration:line-through',
    tags : ['[strike]','[/strike]'],
    where : actions
  });
  
  // emoticons
  popup({
    text : 'Smilies',
  title : 'Insert emoticon',
    add : emo_frame,
  where : actions,
    advanced : function(b, box) {
      emo_frame.onload = function() {
        for (var i=0,frame=frameContent(emo_frame),a=frame.getElementsByTagName('A'); i<a.length; i++) {
          if (/close\(\)/.test(a[i].href)) {
            a[i].href = '#close';
            a[i].onclick = function() { box.style.display = 'none' }
          }
          if (/chatboxsmilie/.test(a[i].href)) {
            a[i].href = '#' + a[i].href.match(/chatboxsmilie\('(.*?)'\)/)[1];
            a[i].onclick = function() {
              message.value += ' ' + this.getAttribute('href').slice(1);
              box.style.display = 'none';
            }
          }
        }
      };
    }
  });

  // colors
  popup({
    text : 'Color',
  title : 'Change text color',
    add : color_frame,
    where : actions,
    advanced : function(b, box) {
      var colortxt = my_getcookie('fmd_chat_colortxt') || '';
      b.appendChild(color_selected);
      color_frame.onload = function() {
        function setColor(val) {
          my_setcookie('fmd_chat_colortxt',val);
          message.style.color = val;
          color_selected.style.background = val;
          box.style.display = 'none';
        };
        var frame = frameContent(color_frame), hex = frame.getElementById('ColorHex'),
            remove = cre({
              tag : 'A',
              html : 'Remove Color',
              href : '#',
              style : 'font-size:12px;text-decoration:none;position:absolute;right:20px;color:red',
              click : function() {
                my_setcookie('fmd_chat_colortxt',0);
                setColor('');
                return false;
              }
            });
    
        if (!hex) return;
        hex.parentNode.appendChild(remove);
        hex.onkeydown = function(e) { if (e.keyCode == 13) { setColor(this.value); return false } };
        for (var i=0,td=frame.getElementsByTagName('TD'); i<td.length; i++) if (td[i].bgColor) td[i].onclick = function() { setColor(this.bgColor) }
      };
      
      if (colortxt.length) {
        message.style.color = colortxt;
        color_selected.style.background = colortxt;
      }
    }
  });
  
  /* apply plugins, and add the shoutbox to the page */
  config.plugins();
  main.insertBefore(fmd_chat,main.firstChild);
  
  
  /* get the messages, and refresh them if auto-refresh enabled */
  getMessages();
  var chatRefresh = window.setInterval(function() {
    if (!refresh.checked || message.disabled) return;
    getMessages();
    
    /*
    * idle time is 5*60(5mins) without typing
    * used to prevent extra requests and members appearing active if they left their browser unattended
    */
    idle++;
    if (idle > config.timeout) {
      refresh.checked = 0;
      reftxt.className = 'fmd_idle';
    }
  },5000);
  
  /* determine the window state */
  window.onblur = function() { focus = 0 };
  window.onfocus = function() {
    if (!focus) {
      focus = 1;
      newmsg = 0;
      document.title = doct;
    }
  };
  
  /* typing and message submission */
  message.onkeydown = function(e) {
    if (e.keyCode ==  return true;
    else if (this.value.length > config.char_limit) e.preventDefault(); /* prevent further typing if char limit is reached */
  };
  message.onkeyup = function(e) {
    e.keyCode == 13 && sendMessage();
    idle > 0 && (idle = 0);
    if (reftxt.className.match(/fmd_idle/)) {
      reftxt.className = '';
      refresh.checked = 1;
    }
  };
  send.onclick = function() { sendMessage() };
  
  /* get message rows from the database */
  function getMessages(o) {
    if (loading) return;
    (o && o.apply) && o.apply();
    
    loading = 1;
    $.get(_database.tid, function(data) {
      var table = $('#fmd_chat',data), dbr=$('#fmd_chat .db_chat_row',data), sbr = box.childNodes, idset = [];
      
      /* check if the last sent message is in the database, if not we'll resend the message */
      if (o && o.last && !table.find('#'+o.last).length) {
        message.value = o.msg;
        sendMessage('Error detected, resending message...');
      }
      
      /* remove shouts from database that exceed the maximum limit */
      if (dbr.length > config.msg_max) {
        $.get('/post?p='+config.pid+'&mode=editpost',function(data){
          var rows = $('#text_editor_textarea',data).val().match(/\[/i][/i]
\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[\/tr\]/g);
          $.post('/post?p='+config.pid+'&mode=editpost',{
            subject : _database.name,
            message : ''+rows.slice(Number(rows.length - config.msg_max) + config.msg_del,rows.length).join('')+'
[/i][/i][/i][/i][/i][/i][/i][/i][/i][table id="fmd_chat" class="database_table"][tr][td]User[/td]
[td]Avatar[/td]
[td]Message[/td]
[/tr]
[/table]
[i][i][i][i][i][i][i][i][i]
',
            post : 1
          });
        });
      }
      
      /* remove messages from the shoutbox that aren't in the database */
      for (var i=0,j=sbr.length; i<j; i++) !table.find('#'+sbr[i].id).length && idset.push(sbr[i].id);
      for (var i=0,j=idset.length; i<j; i++) box.removeChild(document.getElementById(idset[i]));
      
      /* apply new messages */
      if (sbr.length < dbr.length) {
        for (var i=0,j=dbr.length,rid; i<j; i++) {
          rid = dbr[i].id;
          if (!document.getElementById(rid)) {
            var uid = dbr[i].firstChild.innerHTML.match(/(.*?):.*?:.*/)[1], unm = dbr[i].firstChild.innerHTML.match(/.*?:(.*?):.*/)[1],
            crow = cre({
              tag : 'DIV',
              id : rid,
              classname : 'fmd_chat_row',
              html : '<div class="fmd_chat_avatar"><a href="/u'+uid+'" title="View '+unm+'\'s profile"><img src="'+(dbr[i].childNodes[1].firstChild.tagName == 'A' ? dbr[i].childNodes[1].firstChild.innerHTML : dbr[i].childNodes[1].innerHTML)+'" alt="avatar"/></a></div><div class="fmd_chat_name">&nbsp;<span class="fmd_chat_time"><img class="fmd_chat_clock" src="http://i38.servimg.com/u/f38/18/45/41/65/time10.png" alt="time :"/> '+dbr[i].firstChild.innerHTML.match(/.*?:.*?:(.*)/)[1]+'</span></div><div class="fmd_chat_message">'+dbr[i].lastChild.innerHTML.replace(/\[custom (.*?)\]/ig,'<span $1>').replace(/\[\/custom\]/ig,'</span>')+'</div>'
            }),
            ulink = cre({
              tag : 'A',
              href : '/u' + uid,
              html : unm,
              title : 'Mention ' + unm,
              click : function() {
                message.focus();
                message.value += '@"'+this.innerHTML+'" ';
                return false;
              }
            });
            
            crow.childNodes[1].insertBefore(ulink,crow.childNodes[1].firstChild);
            box.appendChild(crow);
            !focus && newmsg++;
          }
        }
        !focus && (document.title = '** '+newmsg+' NEW MESSAGE'+ (newmsg > 1 ? 'S' : '') +' **');
        scrollBox();
      }
      
      (o && o.callback) && o.callback();
      loading = 0;
    });
  };
  

  /* post a message to the database */
  function sendMessage(txt) {
    /* filter out tags */
    msg = message.value.replace(/(\[td\]|\[\/td\]|\[tr\]|\[\/tr\]|\[table\]|\[\/table\]|\[th\]|\[\/th\]|\[tbody\]|\[\/tbody\]|\[quote\]|\[quote=.*?\]|\[\/quote\]|\[code\]|\[\/code\]|\[hide\]|\[\/hide\]|\[spoiler\]|\[spoiler=.*?\]|\[\/spoiler\])/gi,'');

    if (!msg.length || msg.length > config.char_limit + 1 || message.disabled) return;
    message.value = txt ? txt : 'Sending...';
    message.disabled = true;
    footer.className = 'fmd_chat_sending';
    
    /* command lines */
    /^\/me/i.test(msg) && (msg = '[b]* ' + msg.replace(/^\/me/i,ud.name) + '[/b]');
    
    /^\/8ball/i.test(msg) && (msg = msg.replace(/^\/8ball/i,'') + ' [b][The Magic 8-Ball says : ' + ['It is certain','It is decidedly so','Without a doubt','Yes definitely','You may rely on it','As I see it, yes','Most likely','Outlook good','Yes','Signs point to yes','Reply hazy try again','Ask again later','Better not tell you now','Cannot predict now','Concentrate and ask again','Don\'t count on it','My reply is no','My sources say no','Outlook not so good','Very doubtful'][Math.floor(Math.random()*20)] + '][/b]');
    
    if (/^(\/random|\/rand)/i.test(msg)) {
      var min = 1, max = 100, n = Math.floor(Math.random() * (max - min + 1)) + min;
      if (msg.match(/\(\d+:\d+\)/)) {
        min = Number(msg.match(/\((\d+):\d+\)/)[1]), max = Number(msg.match(/\(\d+:(\d+)\)/)[1]);
        n = Math.floor(Math.random() * (max - min + 1)) + min;
      }
      msg = ud.name + ' thinks of a number between ' + min + ' and ' + max + ' ...' + n + ' !';
    };
    
    if (/^(\/clear|\/cls)/i.test(msg) && ud.mod) {
      message.value = 'Clearing messages...';
      $.post('/post?p='+config.pid+'&mode=editpost',{
        subject : _database.name,
        message : '
[/i][/i][/i][/i][/i][/i][/i][/i][/i][table id="fmd_chat" class="database_table"][tr][td]User[/td]
[td]Avatar[/td]
[td]Message[/td]
[/tr]
[tr id="shout_u' + ud.id + '-' + +new Date + '" class="db_chat_row"][td]'+ud.id+':Shout Monster:'+setDate()+'[/td]
[td]http://i38.servimg.com/u/f38/18/21/60/73/sm11.png[/td]
[td][b]MESSAGES HAVE BEEN CLEARED BY '+ud.name.toUpperCase()+'[/b][/td]
[/tr]
[/table]
[i][i][i][i][i][i][i][i][i]
',
        post : 1
      },function() {
        msgEnabled();
        getMessages();
      });
      return;
    }
    
    // formatting
    if (message.style.length) for (var i in fo) RegExp(fo[i].d.a[1], 'i').test(message.style[fo[i].d.a[0]]) && (msg = fo[i].d.b[0] + msg + fo[i].d.b[1]);
    
    // coloring
    if (message.style.color) {
      color = message.style.color.replace(/\s/g,'').toUpperCase();
      color.match(/RGB/) ? msg = '[color='+toHex(color.match(/RGB\((\d+),\d+,\d+\)/)[1], color.match(/RGB\(\d+,(\d+),\d+\)/)[1], color.match(/RGB\(\d+,\d+,(\d+)\)/)[1])+']' + msg + '[/color]' : msg = '[color=+color+]' + msg + '[/color]';
    }
    
    var rid = 'shout_u' + ud.id + '-' + +new Date;
    _database.post({
      pid : config.pid,
      tableid : 'null',
      update : ['null','null'],
      newRow : ''+ud.id+':'+ud.name+':'+setDate()+'
'+ud.ava.match(/src="(.*?)"/)[1]+'
'+msg+'
',
      callback : function(state) {
        msgEnabled();
        getMessages({ last : rid, msg : msg });
        state == 'ERROR' && ( footer.innerHTML = '<p class="fmd_chat_error">An error occured : You don\'t have permission to send messages. Please contact the board Administrator for more information.</p>' );
      }
    });
  };
  
  function msgEnabled() { message.disabled = false; footer.className = ''; message.value = ''; message.focus() };
  function scrollBox() { box.scrollTop = 99999 };
  
  function setDate() {
    var a=new Date(), b=new Date(a.getTime()+(a.getTimezoneOffset()*60000)+(3600000*config.timezone));
    function set(i) { return i > 9 ? i : '0' + i };
    return b.getDate() + '/' + (b.getMonth() + 1) + '/' + b.getFullYear() + ' - ' + set(b.getHours()) + ':' + set(b.getMinutes()) + ':' + set(b.getSeconds());
  };
  
  function toHex() {
    for (var i=0, n=arguments, j=n.length, colorString = '#', h; i<j; i++) {
      h = Number(n[i]).toString(16);
      colorString += (h.length < 2 ? '0' + h : h);
    }
    return colorString.toUpperCase();
  };
  
  function cre(o) {
    var el = document.createElement(o.tag);
    o.html && (el.innerHTML = o.html);
    o.id && (el.id = o.id);
    o.forId && (el.htmlFor = o.forId);
    o.classname && (el.className = o.classname);
    o.src && (el.src = o.src);
    o.type && (el.type = o.type);
    o.href && (el.href = o.href);
    o.title && (el.title = o.title);
    o.value && (el.value = o.value);
    o.checked && (el.checked = o.checked);
    if (o.style) {
      o.style = o.style.split(';');
      for (var i = 0, j = o.style.length, d; i<j; i++) {
        if (o.style[i].length) {
          d = o.style[i].split(':');
          el.style[d[0]] = d[1];
        }
      }
    }
    
    o.click && (el.onclick = o.click);
    o.mouseup && (el.onmouseup = o.mouseup);
    
    return el;
  };
  
  function frameContent(frame) {
    if (frame.contentDocument) frame = frame.contentDocument;
    else if (frame.contentWindow) frame = frame.contentWindow.document;
    frame.body.style.background = 'none';
    return frame;
  };
  
  function button(o) {
    var actif = my_getcookie('fmd_chat_'+o.name) == 1,font,a;
    if (o.tags) {
      a = o.css.split(':'), font = a[0].match(/(font-weight|font-style)/);
      fo[o.name] = {
        d : { a : a, b : o.tags },
        press : function() {
          if (message.style[a[0]].match(RegExp(a[1],'i'))) {
            message.style[a[0]] = message.style[a[0]].replace(RegExp(a[1],'i'),(font ? 'normal' : ''));
            this.className = this.className.replace(/actif/,'');
            my_setcookie('fmd_chat_'+o.name,0);
          } else {
            font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1];
            this.className += ' actif';
            my_setcookie('fmd_chat_'+o.name,1);
          }
        }
      };
      actif && (font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1]);
    }
    
    var button = cre({
      tag : 'DIV',
      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : '') + (actif ? ' actif' : ''),
      html : o.text,
      title : o.name,
      style : (o.style ? o.style : ''),
      mouseup : (fo[o.name] ? fo[o.name].press : '')
    });
    
    o.where.appendChild(button);
    o.advanced && o.advanced(button);
  };
  
  function popup(o) {
    var box = cre({
      tag : 'DIV',
      classname : 'fmd_chat_dropdown',
      style : 'display:none;z-index:10000;' + (o.pop_style ? o.pop_style : ''),
      html : (o.content ? o.content : '')
    }),
    button = cre({
      tag : 'DIV',
      title : (o.title ? o.title : ''),
      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : ''),
      style : (o.but_style ? o.but_style : ''),
      html : o.text,
      mouseup : function() {
        /none/i.test(box.style.display) ? box.style.display = 'block' : box.style.display = 'none';
        o.add && (!box.childNodes.length && box.appendChild(o.add));
      }
    });
    o.where.appendChild(button);
    o.where.appendChild(box);
    o.advanced && o.advanced(button, box);
  };
});[/i][/i][/i][/i][/i][/i][/i][/i][/i]
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by Ange Tuteur June 15th 2015, 10:43 am

Just before the opening of the function $(function() { add the following condition before it :
Code:
/^\/f45/.test(window.location.pathname) &&

To make it like this :
Code:
/^\/f45/.test(window.location.pathname) && $(function() {

Replace 45 by the ID of the subforum. Also, make sure to change the location the script runs to only "in the subforums"
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13242
Reputation : 2982
Language : EN, JA, FR
Location : Pennsylvania

View user profile https://fmdesign.forumotion.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 15th 2015, 6:12 pm

Did it all, it's not showing up at all o.O
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by Ange Tuteur June 15th 2015, 8:58 pm

Post the modified code here, and a link to the sub-forum you want it to display in.

Thanks
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13242
Reputation : 2982
Language : EN, JA, FR
Location : Pennsylvania

View user profile https://fmdesign.forumotion.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 15th 2015, 11:48 pm

Code:

/*
* Shoutbox for Forumotion forums
* Developed by Ange Tuteur - FM Design
* Database must be installed for full functionality ( http://fmdesign.forumotion.com/t281- )
*/
/^\/f1/.test(window.location.pathname) && $(function() {
 var config = {
   pid : 884,
   char_limit : 750,
   msg_max : 50,
   msg_del : 10,
   timeout : 60,
   public_chat : 1,
   title : 'CDA Staff Chat',
   
   mods : [1,3,8,89],
   banned : [-1],
   
   timezone : -5,
   rights : 0, // choose to allow a small backlink to the developer's website
   
   plugins : function() {
     // custom content such as buttons and modifications can go here
   }
 };
 
 if (!config.public_chat && !_userdata.session_logged_in) return;
 var fo = {},
     ud = {
       id : _userdata.user_id,
       name : _userdata.username,
       ava : _userdata.avatar,
       mod : 0
     },
     main = document.getElementById('content') || document.getElementById('page-body'),
     fmd_chat = cre({
       tag : 'DIV',
       id : 'fmd_chatbox'
     }),
     
     box = cre({
       tag : 'DIV',
       id : 'fmd_chat_messagebox'
     }),
     
     header = cre({
       tag : 'DIV',
       id : 'fmd_chat_header',
       html : '<span class="fmd_chat_title">'+config.title+'</span><div class="fmd_chat_options"></div><div style="clear:both"></div>'
     }),
     
     footer = cre({
       tag : 'DIV',
       id : 'fmd_chat_footer'
     }),
     
     actions = cre({
       tag : 'DIV',
       classname : 'fmd_chat_actions'
     }),
 
     emo_frame = cre({
       tag : 'IFRAME',
       classname : 'fmd_chat_frame',
       src : '/post?mode=smilies_chatbox'
     }),
     
     color_frame = cre({
       tag : 'IFRAME',
       classname : 'fmd_chat_frame',
       src : '/chatbox/selectcolor'
     }),
     
     color_selected = cre({
       tag : 'DIV',
       classname : 'fmd_color_selected'
     }),
     
     message = cre({
       tag : 'INPUT',
       type : 'text',
       style : 'font-weight:normal;font-style:normal',
       id : 'fmd_chat_message'
     }),
     
     send = cre({
       tag : 'INPUT',
       type : 'button',
       id : 'fmd_chat_send',
       value : 'Send'
     }),
     
     refresh = cre({
       tag : 'INPUT',
       id : 'fmd_chat_refresh',
       type : 'checkbox',
       title : 'Auto refresh',
       checked : (my_getcookie('fmd_chat_refresh') && my_getcookie('fmd_chat_refresh').length) ? Number(my_getcookie('fmd_chat_refresh')) : 1,
       click : function() {
         this.checked ? my_setcookie('fmd_chat_refresh',1) : my_setcookie('fmd_chat_refresh',0);
         idle = 0;
         this.previousSibling.className.match(/fmd_idle/) && (this.previousSibling.className = '');
       }
     }),
     
     reftxt = cre({
       tag : 'LABEL',
       forId : 'fmd_chat_refresh',
       html : 'Auto : <div class="fmd_chat_dropdown fmd_notice">Auto-refresh has been disabled due to inactivity.. Click this message to enable it.</div>',
       style : 'cursor:pointer',
       title : 'Auto refresh'
     }),
     
     cnote = cre({
       tag : 'DIV',
       html : '\x44\x65\x76\x65\x6c\x6f\x70\x65\x64\x20\x62\x79\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x66\x6d\x64\x65\x73\x69\x67\x6e\x2e\x66\x6f\x72\x75\x6d\x6f\x74\x69\x6f\x6e\x2e\x63\x6f\x6d\x2f\x74\x33\x31\x38\x2d\x66\x6d\x64\x2d\x73\x68\x6f\x75\x74\x62\x6f\x78\x23\x32\x30\x39\x35\x22\x20\x74\x61\x72\x67\x65\x74\x3d\x22\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x41\x6e\x67\x65\x20\x54\x75\x74\x65\x75\x72\x3c\x2f\x61\x3e',
       style : 'text-align:right'
     }),
     options = header.childNodes[1],
     doct = document.title,
     newmsg = 0,
     loading = 0,
     idle = 0,
     focus = 1,
     msg,
     color;
     
 fmd_chat.appendChild(header);
 options.appendChild(reftxt);
 options.appendChild(refresh);
 fmd_chat.appendChild(box);
 fmd_chat.appendChild(footer);
 footer.appendChild(message);
 footer.appendChild(send);
 footer.appendChild(actions);
 config.rights && fmd_chat.appendChild(cnote);
   
 /* check if the user is a moderator */
 for (var i=0,j=config.mods.length; i<j; i++) ud.id == config.mods[i] && (ud.mod = 1);

  /* check if the user has been blocked from writing */
  for (var i=0,j=config.banned.length; i<j; i++) {
    if (ud.id == config.banned[i]) {
      if (ud.id == -1) footer.innerHTML = '<p class="fmd_chat_error">Please <a href="/login">login</a> or <a href="/register">register</a> to use the shoutbox.</p>';
      else footer.innerHTML = '<p class="fmd_chat_error">You have been blocked from using the shoutbox. Please contact the board Administrator for more information.</p>';
    }
  }
  
  
  popup({
    text : '?',
    title : 'help',
    content : '<table class="fmd_chat_help"><tr class="fmd_chat_header"><td width="25%">Command Line</td><td>Explanation</td></tr><tr><td colspan="2">All command lines are used at the beginning of a message. They\'re not case sensitive and can be written capital or lowercase.</td></tr><tr><td>/me</td><td>This is replaced with your username. <br/>Example : <em>/me smells the flowers</em> <b>will send as</b> <em>* '+ud.name+' smells the flowers</em></td></tr><tr><td>/rand<br/>/random</td><td>Will return a number between 1 and 100. You can pass along your own range by writing /rand <strong>(n1:n2)</strong>. n1 is the minimum and n2 is the maximum. <br/>Example : '+ud.name+' thinks of a number between 1 and 100 ...24 !</td></tr><tr><td>/8ball</td><td>Ask a question to the Magic 8-ball and get an answer ! <br/>Example : <em>/8ball will it snow ?</em> <b>will send as</b> <em>will it snow ? <strong>[The Magic 8-Ball says : Signs point to yes]</strong></em></td></tr>'+ (ud.mod ? '<tr><td>/cls<br/>/clear</td><td>This command clears all shoutbox messages.</td></tr>' : '') +'</table>',
    pop_style : 'width:99%;overflow-y:auto',
    where : actions
  });
  
  
  button({
    name : 'refresh messages',
    text : 'Refresh',
    where : options,
    advanced : function(b) {
      b.onclick = function() {
        idle = 0;
        getMessages({
          apply : function() { b.style.opacity = 0.3 },
          callback : function() {
            b.style.opacity = '';
            scrollBox();
          }
        });
      }
    }
  });
  
  button({
    name : 'resize shoutbox',
    text : '+',
    where : options,
    advanced : function(b) {
      b.style.fontWeight = 'bold';
      b.onclick = function() {
        scrollBox();
        if (!fmd_chat.style.zIndex) {
          this.innerHTML = '-';
          document.body.style.overflow = 'hidden';
          fmd_chat.className = 'fmd_chat_max';
          fmd_chat.style.zIndex = '1000000';
        } else {
          this.innerHTML = '+';
          document.body.style.overflow = '';
          fmd_chat.className = '';
          fmd_chat.style.zIndex = '';
        }
      };
    }
  });
  
  button({
    name : 'bold',
    text : 'B',
    css : 'font-weight:bold',
    tags : ['[b]','[/b]'],
    where : actions
  });
      
  button({
    name : 'italic',
    text : 'I',
    css : 'font-style:italic',
    tags : ['[i]','[/i]'],
    where : actions
  });
  
  button({
    name : 'underline',
    text : 'U',
    css : 'text-decoration:underline',
    tags : ['[u]','[/u]'],
    where : actions
  });
      
  button({
    name : 'strike',
    text : 'S',
    css : 'text-decoration:line-through',
    tags : ['[strike]','[/strike]'],
    where : actions
  });
  
  // emoticons
  popup({
    text : 'Smilies',
  title : 'Insert emoticon',
    add : emo_frame,
  where : actions,
    advanced : function(b, box) {
      emo_frame.onload = function() {
        for (var i=0,frame=frameContent(emo_frame),a=frame.getElementsByTagName('A'); i<a.length; i++) {
          if (/close\(\)/.test(a[i].href)) {
            a[i].href = '#close';
            a[i].onclick = function() { box.style.display = 'none' }
          }
          if (/chatboxsmilie/.test(a[i].href)) {
            a[i].href = '#' + a[i].href.match(/chatboxsmilie\('(.*?)'\)/)[1];
            a[i].onclick = function() {
              message.value += ' ' + this.getAttribute('href').slice(1);
              box.style.display = 'none';
            }
          }
        }
      };
    }
  });

  // colors
  popup({
    text : 'Color',
  title : 'Change text color',
    add : color_frame,
    where : actions,
    advanced : function(b, box) {
      var colortxt = my_getcookie('fmd_chat_colortxt') || '';
      b.appendChild(color_selected);
      color_frame.onload = function() {
        function setColor(val) {
          my_setcookie('fmd_chat_colortxt',val);
          message.style.color = val;
          color_selected.style.background = val;
          box.style.display = 'none';
        };
        var frame = frameContent(color_frame), hex = frame.getElementById('ColorHex'),
            remove = cre({
              tag : 'A',
              html : 'Remove Color',
              href : '#',
              style : 'font-size:12px;text-decoration:none;position:absolute;right:20px;color:red',
              click : function() {
                my_setcookie('fmd_chat_colortxt',0);
                setColor('');
                return false;
              }
            });
    
        if (!hex) return;
        hex.parentNode.appendChild(remove);
        hex.onkeydown = function(e) { if (e.keyCode == 13) { setColor(this.value); return false } };
        for (var i=0,td=frame.getElementsByTagName('TD'); i<td.length; i++) if (td[i].bgColor) td[i].onclick = function() { setColor(this.bgColor) }
      };
      
      if (colortxt.length) {
        message.style.color = colortxt;
        color_selected.style.background = colortxt;
      } 
    }
  });
  
  /* apply plugins, and add the shoutbox to the page */
  config.plugins();
  main.insertBefore(fmd_chat,main.firstChild);
  
  
  /* get the messages, and refresh them if auto-refresh enabled */
  getMessages();
  var chatRefresh = window.setInterval(function() {
    if (!refresh.checked || message.disabled) return;
    getMessages();
    
    /*
    * idle time is 5*60(5mins) without typing
    * used to prevent extra requests and members appearing active if they left their browser unattended
    */
    idle++;
    if (idle > config.timeout) {
      refresh.checked = 0;
      reftxt.className = 'fmd_idle';
    }
  },5000);
  
  /* determine the window state */
  window.onblur = function() { focus = 0 };
  window.onfocus = function() {
    if (!focus) {
      focus = 1;
      newmsg = 0;
      document.title = doct;
    }
  };
  
  /* typing and message submission */
  message.onkeydown = function(e) {
    if (e.keyCode ==  return true;
    else if (this.value.length > config.char_limit) e.preventDefault(); /* prevent further typing if char limit is reached */
  };
  message.onkeyup = function(e) {
    e.keyCode == 13 && sendMessage();
    idle > 0 && (idle = 0);
    if (reftxt.className.match(/fmd_idle/)) {
      reftxt.className = '';
      refresh.checked = 1;
    }
  };
  send.onclick = function() { sendMessage() };
  
  /* get message rows from the database */
  function getMessages(o) {
    if (loading) return;
    (o && o.apply) && o.apply();
    
    loading = 1;
    $.get(_database.tid, function(data) {
      var table = $('#fmd_chat',data), dbr=$('#fmd_chat .db_chat_row',data), sbr = box.childNodes, idset = [];
      
      /* check if the last sent message is in the database, if not we'll resend the message */
      if (o && o.last && !table.find('#'+o.last).length) {
        message.value = o.msg;
        sendMessage('Error detected, resending message...');
      }
      
      /* remove shouts from database that exceed the maximum limit */
      if (dbr.length > config.msg_max) {
        $.get('/post?p='+config.pid+'&mode=editpost',function(data){
          var rows = $('#text_editor_textarea',data).val().match(/\[/i][/i]
\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[\/tr\]/g);
          $.post('/post?p='+config.pid+'&mode=editpost',{
            subject : _database.name,
            message : ''+rows.slice(Number(rows.length - config.msg_max) + config.msg_del,rows.length).join('')+'
[/i][/i][/i][/i][/i][/i][/i][/i][/i]
[table id="fmd_chat" class="database_table"][tr][td]User[/td]
[td]Avatar[/td]
[td]Message[/td]
[/tr]
[/table]
[i][i][i][i][i][i][i][i][i]
',
            post : 1
          });
        }); 
      }
      
      /* remove messages from the shoutbox that aren't in the database */
      for (var i=0,j=sbr.length; i<j; i++) !table.find('#'+sbr[i].id).length && idset.push(sbr[i].id);
      for (var i=0,j=idset.length; i<j; i++) box.removeChild(document.getElementById(idset[i]));
      
      /* apply new messages */
      if (sbr.length < dbr.length) {
        for (var i=0,j=dbr.length,rid; i<j; i++) {
          rid = dbr[i].id;
          if (!document.getElementById(rid)) {
            var uid = dbr[i].firstChild.innerHTML.match(/(.*?):.*?:.*/)[1], unm = dbr[i].firstChild.innerHTML.match(/.*?:(.*?):.*/)[1],
            crow = cre({
              tag : 'DIV',
              id : rid,
              classname : 'fmd_chat_row',
              html : '<div class="fmd_chat_avatar"><a href="/u'+uid+'" title="View '+unm+'\'s profile"><img src="'+(dbr[i].childNodes[1].firstChild.tagName == 'A' ? dbr[i].childNodes[1].firstChild.innerHTML : dbr[i].childNodes[1].innerHTML)+'" alt="avatar"/></a></div><div class="fmd_chat_name"> <span class="fmd_chat_time"><img class="fmd_chat_clock" src="http://i38.servimg.com/u/f38/18/45/41/65/time10.png" alt="time :"/> '+dbr[i].firstChild.innerHTML.match(/.*?:.*?:(.*)/)[1]+'</span></div><div class="fmd_chat_message">'+dbr[i].lastChild.innerHTML.replace(/\[custom (.*?)\]/ig,'<span $1>').replace(/\[\/custom\]/ig,'</span>')+'</div>'
            }),
            ulink = cre({
              tag : 'A',
              href : '/u' + uid,
              html : unm,
              title : 'Mention ' + unm,
              click : function() {
                message.focus();
                message.value += '@"'+this.innerHTML+'" ';
                return false;
              }
            });
            
            crow.childNodes[1].insertBefore(ulink,crow.childNodes[1].firstChild);
            box.appendChild(crow);
            !focus && newmsg++;
          }
        }
        !focus && (document.title = '** '+newmsg+' NEW MESSAGE'+ (newmsg > 1 ? 'S' : '') +' **');
        scrollBox();
      }
      
      (o && o.callback) && o.callback();
      loading = 0;
    });
  };
  

  /* post a message to the database */
  function sendMessage(txt) {
    /* filter out tags */
    msg = message.value.replace(/(\[td\]|\[\/td\]|\[tr\]|\[\/tr\]|\[table\]|\[\/table\]|\[th\]|\[\/th\]|\[tbody\]|\[\/tbody\]|\[quote\]|\[quote=.*?\]|\[\/quote\]|\[code\]|\[\/code\]|\[hide\]|\[\/hide\]|\[spoiler\]|\[spoiler=.*?\]|\[\/spoiler\])/gi,'');

    if (!msg.length || msg.length > config.char_limit + 1 || message.disabled) return;
    message.value = txt ? txt : 'Sending...';
    message.disabled = true;
    footer.className = 'fmd_chat_sending';
    
    /* command lines */
    /^\/me/i.test(msg) && (msg = '[b]* ' + msg.replace(/^\/me/i,ud.name) + '[/b]');
    
    /^\/8ball/i.test(msg) && (msg = msg.replace(/^\/8ball/i,'') + ' [b][The Magic 8-Ball says : ' + ['It is certain','It is decidedly so','Without a doubt','Yes definitely','You may rely on it','As I see it, yes','Most likely','Outlook good','Yes','Signs point to yes','Reply hazy try again','Ask again later','Better not tell you now','Cannot predict now','Concentrate and ask again','Don\'t count on it','My reply is no','My sources say no','Outlook not so good','Very doubtful'][Math.floor(Math.random()*20)] + '][/b]');
    
    if (/^(\/random|\/rand)/i.test(msg)) {
      var min = 1, max = 100, n = Math.floor(Math.random() * (max - min + 1)) + min;
      if (msg.match(/\(\d+:\d+\)/)) {
        min = Number(msg.match(/\((\d+):\d+\)/)[1]), max = Number(msg.match(/\(\d+:(\d+)\)/)[1]);
        n = Math.floor(Math.random() * (max - min + 1)) + min;
      }
      msg = ud.name + ' thinks of a number between ' + min + ' and ' + max + ' ...' + n + ' !';
    };
    
    if (/^(\/clear|\/cls)/i.test(msg) && ud.mod) {
      message.value = 'Clearing messages...';
      $.post('/post?p='+config.pid+'&mode=editpost',{
        subject : _database.name,
        message : '
[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]
[table id="fmd_chat" class="database_table"][tr][td]User[/td]
[td]Avatar[/td]
[td]Message[/td]
[/tr]
[tr id="shout_u' + ud.id + '-' + +new Date + '" class="db_chat_row"][td]'+ud.id+':Shout Monster:'+setDate()+'[/td]
[td]http://i38.servimg.com/u/f38/18/21/60/73/sm11.png[/td]
[td][b]MESSAGES HAVE BEEN CLEARED BY '+ud.name.toUpperCase()+'[/b][/td]
[/tr]
[/table]
[i][i][i][i][i][i][i][i][i][i][i]
[i][i][i][i][i][i][i][i][i]
',
        post : 1
      },function() {
        msgEnabled();
        getMessages();
      });
      return;
    }
    
    // formatting
    if (message.style.length) for (var i in fo) RegExp(fo[i].d.a[1], 'i').test(message.style[fo[i].d.a[0]]) && (msg = fo[i].d.b[0] + msg + fo[i].d.b[1]);
    
    // coloring
    if (message.style.color) {
      color = message.style.color.replace(/\s/g,'').toUpperCase();
      color.match(/RGB/) ? msg = '[color='+toHex(color.match(/RGB\((\d+),\d+,\d+\)/)[1], color.match(/RGB\(\d+,(\d+),\d+\)/)[1], color.match(/RGB\(\d+,\d+,(\d+)\)/)[1])+']' + msg + '[/color]' : msg = '[color=+color+]' + msg + '[/color]';
    }
    
    var rid = 'shout_u' + ud.id + '-' + +new Date;
    _database.post({
      pid : config.pid,
      tableid : 'null',
      update : ['null','null'],
      newRow : ''+ud.id+':'+ud.name+':'+setDate()+'
'+ud.ava.match(/src="(.*?)"/)[1]+'
'+msg+'
',
      callback : function(state) {
        msgEnabled();
        getMessages({ last : rid, msg : msg });
        state == 'ERROR' && ( footer.innerHTML = '<p class="fmd_chat_error">An error occured : You don\'t have permission to send messages. Please contact the board Administrator for more information.</p>' );
      }
    });
  };
  
  function msgEnabled() { message.disabled = false; footer.className = ''; message.value = ''; message.focus() };
  function scrollBox() { box.scrollTop = 99999 };
  
  function setDate() {
    var a=new Date(), b=new Date(a.getTime()+(a.getTimezoneOffset()*60000)+(3600000*config.timezone));
    function set(i) { return i > 9 ? i : '0' + i };
    return b.getDate() + '/' + (b.getMonth() + 1) + '/' + b.getFullYear() + ' - ' + set(b.getHours()) + ':' + set(b.getMinutes()) + ':' + set(b.getSeconds());
  };
  
  function toHex() {
    for (var i=0, n=arguments, j=n.length, colorString = '#', h; i<j; i++) {
      h = Number(n[i]).toString(16);
      colorString += (h.length < 2 ? '0' + h : h);
    }
    return colorString.toUpperCase();
  };
  
  function cre(o) {
    var el = document.createElement(o.tag);
    o.html && (el.innerHTML = o.html);
    o.id && (el.id = o.id);
    o.forId && (el.htmlFor = o.forId);
    o.classname && (el.className = o.classname);
    o.src && (el.src = o.src);
    o.type && (el.type = o.type);
    o.href && (el.href = o.href);
    o.title && (el.title = o.title);
    o.value && (el.value = o.value);
    o.checked && (el.checked = o.checked);
    if (o.style) {
      o.style = o.style.split(';');
      for (var i = 0, j = o.style.length, d; i<j; i++) {
        if (o.style[i].length) {
          d = o.style[i].split(':');
          el.style[d[0]] = d[1];
        }
      }
    }
    
    o.click && (el.onclick = o.click);
    o.mouseup && (el.onmouseup = o.mouseup);
    
    return el;
  };
  
  function frameContent(frame) {
    if (frame.contentDocument) frame = frame.contentDocument;
    else if (frame.contentWindow) frame = frame.contentWindow.document;
    frame.body.style.background = 'none';
    return frame;
  };
  
  function button(o) {
    var actif = my_getcookie('fmd_chat_'+o.name) == 1,font,a;
    if (o.tags) {
      a = o.css.split(':'), font = a[0].match(/(font-weight|font-style)/);
      fo[o.name] = {
        d : { a : a, b : o.tags },
        press : function() {
          if (message.style[a[0]].match(RegExp(a[1],'i'))) {
            message.style[a[0]] = message.style[a[0]].replace(RegExp(a[1],'i'),(font ? 'normal' : ''));
            this.className = this.className.replace(/actif/,'');
            my_setcookie('fmd_chat_'+o.name,0);
          } else {
            font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1];
            this.className += ' actif';
            my_setcookie('fmd_chat_'+o.name,1);
          }
        }
      };
      actif && (font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1]);
    }
    
    var button = cre({
      tag : 'DIV',
      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : '') + (actif ? ' actif' : ''),
      html : o.text,
      title : o.name,
      style : (o.style ? o.style : ''),
      mouseup : (fo[o.name] ? fo[o.name].press : '')
    });
    
    o.where.appendChild(button);
    o.advanced && o.advanced(button);
  };
  
  function popup(o) {
    var box = cre({
      tag : 'DIV',
      classname : 'fmd_chat_dropdown',
      style : 'display:none;z-index:10000;' + (o.pop_style ? o.pop_style : ''),
      html : (o.content ? o.content : '')
    }),
    button = cre({
      tag : 'DIV',
      title : (o.title ? o.title : ''),
      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : ''),
      style : (o.but_style ? o.but_style : ''),
      html : o.text,
      mouseup : function() {
        /none/i.test(box.style.display) ? box.style.display = 'block' : box.style.display = 'none';
        o.add && (!box.childNodes.length && box.appendChild(o.add));
      }
    });
    o.where.appendChild(button);
    o.where.appendChild(box);
    o.advanced && o.advanced(button, box);
  };
});

http://cda-academy.forumotion.com/f1-staff-section


Last edited by Kirbs on June 16th 2015, 12:59 am; edited 1 time in total
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by brandon_g June 16th 2015, 12:03 am

Hello,

I would suggest putting it in
Code:
[code][/code]
as certain parts arent showing up right the way you did it. Smile

-Brandon


CSS - FMD Chat? Brando10
Remember to mark your topic CSS - FMD Chat? Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

CSS - FMD Chat? Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 9726
Reputation : 889
Language : English
Location : USA

View user profile https://www.broadcastingduo.com

Back to top Go down

In progress Re: FMD Chat?

Post by Ange Tuteur June 16th 2015, 10:49 am

I'm going to need you to replace it with the base script ( aside from config ), because the one you posted is riddled with syntax errors.
CSS - FMD Chat? Captur15

Code:
/*
* Shoutbox for Forumotion forums
* Developed by Ange Tuteur - FM Design
* Database must be installed for full functionality ( http://fmdesign.forumotion.com/t281- )
*/
/^\/f1/.test(window.location.pathname) && $(function() {
 var config = {
  pid : 884,
  char_limit : 750,
  msg_max : 50,
  msg_del : 10,
  timeout : 60,
  public_chat : 1,
  title : 'CDA Staff Chat',
 
  mods : [1,3,8,89],
  banned : [-1],
 
  timezone : -5,
  rights : 0, // choose to allow a small backlink to the developer's website
 
  plugins : function() {
    // custom content such as buttons and modifications can go here
  }
 };
 
  if (!config.public_chat && !_userdata.session_logged_in) return;
  var fo = {},
      ud = {
        id : _userdata.user_id,
        name : _userdata.username,
        ava : _userdata.avatar,
        mod : 0
      },
      main = document.getElementById('content') || document.getElementById('page-body'),
      fmd_chat = cre({
        tag : 'DIV',
        id : 'fmd_chatbox'
      }),
   
      box = cre({
        tag : 'DIV',
        id : 'fmd_chat_messagebox'
      }),
   
      header = cre({
        tag : 'DIV',
        id : 'fmd_chat_header',
        html : '<span class="fmd_chat_title">'+config.title+'</span><div class="fmd_chat_options"></div><div style="clear:both"></div>'
      }),
   
      footer = cre({
        tag : 'DIV',
        id : 'fmd_chat_footer'
      }),
   
      actions = cre({
        tag : 'DIV',
        classname : 'fmd_chat_actions'
      }),
 
      emo_frame = cre({
        tag : 'IFRAME',
        classname : 'fmd_chat_frame',
        src : '/post?mode=smilies_chatbox'
      }),
   
      color_frame = cre({
        tag : 'IFRAME',
        classname : 'fmd_chat_frame',
        src : '/chatbox/selectcolor'
      }),
   
      color_selected = cre({
        tag : 'DIV',
        classname : 'fmd_color_selected'
      }),
   
      message = cre({
        tag : 'INPUT',
        type : 'text',
        style : 'font-weight:normal;font-style:normal',
        id : 'fmd_chat_message'
      }),
   
      send = cre({
        tag : 'INPUT',
        type : 'button',
        id : 'fmd_chat_send',
        value : 'Send'
      }),
   
      refresh = cre({
        tag : 'INPUT',
        id : 'fmd_chat_refresh',
        type : 'checkbox',
        title : 'Auto refresh',
        checked : (my_getcookie('fmd_chat_refresh') && my_getcookie('fmd_chat_refresh').length) ? Number(my_getcookie('fmd_chat_refresh')) : 1,
        click : function() {
          this.checked ? my_setcookie('fmd_chat_refresh',1) : my_setcookie('fmd_chat_refresh',0);
          idle = 0;
          this.previousSibling.className.match(/fmd_idle/) && (this.previousSibling.className = '');
        }
      }),
   
      reftxt = cre({
        tag : 'LABEL',
        forId : 'fmd_chat_refresh',
        html : 'Auto : <div class="fmd_chat_dropdown fmd_notice">Auto-refresh has been disabled due to inactivity.. Click this message to enable it.</div>',
        style : 'cursor:pointer',
        title : 'Auto refresh'
      }),
   
      cnote = cre({
        tag : 'DIV',
        html : '\x44\x65\x76\x65\x6c\x6f\x70\x65\x64\x20\x62\x79\x20\x3c\x61\x20\x68\x72\x65\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x66\x6d\x64\x65\x73\x69\x67\x6e\x2e\x66\x6f\x72\x75\x6d\x6f\x74\x69\x6f\x6e\x2e\x63\x6f\x6d\x2f\x74\x33\x31\x38\x2d\x66\x6d\x64\x2d\x73\x68\x6f\x75\x74\x62\x6f\x78\x23\x32\x30\x39\x35\x22\x20\x74\x61\x72\x67\x65\x74\x3d\x22\x5f\x62\x6c\x61\x6e\x6b\x22\x3e\x41\x6e\x67\x65\x20\x54\x75\x74\x65\x75\x72\x3c\x2f\x61\x3e',
        style : 'text-align:right'
      }),
      options = header.childNodes[1],
      doct = document.title,
      newmsg = 0,
      loading = 0,
      idle = 0,
      focus = 1,
      msg,
      color;
   
  fmd_chat.appendChild(header);
  options.appendChild(reftxt);
  options.appendChild(refresh);
  fmd_chat.appendChild(box);
  fmd_chat.appendChild(footer);
  footer.appendChild(message);
  footer.appendChild(send);
  footer.appendChild(actions);
  config.rights && fmd_chat.appendChild(cnote);
 
  /* check if the user is a moderator */
  for (var i=0,j=config.mods.length; i<j; i++) ud.id == config.mods[i] && (ud.mod = 1);

  /* check if the user has been blocked from writing */
  for (var i=0,j=config.banned.length; i<j; i++) {
    if (ud.id == config.banned[i]) {
      if (ud.id == -1) footer.innerHTML = '<p class="fmd_chat_error">Please <a href="/login">login</a> or <a href="/register">register</a> to use the shoutbox.</p>';
      else footer.innerHTML = '<p class="fmd_chat_error">You have been blocked from using the shoutbox. Please contact the board Administrator for more information.</p>';
    }
  }
 
 
  popup({
    text : '?',
    title : 'help',
    content : '<table class="fmd_chat_help"><tr class="fmd_chat_header"><td width="25%">Command Line</td><td>Explanation</td></tr><tr><td colspan="2">All command lines are used at the beginning of a message. They\'re not case sensitive and can be written capital or lowercase.</td></tr><tr><td>/me</td><td>This is replaced with your username. <br/>Example : <em>/me smells the flowers</em> <b>will send as</b> <em>* '+ud.name+' smells the flowers</em></td></tr><tr><td>/rand<br/>/random</td><td>Will return a number between 1 and 100. You can pass along your own range by writing /rand <strong>(n1:n2)</strong>. n1 is the minimum and n2 is the maximum. <br/>Example : '+ud.name+' thinks of a number between 1 and 100 ...24 !</td></tr><tr><td>/8ball</td><td>Ask a question to the Magic 8-ball and get an answer ! <br/>Example : <em>/8ball will it snow ?</em> <b>will send as</b> <em>will it snow ? <strong>[The Magic 8-Ball says : Signs point to yes]</strong></em></td></tr>'+ (ud.mod ? '<tr><td>/cls<br/>/clear</td><td>This command clears all shoutbox messages.</td></tr>' : '') +'</table>',
    pop_style : 'width:99%;overflow-y:auto',
    where : actions
  });
 
 
  button({
    name : 'refresh messages',
    text : 'Refresh',
    where : options,
    advanced : function(b) {
      b.onclick = function() {
        idle = 0;
        getMessages({
          apply : function() { b.style.opacity = 0.3 },
          callback : function() {
            b.style.opacity = '';
            scrollBox();
          }
        });
      }
    }
  });
 
  button({
    name : 'resize shoutbox',
    text : '+',
    where : options,
    advanced : function(b) {
      b.style.fontWeight = 'bold';
      b.onclick = function() {
        scrollBox();
        if (!fmd_chat.style.zIndex) {
          this.innerHTML = '-';
          document.body.style.overflow = 'hidden';
          fmd_chat.className = 'fmd_chat_max';
          fmd_chat.style.zIndex = '1000000';
        } else {
          this.innerHTML = '+';
          document.body.style.overflow = '';
          fmd_chat.className = '';
          fmd_chat.style.zIndex = '';
        }
      };
    }
  });
 
  button({
    name : 'bold',
    text : 'B',
    css : 'font-weight:bold',
    tags : ['[b]','[/b]'],
    where : actions
  });
   
  button({
    name : 'italic',
    text : 'I',
    css : 'font-style:italic',
    tags : ['[i]','[/i]'],
    where : actions
  });
 
  button({
    name : 'underline',
    text : 'U',
    css : 'text-decoration:underline',
    tags : ['[u]','[/u]'],
    where : actions
  });
   
  button({
    name : 'strike',
    text : 'S',
    css : 'text-decoration:line-through',
    tags : ['[strike]','[/strike]'],
    where : actions
  });
 
  // emoticons
  popup({
    text : 'Smilies',
  title : 'Insert emoticon',
    add : emo_frame,
  where : actions,
    advanced : function(b, box) {
      emo_frame.onload = function() {
        for (var i=0,frame=frameContent(emo_frame),a=frame.getElementsByTagName('A'); i<a.length; i++) {
          if (/close\(\)/.test(a[i].href)) {
            a[i].href = '#close';
            a[i].onclick = function() { box.style.display = 'none' }
          }
          if (/chatboxsmilie/.test(a[i].href)) {
            a[i].href = '#' + a[i].href.match(/chatboxsmilie\('(.*?)'\)/)[1];
            a[i].onclick = function() {
              message.value += ' ' + this.getAttribute('href').slice(1);
              box.style.display = 'none';
            }
          }
        }
      };
    }
  });

  // colors
  popup({
    text : 'Color',
  title : 'Change text color',
    add : color_frame,
    where : actions,
    advanced : function(b, box) {
      var colortxt = my_getcookie('fmd_chat_colortxt') || '';
      b.appendChild(color_selected);
      color_frame.onload = function() {
        function setColor(val) {
          my_setcookie('fmd_chat_colortxt',val);
          message.style.color = val;
          color_selected.style.background = val;
          box.style.display = 'none';
        };
        var frame = frameContent(color_frame), hex = frame.getElementById('ColorHex'),
            remove = cre({
              tag : 'A',
              html : 'Remove Color',
              href : '#',
              style : 'font-size:12px;text-decoration:none;position:absolute;right:20px;color:red',
              click : function() {
                my_setcookie('fmd_chat_colortxt',0);
                setColor('');
                return false;
              }
            });
 
        if (!hex) return;
        hex.parentNode.appendChild(remove);
        hex.onkeydown = function(e) { if (e.keyCode == 13) { setColor(this.value); return false } };
        for (var i=0,td=frame.getElementsByTagName('TD'); i<td.length; i++) if (td[i].bgColor) td[i].onclick = function() { setColor(this.bgColor) }
      };
   
      if (colortxt.length) {
        message.style.color = colortxt;
        color_selected.style.background = colortxt;
      }
    }
  });
 
  /* apply plugins, and add the shoutbox to the page */
  config.plugins();
  main.insertBefore(fmd_chat,main.firstChild);
 
 
  /* get the messages, and refresh them if auto-refresh enabled */
  getMessages();
  var chatRefresh = window.setInterval(function() {
    if (!refresh.checked || message.disabled) return;
    getMessages();
 
    /*
    * idle time is 5*60(5mins) without typing
    * used to prevent extra requests and members appearing active if they left their browser unattended
    */
    idle++;
    if (idle > config.timeout) {
      refresh.checked = 0;
      reftxt.className = 'fmd_idle';
    }
  },5000);
 
  /* determine the window state */
  window.onblur = function() { focus = 0 };
  window.onfocus = function() {
    if (!focus) {
      focus = 1;
      newmsg = 0;
      document.title = doct;
    }
  };
 
  /* typing and message submission */
  message.onkeydown = function(e) {
    if (e.keyCode == 8) return true;
    else if (this.value.length > config.char_limit) e.preventDefault(); /* prevent further typing if char limit is reached */
  };
  message.onkeyup = function(e) {
    e.keyCode == 13 && sendMessage();
    idle > 0 && (idle = 0);
    if (reftxt.className.match(/fmd_idle/)) {
      reftxt.className = '';
      refresh.checked = 1;
    }
  };
  send.onclick = function() { sendMessage() };
 
  /* get message rows from the database */
  function getMessages(o) {
    if (loading) return;
    (o && o.apply) && o.apply();
 
    loading = 1;
    $.get(_database.tid, function(data) {
      var table = $('#fmd_chat',data), dbr=$('#fmd_chat .db_chat_row',data), sbr = box.childNodes, idset = [];
   
      /* check if the last sent message is in the database, if not we'll resend the message */
      if (o && o.last && !table.find('#'+o.last).length) {
        message.value = o.msg;
        sendMessage('Error detected, resending message...');
      }
   
      /* remove shouts from database that exceed the maximum limit */
      if (dbr.length > config.msg_max) {
        $.get('/post?p='+config.pid+'&mode=editpost',function(data){
          var rows = $('#text_editor_textarea',data).val().match(/\[tr id="shout_u.*?" class="db_chat_row"\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[td\].*?\[\/td\]\[\/tr\]/g);
          $.post('/post?p='+config.pid+'&mode=editpost',{
            subject : _database.name,
            message : '[table id="fmd_chat" class="database_table"][tr][td]User[/td][td]Avatar[/td][td]Message[/td][/tr]'+rows.slice(Number(rows.length - config.msg_max) + config.msg_del,rows.length).join('')+'[/table]',
            post : 1
          });
        });
      }
   
      /* remove messages from the shoutbox that aren't in the database */
      for (var i=0,j=sbr.length; i<j; i++) !table.find('#'+sbr[i].id).length && idset.push(sbr[i].id);
      for (var i=0,j=idset.length; i<j; i++) box.removeChild(document.getElementById(idset[i]));
   
      /* apply new messages */
      if (sbr.length < dbr.length) {
        for (var i=0,j=dbr.length,rid; i<j; i++) {
          rid = dbr[i].id;
          if (!document.getElementById(rid)) {
            var uid = dbr[i].firstChild.innerHTML.match(/(.*?):.*?:.*/)[1], unm = dbr[i].firstChild.innerHTML.match(/.*?:(.*?):.*/)[1],
            crow = cre({
              tag : 'DIV',
              id : rid,
              classname : 'fmd_chat_row',
              html : '<div class="fmd_chat_avatar"><a href="/u'+uid+'" title="View '+unm+'\'s profile"><img src="'+(dbr[i].childNodes[1].firstChild.tagName == 'A' ? dbr[i].childNodes[1].firstChild.innerHTML : dbr[i].childNodes[1].innerHTML)+'" alt="avatar"/></a></div><div class="fmd_chat_name">&nbsp;<span class="fmd_chat_time"><img class="fmd_chat_clock" src="http://i38.servimg.com/u/f38/18/45/41/65/time10.png" alt="time :"/> '+dbr[i].firstChild.innerHTML.match(/.*?:.*?:(.*)/)[1]+'</span></div><div class="fmd_chat_message">'+dbr[i].lastChild.innerHTML.replace(/\[custom (.*?)\]/ig,'<span $1>').replace(/\[\/custom\]/ig,'</span>')+'</div>'
            }),
            ulink = cre({
              tag : 'A',
              href : '/u' + uid,
              html : unm,
              title : 'Mention ' + unm,
              click : function() {
                message.focus();
                message.value += '@"'+this.innerHTML+'" ';
                return false;
              }
            });
         
            crow.childNodes[1].insertBefore(ulink,crow.childNodes[1].firstChild);
            box.appendChild(crow);
            !focus && newmsg++;
          }
        }
        !focus && (document.title = '** '+newmsg+' NEW MESSAGE'+ (newmsg > 1 ? 'S' : '') +' **');
        scrollBox();
      }
   
      (o && o.callback) && o.callback();
      loading = 0;
    });
  };
 

  /* post a message to the database */
  function sendMessage(txt) {
    /* filter out tags */
    msg = message.value.replace(/(\[td\]|\[\/td\]|\[tr\]|\[\/tr\]|\[table\]|\[\/table\]|\[th\]|\[\/th\]|\[tbody\]|\[\/tbody\]|\[quote\]|\[quote=.*?\]|\[\/quote\]|\[code\]|\[\/code\]|\[hide\]|\[\/hide\]|\[spoiler\]|\[spoiler=.*?\]|\[\/spoiler\])/gi,'');

    if (!msg.length || msg.length > config.char_limit + 1 || message.disabled) return;
    message.value = txt ? txt : 'Sending...';
    message.disabled = true;
    footer.className = 'fmd_chat_sending';
 
    /* command lines */
    /^\/me/i.test(msg) && (msg = '[b]* ' + msg.replace(/^\/me/i,ud.name) + '[/b]');
 
    /^\/8ball/i.test(msg) && (msg = msg.replace(/^\/8ball/i,'') + ' [b][The Magic 8-Ball says : ' + ['It is certain','It is decidedly so','Without a doubt','Yes definitely','You may rely on it','As I see it, yes','Most likely','Outlook good','Yes','Signs point to yes','Reply hazy try again','Ask again later','Better not tell you now','Cannot predict now','Concentrate and ask again','Don\'t count on it','My reply is no','My sources say no','Outlook not so good','Very doubtful'][Math.floor(Math.random()*20)] + '][/b]');
 
    if (/^(\/random|\/rand)/i.test(msg)) {
      var min = 1, max = 100, n = Math.floor(Math.random() * (max - min + 1)) + min;
      if (msg.match(/\(\d+:\d+\)/)) {
        min = Number(msg.match(/\((\d+):\d+\)/)[1]), max = Number(msg.match(/\(\d+:(\d+)\)/)[1]);
        n = Math.floor(Math.random() * (max - min + 1)) + min;
      }
      msg = ud.name + ' thinks of a number between ' + min + ' and ' + max + ' ...' + n + ' !';
    };
 
    if (/^(\/clear|\/cls)/i.test(msg) && ud.mod) {
      message.value = 'Clearing messages...';
      $.post('/post?p='+config.pid+'&mode=editpost',{
        subject : _database.name,
        message : '[table id="fmd_chat" class="database_table"][tr][td]User[/td][td]Avatar[/td][td]Message[/td][/tr][tr id="shout_u' + ud.id + '-' + +new Date + '" class="db_chat_row"][td]'+ud.id+':Shout Monster:'+setDate()+'[/td][td]http://i38.servimg.com/u/f38/18/21/60/73/sm11.png[/td][td][b]MESSAGES HAVE BEEN CLEARED BY '+ud.name.toUpperCase()+'[/b][/td][/tr][/table]',
        post : 1
      },function() {
        msgEnabled();
        getMessages();
      });
      return;
    }
 
    // formatting
    if (message.style.length) for (var i in fo) RegExp(fo[i].d.a[1], 'i').test(message.style[fo[i].d.a[0]]) && (msg = fo[i].d.b[0] + msg + fo[i].d.b[1]);
 
    // coloring
    if (message.style.color) {
      color = message.style.color.replace(/\s/g,'').toUpperCase();
      color.match(/RGB/) ? msg = '[color='+toHex(color.match(/RGB\((\d+),\d+,\d+\)/)[1], color.match(/RGB\(\d+,(\d+),\d+\)/)[1], color.match(/RGB\(\d+,\d+,(\d+)\)/)[1])+']' + msg + '[/color]' : msg = '[color='+color+']' + msg + '[/color]';
    }
 
    var rid = 'shout_u' + ud.id + '-' + +new Date;
    _database.post({
      pid : config.pid,
      tableid : 'null',
      update : ['null','null'],
      newRow : '[tr id="'+rid+'" class="db_chat_row"][td]'+ud.id+':'+ud.name+':'+setDate()+'[/td][td]'+ud.ava.match(/src="(.*?)"/)[1]+'[/td][td]'+msg+'[/td][/tr]',
      callback : function(state) {
        msgEnabled();
        getMessages({ last : rid, msg : msg });
        state == 'ERROR' && ( footer.innerHTML = '<p class="fmd_chat_error">An error occured : You don\'t have permission to send messages. Please contact the board Administrator for more information.</p>' );
      }
    });
  };
 
  function msgEnabled() { message.disabled = false; footer.className = ''; message.value = ''; message.focus() };
  function scrollBox() { box.scrollTop = 99999 };
 
  function setDate() {
    var a=new Date(), b=new Date(a.getTime()+(a.getTimezoneOffset()*60000)+(3600000*config.timezone));
    function set(i) { return i > 9 ? i : '0' + i };
    return b.getDate() + '/' + (b.getMonth() + 1) + '/' + b.getFullYear() + ' - ' + set(b.getHours()) + ':' + set(b.getMinutes()) + ':' + set(b.getSeconds());
  };
 
  function toHex() {
    for (var i=0, n=arguments, j=n.length, colorString = '#', h; i<j; i++) {
      h = Number(n[i]).toString(16);
      colorString += (h.length < 2 ? '0' + h : h);
    }
    return colorString.toUpperCase();
  };
 
  function cre(o) {
    var el = document.createElement(o.tag);
    o.html && (el.innerHTML = o.html);
    o.id && (el.id = o.id);
    o.forId && (el.htmlFor = o.forId);
    o.classname && (el.className = o.classname);
    o.src && (el.src = o.src);
    o.type && (el.type = o.type);
    o.href && (el.href = o.href);
    o.title && (el.title = o.title);
    o.value && (el.value = o.value);
    o.checked && (el.checked = o.checked);
    if (o.style) {
      o.style = o.style.split(';');
      for (var i = 0, j = o.style.length, d; i<j; i++) {
        if (o.style[i].length) {
          d = o.style[i].split(':');
          el.style[d[0]] = d[1];
        }
      }
    }
 
    o.click && (el.onclick = o.click);
    o.mouseup && (el.onmouseup = o.mouseup);
 
    return el;
  };
 
  function frameContent(frame) {
    if (frame.contentDocument) frame = frame.contentDocument;
    else if (frame.contentWindow) frame = frame.contentWindow.document;
    frame.body.style.background = 'none';
    return frame;
  };
 
  function button(o) {
    var actif = my_getcookie('fmd_chat_'+o.name) == 1,font,a;
    if (o.tags) {
      a = o.css.split(':'), font = a[0].match(/(font-weight|font-style)/);
      fo[o.name] = {
        d : { a : a, b : o.tags },
        press : function() {
          if (message.style[a[0]].match(RegExp(a[1],'i'))) {
            message.style[a[0]] = message.style[a[0]].replace(RegExp(a[1],'i'),(font ? 'normal' : ''));
            this.className = this.className.replace(/actif/,'');
            my_setcookie('fmd_chat_'+o.name,0);
          } else {
            font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1];
            this.className += ' actif';
            my_setcookie('fmd_chat_'+o.name,1);
          }
        }
      };
      actif && (font ? message.style[a[0]] = a[1] : message.style[a[0]] += ' ' + a[1]);
    }
 
    var button = cre({
      tag : 'DIV',
      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : '') + (actif ? ' actif' : ''),
      html : o.text,
      title : o.name,
      style : (o.style ? o.style : ''),
      mouseup : (fo[o.name] ? fo[o.name].press : '')
    });
 
    o.where.appendChild(button);
    o.advanced && o.advanced(button);
  };
 
  function popup(o) {
    var box = cre({
      tag : 'DIV',
      classname : 'fmd_chat_dropdown',
      style : 'display:none;z-index:10000;' + (o.pop_style ? o.pop_style : ''),
      html : (o.content ? o.content : '')
    }),
    button = cre({
      tag : 'DIV',
      title : (o.title ? o.title : ''),
      classname : 'fmd_chat_button' + (o.text.length < 2 ? ' fmd_small' : ''),
      style : (o.but_style ? o.but_style : ''),
      html : o.text,
      mouseup : function() {
        /none/i.test(box.style.display) ? box.style.display = 'block' : box.style.display = 'none';
        o.add && (!box.childNodes.length && box.appendChild(o.add));
      }
    });
    o.where.appendChild(button);
    o.where.appendChild(box);
    o.advanced && o.advanced(button, box);
  };
});

Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13242
Reputation : 2982
Language : EN, JA, FR
Location : Pennsylvania

View user profile https://fmdesign.forumotion.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 16th 2015, 6:14 pm

Nope, it's still not showing up Q_Q
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by Ange Tuteur June 16th 2015, 6:37 pm

I'd recommend removing this script :
Code:
$(function(){var x=document.getElementById('variables').getElementsByTagName('span');for(var i=0,v;(v=x[i++]);){$('.'+v.id).html(v.innerHTML);$('.'+v.id+'-replace').each(function(i,e){e.innerHTML=e.innerHTML.replace(RegExp('{'+v.id+'}','g'),v.innerHTML)})}});

Because it contains an error which is halting the rest of your JavaScripts in the sub-forums.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13242
Reputation : 2982
Language : EN, JA, FR
Location : Pennsylvania

View user profile https://fmdesign.forumotion.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 16th 2015, 8:41 pm

I couldn't find that part anywhere in the JS you told me to use o.O
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by Ange Tuteur June 16th 2015, 10:47 pm

@Kirbs wrote:I couldn't find that part anywhere in the JS you told me to use o.O
It's not in the script I gave you, but a script that's installed in JS codes management. Until you remove that script, the error will prevent the chatbox from working.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13242
Reputation : 2982
Language : EN, JA, FR
Location : Pennsylvania

View user profile https://fmdesign.forumotion.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 17th 2015, 2:44 am

Looked at all the Java scripts, none of them have that code o.o
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

In progress Re: FMD Chat?

Post by SLGray June 17th 2015, 2:49 am

Do you have it in a template, an announcement, or in the homepage message?


CSS - FMD Chat? Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 49647
Reputation : 3439
Language : English
Location : United States

View user profile https://forumsclub.com/gc/128-link-directory/

Back to top Go down

In progress Re: FMD Chat?

Post by Ange Tuteur June 17th 2015, 10:48 am

It's in one of the files if I'm getting the following error :
CSS - FMD Chat? Captur16
18972.js is a file installed in JavaScript codes management.
http://cda-academy.forumotion.com/18972.js

Just edit each file one by one and look for some of the following points :

1. The code :
Code:
$(function(){var x=document.getElementById('variables').getElementsByTagName('span');for(var i=0,v;(v=x[i++]);){$('.'+v.id).html(v.innerHTML);$('.'+v.id+'-replace').each(function(i,e){e.innerHTML=e.innerHTML.replace(RegExp('{'+v.id+'}','g'),v.innerHTML)})}});

2. Important piece of code.
The script isn't going to look as I've posted it, because I pulled it from your forum via the devtools. So, look for pieces of code that are SIMILAR. Such as this part :
Code:
var x=document.getElementById('variables').getElementsByTagName('span');

3. Search for a script with a specific location. It only appears to be happening in the sub-forums, so search for scripts that are enabled in this location.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13242
Reputation : 2982
Language : EN, JA, FR
Location : Pennsylvania

View user profile https://fmdesign.forumotion.com

Back to top Go down

In progress Re: FMD Chat?

Post by Kirbs June 18th 2015, 7:02 am

Thanks ange it works now, as well as the other problem i've had (which i made a topic for) the quick reply box. one problem still does exist tho which is in the chat box, when i type anything and hit send nothing would show up in the chat box
Kirbs
Kirbs
Forumember

Posts : 628
Reputation : 18
Language : English

View user profile

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum