*/
WCF.Label = {};
-/**
- * Provides enhancements for ACP label management.
- */
-WCF.Label.ACPList = Class.extend({
- /**
- * input element
- * @var jQuery
- */
- _labelInput: null,
-
+if (COMPILER_TARGET_DEFAULT) {
/**
- * list of pre-defined label items
- * @var array<jQuery>
+ * Provides enhancements for ACP label management.
*/
- _labelList: [ ],
-
- /**
- * Initializes the ACP label list.
- */
- init: function() {
- this._labelInput = $('#label').keydown($.proxy(this._keyPressed, this)).keyup($.proxy(this._keyPressed, this)).blur($.proxy(this._keyPressed, this));
+ WCF.Label.ACPList = Class.extend({
+ /**
+ * input element
+ * @var jQuery
+ */
+ _labelInput: null,
- if ($.browser.mozilla && $.browser.touch) {
- this._labelInput.on('input', $.proxy(this._keyPressed, this));
- }
+ /**
+ * list of pre-defined label items
+ * @var array<jQuery>
+ */
+ _labelList: [],
- $('#labelList').find('input[type="radio"]').each($.proxy(function(index, input) {
- var $input = $(input);
+ /**
+ * Initializes the ACP label list.
+ */
+ init: function () {
+ this._labelInput = $('#label').keydown($.proxy(this._keyPressed, this)).keyup($.proxy(this._keyPressed, this)).blur($.proxy(this._keyPressed, this));
- // ignore custom values
- if ($input.prop('value') !== 'custom') {
- this._labelList.push($($input.next('span')));
+ if ($.browser.mozilla && $.browser.touch) {
+ this._labelInput.on('input', $.proxy(this._keyPressed, this));
}
- }, this));
-
- if (this._labelInput[0].value.length > 0) {
- this._keyPressed();
- }
- },
-
- /**
- * Renders label name as label or falls back to a default value if label is empty.
- */
- _keyPressed: function() {
- var $text = this._labelInput.prop('value');
- if ($text === '') $text = WCF.Language.get('wcf.acp.label.defaultValue');
+
+ $('#labelList').find('input[type="radio"]').each($.proxy(function (index, input) {
+ var $input = $(input);
+
+ // ignore custom values
+ if ($input.prop('value') !== 'custom') {
+ this._labelList.push($($input.next('span')));
+ }
+ }, this));
++
++ if (this._labelInput[0].value.length > 0) {
++ this._keyPressed();
++ }
+ },
- for (var $i = 0, $length = this._labelList.length; $i < $length; $i++) {
- this._labelList[$i].text($text);
+ /**
+ * Renders label name as label or falls back to a default value if label is empty.
+ */
+ _keyPressed: function () {
+ var $text = this._labelInput.prop('value');
+ if ($text === '') $text = WCF.Language.get('wcf.acp.label.defaultValue');
+
+ for (var $i = 0, $length = this._labelList.length; $i < $length; $i++) {
+ this._labelList[$i].text($text);
+ }
}
- }
-});
-
-/**
- * Provides simple logic to inherit associations within structured lists.
- */
-WCF.Label.ACPList.Connect = Class.extend({
- /**
- * Initializes inheritation for structured lists.
- */
- init: function() {
- var $listItems = $('#connect .structuredList li');
- if (!$listItems.length) return;
-
- $listItems.each($.proxy(function(index, item) {
- $(item).find('input[type="checkbox"]').click($.proxy(this._click, this));
- }, this));
- },
+ });
/**
- * Marks items as checked if they're logically below current item.
- *
- * @param object event
+ * Provides simple logic to inherit associations within structured lists.
*/
- _click: function(event) {
- var $listItem = $(event.currentTarget);
- if ($listItem.is(':checked')) {
- $listItem = $listItem.parents('li');
- var $depth = $listItem.data('depth');
+ WCF.Label.ACPList.Connect = Class.extend({
+ /**
+ * Initializes inheritation for structured lists.
+ */
+ init: function () {
+ var $listItems = $('#connect .structuredList li');
+ if (!$listItems.length) return;
- while (true) {
- $listItem = $listItem.next();
- if (!$listItem.length) {
- // no more siblings
- return true;
- }
+ $listItems.each($.proxy(function (index, item) {
+ $(item).find('input[type="checkbox"]').click($.proxy(this._click, this));
+ }, this));
+ },
+
+ /**
+ * Marks items as checked if they're logically below current item.
+ *
+ * @param object event
+ */
+ _click: function (event) {
+ var $listItem = $(event.currentTarget);
+ if ($listItem.is(':checked')) {
+ $listItem = $listItem.parents('li');
+ var $depth = $listItem.data('depth');
- // element is on the same or higher level (= lower depth)
- if ($listItem.data('depth') <= $depth) {
- return true;
+ while (true) {
+ $listItem = $listItem.next();
+ if (!$listItem.length) {
+ // no more siblings
+ return true;
+ }
+
+ // element is on the same or higher level (= lower depth)
+ if ($listItem.data('depth') <= $depth) {
+ return true;
+ }
+
+ $listItem.find('input[type="checkbox"]').prop('checked', 'checked');
}
-
- $listItem.find('input[type="checkbox"]').prop('checked', 'checked');
}
}
- }
-});
+ });
+}
+else {
+ WCF.Label.ACPList = Class.extend({
+ _labelInput: {},
+ _labelList: {},
+ init: function() {},
+ _keyPressed: function() {}
+ });
+
+ WCF.Label.ACPList.Connect = Class.extend({
+ init: function() {},
+ _click: function() {}
+ });
+}
/**
* Provides a flexible label chooser.