PageSourceSearch

https://www.buscocamarero.es/Assets/js/custom.js

js buscocamarero.es collected 2026-10-08 22:57:38 UTC 3,647 bytes, 103 lines download raw bytes

1"use strict";
2
3$(function() {
4    $(document).ready(function () {                
5        $('*[data-autocomplete-url]')
6            .each(function () {
7                $(this).removeAttr("name");
8                $(this).autocomplete({
9                    source: $(this).data("autocomplete-url"),
10                    select: function (event, ui) {
11                        $('#' + event.target.id).val(ui.item.label);
12                        $('#' + event.target.id + "_Value").val(ui.item.value);
13                        $('#' + event.target.id + "_Text").val(ui.item.label);
14                        return false;
15                    },
16                    change: function (event, ui) {
17                        if ($('#' + event.target.id).val() == '') {
18                            $('#' + event.target.id + "_Value").val('');
19                            $('#' + event.target.id + "_Text").val('');
20                        } else {
21                            $('#' + event.target.id).val($('#' + event.target.id + "_Text").val());
22                        }
23                    },
24                    position: { collision: "flip" },
25                    autoFocus: true
26                });
27            });
28
29        $('input[data-val-autocompleterequired]').attr('autocomplete', 'nope');
30
31        $("#Email").change(function (event) {
32            var value = $(this).val();
33            if (value != value.trim())
34                $(this).val(value.trim());
35        });
36        $("#Email").keypress(function(e){
37            var charCode = !e.charCode ? e.which : e.charCode;
38            if(charCode == 32)
39                e.preventDefault();
40        })
41    });
42
43    if ($('body').hasClass('login-page')) {
44        console.log('Resize Login');
45        resizeLogin();
46        $(window).resize(function () {
47            resizeLogin();
48        });
49        $(window).load(function () {
50            resizeLogin();
51        });
52    }
53
54    function resizeLogin() {
55        var body = $('body');
56        var main = $('main');
57        var bar = $('#cookie-bar');
58        if (bar.length == 0) {
59            if ($(window).height() < $('main').height()) {
60                body.addClass('low-height');
61            } else {
62                body.removeClass('low-height');
63            }
64        } else {
65            if ($(window).height() < main.height() + bar.height() * 2 + 40) {
66                body.addClass('low-height');
67                main.css('top', bar.height() + 20 + 'px');
68            } else {
69                body.removeClass('low-height');
70                main.css('top', '');
71            }
72        }
73    }
74});
75
76if ($.validator && $.validator.unobtrusive) {
77    $.validator.unobtrusive.adapters.add("checkboxrequired", function (options) {
78        options.rules["checkboxrequired"] = true;
79        if (options.message) {
80            options.messages["checkboxrequired"] = options.message;
81        }
82    });
83    $.validator.addMethod("checkboxrequired", function (value, element, param) {
84        if (value)
85            return true;
86        else
87            return false;
88    });
89
90    $.validator.unobtrusive.adapters.add("autocompleterequired", function (options) {
91        options.rules["autocompleterequired"] = true;
92        if (options.message) {
93            options.messages["autocompleterequired"] = options.message;
94        }
95    });
96    $.validator.addMethod("autocompleterequired", function (value, element, param) {
97        console.log(element);
98        if (value)
99            return true;
100        else
101            return false;
102    });
103}

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.