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
// out with the old... | |
glow.events.addListener(innerView, 'mouseover', function(e) { | |
var item = glow.dom.get(e.source), | |
itemRelated = glow.dom.get(e.relatedTarget); | |
while (item[0] != this) { | |
if ( item.hasClass('timetable-item') ) { | |
if ( item[0] == itemRelated[0] || itemRelated.isWithin(item) ) { | |
return; | |
} |
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
/** | |
@name glow.ElementList#clone | |
@function | |
@description Clones each node in the ElementList, along with data & event listeners | |
@returns {glow.ElementList} | |
Returns a new ElementList containing clones of all the nodes in | |
the ElementList | |
@example |
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
function(obj) { | |
if (obj.constructor.name) { | |
return obj.constructor.name; | |
} else { | |
var constructorStr = obj.constructor.toString(); | |
return constructorStr.slice( constructorStr.indexOf('function ') + 9, constructorStr.indexOf('(') ); | |
} | |
} |
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
function TestClass() {} | |
(TestClass.prototype.constructor == TestClass); // true | |
TestClass.prototype = { | |
myMethod: function() {} | |
}; | |
(TestClass.prototype.constructor == TestClass); // false | |
(TestClass.prototype.constructor == Object); // true |
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
// out with the old: | |
(function(){ | |
// this will hold our instance of glow | |
var glow; | |
gloader.load(['glow', '1', 'glow.dom', 'glow.anim', 'glow.widgets.Carousel'], { | |
async: true, | |
onLoad: function(g) { | |
glow = g; |
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
// adding a show listener to an overlay: | |
myOverlay.on('show', function(event) { | |
// ... | |
}); | |
// adding and removing a show listener to an overlay | |
function showListener() { | |
// ... | |
} |
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
/** | |
@name glow.events | |
@namespace | |
@description Listening, creating & firing events | |
*/ | |
/** | |
@name glow.events.addListeners | |
@function | |
@param {Object[]} attachTo Array of objects to add listeners to |
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
(function() { | |
var glow = new Glow('2').load().loaded(loaded); | |
function loaded() { | |
var thingToClick = glow.dom.create('<a href="#">Thing to click</a>'); | |
glow.events.addListener(thingToClick, 'click', function() { | |
glow.load('widgets').loaded(widgetsLoaded); | |
}); | |
} |
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
glow.net.loadScript('http://twitter.com/statuses/user_timeline/15390783.json?callback={callback}', { | |
onLoad: function(data) { | |
alert(data[0].user.name + "'s latest tweet:\n\n" + data[0].text); | |
} | |
}); |
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
<!-- 1. Simple, usual case with callback --> | |
<script type="text/javascript"> | |
Glow("2").load("core", "widgets").ready(function (glow) { | |
// core & widgets loaded & dom ready | |
glow.widgets.doodle(); | |
}); | |
</script> | |
<!-- 2. 'Application Pattern'. Allows glow instance to be easily used in a wider but not global scope --> | |
<script type="text/javascript"> |