Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
AOS dx.uconn.edu Practice
- Loading branch information
Showing
79 changed files
with
19,644 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+1.2 MB
week-5/dx.uconn.edu/dxlab_files/Screen-Shot-2019-12-02-at-6.24.28-PM.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
458 changes: 458 additions & 0 deletions
458
week-5/dx.uconn.edu/dxlab_files/ally.b0865be865cd64e793f7cc569b416eaf.css
Large diffs are not rendered by default.
Oops, something went wrong.
107 changes: 107 additions & 0 deletions
107
week-5/dx.uconn.edu/dxlab_files/ally.ui.61cce107227eabdf27c3.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
})(); |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.