1/** 2 * Title: Dashcore - HTML App Landing Page - Main Javascript file 3 * Author: http://themeforest.net/user/5studiosnet 4 **/ 5 6(function() { 7 'use strict'; 8 9 // Avoid `console` errors in browsers that lack a console. 10 var method; 11 var noop = function () {}; 12 var methods = [ 13 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 14 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 15 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 16 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' 17 ]; 18 var length = methods.length; 19 var console = (window.console = window.console || {}); 20 21 while (length--) { 22 method = methods[length]; 23 24 // Only stub undefined methods. 25 if (!console[method]) { 26 console[method] = noop; 27 } 28 } 29}()); 30 31// Place any code in here. 32$(function(){ 33 'use strict'; 34 35 /** navbar reference **/ 36 var $navbar = $(".main-nav"), 37 stickyPoint = 90; 38 39 /** Perspective mockups reference **/ 40 var $perspectiveMockups = $(".perspective-mockups"); 41 42 // This element is used as reference for relocation of the mockups on mobile devices. 43 // If you remove it please be sure you add another reference element preferably within the same section and/or position the button was. 44 // You can change the selector (".learn-more") to one that uniquely identifies the reference element. 45 var $topReference = $(".learn-more", ".lightweight-template"); 46 47 var setMockupsTop = function() { 48 // check if the perspective mockups elements are on the page, if you're not going to use them, you can remove all its references 49 if (!$perspectiveMockups.length) return; 50 51 if ($(window).outerWidth() < 768) { 52 $perspectiveMockups.css({top: $topReference.offset().top + "px"}); 53 return; 54 } 55 56 $perspectiveMockups.removeAttr("style"); 57 }; 58 59 var navbarSticky = function() { 60 if ($(window).scrollTop() >= stickyPoint) { 61 $navbar.addClass("navbar-sticky"); 62 } else { 63 $navbar.removeClass("navbar-sticky"); 64 } 65 }; 66 67 /** 68 * STICKY MENU 69 **/ 70 $(window).on("scroll", navbarSticky); 71 72 navbarSticky(); 73 74 /** 75 * SCROLLING NAVIGATION 76 * Enable smooth transition animation when scrolling 77 **/ 78 $('a.scrollto').on('click', function (event) { 79 event.preventDefault(); 80 81 var scrollAnimationTime = 1200; 82 var target = this.hash; 83 84 $('html, body').stop().animate({ 85 scrollTop: $(target).offset().top - 45 86 }, scrollAnimationTime, 'easeInOutExpo', function () { 87 window.location.hash = target; 88 }); 89 }); 90 91 /** 92 * NAVBAR SIDE COLLAPSIBLE - On Mobiles 93 **/ 94 $(".navbar-toggler", $navbar).on("click", function() { 95 if (!$navbar.is('.st-nav')) $navbar.toggleClass("navbar-expanded"); 96 }); 97 98 /** 99 * Blog interaction with buttons: favorite and bookmark 100 **/ 101 $('.card-blog').on({ 102 click: function (e) { 103 e.preventDefault(); 104 105 var $el = $(this).removeClass('far').addClass('fas'); 106 if ($el.hasClass('favorite')) { 107 $el.addClass('text-danger'); 108 } else { 109 $el.addClass('text-warning'); 110 } 111 }, 112 mouseenter: function () { 113 $(this).addClass('fas'); 114 }, 115 mouseleave: function () { 116 $(this).removeClass('fas'); 117 } 118 }, 'i.far'); 119 120 /** 121 * Position the perspective mockups at the end of the first content section on mobile 122 **/ 123 $perspectiveMockups.removeClass("hidden-preload"); 124 $(window).on("resize", setMockupsTop); 125 126 setMockupsTop(); 127 128 /** PLUGINS INITIALIZATION */ 129 /* Bellow this, you can remove the plugins you're not going to use. 130 * If you do so, remember to remove the script reference within the HTML. 131 **/ 132 133 /** 134 * Handle the login form, once the server has sent a successful response 135 **/ 136 $('.login-form form').on('form.submitted', function(evt, data) { 137 window.location.replace('admin/'); 138 }); 139 140 /** 141 * Prettyprint 142 **/ 143 window.prettyPrint && prettyPrint(); 144 145 /** 146 * AOS 147 * Cool scrolling animations 148 **/ 149 AOS.init({ 150 offset: 100, 151 duration: 1500, 152 disable: 'mobile' 153 }); 154 155 /** 156 * typed.js 157 **/ 158 if ($(".typed").length) { 159 $(".typed").each(function (i, el) { 160 var strings = $(el).data("strings"); 161 162 var typed = new Typed('.typed', {
163 strings: strings, 164 typeSpeed: 150, 165 backDelay: 500, 166 backSpeed: 50, 167 loop: true 168 }); 169 }); 170 } 171 172 /** 173 * COUNTERS 174 **/ 175 if ($(".counter").length) { 176 $(".counter").each(function(i, el) { 177 new Waypoint({ 178 element: el, 179 handler: function() { 180 counterUp.default(el); 181 this.destroy(); 182 }, 183 offset: 'bottom-in-view' 184 }); 185 }); 186 } 187 188 /** 189 * POPUPS 190 **/ 191 (function() { 192 $('.modal-popup').each(function () { 193 var $element = $(this); 194 195 // Some default to apply for all instances of Modal 196 var defaults = { 197 removalDelay: 500, 198 preloader: false, 199 midClick: true, 200 callbacks: { 201 beforeOpen: function() { 202 this.st.mainClass = this.st.el.attr('data-effect'); 203 } 204 } 205 }; 206 207 // Defaults to use for specific types 208 var typeDefaults = { 209 image: { 210 closeOnContentClick: true 211 }, 212 gallery: { 213 delegate: 'a', 214 // when gallery is used change the type to 'image' 215 type: 'image', 216 tLoading: 'Loading image #%curr%...', 217 mainClass: 'mfp-with-zoom mfp-img-mobile', 218 gallery: { 219 enabled: true, 220 navigateByImgClick: true, 221 preload: [0,1] // Will preload 0 - before current, and 1 after the current image 222 }, 223 image: { 224 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.' 225 } 226 } 227 }; 228 229 // Load configuration values from data attributes 230 var type = $element.data('type') || 'inline'; 231 var zoomSpeed = $element.data('zoom') || false; 232 var focus = $element.data('focus') || false; 233 234 var attributes = {}; 235 236 if (zoomSpeed) { 237 attributes.zoom = { 238 enabled: true, 239 duration: zoomSpeed 240 } 241 } 242 243 if (focus) { 244 attributes.focus = focus; 245 } 246 247 // According to the type, get the JSON configuration for each 248 $.each(['image', 'gallery'], function () { 249 var attr = $element.data(this) || false; 250 251 if (attr) { 252 typeDefaults[type][this] = attr; 253 } 254 255 // remove the values from the markup 256 $element.removeAttr("data-" + this); 257 }); 258 259 var options = $.extend({}, defaults, { 260 type: type 261 }, typeDefaults[type], attributes); 262 263 $element.magnificPopup(options); 264 }); 265 266 $(document).on('click', '.modal-popup-dismiss', function (e) { 267 e.preventDefault(); 268 $.magnificPopup.close(); 269 }); 270 })(); 271 272 /** 273 * ANIMATION BAR 274 **/ 275 (function () { 276 $(".whyus-progress-bars").animateBar({ 277 orientation: "horizontal", 278 step: 100, 279 duration: 1000, 280 elements: [ 281 { label: "Implementation", value: 73, style: { progress: "progress-xs" } }, // style: { progress: "progress-4" } 282 { label: "Design", value: 91, style: { progress: "progress-xs" } }, 283 { label: "Beauty", value: 97, style: { progress: "progress-xs" } }, 284 { label: "Branding", value: 61, style: { progress: "progress-xs" } }, 285 { label: "Responsiveness", value: 100, style: { progress: "progress-xs" } } 286 ] 287 }); 288 })(); 289 290 /** 291 * Feather Icons 292 **/ 293 feather.replace(); 294 295 /** 296 * Prismjs 297 **/ 298 299 300 /** 301 * PRICING TABLES 302 **/ 303 $(".pricing-table-basis").on("change", 'input[name="pricing-value"]', function() { 304 var period = this.value; 305 306 $(".odometer").each(function() { 307 this.innerHTML = $(this).data(period + "-price"); 308 }); 309 }); 310 311 // TODO: isolate wizard stuff in a single file 312 /** WIZARD 313 * Each wizard has its own configuration, if you're going to use one or another please make sure the selector matches the one used bellow 314 * You can remove the code you're not going to use to speed up the site. 315 **/ 316 (function() { 317 var defaultConfig = { 318 showStepURLhash: false, // not show the hash on URL 319 theme: 'circles', 320 anchorSettings: { 321 enableAllAnchors: true, // Activates all anchors clickable all times 322 removeDoneStepOnNavigateBack: true // remove the "done" on visited steps when navigating back 323 }, 324 useURLhash: true // Enable selection of the step based on url hash 325 }; 326 327 // 1. BASIC WIZARD 328 // This is a basic configuration, just setting the theme and default configuration 329 $("#basic-wizard").smartWizard(defaultConfig); 330 331 // 2. AJAX WIZARD
332 // To load a step content from ajax just add "data-content-url" attribute to the step. 333 $("#ajax-wizard").smartWizard(defaultConfig); 334 335 // 3. FORM WIZARD 336 // Another way to load content through ajax is set the "contentUrl" via setting 337 // this will send all requests to the same endpoint, you can take control of it via "step_number" variable sent automatically 338 339 // Save the wizard variable, we'll used it below to work with it 340 var $formWizard = $("#form-wizard"); 341 var options = $.extend({}, defaultConfig, { 342 contentURL: "wizard/get-form/", 343 ajaxSettings: { 344 type: 'GET' 345 } 346 }); 347 var ajaxFormWizard = $formWizard.smartWizard(options); 348 var doAjax = function($form, config) { 349 var dfd = new $.Deferred(); 350 var settings = $.extend(true, {}, config, { 351 url: $form.attr('action'), 352 type: 'POST', 353 data: $form.serializeArray(), 354 dataType: 'json', 355 beforeSend: function () { 356 $formWizard.smartWizard('block'); 357 } 358 }); 359 360 $.ajax(settings).done(function(data) { 361 if (data.result) { 362 $form.trigger("form.submitted", [data]); 363 364 $("input, textarea", $form).removeClass("error"); 365 $form.addClass('submitted'); 366 } else { 367 if (data.errors) { 368 $.each(data.errors, function(i, v) { 369 var $input = $("[name$='[" + i + "]']", $form).addClass('error'); 370 $input 371 .tooltip({title: v, placement: 'bottom', trigger: 'manual'}).tooltip('show') 372 .on('focus', function() { $(this).tooltip('destroy'); }); 373 }); 374 } 375 } 376 377 $formWizard.smartWizard('unblock'); 378 dfd.resolve(data.result); 379 }).fail(function() { 380 $formWizard.smartWizard('unblock'); 381 382 //show failure message 383 dfd.reject(); 384 }); 385 386 return dfd.promise(); 387 }; 388 389 ajaxFormWizard 390 .on("leaveStep", function(evt, anchorObject, stepNumber, stepDirection) { 391 var $form = $("#form-step-" + stepNumber, $formWizard); 392 393 // stepDirection === 'forward' :- this condition allows to do the form validation 394 // only on forward navigation, that makes easy navigation on backwards still do the validation when going next 395 if(stepDirection === 'forward' && $form.length) { 396 if (!$form.valid()) { 397 return false; 398 } 399 400 return doAjax($form); 401 } 402 403 return true; 404 }) 405 .on("showStep", function (evt, anchorObject, stepNumber, stepDirection) { 406 var validateOptions = { 407 errorPlacement: function(error, element) { 408 var $parent = element.parent(); 409 410 if ($parent.hasClass("input-group")) { 411 error.insertAfter($parent); 412 } else if ($parent.hasClass("has-icon")) { 413 error.insertBefore($parent); 414 } else if ($parent.hasClass("control")) { 415 error.insertAfter(element.next('.control-label')); 416 } else { 417 error.insertAfter(element); 418 } 419 } 420 }; 421 422 var $form = $("#form-step-" + stepNumber, $formWizard); 423 $form.validate(validateOptions); 424 425 // some work with step-2 (pricing plans) 426 if (stepNumber === 2) { 427 $("input[type=radio]", $form).on("change", function (e) { 428 $(e.target) 429 .closest('.row') 430 .find(".card") 431 .removeClass('b b-3'); 432 433 $(e.target) 434 .closest(".card") 435 .addClass("b b-3"); 436 }); 437 } 438 }); 439 })(); 440});
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.