Created
December 31, 2014 04:21
-
-
Save paceaux/0e4235b2b5d7e94232af to your computer and use it in GitHub Desktop.
A mediator between you, the console, Anguilla, and Tridion
This file contains hidden or 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
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