Copied
'+$(this).attr('data-icon')+' to clipboard');
+ });
+}
+function getCssVar(alias) {
+ return getComputedStyle(document.body).getPropertyValue(alias);
+}
+function buildSwatchGroup(id, alias, prefix) {
+ var el = $('body #'+id);
+ if (el) {
+ var colors = getCssVar(alias).split(',');
+ colors.forEach(function(color) {
+ var hex = getCssVar(prefix+color);
+ var html = [
+ '
',
+ '
',
+ '
'+color+'
',
+ '
'+hex+'
',
+ '
'
+ ].join('');
+ el.append(html);
+ });
+ }
+}
+function populateSwatches() {
+ buildSwatchGroup('brand-colors', '--cui-brand-colors', '--cui-color-');
+ buildSwatchGroup('theme-colors', '--cui-theme-colors', '--cui-theme-');
+ buildSwatchGroup('gray-colors', '--cui-gray-colors', '--cui-color-');
+ buildSwatchGroup('status-colors', '--cui-status-colors', '--cui-color-');
+ buildSwatchGroup('misc-colors', '--cui-misc-colors', '--cui-color-');
+}
+function highlightString(str, searchStr) {
+ return '
' + searchStr + '' + str.substring(searchStr.length, str.length) + '';
+}
+function getStorageData(key) {
+ return localStorage.getItem(key);
+}
+function setStorageData(key, value) {
+ localStorage.setItem(key, value);
+}
+function getQueryParam(key) {
+ var url = window.location.search.substring(1);
+ var urlVars = url.split('&');
+ for (var ii = 0; ii < urlVars.length; ii++) {
+ var urlParam = urlVars[ii].split('=');
+ if (urlParam[0] === key) {
+ return urlParam[1];
+ }
+ }
+}
+function setQueryParam(key, value) {
+ if (history.pushState) {
+ var params = new URLSearchParams(window.location.search);
+ params.set(key, value);
+ var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + params.toString();
+ window.history.pushState({path:newUrl},'',newUrl);
+ }
+}
+function populateSearchEntries() {
+ allEntries = [];
+ var entries = $('#search-dictionary .searchable');
+ for (var ii=0;ii
Panel '+ii+'
');
+ }
+ wireCards();
+}
+function wireAccordion() {
+ $('body .accordion > li > a').click(function() {
+ $(this).parent().toggleClass('active');
+ });
+}
+function wireScrollToTop() {
+ $(window).scroll(function () {
+ if ($(this).scrollTop() > 100) {
+ $('#scroll-to-top').fadeIn(500);
+ } else {
+ $('#scroll-to-top').fadeOut(500);
+ }
+ });
+ $('#scroll-to-top').click(function () {
+ $("html, body").animate({
+ scrollTop: 0
+ }, 100);
+ return false;
+ });
+}
+function wireCards() {
+ $('body #grid .panel').click(function() {
+ if ($(this).parent().hasClass('grid--selectable')) {
+ $(this).toggleClass('selected');
+ }
+ });
+ $('body #grid-cards').change(function() {
+ addCards($(this).val());
+ });
+ $('body #grid .panel #grid-card-cols').click(function(e) {
+ e.stopPropagation();
+ });
+ $('body #grid .panel #grid-card-cols').change(function() {
+ removeClassWildcard($(this).closest('.panel'), 'card--col-*');
+ $(this).closest('.panel').addClass('card card--col-'+$(this).val());
+ });
+ $('body #grid .panel #grid-card-rows').click(function(e) {
+ e.stopPropagation();
+ });
+ $('body #grid .panel #grid-card-rows').change(function() {
+ removeClassWildcard($(this).closest('.panel'), 'card--row-*');
+ $(this).closest('.panel').addClass('card card--row-'+$(this).val());
+ });
+}
+function calcSearchWindowHeight() {
+ var el = $('#search-results');
+ var maxHeight = ($(window).height() - $('#search-kit').offset().top - $('#search-kit').height() - 40);
+ el.css('max-height', maxHeight + 'px');
+}
+function shouldHideSidebar() {
+ if (window.innerWidth < 768) {
+ $('#styleguideSidebar').addClass('sidebar--hidden');
+ } else {
+ $('#styleguideSidebar').addClass('sidebar--mini');
+ $('#styleguideSidebar').removeClass('sidebar--hidden');
+ }
+}
+function startGaugeAnimation() {
+ curGaugeTimer = setTimeout(function () {
+ curGaugeProgress += Math.floor(Math.random() * 10);
+ curGaugeProgress = (curGaugeProgress >= 100) ? 100 : curGaugeProgress;
+ $('body #gauge-example').attr('data-percentage', curGaugeProgress);
+ $('body #gauge-example #gauge-example-value').html(curGaugeProgress);
+ if (curGaugeProgress !== 100) {
+ startGaugeAnimation();
+ }
+ }, 100);
+}
+function startProgressAnimation() {
+ curProgressTimer = setTimeout(function () {
+ curProgress += Math.floor(Math.random() * 10);
+ curProgress = (curProgress >= 100) ? 100 : curProgress;
+ $('body #progressbar-size .progressbar').attr('data-percentage', curProgress);
+ $('body #progressbar-size .progressbar .progressbar__label').html(curProgress + '%');
+ if (curProgress !== 100) {
+ startProgressAnimation();
+ }
+ }, 100);
+}
+function jumpTo(ref) {
+ document.location.href = "section-"+ref+".html#"+ref;
+}
+function doNav(url) {
+ shouldHideSidebar();
+ document.location.href = url;
+}
+function updateUrl(ref, pattern) {
+ var path = window.location.pathname;
+ var url = path + '#' + ref;
+ history.pushState({ id: url }, 'Cisco UI Kit - ' + ref, url);
+
+ startPageAnimation(pattern);
+}
+function updateScrollSpy(activeElem) {
+
+ if (scrollSpy) { scrollSpy.destroy(); }
+ $('#subTabs').empty();
+
+ for (var ii=0;ii