PageSourceSearch

https://news.nvinio.com/site/themes/nvinio-apple-v1_dark/assets/js/theme.js?v=1.0.4

js nvinio.com collected 2026-10-01 11:28:10 UTC 6,759 bytes, 138 lines download raw bytes

1"use strict";
2/**
3 * Parsley options for bootstrap 4 styled form validation
4 *
5 * @type {Object}
6 */
7var parsleyOptions = {
8     errorClass: 'is-invalid text-danger',
9     successClass: 'is-valid',
10     errorsWrapper: '<span class="form-text text-danger"></span>',
11     errorTemplate: '<span></span>',
12     trigger: 'focusout',
13     focusInvalid: true,
14 };
15
16/**
17 * Custom jQuery Tasks
18 *
19 * for the theme
20 */
21$(document).ready(function() {
22    // Enable Tooltips
23    $('body').tooltip({
24    selector: '[data-toggle="tooltip"]'
25});
26    // Enable Popovers
27    $('[data-toggle="popover"]').popover();
28
29    // Dynamic select option to URL
30    $('select[data-option-redirect]').on('change', function () {
31      var url = $(this).val();
32      if (url) {
33        window.location = url;
34      }
35      return false;
36    });
37
38    // Add file name to bootstrap's custom file input fields
39    $('.custom-file-input').change(function() {
40      var $el = $(this),
41      files = $el[0].files,
42      label = files[0].name;
43      if (files.length > 1) {
44        label = label + " and " + String(files.length - 1) + " more files"
45      }
46      $el.next('.custom-file-label').html(label);
47    });
48
49    // Offcanvas menu
50    $("body").on("click", "[data-action]", function(e) {
51      e.preventDefault();
52
53      var $this = $(this);
54      var action = $this.data('action');
55      var target = '';
56
57      switch (action) {
58        case "offcanvas-open":
59        target = $this.data("target"), $(target).addClass("open"), $("body").append('<div class="body-backdrop" data-action="offcanvas-close" data-target=' + target + " />");
60        $("body").addClass('offcanvas-open');
61        break;
62        case "offcanvas-close":
63        target = $this.data("target"), $(target).removeClass("open"), $("body").find(".body-backdrop").remove();
64        $("body").removeClass('offcanvas-open');
65        break;
66
67        case 'aside-open':
68        target = $this.data('target');
69        $this.data('action', 'aside-close');
70        $this.addClass('toggled');
71        $(target).addClass('toggled');
72        $('.content').append('<div class="body-backdrop" data-action="aside-close" data-target='+target+' />');
73        break;
74
75
76        case 'aside-close':
77        target = $this.data('target');
78        $this.data('action', 'aside-open');
79        $('[data-action="aside-open"], '+target).removeClass('toggled');
80        $('.content, .header').find('.body-backdrop').remove();
81        break;
82      }
83    });
84
85    // document.ready() ends
86});
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101(function(){'use strict';
102  var body=document.body;
103  function syncLegacyTheme(){
104    var dark=document.documentElement.classList.contains('nvinio-dark');
105    body.classList.toggle('ra-dark',dark);
106    document.querySelectorAll('[data-ra-theme]').forEach(function(b){b.setAttribute('aria-pressed',dark?'true':'false');});
107  }
108  syncLegacyTheme();
109  document.addEventListener('nvinio:theme-change',syncLegacyTheme);
110  document.addEventListener('click',function(e){var th=e.target.closest('[data-ra-theme]');if(th){e.preventDefault();return;}
111    var open=e.target.closest('[data-ra-search]'); if(open){body.classList.add('ra-search-open');setTimeout(function(){var i=document.querySelector('[data-ra-overlay-input]');if(i)i.focus();},80);}
112    var close=e.target.closest('[data-ra-search-close]'); if(close)body.classList.remove('ra-search-open');
113    var copy=e.target.closest('[data-ra-copy]'); if(copy){navigator.clipboard&&navigator.clipboard.writeText(window.location.href).then(function(){copy.textContent='✓';setTimeout(function(){copy.textContent='⧉';},1300);});}
114    var nat=e.target.closest('[data-ra-native-share]');
114 if(nat&&navigator.share){navigator.share({title:document.title,url:location.href}).catch(function(){});}
115  });
116  document.addEventListener('keydown',function(e){if(e.key==='Escape')body.classList.remove('ra-search-open');if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==='k'){e.preventDefault();body.classList.add('ra-search-open');setTimeout(function(){var i=document.querySelector('[data-ra-overlay-input]');if(i)i.focus();},60);}});
117  function progress(){var el=document.getElementById('raScrollProgress');if(el){var h=document.documentElement.scrollHeight-window.innerHeight;el.style.width=(h?window.scrollY/h*100:0)+'%';}}
118  window.addEventListener('scroll',progress,{passive:true});progress();
119  var slides=[].slice.call(document.querySelectorAll('[data-ra-slide]')),dots=[].slice.call(document.querySelectorAll('[data-ra-dot]')),idx=0,timer;
120  function show(n){if(!slides.length)return;idx=(n+slides.length)%slides.length;slides.forEach(function(s,i){s.classList.toggle('is-active',i===idx);});dots.forEach(function(d,i){d.classList.toggle('is-active',i===idx);});}
121  function restart(){clearInterval(timer);if(slides.length>1)timer=setInterval(function(){show(idx+1);},7000)}
122  document.querySelector('[data-ra-next]')&&document.querySelector('[data-ra-next]').addEventListener('click',function(){show(idx+1);restart();});
123  document.querySelector('[data-ra-prev]')&&document.querySelector('[data-ra-prev]').addEventListener('click',function(){show(idx-1);restart();});
124  dots.forEach(function(d){d.addEventListener('click',function(){show(+d.dataset.raDot);restart();});});restart();
125  document.addEventListener('visibilitychange',function(){document.hidden?clearInterval(timer):restart();});
126  var meter=document.getElementById('raArticleProgress');
127  function readProgress(){if(!meter)return;var article=document.querySelector('[data-article]');if(!article)return;var rect=article.getBoundingClientRect(), total=article.scrollHeight, current=Math.min(total,Math.max(0,window.innerHeight-rect.top));meter.style.width=Math.min(100,current/total*100)+'%';}
128  window.addEventListener('scroll',readProgress,{passive:true});readProgress();
129  var observer='IntersectionObserver' in window?new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting)e.target.classList.add('is-visible');});},{threshold:.08}):null;
130  document.querySelectorAll('[data-ra-reveal]').forEach(function(el){if(observer)observer.observe(el);else el.classList.add('is-visible');});
131  window.addEventListener('load',function(){document.querySelectorAll('img[data-src]').forEach(function(img){if(!img.src||img.src.indexOf('data:image')===0)img.src=img.getAttribute('data-src');});});
132  window.addEventListener('nvinio:cse-ready',function(){document.querySelectorAll('.gs-visibleUrl').forEach(function(el){var url=el.textContent.trim();if(!url)return;var host=url.replace(/^https?:\/\//,'').split(/[/?#]/)[0];el.innerHTML='<span class="ra-result-source"><img src="https://www.google.com/s2/favicons?domain='+encodeURIComponent(host)+'" alt="">'+url.replace(/^https?:\/\//,'')+'</span>';});});
133})();
134
135
136
137
138

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.