- เครดิต
- 1
- เพื่อน
- ทักทาย
- บล็อก
- อัลบั้ม
- โพสต์
- กระทู้
- แชร์
- สำคัญ
- สิทธิ์อ่าน
- 10
- จำนวนผู้ติดตาม
- จำนวนผู้กำลังติดตาม
- เพศ
- ไม่บอก
|
Thank you very much.
I have modified a little so that I can achieve:
- each user can select one's own color on entries
- any entry triggers a sound, and users can select whether mute or not
- memorize the above settings
- change in a little user interface (both the 'editor' and the entries)
Demostration (need register):
http://exchristian.hk
Just to share all of you:
1. template/shoutbox.js:
- adding settings to cookies
below- var shoutbox_loaded = false;
คัดลอกไปที่คลิปบอร์ด add:- function setCookie1(para, value)
- {
- var argv = setCookie1.arguments;
- var argc = setCookie1.arguments.length;
- var name = para+self.location.hostname.toString().replace(/\./g,"");
- var expires = (argc > 2) ? argv[2] : null;
- if(expires!=null)
- {
- var LargeExpDate = new Date ();
- LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24));
- }
- document.cookie = name + "=" + escape (value)+((expires == null) ? "" : ("; expires=" +LargeExpDate.toGMTString()));
- }
- function getCookie1(para)
- {
- var Name = para+self.location.hostname.toString().replace(/\./g,"");
- var search = Name + "=";
- if(document.cookie.length > 0)
- {
- var offset = document.cookie.indexOf(search);
- if(offset != -1)
- {
- offset += search.length;
- var end = document.cookie.indexOf(";", offset);
- if(end == -1) end = document.cookie.length;
- return unescape(document.cookie.substring(offset, end));
- }
- else
- return "";
- }
- }
คัดลอกไปที่คลิปบอร์ด Below- this.temp_announcement = '';
คัดลอกไปที่คลิปบอร์ด add:- if (getCookie1("sb") == "0")
- this.shoutbox_sound = false;
- else
- this.shoutbox_sound = true;
คัดลอกไปที่คลิปบอร์ด - entries appearance changing
change:- spn.style.color = 'gray';
- spn.innerHTML = ' says ('+t+')';
- spc.innerHTML = (skin=='default') ? ': '+s : ': <span style="color:'+skin+'">'+s+'</span>';
- td.appendChild(anc);//username
- td.appendChild(spn);//time
- td.appendChild(spc);//content
คัดลอกไปที่คลิปบอร์ด into:- //spn.style.color = 'gray';
- spn.innerHTML = t;
- spc.innerHTML = (skin=='default') ? ': '+s : ': <span style="color:'+skin+'">'+s+'</span>';
-
- td.appendChild(spn);//time
- td.appendChild(anc);//username
- td.appendChild(spc);//content
คัดลอกไปที่คลิปบอร์ด - seems to be a bug, add support to descending order of entries
change:- if (shoutbox.shout_order == 'asc'){
- if (is_ie){
- o.innerHTML = div2.innerHTML+o.innerHTML;
- }else{
- o.insertBefore(div1, o.firstChild);
- }
- }
คัดลอกไปที่คลิปบอร์ด into:- if (shoutbox.shout_order == 'asc'){
- if (BROWSER.ie){
- o.innerHTML += div2.innerHTML;
- }else{
- o.appendChild(div1);
- }
- }else{
- if (BROWSER.ie){
- o.innerHTML = div2.innerHTML+o.innerHTML;
- }else{
- o.insertBefore(div1, o.firstChild);
- }
- }
คัดลอกไปที่คลิปบอร์ด - add sound support, I use pm_2.mp3, you can change it
below:- setTimeout('try{var div = document.getElementById("'+id+'"); div.style.backgroundColor = "'+orig_color+'";}catch(xx){}', (i+1)*time);
คัดลอกไปที่คลิปบอร์ด add:- if (document.createElement && shoutbox.shoutbox_sound)
- {
- var sbsound = document.getElementById('sbsoundnew');
- if (sbsound) {
- sbsound.innerHTML = null;
- document.body.removeChild(sbsound);
- sbsound = null;
- }
- var sbsound = document.createElement('span');
- sbsound.id = 'sbsoundnew';
- sbsound.name = 'sbsoundnew';
- document.body.appendChild(sbsound);
- sbsound.innerHTML = AC_FL_RunContent('id', 'sbsound', 'name', 'sbsound', 'width', '0', 'height', '0', 'src', 'images/sound/player.swf', 'FlashVars', 'sFile=images/sound/pm_2.mp3', 'menu', 'false', 'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true');
- };
คัดลอกไปที่คลิปบอร์ด - change appearance of entries
change:- var t = shoutbox.format_shout_time(d.getHours(), d.getMinutes());
คัดลอกไปที่คลิปบอร์ด into:- var t = shoutbox.format_shout_time(d.getHours(), d.getMinutes())+' ';
คัดลอกไปที่คลิปบอร์ด 2. shoutbox.php
- change appearance of entries
change:- 's_date' => get_date('M. d, Y', $shouts['s_date']),
คัดลอกไปที่คลิปบอร์ด into:- 's_date' => get_date('j/n', $shouts['s_date']),
คัดลอกไปที่คลิปบอร์ด change:- <td valign='top' style='border-style:none;height:auto;' nowrap="nowrap">
- " . (($d['s_uid'] != 0) ? ("<a href='space.php?action=viewpro&uid={$d['s_uid']}'><b>{$d['s_name']}</b></a>") : ("<b>{$d['s_name']}</b>")) . "
- says <span style='color:gray'>({$d['s_date']})</span>: {$d['s_message']}</td>
คัดลอกไปที่คลิปบอร์ด into:- <td valign='top' style='border-style:none;height:auto;'>
- {$d['s_date']} " . (($d['s_uid'] != 0) ? ("<a href='space.php?action=viewpro&uid={$d['s_uid']}'><b>{$d['s_name']}</b></a>") : ("<b>{$d['s_name']}</b>")) . ": {$d['s_message']}</td>
คัดลอกไปที่คลิปบอร์ด 3. template/shoutbox.htm
- change appearance of the "editor"
change:- .txtarea { width: 510px; height: 16px; }
คัดลอกไปที่คลิปบอร์ด into:- .txtarea { width: 620px; height: 16px; }
คัดลอกไปที่คลิปบอร์ด replace the whole block- <div class="editor_tb_shout">...</div>
คัดลอกไปที่คลิปบอร์ด into:- <div class="editor_tb_shout">
- <span class="right">
- <input class="txtarea" rows="5" cols="80" name="message" id="fastpostmessage" onKeyDown="seditor_ctlent(event, 'fastpostvalidate($(\'fastpostform\'))');">
- <span id="newspecialtmp"> <button id="shoutbox-submit-button" class="shoutbox-button">$shout_lang[shout_submit]</button>
- <button id="shoutbox-clear-button" class="shoutbox-button">$shout_lang[clear]</button>
- <button id="shoutbox-refresh-button" class="shoutbox-button">$shout_lang[refresh]</button>
- <select id="fastpostmessage-skin" onchange="if (this.selectedIndex > 0) setCookie1('sbcolor',this.value,7);this.style.backgroundColor=this.value;">
- <option value="default" selected="selected"> </option>
- <option value="#000000" style="background-color: #000000"> </option>
- <option value="#a0522d" style="background-color: #a0522d"> </option>
- <option value="#556b2f" style="background-color: #556b2f"> </option>
- <option value="#006400" style="background-color: #006400"> </option>
- <option value="#483d8b" style="background-color: #483d8b"> </option>
- <option value="#000080" style="background-color: #000080"> </option>
- <option value="#4b0082" style="background-color: #4b0082"> </option>
- <option value="#2f4f4f" style="background-color: #2f4f4f"> </option>
- <option value="#8b0000" style="background-color: #8b0000"> </option>
- <option value="#ff8c00" style="background-color: #ff8c00"> </option>
- <option value="#808000" style="background-color: #808000"> </option>
- <option value="#008000" style="background-color: #008000"> </option>
- <option value="#008080" style="background-color: #008080"> </option>
- <option value="#0000ff" style="background-color: #0000ff"> </option>
- <option value="#708090" style="background-color: #708090"> </option>
- <option value="#696969" style="background-color: #696969"> </option>
- <option value="#ff0000" style="background-color: #ff0000"> </option>
- <option value="#f4a460" style="background-color: #f4a460"> </option>
- <option value="#9acd32" style="background-color: #9acd32"> </option>
- <option value="#2e8b57" style="background-color: #2e8b57"> </option>
- <option value="#48d1cc" style="background-color: #48d1cc"> </option>
- <option value="#4169e1" style="background-color: #4169e1"> </option>
- <option value="#800080" style="background-color: #800080"> </option>
- <option value="#808080" style="background-color: #808080"> </option>
- <option value="#ff00ff" style="background-color: #ff00ff"> </option>
- <option value="#ffa500" style="background-color: #ffa500"> </option>
- <option value="#ffff00" style="background-color: #ffff00"> </option>
- <option value="#00ff00" style="background-color: #00ff00"> </option>
- <option value="#00ffff" style="background-color: #00ffff"> </option>
- <option value="#00bfff'" style="background-color: #00bfff"> </option>
- <option value="#9932cc" style="background-color: #9932cc"> </option>
- <option value="#c0c0c0" style="background-color: #c0c0c0"> </option>
- <option value="#ffc0cb" style="background-color: #ffc0cb"> </option>
- <option value="#f5deb3'" style="background-color: #f5deb3"> </option>
- <option value="#fffacd" style="background-color: #fffacd"> </option>
- <option value="#98fb98" style="background-color: #98fb98"> </option>
- <option value="#afeeee" style="background-color: #afeeee"> </option>
- <option value="#add8e6" style="background-color: #add8e6"> </option>
- <option value="#dda0dd" style="background-color: #dda0dd"> </option>
- </select>
- <input id="shoutbox-sound-select" type=checkbox onClick="setCookie1('sb',this.checked?1:0,7);shoutbox.shoutbox_sound=this.checked;"></input>
- <img src={IMGDIR}/ann_icon.gif align=middle></img>
- <script type="text/javascript">
- var l = getCookie1('sbcolor');
- if (l != "") {
- document.getElementById('fastpostmessage-skin').value = l;
- document.getElementById('fastpostmessage-skin').style.backgroundColor = l;
- }
- if (shoutbox.shoutbox_sound)
- document.getElementById('shoutbox-sound-select').checked = true;
- </script>
- </span>
- </span>
- <!--{if $shoutbox['allow']['smilies']['bbcode']}-->
- {eval $seditor = array('fastpost', array('bold', 'smilies'));}
- <!--{/if}-->
- {subtemplate seditor}
- </div>
คัดลอกไปที่คลิปบอร์ด |
คะแนน
-
ดูบันทึกคะแนน
|