diff --git a/.svn/entries b/.svn/entries deleted file mode 100644 index 48082f72f087ce7e6fa75b9c41d7387daecd447b..0000000000000000000000000000000000000000 --- a/.svn/entries +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/.svn/format b/.svn/format deleted file mode 100644 index 48082f72f087ce7e6fa75b9c41d7387daecd447b..0000000000000000000000000000000000000000 --- a/.svn/format +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/.svn/pristine/00/009e30cb888529424ff3085d11785d71b244b472.svn-base b/.svn/pristine/00/009e30cb888529424ff3085d11785d71b244b472.svn-base deleted file mode 100644 index 19978087c0f7c45f6349493ee9b3e4b3b9866163..0000000000000000000000000000000000000000 --- a/.svn/pristine/00/009e30cb888529424ff3085d11785d71b244b472.svn-base +++ /dev/null @@ -1,236 +0,0 @@ - false, - 'filecount' => 1, - 'delete-enabled' => true, - 'delete-force-confirm' => true, - 'retry-enable-auto' => true, - 'retry-max-auto-attempts' => 1, - 'retry-auto-attempt-delay' => 2, - 'auto-upload' => false, - ); - - $options = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array(); - - $this->field['options'] = wp_parse_args( $options, $defaults ); - - } - - public function output() { - - echo $this->element_before(); - - ?> - - - field['options']['maxsize'] ) && Exopite_Simple_Options_Framework_Upload::file_upload_max_size() >= $this->field['options']['maxsize'] ) { - $maxsize = $this->field['options']['maxsize']; - } - - $allowed_mime_types = ( gettype( Exopite_Simple_Options_Framework_Upload::allowed_mime_types() ) == 'array' ) ? implode( ',', Exopite_Simple_Options_Framework_Upload::allowed_mime_types() ) : Exopite_Simple_Options_Framework_Upload::allowed_mime_types(); - - if ( isset( $this->field['options']['allowed'] ) && is_array( $this->field['options']['allowed'] ) ) { - $allowed_mime_types_array = explode( ',', $allowed_mime_types ); - $allowed_mime_types_array = array_intersect( $allowed_mime_types_array, $this->field['options']['allowed'] ); - $allowed_mime_types = implode( ',', $allowed_mime_types_array ); - } - - - ?> -
1 && !options.allowMultipleItems) { - options.callbacks.processingDroppedFilesComplete([]); - options.callbacks.dropError("tooManyFilesError", ""); - uploadDropZone.dropDisabled(false); - handleDataTransferPromise.failure(); - } else { - droppedFiles = []; - if (qq.isFolderDropSupported(dataTransfer)) { - qq.each(dataTransfer.items, function(idx, item) { - var entry = item.webkitGetAsEntry(); - if (entry) { - if (entry.isFile) { - droppedFiles.push(item.getAsFile()); - } else { - pendingFolderPromises.push(traverseFileTree(entry).done(function() { - pendingFolderPromises.pop(); - if (pendingFolderPromises.length === 0) { - handleDataTransferPromise.success(); - } - })); - } - } - }); - } else { - droppedFiles = dataTransfer.files; - } - if (pendingFolderPromises.length === 0) { - handleDataTransferPromise.success(); - } - } - return handleDataTransferPromise; - } - function setupDropzone(dropArea) { - var dropZone = new qq.UploadDropZone({ - HIDE_ZONES_EVENT_NAME: HIDE_ZONES_EVENT_NAME, - element: dropArea, - onEnter: function(e) { - qq(dropArea).addClass(options.classes.dropActive); - e.stopPropagation(); - }, - onLeaveNotDescendants: function(e) { - qq(dropArea).removeClass(options.classes.dropActive); - }, - onDrop: function(e) { - handleDataTransfer(e.dataTransfer, dropZone).then(function() { - uploadDroppedFiles(droppedFiles, dropZone); - }, function() { - options.callbacks.dropLog("Drop event DataTransfer parsing failed. No files will be uploaded.", "error"); - }); - } - }); - disposeSupport.addDisposer(function() { - dropZone.dispose(); - }); - qq(dropArea).hasAttribute(HIDE_BEFORE_ENTER_ATTR) && qq(dropArea).hide(); - uploadDropZones.push(dropZone); - return dropZone; - } - function isFileDrag(dragEvent) { - var fileDrag; - qq.each(dragEvent.dataTransfer.types, function(key, val) { - if (val === "Files") { - fileDrag = true; - return false; - } - }); - return fileDrag; - } - function leavingDocumentOut(e) { - if (qq.safari()) { - return e.x < 0 || e.y < 0; - } - return e.x === 0 && e.y === 0; - } - function setupDragDrop() { - var dropZones = options.dropZoneElements, maybeHideDropZones = function() { - setTimeout(function() { - qq.each(dropZones, function(idx, dropZone) { - qq(dropZone).hasAttribute(HIDE_BEFORE_ENTER_ATTR) && qq(dropZone).hide(); - qq(dropZone).removeClass(options.classes.dropActive); - }); - }, 10); - }; - qq.each(dropZones, function(idx, dropZone) { - var uploadDropZone = setupDropzone(dropZone); - if (dropZones.length && qq.supportedFeatures.fileDrop) { - disposeSupport.attach(document, "dragenter", function(e) { - if (!uploadDropZone.dropDisabled() && isFileDrag(e)) { - qq.each(dropZones, function(idx, dropZone) { - if (dropZone instanceof HTMLElement && qq(dropZone).hasAttribute(HIDE_BEFORE_ENTER_ATTR)) { - qq(dropZone).css({ - display: "block" - }); - } - }); - } - }); - } - }); - disposeSupport.attach(document, "dragleave", function(e) { - if (leavingDocumentOut(e)) { - maybeHideDropZones(); - } - }); - disposeSupport.attach(qq(document).children()[0], "mouseenter", function(e) { - maybeHideDropZones(); - }); - disposeSupport.attach(document, "drop", function(e) { - if (isFileDrag(e)) { - e.preventDefault(); - maybeHideDropZones(); - } - }); - disposeSupport.attach(document, HIDE_ZONES_EVENT_NAME, maybeHideDropZones); - } - setupDragDrop(); - qq.extend(this, { - setupExtraDropzone: function(element) { - options.dropZoneElements.push(element); - setupDropzone(element); - }, - removeDropzone: function(element) { - var i, dzs = options.dropZoneElements; - for (i in dzs) { - if (dzs[i] === element) { - return dzs.splice(i, 1); - } - } - }, - dispose: function() { - disposeSupport.dispose(); - qq.each(uploadDropZones, function(idx, dropZone) { - dropZone.dispose(); - }); - } - }); - }; - qq.DragAndDrop.callbacks = function() { - "use strict"; - return { - processingDroppedFiles: function() {}, - processingDroppedFilesComplete: function(files, targetEl) {}, - dropError: function(code, errorSpecifics) { - qq.log("Drag & drop error code '" + code + " with these specifics: '" + errorSpecifics + "'", "error"); - }, - dropLog: function(message, level) { - qq.log(message, level); - } - }; - }; - qq.UploadDropZone = function(o) { - "use strict"; - var disposeSupport = new qq.DisposeSupport(), options, element, preventDrop, dropOutsideDisabled; - options = { - element: null, - onEnter: function(e) {}, - onLeave: function(e) {}, - onLeaveNotDescendants: function(e) {}, - onDrop: function(e) {} - }; - qq.extend(options, o); - element = options.element; - function dragoverShouldBeCanceled() { - return qq.safari() || qq.firefox() && qq.windows(); - } - function disableDropOutside(e) { - if (!dropOutsideDisabled) { - if (dragoverShouldBeCanceled) { - disposeSupport.attach(document, "dragover", function(e) { - e.preventDefault(); - }); - } else { - disposeSupport.attach(document, "dragover", function(e) { - if (e.dataTransfer) { - e.dataTransfer.dropEffect = "none"; - e.preventDefault(); - } - }); - } - dropOutsideDisabled = true; - } - } - function isValidFileDrag(e) { - if (!qq.supportedFeatures.fileDrop) { - return false; - } - var effectTest, dt = e.dataTransfer, isSafari = qq.safari(); - effectTest = qq.ie() && qq.supportedFeatures.fileDrop ? true : dt.effectAllowed !== "none"; - return dt && effectTest && (dt.files && dt.files.length || !isSafari && dt.types.contains && dt.types.contains("Files") || dt.types.includes && dt.types.includes("Files")); - } - function isOrSetDropDisabled(isDisabled) { - if (isDisabled !== undefined) { - preventDrop = isDisabled; - } - return preventDrop; - } - function triggerHidezonesEvent() { - var hideZonesEvent; - function triggerUsingOldApi() { - hideZonesEvent = document.createEvent("Event"); - hideZonesEvent.initEvent(options.HIDE_ZONES_EVENT_NAME, true, true); - } - if (window.CustomEvent) { - try { - hideZonesEvent = new CustomEvent(options.HIDE_ZONES_EVENT_NAME); - } catch (err) { - triggerUsingOldApi(); - } - } else { - triggerUsingOldApi(); - } - document.dispatchEvent(hideZonesEvent); - } - function attachEvents() { - disposeSupport.attach(element, "dragover", function(e) { - if (!isValidFileDrag(e)) { - return; - } - var effect = qq.ie() && qq.supportedFeatures.fileDrop ? null : e.dataTransfer.effectAllowed; - if (effect === "move" || effect === "linkMove") { - e.dataTransfer.dropEffect = "move"; - } else { - e.dataTransfer.dropEffect = "copy"; - } - e.stopPropagation(); - e.preventDefault(); - }); - disposeSupport.attach(element, "dragenter", function(e) { - if (!isOrSetDropDisabled()) { - if (!isValidFileDrag(e)) { - return; - } - options.onEnter(e); - } - }); - disposeSupport.attach(element, "dragleave", function(e) { - if (!isValidFileDrag(e)) { - return; - } - options.onLeave(e); - var relatedTarget = document.elementFromPoint(e.clientX, e.clientY); - if (qq(this).contains(relatedTarget)) { - return; - } - options.onLeaveNotDescendants(e); - }); - disposeSupport.attach(element, "drop", function(e) { - if (!isOrSetDropDisabled()) { - if (!isValidFileDrag(e)) { - return; - } - e.preventDefault(); - e.stopPropagation(); - options.onDrop(e); - triggerHidezonesEvent(); - } - }); - } - disableDropOutside(); - attachEvents(); - qq.extend(this, { - dropDisabled: function(isDisabled) { - return isOrSetDropDisabled(isDisabled); - }, - dispose: function() { - disposeSupport.dispose(); - }, - getElement: function() { - return element; - } - }); - this._testing = {}; - this._testing.isValidFileDrag = isValidFileDrag; - }; - (function() { - "use strict"; - qq.uiPublicApi = { - addInitialFiles: function(cannedFileList) { - this._parent.prototype.addInitialFiles.apply(this, arguments); - this._templating.addCacheToDom(); - }, - clearStoredFiles: function() { - this._parent.prototype.clearStoredFiles.apply(this, arguments); - this._templating.clearFiles(); - }, - addExtraDropzone: function(element) { - this._dnd && this._dnd.setupExtraDropzone(element); - }, - removeExtraDropzone: function(element) { - if (this._dnd) { - return this._dnd.removeDropzone(element); - } - }, - getItemByFileId: function(id) { - if (!this._templating.isHiddenForever(id)) { - return this._templating.getFileContainer(id); - } - }, - reset: function() { - this._parent.prototype.reset.apply(this, arguments); - this._templating.reset(); - if (!this._options.button && this._templating.getButton()) { - this._defaultButtonId = this._createUploadButton({ - element: this._templating.getButton(), - title: this._options.text.fileInputTitle - }).getButtonId(); - } - if (this._dnd) { - this._dnd.dispose(); - this._dnd = this._setupDragAndDrop(); - } - this._totalFilesInBatch = 0; - this._filesInBatchAddedToUi = 0; - this._setupClickAndEditEventHandlers(); - }, - setName: function(id, newName) { - var formattedFilename = this._options.formatFileName(newName); - this._parent.prototype.setName.apply(this, arguments); - this._templating.updateFilename(id, formattedFilename); - }, - pauseUpload: function(id) { - var paused = this._parent.prototype.pauseUpload.apply(this, arguments); - paused && this._templating.uploadPaused(id); - return paused; - }, - continueUpload: function(id) { - var continued = this._parent.prototype.continueUpload.apply(this, arguments); - continued && this._templating.uploadContinued(id); - return continued; - }, - getId: function(fileContainerOrChildEl) { - return this._templating.getFileId(fileContainerOrChildEl); - }, - getDropTarget: function(fileId) { - var file = this.getFile(fileId); - return file.qqDropTarget; - } - }; - qq.uiPrivateApi = { - _getButton: function(buttonId) { - var button = this._parent.prototype._getButton.apply(this, arguments); - if (!button) { - if (buttonId === this._defaultButtonId) { - button = this._templating.getButton(); - } - } - return button; - }, - _removeFileItem: function(fileId) { - this._templating.removeFile(fileId); - }, - _setupClickAndEditEventHandlers: function() { - this._fileButtonsClickHandler = qq.FileButtonsClickHandler && this._bindFileButtonsClickEvent(); - this._focusinEventSupported = !qq.firefox(); - if (this._isEditFilenameEnabled()) { - this._filenameClickHandler = this._bindFilenameClickEvent(); - this._filenameInputFocusInHandler = this._bindFilenameInputFocusInEvent(); - this._filenameInputFocusHandler = this._bindFilenameInputFocusEvent(); - } - }, - _setupDragAndDrop: function() { - var self = this, dropZoneElements = this._options.dragAndDrop.extraDropzones, templating = this._templating, defaultDropZone = templating.getDropZone(); - defaultDropZone && dropZoneElements.push(defaultDropZone); - return new qq.DragAndDrop({ - dropZoneElements: dropZoneElements, - allowMultipleItems: this._options.multiple, - classes: { - dropActive: this._options.classes.dropActive - }, - callbacks: { - processingDroppedFiles: function() { - templating.showDropProcessing(); - }, - processingDroppedFilesComplete: function(files, targetEl) { - templating.hideDropProcessing(); - qq.each(files, function(idx, file) { - file.qqDropTarget = targetEl; - }); - if (files.length) { - self.addFiles(files, null, null); - } - }, - dropError: function(code, errorData) { - self._itemError(code, errorData); - }, - dropLog: function(message, level) { - self.log(message, level); - } - } - }); - }, - _bindFileButtonsClickEvent: function() { - var self = this; - return new qq.FileButtonsClickHandler({ - templating: this._templating, - log: function(message, lvl) { - self.log(message, lvl); - }, - onDeleteFile: function(fileId) { - self.deleteFile(fileId); - }, - onCancel: function(fileId) { - self.cancel(fileId); - }, - onRetry: function(fileId) { - self.retry(fileId); - }, - onPause: function(fileId) { - self.pauseUpload(fileId); - }, - onContinue: function(fileId) { - self.continueUpload(fileId); - }, - onGetName: function(fileId) { - return self.getName(fileId); - } - }); - }, - _isEditFilenameEnabled: function() { - return this._templating.isEditFilenamePossible() && !this._options.autoUpload && qq.FilenameClickHandler && qq.FilenameInputFocusHandler && qq.FilenameInputFocusHandler; - }, - _filenameEditHandler: function() { - var self = this, templating = this._templating; - return { - templating: templating, - log: function(message, lvl) { - self.log(message, lvl); - }, - onGetUploadStatus: function(fileId) { - return self.getUploads({ - id: fileId - }).status; - }, - onGetName: function(fileId) { - return self.getName(fileId); - }, - onSetName: function(id, newName) { - self.setName(id, newName); - }, - onEditingStatusChange: function(id, isEditing) { - var qqInput = qq(templating.getEditInput(id)), qqFileContainer = qq(templating.getFileContainer(id)); - if (isEditing) { - qqInput.addClass("qq-editing"); - templating.hideFilename(id); - templating.hideEditIcon(id); - } else { - qqInput.removeClass("qq-editing"); - templating.showFilename(id); - templating.showEditIcon(id); - } - qqFileContainer.addClass("qq-temp").removeClass("qq-temp"); - } - }; - }, - _onUploadStatusChange: function(id, oldStatus, newStatus) { - this._parent.prototype._onUploadStatusChange.apply(this, arguments); - if (this._isEditFilenameEnabled()) { - if (this._templating.getFileContainer(id) && newStatus !== qq.status.SUBMITTED) { - this._templating.markFilenameEditable(id); - this._templating.hideEditIcon(id); - } - } - if (oldStatus === qq.status.UPLOAD_RETRYING && newStatus === qq.status.UPLOADING) { - this._templating.hideRetry(id); - this._templating.setStatusText(id); - qq(this._templating.getFileContainer(id)).removeClass(this._classes.retrying); - } else if (newStatus === qq.status.UPLOAD_FAILED) { - this._templating.hidePause(id); - } - }, - _bindFilenameInputFocusInEvent: function() { - var spec = qq.extend({}, this._filenameEditHandler()); - return new qq.FilenameInputFocusInHandler(spec); - }, - _bindFilenameInputFocusEvent: function() { - var spec = qq.extend({}, this._filenameEditHandler()); - return new qq.FilenameInputFocusHandler(spec); - }, - _bindFilenameClickEvent: function() { - var spec = qq.extend({}, this._filenameEditHandler()); - return new qq.FilenameClickHandler(spec); - }, - _storeForLater: function(id) { - this._parent.prototype._storeForLater.apply(this, arguments); - this._templating.hideSpinner(id); - }, - _onAllComplete: function(successful, failed) { - this._parent.prototype._onAllComplete.apply(this, arguments); - this._templating.resetTotalProgress(); - }, - _onSubmit: function(id, name) { - var file = this.getFile(id); - if (file && file.qqPath && this._options.dragAndDrop.reportDirectoryPaths) { - this._paramsStore.addReadOnly(id, { - qqpath: file.qqPath - }); - } - this._parent.prototype._onSubmit.apply(this, arguments); - this._addToList(id, name); - }, - _onSubmitted: function(id) { - if (this._isEditFilenameEnabled()) { - this._templating.markFilenameEditable(id); - this._templating.showEditIcon(id); - if (!this._focusinEventSupported) { - this._filenameInputFocusHandler.addHandler(this._templating.getEditInput(id)); - } - } - }, - _onProgress: function(id, name, loaded, total) { - this._parent.prototype._onProgress.apply(this, arguments); - this._templating.updateProgress(id, loaded, total); - if (total === 0 || Math.round(loaded / total * 100) === 100) { - this._templating.hideCancel(id); - this._templating.hidePause(id); - this._templating.hideProgress(id); - this._templating.setStatusText(id, this._options.text.waitingForResponse); - this._displayFileSize(id); - } else { - this._displayFileSize(id, loaded, total); - } - }, - _onTotalProgress: function(loaded, total) { - this._parent.prototype._onTotalProgress.apply(this, arguments); - this._templating.updateTotalProgress(loaded, total); - }, - _onComplete: function(id, name, result, xhr) { - var parentRetVal = this._parent.prototype._onComplete.apply(this, arguments), templating = this._templating, fileContainer = templating.getFileContainer(id), self = this; - function completeUpload(result) { - if (!fileContainer) { - return; - } - templating.setStatusText(id); - qq(fileContainer).removeClass(self._classes.retrying); - templating.hideProgress(id); - if (self.getUploads({ - id: id - }).status !== qq.status.UPLOAD_FAILED) { - templating.hideCancel(id); - } - templating.hideSpinner(id); - if (result.success) { - self._markFileAsSuccessful(id); - } else { - qq(fileContainer).addClass(self._classes.fail); - templating.showCancel(id); - if (templating.isRetryPossible() && !self._preventRetries[id]) { - qq(fileContainer).addClass(self._classes.retryable); - templating.showRetry(id); - } - self._controlFailureTextDisplay(id, result); - } - } - if (parentRetVal instanceof qq.Promise) { - parentRetVal.done(function(newResult) { - completeUpload(newResult); - }); - } else { - completeUpload(result); - } - return parentRetVal; - }, - _markFileAsSuccessful: function(id) { - var templating = this._templating; - if (this._isDeletePossible()) { - templating.showDeleteButton(id); - } - qq(templating.getFileContainer(id)).addClass(this._classes.success); - this._maybeUpdateThumbnail(id); - }, - _onUploadPrep: function(id) { - this._parent.prototype._onUploadPrep.apply(this, arguments); - this._templating.showSpinner(id); - }, - _onUpload: function(id, name) { - var parentRetVal = this._parent.prototype._onUpload.apply(this, arguments); - this._templating.showSpinner(id); - return parentRetVal; - }, - _onUploadChunk: function(id, chunkData) { - this._parent.prototype._onUploadChunk.apply(this, arguments); - if (chunkData.partIndex > 0 && this._handler.isResumable(id)) { - this._templating.allowPause(id); - } - }, - _onCancel: function(id, name) { - this._parent.prototype._onCancel.apply(this, arguments); - this._removeFileItem(id); - if (this._getNotFinished() === 0) { - this._templating.resetTotalProgress(); - } - }, - _onBeforeAutoRetry: function(id) { - var retryNumForDisplay, maxAuto, retryNote; - this._parent.prototype._onBeforeAutoRetry.apply(this, arguments); - this._showCancelLink(id); - if (this._options.retry.showAutoRetryNote) { - retryNumForDisplay = this._autoRetries[id]; - maxAuto = this._options.retry.maxAutoAttempts; - retryNote = this._options.retry.autoRetryNote.replace(/\{retryNum\}/g, retryNumForDisplay); - retryNote = retryNote.replace(/\{maxAuto\}/g, maxAuto); - this._templating.setStatusText(id, retryNote); - qq(this._templating.getFileContainer(id)).addClass(this._classes.retrying); - } - }, - _onBeforeManualRetry: function(id) { - if (this._parent.prototype._onBeforeManualRetry.apply(this, arguments)) { - this._templating.resetProgress(id); - qq(this._templating.getFileContainer(id)).removeClass(this._classes.fail); - this._templating.setStatusText(id); - this._templating.showSpinner(id); - this._showCancelLink(id); - return true; - } else { - qq(this._templating.getFileContainer(id)).addClass(this._classes.retryable); - this._templating.showRetry(id); - return false; - } - }, - _onSubmitDelete: function(id) { - var onSuccessCallback = qq.bind(this._onSubmitDeleteSuccess, this); - this._parent.prototype._onSubmitDelete.call(this, id, onSuccessCallback); - }, - _onSubmitDeleteSuccess: function(id, uuid, additionalMandatedParams) { - if (this._options.deleteFile.forceConfirm) { - this._showDeleteConfirm.apply(this, arguments); - } else { - this._sendDeleteRequest.apply(this, arguments); - } - }, - _onDeleteComplete: function(id, xhr, isError) { - this._parent.prototype._onDeleteComplete.apply(this, arguments); - this._templating.hideSpinner(id); - if (isError) { - this._templating.setStatusText(id, this._options.deleteFile.deletingFailedText); - this._templating.showDeleteButton(id); - } else { - this._removeFileItem(id); - } - }, - _sendDeleteRequest: function(id, uuid, additionalMandatedParams) { - this._templating.hideDeleteButton(id); - this._templating.showSpinner(id); - this._templating.setStatusText(id, this._options.deleteFile.deletingStatusText); - this._deleteHandler.sendDelete.apply(this, arguments); - }, - _showDeleteConfirm: function(id, uuid, mandatedParams) { - var fileName = this.getName(id), confirmMessage = this._options.deleteFile.confirmMessage.replace(/\{filename\}/g, fileName), uuid = this.getUuid(id), deleteRequestArgs = arguments, self = this, retVal; - retVal = this._options.showConfirm(confirmMessage); - if (qq.isGenericPromise(retVal)) { - retVal.then(function() { - self._sendDeleteRequest.apply(self, deleteRequestArgs); - }); - } else if (retVal !== false) { - self._sendDeleteRequest.apply(self, deleteRequestArgs); - } - }, - _addToList: function(id, name, canned) { - var prependData, prependIndex = 0, dontDisplay = this._handler.isProxied(id) && this._options.scaling.hideScaled, record; - if (this._options.display.prependFiles) { - if (this._totalFilesInBatch > 1 && this._filesInBatchAddedToUi > 0) { - prependIndex = this._filesInBatchAddedToUi - 1; - } - prependData = { - index: prependIndex - }; - } - if (!canned) { - if (this._options.disableCancelForFormUploads && !qq.supportedFeatures.ajaxUploading) { - this._templating.disableCancel(); - } - if (!this._options.multiple) { - record = this.getUploads({ - id: id - }); - this._handledProxyGroup = this._handledProxyGroup || record.proxyGroupId; - if (record.proxyGroupId !== this._handledProxyGroup || !record.proxyGroupId) { - this._handler.cancelAll(); - this._clearList(); - this._handledProxyGroup = null; - } - } - } - if (canned) { - this._templating.addFileToCache(id, this._options.formatFileName(name), prependData, dontDisplay); - this._templating.updateThumbnail(id, this._thumbnailUrls[id], true, this._options.thumbnails.customResizer); - } else { - this._templating.addFile(id, this._options.formatFileName(name), prependData, dontDisplay); - this._templating.generatePreview(id, this.getFile(id), this._options.thumbnails.customResizer); - } - this._filesInBatchAddedToUi += 1; - if (canned || this._options.display.fileSizeOnSubmit && qq.supportedFeatures.ajaxUploading) { - this._displayFileSize(id); - } - }, - _clearList: function() { - this._templating.clearFiles(); - this.clearStoredFiles(); - }, - _displayFileSize: function(id, loadedSize, totalSize) { - var size = this.getSize(id), sizeForDisplay = this._formatSize(size); - if (size >= 0) { - if (loadedSize !== undefined && totalSize !== undefined) { - sizeForDisplay = this._formatProgress(loadedSize, totalSize); - } - this._templating.updateSize(id, sizeForDisplay); - } - }, - _formatProgress: function(uploadedSize, totalSize) { - var message = this._options.text.formatProgress; - function r(name, replacement) { - message = message.replace(name, replacement); - } - r("{percent}", Math.round(uploadedSize / totalSize * 100)); - r("{total_size}", this._formatSize(totalSize)); - return message; - }, - _controlFailureTextDisplay: function(id, response) { - var mode, responseProperty, failureReason; - mode = this._options.failedUploadTextDisplay.mode; - responseProperty = this._options.failedUploadTextDisplay.responseProperty; - if (mode === "custom") { - failureReason = response[responseProperty]; - if (!failureReason) { - failureReason = this._options.text.failUpload; - } - this._templating.setStatusText(id, failureReason); - if (this._options.failedUploadTextDisplay.enableTooltip) { - this._showTooltip(id, failureReason); - } - } else if (mode === "default") { - this._templating.setStatusText(id, this._options.text.failUpload); - } else if (mode !== "none") { - this.log("failedUploadTextDisplay.mode value of '" + mode + "' is not valid", "warn"); - } - }, - _showTooltip: function(id, text) { - this._templating.getFileContainer(id).title = text; - }, - _showCancelLink: function(id) { - if (!this._options.disableCancelForFormUploads || qq.supportedFeatures.ajaxUploading) { - this._templating.showCancel(id); - } - }, - _itemError: function(code, name, item) { - var message = this._parent.prototype._itemError.apply(this, arguments); - this._options.showMessage(message); - }, - _batchError: function(message) { - this._parent.prototype._batchError.apply(this, arguments); - this._options.showMessage(message); - }, - _setupPastePrompt: function() { - var self = this; - this._options.callbacks.onPasteReceived = function() { - var message = self._options.paste.namePromptMessage, defaultVal = self._options.paste.defaultName; - return self._options.showPrompt(message, defaultVal); - }; - }, - _fileOrBlobRejected: function(id, name) { - this._totalFilesInBatch -= 1; - this._parent.prototype._fileOrBlobRejected.apply(this, arguments); - }, - _prepareItemsForUpload: function(items, params, endpoint) { - this._totalFilesInBatch = items.length; - this._filesInBatchAddedToUi = 0; - this._parent.prototype._prepareItemsForUpload.apply(this, arguments); - }, - _maybeUpdateThumbnail: function(fileId) { - var thumbnailUrl = this._thumbnailUrls[fileId], fileStatus = this.getUploads({ - id: fileId - }).status; - if (fileStatus !== qq.status.DELETED && (thumbnailUrl || this._options.thumbnails.placeholders.waitUntilResponse || !qq.supportedFeatures.imagePreviews)) { - this._templating.updateThumbnail(fileId, thumbnailUrl, this._options.thumbnails.customResizer); - } - }, - _addCannedFile: function(sessionData) { - var id = this._parent.prototype._addCannedFile.apply(this, arguments); - this._addToList(id, this.getName(id), true); - this._templating.hideSpinner(id); - this._templating.hideCancel(id); - this._markFileAsSuccessful(id); - return id; - }, - _setSize: function(id, newSize) { - this._parent.prototype._setSize.apply(this, arguments); - this._templating.updateSize(id, this._formatSize(newSize)); - }, - _sessionRequestComplete: function() { - this._templating.addCacheToDom(); - this._parent.prototype._sessionRequestComplete.apply(this, arguments); - } - }; - })(); - qq.FineUploader = function(o, namespace) { - "use strict"; - var self = this; - this._parent = namespace ? qq[namespace].FineUploaderBasic : qq.FineUploaderBasic; - this._parent.apply(this, arguments); - qq.extend(this._options, { - element: null, - button: null, - listElement: null, - dragAndDrop: { - extraDropzones: [], - reportDirectoryPaths: false - }, - text: { - formatProgress: "{percent}% of {total_size}", - failUpload: "Upload failed", - waitingForResponse: "Processing...", - paused: "Paused" - }, - template: "qq-template", - classes: { - retrying: "qq-upload-retrying", - retryable: "qq-upload-retryable", - success: "qq-upload-success", - fail: "qq-upload-fail", - editable: "qq-editable", - hide: "qq-hide", - dropActive: "qq-upload-drop-area-active" - }, - failedUploadTextDisplay: { - mode: "default", - responseProperty: "error", - enableTooltip: true - }, - messages: { - tooManyFilesError: "You may only drop one file", - unsupportedBrowser: "Unrecoverable error - this browser does not permit file uploading of any kind." - }, - retry: { - showAutoRetryNote: true, - autoRetryNote: "Retrying {retryNum}/{maxAuto}..." - }, - deleteFile: { - forceConfirm: false, - confirmMessage: "Are you sure you want to delete {filename}?", - deletingStatusText: "Deleting...", - deletingFailedText: "Delete failed" - }, - display: { - fileSizeOnSubmit: false, - prependFiles: false - }, - paste: { - promptForName: false, - namePromptMessage: "Please name this image" - }, - thumbnails: { - customResizer: null, - maxCount: 0, - placeholders: { - waitUntilResponse: false, - notAvailablePath: null, - waitingPath: null - }, - timeBetweenThumbs: 750 - }, - scaling: { - hideScaled: false - }, - showMessage: function(message) { - if (self._templating.hasDialog("alert")) { - return self._templating.showDialog("alert", message); - } else { - setTimeout(function() { - window.alert(message); - }, 0); - } - }, - showConfirm: function(message) { - if (self._templating.hasDialog("confirm")) { - return self._templating.showDialog("confirm", message); - } else { - return window.confirm(message); - } - }, - showPrompt: function(message, defaultValue) { - if (self._templating.hasDialog("prompt")) { - return self._templating.showDialog("prompt", message, defaultValue); - } else { - return window.prompt(message, defaultValue); - } - } - }, true); - qq.extend(this._options, o, true); - this._templating = new qq.Templating({ - log: qq.bind(this.log, this), - templateIdOrEl: this._options.template, - containerEl: this._options.element, - fileContainerEl: this._options.listElement, - button: this._options.button, - imageGenerator: this._imageGenerator, - classes: { - hide: this._options.classes.hide, - editable: this._options.classes.editable - }, - limits: { - maxThumbs: this._options.thumbnails.maxCount, - timeBetweenThumbs: this._options.thumbnails.timeBetweenThumbs - }, - placeholders: { - waitUntilUpdate: this._options.thumbnails.placeholders.waitUntilResponse, - thumbnailNotAvailable: this._options.thumbnails.placeholders.notAvailablePath, - waitingForThumbnail: this._options.thumbnails.placeholders.waitingPath - }, - text: this._options.text - }); - if (this._options.workarounds.ios8SafariUploads && qq.ios800() && qq.iosSafari()) { - this._templating.renderFailure(this._options.messages.unsupportedBrowserIos8Safari); - } else if (!qq.supportedFeatures.uploading || this._options.cors.expected && !qq.supportedFeatures.uploadCors) { - this._templating.renderFailure(this._options.messages.unsupportedBrowser); - } else { - this._wrapCallbacks(); - this._templating.render(); - this._classes = this._options.classes; - if (!this._options.button && this._templating.getButton()) { - this._defaultButtonId = this._createUploadButton({ - element: this._templating.getButton(), - title: this._options.text.fileInputTitle - }).getButtonId(); - } - this._setupClickAndEditEventHandlers(); - if (qq.DragAndDrop && qq.supportedFeatures.fileDrop) { - this._dnd = this._setupDragAndDrop(); - } - if (this._options.paste.targetElement && this._options.paste.promptForName) { - if (qq.PasteSupport) { - this._setupPastePrompt(); - } else { - this.log("Paste support module not found.", "error"); - } - } - this._totalFilesInBatch = 0; - this._filesInBatchAddedToUi = 0; - } - }; - qq.extend(qq.FineUploader.prototype, qq.basePublicApi); - qq.extend(qq.FineUploader.prototype, qq.basePrivateApi); - qq.extend(qq.FineUploader.prototype, qq.uiPublicApi); - qq.extend(qq.FineUploader.prototype, qq.uiPrivateApi); - qq.Templating = function(spec) { - "use strict"; - var FILE_ID_ATTR = "qq-file-id", FILE_CLASS_PREFIX = "qq-file-id-", THUMBNAIL_MAX_SIZE_ATTR = "qq-max-size", THUMBNAIL_SERVER_SCALE_ATTR = "qq-server-scale", HIDE_DROPZONE_ATTR = "qq-hide-dropzone", DROPZPONE_TEXT_ATTR = "qq-drop-area-text", IN_PROGRESS_CLASS = "qq-in-progress", HIDDEN_FOREVER_CLASS = "qq-hidden-forever", fileBatch = { - content: document.createDocumentFragment(), - map: {} - }, isCancelDisabled = false, generatedThumbnails = 0, thumbnailQueueMonitorRunning = false, thumbGenerationQueue = [], thumbnailMaxSize = -1, options = { - log: null, - limits: { - maxThumbs: 0, - timeBetweenThumbs: 750 - }, - templateIdOrEl: "qq-template", - containerEl: null, - fileContainerEl: null, - button: null, - imageGenerator: null, - classes: { - hide: "qq-hide", - editable: "qq-editable" - }, - placeholders: { - waitUntilUpdate: false, - thumbnailNotAvailable: null, - waitingForThumbnail: null - }, - text: { - paused: "Paused" - } - }, selectorClasses = { - button: "qq-upload-button-selector", - alertDialog: "qq-alert-dialog-selector", - dialogCancelButton: "qq-cancel-button-selector", - confirmDialog: "qq-confirm-dialog-selector", - dialogMessage: "qq-dialog-message-selector", - dialogOkButton: "qq-ok-button-selector", - promptDialog: "qq-prompt-dialog-selector", - uploader: "qq-uploader-selector", - drop: "qq-upload-drop-area-selector", - list: "qq-upload-list-selector", - progressBarContainer: "qq-progress-bar-container-selector", - progressBar: "qq-progress-bar-selector", - totalProgressBarContainer: "qq-total-progress-bar-container-selector", - totalProgressBar: "qq-total-progress-bar-selector", - file: "qq-upload-file-selector", - spinner: "qq-upload-spinner-selector", - size: "qq-upload-size-selector", - cancel: "qq-upload-cancel-selector", - pause: "qq-upload-pause-selector", - continueButton: "qq-upload-continue-selector", - deleteButton: "qq-upload-delete-selector", - retry: "qq-upload-retry-selector", - statusText: "qq-upload-status-text-selector", - editFilenameInput: "qq-edit-filename-selector", - editNameIcon: "qq-edit-filename-icon-selector", - dropText: "qq-upload-drop-area-text-selector", - dropProcessing: "qq-drop-processing-selector", - dropProcessingSpinner: "qq-drop-processing-spinner-selector", - thumbnail: "qq-thumbnail-selector" - }, previewGeneration = {}, cachedThumbnailNotAvailableImg = new qq.Promise(), cachedWaitingForThumbnailImg = new qq.Promise(), log, isEditElementsExist, isRetryElementExist, templateDom, container, fileList, showThumbnails, serverScale, cacheThumbnailPlaceholders = function() { - var notAvailableUrl = options.placeholders.thumbnailNotAvailable, waitingUrl = options.placeholders.waitingForThumbnail, spec = { - maxSize: thumbnailMaxSize, - scale: serverScale - }; - if (showThumbnails) { - if (notAvailableUrl) { - options.imageGenerator.generate(notAvailableUrl, new Image(), spec).then(function(updatedImg) { - cachedThumbnailNotAvailableImg.success(updatedImg); - }, function() { - cachedThumbnailNotAvailableImg.failure(); - log("Problem loading 'not available' placeholder image at " + notAvailableUrl, "error"); - }); - } else { - cachedThumbnailNotAvailableImg.failure(); - } - if (waitingUrl) { - options.imageGenerator.generate(waitingUrl, new Image(), spec).then(function(updatedImg) { - cachedWaitingForThumbnailImg.success(updatedImg); - }, function() { - cachedWaitingForThumbnailImg.failure(); - log("Problem loading 'waiting for thumbnail' placeholder image at " + waitingUrl, "error"); - }); - } else { - cachedWaitingForThumbnailImg.failure(); - } - } - }, displayWaitingImg = function(thumbnail) { - var waitingImgPlacement = new qq.Promise(); - cachedWaitingForThumbnailImg.then(function(img) { - maybeScalePlaceholderViaCss(img, thumbnail); - if (!thumbnail.src) { - thumbnail.src = img.src; - thumbnail.onload = function() { - thumbnail.onload = null; - show(thumbnail); - waitingImgPlacement.success(); - }; - } else { - waitingImgPlacement.success(); - } - }, function() { - hide(thumbnail); - waitingImgPlacement.success(); - }); - return waitingImgPlacement; - }, generateNewPreview = function(id, blob, spec) { - var thumbnail = getThumbnail(id); - log("Generating new thumbnail for " + id); - blob.qqThumbnailId = id; - return options.imageGenerator.generate(blob, thumbnail, spec).then(function() { - generatedThumbnails++; - show(thumbnail); - previewGeneration[id].success(); - }, function() { - previewGeneration[id].failure(); - if (!options.placeholders.waitUntilUpdate) { - maybeSetDisplayNotAvailableImg(id, thumbnail); - } - }); - }, generateNextQueuedPreview = function() { - if (thumbGenerationQueue.length) { - thumbnailQueueMonitorRunning = true; - var queuedThumbRequest = thumbGenerationQueue.shift(); - if (queuedThumbRequest.update) { - processUpdateQueuedPreviewRequest(queuedThumbRequest); - } else { - processNewQueuedPreviewRequest(queuedThumbRequest); - } - } else { - thumbnailQueueMonitorRunning = false; - } - }, getCancel = function(id) { - return getTemplateEl(getFile(id), selectorClasses.cancel); - }, getContinue = function(id) { - return getTemplateEl(getFile(id), selectorClasses.continueButton); - }, getDialog = function(type) { - return getTemplateEl(container, selectorClasses[type + "Dialog"]); - }, getDelete = function(id) { - return getTemplateEl(getFile(id), selectorClasses.deleteButton); - }, getDropProcessing = function() { - return getTemplateEl(container, selectorClasses.dropProcessing); - }, getEditIcon = function(id) { - return getTemplateEl(getFile(id), selectorClasses.editNameIcon); - }, getFile = function(id) { - return fileBatch.map[id] || qq(fileList).getFirstByClass(FILE_CLASS_PREFIX + id); - }, getFilename = function(id) { - return getTemplateEl(getFile(id), selectorClasses.file); - }, getPause = function(id) { - return getTemplateEl(getFile(id), selectorClasses.pause); - }, getProgress = function(id) { - if (id == null) { - return getTemplateEl(container, selectorClasses.totalProgressBarContainer) || getTemplateEl(container, selectorClasses.totalProgressBar); - } - return getTemplateEl(getFile(id), selectorClasses.progressBarContainer) || getTemplateEl(getFile(id), selectorClasses.progressBar); - }, getRetry = function(id) { - return getTemplateEl(getFile(id), selectorClasses.retry); - }, getSize = function(id) { - return getTemplateEl(getFile(id), selectorClasses.size); - }, getSpinner = function(id) { - return getTemplateEl(getFile(id), selectorClasses.spinner); - }, getTemplateEl = function(context, cssClass) { - return context && qq(context).getFirstByClass(cssClass); - }, getThumbnail = function(id) { - return showThumbnails && getTemplateEl(getFile(id), selectorClasses.thumbnail); - }, hide = function(el) { - el && qq(el).addClass(options.classes.hide); - }, maybeScalePlaceholderViaCss = function(placeholder, thumbnail) { - var maxWidth = placeholder.style.maxWidth, maxHeight = placeholder.style.maxHeight; - if (maxHeight && maxWidth && !thumbnail.style.maxWidth && !thumbnail.style.maxHeight) { - qq(thumbnail).css({ - maxWidth: maxWidth, - maxHeight: maxHeight - }); - } - }, maybeSetDisplayNotAvailableImg = function(id, thumbnail) { - var previewing = previewGeneration[id] || new qq.Promise().failure(), notAvailableImgPlacement = new qq.Promise(); - cachedThumbnailNotAvailableImg.then(function(img) { - previewing.then(function() { - notAvailableImgPlacement.success(); - }, function() { - maybeScalePlaceholderViaCss(img, thumbnail); - thumbnail.onload = function() { - thumbnail.onload = null; - notAvailableImgPlacement.success(); - }; - thumbnail.src = img.src; - show(thumbnail); - }); - }); - return notAvailableImgPlacement; - }, parseAndGetTemplate = function() { - var scriptEl, scriptHtml, fileListNode, tempTemplateEl, fileListEl, defaultButton, dropArea, thumbnail, dropProcessing, dropTextEl, uploaderEl; - log("Parsing template"); - if (options.templateIdOrEl == null) { - throw new Error("You MUST specify either a template element or ID!"); - } - if (qq.isString(options.templateIdOrEl)) { - scriptEl = document.getElementById(options.templateIdOrEl); - if (scriptEl === null) { - throw new Error(qq.format("Cannot find template script at ID '{}'!", options.templateIdOrEl)); - } - scriptHtml = scriptEl.innerHTML; - } else { - if (options.templateIdOrEl.innerHTML === undefined) { - throw new Error("You have specified an invalid value for the template option! " + "It must be an ID or an Element."); - } - scriptHtml = options.templateIdOrEl.innerHTML; - } - scriptHtml = qq.trimStr(scriptHtml); - tempTemplateEl = document.createElement("div"); - tempTemplateEl.appendChild(qq.toElement(scriptHtml)); - uploaderEl = qq(tempTemplateEl).getFirstByClass(selectorClasses.uploader); - if (options.button) { - defaultButton = qq(tempTemplateEl).getFirstByClass(selectorClasses.button); - if (defaultButton) { - qq(defaultButton).remove(); - } - } - if (!qq.DragAndDrop || !qq.supportedFeatures.fileDrop) { - dropProcessing = qq(tempTemplateEl).getFirstByClass(selectorClasses.dropProcessing); - if (dropProcessing) { - qq(dropProcessing).remove(); - } - } - dropArea = qq(tempTemplateEl).getFirstByClass(selectorClasses.drop); - if (dropArea && !qq.DragAndDrop) { - log("DnD module unavailable.", "info"); - qq(dropArea).remove(); - } - if (!qq.supportedFeatures.fileDrop) { - uploaderEl.removeAttribute(DROPZPONE_TEXT_ATTR); - if (dropArea && qq(dropArea).hasAttribute(HIDE_DROPZONE_ATTR)) { - qq(dropArea).css({ - display: "none" - }); - } - } else if (qq(uploaderEl).hasAttribute(DROPZPONE_TEXT_ATTR) && dropArea) { - dropTextEl = qq(dropArea).getFirstByClass(selectorClasses.dropText); - dropTextEl && qq(dropTextEl).remove(); - } - thumbnail = qq(tempTemplateEl).getFirstByClass(selectorClasses.thumbnail); - if (!showThumbnails) { - thumbnail && qq(thumbnail).remove(); - } else if (thumbnail) { - thumbnailMaxSize = parseInt(thumbnail.getAttribute(THUMBNAIL_MAX_SIZE_ATTR)); - thumbnailMaxSize = thumbnailMaxSize > 0 ? thumbnailMaxSize : null; - serverScale = qq(thumbnail).hasAttribute(THUMBNAIL_SERVER_SCALE_ATTR); - } - showThumbnails = showThumbnails && thumbnail; - isEditElementsExist = qq(tempTemplateEl).getByClass(selectorClasses.editFilenameInput).length > 0; - isRetryElementExist = qq(tempTemplateEl).getByClass(selectorClasses.retry).length > 0; - fileListNode = qq(tempTemplateEl).getFirstByClass(selectorClasses.list); - if (fileListNode == null) { - throw new Error("Could not find the file list container in the template!"); - } - fileListEl = fileListNode.children[0].cloneNode(true); - fileListNode.innerHTML = ""; - if (tempTemplateEl.getElementsByTagName("DIALOG").length) { - document.createElement("dialog"); - } - log("Template parsing complete"); - return { - template: tempTemplateEl, - fileTemplate: fileListEl - }; - }, prependFile = function(el, index, fileList) { - var parentEl = fileList, beforeEl = parentEl.firstChild; - if (index > 0) { - beforeEl = qq(parentEl).children()[index].nextSibling; - } - parentEl.insertBefore(el, beforeEl); - }, processNewQueuedPreviewRequest = function(queuedThumbRequest) { - var id = queuedThumbRequest.id, optFileOrBlob = queuedThumbRequest.optFileOrBlob, relatedThumbnailId = optFileOrBlob && optFileOrBlob.qqThumbnailId, thumbnail = getThumbnail(id), spec = { - customResizeFunction: queuedThumbRequest.customResizeFunction, - maxSize: thumbnailMaxSize, - orient: true, - scale: true - }; - if (qq.supportedFeatures.imagePreviews) { - if (thumbnail) { - if (options.limits.maxThumbs && options.limits.maxThumbs <= generatedThumbnails) { - maybeSetDisplayNotAvailableImg(id, thumbnail); - generateNextQueuedPreview(); - } else { - displayWaitingImg(thumbnail).done(function() { - previewGeneration[id] = new qq.Promise(); - previewGeneration[id].done(function() { - setTimeout(generateNextQueuedPreview, options.limits.timeBetweenThumbs); - }); - if (relatedThumbnailId != null) { - useCachedPreview(id, relatedThumbnailId); - } else { - generateNewPreview(id, optFileOrBlob, spec); - } - }); - } - } else { - generateNextQueuedPreview(); - } - } else if (thumbnail) { - displayWaitingImg(thumbnail); - generateNextQueuedPreview(); - } - }, processUpdateQueuedPreviewRequest = function(queuedThumbRequest) { - var id = queuedThumbRequest.id, thumbnailUrl = queuedThumbRequest.thumbnailUrl, showWaitingImg = queuedThumbRequest.showWaitingImg, thumbnail = getThumbnail(id), spec = { - customResizeFunction: queuedThumbRequest.customResizeFunction, - scale: serverScale, - maxSize: thumbnailMaxSize - }; - if (thumbnail) { - if (thumbnailUrl) { - if (options.limits.maxThumbs && options.limits.maxThumbs <= generatedThumbnails) { - maybeSetDisplayNotAvailableImg(id, thumbnail); - generateNextQueuedPreview(); - } else { - if (showWaitingImg) { - displayWaitingImg(thumbnail); - } - return options.imageGenerator.generate(thumbnailUrl, thumbnail, spec).then(function() { - show(thumbnail); - generatedThumbnails++; - setTimeout(generateNextQueuedPreview, options.limits.timeBetweenThumbs); - }, function() { - maybeSetDisplayNotAvailableImg(id, thumbnail); - setTimeout(generateNextQueuedPreview, options.limits.timeBetweenThumbs); - }); - } - } else { - maybeSetDisplayNotAvailableImg(id, thumbnail); - generateNextQueuedPreview(); - } - } - }, setProgressBarWidth = function(id, percent) { - var bar = getProgress(id), progressBarSelector = id == null ? selectorClasses.totalProgressBar : selectorClasses.progressBar; - if (bar && !qq(bar).hasClass(progressBarSelector)) { - bar = qq(bar).getFirstByClass(progressBarSelector); - } - if (bar) { - qq(bar).css({ - width: percent + "%" - }); - bar.setAttribute("aria-valuenow", percent); - } - }, show = function(el) { - el && qq(el).removeClass(options.classes.hide); - }, useCachedPreview = function(targetThumbnailId, cachedThumbnailId) { - var targetThumbnail = getThumbnail(targetThumbnailId), cachedThumbnail = getThumbnail(cachedThumbnailId); - log(qq.format("ID {} is the same file as ID {}. Will use generated thumbnail from ID {} instead.", targetThumbnailId, cachedThumbnailId, cachedThumbnailId)); - previewGeneration[cachedThumbnailId].then(function() { - generatedThumbnails++; - previewGeneration[targetThumbnailId].success(); - log(qq.format("Now using previously generated thumbnail created for ID {} on ID {}.", cachedThumbnailId, targetThumbnailId)); - targetThumbnail.src = cachedThumbnail.src; - show(targetThumbnail); - }, function() { - previewGeneration[targetThumbnailId].failure(); - if (!options.placeholders.waitUntilUpdate) { - maybeSetDisplayNotAvailableImg(targetThumbnailId, targetThumbnail); - } - }); - }; - qq.extend(options, spec); - log = options.log; - if (!qq.supportedFeatures.imagePreviews) { - options.limits.timeBetweenThumbs = 0; - options.limits.maxThumbs = 0; - } - container = options.containerEl; - showThumbnails = options.imageGenerator !== undefined; - templateDom = parseAndGetTemplate(); - cacheThumbnailPlaceholders(); - qq.extend(this, { - render: function() { - log("Rendering template in DOM."); - generatedThumbnails = 0; - container.appendChild(templateDom.template.cloneNode(true)); - hide(getDropProcessing()); - this.hideTotalProgress(); - fileList = options.fileContainerEl || getTemplateEl(container, selectorClasses.list); - log("Template rendering complete"); - }, - renderFailure: function(message) { - var cantRenderEl = qq.toElement(message); - container.innerHTML = ""; - container.appendChild(cantRenderEl); - }, - reset: function() { - container.innerHTML = ""; - this.render(); - }, - clearFiles: function() { - fileList.innerHTML = ""; - }, - disableCancel: function() { - isCancelDisabled = true; - }, - addFile: function(id, name, prependInfo, hideForever, batch) { - var fileEl = templateDom.fileTemplate.cloneNode(true), fileNameEl = getTemplateEl(fileEl, selectorClasses.file), uploaderEl = getTemplateEl(container, selectorClasses.uploader), fileContainer = batch ? fileBatch.content : fileList, thumb; - if (batch) { - fileBatch.map[id] = fileEl; - } - qq(fileEl).addClass(FILE_CLASS_PREFIX + id); - uploaderEl.removeAttribute(DROPZPONE_TEXT_ATTR); - if (fileNameEl) { - qq(fileNameEl).setText(name); - fileNameEl.setAttribute("title", name); - } - fileEl.setAttribute(FILE_ID_ATTR, id); - if (prependInfo) { - prependFile(fileEl, prependInfo.index, fileContainer); - } else { - fileContainer.appendChild(fileEl); - } - if (hideForever) { - fileEl.style.display = "none"; - qq(fileEl).addClass(HIDDEN_FOREVER_CLASS); - } else { - hide(getProgress(id)); - hide(getSize(id)); - hide(getDelete(id)); - hide(getRetry(id)); - hide(getPause(id)); - hide(getContinue(id)); - if (isCancelDisabled) { - this.hideCancel(id); - } - thumb = getThumbnail(id); - if (thumb && !thumb.src) { - cachedWaitingForThumbnailImg.then(function(waitingImg) { - thumb.src = waitingImg.src; - if (waitingImg.style.maxHeight && waitingImg.style.maxWidth) { - qq(thumb).css({ - maxHeight: waitingImg.style.maxHeight, - maxWidth: waitingImg.style.maxWidth - }); - } - show(thumb); - }); - } - } - }, - addFileToCache: function(id, name, prependInfo, hideForever) { - this.addFile(id, name, prependInfo, hideForever, true); - }, - addCacheToDom: function() { - fileList.appendChild(fileBatch.content); - fileBatch.content = document.createDocumentFragment(); - fileBatch.map = {}; - }, - removeFile: function(id) { - qq(getFile(id)).remove(); - }, - getFileId: function(el) { - var currentNode = el; - if (currentNode) { - while (currentNode.getAttribute(FILE_ID_ATTR) == null) { - currentNode = currentNode.parentNode; - } - return parseInt(currentNode.getAttribute(FILE_ID_ATTR)); - } - }, - getFileList: function() { - return fileList; - }, - markFilenameEditable: function(id) { - var filename = getFilename(id); - filename && qq(filename).addClass(options.classes.editable); - }, - updateFilename: function(id, name) { - var filenameEl = getFilename(id); - if (filenameEl) { - qq(filenameEl).setText(name); - filenameEl.setAttribute("title", name); - } - }, - hideFilename: function(id) { - hide(getFilename(id)); - }, - showFilename: function(id) { - show(getFilename(id)); - }, - isFileName: function(el) { - return qq(el).hasClass(selectorClasses.file); - }, - getButton: function() { - return options.button || getTemplateEl(container, selectorClasses.button); - }, - hideDropProcessing: function() { - hide(getDropProcessing()); - }, - showDropProcessing: function() { - show(getDropProcessing()); - }, - getDropZone: function() { - return getTemplateEl(container, selectorClasses.drop); - }, - isEditFilenamePossible: function() { - return isEditElementsExist; - }, - hideRetry: function(id) { - hide(getRetry(id)); - }, - isRetryPossible: function() { - return isRetryElementExist; - }, - showRetry: function(id) { - show(getRetry(id)); - }, - getFileContainer: function(id) { - return getFile(id); - }, - showEditIcon: function(id) { - var icon = getEditIcon(id); - icon && qq(icon).addClass(options.classes.editable); - }, - isHiddenForever: function(id) { - return qq(getFile(id)).hasClass(HIDDEN_FOREVER_CLASS); - }, - hideEditIcon: function(id) { - var icon = getEditIcon(id); - icon && qq(icon).removeClass(options.classes.editable); - }, - isEditIcon: function(el) { - return qq(el).hasClass(selectorClasses.editNameIcon, true); - }, - getEditInput: function(id) { - return getTemplateEl(getFile(id), selectorClasses.editFilenameInput); - }, - isEditInput: function(el) { - return qq(el).hasClass(selectorClasses.editFilenameInput, true); - }, - updateProgress: function(id, loaded, total) { - var bar = getProgress(id), percent; - if (bar && total > 0) { - percent = Math.round(loaded / total * 100); - if (percent === 100) { - hide(bar); - } else { - show(bar); - } - setProgressBarWidth(id, percent); - } - }, - updateTotalProgress: function(loaded, total) { - this.updateProgress(null, loaded, total); - }, - hideProgress: function(id) { - var bar = getProgress(id); - bar && hide(bar); - }, - hideTotalProgress: function() { - this.hideProgress(); - }, - resetProgress: function(id) { - setProgressBarWidth(id, 0); - this.hideTotalProgress(id); - }, - resetTotalProgress: function() { - this.resetProgress(); - }, - showCancel: function(id) { - if (!isCancelDisabled) { - var cancel = getCancel(id); - cancel && qq(cancel).removeClass(options.classes.hide); - } - }, - hideCancel: function(id) { - hide(getCancel(id)); - }, - isCancel: function(el) { - return qq(el).hasClass(selectorClasses.cancel, true); - }, - allowPause: function(id) { - show(getPause(id)); - hide(getContinue(id)); - }, - uploadPaused: function(id) { - this.setStatusText(id, options.text.paused); - this.allowContinueButton(id); - hide(getSpinner(id)); - }, - hidePause: function(id) { - hide(getPause(id)); - }, - isPause: function(el) { - return qq(el).hasClass(selectorClasses.pause, true); - }, - isContinueButton: function(el) { - return qq(el).hasClass(selectorClasses.continueButton, true); - }, - allowContinueButton: function(id) { - show(getContinue(id)); - hide(getPause(id)); - }, - uploadContinued: function(id) { - this.setStatusText(id, ""); - this.allowPause(id); - show(getSpinner(id)); - }, - showDeleteButton: function(id) { - show(getDelete(id)); - }, - hideDeleteButton: function(id) { - hide(getDelete(id)); - }, - isDeleteButton: function(el) { - return qq(el).hasClass(selectorClasses.deleteButton, true); - }, - isRetry: function(el) { - return qq(el).hasClass(selectorClasses.retry, true); - }, - updateSize: function(id, text) { - var size = getSize(id); - if (size) { - show(size); - qq(size).setText(text); - } - }, - setStatusText: function(id, text) { - var textEl = getTemplateEl(getFile(id), selectorClasses.statusText); - if (textEl) { - if (text == null) { - qq(textEl).clearText(); - } else { - qq(textEl).setText(text); - } - } - }, - hideSpinner: function(id) { - qq(getFile(id)).removeClass(IN_PROGRESS_CLASS); - hide(getSpinner(id)); - }, - showSpinner: function(id) { - qq(getFile(id)).addClass(IN_PROGRESS_CLASS); - show(getSpinner(id)); - }, - generatePreview: function(id, optFileOrBlob, customResizeFunction) { - if (!this.isHiddenForever(id)) { - thumbGenerationQueue.push({ - id: id, - customResizeFunction: customResizeFunction, - optFileOrBlob: optFileOrBlob - }); - !thumbnailQueueMonitorRunning && generateNextQueuedPreview(); - } - }, - updateThumbnail: function(id, thumbnailUrl, showWaitingImg, customResizeFunction) { - if (!this.isHiddenForever(id)) { - thumbGenerationQueue.push({ - customResizeFunction: customResizeFunction, - update: true, - id: id, - thumbnailUrl: thumbnailUrl, - showWaitingImg: showWaitingImg - }); - !thumbnailQueueMonitorRunning && generateNextQueuedPreview(); - } - }, - hasDialog: function(type) { - return qq.supportedFeatures.dialogElement && !!getDialog(type); - }, - showDialog: function(type, message, defaultValue) { - var dialog = getDialog(type), messageEl = getTemplateEl(dialog, selectorClasses.dialogMessage), inputEl = dialog.getElementsByTagName("INPUT")[0], cancelBtn = getTemplateEl(dialog, selectorClasses.dialogCancelButton), okBtn = getTemplateEl(dialog, selectorClasses.dialogOkButton), promise = new qq.Promise(), closeHandler = function() { - cancelBtn.removeEventListener("click", cancelClickHandler); - okBtn && okBtn.removeEventListener("click", okClickHandler); - promise.failure(); - }, cancelClickHandler = function() { - cancelBtn.removeEventListener("click", cancelClickHandler); - dialog.close(); - }, okClickHandler = function() { - dialog.removeEventListener("close", closeHandler); - okBtn.removeEventListener("click", okClickHandler); - dialog.close(); - promise.success(inputEl && inputEl.value); - }; - dialog.addEventListener("close", closeHandler); - cancelBtn.addEventListener("click", cancelClickHandler); - okBtn && okBtn.addEventListener("click", okClickHandler); - if (inputEl) { - inputEl.value = defaultValue; - } - messageEl.textContent = message; - dialog.showModal(); - return promise; - } - }); - }; - qq.UiEventHandler = function(s, protectedApi) { - "use strict"; - var disposer = new qq.DisposeSupport(), spec = { - eventType: "click", - attachTo: null, - onHandled: function(target, event) {} - }; - qq.extend(this, { - addHandler: function(element) { - addHandler(element); - }, - dispose: function() { - disposer.dispose(); - } - }); - function addHandler(element) { - disposer.attach(element, spec.eventType, function(event) { - event = event || window.event; - var target = event.target || event.srcElement; - spec.onHandled(target, event); - }); - } - qq.extend(protectedApi, { - getFileIdFromItem: function(item) { - return item.qqFileId; - }, - getDisposeSupport: function() { - return disposer; - } - }); - qq.extend(spec, s); - if (spec.attachTo) { - addHandler(spec.attachTo); - } - }; - qq.FileButtonsClickHandler = function(s) { - "use strict"; - var inheritedInternalApi = {}, spec = { - templating: null, - log: function(message, lvl) {}, - onDeleteFile: function(fileId) {}, - onCancel: function(fileId) {}, - onRetry: function(fileId) {}, - onPause: function(fileId) {}, - onContinue: function(fileId) {}, - onGetName: function(fileId) {} - }, buttonHandlers = { - cancel: function(id) { - spec.onCancel(id); - }, - retry: function(id) { - spec.onRetry(id); - }, - deleteButton: function(id) { - spec.onDeleteFile(id); - }, - pause: function(id) { - spec.onPause(id); - }, - continueButton: function(id) { - spec.onContinue(id); - } - }; - function examineEvent(target, event) { - qq.each(buttonHandlers, function(buttonType, handler) { - var firstLetterCapButtonType = buttonType.charAt(0).toUpperCase() + buttonType.slice(1), fileId; - if (spec.templating["is" + firstLetterCapButtonType](target)) { - fileId = spec.templating.getFileId(target); - qq.preventDefault(event); - spec.log(qq.format("Detected valid file button click event on file '{}', ID: {}.", spec.onGetName(fileId), fileId)); - handler(fileId); - return false; - } - }); - } - qq.extend(spec, s); - spec.eventType = "click"; - spec.onHandled = examineEvent; - spec.attachTo = spec.templating.getFileList(); - qq.extend(this, new qq.UiEventHandler(spec, inheritedInternalApi)); - }; - qq.FilenameClickHandler = function(s) { - "use strict"; - var inheritedInternalApi = {}, spec = { - templating: null, - log: function(message, lvl) {}, - classes: { - file: "qq-upload-file", - editNameIcon: "qq-edit-filename-icon" - }, - onGetUploadStatus: function(fileId) {}, - onGetName: function(fileId) {} - }; - qq.extend(spec, s); - function examineEvent(target, event) { - if (spec.templating.isFileName(target) || spec.templating.isEditIcon(target)) { - var fileId = spec.templating.getFileId(target), status = spec.onGetUploadStatus(fileId); - if (status === qq.status.SUBMITTED) { - spec.log(qq.format("Detected valid filename click event on file '{}', ID: {}.", spec.onGetName(fileId), fileId)); - qq.preventDefault(event); - inheritedInternalApi.handleFilenameEdit(fileId, target, true); - } - } - } - spec.eventType = "click"; - spec.onHandled = examineEvent; - qq.extend(this, new qq.FilenameEditHandler(spec, inheritedInternalApi)); - }; - qq.FilenameInputFocusInHandler = function(s, inheritedInternalApi) { - "use strict"; - var spec = { - templating: null, - onGetUploadStatus: function(fileId) {}, - log: function(message, lvl) {} - }; - if (!inheritedInternalApi) { - inheritedInternalApi = {}; - } - function handleInputFocus(target, event) { - if (spec.templating.isEditInput(target)) { - var fileId = spec.templating.getFileId(target), status = spec.onGetUploadStatus(fileId); - if (status === qq.status.SUBMITTED) { - spec.log(qq.format("Detected valid filename input focus event on file '{}', ID: {}.", spec.onGetName(fileId), fileId)); - inheritedInternalApi.handleFilenameEdit(fileId, target); - } - } - } - spec.eventType = "focusin"; - spec.onHandled = handleInputFocus; - qq.extend(spec, s); - qq.extend(this, new qq.FilenameEditHandler(spec, inheritedInternalApi)); - }; - qq.FilenameInputFocusHandler = function(spec) { - "use strict"; - spec.eventType = "focus"; - spec.attachTo = null; - qq.extend(this, new qq.FilenameInputFocusInHandler(spec, {})); - }; - qq.FilenameEditHandler = function(s, inheritedInternalApi) { - "use strict"; - var spec = { - templating: null, - log: function(message, lvl) {}, - onGetUploadStatus: function(fileId) {}, - onGetName: function(fileId) {}, - onSetName: function(fileId, newName) {}, - onEditingStatusChange: function(fileId, isEditing) {} - }; - function getFilenameSansExtension(fileId) { - var filenameSansExt = spec.onGetName(fileId), extIdx = filenameSansExt.lastIndexOf("."); - if (extIdx > 0) { - filenameSansExt = filenameSansExt.substr(0, extIdx); - } - return filenameSansExt; - } - function getOriginalExtension(fileId) { - var origName = spec.onGetName(fileId); - return qq.getExtension(origName); - } - function handleNameUpdate(newFilenameInputEl, fileId) { - var newName = newFilenameInputEl.value, origExtension; - if (newName !== undefined && qq.trimStr(newName).length > 0) { - origExtension = getOriginalExtension(fileId); - if (origExtension !== undefined) { - newName = newName + "." + origExtension; - } - spec.onSetName(fileId, newName); - } - spec.onEditingStatusChange(fileId, false); - } - function registerInputBlurHandler(inputEl, fileId) { - inheritedInternalApi.getDisposeSupport().attach(inputEl, "blur", function() { - handleNameUpdate(inputEl, fileId); - }); - } - function registerInputEnterKeyHandler(inputEl, fileId) { - inheritedInternalApi.getDisposeSupport().attach(inputEl, "keyup", function(event) { - var code = event.keyCode || event.which; - if (code === 13) { - handleNameUpdate(inputEl, fileId); - } - }); - } - qq.extend(spec, s); - spec.attachTo = spec.templating.getFileList(); - qq.extend(this, new qq.UiEventHandler(spec, inheritedInternalApi)); - qq.extend(inheritedInternalApi, { - handleFilenameEdit: function(id, target, focusInput) { - var newFilenameInputEl = spec.templating.getEditInput(id); - spec.onEditingStatusChange(id, true); - newFilenameInputEl.value = getFilenameSansExtension(id); - if (focusInput) { - newFilenameInputEl.focus(); - } - registerInputBlurHandler(newFilenameInputEl, id); - registerInputEnterKeyHandler(newFilenameInputEl, id); - } - }); - }; -})(window); -//# sourceMappingURL=jquery.fine-uploader.js.map \ No newline at end of file diff --git a/.svn/pristine/0b/0b2405e14917146b43840e666d08ac6462f6c3c6.svn-base b/.svn/pristine/0b/0b2405e14917146b43840e666d08ac6462f6c3c6.svn-base deleted file mode 100644 index 3594fa8c642e71edc5c9b04b587c7ca5767f4428..0000000000000000000000000000000000000000 --- a/.svn/pristine/0b/0b2405e14917146b43840e666d08ac6462f6c3c6.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -/*! -Chosen, a Select Box Enhancer for jQuery and Prototype -by Patrick Filler for Harvest, http://getharvest.com - -Version 1.8.2 -Full source at https://github.com/harvesthq/chosen -Copyright (c) 2011-2017 Harvest http://getharvest.com - -MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md -This file is generated by `grunt build`, do not edit it by hand. -*/.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);clip:rect(0,0,0,0)}.chosen-container.chosen-with-drop .chosen-drop{clip:auto}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}} diff --git a/.svn/pristine/0f/0f76960d1a0be76bbf07af1e6e41ac38ff8fd741.svn-base b/.svn/pristine/0f/0f76960d1a0be76bbf07af1e6e41ac38ff8fd741.svn-base deleted file mode 100644 index 6e7abb4a44a6cd6dfa896ea35c6aa547a90d3d04..0000000000000000000000000000000000000000 --- a/.svn/pristine/0f/0f76960d1a0be76bbf07af1e6e41ac38ff8fd741.svn-base +++ /dev/null @@ -1,163 +0,0 @@ -field['class'] ) ) ? explode( ' ', $this->field['class'] ) : array();//$this->element_class() - $editor = ( isset( $this->field['editor'] ) ) ? $this->field['editor'] : 'tinymce'; - - echo $this->element_before(); - - if ( $editor == 'tinymce' && isset( $this->field['sub'] ) && $this->field['sub'] ) { - - $classes[] = 'tinymce-js'; - $classes = implode( ' ', $classes ); - - echo ''; - - } elseif ( $editor == 'trumbowyg' ) { - - $classes[] = 'trumbowyg-js'; - $classes = implode( ' ', $classes ); - - echo ''; - - } else { - - $args = array( - 'textarea_rows' => 15, - 'editor_class' => implode( ' ', $classes ), - 'textarea_name' => $this->element_name(), - 'teeny' => false, - // output the minimal editor config used in Press This - 'dfw' => false, - // replace the default fullscreen with DFW (supported on the front-end in WordPress 3.4) - 'tinymce' => true, - // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() - 'quicktags' => true - // load Quicktags, can be used to pass settings directly to Quicktags using an array() - ); - - wp_editor( $this->element_value(), $this->field['id'], $args ); - - } - - echo $this->element_after(); - - } - - public static function enqueue( $args ) { - - if ( isset( $args['field'] ) && isset( $args['field']['editor'] ) && is_array( $args['field']['editor'] ) ) { - - foreach ( $args['field']['editor'] as $editor ) { - - switch ( $editor ) { - - case 'trumbowyg': - - $resources = array( - array( - 'name' => 'trumbowyg', - 'fn' => 'editors/trumbowyg/trumbowyg.min.css', - 'type' => 'style', - 'dependency' => array(), - 'version' => '2.10.0', - 'attr' => 'all', - ), - array( - 'name' => 'trumbowyg-colors', - 'fn' => 'editors/trumbowyg/trumbowyg.colors.min.css', - 'type' => 'style', - 'dependency' => array(), - 'version' => '2.10.0', - 'attr' => 'all', - ), - array( - 'name' => 'trumbowyg-user', - 'fn' => 'editors/trumbowyg/trumbowyg.user.min.css', - 'type' => 'style', - 'dependency' => array(), - 'version' => '2.10.0', - 'attr' => 'all', - ), - array( - 'name' => 'trumbowyg', - 'fn' => 'editors/trumbowyg/trumbowyg.min.js', - 'type' => 'script', - 'dependency' => array( 'jquery' ), - 'version' => '1.8.2', - 'attr' => true, - ), - array( - 'name' => 'trumbowyg-base64', - 'fn' => 'editors/trumbowyg/trumbowyg.base64.min.js', - 'type' => 'script', - 'dependency' => array( 'trumbowyg' ), - 'version' => '1.8.2', - 'attr' => true, - ), - array( - 'name' => 'trumbowyg-colors', - 'fn' => 'editors/trumbowyg/trumbowyg.colors.min.js', - 'type' => 'script', - 'dependency' => array( 'trumbowyg' ), - 'version' => '1.8.2', - 'attr' => true, - ), - array( - 'name' => 'trumbowyg-fontfamily', - 'fn' => 'editors/trumbowyg/trumbowyg.fontfamily.min.js', - 'type' => 'script', - 'dependency' => array( 'trumbowyg' ), - 'version' => '1.8.2', - 'attr' => true, - ), - array( - 'name' => 'trumbowyg-fontsize', - 'fn' => 'editors/trumbowyg/trumbowyg.fontsize.min.js', - 'type' => 'script', - 'dependency' => array( 'trumbowyg' ), - 'version' => '1.8.2', - 'attr' => true, - ), - array( - 'name' => 'exopite-sof-trumbowyg-loader', - 'fn' => 'loader-jquery-trumbowyg.min.js', - 'type' => 'script', - 'dependency' => array( 'trumbowyg' ), - 'version' => '', - 'attr' => true, - ), - - ); - - parent::do_enqueue( $resources, $args ); - - break; - - } - - } - - } - - - } - - } - -} diff --git a/.svn/pristine/0f/0f794ee6557b5b69db9547db823051eb389c4d44.svn-base b/.svn/pristine/0f/0f794ee6557b5b69db9547db823051eb389c4d44.svn-base deleted file mode 100644 index c524bb043f042002b2c6a2ce00254ca5b222824d..0000000000000000000000000000000000000000 --- a/.svn/pristine/0f/0f794ee6557b5b69db9547db823051eb389c4d44.svn-base +++ /dev/null @@ -1,95 +0,0 @@ - -/** - * Exopite Simple Options Framework Trumbowyg - */ -; (function ($, window, document, undefined) { - - var pluginName = "exopiteSOFColorpicker"; - - // The actual plugin constructor - function Plugin(element, options) { - - this.element = element; - this._name = pluginName; - this.$element = $(element); - this.init(); - - } - - Plugin.prototype = { - - init: function () { - - var plugin = this; - - plugin.$element.find('.colorpicker').each(function (index, el) { - - if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return; - if ($(el).hasClass('disabled')) return; - - $(el).wpColorPicker({ - /** - * @param {Event} event - standard jQuery event, produced by whichever - * control was changed. - * @param {Object} ui - standard jQuery UI object, with a color member - * containing a Color.js object. - */ - change: function (event, ui) { - plugin.change(event, ui, $(this)); - }, - }); - - }); - - plugin.$element.closest('.exopite-sof-wrapper').on('exopite-sof-field-group-item-added-after', function (event, $cloned) { - - $cloned.find('.colorpicker').each(function (index, el) { - - if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return; - if ($(el).hasClass('disabled')) return; - - $(el).wpColorPicker({ - change: function (event, ui) { - plugin.change(event, ui, $(this)); - }, - }); - - }); - - console.log('color picker clone'); - - }); - - }, - - change: function (event, ui, $this) { - var color = ui.color.toString(); - if ($this.hasClass('font-color-js')) { - console.log('has font-color'); - $this.parents('.exopite-sof-font-field').find('.exopite-sof-font-preview').css({ 'color': color }); - } - }, - - }; - - $.fn[pluginName] = function (options) { - return this.each(function () { - if (!$.data(this, "plugin_" + pluginName)) { - $.data(this, "plugin_" + pluginName, - new Plugin(this, options)); - } - }); - }; - -})(jQuery, window, document); - -; (function ($) { - "use strict"; - - $(document).ready(function () { - - $('.exopite-sof-field').exopiteSOFColorpicker(); - - }); - -}(jQuery)); diff --git a/.svn/pristine/11/1113cfe279e33326fc1e1ed8ebada003943f7b6a.svn-base b/.svn/pristine/11/1113cfe279e33326fc1e1ed8ebada003943f7b6a.svn-base deleted file mode 100644 index 51afa2310513a2e82087aeffd14f4a3a7efed7db..0000000000000000000000000000000000000000 --- a/.svn/pristine/11/1113cfe279e33326fc1e1ed8ebada003943f7b6a.svn-base +++ /dev/null @@ -1,304 +0,0 @@ - -'; - -} - -if (version_compare(PHP_VERSION, '5.6.0', '<=') ) -{ - - echo '-'; - -} -?> -提示:php版本小于5.6.0, 插件程序将无法正常使用,当前系统的php版本是:'.PHP_VERSION.'
-