PageSourceSearch

https://lardex.net/assets/lardex.net/js/custom-035542f344.js

js lardex.net collected 2026-10-02 13:33:27 UTC 21,098 bytes, 547 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opener = _____WB$wombat$assign$function_____("opener");
10$(function() {
11
12    searchAlgolia()
13
14    //document.addEventListener('contextmenu', event => event.preventDefault());
15
16    $(document).on('click', '.nav-tabs a', function() {
17        $(this).tab('show');
18    });
19
20    $('select[multiple="multiple"], .bootstrap-select').multiselect({
21        enableFiltering: true,
22        enableCaseInsensitiveFiltering: true,
23        filterPlaceholder: 'Søk',
24        nonSelectedText: 'Velg fra listen',
25        nSelectedText: 'valgt',
26        allSelectedText: 'Alle valgt',
27        onChange: function(option, checked) {
28            $('.multiselect-container input').uniform({ radioClass: 'choice'});
29        },
30        templates: {
31            filter: '<li class="multiselect-item multiselect-filter"><i class="icon-search4"></i> <input class="form-control" type="text"></li>'
32        }});
33    $('.styled, .multiselect-container input').uniform({ radioClass: 'choice'});
34
35    // Project search function
36    $(document).on('keyup', '.search-form [name="search"]', function() {
37        let searchBox = $(this);
38        delay(function() {
39            let container = searchBox.closest('.container');
40            let value = searchBox.val().trim().toLowerCase();
41            if (value.length > 0) {
42                let apiUrl = searchBox.data('api-url') + '/' + value;
43                $.get(apiUrl, function (articles) {
44                    let url = searchBox.data('url');
45                    $.ajax({
46                        url,
47                        method: 'POST',
48                        data: {articles},
49                        success: function (response) {
50                            container.find('.results').html(response);
51                            container.find('.original').hide();
52                            container.find('.results').fadeIn();
53                        }
54                    });
55                });
56            }
57            else {
58                container.find('.results').hide();
59                container.find('.original').fadeIn();
60            }
61        }, 500);
62    });
63
64    $(document).on('click', '.all-form button', function() {
65        const form = $(this).closest('.all-form');
66        const container = $(this).closest('.container');
67        const viewBtn = form.find('button.viewImages');
68        const hideBtn = form.find('button.hideImages');
69        if ($(this).hasClass('viewImages')) {
70            viewBtn.addClass('loadbtn');
71            const apiUrl = viewBtn.data('api-url');
72            $.get(apiUrl, function (articles) {
73                let url = viewBtn.data('url');
74                $.ajax({
75                    url,
76                    method: 'POST',
77                    data: {articles},
78                    success: function (response) {
79                        container.find('.results').html(response);
80                        container.find('.original').hide();
81                        container.find('.results').fadeIn();
82                        viewBtn.removeClass('loadbtn').hide();
83                        hideBtn.show();
84                    }
85                });
86            });
87        } else {
88            container.find('.results').hide();
89            container.find('.original').fadeIn();
90            hideBtn.hide();
91            viewBtn.show();
92        }
93    });
94
95    $(document).on('submit', '.search-form', function(e) {
96        e.preventDefault();
97        let form = $(this);
98        let search = form.find('.globalsearch').val();
99        let type = form.find('[name="type"]').val();
100        let url = form.data('url');
101        let target = form.data('target');
102        form.find('.search-list').fadeOut();
103        $.get(url, { search: search, type: type }, function(response) {
104            $(target).html(response).fadeIn();
105        });
106    });
107
108    $(document).on('keyup', 'input.globalsearch', function(e) {
109        let input = $(this);
110        let search = input.val();
111        let url = input.attr('data-url');
112        let list = input.siblings('ul.search-list');
113        if(e.key === 'Enter') {
114            list.find('.search-list li:first').trigger('click');
115            list.fadeOut();
116        }
117        else if(search.length > 0) {
118            delay(function() {
119                $.get(url, {search: search}, function(response) {
120                    if(response.length > 0) {
121                        $(list).html(response).fadeIn();
122                        $(list).find(".search-list li:first").trigger('mouseover');
123                    }
124                    else {
125                        $(list).empty().fadeOut();
126                    }
127                });
128            }, 300 );
129        }
130        else {
131            list.empty().fadeOut();
132        }
133    });
134
135    $(document).on('click', '.search-list li', function() {
136        let value = $(this).text();
137        let form = $(this).closest('form');
138        form.find('input[type="search"]').val(value);
139        let searchlist = $(this).closest('.search-list');
140        searchlist.fadeOut();
141        form.submit();
142    });
143
144    $(document).on('focus', '.globalsearch', function() {
145        $(this).val('');
146    });
147
148    $(document).on('click', '.printpage', function() {
149        window.print();
150    });
151
152    $(document).on('click', '.read-more', function() {
153        $(this).toggleClass('up');
154        let article = $(this).closest('.artikkel-inner').find('.full-text');
155        let artClone = article.clone().css('visibility', 'hidden');
156        article.after(artClone);
157        let artHeight = artClone.css('height', 'auto').height();
158        artClone.remove();
159        if (article.height() === 0) {
160            article.css('height', artHeight);
161        }
162        else {
163            article.css('height', 0);
164        }
165    });
166
167    if ($('.image .img-box-article').length > 0) {
168        setTimeout(() => {
169            if (location.hash.length > 0) {
170                const imageId = location.hash.replace('#', '')
171                $(`a[id="image-${imageId}"]`).trigger('click');
172            }
173        }, 100);
174    }
175
176
177    // Get the modal
178    let modal;
179    $('#modal-dialog').on("shown.bs.modal", function (e) {
180        e.preventDefault();
181        modal = $(this);
182        let button = $(e.relatedTarget);
183        let url = button.data('url');
184        let page = button.data('page');
185        let info = button.data('info');
186        $.get(url, { page, info }, function(response){
187            modal.find('.modal-content').html(response);
188            $('.carousel').carousel({
189                interval: false
190            });
191            $('select[multiple="multiple"]').multiselect({enableFiltering: true, enableCaseInsensitiveFiltering: true, filterPlaceholder:'Søk', nonSelectedText:'Velg fra listen',
192                templates: {
193                    filter: '<li class="multiselect-item multiselect-filter"><i class="icon-search4"></i> <input class="form-control" type="text"></li>'
194                }});
195            $('.styled, .multiselect-container input').uniform({ radioClass: 'choice'});
196        });
197    });
198    // When the user clicks anywhere outside of the modal, close it
199    window.onclick = function(event) {
200        if ($(event.target)[0] === modal[0]) {
201            modal.fadeOut();
202        }
203    };
204
205    // Get the modal
206    let modal2;
207    $('#modal-dialog2').on("shown.bs.modal", function (e) {
208        e.preventDefault();
209        modal2 = $(this);
210        const button = $(e.relatedTarget);
211        const url  = button.data('url');
212        const page = button.data('page');
213        const info = button.data('info');
214        $.get(url, { page, info }, function(response) {
215            modal2.find('.modal-content').html(response);
216            $('.carousel').carousel({
217                interval: false
218            });
219            $('select[multiple="multiple"]').multiselect({enableFiltering: true, enableCaseInsensitiveFiltering: true, filterPlaceholder:'Søk', nonSelectedText:'Velg fra listen',
220                templates: {
221                    filter: '<li class="multiselect-item multiselect-filter"><i class="icon-search4"></i> <input class="form-control" type="text"></li>'
222                }});
223            $('.styled, .multiselect-container input').uniform({ radioClass: 'choice'});
224        });
225    });
226    // When the user clicks anywhere outside of the modal, close it
227    window.onclick = function(event) {
228        if (modal2 !== undefined && $(event.target)[0] === modal2[0]) {
229            modal2.fadeOut();
230        }
231    };
232
233    let modalImage;
234    $('#modal-image').on("shown.bs.modal", function (e) {
235        e.preventDefault();
236        modalImage = $(this);
237        const button = $(e.relatedTarget);
238        const url = button.data('url');
239        const type = button.data('type');
240        const container = modalImage.find('.modal-content .pdf-viewer');
241        container.hide();
242        const image = modalImage.find('.modal-content img');
243        image.hide();
244        if (type === 'pdf') {
245            container.show();
246            openPdfViewer(container, url);
247        } else {
248            image.show();
249            modalImage.find('.modal-content img').attr('src', url);
250        }
251    });
252
253    $('[data-toggle="tooltip"]').tooltip({ trigger : 'hover' });
254
255    $(document).on('submit', '#comment-form', function (e) {
256        e.preventDefault();
257        const modal = $('#modal-dialog2');
258        const url   = $(this).attr('action');
259        const data  = $(this).serialize();
260        $.post(url, { data }, function (response) {
261            swal({
262                text: response.message,
263                icon: response.status,
264                timer: 3000
265            });
266            if (response.status === 'success') {
267                setTimeout(function () {
268                    modal.find('.modal-content').empty();
269                    modal.modal('hide')
270                }, 3000);
271            }
272        });
273    });
274
275    /*** SHIPPING ***/
276    $.fn.dataTableAjax = function() {
277        return $(this).DataTable({
278            processing: true,
279            serverSide: true,
280            ajax: {
281                url: $(this).data('url'),
282                //method: "POST",
283                data: function (data) {
284                    return $.extend({}, data, {
285                        term: shippingTable.find('input.active[name="search"]').val(),
286                        column: shippingTable.find('input.active[name="column"]').val(),
287                        shipTypes: $('select[name="shipTypes[]"]').val(),
288                        functions: $('select[name="functions[]"]').val(),
289                        place: $('select[name="place"]').val()
290                    });
291                }
292            },
293            pageLength: 50,
294            order: [[0, 'asc']],
295            dom: '<"datatable-header"ip><"datatable-scroll"t><"datatable-footer">',
296            language: {
297                search: '_INPUT_',
298                searchPlaceholder: 'Søk',
299                lengthMenu: 'Vis _MENU_ rader',
300                paginate: {'first': 'Første', 'last': 'Siste', 'next': '&rarr;', 'previous': '&larr;'},
301                info: 'Viser side _PAGE_ av _PAGES_',
302                infoFiltered: '(filtrert fra _MAX_)',
303                emptyTable: "Ingen data tilgjengelig i tabellen",
304                infoEmpty: "Viser 0 til 0 av 0 rader",
305                zeroRecords: "Ingen data samsvarer med filteret"
306            },
307            fnDrawCallback: function () {
308                $('#artikkel').find('.totalCount').text(dataAjax.page.info().recordsTotal);
309                $('.styled').uniform();
310            }
311        });
312    }
313
314    const shippingTable = $('.shippingtable');
315    let dataAjax;
316    if (shippingTable.length > 0) {
317        dataAjax = shippingTable.dataTableAjax();
318
319        $(document).on('change', 'select.specifications', function() {
320            dataAjax.draw();
321        });
322
323        $(document).on('focus', '.search-reset', function() {
324            $('.specifications').val('').multiselect('refresh');
325            $('.multiselect-container input').uniform({ radioClass: 'choice'});
326            $('.searchinput').val('');
327            dataAjax.draw();
328        });
329
330        $(document).on('click', '.filtering-toggle', function() {
331            const filter = $('.filtering');
332            filter.slideToggle();
333        });
334
335        $(document).on('keyup', '.searchinput', function () {
336            const wrapper = $(this).closest('thead');
337            const input = $(this);
338            wrapper.find('.searchclear').hide();
339            wrapper.find('[name="search"]').each(function (ind, element) {
340                if (element !== input[0]) {
341                    $(element).removeClass('active');
342                    $(element).siblings('[name="column"]').removeClass('active');
343                    $(element).val('');
343 //clears all unused search fields
344                }
345            });
346            if (input.val().length > 0) {
347                input.addClass('active');
348                input.siblings('[name="column"]').addClass('active');
349                input.siblings(".searchclear").toggle(Boolean(input.val()));
350                delay(function () {
351                    shippingTable.DataTable().ajax.reload();
352                }, 200);
353            }
354            else {
355                shippingTable.DataTable().ajax.reload();
356            }
357        });
358
359        $(document).on('click', '.searchclear', function() {
360            const wrapper = $(this).closest('thead');
361            wrapper.find('.searchclear').hide();
362            wrapper.find('[name="search"]').removeClass('active').val('').focus();
363            wrapper.find('[name="column"]').removeClass('active');
364            $(this).siblings('[name="search"]').addClass('active');
365            $(this).siblings('[name="column"]').addClass('active');
366            shippingTable.DataTable().ajax.reload();
367            $('.datatable-header').css('visibility', 'visible');
368        });
369    }
370
371    // For sublist to companies, cooperations and yards
372    const shiplisttable = $('.shiplisttable');
373    if (shiplisttable) {
374        showShiplist(shiplisttable)
375    }
376});
377
378function searchAlgolia() {
379    $(document).on('focus', '#main-search', function() {
380        $('#main-search').addClass('focus');
381        $('body').addClass('modal-open');
382    });
383
384    $(document).on('blur', '#main-search', function() {
385        $('#main-search').removeClass('focus');
386        $('body').removeClass('modal-open');
387    });
388    // Replace with your own values
389    const searchClient = algoliasearch('QIPHRPB6A2', '216763b8cdeb9b881fffc9860e688bb8')
390
391    autocomplete({
392        container: '#autocomplete',
393        placeholder: 'Her søker du i hele nettsiden',
394        detachedMediaQuery: 'none',
395        getSources({ query }) {
396            return [
397                {
398                    sourceId: 'content',
399                    getItems() {
400                        return getAlgoliaResults({
401                            searchClient,
402                            queries: [
403                                {
404                                    indexName: 'lardex',
405                                    query,
406                                    params: {
407                                        hitsPerPage: 10,
408                                        attributesToSnippet: ['name:10', 'description:35'],
409                                        snippetEllipsisText: '…',
410                                    },
411                                },
412                            ],
413                        });
414                    },
415                    templates: {
416                        item({ item, components, html }) {
417                            return html`
418                                <a href="${item.path}">
419                                    <span class="lar-searchWrapper">
420                                        <span class="lar-searchIcon">
421                                            <img src="${item.image}" alt="${item.name}" width="100" height="100"/>
422                                        </span>
423                                        <span class="lar-searchContent">
424                                            <span class="lar-searchTop">
425                                                <span class="lar-searchTitle">
426                                                    ${components.Highlight({ hit: item,  attribute: 'name', })}
427                                                </span>
428                                                <span class="lar-searchCategory">
429                                                    ${item.category}
430                                                </span>
431                                            </span>
432                                            <span class="lar-searchDescription">
433                                                ${components.Snippet({  hit: item,  attribute: 'description', })}
434                                            </span>
435                                        </span>
436                                    </span>
437                                </a>`;
438                        },
439                    },
440                },
441            ];
442        },
443    });
444}
445
446function showShiplist(table) {
447    table.DataTable({
448        pageLength: 50,
449        order: [[0, 'asc']],
450        columnDefs: [
451            { 'type': 'num', 'targets': [3] }
452        ],
453        dom: '<"datatable-header"ip><"datatable-scroll"t><"datatable-footer">',
454        language: {
455            search: '_INPUT_',
456            searchPlaceholder: 'Søk',
457            lengthMenu: 'Vis _MENU_ rader',
458            paginate: {'first': 'Første', 'last': 'Siste', 'next': '&rarr;', 'previous': '&larr;'},
459            info: 'Viser side _PAGE_ av _PAGES_',
460            infoFiltered: '(filtrert fra _MAX_)',
461            emptyTable: "Ingen data tilgjengelig i tabellen",
462            infoEmpty: "Viser 0 til 0 av 0 rader",
463            zeroRecords: "Ingen data samsvarer med filteret"
464        },
465        "fnDrawCallback": function () {
466            $('.styled').uniform();
467        }
468    });
469
470
471}
472
473function openPdfViewer(container, pdfPath) {
474    const baseUrl = document.getElementById('base-url').innerText;
475    container.FlipBook({
476        pdf: pdfPath,
477        template: {
478            html: baseUrl + '/flip/templates/default-book-view.html',
479            styles: [ baseUrl + '/flip/css/short-black-book-view.css' ],
480            links: [ { rel: 'stylesheet', href: baseUrl + '/flip/css/font-awesome.min.css' } ],
481            script: baseUrl + '/flip/js/default-book-view.js',
482            sounds: {
483                startFlip: baseUrl + '/flip/sounds/start-flip.mp3',
484                endFlip: baseUrl + '/flip/sounds/end-flip.mp3'
485            }
486        }
487    });
488}
489
490function pageCallback(path) {
491    return {
492        type: 'image',
493        src: 'books/image/theKingIsBlack/'+(n+1)+'.jpg',
494        interactive: false
495    };
496}
497
498function openTab(evt, cityName) {
499    // Declare all variables
500    let i, tabcontent, tablinks;
501
502    // Get all elements with class="tabcontent" and hide them
503    tabcontent = document.getElementsByClassName("tabcontent");
504    for (i = 0; i < tabcontent.length; i++) {
505        tabcontent[i].style.display = "none";
506    }
507
508    // Get all elements with class="tablinks" and remove the class "active"
509    tablinks = document.getElementsByClassName("tablinks");
510    for (i = 0; i < tablinks.length; i++) {
511        tablinks[i].className = tablinks[i].className.replace(" active", "");
512    }
513
514    // Show the current tab, and add an "active" class to the button that opened the tab
515    document.getElementById(cityName).style.display = "block";
516    evt.currentTarget.className += " active";
517}
518
519let delay = (function(){
520    let timer = 0;
521    return function(callback, ms){
522        clearTimeout (timer);
523        timer = setTimeout(callback, ms);
524    };
525})();
526}
527
528/*
529     FILE ARCHIVED ON 19:39:03 Nov 04, 2023 AND RETRIEVED FROM THE
530     INTERNET ARCHIVE ON 03:45:26 Aug 31, 2026.
531     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
532
533     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
534     SECTION 108(a)(3)).
535*/
536/*
537playback timings (ms):
538  captures_list: 0.377
539  exclusion.robots: 0.031
540  exclusion.robots.policy: 0.023
541  esindex: 0.006
542  cdx.remote: 29.611
543  LoadShardBlock: 141.184 (3)
544  PetaboxLoader3.resolve: 88.649 (3)
545  PetaboxLoader3.datanode: 98.217 (4)
546  load_resource: 83.749
547*/

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.