Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
AOS dx.uconn.edu Practice
  • Loading branch information
plb18001 committed Feb 17, 2022
1 parent 2192ce2 commit 383bfe2
Show file tree
Hide file tree
Showing 79 changed files with 19,644 additions and 0 deletions.
1,933 changes: 1,933 additions & 0 deletions week-5/dx.uconn.edu/dxlab.html

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions week-5/dx.uconn.edu/dxlab_files/ally.ui.61cce107227eabdf27c3.js

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions week-5/dx.uconn.edu/dxlab_files/ally.ui.js
@@ -0,0 +1,71 @@

(function() {
// The obfuscated unique global variable that Ally will be available on
var initGlobalVar = 'ally_61cce107227eabdf27c3';

// The path to the hashed current version of the Ally script
var loaderPath = '/static/integration/api/ally.ui.61cce107227eabdf27c3.js';

// Certain integrations (D2L) can't add custom attributes on a script tag. Help them out by setting a default
var naiveAllyLoaderEl = document.querySelector('script[src*="ally.ui.js"][src*=platform-name]');
if (naiveAllyLoaderEl && !naiveAllyLoaderEl.getAttribute('data-ally-loader')) {
naiveAllyLoaderEl.setAttribute('data-ally-loader', '');
}

// The `data-ally-loader` attribute is required
var allyLoaderEl = document.querySelector('script[data-ally-loader]');
if (!allyLoaderEl) {
console.warn('Ally loaded without data-ally-loader script attribute. Aborting.');
return;
}

// Grab the script tag and extract the Ally hostname from the src URL
var allyLoaderUrl = allyLoaderEl.src;
var allyBaseUrl = '';
if (allyLoaderUrl.indexOf('://') !== -1) {
allyBaseUrl = allyLoaderUrl.split('/').slice(0, 3).join('/');
}

// If a value is specified for `data-ally-loader`, that becomes the name of the Ally global. Otherwise it defaults
// do `ally`
var allyGlobalVar = allyLoaderEl.getAttribute('data-ally-loader') || 'ally';

// Link to the current version of the Ally script
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = allyBaseUrl + loaderPath;
document.getElementsByTagName('head')[0].appendChild(script);

// Add the specified global variable immediately and add helper `ready` function to bind to script load
var loaded = false;
window[allyGlobalVar] = window[allyGlobalVar] || {};
window[allyGlobalVar].ready = window[allyGlobalVar].ready || function(callback) {
callback = callback || function() {};
if (loaded) {
// If it's already loaded, call back immediately
return callback();
} else if (window[initGlobalVar]) {
// We've found it available, mark it as loaded
loaded = true;

// Bind it to the configured global variable
for (var key in window[initGlobalVar]) {
if (window[initGlobalVar].hasOwnProperty(key)) {
window[allyGlobalVar][key] = window[initGlobalVar][key];
}
}

// Clean up the obfuscated global Ally originally loaded on
delete window[initGlobalVar];
return callback();
}

// Iterate every 100ms
// TODO: Could probably be a bit smarter here, and apply a timeout and kill-switch
setTimeout(window[allyGlobalVar].ready, 100, callback);
};

// Always start the initialization cycle right away so it's not _required_ for the consumer to run this function as
// maybe they have their own synchronization
window[allyGlobalVar].ready();
})();
87 changes: 87 additions & 0 deletions week-5/dx.uconn.edu/dxlab_files/analytics.js

Large diffs are not rendered by default.

0 comments on commit 383bfe2

Please sign in to comment.