'); isotopeRemove(itemWrap, itemWrap.find('.fullItemWrap')); var next_before = item.nextAll('.itemFirst').eq(0); if (!item.hasClass('itemLast') && next_before.length > 0) { item.nextAll('.itemFirst:visible').eq(0).before(itemContent); } else { itemWrap.find('article.itemLast').after(itemContent); } //jQuery('.isotopeItem.itemLast[data-row-num="'+itemRow+'"]').after( itemContent ); itemWrap.isotope('destroy').isotope({ //getSortData: { // ids: '[data-postid]', //}, //sortBy: ['ids'], layoutMode: 'masonry', itemSelector: '.isotopeItem', filter: THEMEREX_isotopeFilter, animationOptions: { duration: 750, easing: 'linear', queue: false } }).isotope('on', 'layoutComplete', function() { //function complete }); //add effect setTimeout(function() { "use strict"; isotoreEffect(); }, 500); isotopeScrolling(item) //load content jQuery.post(THEMEREX_ajax_url, { action: 'isotope_content', nonce: THEMEREX_ajax_nonce, postID: istPostID, }).done(function(response) { "use strict"; var rez = JSON.parse(response); jQuery('.fullItemWrap .fullContent').html((rez != '' ? rez.data : THEMEREX_SEND_ERROR)).parent('.fullItemWrap').addClass('ajaxShow'); initShortcodes(jQuery('.fullItemWrap')); initPostFormats(); //nav prev jQuery('.isotopeNav.isoPrev').data('nav-id', (navPrevID != undefined ? navPrevID : navLastID)); jQuery('.isotopeNav.isoNext').data('nav-id', (navNextID != undefined ? navNextID : navFirstID)); THEMEREX_isotopeInitCounter = 0; initRelayoutIsotope(jQuery('.fullItemWrap .fullContent')); }); THEMEREX_isotopeMemoryID = istPostID; return false; } function isotopeFilterClass(selector) { "use strict"; jQuery('.isotopeWrap .isotopeItem').removeClass('isotopeVisible').each(function() { if (selector == '*') { jQuery(this).addClass('isotopeVisible'); } else { jQuery(selector).addClass('isotopeVisible'); } }); } //isotope remove function isotopeRemove(itemWrap, item) { "use strict"; var isotopeWrap = itemWrap; isotopeWrap.find('.isotopeItem[data-postid="' + THEMEREX_isotopeMemoryID + '"]').removeClass('isotopeActive') isotopeWrap.isotope('remove', item).isotope('layout'); } //isotope Images Complete function initRelayoutIsotope(content) { "use strict"; if (!imagesCompleteLoad(content) && THEMEREX_isotopeInitCounter++ ' + filters[i] + ''); } } } function beforeIsotopeItemResize(itemWrap, isotopeWrap, isotopeItem, isotopeWrapFoliosize) { if (itemWrap != 'regular') if (itemWrap.find('.fullItemWrap').length > 0) { isotopeRemove(itemWrap, itemWrap.find('.fullItemWrap')); } var isotopeWrapWidth = isotopeWrap.width(); if (isotopeWrapWidth == 0) isotopeWrapWidth = isotopeWrap.parent().width(); var indent = false; if (jQuery(isotopeWrap).hasClass('isotopeIndent')) { indent = true; if (itemWrap != 'regular') { isotopeWrapWidth = jQuery(isotopeWrap).parents('.masonryWrap').width(); jQuery(isotopeWrap).width(isotopeWrapWidth); } // else isotopeWrapWidth = jQuery(isotopeWrap).width(); } isotopeItem.each(function() { "use strict"; var isotopeItemIncw = jQuery(this).data('incw'); var isotopeItemInch = jQuery(this).data('inch'); if (itemWrap == 'regular') isotopeItemIncw = isotopeItemInch = 1; var isotopeSize = isotopeResizeMath(isotopeWrapWidth, isotopeWrapFoliosize, isotopeItemIncw, isotopeItemInch); jQuery(this).css({ 'width': isotopeSize[0], 'height': isotopeSize[1] }); //indent if (itemWrap != 'regular') { if (indent == true) { jQuery(this).find('.isotopeItemWrap').css({ 'width': (isotopeSize[0] - 30), 'height': (isotopeSize[1] - 30), 'margin-left': '15px' }); } else { jQuery(this).find('.isotopeItemWrap').css({ 'width': isotopeSize[0], 'height': isotopeSize[1] }); } } else { if (indent == true) { jQuery(this).css({ 'width': (isotopeSize[0] - 30) }); } else { jQuery(this).css({ 'width': isotopeSize[0] }); } } var titleSize = 30; var excerptSize = 14; if (isotopeSize[0] > 600) { titleSize = 30; excerptSize = 14; } if (isotopeSize[0] 4) isotopeWrapFoliosize = 4; if (windowWidth 2) isotopeWrapFoliosize = 2; if (windowWidth 1) isotopeWrapFoliosize = 1; if (windowWidth 2) incw = 2; if (windowWidth 2) inch = 2; if (windowWidth 1) incw = 1; if (windowWidth 1) inch = 1; var bw = isotopeWrapWidth / isotopeWrapFoliosize; var w_px = (bw * incw) - 0.01 * incw; var h_px = (bw * inch) - 0.001 * inch; var w_pr = (100 / isotopeWrapFoliosize) * incw; var data = [w_px, h_px, w_pr] return data; } //isotope Images Complete function imagesCompleteLoad(content) { "use strict"; var complete = true; content.find('img').each(function() { if (!complete) return; if (!jQuery(this).get(0).complete) complete = false; }); return complete; } // Shortcodes init jQuery(document).ready(function() { "use strict"; initShortcodes(jQuery('body').eq(0)); }); function initShortcodes(container) { "use strict"; // Tabs if (container.find('.sc_tabs:not(.inited)').length > 0) { var sc_tabs_effetcs = container.find('.sc_tabs:not(.inited)').hasClass('sc_tabs_effects'); container.find('.sc_tabs:not(.inited)') .addClass('inited') .tabs({ show: { direction: sc_tabs_effetcs ? 'right' : '', effect: sc_tabs_effetcs ? 'slide' : 'fade', duration: sc_tabs_effetcs ? 500 : 250, }, hide: { direction: sc_tabs_effetcs ? 'left' : '', effect: sc_tabs_effetcs ? 'slide' : 'fade', duration: sc_tabs_effetcs ? 500 : 250, }, create: function (event, ui) { initShortcodes(ui.panel); }, activate: function (event, ui) { initShortcodes(ui.newPanel); } }); } // Accordion if (container.find('.sc_accordion_init:not(.inited)').length > 0) { container.find(".sc_accordion_init:not(.inited)").each(function () { var init = jQuery(this).data('active'); if (isNaN(init)) init = 0; else init = Math.max(0, init); jQuery(this) .addClass('inited') .accordion({ active: init, heightStyle: "content", header: "> .sc_toggl_item > .sc_toggl_title", create: function (event, ui) { initShortcodes(ui.panel); ui.header.each(function () { jQuery(this).parent().addClass('sc_active'); }); }, activate: function (event, ui) { initShortcodes(ui.newPanel); ui.newHeader.each(function () { jQuery(this).parent().addClass('sc_active'); }); ui.oldHeader.each(function () { jQuery(this).parent().removeClass('sc_active'); }); } }); }); } // Toggles if (container.find('.sc_toggles_init:not(.inited)').length > 0) { container.find('.sc_toggles_init .sc_toggl_title:not(.inited)') .addClass('inited') .click(function () { jQuery(this).parent().toggleClass('sc_active'); jQuery(this).parent().find('.sc_toggl_content').slideToggle(200, function () { initShortcodes(jQuery(this).parent().find('.sc_toggl_content')); }); }); } // Tooltip if (container.find('.sc_tooltip:not(.inited)').length > 0) { container.find('.sc_tooltip:not(.inited)') .addClass('inited') .hover(function () { "use strict"; var obj = jQuery(this); obj.find('.sc_tooltip_item').stop().animate({ 'marginTop': '5' }, 100).show(); }, function () { "use strict"; var obj = jQuery(this); obj.find('.sc_tooltip_item').stop().animate({ 'marginTop': '0' }, 100).hide(); }); } // Infoboxes if (container.find('.sc_infobox.sc_infobox_closeable:not(.inited)').length > 0) { container.find('.sc_infobox.sc_infobox_closeable:not(.inited)') .addClass('inited') .click(function () { jQuery(this).slideUp(); }); } // Contact form if (container.find('.sc_form .sc_form_button .sc_button:not(.inited)').length > 0 && container.find('.sc_form').data('formtype') == 'contact' ) { container.find('.sc_form .sc_form_button .sc_button:not(.inited)') .addClass('inited') .click(function(e){ userSubmitForm(jQuery(this).parents("form"), THEMEREX_ajax_url, THEMEREX_ajax_nonce); e.preventDefault(); return false; }); } // Bordered images if (container.find('.sc_border:not(.inited)').length > 0) { container.find('.sc_border:not(.inited)') .each(function () { "use strict"; if (jQuery(this).parents('div:hidden').length > 0) return; jQuery(this).addClass('inited'); var w = Math.round(jQuery(this).width()); var h = Math.round(w/4*3); jQuery(this).find('.slides').css({height: h+'px'}); jQuery(this).find('.slides li').css({width: w+'px', height: h+'px'}); }); } // Swiper Slider, slider init if (container.find('.sc_slider_swiper:not(.inited)').length > 0 ) { var mySwiper = {}; //swiper auho height jQuery('.sc_slider_swiper.sc_slider_swiper_autoheight').each(function() { var sl_width = jQuery(this).width(); jQuery(this).css('height','auto') jQuery(this).find('li.swiper-slide').each(function() { if( jQuery(this).find('img').length > 0 && jQuery(this).find('img').attr('width').replace('px', '') >= sl_width ){ var img_width = jQuery(this).find('img').attr('width').replace('px', ''); var img_height = jQuery(this).find('img').attr('height').replace('px', ''); var li_height = sl_width / img_width * img_height; } else { var li_height = jQuery(this).height(); } jQuery(this).attr('data-autoheight', li_height ); }); }); //контейнер / ширину картинки * высоту картинки container.find('.sc_slider_swiper:not(.inited)') .each(function () { "use strict"; if (jQuery(this).parents('div:hidden').length > 0) return; jQuery(this).addClass('inited'); var id = jQuery(this).attr('id'); if (id == undefined) { id = 'swiper_'+Math.random(); id = id.replace('.', ''); jQuery(this).attr('id', id); } //specify height var firstSlider = jQuery(this).find('li.swiper-slide').eq(0); var firstHeight = firstSlider.data('autoheight'); var firstTheme = firstSlider.data('theme') != undefined ? 'sc_slider_'+firstSlider.data('theme') : ''; var testimonialAuthor = firstSlider.hasClass('sc_testimonials_item_author_show') ? 'sc_testimonials_author_show' : ''; jQuery(this).addClass(id+' '+firstTheme+' '+testimonialAuthor ).css('height', firstHeight); firstSlider.css('height', firstHeight); //init slider mySwiper[id] = new Swiper('.'+id, { loop: true, grabCursor: true, calculateHeight: false, pagination: jQuery(this).hasClass('sc_slider_pagination') ? '#'+id+' .slider-pagination-nav' : false, paginationClickable: true, autoplay: 7000, speed: 600, onFirstInit: function (swiper){ /*operation*/ }, onSlideChangeStart: function (swiper){ var activeIndex = swiper.activeIndex; var sliderContainer = swiper.container; var sliderLi = jQuery(sliderContainer).find('li.swiper-slide').eq(activeIndex) var theme = sliderLi.data('theme') != undefined ? 'sc_slider_'+sliderLi.data('theme') : ''; var testimonialAuthor = sliderLi.hasClass('sc_testimonials_item_author_show') ? 'sc_testimonials_author_show' : ''; var height = sliderLi.data('autoheight'); jQuery('#'+id).removeClass('sc_slider_light sc_slider_dark sc_testimonials_author_show').addClass( theme+' '+testimonialAuthor ); sliderLi.css('height',height); jQuery('#'+id).css('height',height); jQuery('#'+id).find('.swiper-wrapper').css('height',height); }, }); var navi = jQuery(this).find('.slider-control-nav'); if (navi.length == 0) navi = jQuery(this).siblings('.slider-control-nav'); navi.find('.slide-prev').click(function(e){ var swiper = jQuery(this).parents('.sc_slider_swiper'); if (swiper.length == 0) swiper = jQuery(this).parents('.slider-control-nav').siblings('.sc_slider_swiper'); var id = swiper.attr('id'); e.preventDefault(); mySwiper[id].swipePrev(); }); navi.find('.slide-next').click(function(e){ var swiper = jQuery(this).parents('.sc_slider_swiper'); if (swiper.length == 0) swiper = jQuery(this).parents('.slider-control-nav').siblings('.sc_slider_swiper'); var id = swiper.attr('id'); e.preventDefault(); mySwiper[id].swipeNext(); }); }); } //Scroll if (container.find('.sc_scroll:not(.inited)').length > 0) { var myScroll = {}; container.find('.sc_scroll:not(.inited)') .each(function () { "use strict"; if (jQuery(this).parents('div:hidden').length > 0) return; jQuery(this).addClass('inited'); var id = jQuery(this).attr('id'); if (id == undefined) { id = 'scroll_'+Math.random(); id = id.replace('.', ''); jQuery(this).attr('id', id); } jQuery(this).addClass(id); myScroll[id] = new Swiper('.'+id, { freeMode: true, freeModeFluid: true, grabCursor: true, mode: jQuery(this).hasClass('sc_scroll_vertical') ? 'vertical' : 'horizontal', slidesPerView: jQuery(this).hasClass('sc_scroll') ? 'auto' : 1, mousewheelControl: true, mousewheelAccelerator: 4, // Accelerate mouse wheel in Firefox 4+ scrollContainer: jQuery(this).hasClass('sc_scroll_vertical'), scrollbar: { container: '.'+id+'_bar', hide: true, draggable: true } }) }); } //Countdown if (container.find('.sc_countdown_counter:not(.inited)').length > 0) { var myCountdown = {}; container.find('.sc_countdown_counter:not(.inited)') .each(function () { "use strict"; if (jQuery(this).parents('div:hidden').length > 0) return; jQuery(this).addClass('inited'); var id = jQuery(this).attr('id'); if (id == undefined) { id = 'countdown_'+Math.random(); id = id.replace('.', ''); jQuery(this).attr('id', id); } var style = jQuery(this).data('style'); var curDate = new Date(); var endDate = jQuery(this).data('date'); if (endDate == undefined || endDate == ''){ var cur_date_year = curDate.getFullYear(); var cur_date_mounth = ((curDate.getMonth()+1)%12) + 1; var cur_date_mounth = cur_date_mounth 0) { container.find('.sc_zoom:not(.inited)') .each(function () { if (jQuery(this).parents('div:hidden').length > 0) return; jQuery(this).addClass('inited'); jQuery(this).find('img').elevateZoom({ zoomType: "lens", //borderColour: "#8c8c8c", borderSize: 0, lensShape: "round", lensSize: 200 }); }); } //skills init if (container.find('.sc_skills_item:not(.inited)').length > 0) { skills_init(container); jQuery(window).scroll(function () { skills_init(container); }); } //skills type='arc' init if (jQuery('.sc_skills_arc:not(.inited)').length > 0) { skills_arc_init(container); jQuery(window).scroll(function () { skills_arc_init(container); }); } // eform jQuery('.sc_eform_form .sc_eform_input, .sc_eform_form .sc_eform_button').click(function (e) { "use strict"; e.stopPropagation(); }); jQuery(document).click(function (e) { "use strict"; jQuery('.sc_eform_form.sc_eform_hide').removeClass('sc_eform_opened'); }); jQuery('.sc_eform_form .sc_eform_button').click(function (e) { "use strict"; var form = jQuery(this).parents('.sc_eform_form'); var input = form.find('.sc_eform_input'); var type = form.data('type'); form.addClass('sc_eform_opened'); e_form( jQuery(this).parents('.sc_eform_form') ) return false; }); } // eform function e_form(container){ "use strict"; var form = container; var input = form.find('.sc_eform_input'); var button = form.find('.sc_eform_button'); var type = form.data('type'); //emailer if (form.length>0 && type == 'emailer' ) { if (button.hasClass('sc_eform_button')) { var group = button.data('group'); var email = input.val(); var regexp = new RegExp(THEMEREX_EMAIL_MASK); if (!regexp.test(email)) { input.get(0).focus(); themerex_message_warning(THEMEREX_EMAIL_NOT_VALID); } else { jQuery.post(THEMEREX_ajax_url, { action: 'emailer_submit', nonce: THEMEREX_ajax_nonce, group: group, email: email }).done(function(response) { var rez = JSON.parse(response); if (rez.error === '') { themerex_message_warning(THEMEREX_MESSAGE_EMAIL_ADDED.replace('%s', email)); input.val(''); } else { themerex_message_warning(rez.error); } }); } } else { form.get(0).submit(); } //search } else if (form.length>0 && type == 'search'){ if (button.hasClass('sc_eform_button')) { if( input.val() != '') form.get(0).submit(); } } else { jQuery(document).trigger('click'); } //endIF } // skills init function skills_init(container) { if (arguments.length==0) var container = jQuery('body'); var scrollPosition = jQuery(window).scrollTop() + jQuery(window).height(); container.find('.sc_skills_item:not(.inited)').each(function () { var skillsItem = jQuery(this); var scrollSkills = skillsItem.offset().top; if (scrollPosition > scrollSkills) { skillsItem.addClass('inited'); var skills = skillsItem.parents('.sc_skills').eq(0); var type = skills.data('type'); var total = skillsItem.find('.sc_skills_total').eq(0); var start = parseInt(total.data('start')); var stop = parseInt(total.data('stop')); var maximum = parseInt(total.data('max')); var startPercent = Math.round(start/maximum*100); var stopPercent = Math.round(stop/maximum*100); var ed = total.data('ed'); var duration = parseInt(total.data('duration')); var speed = parseInt(total.data('speed')); var step = parseInt(total.data('step')); if (type == 'bar') { var dir = skills.data('dir'); var count = skillsItem.find('.sc_skills_count').eq(0); if (dir=='horizontal') count.css('width', startPercent + '%').addClass('sc_skills_count_init').animate({ width: stopPercent + '%' }, duration); else if (dir=='vertical') count.css('height', startPercent + '%').addClass('sc_skills_count_init').animate({ height: stopPercent + '%' }, duration); skills_counter(start, stop, speed-(dir!='unknown' ? 5 : 0), step, ed, total); } else if (type == 'counter') { skills_counter(start, stop, speed - 5, step, ed, total); } else if (type == 'pie') { var steps = parseInt(total.data('steps')); var color = total.data('color'); var easing = total.data('easing'); skills_counter(start, stop, Math.round(1500/steps), step, ed, total); var options = { segmentShowStroke: true, segmentStrokeColor: "#fff", percentageInnerCutout: 90, animationSteps: steps, animationEasing: easing, animateRotate: true, animateScale: false, }; var pieData = [{ value: stopPercent, color: color }, { value: 100 - stopPercent, color: "#E5F1FB" }]; var canvas = skillsItem.find('canvas'); canvas.attr({width: skillsItem.width(), height: skillsItem.width()}).css({width: skillsItem.width(), height: skillsItem.height()}); var pie = new Chart(canvas.get(0).getContext("2d")).Doughnut(pieData, options); } } }); } //skills counter animation function skills_counter(start, stop, speed, step, ed, total) { total.html(''+start+ed+''); start = Math.min(stop, start + step); if (start 180), 1, x, y]]; return { path: path, stroke: color } } arc.find('.sc_skills_data').find('.arc').each(function(i){ var t = jQuery(this), color = t.find('.color').val(), value = t.find('.percent').val(), text = t.find('.text').text(); rad += Math.round(w/15); var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': Math.round(w/45) }); z.mouseover(function(){ this.animate({ 'stroke-width': Math.round(w/9), opacity: .75 }, 1000, 'elastic'); if (Raphael.type != 'VML') //solves IE problem this.toFront(); title.stop().animate({ opacity: 0 }, speed, '>', function(){ this.attr({ text: (text ? text + '\n' : '') + value + '%' }).animate({ opacity: 1 }, speed, '', function(){ title.attr({ text: THEMEREX_SC_SKILLS }).animate({ opacity: 1 }, speed, ' h ? ( h/w ) : 1 ), y = ( coordinates.y - $el.offset().top - ( h/2 )) * ( h > w ? ( w/h ) : 1 ), // the angle and the direction from where the mouse came in/went out clockwise (TRBL=0123); // first calculate the angle of the point, // add 180 deg to get rid of the negative values // divide by 90 to get the quadrant // add 3 and do a modulo by 4 to shift the quadrants to a proper clockwise TRBL (top/right/bottom/left) **/ direction = Math.round( ( ( ( Math.atan2(y, x) * (180 / Math.PI) ) + 180 ) / 90 ) + 3 ) % 4; return direction; }, _getStyle : function( direction ) { var fromStyle, toStyle, slideFromTop = { left : '0px', top : '-100%' }, slideFromBottom = { left : '0px', top : '100%' }, slideFromLeft = { left : '-100%', top : '0px' }, slideFromRight = { left : '100%', top : '0px' }, slideTop = { top : '0px' }, slideLeft = { left : '0px' }; switch( direction ) { case 0: // from top fromStyle = !this.options.inverse ? slideFromTop : slideFromBottom; toStyle = slideTop; break; case 1: // from right fromStyle = !this.options.inverse ? slideFromRight : slideFromLeft; toStyle = slideLeft; break; case 2: // from bottom fromStyle = !this.options.inverse ? slideFromBottom : slideFromTop; toStyle = slideTop; break; case 3: // from left fromStyle = !this.options.inverse ? slideFromLeft : slideFromRight; toStyle = slideLeft; break; }; return { from : fromStyle, to : toStyle }; }, // apply a transition or fallback to jquery animate based on Modernizr.csstransitions support _applyAnimation : function( el, styleCSS, speed ) { $.fn.applyStyle = this.support ? $.fn.css : $.fn.animate; el.stop().applyStyle( styleCSS, $.extend( true, [], { duration : speed + 'ms' } ) ); }, }; var logError = function( message ) { if ( window.console ) { window.console.error( message ); } }; $.fn.hoverdir = function( options ) { var instance = $.data( this, 'hoverdir' ); if ( typeof options === 'string' ) { var args = Array.prototype.slice.call( arguments, 1 ); this.each(function() { if ( !instance ) { logError( "cannot call methods on hoverdir prior to initialization; " + "attempted to call method '" + options + "'" ); return; } if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { logError( "no such method '" + options + "' for hoverdir instance" ); return; } instance[ options ].apply( instance, args ); }); } else { this.each(function() { if ( instance ) { instance._init(); } else { instance = $.data( this, 'hoverdir', new $.HoverDir( options, this ) ); } }); } return instance; }; } )( jQuery, window ); /** * hoverIntent is similar to jQuery's built-in "hover" method except that * instead of firing the handlerIn function immediately, hoverIntent checks * to see if the user's mouse has slowed down (beneath the sensitivity * threshold) before firing the event. The handlerOut function is only * called after a matching handlerIn. * * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+ * http://cherne.net/brian/resources/jquery.hoverIntent.html * * You may use hoverIntent under the terms of the MIT license. Basically that * means you are free to use hoverIntent as long as this header is left intact. * Copyright 2007, 2013 Brian Cherne * * // basic usage ... just like .hover() * .hoverIntent( handlerIn, handlerOut ) * .hoverIntent( handlerInOut ) * * // basic usage ... with event delegation! * .hoverIntent( handlerIn, handlerOut, selector ) * .hoverIntent( handlerInOut, selector ) * * // using a basic configuration object * .hoverIntent( config ) * * @param handlerIn function OR configuration object * @param handlerOut function OR selector for delegation OR undefined * @param selector selector OR undefined * @author Brian Cherne **/ (function($) { $.fn.hoverIntent = function(handlerIn,handlerOut,selector) { // default configuration values var cfg = { interval: 100, sensitivity: 7, timeout: 0 }; if ( typeof handlerIn === "object" ) { cfg = $.extend(cfg, handlerIn ); } else if ($.isFunction(handlerOut)) { cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } ); } else { cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } ); } // instantiate variables // cX, cY = current X and Y position of mouse, updated by mousemove event // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval var cX, cY, pX, pY; // A private function for getting mouse position var track = function(ev) { cX = ev.pageX; cY = ev.pageY; }; // A private function for comparing current and previous mouse position var compare = function(ev,ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); // compare mouse positions to see if they've crossed the threshold if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) $().plugin('option', {...}) * @param {Function} PluginClass - constructor class */ function addOptionMethod( PluginClass ) { // don't overwrite original option method if ( PluginClass.prototype.option ) { return; } // option setter PluginClass.prototype.option = function( opts ) { // bail out if not an object if ( !$.isPlainObject( opts ) ){ return; } this.options = $.extend( true, this.options, opts ); }; } // -------------------------- plugin bridge -------------------------- // // helper function for logging errors // $.error breaks jQuery chaining var logError = typeof console === 'undefined' ? noop : function( message ) { console.error( message ); }; /** * jQuery plugin bridge, access methods like $elem.plugin('method') * @param {String} namespace - plugin name * @param {Function} PluginClass - constructor class */ function bridge( namespace, PluginClass ) { // add to jQuery fn namespace $.fn[ namespace ] = function( options ) { if ( typeof options === 'string' ) { // call plugin method when first argument is a string // get arguments for method var args = slice.call( arguments, 1 ); for ( var i=0, len = this.length; i get element from selector string, & get size of element * if option is Element -> get size of element * else use option as a number * * @param {String} measurement * @param {String} size - width or height * @private */ Outlayer.prototype._getMeasurement = function( measurement, size ) { var option = this.options[ measurement ]; var elem; if ( !option ) { // default to 0 this[ measurement ] = 0; } else { // use option as an element if ( typeof option === 'string' ) { elem = this.element.querySelector( option ); } else if ( isElement( option ) ) { elem = option; } // use size of element, if element this[ measurement ] = elem ? getSize( elem )[ size ] : option; } }; /** * layout a collection of item elements * @api public */ Outlayer.prototype.layoutItems = function( items, isInstant ) { items = this._getItemsForLayout( items ); this._layoutItems( items, isInstant ); this._postLayout(); }; /** * get the items to be laid out * you may want to skip over some items * @param {Array} items * @returns {Array} items */ Outlayer.prototype._getItemsForLayout = function( items ) { var layoutItems = []; for ( var i=0, len = items.length; i onresize Outlayer.prototype.handleEvent = function( event ) { var method = 'on' + event.type; if ( this[ method ] ) { this[ method ]( event ); } }; /** * Bind layout to window resizing */ Outlayer.prototype.bindResize = function() { // bind just one listener if ( this.isResizeBound ) { return; } eventie.bind( window, 'resize', this ); this.isResizeBound = true; }; /** * Unbind layout to window resizing */ Outlayer.prototype.unbindResize = function() { if ( this.isResizeBound ) { eventie.unbind( window, 'resize', this ); } this.isResizeBound = false; }; // original debounce by John Hann // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ // this fires every resize Outlayer.prototype.onresize = function() { if ( this.resizeTimeout ) { clearTimeout( this.resizeTimeout ); } var _this = this; function delayed() { _this.resize(); delete _this.resizeTimeout; } this.resizeTimeout = setTimeout( delayed, 100 ); }; // debounced, layout on resize Outlayer.prototype.resize = function() { // don't trigger if size did not change // or if resize was unbound. See #9 if ( !this.isResizeBound || !this.needsResizeLayout() ) { return; } this.layout(); }; /** * check if layout is needed post layout * @returns Boolean */ Outlayer.prototype.needsResizeLayout = function() { var size = getSize( this.element ); // check that this.size and size are there // IE8 triggers resize on body size change, so they might not be var hasSizes = this.size && size; return hasSizes && size.innerWidth !== this.size.innerWidth; }; // -------------------------- methods -------------------------- // /** * add items to Outlayer instance * @param {Array or NodeList or Element} elems * @returns {Array} items - Outlayer.Items **/ Outlayer.prototype.addItems = function( elems ) { var items = this._itemize( elems ); // add items to collection if ( items.length ) { this.items = this.items.concat( items ); } return items; }; /** * Layout newly-appended item elements * @param {Array or NodeList or Element} elems */ Outlayer.prototype.appended = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; } // layout and reveal just the new items this.layoutItems( items, true ); this.reveal( items ); }; /** * Layout prepended elements * @param {Array or NodeList or Element} elems */ Outlayer.prototype.prepended = function( elems ) { var items = this._itemize( elems ); if ( !items.length ) { return; } // add items to beginning of collection var previousItems = this.items.slice(0); this.items = items.concat( previousItems ); // start new layout this._resetLayout(); this._manageStamps(); // layout new stuff without transition this.layoutItems( items, true ); this.reveal( items ); // layout previous items this.layoutItems( previousItems ); }; /** * reveal a collection of items * @param {Array of Outlayer.Items} items */ Outlayer.prototype.reveal = function( items ) { var len = items && items.length; if ( !len ) { return; } for ( var i=0; i containerWidth ) { this.x = 0; this.y = this.maxY; } var position = { x: this.x, y: this.y }; this.maxY = Math.max( this.maxY, this.y + item.size.outerHeight ); this.x += itemWidth; return position; }; FitRows.prototype._getContainerSize = function() { return { height: this.maxY }; }; return FitRows; } if ( typeof define === 'function' && define.amd ) { // AMD define( 'isotope/js/layout-modes/fit-rows',[ '../layout-mode' ], fitRowsDefinition ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = fitRowsDefinition( require('../layout-mode') ); } else { // browser global fitRowsDefinition( window.Isotope.LayoutMode ); } })( window ); ( function( window ) { function verticalDefinition( LayoutMode ) { var Vertical = LayoutMode.create( 'vertical', { horizontalAlignment: 0 }); Vertical.prototype._resetLayout = function() { this.y = 0; }; Vertical.prototype._getItemLayoutPosition = function( item ) { item.getSize(); var x = ( this.isotope.size.innerWidth - item.size.outerWidth ) * this.options.horizontalAlignment; var y = this.y; this.y += item.size.outerHeight; return { x: x, y: y }; }; Vertical.prototype._getContainerSize = function() { return { height: this.y }; }; return Vertical; } if ( typeof define === 'function' && define.amd ) { // AMD define( 'isotope/js/layout-modes/vertical',[ '../layout-mode' ], verticalDefinition ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = verticalDefinition( require('../layout-mode') ); } else { // browser global verticalDefinition( window.Isotope.LayoutMode ); } })( window ); /*! * Isotope v2.1.0 * Filter & sort magical layouts * http://isotope.metafizzy.co */ ( function( window ) { // -------------------------- vars -------------------------- // var jQuery = window.jQuery; // -------------------------- helpers -------------------------- // // extend objects function extend( a, b ) { for ( var prop in b ) { a[ prop ] = b[ prop ]; } return a; } var trim = String.prototype.trim ? function( str ) { return str.trim(); } : function( str ) { return str.replace( /^\s+|\s+$/g, '' ); }; var docElem = document.documentElement; var getText = docElem.textContent ? function( elem ) { return elem.textContent; } : function( elem ) { return elem.innerText; }; var objToString = Object.prototype.toString; function isArray( obj ) { return objToString.call( obj ) === '[object Array]'; } // index of helper cause IE8 var indexOf = Array.prototype.indexOf ? function( ary, obj ) { return ary.indexOf( obj ); } : function( ary, obj ) { for ( var i=0, len = ary.length; i b || a b ? 1 : -1 ) * direction; } } return 0; }; } // -------------------------- methods -------------------------- // // get layout mode Isotope.prototype._mode = function() { var layoutMode = this.options.layoutMode; var mode = this.modes[ layoutMode ]; if ( !mode ) { // TODO console.error throw new Error( 'No layout mode: ' + layoutMode ); } // HACK sync mode's options // any options set after init for layout mode need to be synced mode.options = this.options[ layoutMode ]; return mode; }; Isotope.prototype._resetLayout = function() { // trigger original reset layout Outlayer.prototype._resetLayout.call( this ); this._mode()._resetLayout(); }; Isotope.prototype._getItemLayoutPosition = function( item ) { return this._mode()._getItemLayoutPosition( item ); }; Isotope.prototype._manageStamp = function( stamp ) { this._mode()._manageStamp( stamp ); }; Isotope.prototype._getContainerSize = function() { return this._mode()._getContainerSize(); }; Isotope.prototype.needsResizeLayout = function() { return this._mode().needsResizeLayout(); }; // -------------------------- adding & removing -------------------------- // // HEADS UP overwrites default Outlayer appended Isotope.prototype.appended = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; } var filteredItems = this._filterRevealAdded( items ); // add to filteredItems this.filteredItems = this.filteredItems.concat( filteredItems ); }; // HEADS UP overwrites default Outlayer prepended Isotope.prototype.prepended = function( elems ) { var items = this._itemize( elems ); if ( !items.length ) { return; } // add items to beginning of collection var previousItems = this.items.slice(0); this.items = items.concat( previousItems ); // start new layout this._resetLayout(); this._manageStamps(); // layout new stuff without transition var filteredItems = this._filterRevealAdded( items ); // layout previous items this.layoutItems( previousItems ); // add to filteredItems this.filteredItems = filteredItems.concat( this.filteredItems ); }; Isotope.prototype._filterRevealAdded = function( items ) { var filteredItems = this._noTransition( function() { return this._filter( items ); }); // layout and reveal just the new items this.layoutItems( filteredItems, true ); this.reveal( filteredItems ); return items; }; /** * Filter, sort, and layout newly-appended item elements * @param {Array or NodeList or Element} elems */ Isotope.prototype.insert = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; } // append item elements var i, item; var len = items.length; for ( i=0; i =0?o:t,w=t,e(),x=!0,top!=self)y=!0;else if(r>n&&(t.offsetHeight1&&(i=Math.min(i,v.accelerationMax),t*=i,o*=i)}C=+new Date}if(M.push({x:t,y:o,lastX:0>t?.99:-.99,lastY:0>o?.99:-.99,start:+new Date}),!T){var l=e===document.body,u=function(){for(var r=+new Date,a=0,i=0,c=0;c=v.animationTime,h=f?1:d/v.animationTime;v.pulseAlgorithm&&(h=p(h));var m=s.x*h-s.lastX>>0,w=s.y*h-s.lastY>>0;a+=m,i+=w,s.lastX+=m,s.lastY+=w,f&&(M.splice(c,1),c--)}l?window.scrollBy(a,i):(a&&(e.scrollLeft+=a),i&&(e.scrollTop+=i)),t||o||(M=[]),M.length?E(u,e,n/v.frameRate+1):T=!1};E(u,e,0),T=!0}}function n(e){x||t();var n=e.target,r=l(n);if(!r||e.defaultPrevented||s(w,"embed")||s(n,"embed")&&/\.pdf/i.test(n.src))return!0;var a=e.wheelDeltaX||0,i=e.wheelDeltaY||0;return a||i||(i=e.wheelDelta||0),!v.touchpadSupport&&f(i)?!0:(Math.abs(a)>1.2&&(a*=v.stepSize/120),Math.abs(i)>1.2&&(i*=v.stepSize/120),o(r,-a,-i),void e.preventDefault())}function r(e){var t=e.target,n=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.keyCode!==H.spacebar;if(/input|textarea|select|embed/i.test(t.nodeName)||t.isContentEditable||e.defaultPrevented||n)return!0;if(s(t,"button")&&e.keyCode===H.spacebar)return!0;var r,a=0,i=0,u=l(w),c=u.clientHeight;switch(u==document.body&&(c=window.innerHeight),e.keyCode){case H.up:i=-v.arrowScroll;break;case H.down:i=v.arrowScroll;break;case H.spacebar:r=e.shiftKey?1:-1,i=-r*c*.9;break;case H.pageup:i=.9*-c;break;case H.pagedown:i=.9*c;break;case H.home:i=-u.scrollTop;break;case H.end:var d=u.scrollHeight-u.scrollTop-c;i=d>0?d+10:0;break;case H.left:a=-v.arrowScroll;break;case H.right:a=v.arrowScroll;break;default:return!0}o(u,a,i),e.preventDefault()}function a(e){w=e.target}function i(e,t){for(var o=e.length;o--;)z[N(e[o])]=t;return t}function l(e){var t=[],o=S.scrollHeight;do{var n=z[N(e)];if(n)return i(t,n);if(t.push(e),o===e.scrollHeight){if(!y||S.clientHeight+100?1:-1,t=t>0?1:-1,(k.x!==e||k.y!==t)&&(k.x=e,k.y=t,M=[],C=0)}function f(e){if(e){e=Math.abs(e),D.push(e),D.shift(),clearTimeout(A);var t=D[0]==D[1]&&D[1]==D[2],o=h(D[0],120)&&h(D[1],120)&&h(D[2],120);return!(t||o)}}function h(e,t){return Math.floor(e/t)==e/t}function m(e){var t,o,n;return e*=v.pulseScale,1>e?t=e-(1-Math.exp(-e)):(o=Math.exp(-1),e-=1,n=1-Math.exp(-e),t=o+n*(1-o)),t*v.pulseNormalize}function p(e){return e>=1?1:0>=e?0:(1==v.pulseNormalize&&(v.pulseNormalize/=m(1)),m(e))}var w,g={frameRate:150,animationTime:800,stepSize:120,pulseAlgorithm:!0,pulseScale:8,pulseNormalize:1,accelerationDelta:20,accelerationMax:1,keyboardSupport:!0,arrowScroll:50,touchpadSupport:!0,fixedBackground:!0,excluded:""},v=g,b=!1,y=!1,k={x:0,y:0},x=!1,S=document.documentElement,D=[120,120,120],H={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},v=g,M=[],T=!1,C=+new Date,z={};setInterval(function(){z={}},1e4);var A,N=function(){var e=0;return function(t){return t.uniqueID||(t.uniqueID=e++)}}(),E=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e,t,o){window.setTimeout(e,o||1e3/60)}}(),K=/chrome/i.test(window.navigator.userAgent),L="onmousewheel"in document;L&&K&&(u("mousedown",a),u("mousewheel",n),u("load",t))}(); // Login & registration link jQuery(document).ready(function() { "use strict"; jQuery('#loginForm .sendEnter').click(function(e){ "use strict"; jQuery('#loginForm form input').removeClass('msError'); var error = formValidate(jQuery('#loginForm form'), { error_message_show: true, error_message_time: 4000, error_message_class: 'sc_infobox sc_infobox_style_error', error_fields_class: 'msError', exit_after_first_error: true, rules: [ { field: "log", min_length: { value: 1, message: THEMEREX_LOGIN_EMPTY}, max_length: { value: 60, message: THEMEREX_LOGIN_LONG} }, { field: "pwd", min_length: { value: 4, message: THEMEREX_PASSWORD_EMPTY}, max_length: { value: 20, message: THEMEREX_PASSWORD_LONG} } ] }); if (!error) { document.forms.login_form.submit(); } e.preventDefault(); return false; }); jQuery('#registerForm .sendEnter').click(function(e){ "use strict"; jQuery('#registerForm form input').removeClass('msError'); var error = formValidate(jQuery("#registerForm form"), { error_message_show: true, error_message_time: 4000, error_message_class: "sc_infobox sc_infobox_style_error", error_fields_class: "msError", exit_after_first_error: true, rules: [ { field: "registration_username", min_length: { value: 1, message: THEMEREX_LOGIN_EMPTY }, max_length: { value: 60, message: THEMEREX_LOGIN_LONG } }, { field: "registration_email", min_length: { value: 7, message: THEMEREX_EMAIL_EMPTY }, max_length: { value: 60, message: THEMEREX_EMAIL_LONG }, mask: { value: "^([a-z0-9_\\-]+\\.)*[a-z0-9_\\-]+@[a-z0-9_\\-]+(\\.[a-z0-9_\\-]+)*\\.[a-z]{2,6}$", message: THEMEREX_EMAIL_NOT_VALID } }, { field: "registration_pwd", min_length: { value: 4, message: THEMEREX_PASSWORD_EMPTY }, max_length: { value: 20, message: THEMEREX_PASSWORD_LONG } }, { field: "registration_pwd2", equal_to: { value: 'registration_pwd', message: THEMEREX_PASSWORD_NOT_EQUAL } } ] }); if (!error) { jQuery.post(THEMEREX_ajax_url, { action: 'registration_user', nonce: THEMEREX_ajax_nonce, user_name: jQuery('#registerForm #registration_username').val(), user_email: jQuery('#registerForm #registration_email').val(), user_pwd: jQuery('#registerForm #registration_pwd').val(), }).done(function(response) { var rez = JSON.parse(response); var result_box = jQuery('#registerForm .result'); result_box.toggleClass('sc_infobox_style_error', false).toggleClass('sc_infobox_style_success', false); if (rez.error === '') { result_box.addClass('sc_infobox_style_success').html(THEMEREX_REGISTRATION_SUCCESS); setTimeout(function() { jQuery('.user-popUp .loginFormTab').trigger('click'); }, 2000); } else { result_box.addClass('sc_infobox_style_error').html(THEMEREX_REGISTRATION_FAILED + ' ' + rez.error); } result_box.fadeIn(); setTimeout(function() { jQuery('#registerForm .result').fadeOut(); }, 2000); }); } e.preventDefault(); return false; }); }); // Popup messages //----------------------------------------------------------------- jQuery(document).ready(function(){ "use strict"; jQuery('body').on('click', '#themerex_modal_bg,.themerex_message .themerex_message_close', function (e) { "use strict"; themerex_message_destroy(); if (THEMEREX_MESSAGE_CALLBACK) { THEMEREX_MESSAGE_CALLBACK(0); THEMEREX_MESSAGE_CALLBACK = null; } e.preventDefault(); return false; }); }); var THEMEREX_MESSAGE_CALLBACK = null; var THEMEREX_MESSAGE_TIMEOUT = 5000; // Warning function themerex_message_warning(msg) { "use strict"; var hdr = arguments[1] ? arguments[1] : ''; var icon = arguments[2] ? arguments[2] : 'cancel'; var delay = arguments[3] ? arguments[3] : THEMEREX_MESSAGE_TIMEOUT; return themerex_message({ msg: msg, hdr: hdr, icon: icon, type: 'warning', delay: delay, buttons: [], callback: null }); } // Success function themerex_message_success(msg) { "use strict"; var hdr = arguments[1] ? arguments[1] : ''; var icon = arguments[2] ? arguments[2] : 'check'; var delay = arguments[3] ? arguments[3] : THEMEREX_MESSAGE_TIMEOUT; return themerex_message({ msg: msg, hdr: hdr, icon: icon, type: 'success', delay: delay, buttons: [], callback: null }); } // Info function themerex_message_info(msg) { "use strict"; var hdr = arguments[1] ? arguments[1] : ''; var icon = arguments[2] ? arguments[2] : 'info'; var delay = arguments[3] ? arguments[3] : THEMEREX_MESSAGE_TIMEOUT; return themerex_message({ msg: msg, hdr: hdr, icon: icon, type: 'info', delay: delay, buttons: [], callback: null }); } // Regular function themerex_message_regular(msg) { "use strict"; var hdr = arguments[1] ? arguments[1] : ''; var icon = arguments[2] ? arguments[2] : 'quote'; var delay = arguments[3] ? arguments[3] : THEMEREX_MESSAGE_TIMEOUT; return themerex_message({ msg: msg, hdr: hdr, icon: icon, type: 'regular', delay: delay, buttons: [], callback: null }); } // Confirm dialog function themerex_message_confirm(msg) { "use strict"; var hdr = arguments[1] ? arguments[1] : ''; var callback = arguments[2] ? arguments[2] : null; return themerex_message({ msg: msg, hdr: hdr, icon: 'help', type: 'regular', delay: 0, buttons: ['Yes', 'No'], callback: callback }); } // Modal dialog function themerex_message_dialog(content) { "use strict"; var hdr = arguments[1] ? arguments[1] : ''; var init = arguments[2] ? arguments[2] : null; var callback = arguments[3] ? arguments[3] : null; return themerex_message({ msg: content, hdr: hdr, icon: '', type: 'regular', delay: 0, buttons: ['Apply', 'Cancel'], init: init, callback: callback }); } // General message window function themerex_message(opt) { "use strict"; var msg = opt.msg != undefined ? opt.msg : ''; var hdr = opt.hdr != undefined ? opt.hdr : ''; var icon = opt.icon != undefined ? opt.icon : ''; var type = opt.type != undefined ? opt.type : 'regular'; var delay = opt.delay != undefined ? opt.delay : THEMEREX_MESSAGE_TIMEOUT; var buttons = opt.buttons != undefined ? opt.buttons : []; var init = opt.init != undefined ? opt.init : null; var callback = opt.callback != undefined ? opt.callback : null; // Modal bg jQuery('#themerex_modal_bg').remove(); jQuery('body').append('
'); jQuery('#themerex_modal_bg').fadeIn(); // Popup window jQuery('.themerex_message').remove(); var html = '
' + '' + (icon ? '' : '') + (hdr ? '

'+hdr+'

' : ''); html += '
' + msg + '
'; if (buttons.length > 0) { html += '
'; for (var i=0; i'+buttons[i]+''; } html += '
'; } html += '
'; // Add popup to body jQuery('body').append(html); var popup = jQuery('body .themerex_message').eq(0); // Call init function if (init != null) { init(popup); } // Prepare callback on buttons click if (callback != null) { THEMEREX_MESSAGE_CALLBACK = callback; jQuery('.themerex_message_button').click(function(e) { "use strict"; var btn = jQuery(this).index(); callback(btn+1, popup); THEMEREX_MESSAGE_CALLBACK = null; themerex_message_destroy(); }); } // Show (animate) popup var top = jQuery(window).scrollTop(); jQuery('body .themerex_message').animate({top: top+Math.round((jQuery(window).height()-jQuery('.themerex_message').height())/2), opacity: 1}); // Delayed destroy (if need) if (delay > 0) { setTimeout(function() { themerex_message_destroy(); }, delay); } return popup; } // Destroy message window function themerex_message_destroy() { "use strict"; var top = jQuery(window).scrollTop(); jQuery('#themerex_modal_bg').fadeOut(); jQuery('.themerex_message').animate({top: top-jQuery('.themerex_message').height(), opacity: 0}); setTimeout(function() { jQuery('#themerex_modal_bg').remove(); jQuery('.themerex_message').remove(); }, 500); } jQuery(document).ready(function() { var isMobile = window.matchMedia("only screen and (max-width: 760px)"); if( jQuery('.woocommerce div.product').length > 0 && isMobile.matches ) { jQuery('html, body').animate({ scrollTop: jQuery(".woocommerce div.product").offset().top + 50 }, 500); } }); /* global jQuery:false */ var THEMEREX_user_marks = false; //var allowUserReviews = false; jQuery(document).ready(function () { "use strict"; jQuery('.revBlock.reviewEdit').mousemove(function (e) { "use strict"; if (typeof(allowUserReviews)=='undefined' || !allowUserReviews) return; var ratWidth = jQuery(this).width(); var ratX = e.pageX - jQuery(this).offset().left; //this.offsetLeft; if (ratX == 1) ratX = 0; if (ratX 0 ? jQuery(this).parents('.reviewTab') : jQuery(this).parents('.reviewBlock')); } }); // Save user's marks jQuery('#users-tabs .revAccept a').click(function(e) { if (typeof(allowUserReviews)=='undefined' || !allowUserReviews) return; var marks_cnt = 0; jQuery('#users-tabs .reviewEdit input').each(function (idx) { marks[idx] = Math.round(((marks.length>idx && marks[idx]!='' ? parseFloat(marks[idx])*users : 0) + parseFloat(jQuery(this).val()))/(users+1)*10)/10; jQuery(this).val(marks[idx]); marks_cnt++; }); if (marks.length > marks_cnt) marks = marks.splice(marks_cnt, marks.length-marks_cnt) users++; jQuery('#users-tabs .revAccept').fadeOut(); jQuery.post(THEMEREX_ajax_url, { action: 'reviews_users_accept', nonce: THEMEREX_ajax_nonce, post_id: post_id, marks: marks.join(','), users: users }).done(function(response) { var rez = JSON.parse(response); if (rez.error === '') { allowUserReviews = false; jQuery.cookie('reviews_vote', reviews_vote + (reviews_vote.substr(-1)!=',' ? ',' : '') + post_id + ',', {expires: 365, path: '/'}); jQuery('#users-tabs .revBlock').each(function (idx) { jQuery(this).data('mark', marks[idx]) .find('input').val(marks[idx]).end() .find('.ratingValue').css('width', Math.round(marks[idx]/reviews_max_level*100) + '%'); jQuery(this).parent('.revItem').find('.revAvg').html(marks[idx]); }); setAverageMark(jQuery('#users-tabs')); jQuery('#users-tabs .reviewEdit').removeClass('reviewEdit'); jQuery('#users-tabs .infoTotal .infoRat').html(THEMEREX_REVIEWS_VOTE); } else { jQuery('#users-tabs .infoTotal .infoRat').html(THEMEREX_REVIEWS_ERROR); } }); e.preventDefault(); return false; }); }); // Show average mark function setAverageMark(obj) { "use strict"; var avg = 0; var cnt = 0; obj.find('.reviewEdit').each(function() { avg += parseFloat(jQuery(this).data('mark')); cnt++; }); avg = cnt > 0 ? Math.round(avg/cnt*10)/10 : '0'; if (reviews_max_level