From 06b5ecde7984e87024ad3b8dcfadcf7b257370a5 Mon Sep 17 00:00:00 2001 From: jtkech Date: Thu, 13 Aug 2020 22:34:32 +0200 Subject: [PATCH] Media root folder selected by default --- .../Assets/js/MediaApp/app.js | 7 +- .../wwwroot/Scripts/media.js | 326 +++++++++--------- .../wwwroot/Scripts/media.min.js | 2 +- 3 files changed, 173 insertions(+), 162 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Assets/js/MediaApp/app.js b/src/OrchardCore.Modules/OrchardCore.Media/Assets/js/MediaApp/app.js index 6d0947e31aa..e7c886337c4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Assets/js/MediaApp/app.js +++ b/src/OrchardCore.Modules/OrchardCore.Media/Assets/js/MediaApp/app.js @@ -32,7 +32,7 @@ function initializeMediaApplication(displayMediaApplication, mediaApplicationUrl mediaApp = new Vue({ el: '#mediaApp', data: { - selectedFolder: root, + selectedFolder: {}, mediaItems: [], selectedMedias: [], errors: [], @@ -118,6 +118,11 @@ function initializeMediaApplication(displayMediaApplication, mediaApplicationUrl self.selectedMedias = []; }); + if (!localStorage.getItem('mediaApplicationPrefs')) { + self.selectedFolder = root + return; + } + self.currentPrefs = JSON.parse(localStorage.getItem('mediaApplicationPrefs')); }, computed: { diff --git a/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.js b/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.js index 141fab9264a..642361362e8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.js +++ b/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.js @@ -39,7 +39,7 @@ function initializeMediaApplication(displayMediaApplication, mediaApplicationUrl mediaApp = new Vue({ el: '#mediaApp', data: { - selectedFolder: _root, + selectedFolder: {}, mediaItems: [], selectedMedias: [], errors: [], @@ -108,6 +108,12 @@ function initializeMediaApplication(displayMediaApplication, mediaApplicationUrl self.itemsInPage = itemsInPage; self.selectedMedias = []; }); + + if (!localStorage.getItem('mediaApplicationPrefs')) { + self.selectedFolder = _root; + return; + } + self.currentPrefs = JSON.parse(localStorage.getItem('mediaApplicationPrefs')); }, computed: { @@ -947,165 +953,6 @@ Vue.component('sortIndicator', { } } }); -// component -Vue.component('upload', { - template: '\ -
\ - \ -

{{ model.name }}

\ -
\ - \ - Error: {{ model.errorMessage }} \ -
\ -
\ - ', - props: { - model: Object - }, - mounted: function mounted() { - var self = this; - $('#fileupload').bind('fileuploadprogress', function (e, data) { - if (data.files[0].name !== self.model.name) { - return; - } - - self.model.percentage = parseInt(data.loaded / data.total * 100, 10); - }); - $('#fileupload').bind('fileuploaddone', function (e, data) { - if (data.files[0].name !== self.model.name) { - return; - } - - if (data.result.files[0].error) { - self.handleFailure(data.files[0].name, data.result.files[0].error); - } else { - bus.$emit('removalRequest', self.model); - } - }); - $('#fileupload').bind('fileuploadfail', function (e, data) { - if (data.files[0].name !== self.model.name) { - return; - } - - self.handleFailure(data.files[0].name, data.textStatus); - }); - }, - methods: { - handleFailure: function handleFailure(fileName, message) { - if (fileName !== this.model.name) { - return; - } - - this.model.errorMessage = message; - bus.$emit('ErrorOnUpload', this.model); - }, - dismissWarning: function dismissWarning() { - bus.$emit('removalRequest', this.model); - } - } -}); -// component -Vue.component('uploadList', { - template: '\ -
\ -
\ - {{ T.uploads }} \ - (Pending: {{ pendingCount }}) \ - ( {{ T.errors }}: {{ errorCount }} / {{ T.clearErrors }} ) \ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
\ -
\ -
\ - \ -
\ -
\ -
\ - ', - data: function data() { - return { - files: [], - T: {}, - expanded: false, - pendingCount: 0, - errorCount: 0 - }; - }, - created: function created() { - var self = this; // retrieving localized strings from view - - self.T.uploads = $('#t-uploads').val(); - self.T.errors = $('#t-errors').val(); - self.T.clearErrors = $('#t-clear-errors').val(); - }, - computed: { - fileCount: function fileCount() { - return this.files.length; - } - }, - mounted: function mounted() { - var self = this; - $('#fileupload').bind('fileuploadadd', function (e, data) { - if (!data.files) { - return; - } - - data.files.forEach(function (newFile) { - var alreadyInList = self.files.some(function (f) { - return f.name == newFile.name; - }); - - if (!alreadyInList) { - self.files.push({ - name: newFile.name, - percentage: 0, - errorMessage: '' - }); - } else { - console.error('A file with the same name is already on the queue:' + newFile.name); - } - }); - }); - bus.$on('removalRequest', function (fileUpload) { - self.files.forEach(function (item, index, array) { - if (item.name == fileUpload.name) { - array.splice(index, 1); - } - }); - }); - bus.$on('ErrorOnUpload', function (fileUpload) { - self.updateCount(); - }); - }, - methods: { - updateCount: function updateCount() { - this.errorCount = this.files.filter(function (item) { - return item.errorMessage != ''; - }).length; - this.pendingCount = this.files.length - this.errorCount; - - if (this.files.length < 1) { - this.expanded = false; - } - }, - clearErrors: function clearErrors() { - this.files = this.files.filter(function (item) { - return item.errorMessage == ''; - }); - } - }, - watch: { - files: function files() { - this.updateCount(); - } - } -}); function initializeAttachedMediaField(el, idOfUploadButton, uploadAction, mediaItemUrl, allowMultiple, tempUploadFolder) { var target = $(document.getElementById($(el).data('for'))); var initialPaths = target.data("init"); @@ -1631,6 +1478,165 @@ Vue.component('mediaFieldThumbsContainer', { } } }); +// component +Vue.component('upload', { + template: '\ +
\ + \ +

{{ model.name }}

\ +
\ + \ + Error: {{ model.errorMessage }} \ +
\ +
\ + ', + props: { + model: Object + }, + mounted: function mounted() { + var self = this; + $('#fileupload').bind('fileuploadprogress', function (e, data) { + if (data.files[0].name !== self.model.name) { + return; + } + + self.model.percentage = parseInt(data.loaded / data.total * 100, 10); + }); + $('#fileupload').bind('fileuploaddone', function (e, data) { + if (data.files[0].name !== self.model.name) { + return; + } + + if (data.result.files[0].error) { + self.handleFailure(data.files[0].name, data.result.files[0].error); + } else { + bus.$emit('removalRequest', self.model); + } + }); + $('#fileupload').bind('fileuploadfail', function (e, data) { + if (data.files[0].name !== self.model.name) { + return; + } + + self.handleFailure(data.files[0].name, data.textStatus); + }); + }, + methods: { + handleFailure: function handleFailure(fileName, message) { + if (fileName !== this.model.name) { + return; + } + + this.model.errorMessage = message; + bus.$emit('ErrorOnUpload', this.model); + }, + dismissWarning: function dismissWarning() { + bus.$emit('removalRequest', this.model); + } + } +}); +// component +Vue.component('uploadList', { + template: '\ +
\ +
\ + {{ T.uploads }} \ + (Pending: {{ pendingCount }}) \ + ( {{ T.errors }}: {{ errorCount }} / {{ T.clearErrors }} ) \ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
\ +
\ +
\ + \ +
\ +
\ +
\ + ', + data: function data() { + return { + files: [], + T: {}, + expanded: false, + pendingCount: 0, + errorCount: 0 + }; + }, + created: function created() { + var self = this; // retrieving localized strings from view + + self.T.uploads = $('#t-uploads').val(); + self.T.errors = $('#t-errors').val(); + self.T.clearErrors = $('#t-clear-errors').val(); + }, + computed: { + fileCount: function fileCount() { + return this.files.length; + } + }, + mounted: function mounted() { + var self = this; + $('#fileupload').bind('fileuploadadd', function (e, data) { + if (!data.files) { + return; + } + + data.files.forEach(function (newFile) { + var alreadyInList = self.files.some(function (f) { + return f.name == newFile.name; + }); + + if (!alreadyInList) { + self.files.push({ + name: newFile.name, + percentage: 0, + errorMessage: '' + }); + } else { + console.error('A file with the same name is already on the queue:' + newFile.name); + } + }); + }); + bus.$on('removalRequest', function (fileUpload) { + self.files.forEach(function (item, index, array) { + if (item.name == fileUpload.name) { + array.splice(index, 1); + } + }); + }); + bus.$on('ErrorOnUpload', function (fileUpload) { + self.updateCount(); + }); + }, + methods: { + updateCount: function updateCount() { + this.errorCount = this.files.filter(function (item) { + return item.errorMessage != ''; + }).length; + this.pendingCount = this.files.length - this.errorCount; + + if (this.files.length < 1) { + this.expanded = false; + } + }, + clearErrors: function clearErrors() { + this.files = this.files.filter(function (item) { + return item.errorMessage == ''; + }); + } + }, + watch: { + files: function files() { + this.updateCount(); + } + } +}); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /* diff --git a/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.min.js b/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.min.js index cdc33973c89..542b76e3d76 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.min.js +++ b/src/OrchardCore.Modules/OrchardCore.Media/wwwroot/Scripts/media.min.js @@ -1 +1 @@ -function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(e){for(var t=1;t-1}));switch(e.sortBy){case"size":t.sort((function(t,i){return e.sortAsc?t.size-i.size:i.size-t.size}));break;case"mime":t.sort((function(t,i){return e.sortAsc?t.mime.toLowerCase().localeCompare(i.mime.toLowerCase()):i.mime.toLowerCase().localeCompare(t.mime.toLowerCase())}));break;case"lastModify":t.sort((function(t,i){return e.sortAsc?t.lastModify-i.lastModify:i.lastModify-t.lastModify}));break;default:t.sort((function(t,i){return e.sortAsc?t.name.toLowerCase().localeCompare(i.name.toLowerCase()):i.name.toLowerCase().localeCompare(t.name.toLowerCase())}))}return t},hiddenCount:function(){return this.mediaItems.length-this.filteredMediaItems.length},thumbSize:function(){return this.smallThumbs?100:240},currentPrefs:{get:function(){return{smallThumbs:this.smallThumbs,selectedFolder:this.selectedFolder,gridView:this.gridView}},set:function(e){e&&(this.smallThumbs=e.smallThumbs,this.selectedFolder=e.selectedFolder,this.gridView=e.gridView)}}},watch:{currentPrefs:function(e){localStorage.setItem("mediaApplicationPrefs",JSON.stringify(e))},selectedFolder:function(e){this.mediaFilter="",this.selectedFolder=e,this.loadFolder(e)}},mounted:function(){this.$refs.rootFolder.toggle()},methods:{uploadUrl:function(){return this.selectedFolder?$("#uploadFiles").val()+"?path="+encodeURIComponent(this.selectedFolder.path):null},selectRoot:function(){this.selectedFolder=this.root},loadFolder:function(e){this.errors=[],this.selectedMedias=[];var t=this;$.ajax({url:$("#getMediaItemsUrl").val()+"?path="+encodeURIComponent(e.path),method:"GET",success:function(e){e.forEach((function(e){e.open=!1})),t.mediaItems=e,t.selectedMedias=[],t.sortBy="",t.sortAsc=!0},error:function(i){console.log("error loading folder:"+e.path),t.selectRoot()}})},selectAll:function(){this.selectedMedias=[];for(var e=0;e-1&&(t.mediaItems.splice(n,1),bus.$emit("mediaDeleted",t.selectedMedias[i]))}t.selectedMedias=[]},error:function(e){console.error(e.responseText)}})}}}))},deleteMediaItem:function(e){var t=this;e&&confirmDialog(_objectSpread(_objectSpread({},$("#deleteMedia").data()),{},{callback:function(i){i&&$.ajax({url:$("#deleteMediaUrl").val()+"?path="+encodeURIComponent(e.mediaPath),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val()},success:function(i){var n=t.mediaItems&&t.mediaItems.indexOf(e);n>-1&&(t.mediaItems.splice(n,1),bus.$emit("mediaDeleted",e))},error:function(e){console.error(e.responseText)}})}}))},handleDragStart:function(e,t){var i=[];this.selectedMedias.forEach((function(e){i.push(e.name)})),0==this.isMediaSelected(e)&&(i.push(e.name),this.selectedMedias.push(e)),t.dataTransfer.setData("mediaNames",JSON.stringify(i)),t.dataTransfer.setData("sourceFolder",this.selectedFolder.path),t.dataTransfer.setDragImage(this.dragDropThumbnail,10,10),t.dataTransfer.effectAllowed="move"},handleScrollWhileDrag:function(e){e.clientY<150&&window.scrollBy(0,-10),e.clientY>window.innerHeight-100&&window.scrollBy(0,10)},changeSort:function(e){this.sortBy==e?this.sortAsc=!this.sortAsc:(this.sortAsc=!0,this.sortBy=e)}}}),$("#create-folder-name").keypress((function(e){if(13==e.which)return $("#modalFooterOk").click(),!1})),$("#modalFooterOk").on("click",(function(e){var t=$("#create-folder-name").val();""!==t&&$.ajax({url:$("#createFolderUrl").val()+"?path="+encodeURIComponent(mediaApp.selectedFolder.path)+"&name="+encodeURIComponent(t),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val()},success:function(e){bus.$emit("addFolder",mediaApp.selectedFolder,e),$("#createFolderModal").modal("hide")},error:function(e){$("#createFolderModal-errors").empty();var t=JSON.parse(e.responseText).value;$('').text(t).appendTo($("#createFolderModal-errors"))}})})),$("#renameMediaModalFooterOk").on("click",(function(e){var t=$("#new-item-name").val(),i=$("#old-item-name").val();if(""!==t){var n=mediaApp.selectedFolder.path+"/";"/"===n&&(n="");var a=n+t,r=n+i;a.toLowerCase()!==r.toLowerCase()?$.ajax({url:$("#renameMediaUrl").val()+"?oldPath="+encodeURIComponent(r)+"&newPath="+encodeURIComponent(a),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val()},success:function(e){$("#renameMediaModal").modal("hide"),bus.$emit("mediaRenamed",t,a,r)},error:function(e){$("#renameMediaModal-errors").empty();var t=JSON.parse(e.responseText).value;$('').text(t).appendTo($("#renameMediaModal-errors"))}}):$("#renameMediaModal").modal("hide")}})),e&&(document.getElementById("mediaApp").style.display=""),$(document).trigger("mediaApp:ready")},error:function(e){console.error(e.responseText)}}))}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(e){for(var t=1;t0&&a},thumbSize:function(){return this.smallThumbs?120:240},currentPrefs:{get:function(){return{smallThumbs:this.smallThumbs}},set:function(e){e&&(this.smallThumbs=e.smallThumbs)}}},mounted:function(){var e=this;e.paths=s,e.$on("selectAndDeleteMediaRequested",(function(t){e.selectAndDeleteMedia(t)})),e.$on("selectMediaRequested",(function(t){e.selectMedia(t)}));var n="#"+t,d=l.attr("id");$(n).fileupload({limitConcurrentUploads:20,dropZone:$("#"+d),dataType:"json",url:i,add:function(t,i){var n,a=i.files.length;for(n=0;n0)for(var r=0;r1&&!1===a?(alert($("#onlyOneItemMessage").val()),o.mediaItems.push(i[0]),o.initialized=!0):(o.mediaItems=o.mediaItems.concat(i),o.initialized=!0):alert(n)},error:function(e,t,i){console.log("error on upload!!"),console.log(e),console.log(t),console.log(i)}})},methods:{selectMedia:function(e){this.selectedMedia=e},getUniqueId:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},removeSelected:function(e){if(this.selectedMedia){var t=this.mediaItems&&this.mediaItems.indexOf(this.selectedMedia);t>-1&&(this.mediaItems[t].isRemoved=!0,this.mediaItems.splice(t,1))}else 1===this.mediaItems.length&&(this.mediaItems[t].isRemoved=!0,this.mediaItems.splice(0,1));this.selectedMedia=null},selectAndDeleteMedia:function(e){var t=this;t.selectedMedia=e,setTimeout((function(){t.removeSelected()}),100)}},watch:{mediaItems:function(){setTimeout((function(){$(document).trigger("contentpreview:render")}),100)},currentPrefs:function(e){localStorage.setItem("mediaFieldPrefs",JSON.stringify(e))}}}))}function initializeMediaField(e,t,i,n){var a,r=$(document.getElementById($(e).data("for"))).data("init"),o=$(e),s=o.attr("id");mediaFieldApps.push(a=new Vue({el:o.get(0),data:{mediaItems:[],selectedMedia:null,smallThumbs:!1,idPrefix:s,initialized:!1},created:function(){this.currentPrefs=JSON.parse(localStorage.getItem("mediaFieldPrefs"))},computed:{paths:{get:function(){var e=[];return this.initialized?(this.mediaItems.forEach((function(t){"not-found"!==t.mediaPath&&e.push({Path:t.mediaPath})})),JSON.stringify(e)):JSON.stringify(r)},set:function(e){var t=this,n=e||[],a=$.Deferred(),r=[],o=0;n.forEach((function(e,n){r.push({name:" "+e.Path,mime:"",mediaPath:""}),promise=$.when(a).done((function(){$.ajax({url:i+"?path="+encodeURIComponent(e.Path),method:"GET",success:function(e){e.vuekey=e.name+n.toString(),r.splice(n,1,e),r.length===++o&&(r.forEach((function(e){t.mediaItems.push(e)})),t.initialized=!0)},error:function(i){console.log(i),r.splice(n,1,{name:e.Path,mime:"",mediaPath:"not-found"}),r.length===++o&&(r.forEach((function(e){t.mediaItems.push(e)})),t.initialized=!0)}})}))})),a.resolve()}},fileSize:function(){return Math.round(this.selectedMedia.size/1024)},canAddMedia:function(){return 0===this.mediaItems.length||this.mediaItems.length>0&&n},thumbSize:function(){return this.smallThumbs?120:240},currentPrefs:{get:function(){return{smallThumbs:this.smallThumbs}},set:function(e){e&&(this.smallThumbs=e.smallThumbs)}}},mounted:function(){var e=this;e.paths=r,e.$on("selectAndDeleteMediaRequested",(function(t){e.selectAndDeleteMedia(t)})),e.$on("selectMediaRequested",(function(t){e.selectMedia(t)})),e.$on("filesUploaded",(function(t){e.addMediaFiles(t)}))},methods:{selectMedia:function(e){this.selectedMedia=e},showModal:function(e){var i=this;if(i.canAddMedia){$("#mediaApp").detach().appendTo($(t).find(".modal-body")),$("#mediaApp").show();var n=$(t).modal();$(t).find(".mediaFieldSelectButton").off("click").on("click",(function(e){return i.addMediaFiles(mediaApp.selectedMedias),mediaApp.selectedMedias=[],n.modal("hide"),!0}))}},addMediaFiles:function(e){e.length>1&&!1===n?(alert($("#onlyOneItemMessage").val()),a.mediaItems.push(e[0]),a.initialized=!0):(a.mediaItems=a.mediaItems.concat(e),a.initialized=!0)},removeSelected:function(e){if(this.selectedMedia){var t=this.mediaItems&&this.mediaItems.indexOf(this.selectedMedia);t>-1&&this.mediaItems.splice(t,1)}else 1===this.mediaItems.length&&this.mediaItems.splice(0,1);this.selectedMedia=null},selectAndDeleteMedia:function(e){var t=this;t.selectedMedia=e,setTimeout((function(){t.removeSelected()}),100)}},watch:{mediaItems:function(){setTimeout((function(){$(document).trigger("contentpreview:render")}),100)},currentPrefs:function(e){localStorage.setItem("mediaFieldPrefs",JSON.stringify(e))}}}))}$(document).on("mediaApp:ready",(function(){$("#fileupload").fileupload({dropZone:$("#mediaApp"),limitConcurrentUploads:20,dataType:"json",url:$("#uploadFiles").val(),formData:function(){var e=$("input[name=__RequestVerificationToken]").val();return[{name:"path",value:mediaApp.selectedFolder.path},{name:"__RequestVerificationToken",value:e}]},done:function(e,t){$.each(t.result.files,(function(e,t){t.error||mediaApp.mediaItems.push(t)}))}})})),$(document).bind("dragover",(function(e){var t=e.originalEvent.dataTransfer;if(t.types&&(t.types.indexOf?-1!=t.types.indexOf("Files"):t.types.contains("Files"))){var i=$("#customdropzone"),n=window.dropZoneTimeout;n?clearTimeout(n):i.addClass("in");$(e.target).closest(i);window.dropZoneTimeout=setTimeout((function(){window.dropZoneTimeout=null,i.removeClass("in")}),100)}})),Vue.component("folder",{template:'\n
  • \n \n
      \n \n \n
    \n
  • \n '),props:{model:Object,selectedInMediaApp:Object,level:Number},data:function(){return{open:!1,children:null,parent:null,isHovered:!1,padding:0}},computed:{empty:function(){return!this.children||0==this.children.length},isSelected:function(){return this.selectedInMediaApp.name==this.model.name&&this.selectedInMediaApp.path==this.model.path},isRoot:function(){return""===this.model.path}},mounted:function(){0==this.isRoot&&this.isAncestorOfSelectedFolder()&&this.toggle(),this.padding=this.level<3?26:26+8*this.level},created:function(){var e=this;bus.$on("deleteFolder",(function(t){if(e.children){var i=e.children&&e.children.indexOf(t);i>-1&&(e.children.splice(i,1),bus.$emit("folderDeleted"))}})),bus.$on("addFolder",(function(t,i){e.model==t&&(bus.$emit("beforeFolderAdded",e.model),null!==e.children&&e.children.push(i),i.parent=e.model,bus.$emit("folderAdded",i))}))},methods:{isAncestorOfSelectedFolder:function(){for(parentFolder=mediaApp.selectedFolder;parentFolder;){if(parentFolder.path==this.model.path)return!0;parentFolder=parentFolder.parent}return!1},toggle:function(){this.open=!this.open,this.open&&!this.children&&this.loadChildren()},select:function(){bus.$emit("folderSelected",this.model),this.loadChildren()},createFolder:function(){bus.$emit("createFolderRequested")},deleteFolder:function(){bus.$emit("deleteFolderRequested")},loadChildren:function(){var e=this;0==this.open&&(this.open=!0),$.ajax({url:$("#getFoldersUrl").val()+"?path="+encodeURIComponent(e.model.path),method:"GET",success:function(t){e.children=t,e.children.forEach((function(t){t.parent=e.model}))},error:function(e){emtpy=!1,console.error(e.responseText)}})},handleDragOver:function(e){this.isHovered=!0},handleDragLeave:function(e){this.isHovered=!1},moveMediaToFolder:function(e,t){this.isHovered=!1;var i=JSON.parse(t.dataTransfer.getData("mediaNames"));if(!(i.length<1)){var n=t.dataTransfer.getData("sourceFolder"),a=e.path;""===n&&(n="root"),""===a&&(a="root"),n!==a?confirmDialog(_objectSpread(_objectSpread({},$("#moveMedia").data()),{},{callback:function(e){e&&$.ajax({url:$("#moveMediaListUrl").val(),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val(),mediaNames:i,sourceFolder:n,targetFolder:a},success:function(){bus.$emit("mediaListMoved")},error:function(e){console.error(e.responseText),bus.$emit("mediaListMoved",e.responseText)}})}})):alert($("#sameFolderMessage").val())}}}}),Vue.component("media-items-grid",{template:'\n
      \n
    1. \n
      \n \n \n
      \n
      \n \n \n \n {{ media.name }}\n
      \n
    2. \n
    \n ',data:function(){return{T:{}}},props:{filteredMediaItems:Array,selectedMedias:Array,thumbSize:Number},created:function(){this.T.editButton=$("#t-edit-button").val(),this.T.deleteButton=$("#t-delete-button").val()},methods:{isMediaSelected:function(e){return this.selectedMedias.some((function(t,i,n){return t.url.toLowerCase()===e.url.toLowerCase()}))},buildMediaUrl:function(e,t){return e+(-1==e.indexOf("?")?"?":"&")+"width="+t+"&height="+t},toggleSelectionOfMedia:function(e){bus.$emit("mediaToggleRequested",e)},renameMedia:function(e){bus.$emit("renameMediaRequested",e)},deleteMedia:function(e){bus.$emit("deleteMediaRequested",e)},dragStart:function(e,t){bus.$emit("mediaDragStartRequested",e,t)}}}),Vue.component("media-items-table",{template:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{ T.imageHeader }}\n {{ T.nameHeader }}\n \n \n {{ T.lastModifyHeader }} \n \n \n \n {{ T.sizeHeader }}\n \n \n \n \n {{ T.typeHeader }}\n \n \n
    \n
    \n \n \n
    \n
    \n \n \n
    {{ printDateTime(media.lastModify) }}
    \n
    \n
    {{ isNaN(media.size)? 0 : Math.round(media.size / 1024) }} KB
    \n
    \n
    {{ media.mime }}
    \n
    \n ',data:function(){return{T:{}}},props:{sortBy:String,sortAsc:Boolean,filteredMediaItems:Array,selectedMedias:Array,thumbSize:Number},created:function(){this.T.imageHeader=$("#t-image-header").val(),this.T.nameHeader=$("#t-name-header").val(),this.T.lastModifyHeader=$("#t-lastModify-header").val(),this.T.sizeHeader=$("#t-size-header").val(),this.T.typeHeader=$("#t-type-header").val(),this.T.editButton=$("#t-edit-button").val(),this.T.deleteButton=$("#t-delete-button").val(),this.T.viewButton=$("#t-view-button").val()},methods:{isMediaSelected:function(e){return this.selectedMedias.some((function(t,i,n){return t.url.toLowerCase()===e.url.toLowerCase()}))},buildMediaUrl:function(e,t){return e+(-1==e.indexOf("?")?"?":"&")+"width="+t+"&height="+t},changeSort:function(e){bus.$emit("sortChangeRequested",e)},toggleSelectionOfMedia:function(e){bus.$emit("mediaToggleRequested",e)},renameMedia:function(e){bus.$emit("renameMediaRequested",e)},deleteMedia:function(e){bus.$emit("deleteMediaRequested",e)},dragStart:function(e,t){bus.$emit("mediaDragStartRequested",e,t)},printDateTime:function(e){return new Date(e).toLocaleString()}}}),Vue.component("pager",{template:'\n \n ',props:{sourceItems:Array},data:function(){return{pageSize:10,pageSizeOptions:[10,30,50,100],current:0,T:{}}},created:function(){this.T.pagerFirstButton=$("#t-pager-first-button").val(),this.T.pagerPreviousButton=$("#t-pager-previous-button").val(),this.T.pagerNextButton=$("#t-pager-next-button").val(),this.T.pagerLastButton=$("#t-pager-last-button").val(),this.T.pagerPageSizeLabel=$("#t-pager-page-size-label").val(),this.T.pagerPageLabel=$("#t-pager-page-label").val(),this.T.pagerTotalLabel=$("#t-pager-total-label").val()},methods:{next:function(){this.current=this.current+1},previous:function(){this.current=this.current-1},goFirst:function(){this.current=0},goLast:function(){this.current=this.totalPages-1},goTo:function(e){this.current=e}},computed:{total:function(){return this.sourceItems?this.sourceItems.length:0},totalPages:function(){var e=Math.ceil(this.total/this.pageSize);return e>0?e:1},isLastPage:function(){return this.current+1>=this.totalPages},isFirstPage:function(){return 0===this.current},canDoNext:function(){return!this.isLastPage},canDoPrev:function(){return!this.isFirstPage},canDoFirst:function(){return!this.isFirstPage},canDoLast:function(){return!this.isLastPage},itemsInCurrentPage:function(){var e=this.pageSize*this.current,t=e+this.pageSize,i=this.sourceItems.slice(e,t);return bus.$emit("pagerEvent",i),i},pageLinks:function(){var e=[];e.push(this.current+1);var t=this.current>0?this.current:-1;e.unshift(t);var i=this.current>1?this.current-1:-1;e.unshift(i);var n=this.totalPages-this.current>1?this.current+2:-1;e.push(n);var a=this.totalPages-this.current>2?this.current+3:-1;return e.push(a),e}},watch:{sourceItems:function(){this.current=0},pageSize:function(){this.current=0}}}),Vue.component("sortIndicator",{template:'\n
    \n \n \n
    \n ',props:{colname:String,selectedcolname:String,asc:Boolean},computed:{isActive:function(){return this.colname.toLowerCase()==this.selectedcolname.toLowerCase()}}}),Vue.component("upload",{template:'

    {{ model.name }}

    Error: {{ model.errorMessage }}
    ',props:{model:Object},mounted:function(){var e=this;$("#fileupload").bind("fileuploadprogress",(function(t,i){i.files[0].name===e.model.name&&(e.model.percentage=parseInt(i.loaded/i.total*100,10))})),$("#fileupload").bind("fileuploaddone",(function(t,i){i.files[0].name===e.model.name&&(i.result.files[0].error?e.handleFailure(i.files[0].name,i.result.files[0].error):bus.$emit("removalRequest",e.model))})),$("#fileupload").bind("fileuploadfail",(function(t,i){i.files[0].name===e.model.name&&e.handleFailure(i.files[0].name,i.textStatus)}))},methods:{handleFailure:function(e,t){e===this.model.name&&(this.model.errorMessage=t,bus.$emit("ErrorOnUpload",this.model))},dismissWarning:function(){bus.$emit("removalRequest",this.model)}}}),Vue.component("uploadList",{template:'
    {{ T.uploads }} (Pending: {{ pendingCount }}) ( {{ T.errors }}: {{ errorCount }} / {{ T.clearErrors }} )
    ',data:function(){return{files:[],T:{},expanded:!1,pendingCount:0,errorCount:0}},created:function(){this.T.uploads=$("#t-uploads").val(),this.T.errors=$("#t-errors").val(),this.T.clearErrors=$("#t-clear-errors").val()},computed:{fileCount:function(){return this.files.length}},mounted:function(){var e=this;$("#fileupload").bind("fileuploadadd",(function(t,i){i.files&&i.files.forEach((function(t){e.files.some((function(e){return e.name==t.name}))?console.error("A file with the same name is already on the queue:"+t.name):e.files.push({name:t.name,percentage:0,errorMessage:""})}))})),bus.$on("removalRequest",(function(t){e.files.forEach((function(e,i,n){e.name==t.name&&n.splice(i,1)}))})),bus.$on("ErrorOnUpload",(function(t){e.updateCount()}))},methods:{updateCount:function(){this.errorCount=this.files.filter((function(e){return""!=e.errorMessage})).length,this.pendingCount=this.files.length-this.errorCount,this.files.length<1&&(this.expanded=!1)},clearErrors:function(){this.files=this.files.filter((function(e){return""==e.errorMessage}))}},watch:{files:function(){this.updateCount()}}});var mediaFieldApps=[];function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Vue.component("mediaFieldThumbsContainer",{template:'
    {{T.noImages}}
  • {{ media.isNew ? media.name.substr(36) : media.name }}
    {{ T.mediaNotFound }} {{ T.discardWarning }}
    {{ media.name }}
  • ',data:function(){return{T:{}}},props:{mediaItems:Array,selectedMedia:Object,thumbSize:Number,idPrefix:String},created:function(){this.T.mediaNotFound=$("#t-media-not-found").val(),this.T.discardWarning=$("#t-discard-warning").val(),this.T.noImages=$("#t-no-images").val()},methods:{selectAndDeleteMedia:function(e){this.$parent.$emit("selectAndDeleteMediaRequested",e)},selectMedia:function(e){this.$parent.$emit("selectMediaRequested",e)},buildMediaUrl:function(e,t){return e+(-1==e.indexOf("?")?"?":"&")+"width="+t+"&height="+t}}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery-ui/ui/widget"],e):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?e(require("jquery"),require("./vendor/jquery.ui.widget")):e(window.jQuery)}((function(e){"use strict";function t(t){var i="dragover"===t;return function(n){n.dataTransfer=n.originalEvent&&n.originalEvent.dataTransfer;var a=n.dataTransfer;a&&-1!==e.inArray("Files",a.types)&&!1!==this._trigger(t,e.Event(t,{delegatedEvent:n}))&&(n.preventDefault(),i&&(a.dropEffect="copy"))}}var i;e.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))").test(window.navigator.userAgent)||e('').prop("disabled")),e.support.xhrFileUpload=!(!window.ProgressEvent||!window.FileReader),e.support.xhrFormDataFileUpload=!!window.FormData,e.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice),e.widget("blueimp.fileupload",{options:{dropZone:e(document),pasteZone:void 0,fileInput:void 0,replaceFileInput:!0,paramName:void 0,singleFileUploads:!0,limitMultiFileUploads:void 0,limitMultiFileUploadSize:void 0,limitMultiFileUploadSizeOverhead:512,sequentialUploads:!1,limitConcurrentUploads:void 0,forceIframeTransport:!1,redirect:void 0,redirectParamName:void 0,postMessage:void 0,multipart:!0,maxChunkSize:void 0,uploadedBytes:void 0,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,uniqueFilenames:void 0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,i){return t=this.messages[t]||t.toString(),i&&e.each(i,(function(e,i){t=t.replace("{"+e+"}",i)})),t},formData:function(e){return e.serializeArray()},add:function(t,i){if(t.isDefaultPrevented())return!1;(i.autoUpload||!1!==i.autoUpload&&e(this).fileupload("option","autoUpload"))&&i.process().done((function(){i.submit()}))},processData:!1,contentType:!1,cache:!1,timeout:0},_promisePipe:(i=e.fn.jquery.split("."),Number(i[0])>1||Number(i[1])>7?"then":"pipe"),_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:e.support.blobSlice&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime(),this.loaded=0,this.bitrate=0,this.getBitrate=function(e,t,i){var n=e-this.timestamp;return(!this.bitrate||!i||n>i)&&(this.bitrate=(t-this.loaded)*(1e3/n)*8,this.loaded=t,this.timestamp=e),this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var i;return"function"===e.type(t.formData)?t.formData(t.form):e.isArray(t.formData)?t.formData:"object"===e.type(t.formData)?(i=[],e.each(t.formData,(function(e,t){i.push({name:e,value:t})})),i):[]},_getTotal:function(t){var i=0;return e.each(t,(function(e,t){i+=t.size||1})),i},_initProgressObject:function(t){var i={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,i):t._progress=i},_initResponseObject:function(e){var t;if(e._response)for(t in e._response)Object.prototype.hasOwnProperty.call(e._response,t)&&delete e._response[t];else e._response={}},_onProgress:function(t,i){if(t.lengthComputable){var n,a=Date.now?Date.now():(new Date).getTime();if(i._time&&i.progressInterval&&a-i._time").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&i&&i!==location.host&&t.formData.push({name:t.redirectParamName||"redirect",value:t.redirect})},_initDataSettings:function(e){this._isXHRUpload(e)?(this._chunkedUpload(e,!0)||(e.data||this._initXHRData(e),this._initProgressListener(e)),e.postMessage&&(e.dataType="postmessage "+(e.dataType||""))):this._initIframeSettings(e)},_getParamName:function(t){var i=e(t.fileInput),n=t.paramName;return n?e.isArray(n)||(n=[n]):(n=[],i.each((function(){for(var t=e(this),i=t.prop("name")||"files[]",a=(t.prop("files")||[1]).length;a;)n.push(i),a-=1})),n.length||(n=[i.prop("name")||"files[]"])),n},_initFormSettings:function(t){t.form&&t.form.length||(t.form=e(t.fileInput.prop("form")),t.form.length||(t.form=e(this.options.fileInput.prop("form")))),t.paramName=this._getParamName(t),t.url||(t.url=t.form.prop("action")||location.href),t.type=(t.type||"string"===e.type(t.form.prop("method"))&&t.form.prop("method")||"").toUpperCase(),"POST"!==t.type&&"PUT"!==t.type&&"PATCH"!==t.type&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var i=e.extend({},this.options,t);return this._initFormSettings(i),this._initDataSettings(i),i},_getDeferredState:function(e){return e.state?e.state():e.isResolved()?"resolved":e.isRejected()?"rejected":"pending"},_enhancePromise:function(e){return e.success=e.done,e.error=e.fail,e.complete=e.always,e},_getXHRPromise:function(t,i,n){var a=e.Deferred(),r=a.promise();return i=i||this.options.context||r,!0===t?a.resolveWith(i,n):!1===t&&a.rejectWith(i,n),r.abort=a.promise,this._enhancePromise(r)},_addConvenienceMethods:function(t,i){var n=this,a=function(t){return e.Deferred().resolveWith(n,t).promise()};i.process=function(t,r){return(t||r)&&(i._processQueue=this._processQueue=(this._processQueue||a([this]))[n._promisePipe]((function(){return i.errorThrown?e.Deferred().rejectWith(n,[i]).promise():a(arguments)}))[n._promisePipe](t,r)),this._processQueue||a([this])},i.submit=function(){return"pending"!==this.state()&&(i.jqXHR=this.jqXHR=!1!==n._trigger("submit",e.Event("submit",{delegatedEvent:t}),this)&&n._onSend(t,this)),this.jqXHR||n._getXHRPromise()},i.abort=function(){return this.jqXHR?this.jqXHR.abort():(this.errorThrown="abort",n._trigger("fail",null,this),n._getXHRPromise(!1))},i.state=function(){return this.jqXHR?n._getDeferredState(this.jqXHR):this._processQueue?n._getDeferredState(this._processQueue):void 0},i.processing=function(){return!this.jqXHR&&this._processQueue&&"pending"===n._getDeferredState(this._processQueue)},i.progress=function(){return this._progress},i.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),i=t&&t.split("-"),n=i&&i.length>1&&parseInt(i[1],10);return n&&n+1},_chunkedUpload:function(t,i){t.uploadedBytes=t.uploadedBytes||0;var n,a,r=this,o=t.files[0],s=o.size,l=t.uploadedBytes,d=t.maxChunkSize||s,c=this._blobSlice,u=e.Deferred(),p=u.promise();return!(!(this._isXHRUpload(t)&&c&&(l||("function"===e.type(d)?d(t):d)=s?(o.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",o.error])):(a=function(){var i=e.extend({},t),p=i._progress.loaded;i.blob=c.call(o,l,l+("function"===e.type(d)?d(i):d),o.type),i.chunkSize=i.blob.size,i.contentRange="bytes "+l+"-"+(l+i.chunkSize-1)+"/"+s,r._trigger("chunkbeforesend",null,i),r._initXHRData(i),r._initProgressListener(i),n=(!1!==r._trigger("chunksend",null,i)&&e.ajax(i)||r._getXHRPromise(!1,i.context)).done((function(n,o,d){l=r._getUploadedBytes(d)||l+i.chunkSize,p+i.chunkSize-i._progress.loaded&&r._onProgress(e.Event("progress",{lengthComputable:!0,loaded:l-i.uploadedBytes,total:l-i.uploadedBytes}),i),t.uploadedBytes=i.uploadedBytes=l,i.result=n,i.textStatus=o,i.jqXHR=d,r._trigger("chunkdone",null,i),r._trigger("chunkalways",null,i),ls._sending)for(var n=s._slots.shift();n;){if("pending"===s._getDeferredState(n)){n.resolve();break}n=s._slots.shift()}0===s._active&&s._trigger("stop")}))};return this._beforeSend(t,l),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(r=e.Deferred(),this._slots.push(r),o=r[s._promisePipe](d)):(this._sequence=this._sequence[s._promisePipe](d,d),o=this._sequence),o.abort=function(){return a=[void 0,"abort","abort"],n?n.abort():(r&&r.rejectWith(l.context,a),d())},this._enhancePromise(o)):d()},_onAdd:function(t,i){var n,a,r,o,s=this,l=!0,d=e.extend({},this.options,i),c=i.files,u=c.length,p=d.limitMultiFileUploads,m=d.limitMultiFileUploadSize,f=d.limitMultiFileUploadSizeOverhead,h=0,g=this._getParamName(d),v=0;if(!u)return!1;if(m&&void 0===c[0].size&&(m=void 0),(d.singleFileUploads||p||m)&&this._isXHRUpload(d))if(d.singleFileUploads||m||!p)if(!d.singleFileUploads&&m)for(r=[],n=[],o=0;om||p&&o+1-v>=p)&&(r.push(c.slice(v,o+1)),(a=g.slice(v,o+1)).length||(a=g),n.push(a),v=o+1,h=0);else n=g;else for(r=[],n=[],o=0;o").append(n)[0].reset(),i.after(n).detach(),a&&n.trigger("focus"),e.cleanData(i.off("remove")),this.options.fileInput=this.options.fileInput.map((function(e,t){return t===i[0]?n[0]:t})),i[0]===this.element[0]&&(this.element=n)},_handleFileTreeEntry:function(t,i){var n,a=this,r=e.Deferred(),o=[],s=function(e){e&&!e.entry&&(e.entry=t),r.resolve([e])};return i=i||"",t.isFile?t._file?(t._file.relativePath=i,r.resolve(t._file)):t.file((function(e){e.relativePath=i,r.resolve(e)}),s):t.isDirectory?(n=t.createReader(),function e(){n.readEntries((function(n){n.length?(o=o.concat(n),e()):function(e){a._handleFileTreeEntries(e,i+t.name+"/").done((function(e){r.resolve(e)})).fail(s)}(o)}),s)}()):r.resolve([]),r.promise()},_handleFileTreeEntries:function(t,i){var n=this;return e.when.apply(e,e.map(t,(function(e){return n._handleFileTreeEntry(e,i)})))[this._promisePipe]((function(){return Array.prototype.concat.apply([],arguments)}))},_getDroppedFiles:function(t){var i=(t=t||{}).items;return i&&i.length&&(i[0].webkitGetAsEntry||i[0].getAsEntry)?this._handleFileTreeEntries(e.map(i,(function(e){var t;return e.webkitGetAsEntry?((t=e.webkitGetAsEntry())&&(t._file=e.getAsFile()),t):e.getAsEntry()}))):e.Deferred().resolve(e.makeArray(t.files)).promise()},_getSingleFileInputFiles:function(t){var i,n,a=(t=e(t)).prop("webkitEntries")||t.prop("entries");if(a&&a.length)return this._handleFileTreeEntries(a);if((i=e.makeArray(t.prop("files"))).length)void 0===i[0].name&&i[0].fileName&&e.each(i,(function(e,t){t.name=t.fileName,t.size=t.fileSize}));else{if(!(n=t.prop("value")))return e.Deferred().resolve([]).promise();i=[{name:n.replace(/^.*\\/,"")}]}return e.Deferred().resolve(i).promise()},_getFileInputFiles:function(t){return t instanceof e&&1!==t.length?e.when.apply(e,e.map(t,this._getSingleFileInputFiles))[this._promisePipe]((function(){return Array.prototype.concat.apply([],arguments)})):this._getSingleFileInputFiles(t)},_onChange:function(t){var i=this,n={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(n.fileInput).always((function(a){n.files=a,i.options.replaceFileInput&&i._replaceFileInput(n),!1!==i._trigger("change",e.Event("change",{delegatedEvent:t}),n)&&i._onAdd(t,n)}))},_onPaste:function(t){var i=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,n={files:[]};i&&i.length&&(e.each(i,(function(e,t){var i=t.getAsFile&&t.getAsFile();i&&n.files.push(i)})),!1!==this._trigger("paste",e.Event("paste",{delegatedEvent:t}),n)&&this._onAdd(t,n))},_onDrop:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var i=this,n=t.dataTransfer,a={};n&&n.files&&n.files.length&&(t.preventDefault(),this._getDroppedFiles(n).always((function(n){a.files=n,!1!==i._trigger("drop",e.Event("drop",{delegatedEvent:t}),a)&&i._onAdd(t,a)})))},_onDragOver:t("dragover"),_onDragEnter:t("dragenter"),_onDragLeave:t("dragleave"),_initEventHandlers:function(){this._isXHRUpload(this.options)&&(this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave}),this._on(this.options.pasteZone,{paste:this._onPaste})),e.support.fileInput&&this._on(this.options.fileInput,{change:this._onChange})},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragenter dragleave dragover drop"),this._off(this.options.pasteZone,"paste"),this._off(this.options.fileInput,"change")},_destroy:function(){this._destroyEventHandlers()},_setOption:function(t,i){var n=-1!==e.inArray(t,this._specialOptions);n&&this._destroyEventHandlers(),this._super(t,i),n&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;void 0===t.fileInput?t.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]'):t.fileInput instanceof e||(t.fileInput=e(t.fileInput)),t.dropZone instanceof e||(t.dropZone=e(t.dropZone)),t.pasteZone instanceof e||(t.pasteZone=e(t.pasteZone))},_getRegExp:function(e){var t=e.split("/"),i=t.pop();return t.shift(),new RegExp(t.join("/"),i)},_isRegExpOption:function(t,i){return"url"!==t&&"string"===e.type(i)&&/^\/.*\/[igm]{0,3}$/.test(i)},_initDataAttributes:function(){var t=this,i=this.options,n=this.element.data();e.each(this.element[0].attributes,(function(e,a){var r,o=a.name.toLowerCase();/^data-/.test(o)&&(o=o.slice(5).replace(/-[a-z]/g,(function(e){return e.charAt(1).toUpperCase()})),r=n[o],t._isRegExpOption(o,r)&&(r=t._getRegExp(r)),i[o]=r)}))},_create:function(){this._initDataAttributes(),this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=0,this._initProgressObject(this),this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(t){var i=this;t&&!this.options.disabled&&(t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always((function(e){t.files=e,i._onAdd(null,t)})):(t.files=e.makeArray(t.files),this._onAdd(null,t)))},send:function(t){if(t&&!this.options.disabled){if(t.fileInput&&!t.files){var i,n,a=this,r=e.Deferred(),o=r.promise();return o.abort=function(){return n=!0,i?i.abort():(r.reject(null,"abort","abort"),o)},this._getFileInputFiles(t.fileInput).always((function(e){n||(e.length?(t.files=e,(i=a._onSend(null,t)).then((function(e,t,i){r.resolve(e,t,i)}),(function(e,t,i){r.reject(e,t,i)}))):r.reject())})),this._enhancePromise(o)}if(t.files=e.makeArray(t.files),t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})})),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?e(require("jquery")):e(window.jQuery)}((function(e){"use strict";var t=0,i=e,n="parseJSON";"JSON"in window&&"parse"in JSON&&(i=JSON,n="parse"),e.ajaxTransport("iframe",(function(i){if(i.async){var n,a,r,o=i.initialIframeSrc||"javascript:false;";return{send:function(s,l){(n=e('
    ')).attr("accept-charset",i.formAcceptCharset),r=/\?/.test(i.url)?"&":"?","DELETE"===i.type?(i.url=i.url+r+"_method=DELETE",i.type="POST"):"PUT"===i.type?(i.url=i.url+r+"_method=PUT",i.type="POST"):"PATCH"===i.type&&(i.url=i.url+r+"_method=PATCH",i.type="POST"),a=e('').on("load",(function(){var t,r=e.isArray(i.paramName)?i.paramName:[i.paramName];a.off("load").on("load",(function(){var t;try{if(!(t=a.contents()).length||!t[0].firstChild)throw new Error}catch(e){t=void 0}l(200,"success",{iframe:t}),e('').appendTo(n),window.setTimeout((function(){n.remove()}),0)})),n.prop("target",a.prop("name")).prop("action",i.url).prop("method",i.type),i.formData&&e.each(i.formData,(function(t,i){e('').prop("name",i.name).val(i.value).appendTo(n)})),i.fileInput&&i.fileInput.length&&"POST"===i.type&&(t=i.fileInput.clone(),i.fileInput.after((function(e){return t[e]})),i.paramName&&i.fileInput.each((function(t){e(this).prop("name",r[t]||i.paramName)})),n.append(i.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data"),i.fileInput.removeAttr("form")),window.setTimeout((function(){n.submit(),t&&t.length&&i.fileInput.each((function(i,n){var a=e(t[i]);e(n).prop("name",a.prop("name")).attr("form",a.attr("form")),a.replaceWith(n)}))}),0)})),n.append(a).appendTo(document.body)},abort:function(){a&&a.off("load").prop("src",o),n&&n.remove()}}}})),e.ajaxSetup({converters:{"iframe text":function(t){return t&&e(t[0].body).text()},"iframe json":function(t){return t&&i[n](e(t[0].body).text())},"iframe html":function(t){return t&&e(t[0].body).html()},"iframe xml":function(t){var i=t&&t[0];return i&&e.isXMLDoc(i)?i:e.parseXML(i.XMLDocument&&i.XMLDocument.xml||e(i.body).html())},"iframe script":function(t){return t&&e.globalEval(e(t[0].body).text())}}})})); +function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(e){for(var t=1;t-1}));switch(e.sortBy){case"size":t.sort((function(t,i){return e.sortAsc?t.size-i.size:i.size-t.size}));break;case"mime":t.sort((function(t,i){return e.sortAsc?t.mime.toLowerCase().localeCompare(i.mime.toLowerCase()):i.mime.toLowerCase().localeCompare(t.mime.toLowerCase())}));break;case"lastModify":t.sort((function(t,i){return e.sortAsc?t.lastModify-i.lastModify:i.lastModify-t.lastModify}));break;default:t.sort((function(t,i){return e.sortAsc?t.name.toLowerCase().localeCompare(i.name.toLowerCase()):i.name.toLowerCase().localeCompare(t.name.toLowerCase())}))}return t},hiddenCount:function(){return this.mediaItems.length-this.filteredMediaItems.length},thumbSize:function(){return this.smallThumbs?100:240},currentPrefs:{get:function(){return{smallThumbs:this.smallThumbs,selectedFolder:this.selectedFolder,gridView:this.gridView}},set:function(e){e&&(this.smallThumbs=e.smallThumbs,this.selectedFolder=e.selectedFolder,this.gridView=e.gridView)}}},watch:{currentPrefs:function(e){localStorage.setItem("mediaApplicationPrefs",JSON.stringify(e))},selectedFolder:function(e){this.mediaFilter="",this.selectedFolder=e,this.loadFolder(e)}},mounted:function(){this.$refs.rootFolder.toggle()},methods:{uploadUrl:function(){return this.selectedFolder?$("#uploadFiles").val()+"?path="+encodeURIComponent(this.selectedFolder.path):null},selectRoot:function(){this.selectedFolder=this.root},loadFolder:function(e){this.errors=[],this.selectedMedias=[];var t=this;$.ajax({url:$("#getMediaItemsUrl").val()+"?path="+encodeURIComponent(e.path),method:"GET",success:function(e){e.forEach((function(e){e.open=!1})),t.mediaItems=e,t.selectedMedias=[],t.sortBy="",t.sortAsc=!0},error:function(i){console.log("error loading folder:"+e.path),t.selectRoot()}})},selectAll:function(){this.selectedMedias=[];for(var e=0;e-1&&(t.mediaItems.splice(n,1),bus.$emit("mediaDeleted",t.selectedMedias[i]))}t.selectedMedias=[]},error:function(e){console.error(e.responseText)}})}}}))},deleteMediaItem:function(e){var t=this;e&&confirmDialog(_objectSpread(_objectSpread({},$("#deleteMedia").data()),{},{callback:function(i){i&&$.ajax({url:$("#deleteMediaUrl").val()+"?path="+encodeURIComponent(e.mediaPath),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val()},success:function(i){var n=t.mediaItems&&t.mediaItems.indexOf(e);n>-1&&(t.mediaItems.splice(n,1),bus.$emit("mediaDeleted",e))},error:function(e){console.error(e.responseText)}})}}))},handleDragStart:function(e,t){var i=[];this.selectedMedias.forEach((function(e){i.push(e.name)})),0==this.isMediaSelected(e)&&(i.push(e.name),this.selectedMedias.push(e)),t.dataTransfer.setData("mediaNames",JSON.stringify(i)),t.dataTransfer.setData("sourceFolder",this.selectedFolder.path),t.dataTransfer.setDragImage(this.dragDropThumbnail,10,10),t.dataTransfer.effectAllowed="move"},handleScrollWhileDrag:function(e){e.clientY<150&&window.scrollBy(0,-10),e.clientY>window.innerHeight-100&&window.scrollBy(0,10)},changeSort:function(e){this.sortBy==e?this.sortAsc=!this.sortAsc:(this.sortAsc=!0,this.sortBy=e)}}}),$("#create-folder-name").keypress((function(e){if(13==e.which)return $("#modalFooterOk").click(),!1})),$("#modalFooterOk").on("click",(function(e){var t=$("#create-folder-name").val();""!==t&&$.ajax({url:$("#createFolderUrl").val()+"?path="+encodeURIComponent(mediaApp.selectedFolder.path)+"&name="+encodeURIComponent(t),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val()},success:function(e){bus.$emit("addFolder",mediaApp.selectedFolder,e),$("#createFolderModal").modal("hide")},error:function(e){$("#createFolderModal-errors").empty();var t=JSON.parse(e.responseText).value;$('').text(t).appendTo($("#createFolderModal-errors"))}})})),$("#renameMediaModalFooterOk").on("click",(function(e){var t=$("#new-item-name").val(),i=$("#old-item-name").val();if(""!==t){var n=mediaApp.selectedFolder.path+"/";"/"===n&&(n="");var a=n+t,r=n+i;a.toLowerCase()!==r.toLowerCase()?$.ajax({url:$("#renameMediaUrl").val()+"?oldPath="+encodeURIComponent(r)+"&newPath="+encodeURIComponent(a),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val()},success:function(e){$("#renameMediaModal").modal("hide"),bus.$emit("mediaRenamed",t,a,r)},error:function(e){$("#renameMediaModal-errors").empty();var t=JSON.parse(e.responseText).value;$('').text(t).appendTo($("#renameMediaModal-errors"))}}):$("#renameMediaModal").modal("hide")}})),e&&(document.getElementById("mediaApp").style.display=""),$(document).trigger("mediaApp:ready")},error:function(e){console.error(e.responseText)}}))}function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(e){for(var t=1;t0&&a},thumbSize:function(){return this.smallThumbs?120:240},currentPrefs:{get:function(){return{smallThumbs:this.smallThumbs}},set:function(e){e&&(this.smallThumbs=e.smallThumbs)}}},mounted:function(){var e=this;e.paths=s,e.$on("selectAndDeleteMediaRequested",(function(t){e.selectAndDeleteMedia(t)})),e.$on("selectMediaRequested",(function(t){e.selectMedia(t)}));var n="#"+t,d=l.attr("id");$(n).fileupload({limitConcurrentUploads:20,dropZone:$("#"+d),dataType:"json",url:i,add:function(t,i){var n,a=i.files.length;for(n=0;n0)for(var r=0;r1&&!1===a?(alert($("#onlyOneItemMessage").val()),o.mediaItems.push(i[0]),o.initialized=!0):(o.mediaItems=o.mediaItems.concat(i),o.initialized=!0):alert(n)},error:function(e,t,i){console.log("error on upload!!"),console.log(e),console.log(t),console.log(i)}})},methods:{selectMedia:function(e){this.selectedMedia=e},getUniqueId:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},removeSelected:function(e){if(this.selectedMedia){var t=this.mediaItems&&this.mediaItems.indexOf(this.selectedMedia);t>-1&&(this.mediaItems[t].isRemoved=!0,this.mediaItems.splice(t,1))}else 1===this.mediaItems.length&&(this.mediaItems[t].isRemoved=!0,this.mediaItems.splice(0,1));this.selectedMedia=null},selectAndDeleteMedia:function(e){var t=this;t.selectedMedia=e,setTimeout((function(){t.removeSelected()}),100)}},watch:{mediaItems:function(){setTimeout((function(){$(document).trigger("contentpreview:render")}),100)},currentPrefs:function(e){localStorage.setItem("mediaFieldPrefs",JSON.stringify(e))}}}))}function initializeMediaField(e,t,i,n){var a,r=$(document.getElementById($(e).data("for"))).data("init"),o=$(e),s=o.attr("id");mediaFieldApps.push(a=new Vue({el:o.get(0),data:{mediaItems:[],selectedMedia:null,smallThumbs:!1,idPrefix:s,initialized:!1},created:function(){this.currentPrefs=JSON.parse(localStorage.getItem("mediaFieldPrefs"))},computed:{paths:{get:function(){var e=[];return this.initialized?(this.mediaItems.forEach((function(t){"not-found"!==t.mediaPath&&e.push({Path:t.mediaPath})})),JSON.stringify(e)):JSON.stringify(r)},set:function(e){var t=this,n=e||[],a=$.Deferred(),r=[],o=0;n.forEach((function(e,n){r.push({name:" "+e.Path,mime:"",mediaPath:""}),promise=$.when(a).done((function(){$.ajax({url:i+"?path="+encodeURIComponent(e.Path),method:"GET",success:function(e){e.vuekey=e.name+n.toString(),r.splice(n,1,e),r.length===++o&&(r.forEach((function(e){t.mediaItems.push(e)})),t.initialized=!0)},error:function(i){console.log(i),r.splice(n,1,{name:e.Path,mime:"",mediaPath:"not-found"}),r.length===++o&&(r.forEach((function(e){t.mediaItems.push(e)})),t.initialized=!0)}})}))})),a.resolve()}},fileSize:function(){return Math.round(this.selectedMedia.size/1024)},canAddMedia:function(){return 0===this.mediaItems.length||this.mediaItems.length>0&&n},thumbSize:function(){return this.smallThumbs?120:240},currentPrefs:{get:function(){return{smallThumbs:this.smallThumbs}},set:function(e){e&&(this.smallThumbs=e.smallThumbs)}}},mounted:function(){var e=this;e.paths=r,e.$on("selectAndDeleteMediaRequested",(function(t){e.selectAndDeleteMedia(t)})),e.$on("selectMediaRequested",(function(t){e.selectMedia(t)})),e.$on("filesUploaded",(function(t){e.addMediaFiles(t)}))},methods:{selectMedia:function(e){this.selectedMedia=e},showModal:function(e){var i=this;if(i.canAddMedia){$("#mediaApp").detach().appendTo($(t).find(".modal-body")),$("#mediaApp").show();var n=$(t).modal();$(t).find(".mediaFieldSelectButton").off("click").on("click",(function(e){return i.addMediaFiles(mediaApp.selectedMedias),mediaApp.selectedMedias=[],n.modal("hide"),!0}))}},addMediaFiles:function(e){e.length>1&&!1===n?(alert($("#onlyOneItemMessage").val()),a.mediaItems.push(e[0]),a.initialized=!0):(a.mediaItems=a.mediaItems.concat(e),a.initialized=!0)},removeSelected:function(e){if(this.selectedMedia){var t=this.mediaItems&&this.mediaItems.indexOf(this.selectedMedia);t>-1&&this.mediaItems.splice(t,1)}else 1===this.mediaItems.length&&this.mediaItems.splice(0,1);this.selectedMedia=null},selectAndDeleteMedia:function(e){var t=this;t.selectedMedia=e,setTimeout((function(){t.removeSelected()}),100)}},watch:{mediaItems:function(){setTimeout((function(){$(document).trigger("contentpreview:render")}),100)},currentPrefs:function(e){localStorage.setItem("mediaFieldPrefs",JSON.stringify(e))}}}))}$(document).on("mediaApp:ready",(function(){$("#fileupload").fileupload({dropZone:$("#mediaApp"),limitConcurrentUploads:20,dataType:"json",url:$("#uploadFiles").val(),formData:function(){var e=$("input[name=__RequestVerificationToken]").val();return[{name:"path",value:mediaApp.selectedFolder.path},{name:"__RequestVerificationToken",value:e}]},done:function(e,t){$.each(t.result.files,(function(e,t){t.error||mediaApp.mediaItems.push(t)}))}})})),$(document).bind("dragover",(function(e){var t=e.originalEvent.dataTransfer;if(t.types&&(t.types.indexOf?-1!=t.types.indexOf("Files"):t.types.contains("Files"))){var i=$("#customdropzone"),n=window.dropZoneTimeout;n?clearTimeout(n):i.addClass("in");$(e.target).closest(i);window.dropZoneTimeout=setTimeout((function(){window.dropZoneTimeout=null,i.removeClass("in")}),100)}})),Vue.component("folder",{template:'\n
  • \n \n
      \n \n \n
    \n
  • \n '),props:{model:Object,selectedInMediaApp:Object,level:Number},data:function(){return{open:!1,children:null,parent:null,isHovered:!1,padding:0}},computed:{empty:function(){return!this.children||0==this.children.length},isSelected:function(){return this.selectedInMediaApp.name==this.model.name&&this.selectedInMediaApp.path==this.model.path},isRoot:function(){return""===this.model.path}},mounted:function(){0==this.isRoot&&this.isAncestorOfSelectedFolder()&&this.toggle(),this.padding=this.level<3?26:26+8*this.level},created:function(){var e=this;bus.$on("deleteFolder",(function(t){if(e.children){var i=e.children&&e.children.indexOf(t);i>-1&&(e.children.splice(i,1),bus.$emit("folderDeleted"))}})),bus.$on("addFolder",(function(t,i){e.model==t&&(bus.$emit("beforeFolderAdded",e.model),null!==e.children&&e.children.push(i),i.parent=e.model,bus.$emit("folderAdded",i))}))},methods:{isAncestorOfSelectedFolder:function(){for(parentFolder=mediaApp.selectedFolder;parentFolder;){if(parentFolder.path==this.model.path)return!0;parentFolder=parentFolder.parent}return!1},toggle:function(){this.open=!this.open,this.open&&!this.children&&this.loadChildren()},select:function(){bus.$emit("folderSelected",this.model),this.loadChildren()},createFolder:function(){bus.$emit("createFolderRequested")},deleteFolder:function(){bus.$emit("deleteFolderRequested")},loadChildren:function(){var e=this;0==this.open&&(this.open=!0),$.ajax({url:$("#getFoldersUrl").val()+"?path="+encodeURIComponent(e.model.path),method:"GET",success:function(t){e.children=t,e.children.forEach((function(t){t.parent=e.model}))},error:function(e){emtpy=!1,console.error(e.responseText)}})},handleDragOver:function(e){this.isHovered=!0},handleDragLeave:function(e){this.isHovered=!1},moveMediaToFolder:function(e,t){this.isHovered=!1;var i=JSON.parse(t.dataTransfer.getData("mediaNames"));if(!(i.length<1)){var n=t.dataTransfer.getData("sourceFolder"),a=e.path;""===n&&(n="root"),""===a&&(a="root"),n!==a?confirmDialog(_objectSpread(_objectSpread({},$("#moveMedia").data()),{},{callback:function(e){e&&$.ajax({url:$("#moveMediaListUrl").val(),method:"POST",data:{__RequestVerificationToken:$("input[name='__RequestVerificationToken']").val(),mediaNames:i,sourceFolder:n,targetFolder:a},success:function(){bus.$emit("mediaListMoved")},error:function(e){console.error(e.responseText),bus.$emit("mediaListMoved",e.responseText)}})}})):alert($("#sameFolderMessage").val())}}}}),Vue.component("media-items-grid",{template:'\n
      \n
    1. \n
      \n \n \n
      \n
      \n \n \n \n {{ media.name }}\n
      \n
    2. \n
    \n ',data:function(){return{T:{}}},props:{filteredMediaItems:Array,selectedMedias:Array,thumbSize:Number},created:function(){this.T.editButton=$("#t-edit-button").val(),this.T.deleteButton=$("#t-delete-button").val()},methods:{isMediaSelected:function(e){return this.selectedMedias.some((function(t,i,n){return t.url.toLowerCase()===e.url.toLowerCase()}))},buildMediaUrl:function(e,t){return e+(-1==e.indexOf("?")?"?":"&")+"width="+t+"&height="+t},toggleSelectionOfMedia:function(e){bus.$emit("mediaToggleRequested",e)},renameMedia:function(e){bus.$emit("renameMediaRequested",e)},deleteMedia:function(e){bus.$emit("deleteMediaRequested",e)},dragStart:function(e,t){bus.$emit("mediaDragStartRequested",e,t)}}}),Vue.component("media-items-table",{template:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{ T.imageHeader }}\n {{ T.nameHeader }}\n \n \n {{ T.lastModifyHeader }} \n \n \n \n {{ T.sizeHeader }}\n \n \n \n \n {{ T.typeHeader }}\n \n \n
    \n
    \n \n \n
    \n
    \n \n \n
    {{ printDateTime(media.lastModify) }}
    \n
    \n
    {{ isNaN(media.size)? 0 : Math.round(media.size / 1024) }} KB
    \n
    \n
    {{ media.mime }}
    \n
    \n ',data:function(){return{T:{}}},props:{sortBy:String,sortAsc:Boolean,filteredMediaItems:Array,selectedMedias:Array,thumbSize:Number},created:function(){this.T.imageHeader=$("#t-image-header").val(),this.T.nameHeader=$("#t-name-header").val(),this.T.lastModifyHeader=$("#t-lastModify-header").val(),this.T.sizeHeader=$("#t-size-header").val(),this.T.typeHeader=$("#t-type-header").val(),this.T.editButton=$("#t-edit-button").val(),this.T.deleteButton=$("#t-delete-button").val(),this.T.viewButton=$("#t-view-button").val()},methods:{isMediaSelected:function(e){return this.selectedMedias.some((function(t,i,n){return t.url.toLowerCase()===e.url.toLowerCase()}))},buildMediaUrl:function(e,t){return e+(-1==e.indexOf("?")?"?":"&")+"width="+t+"&height="+t},changeSort:function(e){bus.$emit("sortChangeRequested",e)},toggleSelectionOfMedia:function(e){bus.$emit("mediaToggleRequested",e)},renameMedia:function(e){bus.$emit("renameMediaRequested",e)},deleteMedia:function(e){bus.$emit("deleteMediaRequested",e)},dragStart:function(e,t){bus.$emit("mediaDragStartRequested",e,t)},printDateTime:function(e){return new Date(e).toLocaleString()}}}),Vue.component("pager",{template:'\n \n ',props:{sourceItems:Array},data:function(){return{pageSize:10,pageSizeOptions:[10,30,50,100],current:0,T:{}}},created:function(){this.T.pagerFirstButton=$("#t-pager-first-button").val(),this.T.pagerPreviousButton=$("#t-pager-previous-button").val(),this.T.pagerNextButton=$("#t-pager-next-button").val(),this.T.pagerLastButton=$("#t-pager-last-button").val(),this.T.pagerPageSizeLabel=$("#t-pager-page-size-label").val(),this.T.pagerPageLabel=$("#t-pager-page-label").val(),this.T.pagerTotalLabel=$("#t-pager-total-label").val()},methods:{next:function(){this.current=this.current+1},previous:function(){this.current=this.current-1},goFirst:function(){this.current=0},goLast:function(){this.current=this.totalPages-1},goTo:function(e){this.current=e}},computed:{total:function(){return this.sourceItems?this.sourceItems.length:0},totalPages:function(){var e=Math.ceil(this.total/this.pageSize);return e>0?e:1},isLastPage:function(){return this.current+1>=this.totalPages},isFirstPage:function(){return 0===this.current},canDoNext:function(){return!this.isLastPage},canDoPrev:function(){return!this.isFirstPage},canDoFirst:function(){return!this.isFirstPage},canDoLast:function(){return!this.isLastPage},itemsInCurrentPage:function(){var e=this.pageSize*this.current,t=e+this.pageSize,i=this.sourceItems.slice(e,t);return bus.$emit("pagerEvent",i),i},pageLinks:function(){var e=[];e.push(this.current+1);var t=this.current>0?this.current:-1;e.unshift(t);var i=this.current>1?this.current-1:-1;e.unshift(i);var n=this.totalPages-this.current>1?this.current+2:-1;e.push(n);var a=this.totalPages-this.current>2?this.current+3:-1;return e.push(a),e}},watch:{sourceItems:function(){this.current=0},pageSize:function(){this.current=0}}}),Vue.component("sortIndicator",{template:'\n
    \n \n \n
    \n ',props:{colname:String,selectedcolname:String,asc:Boolean},computed:{isActive:function(){return this.colname.toLowerCase()==this.selectedcolname.toLowerCase()}}});var mediaFieldApps=[];function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Vue.component("mediaFieldThumbsContainer",{template:'
    {{T.noImages}}
  • {{ media.isNew ? media.name.substr(36) : media.name }}
    {{ T.mediaNotFound }} {{ T.discardWarning }}
    {{ media.name }}
  • ',data:function(){return{T:{}}},props:{mediaItems:Array,selectedMedia:Object,thumbSize:Number,idPrefix:String},created:function(){this.T.mediaNotFound=$("#t-media-not-found").val(),this.T.discardWarning=$("#t-discard-warning").val(),this.T.noImages=$("#t-no-images").val()},methods:{selectAndDeleteMedia:function(e){this.$parent.$emit("selectAndDeleteMediaRequested",e)},selectMedia:function(e){this.$parent.$emit("selectMediaRequested",e)},buildMediaUrl:function(e,t){return e+(-1==e.indexOf("?")?"?":"&")+"width="+t+"&height="+t}}}),Vue.component("upload",{template:'

    {{ model.name }}

    Error: {{ model.errorMessage }}
    ',props:{model:Object},mounted:function(){var e=this;$("#fileupload").bind("fileuploadprogress",(function(t,i){i.files[0].name===e.model.name&&(e.model.percentage=parseInt(i.loaded/i.total*100,10))})),$("#fileupload").bind("fileuploaddone",(function(t,i){i.files[0].name===e.model.name&&(i.result.files[0].error?e.handleFailure(i.files[0].name,i.result.files[0].error):bus.$emit("removalRequest",e.model))})),$("#fileupload").bind("fileuploadfail",(function(t,i){i.files[0].name===e.model.name&&e.handleFailure(i.files[0].name,i.textStatus)}))},methods:{handleFailure:function(e,t){e===this.model.name&&(this.model.errorMessage=t,bus.$emit("ErrorOnUpload",this.model))},dismissWarning:function(){bus.$emit("removalRequest",this.model)}}}),Vue.component("uploadList",{template:'
    {{ T.uploads }} (Pending: {{ pendingCount }}) ( {{ T.errors }}: {{ errorCount }} / {{ T.clearErrors }} )
    ',data:function(){return{files:[],T:{},expanded:!1,pendingCount:0,errorCount:0}},created:function(){this.T.uploads=$("#t-uploads").val(),this.T.errors=$("#t-errors").val(),this.T.clearErrors=$("#t-clear-errors").val()},computed:{fileCount:function(){return this.files.length}},mounted:function(){var e=this;$("#fileupload").bind("fileuploadadd",(function(t,i){i.files&&i.files.forEach((function(t){e.files.some((function(e){return e.name==t.name}))?console.error("A file with the same name is already on the queue:"+t.name):e.files.push({name:t.name,percentage:0,errorMessage:""})}))})),bus.$on("removalRequest",(function(t){e.files.forEach((function(e,i,n){e.name==t.name&&n.splice(i,1)}))})),bus.$on("ErrorOnUpload",(function(t){e.updateCount()}))},methods:{updateCount:function(){this.errorCount=this.files.filter((function(e){return""!=e.errorMessage})).length,this.pendingCount=this.files.length-this.errorCount,this.files.length<1&&(this.expanded=!1)},clearErrors:function(){this.files=this.files.filter((function(e){return""==e.errorMessage}))}},watch:{files:function(){this.updateCount()}}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery-ui/ui/widget"],e):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?e(require("jquery"),require("./vendor/jquery.ui.widget")):e(window.jQuery)}((function(e){"use strict";function t(t){var i="dragover"===t;return function(n){n.dataTransfer=n.originalEvent&&n.originalEvent.dataTransfer;var a=n.dataTransfer;a&&-1!==e.inArray("Files",a.types)&&!1!==this._trigger(t,e.Event(t,{delegatedEvent:n}))&&(n.preventDefault(),i&&(a.dropEffect="copy"))}}var i;e.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))").test(window.navigator.userAgent)||e('').prop("disabled")),e.support.xhrFileUpload=!(!window.ProgressEvent||!window.FileReader),e.support.xhrFormDataFileUpload=!!window.FormData,e.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice),e.widget("blueimp.fileupload",{options:{dropZone:e(document),pasteZone:void 0,fileInput:void 0,replaceFileInput:!0,paramName:void 0,singleFileUploads:!0,limitMultiFileUploads:void 0,limitMultiFileUploadSize:void 0,limitMultiFileUploadSizeOverhead:512,sequentialUploads:!1,limitConcurrentUploads:void 0,forceIframeTransport:!1,redirect:void 0,redirectParamName:void 0,postMessage:void 0,multipart:!0,maxChunkSize:void 0,uploadedBytes:void 0,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,uniqueFilenames:void 0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,i){return t=this.messages[t]||t.toString(),i&&e.each(i,(function(e,i){t=t.replace("{"+e+"}",i)})),t},formData:function(e){return e.serializeArray()},add:function(t,i){if(t.isDefaultPrevented())return!1;(i.autoUpload||!1!==i.autoUpload&&e(this).fileupload("option","autoUpload"))&&i.process().done((function(){i.submit()}))},processData:!1,contentType:!1,cache:!1,timeout:0},_promisePipe:(i=e.fn.jquery.split("."),Number(i[0])>1||Number(i[1])>7?"then":"pipe"),_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:e.support.blobSlice&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime(),this.loaded=0,this.bitrate=0,this.getBitrate=function(e,t,i){var n=e-this.timestamp;return(!this.bitrate||!i||n>i)&&(this.bitrate=(t-this.loaded)*(1e3/n)*8,this.loaded=t,this.timestamp=e),this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var i;return"function"===e.type(t.formData)?t.formData(t.form):e.isArray(t.formData)?t.formData:"object"===e.type(t.formData)?(i=[],e.each(t.formData,(function(e,t){i.push({name:e,value:t})})),i):[]},_getTotal:function(t){var i=0;return e.each(t,(function(e,t){i+=t.size||1})),i},_initProgressObject:function(t){var i={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,i):t._progress=i},_initResponseObject:function(e){var t;if(e._response)for(t in e._response)Object.prototype.hasOwnProperty.call(e._response,t)&&delete e._response[t];else e._response={}},_onProgress:function(t,i){if(t.lengthComputable){var n,a=Date.now?Date.now():(new Date).getTime();if(i._time&&i.progressInterval&&a-i._time").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&i&&i!==location.host&&t.formData.push({name:t.redirectParamName||"redirect",value:t.redirect})},_initDataSettings:function(e){this._isXHRUpload(e)?(this._chunkedUpload(e,!0)||(e.data||this._initXHRData(e),this._initProgressListener(e)),e.postMessage&&(e.dataType="postmessage "+(e.dataType||""))):this._initIframeSettings(e)},_getParamName:function(t){var i=e(t.fileInput),n=t.paramName;return n?e.isArray(n)||(n=[n]):(n=[],i.each((function(){for(var t=e(this),i=t.prop("name")||"files[]",a=(t.prop("files")||[1]).length;a;)n.push(i),a-=1})),n.length||(n=[i.prop("name")||"files[]"])),n},_initFormSettings:function(t){t.form&&t.form.length||(t.form=e(t.fileInput.prop("form")),t.form.length||(t.form=e(this.options.fileInput.prop("form")))),t.paramName=this._getParamName(t),t.url||(t.url=t.form.prop("action")||location.href),t.type=(t.type||"string"===e.type(t.form.prop("method"))&&t.form.prop("method")||"").toUpperCase(),"POST"!==t.type&&"PUT"!==t.type&&"PATCH"!==t.type&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var i=e.extend({},this.options,t);return this._initFormSettings(i),this._initDataSettings(i),i},_getDeferredState:function(e){return e.state?e.state():e.isResolved()?"resolved":e.isRejected()?"rejected":"pending"},_enhancePromise:function(e){return e.success=e.done,e.error=e.fail,e.complete=e.always,e},_getXHRPromise:function(t,i,n){var a=e.Deferred(),r=a.promise();return i=i||this.options.context||r,!0===t?a.resolveWith(i,n):!1===t&&a.rejectWith(i,n),r.abort=a.promise,this._enhancePromise(r)},_addConvenienceMethods:function(t,i){var n=this,a=function(t){return e.Deferred().resolveWith(n,t).promise()};i.process=function(t,r){return(t||r)&&(i._processQueue=this._processQueue=(this._processQueue||a([this]))[n._promisePipe]((function(){return i.errorThrown?e.Deferred().rejectWith(n,[i]).promise():a(arguments)}))[n._promisePipe](t,r)),this._processQueue||a([this])},i.submit=function(){return"pending"!==this.state()&&(i.jqXHR=this.jqXHR=!1!==n._trigger("submit",e.Event("submit",{delegatedEvent:t}),this)&&n._onSend(t,this)),this.jqXHR||n._getXHRPromise()},i.abort=function(){return this.jqXHR?this.jqXHR.abort():(this.errorThrown="abort",n._trigger("fail",null,this),n._getXHRPromise(!1))},i.state=function(){return this.jqXHR?n._getDeferredState(this.jqXHR):this._processQueue?n._getDeferredState(this._processQueue):void 0},i.processing=function(){return!this.jqXHR&&this._processQueue&&"pending"===n._getDeferredState(this._processQueue)},i.progress=function(){return this._progress},i.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),i=t&&t.split("-"),n=i&&i.length>1&&parseInt(i[1],10);return n&&n+1},_chunkedUpload:function(t,i){t.uploadedBytes=t.uploadedBytes||0;var n,a,r=this,o=t.files[0],s=o.size,l=t.uploadedBytes,d=t.maxChunkSize||s,c=this._blobSlice,u=e.Deferred(),p=u.promise();return!(!(this._isXHRUpload(t)&&c&&(l||("function"===e.type(d)?d(t):d)=s?(o.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",o.error])):(a=function(){var i=e.extend({},t),p=i._progress.loaded;i.blob=c.call(o,l,l+("function"===e.type(d)?d(i):d),o.type),i.chunkSize=i.blob.size,i.contentRange="bytes "+l+"-"+(l+i.chunkSize-1)+"/"+s,r._trigger("chunkbeforesend",null,i),r._initXHRData(i),r._initProgressListener(i),n=(!1!==r._trigger("chunksend",null,i)&&e.ajax(i)||r._getXHRPromise(!1,i.context)).done((function(n,o,d){l=r._getUploadedBytes(d)||l+i.chunkSize,p+i.chunkSize-i._progress.loaded&&r._onProgress(e.Event("progress",{lengthComputable:!0,loaded:l-i.uploadedBytes,total:l-i.uploadedBytes}),i),t.uploadedBytes=i.uploadedBytes=l,i.result=n,i.textStatus=o,i.jqXHR=d,r._trigger("chunkdone",null,i),r._trigger("chunkalways",null,i),ls._sending)for(var n=s._slots.shift();n;){if("pending"===s._getDeferredState(n)){n.resolve();break}n=s._slots.shift()}0===s._active&&s._trigger("stop")}))};return this._beforeSend(t,l),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(r=e.Deferred(),this._slots.push(r),o=r[s._promisePipe](d)):(this._sequence=this._sequence[s._promisePipe](d,d),o=this._sequence),o.abort=function(){return a=[void 0,"abort","abort"],n?n.abort():(r&&r.rejectWith(l.context,a),d())},this._enhancePromise(o)):d()},_onAdd:function(t,i){var n,a,r,o,s=this,l=!0,d=e.extend({},this.options,i),c=i.files,u=c.length,p=d.limitMultiFileUploads,m=d.limitMultiFileUploadSize,f=d.limitMultiFileUploadSizeOverhead,h=0,g=this._getParamName(d),v=0;if(!u)return!1;if(m&&void 0===c[0].size&&(m=void 0),(d.singleFileUploads||p||m)&&this._isXHRUpload(d))if(d.singleFileUploads||m||!p)if(!d.singleFileUploads&&m)for(r=[],n=[],o=0;om||p&&o+1-v>=p)&&(r.push(c.slice(v,o+1)),(a=g.slice(v,o+1)).length||(a=g),n.push(a),v=o+1,h=0);else n=g;else for(r=[],n=[],o=0;o").append(n)[0].reset(),i.after(n).detach(),a&&n.trigger("focus"),e.cleanData(i.off("remove")),this.options.fileInput=this.options.fileInput.map((function(e,t){return t===i[0]?n[0]:t})),i[0]===this.element[0]&&(this.element=n)},_handleFileTreeEntry:function(t,i){var n,a=this,r=e.Deferred(),o=[],s=function(e){e&&!e.entry&&(e.entry=t),r.resolve([e])};return i=i||"",t.isFile?t._file?(t._file.relativePath=i,r.resolve(t._file)):t.file((function(e){e.relativePath=i,r.resolve(e)}),s):t.isDirectory?(n=t.createReader(),function e(){n.readEntries((function(n){n.length?(o=o.concat(n),e()):function(e){a._handleFileTreeEntries(e,i+t.name+"/").done((function(e){r.resolve(e)})).fail(s)}(o)}),s)}()):r.resolve([]),r.promise()},_handleFileTreeEntries:function(t,i){var n=this;return e.when.apply(e,e.map(t,(function(e){return n._handleFileTreeEntry(e,i)})))[this._promisePipe]((function(){return Array.prototype.concat.apply([],arguments)}))},_getDroppedFiles:function(t){var i=(t=t||{}).items;return i&&i.length&&(i[0].webkitGetAsEntry||i[0].getAsEntry)?this._handleFileTreeEntries(e.map(i,(function(e){var t;return e.webkitGetAsEntry?((t=e.webkitGetAsEntry())&&(t._file=e.getAsFile()),t):e.getAsEntry()}))):e.Deferred().resolve(e.makeArray(t.files)).promise()},_getSingleFileInputFiles:function(t){var i,n,a=(t=e(t)).prop("webkitEntries")||t.prop("entries");if(a&&a.length)return this._handleFileTreeEntries(a);if((i=e.makeArray(t.prop("files"))).length)void 0===i[0].name&&i[0].fileName&&e.each(i,(function(e,t){t.name=t.fileName,t.size=t.fileSize}));else{if(!(n=t.prop("value")))return e.Deferred().resolve([]).promise();i=[{name:n.replace(/^.*\\/,"")}]}return e.Deferred().resolve(i).promise()},_getFileInputFiles:function(t){return t instanceof e&&1!==t.length?e.when.apply(e,e.map(t,this._getSingleFileInputFiles))[this._promisePipe]((function(){return Array.prototype.concat.apply([],arguments)})):this._getSingleFileInputFiles(t)},_onChange:function(t){var i=this,n={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(n.fileInput).always((function(a){n.files=a,i.options.replaceFileInput&&i._replaceFileInput(n),!1!==i._trigger("change",e.Event("change",{delegatedEvent:t}),n)&&i._onAdd(t,n)}))},_onPaste:function(t){var i=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,n={files:[]};i&&i.length&&(e.each(i,(function(e,t){var i=t.getAsFile&&t.getAsFile();i&&n.files.push(i)})),!1!==this._trigger("paste",e.Event("paste",{delegatedEvent:t}),n)&&this._onAdd(t,n))},_onDrop:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var i=this,n=t.dataTransfer,a={};n&&n.files&&n.files.length&&(t.preventDefault(),this._getDroppedFiles(n).always((function(n){a.files=n,!1!==i._trigger("drop",e.Event("drop",{delegatedEvent:t}),a)&&i._onAdd(t,a)})))},_onDragOver:t("dragover"),_onDragEnter:t("dragenter"),_onDragLeave:t("dragleave"),_initEventHandlers:function(){this._isXHRUpload(this.options)&&(this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave}),this._on(this.options.pasteZone,{paste:this._onPaste})),e.support.fileInput&&this._on(this.options.fileInput,{change:this._onChange})},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragenter dragleave dragover drop"),this._off(this.options.pasteZone,"paste"),this._off(this.options.fileInput,"change")},_destroy:function(){this._destroyEventHandlers()},_setOption:function(t,i){var n=-1!==e.inArray(t,this._specialOptions);n&&this._destroyEventHandlers(),this._super(t,i),n&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;void 0===t.fileInput?t.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]'):t.fileInput instanceof e||(t.fileInput=e(t.fileInput)),t.dropZone instanceof e||(t.dropZone=e(t.dropZone)),t.pasteZone instanceof e||(t.pasteZone=e(t.pasteZone))},_getRegExp:function(e){var t=e.split("/"),i=t.pop();return t.shift(),new RegExp(t.join("/"),i)},_isRegExpOption:function(t,i){return"url"!==t&&"string"===e.type(i)&&/^\/.*\/[igm]{0,3}$/.test(i)},_initDataAttributes:function(){var t=this,i=this.options,n=this.element.data();e.each(this.element[0].attributes,(function(e,a){var r,o=a.name.toLowerCase();/^data-/.test(o)&&(o=o.slice(5).replace(/-[a-z]/g,(function(e){return e.charAt(1).toUpperCase()})),r=n[o],t._isRegExpOption(o,r)&&(r=t._getRegExp(r)),i[o]=r)}))},_create:function(){this._initDataAttributes(),this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=0,this._initProgressObject(this),this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(t){var i=this;t&&!this.options.disabled&&(t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always((function(e){t.files=e,i._onAdd(null,t)})):(t.files=e.makeArray(t.files),this._onAdd(null,t)))},send:function(t){if(t&&!this.options.disabled){if(t.fileInput&&!t.files){var i,n,a=this,r=e.Deferred(),o=r.promise();return o.abort=function(){return n=!0,i?i.abort():(r.reject(null,"abort","abort"),o)},this._getFileInputFiles(t.fileInput).always((function(e){n||(e.length?(t.files=e,(i=a._onSend(null,t)).then((function(e,t,i){r.resolve(e,t,i)}),(function(e,t,i){r.reject(e,t,i)}))):r.reject())})),this._enhancePromise(o)}if(t.files=e.makeArray(t.files),t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})})),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?e(require("jquery")):e(window.jQuery)}((function(e){"use strict";var t=0,i=e,n="parseJSON";"JSON"in window&&"parse"in JSON&&(i=JSON,n="parse"),e.ajaxTransport("iframe",(function(i){if(i.async){var n,a,r,o=i.initialIframeSrc||"javascript:false;";return{send:function(s,l){(n=e('
    ')).attr("accept-charset",i.formAcceptCharset),r=/\?/.test(i.url)?"&":"?","DELETE"===i.type?(i.url=i.url+r+"_method=DELETE",i.type="POST"):"PUT"===i.type?(i.url=i.url+r+"_method=PUT",i.type="POST"):"PATCH"===i.type&&(i.url=i.url+r+"_method=PATCH",i.type="POST"),a=e('').on("load",(function(){var t,r=e.isArray(i.paramName)?i.paramName:[i.paramName];a.off("load").on("load",(function(){var t;try{if(!(t=a.contents()).length||!t[0].firstChild)throw new Error}catch(e){t=void 0}l(200,"success",{iframe:t}),e('').appendTo(n),window.setTimeout((function(){n.remove()}),0)})),n.prop("target",a.prop("name")).prop("action",i.url).prop("method",i.type),i.formData&&e.each(i.formData,(function(t,i){e('').prop("name",i.name).val(i.value).appendTo(n)})),i.fileInput&&i.fileInput.length&&"POST"===i.type&&(t=i.fileInput.clone(),i.fileInput.after((function(e){return t[e]})),i.paramName&&i.fileInput.each((function(t){e(this).prop("name",r[t]||i.paramName)})),n.append(i.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data"),i.fileInput.removeAttr("form")),window.setTimeout((function(){n.submit(),t&&t.length&&i.fileInput.each((function(i,n){var a=e(t[i]);e(n).prop("name",a.prop("name")).attr("form",a.attr("form")),a.replaceWith(n)}))}),0)})),n.append(a).appendTo(document.body)},abort:function(){a&&a.off("load").prop("src",o),n&&n.remove()}}}})),e.ajaxSetup({converters:{"iframe text":function(t){return t&&e(t[0].body).text()},"iframe json":function(t){return t&&i[n](e(t[0].body).text())},"iframe html":function(t){return t&&e(t[0].body).html()},"iframe xml":function(t){var i=t&&t[0];return i&&e.isXMLDoc(i)?i:e.parseXML(i.XMLDocument&&i.XMLDocument.xml||e(i.body).html())},"iframe script":function(t){return t&&e.globalEval(e(t[0].body).text())}}})}));