Skip to content

Commit

Permalink
Change Exercise 07->08
Browse files Browse the repository at this point in the history
  • Loading branch information
xenomorph1096 committed Feb 28, 2024
1 parent ed0e623 commit b118b13
Show file tree
Hide file tree
Showing 39 changed files with 33,974 additions and 33,930 deletions.
2 changes: 1 addition & 1 deletion adapt.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion adapt/js/adapt.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion adapt/js/build.min.js

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

262 changes: 131 additions & 131 deletions adapt/js/scriptLoader.js
Original file line number Diff line number Diff line change
@@ -1,131 +1,131 @@
(function() {

const isProduction = (window.ADAPT_BUILD_TYPE !== 'development');

function loadScript(url, callback) {
if (!url || typeof url !== 'string') return;
const script = document.createElement('script');
script.onload = callback;
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
};

// 0. Keep loadScript code to add into Adapt API later
window.__loadScript = loadScript;

// 2. Setup require for old-style module declarations (some code still uses these), configure paths then load JQuery
function setupRequireJS() {
requirejs.config({
map: {
'*': {
coreJS: 'core/js',
coreViews: 'core/js/views',
coreModels: 'core/js/models',
coreCollections: 'core/js/collections'
}
},
paths: {
'regenerator-runtime': 'libraries/regenerator-runtime.min',
'core-js': 'libraries/core-js.min',
jquery: 'libraries/jquery.min',
underscore: 'libraries/underscore.min',
'underscore.results': 'libraries/underscore.results',
backbone: 'libraries/backbone.min',
'backbone.controller': 'libraries/backbone.controller',
'backbone.controller.results': 'libraries/backbone.controller.results',
'backbone.es6': 'libraries/backbone.es6',
handlebars: 'libraries/handlebars.min',
velocity: 'libraries/velocity.min',
imageReady: 'libraries/imageReady',
inview: 'libraries/inview',
scrollTo: 'libraries/scrollTo.min',
bowser: 'libraries/bowser',
enum: 'libraries/enum',
jqueryMobile: 'libraries/jquery.mobile.custom.min',
react: isProduction ? 'libraries/react.production.min' : 'libraries/react.development',
'react-dom': isProduction ? 'libraries/react-dom.production.min' : 'libraries/react-dom.development',
'html-react-parser': 'libraries/html-react-parser.min',
semver: 'libraries/semver'
},
waitSeconds: 0
});
loadJQuery();
}

// 3. start loading JQuery, wait for it to be loaded
function loadJQuery() {
loadScript('libraries/jquery.min.js', checkJQueryStatus);
}

// 4. Wait until JQuery gets loaded completely then load foundation libraries
function checkJQueryStatus() {
if (window.jQuery === undefined) {
setTimeout(checkJQueryStatus, 100);
} else {
setupModernizr();
}
}

// 5. Backward compatibility for Modernizr
function setupModernizr() {
Modernizr.touch = Modernizr.touchevents;
const touchClass = Modernizr.touch ? 'touch' : 'no-touch';
$('html').addClass(touchClass);
loadFoundationLibraries();
}

// 6. Load foundation libraries and templates then load Adapt itself
function loadFoundationLibraries() {
require([
'handlebars',
'underscore',
'regenerator-runtime',
'core-js',
'underscore.results',
'backbone',
'backbone.controller',
'backbone.controller.results',
'backbone.es6',
'velocity',
'imageReady',
'inview',
'jqueryMobile',
'libraries/jquery.resize',
'scrollTo',
'bowser',
'enum',
'react',
'react-dom',
'html-react-parser',
'semver'
], loadGlobals);
}

// 7. Expose global context libraries
function loadGlobals(Handlebars, _) {
window._ = _;
window.Handlebars = Handlebars;
require([
'events/touch'
], loadTemplates);
}

// 8. Load templates
function loadTemplates() {
require([
'templates'
], loadAdapt);
}

// 9. Allow cross-domain AJAX then load Adapt
function loadAdapt() {
$.ajaxPrefilter(function(options) {
options.crossDomain = true;
});
loadScript('adapt/js/adapt.min.js');
}

// 1. Load requirejs then set it up
loadScript('libraries/require.min.js', setupRequireJS);

})();
(function() {

const isProduction = (window.ADAPT_BUILD_TYPE !== 'development');

function loadScript(url, callback) {
if (!url || typeof url !== 'string') return;
const script = document.createElement('script');
script.onload = callback;
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
};

// 0. Keep loadScript code to add into Adapt API later
window.__loadScript = loadScript;

// 2. Setup require for old-style module declarations (some code still uses these), configure paths then load JQuery
function setupRequireJS() {
requirejs.config({
map: {
'*': {
coreJS: 'core/js',
coreViews: 'core/js/views',
coreModels: 'core/js/models',
coreCollections: 'core/js/collections'
}
},
paths: {
'regenerator-runtime': 'libraries/regenerator-runtime.min',
'core-js': 'libraries/core-js.min',
jquery: 'libraries/jquery.min',
underscore: 'libraries/underscore.min',
'underscore.results': 'libraries/underscore.results',
backbone: 'libraries/backbone.min',
'backbone.controller': 'libraries/backbone.controller',
'backbone.controller.results': 'libraries/backbone.controller.results',
'backbone.es6': 'libraries/backbone.es6',
handlebars: 'libraries/handlebars.min',
velocity: 'libraries/velocity.min',
imageReady: 'libraries/imageReady',
inview: 'libraries/inview',
scrollTo: 'libraries/scrollTo.min',
bowser: 'libraries/bowser',
enum: 'libraries/enum',
jqueryMobile: 'libraries/jquery.mobile.custom.min',
react: isProduction ? 'libraries/react.production.min' : 'libraries/react.development',
'react-dom': isProduction ? 'libraries/react-dom.production.min' : 'libraries/react-dom.development',
'html-react-parser': 'libraries/html-react-parser.min',
semver: 'libraries/semver'
},
waitSeconds: 0
});
loadJQuery();
}

// 3. start loading JQuery, wait for it to be loaded
function loadJQuery() {
loadScript('libraries/jquery.min.js', checkJQueryStatus);
}

// 4. Wait until JQuery gets loaded completely then load foundation libraries
function checkJQueryStatus() {
if (window.jQuery === undefined) {
setTimeout(checkJQueryStatus, 100);
} else {
setupModernizr();
}
}

// 5. Backward compatibility for Modernizr
function setupModernizr() {
Modernizr.touch = Modernizr.touchevents;
const touchClass = Modernizr.touch ? 'touch' : 'no-touch';
$('html').addClass(touchClass);
loadFoundationLibraries();
}

// 6. Load foundation libraries and templates then load Adapt itself
function loadFoundationLibraries() {
require([
'handlebars',
'underscore',
'regenerator-runtime',
'core-js',
'underscore.results',
'backbone',
'backbone.controller',
'backbone.controller.results',
'backbone.es6',
'velocity',
'imageReady',
'inview',
'jqueryMobile',
'libraries/jquery.resize',
'scrollTo',
'bowser',
'enum',
'react',
'react-dom',
'html-react-parser',
'semver'
], loadGlobals);
}

// 7. Expose global context libraries
function loadGlobals(Handlebars, _) {
window._ = _;
window.Handlebars = Handlebars;
require([
'events/touch'
], loadTemplates);
}

// 8. Load templates
function loadTemplates() {
require([
'templates'
], loadAdapt);
}

// 9. Allow cross-domain AJAX then load Adapt
function loadAdapt() {
$.ajaxPrefilter(function(options) {
options.crossDomain = true;
});
loadScript('adapt/js/adapt.min.js');
}

// 1. Load requirejs then set it up
loadScript('libraries/require.min.js', setupRequireJS);

})();
4 changes: 2 additions & 2 deletions course/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"_generateSourcemap": false,
"_forceRouteLocking": true,
"_disableAnimationFor": [],
"_id": "6527c3a5e72d6c32787e2b39",
"_courseId": "6527c3a4e72d6c32787e2b1a",
"_id": "65df045804b1a24755cb820d",
"_courseId": "65df045804b1a24755cb820a",
"_drawer": {
"_showEasing": "easeOutQuart",
"_hideEasing": "easeInQuart",
Expand Down
48 changes: 24 additions & 24 deletions course/en/articles.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2b88",
"_parentId": "6527c3a5e72d6c32787e2b48",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb8214",
"_parentId": "65df045804b1a24755cb820e",
"_type": "article",
"_onScreen": {
"_isEnabled": false,
Expand Down Expand Up @@ -112,9 +112,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2b98",
"_parentId": "6527c3a5e72d6c32787e2b5d",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb8215",
"_parentId": "65df045904b1a24755cb8210",
"_type": "article",
"_assessment": {
"_isEnabled": false,
Expand Down Expand Up @@ -157,9 +157,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2ba8",
"_parentId": "6527c3a5e72d6c32787e2b72",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb8216",
"_parentId": "65df045904b1a24755cb8212",
"_type": "article",
"_assessment": {
"_isEnabled": false,
Expand Down Expand Up @@ -202,9 +202,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2bb8",
"_parentId": "6527c3a5e72d6c32787e2b48",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb8217",
"_parentId": "65df045804b1a24755cb820e",
"_type": "article",
"_onScreen": {
"_isEnabled": false,
Expand Down Expand Up @@ -306,9 +306,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2bc8",
"_parentId": "6527c3a5e72d6c32787e2b5d",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb8218",
"_parentId": "65df045904b1a24755cb8210",
"_type": "article",
"_onScreen": {
"_isEnabled": false,
Expand Down Expand Up @@ -410,9 +410,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2bd8",
"_parentId": "6527c3a5e72d6c32787e2b72",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb8219",
"_parentId": "65df045904b1a24755cb8212",
"_type": "article",
"_onScreen": {
"_isEnabled": false,
Expand Down Expand Up @@ -514,9 +514,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2be8",
"_parentId": "6527c3a5e72d6c32787e2b5d",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb821a",
"_parentId": "65df045904b1a24755cb8210",
"_type": "article",
"_assessment": {
"_isEnabled": false,
Expand Down Expand Up @@ -589,9 +589,9 @@
"_isHidden": false,
"_isVisible": true,
"_requireCompletionOf": -1,
"_ariaLevel": 0,
"_id": "6527c3a5e72d6c32787e2bf8",
"_parentId": "6527c3a5e72d6c32787e2b72",
"_isA11yCompletionDescriptionEnabled": true,
"_id": "65df045904b1a24755cb821b",
"_parentId": "65df045904b1a24755cb8212",
"_type": "article",
"_assessment": {
"_isEnabled": false,
Expand Down
Loading

0 comments on commit b118b13

Please sign in to comment.