; App = { baseUrl: 'https://www.zf.ro', initialise: function () { App.zoom(); App.radio(); if (typeof this.pageName != 'undefined' && typeof this.initors[this.pageName] == 'function') { this.initors[this.pageName](); } if (typeof pageCaptcha != 'undefined' && typeof captcha_initors[pageCaptcha] == 'function') { captcha_initors[pageCaptcha](); } App.menuItemActive(); App.scroller(); //butoane dropdown $(".dropdown-toggle").on("click", function () { // $(this).siblings("ul.dropdown-menu").fadeIn(600); $(this).siblings("ul.dropdown-menu").toggle(200); }); $(".dropdown-menu li a").on("click", function () { $(this).parents("ul.dropdown-menu").fadeOut(200); }); //end butoane dropdown //menu dropdown $(".submenu i").on("click", function () { if ($(this).siblings("ul").is(":visible")) { $(this).siblings("ul").slideUp(300); } else { $(this).siblings("ul").slideDown(300); } }); //end butoane dropdown // buton scrollTop ------------ var butonTop = ""; $("body").append(butonTop); $(window).on('scroll', function () { if ($(window).scrollTop() > window.innerHeight) { if ($("#scrollTop").is(":hidden")) { $("#scrollTop").fadeIn(600); } } else { if ($("#scrollTop").is(":visible")) { $("#scrollTop").fadeOut(600); } } }); $("#scrollTop").on('click', function () { $("html, body").animate({scrollTop: 0}, "slow"); }); // end buton scrollTop ------------ // buton abonare zf ------------ // var butonAbonare = "ABONEAZĂ-TE CU 82% DISCOUNT"; // $("body").append(butonAbonare); //end buton abonare zf --------- // tab ---------------- // if (App.pageName != 'homepage') { App.mostReadNews(); // } // end tab ------------ //curs valutar ---------------------------------------------------------- if (App.pageName == 'homepage' || App.pageName == 'curs-valutar' || App.pageName == 'curs-valutar-valuta') { App.convertor(); }; // process box output // var dataToPass = processCurrencies(valute); $.getScript('/js/valute.js') .done(function (script, textStatus) { var dataToPass = processCurrencies(valute); if (App.pageName == 'curs-valutar-valuta') { var zile = Math.min(valute.length, 300); //istoric valori pe 300 de zile var urls = window.location.pathname.split("/"); var moneda = urls[urls.length - 1]; var istoricValute = getCurrencyValues(valute, zile, moneda); var valutaId = $("#valori-valuta"); var htmlString = ""; istoricValute.reverse(); if (valutaId.length) { htmlString = "
Nu ați selectat nicio optiune!
') } } }); master.on('click', '.jsPollResults', function () { $.ajax({ url: '/ajax?l' + box_id + '&submit=1&itemID=' + poll_id + '&service_type=PollContest&output=results&rnd=' + Math.random(), data: '', success: function (data) { master.html(data); } }); }); master.on('click', '.jsPollForm', function () { $.ajax({ url: '/ajax?i' + box_id + '&item=' + poll_id + '&rnd=' + Math.random(), data: '', success: function (data) { master.html(data); } }); }); } } , convertor: function () { convertorValutar(); } , scroller: function () { $('.scroller').mCustomScrollbar({ mousewheel: { enable: true } }); } , gdprForm: function () { var gdprName = $.cookie("gdprname"); var gdprDate = $.cookie("gdprdate"); if (typeof gdprName !== 'undefined' && gdprName !== null) { var inputId = "#gdpr-name-" + gdprName; $(inputId).prop('checked', true); } if (typeof gdprDate !== 'undefined' && gdprDate !== null) { var inputId = "#gdpr-date-" + gdprDate; $(inputId).prop('checked', true); } if (typeof gdprDate !== 'undefined' && gdprDate !== null) { var inputId = "#gdpr-date-" + gdprDate; $(inputId).prop('checked', true); } $("#gdpr-submit").on("click", function () { var elements = $("input:checked"); if (elements.length >= 2) { elements.each(function (index, elem) { var cname = $(elem).attr("name"); var cvalue = $(elem).attr("class"); $.cookie(cname, cvalue, {expires: 5000, path: "/"}); }) // var ref = String(document.referrer); // var pos = ref.indexOf("/gdpr"); // if(pos !== -1 || ref == "") { // ref = "/"; // } // window.location.href = ref; //window.history.back(); alert("Opțiunile dumneavoastră au fost salvate cu succes!"); close(); } else { var errMsg = 'Nu ați bifat toate căsuțele
'; $(".err-msg").remove(); $(".gdpr-form").append(errMsg); } }) } , generateCurrencyHistory: function (data, days, elem, c1, c2, w, h, bkg, pos) { // data is the initial datatable - resulted from processed // elem is the id of the DOM element to be poplated // c1 and c2 are the columns in datatable, 0 means data var newGraph = []; for (var i = 0; i < data.length; i++) { // for (var i = 0; i < 301; i++) { newGraph[i] = new Array(2); } $.each(data, function (key, value) { if (key == 0) { newGraph[key][0] = data[key][c1]; newGraph[key][1] = data[key][c2]; } else { newGraph[key][0] = data[key][c1]; newGraph[key][1] = parseFloat(data[key][c2]); } }); // var graphHead = newGraph[0]; var head = newGraph.slice(0,1); if(newGraph.length > days + 1) { var slicedGraph = head.concat(newGraph.slice(newGraph.length - days)); } else { var slicedGraph = newGraph; } // slicedGraph.unshift(graphHead); //sa am minim doua valori plus head-ul if(Math.abs(newGraph.length - days) >= 3 ) { google.charts.load('current', { 'packages': ['corechart'], 'language': 'ro' }); google.charts.setOnLoadCallback(drawChart); } function drawChart() { var data = google.visualization.arrayToDataTable(slicedGraph); if (typeof pos == null) { pos = 'none'; } var options = { // title: 'Curs valutar', // is3D: true, curveType: 'function', legend: {position: pos}, // backgroundColor: '#FFF1E6', backgroundColor: bkg, width: w, height: h }; var element = document.getElementById(elem); if (typeof(element) != 'undefined' && element != null) { var chart = new google.visualization.LineChart(element); chart.draw(data, options); } } } , newsletter: function () { if ($("#contact_email").val() != "") { //daca a completat emailul var emailVal = $("#contact_email").val(); var pattern = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-]{2,3}$/; var found = emailVal.match(pattern); if (found == null) { //verific formatul emailului alert("Emailul nu este corect"); return false; } else { if ($("#gdpr:checked").length > 0) { // $.cookie("gdprname", "accept", { expires: 5000, path: "/" }); $.cookie("gdprdate", "accept", {expires: 5000, path: "/"}); $.cookie("nlAb", "abonat", {expires: 5000, path: "/"}); return true; } else { alert("Pentru a vă putea abona la newsletter trebuie să bifați ca sunteți de acord cu politica gdpr"); return false; } } } else { alert("Emailul trebuie completat!"); return false; } } , k1z: function () { $.ajax({ url: "/js/k1z.filters.js", dataType: "script", cache: true }) .done(function (script, textStatus) { $.ajax({ url: "/js/taffy.js", dataType: "script", cache: true }) .done(function (script, textStatus) { initFilters(); }) }) .fail(function (jqxhr, settings, exception) { console.log("Triggered ajaxError handler with k1z.filter."); }); } , autocompleteSearch: function () { $.ajax({ url: "https://code.jquery.com/ui/1.12.1/jquery-ui.js", dataType: "script", cache: "true" }).done(function () { $("", { rel: "stylesheet", type: "text/css", href: "https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" }).appendTo("head"); $("#csearch").autocomplete({ minLength: 0, source: companii, focus: function(event, ui) { $('#csearch').val(ui.item.label); return false; }, select: function(event, ui) { $('#cresults').empty(); $('#cresults').append('