var objFileReportTranslations = JSON.parse('{"FileReportCancelConfirm":"\u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043e\u0442\u0447\u0435\u0442 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430?","FileReportConfirm":"\u0415\u0441\u0442\u044c \u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043b\u0443\u0436\u0431\u044b?","ReasonPlaceholder":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b...","PleaseSelectType":"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0438\u043f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:","Type_DoesNotWork":"Does not work","Type_Copyrights":"\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u043e","Type_PersonalPrivacy":"\u0427\u0430\u0441\u0442\u043d\u0430\u044f \u0436\u0438\u0437\u043d\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430","Type_Hatred":"\u041d\u0435\u043d\u0430\u0432\u0438\u0441\u0442\u044c","Type_Terrosim":"\u0422\u0435\u0440\u0440\u043e\u0440\u0438\u0437\u043c","Type_Malware":"\u0412\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435","Type_Spam":"\u0421\u043f\u0430\u043c","Type_Adult":"\u041a\u043e\u043d\u0442\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445","Type_Children":"\u0414\u0435\u0442\u0438","Type_Bug":"\u041e\u0448\u0438\u0431\u043a\u0430","Type_Other":"\u0414\u0440\u0443\u0433\u043e\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('Thanks, a problem report has been submitted and will be reviewed shortly.'); } 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' ] ); } } } ); }