Added ability to double click on WCF.InlineEditor instances
authorAlexander Ebert <ebert@woltlab.com>
Tue, 25 Jun 2013 18:40:28 +0000 (20:40 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 25 Jun 2013 18:40:28 +0000 (20:40 +0200)
wcfsetup/install/files/js/WCF.js

index b5862ab4400c64c30fe062293282362d1911e8ce..6bc0e08ede3c768076be23119ca5ae4b25923c83 100755 (executable)
@@ -6193,6 +6193,15 @@ WCF.InlineEditor = Class.extend({
                        return;
                }
                
+               this._setOptions();
+               var $quickOption = '';
+               for (var $i = 0, $length = this._options.length; $i < $length; $i++) {
+                       if (this._options[$i].isQuickOption) {
+                               $quickOption = this._options[$i].optionName;
+                               break;
+                       }
+               }
+               
                var self = this;
                $elements.each(function(index, element) {
                        var $element = $(element);
@@ -6205,6 +6214,10 @@ WCF.InlineEditor = Class.extend({
                        }
                        
                        $trigger.click($.proxy(self._show, self)).data('elementID', $elementID);
+                       if ($quickOption) {
+                               // simulate click on target action
+                               $trigger.disableSelection().data('optionName', $quickOption).dblclick($.proxy(self._click, self));
+                       }
                        
                        // store reference
                        self._elements[$elementID] = $element;
@@ -6214,8 +6227,6 @@ WCF.InlineEditor = Class.extend({
                        success: $.proxy(this._success, this)
                });
                
-               this._setOptions();
-               
                WCF.CloseOverlayHandler.addCallback('WCF.InlineEditor', $.proxy(this._closeAll, this));
                
                this._notification = new WCF.System.Notification(WCF.Language.get('wcf.global.success'), 'success');