0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
//Quick_Reply_Full_Functions by JustUsersThemesfunction theme_quickreply_box(){ global $txt, $modSettings, $db_prefix; global $context, $settings, $user_info; // Switch between default images and back... mostly in case you don't have an PersonalMessage template, but do ahve a Post template. if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) { $temp1 = $settings['theme_url']; $settings['theme_url'] = $settings['default_theme_url']; $temp2 = $settings['images_url']; $settings['images_url'] = $settings['default_images_url']; $temp3 = $settings['theme_dir']; $settings['theme_dir'] = $settings['default_theme_dir']; } // Set a flag so the sub template knows what to do... $context['show_bbc'] = !empty($modSettings['enableBBC']) && !empty($settings['show_bbc']); // Generate a list of buttons that shouldn't be shown - this should be the fastest way to do this. if (!empty($modSettings['disabledBBC'])) { $disabled_tags = explode(',', $modSettings['disabledBBC']); foreach ($disabled_tags as $tag) $context['disabled_tags'][trim($tag)] = true; } // Go! Supa-sub-template-smash! template_quickreply_box(); // Switch the URLs back... now we're back to whatever the main sub template is. (like folder in PersonalMessage.) if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) { $settings['theme_url'] = $temp1; $settings['images_url'] = $temp2; $settings['theme_dir'] = $temp3; }}
array( 'tag' => 'hr', 'type' => 'closed', 'content' => '<hr />', 'block_level' => true, ),เพิ่มไว้หลังarray( 'tag' => 'bgcolor', 'type' => 'unparsed_equals', 'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,12})\]', 'before' => '<span style="background-color:$1;">', 'after' => '</span>', ),
//Quick_Reply_Full_Functions by JustUsersThemesfunction template_quickreply_box(){ global $context, $settings, $options, $txt, $modSettings; // Assuming BBC code is enabled then print the buttons and some javascript to handle it. if ($context['show_bbc']) { echo ' <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ function bbc_highlight(something, mode) { something.style.backgroundImage = "url(" + smf_images_url + (mode ? "/bbc/bbc_hoverbg.gif)" : "/bbc/bbc_bg.gif)"); } // ]]>]]><![CDATA[</script>';
$found_button = false; // Here loop through the array, printing the images/rows/separators! foreach ($context['bbc_tags'][0] as $image => $tag) { // Is there a "before" part for this bbc button? If not, it can't be a button!! if (isset($tag['before'])) { // Is this tag disabled? if (!empty($context['disabled_tags'][$tag['code']])) continue; $found_button = true; // If there's no after, we're just replacing the entire selection in the post box. if (!isset($tag['after'])) echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.postmodify.message); return false;">'; // On the other hand, if there is one we are surrounding the selection ;). else echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.postmodify.message); return false;">'; // Okay... we have the link. Now for the image and the closing </a>! echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>'; } // I guess it's a divider... elseif ($found_button) { echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />'; $found_button = false; } } // if both color and bgcolor are disabledif (!isset($context['disabled_tags']['color']) || !isset($context['disabled_tags']['bgcolor'])) { echo '<script language="javascript" type="text/javascript">function bbc_highlight(something, mode) { something.style.backgroundImage = "url(" + smf_images_url + (mode ? "/bbc/bbc_hoverbg.gif)" : "/bbc/bbc_bg.gif)"); } '; // define the image dir echo 'var cbid = "', $settings['default_theme_url'],'/images/bbc/"; '; // define the settings for javascript purposes echo 'var usecolor = ', (!isset($context['disabled_tags']['color'])) ? 1 : 0 , '; '; echo 'var usebgcolor = ', (!isset($context['disabled_tags']['bgcolor'])) ? 1 : 0 , '; '; // use array to quickly write all the language strings since javascript can't read php language strings $lang = array( 'yourtexthere', 'insert', 'changetoinsertcolor', 'changetoinsertbgcolor', 'switchbetween', 'insertlastclicked', 'insertlasthovered' ); // WRITE EACH VAR WE MAY USE foreach($lang as $var) { echo 'var '.$var.' = "'.$txt[$var].'"; '; } // call colorbar.js which has the javascript in echo '</script> <script language="javascript" src="', $settings['default_theme_url'], '/color.js" type="text/javascript"></script>';} //ช่องพิมพ์ข้อความตอบด่วน ใช้ปุ่ม Tab จัดย่อหน้าได้ echo ' <textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeydown="insertTab(event,this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="1"></textarea>';}
// Now start printing all of the smileys.เพิ่มไว้ก่อน// if both color and bgcolor are disabledif (!isset($context['disabled_tags']['color']) || !isset($context['disabled_tags']['bgcolor'])) { echo '<tr> <td align="right"></td> <td valign="middle"> <script language="javascript" type="text/javascript">'; // define the image dir echo 'var cbid = "', $settings['default_theme_url'],'/images/bbc/";'; // define the settings for javascript purposes echo 'var usecolor = ', (!isset($context['disabled_tags']['color'])) ? 1 : 0 , '; '; echo 'var usebgcolor = ', (!isset($context['disabled_tags']['bgcolor'])) ? 1 : 0 , '; '; // use array to quickly write all the language strings since javascript can't read php language strings $lang = array( 'yourtexthere', 'insert', 'changetoinsertcolor', 'changetoinsertbgcolor', 'switchbetween', 'insertlastclicked', 'insertlasthovered' ); // WRITE EACH VAR WE MAY USE foreach($lang as $var) { echo 'var '.$var.' = "'.$txt[$var].'"; '; } // call colorbar.js which has the javascript in echo '</script> <script language="javascript" src="', $settings['default_theme_url'], '/color.js" type="text/javascript"></script> </td> </tr>';}
// Print a drop down list for all the colors we allow! if (!isset($context['disabled_tags']['color'])) echo ' <select onchange="surroundText(\'[color=\' + this.options[this.selectedIndex].value.toLowerCase() + \']\', \'[/color]\', document.forms.postmodify.message); this.selectedIndex = 0; document.forms.postmodify.message.focus(document.forms.postmodify.message.caretPos);" style="margin-bottom: 1ex;"> <option value="" selected="selected">', $txt['change_color'], '</option> <option value="Black">', $txt[262], '</option> <option value="Red">', $txt[263], '</option> <option value="Yellow">', $txt[264], '</option> <option value="Pink">', $txt[265], '</option> <option value="Green">', $txt[266], '</option> <option value="Orange">', $txt[267], '</option> <option value="Purple">', $txt[268], '</option> <option value="Blue">', $txt[269], '</option> <option value="Beige">', $txt[270], '</option> <option value="Brown">', $txt[271], '</option> <option value="Teal">', $txt[272], '</option> <option value="Navy">', $txt[273], '</option> <option value="Maroon">', $txt[274], '</option> <option value="LimeGreen">', $txt[275], '</option> </select>';
<textarea class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', $message, '</textarea>วางทับโค๊ดเดิม<textarea class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeydown="insertTab(event,this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', $message, '</textarea>
$txt['yourtexthere'] = 'ข้อความของคุณ';$txt['insert'] = 'แทรก';$txt['changetoinsertcolor'] = 'เปลี่ยนเป็นสีตัวอักษร';$txt['changetoinsertbgcolor'] = 'เปลี่ยนเป็นสีพื้นหลัง';$txt['switchbetween'] = 'เปลี่ยนสลับสีตัวอักษร/พื้นหลัง';$txt['insertlastclicked'] = 'ใส่สีที่เลือกล่าสุด';$txt['insertlasthovered'] = 'ใส่สีที่ชี้เมาท์ล่าสุด';
// COLORBAR.JS// VARIABLES NOT ALREADY SET IN PHPvar cpm = 26; // Colors Per Matrice// ALTERNATES BETWEEN THE ALT (HOVER TEXT)function alt_text(something) { if (usecolor == 1 && usebgcolor == 1) { var button = document.images['colorbtn']; if (button.src == cbid + "fontcolor.gif") { something.title = insert + " [color="+ something.bgColor + "]" + yourtexthere + "[/color]"; } else { something.title = insert + " [bgcolor="+ something.bgColor + "]" + yourtexthere + "[/bgcolor]"; } } else { if (usecolor==1) { something.title = insert + " [color="+ something.bgColor + "]" + yourtexthere + "[/color]"; } else { something.title = insert + " [bgcolor="+ something.bgColor + "]" + yourtexthere + "[/bgcolor]"; } }}// SWITCHES THE BUTTONSfunction color_switch(something) { if (something.src == cbid + "fontcolor.gif") { something.src = cbid + "bgcolor.gif"; something.alt = changetoinsertcolor; something.title = changetoinsertcolor; } else { something.src = cbid + "fontcolor.gif"; something.alt = changetoinsertbgcolor ; something.title = changetoinsertbgcolor ; }}// INSERTS THE COLOR/BGCOLOR TAGSfunction color(hexcolor) { if (usecolor == 1 && usebgcolor == 1) { var button = document.images['colorbtn']; if (button.src == cbid + "fontcolor.gif") { surroundText('[color='+ hexcolor + ']', '[/color]', document.forms.postmodify.message); } else { surroundText('[bgcolor='+ hexcolor + ']', '[/bgcolor]', document.forms.postmodify.message); } } else { if (usecolor==1) { surroundText('[color='+ hexcolor + ']', '[/color]', document.forms.postmodify.message); } else { surroundText('[bgcolor='+ hexcolor + ']', '[/bgcolor]', document.forms.postmodify.message); } }}// FUNCTIONS TO TURN DECIMALS TO HEXvar base_hexa = "0123456789ABCDEF";function dec2Hexa(number) { return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);}function RGB2Hexa(TR,TG,TB) { return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);}// THE COLOR MATRICEScol = new Array;col[0] = new Array(255,-1,255,-1,255,-1); // greyscale: white to blackcol[1] = new Array(0,1,0,0,0,0); // black to redcol[2] = new Array(255,0,0,1,0,0); //red fading to yellowcol[3] = new Array(255,-1,255,0,0,0); //yellow fading to green col[4] = new Array(0,0,255,0,0,1); //green fading to light blue col[5] = new Array(0,0,255,-1,255,0); //light blue fading to blue col[6] = new Array(0,1,0,0,255,0); //blue fading to purplecol[7] = new Array(255,0,0,1,255,0); //purple/violet/pink to white// CREATES ALL THE RGB COLORSfunction rgb(cpm){ for (j=0;j<8;j++){ for (i=0;i<cpm+1;i++) { r = Math.floor(col[j][0]+col[j][1]*i*(255)/cpm); g = Math.floor(col[j][2]+col[j][3]*i*(255)/cpm); b = Math.floor(col[j][4]+col[j][5]*i*(255)/cpm); codehex = r + '' + g + '' + b; document.write('<td bgColor="' + RGB2Hexa(r,g,b) + '" onClick="color(this.bgColor);' + 'document.getElementById(\'colorused\').bgColor = this.bgColor;" onmouseover="alt_text(this);' + 'document.getElementById(\'colorused1\').bgColor=this.bgColor;this.style.cursor=\'pointer\'" ' + 'style="height:18px;width:3px" class="colorcell"><!-- Space --></td>'); } }}// WRITES THE COLOR BAR TABLE/* outer table - overall container controlling width */document.write('<table cellspacing="0" width="450px" cellpadding="0" class="colorbar"><tr><td>')/* switch between color/bg */if (usebgcolor==1 && usecolor==1) { document.write('<td><a href="javascript:void(0);"><img name="colorbtn" onmouseover="bbc_highlight(this, true);" onclick="color_switch(this);document.forms.postmodify.message.focus;return false;" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="'+ cbid + 'fontcolor.gif" align="middle" width="23px" height="22px" alt="' + switchbetween + '" title="' + switchbetween + '" style="background-image: url(' + cbid + '/bbc_bg.gif); margin: 0px 2px 0px 0px;" /></a></td>')}/* hover + click boxes */document.write('<td id="colorused" onClick="color(this.bgColor);" bgColor="#FFFFFF" onMouseOver="this.style.cursor=\'pointer\'" style="border-color:#808080;border-width:1px;border-style:solid;width:12px;height:12px;" class="colorbox">')document.write('<img src="'+ cbid + 'blank.gif" style="width:18px;height:18px;" class="colorboxspacer" alt="' + insertlastclicked + '"/></td><td width="1px;" style="overflow:hidden;font-size:6px;"> </td>')document.write('<td id="colorused1" bgColor="#000000" onClick="color(this.bgColor);" onMouseOver="this.style.cursor=\'pointer\'" style="border-color:#808080;border-width:1px;border-style:solid;width:12px;height:12px;" class="colorbox">')document.write('<img src="'+ cbid + 'blank.gif" style="width:18px;height:18px;" class="colorboxspacer" alt="' + insertlasthovered + '" /></td><td width="1px" style="overflow:hidden;font-size:9px;"> </td>')/* colors in the bar */document.write('<!--' + rgb(cpm) + '// -->')document.write('</tr></table>')
/* Color Bar CSS Class */.colorbar { width:450px;}.colorcell { height:18px;}.colorbox { border-color:#808080; border-width:1px; border-style:solid; width:18px; height:18px; overflow:hidden;}.colorboxspacer { width:18px; height:18px;}
function insertTab(event,obj) { var tabKeyCode = 9; if (event.which) // mozilla var keycode = event.which; else // ie var keycode = event.keyCode; if (keycode == tabKeyCode) { if (event.type == "keydown") { if (obj.setSelectionRange) { // mozilla var s = obj.selectionStart; var e = obj.selectionEnd; obj.value = obj.value.substring(0, s) + "\t" + obj.value.substr(e); obj.setSelectionRange(s + 1, s + 1); obj.focus(); } else if (obj.createTextRange) { // ie document.selection.createRange().text="\t" obj.onblur = function() { this.focus(); this.onblur = null; }; } else { // unsupported browsers } } if (event.returnValue) // ie ? event.returnValue = false; if (event.preventDefault) // dom event.preventDefault(); return false; // should work in all browsers } return true;}
คลิ กที่นี่เพื่อดูโค้ด BBC_code.txt แล้วแทรกลงระหว่างนี้*แก้ไขลิงค์ BB_code.txt24 มีนาคม 2553, 18:14:47By: ulserll