Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Release 3.2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidap committed Dec 21, 2017
1 parent ae89e5e commit 45603d7
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 42 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.1
3.2.0
4 changes: 2 additions & 2 deletions build/css/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/css/print.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/css/vendors.css

Large diffs are not rendered by default.

68 changes: 36 additions & 32 deletions build/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// Init Typeahead on search-fields
$searchFields.typeahead({
hint: true,
hint: false,
highlight: true,
minLength: 1
},
Expand All @@ -35,14 +35,6 @@
});
}

// Insert the icons
$searchFields.after('<span class="icon icon--close" data-form-search-clear></span>');
$('.form-search').append('<button class="icon icon--search icon--before"><span class="sr-only">Search</span></button>');

$('body').on('click', '[data-form-search-clear]', function () {
$('#search-field').val('').focus(); // clear search field and refocus it
});

}) (jQuery, (typeof searchData === 'undefined' ? false : searchData));

/* ==========================================================
Expand Down Expand Up @@ -192,7 +184,7 @@ function disableControl(element) {
// Ensure every first collapse toggle for accordions is accessible
// (cf. https://github.com/paypal/bootstrap-accessibility-plugin/issues/98):
$('[aria-multiselectable="true"]').each(function() {
console.log($(this).find('[data-toggle="collapse"][data-parent]').first().attr({tabindex: 0}));
$(this).find('[data-toggle="collapse"][data-parent]').first().attr({tabindex: 0});
});

}) (jQuery);
Expand Down Expand Up @@ -330,7 +322,7 @@ $.printPreview = {
footnoteLinks = "",
linksIndex = 0;

$body.find('.nav-mobile, .drilldown, .nav-main, .header-separator, .nav-service, .nav-lang, .form-search, .yamm--select, header > div:first-child, footer, .alert, .icon--print, .social-sharing, form, .nav-process, .carousel-indicators, .carousel-control, .breadcrumb, .pagination-container').remove();
$body.find('.nav-mobile, .drilldown, .nav-main, .header-separator, .nav-service, .nav-lang, .form-search, .yamm--select, footer, .alert, .icon--print, .social-sharing, form, .nav-process, .carousel-indicators, .carousel-control, .breadcrumb, .pagination-container').remove();

// if an element is passed, we want it to be the only thing to print out
if (element) {
Expand Down Expand Up @@ -442,6 +434,11 @@ $.printPreview = {
});
});

// "tabindex = -1" is added by bootstrap-accessibility-plugin to dropdown's elements.
// The yamm menu uses the dropdown class, but is not a conventional dropdown, hence, the tabindex must not
// be present.
$dropdown.find('li a').removeAttr('tabindex');

$dropdownToggle.on('click', function() {
$(this).parents($dropdown).trigger('get.hidden');
});
Expand Down Expand Up @@ -492,10 +489,10 @@ $.printPreview = {
var links = $('.dropdown-menu li a', $(this));
var suggestions = [];
links.each(function() {
suggestions.push({
title: $(this).html(),
link: $(this).attr('href')
});
suggestions.push({
title: $(this).html(),
link: $(this).attr('href')
});
});
if (!suggestions.length) {
return;
Expand All @@ -515,19 +512,19 @@ $.printPreview = {
templates: {
empty: function() {
return [
'<li><h3>',
'<li class="search-result-header">',
title,
'</h3></li>',
'</li>',
'<li>',
window.translations['global-search']['nothing-found'],
'</li>',
'</li>'
].join('');
},
header: function() {
return [
'<li><h3>',
'<li class="search-result-header">',
title,
'</h3></li>'
'</li>'
].join('');
},
dataset: '<ul><ul>',
Expand All @@ -540,6 +537,7 @@ $.printPreview = {

function initTypeahead(element) {
$('.search-input', element).typeahead({
hint: false,
highlight: true,
menu: $('.search-results .search-results-list', element),
classNames: {
Expand All @@ -548,45 +546,51 @@ $.printPreview = {
}
}, datasets)
.on('typeahead:selected', function (event, selection) {
event.preventDefault();
$(this).typeahead('val', '')
.closest('.global-search').removeClass('has-input');
window.location.replace(selection.link);
})
event.preventDefault();
window.location.replace(selection.link);
})
.on('typeahead:open', function() {
$(this).closest('.global-search').addClass('focused');
console.log($(this).typeahead('val'));
})
.on('typeahead:close', function () {
.on('typeahead:close', function() {
$(this).closest('.global-search').removeClass('focused');
//$(this).closest('form').trigger('reset');
})
.on('keyup', function (event) {
if (event.keyCode === 27) { // ESC
$(this).closest('form').trigger('reset');
} else if ($(this).typeahead('val')) {
$(this).closest('.global-search').addClass('has-input');
$(this).closest('.global-search').addClass('has-input');
} else {
$(this).closest('.global-search').removeClass('has-input');
}
});
}
});

$('form', element)
.on('submit', function() {
return false;
})
.on('reset', function() {
$('.search-input', this).blur().typeahead('val', '');
$('.search-input', this).typeahead('val', '');
$(this).closest('.global-search').removeClass('has-input');
});

$('.search-reset', element).on('click', function() {
$(this).closest('form').trigger('reset');
$('.search-input', element).focus();
});
}

initTypeahead($('.global-search-standard'));
initTypeahead($('.global-search-mobile'));

// Mobile improvements:
$('.nav-mobile .nav-mobile-menu').parent().on('show.bs.dropdown', function () {
setTimeout(function () {
$('.nav-mobile .search-input.tt-input').val(null).focus();
}, 100);
});

})(jQuery);

/* ==========================================================
Expand Down Expand Up @@ -671,7 +675,7 @@ $.printPreview = {
$that.find('.item:first').addClass('active');
$that.find('.carousel-indicators li:first-child').addClass('active');

$that.append('<a class="left carousel-control icon icon--before icon--less" href="#tab-focus-' + focusIndex + '" data-slide="prev"></a><a class="right carousel-control icon icon--before icon--greater" href="#tab-focus-' + focusIndex + '" data-slide="next"></a>');
$that.append('<a class="left carousel-control icon icon--before icon--less" href="#tab-focus-' + focusIndex + '" data-slide="prev" aria-label="previous"></a><a class="right carousel-control icon icon--before icon--greater" href="#tab-focus-' + focusIndex + '" data-slide="next" aria-label="next"></a>');
});
}
else if($tabFocus && $(window).width() > 767 && isCarouselified) {
Expand Down
2 changes: 1 addition & 1 deletion build/js/main.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/js/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17052,8 +17052,8 @@ This file is generated by `grunt build`, do not edit it by hand.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

* ======================================================================== */


(function($) {
"use strict";

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "swiss-styleguide",
"description": "Swiss Confederation Web Guidelines",
"version": "3.1.1",
"version": "3.2.0",
"homepage": "http://swiss.github.io/styleguide",
"contributors": [
{
Expand Down

0 comments on commit 45603d7

Please sign in to comment.