From 6d459f2d563a04cc8638e9cb6eb4f0c0662dc4d5 Mon Sep 17 00:00:00 2001 From: scotty Date: Thu, 11 Feb 2016 12:58:38 -0800 Subject: [PATCH] hinky a-click fix --- js/script.js | 277 ++++++++++++++++++++++++++------------------------- 1 file changed, 139 insertions(+), 138 deletions(-) diff --git a/js/script.js b/js/script.js index b710249f1c..5c4b7ae8f7 100755 --- a/js/script.js +++ b/js/script.js @@ -749,85 +749,95 @@ var π, π1, πd; π.mods.push(init); })(); -/******************************************************************** - π-dialog.js - USAGE AND API REFERENCE - ______________________________________________ - DEPENDENCIES: - - π.js - - ______________________________________________ - DATA ATTRIBUTES: - - ______________________________________________ - MARKUP AND DEFAULTS: - -
- -
- - ______________________________________________ - GENERATED HTML: - -
- -
- - ______________________________________________ - API - - ***************************************************************************************/ - (function(){ - π.dialog = { - show: π.modalOverlay.show, - spawn: spawn, - actions: {} - }; + var yah = true; + var moving = false; + var CSS_BROWSER_DELAY_HACK = 25; function init() { - π('.pi-dialog').forEach(π.dialog.spawn); - π.setTriggers('dialog', π.modalOverlay); - } + π.clean(init); - function spawn(el){ - var contentBox = π.div('content-box', 0, el.innerHTML); - var dialogBox = π.div('dialog-box', 0, contentBox); - el.fill(dialogBox); - - if (el.dataset.title){ - dialogBox.prepend(π.div('title', 0, el.dataset.title)); + // Safari chokes on the animation here, so... + if (navigator.userAgent.indexOf('Chrome') == -1 && navigator.userAgent.indexOf('Safari') != -1){ + π1('body').add(π.contentElement('style', 0, 0, '.pi-accordion .wrapper{transition: none}')); } + // Gross. - el.π('.buttons button').forEach(function(button){ - button.onclick = function(){ - var action = button.getAttribute('pi-dialog-action'); - if (action){ - π.dialog.actions[action](); - } - }; - - if (!button.hasAttribute('data-bypass')){ - button.listen(dismiss, 'click'); - } + π('.pi-accordion').forEach(function(accordion){ + var container = π.div('container', null, accordion.innerHTML); + accordion.fill(container); + PiAccordion(container); }); - if (!booleanAttributeValue(el, 'data-inline', false)) { - el.addClass('pi-modal-overlay'); - π.modalOverlay.spawn(el); - } - - function dismiss(){ - el.π1('.pi-modal-close-button').click(); - } + setTimeout(function () { + yah = false; + }, 500); } + function PiAccordion(container){ + container.π(':scope > .item').forEach(function(item){ + var titleText = item.dataset.title; + var title = π.div('title', null, titleText); + var wrapper = π.div('wrapper'); + var content = π.div('content', null, item.innerHTML); + + wrapper.fill(content); + item.fill([title, wrapper]); + wrapper.css({height: 0}); + + title.onclick = function(){ + if (!yah) { + if (moving) return; + moving = true; + } + + if (container.dataset.single) { + var openSiblings = item.siblings().filter(function(sib){return sib.hasClass('on');}); + openSiblings.forEach(function(sibling){ + toggleItem(sibling); + }); + } + + setTimeout(function(){ + if (item.tagName.toLowerCase() === 'a') return; + toggleItem(item); + }, CSS_BROWSER_DELAY_HACK); + }; + + function toggleItem(thisItem){ + var thisWrapper = thisItem.π1('.wrapper'); + var contentHeight = thisWrapper.π1('.content').offset().height + 'px'; + + if (thisItem.hasClass('on')) { + thisWrapper.css({height: contentHeight}); + thisItem.killClass('on'); + setTimeout(function(){ + thisWrapper.css({height: 0}); + moving = false; + }, CSS_BROWSER_DELAY_HACK); + } else { + item.addClass('on'); + thisWrapper.css({height: contentHeight}); + + var duration = parseFloat(thisWrapper.css().transitionDuration) * 1000; + setTimeout(function(){ + thisWrapper.css({height: ''}); + moving = false; + }, duration); + } + } + + var innerContainers = content.π(':scope > .container'); + if (innerContainers.length > 0) { + innerContainers.forEach(PiAccordion); + } + }); + } - // π.mods are loaded after DOMContentLoaded π.mods.push(init); })(); + /******************************************************************** π-pushmenu.js // TODO: USAGE AND API REFERENCE @@ -983,94 +993,85 @@ elsewhere... }; })(); +/******************************************************************** + π-dialog.js + USAGE AND API REFERENCE + ______________________________________________ + DEPENDENCIES: + + π.js + + ______________________________________________ + DATA ATTRIBUTES: + + ______________________________________________ + MARKUP AND DEFAULTS: + +
+ +
+ + ______________________________________________ + GENERATED HTML: + +
+ +
+ + ______________________________________________ + API + + ***************************************************************************************/ + (function(){ - var yah = true; - var moving = false; - var CSS_BROWSER_DELAY_HACK = 25; + π.dialog = { + show: π.modalOverlay.show, + spawn: spawn, + actions: {} + }; function init() { - π.clean(init); - - // Safari chokes on the animation here, so... - if (navigator.userAgent.indexOf('Chrome') == -1 && navigator.userAgent.indexOf('Safari') != -1){ - π1('body').add(π.contentElement('style', 0, 0, '.pi-accordion .wrapper{transition: none}')); - } - // Gross. - - π('.pi-accordion').forEach(function(accordion){ - var container = π.div('container', null, accordion.innerHTML); - accordion.fill(container); - PiAccordion(container); - }); - - setTimeout(function () { - yah = false; - }, 500); + π('.pi-dialog').forEach(π.dialog.spawn); + π.setTriggers('dialog', π.modalOverlay); } - function PiAccordion(container){ - container.π(':scope > .item').forEach(function(item){ - var titleText = item.dataset.title; + function spawn(el){ + var contentBox = π.div('content-box', 0, el.innerHTML); + var dialogBox = π.div('dialog-box', 0, contentBox); + el.fill(dialogBox); - var title = π.div('title', null, titleText); - var wrapper = π.div('wrapper'); - var content = π.div('content', null, item.innerHTML); + if (el.dataset.title){ + dialogBox.prepend(π.div('title', 0, el.dataset.title)); + } - wrapper.fill(content); - item.fill([title, wrapper]); - wrapper.css({height: 0}); - - title.onclick = function(){ - if (!yah) { - if (moving) return; - moving = true; + el.π('.buttons button').forEach(function(button){ + button.onclick = function(){ + var action = button.getAttribute('pi-dialog-action'); + if (action){ + π.dialog.actions[action](); } - - if (container.dataset.single) { - var openSiblings = item.siblings().filter(function(sib){return sib.hasClass('on');}); - openSiblings.forEach(function(sibling){ - toggleItem(sibling); - }); - } - - setTimeout(function(){ - toggleItem(item); - }, CSS_BROWSER_DELAY_HACK); }; - function toggleItem(thisItem){ - var thisWrapper = thisItem.π1('.wrapper'); - var contentHeight = thisWrapper.π1('.content').offset().height + 'px'; - - if (thisItem.hasClass('on')) { - thisWrapper.css({height: contentHeight}); - thisItem.killClass('on'); - setTimeout(function(){ - thisWrapper.css({height: 0}); - moving = false; - }, CSS_BROWSER_DELAY_HACK); - } else { - item.addClass('on'); - thisWrapper.css({height: contentHeight}); - - var duration = parseFloat(thisWrapper.css().transitionDuration) * 1000; - setTimeout(function(){ - thisWrapper.css({height: ''}); - moving = false; - }, duration); - } - } - - var innerContainers = content.π(':scope > .container'); - if (innerContainers.length > 0) { - innerContainers.forEach(PiAccordion); + if (!button.hasAttribute('data-bypass')){ + button.listen(dismiss, 'click'); } }); + + if (!booleanAttributeValue(el, 'data-inline', false)) { + el.addClass('pi-modal-overlay'); + π.modalOverlay.spawn(el); + } + + function dismiss(){ + el.π1('.pi-modal-close-button').click(); + } } + + + // π.mods are loaded after DOMContentLoaded π.mods.push(init); })(); - var kub = (function () { π.listen(init); @@ -1250,4 +1251,4 @@ var kub = (function () { }; })(); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFsZi5qcyIsIs+ALmpzIiwiSEFMLmpzIiwiz4Atc3RhdHVzLmpzIiwiz4AtYmFzZUNvbXBvbmVudHMuanMiLCLPgC1kaWFsb2cvz4AtZGlhbG9nLmpzIiwiz4AtcHVzaG1lbnUvz4AtcHVzaG1lbnUuanMiLCLPgC1hY2NvcmRpb24vz4AtYWNjb3JkaW9uLmpzIiwic2NyaXB0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ3BCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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IM+ALWRpYWxvZy5qc1xuIFVTQUdFIEFORCBBUEkgUkVGRVJFTkNFXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERFUEVOREVOQ0lFUzpcblxuIM+ALmpzXG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gREFUQSBBVFRSSUJVVEVTOlxuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIE1BUktVUCBBTkQgREVGQVVMVFM6XG5cbiA8ZGl2IGNsYXNzPVwibmV3X21vZHVsZVwiPlxuXG4gPC9kaXY+XG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gR0VORVJBVEVEIEhUTUw6XG5cbiA8ZGl2IGNsYXNzPVwibmV3X21vZHVsZVwiPlxuXG4gPC9kaXY+XG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gQVBJXG5cbiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cbihmdW5jdGlvbigpe1xuXHTPgC5kaWFsb2cgPSB7XG5cdFx0c2hvdzogz4AubW9kYWxPdmVybGF5LnNob3csXG5cdFx0c3Bhd246IHNwYXduLFxuXHRcdGFjdGlvbnM6IHt9XG5cdH07XG5cblx0ZnVuY3Rpb24gaW5pdCgpIHtcblx0XHTPgCgnLnBpLWRpYWxvZycpLmZvckVhY2goz4AuZGlhbG9nLnNwYXduKTtcblx0XHTPgC5zZXRUcmlnZ2VycygnZGlhbG9nJywgz4AubW9kYWxPdmVybGF5KTtcblx0fVxuXG5cdGZ1bmN0aW9uIHNwYXduKGVsKXtcblx0XHR2YXIgY29udGVudEJveCA9IM+ALmRpdignY29udGVudC1ib3gnLCAwLCBlbC5pbm5lckhUT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xvYWRlZCBhZnRlciBET01Db250ZW50TG9hZGVkXG5cdM+ALm1vZHMucHVzaChpbml0KTtcbn0pKCk7IiwiLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG4gz4AtcHVzaG1lbnUuanNcbiAvLyBUT0RPOiAgVVNBR0UgQU5EIEFQSSBSRUZFUkVOQ0VcbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gREVQRU5ERU5DSUVTOlxuXG4gSEFMLmpzXG5cbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gREFUQSBBVFRSSUJVVEVTOlxuXG4gc2lkZTogW1wibGVmdFwiLCBcInJpZ2h0XCJdXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIE1BUktVUCBBTkQgREVGQVVMVFM6XG5cblx0PGRpdiBjbGFzcz1cInBpLXB1c2htZW51XCIgaWQ9XCJteVB1c2hNZW51XCI+XG5cdFx0IDx1bD5cblx0XHRcdCA8bGk+PGEgaHJlZj1cIiNcIj5mb288L2E+PC9saT5cblx0XHRcdCA8bGk+PGEgaHJlZj1cIiNcIj5iYXI8L2E+PC9saT5cblx0XHRcdCA8bGk+PGEgaHJlZj1cIiNcIj5ncm9uazwvYT48L2xpPlxuXHRcdFx0IDxsaT48YSBocmVmPVwiI1wiPmZsZWVibGVzPC9hPjwvbGk+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+c2VwdWx2ZWRhPC9hPjwvbGk+XG5cdFx0IDwvdWw+XG5cdDwvZGl2PlxuXG5lbHNld2hlcmUuLi5cblxuIDxidXR0b24gb25jbGljaz1cIs+ALXB1c2htZW51LnNob3coJ215UHVzaE1lbnUnKVwiPnNob3cgbWVudTwvYnV0dG9uPlxuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX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Y3Rpb24oKXtcblx0XHRcdFx0XHRcdHRoaXNXcmFwcGVyLmNzcyh7aGVpZ2h0OiAnJ30pO1xuXHRcdFx0XHRcdFx0bW92aW5nID0gZmFsc2U7XG5cdFx0XHRcdFx0fSwgZHVyYXRpb24pO1xuXHRcdFx0XHR9XG5cdFx0XHR9XG5cblx0XHRcdHZhciBpbm5lckNvbnRhaW5lcnMgPSBjb250ZW50Ls+AKCc6c2NvcGUgPiAuY29udGFpbmVyJyk7XG5cdFx0XHRpZiAoaW5uZXJDb250YWluZXJzLmxlbmd0aCA+IDApIHtcblx0XHRcdFx0aW5uZXJDb250YWluZXJzLmZvckVhY2goUGlBY2NvcmRpb24pO1xuXHRcdFx0fVxuXHRcdH0pO1xuXHR9XG5cblx0z4AubW9kcy5wdXNoKGluaXQpO1xufSkoKTtcbiIsIi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuIM+ALXB1c2htZW51LmpzXG4gLy8gVE9ETzogIFVTQUdFIEFORCBBUEkgUkVGRVJFTkNFXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERFUEVOREVOQ0lFUzpcblxuIEhBTC5qc1xuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERBVEEgQVRUUklCVVRFUzpcblxuIHNpZGU6IFtcImxlZnRcIiwgXCJyaWdodFwiXVxuIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiBNQVJLVVAgQU5EIERFRkFVTFRTOlxuXG5cdDxkaXYgY2xhc3M9XCJwaS1wdXNobWVudVwiIGlkPVwibXlQdXNoTWVudVwiPlxuXHRcdCA8dWw+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+Zm9vPC9hPjwvbGk+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+YmFyPC9hPjwvbGk+XG5cdFx0XHQgPGxpPjxhIGhyZWY9XCIjXCI+Z3Jvbms8L2E+PC9saT5cblx0XHRcdCA8bGk+PGEgaHJlZj1cIiNcIj5mbGVlYmxlczwvYT48L2xpPlxuXHRcdFx0IDxsaT48YSBocmVmPVwiI1wiPnNlcHVsdmVkYTwvYT48L2xpPlxuXHRcdCA8L3VsPlxuXHQ8L2Rpdj5cblxuZWxzZXdoZXJlLi4uXG5cbiA8YnV0dG9uIG9uY2xpY2s9XCLPgC1wdXNobWVudS5zaG93KCdteVB1c2hNZW51JylcIj5zaG93IG1lbnU8L2J1dHRvbj5cblxuIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiBHRU5FUkFURUQgSFRNTDpcblxuXHRcbiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXG4gQVBJXG5cblxuICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi9cblxuz4AucHVzaG1lbnUgPSAoZnVuY3Rpb24oKXtcblx0dmFyIGFsbFB1c2hNZW51cyA9IHt9O1xuXG5cdGZ1bmN0aW9uIGluaXQoKXtcblx0XHTPgCgnW2RhdGEtYXV0by1idXJnZXJdJykuZm9yRWFjaChmdW5jdGlvbihjb250YWluZXIpe1xuXHRcdFx0dmFyIGlkID0gY29udGFpbmVyLmdldEF0dHJpYnV0ZSgnZGF0YS1hdXRvLWJ1cmdlcicpO1xuXG5cdFx0XHR2YXIgYXV0b0J1cmdlciA9IM+AZChpZCkgfHwgz4AuZGl2KCdwaS1wdXNobWVudScsIGlkKTtcblx0XHRcdHZhciB1bCA9IGF1dG9CdXJnZXIuz4AxKCd1bCcpIHx8IM+ALnVsKCk7XG5cblx0XHRcdGNvbnRhaW5lci7PgCgnYVtocmVmXSwgYnV0dG9uJykuZm9yRWFjaChmdW5jdGlvbiAob2JqKS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U5DRVxuIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiBERVBFTkRFTkNJRVM6XG5cbiDPgC5qc1xuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIERBVEEgQVRUUklCVVRFUzpcblxuIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19cbiBNQVJLVVAgQU5EIERFRkFVTFRTOlxuXG4gPGRpdiBjbGFzcz1cIm5ld19tb2R1bGVcIj5cblxuIDwvZGl2PlxuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIEdFTkVSQVRFRCBIVE1MOlxuXG4gPGRpdiBjbGFzcz1cIm5ld19tb2R1bGVcIj5cblxuIDwvZGl2PlxuXG4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1xuIEFQSVxuXG4gKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuXG4oZnVuY3Rpb24oKXtcblx0z4AuZGlhbG9nID0ge1xuXHRcdHNob3c6IM+ALm1vZGFsT3ZlcmxheS5zaG93LFxuXHRcdHNwYXduOiBzcGF3bixcblx0XHRhY3Rpb25zOiB7fVxuXHR9O1xuXG5cdGZ1bmN0aW9uIGluaXQoKSB7XG5cdFx0z4AoJy5waS1kaWFsb2cnKS5mb3JFYWNoKM+ALmRpYWxvZy5zcGF3bik7XG5cdFx0z4Auc2V0VHJpZ2dlcnMoJ2RpYWxvZycsIM+ALm1vZGFsT3ZlcmxheSk7XG5cdH1cblxuXHRmdW5jdGlvbiBzcGF3bihlbCl7XG5cdFx0dmFyIGNvbnRlbnRCb3ggPSDPgC5kaXYoJ2NvbnRlbnQtYm94JywgMCwgZWwuaW5uZXJIVE1MKTtcblx0XHR2YXIgZGlhbG9nQm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