Raised This Month: $ Target: $400
 0% 

[HOT] Suggestion for Allied Modders Discussion Forum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 12-10-2012 , 13:03   [HOT] Suggestion for Allied Modders Discussion Forum
Reply With Quote #1

I suggest the next HTML embedded script to be added in each page which contains at least a reply box.
This will allow users to type TAB ('\t') into the box.

PHP Code:
function setSelectionRange(inputselectionStartselectionEnd) {
  if (
input.setSelectionRange) {
    
input.focus();
    
input.setSelectionRange(selectionStartselectionEnd);
  } else if (
input.createTextRange) {
    var 
range input.createTextRange();
    
range.collapse(true);
    
range.moveEnd('character'selectionEnd);
    
range.moveStart('character'selectionStart);
    
range.select();
  }
}

function 
replaceSelection (inputreplaceString) {
  if (
input.setSelectionRange) {
    var 
selectionStart input.selectionStart;
    var 
selectionEnd input.selectionEnd;
    
input.value input.value.substring(0selectionStart)+ replaceString input.value.substring(selectionEnd);
    if (
selectionStart != selectionEnd){
      
setSelectionRange(inputselectionStartselectionStart replaceString.length);
    }else{
      
setSelectionRange(inputselectionStart replaceString.lengthselectionStart replaceString.length);
    }
  } else if (
document.selection) {
    var 
range document.selection.createRange();
    if (
range.parentElement() == input) {
      var 
isCollapsed range.text == '';
      
range.text replaceString;
      if (!
isCollapsed)  {
        
range.moveStart('character', -replaceString.length);
        
range.select();
      }
    }
  }
}

function 
catchTab(item,e){
  if(
navigator.userAgent.match("Gecko")){
    
c=e.which;
  }else{
    
c=e.keyCode;
  }
  if(
c==9){
    
replaceSelection(item,String.fromCharCode(9));
    
setTimeout("document.getElementById('"+item.id+"').focus();",0);
    return 
false;
  }

Implementation in textarea is made like

PHP Code:
<textarea rows=4 cols=65 name=msg form=headform onkeydown="return catchTab(this,event)"></textarea
When displaying thread, if it won't show TABs, it's recommended to replace ( '\t' ) with a few & nbsp ; spacers.

PHP Code:
$Message_To_Show preg_replace"/\t/""&nbsp;&nbsp;&nbsp;&nbsp;"$Row'message' ] ); 
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode