* Clipboard API Handler.
*
* @author Alexander Ebert
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLab/WCF/Controller/Clipboard
*/
/**
* Initializes the clipboard API handler.
*
- * @param {object<string, *>} options initialization options
+ * @param {Object} options initialization options
*/
setup: function(options) {
if (!options.pageClassName) {
/**
* Saves the state for given item object ids.
*
- * @param {string} type object type
- * @param {array<int>} objectIds item object ids
- * @param {boolean} isMarked true if marked
+ * @param {string} type object type
+ * @param {int[]} objectIds item object ids
+ * @param {boolean} isMarked true if marked
*/
_saveState: function(type, objectIds, isMarked) {
Ajax.api(this, {
});
};
+ //noinspection JSUnresolvedVariable
var confirmMessage = (typeof data.internalData.confirmMessage === 'string') ? data.internalData.confirmMessage : '';
var fireEvent = true;
if (typeof data.parameters === 'object' && data.parameters.actionName && data.parameters.className) {
if (data.parameters.actionName === 'unmarkAll' || Array.isArray(data.parameters.objectIDs)) {
if (confirmMessage.length) {
+ //noinspection JSUnresolvedVariable
var template = (typeof data.internalData.template === 'string') ? data.internalData.template : '';
UiConfirmation.show({
}
}
+ //noinspection JSUnresolvedFunction
this._executeProxyAction(listItem, data, formData);
}).bind(this),
message: confirmMessage,
/**
* Forwards clipboard actions to an individual handler.
*
- * @param {Element} listItem dropdown item element
- * @param {object<string, *>} data action data
- * @param {object<string, *>=} formData form data
+ * @param {Element} listItem dropdown item element
+ * @param {Object} data action data
+ * @param {Object?} formData form data
*/
_executeProxyAction: function(listItem, data, formData) {
formData = formData || {};
var objectIds = (data.parameters.actionName !== 'unmarkAll') ? data.parameters.objectIDs : [];
var parameters = { data: formData };
+ //noinspection JSUnresolvedVariable
if (typeof data.internalData.parameters === 'object') {
+ //noinspection JSUnresolvedVariable
for (var key in data.internalData.parameters) {
- if (objOwns(data.internalData.parameters, key)) {
+ //noinspection JSUnresolvedVariable
+ if (data.internalData.parameters.hasOwnProperty(key)) {
+ //noinspection JSUnresolvedVariable
parameters[key] = data.internalData.parameters[key];
}
}
_ajaxSuccess: function(data) {
if (data.actionName === 'unmarkAll') {
_containers.forEach((function(containerData) {
+ //noinspection JSUnresolvedVariable
if (elData(containerData.element, 'type') === data.returnValues.objectType) {
var clipboardObjects = elByClass('jsMarked', containerData.element);
while (clipboardObjects.length) {
containerData.checkboxes[i].checked = false;
}
+ //noinspection JSUnresolvedVariable
UiPageAction.remove('wcfClipboard-' + data.returnValues.objectType);
}
}).bind(this));
_containers.forEach((function(containerData) {
var typeName = elData(containerData.element, 'type');
- var objectIds = (data.returnValues.markedItems && objOwns(data.returnValues.markedItems, typeName)) ? data.returnValues.markedItems[typeName] : [];
+ //noinspection JSUnresolvedVariable
+ var objectIds = (data.returnValues.markedItems && data.returnValues.markedItems.hasOwnProperty(typeName)) ? data.returnValues.markedItems[typeName] : [];
this._rebuildMarkings(containerData, objectIds);
}).bind(this));
var keepEditors = [], typeName;
+ //noinspection JSUnresolvedVariable
if (data.returnValues && data.returnValues.items) {
+ //noinspection JSUnresolvedVariable
for (typeName in data.returnValues.items) {
- if (objOwns(data.returnValues.items, typeName)) {
+ //noinspection JSUnresolvedVariable
+ if (data.returnValues.items.hasOwnProperty(typeName)) {
keepEditors.push(typeName);
}
}
});
// no items
+ //noinspection JSUnresolvedVariable
if (!data.returnValues || !data.returnValues.items) {
return;
}
// rebuild editors
var created, dropdown, editor, typeData;
var divider, item, itemData, itemIndex, label, unmarkAll;
+ //noinspection JSUnresolvedVariable
for (typeName in data.returnValues.items) {
- if (!objOwns(data.returnValues.items, typeName)) {
+ //noinspection JSUnresolvedVariable
+ if (!data.returnValues.items.hasOwnProperty(typeName)) {
continue;
}
+ //noinspection JSUnresolvedVariable
typeData = data.returnValues.items[typeName];
created = false;
// create editor items
for (itemIndex in typeData.items) {
- if (!objOwns(typeData.items, itemIndex)) continue;
+ if (!typeData.items.hasOwnProperty(itemIndex)) {
+ continue;
+ }
itemData = typeData.items[itemIndex];
/**
* Rebuilds the mark state for each item.
*
- * @param {object<string, *>} data container data
- * @param {array<int>} objectIds item object ids
+ * @param {Object} data container data
+ * @param {int[]} objectIds item object ids
*/
_rebuildMarkings: function(data, objectIds) {
var markAll = true;
},
/**
- * Shows the clipboard editor for the given object type.
- *
- * @param {string} objectType
+ * Shows the clipboard editor.
*/
- showEditor: function(objectType) {
+ showEditor: function() {
this._loadMarkedItems();
if (document.documentElement.classList.contains('pageOverlayActive')) {