aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver/template/editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/styles/prosilver/template/editor.js')
-rw-r--r--phpBB/styles/prosilver/template/editor.js51
1 files changed, 49 insertions, 2 deletions
diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js
index 9610cf91d1..639b87e3ee 100644
--- a/phpBB/styles/prosilver/template/editor.js
+++ b/phpBB/styles/prosilver/template/editor.js
@@ -7,6 +7,7 @@
var imageTag = false;
var theSelection = false;
+var bbcodeEnabled = true;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
@@ -14,7 +15,6 @@ var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
-
var baseHeight;
/**
@@ -250,12 +250,59 @@ function addquote(post_id, username)
if (theSelection)
{
- insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
+ if (bbcodeEnabled)
+ {
+ insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
+ }
+ else
+ {
+ var lines = split_lines(theSelection);
+ for (i = 0; i < lines.length; i++)
+ {
+ insert_text('> ' + lines[i] + '\n')
+ }
+ }
}
return;
}
+function split_lines(text)
+{
+ var lines = text.split('\n');
+ var splitLines = new Array();
+ var j = 0;
+ for(i = 0; i < lines.length; i++)
+ {
+ if (lines[i].length <= 80)
+ {
+ splitLines[j] = lines[i];
+ j++;
+ }
+ else
+ {
+ var line = lines[i];
+ do
+ {
+ var splitAt = line.indexOf(' ', 80);
+
+ if (splitAt == -1)
+ {
+ splitLines[j] = line;
+ j++
+ }
+ else
+ {
+ splitLines[j] = line.substring(0, splitAt);
+ line = line.substring(splitAt);
+ j++;
+ }
+ }
+ while(splitAt != -1)
+ }
+ }
+ return splitLines;
+}
/**
* From http://www.massless.org/mozedit/
*/