// source --> https://oakhillag.com/wp-content/plugins/stachethemes_event_calendar/stachethemes/../front/js/adds/event.create.js (function ($) { "use strict"; $.stecExtend(function (master) { if (master.glob.options.general_settings.show_create_event_form == '0') { return; } if (master.glob.options.view != 'agenda') { return; } master.$instance.$agenda.find('.stec-event-create-form').remove(); // Always open since create event is always available $(master.glob.template.eventCreateForm).prependTo(master.$instance.$agenda.find('.stec-layout-events-form')); setTimeout(function(){ master.helper.animate.agenda.openSingle(master.$instance.$agenda.find('.stec-event-create-form')); },0); }, 'onLayoutSet'); $.stecExtend(function (master) { if (master.glob.options.general_settings.show_create_event_form == '0') { return; } // append form switch (master.glob.options.view) { case "agenda" : // handled from onLayoutSet above break; case "month" : $(master.glob.template.eventCreateForm).prependTo(master.$instance.$month.find('.stec-layout-events')); break; case "week" : $(master.glob.template.eventCreateForm).prependTo(master.$instance.$week.find('.stec-layout-events')); break case "day" : $(master.glob.template.eventCreateForm).prependTo(master.$instance.$day.find('.stec-layout-events')); break; } // append unapproved yet events var events = master.calData.getEvents(false, false, true); $(events).each(function (){ if (this.approved == 1) { return true; } var theEvent = this; var $event = $(master.glob.template.eventAapproval) .attr('data-id',this.id) .removeClass('stec-event-awaiting-approval-template') .html(function (index, html) { return html .replace('stec_replace_summary', theEvent.summary); }); if (master.glob.options.view == "agenda") { $event.prependTo(master.$instance.$events.not('.stec-layout-agenda-events-all')); } else { $event.insertAfter(master.$instance.$events.find('.stec-event-create-form')); } }); }, 'onEventHolderOpen'); $.stecExtend(function (master) { if (master.glob.options.general_settings.show_create_event_form == '0') { return; } // Clean unapproved li list master.$instance.$agenda.find('.stec-layout-event-awaiting-approval').remove(); // remove colorpicker $('.colorpicker-' + master.glob.options.id).remove(); }, 'onEventHolderClose'); $.stecExtend(function (master) { if (master.glob.options.general_settings.show_create_event_form == '0') { return; } var createEvent = { blockForm: false, valid: false, captchaContainer: null, $theForm: null, init: function(){ this.bindControls(); }, check_disabled_fields: function() { var parent = this; switch ($('input[name="repeat_endson"]').filter(":checked").val()) { case '0' : //never parent.$theForm.find('input[name="repeat_occurences"]').attr('disabled', 'disabled'); parent.$theForm.find('input[name="repeat_ends_on_date"]').attr('disabled', 'disabled'); break; case '1' : // after n parent.$theForm.find('input[name="repeat_occurences"]').removeAttr('disabled'); parent.$theForm.find('input[name="repeat_ends_on_date"]').attr('disabled', 'disabled'); break; case '2' : // on date parent.$theForm.find('input[name="repeat_occurences"]').attr('disabled', 'disabled'); parent.$theForm.find('input[name="repeat_ends_on_date"]').removeAttr('disabled'); break; } }, update_rrule: function() { var parent = this; var freq = parent.$theForm.find('select[name="event_repeat"]').val(); var byweekday = []; switch (freq) { case '0' : freq = false; break; case '1' : freq = RRule.DAILY; break; case '2' : freq = RRule.WEEKLY; parent.$theForm.find('.stec-layout-event-create-form-inner-weekly-by-day') .find('input[type="checkbox"]') .filter(':checked') .each(function () { byweekday.push(RRule[$(this).attr('name')]); }); break; case '3' : freq = RRule.MONTHLY; break; case '4' : freq = RRule.YEARLY; break; } var interval = parent.$theForm.find('input[name="repeat_gap"]').val(); var count = false; var until = false; switch (parent.$theForm.find('input[name="repeat_endson"]').filter(":checked").val()) { case '0' : //never count = false; until = false; break; case '1' : // after n count = parent.$theForm.find('input[name="repeat_occurences"]').val(); until = false; break; case '2' : // on date count = false; until = new Date(parent.$theForm.find('input[name="repeat_ends_on_date"]').val()); break; } var rr_options = {}; rr_options.freq = freq; if (count > 0) { rr_options.count = count; } if (until) { rr_options.until = until; } if (interval > 0) { rr_options.interval = interval; } if (byweekday.length > 0) { rr_options.byweekday = byweekday; } var the_rule = ''; if (freq !== false) { // Set rule the_rule = new RRule(rr_options); } else { // Empty rrule the_rule = new RRule(); } var rrule = the_rule.toString(); parent.$theForm.find('input[name="rrule"]').val(rrule); }, bindControls: function () { var parent = this; $(document).on("change", master.instance + (' .stec-event-create-form input[name="repeat_endson"]'), function (e) { parent.check_disabled_fields(); }); $(document).on(master.helper.clickHandle(), master.$instance.$agenda.path + ' .stec-layout-event-create-form-inner', function (e) { e.stopPropagation(); }); // calendar select $(document).on('submit', master.instance + (' .stec-layout-event-create-form-inner form') , function (e) { e.preventDefault(); parent.update_rrule(); parent.submitEvent(); }); // calendar select $(document).on('change', master.instance + (' .stec-event-create-form [name="calendar_id"]') , function (e) { var color = $(this).find('option:selected').data('color'); parent.$theForm.find('[name="event_color"]').css({ background: color }).val(color); }); // datetime change $(document).on('change', master.instance + (' .stec-event-create-form [name="start_date"]') + ',' + master.instance + (' .stec-event-create-form [name="end_date"]') + ',' + master.instance + (' .stec-event-create-form [name="start_time_hours"]') + ',' + master.instance + (' .stec-event-create-form [name="end_time_hours"]') + ',' + master.instance + (' .stec-event-create-form [name="start_time_minutes"]') + ',' + master.instance + (' .stec-event-create-form [name="end_time_minutes"]') , function (e) { parent.datePicker.generalTimeFix(); }); // all day $(document).on('change', master.instance + ' .stec-event-create-form input[name="all_day"]', function () { if ($(this).is(':checked')) { parent.$theForm.find('[name="start_time_hours"]').val($('[name="start_time_hours"]').children().first().val()); parent.$theForm.find('[name="start_time_minutes"]').val($('[name="start_time_minutes"]').children().first().val()); parent.$theForm.find('[name="end_time_hours"]').val($('[name="end_time_hours"]').children().last().val()); parent.$theForm.find('[name="end_time_minutes"]').val($('[name="end_time_minutes"]').children().last().val()); parent.$theForm.find('.stec-layout-event-create-form-time').hide(); parent.$theForm.find('.stec-layout-event-create-form-time').prev('p').hide(); } else { parent.$theForm.find('.stec-layout-event-create-form-time').css('display','flex'); parent.$theForm.find('.stec-layout-event-create-form-time').prev('p').show(); parent.$theForm.find('[name="start_time_hours"]').val($('[name="start_time_hours"]').children().first().val()); parent.$theForm.find('[name="start_time_minutes"]').val($('[name="start_time_minutes"]').children().first().val()); parent.$theForm.find('[name="end_time_hours"]').val($('[name="end_time_hours"]').children().first().val()); parent.$theForm.find('[name="end_time_minutes"]').val($('[name="end_time_minutes"]').children().first().val()); } }); // repeat toggle $(document).on('change', master.instance + ' .stec-event-create-form select[name="event_repeat"]', function () { if (parseInt($(this).val(), 10) !== 0) { parent.$theForm.find('.stec-layout-event-create-form-inner-repeat-sub').css('display', 'block'); parent.$theForm.find('.stec-layout-event-create-form-inner-repeat-gap-block').css('display', 'block'); if ($(this).val() == '2') { parent.$theForm.find('.stec-layout-event-create-form-inner-weekly-by-day').show(); } else { parent.$theForm.find('.stec-layout-event-create-form-inner-weekly-by-day').hide(); } } else { parent.$theForm.find('.stec-layout-event-create-form-inner-repeat-sub').hide(); parent.$theForm.find('.stec-layout-event-create-form-inner-repeat-gap-block').hide(); parent.$theForm.find('.stec-layout-event-create-form-inner-weekly-by-day').hide(); } }); $(document).on(master.helper.clickHandle(), master.instance + (" .stec-event-create-form") + ',' + master.instance + (" .stec-layout-event-create-form-preview-right-event-toggle"), function (e) { e.preventDefault(); e.stopPropagation(); var $form = $(this).hasClass('stec-event-create-form') ? $(this) : $(this).parents('.stec-event-create-form'); createEvent.toggleForm($form); }); // upload image $(document).on(master.helper.clickHandle(), master.instance + (' .stec-layout-event-create-form-inner-date-image'), function (e) { e.preventDefault(); e.stopPropagation(); $(this).next().trigger('click'); }); $(document).on('change', master.instance + (' .stec-layout-event-create-form-inner-date-image-file'), function (e) { createEvent.$theForm.find('.stec-layout-event-create-form-inner-date-image').val(this.files[0].name); }); $(document).on(master.helper.clickHandle(), master.$instance.$events.path + ('.stec-layout-event-awaiting-approval-cancel'), function (e) { var eventId = parseInt($(this).parents('.stec-layout-event-awaiting-approval').first().attr('data-id'), 10); createEvent.deleteEvent(eventId); }); $(document).on(master.helper.clickHandle(), master.$instance.$events.path + ('.stec-layout-event-preview-left-approval-cancel'), function (e) { var eventId = parseInt($(this).parents('.stec-layout-event-awaiting-approval').first().attr('data-id'), 10); createEvent.deleteEvent(eventId); }); }, datePicker: { set: function () { createEvent.$theForm.find('[name="start_date"]') .datepicker("destroy") .datepicker({ setDate: master.glob.options.year + '-' + master.glob.options.month + '-' + master.glob.options.day, showAnim: 0, dateFormat: "yy-mm-dd", onSelect: function () { createEvent.$theForm.find('[name="end_date"]').datepicker('option', 'minDate', $(this).val()); createEvent.datePicker.generalTimeFix(); } }) .datepicker("setDate", new Date(master.glob.options.year,master.glob.options.month,master.glob.options.day) ); createEvent.$theForm.find('[name="end_date"]') .datepicker("destroy") .datepicker({ setDate: master.glob.options.year + '-' + master.glob.options.month + '-' + master.glob.options.day, showAnim: 0, dateFormat: "yy-mm-dd", onSelect: function () { createEvent.$theForm.find('[name="start_date"]').datepicker('option', 'maxDate', $(this).val()); createEvent.datePicker.generalTimeFix(); } }) .datepicker("setDate", new Date(master.glob.options.year,master.glob.options.month,master.glob.options.day) ); createEvent.$theForm.find('[name="repeat_ends_on_date"]') .datepicker("destroy") .datepicker(); }, generalTimeFix: function () { var $startDate = createEvent.$theForm.find('[name="start_date"]'); var $endDate = createEvent.$theForm.find('[name="end_date"]'); var $startHours = createEvent.$theForm.find('[name="start_time_hours"]'); var $endHours = createEvent.$theForm.find('[name="end_time_hours"]'); var $startMinutes = createEvent.$theForm.find('[name="start_time_minutes"]'); var $endMinutes = createEvent.$theForm.find('[name="end_time_minutes"]'); var start = new Date($startDate.val()); start.setHours($startHours.val()); start.setMinutes($startMinutes.val()); var end = new Date($endDate.val()); end.setHours($endHours.val()); end.setMinutes($endMinutes.val()); if (start.getTime() > end.getTime()) { $endHours.children().eq($startHours.children().filter(':selected').index()).prop('selected', true); $endMinutes.children().eq($startMinutes.children().filter(':selected').index()).prop('selected', true); } } }, colorPicker: { set: function () { // init colorpicker createEvent.$theForm.find('.stec-layout-event-create-form-inner-colorpicker').each(function (i) { var th = this; var color = $(th).val(); $(th).css({ backgroundColor: color }); $(th).ColorPicker({ klass: 'colorpicker-' + master.glob.options.id, id: 'colorpicker-' + i + '-' + master.glob.options.id, color: color, onShow: function (colpkr) { $(colpkr).show(); return false; }, onHide: function (colpkr) { $(colpkr).hide(); return false; }, onChange: function (hsb, hex, rgb) { $(th).attr("title", "#" + hex); $(th).css({ backgroundColor: "#" + hex }); $(th).val("#" + hex); } }); }); } }, toggleForm: function ($form) { var parent = this; this.$theForm = $form; this.$theForm.toggleClass('active'); this.$theForm.find('.stec-layout-event-create-form-preview-right-event-toggle').toggleClass('active'); this.datePicker.set(); this.colorPicker.set(); if (master.glob.options.captcha.enabled == '1') { this.captchaContainer = null; if (parent.$theForm.find('.stec-layout-event-create-form-g-recaptcha').children().length <= 0) { this.captchaContainer = window.grecaptcha.render(parent.$theForm.find('.stec-layout-event-create-form-g-recaptcha').get(0), { sitekey: master.glob.options.captcha.site_key, callback: function (response) { if (response.length != 0) { parent.valid = true; } } }); } } else { // captcha is disabled parent.valid = true; } // Only 1 calendar; hide the selector if (parent.$theForm .find('[name="calendar_id"]').children().length == 2) { parent.$theForm .find('[name="calendar_id"]').val(parent.$theForm .find('[name="calendar_id"] option:last').val()); parent.$theForm .find('[name="calendar_id"]').parents('div:first').hide(); var color = parent.$theForm.find('[name="calendar_id"]').find('option:selected').data('color'); parent.$theForm.find('[name="event_color"]').css({ background: color }).val(color); } }, submitEvent: function() { if (createEvent.blockForm === true) { return; } if (createEvent.valid === false) { return false; } var eventOverview = { summary: createEvent.$theForm.find('[name="summary"]').val(), calendar_id: createEvent.$theForm.find('[name="calendar_id"]').val() }; if ($.trim(eventOverview.summary) == '' || isNaN(parseInt(eventOverview.calendar_id, 10)) === true) { return false; } var formData = new FormData(createEvent.$theForm.find('form')[0]); formData.append('action','stec_public_ajax_action'); formData.append('task','front_create_event'); $.ajax({ cache: false, processData: false, contentType: false, dataType: "json", type: 'POST', url: window.ajaxurl, data: formData, beforeSend: function () { createEvent.blockForm = true; $(master.glob.template.preloader).appendTo(createEvent.$theForm.find('.stec-layout-event-create-form-inner-submit-flexbox')); }, success: function (data) { createEvent.$theForm.find('.stec-preloader').remove(); if (data.error == '1' || !data.event) { createEvent.$theForm.find('.stec-layout-event-create-form-inner-submit-flexbox .fa-times').show(); return false; } master.calData.addToEventsPool([data.event]); createEvent.$theForm.find('.stec-layout-event-create-form-inner-submit-flexbox .fa-check').show(); setTimeout(function(){ master.layout.set(); }, 500); }, error: function (xhr, status, thrown) { createEvent.$theForm.find('.stec-preloader').remove(); createEvent.$theForm.find('.stec-layout-event-create-form-inner-submit-flexbox .fa-times').show(); console.log(xhr + " " + status + " " + thrown); }, complete: function () { setTimeout(function(){ createEvent.$theForm.find('.stec-layout-event-create-form-inner-submit-flexbox i:visible').fadeTo(250,0, function(){ $(this).css('opacity','1').hide(); }); createEvent.blockForm = false; if (master.glob.options.captcha.enabled == '1') { createEvent.valid = false; window.grecaptcha.reset(createEvent.captchaContainer); } }, 1000); } }); }, deleteEvent: function(eventId) { if (createEvent.blockForm === true) { return; } if (isNaN(eventId)) { return; } var $event = master.$instance.$events.find('.stec-layout-event-awaiting-approval[data-id="'+eventId+'"]'); $.ajax({ dataType: "json", type: 'POST', url: window.ajaxurl, data: { action: 'stec_public_ajax_action', task: 'front_delete_event', id: eventId }, beforeSend: function () { $(master.glob.template.preloader).prependTo($event.find('.stec-layout-event-preview-right')); $event.find('.stec-layout-event-preview-left-approval-cancel').text(window.stecLang.deleting); createEvent.blockForm = true; }, success: function (data) { $event.find('.stec-preloader').remove(); if (data.error == '0') { $event.find('.stec-layout-event-preview-left-approval-cancel') .addClass('stec-layout-event-preview-left-approval-cancel-success') .text(window.stecLang.deleted); $event.find('.stec-layout-event-preview-right .fa-check').show(); master.calData.removeFromEventsPool(eventId); setTimeout(function(){ master.layout.set(); }, 500); } if (data.error == '1') { $event.find('.stec-layout-event-preview-left-approval-cancel').text(window.stecLang.error); $event.find('.stec-layout-event-preview-right .fa-times').show(); } }, error: function (xhr, status, thrown) { $event.find('.stec-preloader').remove(); $event.find('.stec-layout-event-preview-left-approval-cancel').text(window.stecLang.error); $event.find('.stec-layout-event-preview-right .fa-times').show(); console.log(xhr + " " + status + " " + thrown); }, complete: function () { setTimeout(function () { createEvent.blockForm = false; }, 1000); } }); } }; createEvent.init(); }); })(jQuery); // source --> https://oakhillag.com/wp-content/plugins/stachethemes_event_calendar/stachethemes/../front/js/single/stec-single.js (function ($) { "use strict"; /** * prefixes added to prevent conflicts * from jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ */ $.extend($.easing, { stecOutExpo: function (x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; }, stecExpo: function (x, t, b, c, d) { if (t == 0) { return b; } if (t == d) { return b + c; } t = t / (d / 2); if (t < 1) { return c / 2 * Math.pow(2, 10 * (t - 1)) + b; } return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; } }); function stecSingle() { var stecLang = window.stecLang; var glob = { template: { preloader: '' }, event: {}, options: { siteurl: '', monthLabelsShort: [ stecLang.jan, stecLang.feb, stecLang.mar, stecLang.apr, stecLang.may, stecLang.jun, stecLang.jul, stecLang.aug, stecLang.sep, stecLang.oct, stecLang.nov, stecLang.dec ], monthLabels: [ stecLang.january, stecLang.february, stecLang.march, stecLang.april, stecLang.may, stecLang.june, stecLang.july, stecLang.august, stecLang.september, stecLang.october, stecLang.november, stecLang.december ], dayLabels: [ stecLang.sunday, stecLang.monday, stecLang.tuesday, stecLang.wednesday, stecLang.thursday, stecLang.friday, stecLang.saturday ], dayLabelsShort: [ stecLang.sun, stecLang.mon, stecLang.tue, stecLang.wed, stecLang.thu, stecLang.fri, stecLang.sat ] } }; var helper = { // @todo change with date.UTC ? // used for dateToRFC treatAsUTC: function (date) { var result = date instanceof Date ? date : new Date(date); var adjustedMinutes = result.getMinutes() + result.getTimezoneOffset(); result.setMinutes(adjustedMinutes); return result; }, capitalizeFirstLetter: function (string) { return string.charAt(0).toUpperCase() + string.slice(1); }, dateToFormat: function(format, date){ var hasTime = false; var ampm = 'am'; if (format === false) { switch (glob.options.date_format) { case 'dd-mm-yy' : format = 'd m y'; break; case 'mm-dd-yy' : format = 'm d y'; break; case 'yy-mm-dd' : format = 'y m d'; break; } } format = format.split(''); var string = ''; $(format).each(function(){ switch(this) { case 'y' : string += date.getFullYear(); break; case 'm' : string += helper.capitalizeFirstLetter(glob.options.monthLabels[date.getMonth()]); break; case 'M' : string += helper.capitalizeFirstLetter(glob.options.monthLabelsShort[date.getMonth()]); break; case 'd' : string += date.getDate(); break; case 'h' : hasTime = true; var h = date.getHours(); if (glob.options.time_format == '12') { if (h == 12) { ampm = 'pm'; } if (h > 12) { h = h - 12; ampm = 'pm'; } if (h == 0) { h = 12; ampm = 'am'; } string += h < 10 ? '0'+h : h; } else { string += h < 10 ? '0'+h : h; } break; case 'i' : var m = date.getMinutes(); m = m < 10 ? '0'+m : m; string += m; break; case 's' : var s = date.getSeconds(); string += s < 10 ? '0'+s : s; break; default: string += this; } }); if (hasTime && glob.options.time_format == '12') { string += ' ' + ampm; } return string; }, /** * returns now Date for given calendar offset * @param {int} hoursOffset * @returns {Date} date object */ getCalNow: function(hoursOffset) { var date = new Date(); date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); // UTC now date.setHours(date.getHours() + hoursOffset); // UTC now + hours offset return date; }, imgLoaded: function ($img, callback, step) { if (typeof $.fn.imagesLoaded !== "undefined") { // imagesLoaded script is loaded $img.imagesLoaded(function () { if (typeof callback === "function") { callback.call($img); } }); return; } var total = $img.length; var loaded = 0; if (total <= 0) { if (typeof callback === "function") { callback.call($img); } } $img.each(function () { var image = new Image; image.onload = function () { if (typeof step === "function") { step(); } loaded++; if (loaded >= total) { if (typeof callback === "function") { callback.call($img); } } }; image.onerror = function () { console.warn("Could not load image"); }; image.src = $(this).attr("src"); }); }, isEmail: function (email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); }, isMobile: function () { return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) ? true : false; }, clickHandle: function (sub) { var tap = sub ? 'vlick.' + sub : 'vclick'; var click = sub ? 'click.' + sub : 'click'; return this.isMobile() ? tap : click; }, onResizeEnd: function (callback, time, keyslug) { var id; time = time ? time : 10; var handle = keyslug ? 'resize.' + keyslug : 'resize'; $(window).on(handle, function () { clearTimeout(id); id = setTimeout(function () { if (typeof callback === "function") { callback.call(); } }, time); }); }, /** * expects months range 1-12 * converts to 0-11 * @param {str} string yy-mm-dd h:i:s */ dbDateTimeToDate: function (string) { var date = string.replace(/(\s|:|-)/g,",").split(','); for(var i = 0; i < date.length; i++) { date[i] = parseInt(date[i], 10); if (i == 1) { date[i] = date[i] - 1; } } var d = new Date(date[0], date[1], date[2], date[3], date[4]); return d; }, /** * @param {type} string dbDate string * @param {type} offset unixstamp * @returns {String} dbDate string */ dbDateOffset: function(string, offset) { var date = this.dbDateTimeToDate(string); date.setTime(date.getTime() + offset * 1000); return this.dateToDbDateTime(date); }, /* * Converts js date to db date * @param {obj} date * @returns {String} */ dateToDbDateTime: function (date) { var string = ''; var y = date.getFullYear(); var m = date.getMonth() + 1; var d = date.getDate(); var h = date.getHours(); var i = date.getMinutes(); var s = date.getSeconds(); string += y; string += '-'; string += m < 10 ? '0'+m : m; string += '-'; string += d < 10 ? '0'+d : d; string += ' '; string += h < 10 ? '0'+h : h; string += ':'; string += i < 10 ? '0'+i : i; string += ':'; string += s < 10 ? '0'+s : s; return string; } }; this.init = function () { $.extend(glob.options, window.stecSingleOptions); glob.event = window.stecSingleEvent; if (!glob.event) { return; } // Show datetime in user local timezone if ( '1' == glob.options.date_in_user_local_time ) { glob.options.date_label_gmtutc = 0; var original_tz_offset = glob.event.general.timezone_utc_offset; // Update preview dates if ( this.all_day == '1' ) { // Don't convert all day event for now... } else { // Get dates in UTC var utcStart = helper.dbDateOffset(glob.event.general.start_date, -1 * glob.event.general.timezone_utc_offset); var utcEnd = helper.dbDateOffset(glob.event.general.end_date, -1 * glob.event.general.timezone_utc_offset); // Local time offset var offset = -1 * new Date().getTimezoneOffset() * 60; glob.event.general.timezone_utc_offset = offset; glob.event.general.timezone = ''; // Set dates in Local tz glob.event.general.start_date_tz = glob.event.general.start_date; // Start Date in calendar timezone glob.event.general.start_date = helper.dbDateOffset(utcStart, glob.event.general.timezone_utc_offset); glob.event.general.end_date = helper.dbDateOffset(utcEnd, glob.event.general.timezone_utc_offset); var start_date_object = helper.dbDateTimeToDate(glob.event.general.start_date); var end_date_object = helper.dbDateTimeToDate(glob.event.general.end_date); $('.stec-layout-single-preview-left-text-date .stec-layout-single-start-time').text(helper.dateToFormat('h:i', start_date_object)); $('.stec-layout-single-preview-left-text-date .stec-layout-single-end-time').text(helper.dateToFormat('h:i', end_date_object)); $('.stec-layout-single-preview-left-text-date .stec-layout-single-timezone').hide(); $('.stec-layout-single-preview-left-text-date .stec-layout-single-month-full').text(helper.dateToFormat('m', start_date_object)); $('.stec-layout-single-preview-left-text-date .stec-layout-single-month-short').text(helper.dateToFormat('M', start_date_object)); } // Update schedule times if ( glob.event.schedule && glob.event.schedule.length > 0 ) { $(glob.event.schedule).each(function(i) { // Get dates in UTC var utcStart = helper.dbDateOffset(this.start_date, -1 * original_tz_offset); // Local time offset var offset = -1 * new Date().getTimezoneOffset() * 60; // Set dates in Local tz this.start_date = helper.dbDateOffset(utcStart, offset); var start_date_object = helper.dbDateTimeToDate(this.start_date); var tab = $('.stec-layout-single-schedule-tab').eq(i); tab.find('.stec-layout-single-time').text(helper.dateToFormat('h:i', start_date_object)); tab.find('.stec-layout-single-month-full').text(helper.dateToFormat('m', start_date_object)); tab.find('.stec-layout-single-year').text(helper.dateToFormat('y', start_date_object)); }); } } glob.template.preloader = $(".stec-layout-single-preloader-template").html(); glob.options.siteurl = glob.options.site_url; media.init(); attachments.init(); reminder.init(); slider.init(); clock.init(); location.init(); tabs.init(); schedule.init(); woocommerce.init(); forecast.init(); attendance.init(); comments.init(); bindControls(); }; var media = { init: function () { this.bindControls(); this.mediaTrigger(); }, bindControls: function () { var parent = this; $(window).on('resize', function () { parent.mediaTrigger(); }); $('.stec-layout-single').css({ visibility: 'visible' }); }, mediaTrigger: function () { if ($('.stec-layout-single').width() <= 600) { $('.stec-layout-single').removeClass("stec-layout-single-media-med"); $('.stec-layout-single').addClass("stec-layout-single-media-small"); } else if ($('.stec-layout-single').width() <= 870) { $('.stec-layout-single').removeClass("stec-layout-single-media-small"); $('.stec-layout-single').addClass("stec-layout-single-media-med"); } else { $('.stec-layout-single').removeClass("stec-layout-single-media-med stec-layout-single-media-small"); } } }; var attachments = { init: function () { this.bindControls(); }, bindControls: function () { $('.stec-layout-single-attachments-toggle').on(helper.clickHandle(), function(){ $(this).toggleClass('active'); $('.stec-layout-single-attachments-list').toggleClass('active'); }); } }; var reminder = { blockAction: false, ajax: null, init: function () { this.bindControls(); }, bindControls: function () { $('.stec-layout-single-preview-right-reminder').on(helper.clickHandle(), function () { $(this).toggleClass('active'); $('.stec-layout-single-preview-left-reminder-toggle').toggleClass('active'); $('.stec-layout-single-reminder-form').toggleClass('active'); }); $('.stec-layout-single-preview-left-reminder-toggle').on(helper.clickHandle(), function () { $(this).toggleClass('active'); $('.stec-layout-single-preview-right-reminder').toggleClass('active'); $('.stec-layout-single-reminder-form').toggleClass('active'); }); $(document).on(helper.clickHandle(), ".stec-layout-single .stec-layout-single-preview-reminder-units-selector li", function (e) { e.preventDefault(); var value = $(this).attr('data-value'); var text = $(this).text(); $(this).parents('.stec-layout-single-preview-reminder-units-selector') .find('p') .attr('data-value', value) .text(text); }); $(document).on(helper.clickHandle(), ".stec-layout-single .stec-layout-single-preview-remind-button", function (e) { e.preventDefault(); var $form = $(this).parents('ul:first'); var eventId = glob.event.general.id; var start_date = glob.event.general.start_date; var repeat_offset = glob.event.general.repeat_time_offset; var email = $form.find('input[name="email"]').val(); var number = $form.find('input[name="number"]').val(); var units = $form.find('p[data-value]').attr('data-value'); if (helper.isEmail(email) && number != '') { reminder.remindEvent(eventId, start_date, repeat_offset, email, number, units); } }); }, remindEvent: function (eventId, start_date, repeat_offset, email, number, units) { if (this.blockAction === true) { return; } var parent = this; var remindDate = helper.dbDateTimeToDate(helper.dbDateOffset(start_date, repeat_offset)); if (isNaN(number)) { return; } switch (units) { case 'hours' : remindDate.setHours(remindDate.getHours() - number); break; case 'days' : remindDate.setDate(remindDate.getDate() - number); break; case 'weeks' : remindDate.setDate(remindDate.getDate() - number * 7); break; } remindDate = helper.dateToDbDateTime(remindDate); reminder.ajax = $.ajax({ dataType: "json", type: 'POST', url: window.ajaxurl, data: { action: 'stec_public_ajax_action', task: 'add_reminder', event_id: eventId, repeat_offset: repeat_offset, email: email, date: remindDate }, beforeSend: function () { if (reminder.ajax !== null) { reminder.ajax.abort(); } $(glob.template.preloader) .appendTo($('.stec-layout-single-reminder-status')); $('.stec-layout-single-reminder-form li').hide(); parent.blockAction = true; }, success: function (data) { $('.stec-layout-single-reminder-status').find('.stec-layout-single-preloader').remove(); if (data && data.error != 1) { $('.stec-layout-single-reminder-status p') .text(stecLang.reminderset) .show(); } else { $('.stec-layout-single-reminder-status p') .text(stecLang.error) .show(); } }, error: function (xhr, status, thrown) { $('.stec-layout-single-reminder-status').find('.stec-layout-single-preloader').remove(); $('.stec-layout-single-reminder-status p') .text(stecLang.error) .show(); console.log(xhr + " " + status + " " + thrown); }, complete: function () { reminder.ajax = null; setTimeout(function () { $('.stec-layout-single-reminder-status p') .text('-') .hide(); $('.stec-layout-single-reminder-form li').show(); parent.blockAction = false; }, 3000); } }); } }; var slider = { cslide: 0, offset: 0, total: 0, blockAction: false, visCount: 0, visCountSmall: 3, visCountBig: 4, init: function () { var parent = this; var total_images = $('.stec-layout-single-media-controls-list li').length; if (total_images == 1) { $('.stec-layout-single').find('.stec-layout-single-media-controls').remove(); } else { if (total_images < this.visCountBig) { this.visCountBig = total_images; } if (total_images < this.visCountSmall) { this.visCountSmall = total_images; } } this.html(); helper.imgLoaded($('.stec-layout-single').find('.stec-layout-single-media-content img'), function () { setTimeout(function(){ parent.controlsDimensions(); parent.showImage(); $('.stec-layout-single').find('.stec-layout-single-media').fadeTo(1000,1); }, 100); }); this.bindControls(); }, bindControls: function(){ var parent = this; helper.onResizeEnd(function () { parent.controlsDimensions(); }); $('.stec-layout-single').find('.stec-layout-single-media-controls-next').on(helper.clickHandle(), function(e){ e.preventDefault(); parent.slideNext(); }); $('.stec-layout-single').find('.stec-layout-single-media-controls-prev').on(helper.clickHandle(), function(e){ e.preventDefault(); parent.slidePrev(); }); $('.stec-layout-single').find('.stec-layout-single-media-controls li').on(helper.clickHandle(), function(e){ e.preventDefault(); if (parent.cslide == $(this).index()) { return; } parent.cslide = $(this).index(); parent.showImage(); }); }, html: function(){ }, controlsDimensions: function(){ var parent = this; if (!$('.stec-layout-single').is(':visible')) { return; } if ($('.stec-layout-single').hasClass('stec-layout-single-media-small')) { parent.visCount = parent.visCountSmall; } else { parent.visCount = parent.visCountBig; } if ($('.stec-layout-single').find('.stec-layout-single-media-controls-list li').length == parent.visCount) { $('.stec-layout-single').find('.stec-layout-single-media-controls').addClass('no-side-controls'); } else { $('.stec-layout-single').find('.stec-layout-single-media-controls').removeClass('no-side-controls'); } var maxWidth = $('.stec-layout-single').find('.stec-layout-single-media-controls-list-wrap').width(); var $li = $('.stec-layout-single').find('.stec-layout-single-media-controls-list li'); $('.stec-layout-single').find('.stec-layout-single-media-content').height($('.stec-layout-single').find('.stec-layout-single-media img').first().height()); // ~'calc( (100% - 2*10px) / 3 )'; var liWidth = (maxWidth - ((this.visCount - 1) * 10)) / this.visCount; var listWidth = ($li.length * liWidth) + ($li.length * 10) - 10; $('.stec-layout-single').find('.stec-layout-single-media-controls-list').width(listWidth); $li.width(liWidth); this.offset = 0; var left = -1 * ($li.first().width() * this.offset + this.offset * 10); $('.stec-layout-single').find('.stec-layout-single-media-controls-list').stop().css({ left: left }); }, showImage: function(){ $('.stec-layout-single').find('.stec-layout-single-media-controls-list .active-thumb').removeClass('active-thumb'); $('.stec-layout-single').find('.stec-layout-single-media-controls-list li').eq(this.cslide).addClass('active-thumb'); var $old = $('.stec-layout-single').find('.stec-layout-single-media-content .active-image'); var $new = $('.stec-layout-single').find('.stec-layout-single-media-content > div').eq(this.cslide); var $textContent = $new.find('div'); if ($textContent.length > 0) { $('.stec-layout-single').find('.stec-layout-single-media-content-subs div').fadeTo(250, 0, function () { var caption = $textContent.find('p').text(); var desc = $textContent.find('span').text(); $('.stec-layout-single').find('.stec-layout-single-media-content-subs p').text(caption); $('.stec-layout-single').find('.stec-layout-single-media-content-subs span').text(desc); var height = $('.stec-layout-single').find('.stec-layout-single-media-content-subs p').height() + $('.stec-layout-single').find('.stec-layout-single-media-content-subs span').height(); if (height > 0) { height = height + 40; } $('.stec-layout-single').find('.stec-layout-single-media-content-subs').stop().animate({ height: height }, { duration: 400, easing: 'stecExpo', complete: function () { $('.stec-layout-single').find('.stec-layout-single-media-content-subs div').fadeTo(250, 1); } }); }); } else { $('.stec-layout-single').find('.stec-layout-single-media-content-subs div').fadeTo(250, 0, function () { $('.stec-layout-single').find('.stec-layout-single-media-content-subs').stop().animate({ height: 0 }, { duration: 400, easing: 'stecExpo' }); }); } $new.addClass('fade-in'); setTimeout(function () { $old.removeClass('active-image'); $new.removeClass('fade-in').addClass('active-image'); }, 250); }, slideNext: function() { var $li = $('.stec-layout-single').find('.stec-layout-single-media-controls-list li'); if (this.offset + this.visCount >= $li.length) { this.offset = 0; } else { this.offset = this.offset + this.visCount; if (this.offset > $li.length - this.visCount) { this.offset = $li.length - this.visCount; } } var left = -1 * ($li.first().width() * this.offset + this.offset * 10); $('.stec-layout-single').find('.stec-layout-single-media-controls-list').stop().animate({ left: left }, { duration: 750, easing: 'stecExpo' }); }, slidePrev: function() { var $li = $('.stec-layout-single').find('.stec-layout-single-media-controls-list li'); if (this.offset <= 0) { this.offset = $li.length - this.visCount; } else { this.offset = this.offset - this.visCount; if (this.offset < 0) { this.offset = 0; } } var left = -1 * ($li.first().width() * this.offset + this.offset * 10); $('.stec-layout-single').find('.stec-layout-single-media-controls-list').stop().animate({ left: left }, { duration: 750, easing: 'stecExpo' }); } }; var clock = { days: 0, hours: 0, minutes: 0, seconds: 0, daysLabel: '', hoursLabel: '', mionutesLabel: '', secondsLabel: '', interval: '', init: function () { if ($('.stec-layout-single-counter').length <= 0) { return; } var startDate = helper.dbDateTimeToDate(helper.dbDateOffset(glob.event.general.start_date, glob.event.general.repeat_time_offset)); var nowDate = helper.getCalNow(parseInt(glob.event.general.timezone_utc_offset, 10)/3600); var timeLeft = Math.floor((startDate.getTime() - nowDate.getTime()) / 1000); this.days = Math.floor(timeLeft / 86400); this.hours = Math.floor(timeLeft % 86400 / 3600); this.minutes = Math.floor(timeLeft % 86400 % 3600 / 60); this.seconds = Math.floor(timeLeft % 86400 % 3600 % 60); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(0).text(this.days); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(1).text(this.hours); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(2).text(this.minutes); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(3).text(this.seconds); this.daysLabel = $('.stec-layout-single').find('.stec-layout-single-counter-label').eq(0); this.hoursLabel = $('.stec-layout-single').find('.stec-layout-single-counter-label').eq(1); this.minutesLabel = $('.stec-layout-single').find('.stec-layout-single-counter-label').eq(2); this.secondsLabel = $('.stec-layout-single').find('.stec-layout-single-counter-label').eq(3); this.daysLabel.text(this.days == 1 ? this.daysLabel.attr('data-singular-label') : this.daysLabel.attr('data-plural-label')); this.hoursLabel.text(this.hours == 1 ? this.hoursLabel.attr('data-singular-label') : this.hoursLabel.attr('data-plural-label')); this.minutesLabel.text(this.minutes == 1 ? this.minutesLabel.attr('data-singular-label') : this.minutesLabel.attr('data-plural-label')); this.secondsLabel.text(this.seconds == 1 ? this.secondsLabel.attr('data-singular-label') : this.secondsLabel.attr('data-plural-label')); if (timeLeft < 0) { this.complete(); return; } this.count(); }, count: function () { var parent = this; parent.interval = setInterval(function () { parent.seconds--; if (parent.seconds < 0) { parent.seconds = 59; parent.minutes--; if (parent.minutes < 0) { parent.minutes = 59; parent.hours--; if (parent.hours < 0) { parent.hours = 23; if (parent.days > 0) { parent.days--; } $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(0).text(parent.days); parent.daysLabel.text(parent.days == 1 ? parent.daysLabel.attr('data-singular-label') : parent.daysLabel.attr('data-plural-label')); } $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(1).text(parent.hours); parent.hoursLabel.text(parent.hours == 1 ? parent.hoursLabel.attr('data-singular-label') : parent.hoursLabel.attr('data-plural-label')); } $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(2).text(parent.minutes); parent.minutesLabel.text(parent.minutes == 1 ? parent.minutesLabel.attr('data-singular-label') : parent.minutesLabel.attr('data-plural-label')); } $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(3).text(parent.seconds); parent.secondsLabel.text(parent.seconds == 1 ? parent.secondsLabel.attr('data-singular-label') : parent.secondsLabel.attr('data-plural-label')); if (parent.days == 0 && parent.hours == 0 && parent.minutes == 0 && parent.seconds == 0) { clearInterval(parent.interval); parent.complete(); } }, 1000); }, complete: function () { $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(0).text(0); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(1).text(0); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(2).text(0); $('.stec-layout-single').find('.stec-layout-single-counter-num').eq(3).text(0); this.daysLabel.text(this.days == 1 ? this.daysLabel.attr('data-singular-label') : this.daysLabel.attr('data-plural-label')); this.hoursLabel.text(this.hours == 1 ? this.hoursLabel.attr('data-singular-label') : this.hoursLabel.attr('data-plural-label')); this.minutesLabel.text(this.minutes == 1 ? this.minutesLabel.attr('data-singular-label') : this.minutesLabel.attr('data-plural-label')); this.secondsLabel.text(this.seconds == 1 ? this.secondsLabel.attr('data-singular-label') : this.secondsLabel.attr('data-plural-label')); $('.stec-layout-single').find('.stec-layout-single-counter').hide(); $('.stec-layout-single-intro-attendance').hide(); $('.stec-layout-single-attendance-invited').hide(); var now = helper.getCalNow(parseInt(glob.event.general.timezone_utc_offset, 10)/3600); var endDate = helper.dbDateTimeToDate(helper.dbDateOffset(glob.event.general.end_date, glob.event.general.repeat_time_offset)); if (now >= endDate) { $('.stec-layout-single').find('.stec-layout-single-event-status-text.event-expired').show(); } else { $('.stec-layout-single').find('.stec-layout-single-event-status-text.event-inprogress').show(); } } }; var location = { init: function() { var parent = this; if ($('.stec-layout-single-location-gmap').length <= 0) { return; } parent.mapDiv = $('.stec-layout-single-location-gmap').get(0); parent.map = new window.google.maps.Map(parent.mapDiv, { zoom: 15 }); parent.geocoder = new window.google.maps.Geocoder(); parent.directionsService = new window.google.maps.DirectionsService; parent.directionsDisplay = new window.google.maps.DirectionsRenderer; parent.directionsDisplay.setMap(parent.map); parent.$container = $('.stec-layout-single-location'); parent.address = parent.$container.find(".stec-layout-single-location-address").text(); parent.setLocation(parent.address); // start end directions var $start = parent.$container.find('input[name="start"]'); var $end = parent.$container.find('input[name="end"]'); if ($.trim($end.val()) == "") { $end.val(parent.address); } if ($.trim($start.val()) == "") { parent.fillMyLocation($start); } this.bindControls(); }, fillMyLocation: function ($el) { var parent = this; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function (position) { var pos = position.coords.latitude + " " + position.coords.longitude; parent.geocoder.geocode({'address': pos}, function (results, status) { parent.myLocation = (results[0].formatted_address); $el.val(parent.myLocation); }); }, function (a, b, c) { console.log('Navigator Geolocation Error'); } ); } }, setLocation: function (address) { var parent = this; var location_use_coord = parent.$container.find(".stec-layout-single-location-address").attr("data-location-use-coord"); if (location_use_coord) { var latlng = location_use_coord.split(','); var pos = { lat:parseFloat($.trim(latlng[0])), lng:parseFloat($.trim(latlng[1])) }; parent.map.setCenter(pos); parent.marker = new window.google.maps.Marker({ map: parent.map, position: pos, title: address }); } else { parent.geocoder.geocode({'address': address}, function (results, status) { if (status === window.google.maps.GeocoderStatus.OK) { parent.map.setCenter(results[0].geometry.location); parent.marker = new window.google.maps.Marker({ map: parent.map, position: results[0].geometry.location, title: address }); } else { console.log("Geocoder error"); } }); } parent.refresh(); }, getDirection: function (a, b) { var parent = this; parent.directionsService.route({ origin: a, destination: b ? b : parent.marker.position, travelMode: window.google.maps.TravelMode.DRIVING }, function (response, status) { if (status === window.google.maps.DirectionsStatus.OK) { parent.directionsDisplay.setDirections(response); } else { console.log("Direction Service Error"); $('.stec-layout-single-location-direction-error').stop().fadeTo(250,1, function(){ setTimeout(function(){ $('.stec-layout-single-location-direction-error').fadeTo(250,0); }, 3000); }); } }); }, refresh: function (centerOnLocation) { var parent = this; setTimeout(function () { window.google.maps.event.trigger(parent.mapDiv, 'resize'); if (centerOnLocation === true) { parent.setLocation(parent.address); } }, 10); // timeout fixes resize bug }, bindControls: function () { var parent = this; $(".stec-layout-single-location-get-direction-btn").on(helper.clickHandle(), function (e) { e.preventDefault(); var $tabCont = $(".stec-layout-single-location"); var $start = $tabCont.find('input[name="start"]'); var $end = $tabCont.find('input[name="end"]'); if ($.trim($start.val() != "") && $.trim($end.val() != "")) { parent.getDirection($start.val(), $end.val()); } }); } }; var tabs = { init: function() { $('.stec-layout-single-tabs-list li').first().addClass('active'); $('.stec-layout-event-single-tabs-content > div').first().show(); this.bindControls(); }, bindControls: function() { $('.stec-layout-single-tabs-list li').on(helper.clickHandle(), function(){ if ($(this).hasClass('active')) { return; } $('.stec-layout-single-tabs-list li').not(this).removeClass('active'); $(this).addClass('active'); var tab = $(this).attr('data-tab').replace('stec-layout-single-',''); $('.stec-layout-event-single-tabs-content > div').hide(); $('.stec-layout-event-single-tabs-content > .stec-layout-single-' + tab).show(); }); } }; var schedule = { init: function() { this.bindControls(); }, bindControls: function() { $('.stec-layout-single-schedule-tab-preview').on(helper.clickHandle(), function (e) { e.preventDefault(); $(this).parents(".stec-layout-single-schedule-tab") .not('.stec-layout-single-schedule-tab-no-desc') .toggleClass("open"); }); } }; var woocommerce = { init: function () { this.bindControls(); }, bindControls: function () { var parent = this; $('.stec-layout-single-woocommerce-product-buy-addtocart').on(helper.clickHandle(), function (e) { e.preventDefault(); var start_date = helper.dbDateOffset(glob.event.general.start_date_tz ? glob.event.general.start_date_tz : glob.event.general.start_date, glob.event.general.repeat_time_offset); var product = { id: $(this).attr('data-pid'), sku: $(this).attr('data-sku'), quantity: $(this).attr('data-quantity'), event_start_date: start_date + ' ' + glob.event.calendar.timezone }; parent.addToCart(product, $(this).parent()); }); }, addToCart: function (product, $button) { $.ajax({ method: "POST", url: glob.options.siteurl + '/?wc-ajax=add_to_cart', data: { product_id: product.id, product_sku: product.sku, quantity: product.quantity, stec_event_start_date: product.event_start_date }, beforeSend: function () { // add preloader $button.find('.stec-layout-single-woocommerce-product-buy-addtocart').hide(); $button.find('.stec-layout-single-woocommerce-product-buy-ajax-status').empty(); $(glob.template.preloader).appendTo($button.find('.stec-layout-single-woocommerce-product-buy-ajax-status')); }, success: function (data) { $button.find('.stec-layout-single-woocommerce-product-buy-ajax-status').empty(); if (!data || data === null || (data.error && data.error === true)) { // add success icon $('').appendTo($button.find('.stec-layout-single-woocommerce-product-buy-ajax-status')); // error handle console.log('Error adding product to cart'); } else { // update fragments if (data.fragments) { for (var key in data.fragments) { if (data.fragments.hasOwnProperty(key)) { $(key).replaceWith(data.fragments[key]); } } } // add success icon $('').appendTo($button.find('.stec-layout-single-woocommerce-product-buy-ajax-status')); // decrement quantity var quantity = $button.parent() .find('.stec-layout-single-woocommerce-product-quantity span').last().text(); if (!isNaN(quantity) && quantity > 0) { quantity--; $button.parent() .find('.stec-layout-single-woocommerce-product-quantity span').last().text(quantity); } setTimeout(function () { $button.find('.stec-layout-single-woocommerce-product-buy-ajax-status i').stop().fadeTo(1000, 0, function () { $(this).remove(); if (!isNaN(quantity) && quantity > 0) { $button.find('.stec-layout-single-woocommerce-product-buy-addtocart').show(); } }); }, 3000); } }, error: function (xhr, status, thrown) { console.log(xhr + " " + status + " " + thrown); }, dataType: 'json' }); } }; var forecast = { loaded: false, ajax: null, init: function () { var parent = this; this.bindControls(); if ($('.stec-layout-single-tabs-list li[data-tab="stec-layout-single-forecast"]').hasClass('active')) { if (parent.loaded === false) { parent.getWeather(); parent.loaded = true; } } }, fillError: function () { $('.stec-layout-single-forecast-content').remove(); $('.stec-layout-single-forecast').find('.errorna').show(); }, getWindDir: function (bearing) { while (bearing < 0) bearing += 360; while (bearing >= 360) bearing -= 360; var val = Math.round((bearing - 11.25) / 22.5); var arr = [ window.stecLang.N, window.stecLang.NNE, window.stecLang.NE, window.stecLang.ENE, window.stecLang.E, window.stecLang.ESE, window.stecLang.SE, window.stecLang.SSE, window.stecLang.S, window.stecLang.SSW, window.stecLang.SW, window.stecLang.WSW, window.stecLang.W, window.stecLang.WNW, window.stecLang.NW, window.stecLang.NNW ]; return arr[ Math.abs(val) ]; }, iconToText: function (icon) { switch (icon) { case ('clear-day') : case ('clear-night') : return window.stecLang.clear_sky; break; case ('partly-cloudy-day') : case ('partly-cloudy-night') : return window.stecLang.partly_cloudy; break; case ('cloudy') : return window.stecLang.cloudy; break; case ('fog') : return window.stecLang.fog; break; case ('rain') : return window.stecLang.rain; break; case ('sleet') : return window.stecLang.sleet; break; case ('snow') : return window.stecLang.snow; break; case ('wind') : return window.stecLang.wind; break; } }, iconToiconHTML: function (icon, forceday) { // clear-day, clear-night, rain, snow, sleet, wind, fog, cloudy, partly-cloudy-day, or partly-cloudy-night switch (icon) { case ('clear-day') : return '
'; break; case ('clear-night') : return forceday ? '
' : '
'; break; case ('partly-cloudy-day') : return '
'; break; case ('partly-cloudy-night') : return forceday ? '
' : '
'; break; case ('cloudy') : return '
'; break; case ('fog') : return '
'; break; case ('rain') : return '
'; break; case ('sleet') : return '
'; break; case ('snow') : return '
'; break; case ('wind') : return '
'; break; } }, floorFigure: function (figure, decimals) { if (!decimals) decimals = 2; var d = Math.pow(10, decimals); return (parseInt(figure * d) / d).toFixed(decimals); }, getWeather: function () { var parent = this; var location = glob.event.general.location_forecast; parent.ajax = $.ajax({ type: 'POST', url: window.ajaxurl, data: { action: 'stec_public_ajax_action', task: 'get_weather_data', location: function () { location = location.split(','); location[0] = parent.floorFigure(location[0]); location[1] = parent.floorFigure(location[1]); location = location.join(','); return location; } }, beforeSend: function () { if (parent.ajax !== null) { parent.ajax.abort(); } $(glob.template.preloader).appendTo($('.stec-layout-single-forecast')); }, success: function (data) { if (data) { // error ? if (data.error || !data) { parent.fillError(); return; } parent.fillData(data); } else { parent.fillError(); } }, error: function (xhr, status, thrown) { parent.fillError(); console.log(xhr + " " + status + " " + thrown); }, complete: function () { parent.ajax = null; // Remove tabs preloaders $('.stec-layout-single-forecast').find('.stec-layout-single-preloader').remove(); }, dataType: "json" }); }, fillData: function (data) { var parent = this; var fiveDays = []; var i = 0; var forecast = data; var template = $('.stec-layout-single-forecast-details-left-forecast-day-template')[0].outerHTML; $('.stec-layout-single-forecast-details-left-forecast-day-template').remove(); $(forecast.daily.data).each(function () { if (i > 4) return false; var th = this; var icon = parent.iconToiconHTML(th.icon, true); var d = helper.treatAsUTC(new Date(this.time * 1000)); d.setHours(d.getHours() + forecast.offset); var format = 'dd-mm'; switch (glob.options.date_format) { case 'dd-mm-yy' : format = 'd M'; break; case 'mm-dd-yy' : format = 'M d'; break; case 'yy-mm-dd' : format = 'M d'; break; } var niceday = helper.dateToFormat(format, d); fiveDays[i] = $(template).html(function (index, html) { var tempFmin = Math.round(th.temperatureMin); var tempCmin = Math.round((tempFmin - 32) * 5 / 9); var tempFmax = Math.round(th.temperatureMax); var tempCmax = Math.round((tempFmax - 32) * 5 / 9); return html .replace(/\bstec_replace_date\b/g, niceday) .replace(/\bstec_replace_min\b/g, glob.options.temp_units == "C" ? tempCmin : tempFmin) .replace(/\bstec_replace_max\b/g, glob.options.temp_units == "C" ? tempCmax : tempFmax) .replace(/\bstec_replace_temp_units\b/g, glob.options.temp_units == "C" ? "C" : "F") .replace(/\bstec_replace_icon_div\b/g, icon); })[0].outerHTML; i++; }); fiveDays = fiveDays.join(''); $('.stec-layout-single-forecast').html(function (index, html) { var icon = parent.iconToiconHTML(forecast.currently.icon); var tempF = Math.round(forecast.currently.temperature); var tempC = Math.round((tempF - 32) * 5 / 9); var apTempF = Math.round(forecast.currently.apparentTemperature); var apTempC = Math.round((tempF - 32) * 5 / 9); var windMPH = Math.round(forecast.currently.windSpeed); var windKPH = Math.round(windMPH * 1.609344); var d = helper.treatAsUTC(new Date(forecast.currently.time * 1000)); d.setHours(d.getHours() + forecast.offset); var niceday = helper.dateToFormat(false, d); return html .replace(/\bstec_replace_current_summary_text\b/g, parent.iconToText(forecast.currently.icon)) .replace(/\bstec_replace_today_date\b/g, niceday) .replace(/\bstec_replace_location\b/g, helper.capitalizeFirstLetter(glob.event.general.location)) .replace(/\bstec_replace_current_temp\b/g, glob.options.temp_units == "C" ? tempC : tempF) .replace(/\bstec_replace_current_feels_like\b/g, glob.options.temp_units == "C" ? apTempC : apTempF) .replace(/\bstec_replace_current_humidity\b/g, forecast.currently.humidity * 100) .replace(/\bstec_replace_current_temp_units/g, glob.options.temp_units == "C" ? "C" : "F") .replace(/\bstec_replace_current_wind\b/g, glob.options.wind_units == "MPH" ? windMPH : windKPH) .replace(/\bstec_replace_current_wind_units\b/g, glob.options.wind_units == "MPH" ? "MPH" : "KPH") .replace(/\bstec_replace_current_wind_direction\b/g, parent.getWindDir(forecast.currently.windBearing)) .replace(/\bstec_replace_today_icon_div\b/g, icon) .replace(/\bstec_replace_5days\b/g, fiveDays); }); // Chart instance setTimeout(function () { var humidity = [], tempC = [], tempF = [], rain = [], j = -1; var charTimeLabels = []; for (var i = 0; i < 8; i++) { j = j + 3; var th = forecast.hourly.data[j]; var tempf = Math.round(th.temperature); var tempc = Math.round((tempf - 32) * 5 / 9); tempC[i] = tempc; tempF[i] = tempf; humidity[i] = Math.round(th.humidity * 100); rain[i] = th.precipProbability * 100; // Local time var d = helper.treatAsUTC(new Date(th.time * 1000)); charTimeLabels.push(helper.dateToFormat('h:i', d)); } var ch = new parent.chart(); ch.setCanvas($('.stec-layout-single-forecast-details-chart canvas')); ch.setChartData({ labels: charTimeLabels, datasets: [ { label: window.stecLang.humidity_percents, data: humidity, backgroundColor: "rgba(200,200,200,0.1)", borderColor: "rgba(200,200,200,1)", pointBackgroundColor: "rgba(200,200,200,1)", fill: true, lineTension: 0.3, pointHoverRadius: 5, pointHitRadius: 10, borderWidth: 1 }, { label: window.stecLang.rain_chance_percents, data: rain, backgroundColor: "rgba(70,129,195,0.1)", borderColor: "rgba(70,129,195,1)", pointBackgroundColor: "rgba(70,129,195,1)", fill: true, lineTension: 0.3, pointHoverRadius: 5, pointHitRadius: 10, borderWidth: 1 }, { label: window.stecLang.temperature + ' ' + '\u00B0' + (glob.options.temp_units == "C" ? 'C' : 'F'), data: glob.options.temp_units == "C" ? tempC : tempF, backgroundColor: "rgba(252,183,85,0.3)", borderColor: "rgba(252,183,85,1)", pointBackgroundColor: "rgba(252,183,85,1)", fill: true, lineTension: 0.3, pointHoverRadius: 5, pointHitRadius: 10, borderWidth: 1 } ] }); ch.build(); helper.onResizeEnd(function () { if ($('.stec-layout-single').hasClass('stec-layout-single-media-small')) { ch.chart.options.legend.display = false; } else { ch.chart.options.legend.display = true; } ch.chart.update(); }, 50); }, 0); $('.stec-layout-single-forecast-content').show(); }, chart: function () { this.ctx, this.chartData, this.chart, this.setCanvas = function ($canvas) { var canvas = $canvas.get(0); var w = parseInt($('.stec-layout-single-forecast-details-chart').width(), 10); var h = parseInt($('.stec-layout-single-forecast-details-chart').height(), 10); canvas.width = w; canvas.height = h; this.ctx = $canvas.get(0).getContext("2d"); }, this.setChartData = function (chartData) { this.chartData = chartData; }, this.destroy = function () { this.chart.destroy(); }, this.build = function () { var parent = this; if (this.chart) { this.destroy(); } var generalTextColor = $('.stec-layout-single-forecast-details-left-forecast-top p').css('color'); var generalFontFamily = $('.stec-layout-single-forecast-details-left-forecast-top p').css('font-family'); var displayLegend = true; if ($('.stec-layout-single').hasClass('stec-layout-single-media-small')) { displayLegend = false; } this.chart = window.Chart(this.ctx, { type: 'line', data: parent.chartData, options: { maintainAspectRatio: false, responsive: true, defaultFontFamily: generalFontFamily, defaultFontColor: generalTextColor, legend: { display: displayLegend, labels: { fontFamily: generalFontFamily, fontColor: generalTextColor, fontSize: 12 } }, scales: { xAxes: [{ ticks: { fontFamily: generalFontFamily, fontSize: 11, fontColor: generalTextColor }, gridLines: { color: 'rgba(0,0,0,0.1)', zeroLineColor: 'rgba(0,0,0,0)' } }], yAxes: [{ ticks: { fontFamily: generalFontFamily, fontSize: 11, fontColor: generalTextColor }, gridLines: { color: 'rgba(0,0,0,0.1)', zeroLineColor: 'rgba(0,0,0,0)' } }] }, tooltips: { titleFontColor: '#fff', titleFontStyle: generalFontFamily, bodyFontFamily: generalFontFamily, bodyFontColor: '#fff' } } }); }; }, bindControls: function () { var parent = this; $('li[data-tab="stec-layout-single-forecast"]').on(helper.clickHandle(), function(){ if (parent.loaded === false) { parent.getWeather(); parent.loaded = true; } }); } }; var attendance = { ajax: null, init: function(){ var startDate = helper.dbDateTimeToDate(helper.dbDateOffset(glob.event.general.start_date, glob.event.general.repeat_time_offset)); var nowDate = helper.getCalNow(parseInt(glob.event.general.timezone_utc_offset, 10) / 3600); var timeLeft = Math.floor(( startDate.getTime() - nowDate.getTime() ) / 1000); if ( timeLeft < 0 ) { $('.stec-layout-single-intro-attendance').hide(); $('.stec-layout-single-attendance-invited').hide(); return; } this.bindControls(); }, ajaxAttendance: function (status) { // status // 0 - no decision // 1 - accept // 2 - decline var parent = this; glob.ajax = $.ajax({ dataType: "json", type: 'POST', url: window.ajaxurl, data: { action: 'stec_public_ajax_action', task: 'set_user_event_attendance', event_id: glob.event.general.id, repeat_offset: glob.event.general.repeat_time_offset, status: status }, beforeSend: function () { if (parent.ajax !== null) { parent.ajax.abort(); } $('.stec-layout-single-attendance-invited-buttons').hide(); $(glob.template.preloader).appendTo($('.stec-layout-single-attendance-invited')); $('.stec-layout-single-intro-attendance').children().hide(); $('
  • ' + glob.template.preloader + '
  • ') .addClass('intro-attendance'). appendTo($('.stec-layout-single-intro-attendance')); }, success: function (rtrn) { var status = parseInt(rtrn.status, 10); var id = parseInt(rtrn.id, 10); switch(status) { case 1: $('.stec-layout-single-attendance-invited-buttons').children().removeClass('active'); $('.stec-layout-single-attendance-invited-buttons-accept').addClass('active'); $('.stec-layout-single-attendance-attendee-avatar[data-userid="'+glob.options.userid+'"]') .find('ul li i') .attr('class','fa fa-check'); $('.stec-layout-single-intro-attendance').children().removeClass('active'); $('.stec-layout-single-intro-attendance-attend').addClass('active'); break; case 2: $('.stec-layout-single-attendance-invited-buttons').children().removeClass('active'); $('.stec-layout-single-attendance-invited-buttons-decline').addClass('active'); $('.stec-layout-single-attendance-attendee-avatar[data-userid="'+glob.options.userid+'"]') .find('ul li i') .attr('class','fa fa-times'); $('.stec-layout-single-intro-attendance').children().removeClass('active'); $('.stec-layout-single-intro-attendance-decline').addClass('active'); break; default: $('.stec-layout-single-attendance-invited-buttons').children().removeClass('active'); $('.stec-layout-single-attendance-attendee-avatar[data-userid="'+glob.options.userid+'"]') .find('ul li i') .attr('class','fa fa-question'); $('.stec-layout-single-intro-attendance').children().removeClass('active'); break; } }, error: function (xhr, status, thrown) { console.log(xhr + " " + status + " " + thrown); }, complete: function () { parent.ajax = null; $('.stec-layout-single-attendance-invited-buttons').css('display', 'flex'); $('.stec-layout-single-attendance-invited').find('.stec-layout-single-preloader').remove(); $('.stec-layout-single-intro-attendance').children().show(); $('.stec-layout-single-intro-attendance').children().last().remove(); } }); }, bindControls: function() { var parent = this; $('.stec-layout-single-attendance-invited-buttons-accept').on(helper.clickHandle(), function (e) { e.preventDefault(); var status = $(this).hasClass('active') ? 0 : 1; parent.ajaxAttendance(status); }); $('.stec-layout-single-attendance-invited-buttons-decline').on(helper.clickHandle(), function (e) { e.preventDefault(); var status = $(this).hasClass('active') ? 0 : 2; parent.ajaxAttendance(status); }); $('.stec-layout-single-intro-attendance-attend').on(helper.clickHandle(), function (e) { e.preventDefault(); var status = $(this).hasClass('active') ? 0 : 1; parent.ajaxAttendance(status); }); $('.stec-layout-single-intro-attendance-decline').on(helper.clickHandle(), function (e) { e.preventDefault(); var status = $(this).hasClass('active') ? 0 : 2; parent.ajaxAttendance(status); }); } }; var comments = { init: function(){ var eventId = glob.event.general.id; var disqus_shortname = glob.options.disqus_shortname; var disqus_title = glob.event.general.summary; window.disqus_url = window.location.href + "#!stecEventDiscussion" + eventId; window.disqus_identifier = "stecEventID" + eventId; window.disqus_title = disqus_title; if (typeof window.DISQUS === "undefined") { $.ajax({ type: "GET", url: "//" + disqus_shortname + ".disqus.com/embed.js", dataType: "script", cache: true }); } else { window.DISQUS.reset({ reload: true }); } } }; var bindControls = function() { $('.stec-layout-single').on('click', '.stec-layout-single-share .fa-link', function (e) { e.stopPropagation(); e.preventDefault(); var linkURL = $(this).parent().attr('href'); var $temp = $(""); $("body").append($temp); $temp.val(linkURL).select(); document.execCommand("copy"); $temp.remove(); alert(window.stecLang.copiedToClipboard); }); }; } $(document).ready(function () { new stecSingle().init(); }); })(jQuery); // source --> https://oakhillag.com/wp-content/plugins/stachethemes_event_calendar/stachethemes/../front/js/create_form.js (function ($) { "use strict"; function createEventForm() { var $instance = ''; var instance = ''; var blockForm = false; var valid = false; var captchaContainer = null; var $theForm = null; var glob = { options: null, template: { preloader: null } }; this.init = function (atts) { glob.options = atts; instance = '#' + glob.options.id; $instance = $(instance); $theForm = $instance; $theForm.toggleClass('active'); $theForm.find('.stec-layout-event-create-form-preview-right-event-toggle').toggleClass('active'); glob.template.preloader = $instance.children(".stec-preloader-template").html(); datePicker.set(); colorPicker.set(); // Only 1 calendar; hide the selector if ( $theForm.find('[name="calendar_id"]').children().length == 2 ) { $theForm.find('[name="calendar_id"]').val($theForm .find('[name="calendar_id"] option:last').val()); $theForm.find('[name="calendar_id"]').parents('div:first').hide(); var color = $theForm.find('[name="calendar_id"]').find('option:selected').data('color'); $theForm.find('[name="event_color"]').css({ background: color }).val(color); } if ( glob.options.captcha.enabled == '1' ) { captchaContainer = null; if ( $theForm.find('.stec-layout-event-create-form-g-recaptcha').children().length <= 0 ) { captchaContainer = window.grecaptcha.render($theForm.find('.stec-layout-event-create-form-g-recaptcha').get(0), { sitekey: glob.options.captcha.site_key, callback: function (response) { if ( response.length != 0 ) { valid = true; } } }); } } else { // captcha is disabled valid = true; } if ( glob.options.selector ) { if ( $('.stec-create-form-popup-blackscreen').length <= 0 ) { $('
    ').appendTo('body'); } $theForm.addClass('is-popup'); $theForm.hide(); } bindControls(); }; var helper = { isMobile: function () { return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) ? true : false; }, clickHandle: function (sub) { var tap = sub ? 'vclick.' + sub : 'vclick'; var click = sub ? 'click.' + sub : 'click'; return this.isMobile() ? tap : click; } }; var check_disabled_fields = function () { switch ( $('input[name="repeat_endson"]').filter(":checked").val() ) { case '0' : //never $theForm.find('input[name="repeat_occurences"]').attr('disabled', 'disabled'); $theForm.find('input[name="repeat_ends_on_date"]').attr('disabled', 'disabled'); break; case '1' : // after n $theForm.find('input[name="repeat_occurences"]').removeAttr('disabled'); $theForm.find('input[name="repeat_ends_on_date"]').attr('disabled', 'disabled'); break; case '2' : // on date $theForm.find('input[name="repeat_occurences"]').attr('disabled', 'disabled'); $theForm.find('input[name="repeat_ends_on_date"]').removeAttr('disabled'); break; } }; var update_rrule = function () { var freq = $theForm.find('select[name="event_repeat"]').val(); var byweekday = []; switch ( freq ) { case '0' : freq = false; break; case '1' : freq = RRule.DAILY; break; case '2' : freq = RRule.WEEKLY; $theForm.find('.stec-layout-event-create-form-inner-weekly-by-day') .find('input[type="checkbox"]') .filter(':checked') .each(function () { byweekday.push(RRule[$(this).attr('name')]); }); break; case '3' : freq = RRule.MONTHLY; break; case '4' : freq = RRule.YEARLY; break; } var interval = $theForm.find('input[name="repeat_gap"]').val(); var count = false; var until = false; switch ( $theForm.find('input[name="repeat_endson"]').filter(":checked").val() ) { case '0' : //never count = false; until = false; break; case '1' : // after n count = $theForm.find('input[name="repeat_occurences"]').val(); until = false; break; case '2' : // on date count = false; until = new Date($theForm.find('input[name="repeat_ends_on_date"]').val()); break; } var rr_options = {}; rr_options.freq = freq; if ( count > 0 ) { rr_options.count = count; } if ( until ) { rr_options.until = until; } if ( interval > 0 ) { rr_options.interval = interval; } if ( byweekday.length > 0 ) { rr_options.byweekday = byweekday; } var the_rule = ''; if ( freq !== false ) { // Set rule the_rule = new RRule(rr_options); } else { // Empty rrule the_rule = new RRule(); } var rrule = the_rule.toString(); $theForm.find('input[name="rrule"]').val(rrule); }; var datePicker = { set: function () { $theForm.find('[name="start_date"]') .datepicker("destroy") .datepicker({ setDate: glob.options.year + '-' + glob.options.month + '-' + glob.options.day, showAnim: 0, dateFormat: "yy-mm-dd", onSelect: function () { $theForm.find('[name="end_date"]').datepicker('option', 'minDate', $(this).val()); datePicker.generalTimeFix(); } }) .datepicker("setDate", new Date(glob.options.year, glob.options.month, glob.options.day)); $theForm.find('[name="end_date"]') .datepicker("destroy") .datepicker({ setDate: glob.options.year + '-' + glob.options.month + '-' + glob.options.day, showAnim: 0, dateFormat: "yy-mm-dd", onSelect: function () { $theForm.find('[name="start_date"]').datepicker('option', 'maxDate', $(this).val()); datePicker.generalTimeFix(); } }) .datepicker("setDate", new Date(glob.options.year, glob.options.month, glob.options.day)); $theForm.find('[name="repeat_ends_on_date"]') .datepicker("destroy") .datepicker(); }, generalTimeFix: function () { var $startDate = $theForm.find('[name="start_date"]'); var $endDate = $theForm.find('[name="end_date"]'); var $startHours = $theForm.find('[name="start_time_hours"]'); var $endHours = $theForm.find('[name="end_time_hours"]'); var $startMinutes = $theForm.find('[name="start_time_minutes"]'); var $endMinutes = $theForm.find('[name="end_time_minutes"]'); var start = new Date($startDate.val()); start.setHours($startHours.val()); start.setMinutes($startMinutes.val()); var end = new Date($endDate.val()); end.setHours($endHours.val()); end.setMinutes($endMinutes.val()); if ( start.getTime() > end.getTime() ) { $endHours.children().eq($startHours.children().filter(':selected').index()).prop('selected', true); $endMinutes.children().eq($startMinutes.children().filter(':selected').index()).prop('selected', true); } } }; var colorPicker = { set: function () { // init colorpicker $theForm.find('.stec-layout-event-create-form-inner-colorpicker').each(function (i) { var th = this; var color = $(th).val(); $(th).css({ backgroundColor: color }); $(th).ColorPicker({ klass: 'colorpicker-' + glob.options.id, id: 'colorpicker-' + i + '-' + glob.options.id, color: color, onShow: function (colpkr) { $(colpkr).show(); return false; }, onHide: function (colpkr) { $(colpkr).hide(); return false; }, onChange: function (hsb, hex, rgb) { $(th).attr("title", "#" + hex); $(th).css({ backgroundColor: "#" + hex }); $(th).val("#" + hex); } }); }); } }; var submitEvent = function () { if ( blockForm === true ) { return; } if ( valid === false ) { return false; } var eventOverview = { summary: $theForm.find('[name="summary"]').val(), calendar_id: $theForm.find('[name="calendar_id"]').val() }; if ( $.trim(eventOverview.summary) == '' || isNaN(parseInt(eventOverview.calendar_id, 10)) === true ) { return false; } var formData = new FormData($theForm.find('form')[0]); formData.append('action', 'stec_public_ajax_action'); formData.append('task', 'front_create_event'); $.ajax({ cache: false, processData: false, contentType: false, dataType: "json", type: 'POST', url: window.ajaxurl, data: formData, beforeSend: function () { blockForm = true; $(glob.template.preloader).appendTo($theForm.find('.stec-layout-event-create-form-inner-submit-flexbox')); $instance.trigger('stecCreateFormBeforeSend', [$instance]); }, success: function (data) { $theForm.find('.stec-preloader').remove(); if ( data.error == '1' || !data.event ) { $theForm.find('.stec-layout-event-create-form-inner-submit-flexbox .fa-times').show(); $instance.trigger('stecCreateFormSubmitError', [$instance, data]); return false; } $theForm.find('.stec-layout-event-create-form-inner-submit-flexbox .fa-check').show(); $instance.trigger('stecCreateFormSubmit', [$instance, data]); }, error: function (xhr, status, thrown) { $theForm.find('.stec-preloader').remove(); $theForm.find('.stec-layout-event-create-form-inner-submit-flexbox .fa-times').show(); console.log(xhr + " " + status + " " + thrown); $instance.trigger('stecCreateFormSubmitAjaxError', [$instance, xhr, status, thrown]); }, complete: function () { setTimeout(function () { $theForm.find('.stec-layout-event-create-form-inner-submit-flexbox i:visible').fadeTo(250, 0, function () { $(this).css('opacity', '1').hide(); }); blockForm = false; if ( glob.options.captcha.enabled == '1' ) { valid = false; window.grecaptcha.reset(captchaContainer); } }, 1000); } }); }; var deleteEvent = function (eventId) { if ( blockForm === true ) { return; } if ( isNaN(eventId) ) { return; } var $event = $instance.$events.find('.stec-layout-event-awaiting-approval[data-id="' + eventId + '"]'); $.ajax({ dataType: "json", type: 'POST', url: window.ajaxurl, data: { action: 'stec_public_ajax_action', task: 'front_delete_event', id: eventId }, beforeSend: function () { $event.find('.stec-layout-event-preview-left-approval-cancel').text(window.stecLang.deleting); blockForm = true; }, success: function (data) { if ( data.error == '0' ) { $event.find('.stec-layout-event-preview-left-approval-cancel') .addClass('stec-layout-event-preview-left-approval-cancel-success') .text(window.stecLang.deleted); $event.find('.stec-layout-event-preview-right .fa-check').show(); } if ( data.error == '1' ) { $event.find('.stec-layout-event-preview-left-approval-cancel').text(window.stecLang.error); $event.find('.stec-layout-event-preview-right .fa-times').show(); } }, error: function (xhr, status, thrown) { $event.find('.stec-layout-event-preview-left-approval-cancel').text(window.stecLang.error); $event.find('.stec-layout-event-preview-right .fa-times').show(); console.log(xhr + " " + status + " " + thrown); }, complete: function () { setTimeout(function () { blockForm = false; }, 1000); } }); }; var bindControls = function () { if ( glob.options.selector ) { $(document).on(helper.clickHandle(), '.stec-create-form-popup-blackscreen', function (e) { $theForm.hide(); $('.stec-create-form-popup-blackscreen').hide(); }); $(document).on(helper.clickHandle(), glob.options.selector, function (e) { e.preventDefault(); $theForm.css({ top: $(window).scrollTop() }).toggle(); $('.stec-create-form-popup-blackscreen').toggle(); }); } $(document).on("change", instance + (' .stec-event-create-form input[name="repeat_endson"]'), function (e) { check_disabled_fields(); }); // calendar select $(document).on('submit', instance + (' .stec-layout-event-create-form-inner form'), function (e) { e.preventDefault(); update_rrule(); submitEvent(); }); // calendar select $(document).on('change', instance + (' .stec-event-create-form [name="calendar_id"]'), function (e) { var color = $(this).find('option:selected').data('color'); $theForm.find('[name="event_color"]').css({ background: color }).val(color); }); // datetime change $(document).on('change', instance + (' .stec-event-create-form [name="start_date"]') + ',' + instance + (' .stec-event-create-form [name="end_date"]') + ',' + instance + (' .stec-event-create-form [name="start_time_hours"]') + ',' + instance + (' .stec-event-create-form [name="end_time_hours"]') + ',' + instance + (' .stec-event-create-form [name="start_time_minutes"]') + ',' + instance + (' .stec-event-create-form [name="end_time_minutes"]') , function (e) { datePicker.generalTimeFix(); }); // all day $(document).on('change', instance + ' .stec-event-create-form input[name="all_day"]', function () { if ( $(this).is(':checked') ) { $theForm.find('[name="start_time_hours"]').val($('[name="start_time_hours"]').children().first().val()); $theForm.find('[name="start_time_minutes"]').val($('[name="start_time_minutes"]').children().first().val()); $theForm.find('[name="end_time_hours"]').val($('[name="end_time_hours"]').children().last().val()); $theForm.find('[name="end_time_minutes"]').val($('[name="end_time_minutes"]').children().last().val()); $theForm.find('.stec-layout-event-create-form-time').hide(); $theForm.find('.stec-layout-event-create-form-time').prev('p').hide(); } else { $theForm.find('.stec-layout-event-create-form-time').css('display', 'flex'); $theForm.find('.stec-layout-event-create-form-time').prev('p').show(); $theForm.find('[name="start_time_hours"]').val($('[name="start_time_hours"]').children().first().val()); $theForm.find('[name="start_time_minutes"]').val($('[name="start_time_minutes"]').children().first().val()); $theForm.find('[name="end_time_hours"]').val($('[name="end_time_hours"]').children().first().val()); $theForm.find('[name="end_time_minutes"]').val($('[name="end_time_minutes"]').children().first().val()); } }); // repeat toggle $(document).on('change', instance + ' .stec-event-create-form select[name="event_repeat"]', function () { if ( parseInt($(this).val(), 10) !== 0 ) { $theForm.find('.stec-layout-event-create-form-inner-repeat-sub').css('display', 'block'); $theForm.find('.stec-layout-event-create-form-inner-repeat-gap-block').css('display', 'block'); if ( $(this).val() == '2' ) { $theForm.find('.stec-layout-event-create-form-inner-weekly-by-day').show(); } else { $theForm.find('.stec-layout-event-create-form-inner-weekly-by-day').hide(); } } else { $theForm.find('.stec-layout-event-create-form-inner-repeat-sub').hide(); $theForm.find('.stec-layout-event-create-form-inner-repeat-gap-block').hide(); $theForm.find('.stec-layout-event-create-form-inner-weekly-by-day').hide(); } }); // upload image $(document).on(helper.clickHandle(), instance + (' .stec-layout-event-create-form-inner-date-image'), function (e) { e.preventDefault(); e.stopPropagation(); $(this).next().trigger('click'); }); $(document).on('change', instance + (' .stec-layout-event-create-form-inner-date-image-file'), function (e) { $theForm.find('.stec-layout-event-create-form-inner-date-image').val(this.files[0].name); }); $(document).on(helper.clickHandle(), instance + (' .stec-layout-event-preview-right-event-toggle'), function (e) { $('.stec-create-form-popup-blackscreen').hide(); $theForm.hide(); }); /* Not implemented in standalone form yet $(document).on(helper.clickHandle(), $instance.$events.path + ('.stec-layout-event-awaiting-approval-cancel'), function (e) { var eventId = parseInt($(this).parents('.stec-layout-event-awaiting-approval').first().attr('data-id'), 10); createEventForm.deleteEvent(eventId); }); */ }; } $(document).ready(function () { // Set boostrap datetimepicker to no conflict mode if ( typeof $.fn.datepicker.noConflict === 'function' ) { $.fn.bootstrapDP = $.fn.datepicker.noConflict(); } if ( typeof window.stachethemes_ec_create_form_instance !== "undefined" ) { $(window.stachethemes_ec_create_form_instance).each(function () { var cef = new createEventForm(); cef.init(this); }); } }); })(jQuery); // source --> https://oakhillag.com/wp-content/plugins/podlove-podcasting-plugin-for-wordpress/lib/modules/podlove_web_player/player_v2/player/podlove-web-player/static/podlove-web-player.min.js var mejs=mejs||{};mejs.version="2.23.4",mejs.meIndex=0,mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mp4","audio/mpeg","video/dailymotion","video/x-dailymotion","application/x-mpegURL","audio/ogg"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]},mejs.Utility={encodeUrl:function(e){return encodeURIComponent(e)},escapeHTML:function(e){return e.toString().split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(e){var t=document.createElement("div");return t.innerHTML='x',t.firstChild.href},getScriptPath:function(e){for(var t,i,n,s,o,a,r=0,l="",d="",u=document.getElementsByTagName("script"),c=u.length,p=e.length;c>r;r++){for(s=u[r].src,i=s.lastIndexOf("/"),i>-1?(a=s.substring(i+1),o=s.substring(0,i+1)):(a=s,o=""),t=0;p>t;t++)if(d=e[t],n=a.indexOf(d),n>-1){l=o;break}if(""!==l)break}return l},calculateTimeFormat:function(e,t,i){0>e&&(e=0),"undefined"==typeof i&&(i=25);var n=t.timeFormat,s=n[0],o=n[1]==n[0],a=o?2:1,r=":",l=Math.floor(e/3600)%24,d=Math.floor(e/60)%60,u=Math.floor(e%60),c=Math.floor((e%1*i).toFixed(3)),p=[[c,"f"],[u,"s"],[d,"m"],[l,"h"]];n.lengthh;h++)if(-1!==n.indexOf(p[h][1]))m=!0;else if(m){for(var v=!1,g=h;f>g;g++)if(p[g][0]>0){v=!0;break}if(!v)break;o||(n=s+n),n=p[h][1]+r+n,o&&(n=p[h][1]+n),s=p[h][1]}t.currentTimeFormat=n},twoDigitsString:function(e){return 10>e?"0"+e:String(e)},secondsToTimeCode:function(e,t){if(0>e&&(e=0),"object"!=typeof t){var n="m:ss";n=arguments[1]?"hh:mm:ss":n,n=arguments[2]?n+":ff":n,t={currentTimeFormat:n,framesPerSecond:arguments[3]||25}}var s=t.framesPerSecond;"undefined"==typeof s&&(s=25);var n=t.currentTimeFormat,o=Math.floor(e/3600)%24,a=Math.floor(e/60)%60,r=Math.floor(e%60),l=Math.floor((e%1*s).toFixed(3));lis=[[l,"f"],[r,"s"],[a,"m"],[o,"h"]];var d=n;for(i=0,len=lis.length;i0&&(n=Math.pow(60,s)),t+=Number(e[s])*n;return Number(t.toFixed(i))},removeSwf:function(e){var t=document.getElementById(e);t&&/object|embed/i.test(t.nodeName)&&(mejs.MediaFeatures.isIE?(t.style.display="none",function(){4==t.readyState?mejs.Utility.removeObjectInIE(e):setTimeout(arguments.callee,10)}()):t.parentNode.removeChild(t))},removeObjectInIE:function(e){var t=document.getElementById(e);if(t){for(var i in t)"function"==typeof t[i]&&(t[i]=null);t.parentNode.removeChild(t)}},determineScheme:function(e){return e&&-1!=e.indexOf("://")?e.substr(0,e.indexOf("://")+3):"//"},debounce:function(e,t,i){var n;return function(){var s=this,o=arguments,a=function(){n=null,i||e.apply(s,o)},r=i&&!n;clearTimeout(n),n=setTimeout(a,t),r&&e.apply(s,o)}},isNodeAfter:function(e,t){return!!(e&&t&&"function"==typeof e.compareDocumentPosition&&e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}},mejs.PluginDetector={hasPluginVersion:function(e,t){var i=this.plugins[e];return t[1]=t[1]||0,t[2]=t[2]||0,i[0]>t[0]||i[0]==t[0]&&i[1]>t[1]||i[0]==t[0]&&i[1]==t[1]&&i[2]>=t[2]?!0:!1},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(e,t,i,n,s){this.plugins[e]=this.detectPlugin(t,i,n,s)},detectPlugin:function(e,t,i,n){var s,o,a,r=[0,0,0];if("undefined"!=typeof this.nav.plugins&&"object"==typeof this.nav.plugins[e]){if(s=this.nav.plugins[e].description,s&&("undefined"==typeof this.nav.mimeTypes||!this.nav.mimeTypes[t]||this.nav.mimeTypes[t].enabledPlugin))for(r=s.replace(e,"").replace(/^\s+/,"").replace(/\sr/gi,".").split("."),o=0;o0;)this.removeChild(t[0]);if("string"==typeof e)this.src=e;else{var i,n;for(i=0;i0&&null!==v[0].url&&this.getTypeFromFile(v[0].url).indexOf("audio")>-1&&(g.isVideo=!1),g.isVideo&&mejs.MediaFeatures.isBustedAndroid&&(e.canPlayType=function(e){return null!==e.match(/video\/(mp4|m4v)/gi)?"maybe":""}),g.isVideo&&mejs.MediaFeatures.isChromium&&(e.canPlayType=function(e){return null!==e.match(/video\/(webm|ogv|ogg)/gi)?"maybe":""}),!(!i||"auto"!==t.mode&&"auto_plugin"!==t.mode&&"native"!==t.mode||mejs.MediaFeatures.isBustedNativeHTTPS&&t.httpsBasicAuthSite===!0)){for(n||(h=document.createElement(g.isVideo?"video":"audio"),e.parentNode.insertBefore(h,e),e.style.display="none",g.htmlMediaElement=e=h),o=0;o0&&(g.url=v[0].url),g)},formatType:function(e,t){return e&&!t?this.getTypeFromFile(e):t&&~t.indexOf(";")?t.substr(0,t.indexOf(";")):t},getTypeFromFile:function(e){e=e.split("?")[0];var t=e.substring(e.lastIndexOf(".")+1).toLowerCase(),i=/(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(t)?"video/":"audio/";return this.getTypeFromExtension(t,i)},getTypeFromExtension:function(e,t){switch(t=t||"",e){case"mp4":case"m4v":case"m4a":case"f4v":case"f4a":return t+"mp4";case"flv":return t+"x-flv";case"webm":case"webma":case"webmv":return t+"webm";case"ogg":case"oga":case"ogv":return t+"ogg";case"m3u8":return"application/x-mpegurl";case"ts":return t+"mp2t";default:return t+e}},createErrorMessage:function(e,t,i){var n=e.htmlMediaElement,s=document.createElement("div"),o=t.customError;s.className="me-cannotplay";try{s.style.width=n.width+"px",s.style.height=n.height+"px"}catch(a){}o||(o='',""!==i&&(o+=''),o+=""+mejs.i18n.t("mejs.download-file")+""),s.innerHTML=o,n.parentNode.insertBefore(s,n),n.style.display="none",t.error(n)},createPlugin:function(e,t,i,n,s,o){var a,r,l,d=e.htmlMediaElement,u=1,c=1,p="me_"+e.method+"_"+mejs.meIndex++,m=new mejs.PluginMediaElement(p,e.method,e.url),h=document.createElement("div");m.tagName=d.tagName;for(var f=0;f0?t.pluginWidth:t.videoWidth>0?t.videoWidth:null!==d.getAttribute("width")?d.getAttribute("width"):t.defaultVideoWidth,c=t.pluginHeight>0?t.pluginHeight:t.videoHeight>0?t.videoHeight:null!==d.getAttribute("height")?d.getAttribute("height"):t.defaultVideoHeight,u=mejs.Utility.encodeUrl(u),c=mejs.Utility.encodeUrl(c)):t.enablePluginDebug&&(u=320,c=240),m.success=t.success,h.className="me-plugin",h.id=p+"_container",e.isVideo?d.parentNode.insertBefore(h,d):document.body.insertBefore(h,document.body.childNodes[0]),"flash"===e.method||"silverlight"===e.method){var g="audio/mp4"===d.getAttribute("type"),y=d.getElementsByTagName("source");if(y&&!g)for(var f=0,b=y.length;b>f;f++)"audio/mp4"===y[f].getAttribute("type")&&(g=!0);l=["id="+p,"isvideo="+(e.isVideo||g?"true":"false"),"autoplay="+(n?"true":"false"),"preload="+s,"width="+u,"startvolume="+t.startVolume,"timerrate="+t.timerRate,"flashstreamer="+t.flashStreamer,"height="+c,"pseudostreamstart="+t.pseudoStreamingStartQueryParam],null!==e.url&&l.push("flash"==e.method?"file="+mejs.Utility.encodeUrl(e.url):"file="+e.url),t.enablePluginDebug&&l.push("debug=true"),t.enablePluginSmoothing&&l.push("smoothing=true"),t.enablePseudoStreaming&&l.push("pseudostreaming=true"),o&&l.push("controls=true"),t.pluginVars&&(l=l.concat(t.pluginVars)),window[p+"_init"]=function(){switch(m.pluginType){case"flash":m.pluginElement=m.pluginApi=document.getElementById(p);break;case"silverlight":m.pluginElement=document.getElementById(m.id),m.pluginApi=m.pluginElement.Content.MediaElementJS}null!=m.pluginApi&&m.success&&m.success(m,d)},window[p+"_event"]=function(e,t){var i,n,s;i={type:e,target:m};for(n in t)m[n]=t[n],i[n]=t[n];s=t.bufferedTime||0,i.target.buffered=i.buffered={start:function(){return 0},end:function(){return s},length:1},m.dispatchEvent(i)}}switch(e.method){case"silverlight":h.innerHTML='';break;case"flash":mejs.MediaFeatures.isIE?(a=document.createElement("div"),h.appendChild(a),a.outerHTML=''):h.innerHTML='';break;case"youtube":var w;if(-1!=e.url.lastIndexOf("youtu.be"))w=e.url.substr(e.url.lastIndexOf("/")+1),-1!=w.indexOf("?")&&(w=w.substr(0,w.indexOf("?")));else{var j=e.url.match(/[?&]v=([^&#]+)|&|#|$/);j&&(w=j[1])}youtubeSettings={container:h,containerId:h.id,pluginMediaElement:m,pluginId:p,videoId:w,height:c,width:u,scheme:e.scheme,variables:t.youtubeIframeVars},window.postMessage?mejs.YouTubeApi.enqueueIframe(youtubeSettings):mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])&&mejs.YouTubeApi.createFlash(youtubeSettings,t);break;case"vimeo":var T=p+"_player";if(m.vimeoid=e.url.substr(e.url.lastIndexOf("/")+1),h.innerHTML='',"function"==typeof $f){var k=$f(h.childNodes[0]),C=-1;k.addEvent("ready",function(){function e(e,t,i,n){var s={type:i,target:t};"timeupdate"==i&&(t.currentTime=s.currentTime=n.seconds,t.duration=s.duration=n.duration),t.dispatchEvent(s)}k.playVideo=function(){k.api("play")},k.stopVideo=function(){k.api("unload")},k.pauseVideo=function(){k.api("pause")},k.seekTo=function(e){k.api("seekTo",e)},k.setVolume=function(e){k.api("setVolume",e)},k.setMuted=function(e){e?(k.lastVolume=k.api("getVolume"),k.api("setVolume",0)):(k.api("setVolume",k.lastVolume),delete k.lastVolume)},k.getPlayerState=function(){return C},k.addEvent("play",function(){C=1,e(k,m,"play"),e(k,m,"playing")}),k.addEvent("pause",function(){C=2,e(k,m,"pause")}),k.addEvent("finish",function(){C=0,e(k,m,"ended")}),k.addEvent("playProgress",function(t){e(k,m,"timeupdate",t)}),k.addEvent("seek",function(t){C=3,e(k,m,"seeked",t)}),k.addEvent("loadProgress",function(t){C=3,e(k,m,"progress",t)}),m.pluginElement=h,m.pluginApi=k,m.success(m,m.pluginElement)})}else console.warn("You need to include froogaloop for vimeo to work")}return d.style.display="none",d.removeAttribute("autoplay"),m},updateNative:function(e,t){var i,n=e.htmlMediaElement;for(i in mejs.HtmlMediaElement)n[i]=mejs.HtmlMediaElement[i];return t.success(n,n),n}},mejs.YouTubeApi={isIframeStarted:!1,isIframeLoaded:!1,loadIframeApi:function(e){if(!this.isIframeStarted){var t=document.createElement("script");t.src=e.scheme+"www.youtube.com/player_api";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(t,i),this.isIframeStarted=!0}},iframeQueue:[],enqueueIframe:function(e){this.isLoaded?this.createIframe(e):(this.loadIframeApi(e),this.iframeQueue.push(e))},createIframe:function(e){var t=e.pluginMediaElement,i={controls:0,wmode:"transparent"},n=new YT.Player(e.containerId,{height:e.height,width:e.width,videoId:e.videoId,playerVars:mejs.$.extend({},i,e.variables),events:{onReady:function(){n.setVideoSize=function(e,t){n.setSize(e,t)},e.pluginMediaElement.pluginApi=n,e.pluginMediaElement.pluginElement=document.getElementById(e.containerId),t.success(t,t.pluginElement),mejs.YouTubeApi.createEvent(n,t,"canplay"),setInterval(function(){mejs.YouTubeApi.createEvent(n,t,"timeupdate")},250),"undefined"!=typeof t.attributes.autoplay&&n.playVideo()},onStateChange:function(e){mejs.YouTubeApi.handleStateChange(e.data,n,t)}}})},createEvent:function(e,t,i){var n={type:i,target:t};if(e&&e.getDuration){t.currentTime=n.currentTime=e.getCurrentTime(),t.duration=n.duration=e.getDuration(),n.paused=t.paused,n.ended=t.ended,n.muted=e.isMuted(),n.volume=e.getVolume()/100,n.bytesTotal=e.getVideoBytesTotal(),n.bufferedBytes=e.getVideoBytesLoaded();var s=n.bufferedBytes/n.bytesTotal*n.duration;n.target.buffered=n.buffered={start:function(){return 0},end:function(){return s},length:1}}t.dispatchEvent(n)},iFrameReady:function(){for(this.isLoaded=!0,this.isIframeLoaded=!0;this.iframeQueue.length>0;){var e=this.iframeQueue.pop();this.createIframe(e)}},flashPlayers:{},createFlash:function(e){this.flashPlayers[e.pluginId]=e;var t,i=e.scheme+"www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+e.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";mejs.MediaFeatures.isIE?(t=document.createElement("div"),e.container.appendChild(t),t.outerHTML=''):e.container.innerHTML=''},flashReady:function(e){var t=this.flashPlayers[e],i=document.getElementById(e),n=t.pluginMediaElement;n.pluginApi=n.pluginElement=i,t.success(n,n.pluginElement),i.cueVideoById(t.videoId);var s=t.containerId+"_callback";window[s]=function(e){mejs.YouTubeApi.handleStateChange(e,i,n)},i.addEventListener("onStateChange",s),setInterval(function(){mejs.YouTubeApi.createEvent(i,n,"timeupdate")},250),mejs.YouTubeApi.createEvent(i,n,"canplay")},handleStateChange:function(e,t,i){switch(e){case-1:i.paused=!0,i.ended=!0,mejs.YouTubeApi.createEvent(t,i,"loadedmetadata");break;case 0:i.paused=!1,i.ended=!0,mejs.YouTubeApi.createEvent(t,i,"ended");break;case 1:i.paused=!1,i.ended=!1,mejs.YouTubeApi.createEvent(t,i,"play"),mejs.YouTubeApi.createEvent(t,i,"playing");break;case 2:i.paused=!0,i.ended=!1,mejs.YouTubeApi.createEvent(t,i,"pause");break;case 3:mejs.YouTubeApi.createEvent(t,i,"progress");break;case 5:}}},window.onYouTubePlayerAPIReady=function(){mejs.YouTubeApi.iFrameReady()},window.onYouTubePlayerReady=function(e){mejs.YouTubeApi.flashReady(e)},window.mejs=mejs,window.MediaElement=mejs.MediaElement,function(e,t,i){var n={"default":"en",locale:{language:i.i18n&&i.i18n.locale.language||"",strings:i.i18n&&i.i18n.locale.strings||{}},pluralForms:[function(){return arguments[1]},function(){var e=arguments;return 1===e[0]?e[1]:e[2]},function(){var e=arguments;return[0,1].indexOf(e[0])>-1?e[1]:e[2]},function(){var e=arguments;return e[0]%10===1&&e[0]%100!==11?e[1]:0!==e[0]?e[2]:e[3]},function(){var e=arguments;return 1===e[0]||11===e[0]?e[1]:2===e[0]||12===e[0]?e[2]:e[0]>2&&e[0]<20?e[3]:e[4]},function(){return 1===args[0]?args[1]:0===args[0]||args[0]%100>0&&args[0]%100<20?args[2]:args[3]},function(){var e=arguments;return e[0]%10===1&&e[0]%100!==11?e[1]:e[0]%10>=2&&(e[0]%100<10||e[0]%100>=20)?e[2]:[3]},function(){var e=arguments;return e[0]%10===1&&e[0]%100!==11?e[1]:e[0]%10>=2&&e[0]%10<=4&&(e[0]%100<10||e[0]%100>=20)?e[2]:e[3]},function(){var e=arguments;return 1===e[0]?e[1]:e[0]>=2&&e[0]<=4?e[2]:e[3]},function(){var e=arguments;return 1===e[0]?e[1]:e[0]%10>=2&&e[0]%10<=4&&(e[0]%100<10||e[0]%100>=20)?e[2]:e[3]},function(){var e=arguments;return e[0]%100===1?e[2]:e[0]%100===2?e[3]:e[0]%100===3||e[0]%100===4?e[4]:e[1]},function(){var e=arguments;return 1===e[0]?e[1]:2===e[0]?e[2]:e[0]>2&&e[0]<7?e[3]:e[0]>6&&e[0]<11?e[4]:e[5]},function(){var e=arguments;return 0===e[0]?e[1]:1===e[0]?e[2]:2===e[0]?e[3]:e[0]%100>=3&&e[0]%100<=10?e[4]:e[0]%100>=11?e[5]:e[6]},function(){var e=arguments;return 1===e[0]?e[1]:0===e[0]||e[0]%100>1&&e[0]%100<11?e[2]:e[0]%100>10&&e[0]%100<20?e[3]:e[4]},function(){var e=arguments;return e[0]%10===1?e[1]:e[0]%10===2?e[2]:e[3]},function(){var e=arguments;return 11!==e[0]&&e[0]%10===1?e[1]:e[2]},function(){var e=arguments;return 1===e[0]?e[1]:e[0]%10>=2&&e[0]%10<=4&&(e[0]%100<10||e[0]%100>=20)?e[2]:e[3]},function(){var e=arguments;return 1===e[0]?e[1]:2===e[0]?e[2]:8!==e[0]&&11!==e[0]?e[3]:e[4]},function(){var e=arguments;return 0===e[0]?e[1]:e[2]},function(){var e=arguments;return 1===e[0]?e[1]:2===e[0]?e[2]:3===e[0]?e[3]:e[4]},function(){var e=arguments;return 0===e[0]?e[1]:1===e[0]?e[2]:e[3]}],getLanguage:function(){var e=n.locale.language||n["default"];return/^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/.exec(e)?e:n["default"]},t:function(e,t){if("string"==typeof e&&e.length){var i,s,o=n.getLanguage(),a=function(e,t,i){return"object"!=typeof e||"number"!=typeof t||"number"!=typeof i?e:"string"==typeof e?e:n.pluralForms[i].apply(null,[t].concat(e))},r=function(e){var t={"&":"&","<":"<",">":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})};return n.locale.strings&&n.locale.strings[o]&&(i=n.locale.strings[o][e],"number"==typeof t&&(s=n.locale.strings[o]["mejs.plural-form"],i=a.apply(null,[i,t,s]))),!i&&n.locale.strings&&n.locale.strings[n["default"]]&&(i=n.locale.strings[n["default"]][e],"number"==typeof t&&(s=n.locale.strings[n["default"]]["mejs.plural-form"],i=a.apply(null,[i,t,s]))),i=i||e,"number"==typeof t&&(i=i.replace("%1",t)),r(i)}return e}};"undefined"!=typeof mejsL10n&&(n.locale.language=mejsL10n.language),i.i18n=n}(document,window,mejs),function(e){"use strict";"undefined"!=typeof mejsL10n&&(e[mejsL10n.lang]=mejsL10n.strings)}(mejs.i18n.locale.strings),function(e){"use strict";void 0===e.en&&(e.en={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.fullscreen-off":"Turn off Fullscreen","mejs.fullscreen-on":"Go Fullscreen","mejs.download-video":"Download Video","mejs.fullscreen":"Fullscreen","mejs.time-jump-forward":["Jump forward 1 second","Jump forward %1 seconds"],"mejs.play":"Play","mejs.pause":"Pause","mejs.close":"Close","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.time-skip-back":["Skip back 1 second","Skip back %1 seconds"],"mejs.captions-subtitles":"Captions/Subtitles","mejs.none":"None","mejs.mute-toggle":"Mute Toggle","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.ad-skip":"Skip ad","mejs.ad-skip-info":["Skip in 1 second","Skip in %1 seconds"],"mejs.source-chooser":"Source Chooser" })}(mejs.i18n.locale.strings),"undefined"!=typeof jQuery?mejs.$=jQuery:"undefined"!=typeof Zepto?(mejs.$=Zepto,Zepto.fn.outerWidth=function(e){var t=$(this).width();return e&&(t+=parseInt($(this).css("margin-right"),10),t+=parseInt($(this).css("margin-left"),10)),t}):"undefined"!=typeof ender&&(mejs.$=ender),function(e){mejs.MepDefaults={poster:"",showPosterWhenEnded:!1,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(e){return.05*e.duration},defaultSeekForwardInterval:function(e){return.05*e.duration},setDimensions:!0,audioWidth:-1,audioHeight:-1,startVolume:.8,loop:!1,autoRewind:!0,enableAutosize:!0,timeFormat:"",alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,autosizeProgress:!0,alwaysShowControls:!1,hideVideoControlsOnLoad:!1,clickToPlayPause:!0,controlsTimeoutDefault:1500,controlsTimeoutMouseEnter:2500,controlsTimeoutMouseLeave:1e3,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:!0,stretching:"auto",enableKeyboard:!0,pauseOtherPlayers:!0,keyActions:[{keys:[32,179],action:function(e,t){mejs.MediaFeatures.isFirefox||(t.paused||t.ended?t.play():t.pause())}},{keys:[38],action:function(e,t){e.container.find(".mejs-volume-slider").css("display","block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var i=Math.min(t.volume+.1,1);t.setVolume(i)}},{keys:[40],action:function(e,t){e.container.find(".mejs-volume-slider").css("display","block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var i=Math.max(t.volume-.1,0);t.setVolume(i)}},{keys:[37,227],action:function(e,t){if(!isNaN(t.duration)&&t.duration>0){e.isVideo&&(e.showControls(),e.startControlsTimer());var i=Math.max(t.currentTime-e.options.defaultSeekBackwardInterval(t),0);t.setCurrentTime(i)}}},{keys:[39,228],action:function(e,t){if(!isNaN(t.duration)&&t.duration>0){e.isVideo&&(e.showControls(),e.startControlsTimer());var i=Math.min(t.currentTime+e.options.defaultSeekForwardInterval(t),t.duration);t.setCurrentTime(i)}}},{keys:[70],action:function(e){"undefined"!=typeof e.enterFullScreen&&(e.isFullScreen?e.exitFullScreen():e.enterFullScreen())}},{keys:[77],action:function(e){e.container.find(".mejs-volume-slider").css("display","block"),e.isVideo&&(e.showControls(),e.startControlsTimer()),e.setMuted(e.media.muted?!1:!0)}}]},mejs.mepIndex=0,mejs.players={},mejs.MediaElementPlayer=function(t,i){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(t,i);var n=this;return n.$media=n.$node=e(t),n.node=n.media=n.$media[0],n.node?"undefined"!=typeof n.node.player?n.node.player:("undefined"==typeof i&&(i=n.$node.data("mejsoptions")),n.options=e.extend({},mejs.MepDefaults,i),n.options.timeFormat||(n.options.timeFormat="mm:ss",n.options.alwaysShowHours&&(n.options.timeFormat="hh:mm:ss"),n.options.showTimecodeFrameCount&&(n.options.timeFormat+=":ff")),mejs.Utility.calculateTimeFormat(0,n.options,n.options.framesPerSecond||25),n.id="mep_"+mejs.mepIndex++,mejs.players[n.id]=n,n.init(),n):void 0},mejs.MediaElementPlayer.prototype={hasFocus:!1,controlsAreVisible:!0,init:function(){var t=this,i=mejs.MediaFeatures,n=e.extend(!0,{},t.options,{success:function(e,i){t.meReady(e,i)},error:function(e){t.handleError(e)}}),s=t.media.tagName.toLowerCase();if(t.isDynamic="audio"!==s&&"video"!==s,t.isVideo=t.isDynamic?t.options.isVideo:"audio"!==s&&t.options.isVideo,i.isiPad&&t.options.iPadUseNativeControls||i.isiPhone&&t.options.iPhoneUseNativeControls)t.$media.attr("controls","controls"),i.isiPad&&null!==t.media.getAttribute("autoplay")&&t.play();else if(i.isAndroid&&t.options.AndroidUseNativeControls);else if(t.isVideo||!t.isVideo&&t.options.features.length){t.$media.removeAttr("controls");var o=mejs.i18n.t(t.isVideo?"mejs.video-player":"mejs.audio-player");e(''+o+"").insertBefore(t.$media),t.container=e('
    ').addClass(t.$media[0].className).insertBefore(t.$media).focus(function(e){if(!t.controlsAreVisible&&!t.hasFocus&&t.controlsEnabled&&(t.showControls(!0),!t.hasMsNativeFullScreen)){var i=".mejs-playpause-button > button";mejs.Utility.isNodeAfter(e.relatedTarget,t.container[0])&&(i=".mejs-controls .mejs-button:last-child > button");var n=t.container.find(i);n.focus()}}),t.options.features.length||t.container.css("background","transparent").find(".mejs-controls").hide(),t.isVideo&&"fill"===t.options.stretching&&!t.container.parent("mejs-fill-container").length&&(t.outerContainer=t.$media.parent(),t.container.wrap('
    ')),t.container.addClass((i.isAndroid?"mejs-android ":"")+(i.isiOS?"mejs-ios ":"")+(i.isiPad?"mejs-ipad ":"")+(i.isiPhone?"mejs-iphone ":"")+(t.isVideo?"mejs-video ":"mejs-audio ")),t.container.find(".mejs-mediaelement").append(t.$media),t.node.player=t,t.controls=t.container.find(".mejs-controls"),t.layers=t.container.find(".mejs-layers");var a=t.isVideo?"video":"audio",r=a.substring(0,1).toUpperCase()+a.substring(1);t.width=t.options[a+"Width"]>0||t.options[a+"Width"].toString().indexOf("%")>-1?t.options[a+"Width"]:""!==t.media.style.width&&null!==t.media.style.width?t.media.style.width:null!==t.media.getAttribute("width")?t.$media.attr("width"):t.options["default"+r+"Width"],t.height=t.options[a+"Height"]>0||t.options[a+"Height"].toString().indexOf("%")>-1?t.options[a+"Height"]:""!==t.media.style.height&&null!==t.media.style.height?t.media.style.height:null!==t.$media[0].getAttribute("height")?t.$media.attr("height"):t.options["default"+r+"Height"],t.setPlayerSize(t.width,t.height),n.pluginWidth=t.width,n.pluginHeight=t.height}else t.isVideo||t.options.features.length||t.$media.hide();mejs.MediaElement(t.$media[0],n),"undefined"!=typeof t.container&&t.options.features.length&&t.controlsAreVisible&&t.container.trigger("controlsshown")},showControls:function(e){var t=this;e="undefined"==typeof e||e,t.controlsAreVisible||(e?(t.controls.removeClass("mejs-offscreen").stop(!0,!0).fadeIn(200,function(){t.controlsAreVisible=!0,t.container.trigger("controlsshown")}),t.container.find(".mejs-control").removeClass("mejs-offscreen").stop(!0,!0).fadeIn(200,function(){t.controlsAreVisible=!0})):(t.controls.removeClass("mejs-offscreen").css("display","block"),t.container.find(".mejs-control").removeClass("mejs-offscreen").css("display","block"),t.controlsAreVisible=!0,t.container.trigger("controlsshown")),t.setControlsSize())},hideControls:function(t){var i=this;t="undefined"==typeof t||t,!i.controlsAreVisible||i.options.alwaysShowControls||i.keyboardAction||i.media.paused||i.media.ended||(t?(i.controls.stop(!0,!0).fadeOut(200,function(){e(this).addClass("mejs-offscreen").css("display","block"),i.controlsAreVisible=!1,i.container.trigger("controlshidden")}),i.container.find(".mejs-control").stop(!0,!0).fadeOut(200,function(){e(this).addClass("mejs-offscreen").css("display","block")})):(i.controls.addClass("mejs-offscreen").css("display","block"),i.container.find(".mejs-control").addClass("mejs-offscreen").css("display","block"),i.controlsAreVisible=!1,i.container.trigger("controlshidden")))},controlsTimer:null,startControlsTimer:function(e){var t=this;e="undefined"!=typeof e?e:t.options.controlsTimeoutDefault,t.killControlsTimer("start"),t.controlsTimer=setTimeout(function(){t.hideControls(),t.killControlsTimer("hide")},e)},killControlsTimer:function(){var e=this;null!==e.controlsTimer&&(clearTimeout(e.controlsTimer),delete e.controlsTimer,e.controlsTimer=null)},controlsEnabled:!0,disableControls:function(){var e=this;e.killControlsTimer(),e.hideControls(!1),this.controlsEnabled=!1},enableControls:function(){var e=this;e.showControls(!1),e.controlsEnabled=!0},meReady:function(t,i){var n,s,o=this,a=mejs.MediaFeatures,r=i.getAttribute("autoplay"),l=!("undefined"==typeof r||null===r||"false"===r);if(!o.created){if(o.created=!0,o.media=t,o.domNode=i,!(a.isAndroid&&o.options.AndroidUseNativeControls||a.isiPad&&o.options.iPadUseNativeControls||a.isiPhone&&o.options.iPhoneUseNativeControls)){if(!o.isVideo&&!o.options.features.length)return l&&"native"==t.pluginType&&o.play(),void(o.options.success&&("string"==typeof o.options.success?window[o.options.success](o.media,o.domNode,o):o.options.success(o.media,o.domNode,o)));o.buildposter(o,o.controls,o.layers,o.media),o.buildkeyboard(o,o.controls,o.layers,o.media),o.buildoverlays(o,o.controls,o.layers,o.media),o.findTracks();for(n in o.options.features)if(s=o.options.features[n],o["build"+s])try{o["build"+s](o,o.controls,o.layers,o.media)}catch(d){}o.container.trigger("controlsready"),o.setPlayerSize(o.width,o.height),o.setControlsSize(),o.isVideo&&(mejs.MediaFeatures.hasTouch&&!o.options.alwaysShowControls?o.$media.bind("touchstart",function(){o.controlsAreVisible?o.hideControls(!1):o.controlsEnabled&&o.showControls(!1)}):(o.clickToPlayPauseCallback=function(){if(o.options.clickToPlayPause){o.media.paused?o.play():o.pause();var e=o.$media.closest(".mejs-container").find(".mejs-overlay-button"),t=e.attr("aria-pressed");e.attr("aria-pressed",!t)}},o.media.addEventListener("click",o.clickToPlayPauseCallback,!1),o.container.bind("mouseenter",function(){o.controlsEnabled&&(o.options.alwaysShowControls||(o.killControlsTimer("enter"),o.showControls(),o.startControlsTimer(o.options.controlsTimeoutMouseEnter)))}).bind("mousemove",function(){o.controlsEnabled&&(o.controlsAreVisible||o.showControls(),o.options.alwaysShowControls||o.startControlsTimer(o.options.controlsTimeoutMouseEnter))}).bind("mouseleave",function(){o.controlsEnabled&&(o.media.paused||o.options.alwaysShowControls||o.startControlsTimer(o.options.controlsTimeoutMouseLeave))})),o.options.hideVideoControlsOnLoad&&o.hideControls(!1),l&&!o.options.alwaysShowControls&&o.hideControls(),o.options.enableAutosize&&o.media.addEventListener("loadedmetadata",function(e){o.options.videoHeight<=0&&null===o.domNode.getAttribute("height")&&!isNaN(e.target.videoHeight)&&(o.setPlayerSize(e.target.videoWidth,e.target.videoHeight),o.setControlsSize(),o.media.setVideoSize(e.target.videoWidth,e.target.videoHeight))},!1)),o.media.addEventListener("play",function(){var e;for(e in mejs.players){var t=mejs.players[e];t.id==o.id||!o.options.pauseOtherPlayers||t.paused||t.ended||t.pause(),t.hasFocus=!1}o.hasFocus=!0},!1),o.media.addEventListener("ended",function(){if(o.options.autoRewind)try{o.media.setCurrentTime(0),window.setTimeout(function(){e(o.container).find(".mejs-overlay-loading").parent().hide()},20)}catch(t){}"youtube"===o.media.pluginType?o.media.stop():o.media.pause(),o.setProgressRail&&o.setProgressRail(),o.setCurrentRail&&o.setCurrentRail(),o.options.loop?o.play():!o.options.alwaysShowControls&&o.controlsEnabled&&o.showControls()},!1),o.media.addEventListener("loadedmetadata",function(){mejs.Utility.calculateTimeFormat(o.duration,o.options,o.options.framesPerSecond||25),o.updateDuration&&o.updateDuration(),o.updateCurrent&&o.updateCurrent(),o.isFullScreen||(o.setPlayerSize(o.width,o.height),o.setControlsSize())},!1);var u=null;o.media.addEventListener("timeupdate",function(){u!==this.duration&&(u=this.duration,mejs.Utility.calculateTimeFormat(u,o.options,o.options.framesPerSecond||25),o.updateDuration&&o.updateDuration(),o.updateCurrent&&o.updateCurrent(),o.setControlsSize())},!1),o.container.focusout(function(t){if(t.relatedTarget){var i=e(t.relatedTarget);o.keyboardAction&&0===i.parents(".mejs-container").length&&(o.keyboardAction=!1,o.isVideo&&!o.options.alwaysShowControls&&o.hideControls(!0))}}),setTimeout(function(){o.setPlayerSize(o.width,o.height),o.setControlsSize()},50),o.globalBind("resize",function(){o.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||o.setPlayerSize(o.width,o.height),o.setControlsSize()}),"youtube"==o.media.pluginType&&(a.isiOS||a.isAndroid)&&(o.container.find(".mejs-overlay-play").hide(),o.container.find(".mejs-poster").hide())}l&&"native"==t.pluginType&&o.play(),o.options.success&&("string"==typeof o.options.success?window[o.options.success](o.media,o.domNode,o):o.options.success(o.media,o.domNode,o))}},handleError:function(e){var t=this;t.controls&&t.controls.hide(),t.options.error&&t.options.error(e)},setPlayerSize:function(e,t){var i=this;if(!i.options.setDimensions)return!1;switch("undefined"!=typeof e&&(i.width=e),"undefined"!=typeof t&&(i.height=t),i.options.stretching){case"fill":i.isVideo?this.setFillMode():this.setDimensions(i.width,i.height);break;case"responsive":this.setResponsiveMode();break;case"none":this.setDimensions(i.width,i.height);break;default:this.hasFluidMode()===!0?this.setResponsiveMode():this.setDimensions(i.width,i.height)}},hasFluidMode:function(){var e=this;return e.height.toString().indexOf("%")>0||"none"!==e.$node.css("max-width")&&"t.width"!==e.$node.css("max-width")||e.$node[0].currentStyle&&"100%"===e.$node[0].currentStyle.maxWidth},setResponsiveMode:function(){var t=this,i=function(){return t.isVideo?t.media.videoWidth&&t.media.videoWidth>0?t.media.videoWidth:null!==t.media.getAttribute("width")?t.media.getAttribute("width"):t.options.defaultVideoWidth:t.options.defaultAudioWidth}(),n=function(){return t.isVideo?t.media.videoHeight&&t.media.videoHeight>0?t.media.videoHeight:null!==t.media.getAttribute("height")?t.media.getAttribute("height"):t.options.defaultVideoHeight:t.options.defaultAudioHeight}(),s=t.container.parent().closest(":visible").width(),o=t.container.parent().closest(":visible").height(),a=t.isVideo||!t.options.autosizeProgress?parseInt(s*n/i,10):n;(isNaN(a)||0!==o&&a>o&&o>n)&&(a=o),t.container.parent().length>0&&"body"===t.container.parent()[0].tagName.toLowerCase()&&(s=e(window).width(),a=e(window).height()),a&&s&&(t.container.width(s).height(a),t.$media.add(t.container.find(".mejs-shim")).width("100%").height("100%"),t.isVideo&&t.media.setVideoSize&&t.media.setVideoSize(s,a),t.layers.children(".mejs-layer").width("100%").height("100%"))},setFillMode:function(){var e=this,t=e.outerContainer;t.width()||t.height(e.$media.width()),t.height()||t.height(e.$media.height());var i=t.width(),n=t.height();e.setDimensions("100%","100%"),e.container.find(".mejs-poster img").css("display","block"),targetElement=e.container.find("object, embed, iframe, video");var s=e.height,o=e.width,a=i,r=s*i/o,l=o*n/s,d=n,u=!(l>i),c=Math.floor(u?a:l),p=Math.floor(u?r:d);u?(targetElement.height(p).width(i),e.media.setVideoSize&&e.media.setVideoSize(i,p)):(targetElement.height(n).width(c),e.media.setVideoSize&&e.media.setVideoSize(c,n)),targetElement.css({"margin-left":Math.floor((i-c)/2),"margin-top":0})},setDimensions:function(e,t){var i=this;i.container.width(e).height(t),i.layers.children(".mejs-layer").width(e).height(t)},setControlsSize:function(){var t=this,i=0,n=0,s=t.controls.find(".mejs-time-rail"),o=t.controls.find(".mejs-time-total"),a=s.siblings(),r=a.last(),l=null,d=t.options&&!t.options.autosizeProgress;if(t.container.is(":visible")&&s.length&&s.is(":visible")){d&&(n=parseInt(s.css("width"),10)),0!==n&&n||(a.each(function(){var t=e(this);"absolute"!=t.css("position")&&t.is(":visible")&&(i+=e(this).outerWidth(!0))}),n=t.controls.width()-i-(s.outerWidth(!0)-s.width()));do d||s.width(n),o.width(n-(o.outerWidth(!0)-o.width())),"absolute"!=r.css("position")&&(l=r.length?r.position():null,n--);while(null!==l&&l.top.toFixed(2)>0&&n>0);t.container.trigger("controlsresize")}},buildposter:function(t,i,n,s){var o=this,a=e('
    ').appendTo(n),r=t.$media.attr("poster");""!==t.options.poster&&(r=t.options.poster),r?o.setPoster(r):a.hide(),s.addEventListener("play",function(){a.hide()},!1),t.options.showPosterWhenEnded&&t.options.autoRewind&&s.addEventListener("ended",function(){a.show()},!1)},setPoster:function(t){var i=this,n=i.container.find(".mejs-poster"),s=n.find("img");0===s.length&&(s=e('').appendTo(n)),s.attr("src",t),n.css({"background-image":"url("+t+")"})},buildoverlays:function(t,i,n,s){var o=this;if(t.isVideo){var a=e('
    ').hide().appendTo(n),r=e('
    ').hide().appendTo(n),l=e('
    ').appendTo(n).bind("click",function(){if(o.options.clickToPlayPause){s.paused&&s.play();var t=e(this).find(".mejs-overlay-button"),i=t.attr("aria-pressed");t.attr("aria-pressed",!!i)}});s.addEventListener("play",function(){l.hide(),a.hide(),i.find(".mejs-time-buffering").hide(),r.hide()},!1),s.addEventListener("playing",function(){l.hide(),a.hide(),i.find(".mejs-time-buffering").hide(),r.hide()},!1),s.addEventListener("seeking",function(){a.show(),i.find(".mejs-time-buffering").show()},!1),s.addEventListener("seeked",function(){a.hide(),i.find(".mejs-time-buffering").hide()},!1),s.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||l.show()},!1),s.addEventListener("waiting",function(){a.show(),i.find(".mejs-time-buffering").show()},!1),s.addEventListener("loadeddata",function(){a.show(),i.find(".mejs-time-buffering").show(),mejs.MediaFeatures.isAndroid&&(s.canplayTimeout=window.setTimeout(function(){if(document.createEvent){var e=document.createEvent("HTMLEvents");return e.initEvent("canplay",!0,!0),s.dispatchEvent(e)}},300))},!1),s.addEventListener("canplay",function(){a.hide(),i.find(".mejs-time-buffering").hide(),clearTimeout(s.canplayTimeout)},!1),s.addEventListener("error",function(e){o.handleError(e),a.hide(),l.hide(),r.show(),r.find(".mejs-overlay-error").html("Error loading this resource")},!1),s.addEventListener("keydown",function(e){o.onkeydown(t,s,e)},!1)}},buildkeyboard:function(t,i,n,s){var o=this;o.container.keydown(function(){o.keyboardAction=!0}),o.globalBind("keydown",function(i){return t.hasFocus=0!==e(i.target).closest(".mejs-container").length&&e(i.target).closest(".mejs-container").attr("id")===t.$media.closest(".mejs-container").attr("id"),o.onkeydown(t,s,i)}),o.globalBind("click",function(i){t.hasFocus=0!==e(i.target).closest(".mejs-container").length})},onkeydown:function(e,t,i){if(e.hasFocus&&e.options.enableKeyboard)for(var n=0,s=e.options.keyActions.length;s>n;n++)for(var o=e.options.keyActions[n],a=0,r=o.keys.length;r>a;a++)if(i.keyCode==o.keys[a])return"function"==typeof i.preventDefault&&i.preventDefault(),o.action(e,t,i.keyCode,i),!1;return!0},findTracks:function(){var t=this,i=t.$media.find("track");t.tracks=[],i.each(function(i,n){n=e(n),t.tracks.push({srclang:n.attr("srclang")?n.attr("srclang").toLowerCase():"",src:n.attr("src"),kind:n.attr("kind"),label:n.attr("label")||"",entries:[],isLoaded:!1})})},changeSkin:function(e){this.container[0].className="mejs-container "+e,this.setPlayerSize(this.width,this.height),this.setControlsSize()},play:function(){this.load(),this.media.play()},pause:function(){try{this.media.pause()}catch(e){}},load:function(){this.isLoaded||this.media.load(),this.isLoaded=!0},setMuted:function(e){this.media.setMuted(e)},setCurrentTime:function(e){this.media.setCurrentTime(e)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(e){this.media.setVolume(e)},getVolume:function(){return this.media.volume},setSrc:function(e){var t=this;if("youtube"===t.media.pluginType){var i;if("string"!=typeof e){var n,s;for(n=0;n
    ').appendTo(i).click(function(e){return e.preventDefault(),s.paused?s.play():s.pause(),!1}),c=u.find("button");o("pse"),s.addEventListener("play",function(){o("play")},!1),s.addEventListener("playing",function(){o("play")},!1),s.addEventListener("pause",function(){o("pse")},!1),s.addEventListener("paused",function(){o("pse")},!1)}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{stopText:"Stop"}),e.extend(MediaElementPlayer.prototype,{buildstop:function(t,i,n,s){var o=this;e('
    ').appendTo(i).click(function(){s.paused||s.pause(),s.currentTime>0&&(s.setCurrentTime(0),s.pause(),i.find(".mejs-time-current").width("0px"),i.find(".mejs-time-handle").css("left","0px"),i.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0,t.options)),i.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0,t.options)),n.find(".mejs-poster").show())})}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{enableProgressTooltip:!0,progressHelpText:""}),e.extend(MediaElementPlayer.prototype,{buildprogress:function(t,i,n,s){var o=this,a=!1,r=!1,l=0,d=!1,u=t.options.autoRewind,c=(o.options.progressHelpText?o.options.progressHelpText:mejs.i18n.t("mejs.time-help-text"),t.options.enableProgressTooltip?'00:00':"");e('
    '+c+"
    ").appendTo(i),i.find(".mejs-time-buffering").hide(),o.total=i.find(".mejs-time-total"),o.loaded=i.find(".mejs-time-loaded"),o.current=i.find(".mejs-time-current"),o.handle=i.find(".mejs-time-handle"),o.timefloat=i.find(".mejs-time-float"),o.timefloatcurrent=i.find(".mejs-time-float-current"),o.slider=i.find(".mejs-time-slider");var p=function(e){var i,n=o.total.offset(),r=o.total.width(),l=0,d=0,u=0;i=e.originalEvent&&e.originalEvent.changedTouches?e.originalEvent.changedTouches[0].pageX:e.changedTouches?e.changedTouches[0].pageX:e.pageX,s.duration&&(ir+n.left&&(i=r+n.left),u=i-n.left,l=u/r,d=.02>=l?0:l*s.duration,a&&d!==s.currentTime&&s.setCurrentTime(d),mejs.MediaFeatures.hasTouch||(o.timefloat.css("left",u),o.timefloatcurrent.html(mejs.Utility.secondsToTimeCode(d,t.options)),o.timefloat.show()))},m=function(){var e=s.currentTime,i=mejs.i18n.t("mejs.time-slider"),n=mejs.Utility.secondsToTimeCode(e,t.options),a=s.duration;o.slider.attr({"aria-label":i,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":e,"aria-valuetext":n,role:"slider",tabindex:0})},h=function(){var e=new Date;e-l>=1e3&&s.play()};o.slider.bind("focus",function(){t.options.autoRewind=!1}),o.slider.bind("blur",function(){t.options.autoRewind=u}),o.slider.bind("keydown",function(e){new Date-l>=1e3&&(d=s.paused);var i=e.keyCode,n=s.duration,o=s.currentTime,a=t.options.defaultSeekForwardInterval(s),r=t.options.defaultSeekBackwardInterval(s);switch(i){case 37:case 40:o-=r;break;case 39:case 38:o+=a;break;case 36:o=0;break;case 35:o=n;break;case 32:case 13:return void(s.paused?s.play():s.pause());default:return}return o=0>o?0:o>=n?n:Math.floor(o),l=new Date,d||s.pause(),o0&&i.buffered.end&&i.duration?n=i.buffered.end(i.buffered.length-1)/i.duration:i&&void 0!==i.bytesTotal&&i.bytesTotal>0&&void 0!==i.bufferedBytes?n=i.bufferedBytes/i.bytesTotal:e&&e.lengthComputable&&0!==e.total&&(n=e.loaded/e.total),null!==n&&(n=Math.min(1,Math.max(0,n)),t.loaded&&t.total&&t.loaded.width(t.total.width()*n))},setCurrentRail:function(){var e=this;if(void 0!==e.media.currentTime&&e.media.duration&&e.total&&e.handle){var t=Math.round(e.total.width()*e.media.currentTime/e.media.duration),i=t-Math.round(e.handle.outerWidth(!0)/2);e.current.width(t),e.handle.css("left",i)}}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:" | "}),e.extend(MediaElementPlayer.prototype,{buildcurrent:function(t,i,n,s){var o=this;e('
    '+mejs.Utility.secondsToTimeCode(0,t.options)+"
    ").appendTo(i),o.currenttime=o.controls.find(".mejs-currenttime"),s.addEventListener("timeupdate",function(){o.controlsAreVisible&&t.updateCurrent()},!1)},buildduration:function(t,i,n,s){var o=this;i.children().last().find(".mejs-currenttime").length>0?e(o.options.timeAndDurationSeparator+''+mejs.Utility.secondsToTimeCode(o.options.duration,o.options)+"").appendTo(i.find(".mejs-time")):(i.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"),e('
    '+mejs.Utility.secondsToTimeCode(o.options.duration,o.options)+"
    ").appendTo(i)),o.durationD=o.controls.find(".mejs-duration"),s.addEventListener("timeupdate",function(){o.controlsAreVisible&&t.updateDuration()},!1)},updateCurrent:function(){var e=this,t=e.media.currentTime;isNaN(t)&&(t=0),e.currenttime&&e.currenttime.html(mejs.Utility.secondsToTimeCode(t,e.options))},updateDuration:function(){var e=this,t=e.media.duration;e.options.duration>0&&(t=e.options.duration),isNaN(t)&&(t=0),e.container.toggleClass("mejs-long-video",t>3600),e.durationD&&t>0&&e.durationD.html(mejs.Utility.secondsToTimeCode(t,e.options))}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("mejs.mute-toggle"),allyVolumeControlText:mejs.i18n.t("mejs.volume-help-text"),hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical"}),e.extend(MediaElementPlayer.prototype,{buildvolume:function(t,i,n,s){if(!mejs.MediaFeatures.isAndroid&&!mejs.MediaFeatures.isiOS||!this.options.hideVolumeOnTouchDevices){var o=this,a=o.isVideo?o.options.videoVolume:o.options.audioVolume,r="horizontal"==a?e('
    '+o.options.allyVolumeControlText+'
    ').appendTo(i):e('').appendTo(i),l=o.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),d=o.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),u=o.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),c=o.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),p=function(e,t){if(!l.is(":visible")&&"undefined"==typeof t)return l.show(),p(e,!0),void l.hide();e=Math.max(0,e),e=Math.min(e,1),0===e?(r.removeClass("mejs-mute").addClass("mejs-unmute"),r.children("button").attr("title",mejs.i18n.t("mejs.unmute")).attr("aria-label",mejs.i18n.t("mejs.unmute"))):(r.removeClass("mejs-unmute").addClass("mejs-mute"),r.children("button").attr("title",mejs.i18n.t("mejs.mute")).attr("aria-label",mejs.i18n.t("mejs.mute")));var i=d.position();if("vertical"==a){var n=d.height(),s=n-n*e;c.css("top",Math.round(i.top+s-c.height()/2)),u.height(n-s),u.css("top",i.top+s)}else{var o=d.width(),m=o*e;c.css("left",Math.round(i.left+m-c.width()/2)),u.width(Math.round(m))}},m=function(e){var t=null,i=d.offset();if("vertical"===a){var n=d.height(),o=e.pageY-i.top;if(t=(n-o)/n,0===i.top||0===i.left)return}else{var r=d.width(),l=e.pageX-i.left;t=l/r}t=Math.max(0,t),t=Math.min(t,1),p(t),s.setMuted(0===t?!0:!1),s.setVolume(t)},h=!1,f=!1;r.hover(function(){l.show(),f=!0},function(){ f=!1,h||"vertical"!=a||l.hide()});var v=function(){var e=Math.floor(100*s.volume);l.attr({"aria-label":mejs.i18n.t("mejs.volume-slider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,"aria-valuetext":e+"%",role:"slider",tabindex:0})};l.bind("mouseover",function(){f=!0}).bind("mousedown",function(e){return m(e),o.globalBind("mousemove.vol",function(e){m(e)}),o.globalBind("mouseup.vol",function(){h=!1,o.globalUnbind(".vol"),f||"vertical"!=a||l.hide()}),h=!0,!1}).bind("keydown",function(e){var t=e.keyCode,i=s.volume;switch(t){case 38:i=Math.min(i+.1,1);break;case 40:i=Math.max(0,i-.1);break;default:return!0}return h=!1,p(i),s.setVolume(i),!1}),r.find("button").click(function(){s.setMuted(!s.muted)}),r.find("button").bind("focus",function(){l.show()}),s.addEventListener("volumechange",function(e){h||(s.muted?(p(0),r.removeClass("mejs-mute").addClass("mejs-unmute")):(p(s.volume),r.removeClass("mejs-unmute").addClass("mejs-mute"))),v(e)},!1),0===t.options.startVolume&&s.setMuted(!0),"native"===s.pluginType&&s.setVolume(t.options.startVolume),o.container.on("controlsresize",function(){s.muted?(p(0),r.removeClass("mejs-mute").addClass("mejs-unmute")):(p(s.volume),r.removeClass("mejs-unmute").addClass("mejs-mute"))})}}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{usePluginFullScreen:!0,newWindowCallback:function(){return""},fullscreenText:""}),e.extend(MediaElementPlayer.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,fullscreenMode:"",buildfullscreen:function(t,i,n,s){if(t.isVideo){t.isInIframe=window.location!=window.parent.location,s.addEventListener("loadstart",function(){t.detectFullscreenMode()});var o=this,a=null,r=o.options.fullscreenText?o.options.fullscreenText:mejs.i18n.t("mejs.fullscreen"),l=e('
    ').appendTo(i).on("click",function(){var e=mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||t.isFullScreen;e?t.exitFullScreen():t.enterFullScreen()}).on("mouseover",function(){if("plugin-hover"==o.fullscreenMode){null!==a&&(clearTimeout(a),delete a);var e=l.offset(),i=t.container.offset();s.positionFullscreenButton(e.left-i.left,e.top-i.top,!0)}}).on("mouseout",function(){"plugin-hover"==o.fullscreenMode&&(null!==a&&(clearTimeout(a),delete a),a=setTimeout(function(){s.hideFullscreenButton()},1500))});if(t.fullscreenBtn=l,o.globalBind("keydown",function(e){27==e.keyCode&&(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||o.isFullScreen)&&t.exitFullScreen()}),o.normalHeight=0,o.normalWidth=0,mejs.MediaFeatures.hasTrueNativeFullScreen){var d=function(){t.isFullScreen&&(mejs.MediaFeatures.isFullScreen()?(t.isNativeFullScreen=!0,t.setControlsSize()):(t.isNativeFullScreen=!1,t.exitFullScreen()))};t.globalBind(mejs.MediaFeatures.fullScreenEventName,d)}}},detectFullscreenMode:function(){var e=this,t="",i=mejs.MediaFeatures;return i.hasTrueNativeFullScreen&&"native"===e.media.pluginType?t="native-native":i.hasTrueNativeFullScreen&&"native"!==e.media.pluginType&&!i.hasFirefoxPluginMovingProblem?t="plugin-native":e.usePluginFullScreen?mejs.MediaFeatures.supportsPointerEvents?(t="plugin-click",e.createPluginClickThrough()):t="plugin-hover":t="fullwindow",e.fullscreenMode=t,t},isPluginClickThroughCreated:!1,createPluginClickThrough:function(){var t=this;if(!t.isPluginClickThroughCreated){var i,n,s=!1,o=function(){if(s){for(var e in a)a[e].hide();t.fullscreenBtn.css("pointer-events",""),t.controls.css("pointer-events",""),t.media.removeEventListener("click",t.clickToPlayPauseCallback),s=!1}},a={},r=["top","left","right","bottom"],l=function(){var e=fullscreenBtn.offset().left-t.container.offset().left,n=fullscreenBtn.offset().top-t.container.offset().top,s=fullscreenBtn.outerWidth(!0),o=fullscreenBtn.outerHeight(!0),r=t.container.width(),l=t.container.height();for(i in a)a[i].css({position:"absolute",top:0,left:0});a.top.width(r).height(n),a.left.width(e).height(o).css({top:n}),a.right.width(r-e-s).height(o).css({top:n,left:e+s}),a.bottom.width(r).height(l-o-n).css({top:n+o})};for(t.globalBind("resize",function(){l()}),i=0,n=r.length;n>i;i++)a[r[i]]=e('
    ').appendTo(t.container).mouseover(o).hide();fullscreenBtn.on("mouseover",function(){if(!t.isFullScreen){var e=fullscreenBtn.offset(),n=player.container.offset();media.positionFullscreenButton(e.left-n.left,e.top-n.top,!1),t.fullscreenBtn.css("pointer-events","none"),t.controls.css("pointer-events","none"),t.media.addEventListener("click",t.clickToPlayPauseCallback);for(i in a)a[i].show();l(),s=!0}}),media.addEventListener("fullscreenchange",function(){t.isFullScreen=!t.isFullScreen,t.isFullScreen?t.media.removeEventListener("click",t.clickToPlayPauseCallback):t.media.addEventListener("click",t.clickToPlayPauseCallback),o()}),t.globalBind("mousemove",function(e){if(s){var i=fullscreenBtn.offset();(e.pageYi.top+fullscreenBtn.outerHeight(!0)||e.pageXi.left+fullscreenBtn.outerWidth(!0))&&(fullscreenBtn.css("pointer-events",""),t.controls.css("pointer-events",""),s=!1)}}),t.isPluginClickThroughCreated=!0}},cleanfullscreen:function(e){e.exitFullScreen()},containerSizeTimeout:null,enterFullScreen:function(){var t=this;if(mejs.MediaFeatures.isiOS&&mejs.MediaFeatures.hasiOSFullScreen&&"function"==typeof t.media.webkitEnterFullscreen)return void t.media.webkitEnterFullscreen();e(document.documentElement).addClass("mejs-fullscreen"),t.normalHeight=t.container.height(),t.normalWidth=t.container.width(),"native-native"===t.fullscreenMode||"plugin-native"===t.fullscreenMode?(mejs.MediaFeatures.requestFullScreen(t.container[0]),t.isInIframe&&setTimeout(function n(){if(t.isNativeFullScreen){var i=.002,s=e(window).width(),o=screen.width,a=Math.abs(o-s),r=o*i;a>r?t.exitFullScreen():setTimeout(n,500)}},1e3)):"fullwindow"==t.fullscreeMode,t.container.addClass("mejs-container-fullscreen").width("100%").height("100%"),t.containerSizeTimeout=setTimeout(function(){t.container.css({width:"100%",height:"100%"}),t.setControlsSize()},500),"native"===t.media.pluginType?t.$media.width("100%").height("100%"):(t.container.find(".mejs-shim").width("100%").height("100%"),setTimeout(function(){var i=e(window),n=i.width(),s=i.height();t.media.setVideoSize(n,s)},500)),t.layers.children("div").width("100%").height("100%"),t.fullscreenBtn&&t.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen"),t.setControlsSize(),t.isFullScreen=!0;var i=Math.min(screen.width/t.width,screen.height/t.height);t.container.find(".mejs-captions-text").css("font-size",100*i+"%"),t.container.find(".mejs-captions-text").css("line-height","normal"),t.container.find(".mejs-captions-position").css("bottom","45px"),t.container.trigger("enteredfullscreen")},exitFullScreen:function(){var t=this;clearTimeout(t.containerSizeTimeout),mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||t.isFullScreen)&&mejs.MediaFeatures.cancelFullScreen(),e(document.documentElement).removeClass("mejs-fullscreen"),t.container.removeClass("mejs-container-fullscreen").width(t.normalWidth).height(t.normalHeight),"native"===t.media.pluginType?t.$media.width(t.normalWidth).height(t.normalHeight):(t.container.find(".mejs-shim").width(t.normalWidth).height(t.normalHeight),t.media.setVideoSize(t.normalWidth,t.normalHeight)),t.layers.children("div").width(t.normalWidth).height(t.normalHeight),t.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"),t.setControlsSize(),t.isFullScreen=!1,t.container.find(".mejs-captions-text").css("font-size",""),t.container.find(".mejs-captions-text").css("line-height",""),t.container.find(".mejs-captions-position").css("bottom",""),t.container.trigger("exitedfullscreen")}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x"}),e.extend(MediaElementPlayer.prototype,{buildspeed:function(t,i,n,s){var o=this;if("native"==o.media.pluginType){for(var a=null,r=null,l=null,d=null,u=[],c=!1,p=0,m=o.options.speeds.length;m>p;p++){var h=o.options.speeds[p];"string"==typeof h?(u.push({name:h+o.options.speedChar,value:h}),h===o.options.defaultSpeed&&(c=!0)):(u.push(h),h.value===o.options.defaultSpeed&&(c=!0))}c||u.push({name:o.options.defaultSpeed+o.options.speedChar,value:o.options.defaultSpeed}),u.sort(function(e,t){return parseFloat(t.value)-parseFloat(e.value)});var f=function(e){for(p=0,m=u.length;m>p;p++)if(u[p].value===e)return u[p].name},v='
      ';for(p=0,il=u.length;p";v+="
    ",a=e(v).appendTo(i),r=a.find(".mejs-speed-selector"),l=o.options.defaultSpeed,s.addEventListener("loadedmetadata",function(){l&&(s.playbackRate=parseFloat(l))},!0),r.on("click",'input[type="radio"]',function(){var t=e(this).attr("value");l=t,s.playbackRate=parseFloat(t),a.find("button").html(f(t)),a.find(".mejs-speed-selected").removeClass("mejs-speed-selected"),a.find('input[type="radio"]:checked').next().addClass("mejs-speed-selected")}),a.one("mouseenter focusin",function(){r.height(a.find(".mejs-speed-selector ul").outerHeight(!0)+a.find(".mejs-speed-translations").outerHeight(!0)).css("top",-1*r.height()+"px")})}}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"",tracksAriaLive:!1,hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""}),e.extend(MediaElementPlayer.prototype,{hasChapters:!1,cleartracks:function(e){e&&(e.captions&&e.captions.remove(),e.chapters&&e.chapters.remove(),e.captionsText&&e.captionsText.remove(),e.captionsButton&&e.captionsButton.remove())},buildtracks:function(t,i,n,s){if(0!==t.tracks.length){var o,a,r=this,l=r.options.tracksAriaLive?'role="log" aria-live="assertive" aria-atomic="false"':"",d=r.options.tracksText?r.options.tracksText:mejs.i18n.t("mejs.captions-subtitles");if(r.domNode.textTracks)for(o=r.domNode.textTracks.length-1;o>=0;o--)r.domNode.textTracks[o].mode="hidden";r.cleartracks(t,i,n,s),t.chapters=e('
    ').prependTo(n).hide(),t.captions=e('
    ').prependTo(n).hide(),t.captionsText=t.captions.find(".mejs-captions-text"),t.captionsButton=e('
    ").appendTo(i);var u=0;for(o=0;o0&&i.displayChapters(n)},!1),"slides"==n.kind&&i.setupSlides(n)},error:function(){i.removeTrackButton(n.srclang),i.loadNextTrack()}})},enableTrackButton:function(t,i){var n=this;""===i&&(i=mejs.language.codes[t]||t),n.captionsButton.find("input[value="+t+"]").prop("disabled",!1).siblings("label").html(i),n.options.startLanguage==t&&e("#"+n.id+"_captions_"+t).prop("checked",!0).trigger("click"),n.adjustLanguageBox()},removeTrackButton:function(e){var t=this;t.captionsButton.find("input[value="+e+"]").closest("li").remove(),t.adjustLanguageBox()},addTrackButton:function(t,i){var n=this;""===i&&(i=mejs.language.codes[t]||t),n.captionsButton.find("ul").append(e('
  • ")),n.adjustLanguageBox(),n.container.find(".mejs-captions-translations option[value="+t+"]").remove()},adjustLanguageBox:function(){var e=this;e.captionsButton.find(".mejs-captions-selector").height(e.captionsButton.find(".mejs-captions-selector ul").outerHeight(!0)+e.captionsButton.find(".mejs-captions-translations").outerHeight(!0))},checkForTracks:function(){var e=this,t=!1;if(e.options.hideCaptionsButtonWhenEmpty){for(var i=0;i=i.entries.times[e].start&&t.media.currentTime<=i.entries.times[e].stop)return t.captionsText.html(i.entries.text[e]).attr("class","mejs-captions-text "+(i.entries.times[e].identifier||"")),void t.captions.show().height(0);t.captions.hide()}else t.captions.hide()}},setupSlides:function(e){var t=this;t.slides=e,t.slides.entries.imgs=[t.slides.entries.text.length],t.showSlide(0)},showSlide:function(t){if("undefined"!=typeof this.tracks&&"undefined"!=typeof this.slidesContainer){var i=this,n=i.slides.entries.text[t],s=i.slides.entries.imgs[t];"undefined"==typeof s||"undefined"==typeof s.fadeIn?i.slides.entries.imgs[t]=s=e('').on("load",function(){s.appendTo(i.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()}):s.is(":visible")||s.is(":animated")||s.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if("undefined"!=typeof this.slides){var e,t=this,i=t.slides;for(e=0;e=i.entries.times[e].start&&t.media.currentTime<=i.entries.times[e].stop)return void t.showSlide(e)}},displayChapters:function(){var e,t=this;for(e=0;e100||i==t.entries.times.length-1&&100>o+a)&&(o=100-a),s.chapters.append(e('
    '+t.entries.text[i]+''+mejs.Utility.secondsToTimeCode(t.entries.times[i].start,s.options)+"–"+mejs.Utility.secondsToTimeCode(t.entries.times[i].stop,s.options)+"
    ")),a+=o;s.chapters.find("div.mejs-chapter").click(function(){s.media.setCurrentTime(parseFloat(e(this).attr("rel"))),s.media.paused&&s.media.play()}),s.chapters.show()}}),mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}},mejs.TrackFormatParser={webvtt:{pattern_timecode:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(t){for(var i,n,s,o=0,a=mejs.TrackFormatParser.split2(t,/\r?\n/),r={text:[],times:[]};o=0&&""!==a[o-1]&&(s=a[o-1]),o++,n=a[o],o++;""!==a[o]&&o$1"),r.text.push(n),r.times.push({identifier:s,start:0===mejs.Utility.convertSMPTEtoSeconds(i[1])?.2:mejs.Utility.convertSMPTEtoSeconds(i[1]),stop:mejs.Utility.convertSMPTEtoSeconds(i[3]),settings:i[5]})}s=""}return r}},dfxp:{parse:function(t){t=e(t).filter("tt");var i,n,s=0,o=t.children("div").eq(0),a=o.find("p"),r=t.find("#"+o.attr("style")),l={text:[],times:[]};if(r.length){var d=r.removeAttr("id").get(0).attributes;if(d.length)for(i={},s=0;s$1"),l.text.push(n)}return l}},split2:function(e,t){return e.split(t)}},3!="x\n\ny".split(/\n/gi).length&&(mejs.TrackFormatParser.split2=function(e,t){var i,n=[],s="";for(i=0;i
    ').appendTo(i).hover(function(){clearTimeout(o),t.showSourcechooserSelector()},function(){e(this),o=setTimeout(function(){t.hideSourcechooserSelector()},500)}).on("keydown",function(i){var n=i.keyCode;switch(n){case 32:mejs.MediaFeatures.isFirefox||t.showSourcechooserSelector(),e(this).find(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus();break;case 13:t.showSourcechooserSelector(),e(this).find(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus();break;case 27:t.hideSourcechooserSelector(),e(this).find("button").focus();break;default:return!0}}).on("focusout",mejs.Utility.debounce(function(){setTimeout(function(){var i=e(document.activeElement).closest(".mejs-sourcechooser-selector");i.length||t.hideSourcechooserSelector()},0)},100)).delegate("input[type=radio]","click",function(){e(this).attr("aria-selected",!0).attr("checked","checked"),e(this).closest(".mejs-sourcechooser-selector").find("input[type=radio]").not(this).attr("aria-selected","false").removeAttr("checked");var t=this.value;if(s.currentSrc!=t){var i=s.currentTime,n=s.paused;s.pause(),s.setSrc(t),s.addEventListener("loadedmetadata",function(){s.currentTime=i},!0);var o=function(){n||s.play(),s.removeEventListener("canplay",o,!0)};s.addEventListener("canplay",o,!0),s.load()}}).delegate("button","click",function(){e(this).siblings(".mejs-sourcechooser-selector").hasClass("mejs-offscreen")?(t.showSourcechooserSelector(),e(this).siblings(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus()):t.hideSourcechooserSelector()});for(var l in this.node.children){var d=this.node.children[l];"SOURCE"!==d.nodeName||"probably"!=s.canPlayType(d.type)&&"maybe"!=s.canPlayType(d.type)||t.addSourceButton(d.src,d.title,d.type,s.src==d.src)}},addSourceButton:function(t,i,n,s){var o=this;(""===i||void 0==i)&&(i=t),n=n.split("/")[1],o.sourcechooserButton.find("ul").append(e('
  • ")),o.adjustSourcechooserBox()},adjustSourcechooserBox:function(){var e=this;e.sourcechooserButton.find(".mejs-sourcechooser-selector").height(e.sourcechooserButton.find(".mejs-sourcechooser-selector ul").outerHeight(!0))},hideSourcechooserSelector:function(){this.sourcechooserButton.find(".mejs-sourcechooser-selector").addClass("mejs-offscreen").attr("aria-expanded","false").attr("aria-hidden","true").find("input[type=radio]").attr("tabindex","-1")},showSourcechooserSelector:function(){this.sourcechooserButton.find(".mejs-sourcechooser-selector").removeClass("mejs-offscreen").attr("aria-expanded","true").attr("aria-hidden","false").find("input[type=radio]").attr("tabindex","0")}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(e){return"undefined"==typeof e.enterFullScreen?null:mejs.i18n.t(e.isFullScreen?"mejs.fullscreen-off":"mejs.fullscreen-on")},click:function(e){e.isFullScreen?e.exitFullScreen():e.enterFullScreen()}},{render:function(e){return mejs.i18n.t(e.media.muted?"mejs.unmute":"mejs.mute")},click:function(e){e.setMuted(e.media.muted?!1:!0)}},{isSeparator:!0},{render:function(){return mejs.i18n.t("mejs.download-video")},click:function(e){window.location.href=e.media.currentSrc}}]}),e.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(t){t.contextMenu=e('
    ').appendTo(e("body")).hide(),t.container.bind("contextmenu",function(e){return t.isContextMenuEnabled?(e.preventDefault(),t.renderContextMenu(e.clientX-1,e.clientY-1),!1):void 0}),t.container.bind("click",function(){t.contextMenu.hide()}),t.contextMenu.bind("mouseleave",function(){t.startContextMenuTimer()})},cleancontextmenu:function(e){e.contextMenu.remove()},isContextMenuEnabled:!0,enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},contextMenuTimeout:null,startContextMenuTimer:function(){var e=this;e.killContextMenuTimer(),e.contextMenuTimer=setTimeout(function(){e.hideContextMenu(),e.killContextMenuTimer()},750)},killContextMenuTimer:function(){var e=this.contextMenuTimer;null!=e&&(clearTimeout(e),delete e,e=null)},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(t,i){for(var n=this,s="",o=n.options.contextMenuItems,a=0,r=o.length;r>a;a++)if(o[a].isSeparator)s+='
    ';else{var l=o[a].render(n);null!=l&&(s+='
    '+l+"
    ")}n.contextMenu.empty().append(e(s)).css({top:i,left:t}).show(),n.contextMenu.find(".mejs-contextmenu-item").each(function(){var t=e(this),i=parseInt(t.data("itemindex"),10),s=n.options.contextMenuItems[i];"undefined"!=typeof s.show&&s.show(t,n),t.click(function(){"undefined"!=typeof s.click&&s.click(n),n.contextMenu.hide()})}),setTimeout(function(){n.killControlsTimer("rev3")},100)}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{skipBackInterval:30,skipBackText:""}),e.extend(MediaElementPlayer.prototype,{buildskipback:function(t,i,n,s){var o=this,a=mejs.i18n.t("mejs.time-skip-back",o.options.skipBackInterval),r=o.options.skipBackText?o.options.skipBackText:a;e('
    ").appendTo(i).click(function(){s.setCurrentTime(Math.max(s.currentTime-o.options.skipBackInterval,0)),e(this).find("button").blur()})}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{postrollCloseText:""}),e.extend(MediaElementPlayer.prototype,{buildpostroll:function(t,i,n){var s=this,o=s.options.postrollCloseText?s.options.postrollCloseText:mejs.i18n.t("mejs.close"),a=s.container.find('link[rel="postroll"]').attr("href");"undefined"!=typeof a&&(t.postroll=e('').prependTo(n).hide(),s.media.addEventListener("ended",function(){e.ajax({dataType:"html",url:a,success:function(e){n.find(".mejs-postroll-layer-content").html(e)}}),t.postroll.show()},!1))}})}(mejs.$),function(e){e.extend(mejs.MepDefaults,{markerColor:"#E9BC3D",markers:[],markerCallback:function(){}}),e.extend(MediaElementPlayer.prototype,{buildmarkers:function(e,t,i,n){var s=0,o=-1,a=-1,r=-1,l=-1;for(s=0;s');n.addEventListener("durationchange",function(){e.setmarkers(t)}),n.addEventListener("timeupdate",function(){for(o=Math.floor(n.currentTime),r>o?l>o&&(l=-1):r=o,s=0;s=0&&(i=100*Math.floor(n.options.markers[s])/n.media.duration,e(t.find(".mejs-time-marker")[s]).css({width:"1px",left:i+"%",background:n.options.markerColor}))}})}(mejs.$),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){"use strict";return this.replace(/^\s+|\s+$/g,"")}),function(e){"use strict";var t,i,n,s,o,a,r,l,d,u,c,p,m=!1,h=!1,f=[],v=/(?:(\d+):)?(\d+):(\d+)(\.\d+)?([,\-](?:(\d+):)?(\d+):(\d+)(\.\d+)?)?/,g=!1;t=function(e,t){for(var i=e.toString();i.length=e?i||!e?n?"00:00:00":"00:00":"--":(o=Math.floor(e/60/60),a=Math.floor(e/60)%60,r=Math.floor(e%60)%60,l=Math.floor(e%1*1e3),i?(s=t(a,2)+":"+t(r,2),o=t(o,2),o="00"!==o||n?o+":":""):(s=o?t(a,2):a.toString(),s+=":"+t(r,2),o=o?o+":":""),l=l?"."+t(l,3):"",o+s+l)}return e[1]>0&&e[1]<9999999&&e[0]i?[i,n]:[i,!1])):!1},s=function(){var e;e=n(window.location.href),e!==!1&&(m=e[0],h=e[1])},o=function(e){var t=/(^|\s)((https?:\/\/)?[\w\-]+(\.[\w\-]+)+\.?(:\d+)?(\/\S*)?)/gi;return e=e.match(t),null!==e?e[0]:e},a=function(e){window.location.hash=e},p={getItem:function(e){return e&&this.hasItem(e)?window.unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)"+window.escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"),"$1")):null},setItem:function(e,t,i,n,s,o){if(e&&!/^(?:expires|max\-age|path|domain|secure)$/.test(e)){var a="";if(i)switch(typeof i){case"number":a="; max-age="+i;break;case"string":a="; expires="+i;break;case"object":a="; expires="+i.toGMTString()}document.cookie=window.escape(e)+"="+window.escape(t)+a+(s?"; domain="+s:"")+(n?"; path="+n:"")+(o?"; secure":"")}},removeItem:function(e){if(e&&this.hasItem(e)){var t=new Date;t.setDate(t.getDate()-1),document.cookie=window.escape(e)+"=; expires="+t.toGMTString()+"; path=/"}},hasItem:function(e){return new RegExp("(?:^|;\\s*)"+window.escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)}},r=function(t,i){var n=i.closest(".podlovewebplayer_wrapper").find(".coverimg");i.each(function(){var i,s=null,a=e(this),r=a.data("start"),l=a.data("end"),d=a.data("enabled"),u=t.currentTime>r-.3&&t.currentTime<=l;t.buffered.length>0&&(i=t.buffered.end(0)>r),u&&(s=o(a.data("img")),null!==s&&a.hasClass("active")?n.attr("src")!==s&&s.length>5&&n.attr("src",s):n.attr("src")!==n.data("img")&&n.attr("src",n.data("img")),a.addClass("active").siblings().removeClass("active")),!d&&i&&e(a).data("enabled",!0).addClass("loaded").find("a[rel=player]").removeClass("disabled")})},l=function(e){if(!(f.length>1)){var t=e.data.player;m!==!1&&(void 0===t.lastCheck||Math.abs(m-t.lastCheck)>1)&&(t.setCurrentTime(m),t.lastCheck=m,m=!1),h!==!1&&t.currentTime>=h&&(t.pause(),h=!1)}},d=function(e){var t;1===f.length&&(t="t="+i([e.data.player.currentTime]),a(t))},u=function(t){var s,o,a,r,l,d,u,c,p,m,h,f,v="";for(""!==t.chapterHeight&&"number"==typeof parseInt(t.chapterHeight,10)&&(v='style="overflow-y: auto; max-height: '+parseInt(t.chapterHeight,10)+'px;"'),s=e('
    Podcast Chapters
    Chapter Start TimeChapter TitleChapter Duration
    '), o=s.children("table"),a=o.children("tbody"),("true"===t.chaptersVisible||t.chaptersVisible===!0)&&s.addClass("active"),o.addClass("podlovewebplayer_chapters"),"false"!==t.chapterlinks&&o.addClass("linked linked_"+t.chapterlinks),r=t.chapters,l=0,"string"==typeof t.chapters?(r=[],e.each(t.chapters.split("\n"),function(t,i){/\S/.test(i)&&(d=e.trim(i),u=n(d.substring(0,d.indexOf(" "))),c=e.trim(d.substring(d.indexOf(" "))),r.push({start:u[0],code:c}))})):e.each(r,function(e,t){t.code=t.title,"string"==typeof t.start&&(t.start=n(t.start)[0])}),r=r.sort(function(e,t){return e.start-t.start}),l=Math.max.apply(Math,e.map(r,function(e,t){return p=r[t+1],p&&(e.end=p.start),e.start})),m=!1,f=0;f\n\n\n':'\n\n\n'),e.each(r,function(e){var n,s=!r[e+1],o=Math.round(this.end-this.start),d=h.clone();s?0===t.duration?(this.end=9999999999,this.duration="…"):(this.end=t.duration,this.duration=i([Math.round(this.end-this.start)],!1)):this.duration=i([o],!1),e%2&&d.addClass("oddchapter"),d.attr({"data-start":this.start,"data-end":this.end,"data-img":void 0!==this.image?this.image:""}),n=l>=3600,d.find(".starttime > span").text(i([Math.round(this.start)],!0,n)),d.find(".chaptername").html(void 0!==this.href?""!==this.href?""+this.code+' ':""+this.code+"":""+this.code+""),d.find(".timecode > span").html(""+this.duration+""),m&&void 0!==this.image&&""!==this.image&&d.find(".chapterimage").html(''),d.appendTo(a)}),s},c=function(t,n,o){var u,c,m,h,v,y,b,w,j=e(t),T=j,k=!1;o.data("podlovewebplayer",{player:j}),j.on("error",function(){e(this).attr("src")?e(this).removeAttr("src"):e(this).children("source").length&&e(this).children("source").first().remove()}),1===f.length&&s(),"flash"===t.pluginType&&(T=e("#mep_"+t.id.substring(9))),u=o.find(".podlovewebplayer_meta"),c=o.find(".summary"),m=o.find(".podlovewebplayer_timecontrol"),h=o.find(".podlovewebplayer_sharebuttons"),v=o.find(".podlovewebplayer_downloadbuttons"),y=o.find(".podlovewebplayer_chapterbox"),b=o.find("table"),w=b.find("tr"),c.each(function(){e(this).data("height",e(this).height()+10),e(this).height(e(this).hasClass("active")?e(this).find("div.summarydiv").height()+10+"px":"0px")}),y.each(function(){e(this).data("height",e(this).find(".podlovewebplayer_chapters").height()),e(this).height(e(this).hasClass("active")?e(this).find(".podlovewebplayer_chapters").height()+"px":"0px")}),1===u.length&&(u.find("a.infowindow").click(function(){return c.toggleClass("active"),c.hasClass("active")?c.height(c.find("div.summarydiv").height()+10+60+"px"):c.css("height","0px"),!1}),u.find("a.showcontrols").on("click",function(){return m.toggleClass("active"),void 0!==h&&(h.hasClass("active")?h.removeClass("active"):v.hasClass("active")&&v.removeClass("active")),!1}),u.find("a.showsharebuttons").on("click",function(){return h.toggleClass("active"),m.hasClass("active")?m.removeClass("active"):v.hasClass("active")&&v.removeClass("active"),!1}),u.find("a.showdownloadbuttons").on("click",function(){return v.toggleClass("active"),m.hasClass("active")?m.removeClass("active"):h.hasClass("active")&&h.removeClass("active"),!1}),u.find(".bigplay").on("click",function(){if(e(this).hasClass("bigplay")){var i=e(this).parent().find(".bigplay");"number"==typeof t.currentTime&&t.currentTime>0?t.paused?(i.addClass("playing"),t.play()):(i.removeClass("playing"),t.pause()):(i.hasClass("playing")||(i.addClass("playing"),e(this).parent().parent().find(".mejs-time-buffering").show()),"flash"===t.pluginType&&t.pause(),t.play())}return!1}),o.find(".chaptertoggle").unbind("click").click(function(){return o.find(".podlovewebplayer_chapterbox").toggleClass("active"),o.find(".podlovewebplayer_chapterbox").height(o.find(".podlovewebplayer_chapterbox").hasClass("active")?parseInt(o.find(".podlovewebplayer_chapterbox").data("height"),10)+2+"px":"0px"),!1}),o.find(".prevbutton").click(function(){return"number"==typeof t.currentTime&&t.currentTime>0?t.setCurrentTime(t.currentTime>y.find(".active").data("start")+10?y.find(".active").data("start"):y.find(".active").prev().data("start")):t.play(),!1}),o.find(".nextbutton").click(function(){return"number"==typeof t.currentTime&&t.currentTime>0?t.setCurrentTime(y.find(".active").next().data("start")):t.play(),!1}),o.find(".rewindbutton").click(function(){return"number"==typeof t.currentTime&&t.currentTime>0?t.setCurrentTime(t.currentTime-30):t.play(),!1}),o.find(".forwardbutton").click(function(){return"number"==typeof t.currentTime&&t.currentTime>0?t.setCurrentTime(t.currentTime+30):t.play(),!1}),o.find(".currentbutton").click(function(){var s=n.sharewholeepisode===!0?"":"#t="+i([t.currentTime]);return window.prompt("This URL directly points to this episode on the current time",e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href")+s),!1}),o.find(".tweetbutton").click(function(){var s=n.sharewholeepisode===!0?"":"%23t%3D"+i([t.currentTime]);return window.open("https://twitter.com/share?text="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").text())+"&url="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href"))+s,"tweet it","width=550,height=420,resizable=yes"),!1}),o.find(".fbsharebutton").click(function(){var s=n.sharewholeepisode===!0?"":"%23t%3D"+i([t.currentTime]);return window.open("http://www.facebook.com/share.php?t="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").text())+"&u="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href"))+s,"share it","width=550,height=340,resizable=yes"),!1}),o.find(".gplusbutton").click(function(){var s=n.sharewholeepisode===!0?"":"%23t%3D"+i([t.currentTime]);return window.open("https://plus.google.com/share?title="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").text())+"&url="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href"))+s,"plus it","width=550,height=420,resizable=yes"),!1}),o.find(".adnbutton").click(function(){var s=n.sharewholeepisode===!0?"":"%23t%3D"+i([t.currentTime]);return window.open("https://alpha.app.net/intent/post?text="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").text())+"%20"+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href"))+s,"plus it","width=550,height=420,resizable=yes"),!1}),o.find(".mailbutton").click(function(){var s=n.sharewholeepisode===!0?"":"%23t%3D"+i([t.currentTime]);return window.location="mailto:?subject="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").text())+"&body="+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").text())+"%20%3C"+encodeURIComponent(e(this).closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href"))+s+"%3E",!1}),o.find(".fileselect").change(function(){var t,i;return e(this).parent().find(".fileselect option:selected").each(function(){t=e(this).data("dlurl")}),e(this).parent().find(".downloadbutton").each(function(){i=t.split("/"),i=i[i.length-1],e(this).attr("href",t),e(this).attr("download",i)}),!1}),o.find(".openfilebutton").click(function(){return e(this).parent().find(".fileselect option:selected").each(function(){window.open(e(this).data("url"),"Podlove Popup","width=550,height=420,resizable=yes")}),!1}),o.find(".fileinfobutton").click(function(){return e(this).parent().find(".fileselect option:selected").each(function(){window.prompt("file URL:",e(this).val())}),!1})),b.show().delegate(".chaptertr","click",function(n){if(e(this).closest("table").hasClass("linked_all")||e(this).closest("tr").hasClass("loaded")){n.preventDefault();var s=e(this).closest("tr"),o=s.data("start");1===f.length?a("t="+i([o])):k?t.setCurrentTime(o):j.one("canplay",function(){t.setCurrentTime(o)}),"flash"===t.pluginType&&t.pause(),t.play()}return!1}),b.show().delegate(".chaptertr a","click",function(t){return(e(this).closest("table").hasClass("linked_all")||e(this).closest("td").hasClass("loaded"))&&(t.preventDefault(),window.open(e(this)[0].href,"_blank")),!1}),j.one("canplay",function(){k=!0,t.duration&&w.find(".timecode code").eq(-1).each(function(){var n,s;n=Math.floor(e(this).closest("tr").data("start")),s=Math.floor(t.duration),e(this).text(i([s-n]))}),1===f.length&&(j.bind("play timeupdate",{player:t},l).bind("pause",{player:t},d),s(),jQuery(window).bind("onhashchange hashchange onpopstate",function(){g||s(),g=!1}))}),j.on("timeupdate",function(){r(t,w)}).on("play playing",function(){t.persistingTimer||(t.persistingTimer=window.setInterval(function(){1===f.length&&(g=!0,window.location.replace("#t="+i([t.currentTime,!1]))),p.setItem("podloveWebPlayerTime-"+n.permalink,t.currentTime,new Date(2020,1,1))},5e3)),b.find(".paused").removeClass("paused"),1===u.length&&u.find(".bigplay").addClass("playing")}).on("pause",function(){window.clearInterval(t.persistingTimer),t.persistingTimer=null,1===u.length&&u.find(".bigplay").removeClass("playing")})},e.fn.podlovewebplayer=function(t){var i={defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,audioWidth:-1,audioHeight:30,startVolume:.8,loop:!1,enableAutosize:!0,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],alwaysShowControls:!1,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,enableKeyboard:!0,pauseOtherPlayers:!0,duration:!1,plugins:["flash","silverlight"],pluginPath:"./static/",flashName:"flashmediaelement.swf",silverlightName:"silverlightmediaelement.xap"},s=e.extend({},{chapterlinks:"all",width:"100%",duration:!1,chaptersVisible:!1,timecontrolsVisible:!1,sharebuttonsVisible:!1,downloadbuttonsVisible:!1,summaryVisible:!1,hidetimebutton:!1,hidedownloadbutton:!1,hidesharebutton:!1,sharewholeepisode:!1,sources:[]},t);return this.each(function(t,o){var a,r,l,d,v,g,y,b,w,j,T,k,C,S=!1,x=!1,M=!1,E=0;if(s.width="auto"===s.width.toLowerCase()?"100%":s.width.replace("px",""),"AUDIO"===o.tagName?(void 0!==s.audioWidth&&(s.width=s.audioWidth),i.audioWidth=s.width,e.each(i.features,function(e){"fullscreen"===this&&i.features.splice(e,1)})):"VIDEO"===o.tagName&&(void 0!==s.height&&(i.videoWidth=s.width,i.videoHeight=s.height),void 0!==e(o).attr("width")&&(s.width=e(o).attr("width"))),s.duration&&s.duration!==parseInt(s.duration,10)&&(a=n(s.duration),s.duration=a[0]),e.each(i,function(e){void 0!==s[e]&&(i[e]=s[e])}),s.width.toString().trim()===parseInt(s.width,10).toString().trim()&&(s.width=s.width.toString().trim()+"px"),r=o,o=e(o).clone().wrap('
    ')[0],d=e(o).parent(),f.push(o),e(o).find("[data-pwp]").each(function(){s[e(this).data("pwp")]=e(this).html(),e(this).remove()}),e(o).find("source").each(function(){void 0!==s.sources?s.sources.push(e(this).attr("src")):s.sources[0]=e(this).attr("src")}),(void 0!==s.chapters||void 0!==s.title||void 0!==s.subtitle||void 0!==s.summary||void 0!==s.poster||void 0!==e(o).attr("poster"))&&(S=!0,d.addClass("podlovewebplayer_"+o.tagName.toLowerCase()),"AUDIO"===o.tagName&&(e.each(i.features,function(e){"playpause"===this&&i.features.splice(e,1)}),d.prepend('
    '),d.find(".podlovewebplayer_meta").prepend(''),void 0!==s.poster&&d.find(".podlovewebplayer_meta").append('
    '),void 0!==e(o).attr("poster")&&d.find(".podlovewebplayer_meta").append('
    ')),"VIDEO"===o.tagName&&(d.prepend('
    '),d.append('
    ')),void 0!==s.title&&d.find(".podlovewebplayer_meta").append(void 0!==s.permalink?'

    '+s.title+"

    ":'

    '+s.title+"

    "),void 0!==s.subtitle?d.find(".podlovewebplayer_meta").append('
    '+s.subtitle+"
    "):(void 0!==s.title&&s.title.length<42&&void 0===s.poster&&d.addClass("podlovewebplayer_smallplayer"),d.find(".podlovewebplayer_meta").append('
    ')),d.find(".podlovewebplayer_meta").append('
    '),d.on("playerresize",function(){d.find(".podlovewebplayer_chapterbox").data("height",d.find(".podlovewebplayer_chapters").height()),d.find(".podlovewebplayer_chapterbox").hasClass("active")&&d.find(".podlovewebplayer_chapterbox").height(parseInt(d.find(".podlovewebplayer_chapterbox").data("height"),10)+2+"px"),d.find(".summary").data("height",d.find(".summarydiv").height()),d.find(".summary").hasClass("active")&&d.find(".summary").height(d.find(".summarydiv").height()+"px")}),void 0!==s.summary&&(v="",s.summaryVisible===!0&&(v=" active"),d.find(".togglers").append(''),d.find(".podlovewebplayer_meta").after('
    '+s.summary+"
    ")),void 0!==s.chapters?(s.chapters.length>10&&"string"==typeof s.chapters||s.chapters.length>0&&"object"==typeof s.chapters)&&d.find(".togglers").append(''):e(this).parent()[0].getElementsByClassName("mp4chaps").length>0&&(s.chapters=e(this).parent()[0].getElementsByClassName("mp4chaps")[0].innerHTML.trim(),x=!0,(s.chapters.length>10&&"string"==typeof s.chapters||s.chapters.length>0&&"object"==typeof s.chapters)&&d.find(".togglers").append('')),s.hidetimebutton!==!0&&d.find(".togglers").append('')),g="",s.timecontrolsVisible===!0&&(g=" active"),y="",s.sharebuttonsVisible===!0&&(y=" active"),b="",s.downloadbuttonsVisible===!0&&(b=" active"),d.append('
    '),void 0!==s.chapters&&(d.find(".podlovewebplayer_timecontrol").append(''),d.find(".controlbox").append('')),d.find(".podlovewebplayer_timecontrol").append(''),d.find(".podlovewebplayer_timecontrol").append(''),void 0!==d.closest(".podlovewebplayer_wrapper").find(".episodetitle a").attr("href")&&s.hidesharebutton!==!0&&(d.append('
    '),d.find(".togglers").append(''),d.find(".podlovewebplayer_sharebuttons").append(''),d.find(".podlovewebplayer_sharebuttons").append(''),d.find(".podlovewebplayer_sharebuttons").append(''),d.find(".podlovewebplayer_sharebuttons").append(''),d.find(".podlovewebplayer_sharebuttons").append(''),d.find(".podlovewebplayer_sharebuttons").append('')),(void 0!==s.downloads||void 0!==s.sources)&&s.hidedownloadbutton!==!0){if(k='",d.find(".podlovewebplayer_downloadbuttons").append(k),void 0!==s.downloads&&s.downloads.length>0&&(T=s.downloads[0].url.split("/"),T=T[T.length-1],d.find(".podlovewebplayer_downloadbuttons").append(' ')),d.find(".podlovewebplayer_downloadbuttons").append(' '),d.find(".podlovewebplayer_downloadbuttons").append(' ')}void 0!==s.chapters&&(s.chapters.length>10&&"string"==typeof s.chapters||s.chapters.length>1&&"object"==typeof s.chapters)&&(x=!0,u(s).appendTo(d)),(S||x)&&d.append('
    '),l=n(window.location.href),l!==!1&&1===f.length?(void 0!==document.hidden?M=document.hidden:void 0!==document.mozHidden?M=document.mozHidden:void 0!==document.msHidden?M=document.msHidden:void 0!==document.webkitHidden&&(M=document.webkitHidden),e(o).attr(M===!0?{preload:"auto"}:{preload:"auto",autoplay:"autoplay"}),m=l[0],h=l[1]):s&&s.permalink&&(C="podloveWebPlayerTime-"+s.permalink,p.getItem(C)&&e(o).one("canplay",function(){this.currentTime=p.getItem(C)})),e(o).on("ended",function(){p.setItem("podloveWebPlayerTime-"+s.permalink,"",new Date(2e3,1,1))}),i.success=function(t){c(t,s,d),l!==!1&&1===f.length&&e("html, body").delay(150).animate({scrollTop:e(".podlovewebplayer_wrapper:first").offset().top-25})},e(r).replaceWith(d),e(o).mediaelementplayer(i)})}}(jQuery);