1// ========== TABLE OF CONTENTS =========== // 2// 3// 1. Page Loader 4// 2. Text fitting for headlines 5// 3. Parallax 6// 4. Calendar 7// 5. Navbar 8// 6. Sidenav 9// 7. Sidebar Newsfeed-1 10// 8. Sidebar Newsfeed-2 11// 9. Sidebar Newsfeed-3 12// 10. Sidebar Newsfeed-4 13// 11. Sidebar Newsfeed-5 14// 12. Sidebar Newsfeed-6 15// 13. News Ticker 16// 14. To Top Button 17// 15. Owl Carousel - News Slider & Schedule Slider 18// 16. Owl Carousel - Big Gallery Slider-1 19// 17. Owl Carousel - Big Gallery Slider-2 20// 18. Owl Carousel - Big Gallery Slider-3 21// 19. Owl Carousel - Small Gallery Slider 22// 20. Clock 23// 21. Subscribe Form 24// 22. Exchange Rates 25// 23. Currency Converter 26// 24. Sidebar Weather 27// 25. Fitvids 28// 26. Sidebar Scroll 29// 30// ======================================= // 31 32(function($) { 33 "use strict"; 34 35 /* 1. Page Loader */ 36 $(".loader-item").delay(700).fadeOut(); 37 $("#pageloader").delay(1200).fadeOut("slow"); 38 39 /* 2. Text fitting for headlines */ 40 $('.extra-large-caption').fitText(1.5, { minFontSize: '26px', maxFontSize: '80px' }); 41 $('.large-caption').fitText(1.5, { minFontSize: '26px', maxFontSize: '60px' }); 42 $('.medium-caption').fitText(2, { minFontSize: '20px', maxFontSize: '30px' }); 43 $('.small-caption').fitText(2.4, { minFontSize: '20px', maxFontSize: '26px' }); 44 $('.extra-small-caption').fitText(2.4, { minFontSize: '16px', maxFontSize: '22px' }); 45 $('.error-msg').fitText(2, { minFontSize: '36px', maxFontSize: '90px' }); 46 47 /* 3. Parallax */
48 function parallaxInit() { 49 $('.img-overlay1', '#parallax-section').parallax("100%", 0.8); 50 } 51 parallaxInit(); 52 53 /* 4. Calendar */ 54 $('#calendar').datepicker(); 55 56 /* 5. Navbar */ 57 // headroom 58 $("#fixed-navbar").headroom({ 59 tolerance : 5, 60 offset: $('#main-section').offset().top, 61 classes: { 62 pinned: "headroom-pinned", 63 unpinned: "headroom-unpinned" 64 } 65 }); 66 67 // affix 68 $('#fixed-navbar').affix({ 69 offset: { 70 top: $('#fixed-navbar').offset().top 71 } 72 }); 73 74 /* 6. Sidenav */ 75 $('[data-sidenav]').sidenav(); 76 $('.navbar-toggle').attr( 'id', $('#sidenav-toggle').attr('id') ); 77 78 // headroom 79 $("#mobile-nav").headroom({ 80 offset: $('#main-section').offset().top, 81 classes: { 82 pinned: "headroom-pinned", 83 unpinned: "headroom-unpinned" 84 } 85 }); 86 // Affix 87 $('#mobile-nav').affix({ 88 offset: { 89 top: $('.top-menu').height() 90 } 91 }); 92 93 /* 7. Sidebar Newsfeed-1 */ 94 $('.newsfeed-1').easyTicker({ 95 direction: 'up', 96 easing: 'easeOutSine', 97 speed: 'slow', 98 interval: 5000, 99 height: 'auto', 100 visible: 3, 101 mousePause: 1, 102 }); 103 104 /* 8. Sidebar Newsfeed-2 */ 105 $('.newsfeed-2').easyTicker({ 106 direction: 'up', 107 easing: 'easeOutSine', 108 speed: 'slow', 109 interval: 5000, 110 height: 'auto', 111 visible: 4, 112 mousePause: 1, 113 }); 114 115 /* 9. Sidebar Newsfeed-3 */ 116 $('.newsfeed-3').easyTicker({ 117 direction: 'up', 118 easing: 'easeOutSine', 119 speed: 'slow', 120 interval: 5000, 121 height: 'auto', 122 visible: 10, 123 mousePause: 1, 124 }); 125 126 127 /* 10. Sidebar Newsfeed-4 */ 128 $('.newsfeed-4').easyTicker({ 129 direction: 'up', 130 easing: 'easeOutSine', 131 speed: 'slow', 132 interval: 3000, 133 height: 'auto', 134 visible: 6, 135 mousePause: 1, 136 }); 137 138 /* 11. Sidebar Newsfeed-5 */ 139 $('.newsfeed-5').easyTicker({ 140 direction: 'up', 141 easing: 'easeOutSine', 142 speed: 'slow', 143 interval: 3000, 144 height: 'auto', 145 visible: 7, 146 mousePause: 1, 147 }); 148 149 /* 12. Sidebar Newsfeed-6 */ 150 $('.newsfeed-6').easyTicker({ 151 direction: 'up', 152 easing: 'easeOutSine', 153 speed: 'slow', 154 interval: 3000, 155 height: 'auto', 156 visible: 8, 157 mousePause: 1, 158 }); 159 160 /* 13. News Ticker */ 161 $('.newsticker').easyTicker({ 162 direction: 'up', 163 easing: 'easeOutSine', 164 speed: 'slow', 165 interval: 4000, 166 height: 'auto', 167 visible: 1, 168 mousePause: 1, 169 controls: { 170 up: '.up', 171 down: '.down' 172 } 173 }); 174 175 /* 14. To Top Button */ 176 $().UItoTop({ 177 easingType: 'easeOutQuart' 178 }); 179 180 /* 15. Owl Carousel - News Slider & Schedule Slider */ 181 $("#news-slider,#sidebar-schedule-slider").owlCarousel({ 182 autoPlay: 5000, 183 stopOnHover: true, 184 navigation: true, 185 navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"], 186 paginationSpeed: 1000, 187 goToFirstSpeed: 2000, 188 singleItem: true, 189 autoHeight: true, 190 transitionStyle: "fade" 191 }); 192
193 /* 16. Owl Carousel - Big Gallery Slider-1 */ 194 $("#big-gallery-slider-1").owlCarousel({ 195 navigation: true, 196 navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"], 197 items: 3 // 3 visible items 198 }); 199 200 /* 17. Owl Carousel - Big Gallery Slider-2 */ 201 $("#big-gallery-slider-2").owlCarousel({ 202 navigation: true, 203 navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"], 204 items: 4 // 4 visible items 205 }); 206 207 /* 18. Owl Carousel - Big Gallery Slider-3 */ 208 $("#big-gallery-slider-3").owlCarousel({ 209 navigation: true, 210 navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"], 211 items: 5 // 5 visible items 212 }); 213 214 /* 19. Owl Carousel - Small Gallery Slider */ 215 $("#small-gallery-slider").owlCarousel({ 216 navigation: true, 217 navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"], 218 items: 4, // 4 items above 1400px browser width 219 itemsDesktop: [1400, 3], // 3 items between 1400px and 901px 220 itemsDesktopSmall: [900, 2], // 2 items betweem 900px and 601px 221 itemsTablet: [600, 1], // 1 items between 600 and 0 222 itemsMobile: false // itemsMobile disabled - inherit from itemsTablet option 223 }); 224 225 /* 20. Clock */ 226 function getDate() { 227 var date = new Date(); 228 var weekday = date.getDay(); 229 var month = date.getMonth(); 230 var day = date.getDate(); 231 var year = date.getFullYear(); 232 var hour = date.getHours(); 233 var minutes = date.getMinutes(); 234 var seconds = date.getSeconds(); 235 if (hour < 10) hour = "0" + hour; 236 if (minutes < 10) minutes = "0" + minutes; 237 if (seconds < 10) seconds = "0" + seconds; 238 var monthNames = ["January", "February", "Sep", "April", "May", "June", "July", "August", 239 "September", "October", "December", "December" 240 ]; 241 var weekdayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", 242 "Saturday" 243 ]; 244 var ampm = " PM "; 245 if (hour < 12) ampm = " AM "; 246 if (hour > 12) hour -= 12; 247 var showDate = weekdayNames[weekday] + ", " + monthNames[month] + " " + day + ", " + year; 248 var showTime = hour + ":" + minutes + ":" + seconds + ampm; 249 document.getElementById('date').innerHTML = showDate; 250 document.getElementById('time').innerHTML = showTime; 251 requestAnimationFrame(getDate); 252 } 253 getDate(); 254 255 /* 21. Subscribe Form */ 256 $('#subscribeForm').ketchup().submit(function() { 257 if ($(this).ketchup('isValid')) { 258 var action = $(this).attr('action'); 259 $.ajax({ 260 url: action, 261 type: 'POST', 262 data: { 263 email: $('#address').val() 264 }, 265 success: function(data) { 266 $('#result').html(data); 267 }, 268 error: function() { 269 $('#result').html('Sorry, an error occurred.'); 270 } 271 }); 272 } 273 return false; 274 }); 275 276 /* 22. Exchange Rates */ 277 $.getJSON("https://api.fixer.io/latest?base=USD", function(data) { 278 var cDate = data.date; 279 $('#cdate').append(' ' + cDate); 280 $('#euro').append(" " + data.rates.EUR); 281 $('#pound').append(" " + data.rates.GBP); 282 $('#yen').append(" " + data.rates.JPY); 283 $('#franc').append(" " + data.rates.CHF); 284 $('#cdollar').append(" " + data.rates.CAD); 285 $('#adollar').append(" " + data.rates.AUD); 286 $('#ron').append(" " + data.rates.RON); 287 $('#rub').append(" " + data.rates.RUB); 288 }); 289 290 /* 23. Currency Converter */ 291 $.get('http://api.fixer.io/latest?base=ZAR', function(data) { 292 var countryObject = data.rates; 293 for (var key in countryObject) { 294 if (countryObject.hasOwnProperty(key)) { 295 $('select').append('<option val="' + key + '">' + key + '</option>'); 296 } 297 } 298 $('.convertFrom').change(function() { 299 var thisValue = $('.convertFrom .selectpicker').val(); 300 $.get('http://api.fixer.io/latest?base=' + thisValue, function(newData) { 301 countryObject = newData.rates; 302 }); 303 }); 304 $('form').on('submit', function(e) { 305 e.preventDefault(); 306 var convertingTo = $('.convertTo .selectpicker').val(),
307 toRate = countryObject[convertingTo], 308 amount = $('.currencyValue').val(); 309 var calculation = amount * toRate; 310 if (calculation === 0) { 311 $('.output').html('Please enter a valid amount.'); 312 } else { 313 $('.output').html(parseFloat(calculation).toFixed(3)); 314 } 315 }); 316 }); 317 318 /* 24. Sidebar Weather */ 319 var currWeather = {}; 320 $(document).ready(function() { 321 currWeather = getLocationAndWeather('imperial'); 322 $('.btn').click(switchScale); 323 }); 324 325 function switchScale() { 326 if ($('.btn>.switch').text() === 'C') { 327 $('.btn>.switch').text('F'); 328 $('.btn').blur(); 329 getLocationAndWeather('imperial'); 330 } else { 331 $('.btn>.switch').text('C'); 332 $('.btn').blur(); 333 getLocationAndWeather('metric'); 334 } 335 } 336 337 function getLocationAndWeather(scale) { 338 return getWeather({ 339 lat: -37.817011, 340 long: 144.955882 341 }, scale); 342 } 343 344 function getWeather(location, scale) { 345 $.getJSON('http://api.openweathermap.org/data/2.5/weather', { 346 APPID: '7f30b337860dafa75e8a7214e781c455', 347 lat: location.lat, 348 lon: location.long, 349 units: scale 350 }, function(results) { 351 var wthr = { 352 city: results.name, 353 wind_speed: (parseFloat(results.wind.speed) * 2.2369362920544).toFixed(1), 354 type: results.weather[0].main, 355 humidity: results.main.humidity, 356 temp: results.main.temp 357 }; 358 setWeather(wthr, scale); 359 return wthr; 360 }); 361 } 362 363 function setWeather(weather, scale) { 364 $('.weather-city-text', '#weather').text(weather.city); 365 $('#type').text(weather.type); 366 $('#humidity').text('Humidity: ' + weather.humidity + '%'); 367 var spdUnit = 'm/s'; 368 if (scale === 'imperial') spdUnit = 'mph'; 369 $('#wind').text('Wind: ' + weather.wind_speed + spdUnit); 370 $('.temperature', '#weather').text(weather.temp); 371 setWeatherType(weather.type); 372 } 373 374 function setWeatherType(wType) { 375 var icons = { 376 Clear: ['wi-day-sunny', '#CFD8DC'], 377 Rain: ['wi-rain', '#CFD8DC'], 378 Clouds: ['wi-cloudy', '#CFD8DC'], 379 Mist: ['wi-fog', '#CFD8DC'], 380 Thunderstorm: ['wi-thunderstorm', '#CFD8DC'], 381 Snow: ['wi-snow', '#CFD8DC'] 382 }; 383 var $iconElem = $('.weather-icon', '#weather'); 384 //Change the icon 385 $iconElem.removeClass('wi-day-sunny wi-rain wi-cloudy wi-fog wi-thunderstorm wi-snow') 386 .addClass(icons[wType][0]) 387 .css({ 388 'color': icons[wType][1] 389 }); 390 } 391 392 /* 25. FitVids plugin for readjusting video sizes */ 393 $(".video-container").fitVids(); 394 395 /* 26. Sidebar Scroll */ 396 $(".sidebar-scroll").mCustomScrollbar({ 397 setWidth: false, 398 setHeight: 876, 399 setTop: 0, 400 setLeft: 0, 401 axis: "y", 402 scrollbarPosition: "outside", 403 scrollInertia: 950, 404 autoDraggerLength: true, 405 autoHideScrollbar: false, 406 autoExpandScrollbar: false, 407 alwaysShowScrollbar: 0, 408 snapAmount: null, 409 snapOffset: 0, 410 mouseWheel: { 411 enable: true, 412 scrollAmount: 200, 413 axis: "y", 414 preventDefault: false, 415 deltaFactor: "auto", 416 normalizeDelta: true, 417 invert: false, 418 disableOver: ["select", "option", "keygen", "datalist", "textarea"] 419 }, 420 scrollButtons: { 421 enable: false, 422 scrollType: "stepless", 423 scrollAmount: "auto" 424 }, 425 keyboard: { 426 enable: true, 427 scrollType: "stepless", 428 scrollAmount: "auto" 429 }, 430 contentTouchScroll: 25, 431 advanced: { 432 autoExpandHorizontalScroll: false, 433 autoScrollOnFocus: "input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']", 434 updateOnContentResize: true, 435 updateOnImageLoad: true, 436 updateOnSelectorChange: false, 437 releaseDraggableSelectors: false 438 }, 439 theme: "light", 440 callbacks: { 441 onInit: false, 442 onScrollStart: false, 443 onScroll: false, 444 onTotalScroll: false, 445 onTotalScrollBack: false, 446 whileScrolling: false, 447 onTotalScrollOffset: 0, 448 onTotalScrollBackOffset: 0, 449 alwaysTriggerOffsets: true, 450 onOverflowY: false, 451 onOverflowX: false, 452 onOverflowYNone: false, 453 onOverflowXNone: false 454 }, 455 live: false, 456 liveSelector: null 457 }); 458 459})(jQuery); 460
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.