View Single Post
  #41  
Old 04-15-2010, 05:53 AM
Oyabun Oyabun is offline
 
Join Date: Dec 2006
Location: Germany
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default



I don't know if the code is pretty good but I changed my nlp_usertextformatting template to this and wanted to share it with you guys:


PHP Code:
<script type="text/javascript" language="javascript">
<!--
var 
prefix 'sel_nlp_usertextformatting_';
function 
nlp_usertextformatting(req) {
    switch(
req) {
        case 
'color':
            
fetch_object(prefix 'fontcolor').style.backgroundColor fetch_object(prefix 'fontcolor').value;
            
nlp_usertextformatting('set');
        break;
        case 
'set':
            
fetch_object(prefix 'preveiw').style.color = (fetch_object(prefix 'fontcolor').value != -1) ? fetch_object(prefix 'fontcolor').value '';
            
fetch_object(prefix 'preveiw_size').setAttribute("size", (fetch_object(prefix 'fontsize').value != -1) ? fetch_object(prefix 'fontsize').value '');        
            
fetch_object(prefix 'preveiw').style.fontFamily = (fetch_object(prefix 'fonttype').value != -1) ? fetch_object(prefix 'fonttype').value '';
            
fetch_object(prefix 'preveiw').style.fontStyle fetch_object(prefix 'italic').checked 'italic' 'normal';
            <
vb:if condition="is_browser('ie')">document.all.sel_nlp_usertextformatting_preveiw.style.fontWeight<vb:else />fetch_object(prefix 'preveiw').style.fontWeight</vb:if> = fetch_object(prefix 'fontweight').checked 'bold' 'normal';
        break;
        case 
'reset':
            
fetch_object(prefix 'fontcolor').value fetch_object(prefix 'fonttype').value fetch_object(prefix 'fontsize').value '-1';
            
fetch_object(prefix 'fontweight').checked false;
            
fetch_object(prefix 'preveiw_size').removeAttribute('size');
            
fetch_object(prefix 'preveiw').style.color fetch_object(prefix 'preveiw').style.fontFamily fetch_object(prefix 'preveiw').style.fontWeight fetch_object(prefix 'fontcolor').style.backgroundColor fetch_object(prefix 'preveiw').style.fontStyle '';
    }
}
//-->
</script>
<
fieldset class="blockrow">
    <
legend>{vb:rawphrase nlp_usertextformatting_title}</legend>
    <
class="description">{vb:rawphrase nlp_usertextformatting_description}</p>
    <
table width="100%">
      <
tr>
        <
td width="50%"><label for="sel_nlp_usertextformatting_fonttype">{vb:rawphrase nlp_usertextformatting_fonttype}</label></td>
        <
td width="50%"><select onchange="nlp_usertextformatting('set');" name="nlp_usertextformatting_fonttype" id="sel_nlp_usertextformatting_fonttype">
        <
option value="-1">{vb:rawphrase use_forum_default}</option>
        {
vb:raw UserTF.Fonts}
    </
select></td>
      </
tr>
    </
table>
    <
br>
    <
table width="100%">
      <
tr>
        <
td width="50%"><label for="sel_nlp_usertextformatting_fontsize">
{
vb:rawphrase nlp_usertextformatting_fontsize}</label></td>
        <
td width="50%"><select onchange="nlp_usertextformatting('set');" name="nlp_usertextformatting_fontsize" id="sel_nlp_usertextformatting_fontsize">
        <
option value="-1">{vb:rawphrase use_forum_default}</option>
        {
vb:raw UserTF.Size}
    </
select></td>
      </
tr>
    </
table>
    <
br>
    <
table width="100%">
      <
tr>
        <
td width="50%"><label for="sel_nlp_usertextformatting_fontcolor">{vb:rawphrase nlp_usertextformatting_fontcolor}</label></td>
        <
td width="50%"><select 
          
<vb:if condition="$GLOBALS['vbulletin']->usertextformatting['font'] != -1">style="background-color: {vb:raw usertextformatting.color};"</vb:if> onchange="nlp_usertextformatting('color');" name="nlp_usertextformatting_fontcolor" id="sel_nlp_usertextformatting_fontcolor">
        <
option value="-1" style="background-color: white;">{vb:rawphrase use_forum_default}</option>
         {
vb:raw UserTF.Colors}
    </
select></td>
      </
tr>
    </
table>
    
    <
br>
    <
table width="100%">
      <
tr>
        <
td width="49%"><label for="sel_nlp_usertextformatting_fontweight">
          <
input onChange="nlp_usertextformatting('set');" onClick="nlp_usertextformatting('set');" type="checkbox" name="nlp_usertextformatting_fontweight" value="1" id="sel_nlp_usertextformatting_fontweight" {vb:raw usertf.weight} />
        {
vb:rawphrase nlp_usertextformatting_fontweight} </label>
          <
br>
    <
label for="sel_nlp_usertextformatting_italic" style="font-style: italic">
    <
input onChange="nlp_usertextformatting('set');" onClick="nlp_usertextformatting('set');" type="checkbox" name="nlp_usertextformatting_italic" value="1" id="sel_nlp_usertextformatting_italic" {vb:raw usertf.italic} />
    {
vb:rawphrase nlp_usertextformatting_italic} </label></td>
        <
td width="51%"><class="description">&nbsp;</p>
    <!-- 
start -->

    <
class="description" align="center" id="sel_nlp_usertextformatting_preveiw" style="<vb:if condition="$GLOBALS['vbulletin']->usertextformatting['font'] != -1">font-family: {vb:raw usertextformatting.font};</vb:if><vb:if condition="$GLOBALS['vbulletin']->usertextformatting['color'] != -1">color: {vb:raw usertextformatting.color};</vb:if><vb:if condition="$GLOBALS['vbulletin']->usertextformatting['weight'] == 'bold'">font-weight: bold<vb:else />font-weight: normal</vb:if>">
        <
font id="sel_nlp_usertextformatting_preveiw_size" <vb:if condition="$GLOBALS['vbulletin']->usertextformatting['size'] != -1">size="{vb:raw usertextformatting.size}"</vb:if>>{vb:rawphrase nlp_usertextformatting_preveiw}</font>    </p></td>
      </
tr>
    </
table>
    
    
    
    
    
    <
br><br>

<
div align="left">
  <
input type="button" class="button" onclick="javascript:nlp_usertextformatting('reset');" value="{vb:rawphrase nlp_usertextformatting_reset}" />
      </
div>
</
fieldset
Attached Images
File Type: jpg clean.jpg (45.8 KB, 0 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01181 seconds
  • Memory Usage 1,916KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete