PageSourceSearch

https://hi.is/modules/custom/hi_namsleit/js/namsleit.js?tlu1t2

js hi.is collected 2026-09-24 08:41:24 UTC 10,700 bytes, 121 lines download raw bytes

1(function ($, Drupal, once) {
2  'use strict'
3
4  Drupal.behaviors.namsleit = {
5    attach: function (context, settings) {
6      // Global variables
7      const icon = '<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n' +
8          '<g id="Icon">\n' +
9          '<mask id="mask0_1136_28245" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="17" height="17">\n' +
10          '<rect id="Bounding box" x="0.666626" y="0.5" width="16" height="16" fill="#D9D9D9"/>\n' +
11          '</mask>\n' +
12          '<g mask="url(#mask0_1136_28245)">\n' +
13          '<path id="help" d="M8.63333 12.5007C8.86667 12.5007 9.06389 12.4201 9.225 12.259C9.38611 12.0979 9.46667 11.9007 9.46667 11.6673C9.46667 11.434 9.38611 11.2368 9.225 11.0757C9.06389 10.9145 8.86667 10.834 8.63333 10.834C8.4 10.834 8.20278 10.9145 8.04167 11.0757C7.88056 11.2368 7.8 11.434 7.8 11.6673C7.8 11.9007 7.88056 12.0979 8.04167 12.259C8.20278 12.4201 8.4 12.5007 8.63333 12.5007ZM8.03333 9.93398H9.26667C9.26667 9.56732 9.30833 9.27843 9.39167 9.06732C9.475 8.85621 9.71111 8.56732 10.1 8.20065C10.3889 7.91176 10.6167 7.63676 10.7833 7.37565C10.95 7.11454 11.0333 6.80065 11.0333 6.43398C11.0333 5.81176 10.8056 5.33398 10.35 5.00065C9.89444 4.66732 9.35556 4.50065 8.73333 4.50065C8.1 4.50065 7.58611 4.66732 7.19167 5.00065C6.79722 5.33398 6.52222 5.73398 6.36667 6.20065L7.46667 6.63398C7.52222 6.43398 7.64722 6.21732 7.84167 5.98398C8.03611 5.75065 8.33333 5.63398 8.73333 5.63398C9.08889 5.63398 9.35556 5.73121 9.53333 5.92565C9.71111 6.1201 9.8 6.33398 9.8 6.56732C9.8 6.78954 9.73333 6.99787 9.6 7.19232C9.46667 7.38676 9.3 7.56732 9.1 7.73398C8.61111 8.16732 8.31111 8.4951 8.2 8.71732C8.08889 8.93954 8.03333 9.3451 8.03333 9.93398ZM8.66667 15.1673C7.74444 15.1673 6.87778 14.9923 6.06667 14.6423C5.25556 14.2923 4.55 13.8173 3.95 13.2173C3.35 12.6173 2.875 11.9118 2.525 11.1007C2.175 10.2895 2 9.42287 2 8.50065C2 7.57843 2.175 6.71176 2.525 5.90065C2.875 5.08954 3.35 4.38398 3.95 3.78398C4.55 3.18398 5.25556 2.70898 6.06667 2.35898C6.87778 2.00898 7.74444 1.83398 8.66667 1.83398C9.58889 1.83398 10.4556 2.00898 11.2667 2.35898C12.0778 2.70898 12.7833 3.18398 13.3833 3.78398C13.9833 4.38398 14.4583 5.08954 14.8083 5.90065C15.1583 6.71176 15.3333 7.57843 15.3333 8.50065C15.3333 9.42287 15.1583 10.2895 14.8083 11.1007C14.4583 11.9118 13.9833 12.6173 13.3833 13.2173C12.7833 13.8173 12.0778 14.2923 11.2667 14.6423C10.4556 14.9923 9.58889 15.1673 8.66667 15.1673Z" fill="#707070"/>\n' +
14          '</g>\n' +
15          '</g>\n' +
16          '</svg>'
17      const infoIcon =
18        '<svg xmlns="http://www.w3.org/2000/svg" height="17px" viewBox="0 -960 960 960" width="17px" fill="none">\n' +
19        '<path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"  fill="#707070" fill-rule="evenodd"/>\n' +
20        "</svg>";
21      if ($('.setsnamsleit').length) {
22      } else {
23
24        $('.namsleit .js-form-wrapper').not('.form-actions').wrapAll("<div class='setsnamsleit'></div>")
25        $('.allrows').appendTo('.namsleit-form')
26        $('.namsleit .empty').appendTo('.namsleit-form')
27        // Add expand collapse on sets in mobile.
28        if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) {
29          $('.setsnamsleit').wrap('<details class="form-item js-form-wrapper form-wrapper" data-drupal-selector="outer-filter-target-id-collapsible" id="outer-filter-target-id-collapsible" data-once="details" xmlns="http://www.w3.org/1999/html" open>\n' +
30            '</details>')
31          $('#outer-filter-target-id-collapsible').append('<summary role="button" aria-controls="outer-filter-id-collapsible" aria-expanded="false">Filters<span class="summary"></span></summary>')
32          $('.namsleit-form details.js-form-wrapper summary').attr('aria-expanded', 'false')
33          //g$('.namsleit-form details.js-form-wrapper').removeAttr('open', '')
34        } else {
35          $('.namsleit-form details.js-form-wrapper summary').attr('aria-expanded', 'true')
36          $('.namsleit-form details.js-form-wrapper').attr('open', '')
37        }
38
39        // Tooltips EN.
40        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-81330']").attr('title', 'test')
41        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-81330']").append(icon)
42        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-81330']").tooltip({ content: '<strong>In Blended learning study programmes</strong> courses may be organised as face-to-face, distance, online, or self-study.' })
43        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71130']").attr('title', 'test')
44        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71130']").append(icon)
45        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71130']").tooltip({ content: '<strong>In Distance learning study programmes</strong> courses are structured for online learning with real-time participation in virtual meetings, on-site sessions, or field studies.' })
46        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71129']").attr('title', 'test')
47        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71129']").append(icon)
48        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71129']").tooltip({ content: '<strong>In Face-to-face study programmes</strong> courses typically occur in real-time at set times and locations.' })
49        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71131']").attr('title', 'test')
50        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71131']").append(icon)
51        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-71131']").tooltip({ content: '<strong>In Online learning study programmes</strong> Courses are structured for online learning with no real-time participation but students must follow the syllabus.' })
52        $("label[for*='edit-field-namsgerd-kennsluskra-target-id-76684']").attr("title", "test");
53        $("label[for*='edit-field-namsgerd-kennsluskra-target-id-76684']").append(infoIcon);
54        $("label[for*='edit-field-namsgerd-kennsluskra-target-id-76684']").tooltip({ content: "Only research-based master's degrees (with a major thesis or research component) usually give direct access to doctoral studies." });
55
56        // Tooltips IS.
57        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-928
5702']").attr('title', 'test')
58        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92802']").append(icon)
59        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92802']").tooltip({ content: '<strong>Í staðnámi</strong> eru námskeið oftast kennd á tilteknum stað og tíma. Gert er ráð fyrir því að nemendur mæti á staðinn.' })
60        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92812']").attr('title', 'test')
61        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92812']").append(icon)
62        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92812']").tooltip({ content: '<strong>Í fjarnámi</strong> fara námskeið oftast fram á netinu í rauntíma. Gert er ráð fyrir rauntímaþátttöku nemenda á netfundum, í staðlotum og/eða vettvangsnámi.' })
63        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92813']").attr('title', 'test')
64        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92813']").append(icon)
65        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92813']").tooltip({ content: '<strong>Í netnámi</strong> eru námskeið á netinu. Ekki er gert ráð fyrir rauntímaþátttöku, en nemendur þurfa að fylgja kennsluáætlun.' })
66        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92842']").attr('title', 'test')
67        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92842']").append(icon)
68        $("label[for*='edit-field-namsfyrirkomulag-kennslusk-target-id-92842']").tooltip({ content: '<strong>Í blandaðri námsleið</strong> geta námskeið ýmist verið kennd í staðnámi, fjarnámi, netnámi eða sjálfsnámi.' })
69        $("label[for*='edit-field-namsgerd-kennsluskra-target-id-92814']").attr("title", "test");
70        $("label[for*='edit-field-namsgerd-kennsluskra-target-id-92814']").append(infoIcon);
71        $("label[for*='edit-field-namsgerd-kennsluskra-target-id-92814']").tooltip({ content: "Einungis meistaranám með lokaritgerð gefur aðgang að doktorsnámi." });
72
73        const $summary = $("summary[aria-controls='edit-field-minor-major-target-id-collapsible']");
74
75        if ($summary.length) {
76          $summary.append(infoIcon);
77
78          $summary.tooltip({
79            items: "summary",
80            content: function () {
81              return '<a href="/node/17334" class="tooltip-link" style="color: #10099f; text-decoration: underline; font-weight: bold;">Sjá meira um aðal- og aukagreinar í grunnámi</a>';            },
82            // Bætum við seinkun (delay) áður en tooltip lokast
83            hide: { effect: "fadeOut", duration: 150, delay: 400 },
84            show: { effect: "fadeIn", duration: 150 },
85            open: function (event, ui) {
86              // Leyfum músinni að fara yfir tooltip gluggann án þess að hann lokist
87              ui.tooltip.on("mouseenter", function () {
88                $(this).stop(true, true).show();
89              }).on("mouseleave", function () {
90                $(this).fadeOut(150);
91              });
92
93              // Hindrum að smellur á hlekkinn opni/loki <details> bálknum
94              ui.tooltip.find("a").on("click", function (e) {
95                e.stopPropagation();
96              });
97            }
98          });
99        }þa
100      }
101      once('namsleit', 'input[type=checkbox]').forEach(function (elem) {
102        $(elem).on('click', function () {
103          // For the boolean value
104          const label = $(this).next()
105          // For the mammal value
106          // console.log('undan')
107          // console.log(label.attr('style'))
108          // console.log('eftir')
109          if (label.attr('style') === undefined) {
110            label.css('font-weight', '700')
111          }
112          else {
113            label.removeAttr('style')
114          }
115          // console.log(label.attr('style'))
116        })
117      })
118    }
119  }
120// eslint-disable-next-line no-undef
121})(jQuery, Drupal, once)

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.