String.prototype.between = function(prefix, suffix) { string = this; var i = string.indexOf(prefix); if (i >= 0) { string = string.substring(i + prefix.length); } else { return ""; } if (suffix) { i = string.indexOf(suffix); if (i >= 0) { string = string.substring(0, i); } else { return ""; } } return string; } function fcCloseCookieFloater() { $(".fcCookieFloater").fadeOut(250); } function fcSubmitForm(id) { var failedFields = 0; $("#fcForm_"+id+" textarea, #fcForm_"+id+" input:text, #fcForm_"+id+" select").each(function(){ if ($(this).hasClass("required") && $(this).val() == "") { failedFields += 1; $(this).addClass("highlight"); } }); if (failedFields < 1) { $("#fcForm_"+id).fadeOut(300, function () { var formData = new FormData($("#fcForm_"+id)[0]); $.ajax({ type : "POST", data : formData, processData: false, contentType: false, error : function (request, status, error) {$("#fcForm_"+id).fadeIn(300); alert("Virhe lomakkeen käsittelyssä");}, url: "https://www.feedcowboy.com/_submitform.php", success: function(data) { if (fcGetResponseStatus(data) == 1) { alert(fcGetResponseMessage(data)); } else { $("#fcForm_"+id).fadeIn(300); alert(fcGetResponseMessage(data)); } } }); }); } else {alert("Missing fields in the form");} } function fcCheckSearchForm() { $("#fcSearch").val(encodeURIComponent($("#fcSearchInput").val())); } function fcRepositionBlobs() { var bHeight = 0; $(".fcBlobContent_half").each(function () { if ($(this).height() > bHeight) {bHeight = $(this).height();} }); $(".fcBlobContent_half").css("height", bHeight+"px"); } function fcTriggerReadMore(id) { $("#fcReadMoreButton_"+id).removeClass("visible").addClass("hidden"); $("#fcReadMoreContent_"+id).removeClass("hidden").addClass("visible"); } function cancelSlideTimer() { clearInterval(slideTimer); } function fcChangeSlide(id) { $(".slideBlog").fadeOut(500); $("#fcSlide_"+id).delay(500).fadeIn(500); $(".fcSlideButton").attr("src", "https://www.feedcowboy.com/graphics/themes/"+$("#fcSlideButton_"+id).attr("theme-id")+"/header_carousel_listnav_passive.png"); $("#fcSlideButton_"+id).attr("src", "https://www.feedcowboy.com/graphics/themes/"+$("#fcSlideButton_"+id).attr("theme-id")+"/header_carousel_listnav_active.png"); } function fcCloseOverlay() { history.pushState(null, null, baseURL); try { tinymce.remove(); } catch (e) {} $(".fcTinyMCE").remove(); $("body").css("overflow-y", "visible"); $("#fcOverlay").fadeOut(300).html(""); } function fcOpenOverlay(id) { $("#fcOverlay").fadeOut(300, function() { $.ajax({ type:"POST", data: { fcExternalAction : "fcGetOverlay", fcClientID : 45, fcOverlayID : id }, url:"fc.output.php", success: function(data) { $("body").css("overflow-y", "hidden"); $("#fcOverlay").html(data).fadeIn(300); } }); }); } function fcCheckTriggerArea() { if (embedded) { if (feedLength-$(window).height() < $(window).height()+$(window).scrollTop()) { inTriggerArea = true; } else {inTriggerArea = false;} } else { if (feedLength-triggerHeight < $(window).height()+$(window).scrollTop()) { inTriggerArea = true; } else {inTriggerArea = false;} } } function fcRepositionOverlay() { $("#fcPreview").css("top", $(document).scrollTop()+"px"); $("#fcOverlay").css("top", $(document).scrollTop()+"px"); if (!/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { $(".fcCloseOverlay").css("height", ($(".openOverlay").height()+290)+"px"); } if ($(document).scrollTop() > 100) { $(".followUs").show(); $(".fcLink").show(); } else { $(".followUs").hide(); $(".fcLink").hide(); } if ($("#eoh").length > 0) { if ($(document).scrollTop() > $("#eoh").offset().top) { $(".fcScrollUp").show(); } else { $(".fcScrollUp").hide(); } } else { $(".fcScrollUp").hide(); } } function fcGetResponseMessage(string) { return string.between("", ""); } function fcGetResponseStatus(string) { return string.between("", ""); } function fcNotify(string) { $("#fcNotifyDiv").fadeOut(300, function() { $("#fcNotifyDiv").html(string); $("#fcNotifyDiv").fadeIn(300); }); } function fcLoginNotify(string) { $("#fcLoginNotifyDiv").fadeOut(300, function() { $("#fcLoginNotifyDiv").html(string); $("#fcLoginNotifyDiv").fadeIn(300); }); } function fcScrollUp() { $("html, body").animate({scrollTop: $("#eoh").offset().top-20}, 500); } function fcShowResetForm() { $("#fcLoginFormContainer").removeClass("visible").addClass("hidden"); $("#fcResetFormContainer").removeClass("hidden").addClass("visible"); } function fcSubmitLogin() { $("#fcLoginNotifyDiv").fadeOut(300, function() { $.ajax({ type:"POST", data: $("#fcLoginForm").serialize(), url:"engine/fc.fiddle.php?fcFiddle=1", success: function(data) { if (data=="fcSuccess") { $("#fcLoginForm").submit(); } else {fcLoginNotify(data);} } }); }); } function fcResetLogin() { $("#fcLoginNotifyDiv").fadeOut(300, function() { $.ajax({ type:"POST", data: $("#fcResetForm").serialize(), url:"fc.input.php", success: function(data) { fcLoginNotify(fcGetResponseMessage(data)); } }); }); } function fcPreviewPublicFile(id) { $("#fcPreview").fadeOut(300, function() { $.ajax({ type:"POST", data: { fcExternalAction : "fcPreviewPublicFile", fcFileSelected : id }, url:"https://www.feedcowboy.com/fc.output.php", success: function(data) { $("#fcPreview").html(data).fadeIn(300); $(".fcPreviewImg").load(function() { $(this).css("marginTop", Math.round(($(window).height()/2)-($(this).height()/2))+"px").fadeIn(300); }); } }); }); } function fcClosePublicPreview() { $("#fcPreview").fadeOut(300).html(""); }