///////////////////////////////// GRIDS ////////////////////////////// var prevID, prevIDtd, mobileUser var gotError; window.onerror = function() { console.log("Error caught, FORCING the script to work...."); $(".myLoadingDiv").fadeOut(300); }; var cssColor="Green"; var inputButtonTheme = "grey"; $(window).load(function() { /* BOOTSTRAPIZE */ // input-group $(".mrEdit").wrap("
").addClass("form-control") $(".mrDropdown").addClass("form-control") if ($(".panel").length > 1){ $(".panel:not(:last)").addClass("marginBottom") } $(".panel-body:has('.panel')").closest(".qst").contents().unwrap(); $(".panel-body:has('.panel')").closest(".col-sm-12").contents().unwrap(); $(".panel-body:has('.panel')").closest(".panel").contents().unwrap(); $(".panel-body:has('.panel')").prev().contents().unwrap(); $(".panel-body:has('.panel')").contents().unwrap(); $(".panel:last").addClass("lastPanel") //$(".panel:eq(0),.panel:eq(1)").parent().removeClass("col-sm-12").addClass("col-sm-8") // getting location of the project var Image_Location = window.location.hostname if (Image_Location == ""){ Image_Location = "file:///k:/_USEFUL STUFF/Working flow/_Template development/" jsProj = "" }else{Image_Location = "https://" + Image_Location + "/SPSSMR/ImageCache/ImageCache.aspx?Project="} // QUOTA MONITORING $(".QuotaTable tbody tr:first-child").addClass("quotaHeader") $(".QuotaTable tbody td:first-child").each(function(){ if ($(this).text() == "") $(this).parent().hide() }); //DEBUGGER!!!!!!!!!!! $("debugger").hide() $(".debugside").append($("debugger").html()) // Interviewer CSS $("int").addClass("deInt") /*******************************/ $(".mrQuestionTable").children().addClass("clickable") $(".mrQuestionTable").addClass("table table-hover").css({"display":"table","width": "auto"}) $(".mrQuestionText").eq(0).addClass("QuestionText") $("span.mrQuestionTable").each(function(){$(this).replaceWith( "" );}); $("span.clickable").each(function(){$(this).replaceWith( "
  • "+$(this).html()+"
  • " );}); $("[name='_Q_DDynamicPage_QPersonalInfoCat_Cterminated']").attr("id",null) // INITIALIZING CUSTOM RADIO AND CHECKBOXES $(document).ready(function(){ $('input').iCheck({ checkboxClass: 'icheckbox_square-'+inputButtonTheme, radioClass: 'iradio_square-'+inputButtonTheme }); }); if (!$('[name="I.ShowOnly"]').length){ $("input[type='radio']").closest("td").click(function() { //$(this).children().next().children().prop("checked",true) if ($(this).children().next().attr("class") != "mrEdit"){ if ($(this).children().attr("class") == "mrErrorText"){ $("#"+$(this).children().next().next().children().attr("id")).iCheck('check'); }else{ $("#"+$(this).children().next().children().attr("id")).iCheck('check'); } } }) } if ($(".mrPrev").length) $(".nav").append("") if ($(".mrNext").length) $(".nav").append("") $(".mrNext2,.mrPrev2").click(function(){ $("."+$(this).attr("origi")).click() }); var rownum = 0 var tempid = null $('input[type="radio"]').on('ifChecked', function(event){ if ($(this).closest("td").length){ tempid = $(this).closest("td").attr("id").split(".") rownum = tempid[2] $(this).closest(".qst").find("[id$='."+rownum+"'] input[type='checkbox']").iCheck('uncheck'); } else { $(this).closest(".qst").find("input[type='checkbox']").iCheck('uncheck'); } }); $('input[type="checkbox"]').on('ifChecked', function(event){ if ($(this).closest("td").length){ tempid = $(this).closest("td").attr("id").split(".") rownum = tempid[2] $(this).closest(".qst").find("[id$='."+rownum+"'] input[type='radio']").iCheck('uncheck'); } else { $(this).closest(".qst").find("input[type='radio']").iCheck('uncheck'); } //$('input[type="checkbox"]').iCheck('uncheck'); }); /* $( "input[type='radio']" ).parent().parent().hover( function() { $( this ).children().next().addClass("hover") }, function() { $( this ).children().next().removeClass("hover") } ); */ if ($("catch").length){ /*$(".content_container").after("
    You were too fast!
    ") setTimeout(function(){ $(".toofastDiv").css("margin-top","20px") }, 200); setTimeout(function(){ $(".toofastDiv").css("margin-top","-70px") }, 2400);*/ } if ($("catchGrid").length){ /*$(".content_container").after("
    Did you answer correctly the previous question?
    ") setTimeout(function(){ $(".invalidGridDiv").css("margin-top","20px") }, 200); setTimeout(function(){ $(".invalidGridDiv").css("margin-top","-70px") }, 2400);*/ } ////////////////////////////////////////////////////////////////////// $("qstname").each(function(){ $(this).parent().attr("id",$(this).text()) $(this).remove() }); if ($("select").length){ $("option").each(function(){ $(this).attr("catID", $(this).parent().attr("name") + $(this).attr("value")) }) } $("input").on('ifChanged', function(e){ // RADIO / CHECKBOX CHANGE EVENTS ARE COMING HERE }); ////////////////////////////////////////////////////////////////////// var i,j,k,pos for (i=0;i
    ") }else if(i>currentStat-1){ $(".statusBar").append("
    ") }else if(i==currentStat-1){ $(".statusBar").append("
    "/*+"" + ((1+i)/totalStat*100).toFixed(0) + "%"*/+"
    ") } } $(".actSt").append("") /* Color Schemes */ $(".mrNext2,.mrPrev2,.mrStop2,.actSt").addClass("gradient" + cssColor) // FANCY ERROR if ($(".mrErrorText").length) { $("#myModal .modal-title").html($(".mrErrorText").eq(0).html()) $('.errormodal') .modal('show'); } //SYNTAX ERRORS if ($(".errorContainer").length){ $(".syntaxmodal .modal-body").append($(".errorContainer")) $(".float-right button").after("") $(".showError").addClass("shake") $(".showError").click(function(){ $(".syntaxmodal").modal("show") }); } /*$("body").css({"background-image":"url('" + Image_Location + jsProj + "images/template/bg.jpg')","background-attachment": "fixed","background-position": "center"})*/ //REMOVING USELESS ITEMS $(".mrErrorText").prev().remove() $(".qstBody").prevAll("br").remove() $(".mrErrorText").next("br").hide() $(".mrErrorText").hide() //*** HIGHLIGHTING ERRORS --> FIELDS var AfterError $(".qstBody .mrErrorText").each(function(){ AfterError = $(this).next().next() $(this).closest(".panel").addClass("panel-danger") if (AfterError.find(".mrEdit").not(".mrOtherEdit").not("[name*='Other']").length){ AfterError.find(".mrEdit").closest(".form-group").addClass("has-error") return false; } if ($(this).next().hasClass("form-group")){ $(this).next().addClass("has-error") return false; } if (AfterError.find(".mrSingle,.mrMultiple").not("[id$='X0']").length){ AfterError.find(".mrSingle,.mrMultiple").closest("tr").addClass("fieldError error") return false; } if (AfterError.children().attr("class")=="mrSingle"){ $("[name='"+AfterError.children().attr("name")+"'").parent().parent().addClass("fieldError error") } if (AfterError.closest(".mrQuestionTable").length){ $("[name='"+AfterError.children().attr("name")+"'").parent().parent().addClass("fieldError error") } }); $(".mrEdit").parent().parent().addClass("inputBoxTD") if ($(".mrEdit").next().next().children().attr("type") == "checkbox"){$(".mrEdit").next().next().next().addClass("exclusiveUnderText")} // COLOR THEME $("head").append(""); //$(".mrGridQuestionText").parent().addClass("firstRowGrid"); if ($(".qst tr:first-child").find(".mrGridQuestionText .mrQuestionText").text() != ""){ $(".qst tr:first-child:not(:has(.mrEdit))").addClass("firstRowGrid"); $(".qst tr:first-child:not(:has(.mrEdit))").closest("table").addClass("unstackable") } if($(window).width() <= 550){ var cccnt = 0; var grTxt; $(".mrQuestionTable .mrGridQuestionText .mrQuestionText").each(function(){ cccnt ++; grTxt = $(this).html() console.log(grTxt) $(".mrQuestionTable td.mrGridCategoryText").each(function(){ $(this).css("font-weight","bold") $(this).parent().find("td").eq(cccnt).append(grTxt.replace("
    "," - ")) }); }); $("input[type=checkbox],input[type=radio]").closest("td").css("text-align","left") $("input[type=checkbox],input[type=radio]").closest("td").click(function(){ $(this).find("input[type=checkbox],input[type=radio]").iCheck("toggle") }); }; $(".mrQuestionText").parent().not("label").addClass("gridCatText"); $(".gridCatText").eq(1).prevAll("br").remove() //$(".mrQuestionText").unwrap() /* NEW ---- Before ---- FUNCTIONS */ var qstName,addBefore $("before").each(function(){ addBefore = $(this).html() qstName = $(this).attr("class") $(".mrEdit:visible").each(function(){ if ($(this).attr("name").indexOf(qstName) != -1) { $(this).closest(".form-group").addClass("input-group") $(this).before(""+addBefore+"") } }); }); /* NEW ---- AFTER ---- FUNCTIONS */ var qstName,addAfter $("after").each(function(){ addAfter = $(this).html() qstName = $(this).attr("class") $(".mrEdit:visible").each(function(){ if ($(this).attr("name").indexOf(qstName) != -1) { $(this).closest(".form-group").addClass("input-group") $(this).after(""+addAfter+"") } }); }); //SETTING THE CATI QUESTION $("cati").parent().parent().next().next().children().addClass("CatiLayout") $(".containItem").parent().parent().addClass("templateUL") $(".CatiLayout .containItem span").hide() $(".CatiLayout").removeClass("templateUL") $("typ").each(function(){ if ($(this).text() == "long"){ qst($(this).attr("id")).find(".mrEdit").attr({"type":"number","step":"any"}) } }); $(".myLoadingDiv").hide(); // DROPDOWNS if ($("dropRequest").length) { $("dropRequest").each(function(){ }); } /**************************** CUSTOM BLOCK ************************/ qst("PersonalInfoCat").hide() if (!$(".startint").length){ $(".float-right").append('') } $(".mrOtherEdit").focus(function(){ $(this).closest(".containItem").find("input").iCheck("check") }); $(".terminate").click(function(e){ qst("PersonalInfoCat").find("input").iCheck("check") $("#terminateModal .modal-footer").css("text-align","center") $("#terminateModal .modal-body").html(qst("PersonalInfoCat").html()) $("#terminateModal .modal-body .icheckbox_square-green").hide() $(".inputBoxTD").prev("label").hide() $(".form-group").prev("label").hide() $("#terminateModal .modal-body textarea").text("").val("") $("#terminateModal .modal-body .form-group").width("100%") $("#terminateModal").modal({ backdrop: 'static', keyboard: false // to prevent closing with Esc button (if you want this too) }) $("#terminateModal .termbutton").click(function(){ qst("PersonalInfoCat").find(".mrOtherEdit").val($("#terminateModal .modal-body textarea").val()) $(".mrNext").click() }); }); //$('#myModal').modal({backdrop: 'static', keyboard: false}) qst("NextMedication").hide() qst("NextTreatement").hide() if (qst("Species").length){ $(".mrQuestionText:eq(1)").remove() //qst("Age").find(".col-sm-12").removeClass("col-sm-12").addClass("col-sm-3") //qst("Gender").find(".col-sm-12").removeClass("col-sm-12").addClass("col-sm-3") //qst("SpayedNeutered").find(".col-sm-12").removeClass("col-sm-12").addClass("col-sm-3") //qst("Weight").find(".col-sm-12").removeClass("col-sm-12").addClass("col-sm-3") if (qst("Species").containsAny("Dog,Cat")){ qst("Breeds").showEmpty() qst("OtherAnimal").hideFill() } else { qst("Breeds").hideFill() qst("OtherAnimal").showEmpty() } if (qst("Species").containsAny("Dog")){ var Animal = "Dog" initAutofill(Animal) } if (qst("Species").containsAny("Cat")){ var Animal = "Cat" initAutofill(Animal) } $("input[type=radio]").on('ifChecked', function(event){ if (qst("Species").containsAny("Dog,Cat")){ qst("Breeds").showEmpty() qst("OtherAnimal").hideFill() $("[name='_Q_DDynamicPage_QSmallA_QOtherAnimal_QAnimalType_XDK']").iCheck("uncheck") } else { qst("Breeds").hideFill() $("[name='_Q_DDynamicPage_QSmallA_QBreeds_QBreed_XDK']").iCheck("uncheck") qst("OtherAnimal").showEmpty() } if (qst("Species").containsAny("Dog")){ var Animal = "Dog" initAutofill(Animal) } if (qst("Species").containsAny("Cat")){ var Animal = "Cat" initAutofill(Animal) } }); var InserFromCat = ["Species"]; for (var iter = 0; iter < InserFromCat.length; iter++) { LabelInsCategorical(InserFromCat[iter]) } $("labelinscateg").html("" + $("label[for='"+qst("Species").find("input:checked").attr("id")+"'] .mrSingleText").text() + "") if (qst("Species").containsAny("Dog")){ var GermanTag = "des" var HundES = "es" } if (qst("Species").containsAny("Cat")){ var GermanTag = "der" var HundES = "" } if (typeof(DEU)!= "undefined"){ $("labelinscateg").html(GermanTag + " " + $("label[for='"+qst("Species").find("input:checked").attr("id")+"'] .mrSingleText").text() + HundES + "") }; if (qst("Breeds").length){ $( "[name*='_QSmallA_QBreeds_QBreed']").focusout(function(){ $(this).val("") }); if (qst("Breeds").containsAny("DK")){ qst("Breeds").find(".inputBoxTD").eq(1).showEmpty() } else {qst("Breeds").find(".inputBoxTD").eq(1).hideFill()} if (!(qst("Breeds").containsAny("DK"))){ qst("Breeds").find(".inputBoxTD").eq(1).hideFill() } else {qst("Breeds").find(".inputBoxTD").eq(1).showEmpty()} $("input[type=checkbox]").on('ifChecked', function(event){ if (qst("Breeds").containsAny("DK")){ qst("Breeds").find(".inputBoxTD").eq(1).showEmpty() } else {qst("Breeds").find(".inputBoxTD").eq(1).hideFill()} }); $("input[type=checkbox]").on('ifUnchecked', function(event){ if (!(qst("Breeds").containsAny("DK"))){ qst("Breeds").find(".inputBoxTD").eq(1).hideFill() } else {qst("Breeds").find(".inputBoxTD").eq(1).showEmpty()} }); $("#_Q3_Q0").closest(".inputBoxTD").css("display","inline-block") $("#_Q3_Q0").closest(".form-group").css("width","100px") $("#_Q3_Q0").parent().parent().next().remove() $("#_Q3_Q1").closest(".inputBoxTD").css("display","inline-block") $("#_Q3_Q1").closest(".form-group").css("width","100px") $(".panel").css("margin-bottom","0") } qst("Weight").find(".input-group").css("width","150px") if (qst("OtherAnimal").length){ $( "[name*='_QAnimalType']").focusout(function(){ $(this).val("") }); $(".myLoadingDiv").show() ///////////////////////// $.post( "https://dataexpert.hu/Kynetec/dvet/getlist.php",{type:"OtherAnimal"}, function( data ) { $("body").append(data) $( "[name*='_QAnimalType']").autocomplete({ lookup: OtherAnimal, lookupLimit: 100, minChars:0 }); }); ///////////////////////// $(".myLoadingDiv").hide() if (qst("OtherAnimal").containsAny("DK")){ qst("OtherAnimal").find(".inputBoxTD").eq(1).showEmpty() } else {qst("OtherAnimal").find(".inputBoxTD").eq(1).hideFill()} if (!(qst("OtherAnimal").containsAny("DK"))){ qst("OtherAnimal").find(".inputBoxTD").eq(1).hideFill() } else {qst("OtherAnimal").find(".inputBoxTD").eq(1).showEmpty()} $("input[type=checkbox]").on('ifChecked', function(event){ if (qst("OtherAnimal").containsAny("DK")){ qst("OtherAnimal").find(".inputBoxTD").eq(1).showEmpty() } else {qst("OtherAnimal").find(".inputBoxTD").eq(1).hideFill()} }); $("input[type=checkbox]").on('ifUnchecked', function(event){ if (!(qst("OtherAnimal").containsAny("DK"))){ qst("OtherAnimal").find(".inputBoxTD").eq(1).hideFill() } else {qst("OtherAnimal").find(".inputBoxTD").eq(1).showEmpty()} }); $(".panel").css("margin-bottom","0") } } if ($(".AlwaysOnTop").length){ $(".AlwaysOnTop").css("padding","0px 0px 7px") $(".AlwaysOnTop").css("font-size","1.4em") } /*if (qst("Treatment").length){ $(".row-fluid,.content_container,.nav,.statusBar").css("max-width","1260px") };*/ }); // CUSTOM KEY FUNCTIONS var gridTextArr,cntGrid $(window).load(function() { window.addEventListener('orientationchange', doOnOrientationChange); $(window).keydown(function(event){ if(event.which === 13 && !$(event.target).is("textarea")) { event.preventDefault(); $(".mrNext2").click() return false; } }); $("input").keydown(function (e) { var key = e.which ? e.which : event.keyCode; if (key == 110 || key == 188) { var value = $(this).val(); /*if (!isNaN(value)) { e.preventDefault(); $(this).val(value + "."); }*/ } }); $(".mrNext,.mrPrev").click(function(){ $(".navButtons").fadeOut() }); if(typeof keycodeSupport != 'undefined'){ var lastTXT; $(".mrEdit:not('.mrOtherEdit')").eq(0).focus() $(".mrSingleText").each(function(){ $(this).append(" [" + Number($(".mrSingleText").index(this)+1) + "]") }) $(".mrMultipleText").each(function(){ $(this).append(" [" + Number($(".mrMultipleText").index(this)+1) + "]") }) $("body").keyup(function (e) { if ($(e.target).hasClass('mrEdit')) { return false; } var key = e.which ? e.which : event.keyCode; if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) { var value = e.key || String.fromCharCode(e.keyCode); if (value > 0){ $("input[type=radio]").eq(value-1).iCheck("toggle") $("input[type=checkbox]").eq(value-1).iCheck("toggle") } } }); } }); $(window).load(function(){ //$(".myLoadingDiv").hide(); // DO NOT TOUCH ! //splitMobileGrid.call(); }); function initAutofill(AnimalText){ $(".myLoadingDiv").show() $.post( "https://dataexpert.hu/Kynetec/dvet/getlist.php",{type:AnimalText}, function( data ) { $(".animal").remove() $("body").append(data) //alert("itta hiba") $( "[name='_Q_DDynamicPage_QSmallA_QBreeds_QBreed']").autocomplete({ lookup: eval(AnimalText), lookupLimit: 100, minChars:0 }); }); ///////////////////////// $(".myLoadingDiv").hide() } function LabelInsCategorical (InserFromCat){ qst(InserFromCat).find("input").on('ifChecked', function(event){ if (qst(InserFromCat).containsAny("OtrosEspecificar")){ qst(InserFromCat).find("input[type=text]").keyup(function(){ $("labelinscateg").html("" + $(this).val() + "") }); } else { $("labelinscateg").html("" + $("label[for='"+$(this).attr("id")+"'] .mrSingleText").text() + "") } if (qst("Species").containsAny("Dog")){ var GermanTag = "des" var HundES = "es" } if (qst("Species").containsAny("Cat")){ var GermanTag = "der" var HundES = "" } if (typeof(DEU)!= "undefined"){ $("labelinscateg").html(GermanTag + " " + $("label[for='"+$(this).attr("id")+"'] .mrSingleText").text() + HundES + "") }; }); $(window).load(function(){ $("labelinscateg").html("" + $("label[for='"+qst("Species").find("input:checked").attr("id")+"'] .mrSingleText").text() + "") if (qst("Species").containsAny("Dog")){ var GermanTag = "des" var HundES = "es" } if (qst("Species").containsAny("Cat")){ var GermanTag = "der" var HundES = "" } if (typeof(DEU)!= "undefined"){ $("labelinscateg").html(GermanTag + " " + $("label[for='"+qst("Species").find("input:checked").attr("id")+"'] .mrSingleText").text() + HundES + "") }; }) } function replaceASCII(variable){ variable = variable.replace(/&/g, '&'); console.log(variable) } function openNav() { if (document.getElementById("debugside").style.width == "250px"){ document.getElementById("debugside").style.width = "0"; document.getElementById("full").style.marginLeft = "0"; }else{ document.getElementById("debugside").style.width = "250px"; document.getElementById("full").style.marginLeft = "250px"; } } function closeNav() { document.getElementById("debugside").style.width = "0"; document.getElementById("full").style.marginLeft = "0"; } function qst(QuestionNameInDimensions){ if (typeof QuestionNameInDimensions === 'undefined'){ return $(".qst:visible") }else{ return $(".qst[id$='Q"+QuestionNameInDimensions+"']") } } function doOnOrientationChange() { switch(window.orientation) { case -90: case 90:location.reload();break;default:location.reload();break; } } function containsAny(qst,elements){ var e,i,contains; e = elements.split("/"); for (i = 0; i < e.length; i++) { if (qst.find("[name$='" + e[i] + "']").prop("checked") == true){ return true } } return false } function SideBySide(qstLeft,qstRight){ if (qst(qstLeft).length){ qst(qstLeft).find(".col-sm-12").removeClass("col-sm-12").addClass("col-sm-6") //qst(qstRight).prev().remove() if (qst(qstRight).prev().prev().prop("tagName") == "HR") qst(qstRight).prev().prev().hide() qst(qstRight).find(".col-sm-12").removeClass("col-sm-12").addClass("col-sm-6") if (qst(qstLeft).find(".panel-heading").height() !== qst(qstRight).find(".panel-heading").height()){ qst(qstRight).find(".panel-heading").height(qst(qstLeft).find(".panel-heading").height()) } } } function showError(errorText){ $("#myModal .modal-title").html(errorText) $('.errormodal').modal('show'); } ////////////////////////////////////// //CUSTOM FUNCTION LIBRARY ////////////////////////////////////// jQuery.fn.extend({ containsAny: function (elements) { var e,i,contains; e = elements.split(","); for (i = 0; i < e.length; i++) { if ($(this).find("[name$='" + e[i] + "']").length){ if ($(this).find("[name$='" + e[i] + "']").prop("checked") == true){ return true } }else{ //RADIO if ($(this).find("[value$='" + e[i] + "']").prop("tagName") == "INPUT"){ if ($(this).find("[value$='" + e[i] + "']").prop("checked") == true){ return true } } //DROPDOWN if ($(this).find("[value$='" + e[i] + "']").prop("tagName") == "OPTION"){ if ($(this).find("[value$='" + e[i] + "']").is(":selected")){ return true } // } } } return false }, loopCat: function (category) { return $(this).find("input[name*='_Q"+category+"_']") }, label: function(){ return $("[for='"+$(this).attr("id")+"'").html() }, checkSingle: function(el){ $(this).find("[value$='" + el + "']").iCheck("check") }, hideFill: function(){ if ($(this).find(".mrSingle,.mrMultiple").length && !$(this).find(".mrEdit").not(".mrOtherEdit").length){ if ($(this).find(".mrSingle:checked,.mrMultiple:checked").length == 0){ $(this).find(".mrSingle,.mrMultiple").eq(0).iCheck("check") $(this).find(".mrSingle,.mrMultiple").eq(0).addClass("weCheckedIt") } $(this).hide() } if ($(this).find(".mrEdit").not(".mrOtherEdit").length && !$(this).find(".mrSingle,.mrMultiple").length){ $(this).find(".mrEdit").eq(0).val(1234) $(this).hide() } if ($(this).find(".mrEdit").not(".mrOtherEdit").length && $(this).find(".mrSingle,.mrMultiple").length){ $(this).find(".mrEdit").eq(0).val(1234) $(this).hide() } }, showEmpty: function(){ if ($(this).find(".mrSingle,.mrMultiple").length){ if ($(this).find(".weCheckedIt").length > 0){ $(this).find(".weCheckedIt").eq(0).iCheck("uncheck") $(this).find(".weCheckedIt").removeClass("weCheckedIt") } $(this).show() } if ($(this).find(".mrEdit").not(".mrOtherEdit").length){ if ($(this).find(".mrEdit").val() == 1234) $(this).find(".mrEdit").eq(0).val("") $(this).show() } } });