View gist:8a9c47094b6e31de5cb2
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
function assertOkResponse(response) { | |
if (response.type === 'opaque' || response.status === 200) { | |
return response; | |
} | |
throw Error("Bad response: " + response.status); | |
} | |
fetch(url, {'mode': 'cors'}).then(assertOkResponse).then(function(response) { | |
// cache | |
}).catch(function(err) { |
View gist:157041
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
glow.events.addListener("#twit", "mouseover", function () { | |
clearTimeout(myTimeout); | |
myInfoPanel.show(); | |
}); | |
glow.events.addListener("#twit", "mouseout", closeAfterDelay); | |
var myTimeout = 0; | |
function closeAfterDelay() { | |
myTimeout = setTimeout(function() { |
View gist:157973
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
// here are the month names how we want to display them... | |
var fullMonthNames = [ | |
"Janurary", | |
"Feburary", | |
"March", | |
"April", | |
"May", | |
"June", | |
"July", |
View gist:165192
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
function trimFormField(selector, on) { | |
var field = glow.dom.get(selector); | |
return ["custom", { | |
on: on, | |
arg: function(values, opts, callback, formData) { | |
field.val( glow.lang.trim(values[0]) ); | |
callback(glow.forms.PASS, ""); | |
} | |
}]; | |
} |
View gist:165088
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"> | |
<head profile="http://dublincore.org/documents/dcq-html/"> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Glow drag tests</title> | |
<script src="http://www.bbc.co.uk/glow/glow/1.6.0-rc1/core/core.js" type="text/javascript"></script> | |
<script src="http://www.bbc.co.uk/glow/glow/1.6.0-rc1/widgets/widgets.debug.js" type="text/javascript"></script> | |
<link href="http://www.bbc.co.uk/glow/glow/1.6.0-rc1/widgets/widgets.css" type="text/css" rel="stylesheet" /> | |
<style type='text/css'> |
View Glow trim form fields
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
// create our form | |
var myForm = new glow.forms.Form("#fmcustomer") | |
var myForm = glow.lang.trim("txtCompany","txtForename","txtSurname2) | |
// add tests for First Name | |
.addTests( | |
"txtCompany", | |
["required", { | |
on: "change submit", | |
message: "Please tell us your company name" | |
}] |
View gist:167239
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
glow.events.addListener("#yourForm", "submit", function() { | |
glow.net.post( | |
// make a request to the place the form posts to | |
this.action, | |
// get the data from the form to send to the server | |
glow.dom.get(this).val(), | |
{ | |
onLoad: function(response) { | |
// response.text() is the response from the server | |
} |
View gist:172088
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
var functions = [], | |
functionsLen = 0; | |
function buildMassiveString() { | |
// build a ~1mb string | |
return new Array(1024*1024).join('#'); | |
} | |
function addListener() { | |
var massiveString = buildMassiveString(); |
View gist:172042
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
var functions = [], | |
functionsLen = 0; | |
function buildMassiveString() { | |
return new Array(1024*1024).join('#'); | |
} | |
function addFunction() { | |
var massiveString = buildMassiveString(); | |
functions[ functionsLen++ ] = function() {}; |
View gist:173814
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
var MyClass; | |
(function() { | |
MyClass = function() { | |
this.val = 2; | |
} | |
MyClass.prototype.publicFunction = function() { | |
return privateFunction.call(this); |
OlderNewer