PageSourceSearch

https://www.bjorvikautvikling.no/wp-content/themes/enfold-bjorvika/js/site.js?ver=0.1

js bjorvikautvikling.no collected 2026-10-02 07:41:41 UTC 4,685 bytes, 142 lines download raw bytes

1jQuery(function () {
2    Site.Common.init();
3});
4
5/**
6 * Designed to handle logics/events of all pages in site
7 *
8 * Structure:
9 *   var Site = (function () { })();
10 *   Site.Common = (function () {
11*       return {
12*           init: _init...
13*       };
14*   })();
15 *
16 * How to use:
17 *   Site.Common.init();
18 *
19 * @module Site
20 */
21var Site = (function () {
22    return {};
23})();
24
25/**
26 * Handle main events of all page
27 * It will be called when a page is request
28 *
29 * @module Site
30 * @submodule Common
31 */
32Site.Common = (function ($) {
33
34    var _featureImageInMobile = function () {
35        var feature_image = $('.page-header-container').find('img');
36        if (feature_image.length > 0) {
37            if ($(document).width() < 768) {
38                var feature_image_src = 'url("' + feature_image.attr('src') + '")';
39                $(".header-wrapper").css("background-image", feature_image_src);
40            }
41        } else {
42            $(".page-header-container").addClass("no-feature-image");
43        }
44    };
45
46    var _getCurrentPortfolio = function () {
47        if ($('body').find(".projects-list-wrapper").length > 0 && window.location.search.indexOf('filter') > -1) {
48            window.setTimeout(function () {
49                if ($('body').find(".av-sort-by-term").length > 0) {
50                    var filter = decodeURIComponent(window.location.search.match(new RegExp("filter=(.*?)($|\&)", "i"))[1]);
51                    $('a[data-filter=' + filter + ']').trigger("click");
52                    return true;
53                }
54            }, 100);
55
56        }
57    };
58
59    var _moveSecondaryMenuToMainMenuInMobile = function () {
60        if ($(document).width() < 768) {
61            var secondary_menu_item = {},
62                item_ids = [];
63            $('#header_meta').find('.menu-item').each(function () {
64                var $this = $(this),
65                    item_url = $this.children('a').attr('href'),
66                    item_text = $this.children('a').text(),
67                    item_id = $this.attr('id');
68                item_ids.push(item_id);
69                secondary_menu_item[item_id] = "<li class='" + item_id + " av-active-burger-items'>" +
70                    "<a href='" + item_url + "' itemprop='url' style=''>" +
71                    "<span class='avia-bullet'></span>" +
72                    "<span class='avia-menu-text'>" + item_text + "</span>" +
73                    "<span class='avia-menu-fx'>" +
74                    "<span class='avia-arrow-wrap'>" +
75                    "<span class='avia-arrow'>" +
76                    "</span>" +
77                    "</span>" +
78                    "</span>" +
79                    "</a>" +
80                    "</li>";
81            });
82
83            if (!$.isEmptyObject(secondary_menu_item)) {
84
85                $(document).on('avia_burger_list_created', '.av-burger-menu-main a', function () {
86                    var s = $(this);
87
88                    //	allow DOM to build
89                    window.setTimeout(function () {
90                        var burger_menu = s.closest('.avia-menu.av-main-nav-wrap').find('.av-burger-overlay').find('#av-burger-menu-ul');
91                        if (burger_menu.length == 0) {
92                            return true;
93                        }
94                        $(item_ids).each(function (index, id) {
95                            if (burger_menu.find('.' + id).length > 0) {
96                                return true; //continue loop
97                            }
98                            burger_menu.append(secondary_menu_item[id]);
99                        });
100                    }, 200);
101                });
102            }
103        }
104    };
105
106    var _isImageExist = function (url) {
107        var img = new Image();
108        img.src = url;
109        return img.height != 0;
110    };
111
112    var _addDownloadAttributeToImage = function () {
113        $(document).ready(function () {
114            $('.downloadable-image').find('a').each(function (index, value) {
115                var $this = $(this),
116                    images = $this.find("img");
117                if (images.length > 0) {
118                    var imageSrc = $(images).first().attr("src");
119                    if (_isImageExist(imageSrc)) {
120                        $this.attr("download", "");
121                    }
122                }
123            })
124        });
125    };
126
127    var _sampleWithParam = function (param) {
128    };
129
130    var _init = function () {
131        _featureImageInMobile();
132        _getCurrentPortfolio();
133        _addDownloadAttributeToImage();
134        _moveSecondaryMenuToMainMenuInMobile();
135    };
136
137    return {
138        init: _init,
139        sample: _sampleWithParam
140    };
141})(jQuery);
142

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.