// source --> https://stepan-ivan.ru/wp-content/plugins/usernoise/js/usernoise.js?ver=3.7.20 // Generated by CoffeeScript 1.6.3 (function() { window.usernoise = {}; jQuery(function($) { var Errors, FeedbackForm, ThankYouScreen, UsernoiseButton, UsernoiseWindow, browser; UsernoiseButton = function() { var self; self = this; self.show = function() { var $button, propOnIn, propOnOut, propOnStart, property; $button = $("").appendTo($("body")); property = void 0; $button.html(usernoiseButton.text); $button.addClass(usernoiseButton["class"]); $button.attr("style", usernoiseButton.style); $button.click(function(event) { self.showWindow(); event.preventDefault(); return false; }); if (browser.msie7) { if ($button.is(".un-left") || $button.is(".un-right")) { $button.css("margin-top", "-" + $button.width() / 2 + "px"); } $button.addClass("ie7"); } else if (browser.msie8) { if ($button.is(".un-right")) { $button.css("right", "-" + $button.outerWidth() + "px"); } if ($button.is(".un-left") || $button.is(".un-right")) { $button.css("margin-top", "-" + $button.width() / 2 + "px"); } $button.addClass("ie8"); } else { $button.addClass("css3"); } if ($button.is(".un-bottom") || $button.is(".un-top")) { $button.css("margin-left", "-" + ($("#un-button").width() / 2) + "px"); } if ($button.is(".un-left")) { property = "left"; } else if ($button.is(".un-right")) { property = "right"; } else if ($button.is(".un-bottom")) { property = "bottom"; } else { property = "top"; } if ($button.is(".un-left.css3")) { $button.css("margin-top", ($button.width() / 2) + "px"); } if ($button.is(".un-right.css3")) { $button.css("margin-top", "-" + ($button.width() / 2) + "px"); } propOnStart = {}; propOnIn = { opacity: 1 }; propOnOut = { opacity: 0.96 }; propOnStart[property] = "+=40px"; propOnIn[property] = "+=3px"; propOnOut[property] = "-=3px"; $button.animate(propOnStart).hover((function() { $button.animate(propOnIn, 100); }), function() { $button.animate(propOnOut, 100); }); }; self.showWindow = function() { var $iframe, $loading, $overlay; $overlay = $("
").prependTo($("body")); $overlay.fadeIn("fast"); $loading = $("").prependTo($("body")); $iframe = $("").prependTo($("body")); $iframe.css("opacity", 0); $iframe.load(function() { $loading.fadeOut("fast", function() { $loading.remove(); }); $iframe.css("opacity", 0); $iframe.animate({ opacity: 1 }, "fast"); }); $iframe.attr("src", usernoiseButton.windowUrl); }; self.hideWindow = function() { $("#un-overlay").fadeOut(function() { $("#un-overlay").remove(); }); $("#un-loading").remove(); $("#un-iframe").fadeOut("fast", function() { $("#un-iframe").remove(); }); }; }; FeedbackForm = function($form) { var selectTypeHandler, self, submitHandler; selectTypeHandler = function() { var $selector, type; $selector = $(this).parent(); $selector.find("a").removeClass("selected"); $(this).addClass("selected"); type = $(this).attr("data-type"); $selector.find("input[type=hidden]").val(type); $(document).trigger("typeselected#feedbackform#window.un", type); return false; }; submitHandler = function() { var data; data = $form.unSerializeObject(); if (window.parent.document) { data.referer = window.parent.document.location.href; } $(document).trigger("submitting#feedbackform#window.un", data); self.lock(); $form.find(".loader").show(); self.errors.hide(); $.post($form.attr("action"), data, function(response) { $form.find(".loader").hide(); self.unlock(); console.log(response) response = usernoise.helpers.parseJSON(response); if (response.success) { $("#un-thankyou").height($("#un-feedback-wrapper").height() + "px"); $form.find("textarea").val("").trigger("blur"); $(document).trigger("sent#feedbackform#window.un"); } else { self.errors.show(response.errors); } }); return false; }; self = this; self.form = $form; $form.find(".text").unAutoPlaceholder(); $form.find(".un-types-wrapper a").click(selectTypeHandler); $form.find(".un-types-wrapper a:first-child").click(); $form.submit(submitHandler); $.extend(self, { unlock: function() { $(document).trigger("unlocking#feedbackform#window.un"); $form.find("input, select, textarea").removeAttr("disabled"); $form.find(".un-types-wrapper a").click(selectTypeHandler); }, lock: function() { $form.find("*").unbind("click"); $(document).trigger("locking#feedbackform#window.un"); $form.find("input, select, textarea").attr("disabled", "disabled"); }, errors: new Errors($form.find(".un-feedback-errors-wrapper")), selectedType: function() { var type; type = $("#types-wrapper a.selected").attr("id"); if (type) { return type.replace("un-type-", ""); } else { return null; } } }); $(document).trigger("created#feedbackform#window.un", self); }; Errors = function($errorsWrapper) { var $errors, self; self = this; $errors = $errorsWrapper.find(".un-errors"); $.extend(self, { show: function(errors) { $("#window").addClass("transitionEnabled"); $(errors).each(function(index, error) { $errors.append($("").text(error)); }); $errorsWrapper.fadeIn("fast"); }, hide: function(errors) { $errors.html(""); $errorsWrapper.fadeOut("fast", function() { $errorsWrapper.hide(); }); } }); }; ThankYouScreen = function() { var $screen, self; self = this; $screen = $screen; $.extend(self, { show: function() { $("#un-thankyou").show(); $("#un-feedback-close").click(function() { usernoise.window.hide(); return false; }); } }); }; UsernoiseWindow = function(windowSelector) { var $window, detectBrowser, self, showThankYouHandler; detectBrowser = function() { if (!$("#wrapper").hasClass("un")) { return; } $("#wrapper").addClass("un"); if (browser.msie7) { $("#wrapper").addClass("un-ie7"); } if (browser.msie8) { $("#wrapper").addClass("un-ie8"); } }; showThankYouHandler = function(event, html) { self.thankYouScreen = new ThankYouScreen($window.find(".thank-you-screen")); self.thankYouScreen.show(html); }; self = this; $window = $("#window"); detectBrowser(); $.extend(self, { hide: function() { window.parent.usernoiseButton.button.hideWindow(); }, adjustSize: function() { $window.css({ "margin-top": "-" + $window.height() / 2 + "px", "margin-left": "-" + $window.width() / 2 + "px" }); } }); self.adjustSize(); }; browser = {}; if (navigator && navigator.appVersion) { browser.msie6 = navigator.appVersion.indexOf("MSIE 6.0") !== -1; browser.msie7 = navigator.appVersion.indexOf("MSIE 7.0") !== -1; browser.msie8 = navigator.appVersion.indexOf("MSIE 8.0") !== -1; } if (browser.msie6 || browser.msie7) { return; } usernoise.UsernoiseButton = UsernoiseButton; usernoise.FeedbackForm = FeedbackForm; usernoise.Errors = Errors; usernoise.ThankYouScreen = ThankYouScreen; $.fn.unAutoPlaceholder = function() { $(this).each(function() { $(this).attr("data-default", $(this).val()); $(this).focus(function() { if ($(this).val() === $(this).attr("data-default")) { $(this).val(""); $(this).addClass("text-normal"); $(this).removeClass("text-empty"); } }); $(this).blur(function() { if ($(this).val() === "") { $(this).val($(this).attr("data-default")); $(this).removeClass("text-normal"); $(this).addClass("text-empty"); } }); }); }; $.fn.unSerializeObject = function() { var a, o; o = {}; a = this.serializeArray(); $.each(a, function() { if (o[this.name]) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ""); } else { o[this.name] = this.value || ""; } }); return o; }; usernoise.helpers = { parseJSON: function(json) { if ($.parseJSON) { return $.parseJSON(json); } else { return eval_("(" + json + ")"); } } }; usernoise.Window = UsernoiseWindow; }); }).call(this); /* //@ sourceMappingURL=usernoise.map */; // source --> https://stepan-ivan.ru/wp-content/plugins/usernoise/js/button.js?ver=3.7.20 // Generated by CoffeeScript 1.6.3 (function() { jQuery(function($) { var err, is_mobile_device, _this = this; if (navigator && navigator.appVersion && (navigator.appVersion.indexOf("MSIE 6.0") !== -1 || navigator.appVersion.indexOf("MSIE 7.0") !== -1)) { return; } usernoiseButton.button = new usernoise.UsernoiseButton(); usernoise.window = { show: usernoiseButton.button.showWindow }; $(".un-feedback-form").each(function() { new usernoise.FeedbackForm($(this)); }); is_mobile_device = function() { return window.innerWidth <= 800 && window.innerHeight <= 600; }; if (usernoiseButton.showButton && !(usernoiseButton.disableOnMobiles && is_mobile_device())) { usernoiseButton.button.show(); } $(document).bind("sent#feedbackform#window.un", function() { var $overlay, closeOverlay; closeOverlay = function() { $("#un-thankyou").find("a").unbind("click"); $("#un-thankyou").fadeOut("fast", function() { $("#un-overlay").fadeOut("fast", function() { $("#un-overlay").remove(); }); }); }; $overlay = $("").appendTo($("body")); $("#un-overlay").click(closeOverlay).fadeIn("fast", function() { $("#un-thankyou").fadeIn("fast", function() { setTimeout(closeOverlay, 5000); }).find("#un-feedback-close").click(closeOverlay); }); }); try { $("#" + usernoiseButton.custom_button_id).click(function() { usernoise.window.show(); return false; }); } catch (_error) { err = _error; alert("It looks like you entere wrong HTML ID value for custom Usernoise feedback button."); } if (jQuery.on) { jQuery.on('click', 'a[rel=usernoise], button[rel=usernoise], a[href="#usernoise"]', function() { usernoise.window.show(); return false; }); } $("a[rel=usernoise]").click(function() { usernoise.window.show(); return false; }); $("button[rel=usernoise]").click(function() { usernoise.window.show(); return false; }); $("a[href=\"#usernoise\"]").click(function() { usernoise.window.show(); return false; }); }); }).call(this); /* //@ sourceMappingURL=button.map */;