Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EJS.ext = '.txt';
- var deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
- $(window).resize(function () {
- deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
- if (deviceWidth < 480) {
- mobilePortraitMode();
- } else {
- mobileLandscapeMode();
- }
- });
- /* DOM ready */
- $(document).ready(function () {
- $("#search .search").click(function () {
- if ($(this).val() == "Chcem nájsť" || $(this).val() == "I want to find") $(this).val("");
- });
- $("#search input.search").keyup(function () {
- ajxLoad();
- });
- calendarFunctions();
- if ($(".lbtDeleteProfile").length > 0) {
- var dopostback = $(".lbtDeleteProfile").attr("href").replace("javascript:", "");
- var message = 'Skutočne chcete zneplatniť svôj profil?';
- $(".lbtDeleteProfile").attr("href", "#");
- $(".lbtDeleteProfile").click(function () {
- var r = confirm(message);
- if (r == true) {
- eval(dopostback);
- } else {
- return false;
- }
- });
- }
- });
- $("body").append("<a href=\"#\" id=\"linkTop\" class=\"backtotop\"><span></span></a>");
- $(".backtotop").addClass("hidden");
- $(window).scroll(function () {
- if ($(this).scrollTop() === 0) {
- $(".backtotop").addClass("hidden")
- } else {
- $(".backtotop").removeClass("hidden")
- }
- });
- $('#linkTop').click(function () {
- $('body,html').animate({
- scrollTop: 0
- }, 200);
- return false;
- });
- $(".contentTabs.autoTab").each(function () {
- var thisObj = $(this),
- mainTabsHeading = thisObj.find("h2.tabHeading"),
- mainTabs = thisObj.find(".mainTab"),
- subTabs = thisObj.find(".subTab");
- if (subTabs.size() != 0) subTabs.hide().eq(0).show();
- heading = new EJS({ url: '/Scripts/Templates/main_tabs_heading.txt' }).render(mainTabsHeading);
- mainTabsHeading.remove();
- thisObj.prepend(heading);
- mainTabs.each(function (index) {
- var thisMainTab = $(this);
- var subTabsHeading = thisMainTab.find("h3.tabHeading");
- if (index == 0) {
- thisMainTab.show();
- } else {
- thisMainTab.hide();
- }
- subHeading = new EJS({ url: '/Scripts/Templates/sub_tabs_heading.txt' }).render(subTabsHeading);
- //subTabsHeading.remove();
- thisMainTab.prepend(subHeading);
- });
- attachTabsEvent(thisObj);
- setTabs(thisObj);
- myAnchorSel();
- });
- //vybratie otvoreneho TABu podla anchoru v linke
- function myAnchorSel() {
- myAnchor = window.location.hash.split('#T')[1];
- if (myAnchor != undefined) {
- $(".contentTabs.autoTab ul.mainTabsNavi li").removeClass("selected")
- $(".contentTabs.autoTab ul.mainTabsNavi li").each(function (index) {
- if (index == myAnchor) {
- $(this).addClass("selected");
- $(".contentTabs .mainTab").hide();
- $(".contentTabs .mainTab").eq($(this).index()).show();
- }
- })
- }
- }
- // ocislovanie liniek podla poradia TAB - priradenie anchoru
- $(".contentTabs.autoTab.anchorList ul.mainTabsNavi li").each(function (index) {
- $(this).find("a").attr("href", $(this).find("a").attr("href") + "#T" + index)
- })
- function attachTabsEvent(wrapperObj) {
- wrapperObj.find(".mainTabsNavi li").click(function () { var thisObj = $(this); setTabs(wrapperObj, thisObj, false) });
- wrapperObj.find(".subTabsNavi li").click(function () { var thisObj = $(this); setTabs(wrapperObj, thisObj, true) });
- wrapperObj.find(".tabHeading").click(function () { var thisObj = $(this); setTabs(wrapperObj, thisObj, true) });
- }
- function setTabs(wrapperObj, sourceEvt, isSubTab) {
- var firstLoad = false;
- if (sourceEvt == undefined) { firstLoad = true }
- var mainTabsContent = wrapperObj.find(".mainTab");
- var mainTabs = wrapperObj.find(".mainTabsNavi li");
- var mainTabsContent = wrapperObj.find(".mainTab");
- if (!firstLoad) {
- if (!isSubTab) {
- mainTabs.removeClass("selected");
- mainTabs.eq(sourceEvt.index()).addClass("selected");
- }
- }
- if (isSubTab != undefined && isSubTab) {
- var subTabs = wrapperObj.find(".mainTab:visible .subTabsNavi li");
- var tabHeading = wrapperObj.find(".mainTab:visible .tabHeading");
- subTabs.removeClass("selected");
- tabHeading.removeClass("selected");
- if (sourceEvt.hasClass("tabHeading")) {
- var index = 0;
- if (sourceEvt.index() == 1) {
- index = 0;
- } else if (sourceEvt.index() == 3) {
- index = 1;
- } else if (sourceEvt.index() == 5) {
- index = 2;
- }
- subTabs.eq(index).addClass("selected");
- tabHeading.eq(index).addClass("selected");
- } else {
- subTabs.eq(sourceEvt.index()).addClass("selected");
- tabHeading.eq(sourceEvt.index()).addClass("selected");
- }
- }
- var mainTabSelectedIndex = wrapperObj.find(".mainTabsNavi li.selected").index();
- mainTabsContent.hide();
- mainTabsContent.eq(mainTabSelectedIndex).show();
- var subTabSelectedIndex = wrapperObj.find(".mainTab:visible .subTabsNavi li.selected").index();
- var subTabsContent = wrapperObj.find(".mainTab:visible .subTab");
- subTabsContent.hide();
- subTabsContent.eq(subTabSelectedIndex).show();
- if (deviceWidth < 480) {
- mobilePortraitMode();
- } else {
- mobileLandscapeMode();
- }
- }
- function mobilePortraitMode() {
- var subTabsNavi = $(".subTabsNavi");
- var tabHeading = $(".tabHeading");
- if (subTabsNavi.size() != 0) {
- subTabsNavi.hide();
- tabHeading.show();
- }
- }
- function mobileLandscapeMode() {
- var subTabsNavi = $(".subTabsNavi");
- var tabHeading = $(".tabHeading");
- if (subTabsNavi.size() != 0) {
- subTabsNavi.show();
- tabHeading.hide();
- }
- }
- /* search */
- function hidePharmPanel(ev) {
- if (ev.target != $(".findPharmPanel").get(0) && $(ev.target).parents(".findPharmPanel").size() == 0) {
- $("#search_out").html("");
- }
- }
- function ajxLoad() {
- $.ajax({
- url: "/Modules/InformationContent/Web/Search_suggest.aspx" + "?s=" + $("#search input.search").val(),
- dataType: "html",
- //data: data,
- success: function (data) {
- $("#search_out").html(data)
- $("#search_out ul li").click(function (ev) {
- ev.stopPropagation();
- $("body").unbind("click", hidePharmPanel);
- $("#search input.search").val($(this).html())
- $("#search_out").html("");
- });
- $("body").one("click", hidePharmPanel);
- }
- });
- }
- /* kalendare */
- function calendarFunctions() {
- $(".datepicker").datepicker({
- date: $('.datepicker').val(),
- current: $('.datepicker').val()
- });
- $(".datepicker.from").datepicker({
- date: $('.datepicker.from').val(),
- current: $('.datepicker.from').val()
- });
- $(".datepicker.to").datepicker({
- date: $('.datepicker.to').val(),
- current: $('.datepicker.to').val()
- });
- $.datepicker.regional['sk'] = {
- closeText: 'Zavrieť',
- prevText: '<Predchádzajúci',
- nextText: 'Nasledujúci>',
- currentText: 'Dnes',
- monthNames: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún',
- 'Júl', 'August', 'September', 'Október', 'November', 'December'],
- monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún',
- 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
- dayNames: ['Nedeľa', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'],
- dayNamesShort: ['Ned', 'Pon', 'Uto', 'Str', 'Štv', 'Pia', 'Sob'],
- dayNamesMin: ['Ne', 'Po', 'Ut', 'St', 'Št', 'Pia', 'So'],
- weekHeader: 'Ty',
- dateFormat: 'd.m.yy',
- firstDay: 1,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''
- };
- $.datepicker.regional['en'] = {
- dateFormat: 'm.d.yy',
- firstDay: 7,
- isRTL: false,
- showMonthAfterYear: false,
- yearSuffix: ''
- };
- $.datepicker.setDefaults($.datepicker.regional[$("html").attr("lang")]);
- }
- function createLocalitySelector() {
- var localityWrapper = $("#localitySelector");
- var selectedLocality = $(".selectedLocality");
- $("#localitySelector input").hide();
- var selector = "<div id='selector'><input type='text' value='" + selectedLocality.text() + "' data-defaultval='" + selectedLocality.text() + "' /></div>"
- localityWrapper.append(selector);
- $("#selector input").focus(function () {
- if ($(this).val() == $(this).data("defaultval")) {
- $(this).val("");
- }
- });
- $("#selector input").blur(function () {
- if ($(this).val() == "" || $(this).val() == $(this).data("defaultval")) {
- $(this).val($(this).data("defaultval"));
- }
- window.setTimeout(function () {
- $("#selector input").removeClass("openSelector");
- $("#selector ul").remove();
- }, 200);
- });
- $("#selector input").keyup(function (event) {
- var thisElm = $(this);
- $.ajax({
- url: "/AutoCompleteLocality.axd",
- dataType: "json",
- type: "POST",
- data: { LookupPrefix: thisElm.val(), TotalResults: 20, LangId: langGuid },
- success: function (data) {
- $("#selector input").removeClass("openSelector");
- $("#selector ul").remove();
- resultsList = new EJS({ url: '/Scripts/Templates/locality_selector_items.txt' }).render(data);
- $("#selector").append(resultsList);
- if (data.length > 0) {
- $("#selector input").addClass("openSelector");
- $("#selector li a").click(function () {
- var thisLink = $(this);
- $.ajax({
- url: "/SetUserLocality.axd",
- dataType: "json",
- type: "POST",
- data: { UserLocality: thisLink.find("span").text() },
- success: function (dataSave) {
- if (dataSave) {
- $("#selector input").val(thisLink.find("span").text());
- $("#selector input").data("defaultval", thisLink.find("span").text())
- $("#selector ul").remove();
- $("#selector input").removeClass("openSelector");
- } else {
- $("#selector input").val($("#selector input").data("defaultval"));
- $("#selector ul").remove();
- $("#selector input").removeClass("openSelector");
- }
- }
- });
- return false;
- });
- }
- }
- });
- });
- }
- createLocalitySelector();
- if ($(".base-list").size() != 0) {
- var listElm = $(".base-list dd");
- listElm.hide();
- listElm.each(function () {
- var thisElm = $(this);
- thisElm.prev().find(".countRows").text($("li", thisElm).size());
- });
- $(".base-list .btn-opn").css({ "display": "block" });
- $(".base-list .txt-open").click(function () {
- var thisElm = $(this);
- thisElm.parent().parent().next().slideDown('fast', function () {
- thisElm.parent().removeClass("btn-opn").addClass("btn-close");
- });
- });
- $(".base-list .txt-close").click(function () {
- var thisElm = $(this);
- thisElm.parent().parent().next().slideUp('fast', function () {
- thisElm.parent().removeClass("btn-close").addClass("btn-opn");
- });
- });
- }
- $("span.elementInfo").hover(function () {
- var el = $(this);
- if ($("#tooltipWrp").size() == 0) {
- var $tooltipWrp = $("<div id='tooltipWrp'><span class='arrow'></span></div>").appendTo("body");
- }
- // Validation messages
- var $messages = el.text();
- var imgOffset = el.offset();
- var imgWidth = el.width();
- var imgHeight = el.height();
- if ($tooltipWrp != undefined) {
- $tooltipWrp
- .append($messages)
- .css({
- top: imgOffset.top,
- left: imgOffset.left + imgWidth
- })
- .show();
- }
- }, function () {
- $("#tooltipWrp").remove();
- });
- $(document).ready(function () {
- $(this).find('.institutionMap').each(function (k, v) {
- var thisElm = $(this);
- setTimeout(function () { //casove oneskorenie z dovodu max. 10 dotazov na GOOGLE MAPS! za 1 sekundu
- var parentElm;
- if (thisElm.hasClass("secondMap")) {
- console.log("druha");
- parentElm = $(thisElm).parent().parent();
- }
- else {
- console.log("prva");
- parentElm = thisElm.parent();
- }
- var latInst = parentElm.find("span.lat").html();
- var lonInst = parentElm.find("span.lon").html();
- var street = parentElm.find(".street").text();
- var city = parentElm.find(".city").text();
- var cityHead = parentElm.find(".cityHead").text(); // pri detaile obce
- var state = ", Slovensko";
- //default krajina SK, pre medzinarodne institucie bez krajiny
- if (window.location.href.slice(-36) == "8ebd2e18-14e0-4afb-8b09-130e63016ca3" || window.location.href.slice(-36) == "59e632c8-b70a-43fc-ba96-c8c15c0c0036") {
- state = "";
- }
- var institution = parentElm.find("h3").text();
- var lokalitaUrad = { 'address': street + ', ' + city + state }; //upravne aj pre obce - vsetky SK
- var markerss = [];
- if (latInst == null || latInst == "") {
- if (cityHead != "") //ak nie su suradnice, len nazov obce
- {
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 11
- });
- var geocoder = new google.maps.Geocoder();
- geocoder.geocode({
- 'address': cityHead + state
- }, function (results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- new google.maps.Marker({
- position: results[0].geometry.location,
- map: map
- });
- map.setCenter(results[0].geometry.location);
- }
- });
- }
- else if (city != "") //ak nie su suradnice, ale je adresa
- {
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 15
- });
- var geocoder = new google.maps.Geocoder();
- geocoder.geocode({
- 'address': street + ", " + city + state
- }, function (results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- new google.maps.Marker({
- position: results[0].geometry.location,
- map: map
- });
- map.setCenter(results[0].geometry.location);
- }
- });
- }
- else {
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 6,
- center: new google.maps.LatLng(48.652871, 19.233856)
- });
- geoCode(map, lokalitaUrad);
- }
- }
- else {
- var mapcenter = new google.maps.LatLng(parseFloat(latInst.replace(",", ".")), parseFloat(lonInst.replace(",", ".")));
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 16,
- center: mapcenter
- });
- var marker = new google.maps.Marker({
- position: mapcenter,
- map: map,
- title: institution
- });
- }
- }, k * 140);
- });
- /*
- $(".institutionMap").each(function (index) {
- var thisElm = $(this);
- var parentElm = thisElm.parent();
- var latInst = parentElm.find("span.lat").html();
- var lonInst = parentElm.find("span.lon").html();
- var street = parentElm.find(".street").text();
- var city = parentElm.find(".city").text();
- var cityHead = parentElm.find(".cityHead").text(); // pri detaile obce
- var state = ", Slovensko";
- //default krajina SK, pre medzinarodne institucie bez krajiny
- if (window.location.href.slice(-36) == "8ebd2e18-14e0-4afb-8b09-130e63016ca3" || window.location.href.slice(-36) == "59e632c8-b70a-43fc-ba96-c8c15c0c0036") {
- state = "";
- }
- var institution = parentElm.find("h3").text();
- var lokalitaUrad = { 'address': street + ', ' + city + state }; //upravne aj pre obce - vsetky SK
- var markerss = [];
- if (latInst == null || latInst == "") {
- if (cityHead != "") //ak nie su suradnice, len nazov obce
- {
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 11
- });
- var geocoder = new google.maps.Geocoder();
- geocoder.geocode({
- 'address': cityHead + state,
- }, function (results, status) {
- if(status == google.maps.GeocoderStatus.OK) {
- new google.maps.Marker({
- position: results[0].geometry.location,
- map: map
- });
- map.setCenter(results[0].geometry.location);
- }
- });
- }
- else if (city != "") //ak nie su suradnice, ale je adresa
- {
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 15
- });
- var geocoder = new google.maps.Geocoder();
- geocoder.geocode({
- 'address': street + ", " + city + state,
- }, function (results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- new google.maps.Marker({
- position: results[0].geometry.location,
- map: map
- });
- map.setCenter(results[0].geometry.location);
- }
- });
- }
- else{
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 6,
- center: new google.maps.LatLng(48.652871, 19.233856)
- });
- geoCode(map, lokalitaUrad);
- }
- }
- else {
- var map = new google.maps.Map(thisElm.get(0), {
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- streetViewControl: false,
- zoom: 11,
- center: new google.maps.LatLng(latInst.replace(",", "."), lonInst.replace(",", "."))
- });
- var marker = new google.maps.Marker({
- position: new google.maps.LatLng(latInst.replace(",", "."), lonInst.replace(",", ".")),
- map: map,
- title: institution
- });
- }
- });*/
- function geoCode(map, mapData) {
- var geocoder = new google.maps.Geocoder();
- geocoder.geocode(mapData, function (results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- var positionMarkerLat = results[0].geometry.location.lat();
- var positionMarkerLng = results[0].geometry.location.lng();
- var marker = new google.maps.Marker({
- position: new google.maps.LatLng(positionMarkerLat, positionMarkerLng),
- map: map
- });
- if (typeof (map) != "undefined") {
- map.setCenter(new google.maps.LatLng(positionMarkerLat, positionMarkerLng));
- } else {
- alert("Sa mi neda vycentrovat!");
- }
- }
- });
- }
- });
- $(document).ready(function () {
- $(window).resize(function () {
- var mainTabHeight = $(".mainTab .pertinentDocList .listDocument").height();
- if (deviceWidth > 480) {
- $(".pertinentDocList").height(mainTabHeight);
- }
- });
- if ($(".documentLinkList").size() != 0) {
- var mainTabHeight = $(".documentLinkList").outerHeight();
- var pertinentDocList = $(".pertinentDocList").text().trim().length;
- var listHeight = $(".mainTab .pertinentDocList .listDocument").height();
- if (deviceWidth > 480) {
- if (pertinentDocList > 0) {
- $(".pertinentDocList").height(listHeight);
- }
- else {
- $(".pertinentDocList").height(mainTabHeight);
- }
- }
- }
- $('.blog .list.action tr').click(function () {
- $(".blog .list.action tr.actionList").addClass("hiddenElm");
- $(this).next(".actionList").removeClass("hiddenElm");
- });
- categoryList();
- removeTextFromDocumentList();
- });
- function categoryList() {
- $(".articleCategoryList li").mouseenter(function () {
- $(this).parent().css("overflow", "visible");
- $(".articleCategoryList li:first-child").addClass("noArr");
- })
- .mouseleave(function () {
- $(this).parent().css("overflow", "hidden");
- $(".articleCategoryList li:first-child").removeClass("noArr");
- });
- }
- function removeTextFromDocumentList() {
- $(".document .listDocument dd span").each(function () {
- if (!$(this).text().trim().length) {
- $(this).parent().css("display", "none");
- }
- });
- }
- $(document).ready(function () {
- $('#institution .itemDetail .openHour').click(function () {
- $('#g' + $(this).attr("id") + " .openHours").removeClass("novsb")
- $('#g' + $(this).attr("id") + " .openHour").hide()
- })
- $('#institution .itemDetail .openHours').addClass("novsb")
- $('#institution .itemDetail .openHour').removeClass("novsb")
- $('#petition .list.action tr').click(function () {
- $("#petition .list.action tr.actionList").addClass("hiddenElm")
- $(this).next(".actionList").removeClass("hiddenElm")
- })
- })
- $(function () {
- $(".contentNotice dl:nth-child(4)").css("padding", "0px");
- $(".contentNotice dl:nth-child(7)").css("padding", "0px");
- $('.institutionDetailWrapp').css("visibility", "hidden");
- setTimeout(function () {
- $('.institutionDetailWrapp').hide();
- $('.institutionDetailWrapp').css("visibility", "visible");
- }, 500);
- $('.institutionDetailBtn').click(function () {
- var rodic = $(this).parents().eq(1),
- detail = $('.institutionDetailWrapp'),// najdeme rodica, co je element u uroven vyssie, ktory obsahuje element, na ktory sme klikli
- vyrok = $(this).parents().eq(1).find(detail); // vyrok je element nasledujuci po tom, na ktory sme pravy klikli
- // v ramci rodica najdeme [ .find() ] vsetky elementy s vyrokmi a skryjeme ich
- rodic.find(detail).slideUp();
- // vysunieme vyrok, ale len v pripade, ze este nie vysunuty, cize nie je viditelny [ .not(':visible') ]
- vyrok.not(':visible').slideDown();
- if (vyrok.is(':visible')) {
- google.maps.event.trigger(window, 'resize', {});
- }
- return false;
- });
- /*tabs-uprava*/
- if ($('.mainTabsNaviLink li a').hasClass('sel')) {
- $('.mainTabsNaviLink li').find('.sel').parent().addClass('selected');
- };
- /*Notice na tit. stranke, odstranenie paddingu na poslednom*/
- $(".contentPnl .noticeBox:nth-child(4)").css("padding-right", "0px");
- $('.contentPnl .noticeBox').last().css('padding-right', '0');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement