aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/subsilver2/template/editor.js
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-05-16 19:52:36 +0200
committerNils Adermann <naderman@naderman.de>2010-05-16 19:52:36 +0200
commit591217a903460a81df4c19850f5d99c2e9d10b1d (patch)
treef6c8c854cc8fca4b797f28d265c6164982f53d81 /phpBB/styles/subsilver2/template/editor.js
parentcf8995210625b31988dd9ae98435bf183ee799e3 (diff)
parent0bf2c3eed551e57667e1fb14d0d80e347af6fc72 (diff)
downloadforums-591217a903460a81df4c19850f5d99c2e9d10b1d.tar
forums-591217a903460a81df4c19850f5d99c2e9d10b1d.tar.gz
forums-591217a903460a81df4c19850f5d99c2e9d10b1d.tar.bz2
forums-591217a903460a81df4c19850f5d99c2e9d10b1d.tar.xz
forums-591217a903460a81df4c19850f5d99c2e9d10b1d.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: (21 commits) [feature/notify_status] Define'd constants for notify_status [ticket/7782] Send 404 HTTP code when a nonexistent user/forum/topic is requested. [ticket/9530] The prosilver problem in #9531 exists in subsilver2 editor.js [ticket/9530] Subsilver2 is missing BBCode-less quotes fallback-option when bbcodes are disabled. [ticket/9531] BBCode-less quotes fallback-option is missing "Author wrote:" line when quoting from topic-review. [ticket/9547] Use separate constants for display/enable active topics. [ticket/9535] Also fix the margin in the install_update.html [ticket/9535] Fix some more rtl margin issues. [ticket/9535] Correctly set margin of textarea in ACP > Users signature for RTL languages. [ticket/9524] IPv6 regex does not match all valid IPv6 addresses starting with :: [ticket/9510] Unable to copy permissions from and to forums you cannot see [ticket/9510] Unable to copy permissions from and to forums you cannot see [ticket/9545] Initial forum should display active topics by default. [ticket/9546] Also delete bookmarks, when a topic is deleted. [ticket/9529] Topic review is not showing all selected posts. [ticket/9528] Also fall back to bbcode-less quotes for PMs, when bbcodes are disabled. [ticket/9146] Fix double occurring tabindex="6" in prosilver's QR [ticket/9119] Respect language selection on automated update. [ticket/8894] Fix JavaScript-Error and hide Quote-Button on topic review if BBCodes are not allowed. [ticket/9567] Newly registered users group description rewording. ...
Diffstat (limited to 'phpBB/styles/subsilver2/template/editor.js')
-rw-r--r--phpBB/styles/subsilver2/template/editor.js55
1 files changed, 53 insertions, 2 deletions
diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js
index 2d157caada..54bd3450d0 100644
--- a/phpBB/styles/subsilver2/template/editor.js
+++ b/phpBB/styles/subsilver2/template/editor.js
@@ -6,6 +6,7 @@
// Startup variables
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
@@ -195,7 +196,7 @@ function attach_inline(index, filename)
/**
* Add quote text to message
*/
-function addquote(post_id, username)
+function addquote(post_id, username, l_wrote)
{
var message_name = 'message_' + post_id;
var theSelection = '';
@@ -250,12 +251,62 @@ function addquote(post_id, username)
if (theSelection)
{
- insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
+ if (bbcodeEnabled)
+ {
+ insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
+ }
+ else
+ {
+ insert_text(username + ' ' + l_wrote + ':' + '\n');
+ 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/
*/