PageSourceSearch

https://www.riverart.com.tw/lib/g/2.0/scripts/artlogic_modules/_ve…/galleries_js/quicksearch.js

js riverart.com.tw collected 2026-10-01 00:29:05 UTC 3,825 bytes, 81 lines download raw bytes

1var quicksearch = {
2
3    init: function() {
4        
5        if ($('.header_quick_search').length) {
6            $('.header_quick_search .inputField')
7                .off()
8                .each(function() {
9                    if ($(this).attr('data-default-value') && !$(this).val()) {
10                        $(this).val($(this).attr('data-default-value'));
11                    }
12                    if ($('.header_quick_search').hasClass('header_quick_search_reveal')) {
13                        //$(this).attr('data-width', '68');
14                        //$(this).width(0);
15                    }
16                })
17                .focus(function(){
18                    if ($(this).val() == $(this).attr('data-default-value')){
19                        $(this).val( '' ).closest('.header_quick_search').addClass('active');
20                        $('#top_nav').addClass('header_quick_search_reveal_open');
21                        $('body').addClass('header_quick_search_open');
22                    }
23                })
24                .blur(function(){
25                    if ($(this).val() == ''){
26                        if ($(this).closest('.header_quick_search').hasClass('header_quick_search_reveal')) {
27                            //$(this).animate({'width': '0'});
28                        }
29                        $(this).val($(this).attr('data-default-value')).closest('.header_quick_search').removeClass('active');
30                        $('#top_nav').removeClass('header_quick_search_reveal_open');
31                        $('body').removeClass('header_quick_search_open');
32                    }
33                })
34            ;
35            $('.header_quick_search .header_quicksearch_btn').click(function() {
36                if (!$(this).closest('.header_quick_search').find('.header_quicksearch_field').val() || $(this).closest('.header_quick_search').find('.header_quicksearch_field').val() == $(this).closest('.header_quick_search').find('.header_quicksearch_field').attr('data-default-value')) {
37
38                    if ($(this).closest('.header_quick_search').hasClass('header_quick_search_reveal')) {
39                        //$('#header_quicksearch_field').animate({'width': $('#header_quicksearch_field').attr('data-width') + 'px'});
40                    }
41                    $(this).closest('.header_quick_search').find('.header_quicksearch_field').select().focus();
42                    return false;
43                } else {
44                    $(this).closest('.header_quick_search').find('form')[0].submit()
45                }
46
47                $(this).closest('form').submit();
48                return false;
49            });
50        }
51
52        $('#quicksearch_field')
53            .each(function() {
54                if ($(this).attr('data-default-value') && !$(this).val()) {
55                    $(this).val($(this).attr('data-default-value'));
56                }
57            })
58            .click(function() {
59                if ($('#quicksearch_field').val() == $('#quicksearch_field').attr('data-default-value') || $('#quicksearch_field').val() == 'Search...' || $('#quicksearch_field').val() == 'Recherche...') {
60                    $('#quicksearch_field').val('');
61                }
62                $('#quicksearch_field').addClass('active');
63            })
64        ;
65
66        $('#quicksearch_btn').click(function() {
67            if (!$('#quicksearch_field').val() || $('#quicksearch_field').val() == $('#quicksearch_field').attr('data-default-value')) {
68                h.alert('You have not entered a search term!');
69                $('#quicksearch_field').select();
70            } else {
71                $('#quicksearch_form')[0].submit()
72            }
73        });
74
75    }
76
77    }
78
79window.galleries = window.galleries || {};
80window.galleries.quicksearch = quicksearch
81export default quicksearch

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.