PageSourceSearch

https://samar.es/__bundles/Components.BusSearchForm.bus-search-for…B9A3E7E947368F8F57.js?_v=639256852926819252

js samar.es collected 2026-10-02 07:19:14 UTC 4,854 bytes, 1 lines download raw bytes

1var busSearchForm=busSearchForm||{};busSearchForm.init=function(n){function t(n){return f("#"+g+"-"+n)}function e(){if(c.length){var n=String(t("origin-stop-code").val()||"").trim().length>0,i=String(t("destination-stop-code").val()||"").trim().length>0;c.prop("disabled",!(n&&i))}}function y(n,t,i){function h(n){i&&i.length&&i.val(n||"")}function c(t,i){n.val((t||"").toUpperCase());h(i);e()}function s(n){var i=t.find(".stop-suggestion-item");if(!i.length){r=-1;return}n<0&&(n=0);n>=i.length&&(n=i.length-1);r=n;i.removeClass("stop-suggestion-item--active");f(i.get(r)).addClass("stop-suggestion-item--active")}function u(){t.empty().hide();r=-1}if(n.length&&t.length&&nt){var o="",r=-1;n.on("input",function(){var i=(n.val()||"").toString().trim();if(h(""),e(),i.length<1){u();o="";return}i!==o&&(o=i,samar.public.public.getStopsDropdown(i,10).then(function(n){var i=n||[];if(t.empty(),!i.length){u();return}r=-1;i.forEach(function(n,i){if(n&&n.text){var r=f("<div>").addClass("stop-suggestion-item").text((n.text||"").toUpperCase()).data("stop-text",n.text).data("stop-code",n.value).appendTo(t);i===0&&s(0);r.on("mousedown",function(t){t.preventDefault();c(n.text,n.value);u()})}});t.show()}).catch(function(){u()}))});n.on("keydown",function(n){var i=n.key,e=t.find(".stop-suggestion-item"),o;e.length&&(i==="ArrowDown"?(n.preventDefault(),s(r<0?0:r+1)):i==="ArrowUp"?(n.preventDefault(),s(r<0?0:r-1)):i==="Enter"?r>=0&&r<e.length&&(n.preventDefault(),o=f(e.get(r)),c(o.data("stop-text"),o.data("stop-code")),u()):i==="Escape"&&u())});n.on("blur",function(){setTimeout(function(){u()},150)})}}function tt(){try{var n=abp&&abp.localization&&abp.localization.currentCulture&&abp.localization.currentCulture.cultureName?String(abp.localization.currentCulture.cultureName):"es";return n.split("-")[0]||"es"}catch(t){return"es"}}function w(n){var t=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return t+"-"+i+"-"+r}function it(n){var t,i;return n?(t=String(n).split("-"),t.length!==3)?null:(i=new Date(parseInt(t[0],10),parseInt(t[1],10)-1,parseInt(t[2],10)),isNaN(i.getTime())?null:i):null}function b(n){if(n&&n.length){if(!f.fn.datepicker){n.prop("readonly",!1);return}n.datepicker({autoclose:!0,todayHighlight:!0,weekStart:1,format:"dd/mm/yyyy",language:tt()})}}function h(n,t){var u,i,r,f;if(n.length&&t.length){if(u=n.val()||"",!u){t.val("");return}if(i=null,n.datepicker)try{i=n.datepicker("getDate")}catch(e){i=null}if(i&&!isNaN(i.getTime())){t.val(w(i));return}r=u.split("/");r.length===3&&(f=new Date(parseInt(r[2],10),parseInt(r[1],10)-1,parseInt(r[0],10)),isNaN(f.getTime())||t.val(w(f)))}}function k(n,t){if(n.length&&t.length){var i=it(t.val());i?n.datepicker("setDate",i):n.val("")}}function rt(n){p.length&&(p.toggleClass("is-hidden",!n),!n&&o.length&&(o.val(""),i.length&&i.val("")))}function a(){if(r.length){var n=r.find('input[name="Search.IsOneWay"]:checked').val(),t=String(n)==="true";rt(!t)}}var f=jQuery,d=abp.localization.getResource("Samar"),g=n,nt=window.samar&&samar.public&&samar.public.public&&samar.public.public.getStopsDropdown,r=t("form"),c=r.find('button.search-button[type="submit"]'),s,v;if(y(t("origin-stop"),t("origin-stop-list"),t("origin-stop-code")),y(t("destination-stop"),t("destination-stop-list"),t("destination-stop-code")),r.length){r.on("keydown",function(n){if(n.key==="Enter"&&!n.isDefaultPrevented()){var t=f(n.target);if(t.is("button")||t.closest("button").length){t.closest('button.search-button[type="submit"]').length;return}n.preventDefault();t.is('input[type="checkbox"], input[type="radio"]')&&t.trigger("click")}});r.on("submit",function(n){e();c.prop("disabled")&&n.preventDefault()})}s=t("swap-stops");s.attr({tabindex:0,role:"button","aria-label":d("Public:SwapStopsAriaLabel")});s.on("keydown",function(n){(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),s.click())});s.on("click",function(){var n=t("origin-stop").val(),i=t("destination-stop").val(),r=t("origin-stop-code").val(),u=t("destination-stop-code").val();t("origin-stop").val(i);t("destination-stop").val(n);t("origin-stop-code").val(u);t("destination-stop-code").val(r);e()});var ut=t("outbound-date-select"),p=t("return-date-select"),l=t("outbound-date"),o=t("return-date"),u=t("outbound-date-display"),i=t("return-date-display");if(b(u),b(i),k(u,l),k(i,o),r.length)r.on("change",'input[name="Search.IsOneWay"]',function(){a()});if(u.length&&i.length&&f.fn.datepicker){u.on("changeDate",function(n){if(n&&n.date){h(u,l);i.datepicker("setStartDate",n.date);var t=i.datepicker("getDate");t&&t<n.date&&(i.val(""),o.val(""))}});i.on("changeDate",function(){h(i,o)});u.on("change",function(){h(u,l)});i.on("change",function(){h(i,o)});v=u.datepicker("getDate");v&&i.datepicker("setStartDate",v)}a();e();window.addEventListener("pageshow",function(n){n.persisted&&(a(),e())})};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.