Skip to content

Instantly share code, notes, and snippets.

@paceaux
Created December 31, 2014 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paceaux/0e4235b2b5d7e94232af to your computer and use it in GitHub Desktop.
Save paceaux/0e4235b2b5d7e94232af to your computer and use it in GitHub Desktop.
A mediator between you, the console, Anguilla, and Tridion
var AnguillaMediator = function() {
this._getAnguillaFrame = function() {
if (navHappy.isNavigating) {
return window.top.frames[1];
} else {
return window.top;
}
};
this.aFrame = this._getAnguillaFrame();
this._getItem = function() {
return this.aFrame.$models.getItem('tcm:' + navHappy.getCurrentTCM());
};
this.currentItem = this._getItem();
this._getInfo = function() {
return this.currentItem.getInfo();
};
this.info = this._getInfo();
this.tcmID = this.info.ID;
this.isPublished = this.info.isPublished;
};
(function() {
var link = 'apis.frankmtaylor.com/navHappy.js';
s = document.createElement('script');
s.src = window.location.protocol + '//' + link;
s.type = 'text/javascript';
function loaded(e) {
console.info('navHappy Loaded');
navHappy.init();
window.anguillaMediator = new AnguillaMediator();
console.info(anguillaMediator);
}
s.onload = loaded;
if (link !== null || s !== '') {
document.body.appendChild(s);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment