From 8d6d16a5de2b7131f115175d851dac9ca27e3c79 Mon Sep 17 00:00:00 2001 From: Gareth Barnard <1058419+gjb2048@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:51:19 +0100 Subject: [PATCH] V402.1.5 --- Changes.md | 34 + amd/build/adaptable.min.js | 3 +- amd/build/adaptable.min.js.map | 1 + amd/build/admin_settings.min.js | 12 +- amd/build/admin_settings.min.js.map | 2 +- amd/build/bsoptions.min.js | 4 - amd/build/flexslider.min.js | 12 + amd/build/flexslider.min.js.map | 1 + amd/build/icon_system_fontawesome.min.js | 10 +- amd/build/icon_system_fontawesome.min.js.map | 1 + amd/build/jqueryeasing.min.js | 5 + amd/build/jqueryeasing.min.js.map | 1 + amd/build/pace.min.js | 3 + amd/build/pace.min.js.map | 1 + amd/build/savebutton.min.js | 3 +- amd/build/savebutton.min.js.map | 1 + amd/build/slider.min.js | 5 + amd/build/slider.min.js.map | 1 + amd/build/tabbed.min.js | 5 + amd/build/tabbed.min.js.map | 1 + amd/build/templatepreview.min.js | 4 - amd/build/utils.min.js | 4 - amd/src/adaptable.js | 400 ++++- amd/src/admin_settings.js | 27 +- amd/src/bsoptions.js | 282 ---- amd/src/flexslider.js | 1282 +++++++++++++++++ amd/src/icon_system_fontawesome.js | 18 +- amd/src/jqueryeasing.js | 190 +++ amd/src/pace.js | 986 +++++++++++++ amd/src/savebutton.js | 76 +- amd/src/slider.js | 105 ++ amd/src/tabbed.js | 117 ++ amd/src/templatepreview.js | 41 - amd/src/utils.js | 100 -- ...dmin_setting_configstoredfile_putprops.php | 163 +++ classes/admin_setting_configstoredfiles.php | 125 +- classes/admin_setting_getprops.php | 270 ++++ .../admin_setting_putprops.php | 47 +- classes/output/core_renderer_layout.php | 46 +- classes/output/core_renderer_toolbox.php | 10 +- classes/toolbox.php | 249 +++- config.php | 4 +- db/upgrade.php | 24 +- fonts/fa-brands-400.ttf | Bin 189684 -> 209376 bytes fonts/fa-brands-400.woff2 | Bin 109808 -> 118072 bytes fonts/fa-regular-400.ttf | Bin 63348 -> 67976 bytes fonts/fa-regular-400.woff2 | Bin 24488 -> 25464 bytes fonts/fa-solid-900.ttf | Bin 394668 -> 423676 bytes fonts/fa-solid-900.woff2 | Bin 150020 -> 157192 bytes fonts/fa-v4compatibility.ttf | Bin 10172 -> 10836 bytes fonts/fa-v4compatibility.woff2 | Bin 4568 -> 4800 bytes jquery/adaptable_v2_1_1_2.js | 88 -- jquery/jquery-easing-min.js | 8 - jquery/jquery-flexslider-min.js | 5 - jquery/pace-min.js | 2 - jquery/plugins.php | 54 - jquery/tickerme.js | 124 -- lang/en/theme_adaptable.php | 88 +- lib.php | 46 +- scss/fontawesome/_animated.scss | 1 - scss/fontawesome/_bordered-pulled.scss | 4 +- scss/fontawesome/_core.scss | 12 +- scss/fontawesome/_list.scss | 2 +- scss/fontawesome/_mixins.scss | 3 - scss/fontawesome/_rotated-flipped.scss | 4 +- scss/fontawesome/_shims.scss | 464 ------ scss/fontawesome/_variables.scss | 54 +- scss/fontawesome/brands.scss | 4 +- scss/fontawesome/fontawesome.scss | 4 +- scss/fontawesome/regular.scss | 4 +- scss/fontawesome/solid.scss | 4 +- scss/fontawesome/v4-shims.scss | 4 +- scss/main.scss | 2 + scss/nosettings/_backup-restore.scss | 59 +- scss/nosettings/_core.scss | 21 + scss/nosettings/_drawers.scss | 2 +- scss/nosettings/_form.scss | 18 + scss/nosettings/_layout.scss | 65 + scss/nosettings/_modal.scss | 102 ++ scss/nosettings/_notifications.scss | 7 +- scss/nosettings/_secondarynavigation.scss | 2 + scss/nosettings/_user.scss | 7 - scss/settings/adaptable.scss | 462 +----- scss/settings/admin.scss | 15 +- scss/settings/blocks.scss | 61 +- scss/settings/button.scss | 120 +- scss/settings/core.scss | 29 + scss/settings/course.scss | 1 + scss/settings/extras.scss | 62 +- scss/settings/header.scss | 58 + scss/settings/menu.scss | 18 +- scss/settings/modal.scss | 52 + scss/settings/responsive.scss | 10 +- scss/settings/secondarynavigation.scss | 28 + ...adaptable_admin_setting_configtemplate.php | 3 - settings/adaptable_admin_setting_getprops.php | 147 -- settings/array_definitions.php | 1 + settings/block_regions.php | 7 +- settings/buttons.php | 58 +- settings/category_headers.php | 10 +- settings/colors.php | 41 +- settings/dash_block_regions.php | 5 +- settings/fonts.php | 8 - settings/footer.php | 56 +- settings/frontpage_courses.php | 5 +- settings/frontpage_slider.php | 5 +- settings/header.php | 10 +- settings/importexport_settings.php | 49 +- settings/information_blocks.php | 3 +- settings/layout.php | 5 +- settings/login.php | 5 +- settings/marketing_blocks.php | 5 +- settings/news_ticker.php | 36 + templates/core/loginform.mustache | 2 +- templates/savediscard.mustache | 13 +- templates/secondarynav.mustache | 2 +- .../behat_theme_adaptable_behat_auth.php | 49 - ...behat_theme_adaptable_behat_navigation.php | 4 +- ...ehat_theme_adaptable_behat_permissions.php | 2 +- tests/behat/blacklist.json | 6 + .../behat_theme_adaptable_behat_core_auth.php | 50 - tests/behat/navigation.feature | 11 + thirdpartylibs.xml | 19 +- version.php | 4 +- 124 files changed, 5070 insertions(+), 2407 deletions(-) create mode 100644 amd/build/adaptable.min.js.map delete mode 100644 amd/build/bsoptions.min.js create mode 100644 amd/build/flexslider.min.js create mode 100644 amd/build/flexslider.min.js.map create mode 100644 amd/build/icon_system_fontawesome.min.js.map create mode 100644 amd/build/jqueryeasing.min.js create mode 100644 amd/build/jqueryeasing.min.js.map create mode 100644 amd/build/pace.min.js create mode 100644 amd/build/pace.min.js.map create mode 100644 amd/build/savebutton.min.js.map create mode 100644 amd/build/slider.min.js create mode 100644 amd/build/slider.min.js.map create mode 100644 amd/build/tabbed.min.js create mode 100644 amd/build/tabbed.min.js.map delete mode 100644 amd/build/templatepreview.min.js delete mode 100644 amd/build/utils.min.js delete mode 100644 amd/src/bsoptions.js create mode 100644 amd/src/flexslider.js create mode 100644 amd/src/jqueryeasing.js create mode 100644 amd/src/pace.js create mode 100644 amd/src/slider.js create mode 100644 amd/src/tabbed.js delete mode 100644 amd/src/templatepreview.js delete mode 100644 amd/src/utils.js create mode 100644 classes/admin_setting_configstoredfile_putprops.php create mode 100644 classes/admin_setting_getprops.php rename settings/adaptable_admin_setting_putprops.php => classes/admin_setting_putprops.php (71%) delete mode 100644 jquery/adaptable_v2_1_1_2.js delete mode 100644 jquery/jquery-easing-min.js delete mode 100644 jquery/jquery-flexslider-min.js delete mode 100644 jquery/pace-min.js delete mode 100644 jquery/plugins.php delete mode 100644 jquery/tickerme.js create mode 100644 scss/nosettings/_layout.scss create mode 100644 scss/nosettings/_modal.scss create mode 100644 scss/settings/core.scss create mode 100644 scss/settings/modal.scss create mode 100644 scss/settings/secondarynavigation.scss delete mode 100644 settings/adaptable_admin_setting_getprops.php delete mode 100644 tests/behat/behat_theme_adaptable_behat_auth.php create mode 100644 tests/behat/blacklist.json delete mode 100644 tests/behat/core_auth/behat_theme_adaptable_behat_core_auth.php create mode 100644 tests/behat/navigation.feature diff --git a/Changes.md b/Changes.md index 2777a6c..bf4d49f 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,37 @@ +Change Log in version 402.1.5 (2023092506) +=========================================== +1. Only show secondary navigation if there is something to show. +2. Refactored 'buttonfocuscolor' and 'buttonfocuscoloropacity' to be 'inputbuttonfocuscolour' and 'inputbuttonfocuscolouropacity' + respectively as they really relate to the box shadow when focusing on an 'input' button. +3. Created 'buttonfocuscolour' and 'buttontextfocuscolor' to apply a background and text colour on focused buttons. +4. Flex Slider upgraded to 2.7.2. +5. Pace updated to 1.2.4. +6. AMD'ify Tickerme. +7. AMD'ify jquery.easing. +8. Removed outdated method of jQuery plugin usage. +9. Moved ticker JS to sponsors only. +10. Added 'enablesavecanceloverlayresetconfirm' string for save settings cancellation reset warning. +11. Fix sticky header margin. +12. Fix course index user preference. +13. Added 'regionmaintextcolor' and other small fixes. +14. Added 'primarycolour' and 'secondarycolour', to control the respective Bootstrap colours as used in the SCSS in general. +15. Added the ability to set text and background colours on the Ticker. +16. Moved 'fontcolor' to 'Colours' tab and fix button colours. +17. Dialog and tab tidy. +18. Ticker style back to what it was. +19. Fix collapsed information blocks not showing. +20. Remove 'docked' styles. +21. Fix 'Flexible blocks are too big on small screens'. +22. Add name and description back to user profile page. +23. Fix theme selector buttons. +24. Tidy frontpage layout. +25. Fix backup 'Return to course button'. +26. Add file settings to import / export of settings. +27. Fix unread notification text colour. +28. Fix notification icons not showing when body font weight is <= 300. +29. Update theme version of FontAwesome free to 6.6.0 from 6.4.2. +30. Increase tooltip font size to .9rem. + Change Log in version 402.1.4 (2023092505) =========================================== 1. Fix 'itemid' not being regenerated for 'customjsfiles'. diff --git a/amd/build/adaptable.min.js b/amd/build/adaptable.min.js index 8c8e737..117805c 100644 --- a/amd/build/adaptable.min.js +++ b/amd/build/adaptable.min.js @@ -1,4 +1,5 @@ +define("theme_adaptable/adaptable",["exports","jquery","theme_adaptable/jqueryeasing","theme_adaptable/pace","core/log"],(function(_exports,_jquery,_jqueryeasing,_pace,_log){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} // @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. -define("theme_adaptable/adaptable",["jquery","core/log"],(function($,log){return log.debug("Adaptable AMD"),{init:function(){$(document).ready((function($){log.debug("Adaptable AMD init"),$(".breadcrumb li:not(:last-child) span").not(".separator").addClass(""),$(".breadcrumb li:last-child").addClass("lastli");try{$('.context-header-settings-menu .dropdown-menu .dropdown-item a[href*="edit"], #editingbutton a').click((function(event){event.preventDefault();var to=$(window).scrollTop();sessionStorage.setItem("scrollTo",to);var url=$(this).prop("href");return window.location.replace(url),!1}));var scrollTo=sessionStorage.getItem("scrollTo");null!==scrollTo&&(window.scrollTo(0,scrollTo),sessionStorage.removeItem("scrollTo"))}catch(e){log.debug("Adaptable: Session storage exception: "+e.name)}var bttOn;bttOn=!($(window).scrollTop()>50);var scrollCheck=function(){$(window).scrollTop()>50?0==bttOn&&(bttOn=!0,$("#back-to-top").fadeIn(500)):1==bttOn&&(bttOn=!1,$("#back-to-top").fadeOut(500))};if(scrollCheck(),$(window).scroll((function(){scrollCheck()})),$("#back-to-top").click((function(event){return event.preventDefault(),$("html, body").animate({scrollTop:0},500),!1})),window.location.hash&&$("body").hasClass("pagelayout-course")){var anchorTop=$(window.location.hash).offset().top;$("html, body").animate({scrollTop:anchorTop-102},500)}}))}}})); +Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=_interopRequireDefault(_jquery),_jqueryeasing=_interopRequireDefault(_jqueryeasing),_pace=_interopRequireDefault(_pace),_log=_interopRequireDefault(_log);const adaptable=()=>{_log.default.debug("Adaptable ES6 adaptable"),(0,_jquery.default)(".breadcrumb li:not(:last-child) span").not(".separator").addClass(""),(0,_jquery.default)(".breadcrumb li:last-child").addClass("lastli");try{(0,_jquery.default)('.context-header-settings-menu .dropdown-menu .dropdown-item a[href*="edit"], #editingbutton a').click((function(event){event.preventDefault();var to=(0,_jquery.default)(window).scrollTop();sessionStorage.setItem("scrollTo",to);var url=(0,_jquery.default)(this).prop("href");return window.location.replace(url),!1}));var scrollTo=sessionStorage.getItem("scrollTo");null!==scrollTo&&(window.scrollTo(0,scrollTo),sessionStorage.removeItem("scrollTo"))}catch(e){_log.default.debug("Adaptable: Session storage exception: "+e.name)}let bttOn;let st=(0,_jquery.default)("#page").scrollTop();bttOn=!(st>150);var bttScrollCheck=function(){st=(0,_jquery.default)("#page").scrollTop(),st>150?0==bttOn&&(bttOn=!0,(0,_jquery.default)("#back-to-top").fadeIn(500)):1==bttOn&&(bttOn=!1,(0,_jquery.default)("#back-to-top").fadeOut(500))};if(bttScrollCheck(),(0,_jquery.default)("#page").scroll((function(){bttScrollCheck()})),(0,_jquery.default)("#back-to-top").click((function(event){return event.preventDefault(),(0,_jquery.default)("#page").animate({scrollTop:0},500),!1})),window.location.hash&&(0,_jquery.default)("body").hasClass("pagelayout-course")){var anchorTop=(0,_jquery.default)(window.location.hash).offset().top;(0,_jquery.default)("html, body").animate({scrollTop:anchorTop-102},500)}"fixed"==(0,_jquery.default)("header").css("position")&&(0,_jquery.default)(".outercont").css("padding-top",(0,_jquery.default)("header").height())},options=data=>{_log.default.debug("Adaptable ES6 options");var body=(0,_jquery.default)("body"),navbar=document.getElementById("main-navbar");if(data.stickynavbar){const screenmd=992,screensm=768;var currentWindowSize,windowWidth=(0,_jquery.default)(window).width();currentWindowSize=windowWidth0&&void 0!==arguments[0]&&arguments[0];if(pageScrollTop=page.scrollTop,windowWidth=aboveHeaderHeight)return;pageScrollTop=aboveHeaderHeight,newHeaderTop=0,newPageMarginTop=0}else{if(!update&¤tPageScrollTop==headerNoNavbar&&pageScrollTop>=headerNoNavbar)return;update&&(headerHeight=header.getBoundingClientRect().height,null!==navbar&&(navbarHeight=navbar.getBoundingClientRect().height),headerNoNavbar=headerHeight-navbarHeight),pageScrollTop>headerNoNavbar&&(pageScrollTop=headerNoNavbar),newHeaderTop=-pageScrollTop,newPageMarginTop=headerHeight-pageScrollTop}if(currentPageScrollTop=pageScrollTop,(update||newHeaderTop!=headerTop)&&(header.style.top=newHeaderTop+"px",headerTop=newHeaderTop),(update||newPageMarginTop!=pageMarginTop)&&(page.style.marginTop=newPageMarginTop+"px",pageMarginTop=newPageMarginTop),(courseIndex||sidePost)&&(newDrawerPaddingTop=windowWidth{if(_log.default.debug("Adaptable ES6 init"),(0,_jqueryeasing.default)(),_pace.default.start({document:!1}),data.stickynavbar){var shiftWindow=function(){scrollBy(0,-50)};location.hash&&shiftWindow(),window.addEventListener("hashchange",shiftWindow)}"loading"!==document.readyState?(_log.default.debug("Adaptable ES6 init DOM content already loaded"),adaptable(),options(data)):(_log.default.debug("Adaptable ES6 init JS DOM content not loaded"),document.addEventListener("DOMContentLoaded",(function(){_log.default.debug("Adaptable ES6 init JS DOM content loaded"),adaptable(),options(data)})))}})); //# sourceMappingURL=adaptable.min.js.map \ No newline at end of file diff --git a/amd/build/adaptable.min.js.map b/amd/build/adaptable.min.js.map new file mode 100644 index 0000000..3c8860f --- /dev/null +++ b/amd/build/adaptable.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"adaptable.min.js","sources":["../src/adaptable.js"],"sourcesContent":["//\n// This file is part of Adaptable theme for moodle\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n//\n\n// Adaptable main JS file\n//\n// @package theme_adaptable\n// @copyright 2015-2019 Jeremy Hopkins (Coventry University)\n// @copyright 2015-2019 Fernando Acedo (3-bits.com)\n// @copyright 2018-2019 Manoj Solanki (Coventry University)\n// @copyright 2019 G J Barnard\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport $ from 'jquery';\nimport jqueryeasingInit from 'theme_adaptable/jqueryeasing';\nimport pace from 'theme_adaptable/pace';\nimport log from 'core/log';\n\nconst adaptable = () => {\n log.debug('Adaptable ES6 adaptable');\n\n // Breadcrumb.\n $(\".breadcrumb li:not(:last-child) span\").not('.separator').addClass('');\n $(\".breadcrumb li:last-child\").addClass(\"lastli\");\n\n // Edit button keep position. Needs session storage!\n try {\n $('.context-header-settings-menu .dropdown-menu .dropdown-item a[href*=\"edit\"], #editingbutton a')\n .click(function (event) {\n event.preventDefault();\n\n var to = $(window).scrollTop();\n sessionStorage.setItem('scrollTo', to);\n var url = $(this).prop('href');\n window.location.replace(url);\n\n return false;\n });\n var scrollTo = sessionStorage.getItem('scrollTo');\n if (scrollTo !== null) {\n window.scrollTo(0, scrollTo);\n sessionStorage.removeItem('scrollTo');\n }\n } catch (e) {\n log.debug('Adaptable: Session storage exception: ' + e.name);\n }\n\n // Scroll to top.\n const bttOffset = 150;\n const bttDuration = 500;\n let bttOn;\n const scrollDuration = 500;\n let st = $('#page').scrollTop();\n if (st > bttOffset) {\n bttOn = false;\n } else {\n bttOn = true;\n }\n var bttScrollCheck = function () {\n st = $('#page').scrollTop();\n if (st > bttOffset) {\n if (bttOn == false) {\n bttOn = true;\n $('#back-to-top').fadeIn(bttDuration);\n }\n } else {\n if (bttOn == true) {\n bttOn = false;\n $('#back-to-top').fadeOut(bttDuration);\n }\n }\n };\n bttScrollCheck();\n $('#page').scroll(function () {\n bttScrollCheck();\n });\n\n $('#back-to-top').click(function (event) {\n event.preventDefault();\n $('#page').animate({ scrollTop: 0 }, scrollDuration);\n return false;\n });\n\n // Anchor.\n if (window.location.hash) {\n if ($(\"body\").hasClass(\"pagelayout-course\")) {\n var anchorTop = $(window.location.hash).offset().top;\n $('html, body').animate({ scrollTop: anchorTop - 102 }, scrollDuration);\n }\n }\n\n // New for every three.\n if ($('header').css(\"position\") == \"fixed\") {\n $('.outercont').css('padding-top', $('header').height());\n }\n};\n\nconst options = (data) => {\n log.debug('Adaptable ES6 options');\n var body = $(\"body\");\n // Get the navbar, if present.\n var navbar = document.getElementById(\"main-navbar\");\n\n if (data.stickynavbar) {\n /* New way to handle sticky navbar requirement.\n Simply taken from https://www.w3schools.com/howto/howto_js_navbar_sticky.asp. */\n\n const screenmd = 992;\n const screensm = 768;\n var windowWidth = $(window).width();\n var currentWindowSize;\n if (windowWidth < screensm) {\n currentWindowSize = 1;\n } else if (windowWidth < screenmd) {\n currentWindowSize = 2;\n } else {\n currentWindowSize = 3;\n }\n\n // Container.\n var header = document.getElementById(\"adaptable-page-header-wrapper\");\n var aboveHeader = document.getElementById(\"header1\");\n if (!aboveHeader) {\n aboveHeader = document.getElementById(\"header2\");\n }\n\n // Drawers.\n var courseIndex = document.getElementById(\"theme_adaptable-drawers-courseindex\");\n var sidePost = document.getElementById(\"theme_adaptable-drawers-sidepost\");\n var drawerTogglers = document.getElementsByClassName(\"drawer-toggler\");\n\n // Page.\n var page = document.getElementById(\"page\");\n\n // Adjustments.\n var pageScrollTop = page.scrollTop;\n var currentPageScrollTop = pageScrollTop;\n var headerHeight = 0;\n var headerNoNavbar = 0;\n var navbarHeight = 0;\n if (navbar !== null) {\n navbarHeight = navbar.getBoundingClientRect().height;\n }\n var aboveHeaderHeight = aboveHeader.getBoundingClientRect().height;\n\n var drawerPaddingTop = 0;\n var newDrawerPaddingTop = 0;\n var pageMarginTop = 0;\n var newPageMarginTop = 0;\n var headerTop = 0;\n var newHeaderTop = 0;\n\n var isFixed = 0;\n /* Ok, here's an odd one... desktops need to use the 'inner' variables and mobiles the 'outer'\n to be accurate! But... I've (GB) found that the jQuery height and width functions adapt and\n report close to correct values regardless of device, so use them instead without complicated\n device detection here! Update: postion:fixed does not work on mobiles at the moment so won't\n be for such, left comment for future info. */\n\n /* Top navbar stickyness.\n As per above comments, some issues noted with using CSS position: fixed, but these seem to mostly be constrained\n to older browsers (inc. mobile browsers). May need to revisit!\n https://caniuse.com/#feat=css-fixed */\n if (windowWidth < screenmd) {\n header.classList.remove(\"sticky\");\n body.addClass(\"page-header-margin\");\n isFixed = 1;\n } else {\n header.classList.add(\"sticky\");\n body.removeClass(\"page-header-margin\");\n }\n\n var makeNavbarSticky = function (update = false) {\n pageScrollTop = page.scrollTop;\n\n if (windowWidth < screenmd) {\n if ((!update) && (currentPageScrollTop == aboveHeaderHeight) && (pageScrollTop >= aboveHeaderHeight)) {\n return;\n }\n pageScrollTop = aboveHeaderHeight;\n newHeaderTop = 0;\n newPageMarginTop = 0;\n } else {\n if ((!update) && (currentPageScrollTop == headerNoNavbar) && (pageScrollTop >= headerNoNavbar)) {\n return;\n }\n if (update) {\n // Just changed from <= screenmd.\n headerHeight = header.getBoundingClientRect().height;\n if (navbar !== null) {\n navbarHeight = navbar.getBoundingClientRect().height;\n } // Else will never change from 0 at init!\n headerNoNavbar = headerHeight - navbarHeight;\n }\n if (pageScrollTop > headerNoNavbar) {\n pageScrollTop = headerNoNavbar;\n }\n newHeaderTop = -pageScrollTop;\n newPageMarginTop = headerHeight - pageScrollTop;\n }\n currentPageScrollTop = pageScrollTop;\n\n if ((update) || (newHeaderTop != headerTop)) {\n header.style.top = newHeaderTop + 'px';\n headerTop = newHeaderTop;\n }\n if ((update) || (newPageMarginTop != pageMarginTop)) {\n page.style.marginTop = newPageMarginTop + 'px';\n pageMarginTop = newPageMarginTop;\n }\n\n if ((courseIndex) || (sidePost)) {\n if (windowWidth < screenmd) {\n newDrawerPaddingTop = 0;\n } else {\n newDrawerPaddingTop = headerHeight - pageScrollTop;\n }\n if ((update) || (newDrawerPaddingTop != drawerPaddingTop)) {\n drawerPaddingTop = newDrawerPaddingTop;\n if (courseIndex) {\n courseIndex.style.paddingTop = drawerPaddingTop + 'px';\n }\n if (sidePost) {\n sidePost.style.paddingTop = drawerPaddingTop + 'px';\n }\n if ((courseIndex) || (sidePost)) {\n if (windowWidth < screenmd) {\n for (let dt = 0; dt < drawerTogglers.length; dt++) {\n drawerTogglers[dt].style.top = null;\n }\n } else {\n for (let dt = 0; dt < drawerTogglers.length; dt++) {\n drawerTogglers[dt].style.top = (drawerPaddingTop + 22) + 'px';\n }\n }\n }\n }\n }\n };\n makeNavbarSticky(true);\n if (courseIndex) {\n courseIndex.classList.remove(\"d-none\");\n }\n if (sidePost) {\n sidePost.classList.remove(\"d-none\");\n }\n\n // When the user scrolls the page, execute makeNavbarSticky().\n page.onscroll = function () { makeNavbarSticky(); };\n\n $(window).resize(function () {\n windowWidth = $(window).width();\n if (windowWidth < screensm) {\n if (currentWindowSize != 1) {\n makeNavbarSticky(true);\n currentWindowSize = 1;\n }\n } else if (windowWidth < screenmd) {\n if (currentWindowSize != 2) {\n makeNavbarSticky(true);\n currentWindowSize = 2;\n }\n } else {\n if (currentWindowSize != 3) {\n currentWindowSize = 3;\n }\n // At screenmd and above, window width changes can change the height of the header.\n makeNavbarSticky(true);\n }\n if (windowWidth < screenmd) {\n if (isFixed === 0) {\n header.classList.remove(\"sticky\");\n body.addClass(\"page-header-margin\");\n isFixed = 1;\n }\n } else {\n if (isFixed === 1) {\n header.classList.add(\"sticky\");\n body.removeClass(\"page-header-margin\");\n isFixed = 0;\n }\n }\n });\n }\n\n $('.moodlewidth').click(function() {\n if (body.hasClass('fullin') ) {\n body.removeClass('fullin');\n M.util.set_user_preference('theme_adaptable_full', 'nofull');\n } else {\n body.addClass('fullin');\n M.util.set_user_preference('theme_adaptable_full', 'fullin');\n }\n });\n\n $('#openoverlaymenu').click(function () {\n $('#conditionalmenu').toggleClass('open');\n });\n $('#overlaymenuclose').click(function () {\n $('#conditionalmenu').toggleClass('open');\n });\n\n // Bootstrap sub-menu functionality.\n // See: https://bootstrapthemes.co/demo/resource/bootstrap-4-multi-dropdown-hover-navbar/.\n\n $('.dropdown-menu a.dropdown-toggle').on('click', function () {\n var $el = $(this);\n var $parent = $(this).offsetParent(\".dropdown-menu\");\n if (!$(this).next().hasClass('show')) {\n $(this).parents('.dropdown-menu').first().find('.show').removeClass(\"show\");\n }\n var $subMenu = $(this).next(\".dropdown-menu\");\n $subMenu.toggleClass('show');\n\n $(this).parent(\"li\").toggleClass('show');\n\n $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function () {\n $('.dropdown-menu .show').removeClass(\"show\");\n });\n\n if (!$parent.parent().hasClass('navbar-nav')) {\n $el.next().css({ \"top\": $el[0].offsetTop, \"left\": $parent.outerWidth() - 4 });\n }\n\n return false;\n });\n};\n\nexport const init = (data) => {\n log.debug('Adaptable ES6 init');\n jqueryeasingInit();\n pace.start({\n document: false\n });\n /* Conditional javascript to resolve anchor link clicking issue with sticky navbar.\n in old bootstrap version. Re: issue #919.\n Original issue / solution discussion here: https://github.com/twbs/bootstrap/issues/1768. */\n if (data.stickynavbar) {\n var shiftWindow = function () { scrollBy(0, -50); };\n if (location.hash) {\n shiftWindow();\n }\n window.addEventListener(\"hashchange\", shiftWindow);\n }\n if (document.readyState !== 'loading') {\n log.debug(\"Adaptable ES6 init DOM content already loaded\");\n adaptable();\n options(data);\n } else {\n log.debug(\"Adaptable ES6 init JS DOM content not loaded\");\n document.addEventListener('DOMContentLoaded', function () {\n log.debug(\"Adaptable ES6 init JS DOM content loaded\");\n adaptable();\n options(data);\n });\n }\n};\n"],"names":["adaptable","debug","not","addClass","click","event","preventDefault","to","window","scrollTop","sessionStorage","setItem","url","this","prop","location","replace","scrollTo","getItem","removeItem","e","name","bttOn","st","bttScrollCheck","fadeIn","fadeOut","scroll","animate","hash","hasClass","anchorTop","offset","top","css","height","options","data","body","navbar","document","getElementById","stickynavbar","screenmd","screensm","currentWindowSize","windowWidth","width","header","aboveHeader","courseIndex","sidePost","drawerTogglers","getElementsByClassName","page","pageScrollTop","currentPageScrollTop","headerHeight","headerNoNavbar","navbarHeight","getBoundingClientRect","aboveHeaderHeight","drawerPaddingTop","newDrawerPaddingTop","pageMarginTop","newPageMarginTop","headerTop","newHeaderTop","isFixed","classList","remove","add","removeClass","makeNavbarSticky","update","style","marginTop","paddingTop","dt","length","onscroll","resize","M","util","set_user_preference","toggleClass","on","$el","$parent","offsetParent","next","parents","first","find","parent","offsetTop","outerWidth","start","shiftWindow","scrollBy","addEventListener","readyState"],"mappings":";;qPAkCMA,UAAY,kBACVC,MAAM,+CAGR,wCAAwCC,IAAI,cAAcC,SAAS,wBACnE,6BAA6BA,SAAS,kCAIlC,iGACGC,OAAM,SAAUC,OACbA,MAAMC,qBAEFC,IAAK,mBAAEC,QAAQC,YACnBC,eAAeC,QAAQ,WAAYJ,QAC/BK,KAAM,mBAAEC,MAAMC,KAAK,eACvBN,OAAOO,SAASC,QAAQJ,MAEjB,SAEXK,SAAWP,eAAeQ,QAAQ,YACrB,OAAbD,WACAT,OAAOS,SAAS,EAAGA,UACnBP,eAAeS,WAAW,aAEhC,MAAOC,gBACDnB,MAAM,yCAA2CmB,EAAEC,UAMvDC,UAEAC,IAAK,mBAAE,SAASd,YAEhBa,QADAC,GALc,SAUdC,eAAiB,WACjBD,IAAK,mBAAE,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F,iBAAiB,aAAcF,aAEd,YAAxB1D,SAAS6D,yBACLpG,MAAM,iDACVD,YACAoC,QAAQC,qBAEJpC,MAAM,gDACVuC,SAAS4D,iBAAiB,oBAAoB,wBACtCnG,MAAM,4CACVD,YACAoC,QAAQC"} \ No newline at end of file diff --git a/amd/build/admin_settings.min.js b/amd/build/admin_settings.min.js index dca8977..2c3bf0f 100644 --- a/amd/build/admin_settings.min.js +++ b/amd/build/admin_settings.min.js @@ -1,13 +1,5 @@ define("theme_adaptable/admin_settings",["exports","core/log"],(function(_exports,_log){var obj; -/** - * Admin settings. Go back to the current tab after save. - * - * @module theme_adaptable/admin_settings - * @copyright 2024 G J Barnard. - * @author G J Barnard - - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_log=(obj=_log)&&obj.__esModule?obj:{default:obj};_exports.init=()=>{const stickyTabs=()=>{const tabels=document.querySelectorAll('a[data-toggle="tab"]');if(tabels.length){const action=document.querySelector("form#adminsettings");tabels.forEach((tabel=>{tabel.addEventListener("click",(event=>{_log.default.debug("Tab clicky! "+event.target.href),action.setAttribute("action",event.target.href)}),!1)}))}};"loading"!==document.readyState?(_log.default.debug("Adaptable Admin settings JS DOM content already loaded"),stickyTabs()):(_log.default.debug("Adaptable Admin settings JS DOM content not loaded"),document.addEventListener("DOMContentLoaded",(function(){_log.default.debug("Adaptable Admin settings JS DOM content loaded"),stickyTabs()})))}})); +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_log=(obj=_log)&&obj.__esModule?obj:{default:obj};_exports.init=()=>{const stickyTabs=()=>{const tabels=document.querySelectorAll('a[data-toggle="tab"]');if(tabels.length){const action=document.querySelector("form#adminsettings");tabels.forEach((tabel=>{tabel.addEventListener("click",(event=>{_log.default.debug("Tab clicky! "+event.target.href),action.setAttribute("action",event.target.href)}),!1)}))}};_log.default.debug("Adaptable ES6 Admin settings init"),"loading"!==document.readyState?(_log.default.debug("Adaptable ES6 Admin settings JS DOM content already loaded"),stickyTabs()):(_log.default.debug("Adaptable ES6 Admin settings JS DOM content not loaded"),document.addEventListener("DOMContentLoaded",(function(){_log.default.debug("Adaptable ES6 Admin settings JS DOM content loaded"),stickyTabs()})))}})); //# sourceMappingURL=admin_settings.min.js.map \ No newline at end of file diff --git a/amd/build/admin_settings.min.js.map b/amd/build/admin_settings.min.js.map index b249d7e..08b640f 100644 --- a/amd/build/admin_settings.min.js.map +++ b/amd/build/admin_settings.min.js.map @@ -1 +1 @@ -{"version":3,"file":"admin_settings.min.js","sources":["../src/admin_settings.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Admin settings. Go back to the current tab after save.\n *\n * @module theme_adaptable/admin_settings\n * @copyright 2024 G J Barnard.\n * @author G J Barnard -\n * {@link https://moodle.org/user/profile.php?id=442195}\n * {@link https://gjbarnard.co.uk}\n * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n */\n\nimport log from 'core/log';\n\n/**\n * Initialise this module.\n */\nexport const init = () => {\n const stickyTabs = () => {\n const tabels = document.querySelectorAll('a[data-toggle=\"tab\"]');\n if (tabels.length) {\n const action = document.querySelector('form#adminsettings');\n tabels.forEach(tabel => {\n tabel.addEventListener(\n \"click\",\n (event) => {\n log.debug(\"Tab clicky! \" + event.target.href);\n action.setAttribute('action', event.target.href);\n },\n false,\n );\n });\n }\n };\n\n if (document.readyState !== 'loading') {\n log.debug(\"Adaptable Admin settings JS DOM content already loaded\");\n stickyTabs();\n } else {\n log.debug(\"Adaptable Admin settings JS DOM content not loaded\");\n document.addEventListener('DOMContentLoaded', function() {\n log.debug(\"Adaptable Admin settings JS DOM content loaded\");\n stickyTabs();\n });\n }\n};\n"],"names":["stickyTabs","tabels","document","querySelectorAll","length","action","querySelector","forEach","tabel","addEventListener","event","debug","target","href","setAttribute","readyState"],"mappings":";;;;;;;;;;kJA+BoB,WACVA,WAAa,WACTC,OAASC,SAASC,iBAAiB,2BACrCF,OAAOG,OAAQ,OACTC,OAASH,SAASI,cAAc,sBACtCL,OAAOM,SAAQC,QACXA,MAAMC,iBACF,SACCC,qBACOC,MAAM,eAAiBD,MAAME,OAAOC,MACxCR,OAAOS,aAAa,SAAUJ,MAAME,OAAOC,SAE/C,QAMY,YAAxBX,SAASa,yBACLJ,MAAM,0DACVX,4BAEIW,MAAM,sDACVT,SAASO,iBAAiB,oBAAoB,wBACtCE,MAAM,kDACVX"} \ No newline at end of file +{"version":3,"file":"admin_settings.min.js","sources":["../src/admin_settings.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// Admin settings. Go back to the current tab after save.\n//\n// @module theme_adaptable/admin_settings\n// @copyright 2024 G J Barnard.\n// @author G J Barnard -\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport log from 'core/log';\n\n/**\n * Initialise this module.\n */\nexport const init = () => {\n const stickyTabs = () => {\n const tabels = document.querySelectorAll('a[data-toggle=\"tab\"]');\n if (tabels.length) {\n const action = document.querySelector('form#adminsettings');\n tabels.forEach(tabel => {\n tabel.addEventListener(\n \"click\",\n (event) => {\n log.debug(\"Tab clicky! \" + event.target.href);\n action.setAttribute('action', event.target.href);\n },\n false,\n );\n });\n }\n };\n\n log.debug('Adaptable ES6 Admin settings init');\n if (document.readyState !== 'loading') {\n log.debug(\"Adaptable ES6 Admin settings JS DOM content already loaded\");\n stickyTabs();\n } else {\n log.debug(\"Adaptable ES6 Admin settings JS DOM content not loaded\");\n document.addEventListener('DOMContentLoaded', function() {\n log.debug(\"Adaptable ES6 Admin settings JS DOM content loaded\");\n stickyTabs();\n });\n }\n};\n"],"names":["stickyTabs","tabels","document","querySelectorAll","length","action","querySelector","forEach","tabel","addEventListener","event","debug","target","href","setAttribute","readyState"],"mappings":";;6IA+BoB,WACVA,WAAa,WACTC,OAASC,SAASC,iBAAiB,2BACrCF,OAAOG,OAAQ,OACTC,OAASH,SAASI,cAAc,sBACtCL,OAAOM,SAAQC,QACXA,MAAMC,iBACF,SACCC,qBACOC,MAAM,eAAiBD,MAAME,OAAOC,MACxCR,OAAOS,aAAa,SAAUJ,MAAME,OAAOC,SAE/C,qBAMZF,MAAM,qCACkB,YAAxBT,SAASa,yBACLJ,MAAM,8DACVX,4BAEIW,MAAM,0DACVT,SAASO,iBAAiB,oBAAoB,wBACtCE,MAAM,sDACVX"} \ No newline at end of file diff --git a/amd/build/bsoptions.min.js b/amd/build/bsoptions.min.js deleted file mode 100644 index 2545f02..0000000 --- a/amd/build/bsoptions.min.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. -define("theme_adaptable/bsoptions",["jquery","core/log"],(function($,log){return log.debug("Adaptable Bootstrap AMD opt in functions"),{init:function(data){if($(document).ready((function($){var body=$("body"),navbar=document.getElementById("main-navbar");if(data.stickynavbar){const screenmd=992,screensm=768;var currentWindowSize,windowWidth=$(window).width();currentWindowSize=windowWidth0&&void 0!==arguments[0]&&arguments[0];if(pageScrollTop=page.scrollTop,windowWidth=aboveHeaderHeight)return;pageScrollTop=aboveHeaderHeight,newHeaderTop=0,newPageMarginTop=0}else{if(!update&¤tPageScrollTop==headerNoNavbar&&pageScrollTop>=headerNoNavbar)return;update&&(headerHeight=header.getBoundingClientRect().height,null!==navbar&&(navbarHeight=navbar.getBoundingClientRect().height),headerNoNavbar=headerHeight-navbarHeight),pageScrollTop>headerNoNavbar&&(pageScrollTop=headerNoNavbar),newHeaderTop=-pageScrollTop,newPageMarginTop=headerHeight-pageScrollTop}if(currentPageScrollTop=pageScrollTop,(update||newHeaderTop!=headerTop)&&(header.style.top=newHeaderTop+"px",headerTop=newHeaderTop),(update||newPageMarginTop!=pageMarginTop)&&(page.style.marginTop=newPageMarginTop+"px",pageMarginTop=newPageMarginTop),(courseIndex||sidePost)&&(newDrawerPaddingTop=windowWidth{ +/* + * jQuery FlexSlider v2.7.2 + * Copyright 2012 WooThemes + * Contributing Author: Tyler Smith + * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later. + */ +var focused=!0;_jquery.default.flexslider=function(el,options){var slider=(0,_jquery.default)(el);void 0===options.rtl&&"rtl"==(0,_jquery.default)("html").attr("dir")&&(options.rtl=!0),slider.vars=_jquery.default.extend({},_jquery.default.flexslider.defaults,options);var watchedEventClearTimer,namespace=slider.vars.namespace,msGesture=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,touch=("ontouchstart"in window||msGesture||window.DocumentTouch&&document instanceof DocumentTouch)&&slider.vars.touch,eventType="click touchend MSPointerUp keyup",watchedEvent="",vertical="vertical"===slider.vars.direction,reverse=slider.vars.reverse,carousel=slider.vars.itemWidth>0,fade="fade"===slider.vars.animation,asNav=""!==slider.vars.asNavFor,methods={};_jquery.default.data(el,"flexslider",slider),methods={init:function(){slider.animating=!1,slider.currentSlide=parseInt(slider.vars.startAt?slider.vars.startAt:0,10),isNaN(slider.currentSlide)&&(slider.currentSlide=0),slider.animatingTo=slider.currentSlide,slider.atEnd=0===slider.currentSlide||slider.currentSlide===slider.last,slider.containerSelector=slider.vars.selector.substr(0,slider.vars.selector.search(" ")),slider.slides=(0,_jquery.default)(slider.vars.selector,slider),slider.container=(0,_jquery.default)(slider.containerSelector,slider),slider.count=slider.slides.length,slider.syncExists=(0,_jquery.default)(slider.vars.sync).length>0,"slide"===slider.vars.animation&&(slider.vars.animation="swing"),slider.prop=vertical?"top":slider.vars.rtl?"marginRight":"marginLeft",slider.args={},slider.manualPause=!1,slider.stopped=!1,slider.started=!1,slider.startTimeout=null,slider.transitions=!slider.vars.video&&!fade&&slider.vars.useCSS&&function(){var obj=document.createElement("div"),props=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in props)if(void 0!==obj.style[props[i]])return slider.pfx=props[i].replace("Perspective","").toLowerCase(),slider.prop="-"+slider.pfx+"-transform",!0;return!1}(),slider.isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,slider.ensureAnimationEnd="",""!==slider.vars.controlsContainer&&(slider.controlsContainer=(0,_jquery.default)(slider.vars.controlsContainer).length>0&&(0,_jquery.default)(slider.vars.controlsContainer)),""!==slider.vars.manualControls&&(slider.manualControls=(0,_jquery.default)(slider.vars.manualControls).length>0&&(0,_jquery.default)(slider.vars.manualControls)),""!==slider.vars.customDirectionNav&&(slider.customDirectionNav=2===(0,_jquery.default)(slider.vars.customDirectionNav).length&&(0,_jquery.default)(slider.vars.customDirectionNav)),slider.vars.randomize&&(slider.slides.sort((function(){return Math.round(Math.random())-.5})),slider.container.empty().append(slider.slides)),slider.doMath(),slider.setup("init"),slider.vars.controlNav&&methods.controlNav.setup(),slider.vars.directionNav&&methods.directionNav.setup(),slider.vars.keyboard&&(1===(0,_jquery.default)(slider.containerSelector).length||slider.vars.multipleKeyboard)&&(0,_jquery.default)(document).bind("keyup",(function(event){var keycode=event.keyCode;if(!slider.animating&&(39===keycode||37===keycode)){var target=slider.vars.rtl?37===keycode?slider.getTarget("next"):39===keycode&&slider.getTarget("prev"):39===keycode?slider.getTarget("next"):37===keycode&&slider.getTarget("prev");slider.flexAnimate(target,slider.vars.pauseOnAction)}})),slider.vars.mousewheel&&slider.bind("mousewheel",(function(event,delta,deltaX,deltaY){event.preventDefault();var target=delta<0?slider.getTarget("next"):slider.getTarget("prev");slider.flexAnimate(target,slider.vars.pauseOnAction)})),slider.vars.pausePlay&&methods.pausePlay.setup(),slider.vars.slideshow&&slider.vars.pauseInvisible&&methods.pauseInvisible.init(),slider.vars.slideshow&&(slider.vars.pauseOnHover&&slider.hover((function(){slider.manualPlay||slider.manualPause||slider.pause()}),(function(){slider.manualPause||slider.manualPlay||slider.stopped||slider.play()})),slider.vars.pauseInvisible&&methods.pauseInvisible.isHidden()||(slider.vars.initDelay>0?slider.startTimeout=setTimeout(slider.play,slider.vars.initDelay):slider.play())),asNav&&methods.asNav.setup(),touch&&slider.vars.touch&&methods.touch(),(!fade||fade&&slider.vars.smoothHeight)&&(0,_jquery.default)(window).bind("resize orientationchange focus",methods.resize),slider.find("img").attr("draggable","false"),setTimeout((function(){slider.vars.start(slider)}),200)},asNav:{setup:function(){slider.asNav=!0,slider.animatingTo=Math.floor(slider.currentSlide/slider.move),slider.currentItem=slider.currentSlide,slider.slides.removeClass(namespace+"active-slide").eq(slider.currentItem).addClass(namespace+"active-slide"),msGesture?(el._slider=slider,slider.slides.each((function(){this._gesture=new MSGesture,this._gesture.target=this,this.addEventListener("MSPointerDown",(function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)}),!1),this.addEventListener("MSGestureTap",(function(e){e.preventDefault();var $slide=(0,_jquery.default)(this),target=$slide.index();(0,_jquery.default)(slider.vars.asNavFor).data("flexslider").animating||$slide.hasClass("active")||(slider.direction=slider.currentItem'),slider.pagingCount>1)for(var i=0;i").attr("href","#").text(j),"thumbnails"===slider.vars.controlNav&&(item=(0,_jquery.default)("").attr("src",slide.attr("data-thumb"))),""!==slide.attr("data-thumb-alt")&&item.attr("alt",slide.attr("data-thumb-alt")),"thumbnails"===slider.vars.controlNav&&!0===slider.vars.thumbCaptions){var captn=slide.attr("data-thumbcaption");if(""!==captn&&void 0!==captn){var caption=(0,_jquery.default)("").addClass(namespace+"caption").text(captn);item.append(caption)}}var liElement=(0,_jquery.default)("
  • ");item.appendTo(liElement),liElement.append("
  • "),slider.controlNavScaffold.append(liElement),j++}slider.controlsContainer?(0,_jquery.default)(slider.controlsContainer).append(slider.controlNavScaffold):slider.append(slider.controlNavScaffold),methods.controlNav.set(),methods.controlNav.active(),slider.controlNavScaffold.delegate("a, img",eventType,(function(event){if(event.preventDefault(),""===watchedEvent||watchedEvent===event.type){var $this=(0,_jquery.default)(this),target=slider.controlNav.index($this);$this.hasClass(namespace+"active")||(slider.direction=target>slider.currentSlide?"next":"prev",slider.flexAnimate(target,slider.vars.pauseOnAction))}""===watchedEvent&&(watchedEvent=event.type),methods.setToClearWatchedEvent()}))},setupManual:function(){slider.controlNav=slider.manualControls,methods.controlNav.active(),slider.controlNav.bind(eventType,(function(event){if(event.preventDefault(),""===watchedEvent||watchedEvent===event.type){var $this=(0,_jquery.default)(this),target=slider.controlNav.index($this);$this.hasClass(namespace+"active")||(target>slider.currentSlide?slider.direction="next":slider.direction="prev",slider.flexAnimate(target,slider.vars.pauseOnAction))}""===watchedEvent&&(watchedEvent=event.type),methods.setToClearWatchedEvent()}))},set:function(){var selector="thumbnails"===slider.vars.controlNav?"img":"a";slider.controlNav=(0,_jquery.default)("."+namespace+"control-nav li "+selector,slider.controlsContainer?slider.controlsContainer:slider)},active:function(){slider.controlNav.removeClass(namespace+"active").eq(slider.animatingTo).addClass(namespace+"active")},update:function(action,pos){slider.pagingCount>1&&"add"===action?slider.controlNavScaffold.append((0,_jquery.default)('
  • '+slider.count+"
  • ")):1===slider.pagingCount?slider.controlNavScaffold.find("li").remove():slider.controlNav.eq(pos).closest("li").remove(),methods.controlNav.set(),slider.pagingCount>1&&slider.pagingCount!==slider.controlNav.length?slider.update(pos,action):methods.controlNav.active()}},directionNav:{setup:function(){var directionNavScaffold=(0,_jquery.default)('");slider.customDirectionNav?slider.directionNav=slider.customDirectionNav:slider.controlsContainer?((0,_jquery.default)(slider.controlsContainer).append(directionNavScaffold),slider.directionNav=(0,_jquery.default)("."+namespace+"direction-nav li a",slider.controlsContainer)):(slider.append(directionNavScaffold),slider.directionNav=(0,_jquery.default)("."+namespace+"direction-nav li a",slider)),methods.directionNav.update(),slider.directionNav.bind(eventType,(function(event){var target;event.preventDefault(),""!==watchedEvent&&watchedEvent!==event.type||(target=(0,_jquery.default)(this).hasClass(namespace+"next")?slider.getTarget("next"):slider.getTarget("prev"),slider.flexAnimate(target,slider.vars.pauseOnAction)),""===watchedEvent&&(watchedEvent=event.type),methods.setToClearWatchedEvent()}))},update:function(){var disabledClass=namespace+"disabled";1===slider.pagingCount?slider.directionNav.addClass(disabledClass).attr("tabindex","-1"):slider.vars.animationLoop?slider.directionNav.removeClass(disabledClass).removeAttr("tabindex"):0===slider.animatingTo?slider.directionNav.removeClass(disabledClass).filter("."+namespace+"prev").addClass(disabledClass).attr("tabindex","-1"):slider.animatingTo===slider.last?slider.directionNav.removeClass(disabledClass).filter("."+namespace+"next").addClass(disabledClass).attr("tabindex","-1"):slider.directionNav.removeClass(disabledClass).removeAttr("tabindex")}},pausePlay:{setup:function(){var pausePlayScaffold=(0,_jquery.default)('
    ');slider.controlsContainer?(slider.controlsContainer.append(pausePlayScaffold),slider.pausePlay=(0,_jquery.default)("."+namespace+"pauseplay a",slider.controlsContainer)):(slider.append(pausePlayScaffold),slider.pausePlay=(0,_jquery.default)("."+namespace+"pauseplay a",slider)),methods.pausePlay.update(slider.vars.slideshow?namespace+"pause":namespace+"play"),slider.pausePlay.bind(eventType,(function(event){event.preventDefault(),""!==watchedEvent&&watchedEvent!==event.type||((0,_jquery.default)(this).hasClass(namespace+"pause")?(slider.manualPause=!0,slider.manualPlay=!1,slider.pause()):(slider.manualPause=!1,slider.manualPlay=!0,slider.play())),""===watchedEvent&&(watchedEvent=event.type),methods.setToClearWatchedEvent()}))},update:function(state){"play"===state?slider.pausePlay.removeClass(namespace+"pause").addClass(namespace+"play").html(slider.vars.playText):slider.pausePlay.removeClass(namespace+"play").addClass(namespace+"pause").html(slider.vars.pauseText)}},touch:function(){var startX,startY,offset,cwidth,dx,startT,onTouchStart,onTouchMove,onTouchEnd,scrolling=!1,localX=0,localY=0,accDx=0;if(msGesture){function onMSPointerDown(e){e.stopPropagation(),slider.animating?e.preventDefault():(slider.pause(),el._gesture.addPointer(e.pointerId),accDx=0,cwidth=vertical?slider.h:slider.w,startT=Number(new Date),offset=carousel&&reverse&&slider.animatingTo===slider.last?0:carousel&&reverse?slider.limit-(slider.itemW+slider.vars.itemMargin)*slider.move*slider.animatingTo:carousel&&slider.currentSlide===slider.last?slider.limit:carousel?(slider.itemW+slider.vars.itemMargin)*slider.move*slider.currentSlide:reverse?(slider.last-slider.currentSlide+slider.cloneOffset)*cwidth:(slider.currentSlide+slider.cloneOffset)*cwidth)}function onMSGestureChange(e){e.stopPropagation();var slider=e.target._slider;if(slider){var transX=-e.translationX,transY=-e.translationY;accDx+=vertical?transY:transX,dx=(slider.vars.rtl?-1:1)*accDx,scrolling=vertical?Math.abs(accDx)500)&&(e.preventDefault(),!fade&&slider.transitions&&(slider.vars.animationLoop||(dx=accDx/(0===slider.currentSlide&&accDx<0||slider.currentSlide===slider.last&&accDx>0?Math.abs(accDx)/cwidth+2:1)),slider.setProps(offset+dx,"setTouch"))):setImmediate((function(){el._gesture.stop()}))}}function onMSGestureEnd(e){e.stopPropagation();var slider=e.target._slider;if(slider){if(slider.animatingTo===slider.currentSlide&&!scrolling&&null!==dx){var updateDx=reverse?-dx:dx,target=updateDx>0?slider.getTarget("next"):slider.getTarget("prev");slider.canAdvance(target)&&(Number(new Date)-startT<550&&Math.abs(updateDx)>50||Math.abs(updateDx)>cwidth/2)?slider.flexAnimate(target,slider.vars.pauseOnAction):fade||slider.flexAnimate(slider.currentSlide,slider.vars.pauseOnAction,!0)}startX=null,startY=null,dx=null,offset=null,accDx=0}}el.style.msTouchAction="none",el._gesture=new MSGesture,el._gesture.target=el,el.addEventListener("MSPointerDown",onMSPointerDown,!1),el._slider=slider,el.addEventListener("MSGestureChange",onMSGestureChange,!1),el.addEventListener("MSGestureEnd",onMSGestureEnd,!1)}else onTouchStart=function(e){slider.animating?e.preventDefault():(window.navigator.msPointerEnabled||1===e.touches.length)&&(slider.pause(),cwidth=vertical?slider.h:slider.w,startT=Number(new Date),localX=e.touches[0].pageX,localY=e.touches[0].pageY,offset=carousel&&reverse&&slider.animatingTo===slider.last?0:carousel&&reverse?slider.limit-(slider.itemW+slider.vars.itemMargin)*slider.move*slider.animatingTo:carousel&&slider.currentSlide===slider.last?slider.limit:carousel?(slider.itemW+slider.vars.itemMargin)*slider.move*slider.currentSlide:reverse?(slider.last-slider.currentSlide+slider.cloneOffset)*cwidth:(slider.currentSlide+slider.cloneOffset)*cwidth,startX=vertical?localY:localX,startY=vertical?localX:localY,el.addEventListener("touchmove",onTouchMove,!1),el.addEventListener("touchend",onTouchEnd,!1))},onTouchMove=function(e){localX=e.touches[0].pageX,localY=e.touches[0].pageY,dx=vertical?startX-localY:(slider.vars.rtl?-1:1)*(startX-localX);(!(scrolling=vertical?Math.abs(dx)500)&&(e.preventDefault(),!fade&&slider.transitions&&(slider.vars.animationLoop||(dx/=0===slider.currentSlide&&dx<0||slider.currentSlide===slider.last&&dx>0?Math.abs(dx)/cwidth+2:1),slider.setProps(offset+dx,"setTouch")))},onTouchEnd=function(e){if(el.removeEventListener("touchmove",onTouchMove,!1),slider.animatingTo===slider.currentSlide&&!scrolling&&null!==dx){var updateDx=reverse?-dx:dx,target=updateDx>0?slider.getTarget("next"):slider.getTarget("prev");slider.canAdvance(target)&&(Number(new Date)-startT<550&&Math.abs(updateDx)>50||Math.abs(updateDx)>cwidth/2)?slider.flexAnimate(target,slider.vars.pauseOnAction):fade||slider.flexAnimate(slider.currentSlide,slider.vars.pauseOnAction,!0)}el.removeEventListener("touchend",onTouchEnd,!1),startX=null,startY=null,dx=null,offset=null},el.addEventListener("touchstart",onTouchStart,!1)},resize:function(){!slider.animating&&slider.is(":visible")&&(carousel||slider.doMath(),fade?methods.smoothHeight():carousel?(slider.slides.width(slider.computedW),slider.update(slider.pagingCount),slider.setProps()):vertical?(slider.viewport.height(slider.h),slider.setProps(slider.h,"setTotal")):(slider.vars.smoothHeight&&methods.smoothHeight(),slider.newSlides.width(slider.computedW),slider.setProps(slider.computedW,"setTotal")))},smoothHeight:function(dur){if(!vertical||fade){var $obj=fade?slider:slider.viewport;dur?$obj.animate({height:slider.slides.eq(slider.animatingTo).innerHeight()},dur):$obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight())}},sync:function(action){var $obj=(0,_jquery.default)(slider.vars.sync).data("flexslider"),target=slider.animatingTo;switch(action){case"animate":$obj.flexAnimate(target,slider.vars.pauseOnAction,!1,!0);break;case"play":$obj.playing||$obj.asNav||$obj.play();break;case"pause":$obj.pause()}},uniqueID:function($clone){return $clone.filter("[id]").add($clone.find("[id]")).each((function(){var $this=(0,_jquery.default)(this);$this.attr("id",$this.attr("id")+"_clone")})),$clone},pauseInvisible:{visProp:null,init:function(){var visProp=methods.pauseInvisible.getHiddenProp();if(visProp){var evtname=visProp.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(evtname,(function(){methods.pauseInvisible.isHidden()?slider.startTimeout?clearTimeout(slider.startTimeout):slider.pause():slider.started?slider.play():slider.vars.initDelay>0?setTimeout(slider.play,slider.vars.initDelay):slider.play()}))}},isHidden:function(){var prop=methods.pauseInvisible.getHiddenProp();return!!prop&&document[prop]},getHiddenProp:function(){var prefixes=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var i=0;islider.currentSlide?"next":"prev"),asNav&&1===slider.pagingCount&&(slider.direction=slider.currentItemslider.limit&&1!==slider.visible?slider.limit:calcNext):slideString=0===slider.currentSlide&&target===slider.count-1&&slider.vars.animationLoop&&"next"!==slider.direction?reverse?(slider.count+slider.cloneOffset)*dimension:0:slider.currentSlide===slider.last&&0===target&&slider.vars.animationLoop&&"prev"!==slider.direction?reverse?0:(slider.count+1)*dimension:reverse?(slider.count-1-target+slider.cloneOffset)*dimension:(target+slider.cloneOffset)*dimension,slider.setProps(slideString,"",slider.vars.animationSpeed),slider.transitions?(slider.vars.animationLoop&&slider.atEnd||(slider.animating=!1,slider.currentSlide=slider.animatingTo),slider.container.unbind("webkitTransitionEnd transitionend"),slider.container.bind("webkitTransitionEnd transitionend",(function(){clearTimeout(slider.ensureAnimationEnd),slider.wrapup(dimension)})),clearTimeout(slider.ensureAnimationEnd),slider.ensureAnimationEnd=setTimeout((function(){slider.wrapup(dimension)}),slider.vars.animationSpeed+100)):slider.container.animate(slider.args,slider.vars.animationSpeed,slider.vars.easing,(function(){slider.wrapup(dimension)}))}slider.vars.smoothHeight&&methods.smoothHeight(slider.vars.animationSpeed)}},slider.wrapup=function(dimension){fade||carousel||(0===slider.currentSlide&&slider.animatingTo===slider.last&&slider.vars.animationLoop?slider.setProps(dimension,"jumpEnd"):slider.currentSlide===slider.last&&0===slider.animatingTo&&slider.vars.animationLoop&&slider.setProps(dimension,"jumpStart")),slider.animating=!1,slider.currentSlide=slider.animatingTo,slider.vars.after(slider)},slider.animateSlides=function(){!slider.animating&&focused&&slider.flexAnimate(slider.getTarget("next"))},slider.pause=function(){clearInterval(slider.animatedSlides),slider.animatedSlides=null,slider.playing=!1,slider.vars.pausePlay&&methods.pausePlay.update("play"),slider.syncExists&&methods.sync("pause")},slider.play=function(){slider.playing&&clearInterval(slider.animatedSlides),slider.animatedSlides=slider.animatedSlides||setInterval(slider.animateSlides,slider.vars.slideshowSpeed),slider.started=slider.playing=!0,slider.vars.pausePlay&&methods.pausePlay.update("pause"),slider.syncExists&&methods.sync("play")},slider.stop=function(){slider.pause(),slider.stopped=!0},slider.canAdvance=function(target,fromNav){var last=asNav?slider.pagingCount-1:slider.last;return!!fromNav||(!(!asNav||slider.currentItem!==slider.count-1||0!==target||"prev"!==slider.direction)||(!asNav||0!==slider.currentItem||target!==slider.pagingCount-1||"next"===slider.direction)&&(!(target===slider.currentSlide&&!asNav)&&(!!slider.vars.animationLoop||(!slider.atEnd||0!==slider.currentSlide||target!==last||"next"===slider.direction)&&(!slider.atEnd||slider.currentSlide!==last||0!==target||"next"!==slider.direction))))},slider.getTarget=function(dir){return slider.direction=dir,"next"===dir?slider.currentSlide===slider.last?0:slider.currentSlide+1:0===slider.currentSlide?slider.last:slider.currentSlide-1},slider.setProps=function(pos,special,dur){var posCheck,target=(posCheck=pos||(slider.itemW+slider.vars.itemMargin)*slider.move*slider.animatingTo,function(){if(carousel)return"setTouch"===special?pos:reverse&&slider.animatingTo===slider.last?0:reverse?slider.limit-(slider.itemW+slider.vars.itemMargin)*slider.move*slider.animatingTo:slider.animatingTo===slider.last?slider.limit:posCheck;switch(special){case"setTotal":return reverse?(slider.count-1-slider.currentSlide+slider.cloneOffset)*pos:(slider.currentSlide+slider.cloneOffset)*pos;case"setTouch":default:return pos;case"jumpEnd":return reverse?pos:slider.count*pos;case"jumpStart":return reverse?slider.count*pos:pos}}()*(slider.vars.rtl?1:-1)+"px");slider.transitions&&(target=slider.isFirefox?vertical?"translate3d(0,"+target+",0)":"translate3d("+parseInt(target)+"px,0,0)":vertical?"translate3d(0,"+target+",0)":"translate3d("+(slider.vars.rtl?-1:1)*parseInt(target)+"px,0,0)",dur=void 0!==dur?dur/1e3+"s":"0s",slider.container.css("-"+slider.pfx+"-transition-duration",dur),slider.container.css("transition-duration",dur)),slider.args[slider.prop]=target,(slider.transitions||void 0===dur)&&slider.container.css(slider.args),slider.container.css("transform",target)},slider.setup=function(type){var sliderOffset,arr;fade?(slider.vars.rtl?slider.slides.css({width:"100%",float:"right",marginLeft:"-100%",position:"relative"}):slider.slides.css({width:"100%",float:"left",marginRight:"-100%",position:"relative"}),"init"===type&&(touch?slider.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+slider.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(slider.currentSlide).css({opacity:1,zIndex:2}):0==slider.vars.fadeFirstSlide?slider.slides.css({opacity:0,display:"block",zIndex:1}).eq(slider.currentSlide).css({zIndex:2}).css({opacity:1}):slider.slides.css({opacity:0,display:"block",zIndex:1}).eq(slider.currentSlide).css({zIndex:2}).animate({opacity:1},slider.vars.animationSpeed,slider.vars.easing)),slider.vars.smoothHeight&&methods.smoothHeight()):("init"===type&&(slider.viewport=(0,_jquery.default)('
    ').css({overflow:"hidden",position:"relative"}).appendTo(slider).append(slider.container),slider.cloneCount=0,slider.cloneOffset=0,reverse&&(arr=_jquery.default.makeArray(slider.slides).reverse(),slider.slides=(0,_jquery.default)(arr),slider.container.empty().append(slider.slides))),slider.vars.animationLoop&&!carousel&&(slider.cloneCount=2,slider.cloneOffset=1,"init"!==type&&slider.container.find(".clone").remove(),slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(methods.uniqueID(slider.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),slider.newSlides=(0,_jquery.default)(slider.vars.selector,slider),sliderOffset=reverse?slider.count-1-slider.currentSlide+slider.cloneOffset:slider.currentSlide+slider.cloneOffset,vertical&&!carousel?(slider.container.height(200*(slider.count+slider.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout((function(){slider.newSlides.css({display:"block"}),slider.doMath(),slider.viewport.height(slider.h),slider.setProps(sliderOffset*slider.h,"init")}),"init"===type?100:0)):(slider.container.width(200*(slider.count+slider.cloneCount)+"%"),slider.setProps(sliderOffset*slider.computedW,"init"),setTimeout((function(){slider.doMath(),slider.vars.rtl&&slider.isFirefox?slider.newSlides.css({width:slider.computedW,marginRight:slider.computedM,float:"right",display:"block"}):slider.newSlides.css({width:slider.computedW,marginRight:slider.computedM,float:"left",display:"block"}),slider.vars.smoothHeight&&methods.smoothHeight()}),"init"===type?100:0)));carousel||slider.slides.removeClass(namespace+"active-slide").eq(slider.currentSlide).addClass(namespace+"active-slide"),slider.vars.init(slider)},slider.doMath=function(){var slide=slider.slides.first(),slideMargin=slider.vars.itemMargin,minItems=slider.vars.minItems,maxItems=slider.vars.maxItems;slider.w=void 0===slider.viewport?slider.width():slider.viewport.width(),slider.isFirefox&&(slider.w=slider.width()),slider.h=slide.height(),slider.boxPadding=slide.outerWidth()-slide.width(),carousel?(slider.itemT=slider.vars.itemWidth+slideMargin,slider.itemM=slideMargin,slider.minW=minItems?minItems*slider.itemT:slider.w,slider.maxW=maxItems?maxItems*slider.itemT-slideMargin:slider.w,slider.itemW=slider.minW>slider.w?(slider.w-slideMargin*(minItems-1))/minItems:slider.maxWslider.w?slider.w:slider.vars.itemWidth,slider.visible=Math.floor(slider.w/slider.itemW),slider.move=slider.vars.move>0&&slider.vars.moveslider.w?slider.itemW*(slider.count-1)+slideMargin*(slider.count-1):(slider.itemW+slideMargin)*slider.count-slider.w-slideMargin):(slider.itemW=slider.w,slider.itemM=slideMargin,slider.pagingCount=slider.count,slider.last=slider.count-1),slider.computedW=slider.itemW-slider.boxPadding,slider.computedM=slider.itemM},slider.update=function(pos,action){slider.doMath(),carousel||(posslider.controlNav.length?methods.controlNav.update("add"):("remove"===action&&!carousel||slider.pagingCountslider.last&&(slider.currentSlide-=1,slider.animatingTo-=1),methods.controlNav.update("remove",slider.last))),slider.vars.directionNav&&methods.directionNav.update()},slider.addSlide=function(obj,pos){var $obj=(0,_jquery.default)(obj);slider.count+=1,slider.last=slider.count-1,vertical&&reverse?void 0!==pos?slider.slides.eq(slider.count-pos).after($obj):slider.container.prepend($obj):void 0!==pos?slider.slides.eq(pos).before($obj):slider.container.append($obj),slider.update(pos,"add"),slider.slides=(0,_jquery.default)(slider.vars.selector+":not(.clone)",slider),slider.setup(),slider.vars.added(slider)},slider.removeSlide=function(obj){var pos=isNaN(obj)?slider.slides.index((0,_jquery.default)(obj)):obj;slider.count-=1,slider.last=slider.count-1,isNaN(obj)?(0,_jquery.default)(obj,slider.slides).remove():vertical&&reverse?slider.slides.eq(slider.last).remove():slider.slides.eq(obj).remove(),slider.doMath(),slider.update(pos,"remove"),slider.slides=(0,_jquery.default)(slider.vars.selector+":not(.clone)",slider),slider.setup(),slider.vars.removed(slider)},methods.init()},(0,_jquery.default)(window).blur((function(e){focused=!1})).focus((function(e){focused=!0})),_jquery.default.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,isFirefox:!1,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){},rtl:!1},_jquery.default.fn.flexslider=function(options){if(void 0===options&&(options={}),"object"==typeof options)return this.each((function(){var $this=(0,_jquery.default)(this),selector=options.selector?options.selector:".slides > li",$slides=$this.find(selector);1===$slides.length&&!1===options.allowOneSlide||0===$slides.length?($slides.fadeIn(400),options.start&&options.start($this)):void 0===$this.data("flexslider")&&new _jquery.default.flexslider(this,options)}));var $slider=(0,_jquery.default)(this).data("flexslider");switch(options){case"play":$slider.play();break;case"pause":$slider.pause();break;case"stop":$slider.stop();break;case"next":$slider.flexAnimate($slider.getTarget("next"),!0);break;case"prev":case"previous":$slider.flexAnimate($slider.getTarget("prev"),!0);break;default:"number"==typeof options&&$slider.flexAnimate(options,!0)}}}})); + +//# sourceMappingURL=flexslider.min.js.map \ No newline at end of file diff --git a/amd/build/flexslider.min.js.map b/amd/build/flexslider.min.js.map new file mode 100644 index 0000000..0fd9cc9 --- /dev/null +++ b/amd/build/flexslider.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flexslider.min.js","sources":["../src/flexslider.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// ES6 wrapper for FlexSlider.\n//\n// @module theme_adaptable/flexslider\n// @copyright 2024 G J Barnard.\n// @author G J Barnard -\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport $ from 'jquery';\n\n/**\n * Initialise FlexSlider.\n */\nexport const flexslider = () => {\n /*\n * jQuery FlexSlider v2.7.2\n * Copyright 2012 WooThemes\n * Contributing Author: Tyler Smith\n * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later.\n */\n\n var focused = true;\n\n //FlexSlider: Object Instance\n $.flexslider = function (el, options) {\n var slider = $(el);\n\n // making variables public\n\n //if rtl value was not passed and html is in rtl..enable it by default.\n if (typeof options.rtl == 'undefined' && $('html').attr('dir') == 'rtl') {\n options.rtl = true;\n }\n slider.vars = $.extend({}, $.flexslider.defaults, options);\n\n var namespace = slider.vars.namespace,\n msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,\n touch = ((\"ontouchstart\" in window) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,\n // deprecating this idea, as devices are being released with both of these events\n eventType = \"click touchend MSPointerUp keyup\",\n watchedEvent = \"\",\n watchedEventClearTimer,\n vertical = slider.vars.direction === \"vertical\",\n reverse = slider.vars.reverse,\n carousel = (slider.vars.itemWidth > 0),\n fade = slider.vars.animation === \"fade\",\n asNav = slider.vars.asNavFor !== \"\",\n methods = {};\n\n // Store a reference to the slider object\n $.data(el, \"flexslider\", slider);\n\n // Private slider methods\n methods = {\n init: function () {\n slider.animating = false;\n // Get current slide and make sure it is a number\n slider.currentSlide = parseInt((slider.vars.startAt ? slider.vars.startAt : 0), 10);\n if (isNaN(slider.currentSlide)) { slider.currentSlide = 0; }\n slider.animatingTo = slider.currentSlide;\n slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);\n slider.containerSelector = slider.vars.selector.substr(0, slider.vars.selector.search(' '));\n slider.slides = $(slider.vars.selector, slider);\n slider.container = $(slider.containerSelector, slider);\n slider.count = slider.slides.length;\n // SYNC:\n slider.syncExists = $(slider.vars.sync).length > 0;\n // SLIDE:\n if (slider.vars.animation === \"slide\") { slider.vars.animation = \"swing\"; }\n slider.prop = (vertical) ? \"top\" : (slider.vars.rtl ? \"marginRight\" : \"marginLeft\");\n slider.args = {};\n // SLIDESHOW:\n slider.manualPause = false;\n slider.stopped = false;\n //PAUSE WHEN INVISIBLE\n slider.started = false;\n slider.startTimeout = null;\n // TOUCH/USECSS:\n slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function () {\n var obj = document.createElement('div'),\n props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];\n for (var i in props) {\n if (obj.style[props[i]] !== undefined) {\n slider.pfx = props[i].replace('Perspective', '').toLowerCase();\n slider.prop = \"-\" + slider.pfx + \"-transform\";\n return true;\n }\n }\n return false;\n }());\n slider.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n slider.ensureAnimationEnd = '';\n // CONTROLSCONTAINER:\n if (slider.vars.controlsContainer !== \"\") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);\n // MANUAL:\n if (slider.vars.manualControls !== \"\") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);\n\n // CUSTOM DIRECTION NAV:\n if (slider.vars.customDirectionNav !== \"\") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav);\n\n // RANDOMIZE:\n if (slider.vars.randomize) {\n slider.slides.sort(function () { return (Math.round(Math.random()) - 0.5); });\n slider.container.empty().append(slider.slides);\n }\n\n slider.doMath();\n\n // INIT\n slider.setup(\"init\");\n\n // CONTROLNAV:\n if (slider.vars.controlNav) { methods.controlNav.setup(); }\n\n // DIRECTIONNAV:\n if (slider.vars.directionNav) { methods.directionNav.setup(); }\n\n // KEYBOARD:\n if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {\n $(document).bind('keyup', function (event) {\n var keycode = event.keyCode;\n if (!slider.animating && (keycode === 39 || keycode === 37)) {\n var target = (slider.vars.rtl ?\n ((keycode === 37) ? slider.getTarget('next') :\n (keycode === 39) ? slider.getTarget('prev') : false)\n :\n ((keycode === 39) ? slider.getTarget('next') :\n (keycode === 37) ? slider.getTarget('prev') : false)\n )\n ;\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n }\n });\n }\n // MOUSEWHEEL:\n if (slider.vars.mousewheel) {\n slider.bind('mousewheel', function (event, delta, deltaX, deltaY) {\n event.preventDefault();\n var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n });\n }\n\n // PAUSEPLAY\n if (slider.vars.pausePlay) { methods.pausePlay.setup(); }\n\n //PAUSE WHEN INVISIBLE\n if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); }\n\n // SLIDSESHOW\n if (slider.vars.slideshow) {\n if (slider.vars.pauseOnHover) {\n slider.hover(function () {\n if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }\n }, function () {\n if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }\n });\n }\n // initialize animation\n //If we're visible, or we don't use PageVisibility API\n if (!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {\n (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();\n }\n }\n\n // ASNAV:\n if (asNav) { methods.asNav.setup(); }\n\n // TOUCH\n if (touch && slider.vars.touch) { methods.touch(); }\n\n // FADE&&SMOOTHHEIGHT || SLIDE:\n if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind(\"resize orientationchange focus\", methods.resize); }\n\n slider.find(\"img\").attr(\"draggable\", \"false\");\n\n // API: start() Callback\n setTimeout(function () {\n slider.vars.start(slider);\n }, 200);\n },\n asNav: {\n setup: function () {\n slider.asNav = true;\n slider.animatingTo = Math.floor(slider.currentSlide / slider.move);\n slider.currentItem = slider.currentSlide;\n slider.slides.removeClass(namespace + \"active-slide\").eq(slider.currentItem).addClass(namespace + \"active-slide\");\n if (!msGesture) {\n slider.slides.on(eventType, function (e) {\n e.preventDefault();\n var $slide = $(this),\n target = $slide.index();\n var posFromX;\n if (slider.vars.rtl) {\n posFromX = -1 * ($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container\n }\n else {\n posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container\n }\n if (posFromX <= 0 && $slide.hasClass(namespace + 'active-slide')) {\n slider.flexAnimate(slider.getTarget(\"prev\"), true);\n } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + \"active-slide\")) {\n slider.direction = (slider.currentItem < target) ? \"next\" : \"prev\";\n slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);\n }\n });\n } else {\n el._slider = slider;\n slider.slides.each(function () {\n var that = this;\n that._gesture = new MSGesture();\n that._gesture.target = that;\n that.addEventListener(\"MSPointerDown\", function (e) {\n e.preventDefault();\n if (e.currentTarget._gesture) {\n e.currentTarget._gesture.addPointer(e.pointerId);\n }\n }, false);\n that.addEventListener(\"MSGestureTap\", function (e) {\n e.preventDefault();\n var $slide = $(this),\n target = $slide.index();\n if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {\n slider.direction = (slider.currentItem < target) ? \"next\" : \"prev\";\n slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);\n }\n });\n });\n }\n }\n },\n controlNav: {\n setup: function () {\n if (!slider.manualControls) {\n methods.controlNav.setupPaging();\n } else { // MANUALCONTROLS:\n methods.controlNav.setupManual();\n }\n },\n setupPaging: function () {\n var type = (slider.vars.controlNav === \"thumbnails\") ? 'control-thumbs' : 'control-paging',\n j = 1,\n item,\n slide;\n\n slider.controlNavScaffold = $('
      ');\n\n if (slider.pagingCount > 1) {\n for (var i = 0; i < slider.pagingCount; i++) {\n slide = slider.slides.eq(i);\n\n if (undefined === slide.attr('data-thumb-alt')) {\n slide.attr('data-thumb-alt', '');\n }\n\n item = $('').attr('href', '#').text(j);\n if (slider.vars.controlNav === \"thumbnails\") {\n item = $('').attr('src', slide.attr('data-thumb'));\n }\n\n if ('' !== slide.attr('data-thumb-alt')) {\n item.attr('alt', slide.attr('data-thumb-alt'));\n }\n\n if ('thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions) {\n var captn = slide.attr('data-thumbcaption');\n if ('' !== captn && undefined !== captn) {\n var caption = $('').addClass(namespace + 'caption').text(captn);\n item.append(caption);\n }\n }\n\n var liElement = $('
    1. ');\n item.appendTo(liElement);\n liElement.append('
    2. ');\n\n slider.controlNavScaffold.append(liElement);\n j++;\n\n }\n }\n\n // CONTROLSCONTAINER:\n (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);\n methods.controlNav.set();\n\n methods.controlNav.active();\n\n slider.controlNavScaffold.delegate('a, img', eventType, function (event) {\n event.preventDefault();\n\n if (watchedEvent === \"\" || watchedEvent === event.type) {\n var $this = $(this),\n target = slider.controlNav.index($this);\n\n if (!$this.hasClass(namespace + 'active')) {\n slider.direction = (target > slider.currentSlide) ? \"next\" : \"prev\";\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n }\n }\n\n // setup flags to prevent event duplication\n if (watchedEvent === \"\") {\n watchedEvent = event.type;\n }\n methods.setToClearWatchedEvent();\n\n });\n },\n setupManual: function () {\n slider.controlNav = slider.manualControls;\n methods.controlNav.active();\n\n slider.controlNav.bind(eventType, function (event) {\n event.preventDefault();\n\n if (watchedEvent === \"\" || watchedEvent === event.type) {\n var $this = $(this),\n target = slider.controlNav.index($this);\n\n if (!$this.hasClass(namespace + 'active')) {\n (target > slider.currentSlide) ? slider.direction = \"next\" : slider.direction = \"prev\";\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n }\n }\n\n // setup flags to prevent event duplication\n if (watchedEvent === \"\") {\n watchedEvent = event.type;\n }\n methods.setToClearWatchedEvent();\n });\n },\n set: function () {\n var selector = (slider.vars.controlNav === \"thumbnails\") ? 'img' : 'a';\n slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);\n },\n active: function () {\n slider.controlNav.removeClass(namespace + \"active\").eq(slider.animatingTo).addClass(namespace + \"active\");\n },\n update: function (action, pos) {\n if (slider.pagingCount > 1 && action === \"add\") {\n slider.controlNavScaffold.append($('
    3. ' + slider.count + '
    4. '));\n } else if (slider.pagingCount === 1) {\n slider.controlNavScaffold.find('li').remove();\n } else {\n slider.controlNav.eq(pos).closest('li').remove();\n }\n methods.controlNav.set();\n (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();\n }\n },\n directionNav: {\n setup: function () {\n var directionNavScaffold = $('');\n\n // CUSTOM DIRECTION NAV:\n if (slider.customDirectionNav) {\n slider.directionNav = slider.customDirectionNav;\n // CONTROLSCONTAINER:\n } else if (slider.controlsContainer) {\n $(slider.controlsContainer).append(directionNavScaffold);\n slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);\n } else {\n slider.append(directionNavScaffold);\n slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);\n }\n\n methods.directionNav.update();\n\n slider.directionNav.bind(eventType, function (event) {\n event.preventDefault();\n var target;\n\n if (watchedEvent === \"\" || watchedEvent === event.type) {\n target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n }\n\n // setup flags to prevent event duplication\n if (watchedEvent === \"\") {\n watchedEvent = event.type;\n }\n methods.setToClearWatchedEvent();\n });\n },\n update: function () {\n var disabledClass = namespace + 'disabled';\n if (slider.pagingCount === 1) {\n slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');\n } else if (!slider.vars.animationLoop) {\n if (slider.animatingTo === 0) {\n slider.directionNav.removeClass(disabledClass).filter('.' + namespace + \"prev\").addClass(disabledClass).attr('tabindex', '-1');\n } else if (slider.animatingTo === slider.last) {\n slider.directionNav.removeClass(disabledClass).filter('.' + namespace + \"next\").addClass(disabledClass).attr('tabindex', '-1');\n } else {\n slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');\n }\n } else {\n slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');\n }\n }\n },\n pausePlay: {\n setup: function () {\n var pausePlayScaffold = $('
      ');\n\n // CONTROLSCONTAINER:\n if (slider.controlsContainer) {\n slider.controlsContainer.append(pausePlayScaffold);\n slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);\n } else {\n slider.append(pausePlayScaffold);\n slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);\n }\n\n methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');\n\n slider.pausePlay.bind(eventType, function (event) {\n event.preventDefault();\n\n if (watchedEvent === \"\" || watchedEvent === event.type) {\n if ($(this).hasClass(namespace + 'pause')) {\n slider.manualPause = true;\n slider.manualPlay = false;\n slider.pause();\n } else {\n slider.manualPause = false;\n slider.manualPlay = true;\n slider.play();\n }\n }\n\n // setup flags to prevent event duplication\n if (watchedEvent === \"\") {\n watchedEvent = event.type;\n }\n methods.setToClearWatchedEvent();\n });\n },\n update: function (state) {\n (state === \"play\") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);\n }\n },\n touch: function () {\n var startX,\n startY,\n offset,\n cwidth,\n dx,\n startT,\n onTouchStart,\n onTouchMove,\n onTouchEnd,\n scrolling = false,\n localX = 0,\n localY = 0,\n accDx = 0;\n\n if (!msGesture) {\n onTouchStart = function (e) {\n if (slider.animating) {\n e.preventDefault();\n } else if ((window.navigator.msPointerEnabled) || e.touches.length === 1) {\n slider.pause();\n // CAROUSEL:\n cwidth = (vertical) ? slider.h : slider.w;\n startT = Number(new Date());\n // CAROUSEL:\n\n // Local vars for X and Y points.\n localX = e.touches[0].pageX;\n localY = e.touches[0].pageY;\n\n offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :\n (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :\n (carousel && slider.currentSlide === slider.last) ? slider.limit :\n (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :\n (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;\n startX = (vertical) ? localY : localX;\n startY = (vertical) ? localX : localY;\n el.addEventListener('touchmove', onTouchMove, false);\n el.addEventListener('touchend', onTouchEnd, false);\n }\n };\n\n onTouchMove = function (e) {\n // Local vars for X and Y points.\n\n localX = e.touches[0].pageX;\n localY = e.touches[0].pageY;\n\n dx = (vertical) ? startX - localY : (slider.vars.rtl ? -1 : 1) * (startX - localX);\n scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));\n var fxms = 500;\n\n if (!scrolling || Number(new Date()) - startT > fxms) {\n e.preventDefault();\n if (!fade && slider.transitions) {\n if (!slider.vars.animationLoop) {\n dx = dx / ((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx) / cwidth + 2) : 1);\n }\n slider.setProps(offset + dx, \"setTouch\");\n }\n }\n };\n\n onTouchEnd = function (e) {\n // finish the touch by undoing the touch session\n el.removeEventListener('touchmove', onTouchMove, false);\n\n if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {\n var updateDx = (reverse) ? -dx : dx,\n target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');\n\n if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) {\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n } else {\n if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }\n }\n }\n el.removeEventListener('touchend', onTouchEnd, false);\n\n startX = null;\n startY = null;\n dx = null;\n offset = null;\n };\n\n el.addEventListener('touchstart', onTouchStart, false);\n } else {\n el.style.msTouchAction = \"none\";\n el._gesture = new MSGesture();\n el._gesture.target = el;\n el.addEventListener(\"MSPointerDown\", onMSPointerDown, false);\n el._slider = slider;\n el.addEventListener(\"MSGestureChange\", onMSGestureChange, false);\n el.addEventListener(\"MSGestureEnd\", onMSGestureEnd, false);\n\n function onMSPointerDown(e) {\n e.stopPropagation();\n if (slider.animating) {\n e.preventDefault();\n } else {\n slider.pause();\n el._gesture.addPointer(e.pointerId);\n accDx = 0;\n cwidth = (vertical) ? slider.h : slider.w;\n startT = Number(new Date());\n // CAROUSEL:\n\n offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :\n (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :\n (carousel && slider.currentSlide === slider.last) ? slider.limit :\n (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :\n (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;\n }\n }\n\n function onMSGestureChange(e) {\n e.stopPropagation();\n var slider = e.target._slider;\n if (!slider) {\n return;\n }\n var transX = -e.translationX,\n transY = -e.translationY;\n\n //Accumulate translations.\n accDx = accDx + ((vertical) ? transY : transX);\n dx = (slider.vars.rtl ? -1 : 1) * accDx;\n scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));\n\n if (e.detail === e.MSGESTURE_FLAG_INERTIA) {\n setImmediate(function () {\n el._gesture.stop();\n });\n\n return;\n }\n\n if (!scrolling || Number(new Date()) - startT > 500) {\n e.preventDefault();\n if (!fade && slider.transitions) {\n if (!slider.vars.animationLoop) {\n dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);\n }\n slider.setProps(offset + dx, \"setTouch\");\n }\n }\n }\n\n function onMSGestureEnd(e) {\n e.stopPropagation();\n var slider = e.target._slider;\n if (!slider) {\n return;\n }\n if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {\n var updateDx = (reverse) ? -dx : dx,\n target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');\n\n if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) {\n slider.flexAnimate(target, slider.vars.pauseOnAction);\n } else {\n if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }\n }\n }\n\n startX = null;\n startY = null;\n dx = null;\n offset = null;\n accDx = 0;\n }\n }\n },\n resize: function () {\n if (!slider.animating && slider.is(':visible')) {\n if (!carousel) { slider.doMath(); }\n\n if (fade) {\n // SMOOTH HEIGHT:\n methods.smoothHeight();\n } else if (carousel) { //CAROUSEL:\n slider.slides.width(slider.computedW);\n slider.update(slider.pagingCount);\n slider.setProps();\n }\n else if (vertical) { //VERTICAL:\n slider.viewport.height(slider.h);\n slider.setProps(slider.h, \"setTotal\");\n } else {\n // SMOOTH HEIGHT:\n if (slider.vars.smoothHeight) { methods.smoothHeight(); }\n slider.newSlides.width(slider.computedW);\n slider.setProps(slider.computedW, \"setTotal\");\n }\n }\n },\n smoothHeight: function (dur) {\n if (!vertical || fade) {\n var $obj = (fade) ? slider : slider.viewport;\n (dur) ? $obj.animate({ \"height\": slider.slides.eq(slider.animatingTo).innerHeight() }, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight());\n }\n },\n sync: function (action) {\n var $obj = $(slider.vars.sync).data(\"flexslider\"),\n target = slider.animatingTo;\n\n switch (action) {\n case \"animate\": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;\n case \"play\": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;\n case \"pause\": $obj.pause(); break;\n }\n },\n uniqueID: function ($clone) {\n // Append _clone to current level and children elements with id attributes\n $clone.filter('[id]').add($clone.find('[id]')).each(function () {\n var $this = $(this);\n $this.attr('id', $this.attr('id') + '_clone');\n });\n return $clone;\n },\n pauseInvisible: {\n visProp: null,\n init: function () {\n var visProp = methods.pauseInvisible.getHiddenProp();\n if (visProp) {\n var evtname = visProp.replace(/[H|h]idden/, '') + 'visibilitychange';\n document.addEventListener(evtname, function () {\n if (methods.pauseInvisible.isHidden()) {\n if (slider.startTimeout) {\n clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible\n } else {\n slider.pause(); //Or just pause\n }\n }\n else {\n if (slider.started) {\n slider.play(); //Initiated before, just play\n } else {\n if (slider.vars.initDelay > 0) {\n setTimeout(slider.play, slider.vars.initDelay);\n } else {\n slider.play(); //Didn't init before: simply init or wait for it\n }\n }\n }\n });\n }\n },\n isHidden: function () {\n var prop = methods.pauseInvisible.getHiddenProp();\n if (!prop) {\n return false;\n }\n return document[prop];\n },\n getHiddenProp: function () {\n var prefixes = ['webkit', 'moz', 'ms', 'o'];\n // if 'hidden' is natively supported just return it\n if ('hidden' in document) {\n return 'hidden';\n }\n // otherwise loop over all the known prefixes until we find one\n for (var i = 0; i < prefixes.length; i++) {\n if ((prefixes[i] + 'Hidden') in document) {\n return prefixes[i] + 'Hidden';\n }\n }\n // otherwise it's not supported\n return null;\n }\n },\n setToClearWatchedEvent: function () {\n clearTimeout(watchedEventClearTimer);\n watchedEventClearTimer = setTimeout(function () {\n watchedEvent = \"\";\n }, 3000);\n }\n };\n\n // public methods\n slider.flexAnimate = function (target, pause, override, withSync, fromNav) {\n if (!slider.vars.animationLoop && target !== slider.currentSlide) {\n slider.direction = (target > slider.currentSlide) ? \"next\" : \"prev\";\n }\n\n if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? \"next\" : \"prev\";\n\n if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(\":visible\")) {\n if (asNav && withSync) {\n var master = $(slider.vars.asNavFor).data('flexslider');\n slider.atEnd = target === 0 || target === slider.count - 1;\n master.flexAnimate(target, true, false, true, fromNav);\n slider.direction = (slider.currentItem < target) ? \"next\" : \"prev\";\n master.direction = slider.direction;\n\n if (Math.ceil((target + 1) / slider.visible) - 1 !== slider.currentSlide && target !== 0) {\n slider.currentItem = target;\n slider.slides.removeClass(namespace + \"active-slide\").eq(target).addClass(namespace + \"active-slide\");\n target = Math.floor(target / slider.visible);\n } else {\n slider.currentItem = target;\n slider.slides.removeClass(namespace + \"active-slide\").eq(target).addClass(namespace + \"active-slide\");\n return false;\n }\n }\n\n slider.animating = true;\n slider.animatingTo = target;\n\n // SLIDESHOW:\n if (pause) { slider.pause(); }\n\n // API: before() animation Callback\n slider.vars.before(slider);\n\n // SYNC:\n if (slider.syncExists && !fromNav) { methods.sync(\"animate\"); }\n\n // CONTROLNAV\n if (slider.vars.controlNav) { methods.controlNav.active(); }\n\n // !CAROUSEL:\n // CANDIDATE: slide active class (for add/remove slide)\n if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); }\n\n // INFINITE LOOP:\n // CANDIDATE: atEnd\n slider.atEnd = target === 0 || target === slider.last;\n\n // DIRECTIONNAV:\n if (slider.vars.directionNav) { methods.directionNav.update(); }\n\n if (target === slider.last) {\n // API: end() of cycle Callback\n slider.vars.end(slider);\n // SLIDESHOW && !INFINITE LOOP:\n if (!slider.vars.animationLoop) { slider.pause(); }\n }\n\n // SLIDE:\n if (!fade) {\n var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,\n margin, slideString, calcNext;\n\n // INFINITE LOOP / REVERSE:\n if (carousel) {\n margin = slider.vars.itemMargin;\n calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;\n slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;\n } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== \"next\") {\n slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;\n } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== \"prev\") {\n slideString = (reverse) ? 0 : (slider.count + 1) * dimension;\n } else {\n slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;\n }\n slider.setProps(slideString, \"\", slider.vars.animationSpeed);\n if (slider.transitions) {\n if (!slider.vars.animationLoop || !slider.atEnd) {\n slider.animating = false;\n slider.currentSlide = slider.animatingTo;\n }\n\n // Unbind previous transitionEnd events and re-bind new transitionEnd event\n slider.container.unbind(\"webkitTransitionEnd transitionend\");\n slider.container.bind(\"webkitTransitionEnd transitionend\", function () {\n clearTimeout(slider.ensureAnimationEnd);\n slider.wrapup(dimension);\n });\n\n // Insurance for the ever-so-fickle transitionEnd event\n clearTimeout(slider.ensureAnimationEnd);\n slider.ensureAnimationEnd = setTimeout(function () {\n slider.wrapup(dimension);\n }, slider.vars.animationSpeed + 100);\n\n } else {\n slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function () {\n slider.wrapup(dimension);\n });\n }\n } else { // FADE:\n if (!touch) {\n slider.slides.eq(slider.currentSlide).css({ \"zIndex\": 1 }).animate({ \"opacity\": 0 }, slider.vars.animationSpeed, slider.vars.easing);\n slider.slides.eq(target).css({ \"zIndex\": 2 }).animate({ \"opacity\": 1 }, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);\n } else {\n slider.slides.eq(slider.currentSlide).css({ \"opacity\": 0, \"zIndex\": 1 });\n slider.slides.eq(target).css({ \"opacity\": 1, \"zIndex\": 2 });\n slider.wrapup(dimension);\n }\n }\n // SMOOTH HEIGHT:\n if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); }\n }\n };\n slider.wrapup = function (dimension) {\n // SLIDE:\n if (!fade && !carousel) {\n if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {\n slider.setProps(dimension, \"jumpEnd\");\n } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {\n slider.setProps(dimension, \"jumpStart\");\n }\n }\n slider.animating = false;\n slider.currentSlide = slider.animatingTo;\n // API: after() animation Callback\n slider.vars.after(slider);\n };\n\n // SLIDESHOW:\n slider.animateSlides = function () {\n if (!slider.animating && focused) { slider.flexAnimate(slider.getTarget(\"next\")); }\n };\n // SLIDESHOW:\n slider.pause = function () {\n clearInterval(slider.animatedSlides);\n slider.animatedSlides = null;\n slider.playing = false;\n // PAUSEPLAY:\n if (slider.vars.pausePlay) { methods.pausePlay.update(\"play\"); }\n // SYNC:\n if (slider.syncExists) { methods.sync(\"pause\"); }\n };\n // SLIDESHOW:\n slider.play = function () {\n if (slider.playing) { clearInterval(slider.animatedSlides); }\n slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);\n slider.started = slider.playing = true;\n // PAUSEPLAY:\n if (slider.vars.pausePlay) { methods.pausePlay.update(\"pause\"); }\n // SYNC:\n if (slider.syncExists) { methods.sync(\"play\"); }\n };\n // STOP:\n slider.stop = function () {\n slider.pause();\n slider.stopped = true;\n };\n slider.canAdvance = function (target, fromNav) {\n // ASNAV:\n var last = (asNav) ? slider.pagingCount - 1 : slider.last;\n return (fromNav) ? true :\n (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === \"prev\") ? true :\n (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== \"next\") ? false :\n (target === slider.currentSlide && !asNav) ? false :\n (slider.vars.animationLoop) ? true :\n (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== \"next\") ? false :\n (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === \"next\") ? false :\n true;\n };\n slider.getTarget = function (dir) {\n slider.direction = dir;\n if (dir === \"next\") {\n return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;\n } else {\n return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;\n }\n };\n\n // SLIDE:\n slider.setProps = function (pos, special, dur) {\n var target = (function () {\n var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,\n posCalc = (function () {\n if (carousel) {\n return (special === \"setTouch\") ? pos :\n (reverse && slider.animatingTo === slider.last) ? 0 :\n (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :\n (slider.animatingTo === slider.last) ? slider.limit : posCheck;\n } else {\n switch (special) {\n case \"setTotal\": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;\n case \"setTouch\": return (reverse) ? pos : pos;\n case \"jumpEnd\": return (reverse) ? pos : slider.count * pos;\n case \"jumpStart\": return (reverse) ? slider.count * pos : pos;\n default: return pos;\n }\n }\n }());\n\n return (posCalc * ((slider.vars.rtl) ? 1 : -1)) + \"px\";\n }());\n\n if (slider.transitions) {\n if (slider.isFirefox) {\n target = (vertical) ? \"translate3d(0,\" + target + \",0)\" : \"translate3d(\" + (parseInt(target) + 'px') + \",0,0)\";\n } else {\n target = (vertical) ? \"translate3d(0,\" + target + \",0)\" : \"translate3d(\" + ((slider.vars.rtl ? -1 : 1) * parseInt(target) + 'px') + \",0,0)\";\n }\n dur = (dur !== undefined) ? (dur / 1000) + \"s\" : \"0s\";\n slider.container.css(\"-\" + slider.pfx + \"-transition-duration\", dur);\n slider.container.css(\"transition-duration\", dur);\n }\n\n slider.args[slider.prop] = target;\n if (slider.transitions || dur === undefined) { slider.container.css(slider.args); }\n\n slider.container.css('transform', target);\n };\n\n slider.setup = function (type) {\n // SLIDE:\n if (!fade) {\n var sliderOffset, arr;\n\n if (type === \"init\") {\n slider.viewport = $('
      ').css({ \"overflow\": \"hidden\", \"position\": \"relative\" }).appendTo(slider).append(slider.container);\n // INFINITE LOOP:\n slider.cloneCount = 0;\n slider.cloneOffset = 0;\n // REVERSE:\n if (reverse) {\n arr = $.makeArray(slider.slides).reverse();\n slider.slides = $(arr);\n slider.container.empty().append(slider.slides);\n }\n }\n // INFINITE LOOP && !CAROUSEL:\n if (slider.vars.animationLoop && !carousel) {\n slider.cloneCount = 2;\n slider.cloneOffset = 1;\n // clear out old clones\n if (type !== \"init\") { slider.container.find('.clone').remove(); }\n slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))\n .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));\n }\n slider.newSlides = $(slider.vars.selector, slider);\n\n sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;\n // VERTICAL:\n if (vertical && !carousel) {\n slider.container.height((slider.count + slider.cloneCount) * 200 + \"%\").css(\"position\", \"absolute\").width(\"100%\");\n setTimeout(function () {\n slider.newSlides.css({ \"display\": \"block\" });\n slider.doMath();\n slider.viewport.height(slider.h);\n slider.setProps(sliderOffset * slider.h, \"init\");\n }, (type === \"init\") ? 100 : 0);\n } else {\n slider.container.width((slider.count + slider.cloneCount) * 200 + \"%\");\n slider.setProps(sliderOffset * slider.computedW, \"init\");\n setTimeout(function () {\n slider.doMath();\n if (slider.vars.rtl) {\n if (slider.isFirefox) {\n slider.newSlides.css({ \"width\": slider.computedW, \"marginRight\": slider.computedM, \"float\": \"right\", \"display\": \"block\" });\n } else {\n slider.newSlides.css({ \"width\": slider.computedW, \"marginRight\": slider.computedM, \"float\": \"left\", \"display\": \"block\" });\n }\n\n }\n else {\n slider.newSlides.css({ \"width\": slider.computedW, \"marginRight\": slider.computedM, \"float\": \"left\", \"display\": \"block\" });\n }\n // SMOOTH HEIGHT:\n if (slider.vars.smoothHeight) { methods.smoothHeight(); }\n }, (type === \"init\") ? 100 : 0);\n }\n } else { // FADE:\n if (slider.vars.rtl) {\n slider.slides.css({ \"width\": \"100%\", \"float\": 'right', \"marginLeft\": \"-100%\", \"position\": \"relative\" });\n }\n else {\n slider.slides.css({ \"width\": \"100%\", \"float\": 'left', \"marginRight\": \"-100%\", \"position\": \"relative\" });\n }\n if (type === \"init\") {\n if (!touch) {\n //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);\n if (slider.vars.fadeFirstSlide == false) {\n slider.slides.css({ \"opacity\": 0, \"display\": \"block\", \"zIndex\": 1 }).eq(slider.currentSlide).css({ \"zIndex\": 2 }).css({ \"opacity\": 1 });\n } else {\n slider.slides.css({ \"opacity\": 0, \"display\": \"block\", \"zIndex\": 1 }).eq(slider.currentSlide).css({ \"zIndex\": 2 }).animate({ \"opacity\": 1 }, slider.vars.animationSpeed, slider.vars.easing);\n }\n } else {\n slider.slides.css({ \"opacity\": 0, \"display\": \"block\", \"webkitTransition\": \"opacity \" + slider.vars.animationSpeed / 1000 + \"s ease\", \"zIndex\": 1 }).eq(slider.currentSlide).css({ \"opacity\": 1, \"zIndex\": 2 });\n }\n }\n // SMOOTH HEIGHT:\n if (slider.vars.smoothHeight) { methods.smoothHeight(); }\n }\n // !CAROUSEL:\n // CANDIDATE: active slide\n if (!carousel) { slider.slides.removeClass(namespace + \"active-slide\").eq(slider.currentSlide).addClass(namespace + \"active-slide\"); }\n\n //FlexSlider: init() Callback\n slider.vars.init(slider);\n };\n\n slider.doMath = function () {\n var slide = slider.slides.first(),\n slideMargin = slider.vars.itemMargin,\n minItems = slider.vars.minItems,\n maxItems = slider.vars.maxItems;\n\n slider.w = (slider.viewport === undefined) ? slider.width() : slider.viewport.width();\n if (slider.isFirefox) { slider.w = slider.width(); }\n slider.h = slide.height();\n slider.boxPadding = slide.outerWidth() - slide.width();\n\n // CAROUSEL:\n if (carousel) {\n slider.itemT = slider.vars.itemWidth + slideMargin;\n slider.itemM = slideMargin;\n slider.minW = (minItems) ? minItems * slider.itemT : slider.w;\n slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;\n slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1))) / minItems :\n (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1))) / maxItems :\n (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;\n\n slider.visible = Math.floor(slider.w / (slider.itemW));\n slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible) ? slider.vars.move : slider.visible;\n slider.pagingCount = Math.ceil(((slider.count - slider.visible) / slider.move) + 1);\n slider.last = slider.pagingCount - 1;\n slider.limit = (slider.pagingCount === 1) ? 0 :\n (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;\n } else {\n slider.itemW = slider.w;\n slider.itemM = slideMargin;\n slider.pagingCount = slider.count;\n slider.last = slider.count - 1;\n }\n slider.computedW = slider.itemW - slider.boxPadding;\n slider.computedM = slider.itemM;\n };\n\n slider.update = function (pos, action) {\n slider.doMath();\n\n // update currentSlide and slider.animatingTo if necessary\n if (!carousel) {\n if (pos < slider.currentSlide) {\n slider.currentSlide += 1;\n } else if (pos <= slider.currentSlide && pos !== 0) {\n slider.currentSlide -= 1;\n }\n slider.animatingTo = slider.currentSlide;\n }\n\n // update controlNav\n if (slider.vars.controlNav && !slider.manualControls) {\n if ((action === \"add\" && !carousel) || slider.pagingCount > slider.controlNav.length) {\n methods.controlNav.update(\"add\");\n } else if ((action === \"remove\" && !carousel) || slider.pagingCount < slider.controlNav.length) {\n if (carousel && slider.currentSlide > slider.last) {\n slider.currentSlide -= 1;\n slider.animatingTo -= 1;\n }\n methods.controlNav.update(\"remove\", slider.last);\n }\n }\n // update directionNav\n if (slider.vars.directionNav) { methods.directionNav.update(); }\n\n };\n\n slider.addSlide = function (obj, pos) {\n var $obj = $(obj);\n\n slider.count += 1;\n slider.last = slider.count - 1;\n\n // append new slide\n if (vertical && reverse) {\n (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);\n } else {\n (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);\n }\n\n // update currentSlide, animatingTo, controlNav, and directionNav\n slider.update(pos, \"add\");\n\n // update slider.slides\n slider.slides = $(slider.vars.selector + ':not(.clone)', slider);\n // re-setup the slider to accomdate new slide\n slider.setup();\n\n //FlexSlider: added() Callback\n slider.vars.added(slider);\n };\n slider.removeSlide = function (obj) {\n var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;\n\n // update count\n slider.count -= 1;\n slider.last = slider.count - 1;\n\n // remove slide\n if (isNaN(obj)) {\n $(obj, slider.slides).remove();\n } else {\n (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();\n }\n\n // update currentSlide, animatingTo, controlNav, and directionNav\n slider.doMath();\n slider.update(pos, \"remove\");\n\n // update slider.slides\n slider.slides = $(slider.vars.selector + ':not(.clone)', slider);\n // re-setup the slider to accomdate new slide\n slider.setup();\n\n // FlexSlider: removed() Callback\n slider.vars.removed(slider);\n };\n\n //FlexSlider: Initialize\n methods.init();\n };\n\n // Ensure the slider isn't focussed if the window loses focus.\n $(window).blur(function (e) {\n focused = false;\n }).focus(function (e) {\n focused = true;\n });\n\n //FlexSlider: Default Settings\n $.flexslider.defaults = {\n namespace: \"flex-\", //{NEW} String: Prefix string attached to the class of every element generated by the plugin\n selector: \".slides > li\", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril\n animation: \"fade\", //String: Select your animation type, \"fade\" or \"slide\"\n easing: \"swing\", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!\n direction: \"horizontal\", //String: Select the sliding direction, \"horizontal\" or \"vertical\"\n reverse: false, //{NEW} Boolean: Reverse the animation direction\n animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received \"disable\" classes at either end\n smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode\n startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)\n slideshow: true, //Boolean: Animate slider automatically\n slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds\n animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds\n initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds\n randomize: false, //Boolean: Randomize slide order\n fadeFirstSlide: true, //Boolean: Fade in the first slide when animation type is \"fade\"\n thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the \"thumbnails\" controlNav.\n\n // Usability features\n pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.\n pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering\n pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.\n useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available\n touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices\n video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches\n\n // Primary Controls\n controlNav: true, //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage\n directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)\n prevText: \"Previous\", //String: Set the text for the \"previous\" directionNav item\n nextText: \"Next\", //String: Set the text for the \"next\" directionNav item\n\n // Secondary Navigation\n keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys\n multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.\n mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel\n pausePlay: false, //Boolean: Create pause/play dynamic element\n pauseText: \"Pause\", //String: Set the text for the \"pause\" pausePlay item\n playText: \"Play\", //String: Set the text for the \"play\" pausePlay item\n\n // Special properties\n controlsContainer: \"\", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(\".flexslider-container\"). Property is ignored if given element is not found.\n manualControls: \"\", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(\".flex-control-nav li\") or \"#tabs-nav li img\", etc. The number of elements in your controlNav should match the number of slides/tabs.\n customDirectionNav: \"\", //{NEW} jQuery Object/Selector: Custom prev / next button. Must be two jQuery elements. In order to make the events work they have to have the classes \"prev\" and \"next\" (plus namespace)\n sync: \"\", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.\n asNavFor: \"\", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider\n\n // Carousel Options\n itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.\n itemMargin: 0, //{NEW} Integer: Margin between carousel items.\n minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.\n maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.\n move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.\n allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide\n\n // Browser Specific\n isFirefox: false, // {NEW} Boolean: Set to true when Firefox is the browser used.\n\n // Callback API\n start: function () { }, //Callback: function(slider) - Fires when the slider loads the first slide\n before: function () { }, //Callback: function(slider) - Fires asynchronously with each slider animation\n after: function () { }, //Callback: function(slider) - Fires after each slider animation completes\n end: function () { }, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)\n added: function () { }, //{NEW} Callback: function(slider) - Fires after a slide is added\n removed: function () { }, //{NEW} Callback: function(slider) - Fires after a slide is removed\n init: function () { }, //{NEW} Callback: function(slider) - Fires after the slider is initially setup\n rtl: false //{NEW} Boolean: Whether or not to enable RTL mode\n };\n\n //FlexSlider: Plugin Function\n $.fn.flexslider = function (options) {\n if (options === undefined) { options = {}; }\n\n if (typeof options === \"object\") {\n return this.each(function () {\n var $this = $(this),\n selector = (options.selector) ? options.selector : \".slides > li\",\n $slides = $this.find(selector);\n\n if (($slides.length === 1 && options.allowOneSlide === false) || $slides.length === 0) {\n $slides.fadeIn(400);\n if (options.start) { options.start($this); }\n } else if ($this.data('flexslider') === undefined) {\n new $.flexslider(this, options);\n }\n });\n } else {\n // Helper strings to quickly perform functions on the slider\n var $slider = $(this).data('flexslider');\n switch (options) {\n case \"play\": $slider.play(); break;\n case \"pause\": $slider.pause(); break;\n case \"stop\": $slider.stop(); break;\n case \"next\": $slider.flexAnimate($slider.getTarget(\"next\"), true); break;\n case \"prev\":\n case \"previous\": $slider.flexAnimate($slider.getTarget(\"prev\"), true); break;\n default: if (typeof options === \"number\") { $slider.flexAnimate(options, true); }\n }\n }\n };\n};\n"],"names":["focused","flexslider","el","options","slider","rtl","attr","vars","$","extend","defaults","watchedEventClearTimer","namespace","msGesture","window","navigator","msPointerEnabled","MSGesture","touch","DocumentTouch","document","eventType","watchedEvent","vertical","direction","reverse","carousel","itemWidth","fade","animation","asNav","asNavFor","methods","data","init","animating","currentSlide","parseInt","startAt","isNaN","animatingTo","atEnd","last","containerSelector","selector","substr","search","slides","container","count","length","syncExists","sync","prop","args","manualPause","stopped","started","startTimeout","transitions","video","useCSS","obj","createElement","props","i","undefined","style","pfx","replace","toLowerCase","isFirefox","userAgent","indexOf","ensureAnimationEnd","controlsContainer","manualControls","customDirectionNav","randomize","sort","Math","round","random","empty","append","doMath","setup","controlNav","directionNav","keyboard","multipleKeyboard","bind","event","keycode","keyCode","target","getTarget","flexAnimate","pauseOnAction","mousewheel","delta","deltaX","deltaY","preventDefault","pausePlay","slideshow","pauseInvisible","pauseOnHover","hover","manualPlay","pause","play","isHidden","initDelay","setTimeout","smoothHeight","resize","find","start","floor","move","currentItem","removeClass","eq","addClass","_slider","each","this","_gesture","addEventListener","e","currentTarget","addPointer","pointerId","$slide","index","hasClass","on","offset","right","scrollLeft","left","setupManual","setupPaging","item","slide","type","j","controlNavScaffold","pagingCount","text","thumbCaptions","captn","caption","liElement","appendTo","set","active","delegate","$this","setToClearWatchedEvent","update","action","pos","remove","closest","directionNavScaffold","prevText","nextText","disabledClass","animationLoop","removeAttr","filter","pausePlayScaffold","state","html","playText","pauseText","startX","startY","cwidth","dx","startT","onTouchStart","onTouchMove","onTouchEnd","scrolling","localX","localY","accDx","onMSPointerDown","stopPropagation","h","w","Number","Date","limit","itemW","itemMargin","cloneOffset","onMSGestureChange","transX","translationX","transY","translationY","abs","detail","MSGESTURE_FLAG_INERTIA","setProps","setImmediate","stop","onMSGestureEnd","updateDx","canAdvance","msTouchAction","touches","pageX","pageY","removeEventListener","is","width","computedW","viewport","height","newSlides","dur","$obj","animate","innerHeight","playing","uniqueID","$clone","add","visProp","getHiddenProp","evtname","clearTimeout","prefixes","override","withSync","fromNav","master","ceil","visible","before","end","css","wrapup","dimension","animationSpeed","easing","margin","slideString","calcNext","unbind","after","animateSlides","clearInterval","animatedSlides","setInterval","slideshowSpeed","dir","special","posCheck","sliderOffset","arr","fadeFirstSlide","cloneCount","makeArray","first","clone","prepend","computedM","slideMargin","minItems","maxItems","boxPadding","outerWidth","itemT","itemM","minW","maxW","addSlide","added","removeSlide","removed","blur","focus","allowOneSlide","fn","$slides","fadeIn","$slider"],"mappings":";;+JA+B0B;;;;;;;IAQlBA,SAAU,kBAGZC,WAAa,SAAUC,GAAIC,aACrBC,QAAS,mBAAEF,SAKW,IAAfC,QAAQE,KAA+C,QAAzB,mBAAE,QAAQC,KAAK,SACpDH,QAAQE,KAAM,GAElBD,OAAOG,KAAOC,gBAAEC,OAAO,GAAID,gBAAEP,WAAWS,SAAUP,aAQ9CQ,uBANAC,UAAYR,OAAOG,KAAKK,UACxBC,UAAYC,OAAOC,WAAaD,OAAOC,UAAUC,kBAAoBF,OAAOG,UAC5EC,OAAU,iBAAkBJ,QAAWD,WAAaC,OAAOK,eAAiBC,oBAAoBD,gBAAkBf,OAAOG,KAAKW,MAE9HG,UAAY,mCACZC,aAAe,GAEfC,SAAqC,aAA1BnB,OAAOG,KAAKiB,UACvBC,QAAUrB,OAAOG,KAAKkB,QACtBC,SAAYtB,OAAOG,KAAKoB,UAAY,EACpCC,KAAiC,SAA1BxB,OAAOG,KAAKsB,UACnBC,MAAiC,KAAzB1B,OAAOG,KAAKwB,SACpBC,QAAU,mBAGZC,KAAK/B,GAAI,aAAcE,QAGzB4B,QAAU,CACNE,KAAM,WACF9B,OAAO+B,WAAY,EAEnB/B,OAAOgC,aAAeC,SAAUjC,OAAOG,KAAK+B,QAAUlC,OAAOG,KAAK+B,QAAU,EAAI,IAC5EC,MAAMnC,OAAOgC,gBAAiBhC,OAAOgC,aAAe,GACxDhC,OAAOoC,YAAcpC,OAAOgC,aAC5BhC,OAAOqC,MAAiC,IAAxBrC,OAAOgC,cAAsBhC,OAAOgC,eAAiBhC,OAAOsC,KAC5EtC,OAAOuC,kBAAoBvC,OAAOG,KAAKqC,SAASC,OAAO,EA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mH,OAASnH,QAAQmH,MAAMyC,aACC7F,IAA7B6F,MAAM9H,KAAK,mBACdzB,gBAAEP,WAAW8H,KAAM5H,gBAK3BiS,SAAU,mBAAErK,MAAM9F,KAAK,qBACnB9B,aACC,OAAQiS,QAAQrL,iBAChB,QAASqL,QAAQtL,kBACjB,OAAQsL,QAAQlF,iBAChB,OAAQkF,QAAQnM,YAAYmM,QAAQpM,UAAU,SAAS,aACvD,WACA,WAAYoM,QAAQnM,YAAYmM,QAAQpM,UAAU,SAAS,iBAChC,iBAAZ7F,SAAwBiS,QAAQnM,YAAY9F,SAAS"} \ No newline at end of file diff --git a/amd/build/icon_system_fontawesome.min.js b/amd/build/icon_system_fontawesome.min.js index 61a69c9..825fb4d 100644 --- a/amd/build/icon_system_fontawesome.min.js +++ b/amd/build/icon_system_fontawesome.min.js @@ -1,12 +1,4 @@ -/** - * Adaptable theme. - * - * @module theme_adaptable/icon_system_fontawesome - * @copyright 2023 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. define("theme_adaptable/icon_system_fontawesome",["core/icon_system","jquery","core/ajax","core/mustache","core/localstorage","core/url"],(function(IconSystem,$,Ajax,Mustache,LocalStorage,Url){var staticMap=null,fetchMap=null,IconSystemFontawesome=function(){IconSystem.apply(this,arguments)};return(IconSystemFontawesome.prototype=Object.create(IconSystem.prototype)).init=function(){if(staticMap)return $.when(this);var map=LocalStorage.get("theme_adaptable/iconmap-fontawesome");return map&&(map=JSON.parse(map)),map?(staticMap=map,$.when(this)):(null===fetchMap&&(fetchMap=Ajax.call([{methodname:"theme_adaptable_output_load_fontawesome_icon_map",args:[]}],!0,!1)[0]),fetchMap.then(function(map){return staticMap={},$.each(map,(function(index,value){staticMap[value.component+"/"+value.pix]=value.to})),LocalStorage.set("theme_adaptable/iconmap-fontawesome",JSON.stringify(staticMap)),this}.bind(this)))},IconSystemFontawesome.prototype.renderIcon=function(key,component,title,template){var mappedIcon=staticMap[component+"/"+key],unmappedIcon=!1;void 0===mappedIcon&&(unmappedIcon={attributes:[{name:"src",value:Url.imageUrl(key,component)},{name:"alt",value:title},{name:"title",value:title}]});var context={key:mappedIcon,title:title,alt:title,unmappedIcon:unmappedIcon};return Mustache.render(template,context)},IconSystemFontawesome.prototype.getTemplateName=function(){return"theme_adaptable/pix_icon_fontawesome"},IconSystemFontawesome})); //# sourceMappingURL=icon_system_fontawesome.min.js.map \ No newline at end of file diff --git a/amd/build/icon_system_fontawesome.min.js.map b/amd/build/icon_system_fontawesome.min.js.map new file mode 100644 index 0000000..88318de --- /dev/null +++ b/amd/build/icon_system_fontawesome.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"icon_system_fontawesome.min.js","sources":["../src/icon_system_fontawesome.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// Adaptable theme.\n//\n// @module theme_adaptable/icon_system_fontawesome\n// @copyright 2023 G J Barnard\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\ndefine(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/localstorage', 'core/url'],\nfunction(IconSystem, $, Ajax, Mustache, LocalStorage, Url) {\n\n var staticMap = null;\n var fetchMap = null;\n\n /**\n * IconSystemFontawesome\n */\n var IconSystemFontawesome = function() {\n IconSystem.apply(this, arguments);\n };\n IconSystemFontawesome.prototype = Object.create(IconSystem.prototype);\n\n /**\n * Prefetch resources so later calls to renderIcon can be resolved synchronously.\n *\n * @method init\n * @return {Promise}\n */\n IconSystemFontawesome.prototype.init = function() {\n if (staticMap) {\n return $.when(this);\n }\n\n var map = LocalStorage.get('theme_adaptable/iconmap-fontawesome');\n if (map) {\n map = JSON.parse(map);\n }\n\n if (map) {\n staticMap = map;\n return $.when(this);\n }\n\n if (fetchMap === null) {\n fetchMap = Ajax.call([{\n methodname: 'theme_adaptable_output_load_fontawesome_icon_map',\n args: []\n }], true, false)[0];\n }\n\n return fetchMap.then(function(map) {\n staticMap = {};\n $.each(map, function(index, value) {\n staticMap[value.component + '/' + value.pix] = value.to;\n });\n LocalStorage.set('theme_adaptable/iconmap-fontawesome', JSON.stringify(staticMap));\n return this;\n }.bind(this));\n };\n\n /**\n * Render an icon.\n *\n * @param {String} key\n * @param {String} component\n * @param {String} title\n * @param {String} template\n * @return {String}\n * @method renderIcon\n */\n IconSystemFontawesome.prototype.renderIcon = function(key, component, title, template) {\n var mappedIcon = staticMap[component + '/' + key];\n var unmappedIcon = false;\n if (typeof mappedIcon === \"undefined\") {\n var url = Url.imageUrl(key, component);\n\n unmappedIcon = {\n attributes: [\n {name: 'src', value: url},\n {name: 'alt', value: title},\n {name: 'title', value: title}\n ]\n };\n }\n\n var context = {\n key: mappedIcon,\n title: title,\n alt: title,\n unmappedIcon: unmappedIcon\n };\n\n return Mustache.render(template, context);\n };\n\n /**\n * Get the name of the template to pre-cache for this icon system.\n *\n * @return {String}\n * @method getTemplateName\n */\n IconSystemFontawesome.prototype.getTemplateName = function() {\n return 'theme_adaptable/pix_icon_fontawesome';\n };\n\n return IconSystemFontawesome; // @alias module:theme_adaptable/icon_system_fontawesome\n\n});\n"],"names":["define","IconSystem","$","Ajax","Mustache","LocalStorage","Url","staticMap","fetchMap","IconSystemFontawesome","apply","this","arguments","prototype","Object","create","init","when","map","get","JSON","parse","call","methodname","args","then","each","index","value","component","pix","to","set","stringify","bind","renderIcon","key","title","template","mappedIcon","unmappedIcon","attributes","name","imageUrl","context","alt","render","getTemplateName"],"mappings":";AAyBAA,iDAAO,CAAC,mBAAoB,SAAU,YAAa,gBAAiB,oBAAqB,aACzF,SAASC,WAAYC,EAAGC,KAAMC,SAAUC,aAAcC,SAE9CC,UAAY,KACZC,SAAW,KAKXC,sBAAwB,WACxBR,WAAWS,MAAMC,KAAMC,mBAE3BH,sBAAsBI,UAAYC,OAAOC,OAAOd,WAAWY,YAQ3BG,KAAO,cAC/BT,iBACOL,EAAEe,KAAKN,UAGdO,IAAMb,aAAac,IAAI,8CACvBD,MACAA,IAAME,KAAKC,MAAMH,MAGjBA,KACAX,UAAYW,IACLhB,EAAEe,KAAKN,QAGD,OAAbH,WACAA,SAAWL,KAAKmB,KAAK,CAAC,CAClBC,WAAY,mDACZC,KAAM,MACN,GAAM,GAAO,IAGdhB,SAASiB,KAAK,SAASP,YAC1BX,UAAY,GACZL,EAAEwB,KAAKR,KAAK,SAASS,MAAOC,OACxBrB,UAAUqB,MAAMC,UAAY,IAAMD,MAAME,KAAOF,MAAMG,MAEzD1B,aAAa2B,IAAI,sCAAuCZ,KAAKa,UAAU1B,YAChEI,MACTuB,KAAKvB,SAaXF,sBAAsBI,UAAUsB,WAAa,SAASC,IAAKP,UAAWQ,MAAOC,cACrEC,WAAahC,UAAUsB,UAAY,IAAMO,KACzCI,cAAe,OACO,IAAfD,aAGPC,aAAe,CACXC,WAAY,CACR,CAACC,KAAM,MAAOd,MAJZtB,IAAIqC,SAASP,IAAKP,YAKpB,CAACa,KAAM,MAAOd,MAAOS,OACrB,CAACK,KAAM,QAASd,MAAOS,cAK/BO,QAAU,CACVR,IAAKG,WACLF,MAAOA,MACPQ,IAAKR,MACLG,aAAcA,qBAGXpC,SAAS0C,OAAOR,SAAUM,UASrCnC,sBAAsBI,UAAUkC,gBAAkB,iBACvC,wCAGJtC"} \ No newline at end of file diff --git a/amd/build/jqueryeasing.min.js b/amd/build/jqueryeasing.min.js new file mode 100644 index 0000000..55de31a --- /dev/null +++ b/amd/build/jqueryeasing.min.js @@ -0,0 +1,5 @@ +define("theme_adaptable/jqueryeasing",["exports","jquery","core/log"],(function(_exports,_jquery,_log){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +return Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=function(){_log.default.debug("Adaptable ES6 jqueryeasing init"),void 0!==_jquery.default.easing&&(_jquery.default.easing.jswing=_jquery.default.easing.swing);var pow=Math.pow,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,PI=Math.PI,c1=1.70158,c2=1.525*c1,c4=2*PI/3,c5=2*PI/4.5;function bounceOut(x){var n1=7.5625,d1=2.75;return x<1/d1?n1*x*x:x<2/d1?n1*(x-=1.5/d1)*x+.75:x<2.5/d1?n1*(x-=2.25/d1)*x+.9375:n1*(x-=2.625/d1)*x+.984375}_jquery.default.extend(_jquery.default.easing,{def:"easeOutQuad",swing:function(x){return _jquery.default.easing[_jquery.default.easing.def](x)},easeInQuad:function(x){return x*x},easeOutQuad:function(x){return 1-(1-x)*(1-x)},easeInOutQuad:function(x){return x<.5?2*x*x:1-pow(-2*x+2,2)/2},easeInCubic:function(x){return x*x*x},easeOutCubic:function(x){return 1-pow(1-x,3)},easeInOutCubic:function(x){return x<.5?4*x*x*x:1-pow(-2*x+2,3)/2},easeInQuart:function(x){return x*x*x*x},easeOutQuart:function(x){return 1-pow(1-x,4)},easeInOutQuart:function(x){return x<.5?8*x*x*x*x:1-pow(-2*x+2,4)/2},easeInQuint:function(x){return x*x*x*x*x},easeOutQuint:function(x){return 1-pow(1-x,5)},easeInOutQuint:function(x){return x<.5?16*x*x*x*x*x:1-pow(-2*x+2,5)/2},easeInSine:function(x){return 1-cos(x*PI/2)},easeOutSine:function(x){return sin(x*PI/2)},easeInOutSine:function(x){return-(cos(PI*x)-1)/2},easeInExpo:function(x){return 0===x?0:pow(2,10*x-10)},easeOutExpo:function(x){return 1===x?1:1-pow(2,-10*x)},easeInOutExpo:function(x){return 0===x?0:1===x?1:x<.5?pow(2,20*x-10)/2:(2-pow(2,-20*x+10))/2},easeInCirc:function(x){return 1-sqrt(1-pow(x,2))},easeOutCirc:function(x){return sqrt(1-pow(x-1,2))},easeInOutCirc:function(x){return x<.5?(1-sqrt(1-pow(2*x,2)))/2:(sqrt(1-pow(-2*x+2,2))+1)/2},easeInElastic:function(x){return 0===x?0:1===x?1:-pow(2,10*x-10)*sin((10*x-10.75)*c4)},easeOutElastic:function(x){return 0===x?0:1===x?1:pow(2,-10*x)*sin((10*x-.75)*c4)+1},easeInOutElastic:function(x){return 0===x?0:1===x?1:x<.5?-pow(2,20*x-10)*sin((20*x-11.125)*c5)/2:pow(2,-20*x+10)*sin((20*x-11.125)*c5)/2+1},easeInBack:function(x){return 2.70158*x*x*x-c1*x*x},easeOutBack:function(x){return 1+2.70158*pow(x-1,3)+c1*pow(x-1,2)},easeInOutBack:function(x){return x<.5?pow(2*x,2)*(7.189819*x-c2)/2:(pow(2*x-2,2)*((c2+1)*(2*x-2)+c2)+2)/2},easeInBounce:function(x){return 1-bounceOut(1-x)},easeOutBounce:bounceOut,easeInOutBounce:function(x){return x<.5?(1-bounceOut(1-2*x))/2:(1+bounceOut(2*x-1))/2}})},_jquery=_interopRequireDefault(_jquery),_log=_interopRequireDefault(_log),_exports.default})); + +//# sourceMappingURL=jqueryeasing.min.js.map \ No newline at end of file diff --git a/amd/build/jqueryeasing.min.js.map b/amd/build/jqueryeasing.min.js.map new file mode 100644 index 0000000..0cccad8 --- /dev/null +++ b/amd/build/jqueryeasing.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jqueryeasing.min.js","sources":["../src/jqueryeasing.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// ES6 wrapper for jqueryeasing.\n//\n// @module theme_adaptable/jqueryeasing\n// @copyright 2024 G J Barnard.\n// @author G J Barnard -\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport $ from 'jquery';\nimport log from 'core/log';\n\n/**\n * Initialise jqueryeasing.\n */\nexport default function jqueryeasingInit() {\n log.debug('Adaptable ES6 jqueryeasing init');\n /*\n * jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/\n * Open source under the BSD License.\n * Copyright © 2008 George McGinley Smith\n * All rights reserved.\n * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE\n */\n\n // Preserve the original jQuery \"swing\" easing as \"jswing\"\n if (typeof $.easing !== 'undefined') {\n $.easing['jswing'] = $.easing['swing'];\n }\n\n var pow = Math.pow,\n sqrt = Math.sqrt,\n sin = Math.sin,\n cos = Math.cos,\n PI = Math.PI,\n c1 = 1.70158,\n c2 = c1 * 1.525,\n c3 = c1 + 1,\n c4 = (2 * PI) / 3,\n c5 = (2 * PI) / 4.5;\n\n // x is the fraction of animation progress, in the range 0..1\n function bounceOut(x) {\n var n1 = 7.5625,\n d1 = 2.75;\n if (x < 1 / d1) {\n return n1 * x * x;\n } else if (x < 2 / d1) {\n return n1 * (x -= (1.5 / d1)) * x + .75;\n } else if (x < 2.5 / d1) {\n return n1 * (x -= (2.25 / d1)) * x + .9375;\n } else {\n return n1 * (x -= (2.625 / d1)) * x + .984375;\n }\n }\n\n $.extend($.easing,\n {\n def: 'easeOutQuad',\n swing: function (x) {\n return $.easing[$.easing.def](x);\n },\n easeInQuad: function (x) {\n return x * x;\n },\n easeOutQuad: function (x) {\n return 1 - (1 - x) * (1 - x);\n },\n easeInOutQuad: function (x) {\n return x < 0.5 ?\n 2 * x * x :\n 1 - pow(-2 * x + 2, 2) / 2;\n },\n easeInCubic: function (x) {\n return x * x * x;\n },\n easeOutCubic: function (x) {\n return 1 - pow(1 - x, 3);\n },\n easeInOutCubic: function (x) {\n return x < 0.5 ?\n 4 * x * x * x :\n 1 - pow(-2 * x + 2, 3) / 2;\n },\n easeInQuart: function (x) {\n return x * x * x * x;\n },\n easeOutQuart: function (x) {\n return 1 - pow(1 - x, 4);\n },\n easeInOutQuart: function (x) {\n return x < 0.5 ?\n 8 * x * x * x * x :\n 1 - pow(-2 * x + 2, 4) / 2;\n },\n easeInQuint: function (x) {\n return x * x * x * x * x;\n },\n easeOutQuint: function (x) {\n return 1 - pow(1 - x, 5);\n },\n easeInOutQuint: function (x) {\n return x < 0.5 ?\n 16 * x * x * x * x * x :\n 1 - pow(-2 * x + 2, 5) / 2;\n },\n easeInSine: function (x) {\n return 1 - cos(x * PI / 2);\n },\n easeOutSine: function (x) {\n return sin(x * PI / 2);\n },\n easeInOutSine: function (x) {\n return -(cos(PI * x) - 1) / 2;\n },\n easeInExpo: function (x) {\n return x === 0 ? 0 : pow(2, 10 * x - 10);\n },\n easeOutExpo: function (x) {\n return x === 1 ? 1 : 1 - pow(2, -10 * x);\n },\n easeInOutExpo: function (x) {\n return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?\n pow(2, 20 * x - 10) / 2 :\n (2 - pow(2, -20 * x + 10)) / 2;\n },\n easeInCirc: function (x) {\n return 1 - sqrt(1 - pow(x, 2));\n },\n easeOutCirc: function (x) {\n return sqrt(1 - pow(x - 1, 2));\n },\n easeInOutCirc: function (x) {\n return x < 0.5 ?\n (1 - sqrt(1 - pow(2 * x, 2))) / 2 :\n (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;\n },\n easeInElastic: function (x) {\n return x === 0 ? 0 : x === 1 ? 1 :\n -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);\n },\n easeOutElastic: function (x) {\n return x === 0 ? 0 : x === 1 ? 1 :\n pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;\n },\n easeInOutElastic: function (x) {\n return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?\n -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 :\n pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1;\n },\n easeInBack: function (x) {\n return c3 * x * x * x - c1 * x * x;\n },\n easeOutBack: function (x) {\n return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);\n },\n easeInOutBack: function (x) {\n return x < 0.5 ?\n (pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2)) / 2 :\n (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;\n },\n easeInBounce: function (x) {\n return 1 - bounceOut(1 - x);\n },\n easeOutBounce: bounceOut,\n easeInOutBounce: function (x) {\n return x < 0.5 ?\n (1 - bounceOut(1 - 2 * x)) / 2 :\n (1 + bounceOut(2 * x - 1)) / 2;\n }\n }\n );\n};\n"],"names":["debug","$","easing","pow","Math","sqrt","sin","cos","PI","c1","c2","c4","c5","bounceOut","x","n1","d1","extend","def","swing","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInSine","easeOutSine","easeInOutSine","easeInExpo","easeOutExpo","easeInOutExpo","easeInCirc","easeOutCirc","easeInOutCirc","easeInElastic","easeOutElastic","easeInOutElastic","easeInBack","easeOutBack","easeInOutBack","easeInBounce","easeOutBounce","easeInOutBounce"],"mappings":";;wGAiCQA,MAAM,wCAUc,IAAbC,gBAAEC,yBACPA,OAAF,OAAqBD,gBAAEC,OAAF,WAGrBC,IAAMC,KAAK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,GAAKQ,EAAI,QAAUF,IAAO,EACvDT,IAAI,GAAI,GAAKW,EAAI,IAAMR,KAAK,GAAKQ,EAAI,QAAUF,IAAM,EAAI,GAEjEgC,WAAY,SAAU9B,UAjHrBL,QAkHeK,EAAIA,EAAIA,EAAIL,GAAKK,EAAIA,GAErC+B,YAAa,SAAU/B,UACZ,EArHVL,QAqHmBN,IAAIW,EAAI,EAAG,GAAKL,GAAKN,IAAIW,EAAI,EAAG,IAEpDgC,cAAe,SAAUhC,UACdA,EAAI,GACNX,IAAI,EAAIW,EAAG,IAAM,SAAeA,EAAIJ,IAAO,GAC3CP,IAAI,EAAIW,EAAI,EAAG,KAAOJ,GAAK,IAAU,EAAJI,EAAQ,GAAKJ,IAAM,GAAK,GAElEqC,aAAc,SAAUjC,UACb,EAAID,UAAU,EAAIC,IAE7BkC,cAAenC,UACfoC,gBAAiB,SAAUnC,UAChBA,EAAI,IACN,EAAID,UAAU,EAAI,EAAIC,IAAM,GAC5B,EAAID,UAAU,EAAIC,EAAI,IAAM"} \ No newline at end of file diff --git a/amd/build/pace.min.js b/amd/build/pace.min.js new file mode 100644 index 0000000..abe8a3f --- /dev/null +++ b/amd/build/pace.min.js @@ -0,0 +1,3 @@ +(function(){var AjaxMonitor,Bar,DocumentMonitor,ElementMonitor,ElementTracker,EventLagMonitor,Evented,Events,NoTargetError,Pace,RequestIntercept,SOURCE_KEYS,Scaler,SocketRequestTracker,XHRRequestTracker,addEventListener,animation,avgAmplitude,bar,cancelAnimation,cancelAnimationFrame,defaultOptions,extend,extendNative,getFromDOM,getIntercept,handlePushState,ignoreStack,init,now,options,requestAnimationFrame,result,runAnimation,scalers,shouldIgnoreURL,shouldTrack,source,sources,uniScaler,_WebSocket,_XDomainRequest,_XMLHttpRequest,_i,_intercept,_len,_pushState,_ref,_replaceState,__slice=[].slice,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);function ctor(){this.constructor=child}return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i=33?(last=now(),fn(diff,(function(){return requestAnimationFrame(tick)}))):setTimeout(tick,33-diff)})()},result=function(){var args,key,obj;return obj=arguments[0],key=arguments[1],args=3<=arguments.length?__slice.call(arguments,2):[],"function"==typeof obj[key]?obj[key].apply(obj,args):obj[key]},extend=function(){var key,out,source,sources,val,_i,_len;for(out=arguments[0],_i=0,_len=(sources=2<=arguments.length?__slice.call(arguments,1):[]).length;_i<_len;_i++)if(source=sources[_i])for(key in source)__hasProp.call(source,key)&&(val=source[key],null!=out[key]&&"object"==typeof out[key]&&null!=val&&"object"==typeof val?extend(out[key],val):out[key]=val);return out},avgAmplitude=function(arr){var count,sum,v,_i,_len;for(sum=count=0,_i=0,_len=arr.length;_i<_len;_i++)v=arr[_i],sum+=Math.abs(v),count++;return sum/count},getFromDOM=function(key,json){var data,e,el;if(null==key&&(key="options"),null==json&&(json=!0),el=document.querySelector("[data-pace-"+key+"]")){if(data=el.getAttribute("data-pace-"+key),!json)return data;try{return JSON.parse(data)}catch(_error){return e=_error,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",e):void 0}}},Evented=function(){function Evented(){}return Evented.prototype.on=function(event,handler,ctx,once){var _base;return null==once&&(once=!1),null==this.bindings&&(this.bindings={}),null==(_base=this.bindings)[event]&&(_base[event]=[]),this.bindings[event].push({handler:handler,ctx:ctx,once:once})},Evented.prototype.once=function(event,handler,ctx){return this.on(event,handler,ctx,!0)},Evented.prototype.off=function(event,handler){var i,_ref,_results;if(null!=(null!=(_ref=this.bindings)?_ref[event]:void 0)){if(null==handler)return delete this.bindings[event];for(i=0,_results=[];i\n
      \n\n
      ',null!=targetElement.firstChild?targetElement.insertBefore(this.el,targetElement.firstChild):targetElement.appendChild(this.el)}return this.el},Bar.prototype.finish=function(){var el;return(el=this.getElement()).className=el.className.replace("pace-active","pace-inactive"),document.body.className=document.body.className.replace("pace-running ","pace-done ")},Bar.prototype.update=function(prog){return this.progress=prog,Pace.trigger("progress",prog),this.render()},Bar.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(_error){NoTargetError=_error}return this.el=void 0},Bar.prototype.render=function(){var el,key,progressStr,transform,_j,_len1,_ref2;if(null==document.querySelector(options.target))return!1;for(el=this.getElement(),transform="translate3d("+this.progress+"%, 0, 0)",_j=0,_len1=(_ref2=["webkitTransform","msTransform","transform"]).length;_j<_len1;_j++)key=_ref2[_j],el.children[0].style[key]=transform;return(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(el.children[0].setAttribute("data-progress-text",(0|this.progress)+"%"),this.progress>=100?progressStr="99":(progressStr=this.progress<10?"0":"",progressStr+=0|this.progress),el.children[0].setAttribute("data-progress",""+progressStr)),Pace.trigger("change",this.progress),this.lastRenderedProgress=this.progress},Bar.prototype.done=function(){return this.progress>=100},Bar}(),Events=function(){function Events(){this.bindings={}}return Events.prototype.trigger=function(name,val){var binding,_j,_len1,_ref2,_results;if(null!=this.bindings[name]){for(_results=[],_j=0,_len1=(_ref2=this.bindings[name]).length;_j<_len1;_j++)binding=_ref2[_j],_results.push(binding.call(this,val));return _results}},Events.prototype.on=function(name,fn){var _base;return null==(_base=this.bindings)[name]&&(_base[name]=[]),this.bindings[name].push(fn)},Events}(),_XMLHttpRequest=window.XMLHttpRequest,_XDomainRequest=window.XDomainRequest,_WebSocket=window.WebSocket,extendNative=function(to,from){var key,_results;for(key in _results=[],from.prototype)try{null==to[key]&&"function"!=typeof from[key]?"function"==typeof Object.defineProperty?_results.push(Object.defineProperty(to,key,{get:function(key){return function(){return from.prototype[key]}}(key),configurable:!0,enumerable:!0})):_results.push(to[key]=from.prototype[key]):_results.push(void 0)}catch(_error){_error}return _results},ignoreStack=[],Pace.ignore=function(){var args,fn,ret;return fn=arguments[0],args=2<=arguments.length?__slice.call(arguments,1):[],ignoreStack.unshift("ignore"),ret=fn.apply(null,args),ignoreStack.shift(),ret},Pace.track=function(){var args,fn,ret;return fn=arguments[0],args=2<=arguments.length?__slice.call(arguments,1):[],ignoreStack.unshift("track"),ret=fn.apply(null,args),ignoreStack.shift(),ret},shouldTrack=function(method){var _ref2;if(null==method&&(method="GET"),"track"===ignoreStack[0])return"force";if(!ignoreStack.length&&options.ajax){if("socket"===method&&options.ajax.trackWebSockets)return!0;if(_ref2=method.toUpperCase(),__indexOf.call(options.ajax.trackMethods,_ref2)>=0)return!0}return!1},RequestIntercept=function(_super){function RequestIntercept(){var monitorXHR,_this=this;RequestIntercept.__super__.constructor.apply(this,arguments),monitorXHR=function(req){var _open;return _open=req.open,req.open=function(type,url,async){return shouldTrack(type)&&_this.trigger("request",{type:type,url:url,request:req}),_open.apply(req,arguments)}},window.XMLHttpRequest=function(flags){var req;return req=new _XMLHttpRequest(flags),monitorXHR(req),req};try{extendNative(window.XMLHttpRequest,_XMLHttpRequest)}catch(_error){}if(null!=_XDomainRequest){window.XDomainRequest=function(){var req;return req=new _XDomainRequest,monitorXHR(req),req};try{extendNative(window.XDomainRequest,_XDomainRequest)}catch(_error){}}if(null!=_WebSocket&&options.ajax.trackWebSockets){window.WebSocket=function(url,protocols){var req;return req=null!=protocols?new _WebSocket(url,protocols):new _WebSocket(url),shouldTrack("socket")&&_this.trigger("request",{type:"socket",url:url,protocols:protocols,request:req}),req};try{extendNative(window.WebSocket,_WebSocket)}catch(_error){}}}return __extends(RequestIntercept,_super),RequestIntercept}(Events),_intercept=null,shouldIgnoreURL=function(url){var pattern,_j,_len1,_ref2;for(_j=0,_len1=(_ref2=options.ajax.ignoreURLs).length;_j<_len1;_j++)if("string"==typeof(pattern=_ref2[_j])){if(-1!==url.indexOf(pattern))return!0}else if(pattern.test(url))return!0;return!1},(getIntercept=function(){return null==_intercept&&(_intercept=new RequestIntercept),_intercept})().on("request",(function(_arg){var after,args,request,type,url;if(type=_arg.type,request=_arg.request,url=_arg.url,!shouldIgnoreURL(url))return Pace.running||!1===options.restartOnRequestAfter&&"force"!==shouldTrack(type)?void 0:(args=arguments,"boolean"==typeof(after=options.restartOnRequestAfter||0)&&(after=0),setTimeout((function(){var _j,_len1,_ref2,_ref3,_results;if("socket"===type?request.readyState<1:0<(_ref2=request.readyState)&&_ref2<4){for(Pace.restart(),_results=[],_j=0,_len1=(_ref3=Pace.sources).length;_j<_len1;_j++){if((source=_ref3[_j])instanceof AjaxMonitor){source.watch.apply(source,args);break}_results.push(void 0)}return _results}}),after))})),AjaxMonitor=function(){function AjaxMonitor(){this.complete=__bind(this.complete,this);var _this=this;this.elements=[],getIntercept().on("request",(function(){return _this.watch.apply(_this,arguments)}))}return AjaxMonitor.prototype.watch=function(_arg){var request,tracker,type,url;if(type=_arg.type,request=_arg.request,url=_arg.url,!shouldIgnoreURL(url))return tracker="socket"===type?new SocketRequestTracker(request,this.complete):new XHRRequestTracker(request,this.complete),this.elements.push(tracker)},AjaxMonitor.prototype.complete=function(tracker){return this.elements=this.elements.filter((function(e){return e!==tracker}))},AjaxMonitor}(),XHRRequestTracker=function(request,completeCallback){var _j,_len1,_onreadystatechange,_ref2,_this=this;if(this.progress=0,null!=window.ProgressEvent)for(addEventListener(request,"progress",(function(evt){return evt.lengthComputable?_this.progress=100*evt.loaded/evt.total:_this.progress=_this.progress+(100-_this.progress)/2})),_j=0,_len1=(_ref2=["load","abort","timeout","error"]).length;_j<_len1;_j++)addEventListener(request,_ref2[_j],(function(){return completeCallback(_this),_this.progress=100}));else _onreadystatechange=request.onreadystatechange,request.onreadystatechange=function(){var _ref3;return 0===(_ref3=request.readyState)||4===_ref3?(completeCallback(_this),_this.progress=100):3===request.readyState&&(_this.progress=50),"function"==typeof _onreadystatechange?_onreadystatechange.apply(null,arguments):void 0}},SocketRequestTracker=function(request,completeCallback){var _j,_len1,_ref2,_this=this;for(this.progress=0,_j=0,_len1=(_ref2=["error","open"]).length;_j<_len1;_j++)addEventListener(request,_ref2[_j],(function(){return completeCallback(_this),_this.progress=100}))},ElementMonitor=function(){function ElementMonitor(options){var selector,_j,_len1,_ref2;for(null==options&&(options={}),this.complete=__bind(this.complete,this),this.elements=[],null==options.selectors&&(options.selectors=[]),_j=0,_len1=(_ref2=options.selectors).length;_j<_len1;_j++)selector=_ref2[_j],this.elements.push(new ElementTracker(selector,this.complete))}return ElementMonitor.prototype.complete=function(tracker){return this.elements=this.elements.filter((function(e){return e!==tracker}))},ElementMonitor}(),ElementTracker=function(){function ElementTracker(selector,completeCallback){this.selector=selector,this.completeCallback=completeCallback,this.progress=0,this.check()}return ElementTracker.prototype.check=function(){var _this=this;return document.querySelector(this.selector)?this.done():setTimeout((function(){return _this.check()}),options.elements.checkInterval)},ElementTracker.prototype.done=function(){return this.completeCallback(this),this.completeCallback=null,this.progress=100},ElementTracker}(),DocumentMonitor=function(){function DocumentMonitor(){var _onreadystatechange,_ref2,_this=this;this.progress=null!=(_ref2=this.states[document.readyState])?_ref2:100,_onreadystatechange=document.onreadystatechange,document.onreadystatechange=function(){return null!=_this.states[document.readyState]&&(_this.progress=_this.states[document.readyState]),"function"==typeof _onreadystatechange?_onreadystatechange.apply(null,arguments):void 0}}return DocumentMonitor.prototype.states={loading:0,interactive:50,complete:100},DocumentMonitor}(),EventLagMonitor=function(){var avg,interval,last,points,samples,_this=this;this.progress=0,avg=0,samples=[],points=0,last=now(),interval=setInterval((function(){var diff;return diff=now()-last-50,last=now(),samples.push(diff),samples.length>options.eventLag.sampleCount&&samples.shift(),avg=avgAmplitude(samples),++points>=options.eventLag.minSamples&&avg=100&&(this.done=!0),val===this.last?this.sinceLastUpdate+=frameTime:(this.sinceLastUpdate&&(this.rate=(val-this.last)/this.sinceLastUpdate),this.catchup=(val-this.progress)/options.catchupTime,this.sinceLastUpdate=0,this.last=val),val>this.progress&&(this.progress+=this.catchup*frameTime),scaling=1-Math.pow(this.progress/100,options.easeFactor),this.progress+=scaling*this.rate*frameTime,this.progress=Math.min(this.lastProgress+options.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},Scaler}(),sources=null,scalers=null,bar=null,uniScaler=null,animation=null,cancelAnimation=null,Pace.running=!1,handlePushState=function(){if(options.restartOnPushState)return Pace.restart()},null!=window.history.pushState&&(_pushState=window.history.pushState,window.history.pushState=function(){return handlePushState(),_pushState.apply(window.history,arguments)}),null!=window.history.replaceState&&(_replaceState=window.history.replaceState,window.history.replaceState=function(){return handlePushState(),_replaceState.apply(window.history,arguments)}),SOURCE_KEYS={ajax:AjaxMonitor,elements:ElementMonitor,document:DocumentMonitor,eventLag:EventLagMonitor},(init=function(){var type,_j,_k,_len1,_len2,_ref2,_ref3,_ref4;for(Pace.sources=sources=[],_j=0,_len1=(_ref2=["ajax","elements","document","eventLag"]).length;_j<_len1;_j++)!1!==options[type=_ref2[_j]]&&sources.push(new SOURCE_KEYS[type](options[type]));for(_k=0,_len2=(_ref4=null!=(_ref3=options.extraSources)?_ref3:[]).length;_k<_len2;_k++)source=_ref4[_k],sources.push(new source(options));return Pace.bar=bar=new Bar,scalers=[],uniScaler=new Scaler})(),Pace.stop=function(){return Pace.trigger("stop"),Pace.running=!1,bar.destroy(),cancelAnimation=!0,null!=animation&&("function"==typeof cancelAnimationFrame&&cancelAnimationFrame(animation),animation=null),init()},Pace.restart=function(){return Pace.trigger("restart"),Pace.stop(),Pace.start()},Pace.go=function(){var start;return Pace.running=!0,bar.render(),start=now(),cancelAnimation=!1,animation=runAnimation((function(frameTime,enqueueNextFrame){var avg,count,done,element,elements,i,j,scaler,scalerList,sum,_j,_k,_len1,_len2,_ref2;for(100-bar.progress,count=sum=0,done=!0,i=_j=0,_len1=sources.length;_j<_len1;i=++_j)for(source=sources[i],scalerList=null!=scalers[i]?scalers[i]:scalers[i]=[],j=_k=0,_len2=(elements=null!=(_ref2=source.elements)?_ref2:[source]).length;_k<_len2;j=++_k)element=elements[j],done&=(scaler=null!=scalerList[j]?scalerList[j]:scalerList[j]=new Scaler(element)).done,scaler.done||(count++,sum+=scaler.tick(frameTime));return avg=sum/count,bar.update(uniScaler.tick(frameTime,avg)),bar.done()||done||cancelAnimation?(bar.update(100),Pace.trigger("done"),setTimeout((function(){return bar.finish(),Pace.running=!1,Pace.trigger("hide")}),Math.max(options.ghostTime,Math.max(options.minTime-(now()-start),0)))):enqueueNextFrame()}))},Pace.start=function(_options){extend(options,_options),Pace.running=!0;try{bar.render()}catch(_error){NoTargetError=_error}return document.querySelector(".pace")?(Pace.trigger("start"),Pace.go()):setTimeout(Pace.start,50)},"function"==typeof define&&define.amd?define("theme_adaptable/pace",(function(){return Pace})):"object"==typeof exports?module.exports=Pace:options.startOnPageLoad&&Pace.start()}).call(window); + +//# sourceMappingURL=pace.min.js.map \ No newline at end of file diff --git a/amd/build/pace.min.js.map b/amd/build/pace.min.js.map new file mode 100644 index 0000000..ecb3366 --- /dev/null +++ b/amd/build/pace.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pace.min.js","sources":["../src/pace.js"],"sourcesContent":["/*!\n * pace.js v1.2.4\n * https://github.com/CodeByZach/pace/\n * Licensed MIT © HubSpot, Inc.\n */\n(function() {\n var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Evented, Events, NoTargetError, Pace, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, addEventListener, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldIgnoreURL, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState,\n __slice = [].slice,\n __hasProp = {}.hasOwnProperty,\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },\n __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n defaultOptions = {\n className: '',\n catchupTime: 100,\n initialRate: .03,\n minTime: 250,\n ghostTime: 100,\n maxProgressPerFrame: 20,\n easeFactor: 1.25,\n startOnPageLoad: true,\n restartOnPushState: true,\n restartOnRequestAfter: 500,\n target: 'body',\n elements: {\n checkInterval: 100,\n selectors: ['body']\n },\n eventLag: {\n minSamples: 10,\n sampleCount: 3,\n lagThreshold: 3\n },\n ajax: {\n trackMethods: ['GET'],\n trackWebSockets: true,\n ignoreURLs: []\n }\n };\n\n now = function() {\n var _ref;\n return (_ref = typeof performance !== \"undefined\" && performance !== null ? typeof performance.now === \"function\" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date);\n };\n\n requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;\n\n cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;\n\n addEventListener = function(obj, event, callback) {\n if (typeof obj.addEventListener === \"function\") {\n return obj.addEventListener(event, callback, false);\n } else {\n return function() {\n if (typeof obj[\"on\" + event] !== \"function\" || typeof obj[\"on\" + event].eventListeners !== \"object\") {\n var eventListeners = new Events();\n if (typeof obj[\"on\" + event] === \"function\") {\n eventListeners.on(event, obj[\"on\" + event]);\n }\n obj[\"on\" + event] = function(evt) {\n return eventListeners.trigger(event, evt);\n };\n obj[\"on\" + event].eventListeners = eventListeners;\n } else {\n var eventListeners = obj[\"on\" + event].eventListeners;\n }\n eventListeners.on(event, callback);\n }();\n }\n };\n\n if (requestAnimationFrame == null) {\n requestAnimationFrame = function(fn) {\n return setTimeout(fn, 50);\n };\n cancelAnimationFrame = function(id) {\n return clearTimeout(id);\n };\n }\n\n runAnimation = function(fn) {\n var last, tick;\n last = now();\n tick = function() {\n var diff;\n diff = now() - last;\n if (diff >= 33) {\n last = now();\n return fn(diff, function() {\n return requestAnimationFrame(tick);\n });\n } else {\n return setTimeout(tick, 33 - diff);\n }\n };\n return tick();\n };\n\n result = function() {\n var args, key, obj;\n obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];\n if (typeof obj[key] === 'function') {\n return obj[key].apply(obj, args);\n } else {\n return obj[key];\n }\n };\n\n extend = function() {\n var key, out, source, sources, val, _i, _len;\n out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n for (_i = 0, _len = sources.length; _i < _len; _i++) {\n source = sources[_i];\n if (source) {\n for (key in source) {\n if (!__hasProp.call(source, key)) continue;\n val = source[key];\n if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') {\n extend(out[key], val);\n } else {\n out[key] = val;\n }\n }\n }\n }\n return out;\n };\n\n avgAmplitude = function(arr) {\n var count, sum, v, _i, _len;\n sum = count = 0;\n for (_i = 0, _len = arr.length; _i < _len; _i++) {\n v = arr[_i];\n sum += Math.abs(v);\n count++;\n }\n return sum / count;\n };\n\n getFromDOM = function(key, json) {\n var data, e, el;\n if (key == null) {\n key = 'options';\n }\n if (json == null) {\n json = true;\n }\n el = document.querySelector(\"[data-pace-\" + key + \"]\");\n if (!el) {\n return;\n }\n data = el.getAttribute(\"data-pace-\" + key);\n if (!json) {\n return data;\n }\n try {\n return JSON.parse(data);\n } catch (_error) {\n e = _error;\n return typeof console !== \"undefined\" && console !== null ? console.error(\"Error parsing inline pace options\", e) : void 0;\n }\n };\n\n Evented = (function() {\n function Evented() {}\n\n Evented.prototype.on = function(event, handler, ctx, once) {\n var _base;\n if (once == null) {\n once = false;\n }\n if (this.bindings == null) {\n this.bindings = {};\n }\n if ((_base = this.bindings)[event] == null) {\n _base[event] = [];\n }\n return this.bindings[event].push({\n handler: handler,\n ctx: ctx,\n once: once\n });\n };\n\n Evented.prototype.once = function(event, handler, ctx) {\n return this.on(event, handler, ctx, true);\n };\n\n Evented.prototype.off = function(event, handler) {\n var i, _ref, _results;\n if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {\n return;\n }\n if (handler == null) {\n return delete this.bindings[event];\n } else {\n i = 0;\n _results = [];\n while (i < this.bindings[event].length) {\n if (this.bindings[event][i].handler === handler) {\n _results.push(this.bindings[event].splice(i, 1));\n } else {\n _results.push(i++);\n }\n }\n return _results;\n }\n };\n\n Evented.prototype.trigger = function() {\n var args, ctx, event, handler, i, once, _ref, _ref1, _results;\n event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n if ((_ref = this.bindings) != null ? _ref[event] : void 0) {\n i = 0;\n _results = [];\n while (i < this.bindings[event].length) {\n _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;\n handler.apply(ctx != null ? ctx : this, args);\n if (once) {\n _results.push(this.bindings[event].splice(i, 1));\n } else {\n _results.push(i++);\n }\n }\n return _results;\n }\n };\n\n return Evented;\n\n })();\n\n Pace = window.Pace || {};\n\n window.Pace = Pace;\n\n extend(Pace, Evented.prototype);\n\n options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM());\n\n _ref = ['ajax', 'document', 'eventLag', 'elements'];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n source = _ref[_i];\n if (options[source] === true) {\n options[source] = defaultOptions[source];\n }\n }\n\n NoTargetError = (function(_super) {\n __extends(NoTargetError, _super);\n\n function NoTargetError() {\n _ref1 = NoTargetError.__super__.constructor.apply(this, arguments);\n return _ref1;\n }\n\n return NoTargetError;\n\n })(Error);\n\n Bar = (function() {\n function Bar() {\n this.progress = 0;\n }\n\n Bar.prototype.getElement = function() {\n var targetElement;\n if (this.el == null) {\n targetElement = document.querySelector(options.target);\n if (!targetElement) {\n throw new NoTargetError;\n }\n this.el = document.createElement('div');\n this.el.className = \"pace pace-active\";\n document.body.className = document.body.className.replace(/(pace-done )|/, 'pace-running ');\n var _custom_class_name = (options.className !== '') ? ' '+options.className : '';\n this.el.innerHTML = '
      \\n
      \\n
      \\n
      ';\n if (targetElement.firstChild != null) {\n targetElement.insertBefore(this.el, targetElement.firstChild);\n } else {\n targetElement.appendChild(this.el);\n }\n }\n return this.el;\n };\n\n Bar.prototype.finish = function() {\n var el;\n el = this.getElement();\n el.className = el.className.replace('pace-active', 'pace-inactive');\n return document.body.className = document.body.className.replace('pace-running ', 'pace-done ');\n };\n\n Bar.prototype.update = function(prog) {\n this.progress = prog;\n Pace.trigger('progress', prog);\n return this.render();\n };\n\n Bar.prototype.destroy = function() {\n try {\n this.getElement().parentNode.removeChild(this.getElement());\n } catch (_error) {\n NoTargetError = _error;\n }\n return this.el = void 0;\n };\n\n Bar.prototype.render = function() {\n var el, key, progressStr, transform, _j, _len1, _ref2;\n if (document.querySelector(options.target) == null) {\n return false;\n }\n el = this.getElement();\n transform = \"translate3d(\" + this.progress + \"%, 0, 0)\";\n _ref2 = ['webkitTransform', 'msTransform', 'transform'];\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n key = _ref2[_j];\n el.children[0].style[key] = transform;\n }\n if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) {\n el.children[0].setAttribute('data-progress-text', \"\" + (this.progress | 0) + \"%\");\n if (this.progress >= 100) {\n progressStr = '99';\n } else {\n progressStr = this.progress < 10 ? \"0\" : \"\";\n progressStr += this.progress | 0;\n }\n el.children[0].setAttribute('data-progress', \"\" + progressStr);\n }\n Pace.trigger('change', this.progress);\n return this.lastRenderedProgress = this.progress;\n };\n\n Bar.prototype.done = function() {\n return this.progress >= 100;\n };\n\n return Bar;\n\n })();\n\n Events = (function() {\n function Events() {\n this.bindings = {};\n }\n\n Events.prototype.trigger = function(name, val) {\n var binding, _j, _len1, _ref2, _results;\n if (this.bindings[name] != null) {\n _ref2 = this.bindings[name];\n _results = [];\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n binding = _ref2[_j];\n _results.push(binding.call(this, val));\n }\n return _results;\n }\n };\n\n Events.prototype.on = function(name, fn) {\n var _base;\n if ((_base = this.bindings)[name] == null) {\n _base[name] = [];\n }\n return this.bindings[name].push(fn);\n };\n\n return Events;\n\n })();\n\n _XMLHttpRequest = window.XMLHttpRequest;\n\n _XDomainRequest = window.XDomainRequest;\n\n _WebSocket = window.WebSocket;\n\n extendNative = function(to, from) {\n var e, key, _results;\n _results = [];\n for (key in from.prototype) {\n try {\n if ((to[key] == null) && typeof from[key] !== 'function') {\n if (typeof Object.defineProperty === 'function') {\n _results.push(Object.defineProperty(to, key, {\n get: (function(key) {\n return function() {\n return from.prototype[key];\n };\n })(key),\n configurable: true,\n enumerable: true\n }));\n } else {\n _results.push(to[key] = from.prototype[key]);\n }\n } else {\n _results.push(void 0);\n }\n } catch (_error) {\n e = _error;\n }\n }\n return _results;\n };\n\n ignoreStack = [];\n\n Pace.ignore = function() {\n var args, fn, ret;\n fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n ignoreStack.unshift('ignore');\n ret = fn.apply(null, args);\n ignoreStack.shift();\n return ret;\n };\n\n Pace.track = function() {\n var args, fn, ret;\n fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n ignoreStack.unshift('track');\n ret = fn.apply(null, args);\n ignoreStack.shift();\n return ret;\n };\n\n shouldTrack = function(method) {\n var _ref2;\n if (method == null) {\n method = 'GET';\n }\n if (ignoreStack[0] === 'track') {\n return 'force';\n }\n if (!ignoreStack.length && options.ajax) {\n if (method === 'socket' && options.ajax.trackWebSockets) {\n return true;\n } else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) {\n return true;\n }\n }\n return false;\n };\n\n RequestIntercept = (function(_super) {\n __extends(RequestIntercept, _super);\n\n function RequestIntercept() {\n var monitorXHR,\n _this = this;\n RequestIntercept.__super__.constructor.apply(this, arguments);\n monitorXHR = function(req) {\n var _open;\n _open = req.open;\n return req.open = function(type, url, async) {\n if (shouldTrack(type)) {\n _this.trigger('request', {\n type: type,\n url: url,\n request: req\n });\n }\n return _open.apply(req, arguments);\n };\n };\n window.XMLHttpRequest = function(flags) {\n var req;\n req = new _XMLHttpRequest(flags);\n monitorXHR(req);\n return req;\n };\n try {\n extendNative(window.XMLHttpRequest, _XMLHttpRequest);\n } catch (_error) {}\n if (_XDomainRequest != null) {\n window.XDomainRequest = function() {\n var req;\n req = new _XDomainRequest;\n monitorXHR(req);\n return req;\n };\n try {\n extendNative(window.XDomainRequest, _XDomainRequest);\n } catch (_error) {}\n }\n if ((_WebSocket != null) && options.ajax.trackWebSockets) {\n window.WebSocket = function(url, protocols) {\n var req;\n if (protocols != null) {\n req = new _WebSocket(url, protocols);\n } else {\n req = new _WebSocket(url);\n }\n if (shouldTrack('socket')) {\n _this.trigger('request', {\n type: 'socket',\n url: url,\n protocols: protocols,\n request: req\n });\n }\n return req;\n };\n try {\n extendNative(window.WebSocket, _WebSocket);\n } catch (_error) {}\n }\n }\n\n return RequestIntercept;\n\n })(Events);\n\n _intercept = null;\n\n getIntercept = function() {\n if (_intercept == null) {\n _intercept = new RequestIntercept;\n }\n return _intercept;\n };\n\n shouldIgnoreURL = function(url) {\n var pattern, _j, _len1, _ref2;\n _ref2 = options.ajax.ignoreURLs;\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n pattern = _ref2[_j];\n if (typeof pattern === 'string') {\n if (url.indexOf(pattern) !== -1) {\n return true;\n }\n } else {\n if (pattern.test(url)) {\n return true;\n }\n }\n }\n return false;\n };\n\n getIntercept().on('request', function(_arg) {\n var after, args, request, type, url;\n type = _arg.type, request = _arg.request, url = _arg.url;\n if (shouldIgnoreURL(url)) {\n return;\n }\n if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) {\n args = arguments;\n after = options.restartOnRequestAfter || 0;\n if (typeof after === 'boolean') {\n after = 0;\n }\n return setTimeout(function() {\n var stillActive, _j, _len1, _ref2, _ref3, _results;\n if (type === 'socket') {\n stillActive = request.readyState < 1;\n } else {\n stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);\n }\n if (stillActive) {\n Pace.restart();\n _ref3 = Pace.sources;\n _results = [];\n for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {\n source = _ref3[_j];\n if (source instanceof AjaxMonitor) {\n source.watch.apply(source, args);\n break;\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n }, after);\n }\n });\n\n AjaxMonitor = (function() {\n function AjaxMonitor() {\n this.complete = __bind(this.complete, this);\n var _this = this;\n this.elements = [];\n getIntercept().on('request', function() {\n return _this.watch.apply(_this, arguments);\n });\n }\n\n AjaxMonitor.prototype.watch = function(_arg) {\n var request, tracker, type, url;\n type = _arg.type, request = _arg.request, url = _arg.url;\n if (shouldIgnoreURL(url)) {\n return;\n }\n if (type === 'socket') {\n tracker = new SocketRequestTracker(request, this.complete);\n } else {\n tracker = new XHRRequestTracker(request, this.complete);\n }\n return this.elements.push(tracker);\n };\n\n AjaxMonitor.prototype.complete = function(tracker) {\n return this.elements = this.elements.filter(function(e) {\n return e !== tracker;\n });\n };\n\n return AjaxMonitor;\n\n })();\n\n XHRRequestTracker = (function() {\n function XHRRequestTracker(request, completeCallback) {\n var event, size, _j, _len1, _onreadystatechange, _ref2,\n _this = this;\n this.progress = 0;\n if (window.ProgressEvent != null) {\n size = null;\n addEventListener(request, 'progress', function(evt) {\n if (evt.lengthComputable) {\n return _this.progress = 100 * evt.loaded / evt.total;\n } else {\n return _this.progress = _this.progress + (100 - _this.progress) / 2;\n }\n }, false);\n _ref2 = ['load', 'abort', 'timeout', 'error'];\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n event = _ref2[_j];\n addEventListener(request, event, function() {\n completeCallback(_this);\n return _this.progress = 100;\n }, false);\n }\n } else {\n _onreadystatechange = request.onreadystatechange;\n request.onreadystatechange = function() {\n var _ref3;\n if ((_ref3 = request.readyState) === 0 || _ref3 === 4) {\n completeCallback(_this);\n _this.progress = 100;\n } else if (request.readyState === 3) {\n _this.progress = 50;\n }\n return typeof _onreadystatechange === \"function\" ? _onreadystatechange.apply(null, arguments) : void 0;\n };\n }\n }\n\n return XHRRequestTracker;\n\n })();\n\n SocketRequestTracker = (function() {\n function SocketRequestTracker(request, completeCallback) {\n var event, _j, _len1, _ref2,\n _this = this;\n this.progress = 0;\n _ref2 = ['error', 'open'];\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n event = _ref2[_j];\n addEventListener(request, event, function() {\n completeCallback(_this);\n return _this.progress = 100;\n }, false);\n }\n }\n\n return SocketRequestTracker;\n\n })();\n\n ElementMonitor = (function() {\n function ElementMonitor(options) {\n var selector, _j, _len1, _ref2;\n if (options == null) {\n options = {};\n }\n this.complete = __bind(this.complete, this);\n this.elements = [];\n if (options.selectors == null) {\n options.selectors = [];\n }\n _ref2 = options.selectors;\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n selector = _ref2[_j];\n this.elements.push(new ElementTracker(selector, this.complete));\n }\n }\n\n ElementMonitor.prototype.complete = function(tracker) {\n return this.elements = this.elements.filter(function(e) {\n return e !== tracker;\n });\n };\n\n return ElementMonitor;\n\n })();\n\n ElementTracker = (function() {\n function ElementTracker(selector, completeCallback) {\n this.selector = selector;\n this.completeCallback = completeCallback;\n this.progress = 0;\n this.check();\n }\n\n ElementTracker.prototype.check = function() {\n var _this = this;\n if (document.querySelector(this.selector)) {\n return this.done();\n } else {\n return setTimeout((function() {\n return _this.check();\n }), options.elements.checkInterval);\n }\n };\n\n ElementTracker.prototype.done = function() {\n this.completeCallback(this);\n this.completeCallback = null;\n return this.progress = 100;\n };\n\n return ElementTracker;\n\n })();\n\n DocumentMonitor = (function() {\n DocumentMonitor.prototype.states = {\n loading: 0,\n interactive: 50,\n complete: 100\n };\n\n function DocumentMonitor() {\n var _onreadystatechange, _ref2,\n _this = this;\n this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100;\n _onreadystatechange = document.onreadystatechange;\n document.onreadystatechange = function() {\n if (_this.states[document.readyState] != null) {\n _this.progress = _this.states[document.readyState];\n }\n return typeof _onreadystatechange === \"function\" ? _onreadystatechange.apply(null, arguments) : void 0;\n };\n }\n\n return DocumentMonitor;\n\n })();\n\n EventLagMonitor = (function() {\n function EventLagMonitor() {\n var avg, interval, last, points, samples,\n _this = this;\n this.progress = 0;\n avg = 0;\n samples = [];\n points = 0;\n last = now();\n interval = setInterval(function() {\n var diff;\n diff = now() - last - 50;\n last = now();\n samples.push(diff);\n if (samples.length > options.eventLag.sampleCount) {\n samples.shift();\n }\n avg = avgAmplitude(samples);\n if (++points >= options.eventLag.minSamples && avg < options.eventLag.lagThreshold) {\n _this.progress = 100;\n return clearInterval(interval);\n } else {\n return _this.progress = 100 * (3 / (avg + 3));\n }\n }, 50);\n }\n\n return EventLagMonitor;\n\n })();\n\n Scaler = (function() {\n function Scaler(source) {\n this.source = source;\n this.last = this.sinceLastUpdate = 0;\n this.rate = options.initialRate;\n this.catchup = 0;\n this.progress = this.lastProgress = 0;\n if (this.source != null) {\n this.progress = result(this.source, 'progress');\n }\n }\n\n Scaler.prototype.tick = function(frameTime, val) {\n var scaling;\n if (val == null) {\n val = result(this.source, 'progress');\n }\n if (val >= 100) {\n this.done = true;\n }\n if (val === this.last) {\n this.sinceLastUpdate += frameTime;\n } else {\n if (this.sinceLastUpdate) {\n this.rate = (val - this.last) / this.sinceLastUpdate;\n }\n this.catchup = (val - this.progress) / options.catchupTime;\n this.sinceLastUpdate = 0;\n this.last = val;\n }\n if (val > this.progress) {\n this.progress += this.catchup * frameTime;\n }\n scaling = 1 - Math.pow(this.progress / 100, options.easeFactor);\n this.progress += scaling * this.rate * frameTime;\n this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress);\n this.progress = Math.max(0, this.progress);\n this.progress = Math.min(100, this.progress);\n this.lastProgress = this.progress;\n return this.progress;\n };\n\n return Scaler;\n\n })();\n\n sources = null;\n\n scalers = null;\n\n bar = null;\n\n uniScaler = null;\n\n animation = null;\n\n cancelAnimation = null;\n\n Pace.running = false;\n\n handlePushState = function() {\n if (options.restartOnPushState) {\n return Pace.restart();\n }\n };\n\n if (window.history.pushState != null) {\n _pushState = window.history.pushState;\n window.history.pushState = function() {\n handlePushState();\n return _pushState.apply(window.history, arguments);\n };\n }\n\n if (window.history.replaceState != null) {\n _replaceState = window.history.replaceState;\n window.history.replaceState = function() {\n handlePushState();\n return _replaceState.apply(window.history, arguments);\n };\n }\n\n SOURCE_KEYS = {\n ajax: AjaxMonitor,\n elements: ElementMonitor,\n document: DocumentMonitor,\n eventLag: EventLagMonitor\n };\n\n (init = function() {\n var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;\n Pace.sources = sources = [];\n _ref2 = ['ajax', 'elements', 'document', 'eventLag'];\n for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {\n type = _ref2[_j];\n if (options[type] !== false) {\n sources.push(new SOURCE_KEYS[type](options[type]));\n }\n }\n _ref4 = (_ref3 = options.extraSources) != null ? _ref3 : [];\n for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {\n source = _ref4[_k];\n sources.push(new source(options));\n }\n Pace.bar = bar = new Bar;\n scalers = [];\n return uniScaler = new Scaler;\n })();\n\n Pace.stop = function() {\n Pace.trigger('stop');\n Pace.running = false;\n bar.destroy();\n cancelAnimation = true;\n if (animation != null) {\n if (typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(animation);\n }\n animation = null;\n }\n return init();\n };\n\n Pace.restart = function() {\n Pace.trigger('restart');\n Pace.stop();\n return Pace.start();\n };\n\n Pace.go = function() {\n var start;\n Pace.running = true;\n bar.render();\n start = now();\n cancelAnimation = false;\n return animation = runAnimation(function(frameTime, enqueueNextFrame) {\n var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2;\n remaining = 100 - bar.progress;\n count = sum = 0;\n done = true;\n for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) {\n source = sources[i];\n scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];\n elements = (_ref2 = source.elements) != null ? _ref2 : [source];\n for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) {\n element = elements[j];\n scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);\n done &= scaler.done;\n if (scaler.done) {\n continue;\n }\n count++;\n sum += scaler.tick(frameTime);\n }\n }\n avg = sum / count;\n bar.update(uniScaler.tick(frameTime, avg));\n if (bar.done() || done || cancelAnimation) {\n bar.update(100);\n Pace.trigger('done');\n return setTimeout(function() {\n bar.finish();\n Pace.running = false;\n return Pace.trigger('hide');\n }, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0)));\n } else {\n return enqueueNextFrame();\n }\n });\n };\n\n Pace.start = function(_options) {\n extend(options, _options);\n Pace.running = true;\n try {\n bar.render();\n } catch (_error) {\n NoTargetError = _error;\n }\n if (!document.querySelector('.pace')) {\n return setTimeout(Pace.start, 50);\n } else {\n Pace.trigger('start');\n return Pace.go();\n }\n };\n\n if (typeof define === 'function' && define.amd) {\n define(function() {\n return Pace;\n });\n } else if (typeof exports === 'object') {\n module.exports = Pace;\n } else {\n if (options.startOnPageLoad) {\n Pace.start();\n }\n }\n\n}).call(this);"],"names":["AjaxMonitor","Bar","DocumentMonitor","ElementMonitor","ElementTracker","EventLagMonitor","Evented","Events","NoTargetError","Pace","RequestIntercept","SOURCE_KEYS","Scaler","SocketRequestTracker","XHRRequestTracker","addEventListener","animation","avgAmplitude","bar","cancelAnimation","cancelAnimationFrame","defaultOptions","extend","extendNative","getFromDOM","getIntercept","handlePushState","ignoreStack","init","now","options","requestAnimationFrame","result","runAnimation","scalers","shouldIgnoreURL","shouldTrack","source","sources","uniScaler","_WebSocket","_XDomainRequest","_XMLHttpRequest","_i","_intercept","_len","_pushState","_ref","_replaceState","__slice","slice","__hasProp","hasOwnProperty","__extends","child","parent","key","call","ctor","constructor","prototype","__super__","__indexOf","indexOf","item","i","l","this","length","__bind","fn","me","apply","arguments","className","catchupTime","initialRate","minTime","ghostTime","maxProgressPerFrame","easeFactor","startOnPageLoad","restartOnPushState","restartOnRequestAfter","target","elements","checkInterval","selectors","eventLag","minSamples","sampleCount","lagThreshold","ajax","trackMethods","trackWebSockets","ignoreURLs","performance","Date","window","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","mozCancelAnimationFrame","obj","event","callback","eventListeners","on","evt","trigger","setTimeout","id","clearTimeout","last","tick","diff","args","out","val","arr","count","sum","v","Math","abs","json","data","e","el","document","querySelector","getAttribute","JSON","parse","_error","console","error","handler","ctx","once","_base","bindings","push","off","_results","splice","_ref1","paceOptions","_super","Error","progress","getElement","targetElement","createElement","body","replace","_custom_class_name","innerHTML","firstChild","insertBefore","appendChild","finish","update","prog","render","destroy","parentNode","removeChild","progressStr","transform","_j","_len1","_ref2","children","style","lastRenderedProgress","setAttribute","done","name","binding","XMLHttpRequest","XDomainRequest","WebSocket","to","from","Object","defineProperty","get","configurable","enumerable","ignore","ret","unshift","shift","track","method","toUpperCase","monitorXHR","_this","req","_open","open","type","url","async","request","flags","protocols","pattern","test","_arg","after","running","_ref3","readyState","restart","watch","complete","tracker","filter","completeCallback","_onreadystatechange","ProgressEvent","lengthComputable","loaded","total","onreadystatechange","selector","check","states","loading","interactive","avg","interval","points","samples","setInterval","clearInterval","sinceLastUpdate","rate","catchup","lastProgress","frameTime","scaling","pow","min","max","history","pushState","replaceState","_k","_len2","_ref4","extraSources","stop","start","go","enqueueNextFrame","element","j","scaler","scalerList","_options","define","amd","exports","module"],"mappings":"CAKA,eACQA,YAAaC,IAAKC,gBAAiBC,eAAgBC,eAAgBC,gBAAiBC,QAASC,OAAQC,cAAeC,KAAMC,iBAAkBC,YAAaC,OAAQC,qBAAsBC,kBAAmBC,iBAAkBC,UAAWC,aAAcC,IAAKC,gBAAiBC,qBAAsBC,eAAgBC,OAAQC,aAAcC,WAAYC,aAAcC,gBAAiBC,YAAaC,KAAMC,I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,KAAKoG,QAAQ,SACNpG,KAAKuP,MAHLlJ,WAAWrG,KAAKsP,MAAO,KAOhB,mBAAXQ,QAAyBA,OAAOC,IACvCD,+BAAO,kBACI9P,QAEe,iBAAZgQ,QACdC,OAAOD,QAAUhQ,KAEbqB,QAAQmD,iBACRxE,KAAKsP,UAIdtM,KAAKU"} \ No newline at end of file diff --git a/amd/build/savebutton.min.js b/amd/build/savebutton.min.js index f8cba41..ab90475 100644 --- a/amd/build/savebutton.min.js +++ b/amd/build/savebutton.min.js @@ -1,4 +1,5 @@ +define("theme_adaptable/savebutton",["exports","jquery","core/log"],(function(_exports,_jquery,_log){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} // @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. -define("theme_adaptable/savebutton",["jquery","core/log"],(function($,log){return log.debug("Adaptable savebutton.js function called"),{init:function(){$(document).ready((function($){$("#savediscardsection").hide(),$("#adminsettings :input").on("change input",(function(){$("#savediscardsection").fadeIn("slow")})),$("#adminsubmitbutton").click((function(){window.onbeforeunload=null,$("#adminsettings").submit()})),$("#adminresetbutton").click((function(){1==confirm("This resets any changes made since loading this page. Are you sure?")&&($("#adminsettings")[0].reset(),$("#savediscardsection").hide())})),$(".colourdialogue").click((function(){$("#savediscardsection").fadeIn("slow")}))}))}}})); +Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.saveButtonInit=void 0,_jquery=_interopRequireDefault(_jquery),_log=_interopRequireDefault(_log);const saveButton=()=>{(0,_jquery.default)("#savediscardsection").hide(),(0,_jquery.default)("#adminsettings :input").on("change input",(function(){(0,_jquery.default)("#savediscardsection").fadeIn("slow")})),(0,_jquery.default)("#adminsubmitbutton").click((function(){window.onbeforeunload=null,(0,_jquery.default)("#adminsettings").submit()})),(0,_jquery.default)("#adminresetbutton").click((function(){var confirmString=(0,_jquery.default)(this).data("confirm");1==confirm(confirmString)&&((0,_jquery.default)("#adminsettings")[0].reset(),(0,_jquery.default)("#savediscardsection").hide())})),(0,_jquery.default)(".colourdialogue").click((function(){(0,_jquery.default)("#savediscardsection").fadeIn("slow")}))};_exports.saveButtonInit=()=>{_log.default.debug("Adaptable ES6 Save button Init"),"loading"!==document.readyState?(_log.default.debug("Adaptable ES6 Save button Init DOM content already loaded"),saveButton()):(_log.default.debug("Adaptable ES6 Save button Init JS DOM content not loaded"),document.addEventListener("DOMContentLoaded",(function(){_log.default.debug("Adaptable ES6 Save button Init JS DOM content loaded"),saveButton()})))}})); //# sourceMappingURL=savebutton.min.js.map \ No newline at end of file diff --git a/amd/build/savebutton.min.js.map b/amd/build/savebutton.min.js.map new file mode 100644 index 0000000..14eb5e6 --- /dev/null +++ b/amd/build/savebutton.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"savebutton.min.js","sources":["../src/savebutton.js"],"sourcesContent":["//\n// This file is part of Adaptable theme for moodle\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// Adaptable save button JS file\n//\n// @package theme_adaptable\n// @copyright 2015-2019 Jeremy Hopkins (Coventry University)\n// @copyright 2015-2019 Fernando Acedo (3-bits.com)\n// @copyright 2018-2019 Manoj Solanki (Coventry University)\n// @copyright 2019 G J Barnard\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport $ from 'jquery';\nimport log from 'core/log';\n\n/**\n * Save button.\n */\nconst saveButton = () => {\n $(\"#savediscardsection\").hide();\n\n $('#adminsettings :input').on('change input', function () {\n $(\"#savediscardsection\").fadeIn('slow');\n });\n\n $(\"#adminsubmitbutton\").click(function () {\n window.onbeforeunload = null;\n $(\"#adminsettings\").submit();\n });\n $(\"#adminresetbutton\").click(function () {\n var confirmString = $(this).data('confirm'); // Saves an AJAX call for such a rare thing.\n var result = confirm(confirmString);\n if (result == true) {\n $('#adminsettings')[0].reset();\n $(\"#savediscardsection\").hide();\n }\n });\n\n $(\".colourdialogue\").click(function () {\n $(\"#savediscardsection\").fadeIn('slow');\n });\n};\n\n/**\n * Init.\n */\nexport const saveButtonInit = () => {\n log.debug('Adaptable ES6 Save button Init');\n\n if (document.readyState !== 'loading') {\n log.debug(\"Adaptable ES6 Save button Init DOM content already loaded\");\n saveButton();\n } else {\n log.debug(\"Adaptable ES6 Save button Init JS DOM content not loaded\");\n document.addEventListener('DOMContentLoaded', function () {\n log.debug(\"Adaptable ES6 Save button Init JS DOM content loaded\");\n saveButton();\n });\n }\n};\n"],"names":["saveButton","hide","on","fadeIn","click","window","onbeforeunload","submit","confirmString","this","data","confirm","reset","debug","document","readyState","addEventListener"],"mappings":";;uKAmCMA,WAAa,yBACb,uBAAuBC,2BAEvB,yBAAyBC,GAAG,gBAAgB,+BACxC,uBAAuBC,OAAO,+BAGlC,sBAAsBC,OAAM,WAC1BC,OAAOC,eAAiB,yBACtB,kBAAkBC,gCAEtB,qBAAqBH,OAAM,eACrBI,eAAgB,mBAAEC,MAAMC,KAAK,WAEnB,GADDC,QAAQH,qCAEf,kBAAkB,GAAGI,4BACrB,uBAAuBX,+BAI/B,mBAAmBG,OAAM,+BACrB,uBAAuBD,OAAO,oCAOV,kBACtBU,MAAM,kCAEkB,YAAxBC,SAASC,yBACLF,MAAM,6DACVb,4BAEIa,MAAM,4DACVC,SAASE,iBAAiB,oBAAoB,wBACtCH,MAAM,wDACVb"} \ No newline at end of file diff --git a/amd/build/slider.min.js b/amd/build/slider.min.js new file mode 100644 index 0000000..a970573 --- /dev/null +++ b/amd/build/slider.min.js @@ -0,0 +1,5 @@ +define("theme_adaptable/slider",["exports","jquery","theme_adaptable/flexslider","core/log"],(function(_exports,_jquery,_flexslider,_log){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=_interopRequireDefault(_jquery),_log=_interopRequireDefault(_log);_exports.init=()=>{const sliderInit=()=>{(0,_flexslider.flexslider)(),(0,_jquery.default)("#main-slider").length&&((0,_jquery.default)("#main-slider").flexslider({namespace:"flex-",selector:".slides > li",animation:"slide",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,pauseOnAction:!0,pauseOnHover:!1,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:""}),(0,_jquery.default)(".container.slidewrap").length&&(0,_jquery.default)(".container.slidewrap").on("transitionend",(function(){(0,_jquery.default)("#main-slider").data("flexslider").resize()})))};"loading"!==document.readyState?(_log.default.debug("Adaptable ES6 Slider JS DOM content already loaded"),sliderInit()):(_log.default.debug("Adaptable ES6 Slider JS DOM content not loaded"),document.addEventListener("DOMContentLoaded",(function(){_log.default.debug("Adaptable ES6 Slider JS DOM content loaded"),sliderInit()})))}})); + +//# sourceMappingURL=slider.min.js.map \ No newline at end of file diff --git a/amd/build/slider.min.js.map b/amd/build/slider.min.js.map new file mode 100644 index 0000000..c6630ed --- /dev/null +++ b/amd/build/slider.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"slider.min.js","sources":["../src/slider.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// Slider\n//\n// @module theme_adaptable/slider\n// @copyright 2024 G J Barnard.\n// @author G J Barnard -\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport $ from 'jquery';\nimport { flexslider } from 'theme_adaptable/flexslider';\nimport log from 'core/log';\n\n/**\n * Initialise this module.\n */\nexport const init = () => {\n\n const sliderInit = () => {\n flexslider();\n\n // Slider.\n if ($('#main-slider').length) {\n $('#main-slider').flexslider({\n namespace: \"flex-\", // New: {NEW} String: Prefix string attached to the class of every element generated by the plugin.\n selector: \".slides > li\", // New: {NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril\n animation: \"slide\", // String: Select your animation type, \"fade\" or \"slide\".\n easing: \"swing\", // {NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!\n direction: \"horizontal\", // String: Select the sliding direction, \"horizontal\" or \"vertical\".\n reverse: false, // {NEW} Boolean: Reverse the animation direction.\n animationLoop: true, // Boolean: Should the animation loop? If false, directionNav will received \"disable\" classes at either end.\n smoothHeight: false, // {NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode.\n startAt: 0, // Integer: The slide that the slider should start on. Array notation (0 = first slide).\n slideshow: true, // Boolean: Animate slider automatically.\n slideshowSpeed: 7000, // Integer: Set the speed of the slideshow cycling, in milliseconds.\n animationSpeed: 600, // Integer: Set the speed of animations, in milliseconds.\n initDelay: 0, // {NEW} Integer: Set an initialization delay, in milliseconds.\n randomize: false, // Boolean: Randomize slide order.\n\n // Usability features.\n pauseOnAction: true, // Boolean: Pause the slideshow when interacting with control elements, highly recommended.\n pauseOnHover: false, // Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering.\n useCSS: true, // {NEW} Boolean: Slider will use CSS3 transitions if available.\n touch: true, // {NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices.\n video: false, // {NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches.\n\n // Primary Controls.\n controlNav: true, // Boolean: Create navigation for paging control of each slide? Note! Leave true for manualControls usage.\n directionNav: true, // Boolean: Create navigation for previous / next navigation? (true/false).\n prevText: \"Previous\", // String: Set the text for the \"previous\" directionNav item.\n nextText: \"Next\", // String: Set the text for the \"next\" directionNav item.\n\n // Secondary Navigation.\n keyboard: true, // Boolean: Allow slider navigating via keyboard left/right keys.\n multipleKeyboard: false, // {NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.\n mousewheel: false, // {UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel.\n pausePlay: false, // Boolean: Create pause/play dynamic element.\n pauseText: 'Pause', // String: Set the text for the \"pause\" pausePlay item.\n playText: 'Play', // String: Set the text for the \"play\" pausePlay item.\n\n // Special properties.\n controlsContainer: \"\", // {UPDATED} Selector: USE CLASS SELECTOR. Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be \".flexslider-container\". Property is ignored if given element is not found.\n manualControls: \"\", // Selector: Declare custom control navigation. Examples would be \".flex-control-nav li\" or \"#tabs-nav li img\", etc. The number of elements in your controlNav should match the number of slides/tabs.\n sync: \"\", // {NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.\n asNavFor: \"\", // {NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider.\n });\n\n if ($('.container.slidewrap').length) {\n $(\".container.slidewrap\").on('transitionend', function () {\n var slider1 = $('#main-slider').data('flexslider');\n slider1.resize();\n });\n }\n }\n\n };\n\n if (document.readyState !== 'loading') {\n log.debug(\"Adaptable ES6 Slider JS DOM content already loaded\");\n sliderInit();\n } else {\n log.debug(\"Adaptable ES6 Slider JS DOM content not loaded\");\n document.addEventListener('DOMContentLoaded', function () {\n log.debug(\"Adaptable ES6 Slider JS DOM content loaded\");\n sliderInit();\n });\n }\n};\n"],"names":["sliderInit","length","flexslider","namespace","selector","animation","easing","direction","reverse","animationLoop","smoothHeight","startAt","slideshow","slideshowSpeed","animationSpeed","initDelay","randomize","pauseOnAction","pauseOnHover","useCSS","touch","video","controlNav","directionNav","prevText","nextText","keyboard","multipleKeyboard","mousewheel","pausePlay","pauseText","playText","controlsContainer","manualControls","sync","asNavFor","on","data","resize","document","readyState","debug","addEventListener"],"mappings":";;qKAiCoB,WAEVA,WAAa,mCAIX,mBAAE,gBAAgBC,6BAChB,gBAAgBC,WAAW,CACzBC,UAAW,QACXC,SAAU,eACVC,UAAW,QACXC,OAAQ,QACRC,UAAW,aACXC,SAAS,EACTC,eAAe,EACfC,cAAc,EACdC,QAAS,EACTC,WAAW,EACXC,eAAgB,IAChBC,eAAgB,IAChBC,UAAW,EACXC,WAAW,EAGXC,eAAe,EACfC,cAAc,EACdC,QAAQ,EACRC,OAAO,EACPC,OAAO,EAGPC,YAAY,EACZC,cAAc,EACdC,SAAU,WACVC,SAAU,OAGVC,UAAU,EACVC,kBAAkB,EAClBC,YAAY,EACZC,WAAW,EACXC,UAAW,QACXC,SAAU,OAGVC,kBAAmB,GACnBC,eAAgB,GAChBC,KAAM,GACNC,SAAU,MAGV,mBAAE,wBAAwBlC,4BACxB,wBAAwBmC,GAAG,iBAAiB,YAC5B,mBAAE,gBAAgBC,KAAK,cAC7BC,cAOI,YAAxBC,SAASC,yBACLC,MAAM,sDACVzC,4BAEIyC,MAAM,kDACVF,SAASG,iBAAiB,oBAAoB,wBACtCD,MAAM,8CACVzC"} \ No newline at end of file diff --git a/amd/build/tabbed.min.js b/amd/build/tabbed.min.js new file mode 100644 index 0000000..c038830 --- /dev/null +++ b/amd/build/tabbed.min.js @@ -0,0 +1,5 @@ +define("theme_adaptable/tabbed",["exports","jquery","core/log"],(function(_exports,_jquery,_log){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=_interopRequireDefault(_jquery),_log=_interopRequireDefault(_log);const tabbed=(currentpage,tabpersistencetime)=>{if("coursepage"==currentpage){var expiration,hasStorage="sessionStorage"in window&&window.sessionStorage,currentUrl=document.location.toString();if(hasStorage&&-1!=currentUrl.indexOf("course/view.php?id=")){var tabValues=JSON.parse(sessionStorage.getItem("tabValues"))||{},tabTimestamp=JSON.parse(sessionStorage.getItem("tabTimestamp")),$radiobuttons=(0,_jquery.default)("#coursetabcontainer :radio"),now=new Date;const setTimestamp=timestamp=>{var timeStampJSON=JSON.stringify(timestamp);_log.default.debug("Adaptable ES6 Tabbled: Setting timestamp to "+timeStampJSON),sessionStorage.setItem("tabTimestamp",timeStampJSON)};tabTimestamp&&((expiration=new Date(tabTimestamp)).setMinutes(expiration.getMinutes()+parseInt(tabpersistencetime)),now.getTime()>expiration.getTime()&&(_log.default.debug("Adaptable ES6 Tabbled: Expired"),sessionStorage.removeItem("tabValues"),tabValues={})),setTimestamp(now);var courseid=new URL(document.location).searchParams.get("id");$radiobuttons.on("change",(function(){$radiobuttons.each((function(){this.checked&&(tabValues[courseid]=this.id)})),sessionStorage.setItem("tabValues",JSON.stringify(tabValues))}));var tabhasbeenset=!1;_jquery.default.each(tabValues,(function(key,value){key==courseid&&((0,_jquery.default)("#"+value).prop("checked",!0),tabhasbeenset=!0)})),0==tabhasbeenset&&(0,_jquery.default)("input:radio[name=tabs]:first").attr("checked",!0),(0,_jquery.default)("label.coursetab").show()}}};_exports.init=(currentpage,tabpersistencetime)=>{_log.default.debug("Adaptable ES6 Tabbled init"),"loading"!==document.readyState?(_log.default.debug("Adaptable ES6 Tabbled init DOM content already loaded"),tabbed(currentpage,tabpersistencetime)):(_log.default.debug("Adaptable ES6 Tabbled init JS DOM content not loaded"),document.addEventListener("DOMContentLoaded",(function(){_log.default.debug("Adaptable ES6 Tabbled init JS DOM content loaded"),tabbed(currentpage,tabpersistencetime)})))}})); + +//# sourceMappingURL=tabbed.min.js.map \ No newline at end of file diff --git a/amd/build/tabbed.min.js.map b/amd/build/tabbed.min.js.map new file mode 100644 index 0000000..c157db8 --- /dev/null +++ b/amd/build/tabbed.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tabbed.min.js","sources":["../src/tabbed.js"],"sourcesContent":["//\n// This file is part of Adaptable theme for moodle\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n//\n// Adaptable Tabbed JS file\n//\n// @package theme_adaptable\n// @copyright 2015-2019 Jeremy Hopkins (Coventry University)\n// @copyright 2018-2019 Manoj Solanki (Coventry University)\n// @copyright 2019 G J Barnard\n// {@link https://moodle.org/user/profile.php?id=442195}\n// {@link https://gjbarnard.co.uk}\n// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.\n//\n\nimport $ from 'jquery';\nimport log from 'core/log';\n\n/**\n * Tabbed.\n *\n * @param {string} currentpage The current page.\n * @param {string} tabpersistencetime The persistance time of the current set tab.\n */\nconst tabbed = (currentpage, tabpersistencetime) => {\n if (currentpage == 'coursepage') {\n var hasStorage = (\"sessionStorage\" in window && window.sessionStorage);\n var now, expiration;\n var currentUrl = document.location.toString();\n\n if ((hasStorage) && (currentUrl.indexOf('course/view.php?id=') != -1)) {\n\n var tabValues = JSON.parse(sessionStorage.getItem('tabValues')) || {};\n var tabTimestamp = JSON.parse(sessionStorage.getItem('tabTimestamp'));\n var $radiobuttons = $(\"#coursetabcontainer :radio\");\n var now = new Date();\n\n const setTimestamp = (timestamp) => {\n var timeStampJSON = JSON.stringify(timestamp);\n log.debug('Adaptable ES6 Tabbled: Setting timestamp to ' + timeStampJSON);\n sessionStorage.setItem(\"tabTimestamp\", timeStampJSON);\n };\n\n // Check timestamp for session.\n if (tabTimestamp) {\n // Calculate expiration time for content, to force periodic refresh after 'tabpersistencetime' minutes.\n expiration = new Date(tabTimestamp);\n expiration.setMinutes(expiration.getMinutes() + parseInt(tabpersistencetime));\n if (now.getTime() > expiration.getTime()) {\n log.debug('Adaptable ES6 Tabbled: Expired');\n sessionStorage.removeItem('tabValues');\n tabValues = {};\n }\n }\n setTimestamp(now);\n\n var params = (new URL(document.location)).searchParams;\n var courseid = params.get(\"id\");\n\n $radiobuttons.on(\"change\", function () {\n $radiobuttons.each(function () {\n if (this.checked) {\n tabValues[courseid] = this.id;\n }\n });\n sessionStorage.setItem(\"tabValues\", JSON.stringify(tabValues));\n });\n\n var tabhasbeenset = false;\n $.each(tabValues, function (key, value) {\n if (key == courseid) {\n $(\"#\" + value).prop('checked', true);\n tabhasbeenset = true;\n }\n });\n if (tabhasbeenset == false) {\n $(\"input:radio[name=tabs]:first\").attr('checked', true);\n }\n\n $('label.coursetab').show();\n }\n\n }\n};\n\n/**\n * Init.\n *\n * @param {string} currentpage The current page.\n * @param {string} tabpersistencetime The persistance time of the current set tab.\n*/\nexport const init = (currentpage, tabpersistencetime) => {\n log.debug('Adaptable ES6 Tabbled init');\n if (document.readyState !== 'loading') {\n log.debug(\"Adaptable ES6 Tabbled init DOM content already loaded\");\n tabbed(currentpage, tabpersistencetime);\n } else {\n log.debug(\"Adaptable ES6 Tabbled init JS DOM content not loaded\");\n document.addEventListener('DOMContentLoaded', function () {\n log.debug(\"Adaptable ES6 Tabbled init JS DOM content loaded\");\n tabbed(currentpage, tabpersistencetime);\n });\n }\n};\n"],"names":["tabbed","currentpage","tabpersistencetime","expiration","hasStorage","window","sessionStorage","currentUrl","document","location","toString","indexOf","tabValues","JSON","parse","getItem","tabTimestamp","$radiobuttons","now","Date","setTimestamp","timestamp","timeStampJSON","stringify","debug","setItem","setMinutes","getMinutes","parseInt","getTime","removeItem","courseid","URL","searchParams","get","on","each","this","checked","id","tabhasbeenset","key","value","prop","attr","show","readyState","addEventListener"],"mappings":";;6JAqCMA,OAAS,CAACC,YAAaC,yBACN,cAAfD,YAA6B,KAEpBE,WADLC,WAAc,mBAAoBC,QAAUA,OAAOC,eAEnDC,WAAaC,SAASC,SAASC,cAE9BN,aAA8D,GAA9CG,WAAWI,QAAQ,uBAA+B,KAE/DC,UAAYC,KAAKC,MAAMR,eAAeS,QAAQ,eAAiB,GAC/DC,aAAeH,KAAKC,MAAMR,eAAeS,QAAQ,iBACjDE,eAAgB,mBAAE,8BAClBC,IAAM,IAAIC,WAERC,aAAgBC,gBACdC,cAAgBT,KAAKU,UAAUF,wBAC/BG,MAAM,+CAAiDF,eAC3DhB,eAAemB,QAAQ,eAAgBH,gBAIvCN,gBAEAb,WAAa,IAAIgB,KAAKH,eACXU,WAAWvB,WAAWwB,aAAeC,SAAS1B,qBACrDgB,IAAIW,UAAY1B,WAAW0B,yBACvBL,MAAM,kCACVlB,eAAewB,WAAW,aAC1BlB,UAAY,KAGpBQ,aAAaF,SAGTa,SADU,IAAIC,IAAIxB,SAASC,UAAWwB,aACpBC,IAAI,MAE1BjB,cAAckB,GAAG,UAAU,WACvBlB,cAAcmB,MAAK,WACXC,KAAKC,UACL1B,UAAUmB,UAAYM,KAAKE,OAGnCjC,eAAemB,QAAQ,YAAaZ,KAAKU,UAAUX,mBAGnD4B,eAAgB,kBAClBJ,KAAKxB,WAAW,SAAU6B,IAAKC,OACzBD,KAAOV,+BACL,IAAMW,OAAOC,KAAK,WAAW,GAC/BH,eAAgB,MAGH,GAAjBA,mCACE,gCAAgCI,KAAK,WAAW,uBAGpD,mBAAmBC,wBAYb,CAAC5C,YAAaC,mCAC1BsB,MAAM,8BACkB,YAAxBhB,SAASsC,yBACLtB,MAAM,yDACVxB,OAAOC,YAAaC,mCAEhBsB,MAAM,wDACVhB,SAASuC,iBAAiB,oBAAoB,wBACtCvB,MAAM,oDACVxB,OAAOC,YAAaC"} \ No newline at end of file diff --git a/amd/build/templatepreview.min.js b/amd/build/templatepreview.min.js deleted file mode 100644 index d462ba8..0000000 --- a/amd/build/templatepreview.min.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. -define("theme_adaptable/templatepreview",["jquery","core/log"],(function($,log){return log.debug("Adaptable Template Preview AMD"),{init:function(){$(document).ready((function(){log.debug("Adaptable Template Preview AMD init")}))}}})); - -//# sourceMappingURL=templatepreview.min.js.map \ No newline at end of file diff --git a/amd/build/utils.min.js b/amd/build/utils.min.js deleted file mode 100644 index 359a98c..0000000 --- a/amd/build/utils.min.js +++ /dev/null @@ -1,4 +0,0 @@ -// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. -define("theme_adaptable/utils",["jquery","core/log"],(function($,log){return{init:function(currentpage,tabpersistencetime){$(document).ready((function($){if("coursepage"==currentpage){var now,expiration,hasStorage="sessionStorage"in window&&window.sessionStorage,currentUrl=document.location.toString();if(hasStorage&&-1!=currentUrl.indexOf("course/view.php?id=")){var tabValues=JSON.parse(sessionStorage.getItem("tabValues"))||{},tabTimestamp=JSON.parse(sessionStorage.getItem("tabTimestamp")),$radiobuttons=$("#coursetabcontainer :radio");tabTimestamp?(now=new Date,(expiration=new Date(tabTimestamp)).setMinutes(expiration.getMinutes()+parseInt(tabpersistencetime)),now.getTime()>expiration.getTime()&&(log.debug("Expired"),sessionStorage.removeItem("tabTimestamp"),sessionStorage.removeItem("tabValues"),tabValues={}),sessionStorage.setItem("tabTimestamp",JSON.stringify(new Date))):(sessionStorage.setItem("tabTimestamp",JSON.stringify(new Date)),log.debug("Setting timestamp"));var courseid=new URL(document.location).searchParams.get("id");$radiobuttons.on("change",(function(){$radiobuttons.each((function(){this.checked&&(tabValues[courseid]=this.id)})),sessionStorage.setItem("tabValues",JSON.stringify(tabValues))}));var tabhasbeenset=!1;$.each(tabValues,(function(key,value){key==courseid&&($("#"+value).prop("checked",!0),tabhasbeenset=!0)})),0==tabhasbeenset&&$("input:radio[name=tabs]:first").attr("checked",!0),$("label.coursetab").show()}}}))}}})); - -//# sourceMappingURL=utils.min.js.map \ No newline at end of file diff --git a/amd/src/adaptable.js b/amd/src/adaptable.js index 2c31e1a..d25bd89 100644 --- a/amd/src/adaptable.js +++ b/amd/src/adaptable.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . // -// + // Adaptable main JS file // // @package theme_adaptable @@ -25,87 +25,349 @@ // {@link https://moodle.org/user/profile.php?id=442195} // {@link https://gjbarnard.co.uk} // @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// -/* jshint ignore:start */ -define(['jquery', 'core/log'], function($, log) { - "use strict"; // ...jshint ;_; !!! +import $ from 'jquery'; +import jqueryeasingInit from 'theme_adaptable/jqueryeasing'; +import pace from 'theme_adaptable/pace'; +import log from 'core/log'; - log.debug('Adaptable AMD'); +const adaptable = () => { + log.debug('Adaptable ES6 adaptable'); - return { - init: function() { - $(document).ready(function($) { + // Breadcrumb. + $(".breadcrumb li:not(:last-child) span").not('.separator').addClass(''); + $(".breadcrumb li:last-child").addClass("lastli"); - log.debug('Adaptable AMD init'); + // Edit button keep position. Needs session storage! + try { + $('.context-header-settings-menu .dropdown-menu .dropdown-item a[href*="edit"], #editingbutton a') + .click(function (event) { + event.preventDefault(); - // Breadcrumb. - $(".breadcrumb li:not(:last-child) span").not('.separator').addClass(''); - $(".breadcrumb li:last-child").addClass("lastli"); + var to = $(window).scrollTop(); + sessionStorage.setItem('scrollTo', to); + var url = $(this).prop('href'); + window.location.replace(url); - // Edit button keep position. Needs session storage! - try { - $('.context-header-settings-menu .dropdown-menu .dropdown-item a[href*="edit"], #editingbutton a') - .click(function(event) { - event.preventDefault(); + return false; + }); + var scrollTo = sessionStorage.getItem('scrollTo'); + if (scrollTo !== null) { + window.scrollTo(0, scrollTo); + sessionStorage.removeItem('scrollTo'); + } + } catch (e) { + log.debug('Adaptable: Session storage exception: ' + e.name); + } - var to = $(window).scrollTop(); - sessionStorage.setItem('scrollTo', to); - var url = $(this).prop('href'); - window.location.replace(url); + // Scroll to top. + const bttOffset = 150; + const bttDuration = 500; + let bttOn; + const scrollDuration = 500; + let st = $('#page').scrollTop(); + if (st > bttOffset) { + bttOn = false; + } else { + bttOn = true; + } + var bttScrollCheck = function () { + st = $('#page').scrollTop(); + if (st > bttOffset) { + if (bttOn == false) { + bttOn = true; + $('#back-to-top').fadeIn(bttDuration); + } + } else { + if (bttOn == true) { + bttOn = false; + $('#back-to-top').fadeOut(bttDuration); + } + } + }; + bttScrollCheck(); + $('#page').scroll(function () { + bttScrollCheck(); + }); - return false; - }); - var scrollTo = sessionStorage.getItem('scrollTo'); - if (scrollTo !== null) { - window.scrollTo(0, scrollTo); - sessionStorage.removeItem('scrollTo'); - } - } catch(e) { - log.debug('Adaptable: Session storage exception: ' + e.name); + $('#back-to-top').click(function (event) { + event.preventDefault(); + $('#page').animate({ scrollTop: 0 }, scrollDuration); + return false; + }); + + // Anchor. + if (window.location.hash) { + if ($("body").hasClass("pagelayout-course")) { + var anchorTop = $(window.location.hash).offset().top; + $('html, body').animate({ scrollTop: anchorTop - 102 }, scrollDuration); + } + } + + // New for every three. + if ($('header').css("position") == "fixed") { + $('.outercont').css('padding-top', $('header').height()); + } +}; + +const options = (data) => { + log.debug('Adaptable ES6 options'); + var body = $("body"); + // Get the navbar, if present. + var navbar = document.getElementById("main-navbar"); + + if (data.stickynavbar) { + /* New way to handle sticky navbar requirement. + Simply taken from https://www.w3schools.com/howto/howto_js_navbar_sticky.asp. */ + + const screenmd = 992; + const screensm = 768; + var windowWidth = $(window).width(); + var currentWindowSize; + if (windowWidth < screensm) { + currentWindowSize = 1; + } else if (windowWidth < screenmd) { + currentWindowSize = 2; + } else { + currentWindowSize = 3; + } + + // Container. + var header = document.getElementById("adaptable-page-header-wrapper"); + var aboveHeader = document.getElementById("header1"); + if (!aboveHeader) { + aboveHeader = document.getElementById("header2"); + } + + // Drawers. + var courseIndex = document.getElementById("theme_adaptable-drawers-courseindex"); + var sidePost = document.getElementById("theme_adaptable-drawers-sidepost"); + var drawerTogglers = document.getElementsByClassName("drawer-toggler"); + + // Page. + var page = document.getElementById("page"); + + // Adjustments. + var pageScrollTop = page.scrollTop; + var currentPageScrollTop = pageScrollTop; + var headerHeight = 0; + var headerNoNavbar = 0; + var navbarHeight = 0; + if (navbar !== null) { + navbarHeight = navbar.getBoundingClientRect().height; + } + var aboveHeaderHeight = aboveHeader.getBoundingClientRect().height; + + var drawerPaddingTop = 0; + var newDrawerPaddingTop = 0; + var pageMarginTop = 0; + var newPageMarginTop = 0; + var headerTop = 0; + var newHeaderTop = 0; + + var isFixed = 0; + /* Ok, here's an odd one... desktops need to use the 'inner' variables and mobiles the 'outer' + to be accurate! But... I've (GB) found that the jQuery height and width functions adapt and + report close to correct values regardless of device, so use them instead without complicated + device detection here! Update: postion:fixed does not work on mobiles at the moment so won't + be for such, left comment for future info. */ + + /* Top navbar stickyness. + As per above comments, some issues noted with using CSS position: fixed, but these seem to mostly be constrained + to older browsers (inc. mobile browsers). May need to revisit! + https://caniuse.com/#feat=css-fixed */ + if (windowWidth < screenmd) { + header.classList.remove("sticky"); + body.addClass("page-header-margin"); + isFixed = 1; + } else { + header.classList.add("sticky"); + body.removeClass("page-header-margin"); + } + + var makeNavbarSticky = function (update = false) { + pageScrollTop = page.scrollTop; + + if (windowWidth < screenmd) { + if ((!update) && (currentPageScrollTop == aboveHeaderHeight) && (pageScrollTop >= aboveHeaderHeight)) { + return; + } + pageScrollTop = aboveHeaderHeight; + newHeaderTop = 0; + newPageMarginTop = 0; + } else { + if ((!update) && (currentPageScrollTop == headerNoNavbar) && (pageScrollTop >= headerNoNavbar)) { + return; + } + if (update) { + // Just changed from <= screenmd. + headerHeight = header.getBoundingClientRect().height; + if (navbar !== null) { + navbarHeight = navbar.getBoundingClientRect().height; + } // Else will never change from 0 at init! + headerNoNavbar = headerHeight - navbarHeight; } + if (pageScrollTop > headerNoNavbar) { + pageScrollTop = headerNoNavbar; + } + newHeaderTop = -pageScrollTop; + newPageMarginTop = headerHeight - pageScrollTop; + } + currentPageScrollTop = pageScrollTop; + + if ((update) || (newHeaderTop != headerTop)) { + header.style.top = newHeaderTop + 'px'; + headerTop = newHeaderTop; + } + if ((update) || (newPageMarginTop != pageMarginTop)) { + page.style.marginTop = newPageMarginTop + 'px'; + pageMarginTop = newPageMarginTop; + } - // Scroll to top. - var offset = 50; - var duration = 500; - var bttOn; - if ($(window).scrollTop() > offset) { - bttOn = false; + if ((courseIndex) || (sidePost)) { + if (windowWidth < screenmd) { + newDrawerPaddingTop = 0; } else { - bttOn = true; + newDrawerPaddingTop = headerHeight - pageScrollTop; } - var scrollCheck = function() { - if ($(window).scrollTop() > offset) { - if (bttOn == false) { - bttOn = true; - $('#back-to-top').fadeIn(duration); - } - } else { - if (bttOn == true) { - bttOn = false; - $('#back-to-top').fadeOut(duration); - } + if ((update) || (newDrawerPaddingTop != drawerPaddingTop)) { + drawerPaddingTop = newDrawerPaddingTop; + if (courseIndex) { + courseIndex.style.paddingTop = drawerPaddingTop + 'px'; } - }; - scrollCheck(); - $(window).scroll(function () { - scrollCheck(); - }); - - $('#back-to-top').click(function(event) { - event.preventDefault(); - $('html, body').animate({scrollTop: 0}, duration); - return false; - }); - - // Anchor. - if (window.location.hash) { - if ($("body").hasClass("pagelayout-course")) { - var anchorTop = $(window.location.hash).offset().top; - $('html, body').animate({scrollTop: anchorTop - 102}, duration); + if (sidePost) { + sidePost.style.paddingTop = drawerPaddingTop + 'px'; + } + if ((courseIndex) || (sidePost)) { + if (windowWidth < screenmd) { + for (let dt = 0; dt < drawerTogglers.length; dt++) { + drawerTogglers[dt].style.top = null; + } + } else { + for (let dt = 0; dt < drawerTogglers.length; dt++) { + drawerTogglers[dt].style.top = (drawerPaddingTop + 22) + 'px'; + } + } } } - }); + } + }; + makeNavbarSticky(true); + if (courseIndex) { + courseIndex.classList.remove("d-none"); } - }; -}); -/* jshint ignore:end */ \ No newline at end of file + if (sidePost) { + sidePost.classList.remove("d-none"); + } + + // When the user scrolls the page, execute makeNavbarSticky(). + page.onscroll = function () { makeNavbarSticky(); }; + + $(window).resize(function () { + windowWidth = $(window).width(); + if (windowWidth < screensm) { + if (currentWindowSize != 1) { + makeNavbarSticky(true); + currentWindowSize = 1; + } + } else if (windowWidth < screenmd) { + if (currentWindowSize != 2) { + makeNavbarSticky(true); + currentWindowSize = 2; + } + } else { + if (currentWindowSize != 3) { + currentWindowSize = 3; + } + // At screenmd and above, window width changes can change the height of the header. + makeNavbarSticky(true); + } + if (windowWidth < screenmd) { + if (isFixed === 0) { + header.classList.remove("sticky"); + body.addClass("page-header-margin"); + isFixed = 1; + } + } else { + if (isFixed === 1) { + header.classList.add("sticky"); + body.removeClass("page-header-margin"); + isFixed = 0; + } + } + }); + } + + $('.moodlewidth').click(function() { + if (body.hasClass('fullin') ) { + body.removeClass('fullin'); + M.util.set_user_preference('theme_adaptable_full', 'nofull'); + } else { + body.addClass('fullin'); + M.util.set_user_preference('theme_adaptable_full', 'fullin'); + } + }); + + $('#openoverlaymenu').click(function () { + $('#conditionalmenu').toggleClass('open'); + }); + $('#overlaymenuclose').click(function () { + $('#conditionalmenu').toggleClass('open'); + }); + + // Bootstrap sub-menu functionality. + // See: https://bootstrapthemes.co/demo/resource/bootstrap-4-multi-dropdown-hover-navbar/. + + $('.dropdown-menu a.dropdown-toggle').on('click', function () { + var $el = $(this); + var $parent = $(this).offsetParent(".dropdown-menu"); + if (!$(this).next().hasClass('show')) { + $(this).parents('.dropdown-menu').first().find('.show').removeClass("show"); + } + var $subMenu = $(this).next(".dropdown-menu"); + $subMenu.toggleClass('show'); + + $(this).parent("li").toggleClass('show'); + + $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function () { + $('.dropdown-menu .show').removeClass("show"); + }); + + if (!$parent.parent().hasClass('navbar-nav')) { + $el.next().css({ "top": $el[0].offsetTop, "left": $parent.outerWidth() - 4 }); + } + + return false; + }); +}; + +export const init = (data) => { + log.debug('Adaptable ES6 init'); + jqueryeasingInit(); + pace.start({ + document: false + }); + /* Conditional javascript to resolve anchor link clicking issue with sticky navbar. + in old bootstrap version. Re: issue #919. + Original issue / solution discussion here: https://github.com/twbs/bootstrap/issues/1768. */ + if (data.stickynavbar) { + var shiftWindow = function () { scrollBy(0, -50); }; + if (location.hash) { + shiftWindow(); + } + window.addEventListener("hashchange", shiftWindow); + } + if (document.readyState !== 'loading') { + log.debug("Adaptable ES6 init DOM content already loaded"); + adaptable(); + options(data); + } else { + log.debug("Adaptable ES6 init JS DOM content not loaded"); + document.addEventListener('DOMContentLoaded', function () { + log.debug("Adaptable ES6 init JS DOM content loaded"); + adaptable(); + options(data); + }); + } +}; diff --git a/amd/src/admin_settings.js b/amd/src/admin_settings.js index 86302f0..614910c 100644 --- a/amd/src/admin_settings.js +++ b/amd/src/admin_settings.js @@ -13,16 +13,16 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Admin settings. Go back to the current tab after save. - * - * @module theme_adaptable/admin_settings - * @copyright 2024 G J Barnard. - * @author G J Barnard - - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ +// +// Admin settings. Go back to the current tab after save. +// +// @module theme_adaptable/admin_settings +// @copyright 2024 G J Barnard. +// @author G J Barnard - +// {@link https://moodle.org/user/profile.php?id=442195} +// {@link https://gjbarnard.co.uk} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// import log from 'core/log'; @@ -47,13 +47,14 @@ export const init = () => { } }; + log.debug('Adaptable ES6 Admin settings init'); if (document.readyState !== 'loading') { - log.debug("Adaptable Admin settings JS DOM content already loaded"); + log.debug("Adaptable ES6 Admin settings JS DOM content already loaded"); stickyTabs(); } else { - log.debug("Adaptable Admin settings JS DOM content not loaded"); + log.debug("Adaptable ES6 Admin settings JS DOM content not loaded"); document.addEventListener('DOMContentLoaded', function() { - log.debug("Adaptable Admin settings JS DOM content loaded"); + log.debug("Adaptable ES6 Admin settings JS DOM content loaded"); stickyTabs(); }); } diff --git a/amd/src/bsoptions.js b/amd/src/bsoptions.js deleted file mode 100644 index d1538b4..0000000 --- a/amd/src/bsoptions.js +++ /dev/null @@ -1,282 +0,0 @@ -// -// This file is part of Adaptable theme for moodle -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . -// -// -// Adaptable Bootstrap opt in functions JS file -// -// @package theme_adaptable -// @copyright 2015-2019 Jeremy Hopkins (Coventry University) -// @copyright 2015-2019 Fernando Acedo (3-bits.com) -// @copyright 2018-2019 Manoj Solanki (Coventry University) -// @copyright 2019 G J Barnard -// {@link https://moodle.org/user/profile.php?id=442195} -// {@link https://gjbarnard.co.uk} -// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - -/* jshint ignore:start */ -define(['jquery', 'core/log'], function($, log) { - "use strict"; // ...jshint ;_; !!! - - log.debug('Adaptable Bootstrap AMD opt in functions'); - - return { - init: function(data) { - $(document).ready(function($) { - - var body = $("body"); - // Get the navbar, if present. - var navbar = document.getElementById("main-navbar"); - - if (data.stickynavbar) { - /* New way to handle sticky navbar requirement. - Simply taken from https://www.w3schools.com/howto/howto_js_navbar_sticky.asp. */ - - const screenmd = 992; - const screensm = 768; - var windowWidth = $(window).width(); - var currentWindowSize; - if (windowWidth < screensm) { - currentWindowSize = 1; - } else if (windowWidth < screenmd) { - currentWindowSize = 2; - } else { - currentWindowSize = 3; - } - - // Container. - var header = document.getElementById("adaptable-page-header-wrapper"); - var aboveHeader = document.getElementById("header1"); - if (!aboveHeader) { - aboveHeader = document.getElementById("header2"); - } - - // Drawers. - var courseIndex = document.getElementById("theme_adaptable-drawers-courseindex"); - var sidePost = document.getElementById("theme_adaptable-drawers-sidepost"); - var drawerTogglers = document.getElementsByClassName("drawer-toggler"); - - // Page. - var page = document.getElementById("page"); - - // Adjustments. - var pageScrollTop = page.scrollTop; - var currentPageScrollTop = pageScrollTop; - var headerHeight = 0; - var headerNoNavbar = 0; - var navbarHeight = 0; - if (navbar !== null) { - navbarHeight = navbar.getBoundingClientRect().height; - } - var aboveHeaderHeight = aboveHeader.getBoundingClientRect().height; - - var drawerPaddingTop = 0; - var newDrawerPaddingTop = 0; - var pageMarginTop = 0; - var newPageMarginTop = 0; - var headerTop = 0; - var newHeaderTop = 0; - - var isFixed = 0; - /* Ok, here's an odd one... desktops need to use the 'inner' variables and mobiles the 'outer' - to be accurate! But... I've (GB) found that the jQuery height and width functions adapt and - report close to correct values regardless of device, so use them instead without complicated - device detection here! Update: postion:fixed does not work on mobiles at the moment so won't - be for such, left comment for future info. */ - - /* Top navbar stickyness. - As per above comments, some issues noted with using CSS position: fixed, but these seem to mostly be constrained - to older browsers (inc. mobile browsers). May need to revisit! - https://caniuse.com/#feat=css-fixed */ - if (windowWidth < screenmd) { - header.classList.remove("sticky"); - body.addClass("page-header-margin"); - isFixed = 1; - } else { - header.classList.add("sticky"); - body.removeClass("page-header-margin"); - } - - var makeNavbarSticky = function(update = false) { - pageScrollTop = page.scrollTop; - - if (windowWidth < screenmd) { - if ((!update) && (currentPageScrollTop == aboveHeaderHeight) && (pageScrollTop >= aboveHeaderHeight)) { - return; - } - pageScrollTop = aboveHeaderHeight; - newHeaderTop = 0; - newPageMarginTop = 0; - } else { - if ((!update) && (currentPageScrollTop == headerNoNavbar) && (pageScrollTop >= headerNoNavbar)) { - return; - } - if (update) { - // Just changed from <= screenmd. - headerHeight = header.getBoundingClientRect().height; - if (navbar !== null) { - navbarHeight = navbar.getBoundingClientRect().height; - } // Else will never change from 0 at init! - headerNoNavbar = headerHeight - navbarHeight; - } - if (pageScrollTop > headerNoNavbar) { - pageScrollTop = headerNoNavbar; - } - newHeaderTop = -pageScrollTop; - newPageMarginTop = headerHeight - pageScrollTop; - } - currentPageScrollTop = pageScrollTop; - - if ((update) || (newHeaderTop != headerTop)) { - header.style.top = newHeaderTop + 'px'; - headerTop = newHeaderTop; - } - if ((update) || (newPageMarginTop != pageMarginTop)) { - page.style.marginTop = newPageMarginTop + 'px'; - pageMarginTop = newPageMarginTop; - } - - if ((courseIndex) || (sidePost)) { - if (windowWidth < screenmd) { - newDrawerPaddingTop = 0; - } else { - newDrawerPaddingTop = headerHeight - pageScrollTop; - } - if ((update) || (newDrawerPaddingTop != drawerPaddingTop)) { - drawerPaddingTop = newDrawerPaddingTop; - if (courseIndex) { - courseIndex.style.paddingTop = drawerPaddingTop + 'px'; - } - if (sidePost) { - sidePost.style.paddingTop = drawerPaddingTop + 'px'; - } - if ((courseIndex) || (sidePost)) { - if (windowWidth < screenmd) { - for (let dt = 0; dt < drawerTogglers.length; dt++) { - drawerTogglers[dt].style.top = null; - } - } else { - for (let dt = 0; dt < drawerTogglers.length; dt++) { - drawerTogglers[dt].style.top = (drawerPaddingTop + 22) + 'px'; - } - } - } - } - } - }; - makeNavbarSticky(true); - if (courseIndex) { - courseIndex.classList.remove("d-none"); - } - if (sidePost) { - sidePost.classList.remove("d-none"); - } - - // When the user scrolls the page, execute makeNavbarSticky(). - page.onscroll = function() {makeNavbarSticky();}; - - $(window).resize(function() { - windowWidth = $(window).width(); - if (windowWidth < screensm) { - if (currentWindowSize != 1) { - makeNavbarSticky(true); - currentWindowSize = 1; - } - } else if (windowWidth < screenmd) { - if (currentWindowSize != 2) { - makeNavbarSticky(true); - currentWindowSize = 2; - } - } else { - if (currentWindowSize != 3) { - currentWindowSize = 3; - } - // At screenmd and above, window width changes can change the height of the header. - makeNavbarSticky(true); - } - if (windowWidth < screenmd) { - if (isFixed === 0) { - header.classList.remove("sticky"); - body.addClass("page-header-margin"); - isFixed = 1; - } - } else { - if (isFixed === 1) { - header.classList.add("sticky"); - body.removeClass("page-header-margin"); - isFixed = 0; - } - } - }); - } - - $('.moodlewidth').click(function() { - if (body.hasClass('fullin') ) { - body.removeClass('fullin'); - M.util.set_user_preference('theme_adaptable_full', 'nofull'); - } else { - body.addClass('fullin'); - M.util.set_user_preference('theme_adaptable_full', 'fullin'); - } - }); - - $('#openoverlaymenu').click(function() { - $('#conditionalmenu').toggleClass('open'); - }); - $('#overlaymenuclose').click(function() { - $('#conditionalmenu').toggleClass('open'); - }); - - // Bootstrap sub-menu functionality. - // See: https://bootstrapthemes.co/demo/resource/bootstrap-4-multi-dropdown-hover-navbar/. - - $( '.dropdown-menu a.dropdown-toggle' ).on( 'click', function () { - var $el = $(this); - var $parent = $(this).offsetParent( ".dropdown-menu" ); - if ( !$(this).next().hasClass('show')) { - $(this).parents('.dropdown-menu').first().find('.show').removeClass("show"); - } - var $subMenu = $( this ).next(".dropdown-menu"); - $subMenu.toggleClass('show'); - - $(this).parent("li").toggleClass('show'); - - $(this).parents('li.nav-item.dropdown.show').on( 'hidden.bs.dropdown', function () { - $('.dropdown-menu .show').removeClass("show"); - }); - - if (!$parent.parent().hasClass( 'navbar-nav')) { - $el.next().css({"top": $el[0].offsetTop, "left": $parent.outerWidth() - 4 }); - } - - return false; - } ); - - }); - - /* Conditional javascript to resolve anchor link clicking issue with sticky navbar. - in old bootstrap version. Re: issue #919. - Original issue / solution discussion here: https://github.com/twbs/bootstrap/issues/1768. */ - if (data.stickynavbar) { - var shiftWindow = function() {scrollBy(0, -50);}; - if (location.hash) { - shiftWindow(); - } - window.addEventListener("hashchange", shiftWindow); - } - } - }; -}); -/* jshint ignore:end */ diff --git a/amd/src/flexslider.js b/amd/src/flexslider.js new file mode 100644 index 0000000..3c6ed8b --- /dev/null +++ b/amd/src/flexslider.js @@ -0,0 +1,1282 @@ +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +// +// ES6 wrapper for FlexSlider. +// +// @module theme_adaptable/flexslider +// @copyright 2024 G J Barnard. +// @author G J Barnard - +// {@link https://moodle.org/user/profile.php?id=442195} +// {@link https://gjbarnard.co.uk} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// + +import $ from 'jquery'; + +/** + * Initialise FlexSlider. + */ +export const flexslider = () => { + /* + * jQuery FlexSlider v2.7.2 + * Copyright 2012 WooThemes + * Contributing Author: Tyler Smith + * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later. + */ + + var focused = true; + + //FlexSlider: Object Instance + $.flexslider = function (el, options) { + var slider = $(el); + + // making variables public + + //if rtl value was not passed and html is in rtl..enable it by default. + if (typeof options.rtl == 'undefined' && $('html').attr('dir') == 'rtl') { + options.rtl = true; + } + slider.vars = $.extend({}, $.flexslider.defaults, options); + + var namespace = slider.vars.namespace, + msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture, + touch = (("ontouchstart" in window) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch, + // deprecating this idea, as devices are being released with both of these events + eventType = "click touchend MSPointerUp keyup", + watchedEvent = "", + watchedEventClearTimer, + vertical = slider.vars.direction === "vertical", + reverse = slider.vars.reverse, + carousel = (slider.vars.itemWidth > 0), + fade = slider.vars.animation === "fade", + asNav = slider.vars.asNavFor !== "", + methods = {}; + + // Store a reference to the slider object + $.data(el, "flexslider", slider); + + // Private slider methods + methods = { + init: function () { + slider.animating = false; + // Get current slide and make sure it is a number + slider.currentSlide = parseInt((slider.vars.startAt ? slider.vars.startAt : 0), 10); + if (isNaN(slider.currentSlide)) { slider.currentSlide = 0; } + slider.animatingTo = slider.currentSlide; + slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last); + slider.containerSelector = slider.vars.selector.substr(0, slider.vars.selector.search(' ')); + slider.slides = $(slider.vars.selector, slider); + slider.container = $(slider.containerSelector, slider); + slider.count = slider.slides.length; + // SYNC: + slider.syncExists = $(slider.vars.sync).length > 0; + // SLIDE: + if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; } + slider.prop = (vertical) ? "top" : (slider.vars.rtl ? "marginRight" : "marginLeft"); + slider.args = {}; + // SLIDESHOW: + slider.manualPause = false; + slider.stopped = false; + //PAUSE WHEN INVISIBLE + slider.started = false; + slider.startTimeout = null; + // TOUCH/USECSS: + slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function () { + var obj = document.createElement('div'), + props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; + for (var i in props) { + if (obj.style[props[i]] !== undefined) { + slider.pfx = props[i].replace('Perspective', '').toLowerCase(); + slider.prop = "-" + slider.pfx + "-transform"; + return true; + } + } + return false; + }()); + slider.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; + slider.ensureAnimationEnd = ''; + // CONTROLSCONTAINER: + if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer); + // MANUAL: + if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls); + + // CUSTOM DIRECTION NAV: + if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav); + + // RANDOMIZE: + if (slider.vars.randomize) { + slider.slides.sort(function () { return (Math.round(Math.random()) - 0.5); }); + slider.container.empty().append(slider.slides); + } + + slider.doMath(); + + // INIT + slider.setup("init"); + + // CONTROLNAV: + if (slider.vars.controlNav) { methods.controlNav.setup(); } + + // DIRECTIONNAV: + if (slider.vars.directionNav) { methods.directionNav.setup(); } + + // KEYBOARD: + if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) { + $(document).bind('keyup', function (event) { + var keycode = event.keyCode; + if (!slider.animating && (keycode === 39 || keycode === 37)) { + var target = (slider.vars.rtl ? + ((keycode === 37) ? slider.getTarget('next') : + (keycode === 39) ? slider.getTarget('prev') : false) + : + ((keycode === 39) ? slider.getTarget('next') : + (keycode === 37) ? slider.getTarget('prev') : false) + ) + ; + slider.flexAnimate(target, slider.vars.pauseOnAction); + } + }); + } + // MOUSEWHEEL: + if (slider.vars.mousewheel) { + slider.bind('mousewheel', function (event, delta, deltaX, deltaY) { + event.preventDefault(); + var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev'); + slider.flexAnimate(target, slider.vars.pauseOnAction); + }); + } + + // PAUSEPLAY + if (slider.vars.pausePlay) { methods.pausePlay.setup(); } + + //PAUSE WHEN INVISIBLE + if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); } + + // SLIDSESHOW + if (slider.vars.slideshow) { + if (slider.vars.pauseOnHover) { + slider.hover(function () { + if (!slider.manualPlay && !slider.manualPause) { slider.pause(); } + }, function () { + if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); } + }); + } + // initialize animation + //If we're visible, or we don't use PageVisibility API + if (!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) { + (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play(); + } + } + + // ASNAV: + if (asNav) { methods.asNav.setup(); } + + // TOUCH + if (touch && slider.vars.touch) { methods.touch(); } + + // FADE&&SMOOTHHEIGHT || SLIDE: + if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); } + + slider.find("img").attr("draggable", "false"); + + // API: start() Callback + setTimeout(function () { + slider.vars.start(slider); + }, 200); + }, + asNav: { + setup: function () { + slider.asNav = true; + slider.animatingTo = Math.floor(slider.currentSlide / slider.move); + slider.currentItem = slider.currentSlide; + slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide"); + if (!msGesture) { + slider.slides.on(eventType, function (e) { + e.preventDefault(); + var $slide = $(this), + target = $slide.index(); + var posFromX; + if (slider.vars.rtl) { + posFromX = -1 * ($slide.offset().right - $(slider).scrollLeft()); // Find position of slide relative to right of slider container + } + else { + posFromX = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container + } + if (posFromX <= 0 && $slide.hasClass(namespace + 'active-slide')) { + slider.flexAnimate(slider.getTarget("prev"), true); + } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) { + slider.direction = (slider.currentItem < target) ? "next" : "prev"; + slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true); + } + }); + } else { + el._slider = slider; + slider.slides.each(function () { + var that = this; + that._gesture = new MSGesture(); + that._gesture.target = that; + that.addEventListener("MSPointerDown", function (e) { + e.preventDefault(); + if (e.currentTarget._gesture) { + e.currentTarget._gesture.addPointer(e.pointerId); + } + }, false); + that.addEventListener("MSGestureTap", function (e) { + e.preventDefault(); + var $slide = $(this), + target = $slide.index(); + if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) { + slider.direction = (slider.currentItem < target) ? "next" : "prev"; + slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true); + } + }); + }); + } + } + }, + controlNav: { + setup: function () { + if (!slider.manualControls) { + methods.controlNav.setupPaging(); + } else { // MANUALCONTROLS: + methods.controlNav.setupManual(); + } + }, + setupPaging: function () { + var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging', + j = 1, + item, + slide; + + slider.controlNavScaffold = $('
        '); + + if (slider.pagingCount > 1) { + for (var i = 0; i < slider.pagingCount; i++) { + slide = slider.slides.eq(i); + + if (undefined === slide.attr('data-thumb-alt')) { + slide.attr('data-thumb-alt', ''); + } + + item = $('').attr('href', '#').text(j); + if (slider.vars.controlNav === "thumbnails") { + item = $('').attr('src', slide.attr('data-thumb')); + } + + if ('' !== slide.attr('data-thumb-alt')) { + item.attr('alt', slide.attr('data-thumb-alt')); + } + + if ('thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions) { + var captn = slide.attr('data-thumbcaption'); + if ('' !== captn && undefined !== captn) { + var caption = $('').addClass(namespace + 'caption').text(captn); + item.append(caption); + } + } + + var liElement = $('
      1. '); + item.appendTo(liElement); + liElement.append('
      2. '); + + slider.controlNavScaffold.append(liElement); + j++; + + } + } + + // CONTROLSCONTAINER: + (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold); + methods.controlNav.set(); + + methods.controlNav.active(); + + slider.controlNavScaffold.delegate('a, img', eventType, function (event) { + event.preventDefault(); + + if (watchedEvent === "" || watchedEvent === event.type) { + var $this = $(this), + target = slider.controlNav.index($this); + + if (!$this.hasClass(namespace + 'active')) { + slider.direction = (target > slider.currentSlide) ? "next" : "prev"; + slider.flexAnimate(target, slider.vars.pauseOnAction); + } + } + + // setup flags to prevent event duplication + if (watchedEvent === "") { + watchedEvent = event.type; + } + methods.setToClearWatchedEvent(); + + }); + }, + setupManual: function () { + slider.controlNav = slider.manualControls; + methods.controlNav.active(); + + slider.controlNav.bind(eventType, function (event) { + event.preventDefault(); + + if (watchedEvent === "" || watchedEvent === event.type) { + var $this = $(this), + target = slider.controlNav.index($this); + + if (!$this.hasClass(namespace + 'active')) { + (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev"; + slider.flexAnimate(target, slider.vars.pauseOnAction); + } + } + + // setup flags to prevent event duplication + if (watchedEvent === "") { + watchedEvent = event.type; + } + methods.setToClearWatchedEvent(); + }); + }, + set: function () { + var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a'; + slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider); + }, + active: function () { + slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active"); + }, + update: function (action, pos) { + if (slider.pagingCount > 1 && action === "add") { + slider.controlNavScaffold.append($('
      3. ' + slider.count + '
      4. ')); + } else if (slider.pagingCount === 1) { + slider.controlNavScaffold.find('li').remove(); + } else { + slider.controlNav.eq(pos).closest('li').remove(); + } + methods.controlNav.set(); + (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active(); + } + }, + directionNav: { + setup: function () { + var directionNavScaffold = $(''); + + // CUSTOM DIRECTION NAV: + if (slider.customDirectionNav) { + slider.directionNav = slider.customDirectionNav; + // CONTROLSCONTAINER: + } else if (slider.controlsContainer) { + $(slider.controlsContainer).append(directionNavScaffold); + slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer); + } else { + slider.append(directionNavScaffold); + slider.directionNav = $('.' + namespace + 'direction-nav li a', slider); + } + + methods.directionNav.update(); + + slider.directionNav.bind(eventType, function (event) { + event.preventDefault(); + var target; + + if (watchedEvent === "" || watchedEvent === event.type) { + target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev'); + slider.flexAnimate(target, slider.vars.pauseOnAction); + } + + // setup flags to prevent event duplication + if (watchedEvent === "") { + watchedEvent = event.type; + } + methods.setToClearWatchedEvent(); + }); + }, + update: function () { + var disabledClass = namespace + 'disabled'; + if (slider.pagingCount === 1) { + slider.directionNav.addClass(disabledClass).attr('tabindex', '-1'); + } else if (!slider.vars.animationLoop) { + if (slider.animatingTo === 0) { + slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1'); + } else if (slider.animatingTo === slider.last) { + slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1'); + } else { + slider.directionNav.removeClass(disabledClass).removeAttr('tabindex'); + } + } else { + slider.directionNav.removeClass(disabledClass).removeAttr('tabindex'); + } + } + }, + pausePlay: { + setup: function () { + var pausePlayScaffold = $('
        '); + + // CONTROLSCONTAINER: + if (slider.controlsContainer) { + slider.controlsContainer.append(pausePlayScaffold); + slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer); + } else { + slider.append(pausePlayScaffold); + slider.pausePlay = $('.' + namespace + 'pauseplay a', slider); + } + + methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play'); + + slider.pausePlay.bind(eventType, function (event) { + event.preventDefault(); + + if (watchedEvent === "" || watchedEvent === event.type) { + if ($(this).hasClass(namespace + 'pause')) { + slider.manualPause = true; + slider.manualPlay = false; + slider.pause(); + } else { + slider.manualPause = false; + slider.manualPlay = true; + slider.play(); + } + } + + // setup flags to prevent event duplication + if (watchedEvent === "") { + watchedEvent = event.type; + } + methods.setToClearWatchedEvent(); + }); + }, + update: function (state) { + (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText); + } + }, + touch: function () { + var startX, + startY, + offset, + cwidth, + dx, + startT, + onTouchStart, + onTouchMove, + onTouchEnd, + scrolling = false, + localX = 0, + localY = 0, + accDx = 0; + + if (!msGesture) { + onTouchStart = function (e) { + if (slider.animating) { + e.preventDefault(); + } else if ((window.navigator.msPointerEnabled) || e.touches.length === 1) { + slider.pause(); + // CAROUSEL: + cwidth = (vertical) ? slider.h : slider.w; + startT = Number(new Date()); + // CAROUSEL: + + // Local vars for X and Y points. + localX = e.touches[0].pageX; + localY = e.touches[0].pageY; + + offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 : + (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) : + (carousel && slider.currentSlide === slider.last) ? slider.limit : + (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide : + (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth; + startX = (vertical) ? localY : localX; + startY = (vertical) ? localX : localY; + el.addEventListener('touchmove', onTouchMove, false); + el.addEventListener('touchend', onTouchEnd, false); + } + }; + + onTouchMove = function (e) { + // Local vars for X and Y points. + + localX = e.touches[0].pageX; + localY = e.touches[0].pageY; + + dx = (vertical) ? startX - localY : (slider.vars.rtl ? -1 : 1) * (startX - localX); + scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY)); + var fxms = 500; + + if (!scrolling || Number(new Date()) - startT > fxms) { + e.preventDefault(); + if (!fade && slider.transitions) { + if (!slider.vars.animationLoop) { + dx = dx / ((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx) / cwidth + 2) : 1); + } + slider.setProps(offset + dx, "setTouch"); + } + } + }; + + onTouchEnd = function (e) { + // finish the touch by undoing the touch session + el.removeEventListener('touchmove', onTouchMove, false); + + if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) { + var updateDx = (reverse) ? -dx : dx, + target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev'); + + if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) { + slider.flexAnimate(target, slider.vars.pauseOnAction); + } else { + if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); } + } + } + el.removeEventListener('touchend', onTouchEnd, false); + + startX = null; + startY = null; + dx = null; + offset = null; + }; + + el.addEventListener('touchstart', onTouchStart, false); + } else { + el.style.msTouchAction = "none"; + el._gesture = new MSGesture(); + el._gesture.target = el; + el.addEventListener("MSPointerDown", onMSPointerDown, false); + el._slider = slider; + el.addEventListener("MSGestureChange", onMSGestureChange, false); + el.addEventListener("MSGestureEnd", onMSGestureEnd, false); + + function onMSPointerDown(e) { + e.stopPropagation(); + if (slider.animating) { + e.preventDefault(); + } else { + slider.pause(); + el._gesture.addPointer(e.pointerId); + accDx = 0; + cwidth = (vertical) ? slider.h : slider.w; + startT = Number(new Date()); + // CAROUSEL: + + offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 : + (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) : + (carousel && slider.currentSlide === slider.last) ? slider.limit : + (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide : + (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth; + } + } + + function onMSGestureChange(e) { + e.stopPropagation(); + var slider = e.target._slider; + if (!slider) { + return; + } + var transX = -e.translationX, + transY = -e.translationY; + + //Accumulate translations. + accDx = accDx + ((vertical) ? transY : transX); + dx = (slider.vars.rtl ? -1 : 1) * accDx; + scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY)); + + if (e.detail === e.MSGESTURE_FLAG_INERTIA) { + setImmediate(function () { + el._gesture.stop(); + }); + + return; + } + + if (!scrolling || Number(new Date()) - startT > 500) { + e.preventDefault(); + if (!fade && slider.transitions) { + if (!slider.vars.animationLoop) { + dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1); + } + slider.setProps(offset + dx, "setTouch"); + } + } + } + + function onMSGestureEnd(e) { + e.stopPropagation(); + var slider = e.target._slider; + if (!slider) { + return; + } + if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) { + var updateDx = (reverse) ? -dx : dx, + target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev'); + + if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth / 2)) { + slider.flexAnimate(target, slider.vars.pauseOnAction); + } else { + if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); } + } + } + + startX = null; + startY = null; + dx = null; + offset = null; + accDx = 0; + } + } + }, + resize: function () { + if (!slider.animating && slider.is(':visible')) { + if (!carousel) { slider.doMath(); } + + if (fade) { + // SMOOTH HEIGHT: + methods.smoothHeight(); + } else if (carousel) { //CAROUSEL: + slider.slides.width(slider.computedW); + slider.update(slider.pagingCount); + slider.setProps(); + } + else if (vertical) { //VERTICAL: + slider.viewport.height(slider.h); + slider.setProps(slider.h, "setTotal"); + } else { + // SMOOTH HEIGHT: + if (slider.vars.smoothHeight) { methods.smoothHeight(); } + slider.newSlides.width(slider.computedW); + slider.setProps(slider.computedW, "setTotal"); + } + } + }, + smoothHeight: function (dur) { + if (!vertical || fade) { + var $obj = (fade) ? slider : slider.viewport; + (dur) ? $obj.animate({ "height": slider.slides.eq(slider.animatingTo).innerHeight() }, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight()); + } + }, + sync: function (action) { + var $obj = $(slider.vars.sync).data("flexslider"), + target = slider.animatingTo; + + switch (action) { + case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break; + case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break; + case "pause": $obj.pause(); break; + } + }, + uniqueID: function ($clone) { + // Append _clone to current level and children elements with id attributes + $clone.filter('[id]').add($clone.find('[id]')).each(function () { + var $this = $(this); + $this.attr('id', $this.attr('id') + '_clone'); + }); + return $clone; + }, + pauseInvisible: { + visProp: null, + init: function () { + var visProp = methods.pauseInvisible.getHiddenProp(); + if (visProp) { + var evtname = visProp.replace(/[H|h]idden/, '') + 'visibilitychange'; + document.addEventListener(evtname, function () { + if (methods.pauseInvisible.isHidden()) { + if (slider.startTimeout) { + clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible + } else { + slider.pause(); //Or just pause + } + } + else { + if (slider.started) { + slider.play(); //Initiated before, just play + } else { + if (slider.vars.initDelay > 0) { + setTimeout(slider.play, slider.vars.initDelay); + } else { + slider.play(); //Didn't init before: simply init or wait for it + } + } + } + }); + } + }, + isHidden: function () { + var prop = methods.pauseInvisible.getHiddenProp(); + if (!prop) { + return false; + } + return document[prop]; + }, + getHiddenProp: function () { + var prefixes = ['webkit', 'moz', 'ms', 'o']; + // if 'hidden' is natively supported just return it + if ('hidden' in document) { + return 'hidden'; + } + // otherwise loop over all the known prefixes until we find one + for (var i = 0; i < prefixes.length; i++) { + if ((prefixes[i] + 'Hidden') in document) { + return prefixes[i] + 'Hidden'; + } + } + // otherwise it's not supported + return null; + } + }, + setToClearWatchedEvent: function () { + clearTimeout(watchedEventClearTimer); + watchedEventClearTimer = setTimeout(function () { + watchedEvent = ""; + }, 3000); + } + }; + + // public methods + slider.flexAnimate = function (target, pause, override, withSync, fromNav) { + if (!slider.vars.animationLoop && target !== slider.currentSlide) { + slider.direction = (target > slider.currentSlide) ? "next" : "prev"; + } + + if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev"; + + if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) { + if (asNav && withSync) { + var master = $(slider.vars.asNavFor).data('flexslider'); + slider.atEnd = target === 0 || target === slider.count - 1; + master.flexAnimate(target, true, false, true, fromNav); + slider.direction = (slider.currentItem < target) ? "next" : "prev"; + master.direction = slider.direction; + + if (Math.ceil((target + 1) / slider.visible) - 1 !== slider.currentSlide && target !== 0) { + slider.currentItem = target; + slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide"); + target = Math.floor(target / slider.visible); + } else { + slider.currentItem = target; + slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide"); + return false; + } + } + + slider.animating = true; + slider.animatingTo = target; + + // SLIDESHOW: + if (pause) { slider.pause(); } + + // API: before() animation Callback + slider.vars.before(slider); + + // SYNC: + if (slider.syncExists && !fromNav) { methods.sync("animate"); } + + // CONTROLNAV + if (slider.vars.controlNav) { methods.controlNav.active(); } + + // !CAROUSEL: + // CANDIDATE: slide active class (for add/remove slide) + if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); } + + // INFINITE LOOP: + // CANDIDATE: atEnd + slider.atEnd = target === 0 || target === slider.last; + + // DIRECTIONNAV: + if (slider.vars.directionNav) { methods.directionNav.update(); } + + if (target === slider.last) { + // API: end() of cycle Callback + slider.vars.end(slider); + // SLIDESHOW && !INFINITE LOOP: + if (!slider.vars.animationLoop) { slider.pause(); } + } + + // SLIDE: + if (!fade) { + var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW, + margin, slideString, calcNext; + + // INFINITE LOOP / REVERSE: + if (carousel) { + margin = slider.vars.itemMargin; + calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo; + slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext; + } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") { + slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0; + } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") { + slideString = (reverse) ? 0 : (slider.count + 1) * dimension; + } else { + slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension; + } + slider.setProps(slideString, "", slider.vars.animationSpeed); + if (slider.transitions) { + if (!slider.vars.animationLoop || !slider.atEnd) { + slider.animating = false; + slider.currentSlide = slider.animatingTo; + } + + // Unbind previous transitionEnd events and re-bind new transitionEnd event + slider.container.unbind("webkitTransitionEnd transitionend"); + slider.container.bind("webkitTransitionEnd transitionend", function () { + clearTimeout(slider.ensureAnimationEnd); + slider.wrapup(dimension); + }); + + // Insurance for the ever-so-fickle transitionEnd event + clearTimeout(slider.ensureAnimationEnd); + slider.ensureAnimationEnd = setTimeout(function () { + slider.wrapup(dimension); + }, slider.vars.animationSpeed + 100); + + } else { + slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function () { + slider.wrapup(dimension); + }); + } + } else { // FADE: + if (!touch) { + slider.slides.eq(slider.currentSlide).css({ "zIndex": 1 }).animate({ "opacity": 0 }, slider.vars.animationSpeed, slider.vars.easing); + slider.slides.eq(target).css({ "zIndex": 2 }).animate({ "opacity": 1 }, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup); + } else { + slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 }); + slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 }); + slider.wrapup(dimension); + } + } + // SMOOTH HEIGHT: + if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); } + } + }; + slider.wrapup = function (dimension) { + // SLIDE: + if (!fade && !carousel) { + if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) { + slider.setProps(dimension, "jumpEnd"); + } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) { + slider.setProps(dimension, "jumpStart"); + } + } + slider.animating = false; + slider.currentSlide = slider.animatingTo; + // API: after() animation Callback + slider.vars.after(slider); + }; + + // SLIDESHOW: + slider.animateSlides = function () { + if (!slider.animating && focused) { slider.flexAnimate(slider.getTarget("next")); } + }; + // SLIDESHOW: + slider.pause = function () { + clearInterval(slider.animatedSlides); + slider.animatedSlides = null; + slider.playing = false; + // PAUSEPLAY: + if (slider.vars.pausePlay) { methods.pausePlay.update("play"); } + // SYNC: + if (slider.syncExists) { methods.sync("pause"); } + }; + // SLIDESHOW: + slider.play = function () { + if (slider.playing) { clearInterval(slider.animatedSlides); } + slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed); + slider.started = slider.playing = true; + // PAUSEPLAY: + if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); } + // SYNC: + if (slider.syncExists) { methods.sync("play"); } + }; + // STOP: + slider.stop = function () { + slider.pause(); + slider.stopped = true; + }; + slider.canAdvance = function (target, fromNav) { + // ASNAV: + var last = (asNav) ? slider.pagingCount - 1 : slider.last; + return (fromNav) ? true : + (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true : + (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false : + (target === slider.currentSlide && !asNav) ? false : + (slider.vars.animationLoop) ? true : + (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false : + (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false : + true; + }; + slider.getTarget = function (dir) { + slider.direction = dir; + if (dir === "next") { + return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1; + } else { + return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1; + } + }; + + // SLIDE: + slider.setProps = function (pos, special, dur) { + var target = (function () { + var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo, + posCalc = (function () { + if (carousel) { + return (special === "setTouch") ? pos : + (reverse && slider.animatingTo === slider.last) ? 0 : + (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) : + (slider.animatingTo === slider.last) ? slider.limit : posCheck; + } else { + switch (special) { + case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos; + case "setTouch": return (reverse) ? pos : pos; + case "jumpEnd": return (reverse) ? pos : slider.count * pos; + case "jumpStart": return (reverse) ? slider.count * pos : pos; + default: return pos; + } + } + }()); + + return (posCalc * ((slider.vars.rtl) ? 1 : -1)) + "px"; + }()); + + if (slider.transitions) { + if (slider.isFirefox) { + target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + (parseInt(target) + 'px') + ",0,0)"; + } else { + target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + ((slider.vars.rtl ? -1 : 1) * parseInt(target) + 'px') + ",0,0)"; + } + dur = (dur !== undefined) ? (dur / 1000) + "s" : "0s"; + slider.container.css("-" + slider.pfx + "-transition-duration", dur); + slider.container.css("transition-duration", dur); + } + + slider.args[slider.prop] = target; + if (slider.transitions || dur === undefined) { slider.container.css(slider.args); } + + slider.container.css('transform', target); + }; + + slider.setup = function (type) { + // SLIDE: + if (!fade) { + var sliderOffset, arr; + + if (type === "init") { + slider.viewport = $('
        ').css({ "overflow": "hidden", "position": "relative" }).appendTo(slider).append(slider.container); + // INFINITE LOOP: + slider.cloneCount = 0; + slider.cloneOffset = 0; + // REVERSE: + if (reverse) { + arr = $.makeArray(slider.slides).reverse(); + slider.slides = $(arr); + slider.container.empty().append(slider.slides); + } + } + // INFINITE LOOP && !CAROUSEL: + if (slider.vars.animationLoop && !carousel) { + slider.cloneCount = 2; + slider.cloneOffset = 1; + // clear out old clones + if (type !== "init") { slider.container.find('.clone').remove(); } + slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true')) + .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true')); + } + slider.newSlides = $(slider.vars.selector, slider); + + sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset; + // VERTICAL: + if (vertical && !carousel) { + slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%"); + setTimeout(function () { + slider.newSlides.css({ "display": "block" }); + slider.doMath(); + slider.viewport.height(slider.h); + slider.setProps(sliderOffset * slider.h, "init"); + }, (type === "init") ? 100 : 0); + } else { + slider.container.width((slider.count + slider.cloneCount) * 200 + "%"); + slider.setProps(sliderOffset * slider.computedW, "init"); + setTimeout(function () { + slider.doMath(); + if (slider.vars.rtl) { + if (slider.isFirefox) { + slider.newSlides.css({ "width": slider.computedW, "marginRight": slider.computedM, "float": "right", "display": "block" }); + } else { + slider.newSlides.css({ "width": slider.computedW, "marginRight": slider.computedM, "float": "left", "display": "block" }); + } + + } + else { + slider.newSlides.css({ "width": slider.computedW, "marginRight": slider.computedM, "float": "left", "display": "block" }); + } + // SMOOTH HEIGHT: + if (slider.vars.smoothHeight) { methods.smoothHeight(); } + }, (type === "init") ? 100 : 0); + } + } else { // FADE: + if (slider.vars.rtl) { + slider.slides.css({ "width": "100%", "float": 'right', "marginLeft": "-100%", "position": "relative" }); + } + else { + slider.slides.css({ "width": "100%", "float": 'left', "marginRight": "-100%", "position": "relative" }); + } + if (type === "init") { + if (!touch) { + //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing); + if (slider.vars.fadeFirstSlide == false) { + slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({ "zIndex": 2 }).css({ "opacity": 1 }); + } else { + slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({ "zIndex": 2 }).animate({ "opacity": 1 }, slider.vars.animationSpeed, slider.vars.easing); + } + } else { + slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2 }); + } + } + // SMOOTH HEIGHT: + if (slider.vars.smoothHeight) { methods.smoothHeight(); } + } + // !CAROUSEL: + // CANDIDATE: active slide + if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); } + + //FlexSlider: init() Callback + slider.vars.init(slider); + }; + + slider.doMath = function () { + var slide = slider.slides.first(), + slideMargin = slider.vars.itemMargin, + minItems = slider.vars.minItems, + maxItems = slider.vars.maxItems; + + slider.w = (slider.viewport === undefined) ? slider.width() : slider.viewport.width(); + if (slider.isFirefox) { slider.w = slider.width(); } + slider.h = slide.height(); + slider.boxPadding = slide.outerWidth() - slide.width(); + + // CAROUSEL: + if (carousel) { + slider.itemT = slider.vars.itemWidth + slideMargin; + slider.itemM = slideMargin; + slider.minW = (minItems) ? minItems * slider.itemT : slider.w; + slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w; + slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1))) / minItems : + (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1))) / maxItems : + (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth; + + slider.visible = Math.floor(slider.w / (slider.itemW)); + slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible) ? slider.vars.move : slider.visible; + slider.pagingCount = Math.ceil(((slider.count - slider.visible) / slider.move) + 1); + slider.last = slider.pagingCount - 1; + slider.limit = (slider.pagingCount === 1) ? 0 : + (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin; + } else { + slider.itemW = slider.w; + slider.itemM = slideMargin; + slider.pagingCount = slider.count; + slider.last = slider.count - 1; + } + slider.computedW = slider.itemW - slider.boxPadding; + slider.computedM = slider.itemM; + }; + + slider.update = function (pos, action) { + slider.doMath(); + + // update currentSlide and slider.animatingTo if necessary + if (!carousel) { + if (pos < slider.currentSlide) { + slider.currentSlide += 1; + } else if (pos <= slider.currentSlide && pos !== 0) { + slider.currentSlide -= 1; + } + slider.animatingTo = slider.currentSlide; + } + + // update controlNav + if (slider.vars.controlNav && !slider.manualControls) { + if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) { + methods.controlNav.update("add"); + } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) { + if (carousel && slider.currentSlide > slider.last) { + slider.currentSlide -= 1; + slider.animatingTo -= 1; + } + methods.controlNav.update("remove", slider.last); + } + } + // update directionNav + if (slider.vars.directionNav) { methods.directionNav.update(); } + + }; + + slider.addSlide = function (obj, pos) { + var $obj = $(obj); + + slider.count += 1; + slider.last = slider.count - 1; + + // append new slide + if (vertical && reverse) { + (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj); + } else { + (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj); + } + + // update currentSlide, animatingTo, controlNav, and directionNav + slider.update(pos, "add"); + + // update slider.slides + slider.slides = $(slider.vars.selector + ':not(.clone)', slider); + // re-setup the slider to accomdate new slide + slider.setup(); + + //FlexSlider: added() Callback + slider.vars.added(slider); + }; + slider.removeSlide = function (obj) { + var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj; + + // update count + slider.count -= 1; + slider.last = slider.count - 1; + + // remove slide + if (isNaN(obj)) { + $(obj, slider.slides).remove(); + } else { + (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove(); + } + + // update currentSlide, animatingTo, controlNav, and directionNav + slider.doMath(); + slider.update(pos, "remove"); + + // update slider.slides + slider.slides = $(slider.vars.selector + ':not(.clone)', slider); + // re-setup the slider to accomdate new slide + slider.setup(); + + // FlexSlider: removed() Callback + slider.vars.removed(slider); + }; + + //FlexSlider: Initialize + methods.init(); + }; + + // Ensure the slider isn't focussed if the window loses focus. + $(window).blur(function (e) { + focused = false; + }).focus(function (e) { + focused = true; + }); + + //FlexSlider: Default Settings + $.flexslider.defaults = { + namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin + selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril + animation: "fade", //String: Select your animation type, "fade" or "slide" + easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported! + direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" + reverse: false, //{NEW} Boolean: Reverse the animation direction + animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end + smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode + startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide) + slideshow: true, //Boolean: Animate slider automatically + slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds + animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds + initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds + randomize: false, //Boolean: Randomize slide order + fadeFirstSlide: true, //Boolean: Fade in the first slide when animation type is "fade" + thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav. + + // Usability features + pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended. + pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering + pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage. + useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available + touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices + video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches + + // Primary Controls + controlNav: true, //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage + directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) + prevText: "Previous", //String: Set the text for the "previous" directionNav item + nextText: "Next", //String: Set the text for the "next" directionNav item + + // Secondary Navigation + keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys + multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present. + mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel + pausePlay: false, //Boolean: Create pause/play dynamic element + pauseText: "Pause", //String: Set the text for the "pause" pausePlay item + playText: "Play", //String: Set the text for the "play" pausePlay item + + // Special properties + controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found. + manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs. + customDirectionNav: "", //{NEW} jQuery Object/Selector: Custom prev / next button. Must be two jQuery elements. In order to make the events work they have to have the classes "prev" and "next" (plus namespace) + sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care. + asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider + + // Carousel Options + itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding. + itemMargin: 0, //{NEW} Integer: Margin between carousel items. + minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this. + maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit. + move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items. + allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide + + // Browser Specific + isFirefox: false, // {NEW} Boolean: Set to true when Firefox is the browser used. + + // Callback API + start: function () { }, //Callback: function(slider) - Fires when the slider loads the first slide + before: function () { }, //Callback: function(slider) - Fires asynchronously with each slider animation + after: function () { }, //Callback: function(slider) - Fires after each slider animation completes + end: function () { }, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) + added: function () { }, //{NEW} Callback: function(slider) - Fires after a slide is added + removed: function () { }, //{NEW} Callback: function(slider) - Fires after a slide is removed + init: function () { }, //{NEW} Callback: function(slider) - Fires after the slider is initially setup + rtl: false //{NEW} Boolean: Whether or not to enable RTL mode + }; + + //FlexSlider: Plugin Function + $.fn.flexslider = function (options) { + if (options === undefined) { options = {}; } + + if (typeof options === "object") { + return this.each(function () { + var $this = $(this), + selector = (options.selector) ? options.selector : ".slides > li", + $slides = $this.find(selector); + + if (($slides.length === 1 && options.allowOneSlide === false) || $slides.length === 0) { + $slides.fadeIn(400); + if (options.start) { options.start($this); } + } else if ($this.data('flexslider') === undefined) { + new $.flexslider(this, options); + } + }); + } else { + // Helper strings to quickly perform functions on the slider + var $slider = $(this).data('flexslider'); + switch (options) { + case "play": $slider.play(); break; + case "pause": $slider.pause(); break; + case "stop": $slider.stop(); break; + case "next": $slider.flexAnimate($slider.getTarget("next"), true); break; + case "prev": + case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break; + default: if (typeof options === "number") { $slider.flexAnimate(options, true); } + } + } + }; +}; diff --git a/amd/src/icon_system_fontawesome.js b/amd/src/icon_system_fontawesome.js index 37a7549..0a4b29d 100644 --- a/amd/src/icon_system_fontawesome.js +++ b/amd/src/icon_system_fontawesome.js @@ -13,15 +13,15 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Adaptable theme. - * - * @module theme_adaptable/icon_system_fontawesome - * @copyright 2023 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ +// +// Adaptable theme. +// +// @module theme_adaptable/icon_system_fontawesome +// @copyright 2023 G J Barnard +// {@link https://moodle.org/user/profile.php?id=442195} +// {@link https://gjbarnard.co.uk} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/localstorage', 'core/url'], function(IconSystem, $, Ajax, Mustache, LocalStorage, Url) { diff --git a/amd/src/jqueryeasing.js b/amd/src/jqueryeasing.js new file mode 100644 index 0000000..1ae59a3 --- /dev/null +++ b/amd/src/jqueryeasing.js @@ -0,0 +1,190 @@ +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +// +// ES6 wrapper for jqueryeasing. +// +// @module theme_adaptable/jqueryeasing +// @copyright 2024 G J Barnard. +// @author G J Barnard - +// {@link https://moodle.org/user/profile.php?id=442195} +// {@link https://gjbarnard.co.uk} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// + +import $ from 'jquery'; +import log from 'core/log'; + +/** + * Initialise jqueryeasing. + */ +export default function jqueryeasingInit() { + log.debug('Adaptable ES6 jqueryeasing init'); + /* + * jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/ + * Open source under the BSD License. + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE + */ + + // Preserve the original jQuery "swing" easing as "jswing" + if (typeof $.easing !== 'undefined') { + $.easing['jswing'] = $.easing['swing']; + } + + var pow = Math.pow, + sqrt = Math.sqrt, + sin = Math.sin, + cos = Math.cos, + PI = Math.PI, + c1 = 1.70158, + c2 = c1 * 1.525, + c3 = c1 + 1, + c4 = (2 * PI) / 3, + c5 = (2 * PI) / 4.5; + + // x is the fraction of animation progress, in the range 0..1 + function bounceOut(x) { + var n1 = 7.5625, + d1 = 2.75; + if (x < 1 / d1) { + return n1 * x * x; + } else if (x < 2 / d1) { + return n1 * (x -= (1.5 / d1)) * x + .75; + } else if (x < 2.5 / d1) { + return n1 * (x -= (2.25 / d1)) * x + .9375; + } else { + return n1 * (x -= (2.625 / d1)) * x + .984375; + } + } + + $.extend($.easing, + { + def: 'easeOutQuad', + swing: function (x) { + return $.easing[$.easing.def](x); + }, + easeInQuad: function (x) { + return x * x; + }, + easeOutQuad: function (x) { + return 1 - (1 - x) * (1 - x); + }, + easeInOutQuad: function (x) { + return x < 0.5 ? + 2 * x * x : + 1 - pow(-2 * x + 2, 2) / 2; + }, + easeInCubic: function (x) { + return x * x * x; + }, + easeOutCubic: function (x) { + return 1 - pow(1 - x, 3); + }, + easeInOutCubic: function (x) { + return x < 0.5 ? + 4 * x * x * x : + 1 - pow(-2 * x + 2, 3) / 2; + }, + easeInQuart: function (x) { + return x * x * x * x; + }, + easeOutQuart: function (x) { + return 1 - pow(1 - x, 4); + }, + easeInOutQuart: function (x) { + return x < 0.5 ? + 8 * x * x * x * x : + 1 - pow(-2 * x + 2, 4) / 2; + }, + easeInQuint: function (x) { + return x * x * x * x * x; + }, + easeOutQuint: function (x) { + return 1 - pow(1 - x, 5); + }, + easeInOutQuint: function (x) { + return x < 0.5 ? + 16 * x * x * x * x * x : + 1 - pow(-2 * x + 2, 5) / 2; + }, + easeInSine: function (x) { + return 1 - cos(x * PI / 2); + }, + easeOutSine: function (x) { + return sin(x * PI / 2); + }, + easeInOutSine: function (x) { + return -(cos(PI * x) - 1) / 2; + }, + easeInExpo: function (x) { + return x === 0 ? 0 : pow(2, 10 * x - 10); + }, + easeOutExpo: function (x) { + return x === 1 ? 1 : 1 - pow(2, -10 * x); + }, + easeInOutExpo: function (x) { + return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? + pow(2, 20 * x - 10) / 2 : + (2 - pow(2, -20 * x + 10)) / 2; + }, + easeInCirc: function (x) { + return 1 - sqrt(1 - pow(x, 2)); + }, + easeOutCirc: function (x) { + return sqrt(1 - pow(x - 1, 2)); + }, + easeInOutCirc: function (x) { + return x < 0.5 ? + (1 - sqrt(1 - pow(2 * x, 2))) / 2 : + (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2; + }, + easeInElastic: function (x) { + return x === 0 ? 0 : x === 1 ? 1 : + -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4); + }, + easeOutElastic: function (x) { + return x === 0 ? 0 : x === 1 ? 1 : + pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1; + }, + easeInOutElastic: function (x) { + return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? + -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : + pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1; + }, + easeInBack: function (x) { + return c3 * x * x * x - c1 * x * x; + }, + easeOutBack: function (x) { + return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2); + }, + easeInOutBack: function (x) { + return x < 0.5 ? + (pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2)) / 2 : + (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2; + }, + easeInBounce: function (x) { + return 1 - bounceOut(1 - x); + }, + easeOutBounce: bounceOut, + easeInOutBounce: function (x) { + return x < 0.5 ? + (1 - bounceOut(1 - 2 * x)) / 2 : + (1 + bounceOut(2 * x - 1)) / 2; + } + } + ); +}; diff --git a/amd/src/pace.js b/amd/src/pace.js new file mode 100644 index 0000000..966cc4c --- /dev/null +++ b/amd/src/pace.js @@ -0,0 +1,986 @@ +/*! + * pace.js v1.2.4 + * https://github.com/CodeByZach/pace/ + * Licensed MIT © HubSpot, Inc. + */ +(function() { + var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Evented, Events, NoTargetError, Pace, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, addEventListener, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldIgnoreURL, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState, + __slice = [].slice, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + + defaultOptions = { + className: '', + catchupTime: 100, + initialRate: .03, + minTime: 250, + ghostTime: 100, + maxProgressPerFrame: 20, + easeFactor: 1.25, + startOnPageLoad: true, + restartOnPushState: true, + restartOnRequestAfter: 500, + target: 'body', + elements: { + checkInterval: 100, + selectors: ['body'] + }, + eventLag: { + minSamples: 10, + sampleCount: 3, + lagThreshold: 3 + }, + ajax: { + trackMethods: ['GET'], + trackWebSockets: true, + ignoreURLs: [] + } + }; + + now = function() { + var _ref; + return (_ref = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date); + }; + + requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + + cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame; + + addEventListener = function(obj, event, callback) { + if (typeof obj.addEventListener === "function") { + return obj.addEventListener(event, callback, false); + } else { + return function() { + if (typeof obj["on" + event] !== "function" || typeof obj["on" + event].eventListeners !== "object") { + var eventListeners = new Events(); + if (typeof obj["on" + event] === "function") { + eventListeners.on(event, obj["on" + event]); + } + obj["on" + event] = function(evt) { + return eventListeners.trigger(event, evt); + }; + obj["on" + event].eventListeners = eventListeners; + } else { + var eventListeners = obj["on" + event].eventListeners; + } + eventListeners.on(event, callback); + }(); + } + }; + + if (requestAnimationFrame == null) { + requestAnimationFrame = function(fn) { + return setTimeout(fn, 50); + }; + cancelAnimationFrame = function(id) { + return clearTimeout(id); + }; + } + + runAnimation = function(fn) { + var last, tick; + last = now(); + tick = function() { + var diff; + diff = now() - last; + if (diff >= 33) { + last = now(); + return fn(diff, function() { + return requestAnimationFrame(tick); + }); + } else { + return setTimeout(tick, 33 - diff); + } + }; + return tick(); + }; + + result = function() { + var args, key, obj; + obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : []; + if (typeof obj[key] === 'function') { + return obj[key].apply(obj, args); + } else { + return obj[key]; + } + }; + + extend = function() { + var key, out, source, sources, val, _i, _len; + out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + for (_i = 0, _len = sources.length; _i < _len; _i++) { + source = sources[_i]; + if (source) { + for (key in source) { + if (!__hasProp.call(source, key)) continue; + val = source[key]; + if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') { + extend(out[key], val); + } else { + out[key] = val; + } + } + } + } + return out; + }; + + avgAmplitude = function(arr) { + var count, sum, v, _i, _len; + sum = count = 0; + for (_i = 0, _len = arr.length; _i < _len; _i++) { + v = arr[_i]; + sum += Math.abs(v); + count++; + } + return sum / count; + }; + + getFromDOM = function(key, json) { + var data, e, el; + if (key == null) { + key = 'options'; + } + if (json == null) { + json = true; + } + el = document.querySelector("[data-pace-" + key + "]"); + if (!el) { + return; + } + data = el.getAttribute("data-pace-" + key); + if (!json) { + return data; + } + try { + return JSON.parse(data); + } catch (_error) { + e = _error; + return typeof console !== "undefined" && console !== null ? console.error("Error parsing inline pace options", e) : void 0; + } + }; + + Evented = (function() { + function Evented() {} + + Evented.prototype.on = function(event, handler, ctx, once) { + var _base; + if (once == null) { + once = false; + } + if (this.bindings == null) { + this.bindings = {}; + } + if ((_base = this.bindings)[event] == null) { + _base[event] = []; + } + return this.bindings[event].push({ + handler: handler, + ctx: ctx, + once: once + }); + }; + + Evented.prototype.once = function(event, handler, ctx) { + return this.on(event, handler, ctx, true); + }; + + Evented.prototype.off = function(event, handler) { + var i, _ref, _results; + if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) { + return; + } + if (handler == null) { + return delete this.bindings[event]; + } else { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + if (this.bindings[event][i].handler === handler) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; + + Evented.prototype.trigger = function() { + var args, ctx, event, handler, i, once, _ref, _ref1, _results; + event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if ((_ref = this.bindings) != null ? _ref[event] : void 0) { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; + handler.apply(ctx != null ? ctx : this, args); + if (once) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; + + return Evented; + + })(); + + Pace = window.Pace || {}; + + window.Pace = Pace; + + extend(Pace, Evented.prototype); + + options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM()); + + _ref = ['ajax', 'document', 'eventLag', 'elements']; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + source = _ref[_i]; + if (options[source] === true) { + options[source] = defaultOptions[source]; + } + } + + NoTargetError = (function(_super) { + __extends(NoTargetError, _super); + + function NoTargetError() { + _ref1 = NoTargetError.__super__.constructor.apply(this, arguments); + return _ref1; + } + + return NoTargetError; + + })(Error); + + Bar = (function() { + function Bar() { + this.progress = 0; + } + + Bar.prototype.getElement = function() { + var targetElement; + if (this.el == null) { + targetElement = document.querySelector(options.target); + if (!targetElement) { + throw new NoTargetError; + } + this.el = document.createElement('div'); + this.el.className = "pace pace-active"; + document.body.className = document.body.className.replace(/(pace-done )|/, 'pace-running '); + var _custom_class_name = (options.className !== '') ? ' '+options.className : ''; + this.el.innerHTML = '
        \n
        \n
        \n
        '; + if (targetElement.firstChild != null) { + targetElement.insertBefore(this.el, targetElement.firstChild); + } else { + targetElement.appendChild(this.el); + } + } + return this.el; + }; + + Bar.prototype.finish = function() { + var el; + el = this.getElement(); + el.className = el.className.replace('pace-active', 'pace-inactive'); + return document.body.className = document.body.className.replace('pace-running ', 'pace-done '); + }; + + Bar.prototype.update = function(prog) { + this.progress = prog; + Pace.trigger('progress', prog); + return this.render(); + }; + + Bar.prototype.destroy = function() { + try { + this.getElement().parentNode.removeChild(this.getElement()); + } catch (_error) { + NoTargetError = _error; + } + return this.el = void 0; + }; + + Bar.prototype.render = function() { + var el, key, progressStr, transform, _j, _len1, _ref2; + if (document.querySelector(options.target) == null) { + return false; + } + el = this.getElement(); + transform = "translate3d(" + this.progress + "%, 0, 0)"; + _ref2 = ['webkitTransform', 'msTransform', 'transform']; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + key = _ref2[_j]; + el.children[0].style[key] = transform; + } + if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) { + el.children[0].setAttribute('data-progress-text', "" + (this.progress | 0) + "%"); + if (this.progress >= 100) { + progressStr = '99'; + } else { + progressStr = this.progress < 10 ? "0" : ""; + progressStr += this.progress | 0; + } + el.children[0].setAttribute('data-progress', "" + progressStr); + } + Pace.trigger('change', this.progress); + return this.lastRenderedProgress = this.progress; + }; + + Bar.prototype.done = function() { + return this.progress >= 100; + }; + + return Bar; + + })(); + + Events = (function() { + function Events() { + this.bindings = {}; + } + + Events.prototype.trigger = function(name, val) { + var binding, _j, _len1, _ref2, _results; + if (this.bindings[name] != null) { + _ref2 = this.bindings[name]; + _results = []; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + binding = _ref2[_j]; + _results.push(binding.call(this, val)); + } + return _results; + } + }; + + Events.prototype.on = function(name, fn) { + var _base; + if ((_base = this.bindings)[name] == null) { + _base[name] = []; + } + return this.bindings[name].push(fn); + }; + + return Events; + + })(); + + _XMLHttpRequest = window.XMLHttpRequest; + + _XDomainRequest = window.XDomainRequest; + + _WebSocket = window.WebSocket; + + extendNative = function(to, from) { + var e, key, _results; + _results = []; + for (key in from.prototype) { + try { + if ((to[key] == null) && typeof from[key] !== 'function') { + if (typeof Object.defineProperty === 'function') { + _results.push(Object.defineProperty(to, key, { + get: (function(key) { + return function() { + return from.prototype[key]; + }; + })(key), + configurable: true, + enumerable: true + })); + } else { + _results.push(to[key] = from.prototype[key]); + } + } else { + _results.push(void 0); + } + } catch (_error) { + e = _error; + } + } + return _results; + }; + + ignoreStack = []; + + Pace.ignore = function() { + var args, fn, ret; + fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + ignoreStack.unshift('ignore'); + ret = fn.apply(null, args); + ignoreStack.shift(); + return ret; + }; + + Pace.track = function() { + var args, fn, ret; + fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + ignoreStack.unshift('track'); + ret = fn.apply(null, args); + ignoreStack.shift(); + return ret; + }; + + shouldTrack = function(method) { + var _ref2; + if (method == null) { + method = 'GET'; + } + if (ignoreStack[0] === 'track') { + return 'force'; + } + if (!ignoreStack.length && options.ajax) { + if (method === 'socket' && options.ajax.trackWebSockets) { + return true; + } else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) { + return true; + } + } + return false; + }; + + RequestIntercept = (function(_super) { + __extends(RequestIntercept, _super); + + function RequestIntercept() { + var monitorXHR, + _this = this; + RequestIntercept.__super__.constructor.apply(this, arguments); + monitorXHR = function(req) { + var _open; + _open = req.open; + return req.open = function(type, url, async) { + if (shouldTrack(type)) { + _this.trigger('request', { + type: type, + url: url, + request: req + }); + } + return _open.apply(req, arguments); + }; + }; + window.XMLHttpRequest = function(flags) { + var req; + req = new _XMLHttpRequest(flags); + monitorXHR(req); + return req; + }; + try { + extendNative(window.XMLHttpRequest, _XMLHttpRequest); + } catch (_error) {} + if (_XDomainRequest != null) { + window.XDomainRequest = function() { + var req; + req = new _XDomainRequest; + monitorXHR(req); + return req; + }; + try { + extendNative(window.XDomainRequest, _XDomainRequest); + } catch (_error) {} + } + if ((_WebSocket != null) && options.ajax.trackWebSockets) { + window.WebSocket = function(url, protocols) { + var req; + if (protocols != null) { + req = new _WebSocket(url, protocols); + } else { + req = new _WebSocket(url); + } + if (shouldTrack('socket')) { + _this.trigger('request', { + type: 'socket', + url: url, + protocols: protocols, + request: req + }); + } + return req; + }; + try { + extendNative(window.WebSocket, _WebSocket); + } catch (_error) {} + } + } + + return RequestIntercept; + + })(Events); + + _intercept = null; + + getIntercept = function() { + if (_intercept == null) { + _intercept = new RequestIntercept; + } + return _intercept; + }; + + shouldIgnoreURL = function(url) { + var pattern, _j, _len1, _ref2; + _ref2 = options.ajax.ignoreURLs; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + pattern = _ref2[_j]; + if (typeof pattern === 'string') { + if (url.indexOf(pattern) !== -1) { + return true; + } + } else { + if (pattern.test(url)) { + return true; + } + } + } + return false; + }; + + getIntercept().on('request', function(_arg) { + var after, args, request, type, url; + type = _arg.type, request = _arg.request, url = _arg.url; + if (shouldIgnoreURL(url)) { + return; + } + if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) { + args = arguments; + after = options.restartOnRequestAfter || 0; + if (typeof after === 'boolean') { + after = 0; + } + return setTimeout(function() { + var stillActive, _j, _len1, _ref2, _ref3, _results; + if (type === 'socket') { + stillActive = request.readyState < 1; + } else { + stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4); + } + if (stillActive) { + Pace.restart(); + _ref3 = Pace.sources; + _results = []; + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + source = _ref3[_j]; + if (source instanceof AjaxMonitor) { + source.watch.apply(source, args); + break; + } else { + _results.push(void 0); + } + } + return _results; + } + }, after); + } + }); + + AjaxMonitor = (function() { + function AjaxMonitor() { + this.complete = __bind(this.complete, this); + var _this = this; + this.elements = []; + getIntercept().on('request', function() { + return _this.watch.apply(_this, arguments); + }); + } + + AjaxMonitor.prototype.watch = function(_arg) { + var request, tracker, type, url; + type = _arg.type, request = _arg.request, url = _arg.url; + if (shouldIgnoreURL(url)) { + return; + } + if (type === 'socket') { + tracker = new SocketRequestTracker(request, this.complete); + } else { + tracker = new XHRRequestTracker(request, this.complete); + } + return this.elements.push(tracker); + }; + + AjaxMonitor.prototype.complete = function(tracker) { + return this.elements = this.elements.filter(function(e) { + return e !== tracker; + }); + }; + + return AjaxMonitor; + + })(); + + XHRRequestTracker = (function() { + function XHRRequestTracker(request, completeCallback) { + var event, size, _j, _len1, _onreadystatechange, _ref2, + _this = this; + this.progress = 0; + if (window.ProgressEvent != null) { + size = null; + addEventListener(request, 'progress', function(evt) { + if (evt.lengthComputable) { + return _this.progress = 100 * evt.loaded / evt.total; + } else { + return _this.progress = _this.progress + (100 - _this.progress) / 2; + } + }, false); + _ref2 = ['load', 'abort', 'timeout', 'error']; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + event = _ref2[_j]; + addEventListener(request, event, function() { + completeCallback(_this); + return _this.progress = 100; + }, false); + } + } else { + _onreadystatechange = request.onreadystatechange; + request.onreadystatechange = function() { + var _ref3; + if ((_ref3 = request.readyState) === 0 || _ref3 === 4) { + completeCallback(_this); + _this.progress = 100; + } else if (request.readyState === 3) { + _this.progress = 50; + } + return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0; + }; + } + } + + return XHRRequestTracker; + + })(); + + SocketRequestTracker = (function() { + function SocketRequestTracker(request, completeCallback) { + var event, _j, _len1, _ref2, + _this = this; + this.progress = 0; + _ref2 = ['error', 'open']; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + event = _ref2[_j]; + addEventListener(request, event, function() { + completeCallback(_this); + return _this.progress = 100; + }, false); + } + } + + return SocketRequestTracker; + + })(); + + ElementMonitor = (function() { + function ElementMonitor(options) { + var selector, _j, _len1, _ref2; + if (options == null) { + options = {}; + } + this.complete = __bind(this.complete, this); + this.elements = []; + if (options.selectors == null) { + options.selectors = []; + } + _ref2 = options.selectors; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + selector = _ref2[_j]; + this.elements.push(new ElementTracker(selector, this.complete)); + } + } + + ElementMonitor.prototype.complete = function(tracker) { + return this.elements = this.elements.filter(function(e) { + return e !== tracker; + }); + }; + + return ElementMonitor; + + })(); + + ElementTracker = (function() { + function ElementTracker(selector, completeCallback) { + this.selector = selector; + this.completeCallback = completeCallback; + this.progress = 0; + this.check(); + } + + ElementTracker.prototype.check = function() { + var _this = this; + if (document.querySelector(this.selector)) { + return this.done(); + } else { + return setTimeout((function() { + return _this.check(); + }), options.elements.checkInterval); + } + }; + + ElementTracker.prototype.done = function() { + this.completeCallback(this); + this.completeCallback = null; + return this.progress = 100; + }; + + return ElementTracker; + + })(); + + DocumentMonitor = (function() { + DocumentMonitor.prototype.states = { + loading: 0, + interactive: 50, + complete: 100 + }; + + function DocumentMonitor() { + var _onreadystatechange, _ref2, + _this = this; + this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100; + _onreadystatechange = document.onreadystatechange; + document.onreadystatechange = function() { + if (_this.states[document.readyState] != null) { + _this.progress = _this.states[document.readyState]; + } + return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0; + }; + } + + return DocumentMonitor; + + })(); + + EventLagMonitor = (function() { + function EventLagMonitor() { + var avg, interval, last, points, samples, + _this = this; + this.progress = 0; + avg = 0; + samples = []; + points = 0; + last = now(); + interval = setInterval(function() { + var diff; + diff = now() - last - 50; + last = now(); + samples.push(diff); + if (samples.length > options.eventLag.sampleCount) { + samples.shift(); + } + avg = avgAmplitude(samples); + if (++points >= options.eventLag.minSamples && avg < options.eventLag.lagThreshold) { + _this.progress = 100; + return clearInterval(interval); + } else { + return _this.progress = 100 * (3 / (avg + 3)); + } + }, 50); + } + + return EventLagMonitor; + + })(); + + Scaler = (function() { + function Scaler(source) { + this.source = source; + this.last = this.sinceLastUpdate = 0; + this.rate = options.initialRate; + this.catchup = 0; + this.progress = this.lastProgress = 0; + if (this.source != null) { + this.progress = result(this.source, 'progress'); + } + } + + Scaler.prototype.tick = function(frameTime, val) { + var scaling; + if (val == null) { + val = result(this.source, 'progress'); + } + if (val >= 100) { + this.done = true; + } + if (val === this.last) { + this.sinceLastUpdate += frameTime; + } else { + if (this.sinceLastUpdate) { + this.rate = (val - this.last) / this.sinceLastUpdate; + } + this.catchup = (val - this.progress) / options.catchupTime; + this.sinceLastUpdate = 0; + this.last = val; + } + if (val > this.progress) { + this.progress += this.catchup * frameTime; + } + scaling = 1 - Math.pow(this.progress / 100, options.easeFactor); + this.progress += scaling * this.rate * frameTime; + this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress); + this.progress = Math.max(0, this.progress); + this.progress = Math.min(100, this.progress); + this.lastProgress = this.progress; + return this.progress; + }; + + return Scaler; + + })(); + + sources = null; + + scalers = null; + + bar = null; + + uniScaler = null; + + animation = null; + + cancelAnimation = null; + + Pace.running = false; + + handlePushState = function() { + if (options.restartOnPushState) { + return Pace.restart(); + } + }; + + if (window.history.pushState != null) { + _pushState = window.history.pushState; + window.history.pushState = function() { + handlePushState(); + return _pushState.apply(window.history, arguments); + }; + } + + if (window.history.replaceState != null) { + _replaceState = window.history.replaceState; + window.history.replaceState = function() { + handlePushState(); + return _replaceState.apply(window.history, arguments); + }; + } + + SOURCE_KEYS = { + ajax: AjaxMonitor, + elements: ElementMonitor, + document: DocumentMonitor, + eventLag: EventLagMonitor + }; + + (init = function() { + var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4; + Pace.sources = sources = []; + _ref2 = ['ajax', 'elements', 'document', 'eventLag']; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + type = _ref2[_j]; + if (options[type] !== false) { + sources.push(new SOURCE_KEYS[type](options[type])); + } + } + _ref4 = (_ref3 = options.extraSources) != null ? _ref3 : []; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + source = _ref4[_k]; + sources.push(new source(options)); + } + Pace.bar = bar = new Bar; + scalers = []; + return uniScaler = new Scaler; + })(); + + Pace.stop = function() { + Pace.trigger('stop'); + Pace.running = false; + bar.destroy(); + cancelAnimation = true; + if (animation != null) { + if (typeof cancelAnimationFrame === "function") { + cancelAnimationFrame(animation); + } + animation = null; + } + return init(); + }; + + Pace.restart = function() { + Pace.trigger('restart'); + Pace.stop(); + return Pace.start(); + }; + + Pace.go = function() { + var start; + Pace.running = true; + bar.render(); + start = now(); + cancelAnimation = false; + return animation = runAnimation(function(frameTime, enqueueNextFrame) { + var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2; + remaining = 100 - bar.progress; + count = sum = 0; + done = true; + for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) { + source = sources[i]; + scalerList = scalers[i] != null ? scalers[i] : scalers[i] = []; + elements = (_ref2 = source.elements) != null ? _ref2 : [source]; + for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) { + element = elements[j]; + scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element); + done &= scaler.done; + if (scaler.done) { + continue; + } + count++; + sum += scaler.tick(frameTime); + } + } + avg = sum / count; + bar.update(uniScaler.tick(frameTime, avg)); + if (bar.done() || done || cancelAnimation) { + bar.update(100); + Pace.trigger('done'); + return setTimeout(function() { + bar.finish(); + Pace.running = false; + return Pace.trigger('hide'); + }, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0))); + } else { + return enqueueNextFrame(); + } + }); + }; + + Pace.start = function(_options) { + extend(options, _options); + Pace.running = true; + try { + bar.render(); + } catch (_error) { + NoTargetError = _error; + } + if (!document.querySelector('.pace')) { + return setTimeout(Pace.start, 50); + } else { + Pace.trigger('start'); + return Pace.go(); + } + }; + + if (typeof define === 'function' && define.amd) { + define(function() { + return Pace; + }); + } else if (typeof exports === 'object') { + module.exports = Pace; + } else { + if (options.startOnPageLoad) { + Pace.start(); + } + } + +}).call(this); \ No newline at end of file diff --git a/amd/src/savebutton.js b/amd/src/savebutton.js index 064fd25..1ebdb05 100644 --- a/amd/src/savebutton.js +++ b/amd/src/savebutton.js @@ -13,7 +13,7 @@ // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -// + // // Adaptable save button JS file // @@ -25,41 +25,53 @@ // {@link https://moodle.org/user/profile.php?id=442195} // {@link https://gjbarnard.co.uk} // @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// -/* jshint ignore:start */ -define(['jquery', 'core/log'], function($, log) { - - "use strict"; // ... jshint ;_;. +import $ from 'jquery'; +import log from 'core/log'; - log.debug('Adaptable savebutton.js function called'); +/** + * Save button. + */ +const saveButton = () => { + $("#savediscardsection").hide(); - return { - init: function() { - $(document).ready(function($) { + $('#adminsettings :input').on('change input', function () { + $("#savediscardsection").fadeIn('slow'); + }); - $("#savediscardsection").hide(); + $("#adminsubmitbutton").click(function () { + window.onbeforeunload = null; + $("#adminsettings").submit(); + }); + $("#adminresetbutton").click(function () { + var confirmString = $(this).data('confirm'); // Saves an AJAX call for such a rare thing. + var result = confirm(confirmString); + if (result == true) { + $('#adminsettings')[0].reset(); + $("#savediscardsection").hide(); + } + }); - $('#adminsettings :input').on('change input', function() { - $("#savediscardsection").fadeIn('slow'); - }); + $(".colourdialogue").click(function () { + $("#savediscardsection").fadeIn('slow'); + }); +}; - $("#adminsubmitbutton").click(function() { - window.onbeforeunload = null; - $("#adminsettings").submit(); - }); - $("#adminresetbutton").click(function() { - var result = confirm("This resets any changes made since loading this page. Are you sure?"); - if (result == true) { - $('#adminsettings')[0].reset(); - $("#savediscardsection").hide(); - } - }); +/** + * Init. + */ +export const saveButtonInit = () => { + log.debug('Adaptable ES6 Save button Init'); - $(".colourdialogue").click(function() { - $("#savediscardsection").fadeIn('slow'); - }); - }); - } - }; -}); -/* jshint ignore:end */ + if (document.readyState !== 'loading') { + log.debug("Adaptable ES6 Save button Init DOM content already loaded"); + saveButton(); + } else { + log.debug("Adaptable ES6 Save button Init JS DOM content not loaded"); + document.addEventListener('DOMContentLoaded', function () { + log.debug("Adaptable ES6 Save button Init JS DOM content loaded"); + saveButton(); + }); + } +}; diff --git a/amd/src/slider.js b/amd/src/slider.js new file mode 100644 index 0000000..8af885a --- /dev/null +++ b/amd/src/slider.js @@ -0,0 +1,105 @@ +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +// +// Slider +// +// @module theme_adaptable/slider +// @copyright 2024 G J Barnard. +// @author G J Barnard - +// {@link https://moodle.org/user/profile.php?id=442195} +// {@link https://gjbarnard.co.uk} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// + +import $ from 'jquery'; +import { flexslider } from 'theme_adaptable/flexslider'; +import log from 'core/log'; + +/** + * Initialise this module. + */ +export const init = () => { + + const sliderInit = () => { + flexslider(); + + // Slider. + if ($('#main-slider').length) { + $('#main-slider').flexslider({ + namespace: "flex-", // New: {NEW} String: Prefix string attached to the class of every element generated by the plugin. + selector: ".slides > li", // New: {NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril + animation: "slide", // String: Select your animation type, "fade" or "slide". + easing: "swing", // {NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported! + direction: "horizontal", // String: Select the sliding direction, "horizontal" or "vertical". + reverse: false, // {NEW} Boolean: Reverse the animation direction. + animationLoop: true, // Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end. + smoothHeight: false, // {NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode. + startAt: 0, // Integer: The slide that the slider should start on. Array notation (0 = first slide). + slideshow: true, // Boolean: Animate slider automatically. + slideshowSpeed: 7000, // Integer: Set the speed of the slideshow cycling, in milliseconds. + animationSpeed: 600, // Integer: Set the speed of animations, in milliseconds. + initDelay: 0, // {NEW} Integer: Set an initialization delay, in milliseconds. + randomize: false, // Boolean: Randomize slide order. + + // Usability features. + pauseOnAction: true, // Boolean: Pause the slideshow when interacting with control elements, highly recommended. + pauseOnHover: false, // Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering. + useCSS: true, // {NEW} Boolean: Slider will use CSS3 transitions if available. + touch: true, // {NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices. + video: false, // {NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches. + + // Primary Controls. + controlNav: true, // Boolean: Create navigation for paging control of each slide? Note! Leave true for manualControls usage. + directionNav: true, // Boolean: Create navigation for previous / next navigation? (true/false). + prevText: "Previous", // String: Set the text for the "previous" directionNav item. + nextText: "Next", // String: Set the text for the "next" directionNav item. + + // Secondary Navigation. + keyboard: true, // Boolean: Allow slider navigating via keyboard left/right keys. + multipleKeyboard: false, // {NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present. + mousewheel: false, // {UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel. + pausePlay: false, // Boolean: Create pause/play dynamic element. + pauseText: 'Pause', // String: Set the text for the "pause" pausePlay item. + playText: 'Play', // String: Set the text for the "play" pausePlay item. + + // Special properties. + controlsContainer: "", // {UPDATED} Selector: USE CLASS SELECTOR. Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be ".flexslider-container". Property is ignored if given element is not found. + manualControls: "", // Selector: Declare custom control navigation. Examples would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs. + sync: "", // {NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care. + asNavFor: "", // {NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider. + }); + + if ($('.container.slidewrap').length) { + $(".container.slidewrap").on('transitionend', function () { + var slider1 = $('#main-slider').data('flexslider'); + slider1.resize(); + }); + } + } + + }; + + if (document.readyState !== 'loading') { + log.debug("Adaptable ES6 Slider JS DOM content already loaded"); + sliderInit(); + } else { + log.debug("Adaptable ES6 Slider JS DOM content not loaded"); + document.addEventListener('DOMContentLoaded', function () { + log.debug("Adaptable ES6 Slider JS DOM content loaded"); + sliderInit(); + }); + } +}; diff --git a/amd/src/tabbed.js b/amd/src/tabbed.js new file mode 100644 index 0000000..9d9279b --- /dev/null +++ b/amd/src/tabbed.js @@ -0,0 +1,117 @@ +// +// This file is part of Adaptable theme for moodle +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +// +// Adaptable Tabbed JS file +// +// @package theme_adaptable +// @copyright 2015-2019 Jeremy Hopkins (Coventry University) +// @copyright 2018-2019 Manoj Solanki (Coventry University) +// @copyright 2019 G J Barnard +// {@link https://moodle.org/user/profile.php?id=442195} +// {@link https://gjbarnard.co.uk} +// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +// + +import $ from 'jquery'; +import log from 'core/log'; + +/** + * Tabbed. + * + * @param {string} currentpage The current page. + * @param {string} tabpersistencetime The persistance time of the current set tab. + */ +const tabbed = (currentpage, tabpersistencetime) => { + if (currentpage == 'coursepage') { + var hasStorage = ("sessionStorage" in window && window.sessionStorage); + var now, expiration; + var currentUrl = document.location.toString(); + + if ((hasStorage) && (currentUrl.indexOf('course/view.php?id=') != -1)) { + + var tabValues = JSON.parse(sessionStorage.getItem('tabValues')) || {}; + var tabTimestamp = JSON.parse(sessionStorage.getItem('tabTimestamp')); + var $radiobuttons = $("#coursetabcontainer :radio"); + var now = new Date(); + + const setTimestamp = (timestamp) => { + var timeStampJSON = JSON.stringify(timestamp); + log.debug('Adaptable ES6 Tabbled: Setting timestamp to ' + timeStampJSON); + sessionStorage.setItem("tabTimestamp", timeStampJSON); + }; + + // Check timestamp for session. + if (tabTimestamp) { + // Calculate expiration time for content, to force periodic refresh after 'tabpersistencetime' minutes. + expiration = new Date(tabTimestamp); + expiration.setMinutes(expiration.getMinutes() + parseInt(tabpersistencetime)); + if (now.getTime() > expiration.getTime()) { + log.debug('Adaptable ES6 Tabbled: Expired'); + sessionStorage.removeItem('tabValues'); + tabValues = {}; + } + } + setTimestamp(now); + + var params = (new URL(document.location)).searchParams; + var courseid = params.get("id"); + + $radiobuttons.on("change", function () { + $radiobuttons.each(function () { + if (this.checked) { + tabValues[courseid] = this.id; + } + }); + sessionStorage.setItem("tabValues", JSON.stringify(tabValues)); + }); + + var tabhasbeenset = false; + $.each(tabValues, function (key, value) { + if (key == courseid) { + $("#" + value).prop('checked', true); + tabhasbeenset = true; + } + }); + if (tabhasbeenset == false) { + $("input:radio[name=tabs]:first").attr('checked', true); + } + + $('label.coursetab').show(); + } + + } +}; + +/** + * Init. + * + * @param {string} currentpage The current page. + * @param {string} tabpersistencetime The persistance time of the current set tab. +*/ +export const init = (currentpage, tabpersistencetime) => { + log.debug('Adaptable ES6 Tabbled init'); + if (document.readyState !== 'loading') { + log.debug("Adaptable ES6 Tabbled init DOM content already loaded"); + tabbed(currentpage, tabpersistencetime); + } else { + log.debug("Adaptable ES6 Tabbled init JS DOM content not loaded"); + document.addEventListener('DOMContentLoaded', function () { + log.debug("Adaptable ES6 Tabbled init JS DOM content loaded"); + tabbed(currentpage, tabpersistencetime); + }); + } +}; diff --git a/amd/src/templatepreview.js b/amd/src/templatepreview.js deleted file mode 100644 index 82168a3..0000000 --- a/amd/src/templatepreview.js +++ /dev/null @@ -1,41 +0,0 @@ -// -// This file is part of Adaptable theme for moodle -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . -// -// -// Adaptable Template Preview JS file -// -// @package theme_adaptable -// @copyright 2020 G J Barnard -// {@link https://moodle.org/user/profile.php?id=442195} -// {@link https://gjbarnard.co.uk} -// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - -/* jshint ignore:start */ -define(['jquery', 'core/log'], function($, log) { - - "use strict"; // jshint ;_; - - log.debug('Adaptable Template Preview AMD'); - - return { - init: function() { - $(document).ready(function() { - log.debug('Adaptable Template Preview AMD init'); - }); - } - }; -}); -/* jshint ignore:end */ diff --git a/amd/src/utils.js b/amd/src/utils.js deleted file mode 100644 index 3a7dee1..0000000 --- a/amd/src/utils.js +++ /dev/null @@ -1,100 +0,0 @@ -// -// This file is part of Adaptable theme for moodle -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . -// -// -// Adaptable main JS file -// -// @package theme_adaptable -// @copyright 2015-2019 Jeremy Hopkins (Coventry University) -// @copyright 2018-2019 Manoj Solanki (Coventry University) -// @copyright 2019 G J Barnard -// {@link https://moodle.org/user/profile.php?id=442195} -// {@link https://gjbarnard.co.uk} -// @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - -/* jshint ignore:start */ -define(["jquery", "core/log"], function($, log) { - - "use strict"; // ... jshint ;_;. - return { - init: function(currentpage, tabpersistencetime) { - - $(document).ready(function($) { - if (currentpage == 'coursepage') { - var hasStorage = ("sessionStorage" in window && window.sessionStorage); - var now, expiration; - var currentUrl = document.location.toString(); - - if ( (hasStorage) && (currentUrl.indexOf('course/view.php?id=') != -1) ) { - - var tabValues = JSON.parse(sessionStorage.getItem('tabValues')) || {}; - var tabTimestamp = JSON.parse(sessionStorage.getItem('tabTimestamp')); - var $radiobuttons = $("#coursetabcontainer :radio"); - - // Check timestamp for session. - if (tabTimestamp) { - // calculate expiration time for content, - // to force periodic refresh after 30 minutes - now = new Date(); - expiration = new Date(tabTimestamp); - expiration.setMinutes(expiration.getMinutes() + parseInt(tabpersistencetime)); - if (now.getTime() > expiration.getTime()) { - log.debug('Expired'); - sessionStorage.removeItem('tabTimestamp'); - sessionStorage.removeItem('tabValues'); - tabValues = {}; - } - - // Reset timestamp anyway as user is still active. - sessionStorage.setItem("tabTimestamp", JSON.stringify(new Date())); - } else { - sessionStorage.setItem("tabTimestamp", JSON.stringify(new Date())); - log.debug('Setting timestamp'); - } - - var params = (new URL(document.location)).searchParams; - var courseid = params.get("id"); - - $radiobuttons.on("change", function() { - - $radiobuttons.each(function(){ - if (this.checked) { - tabValues[courseid] = this.id; - } - }); - sessionStorage.setItem("tabValues", JSON.stringify(tabValues)); - }); - - var tabhasbeenset = false; - $.each(tabValues, function(key, value) { - if (key == courseid) { - $("#" + value).prop('checked', true); - tabhasbeenset = true; - } - }); - if (tabhasbeenset == false) { - $("input:radio[name=tabs]:first").attr('checked', true); - } - - $('label.coursetab').show(); - } - - } - }); - } - }; -}); -/* jshint ignore:end */ diff --git a/classes/admin_setting_configstoredfile_putprops.php b/classes/admin_setting_configstoredfile_putprops.php new file mode 100644 index 0000000..84753ef --- /dev/null +++ b/classes/admin_setting_configstoredfile_putprops.php @@ -0,0 +1,163 @@ +. + +/** + * Upload a properties file but don't store. + * + * @package theme_adaptable + * @copyright 2024 G J Barnard + * {@link https://moodle.org/user/profile.php?id=442195} + * {@link https://gjbarnard.co.uk} + * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + +namespace theme_adaptable; + +use context_user; + +/** + * Upload a properties file but don't store. + */ +class admin_setting_configstoredfile_putprops extends \admin_setting_configstoredfile { + /** @var string Name of the plugin. */ + private $pluginname; + /** @var string Frankenstyle of the plugin. */ + private $pluginfrankenstyle; + /** @var string Name of the 'callable' function to call with the name of the theme and the properties as an array. */ + private $callme; + /** @var string Setting name (same plugin) for the report to be written to. */ + private $reportsettingname; + /** @var admin_setting_putprops Pointer to admin_setting_putprops setting instance for writing the report. */ + private $adminsettingputprops = null; + + /** + * Create new stored files setting. + * + * @param string $name :ow level setting name. + * @param string $visiblename Human readable setting name. + * @param string $description Description of setting. + * @param mixed $filearea File area for file storage. + * @param string $pluginname Name of the plugin. + * @param string $pluginfrankenstyle Frankenstyle of the plugin. + * @param string $callme Name of the 'callable' function to call with the name of the theme and the properties as an array. + * @param string $reportsettingname Setting name (same plugin) for the report to be written to + * @param array $options File area options. + * @param int $itemid itemid for file storage. + */ + public function __construct( + $name, $visiblename, $description, $filearea, $pluginname, $pluginfrankenstyle, $callme, $reportsettingname, + ?array $options, $itemid = 0) { + $this->nosave = true; + $this->pluginname = $pluginname; + $this->pluginfrankenstyle = $pluginfrankenstyle; + $this->callme = $callme; + $this->reportsettingname = $reportsettingname; + parent::__construct($name, $visiblename, $description, $filearea, $itemid, $options); + } + + /** + * Get setting method. + * @return none + */ + public function get_setting() { + return ''; + } + + /** + * Get default settings. + * @return string '' + */ + public function get_defaultsetting() { + return ''; + } + + /** + * Tell us the admin_setting_putprops instance. + */ + public function set_admin_setting_putprops($adminsettingputprops) { + $this->adminsettingputprops = $adminsettingputprops; + } + + /** + * Process the uploaded file. + * + * @param string $data Draft item id. + * + * @return mixed Result of processing. + */ + public function write_setting($data) { + global $USER; + + if (!empty($data)) { + if (!is_number($data)) { + // Draft item id is expected here! + return get_string('errorsetting', 'admin'); + } + $fs = get_file_storage(); + $component = is_null($this->plugin) ? 'core' : $this->plugin; + // Make sure the settings form was not open for more than 4 days and draft areas deleted in the meantime. + // But we can safely ignore that if the destination area is empty, so that the user is not prompt + // with an error because the draft area does not exist, as they did not use it. + $usercontext = context_user::instance($USER->id); + if (!$fs->file_exists($usercontext->id, 'user', 'draft', $data, '/', '.')) { + // Draft file does not exist for some reason! + return ''; + } + $files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data, 'sortorder,filepath,filename', false); + if ($files) { + /** @var stored_file $file */ + $file = reset($files); + } + if ($file) { + // Only attempt decode if we have the start of a JSON string, otherwise will certainly be the saved report. + $filedata = $file->get_content(); + if ((!empty($filedata)) && ($filedata[0] == '{')) { + $props = json_decode($filedata, true); + if ($props === null) { + if (function_exists('json_last_error_msg')) { + $validated = json_last_error_msg(); + } else { + // Fall back to numeric error for older PHP version. + $validated = json_last_error(); + } + } else { + $report = call_user_func($this->callme, $this->pluginname, $this->pluginfrankenstyle, $props); + if (!empty($this->adminsettingputprops)) { + $this->adminsettingputprops->set_filereport($report); + } + + // Success. + $callbackfunction = $this->updatedcallback; + if (!empty($callbackfunction) && function_exists($callbackfunction)) { + $callbackfunction($this->get_full_name()); + } + } + } else { + return get_string('errorsetting', 'admin'); + } + } else { + return get_string('errorsetting', 'admin'); + } + } + + /*$validated = $this->validate($data); + if ($validated !== true) { + return $validated; + }*/ + + return ''; + } +} diff --git a/classes/admin_setting_configstoredfiles.php b/classes/admin_setting_configstoredfiles.php index d97e3e8..48390d0 100644 --- a/classes/admin_setting_configstoredfiles.php +++ b/classes/admin_setting_configstoredfiles.php @@ -28,6 +28,7 @@ namespace theme_adaptable; use context_system; +use context_user; defined('MOODLE_INTERNAL') || die; @@ -54,7 +55,7 @@ class admin_setting_configstoredfiles extends \admin_setting_configstoredfile { * @param array $options file area options. * @param int $itemid itemid for file storage. */ - public function __construct($name, $visiblename, $description, $filearea, array $options = null, $itemid = 0) { + public function __construct($name, $visiblename, $description, $filearea, ?array $options, $itemid = 0) { $this->oldhashes = []; $this->owner = null; parent::__construct($name, $visiblename, $description, $filearea, $itemid, $options); @@ -244,6 +245,128 @@ public function post_write_settings($original) { return true; } + /** + * Base 64 encode. + */ + public function base64encode() { + global $PAGE, $USER; + $component = is_null($this->plugin) ? 'theme_adaptable' : $this->plugin; + $itemid = theme_get_revision(); + $syscontext = context_system::instance(); + + $fs = get_file_storage(); + $files = $fs->get_area_files( + $syscontext->id, $component, $this->filearea, 0, 'sortorder,filepath,filename', false); // Item id could not be 0! + + $settingfiles = []; + foreach ($files as $file) { + $filename = $file->get_filename(); + $orginalcreated = $file->get_timecreated(); + $filecontent = $file->get_content(); + $base64enc = base64_encode($filecontent); + + $settingarrfile = [ + 'filepath' => $file->get_filepath(), + 'filename' => $file->get_filename(), + 'author' => $file->get_author(), + 'license' => $file->get_license(), + 'timecreated' => $file->get_timecreated(), + 'timemodified' => $file->get_timemodified(), + 'mimetype' => $file->get_mimetype(), + 'content' => $base64enc, + ]; + $settingfilejson = json_encode($settingarrfile, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); + $settingfileent = htmlentities($settingfilejson, ENT_COMPAT); + $settingfiles[] = $settingfileent; + } + + $settingfilesjson = json_encode($settingfiles, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); + $settingarr = [$this->filearea => $settingfilesjson]; + $settingarrjson = json_encode($settingarr, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); + + return $settingarrjson; + } + + /** + * Base 64 decode. + */ + public function base64decode($settingarrjson) { + global $USER; + $component = is_null($this->plugin) ? 'theme_adaptable' : $this->plugin; + $syscontext = context_system::instance(); + + $settingarrjsondec = json_decode($settingarrjson, true); + $settingarrdec = $settingarrjsondec[$this->filearea]; + + $settingsfilesjsondec = json_decode($settingarrdec, true); + + $fs = get_file_storage(); + $draftfiles = []; + foreach ($settingsfilesjsondec as $settingsfilejsondec) { + $settingfileentdec = html_entity_decode($settingsfilejsondec, ENT_COMPAT); + $settingfilejsondec = json_decode($settingfileentdec, true); + + $base64dec = base64_decode($settingfilejsondec['content']); + $filerecord = [ + 'contextid' => context_user::instance($USER->id)->id, + 'component' => 'user', + 'filearea' => 'draft', + 'itemid' => file_get_unused_draft_itemid(), + 'filepath' => '/', + 'filename' => $settingfilejsondec['filename'], + // Don't use userid as could be different! + 'author' => $settingfilejsondec['author'], + 'license' => $settingfilejsondec['license'], + 'timecreated' => time(), + 'timemodified' => time(), + 'mimetype' => $settingfilejsondec['mimetype'], + ]; + $draftfiles[] = $fs->create_file_from_string($filerecord, $base64dec); // Draft. + } + + // Got this far with all the draft files created... + $files = $fs->get_area_files( + $syscontext->id, $component, $this->filearea, 0, 'sortorder,filepath,filename', false); // Item id could not be 0! + foreach ($files as $file) { + if (!empty($file)) { + $file->delete(); + } + } + + foreach ($draftfiles as $draftfile) { + $filerecord = [ + 'contextid' => $syscontext->id, + 'component' => $component, + 'filearea' => $this->filearea, + 'itemid' => '0', + 'filepath' => $draftfile->get_filepath(), + 'filename' => $draftfile->get_filename(), + 'author' => $draftfile->get_author(), + 'license' => $draftfile->get_license(), + 'timecreated' => $draftfile->get_timecreated(), + 'timemodified' => $draftfile->get_timemodified(), + 'mimetype' => $draftfile->get_mimetype(), + ]; + $settingfile = $fs->create_file_from_string($filerecord, $draftfile->get_content()); // Replacement. + + $draftfile->delete(); // Finished with draft. + } + + $files = $fs->get_area_files( + $syscontext->id, $component, $this->filearea, 0, 'sortorder,filepath,filename', false); // Item id could not be 0! + $filepath = ''; + if ($files) { + /** @var stored_file $file */ + $file = reset($files); + $filepath = $file->get_filepath().$file->get_filename(); + } + $result = ($this->config_write($this->filearea, $filepath) ? '' : get_string('errorsetting', 'admin')); + $callbackfunction = $this->updatedcallback; + if (!empty($callbackfunction) && is_callable($callbackfunction)) { + $callbackfunction($this->get_full_name()); + } + } + // Adapted from theme_config class. /** * Returns URL to the stored file via pluginfile.php. diff --git a/classes/admin_setting_getprops.php b/classes/admin_setting_getprops.php new file mode 100644 index 0000000..76450a9 --- /dev/null +++ b/classes/admin_setting_getprops.php @@ -0,0 +1,270 @@ +. + +/** + * Get properties setting. + * + * @package theme_adaptable + * @copyright 2018 G J Barnard + * {@link https://moodle.org/user/profile.php?id=442195} + * {@link https://gjbarnard.co.uk} + * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + +namespace theme_adaptable; + +use context_system; +use context_user; +use html_table; +use html_writer; +use moodle_url; + +/** + * Get properties class. + */ +class admin_setting_getprops extends \admin_setting { + /** @var string Plugin frankenstyle. */ + private $pluginfrankenstyle; + + /** @var string Return button name. */ + private $returnbuttonname; + + /** @var string Section name. */ + private $settingsectionname; + + /** @var string Save properties button name. */ + private $savepropsbuttonname; + + /** @var string Save properties with files as a string button name. */ + private $savepropsfilestoobuttonname; + + /** @var string Save properties with files as a file button name. */ + private $savepropsfilestoofilebuttonname; + + /** + * Not a setting, just properties. + * @param string $name Unique ascii name, either 'mysetting' for settings that in config, + * or 'myplugin/mysetting' for ones in config_plugins. + * @param string $heading Heading. + * @param string $information Text in box. + * @param string $pluginfrankenstyle Plugin frankenstyle. + * @param string $props Properties. + * @param string $settingsectionname Setting section name. + * @param string $returnbuttonname Return button name. + * @param string $savepropsbuttonname Save properties button name. + * @param string $savepropsfilestoobuttonname Save properties with files as a string button name. + * @param string $savepropsfilestoofilebuttonname Save properties with files as a file button name. + */ + public function __construct( + $name, + $heading, + $information, + $pluginfrankenstyle, + $settingsectionname, + $returnbuttonname, + $savepropsbuttonname, + $savepropsfilestoobuttonname, + $savepropsfilestoofilebuttonname + ) { + $this->nosave = true; + $this->pluginfrankenstyle = $pluginfrankenstyle; + $this->returnbuttonname = $returnbuttonname; + $this->settingsectionname = $settingsectionname; + $this->savepropsbuttonname = $savepropsbuttonname; + $this->savepropsfilestoobuttonname = $savepropsfilestoobuttonname; + $this->savepropsfilestoofilebuttonname = $savepropsfilestoofilebuttonname; + parent::__construct($name, $heading, $information, ''); // Last parameter is default. + } + + /** + * Get setting method. + * @return none + */ + public function get_setting() { + return ''; + } + + /** + * Get default settings method. + * @return string '' + */ + public function get_defaultsetting() { + return ''; + } + + /** + * Never write settings + * + * @param string $data setting to write + * + * @return string Always returns an empty string + */ + public function write_setting($data) { + return ''; + } + + /** + * Returns an HTML string + * + * @param string $data Data + * @param string $query Query + * + * @return string Returns an HTML string + */ + public function output_html($data, $query = '') { + $return = ''; + + $saveprops = optional_param($this->pluginfrankenstyle.'_getprops_saveprops', 0, PARAM_INT); + $savepropsfilestoo = optional_param($this->pluginfrankenstyle.'_getprops_saveprops_filestoo', 0, PARAM_INT); + $savepropsfilestoofile = optional_param($this->pluginfrankenstyle.'_getprops_saveprops_filestoofile', 0, PARAM_INT); + if ($saveprops) { + $props = \theme_adaptable\toolbox::get_properties($this->pluginfrankenstyle); + + $returnurl = new moodle_url('/admin/settings.php', ['section' => $this->settingsectionname]); + $returnbutton = ''; + $return .= $returnbutton; + $return .= '
        '; + $return .= ''; + $return .= $returnbutton; + $return .= '
        '; + } else if (($savepropsfilestoo) || ($savepropsfilestoofile)) { + $props = \theme_adaptable\toolbox::get_properties($this->pluginfrankenstyle, true); + + $jsonprops = json_encode($props[\theme_adaptable\toolbox::PROPS], + JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS); + + $alertstate = 'success'; + if ($savepropsfilestoofile) { + $fs = get_file_storage(); + $syscontext = context_system::instance(); + $files = $fs->get_area_files( + $syscontext->id, $this->pluginfrankenstyle, 'propertyfiles', 0, 'filepath,filename', false); + if (count($files) < 8) { + global $USER; + $time = time(); + $datetime = new \DateTime("now", \core_date::get_user_timezone_object()); + // Appended seconds. + $userdate = userdate($datetime->getTimestamp(), get_string('backupnameformat', 'core_langconfig').'%S'); + $filename = "Adaptable_".get_string('settings')."_".$userdate.".json"; + + $filerecord = [ + 'contextid' => context_user::instance($USER->id)->id, + 'component' => 'user', + 'filearea' => 'draft', + 'itemid' => file_get_unused_draft_itemid(), + 'filepath' => '/', + 'filename' => $filename, + // Don't use userid as could be different! + 'author' => fullname($USER, true), + 'license' => '', + 'timecreated' => $time, + 'timemodified' => $time, + 'mimetype' => 'application/json', + ]; + $draftjson = $fs->create_file_from_string($filerecord, $jsonprops); // Draft. + + // Able to make file.... + $filerecord = [ + 'contextid' => $syscontext->id, + 'component' => $this->pluginfrankenstyle, + 'filearea' => 'propertyfiles', + 'itemid' => '0', + 'filepath' => $draftjson->get_filepath(), + 'filename' => $draftjson->get_filename(), + 'author' => $draftjson->get_author(), + 'license' => $draftjson->get_license(), + 'timecreated' => $draftjson->get_timecreated(), + 'timemodified' => $draftjson->get_timemodified(), + 'mimetype' => $draftjson->get_mimetype(), + ]; + $settingfile = $fs->create_file_from_storedfile($filerecord, $draftjson); // Replacement. + + $draftjson->delete(); // Finished with draft. + + $savepropsfilestoofileresult = get_string('propertiesexportfilestoofilesuccess', $this->pluginfrankenstyle, $settingfile->get_filename()); + } else { + $savepropsfilestoofileresult = get_string('propertiesexportfilestoofilefail', $this->pluginfrankenstyle); + $alertstate = 'warning'; + } + } + + $returnurl = new moodle_url('/admin/settings.php', ['section' => $this->settingsectionname]); + $returnbutton = ''; + $return .= $returnbutton; + $return .= '
        '; + $return .= ''; + $return .= $returnbutton; + $return .= '
        '; + + } else { + $props = \theme_adaptable\toolbox::get_properties($this->pluginfrankenstyle); + + $propsexporturl = new moodle_url('/admin/settings.php', ['section' => $this->settingsectionname, + $this->pluginfrankenstyle . '_getprops_saveprops' => 1, ]); + $propsexportbutton = ''; + + $propsexportfilestoourl = new moodle_url('/admin/settings.php', ['section' => $this->settingsectionname, + $this->pluginfrankenstyle . '_getprops_saveprops_filestoo' => 1, ]); + $propsexportfilestoobutton = ''; + + $propsexportfilestoofilesurl = new moodle_url('/admin/settings.php', ['section' => $this->settingsectionname, + $this->pluginfrankenstyle . '_getprops_saveprops_filestoofile' => 1, ]); + $propsexportfilestoofilebutton = ''; + + $table = new html_table(); + $table->head = [$this->visiblename, markdown_to_html($this->description)]; + $table->colclasses = ['leftalign', 'leftalign']; + $table->id = 'adminprops_' . $this->name; + $table->attributes['class'] = 'admintable generaltable'; + $table->data = []; + + foreach ($props[\theme_adaptable\toolbox::PROPS] as $propname => $propvalue) { + $table->data[] = [$propname, '
        ' . htmlentities($propvalue, ENT_COMPAT) . '
        ']; + } + $return .= $propsexportbutton; + $return .= $propsexportfilestoobutton; + $return .= $propsexportfilestoofilebutton; + $return .= '
        '; + $return .= html_writer::table($table); + $return .= $propsexportbutton; + $return .= $propsexportfilestoobutton; + $return .= $propsexportfilestoofilebutton; + $return .= '
        '; + } + + return $return; + } +} diff --git a/settings/adaptable_admin_setting_putprops.php b/classes/admin_setting_putprops.php similarity index 71% rename from settings/adaptable_admin_setting_putprops.php rename to classes/admin_setting_putprops.php index 1a0ff46..794b1dd 100644 --- a/settings/adaptable_admin_setting_putprops.php +++ b/classes/admin_setting_putprops.php @@ -24,16 +24,22 @@ * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. */ +namespace theme_adaptable; + /** * Set properties class. */ -class adaptable_admin_setting_putprops extends admin_setting_configtextarea { - /** @var string Name of the theme. */ - private $themename; +class admin_setting_putprops extends \admin_setting_configtextarea { + /** @var string Name of the plugin. */ + private $pluginname; + /** @var string Frankenstyle of the plugin. */ + private $pluginfrankenstyle; /** @var string Name of the 'callable' function to call with the name of the theme and the properties as an array. */ private $callme; /** @var string Report back from the parsing 'callable' to inform the user in the text area. */ private $report = ''; + /** @var string File report to use if any. */ + private $filereport = ''; /** * Not a setting, just putting properties. @@ -42,13 +48,16 @@ class adaptable_admin_setting_putprops extends admin_setting_configtextarea { * config_plugins. * @param string $visiblename localised * @param string $description long localised info - * @param string $themename Name of the theme. + * @param string $pluginname Name of the plugin. + * @param string $pluginfrankenstyle Frankenstyle of the plugin. * @param string $callme Name of the 'callable' function to call with the name of the theme and the properties as an array. */ - public function __construct($name, $visiblename, $description, $themename, $callme) { - $this->themename = $themename; + public function __construct($name, $visiblename, $description, $pluginname, $pluginfrankenstyle, $callme) { + $this->pluginname = $pluginname; + $this->pluginfrankenstyle = $pluginfrankenstyle; $this->callme = $callme; - parent::__construct($name, $visiblename, $description, ''); // Last parameter is default. + // Not a 'nosave' as saves the current report. + parent::__construct($name, $visiblename, $description, '', PARAM_RAW, '60', '24'); // Cols and rows. } /** @@ -59,6 +68,14 @@ public function get_defaultsetting() { return ''; } + /** + * Set file report. + * @param string $filereport File report. + */ + public function set_filereport($filereport) { + $this->filereport = $filereport; + } + /** * Write settings. * @@ -89,6 +106,7 @@ public function validate($data) { if (!empty($data)) { // Only attempt decode if we have the start of a JSON string, otherwise will certainly be the saved report. if ($data[0] == '{') { + // Setting has JSON. $props = json_decode($data, true); if ($props === null) { if (function_exists('json_last_error_msg')) { @@ -98,12 +116,21 @@ public function validate($data) { $validated = json_last_error(); } } else { - $this->report = call_user_func($this->callme, $this->themename, $props); + $this->report = call_user_func($this->callme, $this->pluginname, $this->pluginfrankenstyle, $props); } } else { - // Keep what we have. - $this->report = $data; + // Keep what we have unless we're replacing with a file report. + if (!empty($this->filereport)) { + $this->report = $this->filereport; + $this->filereport = null; + } else { + $this->report = $data; + } } + } else if (!empty($this->filereport)) { + // Replace empty setting with file report. + $this->report = $this->filereport; + $this->filereport = null; } } diff --git a/classes/output/core_renderer_layout.php b/classes/output/core_renderer_layout.php index 9aad1aa..10a3023 100644 --- a/classes/output/core_renderer_layout.php +++ b/classes/output/core_renderer_layout.php @@ -53,18 +53,17 @@ public function yesheader($sidepostdrawer) { theme_adaptable_initialise_full(); $bodyclasses[] = theme_adaptable_get_full(); - $bsoptionsdata = ['data' => []]; + $optionsdata = ['data' => []]; // Main navbar. if (isset($themesettings->stickynavbar) && $themesettings->stickynavbar == 1) { - $bsoptionsdata['data']['stickynavbar'] = true; + $optionsdata['data']['stickynavbar'] = true; } else { - $bsoptionsdata['data']['stickynavbar'] = false; + $optionsdata['data']['stickynavbar'] = false; } // JS calls. - $this->page->requires->js_call_amd('theme_adaptable/adaptable', 'init'); - $this->page->requires->js_call_amd('theme_adaptable/bsoptions', 'init', $bsoptionsdata); + $this->page->requires->js_call_amd('theme_adaptable/adaptable', 'init', $optionsdata); // Layout. $left = (!right_to_left()); @@ -174,7 +173,7 @@ public function yesheader($sidepostdrawer) { if (!empty($sidepostmarkup)) { echo $sidepostmarkup; } - if (!$bsoptionsdata['data']['stickynavbar']) { + if (!$optionsdata['data']['stickynavbar']) { echo '
        '; } @@ -368,7 +367,7 @@ public function yesheader($sidepostdrawer) { echo $this->render_from_template('theme_adaptable/headerstyletwo', $headercontext); } - if ($bsoptionsdata['data']['stickynavbar']) { + if ($optionsdata['data']['stickynavbar']) { echo '
        '; } if (!empty($courseindextogglemarkup)) { @@ -498,6 +497,7 @@ protected function courseindexheader() { if ($courseindex) { require_once($CFG->dirroot . '/course/lib.php'); $courseindex = core_course_drawer(); + user_preference_allow_ajax_update('drawer-open-index', PARAM_BOOL); } if (!$courseindex) { @@ -587,12 +587,14 @@ public function secondarynav() { $tablistnav = $this->page->has_tablist_secondary_navigation(); $moremenu = new \core\navigation\output\more_menu($this->page->secondarynav, 'nav-tabs', true, $tablistnav); $secondarynavigation = $moremenu->export_for_template($this); - $secondarynavigation = $this->render_from_template('theme_adaptable/secondarynav', $secondarynavigation); + if (!empty($secondarynavigation)) { + $secondarynavigation = $this->render_from_template('theme_adaptable/secondarynav', $secondarynavigation); - $overflowdata = $this->page->secondarynav->get_overflow_menu_data(); - if (!is_null($overflowdata)) { - $overflow = $overflowdata->export_for_template($this); - $overflow = $this->render_from_template('theme_adaptable/overflow', $overflow); + $overflowdata = $this->page->secondarynav->get_overflow_menu_data(); + if (!is_null($overflowdata)) { + $overflow = $overflowdata->export_for_template($this); + $overflow = $this->render_from_template('theme_adaptable/overflow', $overflow); + } } } @@ -732,6 +734,9 @@ public function columns_two_layout() { echo '
        '; echo $this->get_course_alerts(); echo $this->course_content_header(); + if ($this->page->pagetype == 'user-profile') { + echo $this->context_header(); + } if (!empty($secondarynavigation)) { echo $secondarynavigation; } @@ -961,7 +966,7 @@ functionality and the non-use of numbers in block region names. */ } else { $tabbedlayoutcoursepagetabpersistencetime = 30; } - $this->page->requires->js_call_amd('theme_adaptable/utils', 'init', ['currentpage' => $currentpage, + $this->page->requires->js_call_amd('theme_adaptable/tabbed', 'init', ['currentpage' => $currentpage, 'tabpersistencetime' => $tabbedlayoutcoursepagetabpersistencetime, ]); } } @@ -985,7 +990,7 @@ public function dashboard_layout() { $dashblocklayoutlayoutrow = ''; if (!empty($themesettings->dashblocksenabled)) { $dashblocklayoutlayoutrow = '
        '; - $dashblocklayoutlayoutrow .= $this->get_block_regions('dashblocklayoutlayoutrow'); + $dashblocklayoutlayoutrow .= $this->get_block_regions('dashblocklayoutlayoutrow', 'frnt-market-'); $dashblocklayoutlayoutrow .= '
        '; } @@ -1199,7 +1204,9 @@ public function frontpage_layout() { echo $overflow; } + echo '
        '; echo $this->get_news_ticker(); + echo '
        '; // Slider. echo $this->get_frontpage_slider(); @@ -1212,11 +1219,14 @@ public function frontpage_layout() { echo '
        '; } echo '
        '; + echo '
        '; echo \theme_adaptable\toolbox::get_setting('infobox', 'format_moodle'); echo '
        '; echo '
        '; + echo '
        '; } + echo '
        '; // If Information Blocks are enabled then let's show them. if (!empty($themesettings->informationblocksenabled)) { echo $this->get_flexible_blocks('information'); @@ -1226,11 +1236,12 @@ public function frontpage_layout() { if (!empty($themesettings->frontpagemarketenabled)) { echo $this->get_marketing_blocks(); } + echo '
        '; if (!empty($themesettings->frontpageblocksenabled)) { echo '
        '; echo '
        '; - echo $this->get_block_regions(); + echo $this->get_block_regions('blocklayoutlayoutrow', 'frnt-market-'); echo '
        '; echo '
        '; } @@ -1243,12 +1254,13 @@ public function frontpage_layout() { echo '
        '; } echo '
        '; + echo '
        '; echo \theme_adaptable\toolbox::get_setting('infobox2', 'format_moodle'); echo '
        '; echo '
        '; + echo '
        '; } - // The main content goes here. echo '
        '; echo '
        '; echo '