Ignore:
Timestamp:
Mar 31, 2010, 6:32:40 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Aktualizace fóra.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/styles/prosilver/template/editor.js

    r400 r702  
    88var theSelection = false;
    99
     10var bbcodeEnabled = true;
    1011// Check for Browser & Platform for PC & IE specific bits
    1112// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
     
    1516var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
    1617var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
    17 
    1818var baseHeight;
    19 onload_functions.push('initInsertions()');
    2019
    2120/**
     
    252251        if (theSelection)
    253252        {
    254                 insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
     253                if (bbcodeEnabled)
     254                {
     255                        insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
     256                }
     257                else
     258                {
     259                        var lines = split_lines(theSelection);
     260                        for (i = 0; i < lines.length; i++)
     261                        {
     262                                insert_text('> ' + lines[i] + '\n')
     263                        }
     264                }
    255265        }
    256266
     
    258268}
    259269
     270function split_lines(text)
     271{
     272        var lines = text.split('\n');
     273        var splitLines = new Array();
     274        var j = 0;
     275        for(i = 0; i < lines.length; i++)
     276        {
     277                if (lines[i].length <= 80)
     278                {
     279                        splitLines[j] = lines[i];
     280                        j++;
     281                }
     282                else
     283                {
     284                        var line = lines[i];
     285                        do
     286                        {
     287                                var splitAt = line.indexOf(' ', 80);
     288                               
     289                                if (splitAt == -1)
     290                                {
     291                                        splitLines[j] = line;
     292                                        j++
     293                                }
     294                                else
     295                                {
     296                                        splitLines[j] = line.substring(0, splitAt);
     297                                        line = line.substring(splitAt);
     298                                        j++;
     299                                }
     300                        }
     301                        while(splitAt != -1)
     302                }
     303        }
     304        return splitLines;
     305}
    260306/**
    261307* From http://www.massless.org/mozedit/
     
    263309function mozWrap(txtarea, open, close)
    264310{
    265         var selLength = txtarea.textLength;
     311        var selLength = (typeof(txtarea.textLength) == 'undefined') ? txtarea.value.length : txtarea.textLength;
    266312        var selStart = txtarea.selectionStart;
    267313        var selEnd = txtarea.selectionEnd;
     
    278324
    279325        txtarea.value = s1 + open + s2 + close + s3;
    280         txtarea.selectionStart = selEnd + open.length + close.length;
    281         txtarea.selectionEnd = txtarea.selectionStart;
     326        txtarea.selectionStart = selStart + open.length;
     327        txtarea.selectionEnd = selEnd + open.length;
    282328        txtarea.focus();
    283329        txtarea.scrollTop = scrollTop;
Note: See TracChangeset for help on using the changeset viewer.