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 myOverlay = new glow.widgets.Overlay("#element", { | |
x: 20, | |
y: 20 | |
}); |
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 editform = new glow.forms.Form("#editform", { | |
// make avalidation method | |
onValidate: function(results) { | |
// if the form is submitting and there's no errors | |
if (results.eventName == 'submit' && !results.errorCount) { | |
if ( /* decide if you want to submit here */ ) { | |
editform.formNode[0].submit(); | |
} | |
} | |
else { |
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
NodeListProto.clone = function() { | |
// TODO: make this work with events and data | |
var nodes = [], | |
i = this.length; | |
while (i--) { | |
nodes[i] = this[i].cloneNode(true); | |
glow.events._copyDomListeners(this[i], nodes[i]); | |
glow.NodeList._copyData(this[i], nodes[i]); | |
} |
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 MyConstructor() { | |
var instance = function() { | |
alert('yey'); | |
} | |
instance.constructor = MyConstructor; | |
instance.__proto__ = MyConstructor.prototype; | |
return instance; | |
} |
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 getItemIndex(elm) { | |
var siblings = elm.slice(0,1).parent().children(), | |
i = siblings.length; | |
while(i--) { | |
if (siblings[i] == elm[0]) { | |
return i; | |
} | |
} | |
return -1; |
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 myApplication = (function(){ | |
// this will hold our instance of glow | |
var glow; | |
gloader.load(['glow', '1', 'glow.dom', 'glow.anim'], { | |
async: true, | |
onLoad: function(g) { | |
glow = g; | |
glowLoaded(); | |
g.ready(domReady); |
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 h(str) { | |
return str | |
.replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"') | |
.replace(/'/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
function preloadImages(imageUrls, callback) { | |
var images = [], | |
imagesLen = imageUrls.length, | |
loaded = 0, | |
image; | |
function imageLoaded() { | |
if (++loaded == imagesLen) { | |
callback(images); | |
} |
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.NodeList#filter | |
@function | |
@description Filter the NodeList | |
@param {Function|string} test Filter test | |
If a string is provided, it is used in a call to {@link glow.NodeList#is NodeList#is}. | |
If a function is provided it will be passed a single argument | |
representing the index of the current item in the NodeList. |
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
// get images with a width greater than 320 | |
glow('img').filter(function () { | |
return glow(this).width() > 320; | |
}); | |
// get a definition term | |
var term = glow('#myDefs dt:first-child'); | |
// get the next dt | |
term.next('dt'); |