{"version":3,"sources":["js/jquery.details.js"],"names":["document","$","doc","fake","root","diff","de","el","proto","fn","isOpera","Object","prototype","toString","call","window","opera","isDetailsSupported","createElement","body","documentElement","insertBefore","firstElementChild","firstChild","innerHTML","style","display","appendChild","offsetHeight","open","removeChild","parentNode","toggleOpen","$details","$detailsSummary","$detailsNotSummary","toggle","isOpen","prop","removeClass","triggerHandler","attr","hide","addClass","show","noSelect","this","bind","css","MozUserSelect","msUserSelect","webkitUserSelect","userSelect","details","each","index","$summary","first","role","aria-expanded","aria-controls","on","close","support","children","$detailsNotSummaryContents","contents","length","text","prependTo","filter","nodeType","test","data","wrap","focus","keyup","event","keyCode","preventDefault","click","jQuery"],"mappings":";CACE,SAASA,EAAUC,GAEpB,IAKmCC,EAE1BC,EACAC,EACAC,EAKCC,EARDC,EANLC,EAAQP,EAAEQ,GAGVC,EAA0D,kBAAhDC,OAAOC,UAAUC,SAASC,KAAKC,OAAOC,OAEhDC,EAKO,SAJFV,GAD0BL,EAwB7BF,GAvBYkB,cAAc,cAO3Bd,EAAOF,EAAIiB,OACNb,EAAKJ,EAAIkB,gBACbjB,GAAO,EACAG,EAAGe,aAAanB,EAAIgB,cAAc,QAASZ,EAAGgB,mBAAqBhB,EAAGiB,aAE9EhB,EAAGiB,UAAY,wBACfjB,EAAGkB,MAAMC,QAAU,QACnBtB,EAAKuB,YAAYpB,GACjBF,EAAOE,EAAGqB,aACVrB,EAAGsB,MAAO,EACVxB,EAAOA,GAAQE,EAAGqB,aAClBxB,EAAK0B,YAAYvB,GACbJ,GACHC,EAAK2B,WAAWD,YAAY1B,GAEtBC,GAER2B,EAAa,SAASC,EAAUC,EAAiBC,EAAoBC,GACpE,IAAIC,EAASJ,EAASK,KAAK,QACfD,GAAUD,IAAWC,IAAWD,GAE3CH,EAASM,YAAY,QAAQD,KAAK,QAAQ,GAAOE,eAAe,iBAChEN,EAAgBO,KAAK,iBAAiB,GACtCN,EAAmBO,SAEnBT,EAASU,SAAS,QAAQL,KAAK,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,KAAK,SAC3CT,EAAWC,EAAUC,EAAiBC,GAGtCD,EAAgBO,KAAK,CAACiB,KAAQ,SAAUE,gBAAiB3B,EAASQ,KAAK,QAAQI,WAAWP,KAAK,WAAY,GAAGuB,GAAG,SAAS,WAEzH3B,EAAgByC,QAEhB3C,EAAWC,EAAUC,EAAiBC,GAAoB,MACxDyC,OAAM,SAASC,IACb,IAAMA,EAAMC,SAAY,IAAMD,EAAMC,UAAYpE,KAGnDmE,EAAME,iBACN7C,EAAgB8C,iBAQZjB,QAAU9C,EA5JnB,CAgKCjB,SAAUiF","file":"jquery.details.js","sourcesContent":["/*! http://mths.be/details v0.1.0 by @mathias | includes http://mths.be/noselect v1.0.3 */\n;(function(document, $) {\n\n\tvar proto = $.fn,\n\t details,\n\t // :'(\n\t isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]',\n\t // Feature test for native `
` support\n\t isDetailsSupported = (function(doc) {\n\t \tvar el = doc.createElement('details'),\n\t \t fake,\n\t \t root,\n\t \t diff;\n\t \tif (!('open' in el)) {\n\t \t\treturn false;\n\t \t}\n\t \troot = doc.body || (function() {\n\t \t\tvar de = doc.documentElement;\n\t \t\tfake = true;\n\t \t\treturn de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);\n\t \t}());\n\t \tel.innerHTML = 'ab';\n\t \tel.style.display = 'block';\n\t \troot.appendChild(el);\n\t \tdiff = el.offsetHeight;\n\t \tel.open = true;\n\t \tdiff = diff != el.offsetHeight;\n\t \troot.removeChild(el);\n\t \tif (fake) {\n\t \t\troot.parentNode.removeChild(root);\n\t \t}\n\t \treturn diff;\n\t }(document)),\n\t toggleOpen = function($details, $detailsSummary, $detailsNotSummary, toggle) {\n\t \tvar isOpen = $details.prop('open'),\n\t \t close = isOpen && toggle || !isOpen && !toggle;\n\t \tif (close) {\n\t \t\t$details.removeClass('open').prop('open', false).triggerHandler('close.details');\n\t \t\t$detailsSummary.attr('aria-expanded', false);\n\t \t\t$detailsNotSummary.hide();\n\t \t} else {\n\t \t\t$details.addClass('open').prop('open', true).triggerHandler('open.details');\n\t \t\t$detailsSummary.attr('aria-expanded', true);\n\t \t\t$detailsNotSummary.show();\n\t \t}\n\t };\n\n\t/* http://mths.be/noselect v1.0.3 */\n\tproto.noSelect = function() {\n\n\t\t// Since the string 'none' is used three times, storing it in a variable gives better results after minification\n\t\tvar none = 'none';\n\n\t\t// onselectstart and ondragstart for WebKit & IE\n\t\t// onmousedown for WebKit & Opera\n\t\treturn this.bind('selectstart dragstart mousedown', function() {\n\t\t\treturn false;\n\t\t}).css({\n\t\t\t'MozUserSelect': none,\n\t\t\t'msUserSelect': none,\n\t\t\t'webkitUserSelect': none,\n\t\t\t'userSelect': none\n\t\t});\n\n\t};\n\n\t// Execute the fallback only if there’s no native `details` support\n\tif (isDetailsSupported) {\n\n\t\tdetails = proto.details = function() {\n\n\t\t\treturn this.each(function(index) {\n\t\t\t\tvar $details = $(this),\n\t\t\t\t $summary = $('summary', $details).first();\n\t\t\t\t// If `$details` doesn’t already have one, assign a generated `id` for\n\t\t\t\t// `aria-controls` on the `` to reference.\n\t\t\t\tif (!$details.attr('id')) {\n\t\t\t\t\t$details.attr('id', 'details-id-' + index);\n\t\t\t\t}\n\t\t\t\t$details.attr('role', 'group');\n\t\t\t\t$summary.attr({\n\t\t\t\t\t'role': 'button',\n\t\t\t\t\t'aria-expanded': $details.prop('open'),\n\t\t\t\t\t'aria-controls': $details.attr('id')\n\t\t\t\t}).on('click', function() {\n\t\t\t\t\t// the value of the `open` property is the old value\n\t\t\t\t\tvar close = $details.prop('open');\n\t\t\t\t\t$summary.attr('aria-expanded', !close);\n\t\t\t\t\t$details.triggerHandler((close ? 'close' : 'open') + '.details');\n\t\t\t\t});\n\t\t\t});\n\n\t\t};\n\n\t\tdetails.support = isDetailsSupported;\n\n\t} else {\n\n\t\tdetails = proto.details = function() {\n\n\t\t\t// Loop through all `details` elements\n\t\t\treturn this.each(function(index) {\n\n\t\t\t\t// Store a reference to the current `details` element in a variable\n\t\t\t\tvar $details = $(this),\n\t\t\t\t // Store a reference to the `summary` element of the current `details` element (if any) in a variable\n\t\t\t\t $detailsSummary = $('summary', $details).first(),\n\t\t\t\t // Do the same for the info within the `details` element\n\t\t\t\t $detailsNotSummary = $details.children(':not(summary)'),\n\t\t\t\t // This will be used later to look for direct child text nodes\n\t\t\t\t $detailsNotSummaryContents = $details.contents(':not(summary)');\n\t\t\t\t//assign a generated @id to the details element for reference by @aria-controls on the summary\n\t\t\t\tif (!$details.attr('id')) {\n\t\t\t\t\t$details.attr('id', 'details-id-' + index);\n\t\t\t\t}\n\t\t\t\t$details.attr('role', 'group');\n\t\t\t\t// If there is no `summary` in the current `details` element…\n\t\t\t\tif (!$detailsSummary.length) {\n\t\t\t\t\t// …create one with default text\n\t\t\t\t\t$detailsSummary = $('').text('Details').prependTo($details);\n\t\t\t\t}\n\n\t\t\t\t// Look for direct child text nodes\n\t\t\t\tif ($detailsNotSummary.length != $detailsNotSummaryContents.length) {\n\t\t\t\t\t// Wrap child text nodes in a `span` element\n\t\t\t\t\t$detailsNotSummaryContents.filter(function() {\n\t\t\t\t\t\t// Only keep the node in the collection if it’s a text node containing more than only whitespace\n\t\t\t\t\t\t// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character\n\t\t\t\t\t\treturn this.nodeType == 3 && /[^ \\t\\n\\f\\r]/.test(this.data);\n\t\t\t\t\t}).wrap('');\n\t\t\t\t\t// There are now no direct child text nodes anymore — they’re wrapped in `span` elements\n\t\t\t\t\t$detailsNotSummary = $details.children(':not(summary)');\n\t\t\t\t}\n\n\t\t\t\t// Hide content unless there’s an `open` attribute\n\t\t\t\t$details.prop('open', typeof $details.attr('open') == 'string');\n\t\t\t\ttoggleOpen($details, $detailsSummary, $detailsNotSummary);\n\n\t\t\t\t// Add `role=button` and set the `tabindex` of the `summary` element to `0` to make it keyboard accessible\n\t\t\t\t$detailsSummary.attr({'role': 'button', 'aria-controls': $details.attr('id')}).noSelect().prop('tabIndex', 0).on('click', function() {\n\t\t\t\t\t// Focus on the `summary` element\n\t\t\t\t\t$detailsSummary.focus();\n\t\t\t\t\t// Toggle the `open` and `aria-expanded` attributes and the `open` property of the `details` element and display the additional info\n\t\t\t\t\ttoggleOpen($details, $detailsSummary, $detailsNotSummary, true);\n\t\t\t\t}).keyup(function(event) {\n\t\t\t\t\tif (32 == event.keyCode || (13 == event.keyCode && !isOpera)) {\n\t\t\t\t\t\t// Space or Enter is pressed — trigger the `click` event on the `summary` element\n\t\t\t\t\t\t// Opera already seems to trigger the `click` event when Enter is pressed\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t$detailsSummary.click();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t});\n\n\t\t};\n\n\t\tdetails.support = isDetailsSupported;\n\n\t}\n\n}(document, jQuery));\n"]}