Дорама Ру

/* Feedback.js */ if (typeof getSelTextWorked == 'undefined'){ var getSelTextWorked=function(){ var txt = ''; if (window.getSelection!=undefined){txt = window.getSelection(); }else if (document.getSelection!=undefined){txt = document.getSelection(); }else if (document.selection!=undefined){txt = document.selection.createRange().text;} return txt; } } if (typeof ctrlEnter == 'undefined'){ var ctrlEnter=function(e){ if(((e.keyCode == 13) || (e.keyCode == 10)) && (e.ctrlKey == true)){ var descr = getSelTextWorked(); var feedbackInit = { 'type' : 'error', 'link' : location.href } if (descr != ''){feedbackInit.messageText = '%ERROR%: "' + descr + '"';} jQuery('a.feedback').feedback(feedbackInit); } } } function validate_email(str){ var email_regular = new RegExp(/^([a-z0-9_\-\.]+)@[a-z0-9\-]+(\.[a-z0-9\-]+)*(\.[a-z]{2,3})$/i); return email_regular.test(str); } jQuery(document).ready(function() { jQuery(document).keypress(function(event){ctrlEnter(event)}); if (typeof jQuery.fn.feedback == 'undefined'){ // Feedback jQuery.fn.feedback = function(options){ var domain = typeof mainDomainHttp != 'undefined' ? mainDomainHttp : 'http://fininsider.ru/wp-content/plugins/wp_ajax_feedback/', activeTab = typeof options != 'undefined' && typeof options.type != 'undefined' ? 'activeTab='+options.type : '', messageText = typeof options != 'undefined' && typeof options.messageText != 'undefined' ? 'messageText='+options.messageText : '', link = typeof options != 'undefined' && typeof options.link != 'undefined' ? 'fback_location='+options.link : ''; jQuery.getScript(domain+'feedbackform.js?' + activeTab + '&' + messageText + '&' + link, function(){ if (jQuery('div.feedback').children().length == 0){ jQuery('body').append(feedback_form.data); } else { jQuery('div.feedback').replaceWith(feedback_form.data); } jQuery('div.feedback').each(setFeedback); } ); }; var setFeedback = function(){ var self = this; var pos_wrate, pos_hrate, size_wrate, size_hrate; var con = jQuery(self).children(".c"); var form = jQuery(con).children(".fb_form"); var textarea = jQuery("#fback_text"); var tabsleft = jQuery("ul.tabsLeft"); var resize_teh_popup = function(){ jQuery(con).css({ marginTop: function(){return parseInt(jQuery(con).height()/-2);}, marginLeft: function(){return parseInt(jQuery(con).width()/-2);}, width: jQuery(window).width()<=800?"480px":"", height: jQuery(window).width()<=800?"289px":"", fontSize: jQuery(window).width()<=800?"0.7em":"" }); jQuery(textarea).css({ height: jQuery(window).width()<=800?"65px":"" }); jQuery(tabsleft).css({ height: jQuery(window).width()<=800?"207px":"" }); jQuery(".feedback .tabsLeft a").css({ backgroundPosition: jQuery(window).width()<=800?"4px -32px":"" }); jQuery(".feedback li.active a").css({ backgroundPosition: jQuery(window).width()<=800?"4px 5px":"" }); jQuery(form).css({ width: jQuery(window).width()<=800?"274px":"", top: jQuery(window).width()<=800?"97px":"" }); jQuery(tabsleft).children("li").children("a").css({ padding: jQuery(window).width()<=800?"0px 10px 1px 27px":"", fontSize: jQuery(window).width()<=800?"1.3em":"" }); }; if(jQuery(window).width()<=800) resize_teh_popup(); jQuery(self).children(".opacity").height(jQuery(document).height()); jQuery(con).css({ marginTop: function(){return parseInt(jQuery(con).height()/-2);}, marginLeft: function(){return parseInt(jQuery(con).width()/-2);} }); jQuery(window).resize(resize_teh_popup); jQuery('ul.tabsLeft li').live('click', function(){ jQuery(".feedback .tabsLeft a").css({ backgroundPosition: jQuery(window).width()<=800?"4px -32px":"" }); jQuery(".feedback li.active a").css({ backgroundPosition: jQuery(window).width()<=800?"4px 5px":"" }); }); jQuery('div.feedback').find("a.fback_close, input.fback_close, div.opacity").live('click',function(){ jQuery('div.feedback').remove(); return false; }); }; /* Automatically apply to any a.feedback */ jQuery('a.feedback').click(function(){jQuery(this).feedback(); return false;}); // Feedback jQuery('#fback_submit').live('click',function(){ jQuery('.f').html(''); var fback_text = jQuery('#fback_text').val(), fback_type = jQuery('div.feedback').find('ul.tabsLeft').find('li.active').attr('id'), fback_email = jQuery('#fback_email').val(), capq = jQuery('#capq').val(), caph = jQuery('#caph').val(); if (fback_text.trim() == ''){ alert(typeof feedback_validate_message != 'undefined' ? feedback_validate_message : 'Поле "Текст сообщения" не заполнено'); return false; } // if (fback_email.trim() == '' || !validate_email(fback_email.trim())){ //alert(typeof feedback_validate_email != 'undefined' ? feedback_validate_email : 'Поле Email не заполнено или заполнено некорректно'); //return false; //} jQuery.post('http://fininsider.ru/wp-content/plugins/wp_ajax_feedback/feedbacksend.php', { 'fback_email': fback_email, 'fback_type': fback_type, 'fback_text': fback_text, 'fback_location': location.href, 'capq': capq, 'caph': caph }, function(data){ jQuery('div.feedback').replaceWith(data); jQuery('div.feedback').find('div.c').css({ marginTop: function(){return parseInt(jQuery(this).height()/-2);}, marginLeft: function(){return parseInt(jQuery(this).width()/-2);} }); }); }); } });