var objFileReportTranslations = JSON.parse('{"FileReportCancelConfirm":"\u0412\u0438 \u0431\u0430\u0436\u0430\u0454\u0442\u0435 \u0441\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438 \u043f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u0456\u0439 \u0437\u0432\u0456\u0442 \u043f\u0440\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0434\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0443?","FileReportConfirm":"\u0427\u0438 \u0454 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437 \u0446\u0438\u043c \u0432\u043c\u0456\u0441\u0442\u043e\u043c \u0430\u0431\u043e \u0444\u0443\u043d\u043a\u0446\u0456\u0454\u044e \u0441\u043b\u0443\u0436\u0431\u0438?","ReasonPlaceholder":"\u0412\u0432\u0435\u0434\u0456\u0442\u044c \u043e\u043f\u0438\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0438...","PleaseSelectType":"\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044c \u0442\u0438\u043f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0438:","Type_DoesNotWork":"\u041d\u0435 \u043f\u0440\u0430\u0446\u044e\u0454","Type_Copyrights":"\u0410\u0432\u0442\u043e\u0440\u0441\u044c\u043a\u0456 \u043f\u0440\u0430\u0432\u0430","Type_PersonalPrivacy":"\u041a\u043e\u043d\u0444\u0456\u0434\u0435\u043d\u0446\u0456\u0439\u043d\u0456\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u0438","Type_Hatred":"\u041d\u0435\u043d\u0430\u0432\u0438\u0441\u0442\u044c","Type_Terrosim":"\u0422\u0435\u0440\u043e\u0440\u0438\u0437\u043c","Type_Malware":"\u0428\u043a\u0456\u0434\u043b\u0438\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0435 \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0435\u043d\u043d\u044f","Type_Spam":"\u0421\u043f\u0430\u043c","Type_Adult":"\u0412\u043c\u0456\u0441\u0442 \u0434\u043b\u044f \u0434\u043e\u0440\u043e\u0441\u043b\u0438\u0445","Type_Children":"\u0434\u0456\u0442\u0438","Type_Bug":"\u041f\u043e\u043c\u0438\u043b\u043a\u0430","Type_Other":"\u0406\u043d\u0448\u0438\u0439","Button_Report":"Report","Button_Cancel":"Cancel"}'); function showFileReportModal( domLink, strHash, fnCallback ) { if ( typeof fnCallback === "undefined" ) { fnCallback = function () {}; } if ( $( domLink ).hasClass( 'has_reported' ) ) return showCancelFileReportModal(domLink, strHash, fnCallback); var strInputs = ''; strInputs += '
'; strInputs += '
'; strInputs += ''; strInputs += '
'; strInputs += '
'; strInputs += ''; strInputs += '
'; fConfirm( objFileReportTranslations.FileReportConfirm + strInputs, null, objFileReportTranslations.Button_Report , objFileReportTranslations.Button_Cancel , // Submit function( bolSubmitted, jqModalWindow ) { if( bolSubmitted === true ) { var jqReason = $( '.reason', jqModalWindow ); var jqType = $( '.type', jqModalWindow ); makeFileReportRequest( strHash, jqReason.val(), jqType.val(), function ( strActionResponse ) { finishFileReport( domLink, strActionResponse ); fnCallback( strActionResponse ); }); } }, // Validate function ( jqModalWindow ) { var jqReason = $( '.reason', jqModalWindow ); var jqType = $( '.type', jqModalWindow ); var bolOk = true; if ( $.trim( jqReason.val() ).length < 4 ) { jqReason.css({'border-color': 'red'}); bolOk = false; } else { jqReason.css({'border-color': 'inherit'}); } if ( $.trim( jqType.val() ) == '' ) { jqType.css({'border-color': 'red'}); bolOk = false; } else { jqType.css({'border-color': 'inherit'}); } return bolOk; } ); } function showCancelFileReportModal(domLink, strHash, fnCallback) { if ( typeof fnCallback === "undefined" ) { fnCallback = function () {}; } fConfirm( objFileReportTranslations.FileReportCancelConfirm, null, 'OK', objFileReportTranslations.Button_Cancel , // Submit function( bolSubmitted ) { if( bolSubmitted === true ) { makeFileReportRequest( strHash, null, null, function ( strActionResponse ) { finishFileReport( domLink, strActionResponse ); fnCallback( strActionResponse ); }); } } ); } function finishFileReport( domLink, strActionResponse ) { if ( strActionResponse == 'report' ) { $( domLink ).addClass( 'has_reported' ).attr( 'my_title', 'Скасувати повідомлення про проблему' ); fSuccess('Дякуємо, звіт про проблему надіслано та незабаром буде розглянуто.'); } else { $( domLink ).removeClass( 'has_reported' ).attr( 'my_title', 'Повідомити про проблему' ); fSuccess('Ваше повідомлення про небезпечний вміст файлу скасовано.'); } } function makeFileReportRequest( strHash, strReason, strType, fncCallback ) { $.ajax( { type: "POST", dataType: "json", url: "/ajax/report_file.php", data: { 'report': true, 'h': strHash, 'reason': !!strReason ? strReason : null, 'type': !!strType ? strType : null }, success: function ( data ) { if ( data[ 'status' ] == 'ok' ) { fncCallback( data[ 'action' ] ); } } } ); }