1$(function() { 2 let loading = { 3 show: function() { 4 $("body").append("<div class='main-loading'></div>"); 5 }, 6 hide: function() { 7 $(".main-loading").remove(); 8 } 9 } 10 $("body").easeScroll(); 11 12 $("[data-bg]").each(function() { 13 let $this = $(this), 14 $bg = $this.attr("data-bg"); 15 16 $this.css({ 17 backgroundImage: 'url('+$bg+')', 18 backgroundPosition: 'center', 19 backgroundAttachment: 'fixed', 20 backgroundSize: 'center' 21 }); 22 $this.prepend("<div class='overlay'></div>"); 23 }); 24 25 let getNavbarOffset = function() { 26 let $navbar = $(".main-navbar"), 27 top = parseInt($navbar.css("top"), 10); 28 29 if(isNaN(top)) { 30 top = 0; 31 } 32 33 return $navbar.outerHeight() + top + 12; 34 } 35 36 $(".smooth-link").click(function() { 37 let $this = $(this), 38 href = $this.attr("href"); 39 40 if(!href || href.charAt(0) !== "#") { 41 return true; 42 } 43 44 let $target = $(href); 45 if(!$target.length) { 46 return true; 47 } 48 49 $("html, body").animate({ 50 scrollTop: $target.offset().top - getNavbarOffset() 51 }); 52 53 return false; 54 }); 55 56 $(document).on("click", "a[href^='#'][href$='-modal']", function(e) { 57 let id = this.hash ? this.hash.substring(1) : "", 58 $modal = $("[data-remodal-id='" + id + "']"), 59 scrollTop = $(window).scrollTop(); 60 61 if(!$modal.length || typeof $.fn.remodal !== "function") { 62 return true; 63 } 64 65 e.preventDefault(); 66 67 let instance = $modal.remodal({ hashTracking: false }); 68 if(instance && instance.settings) { 69 instance.settings.hashTracking = false; 70 } 71 72 instance.open(); 73 $(window).scrollTop(scrollTop); 74 window.setTimeout(function() { 75 $(window).scrollTop(scrollTop); 76 }, 0); 77 78 return false; 79 }); 80 81 $(window).scroll(function() { 82 let $this = $(this); 83 if($this.scrollTop() > $(".hero").outerHeight() - 150) { 84 $(".main-navbar").addClass("bg-dark"); 85 }else{ 86 $(".main-navbar").removeClass("bg-dark"); 87 } 88 89 $("section").each(function() { 90 if($this.scrollTop() >= ($(this).offset().top - getNavbarOffset())) { 91 $(".smooth-link").parent().removeClass("active"); 92 $(".smooth-link[href='#"+$(this).attr("id")+"']").parent().addClass('active'); 93 } 94 }); 95 }); 96 97 $("[data-toggle=read]").click(function() { 98 let $this = $(this), 99 $id = $this.attr("id"); 100 101 $("body").css({ 102 overflow: "hidden" 103 }); 104 105 let $element = '<div class="article-read">'; 106 $element += '<div class="article-read-inner">'; 107 $element += '<div class="article-back">'; 108 $element += '<a class="btn btn-outline-primary"><i class="ion ion-chevron-left"></i> Back</a>'; 109 $element += '</div>'; 110 $element += '<h1 class="article-title">{title}</h1>'; 111 $element += '<div class="article-metas">'; 112 $element += '<div class="meta">'; 113 $element += ' {date}'; 114 $element += '</div>'; 115 $element += '<div class="meta">'; 116 $element += ' {category}'; 117 $element += '</div>'; 118 $element += '<div class="meta">'; 119 $element += ' {author}'; 120 $element += '</div>'; 121 $element += '</div>'; 122 $element += '<figure class="article-picture"><img src="{picture}"></figure>'; 123 $element += '<div class="article-content">'; 124 $element += '{content}'; 125 $element += '</div>'; 126 $element += '</div>'; 127 $element += '</div>'; 128 129 $.ajax({ 130 url: "mock/article.json", 131 dataType: 'json', 132 beforeSend: function() { 133 loading.show(); 134 }, 135 complete: function() { 136 loading.hide(); 137 }, 138 success: function(data) { 139 let reg = /{([a-zA-Z0-9]+)}/g, 140 res = [], 141 element = $element; 142 while(match = reg.exec($element)) { 143 element = element.replace('{' + match[1] + '}', data[match[1]]); 144 } 145 146 $("body").prepend(element); 147 $(".article-read").fadeIn(); 148 $(document).on("click", ".article-back .btn", function() { 149 $(".article-read").fadeOut(function() { 150 $(".article-read").remove(); 151 $("body").css({ 152 overflow: 'auto' 153 }); 154 }); 155 return false; 156 }); 157 } 158 }); 159 160 return false; 161 }); 162 163}); 164 165 166 167 168$('.toggle').click(function(e) { 169 e.preventDefault(); 170 171 var $this = $(this); 172 173 if ($this.next().hasClass('show')) { 174 $this.next().removeClass('show'); 175 $this.next().slideUp(350); 176 } else { 177 $this.parent().parent().find('li .inner').removeClass('show'); 178 $this.parent().parent().find('li .inner').slideUp(350); 179 $this.next().toggleClass('show'); 180 $this.next().slideToggle(350); 181 } 182}); 183 184 185 186// Closes the Responsive Menu on Menu Item Click 187$('.navbar-collapse ul li a').click(function() { 188 $(".navbar-collapse").removeClass("show"); 189});
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.