Fixed issue with quote detection in Opera 12.17
authorAlexander Ebert <ebert@woltlab.com>
Fri, 28 Nov 2014 00:23:54 +0000 (01:23 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 28 Nov 2014 00:23:54 +0000 (01:23 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 2528d3855dd105bc3859bfbfdfeb116b1315d5cf..422306dd6df2fd5f4b56717db63b68db8d890970 100644 (file)
@@ -193,6 +193,9 @@ RedactorPlugins.wbbcode = function() {
                convertFromHtml: function(html) {
                        WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'beforeConvertFromHtml', { html: html });
                        
+                       $('<pre />').text(html).appendTo(document.body);
+                       
+                       console.debug(html);
                        // remove data-redactor-tag="" attribute
                        html = html.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g, '$1');
                        
@@ -281,17 +284,24 @@ RedactorPlugins.wbbcode = function() {
                        html = html.replace(/&nbsp;/gi, " ");
                        
                        // [quote]
-                       html = html.replace(/<blockquote class="quoteBox" cite="([^"]+)?" data-author="([^"]+)?"[^>]*?>\n?<div[^>]+>\n?<header[^>]*?>[\s\S]*?<\/header>/gi, function(match, link, author, innerContent) {
+                       html = html.replace(/<blockquote([^>]+)>\n?<div[^>]+>\n?<header[^>]*?>[\s\S]*?<\/header>/gi, function(match, attributes, innerContent) {
                                var $quote;
+                               var $author = '';
+                               var $link = '';
                                
-                               if (author) author = WCF.String.unescapeHTML(author);
-                               if (link) link = WCF.String.unescapeHTML(link);
+                               if (attributes.match(/data-author="([^"]+)"/)) {
+                                       $author = WCF.String.unescapeHTML(RegExp.$1);
+                               }
                                
-                               if (link) {
-                                       $quote = "[quote='" + author + "','" + link + "']";
+                               if (attributes.match(/cite="([^"]+)"/)) {
+                                       $link = WCF.String.unescapeHTML(RegExp.$1);
+                               }
+                               
+                               if ($link) {
+                                       $quote = "[quote='" + $author + "','" + $link + "']";
                                }
                                else if (author) {
-                                       $quote = "[quote='" + author + "']";
+                                       $quote = "[quote='" + $author + "']";
                                }
                                else {
                                        $quote = "[quote]";