blue-twilight/public/js/blue-twilight.min.js

2 lines
1.6 MiB
JavaScript
Raw Normal View History

function AboutViewModel(e){this.el="#about-app",this.data={can_upgrade:!1,is_loading:!0,version_body:"",version_date:"",version_name:"",version_url:""},this.computed={},this.methods={init:function(){var t=this;$.ajax(e.latest_release_url,{complete:function(){t.is_loading=!1},dataType:"json",error:function(e,t,c){},method:"GET",success:function(e){t.version_body=e.body,t.version_date=e.publish_date,t.version_name=e.name,t.version_url=e.url,t.can_upgrade=e.can_upgrade}})}}}function CreateAlbumViewModel(){this.el="#create-album-app",this.data={is_inherit_permissions:!0,is_private:!1,parent_id:""},this.computed={isParentAlbum:function(){return""==this.parent_id},isPrivateDisabled:function(){return!this.isParentAlbum&&this.is_inherit_permissions}}}function EditAlbumViewModel(){this.el="#edit-album-app",this.data={parent_id:""},this.computed={isParentAlbum:function(){return""==this.parent_id}}}function SettingsViewModel(c,n){this.el="#settings-app",this.data={is_rebuilding_permissions_cache:!1},this.methods={rebuildPermissionsCache:function(e){var t=this;return $.ajax(c.rebuild_permissions_cache,{complete:function(){t.is_rebuilding_permissions_cache=!1},dataType:"json",error:function(e,t,c){alert(n.permissions_cache_rebuild_failed)},method:"POST",success:function(e){alert(n.permissions_cache_rebuild_succeeded)}}),e.preventDefault(),!1}}}function AnalyseAlbumViewModel(){this.el="#analyse-album",this.data={imagesFailed:[],imagesToAnalyse:[],imagesInProgress:[],imagesRecentlyCompleted:[],numberSuccessful:0,numberFailed:0},this.computed={failedPercentage:function(){var e=0;return 0<this.numberTotal&&(e=this.numberFailed/this.numberTotal*100),e.toFixed(2)+"%"},isCompleted:function(){return 0<this.numberTotal&&this.numberSuccessful+this.numberFailed>=this.numberTotal},latestCompletedImages:function(){var e=this.imagesRecentlyCompleted.length-3<0?0:this.imagesRecentlyCompleted.length-3,t=3+e;return this.imagesRecentlyCompleted.slice(e,t)},numberTotal:function(){return this.imagesToAnalyse.length},successfulPercentage:function(){var e=0;return 0<this.numberTotal&&(e=this.numberSuccessful/this.numberTotal*100),e.toFixed(2)+"%"}},this.methods={analyseImage:function(n){var i=this;this.imagesToAnalyse.push(n),$.ajax(n.url,{beforeSend:function(){i.imagesInProgress.push(n)},dataType:"json",error:function(e,t,c){i.numberFailed++,i.imagesFailed.push({name:n.name,reason:t}),n.isSuccessful=!1,n.isPending=!1},method:"POST",success:function(e){var t;e.is_successful?(i.numberSuccessful++,n.isSuccessful=!0,n.isPending=!1,i.imagesRecentlyCompleted.push(n),-1<(t=i.imagesInProgress.indexOf(n))&&i.imagesInProgress.splice(t,1)):(i.numberFailed++,i.imagesFailed.push({name:n.name,reason:e.message}),n.isSuccessful=!1,n.isPending=!1,-1<(t=i.imagesInProgress.indexOf(n))&&i.imagesInProgress.splice(t,1))}})}}}function AnalyseImageViewModel(e){this.isPending=!0,this.isSuccessful=!1,this.name=e.name,this.photoID=e.photo_id,this.url=e.url}function EditPhotosViewModel(r,a,o){this.el="#photos-tab",this.data={albums:[],bulkModifyMethod:"",isSubmitting:!1,photoIDs:[],photoIDsAvailable:[],selectAllInAlbum:0},this.methods={bulkModifySelected:function(e){if(this.isSubmitting)return!0;var c=this,n=$(e.target).closest("form");return"change_album"===this.bulkModifyMethod?(this.promptForNewAlbum(function(e){var t=$("select",e).val();$('input[name="new-album-id"]',n).val(t),c.isSubmitting=!0,$('button[name="bulk-apply"]',n).click(),_bt_showLoadingModal()}),e.preventDefault(),!1):"delete"!==this.bulkModifyMethod||(bootbox.dialog({message:a.delete_bulk_confirm_message,title:a.delete_bulk_confirm_title,buttons:{cancel:{label:a.action_cancel,className:"btn-secondary"},confirm:{label:a.action_delete,className:"btn-danger",callback:function(){c.isSubmitting=!0,$('button[name="bulk-apply"]',n).click(),_bt_showLoadingModal()}}}}),e.preventDefault(),!1)},changeAlbum:function(e){this.selectPhotoSingle(e.target);var c=this.photoIDs[0];return this.photoIDs=[],this.promptForNewAlbum(function(e){var t=$("select",e).val();$.post(o.move_photo.replace(/\/0$/,"/"+c),{new_album_id:t},function
//# sourceMappingURL=blue-twilight.min.js.map