source/javascripts/scripts.js (55 lines of code) (raw):

function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } $(function() { var $ci = $('#ci-subt'), $tagLine = $('#tagline'), $hireUs = $('#hire-us'), $tabs = $('#tabs'), $imageLink = $('.image-link'); $("input").not("[type=submit]").jqBootstrapValidation(); if (getUrlParameter('s') == 'ph' && $ci.length) { $ci.append('<br><br>Hello, Product Hunters!<br><br> Get 75% off a GitLab.com bronze subscription forever! <br> Use the code: producthunt75'); } // Consultancy if ($tagLine.length && $hireUs.length) { $tagLine.addClass('animated fadeInLeft'); $hireUs.addClass('animated bounceIn'); } // Tabs if ($tabs.length) { var current = window.location.hash; $('.tab:not(' + current +')', $tabs).hide(); window.scrollTo(0, 0); $(".dropdown-menu a").on('click', function (e) { e.preventDefault(); var selText = $(this).text(), current = $(this).attr('href'); $(this).parents('.btn-group').find('.dropdown-toggle').html(selText +' <span class="caret"></span>'); $('.tab:not(' + current +')', $tabs).hide(); $(current).show(); window.location.replace(window.location.origin + window.location.pathname + current); window.scrollTo(0, 0); $(this).dropdown('toggle'); return false; }); } if ($imageLink.length) { $imageLink.magnificPopup({ type:'image' }); } $(window).on("hashchange", function () { var extraHeight = $('.navbar-header').outerHeight(); var $qnav = $('#qnav'); if ($qnav.length) { extraHeight += $qnav.outerHeight(); } window.scrollTo(window.scrollX, window.scrollY - extraHeight); }); });