Peer-to-Peer-Powered Download
Keep this browser tab active in foreground. Finish in
ERROR while downloading. REFRESH or try another download method!
.torrent You can use Vuze or other WebTorrent desktop clients to download and seed
"Save as" window will pop up for each file, when download finishes. This window must be in foreground. You can set your browser to allow download of multiple files: Settings > Advanced > Ask where to save each file before downloading. Doesn’t work? Let us know
X
' ).attr( { 'class' : 'styled-select upload-access-switch-select' , } )var objTypeSelect = $( '' ).attr( { 'class' : 'upload-access-switch_type-select' , 'disabled' : ( this.strUploadAccessSwitchType == 'default' && ! this.bolOwnerLoggedIn ? true : false ) } );objTypeSelect.append($( '
' ).text( '' ));if ( this.bolOwnerLoggedIn ){objTypeSelect.append( $( '
' ).attr( { 'value' : 'private' , 'desc' : 'Only you or users invited by email can access.' , 'selected' : ( this.strAccessType == 'private' ? true : false ) } ) .text( 'Only with private permission' ) );}if ( this.strUploadAccessSwitchType == 'default' ){ objTypeSelect.append( $( '
' ).attr( { 'value' : 'link' , 'desc' : 'View and download access' , 'selected' : ( this.strAccessType == 'link' ? true : false ) } ) .text( 'Anyone who knows the link' ) );}else if ( this.strUploadAccessSwitchType == 'sharing_form' ){ objTypeSelect.append( $( '
' ).attr( { 'value' : 'link-can-view' , 'desc' : 'View and download.' , 'selected' : ( this.strAccessType == 'link' ? true : false ) , 'class' : 'upload-access-switch_type-select_option_link-can-view' } ) .text( 'via link to access content' ) ); objTypeSelect.append( $( '
' ).attr( { 'value' : 'link-can-edit' , 'desc' : 'Link to add, edit or delete content.' , 'selected' : ( this.strAccessType == 'link-can-edit' ? true : false ) , } ) .text( 'Get a link to edit content' ) ); if ( this.strItemType == 'upload' ) { objTypeSelect.append( $( '
' ).attr( { 'value' : 'link-can-upload' , 'desc' : 'Visitors can add files, but can’t delete or edit existing.' , 'selected' : ( this.strAccessType == 'link-can-upload' ? true : false ) , } ) .text( 'Get Link to add content' ) ); }}if ( this.strItemType == 'upload' && this.bolOwnerLoggedIn ){objTypeSelect.append( $( '
' ).attr( { 'value' : 'password' , 'desc' : 'Visitors must enter a password to access' , 'selected' : ( this.strAccessType == 'password' ? true : false ) } ) .text( 'Set password' ) );objTypeSelect.append( $( '
' ).attr( { 'value' : 'public' , 'desc' : 'Visible to anyone on your profile and via search.' , 'selected' : ( this.strAccessType == 'public' ? true : false ) } ) .text( 'Posted on my profile page' ) );}objTypeSelectWrap.append( objTypeSelect );$( this.objParentElement ).html($( '
' ).attr( {'class' : 'upload-access-switch' ,'data-selected-access-type' : this.strAccessType } ).append($( '
' ).attr( {'class' : 'upload-access-switch_type-wrapper' } ).append($( '' ).text( ( this.strUploadAccessSwitchType == 'sharing_form' ? 'Link and Access rights:' : 'Access:' ) )).append( objTypeSelectWrap )).append($( '
' ).attr( {'class' : 'upload-access-switch_password-wrapper'} ).append($( '' ).text( 'Password:' )).append($( '' ).attr( {'class' : 'upload-access-switch_password' , 'type' : 'text' , 'placeholder' : 'Enter a password' , 'title' : 'Enter a password' , 'value' : this.strUploadPassword} )).append($( '
' ).attr( {'class' : 'upload-access-switch_password-save-btn'} ).text( 'Save' ))).append($( '
' ).attr( {'class' : 'upload-access-switch_loading-mask'} ).append($( '' ).attr( {'class' : 'fal fa-spinner fa-spin'} ))));checkTooltips();var x, i, j, selElmnt, a, b, c, d, e;/*look for any elements with the class "styled-select":*/x = document.getElementsByClassName("upload-access-switch-select");for (i = 0; i < x.length; i++) {if (x[i].getElementsByClassName("select-selected").length < 1) {selElmnt = x[i].getElementsByTagName("select")[0];/*for each element, create a new DIV that will act as the selected item:*/a = document.createElement("DIV");a.setAttribute("class", "select-selected");a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;x[i].appendChild(a);/*for each element, create a new DIV that will contain the option list:*/b = document.createElement("DIV");b.setAttribute("class", "select-items select-hide");for (j = 1; j < selElmnt.length; j++) {/*for each option in the original select element,create a new DIV that will act as an option item:*/c = document.createElement("DIV");d = document.createElement("DIV");if(selElmnt.options[j].value == selElmnt.value){c.setAttribute("class", "checked");}e = document.createElement("DIV");e.setAttribute("class", "value");d.setAttribute("class", "desc");//c.innerHTML = selElmnt.options[j].innerHTML;e.innerHTML = selElmnt.options[j].innerHTML;d.innerHTML = selElmnt.options[j].getAttribute('desc');c.appendChild(e);c.appendChild(d);if ( !!selElmnt.id && !!selElmnt.options[j].value ){c.setAttribute( 'id', selElmnt.id + '_' + selElmnt.options[j].value );}c.addEventListener("click", function(e) {/*when an item is clicked, update the original select box,and the selected item:*/var y, i, k, s, sjq, h, clicked;clicked = this;s = this.parentNode.parentNode.getElementsByTagName("select")[0];sjq = $(s);$(clicked).parents().children().removeClass('checked');$(clicked).addClass('checked');h = this.parentNode.previousSibling;for (i = 0; i < s.length; i++) {if (s.options[i].innerHTML == this.getElementsByClassName("value")[0].innerHTML) {s.selectedIndex = i;h.innerHTML = this.getElementsByClassName("value")[0].innerHTML;y = this.parentNode.getElementsByClassName("same-as-selected");for (k = 0; k < y.length; k++) {y[k].removeAttribute("class");}this.setAttribute("class", "same-as-selected checked");sjq.trigger("change");break;}}h.click();});b.appendChild(c);}x[i].appendChild(b);a.addEventListener("click", function(e) {/*when the select box is clicked, close any other select boxes,and open/close the current select box:*/e.stopPropagation();closeAllSelect(this);this.nextSibling.classList.toggle("select-hide");this.classList.toggle("select-arrow-active");this.parentElement.classList.toggle("blue-border");if (this.parentElement.previousElementSibling){this.parentElement.previousElementSibling.classList.toggle("blue-span");}});}}function closeAllSelect(elmnt) {/*a function that will close all select boxes in the document,except the current select box:*/var x, y, i, arrNo = [];x = document.getElementsByClassName("select-items");y = document.getElementsByClassName("select-selected");for (i = 0; i < y.length; i++) {if (elmnt == y[i]) {arrNo.push(i)} else {y[i].classList.remove("select-arrow-active");}}for (i = 0; i < x.length; i++) {if (arrNo.indexOf(i)) {x[i].classList.add("select-hide");x[i].parentElement.classList.remove("blue-border");if (x[i].parentElement.previousElementSibling){x[i].parentElement.previousElementSibling.classList.remove("blue-span");}}}}/*if the user clicks anywhere outside the select box,then close all select boxes:*/if ( ! bolUploadAccessSwitch_closeAllSelect_Binded ){document.addEventListener("click", closeAllSelect);bolUploadAccessSwitch_closeAllSelect_Binded = true;}if ( ! this.bolOwnerLoggedIn ){if ( this.strUploadAccessSwitchType == 'sharing_form' ){// do nothing}else{ $( this.objParentElement ).on( 'click', function( event ) { showCreateAccount(); } );}}else{ $( this.objParentElement ).find( '.upload-access-switch_type-select' ).on( 'change', function() { _this.changeAccessType( $( this ).val() ); } ); $( this.objParentElement ).find( '.upload-access-switch_password' ).on( 'change', function() { _this.changeAccessType( 'password' ); } );$( this.objParentElement ).find( '.upload-access-switch_password' ).on( 'input', function() {$( '.upload-access-switch_password-save-btn' ).html('Save'); $( '.upload-access-switch_password-save-btn' ).removeClass("green"); } );}}this.init();this.changeAccessType = function( strNewAccessType ){$( this.objParentElement ).find( '.upload-access-switch' ).attr( 'data-selected-access-type', strNewAccessType );if ( strNewAccessType == 'password' && $( this.objParentElement ).find( '.upload-access-switch_password' ).val().trim() == '' ){showTooltip( $( this.objParentElement ).find( '.upload-access-switch_password' ), 'Enter a password' );return;}if (strNewAccessType == 'link-can-view'|| strNewAccessType == 'link-can-edit'|| strNewAccessType == 'link-can-upload'){strNewAccessType = 'link';}if ( this.strItemType == 'file' ){if ( this.strParentAccessType == 'LINK' && strNewAccessType == 'private' ){ this.afterErrorOn_changeAcceccType( 'Setting this file to private will not work because upper folder is not set private. Toggle access settings for the folder, first.' );return;}}this.showLoadingMask();var strAjax_Url = ''; var objAjax_Data = null; if ( this.strItemType == 'upload' ) { strAjax_Url = '/ajax/upload_info.php?PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812'; objAjax_Data = { 'set_upload_access_type' : true ,'upload_hash' : this.strUploadHash ,'upload_access_type' : strNewAccessType ,'upload_password' : $( this.objParentElement ).find( '.upload-access-switch_password' ).val() }; } else if ( this.strItemType == 'file' ) { strAjax_Url = '/ajax/file_info.php?PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812'; objAjax_Data = { 'set_file_access_type' : true ,'file_hash' : this.strFileHash ,'file_access_type' : strNewAccessType }; } $.ajax( { type: "POST", dataType: "json", url: strAjax_Url , data: objAjax_Data , success: function( data ) { if ( data['status'] == 'ok' ) { _this.strAccessType = strNewAccessType; _this.bolAccessTypeChanged = true; if ( _this.strItemType == 'upload' ) { if ( strNewAccessType != 'password' ) { $( _this.objParentElement ).find( '.upload-access-switch_password' ).val( '' ); }else {$( '.upload-access-switch_password-save-btn' ).html('Saved!'); $( '.upload-access-switch_password-save-btn' ).addClass("green");} if ( strNewAccessType == 'link' ) { $( '#upload_button__publish' ).show(); $( '#upload_button__unpublish' ).hide(); } else if ( strNewAccessType == 'public' ) { $( '#upload_button__publish' ).hide(); $( '#upload_button__unpublish' ).show(); } else { $( '#upload_button__publish' ).hide(); $( '#upload_button__unpublish' ).hide(); } if ( _this.strEmbedPlace == 'filebrowser' ) { gaev( 'filebrowser-folder-info', 'access', strNewAccessType ); } } if ( _this.strItemType == 'upload' && ( _this.strEmbedPlace == 'filebrowser' || _this.strEmbedPlace == 'list' ) ) { location.reload(); } _this.hideLoadingMask(); } else { _this.afterErrorOn_changeAcceccType(); } } , error: function() { _this.afterErrorOn_changeAcceccType(); } } );}this.afterErrorOn_changeAcceccType = function( strErrorMsg ){if ( this.strAccessType == 'link' && this.strUploadAccessSwitchType == 'sharing_form' ){this.strAccessType = 'link-can-view';} $( this.objParentElement ).find( '.upload-access-switch' ).attr( 'data-selected-access-type', this.strAccessType );$( this.objParentElement ).find( '.upload-access-switch_type-select option[value="' + this.strAccessType + '"]' ).attr( 'selected', 'selected' );$( this.objParentElement ).find( '.upload-access-switch_type-select' ).trigger( 'change' );if ( typeof strErrorMsg == 'undefined' ){strErrorMsg = 'An error occurred. Try again!';}fError( strErrorMsg );this.hideLoadingMask();}this.showLoadingMask = function(){$( this.objParentElement ).find( '.upload-access-switch_loading-mask' ).show();}this.hideLoadingMask = function(){$( this.objParentElement ).find( '.upload-access-switch_loading-mask' ).hide();}}
- from -
-%
- -
Copy complete
OK
') $('.edit_wrapper_edit_button').click(function() { $(this).parent().find("textarea").focus(); }); $('#file_description_edit_wrapper textarea').on("keyup change", function(e) { autoGrow( this, '32px' ); if ( bolIsOwner ) { updateFileDescription(); } }); $('#file_name_edit_wrapper textarea').on("keyup change", function(e) { autoGrow( this, '32px' ); if ( bolIsOwner ) { updateFileName(); } }); $('#file_name_edit_wrapper textarea').on("focus", function(e) { $('#file_name_edit_wrapper textarea').val( $('#file_name_edit_wrapper textarea').val().replace( '.' + arrExtensions[ intCurrentFileIndex ], '' ) ); } ) $('#file_name_edit_wrapper textarea').on("focusout", function(e) { $('#file_name_edit_wrapper textarea').val( $('#file_name_edit_wrapper textarea').val() + '.' + arrExtensions[ intCurrentFileIndex ] ); } ) $('#file_description_edit_wrapper textarea').on("focus", function(e) { $( "#file_description_edit_wrapper" ).removeClass("no-description"); } ) $('#file_description_edit_wrapper textarea').on("focusout", function(e) { if ( $('#file_description_edit_wrapper textarea').val() == '' ) { $( "#file_description_edit_wrapper" ).addClass("no-description"); } else { $( "#file_description_edit_wrapper" ).removeClass("no-description"); } } ) if ( bolIsOwner ) { $('#gallery2__header__setprice').show(); }if ( ! bolHideShareButtons ){ $('#gallery2__share').show(); $('#gallery2_item_info_share-wrapper').show();} if (arrHashes.length == 1){hideThumbs();}$('#gallery_file_tags_container .file_tags_input').tagsInput({'autocomplete_url': './ajax/file_tag.php?autocomplete&PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812' ,'autocomplete': { selectFirst:false, autoFill:false},'height' : 'auto','width' : '100%', 'interactive' : bolIsOwner || ( window.location.href.indexOf( "filebrowser" ) !== -1 && 0 ),'defaultText' : 'Add tags','onAddTag' : function(strTagName) {$('#gallery_file_tags_container .file_tags_error').hide();$.ajax({type: "POST",dataType: "json",url: "./ajax/file_tag.php?PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812",data: {'add_file_tag': true ,'file_hash' : strCurrentFileHash ,'tag_name': strTagName} ,success: function(data){if (data['status'] == 'ok'){var intItemIndex = getItemIndex(strCurrentFileHash);arrTags[intItemIndex] += ';' + strTagName; $('#sidebar_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]); //update tags in filebrowser}else{$('#gallery_file_tags_container .file_tags_error').show();}} ,error: function(){$('#gallery_file_tags_container .file_tags_error').show();}});} ,'onRemoveTag' : function(strTagName){$('#gallery_file_tags_container .file_tags_error').hide();$.ajax({type: "POST",dataType: "json",url: "./ajax/file_tag.php?PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812",data: {'delete_file_tag': true ,'file_hash' : strCurrentFileHash ,'tag_name': strTagName} ,success: function(data){if (data['status'] == 'ok'){var intItemIndex = getItemIndex(strCurrentFileHash);arrTags[intItemIndex] = arrTags[intItemIndex].replace(strTagName, ''); $('#sidebar_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]); //update tags in filebrowser}else{$('#gallery_file_tags_container .file_tags_error').show();}} ,error: function(){$('#gallery_file_tags_container .file_tags_error').show();}});} ,'delimiter' : [';'] ,'removeWithBackspace' : true ,'minChars' : 1 ,'maxChars' : 245 ,'placeholderColor' : '#666666'});function getFileShareParams() { if ( objMainShareParams ) { var intItemIndex = getItemIndex( strCurrentFileHash ); var objFileShareParams = {}; for ( idx in objMainShareParams ) { objFileShareParams[ idx ] = objMainShareParams[ idx ]; } if ( typeof( arrFileShareLinks ) != 'undefined' && typeof( arrFileShareLinks[ intItemIndex ] ) != 'undefined' ) { objFileShareParams[ 'view_url' ] = 'https://file.fm' + arrFileShareLinks[ intItemIndex ]; } else { objFileShareParams[ 'view_url' ] += '#/view/' + arrHashes[ intItemIndex ]; } objFileShareParams[ 'can_share' ] = bolIsOwner; objFileShareParams[ 'show_type_select' ] = false; objFileShareParams[ 'type' ] = 'one_file'; var strFileShareParams_PictureUrl = ''; if ( arrFileTypes[ intItemIndex ] == 'image' ) { strFileShareParams_PictureUrl = 'https://file.fm/thumb_show.php?i=' + arrHashes[ intItemIndex ] + '&view'; } var strFileViewLink = 'https://file.fm/f/' + strCurrentFileHash; var strFileEditLink = ''; if ( bolCanDelete && typeof arrFileDeleteKeys != 'undefined' && arrFileDeleteKeys[ intItemIndex ] != '' ) { strFileEditLink = strFileViewLink + '?fk=' + arrFileDeleteKeys[ intItemIndex ]; } objFileShareParams[ 'one_file' ] = { 'view_url': strFileViewLink, 'edit_url': strFileEditLink, 'facebook': { 'name': strFileViewLink, 'picture_url': strFileShareParams_PictureUrl, 'description': strFileViewLink, 'link': strFileViewLink, 'return_link': objFileShareParams[ 'all_files' ][ 'facebook' ][ 'return_link' ] }, 'twitter': { 'text': DOMAIN_NAME + ': ', 'link': strFileViewLink }, 'share_email': { 'upload_hash': '', 'file_view_hash': strCurrentFileHash }, 'embed_player': { 'file_view_hash': null }, 'item_info': { 'file_view_hash': strCurrentFileHash, 'upload_hash': objFileShareParams[ 'all_files' ][ 'share_email' ][ 'upload_hash' ], 'file_name': arrDisplayNames[ intItemIndex ], 'item_name': arrDisplayNames[ intItemIndex ], 'extension': arrExtensions[ intItemIndex ], 'owner_logged_in': bolIsOwner, 'access_type': ( typeof arrFileAccessTypes != 'undefined' ? arrFileAccessTypes[ intItemIndex ] : '' ), 'parent_access_type': arrAccessType[ intItemIndex ] } }; if ( typeof( bolIsAnonymousUpload ) == 'boolean' && bolIsAnonymousUpload && arrFeeDownloadPrice[ intItemIndex ] == null && arrAllowDownload[ intItemIndex ] && ( arrAccessType[ intItemIndex ] == 'LINK' || arrAccessType[ intItemIndex ] == 'PUBLIC' ) && arrUploadPassword[ intItemIndex ] == '' && arrAllowPublicDownload[ intItemIndex ] ) { objFileShareParams[ 'one_file' ][ 'embed_player' ] = { 'file_view_hash': strCurrentFileHash, 'file_extension': arrExtensions[ intItemIndex ], 'is_video': arrIsVideo[ intItemIndex ] } } return objFileShareParams; } return null; } window.galleryGetFileShareParams = getFileShareParams; $( document ).on( 'click', '#gallery2__share', function ( e ) { var objFileShareParams = getFileShareParams(); if ( objFileShareParams !== null ) { showSharePopup( e, objFileShareParams ); } } ); $( document ).on( 'click', '#gallery2_upload_button__share_with_users', function ( e ) { var objFileShareParams = getFileShareParams(); if ( objFileShareParams !== null ) { showSharePopup( e, objFileShareParams ); } } ); $( document ).on( 'click', '#gallery2__sign, #gallery2__left_info-button_sign', function ( e ) { if ( bolCanEdit ) { objEparakstsFileSigningForm.showForm( [ strCurrentFileHash ] ); } else { fError( 'This link is for viewing the document only. To sign, please ask the file owner to send a link to edit the file - from the e-signature form.', 'Warning!' ); } } ); $( document ).on( 'click', '.gallery2__edit', function ( e ) { window.open( '/edit/' + strCurrentFileHash, '_blank' ); } ); $( document ).on( 'click', '.gallery2__button__buy-products', function ( e ) { window.open( '/c/' + strUploadHash + '?h=' + strCurrentFileHash, '_blank' ); } ); $( document ).on( 'click', '.print_or_buy_popup__products', function ( e ) { window.open( '/c/' + strUploadHash + '?h=' + strCurrentFileHash, '_blank' ); } ); $( document ).on( 'contextmenu', 'video', function ( e ) { e.preventDefault(); } ); $( document ).on( 'click', '#gallery2__sidebar__info_embed_button', function ( e ) { var objFileShareParams = getFileShareParams(); if ( objFileShareParams !== null ) { window.FileEmbedPopup.showPopup( e, objFileShareParams ); } } ); $(window).resize(function() {if (!bolGalleryIsVisible){bolHaveToRedrawGallery = true;}else{ recalculateGalleryForBanner(true);}});/*** Check video network state, if loading longer than 1+1 intervals, show thumbnail generation message ***/var bolHasVideo = false;for ( idx in arrFileTypes){if ( arrFileTypes[idx] == 'video' ){bolHasVideo = true;}}if (bolHasVideo){if ( resVideoCheckInterval != null){clearInterval(resVideoCheckInterval);resVideoCheckInterval = null;}resVideoCheckInterval = setInterval(function () {for ( idx in arrFileTypes){if ( arrFileTypes[idx] == 'video' ){var domVideo = document.getElementById('video_' + arrHashes[idx]); if ( domVideo ){ // iOS safari workaround - "play" gets fired when the play button is clicked => set video as loading if(bolIsiOSDevice) { domVideo.addEventListener('play', function () { objVideoIsLoading[idx] = true; }); } var bolIsLoading = bolIsiOSDevice ? objVideoIsLoading[idx] : false; // iOS safari workaround: video has stopped loading when its duration attribute is > 0 if (domVideo.duration > 0 && bolIsiOSDevice) { bolIsLoading = false; } // If network connection active (2=NETWORK_LOADING) - this is broken in iOS safari else if (domVideo.networkState == 2){bolIsLoading = true;}if ( bolIsLoading ){if (objVideoIsLoading[idx] == true){$('#video_thumb_gen_'+ arrHashes[idx]).css({'visibility':'visible'});}objVideoIsLoading[idx] = true;}else if ( objVideoIsLoading[idx] ){objVideoIsLoading[idx] = false;$('.video_thumb_gen').css({'visibility':'hidden'});}}}}}, 3000);}/***/ /*** Close in item main element click ***/ $( '#gallery2' ).on( 'bx_slider_click', '.bx-viewport', function( e, domElement ){ if ( $(domElement).hasClass('gallery2__item') ) { closeGallery(strCurrentFileHash); } });bolGalleryInitalizedState = 1; } $(function (){ if ( bolGalleryInitalizedState === null ) { galleryInitalize();}}); $(document).on( "fullscreenchange", function () { adjustContentWidth( true ); } ); $(document).on("keydown", function(evt) { if (evt.altKey || evt.ctrlKey || evt.metaKey || $(evt.target).is(":input")) { return; } if ( ! bolGalleryIsVisible ) { return;}if( 0) { return; } var key = evt.keyCode; if (key == 37 ) { galleryOpenPrevItem(); } else if (key == 39) { galleryOpenNextItem();} else if (key == 27) { closeGallery(strCurrentFileHash); } }); function autoGrow( element, strMinHeight ) { if( typeof strMinHeight === "undefined" ) { strMinHeight = '32px'; } element.style.height = strMinHeight; element.style.height = element.scrollHeight + "px"; element.style.height = element.scrollHeight + 5 + "px"; } function galleryCalculateOffset(el) { var rect = el.getBoundingClientRect(), scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, scrollTop = window.pageYOffset || document.documentElement.scrollTop; return { top: rect.top + scrollTop, left: rect.left + scrollLeft }} window.getImageCountText = function() { return ( parseInt( intCurrentFileIndex ) + 1 ) + ' / ' + arrIDs.length; }; function checkThumbStripArrows() { var jqThumbStrip = $('#gallery2__thumb-strip'); var jqThumbStripInner = $('#gallery2__thumb-strip__inner'); var intThumbWidthSum = 0; $('A', jqThumbStripInner).each(function (){ intThumbWidthSum += $(this).width(); }); var bolShowThumbStripArrows = false; if ( parseInt( jqThumbStripInner.css('left') ) + parseInt( jqThumbStripInner.css('margin-right') ) < 0 || jqThumbStrip.width() - ( parseInt( jqThumbStripInner.css('left') ) + parseInt( jqThumbStripInner.css('margin-right') ) ) <= intThumbWidthSum ) { bolShowThumbStripArrows = true; } if ( ! bolShowThumbStripArrows ) { $('#gallery2__thumb-strip__buttons').hide(); } else { $('#gallery2__thumb-strip__buttons').show(); } } var bolHideShareButtons = false;var bolGalleryIsShowingItem = false; var clickedItemHash = null; function showGalleryItem( strHash ) { if (arrHashes.length == 1){ hideThumbs();} clickedItemHash = strHash;if ( bolGalleryIsShowingItem ){return;}bolGalleryIsShowingItem = true; var bolP2PDownloadAllowed = false; var bolSimpleDownloadAllowed = false; strCurrentFileHash = strHash; intCurrentFileIndex = getItemIndex ( strHash ); strCurrentFileName = arrDisplayNames[intCurrentFileIndex]; preloadImage ( intCurrentFileIndex );if ( ! bolGalleryIsVisible ){showGallery();}stopActiveContent();checkBeforeContentChange (); jqMainSlider.goToSlide( intCurrentFileIndex ); checkAfterContentChange(); // checkGalleryArrows(); if ($('#share_popup').is(":visible")) { hideSharePopup(); } if ( typeof window.FileEmbedPopup !== 'undefined' ) { window.FileEmbedPopup.hidePopup(); } if ( arrFileTypes[intCurrentFileIndex] == 'image' && arrFeeDownloadPrice[intCurrentFileIndex] == null) { $('#gallery2__header__view-original').show(); $('#gallery2__header__view-original-small').css( 'visibility', 'visible' ); } else { $('#gallery2__header__view-original').hide(); $('#gallery2__header__view-original-small').css( 'visibility', 'hidden' ); } $('.gallery2__header__img-count').text( window.getImageCountText() );if (arrAllowDownload[intCurrentFileIndex] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[intCurrentFileIndex] )){ bolSimpleDownloadAllowed = true;$('.gallery2__save_button').show();$('#gallery2__sidebar__info_embed_button').show();$('#gallery2__share').show();$('#gallery2_item_info_share-wrapper').show();}else{ bolSimpleDownloadAllowed = false;$('.gallery2__save_button').hide();$('#gallery2__sidebar__info_embed_button').hide();$('#gallery2__share').hide(); $('#gallery2_item_info_share-wrapper').hide();} if ( bolIsOwner ) { $('#gallery2__item_info_delete').show(); } else { $('#gallery2__item_info_delete').hide(); } $( '#gallery2__left_info__signers-list-container' ).hide(); if ( bolCanEdit && ( typeof arrFileIsLockedByOtherUser == 'undefined' || ! arrFileIsLockedByOtherUser[ intCurrentFileIndex ] ) ) { $( '#gallery2__left_info-button_sign' ).show(); if (arrExtensions[intCurrentFileIndex] == 'edoc'|| arrExtensions[intCurrentFileIndex] == 'pdf'|| arrExtensions[intCurrentFileIndex] == 'doc'|| arrExtensions[intCurrentFileIndex] == 'docx') { $('#gallery2__sign').css('display', 'inline-flex'); } else { $('#gallery2__sign').hide(); } } else { $( '#gallery2__left_info-button_sign' ).hide(); $( '#gallery2__sign' ).hide(); } if ( bolCanEdit ) { if ( canOpenFileInEditor( 'edit', arrExtensions[ intCurrentFileIndex ] ) ) { $( '#gallery2__edit_button span' ).text( 'Edit' ); $( '.gallery2__edit' ).show(); } else if ( canOpenFileInEditor( 'view', arrExtensions[ intCurrentFileIndex ] ) ) { $( '#gallery2__edit_button span' ).text( 'View' ); $( '.gallery2__edit' ).show(); } else { $( '.gallery2__edit' ).hide(); } } else { $( '.gallery2__edit' ).hide(); } $( '.gallery2__button__buy-products' ).hide(); if ( arrFileHasProductSelling[ intCurrentFileIndex ] == 1 ) { $( '.gallery2__button__buy-products' ).show(); } /*if ( typeof(bolHideDownloadButtons) !== 'undefined' && bolHideDownloadButtons || ( typeof(arrHideDownloadButtons) !== 'undefined' && arrHideDownloadButtons[intCurrentFileIndex] ) ) { $('.gallery2__save_button').addClass('hidden'); $('.gallery2__p2p_save_button').addClass('hidden'); }if ( arrDownloads[ intCurrentFileIndex ] < 20 ) { $('.gallery2__p2p_save_button').addClass('hidden'); }else { $('.gallery2__p2p_save_button').removeClass('hidden'); } */ if( !bolIsOwner && window.location.href.indexOf("filebrowser") === -1 && typeof arrReports != 'undefined' && typeof arrStatuses != 'undefined' && ! [3, 4].includes(arrStatuses[ intCurrentFileIndex ]) && ( typeof arrFileIsLockedByOtherUser == 'undefined' || ! arrFileIsLockedByOtherUser[ intCurrentFileIndex ] ) ) { $( '#gallery2__report_button' ).show(); if (arrReports[ intCurrentFileIndex ] == 0) { $( '#gallery2__report_button' ).click(function() { showFileReportModal(this, strCurrentFileHash); }); } else { $( '#gallery2__report_button' ).click(function() { showCancelFileReportModal(this, strCurrentFileHash); }); } } else { $( '#gallery2__report_button' ).hide(); } if ( arrFileTypes[ intCurrentFileIndex ] === 'document' && ( arrExtensions[ intCurrentFileIndex ] === 'pdf' || arrExtensions[ intCurrentFileIndex ] === 'odt' || arrExtensions[ intCurrentFileIndex ] === 'ods' || arrExtensions[ intCurrentFileIndex ] === 'odp' || isFileConvertable( 'pdf', intCurrentFileIndex ) ) && arrFeeDownloadPrice[ intCurrentFileIndex ] == null && arrAllowDownload[ intCurrentFileIndex ] ) { $( "#gallery2__controls_left" ).css( { 'margin-top': '32px', 'height': 'calc(100% - 50px)' } ); $( "#gallery2__controls_right" ).css( { 'right': '15px', 'margin-top': '32px', 'height': 'calc(100% - 50px)' } ); if( window.location.pathname.substr(0,3) !== "/f/" ) { $("#gallery2__header__info").hide(); } } else { $( "#gallery2__controls_right" ).css( { 'right': '0', 'margin-top': '32px', 'height': 'calc(100% - 50px)' } ); $( "#gallery2__controls_left" ).css( { 'margin-top': '32px', 'height': 'calc(100% - 50px)' } ); if( window.location.pathname.substr(0,3) !== "/f/" ) { $("#gallery2__header__info").show(); } } if ( arrFileTypes[ intCurrentFileIndex ] !== 'image' ) { $('#gallery2__controls_middle').removeClass('image'); $('#gallery2__controls_zoom').css('display', 'none'); $('#gallery_vote_header').show(); $('#gallery2__content-wrapper').removeClass( 'gallery__only_image' ); } else { $('#gallery2__controls_middle').addClass('image'); $('#gallery2__controls_zoom').css('display', 'block'); $('#gallery_vote_header').hide(); } if ( arrFileTypes[ intCurrentFileIndex ] !== 'audio' ) { $('#gallery2__header__fullscreen').show(); } else { $('#gallery2__header__fullscreen').hide(); }if ( bolShowP2PDownloadButton && ( typeof(objWebTorrentDownloadForm) === 'object' || ! bolIsListViewForSpecificFile ) && arrFeeDownloadPrice[ intCurrentFileIndex ] == null && arrAllowDownload[ intCurrentFileIndex ] && ( arrAccessType[ intCurrentFileIndex ] == 'LINK' || arrAccessType[ intCurrentFileIndex ] == 'PUBLIC' ) && arrUploadPassword[ intCurrentFileIndex ] == '' && arrAllowPublicDownload[ intCurrentFileIndex ] ) { bolP2PDownloadAllowed = true; $('.gallery2__p2p_save_button').css({display: 'inline-flex'}); $('.gallery2__video_filename-download .gallery2__save_button').hide(); } else { bolP2PDownloadAllowed = false; $('.gallery2__p2p_save_button').hide(); $('.gallery2__video_filename-download .gallery2__save_button').show(); } if (bolIsOwner) { $("#gallery2__buyfile").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)"); $(".print_or_buy_popup__buyfile").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)"); } else { $("#gallery2__buyfile").attr("onclick", "showBuyFileFormModal(strCurrentFileHash)"); $(".print_or_buy_popup__buyfile").attr("onclick", "showBuyFileFormModal(strCurrentFileHash)"); }// spec for public profile -> fee file count can be dynamic, assume it is > 0 if (arrFeeDownloadPrice[intCurrentFileIndex] == null){$('.gallery2__buy_button').hide();$('.gallery2__save_button').show(); if ( typeof bolHideDownloadButtons != 'undefined' && bolHideDownloadButtons ) { $( '.gallery2__save_button' ).hide(); } if (bolIsOwner) { $('#gallery2__buyfile span.text').html('Sell file'); $('#gallery2__buyfile span.price').html(''); $('#gallery2__buyfile').hide(); //hide, if there's no price $( '#gallery2__header__mid .seperator' ).hide(); $('.print_or_buy_popup__buyfile span.text').html('Sell file'); $('.print_or_buy_popup__buyfile span.price').html(''); $('.print_or_buy_popup__buyfile').hide(); //hide, if there's no price } else { $('#gallery2__buyfile').hide(); $( '#gallery2__header__mid .seperator' ).hide(); $('.print_or_buy_popup__buyfile').hide(); }}else {$('.gallery2__buy_button').css( 'display', 'inline-flex' ); $('.gallery2__save_button').hide(); if (bolIsOwner) { $('#gallery2__buyfile').show(); $( '#gallery2__header__mid .seperator' ).css('display', ''); $('#gallery2__buyfile span.text').html('Sell file'); $('#gallery2__buyfile span.price').html(' (' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $)'); $('.print_or_buy_popup__buyfile').show(); $('.print_or_buy_popup__buyfile span.text').html('Sell file'); $('.print_or_buy_popup__buyfile span.price').html(' (' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $)'); } else { $('#gallery2__buyfile').hide(); $( '#gallery2__header__mid .seperator' ).hide(); $('.print_or_buy_popup__buyfile').hide(); }}if ((arrExtensions[intCurrentFileIndex] == 'png' || arrExtensions[intCurrentFileIndex] == 'jpg' || arrExtensions[intCurrentFileIndex] == 'jpge')&& arrFeeDownloadPrice[intCurrentFileIndex] == null&& bolSimpleDownloadAllowed){$('#gallery2__item_info_order').show();$('#gallery2__order').css({display: 'inline-flex'});}else{$('#gallery2__item_info_order').hide();$('#gallery2__order').hide();}if (intCurrentFileIndex == 0){$('#gallery2__controls_left').hide();}else {$('#gallery2__controls_left').show();}if (intCurrentFileIndex == arrIDs.length - 1){$('#gallery2__controls_right').hide();}else {$('#gallery2__controls_right').show();}// Hide share button for audio player on mobileif (arrFileTypes[ intCurrentFileIndex ] == 'audio'&&( arrAllowDownload[ intCurrentFileIndex ]|| false|| arrFileAttributes[ intCurrentFileIndex ].readOnly|| arrFileAttributes[ intCurrentFileIndex ].hasPreviewVideo)&& typeof objAudioPlayer !== "undefined"&& objAudioPlayer !== null&& objAudioPlayer._isMobileView){bolHideShareButtons = true;$( '#gallery2__share' ).hide()$( '#gallery2__sidebar__info_embed_button' ).hide() $('#gallery2_item_info_share-wrapper').hide();}else{bolHideShareButtons = false;$( '#gallery2__share' ).show(); $('#gallery2_item_info_share-wrapper').show();$( '#item_info_share' ).show();$( '#gallery2__sidebar__info_embed_button' ).css( 'display', 'inline-flex' ); var strAccessType = ''; if (typeof strAccessType != 'undefined') { strAccessType = arrAccessType[ intCurrentFileIndex ]; } else { strAccessType = 'LINK'; } if(strAccessType != '') { if (bolIsOwner) { $( '#gallery_upload-access-switch' ).show(); var intItemIndex = getItemIndex( strCurrentFileHash ); var access_type = ( typeof arrFileAccessTypes != 'undefined' ? arrFileAccessTypes[ intItemIndex ] : '' ) if ( access_type == '' || access_type == null ) { access_type = 'LINK'; } if ( access_type == 'PRIVATE' && 'LINK' == 'LINK' ) { access_type = 'LINK'; } var objGalleryUploadAccessSwitch = new UploadAccessSwitch( $( '#gallery_upload-access-switch' ) , { item_type : 'file' , file_hash : strCurrentFileHash , owner_logged_in : bolIsOwner , access_type : access_type , parent_access_type : arrAccessType[ intItemIndex ], upload_access_switch_type : 'sharing_form' } ); } else { $( '#gallery_upload-access-switch' ).hide(); if ( strAccessType == 'PRIVATE' ) { $( '#gallery2_item_info_share-wrapper' ).hide(); } else { $( '#gallery2_item_info_share-wrapper' ).show(); } } } else { $( '#gallery_upload-access-switch' ).hide(); if ( strAccessType == 'PRIVATE' ) { $( '#gallery2_item_info_share-wrapper' ).hide(); } else { $( '#gallery2_item_info_share-wrapper' ).show(); } } if ( strAccessType == 'PRIVATE' ) { $( '#gallery2_item_info_share-wrapper #gallery2_item_info_share' ).hide(); $( '#gallery_upload-access-switch' ).css('padding', '0'); } else { $( '#gallery2_item_info_share-wrapper #gallery2_item_info_share' ).show(); $( '#gallery_upload-access-switch' ).css('padding', ''); } $( document ).on( 'change', '#gallery2_file_info .upload-access-switch_type-select', function() { var strAccessSwitchType = $( this ).val(); if ( strAccessSwitchType == 'private' ) { $( '#gallery2_item_info_share-wrapper #gallery2_item_info_share' ).hide(); $( '#gallery_upload-access-switch' ).css('padding', '0'); } else { $( '#gallery2_item_info_share-wrapper #gallery2_item_info_share' ).show(); $( '#gallery_upload-access-switch' ).css('padding', ''); } if ( strAccessSwitchType == 'link-can-view' ) { updateSharePopupLink( 1 ); } else if ( strAccessSwitchType == 'link-can-edit' ) { updateSharePopupLink( 2 ); } else if ( strAccessSwitchType == 'link-can-upload' ) { updateSharePopupLink( 3 ); } } ); function updateSharePopupLink(intSelected) { var objFileShareParams = galleryGetFileShareParams(); if ( intSelected == 2 && objFileShareParams[ 'one_file' ][ 'edit_url' ] != '' ) { $( '#gallery_share_popup_url' ).val( objFileShareParams[ 'one_file' ][ 'edit_url' ] ); $( '#gallery_share_popup_url' ).attr( 'data-clipboard-text', objFileShareParams[ 'one_file' ][ 'edit_url' ] ); } else if( intSelected == 3 && objFileShareParams[ 'one_file' ][ 'upload_url' ] ) { $( '#gallery_share_popup_url' ).val( objFileShareParams[ 'one_file' ][ 'upload_url' ] ); $( '#gallery_share_popup_url' ).attr( 'data-clipboard-text', objFileShareParams[ 'one_file' ][ 'upload_url' ] ); } else { $( '#gallery_share_popup_url' ).val( objFileShareParams[ 'one_file' ][ 'view_url' ] ); $( '#gallery_share_popup_url' ).attr( 'data-clipboard-text', objFileShareParams[ 'one_file' ][ 'view_url' ] ); } }} checkThumbStripArrows();// $('#gallery2__header__comments_count').text(arrCommentCounts[intCurrentFileIndex]); galleryUpdateVoteCount(); galleryLoadFileInfo(); $( '#gallery2__comments-list__loadmore' ).remove(); galleryLoadFileComments(); setTimeout('gallerySelectThumb('+ intCurrentFileIndex +')', 100); var bolLogViews = 0; // bolOwnerIsStorageSubscriber - comes from public.php, this overrides bolLogViews if( typeof bolOwnerIsStorageSubscriber !== 'undefined' ) { bolLogViews |= bolOwnerIsStorageSubscriber; } var bolLogFileView = true; /* // Don't log view event for video, audio files. Player will log it on its own. if ( arrFileTypes[ intCurrentFileIndex ] == 'video' || arrFileTypes[ intCurrentFileIndex ] == 'audio' ) { bolLogFileView = false; } */ if ( bolLogFileView ) $.post('./fileView.php', {'h': strCurrentFileHash, 'p': bolLogViews});/* Google Analytics */ if ( typeof _gaq != 'undefined' ) { _gaq.push( [ '_trackPageview', window.location.href ] ); } var jqGalleryContainer = $('#gallery2'); if ( bolP2PDownloadAllowed ) { jqGalleryContainer.addClass( 'p2p_download_allowed' ); } else { jqGalleryContainer.removeClass( 'p2p_download_allowed' ); } if ( bolSimpleDownloadAllowed ) { jqGalleryContainer.addClass( 'simple_download_allowed' ); } else { jqGalleryContainer.removeClass( 'simple_download_allowed' ); } bolGalleryIsShowingItem = false; if( bolStartAudioOnOpen ) { $( "#audio_" + strCurrentFileHash ).trigger( 'play' ); bolStartAudioOnOpen = false; } //repositionHeartButton(); /*** Build main download button ***/ var intItemIndex = getItemIndexByHashOrName( strCurrentFileHash ); var bolSimpleDownloadAllowed = false; var bolP2PDownloadAllowed = false; if ( arrFeeDownloadPrice[ intItemIndex ]==null && arrAllowDownload[ intItemIndex ] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intItemIndex ] )) { bolSimpleDownloadAllowed = true; } if ( bolShowP2PDownloadButton && ( typeof(objWebTorrentDownloadForm) === 'object' || ! bolIsListViewForSpecificFile ) && arrFeeDownloadPrice[ intItemIndex ] == null && arrAllowDownload[ intItemIndex ] && ( arrAccessType[ intItemIndex ] == 'LINK' || arrAccessType[ intItemIndex ] == 'PUBLIC' ) && arrUploadPassword[ intItemIndex ] == '' && arrAllowPublicDownload[ intItemIndex ] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intItemIndex ] ) ) { bolP2PDownloadAllowed = true; } $( '#gallery-main-download-button' ).remove(); if ( bolSimpleDownloadAllowed || bolP2PDownloadAllowed ) { var objDownloadButton = new DropdownButton (); if ( bolSimpleDownloadAllowed ) { objDownloadButton.addButton('gallery-download-simple-split-button', 'Download this file', 'Download', ' ', function (){ gaev('split-download-button-engagement', 'header-download-simple-click', 'Split button simple download click'); modalGalleryDownloadFileBtn( strCurrentFileHash ) }) } if ( bolSimpleDownloadAllowed && ! bolIsOwner && typeof objUploadCopyForm != 'undefined' && typeof strUploadHash != 'undefined' ) { objDownloadButton.addButton('gallery-download-myfiles-split-button', 'Copy to My account', 'Copy to My account', null, function (){ gaev('split-download-button-engagement', 'header-download-myfiles-click', 'Split button myfiles download click'); modalGalleryDownloadFileBtn( strCurrentFileHash, 'my-files' ); }) } if ( bolP2PDownloadAllowed ) { objDownloadButton.addButton('gallery-download-p2p-split-button', 'Download via P2P', 'Download via P2P', null, function (){ gaev('split-download-button-engagement', 'header-download-p2p-click', 'Split button P2P download click'); modalGalleryDownloadFileP2PBtn( intCurrentFileIndex ); }) } if ( isFileConvertable( 'pdf', intItemIndex ) ) { objDownloadButton.addButton( 'gallery-download-simple-split-button' , 'Download this file as PDF' , 'Download PDF' , '
' , function () { gaev( 'split-download-button-engagement', 'header-download-pdf-click', 'Split button pdf download click' ); modalGalleryDownloadFileBtn( strCurrentFileHash, 'pdf' ) } ); } else if ( isFileConvertable( 'mp4', intItemIndex ) ) { objDownloadButton.addButton( 'gallery-download-simple-split-button' , 'Download as MP4' , 'MP4' , '
' , function () { gaev( 'split-download-button-engagement', 'header-download-mp4-click', 'Split button mp4 download click' ); modalGalleryDownloadFileBtn( strCurrentFileHash, 'mp4' ) } ); } var jqDownloadButton = objDownloadButton.build( 'gallery-download-split-button', 'gallery-main-download-button' ); $( '#gallery2__header__mid_content' ).prepend( jqDownloadButton ); $( '#gallery2__header__mid .seperator' ).css('display', ''); } /*********/ // var intTotalItems = parseInt( window.getImageCountText().split( '/' )[ 1 ] ); // if ( intCurrentFileIndex >= arrIDs.length - 2 && arrIDs.length < intTotalItems && typeof window.galleryLoadNextPage === "function" ) // { // window.galleryLoadNextPage(); // } if ( ! objMainShareParams ) { $('#gallery2__share').hide(); $('#gallery2_item_info_share-wrapper').hide(); $('#gallery2__sidebar__info_embed_button').hide(); } $( '#gallery2_info_head .thumbnail-wrapper' ).html( '' ); $( '#gallery2_info_head .thumbnail-wrapper' ).removeClass("two-actions"); $( '#gallery2_info_head .thumbnail-wrapper' ).removeClass("one-action"); var strThumbnailActions = ''; if( bolIsOwner && arrFileTypes[intCurrentFileIndex] != 'image' ){ if ( arrThumbnails[intItemIndex] ) { var strThumbPath = arrThumbnails[intItemIndex]; strThumbHTML = '
'; } else if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[intItemIndex] ) { strThumbHTML = '
'; } else { strThumbHTML = '
'; } $( '#gallery2_info_head .thumbnail-wrapper' ).html( '' ); $( '#gallery2_info_head .thumbnail-wrapper' ).append(strThumbHTML); $( '#gallery2_info_head .thumbnail-wrapper' ).append('
'); if ( arrFileAttributes[ intItemIndex ][ 'hasCustomThumb' ] ) { strThumbnailActions = '
' + '' + '' + '
' + '' + ''; $( '#gallery2_info_head .thumbnail-actions' ).append(strThumbnailActions); $( '#gallery2_info_head .thumbnail-wrapper' ).addClass("two-actions"); } else { strThumbnailActions = '
' + '' + ''; $( '#gallery2_info_head .thumbnail-actions' ).append(strThumbnailActions); $( '#gallery2_info_head .thumbnail-wrapper' ).addClass("one-action"); }} else { if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[intItemIndex] ) { strThumbHTML = ''; } else { strThumbHTML = '
'; } $( '#gallery2_info_head .thumbnail-wrapper' ).html( '' ); $( '#gallery2_info_head .thumbnail-wrapper' ).append(strThumbHTML); } var strName = arrDisplayNames[intItemIndex];if (strName == ''){strName = arrNames[intItemIndex];} $( ".gallery2__header__file_name_value" ).html( strName ); if( bolIsOwner ) { $(".not_owner_show").hide(); $(".not_owner_hide").show(); } else { $(".not_owner_show").show(); $(".not_owner_hide").hide(); }}window.showGalleryItem = showGalleryItem;function stopActiveContent(){// Stop videovar jqAllVideos = $("video");if (jqAllVideos.length>0){jqAllVideos.each(function () {this.pause();});}// Stop audiovar jqAllAudios = $("audio");if (jqAllAudios.length>0){jqAllAudios.each(function () {this.pause();});}} function GalleryDeleteFile(strFileH, strFileName) { fConfirm( 'Do you really want to delete this file?"' + strFileName + '"', 'Delete this file', 'Yes, delete!', 'Cancel', function(r){ if( r == true ) { $.ajax({ type: "POST", dataType: "json", url: "./ajax/delete_file.php?PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812", data: { 'delete_user_file' : true , 'f' : strFileH , 'source': 'filebrowser' }, success: function( data ){ if( data['status'] == 'ok' ) { if(bolGalleryIsVisible && intNextIndex != null && !isNaN( intNextIndex )) { galleryOpenNextItem(); } else if (intPreviousIndex != null && !isNaN( intPreviousIndex )) { galleryOpenPrevItem(); } fSuccess( "File "+ strFileName +" has been deleted!", "Info" ); location.reload(); } else { if( typeof data[ 'file_read_only' ] !== 'undefined' && data[ 'file_read_only' ] ) { fError( "The file cannot be deleted because it is shared!", "Info" ); } else if ( typeof data[ 'file_is_locked' ] !== 'undefined' && data[ 'file_is_locked' ] ) { fError( "This file cannot be deleted because it is locked.", "Info" ); } else { fError( "There was an error, the file was not deleted", "Info" ); } } } }); } }); return false; } function checkGalleryArrows() { if( $( window ).width() < 550 ) { if( arrFileTypes[intCurrentFileIndex] == 'audio' || arrFileTypes[intCurrentFileIndex] == 'video' || arrFileTypes[intCurrentFileIndex] == 'document' ) { $( '#gallery2__controls_left, #gallery2__controls_right' ).show(); $( '#gallery2__controls_left a, #gallery2__controls_right a' ).css({ 'top': 'initial', 'bottom': '0px' }); } else { $( '#gallery2__controls_left, #gallery2__controls_right' ).hide(); } } else { $( '#gallery2__controls_left a, #gallery2__controls_right a' ).removeAttr( 'style' ); $( '#gallery2__controls_left, #gallery2__controls_right' ).show(); } }function galleryLoadFileInfo(){if ( ! bolGallerySidebarVisible ){return;}var intItemIndex = getItemIndex ( strCurrentFileHash ); if ( typeof strUploadUserNameLink != 'undefined' ){ $( '#gallery2__sidebar__info-owner-user .gallery2__sidebar__info-value' ).html( strUploadUserNameLink );$( '#gallery2__sidebar__info .header-owner_name' ).html( strUploadUserNameLink ); if( typeof strUploadUserID != 'undefined' && strUploadUserID != '' && typeof strUploadUserLastProfileEditTimestamp != 'undefined') { $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '' ); } else { $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '
' ); }}else if ( typeof PublicProfile != 'undefined' && typeof PublicProfile.strProfileName != 'undefined' ){$( '#gallery2__sidebar__info-owner-user .gallery2__sidebar__info-value' ).html( '' + PublicProfile.strProfileName + '' );$( '#gallery2__sidebar__info .header-owner_name' ).html( '' + PublicProfile.strProfileName + '' ); if( typeof strUploadUserID != 'undefined' && strUploadUserID != '' && typeof strUploadUserLastProfileEditTimestamp != 'undefined') { $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '' ); } else if( typeof PublicProfile.strAvatarPath != 'undefined' && PublicProfile.strAvatarPath != '') { $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '' ); } else { $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '
' ); }}else {$( '#gallery2__sidebar__info-owner-user' ).hide();$( '#gallery2__sidebar__info .header-owner' ).hide();} //$('#gallery2__sidebar__info-upload .gallery2__sidebar__info-value').html( strFolderName ); $('#gallery2__sidebar__info-size .gallery2__sidebar__info-value').html(arrSizes[intItemIndex]); if( typeof arrDatesCreated != 'undefined') {// const DateTimeCreated = new Date(arrDatesCreated[intItemIndex]);// const DateCreated = DateTimeCreated.toISOString().slice(0,10); $('#gallery2__sidebar__info-date .gallery2__sidebar__info-value').html( arrDatesCreated[intItemIndex] ); } else { $('#gallery2__sidebar__info-date .gallery2__sidebar__info-value').html( arrDates[intItemIndex] ); } if( typeof arrDatesModified != 'undefined') {// const DateTimeModified = new Date(arrDatesModified[intItemIndex]);// const DateModified = DateTimeModified.toISOString().slice(0,10); $('#gallery2__sidebar__info-moddate .gallery2__sidebar__info-value').html( arrDatesModified[intItemIndex] ); } else { $('#gallery2__sidebar__info-moddate .gallery2__sidebar__info-value').html( arrDates[intItemIndex] ); }$('#gallery2__sidebar__info-views .gallery2__sidebar__info-value').html(arrViews[intItemIndex]);$('#gallery2__sidebar__info-downloads .gallery2__sidebar__info-value').html(arrDownloads[intItemIndex]);$('#gallery2__sidebar__info-comments .gallery2__sidebar__info-value').html(arrCommentCounts[intItemIndex]); $('.gallery2_share-input').val('https://file.fm/f/' + strCurrentFileHash );if ( typeof arrDatesDelete == 'undefined' || arrDatesDelete[intItemIndex] == '' ){$('#gallery2__sidebar__info-date-delete').hide();}else{$('#gallery2__sidebar__info-date-delete .gallery2__sidebar__info-value').html( ( typeof arrDatesDelete != 'undefined' ? arrDatesDelete[intItemIndex] : '' ) );$('#gallery2__sidebar__info-date-delete').show();}var strName = arrDisplayNames[intItemIndex];if (strName == ''){strName = arrNames[intItemIndex];}var $name = $('#gallery2__sidebar__info-name .gallery2__sidebar__info-value'); $name.val( strName ); if( bolIsOwner ) { autoGrow( $name.get( 0 ), '32px' ); $(".not_owner_show").hide(); $(".not_owner_hide").show(); } else { $(".not_owner_show").show(); $(".not_owner_hide").hide(); $( ".gallery2__sidebar__file_name_value" ).html( strName ); $( ".gallery2__header__file_name_value" ).html( strName ); } var $desc = $('#gallery2__sidebar__info-description .gallery2__sidebar__info-value'); var strDescriptionForInput = arrDescriptions[ intItemIndex ].replaceAll('', String.fromCharCode(13, 10)); var strDescriptionForHtml = arrDescriptions[ intItemIndex ].replaceAll('', '
'); $desc.val( strDescriptionForInput ); var strDescription = strDescriptionForInput; if ( strDescription == '' || typeof strDescription == 'undefined' ) { strDescription = ''; $desc.html( strDescription ); } else { $( ".gallery2__sidebar__file_description_value" ).html( strDescription ); } if( bolIsOwner ) { autoGrow( $desc.get( 0 ), '32px' ); $(".not_owner_show").hide(); $(".not_owner_hide").show(); if ( strDescription == '' ) { $( "#file_description_edit_wrapper" ).addClass("no-description"); } else { $( "#file_description_edit_wrapper" ).removeClass("no-description"); } } else { $("#file_description_edit_wrapper").click(function () { if( window.location.href.indexOf("filebrowser") === -1 ) { showSignIn(); } }); $( ".gallery2__sidebar__file_description_value" ).html( strDescriptionForHtml ); if ( strDescription == '' ) { $( "#gallery2__sidebar__info-description" ).hide(); } else { $( "#gallery2__sidebar__info-description" ).show(); } $(".not_owner_show").show(); $(".not_owner_hide").hide(); } $('#gallery_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]);if ( ( arrTags[ intItemIndex ] == '' || typeof arrTags[intItemIndex] === "undefined" ) && ! bolIsOwner ){$( '#gallery2__sidebar__info-tags' ).hide();}else{$( '#gallery2__sidebar__info-tags' ).show();}if( bolIsOwner && arrFileTypes[intCurrentFileIndex] != 'image' ){$( '#gallery2__sidebar__info-set-custom-thumbnail' ).html( '' ); if ( arrFileAttributes[ intItemIndex ][ 'hasCustomThumb' ] ) { $( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '
Change file image
' ); $( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '
Delete file image
' ); } else { $( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '
Set file preview image
' ); }$( '#gallery2__sidebar__info-set-custom-thumbnail' ).show();}else{$( '#gallery2__sidebar__info-set-custom-thumbnail' ).hide();} $( "#gallery2__item_info_delete" ).on( 'click', function() { GalleryDeleteFile(arrHashes[ intItemIndex ], strName ); });$( '#gallery2__sidebar__info-price' ).html( '' );$( '#gallery2__sidebar__info-price' ).hide();$( '#gallery2__item_info_save' ).hide();if ( arrFeeDownloadPrice[ intCurrentFileIndex ] != null ){if ( bolIsOwner ){$("#gallery2__sidebar__info-price").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)") $("#gallery2__sidebar__info-price").append("Change price") $( '#gallery2__item_info_save' ).show(); $('#gallery2__buyfile span.text').html('Change price'); $('.print_or_buy_popup__buyfile span.text').html('Change price'); }else{$("#gallery2__sidebar__info-price").attr("onclick", "showBuyFileFormModal(strCurrentFileHash)") $("#gallery2__sidebar__info-price").append("Buy this product") $('#gallery2__buyfile span.text').html('Buy this product'); $('.print_or_buy_popup__buyfile span.text').html('Buy this product'); $( '#gallery2__item_info_save' ).hide();}$( '#gallery2__sidebar__info-price' ).append( ' (' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $)' );$( '#gallery2__sidebar__info-price' ).show();}else{ if ( bolIsOwner ) { $("#gallery2__sidebar__info-price").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)") $("#gallery2__sidebar__info-price").append("Sell") $('#gallery2__buyfile span.text').html('Sell'); $('.print_or_buy_popup__buyfile span.text').html('Sell'); $( '#gallery2__sidebar__info-price' ).show(); $( '#gallery2__item_info_save' ).show(); } else { if ( arrFeeDownloadPrice[ intItemIndex ]==null && arrAllowDownload[ intItemIndex ] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intItemIndex ] )) { $( '#gallery2__item_info_save' ).show(); $( '.gallery2__save_button' ).show(); } else { $( '#gallery2__item_info_save' ).hide(); $( '.gallery2__save_button' ).hide(); } }}autosize.update($('#file_description_edit_wrapper textarea'));autosize.update($('#file_name_edit_wrapper textarea')); bolGalleryCommentsVisible = true; galleryLoadFileComments();} function galleryLoadFileComments() { if (bolDisableGalleryChat || !bolGalleryCommentsVisible || strActiveCommentsEntityHash == strCurrentFileHash) { return; } // Check if global variable is available if (typeof window.ChatFM === 'undefined') { setTimeout(function() { galleryLoadFileComments() }, 100) return } strActiveCommentsEntityHash = strCurrentFileHash; ChatFM.resetChat(); ChatFM.setNewEntityChat(strCurrentFileHash, "1"); } function galleryUpdateVoteCount() {var intItemIndex = getItemIndex ( strCurrentFileHash );$('.gallery_vote .vote_count').text( arrVoteCounts[intItemIndex] );var strVoteIcon = null;if ( arrHasVoted[intItemIndex] ){ strVoteIcon = '/images/gallery/heart_red.svg';$('.gallery_vote').addClass('has_voted');}else{ strVoteIcon = '/images/gallery/heart_hollow.svg';$('.gallery_vote').removeClass('has_voted');}if( typeof objAudioPlayer !== "undefined" && objAudioPlayer !== null ) { objAudioPlayer.afterVote(); } var jqImage = $('#main_image_' + strCurrentFileHash); /* if ( jqImage.length ) { $('#vote_heart_on_image').html(''); } */} /************************************************************************************************************/function galleryChangeLocation ( strLocation ) { if ( window.location.hash === strLocation ) { setTimeout( "galleryCheckLocation ();", 50 ); } else { var bolChangeLocation = true; if ( bolChangeLocation ) { if(window.location.hash.indexOf('#') != -1) { window.location.replace(('' + window.location).split('#')[0] + strLocation) } else { window.location.replace(('' + window.location) + '#' + strLocation) } } } } /************************************************************************************************************/ var bolCheckLocationRunning = false; function galleryCheckLocation () { if ( bolCheckLocationRunning ) return; bolCheckLocationRunning = true; var intFileIndex = null; if (window.location.hash.indexOf(';/view/') != -1) { bolHashtagViewUseSemicolon = true; } else { bolHashtagViewUseSemicolon = false; } var intIndexOfView = window.location.hash.indexOf('/view/'); if (intIndexOfView != -1) { var strViewLink = window.location.hash.slice(intIndexOfView, window.location.hash.length); var intIndexOfFileNameEnd = strViewLink.indexOf(';'); if ( intIndexOfFileNameEnd == -1 ) { intIndexOfFileNameEnd = strViewLink.length; } var strItemHashOrName = strViewLink.slice(6, intIndexOfFileNameEnd); intFileIndex = getItemIndexByHashOrName ( strItemHashOrName ); } else { if( strCurrentFileHash && ! bolIsListViewForSpecificFile ) closeGallery(strCurrentFileHash); if(bolGalleryOpened) { bolPushWhenOpen = true; //if user goes backwards in history, add the entry of /u/ page again } }if (window.location.hash.indexOf(';zoom') == -1){ $('#gallery_panzoomdiv').css('display', 'none'); }if ( typeof intFileIndex !== "undefined" && intFileIndex !== null ){$('#gallery2').show();if ( strCurrentFileHash !== arrHashes[ intFileIndex ] ) { setTimeout( "showGalleryItem( '" + arrHashes[ intFileIndex ] + "')", 0 ); }} else { if ( bolGalleryIsVisible && bolCloseGalleryIfHashRemoved ) { closeGallery(strCurrentFileHash); } } bolCheckLocationRunning = false;} var galleryCheckHashtag = galleryCheckLocation; /********/ $(window).bind('hashchange', galleryCheckLocation); // $(window).bind('popstate', galleryCheckLocation); /********/ function galleryDestroyMainSlider () { if ( jqMainSlider ) { jqMainSlider.destroySlider(); jqMainSlider = null;}} function galleryReinitalize () { galleryDestroyMainSlider (); $( '#gallery2__swipe-wrapper .gallery2__item' ).remove(); $( '#gallery2__thumb-strip__inner' ).html(''); if ( bolIsOwner ) { $('#gallery2__header__setprice').show(); $('#gallery2__sign').show(); $('.gallery2__edit').show(); } else { $('#gallery2__header__setprice').hide(); $('#gallery2__sign').hide(); $('.gallery2__edit').hide(); }} function initVideoPlayer (intFileIndex) { var logoHref = "https://file.fm"; var logoImgUrL = logoHref; logoImgUrL += "/images/logo/white/filesfm_logo_full.svg"; var player = new FilesFm_VideoJS( "video_" + arrHashes[ intFileIndex ], { autoplay: false, hash: arrHashes[ intFileIndex ], title: arrDisplayNames[ intFileIndex ], downloadURL: "https://"+ arrFileHost[ intFileIndex ] +"/down.php?i=" + arrHashes[ intFileIndex ], logoHref: logoHref, logoImgURL: logoImgUrL, smallLogoImgURL: "/images/logo/white/logo_small.svg", isLiked: arrHasVoted[ intFileIndex ], posterHref: 'https://' + arrFileHost[ intFileIndex ] + '/thumb_video_picture.php?i=' + arrHashes[intFileIndex], likeBtnClick: function ( callback ) { voteForFile( arrHashes[ intFileIndex ], callback ); }, commentsBtnClick: function () { player.exitFullscreen(); showGalleryInfo(); }, shareBtnClick: function ( e ) { var objFileShareParams = galleryGetFileShareParams(); if ( objFileShareParams !== null ) { player.exitFullscreen(); showSharePopup( window.event, objFileShareParams ); } }, muted: getVideoSettingsFromCookie_Muted() , volume: getVideoSettingsFromCookie_Volume() , onVolumeChange: function( volume, muted ) { saveVideoSettingsInCookie( 'sound', 'volume', volume ); saveVideoSettingsInCookie( 'sound', 'muted', muted ); } , onPlay: function() { player.setVolume( getVideoSettingsFromCookie_Volume() ); player.setMuted( getVideoSettingsFromCookie_Muted() ); } } ); fitVideoPlayer( $( "#video_" + arrHashes[ intFileIndex ] ) ); $( "#video_" + arrHashes[ intFileIndex ] ).find( "*" ).addClass( "bx_allow_events" ); $( "#video_" + arrHashes[ intFileIndex ] ).addClass( 'ffm_video_fallback' ); $( "#video_" + arrHashes[ intFileIndex ] + ' .vjs-loading-spinner .vjs-control-text' ).text( 'Wait until the MP4 video format is converted for streaming playback. This takes some time, depending on the length of the video. If the video does not start, it means that the format of this file is not suitable for streaming. Refresh page and download.' ); // let's not resize the player anymore player.fluid( false ); } function getVideoSize($video) { $video = $($video); var $viewPort = $video.closest( ".gallery2__video_container" ); var viewportHeight = $viewPort.height() - 100; var viewportWidth = $viewPort.width(); var minHeight = 240; var videoHeight = $video.get( 0 ).offsetHeight; var videoWidth = $video.get( 0 ).offsetWidth; var widthToHeight = $video.attr( 'data-wth' ); if ( typeof widthToHeight === "undefined" || !widthToHeight ) { widthToHeight = Math.floor( videoWidth / videoHeight * 100 ) / 100; $video.attr( 'data-wth', widthToHeight ); } if( widthToHeight == 0 ) { widthToHeight = 1; } var maxHeight = viewportHeight; if ( maxHeight * widthToHeight >= viewportWidth ) { maxHeight = Math.round( viewportWidth / widthToHeight ); } if( maxHeight > viewportHeight ) { maxHeight = viewportHeight; } if ( maxHeight < minHeight ) { maxHeight = minHeight; } var w = Math.floor( widthToHeight * maxHeight ); return { height: maxHeight + 'px', width: !isNaN(w) ? (w + "px") : "0px" }; } function fitVideoPlayer( $video ) { $video = $($video); var size = getVideoSize( $video ); $video.css( { paddingTop: size.height, width: size.width, height: 0 } ); $video.find( "video" ).css( 'width', '100%' ); } function fitEmbedPlayer( $video ) { $video = $( $video ); var size = getVideoSize( $video ); if ( size.width !== "0px" ) { $video.closest( ".gallery2__video_container__embed_palyer" ).css( { 'maxWidth': size.width } ); $video.closest( ".filesfm__embed_player__container" ).css( { height: "auto" } ); } $video.find( "video" ).css( 'width', '100%' ); } var bolGalleryIsOpening = false; var arrThumbWidth = []; function showGallery() { if ( bolGalleryIsOpening ) { return;}bolGalleryIsOpening = true; $( 'html' ).css( 'overflow', 'hidden' ); $( '#gallery2' ).show(); $('#tawkchat-iframe-container').hide(); if( $( '#gallery2__swipe-wrapper .gallery2__item' ).length == 0 ) { if (jqThumbContainer == null) { jqThumbContainer = $('#gallery2__thumb-strip__inner'); var intAllThumbCount = $( 'A', jqThumbContainer ).length; jqThumbContainer.width( intAllThumbCount * intThumbWidth + 3 ); } var intThumbsW = 0; var arrItems = []; var arrThumbs = []; for( idx in arrIDs ) { // JU. Removed jQuery from content composingvar strItemHTML = ''; strAddress = ''; var strThumbHTML = ''; var strClass = null; if ( arrThumbnails[idx] ) { var strThumbPath = arrThumbnails[idx]; strThumbHTML = '
'; jqThumbContainer.width( jqThumbContainer.width() + intThumbWidth + 3 ); /* $("
").attr("src", arrThumbnails[idx]).load(function(){ var realWidth = this.width; var realHeight = this.height; var intThisThumbWidth = 93 / realHeight * realWidth; jqThumbContainer.width( jqThumbContainer.width() + intThisThumbWidth + 3); }); */ } else if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[idx] ) { strThumbHTML = '
'+ arrExtensions[ idx ].toUpperCase() +''; jqThumbContainer.width( jqThumbContainer.width() + intThumbWidth + 3 ); } else if ( arrIconClass[idx] ) { strThumbHTML = ''+ arrExtensions[ idx ].toUpperCase() +''; strClass = 'doc-icon'; jqThumbContainer.width( jqThumbContainer.width() + intThumbWidth + 3 ); } else { strThumbHTML = ''+ arrExtensions[ idx ].toUpperCase() +''; strClass = 'doc-icon'; jqThumbContainer.width( jqThumbContainer.width() + intThumbWidth + 3 ); } var strThumbItemHTML = '
'; arrItems.push(strItemHTML); arrThumbs.push(strThumbItemHTML); } $( '#gallery2__swipe-wrapper' )[0].innerHTML = arrItems.join(''); jqThumbContainer[0].innerHTML = arrThumbs.join(''); arrItems = null; arrThumbs = null; }if (jqThumbContainer == null){jqThumbContainer = $('#gallery2__thumb-strip__inner');}if (jqThumbViewport == null){jqThumbViewport = $('#gallery2__thumb-strip');} if( jqMainSlider == null ) { recalculateGalleryForBanner(); jqMainSlider = $( '#gallery2__swipe-wrapper' ).bxSlider({ slideSelector: 'span.gallery2__item', infiniteLoop: false, hideControlOnEnd: true, preventDefaultSwipeX: true, video: true, pager: false, controls: false, slideWidth: 9999, useCSS: true, speed: 0, animationSpeed: 0, touchEnabled: true , onSlideBefore: function( $slide, oldIDx, newIDx ){ galleryChangeLocation ( getItemLink ( arrHashes[newIDx] ) ); if( !$slide.hasClass( 'content_ready' ) ) { loadSlideContent( $slide, newIDx ); } }, onSlideAfter: function( $slide, oldIDx, newIDx ){ var slidePrevIDx = parseInt( newIDx ) - 1; var slideNextIDx = parseInt( newIDx ) + 1; if( slidePrevIDx >= 0 ) { $slidePrev = $( '#gallery2__item-' + slidePrevIDx ); if( $slidePrev.length > 0 && !$slidePrev.hasClass( 'content_ready' ) ) { loadSlideContent( $slidePrev, slidePrevIDx ); } } if( slideNextIDx < jqMainSlider.getSlideCount() ) { $slideNext = $( '#gallery2__item-' + slideNextIDx ); if( $slideNext.length > 0 && !$slideNext.hasClass( 'content_ready' ) ) { loadSlideContent( $slideNext, slideNextIDx ); } } if ( $slide.find( ".gallery2__item__audio-wrapper" ).length ) { objAudioPlayer.appendTo( $slide.find( ".gallery2__item__audio-wrapper" ) ); objAudioPlayer.setCurrentTrackByHash( arrHashes[ newIDx ] ); } } }); } else if (bolHaveToRedrawGallery) { recalculateGalleryForBanner(true); bolHaveToRedrawGallery = false; } // At the beginning we need fixed size for lazyload to work $( 'img.lazyload-image-gallery', jqThumbContainer).css( {'width': 'auto', 'height':'73px'} ).addClass('image-not-loaded'); $(function(){ var intAllThumbCount = $( 'A', jqThumbContainer ).length; jqThumbContainer.width( intAllThumbCount * ( intThumbWidth + 5) + 3 ); // After preload image is loaded - set auto size for original images. $( 'img.lazyload-image-gallery', jqThumbContainer ).on( 'load', function (){ /* var w = this.clientWidth; var h = this.clientHeight; this.style.width = 'auto'; this.style.height = '100%'; if ( w < 108 ) { this.parentNode.style.width = 'auto'; } */ //$('.thumb-loader', $(this).parent()).remove(); var intW = this.naturalWidth; if ( intW < intThumbWidth ) intW = intThumbWidth; arrThumbWidth.push( intW ); var intLoadedThumbCount = 0; var intLoadedThumbWidthSum = 0; for ( var i = 0; i
" ) .css({ 'background-image': 'url("/thumb.php?i=' + arrHashes[ intFileIndex ] + '")', 'height': function() { if (0) //( !arrDescriptions[intFileIndex] ) // AD: description isn't visible anymore { return 'calc( 100% - 115px )'; } } }) .addClass( 'gallery2__item__custom_thumb gallery2__item__base-width-on-two' ); if ( arrFeeDownloadPrice[intFileIndex] > 0 ) { if (bolIsOwner) { jqThumbInner.attr( 'onclick', 'showSetPriceFormModal(strCurrentFileHash)' ); } else { jqThumbInner.attr( 'onclick', 'showBuyFileFormModal(strCurrentFileHash)' ); } jqThumbInner.addClass( 'bx_allow_events' ); jqThumbInner.addClass( 'has_price' ); } jqThumb = $( '' ) .append( jqThumbInner ); } else { var strIconHtml = ''; if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] ) { strIconHtml = ' ' + arrDisplayNames[intFileIndex] + ' ' + arrDescriptions[intFileIndex] + ' ' + arrDescriptions[intFileIndex] + ' ' + ' ' + ' ' + ' You can buy this file or print-on-demand products: ' + '' + '' + '' + 'View products' + '' + '' + ' ' + ' " ).css( 'background-image', 'url("/thumb.php?i=' + arrHashes[ intFileIndex ] + '")' ).addClass( 'gallery2__item__custom_thumb gallery2__item__base-width-on' ); if ( arrFeeDownloadPrice[intFileIndex] > 0 ) { if (bolIsOwner) { jqThumb.attr( 'onclick', 'showSetPriceFormModal(strCurrentFileHash)' ); } else { jqThumb.attr( 'onclick', 'showBuyFileFormModal(strCurrentFileHash)' ); } jqThumb.addClass( 'bx_allow_events' ); jqThumb.addClass( 'has_price' ); } } else { jqThumb = $( '' ).addClass( 'fa-5x fa ' + arrIconClass[intFileIndex] ); if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] ) { jqThumb = $( ' ' + arrDisplayNames[intFileIndex] + ' '); // AD: description isn't visible anymore // $('.gallery2__item__doc-wrapper', $jqSlideElem).append(' ' + arrDescriptions[intFileIndex] + ' '); } var jqButtonContainer = $(' ').css({'white-space': 'normal'}); jqButtonContainer.append(' ' + arrDescriptions[intFileIndex] + ' '); /*** Build download button ***/ /* if ( bolSimpleDownloadAllowed || bolP2PDownloadAllowed ) { var objDownloadButton = new DropdownButton (); if ( bolSimpleDownloadAllowed ) { objDownloadButton.addButton('gallery-download-simple-split-button', 'Download this file', 'Download', null, function (){ gaev('split-download-button-engagement', 'document-main-download-simple-click', 'Main split button simple download click'); modalGalleryDownloadFileBtn( strCurrentFileHash ) }) } if ( bolSimpleDownloadAllowed && ! bolIsOwner && typeof objUploadCopyForm != 'undefined' && typeof strUploadHash != 'undefined' ) { objDownloadButton.addButton('gallery-download-myfiles-split-button', 'Copy to My account', 'Copy to My account', null, function (){ gaev('split-download-button-engagement', 'document-main-download-myfiles-click', 'Main split button myfiles download click'); modalGalleryDownloadFileBtn( strCurrentFileHash, 'my-files' ); }) } if ( bolP2PDownloadAllowed ) { objDownloadButton.addButton('gallery-download-p2p-split-button', 'Download via P2P', 'Download via P2P', null, function (){ gaev('split-download-button-engagement', 'document-main-download-p2p-click', 'Main split button P2P download click'); modalGalleryDownloadFileP2PBtn( intCurrentFileIndex ) }) } var jqDownloadButton = objDownloadButton.build( 'gallery-download-split-button large extra-large', 'file-' + intFileIndex + '-download-split-button', arrDisplayNames[ intFileIndex ] ); jqButtonContainer.append( jqDownloadButton ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append(jqButtonContainer); } */ /*********/ if ( arrExtensions[ intFileIndex ] == 'pdf' || bolIsFileConvertableToPdf ) { var bolForbidDirectDownload = false; if ( typeof( arrForbidDirectDownload ) != 'undefined' && arrForbidDirectDownload[ intFileIndex ] == true ) { bolForbidDirectDownload = true; } if ( arrFeeDownloadPrice[ intFileIndex ] == null && arrAllowDownload[ intFileIndex ] && browserSupportsCanvas() && ! bolForbidDirectDownload && arrSizesInBytes[ intFileIndex ] < 104857600 ) { ( function() { $( this ).attr( 'disabled', 'disabled' ); var $jqSlideElem = $( this ).closest( ".gallery2__item" ); var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ]; $jqSlideElem.prepend( ' ' + ' ' + '' + ' ' + '' + 'Please wait while the file is preview is being created... ' + ' ' + ' ' + // AD: description isn't visible anymore // ' ' + arrDisplayNames[ intFileIndex ] + ' ' + // ' ' + arrDescriptions[intFileIndex] + ' ' + ' ' ); var strPdfSrc; if ( bolIsFileConvertableToPdf ) { var strDateModified = ( typeof arrDatesModified != 'undefined' ? arrDatesModified[ intFileIndex ] : ( typeof arrModDate != 'undefined' ? arrModDate[ intFileIndex ] : '' ) ); strPdfSrc = 'https://' + arrFileHost[ intFileIndex ] + '/api/file/get_thumb_pdf.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812&dm=' + strDateModified + '&v=102&n=' + arrDisplayNames[ intFileIndex ] + '.pdf'; } else { strPdfSrc = 'https://' + arrFileHost[ intFileIndex ] + '/down.php?pdf=1&truemimetype=1&i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812&n=' + arrDisplayNames[ intFileIndex ]; } $.ajax( { type: "GET", url: strPdfSrc, success: function() { $( 'iframe', $jqSlideElem ) .attr( 'src', '/js/pdfjs-v2/web/viewer.html#' + encodeURI( strPdfSrc ) ) .addClass( 'gallery2__item__base-width-on' ) .css( { 'height': function() { return '100%'; // AD: description isn't visible anymore /* if ( arrDescriptions[intFileIndex] ) { return 'calc( 100% - 150px )'; } else { return 'calc( 100% - 60px )'; } */ } } ) .on( 'load', function () { if ( ! bolSimpleDownloadAllowed ) { $( this ).contents().find( '#print' ).hide(); $( this ).contents().find( '#download' ).hide(); } } ); } , error: function(data) { var stErrorText = 'Sorry, we were unable to create file preview. Please try again by refreshing the page or contact support@files.fm. You can download the file to view it.'; if ( data.status == 405 ) { stErrorText = 'There is no preview available for this file. Download the file to view it.'; } $( 'iframe', $jqSlideElem ).replaceWith( ' ' + '' + ' ' + stErrorText + ' ' + ' ' ); $( '.gallery2__item__msg_has_no_preview' ) .addClass( 'gallery2__item__base-width-on' ) .css( { 'height': function() { return '100%'; // AD: description isn't visible anymore /* if ( arrDescriptions[intFileIndex] ) { return 'calc( 100% - 150px )'; } else { return 'calc( 100% - 60px )'; } */ } } ); $( '.gallery2__item__iframe-loading', $jqSlideElem ).hide(); } } ); } ).apply( $jqSlideElem ); } } else if ( ( arrExtensions[intFileIndex] == "txt" || arrExtensions[intFileIndex] == "php" || arrExtensions[intFileIndex] == "js" || arrExtensions[intFileIndex] == "html" || arrExtensions[intFileIndex] == "css" || arrExtensions[intFileIndex] == "xml" || arrExtensions[intFileIndex] == "csv" || arrExtensions[intFileIndex] == "ini" ) && arrFeeDownloadPrice[ intFileIndex ] == null && arrAllowDownload[ intFileIndex ] ) { var fnLoadIframe = function () { $( this ).attr( 'disabled', 'disabled' ); var $jqSlideElem = $( this ).closest( ".gallery2__item" ); var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ]; $jqSlideElem.prepend( ' ' + arrDisplayNames[ intFileIndex ] + ' ' + arrDescriptions[intFileIndex] + ' ' ); arrIframeTimers[ intFileIndex ] = setTimeout( function () { $( '#gallery2__item__iframe-wrapper__' + intFileIndex ).hide(); }, 30000 ); $( 'iframe', $jqSlideElem ) .attr( 'src', 'https://' + arrFileHost[ intFileIndex ] + '/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1&view=1&truemimetype=1' ) .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' ) .css({ 'height': function(){ return '100%'; // AD: description isn't visible anymore /* if ( arrDescriptions[intFileIndex] ) { return 'calc( 100% - 150px )'; } else { return 'calc( 100% - 60px )'; } */ }, "background": "white" }) .addClass( 'gallery2__item__base-width-on' ) }; fnLoadIframe.apply( $jqSlideElem ); } else { //JV 2019.12.13: doc preview strādās līdz 50MB failiem if ( arrFeeDownloadPrice[ intFileIndex ] == null && arrSizesInBytes[ intFileIndex ] < 50 * 1024 * 1024 && arrUploadPassword[ intFileIndex ] == '' && arrAccessType[ intFileIndex ] == 'LINK' ) { var fnLoadIframe = function () { $( this ).attr( 'disabled', 'disabled' ); var $jqSlideElem = $( this ).closest( ".gallery2__item" ); var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ]; $jqSlideElem.prepend( ' ' + ' ' + '' + '' + ' ' + ' ' + //' ' + arrDisplayNames[ intFileIndex ] + ' ' + //' ' + arrDescriptions[intFileIndex] + ' ' + ' ' ); arrIframeTimers[ intFileIndex ] = setTimeout( function () { $( '#gallery2__item__iframe-wrapper__' + intFileIndex ).hide(); }, 30000 ); if ( arrExtensions[intFileIndex] == "dwg" || arrExtensions[intFileIndex] == "dxf" ) { // JV: ja ir DWG vai DXF AutoCAD fails, tad radisim citu dokumentu preview iframe: // ShareCad.org nestrada down.php linki, tapec ielikts direct path access links $.ajax( { type: "GET", url: "/api/embed_urls.php", data: { 'i': arrHashes[ intFileIndex ] }, success: function ( data ) { data = JSON.parse( data ); $( 'iframe', $jqSlideElem ) .attr( 'src', 'https://sharecad.org/cadframe/load?url='+data[ 'path_access_url' ] ) .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' ); } } ); } else if ( arrExtensions[intFileIndex] == "rtf" || arrSizesInBytes[ intFileIndex ] > 10 * 1024 * 1024 ) //MS ofisam ir file size limits 10MB? { $( 'iframe', $jqSlideElem ) .attr( 'src', 'https://docs.google.com/viewerng/viewer?embedded=true&url=https://api.files.fm/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1' ) .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' ); } // Google docs iframe dokumentu paradisanai// https://docs.google.com/viewer?embedded=true&url=// https://docs.google.com/viewerng/viewer?embedded=true&url=// MS Office: https://view.officeapps.live.com/op/embed.aspx?src= else //JV: 2020-05-22 Googli aizstāju ar Office { $( 'iframe', $jqSlideElem ) .attr( 'src', 'https://view.officeapps.live.com/op/embed.aspx?src=https://api.files.fm/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1' ) .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' ); } $( 'iframe', $jqSlideElem ) .css({ 'height': function(){ return '100%'; // AD: description isn't visible anymore /* if ( arrDescriptions[intFileIndex] ) { return 'calc( 100% - 150px )'; } else { return 'calc( 100% - 60px )'; } */ } }) .addClass( 'gallery2__item__base-width-on' ) }; if ( 1 ) // clickedItemHash !== arrHashes[ intFileIndex ] ) { var jqPreviewButton = $( '' ).attr( { 'href': 'javascript:void(0);', 'title': 'View', 'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button gallery2__item__doc-wrapper__download_button gallery2__preview_button' } ).html( 'Preview this file' ) .click( function() { if ( arrExtensions[intFileIndex] == "dwg" || arrExtensions[intFileIndex] == "dxf" ) { showSignIn(); } else { fnLoadIframe.apply( $jqSlideElem ); var jqDownloadButton = $( '' ).attr( { 'href': 'javascript:void(0);', 'onclick': 'modalGalleryDownloadFileBtn( "' + arrHashes[ intFileIndex ] + '" )', 'title': 'Download', 'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button' } ).html( 'Download this file' ); $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqDownloadButton ); } } ) $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqPreviewButton ); } else { fnLoadIframe.apply( $jqSlideElem ); var jqDownloadButton = $( '' ).attr( { 'href': 'javascript:void(0);', 'onclick': 'modalGalleryDownloadFileBtn( "' + arrHashes[ intFileIndex ] + '" )', 'title': 'Download', 'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button' } ).html( 'Download this file' ); $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqDownloadButton ); } } } if(0)//( !arrDescriptions[intFileIndex] ) // AD: description isn't visible anymore { $('.gallery2__item__desc-wrapper', $jqSlideElem).hide() $( '.gallery2__item__custom_thumb', $jqSlideElem ).css({'height': 'calc( 100% - 100px )'}); } $(".gallery2__item__custom_thumb" ).each(function() { var objBackground = getBackgroundSize(this); if(objBackground.width>=$('#gallery2__image-wrapper').width()) { objBackground.width=objBackground.width-20; } $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( objBackground.width ); $(this).parent().siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( objBackground.width ); }); $("img").each(function() { var intImageWidth = $(this).width(); if(intImageWidth>=$('#gallery2__image-wrapper').width()) { intImageWidth=intImageWidth-20; } $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intImageWidth ); }); $("iframe", ".gallery2__item__iframe-wrapper" ).each(function() { var intIframeWidth = $(this).width(); if(intIframeWidth>=$('#gallery2__image-wrapper').width()) { intIframeWidth=intIframeWidth-20; } $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intIframeWidth ); }); break; case 'video': var bolThisVideoUseEmbedPlayer = false; var strHtml = ''; strHtml += ''; strHtml += ' '; if ( useEmbedPlayer( intFileIndex ) ) { bolThisVideoUseEmbedPlayer = true; } strHtml += " "; if ( !arrFileAttributes[ intFileIndex ][ 'canDownload' ] && arrFileAttributes[ intFileIndex ][ 'isForSale' ] && !arrFileAttributes[ intFileIndex ][ 'hasPreviewVideo' ] ) { jqThumb = $( ' ' ) .css({ 'height': function(){ if (!arrDescriptions[intFileIndex]) { return 'calc( 100% - 115px )'; } else { // return 'calc( 100% - 150px )'; // AD: description isn't visible anymore return 'calc( 100% - 115px )'; } }, }) .append( $( " ' + arrDisplayNames[ intFileIndex ] + ' ' ); if( arrDescriptions[intFileIndex] ) { // $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( ' ' + arrDescriptions[intFileIndex] + ' '); } // JV: slikti izskatas pardodamajiem video failiem, ka "nav kautkas pieejams" - nonemu//$( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( ' File preview is not available ' ); break; } if ( bolThisVideoUseEmbedPlayer ) { var strAutoload = 'off'; if ( arrExtensions[ intFileIndex ] == 'mp4' ) { strAutoload = 'on'; } strHtml += ' '; strHtml += ' '; } else { var strVideoSrc = 'https://' + arrFileHost[ intFileIndex ] + '/thumb_video/' + arrHashes[ intFileIndex ] + '' + strHttpCacheKey + '.mp4?v=1675369366&PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812'; if ( arrExtensions[ intFileIndex ] == 'mp4' && ! arrFileAttributes[ intFileIndex ][ 'hasVideoThumb' ] ) { $.get( strVideoSrc, function() {} ); strVideoSrc = 'https://' + arrFileHost[ intFileIndex ] + '/down.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=cbeb2dea5cac23e207a8f78e6c2e8445acd7e812&pv=1&' + strHttpCacheKey + '.mp4'; } strHtml += ' '; strHtml += ' "; /* if ( !bolThisVideoUseEmbedPlayer ) { if ( arrFileAttributes[ intFileIndex ][ 'isForSale' ] ) { strHtml += ' This is a preview. You can buy full video. '; } else { strHtml += ' This is a lower quality preview. '; } } */ /* if( arrDescriptions[intFileIndex] ) { strHtml += ' ' + arrDescriptions[intFileIndex] + ' '; } */ //strHtml += ' '; //strHtml += ' Buy this product '; //strHtml += ' '; strHtml += ' '; strHtml += " "; strHtml += " ' + arrDisplayNames[intFileIndex] + ' ' + arrDescriptions[intFileIndex] + ' Buy this product ' + arrDescriptions[intFileIndex] + ' ' + arrDisplayNames[intFileIndex] + ' ' + arrDescriptions[intFileIndex] + ' ' + arrDisplayNames[ intFileIndex ] + ' " ).css({ 'background-image': 'url("/thumb.php?i=' + arrHashes[ intFileIndex ] + '")', 'height': function(){ if(0) //( !arrDescriptions[intFileIndex] ) // AD: description isn't visible anymore { return 'calc( 100% - 115px )'; } } }) .addClass( 'gallery2__item__custom_thumb gallery2__item__base-width-on' ); } else { jqThumb = $( '' ).addClass( 'fa-5x fa ' + arrIconClass[intFileIndex] ); if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] ) { jqThumb = $( ' ').css({'white-space': 'normal'}); if ( arrFeeDownloadPrice[ intFileIndex ] == null ) { var $jqSlideElem = $( $jqSlideElem ).closest( ".gallery2__item" ); var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ]; $jqSlideElem.prepend( ' ' + arrDescriptions[intFileIndex] + ' ' ); arrIframeTimers[ intFileIndex ] = setTimeout( function () { $( '#gallery2__item__iframe-wrapper__' + intFileIndex ).hide(); }, 30000 ); $.get( 'https://'+ arrFileHost[ intFileIndex ] + '/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1&view=1&truemimetype=1', function( strFileContent ) { $( 'iframe', $jqSlideElem ) .attr( 'src', strFileContent ) .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' ) .css({ 'height': function() { if ( arrDescriptions[intFileIndex] ) { // return 'calc( 100% - 150px )'; // AD: description isn't visible anymore return 'calc( 100% - 60px )'; } else { return 'calc( 100% - 60px )'; } }, "background": "white", }) } ); } else { $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( ' ' + arrDisplayNames[intFileIndex] + ' ' ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( ' ' + arrDescriptions[intFileIndex] + ' '); } if( !arrDescriptions[intFileIndex] ) { $('.gallery2__item__desc-wrapper', $jqSlideElem).hide(); } function updateURLDescriptionWidth() { $(".gallery2__item__base-width-on" ).each(function() { switch(this.tagName) { case 'IMG': intElementWidth = $( this ).width(); break; case 'DIV': var objBackground = getBackgroundSize(this); intElementWidth = objBackground.width; break; case 'IFRAME': intElementWidth = $( this ).width(); break; default: intElementWidth = $( this ).width(); break; } if(intElementWidth>=$('#gallery2__image-wrapper').width()) { intElementWidth=intElementWidth-20; } $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intElementWidth ); }); } updateURLDescriptionWidth(); break; } } if ( arrFileTypes[ intCurrentFileIndex ] !== 'audio' ) { var jqPreviewButton = $( '' ).attr( { 'href': 'javascript:void(0);', 'title': function() { if (bolIsOwner) { return 'Sell'; } else { return 'Buy'; } }, 'class': 'gallery2__buy_button', 'style': "display:none;" } ).html( function(){ if ( arrFeeDownloadPrice[ intCurrentFileIndex ] ) { return 'Buy this product (' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $)'; } else { return 'Buy this product'; } } ) .click( function() { if (bolIsOwner) { return showSetPriceFormModal(strCurrentFileHash); } else { return showBuyFileFormModal(strCurrentFileHash); } } ) $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqPreviewButton ); } if ($('.gallery2__item__information-wrapper', $jqSlideElem).find('.gallery2__preview_button').length<1) { var jqDownloadButton = $( '' ).attr( { 'href': 'javascript:void(0);', 'onclick': 'modalGalleryDownloadFileBtn( "' + arrHashes[ intFileIndex ] + '" )', 'title': 'Download', 'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button' } ).html( 'Download this file' ); $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqDownloadButton ); } $('a', $jqSlideElem).addClass( 'bx_allow_events' ); $('a', $jqSlideElem).find( "*" ).addClass( 'bx_allow_events' ); $('.gallery2__video_downloadbutton', $jqSlideElem).find( "*" ).addClass( 'bx_allow_events' ); $jqSlideElem.addClass( 'content_ready' ); } function adjustDescriptionWidth() { var intElementWidth; $(".gallery2__item__base-width-on").each(function() { switch(this.tagName) { case 'IMG': case 'IFRAME': intElementWidth = $( this ).width(); break; case 'DIV': var objBackground = getBackgroundSize(this); intElementWidth = objBackground.width; break; default: intElementWidth = $( this ).width(); break; } if(intElementWidth>=$('#gallery2__image-wrapper').width()) { intElementWidth=intElementWidth-20; } $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intElementWidth ); }); $('.gallery2__item__base-width-on-two').each(function() { switch(this.tagName) { case 'IMG': intElementWidth = $( this ).outerWidth(); break; case 'DIV': var objBackground = getBackgroundSize(this); intElementWidth = objBackground.width; break; default: intElementWidth = $( this ).outerWidth(); break; } if(intElementWidth>=$('#gallery2__image-wrapper').width()) { intElementWidth=intElementWidth-20; } $(this).parent().parent().find('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width(intElementWidth); }); $('.vjs-poster, .filesfm__embed_player__container, .audio_player').each(function() { intElementWidth = $( this ).outerWidth(); if(intElementWidth>=$('#gallery2__image-wrapper').width()) { intElementWidth=intElementWidth-20; } $(this).parent().parent().find('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width(intElementWidth); }); } adjustDescriptionWidth(); function resizeend() { adjustDescriptionWidth(); } var intTimer; window.addEventListener('resize', function() { //source: https://stackoverflow.com/questions/5489946/how-to-wait-for-the-end-of-resize-event-and-only-then-perform-an-action clearTimeout(intTimer); intTimer = setTimeout(resizeend, 300); adjustDescriptionWidth(); }); function registerEmbedPlayerFileEventCallback( strFileHash, fncCallback ) { var intEmbedPlayerFileIndex = getItemIndex ( strFileHash ); if ( intEmbedPlayerFileIndex !== null && typeof fncCallback === 'function' ) { objEmbedPlayerFileEventCallback[ intEmbedPlayerFileIndex ] = fncCallback; } } function callEmbedPlayerFileEventCallback( strEventCode, intFileIndex ) { if ( typeof( objEmbedPlayerFileEventCallback[intFileIndex] ) === 'function' ) { objEmbedPlayerFileEventCallback[intFileIndex]( strEventCode ); } } function galleryOpenPrevItem() { if ( intPreviousIndex != null && !isNaN( intPreviousIndex )){ galleryChangeLocation ( getItemLink ( arrHashes[intPreviousIndex] ) ); adjustDescriptionWidth();}} function galleryOpenNextItem() { if ( bolGalleryIsVisible && intNextIndex != null && !isNaN( intNextIndex )){ galleryChangeLocation ( getItemLink ( arrHashes[intNextIndex] ) ); adjustDescriptionWidth();}}var resThumbLoadTimeout; function gallerySelectThumb( intItemIndex ) {if ( bolGalleryIsVisible && bolGalleryInitalizedState < 1 ){// If dom not loaded yet, wait for it to load.setTimeout('gallerySelectThumb( '+ intItemIndex +' )', 100);return;}if (jqThumbViewport == null){jqThumbViewport = $('#gallery2__thumb-strip');}var intViewportWidthPx = jqThumbViewport.width();if (jqThumbContainer == null){jqThumbContainer = $('#gallery2__thumb-strip__inner');}var jqThumb = $('A.thumb_' + arrHashes[intItemIndex], jqThumbContainer);function onThumbReady() { var intThumbPossitionLeftPx = jqThumb.position().left; // If scrollable on mobile if (jqThumbViewport.css('overflow-x')=='auto') { var intThumbPossitionLeftPx = jqThumb[0].offsetLeft; var intThumbOffsetLeftPx = galleryCalculateOffset(jqThumb[0]).left; var intScrollLeft = jqThumbViewport.scrollLeft(); var jqThImg = $('IMG', jqThumb); var intThisThumbWidth = intThumbWidth; if ( intThisThumbWidth < intThumbWidth ) intThisThumbWidth = intThumbWidth; if ( intThumbOffsetLeftPx + intScrollLeft > intViewportWidthPx + intScrollLeft - intThisThumbWidth ) { jqThumbViewport.scrollLeft( intThumbOffsetLeftPx + intScrollLeft - intViewportWidthPx + intThisThumbWidth ); } else if (intThumbOffsetLeftPx < 0) { jqThumbViewport.scrollLeft( intThumbPossitionLeftPx ); } } else { var intThumbOffsetLeftPx = jqThumb.offset().left; var jqThumbStrip = $('#gallery2__thumb-strip'); var jqThumbStripInner = $('#gallery2__thumb-strip__inner'); var intThumbWidthSum = 0; $('A', jqThumbStripInner).each(function (){ intThumbWidthSum += $(this).width(); }); var bolThumbsAreOutside = false; if ( jqThumbStrip.width() <= intThumbWidthSum ) { bolThumbsAreOutside = true; } if ( $( '#gallery2' ).hasClass( 'gallery__sidebar-visible' ) ) { intThumbOffsetLeftPx = intThumbOffsetLeftPx -360; } if ( ! bolThumbsAreOutside ) { jqThumbContainer.css({'left': '0px'}); } else { /**** If outside viewport ****/ // If outside to the right if ( intThumbOffsetLeftPx < 0 ) { var jqThImg = $('IMG', jqThumb); var intThisThumbWidth = intThumbWidth; if ( intThisThumbWidth < intThumbWidth ) intThisThumbWidth = intThumbWidth; var intSetLeftPx = (-1*intThumbPossitionLeftPx + intThisThumbWidth ); jqThumbContainer.css({'left': intSetLeftPx + 'px'}); } // else - outside to left else if ( intThumbOffsetLeftPx > intViewportWidthPx - 360 ) { var jqThImg = $('IMG', jqThumb); var intThisThumbWidth = intThumbWidth; if ( intThisThumbWidth < intThumbWidth ) intThisThumbWidth = intThumbWidth; var intSetLeftPx = -1*intThumbPossitionLeftPx + intViewportWidthPx - intThisThumbWidth - intThumbWidth; jqThumbContainer.css({'left': intSetLeftPx + 'px'}); } /****/ } checkThumbStripArrows(); } $('A.active', jqThumbContainer).removeClass('active'); jqThumb.addClass('active'); setTimeout("checkThumbStripArrows()", 500); setTimeout("galleryLazyloadRecalc()", 500); } if ( $('IMG', jqThumb).length===0 || ( $('IMG', jqThumb)[0].complete && $('IMG', jqThumb).attr('src')===$('IMG', jqThumb).attr('data-original') ) ) { onThumbReady(); } else { $('IMG', jqThumb).on('load', function (){ if ($(this).attr('src') === $(this).attr('data-original')) { onThumbReady(); } }); var intElementIndex = jqThumb.index(); if (jqThumbViewport.css('overflow-x') == 'auto') { jqThumbViewport.scrollLeft(intElementIndex * intThumbWidth); } else { jqThumbContainer.css({'left': (-1 * (intElementIndex + 2) * intThumbWidth) + 'px'}); } galleryLazyloadRecalc(); setTimeout( function (){ galleryLazyloadRecalc(); }, 1000); setTimeout( function (){ galleryLazyloadRecalc(); }, 5000); }} function closeGallery(strScrollHash) { if ( ! bolGalleryIsVisible ) return; $( 'html' ).css( 'overflow', 'auto' ); $( '#gallery2' ).fadeOut( 'fast' ); $('#gallery_panzoomdiv').css('display', 'none'); $('#gallery2__content-wrapper').removeClass( 'gallery__only_image' ); if ( strGalleryCloseHashtag ) { window.location.hash = strGalleryCloseHashtag; }else{ if ( window.location.href.indexOf( "filebrowser" ) !== -1 ) { var intIndexOfView = window.location.hash.indexOf(';/view/'); if (intIndexOfView == -1) { intIndexOfView = window.location.hash.indexOf('/view/'); if (intIndexOfView == -1) { intIndexOfView = window.location.hash.length; } } history.replaceState( null, '', ('' + window.location).split('#')[0] + window.location.hash.slice(0, intIndexOfView)) } else { history.replaceState( 'gallery', document.title, ('' + window.location).split('#')[0] ); }} bolGalleryIsVisible = false; strCurrentFileHash = null;stopActiveContent();if ($('#share_popup').is(":visible")) { hideSharePopup(); } if ( typeof window.FileEmbedPopup !== 'undefined' ) { window.FileEmbedPopup.hidePopup(); } if ( !bolDisableGalleryChat && strActiveCommentsEntityHash != "" ) { ChatFM.resetChat(); strActiveCommentsEntityHash = ""; } if($("#item_"+strScrollHash).length) { if ( window.location.href.indexOf( "filebrowser" ) !== -1 ) /* for filebrowser */ { var myElem = document.getElementById("item_"+strScrollHash); let topOffset = myElem.getBoundingClientRect().top; while (myElem != document.documentElement) { myElem = myElem.parentElement; topOffset += myElem.scrollTop; } $(".main_content").animate({scrollTop: topOffset - $(".main_content").height() / 2}); } else { $(document.body).animate({ scrollTop: $("#item_"+strScrollHash).offset().top - window.innerHeight / 2 }, 1000); } $("#item_"+strScrollHash).addClass('active-hover'); } } function showGalleryInfo() { var $gallery_content = $( '#gallery2__content' ); if( $gallery_content.hasClass( 'gallery__sidebar__info-visible' ) && $gallery_content.hasClass( 'gallery__sidebar-visible' ) ) { bolGallerySidebarVisible = false; bolGalleryCommentsVisible = false; $gallery_content.removeClass( 'gallery__sidebar-visible' ); $( '#gallery2' ).removeClass( 'gallery__sidebar-visible' ); } else { $gallery_content.removeClass( 'gallery__sidebar__comments-visible' ).addClass( 'gallery__sidebar__info-visible' ); if( !$gallery_content.hasClass( 'gallery__sidebar-visible' ) ) { $gallery_content.addClass( 'gallery__sidebar-visible' ); $( '#gallery2' ).addClass( 'gallery__sidebar-visible' ); } bolGallerySidebarVisible = true; galleryLoadFileInfo(); } adjustContentWidth(true); loadGalleryInfoAd(); } function showGalleryMessages() { $( '#gallery2__content' ).addClass( 'gallery__sidebar__comments-visible' ).addClass( 'gallery__sidebar__info-visible' ); } function hideGalleryMessages() { $( '#gallery2__content' ).removeClass( 'gallery__sidebar__comments-visible' ).addClass( 'gallery__sidebar__info-visible' ); } var bolGalleryInfoAdLoaded = false; function loadGalleryInfoAd() { if ( bolGalleryInfoAdLoaded ) return; if ( typeof fncDynamicLoadBanner_gallery2__sidebar__banner == 'function' ) { fncDynamicLoadBanner_gallery2__sidebar__banner(); } bolGalleryInfoAdLoaded = true; } function hideSidebar() { $( '#gallery2__content' ).removeClass( 'gallery__sidebar-visible' ); $( '#gallery2' ).removeClass( 'gallery__sidebar-visible' ); bolGallerySidebarVisible = false; bolGalleryCommentsVisible = false; adjustContentWidth(true); } function toggleThumbs() { $( '#gallery2__content' ).toggleClass( 'gallery__thumbs-visible' ); // fire resize event after transition, so audio player knows to resize if( typeof objAudioPlayer !== "undefined" ) { setTimeout( function() { var evt = document.createEvent('UIEvents'); evt.initUIEvent('resize', true, false,window,0); window.dispatchEvent(evt); }, 300 ); } } function hideThumbs() { $( '#gallery2__content' ).removeClass( 'gallery__thumbs-visible' ); $( '#gallery2__thumb-strip__hide_container' ).hide(); } function showThumbs() { $( '#gallery2__content' ).addClass( 'gallery__thumbs-visible' ); $( '#gallery2__thumb-strip__hide_container' ).show(); } function getItemLink ( strHash ) { var intIndex = null; for (idx in arrIDs) { if (arrHashes[idx] == strHash) { intIndex = idx; break;}} var strHashtag = window.location.hash;var intIndexOfView = strHashtag.indexOf(';/view/');if (intIndexOfView != -1) { strHashtag = strHashtag.slice(0, intIndexOfView);}else{var intIndexOfView = strHashtag.indexOf('/view/');if (intIndexOfView != -1) { strHashtag = strHashtag.slice(0, intIndexOfView);}}var intIndexOfDelimiter = strHashtag.indexOf(';/view/');if (intIndexOfDelimiter != -1) { strHashtag = strHashtag.slice(0, intIndexOfDelimiter);}/*if (strHashtag.slice(strHashtag.length-1, strHashtag.length) == '/'){strHashtag = strHashtag.slice(0, strHashtag.length-1);}*/strHashtag = strHashtag + ( bolHashtagViewUseSemicolon ? ';' : '') + '/view/' + arrHashes[intIndex];return strHashtag;} function getItemIndex ( strHash ) { var intIndex = null; for (idx in arrIDs) { if (arrHashes[idx] == strHash) { intIndex = idx; break;}}return intIndex;} function getItemIndexByHashOrName ( strHashOrName ) { if( typeof arrHashes === "undefined" ) { return null; } // edit: before comparisons, urldecode both strings strHashOrName = decodeURIComponent( strHashOrName.replace( /\+/g, ' ' ) ); var intIndex = null; for (idx in arrHashes) { if ( decodeURIComponent( arrHashes[ idx ].replace( /\+/g, ' ' ) ) === strHashOrName ) { intIndex = idx; break; } } if ( intIndex === null ) { var intIndex = null; for (idx in arrNames) { if ( decodeURIComponent( arrNames[ idx ].replace( /\+/g, ' ' ) ) === strHashOrName ) { intIndex = idx; break; } } }return intIndex;} function getNextIndex ( strHash ) { var intIndex = null; var intNextIndex = null; for (idx in arrIDs) { if ( intIndex !== null ) { intNextIndex = idx; break;} if (arrHashes[idx] == strHash) { intIndex = idx;}}return parseInt(intNextIndex);} function getPreviousIndex ( strHash ) { var intPreviousIndex = null; for (idx in arrIDs) { if (arrHashes[idx] == strHash) { break;}else{intPreviousIndex = idx;}}return parseInt(intPreviousIndex);}function preloadImage ( intIndex ){if (typeof arrIsPreloaded == 'undefined')arrIsPreloaded = {};if (typeof arrIsPreloaded[intIndex] == 'undefined')arrIsPreloaded[intIndex]if ( arrFileTypes[intIndex] == 'image' && arrIsPreloaded[intIndex] != true ){var strHash = arrHashes[intIndex];var strImageURL = 'https://'+ arrFileHost[ intIndex ] +'/thumb_show.php?i=' + strHash + '&view';if (arrFeeDownloadPrice[intIndex] > 0){ strImageURL += '&wm=103';} if ( typeof( arrFileVersion ) != 'undefined' && typeof( arrFileVersion[ intIndex ] ) != 'undefined' && arrFileVersion[ intIndex ] > 0 ) { strImageURL += '&version=' + arrFileVersion[ intIndex ]; }$("'; } jqThumb = $( '' + strIconHtml + '' ); } var bolSimpleDownloadAllowed = false; var bolP2PDownloadAllowed = false; if ( bolShowP2PDownloadButton && ( typeof( objWebTorrentDownloadForm ) === 'object' || ! bolIsListViewForSpecificFile ) && arrFeeDownloadPrice[ intFileIndex ] == null && arrAllowDownload[ intFileIndex ] && ( arrAccessType[ intFileIndex ] === 'LINK' || arrAccessType[ intFileIndex ] === 'PUBLIC' ) && arrUploadPassword[ intFileIndex ] === '' && arrAllowPublicDownload[ intFileIndex ] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intFileIndex ] ) ) { bolP2PDownloadAllowed = true; } if ( arrAllowDownload[ intFileIndex ] && arrFeeDownloadPrice[ intFileIndex ] == null && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intFileIndex ] ) ) { bolSimpleDownloadAllowed = true; } $jqSlideElem.append( '' ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb ); if (!arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ]) { $('.gallery2__item__doc-wrapper', $jqSlideElem).append('
' + // '' + // '
' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass( 'gallery2__item__base-width-on ext-icon' ); } } var bolSimpleDownloadAllowed = false; var bolP2PDownloadAllowed = false; if ( bolShowP2PDownloadButton && ( typeof( objWebTorrentDownloadForm ) === 'object' || ! bolIsListViewForSpecificFile ) && arrFeeDownloadPrice[ intFileIndex ] == null && arrAllowDownload[ intFileIndex ] && ( arrAccessType[ intFileIndex ] === 'LINK' || arrAccessType[ intFileIndex ] === 'PUBLIC' ) && arrUploadPassword[ intFileIndex ] === '' && arrAllowPublicDownload[ intFileIndex ] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intFileIndex ] ) ) { bolP2PDownloadAllowed = true; } if ( arrAllowDownload[ intFileIndex ] && arrFeeDownloadPrice[ intFileIndex ] == null && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intFileIndex ] )) { bolSimpleDownloadAllowed = true; } $jqSlideElem.append( '' ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb ); if (!arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ]) { $('.gallery2__item__doc-wrapper', $jqSlideElem).append('
For large files, this may take longer. You can download the file to view it.' + '" ) .css({ 'padding-bottom': '24px', }) .attr( 'src', '/thumb_video_picture.php?i=' + arrHashes[ intFileIndex ] ) .addClass( 'gallery2__item__base-width-on-two' ) ); $jqSlideElem.append( '' ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb ); // $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '
'+'' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass('ext-icon'); } $jqSlideElem.append( '' ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '
' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass('ext-icon'); } $jqIconContainer.append($jqIcon); // Loading icon var $jqLoadingIcon = $('').hide(); $jqIconContainer.append($jqLoadingIcon); // Error icon var $jqErrorIcon = $('').hide(); $jqIconContainer.append($jqErrorIcon); // Add the icon container to the main container $jqMainContainer.append( $jqIconContainer ); // Filename var $jqFileName = $( '
').attr('src', strImageURL); intLoadImageTimeout = setTimeout(function() { fnLoadImageFailed(); }, 30000); $jqImg.on('load', function() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { fnLoadImageFailed(); } else { fnLoadImageSucceeded(); } }); } var $jqPreviewButton = $( '' ); $jqPreviewButton.attr( { 'href': 'javascript:void(0);', 'title': 'Download', 'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button gallery2__item__doc-wrapper__download_button gallery2__preview_button' } ); $jqPreviewButton.css( "marginLeft", "0px" ); $jqPreviewButton.html( 'Preview this file' ); $jqPreviewButton.click( function() { fnLoadImage(); } ); $jqButtonContainer.append("
"); // Add the preview button to the button container $jqButtonContainer.append( $jqPreviewButton ); // Add the buttons container to the main item info container $jqMainContainer.append($jqButtonContainer); // Add the helper and the main container to the DOM $jqSlideElem.append( $jqMainContainerHelper ); $jqSlideElem.append( $jqMainContainer ); break; case 'url' : { var jqThumb; if ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] ) { jqThumb = $( "' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass( 'gallery2__item__base-width-on ext-icon' ); } } if ( arrFeeDownloadPrice[intFileIndex] > 0 ) { if (bolIsOwner) { jqThumb.attr( 'onclick', 'showSetPriceFormModal(strCurrentFileHash)' ); } else { jqThumb.attr( 'onclick', 'showBuyFileFormModal(strCurrentFileHash)' ); } jqThumb.addClass( 'bx_allow_events' ); jqThumb.addClass( 'has_price' ); } $jqSlideElem.append( '' ); $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb ); var jqButtonContainer = $('
").attr("src", strImageURL);arrIsPreloaded[intIndex] = true;}}function checkBeforeContentChange (){intNextIndex = getNextIndex ( strCurrentFileHash );intPreviousIndex = getPreviousIndex ( strCurrentFileHash );if ( intNextIndex != null && !isNaN( intNextIndex ) ){$('#gallery2__controls_right').show();}else{$('#gallery2__controls_right').hide();}if ( intPreviousIndex != null && !isNaN( intPreviousIndex ) ){$('#gallery2__controls_left').show();}else{$('#gallery2__controls_left').hide();} //$('#vote_heart_on_image').hide();}function useEmbedPlayer( intFileIndex ) { var bolUseEmbedPlayerForThisFiles = false; if ( arrFileAttributes[ intFileIndex ][ 'readOnly' ] ) { bolUseEmbedPlayerForThisFiles = true; } else if ( typeof ( bolUseEmbedPlayer ) == 'boolean' && bolUseEmbedPlayer && typeof ( bolIsAnonymousUpload ) == 'boolean' && arrFeeDownloadPrice[ intFileIndex ] == null && arrAllowDownload[ intFileIndex ] && arrAllowPublicDownload[ intFileIndex ] ) { if ( ( [ 'm4a', 'webm', 'ogg' ] ).indexOf( arrExtensions[ intFileIndex ] ) !== -1 ) { bolUseEmbedPlayerForThisFiles = true; } else if ( arrExtensions[ intFileIndex ] == 'mp4' ) { if ( arrViews[ intFileIndex ] < 1000 ) { bolUseEmbedPlayerForThisFiles = false; } else { bolUseEmbedPlayerForThisFiles = true; } } } return bolUseEmbedPlayerForThisFiles; }function checkAfterContentChange (){if ( ! intNextIndex ){intNextIndex = getNextIndex ( strCurrentFileHash );}if ( ! intPreviousIndex ){intPreviousIndex = getPreviousIndex ( strCurrentFileHash );}if ( intNextIndex != null && !isNaN( intNextIndex ) ){$('#gallery2__controls_right').show();}else{$('#gallery2__controls_right').hide();}if ( intPreviousIndex != null && !isNaN( intPreviousIndex ) ){$('#gallery2__controls_left').show();}else{$('#gallery2__controls_left').hide();}/*** do preloading ***/for (var int=0; int