.data() now supports upper-case 'ID' suffix
authorAlexander Ebert <ebert@woltlab.com>
Mon, 14 Nov 2011 15:51:44 +0000 (16:51 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 14 Nov 2011 15:51:44 +0000 (16:51 +0100)
wcfsetup/install/files/js/WCF.js

index aa963eec6c8e32891f88f6b65d7dffc14472bbd2..69f659d83300d2025fdf714cdf6d1092c40aa314 100644 (file)
@@ -6,6 +6,26 @@
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  */
 
+(function() {
+       // store original implementation
+       var $jQueryData = jQuery.fn.data;
+
+       /**
+        * Override jQuery.fn.data() to support custom 'ID' suffix which will
+        * be translated to '-id' at runtime.
+        * 
+        * @see jQuery.fn.data()
+        */
+       jQuery.fn.data = function(key, value) {
+               if (key.indexOf('ID') > 0) {
+                       arguments[0] = key.replace('ID', '-id');
+               }
+
+               // call jQuery's own data method
+               return $jQueryData.apply(this, arguments);
+       }
+})();
+
  /* Simple JavaScript Inheritance
  * By John Resig http://ejohn.org/
  * MIT Licensed.
@@ -3007,7 +3027,7 @@ $.widget('ui.wcfSidebar', {
         */
        _create: function() {
                this.element.wrap('<div class="collapsibleSidebar"></div>');
-               this._container = this.element.parents('aside:eq(0)');
+               this._container = this.element.parent('div');
                
                // create toggle button
                this._button = $('<span class="collapsibleSidebarButton" title="' + WCF.Language.get('wcf.global.button.collapsible') + '"></span>').appendTo(this._container);