From: Trevor Johns Date: Tue, 12 Apr 2016 17:35:42 +0000 (-0700) Subject: Revert "Merge "Resolve merge conflicts of a5f0068 to nyc-dev" into nyc-dev" X-Git-Tag: android-x86-7.1-r1~348^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bf234fdfba1116cc29e8cc8443d08804843edf94;p=android-x86%2Fbuild.git Revert "Merge "Resolve merge conflicts of a5f0068 to nyc-dev" into nyc-dev" This reverts commit 6edfbfabad1ddbda00e0fcc713672f6e63acdf44, reversing changes made to e09b2c16e32cee89d6b5ac29fe5a905b76872179. --- diff --git a/tools/droiddoc/templates-ndk/sdkpage.cs b/tools/droiddoc/templates-ndk/sdkpage.cs index ffad465cd..817ac47a6 100644 --- a/tools/droiddoc/templates-ndk/sdkpage.cs +++ b/tools/droiddoc/templates-ndk/sdkpage.cs @@ -80,13 +80,13 @@ Platform Package Size (Bytes) - SHA1 Checksum + MD5 Checksum Windows 32-bit + href="http://dl.google.com/android/ndk/"> @@ -94,7 +94,7 @@ + + Linux 32-bit (x86) + + + + + + - - - - etc ... - - - - Control over how the carousel takes over the screen can mostly be defined in - a css file. Setting min-height on the .fullscreen-carousel-content elements - will prevent them from shrinking to far vertically when the browser is very - short, and setting max-height on the .fullscreen-carousel itself will prevent - the area from becoming to long in the case that the browser is stretched very - tall. - - There is limited functionality for having multiple sections since that request - was removed, but it is possible to add .next-arrow and .prev-arrow elements to - scroll between multiple content areas. -*/ - -(function() { - $(document).ready(function() { - $('.fullscreen-carousel').each(function() { - initWidget(this); - }); - }); - - function initWidget(widget) { - var $widget = $(widget); - - var topOffset = $widget.offset().top; - var padBottom = parseInt($widget.data('paddingbottom')) || 0; - var maxHeight = 0; - var minHeight = 0; - var $content = $widget.find('.fullscreen-carousel-content'); - var $nextArrow = $widget.find('.next-arrow'); - var $prevArrow = $widget.find('.prev-arrow'); - var $curSection = $($content[0]); - - if ($content.length <= 1) { - $nextArrow.hide(); - $prevArrow.hide(); - } else { - $nextArrow.click(function() { - var index = ($content.index($curSection) + 1); - $curSection.hide(); - $curSection = $($content[index >= $content.length ? 0 : index]); - $curSection.show(); - }); - - $prevArrow.click(function() { - var index = ($content.index($curSection) - 1); - $curSection.hide(); - $curSection = $($content[index < 0 ? $content.length - 1 : 0]); - $curSection.show(); - }); - } - - // Just hide all content sections except first. - $content.each(function(index) { - if ($(this).height() > minHeight) minHeight = $(this).height(); - $(this).css({position: 'absolute', display: index > 0 ? 'none' : ''}); - }); - - // Register for changes to window size, and trigger. - $(window).resize(resizeWidget); - resizeWidget(); - - function resizeWidget() { - var height = $(window).height() - topOffset - padBottom; - $widget.width($(window).width()); - $widget.height(height < minHeight ? minHeight : - (maxHeight && height > maxHeight ? maxHeight : height)); - } - } -})(); - -/* - Tab Carousel - - The following allows tab widgets to be installed via the html below. Each - tab content section should have a data-tab attribute matching one of the - nav items'. Also each tab content section should have a width matching the - tab carousel. - - HTML: - - - -*/ -(function() { - $(document).ready(function() { - $('.tab-carousel').each(function() { - initWidget(this); - }); - }); - - function initWidget(widget) { - var $widget = $(widget); - var $nav = $widget.find('.tab-nav'); - var $anchors = $nav.find('[data-tab]'); - var $li = $nav.find('li'); - var $contentContainer = $widget.find('.tab-carousel-content'); - var $tabs = $contentContainer.find('[data-tab]'); - var $curTab = $($tabs[0]); // Current tab is first tab. - var width = $widget.width(); - - // Setup nav interactivity. - $anchors.click(function(evt) { - evt.preventDefault(); - var query = '[data-tab=' + $(this).data('tab') + ']'; - transitionWidget($tabs.filter(query)); - }); - - // Add highlight for navigation on first item. - var $highlight = $('
').addClass('highlight') - .css({left:$li.position().left + 'px', width:$li.outerWidth() + 'px'}) - .appendTo($nav); - - // Store height since we will change contents to absolute. - $contentContainer.height($contentContainer.height()); - - // Absolutely position tabs so they're ready for transition. - $tabs.each(function(index) { - $(this).css({position: 'absolute', left: index > 0 ? width + 'px' : '0'}); - }); - - function transitionWidget($toTab) { - if (!$curTab.is($toTab)) { - var curIndex = $tabs.index($curTab[0]); - var toIndex = $tabs.index($toTab[0]); - var dir = toIndex > curIndex ? 1 : -1; - - // Animate content sections. - $toTab.css({left:(width * dir) + 'px'}); - $curTab.animate({left:(width * -dir) + 'px'}); - $toTab.animate({left:'0'}); - - // Animate navigation highlight. - $highlight.animate({left:$($li[toIndex]).position().left + 'px', - width:$($li[toIndex]).outerWidth() + 'px'}) - - // Store new current section. - $curTab = $toTab; - } - } - } -})(); - -/** - * Auto TOC - * - * Upgrades h2s on the page to have a rule and be toggle-able on mobile. - */ -(function($) { - var upgraded = false; - var h2Titles; - - function initWidget() { - // add HRs below all H2s (except for a few other h2 variants) - // Consider doing this with css instead. - h2Titles = $('h2').not('#qv h2, #tb h2, .sidebox h2, #devdoc-nav h2, h2.norule'); - h2Titles.css({paddingBottom:0}).after('
'); - - // Exit early if on older browser. - if (!window.matchMedia) { - return; - } - - // Only run logic in mobile layout. - var query = window.matchMedia('(max-width: 719px)'); - if (query.matches) { - makeTogglable(); - } else { - query.addListener(makeTogglable); - } - } - - function makeTogglable() { - // Only run this logic once. - if (upgraded) { return; } - upgraded = true; - - // Only make content h2s togglable. - var contentTitles = h2Titles.filter('#jd-content *'); - - // If there are more than 1 - if (contentTitles.size() < 2) { - return; - } - - contentTitles.each(function() { - // Find all the relevant nodes. - var $title = $(this); - var $hr = $title.next(); - var $contents = allNextUntil($hr[0], 'h2, .next-docs'); - var $section = $($title) - .add($hr) - .add($title.prev('a[name]')) - .add($contents); - var $anchor = $section.first().prev(); - var anchorMethod = 'after'; - if ($anchor.length === 0) { - $anchor = $title.parent(); - anchorMethod = 'prepend'; - } - - // Some h2s are in their own container making it pretty hard to find the end, so skip. - if ($contents.length === 0) { - return; - } - - // Remove from DOM before messing with it. DOM is slow! - $section.detach(); - - // Add mobile-only expand arrows. - $title.prepend('' + - '' + - '' + - '') - .attr('data-toggle', 'section'); - - // Wrap in magic markup. - $section = $section.wrapAll('
').parent(); - - // extra div used for max-height calculation. - $contents.wrapAll('
'); - - // Pre-expand section if requested. - if ($title.hasClass('is-expanded')) { - $section.addClass('is-expanded'); - } - - // Pre-expand section if targetted by hash. - if (location.hash && $section.find(location.hash).length) { - $section.addClass('is-expanded'); - } - - // Add it back to the dom. - $anchor[anchorMethod].call($anchor, $section); - }); - } - - // Similar to $.fn.nextUntil() except we need all nodes, jQuery skips text nodes. - function allNextUntil(elem, until) { - var matched = []; - - while ((elem = elem.nextSibling) && elem.nodeType !== 9) { - if (elem.nodeType === 1 && jQuery(elem).is(until)) { - break; - } - matched.push(elem); - } - return $(matched); - } - - $(function() { - initWidget(); - }); -})(jQuery); - -(function($, window) { - 'use strict'; - - // Blogger API info - var apiUrl = 'https://www.googleapis.com/blogger/v3'; - var apiKey = 'AIzaSyCFhbGnjW06dYwvRCU8h_zjdpS4PYYbEe8'; - - // Blog IDs can be found in the markup of the blog posts - var blogs = { - 'android-developers': { - id: '6755709643044947179', - title: 'Android Developers Blog' - } - }; - var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December']; - - var BlogReader = (function() { - var reader; - - function BlogReader() { - this.doneSetup = false; - } - - /** - * Initialize the blog reader and modal. - */ - BlogReader.prototype.setup = function() { - $('#jd-content').append( - '
' + - '
' + - '
' + - '
' + - '
' + - '' + - '' + - '' + - '' + - '
' + - '

' + - '
' + - '
' + - '' + - '

' + - '
' + - '
' + - '
' + - '
' + - '
'); - - this.blogReader = $('#blog-reader').dacModal(); - - this.doneSetup = true; - }; - - BlogReader.prototype.openModal_ = function(blog, post) { - var published = new Date(post.published); - var formattedDate = monthNames[published.getMonth()] + ' ' + published.getDay() + ' ' + published.getFullYear(); - this.blogReader.find('.dac-modal-header-open').attr('href', post.url); - this.blogReader.find('.dac-modal-header-title').text(blog.title); - this.blogReader.find('.dac-blog-reader-title').html(post.title); - this.blogReader.find('.dac-blog-reader-date').html(formattedDate); - this.blogReader.find('.dac-blog-reader-text').html(post.content); - this.blogReader.trigger('modal-open'); - }; - - /** - * Show a blog post in a modal - * @param {string} blogName - The name of the Blogspot blog. - * @param {string} postPath - The path to the blog post. - * @param {bool} secondTry - Has it failed once? - */ - BlogReader.prototype.showPost = function(blogName, postPath, secondTry) { - var blog = blogs[blogName]; - var postUrl = 'https://' + blogName + '.blogspot.com' + postPath; - - var url = apiUrl + '/blogs/' + blog.id + '/posts/bypath?path=' + encodeURIComponent(postPath) + '&key=' + apiKey; - $.ajax(url, {timeout: 650}).done(this.openModal_.bind(this, blog)).fail(function(error) { - // Retry once if we get an error - if (error.status === 500 && !secondTry) { - this.showPost(blogName, postPath, true); - } else { - window.location.href = postUrl; - } - }.bind(this)); - }; - - return { - getReader: function() { - if (!reader) { - reader = new BlogReader(); - } - return reader; - } - }; - })(); - - var blogReader = BlogReader.getReader(); - - function wrapLinkWithReader(e) { - var el = $(e.currentTarget); - if (el.hasClass('dac-modal-header-open')) { - return; - } - - // Only catch links on blogspot.com - var matches = el.attr('href').match(/https?:\/\/([^\.]*).blogspot.com([^$]*)/); - if (matches && matches.length === 3) { - var blogName = matches[1]; - var postPath = matches[2]; - - // Check if we have information about the blog - if (!blogs[blogName]) { - return; - } - - // Setup the first time it's used - if (!blogReader.doneSetup) { - blogReader.setup(); - } - - e.preventDefault(); - blogReader.showPost(blogName, postPath); - } - } - - $(document).on('click.blog-reader', 'a[href*="blogspot.com/"]', wrapLinkWithReader); -})(jQuery, window); - -(function($) { - $.fn.debounce = function(func, wait, immediate) { - var timeout; - - return function() { - var context = this; - var args = arguments; - - var later = function() { - timeout = null; - if (!immediate) { - func.apply(context, args); - } - }; - - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - - if (callNow) { - func.apply(context, args); - } - }; - }; -})(jQuery); - -/* Calculate the vertical area remaining */ -(function($) { - $.fn.ellipsisfade = function() { - // Only fetch line-height of first element to avoid recalculate style. - // Will be NaN if no elements match, which is ok. - var lineHeight = parseInt(this.css('line-height'), 10); - - this.each(function() { - // get element text - var $this = $(this); - var remainingHeight = $this.parent().parent().height(); - $this.parent().siblings().each(function() { - var elHeight; - if ($(this).is(':visible')) { - elHeight = $(this).outerHeight(true); - remainingHeight = remainingHeight - elHeight; - } - }); - - var adjustedRemainingHeight = ((remainingHeight) / lineHeight >> 0) * lineHeight; - $this.parent().css({height: adjustedRemainingHeight}); - $this.css({height: 'auto'}); - }); - - return this; - }; - - /* Pass the line height to ellipsisfade() to adjust the height of the - text container to show the max number of lines possible, without - showing lines that are cut off. This works with the css ellipsis - classes to fade last text line and apply an ellipsis char. */ - function updateEllipsis(context) { - if (!(context instanceof jQuery)) { - context = $('html'); - } - - context.find('.card-info .text').ellipsisfade(); - } - - $(window).on('resize', $.fn.debounce(updateEllipsis, 500)); - $(updateEllipsis); - $('html').on('dac:domchange', function(e) { updateEllipsis($(e.target)); }); -})(jQuery); - -/* Filter */ -(function($) { - 'use strict'; - - /** - * A single filter item content. - * @type {string} - Element template. - * @private - */ - var ITEM_STR_ = '' + - '' + - ''; - - /** - * Template for a chip element. - * @type {*|HTMLElement} - * @private - */ - var CHIP_BASE_ = $('
  • ' + - '' + - '
  • '); - - /** - * Component to handle narrowing down resources. - * @param {HTMLElement} el - The DOM element. - * @param {Object} options - * @constructor - */ - function Filter(el, options) { - this.el = $(el); - this.options = $.extend({}, Filter.DEFAULTS_, options); - this.init(); - } - - Filter.DEFAULTS_ = { - activeClass: 'dac-active', - chipsDataAttr: 'filter-chips', - nameDataAttr: 'filter-name', - countDataAttr: 'filter-count', - tabViewDataAttr: 'tab-view', - valueDataAttr: 'filter-value' - }; - - /** - * Draw resource cards. - * @param {Array} resources - * @private - */ - Filter.prototype.draw_ = function(resources) { - var that = this; - - if (resources.length === 0) { - this.containerEl_.html('

    Nothing matches selected filters.

    '); - return; - } - - // Draw resources. - that.containerEl_.resourceWidget(resources, that.data_.options); - }; - - /** - * Initialize a Filter component. - */ - Filter.prototype.init = function() { - this.containerEl_ = $(this.options.filter); - - // Setup data settings - this.data_ = {}; - this.data_.chips = {}; - this.data_.options = this.containerEl_.widgetOptions(); - this.data_.all = window.metadata.query(this.data_.options); - - // Initialize filter UI - this.initUi(); - }; - - /** - * Generate a chip for a given filter item. - * @param {Object} item - A single filter option (checkbox container). - * @returns {HTMLElement} A new Chip element. - */ - Filter.prototype.chipForItem = function(item) { - var chip = CHIP_BASE_.clone(); - chip.prepend(this.data_.chips[item.data('filter-value')]); - chip.data('item.dac-filter', item); - item.data('chip.dac-filter', chip); - this.addToItemValue(item, 1); - return chip[0]; - }; - - /** - * Update count of checked filter items. - * @param {Object} item - A single filter option (checkbox container). - * @param {Number} value - Either -1 or 1. - */ - Filter.prototype.addToItemValue = function(item, value) { - var tab = item.parent().data(this.options.tabViewDataAttr); - var countEl = this.countEl_.filter('[data-' + this.options.countDataAttr + '="' + tab + '"]'); - var count = value + parseInt(countEl.text(), 10); - countEl.text(count); - countEl.toggleClass('dac-disabled', count === 0); - }; - - /** - * Set event listeners. - * @private - */ - Filter.prototype.setEventListeners_ = function() { - this.chipsEl_.on('click.dac-filter', '.dac-filter-chip-close', this.closeChipHandler_.bind(this)); - this.tabViewEl_.on('change.dac-filter', ':checkbox', this.toggleCheckboxHandler_.bind(this)); - }; - - /** - * Check filter items that are active by default. - */ - Filter.prototype.activateInitialFilters_ = function() { - var id = (new Date()).getTime(); - var initiallyCheckedValues = this.data_.options.query.replace(/,\s*/g, '+').split('+'); - var chips = document.createDocumentFragment(); - var that = this; - - this.items_.each(function(i) { - var item = $(this); - var opts = item.data(); - that.data_.chips[opts.filterValue] = opts.filterName; - - var checkbox = $(ITEM_STR_.replace(/\{\{name\}\}/g, opts.filterName) - .replace(/\{\{value\}\}/g, opts.filterValue) - .replace(/\{\{id\}\}/g, 'filter-' + id + '-' + (i + 1))); - - if (initiallyCheckedValues.indexOf(opts.filterValue) > -1) { - checkbox[0].checked = true; - chips.appendChild(that.chipForItem(item)); - } - - item.append(checkbox); - }); - - this.chipsEl_.append(chips); - }; - - /** - * Initialize the Filter view - */ - Filter.prototype.initUi = function() { - // Cache DOM elements - this.chipsEl_ = this.el.find('[data-' + this.options.chipsDataAttr + ']'); - this.countEl_ = this.el.find('[data-' + this.options.countDataAttr + ']'); - this.tabViewEl_ = this.el.find('[data-' + this.options.tabViewDataAttr + ']'); - this.items_ = this.el.find('[data-' + this.options.nameDataAttr + ']'); - - // Setup UI - this.draw_(this.data_.all); - this.activateInitialFilters_(); - this.setEventListeners_(); - }; - - /** - * @returns {[types|Array, tags|Array, category|Array]} - */ - Filter.prototype.getActiveClauses = function() { - var tags = []; - var types = []; - var categories = []; - - this.items_.find(':checked').each(function(i, checkbox) { - // Currently, there is implicit business logic here that `tag` is AND'ed together - // while `type` is OR'ed. So , and + do the same thing here. It would be great to - // reuse the same query engine for filters, but it would need more powerful syntax. - // Probably parenthesis, to support "tag:dog + tag:cat + (type:video, type:blog)" - var expression = $(checkbox).val(); - var regex = /(\w+):(\w+)/g; - var match; - - while (match = regex.exec(expression)) { - switch (match[1]) { - case 'category': - categories.push(match[2]); - break; - case 'tag': - tags.push(match[2]); - break; - case 'type': - types.push(match[2]); - break; - } - } - }); - - return [types, tags, categories]; - }; - - /** - * Actual filtering logic. - * @returns {Array} - */ - Filter.prototype.filteredResources = function() { - var data = this.getActiveClauses(); - var types = data[0]; - var tags = data[1]; - var categories = data[2]; - var resources = []; - var resource = {}; - var tag = ''; - var shouldAddResource = true; - - for (var resourceIndex = 0; resourceIndex < this.data_.all.length; resourceIndex++) { - resource = this.data_.all[resourceIndex]; - shouldAddResource = types.indexOf(resource.type) > -1; - - if (categories && categories.length > 0) { - shouldAddResource = shouldAddResource && categories.indexOf(resource.category) > -1; - } - - for (var tagIndex = 0; shouldAddResource && tagIndex < tags.length; tagIndex++) { - tag = tags[tagIndex]; - shouldAddResource = resource.tags.indexOf(tag) > -1; - } - - if (shouldAddResource) { - resources.push(resource); - } - } - - return resources; - }; - - /** - * Close Chip Handler - * @param {Event} event - Click event - * @private - */ - Filter.prototype.closeChipHandler_ = function(event) { - var chip = $(event.currentTarget).parent(); - var checkbox = chip.data('item.dac-filter').find(':first-child')[0]; - checkbox.checked = false; - this.changeStateForCheckbox(checkbox); - }; - - /** - * Handle filter item state change. - * @param {Event} event - Change event - * @private - */ - Filter.prototype.toggleCheckboxHandler_ = function(event) { - this.changeStateForCheckbox(event.currentTarget); - }; - - /** - * Redraw resource view based on new state. - * @param checkbox - */ - Filter.prototype.changeStateForCheckbox = function(checkbox) { - var item = $(checkbox).parent(); - - if (checkbox.checked) { - this.chipsEl_.append(this.chipForItem(item)); - ga('send', 'event', 'Filters', 'Check', $(checkbox).val()); - } else { - item.data('chip.dac-filter').remove(); - this.addToItemValue(item, -1); - ga('send', 'event', 'Filters', 'Uncheck', $(checkbox).val()); - } - - this.draw_(this.filteredResources()); - }; - - /** - * jQuery plugin - */ - $.fn.dacFilter = function() { - return this.each(function() { - var el = $(this); - new Filter(el, el.data()); - }); - }; - - /** - * Data Attribute API - */ - $(function() { - $('[data-filter]').dacFilter(); - }); -})(jQuery); - -(function($) { - 'use strict'; - - /** - * Toggle Floating Label state. - * @param {HTMLElement} el - The DOM element. - * @param options - * @constructor - */ - function FloatingLabel(el, options) { - this.el = $(el); - this.options = $.extend({}, FloatingLabel.DEFAULTS_, options); - this.group = this.el.closest('.dac-form-input-group'); - this.input = this.group.find('.dac-form-input'); - - this.checkValue_ = this.checkValue_.bind(this); - this.checkValue_(); - - this.input.on('focus', function() { - this.group.addClass('dac-focused'); - }.bind(this)); - this.input.on('blur', function() { - this.group.removeClass('dac-focused'); - this.checkValue_(); - }.bind(this)); - this.input.on('keyup', this.checkValue_); - } - - /** - * The label is moved out of the textbox when it has a value. - */ - FloatingLabel.prototype.checkValue_ = function() { - if (this.input.val().length) { - this.group.addClass('dac-has-value'); - } else { - this.group.removeClass('dac-has-value'); - } - }; - - /** - * jQuery plugin - * @param {object} options - Override default options. - */ - $.fn.dacFloatingLabel = function(options) { - return this.each(function() { - new FloatingLabel(this, options); - }); - }; - - $(document).on('ready.aranja', function() { - $('.dac-form-floatlabel').each(function() { - $(this).dacFloatingLabel($(this).data()); - }); - }); -})(jQuery); - -(function($) { - 'use strict'; - - /** - * @param {HTMLElement} el - The DOM element. - * @param {Object} options - * @constructor - */ - function Crumbs(selected, options) { - this.options = $.extend({}, Crumbs.DEFAULTS_, options); - this.el = $(this.options.container); - - // Do not build breadcrumbs for landing site. - if (!selected || location.pathname === '/index.html' || location.pathname === '/') { - return; - } - - // Cache navigation resources - this.selected = $(selected); - this.selectedParent = this.selected.closest('.dac-nav-secondary').siblings('a'); - - // Build the breadcrumb list. - this.init(); - } - - Crumbs.DEFAULTS_ = { - container: '.dac-header-crumbs', - crumbItem: $('
  • '), - linkClass: 'dac-header-crumbs-link' - }; - - Crumbs.prototype.init = function() { - Crumbs.buildCrumbForLink(this.selected.clone()).appendTo(this.el); - - if (this.selectedParent.length) { - Crumbs.buildCrumbForLink(this.selectedParent.clone()).prependTo(this.el); - } - - // Reveal the breadcrumbs - this.el.addClass('dac-has-content'); - }; - - /** - * Build a HTML structure for a breadcrumb. - * @param {string} link - * @return {jQuery} - */ - Crumbs.buildCrumbForLink = function(link) { - link.find('br').replaceWith(' '); - - var crumbLink = $('') - .attr('class', Crumbs.DEFAULTS_.linkClass) - .attr('href', link.attr('href')) - .text(link.text()); - - return Crumbs.DEFAULTS_.crumbItem.clone().append(crumbLink); - }; - - /** - * jQuery plugin - */ - $.fn.dacCrumbs = function(options) { - return this.each(function() { - new Crumbs(this, options); - }); - }; -})(jQuery); - -(function($) { - 'use strict'; - - /** - * @param {HTMLElement} el - The DOM element. - * @param {Object} options - * @constructor - */ - function SearchInput(el, options) { - this.el = $(el); - this.options = $.extend({}, SearchInput.DEFAULTS_, options); - this.body = $('body'); - this.input = this.el.find('input'); - this.close = this.el.find(this.options.closeButton); - this.clear = this.el.find(this.options.clearButton); - this.icon = this.el.find('.' + this.options.iconClass); - this.init(); - } - - SearchInput.DEFAULTS_ = { - activeClass: 'dac-active', - activeIconClass: 'dac-search', - closeButton: '[data-search-close]', - clearButton: '[data-search-clear]', - hiddenClass: 'dac-hidden', - iconClass: 'dac-header-search-icon', - searchModeClass: 'dac-search-mode', - transitionDuration: 250 - }; - - SearchInput.prototype.init = function() { - this.input.on('focus.dac-search', this.setActiveState.bind(this)) - .on('input.dac-search', this.checkInputValue.bind(this)); - this.close.on('click.dac-search', this.unsetActiveStateHandler_.bind(this)); - this.clear.on('click.dac-search', this.clearInput.bind(this)); - }; - - SearchInput.prototype.setActiveState = function() { - var that = this; - - this.clear.addClass(this.options.hiddenClass); - this.body.addClass(this.options.searchModeClass); - this.checkInputValue(); - - // Set icon to black after background has faded to white. - setTimeout(function() { - that.icon.addClass(that.options.activeIconClass); - }, this.options.transitionDuration); - }; - - SearchInput.prototype.unsetActiveStateHandler_ = function(event) { - event.preventDefault(); - this.unsetActiveState(); - }; - - SearchInput.prototype.unsetActiveState = function() { - this.icon.removeClass(this.options.activeIconClass); - this.clear.addClass(this.options.hiddenClass); - this.body.removeClass(this.options.searchModeClass); - }; - - SearchInput.prototype.clearInput = function(event) { - event.preventDefault(); - this.input.val(''); - this.clear.addClass(this.options.hiddenClass); - }; - - SearchInput.prototype.checkInputValue = function() { - if (this.input.val().length) { - this.clear.removeClass(this.options.hiddenClass); - } else { - this.clear.addClass(this.options.hiddenClass); - } - }; - - /** - * jQuery plugin - * @param {object} options - Override default options. - */ - $.fn.dacSearchInput = function() { - return this.each(function() { - var el = $(this); - el.data('search-input.dac', new SearchInput(el, el.data())); - }); - }; - - /** - * Data Attribute API - */ - $(function() { - $('[data-search]').dacSearchInput(); - }); -})(jQuery); - -/* global METADATA */ -(function($) { - function DacCarouselQuery(el) { - el = $(el); - - var opts = el.data(); - opts.maxResults = parseInt(opts.maxResults || '100', 10); - opts.query = opts.carouselQuery; - var resources = window.metadata.query(opts); - - el.empty(); - $(resources).each(function() { - var resource = $.extend({}, this, METADATA.carousel[this.url]); - el.dacHero(resource); - }); - - // Pagination element. - el.append('