Skip to content

Instantly share code, notes, and snippets.

View jakearchibald's full-sized avatar
💭
Tired

Jake Archibald jakearchibald

💭
Tired
View GitHub Profile
function User(name,id) {
this.name = name;
this.id = id;
}
User.prototype.show_user = function() {
alert("Nom : " + this.name + " id : " + this.id);
}
var test_object = new User("greg",2);
function toggleOnClick(elmToToggle, elmToClick) {
elmToToggle = glow.dom.get(elmToToggle);
var fullHeight = elmToToggle.height();
glow.events.addListener(elmToClick, 'click', function() {
if (elmToToggle.height()) {
glow.anim.slideUp(elmToToggle, 1);
} else {
glow.anim.css(elmToToggle, 1, {
var listenerRef;
function addListener() {
listenerRef = glow.events.addListener(myCarousel2, 'afterScroll', afterScrollListener);
}
fucntion removeListener() {
glow.events.removeListener(listenerRef);
}
function slideRight(elm, seconds, opts) {
elm = glow.dom.get(elm);
opts = opts || {};
// make the tween easeBoth by default
opts.tween = opts.tween || glow.tweens.easeBoth();
// get the full width of the item
var currentWidth = elm[0].style.width,
fullWidth,
anim;
function getFilterOpts(type, item, callback) {
var requestUrl = "/api/plugin:"+type+"/config?path=" +item;
var str = '';
// get json data from config
glow.net.get(requestUrl, {
onLoad: function(response) {
var data = response.json();
str += '<p>'+data.a_value+'</p>';
// simplified example of what I need to add to var str.
function Ball(colour) {
// ...
}
Ball.prototype.on = function(eventName, callback) {
glow.events.addListener(this, eventName, callback);
};
Ball.prototype._moved = function() {
if (this._directionChange) {
glow.events.fire(this, 'bounce');
}
var mySortable = new glow.widgets.Sortable('#mySortable', {
onSort : function () {
// this will contain the IDs of the items in the sortable, in order
var itemIds = [];
// get the children of the sortable containers - these are the items you drag
// Then sort them, and get the ID for each
mySortable.containers.children().sort().each(function () {
itemIds.push( this.id );
});
var mySortable = new glow.widgets.Sortable('#mySortable', {
onSort : function () {
// this will contain the IDs of the items in the sortable, in order
var itemIds = [];
// get the children of the sortable containers - these are the items you drag
// Then sort them, and get the ID for each
mySortable.containers.children().sort().each(function () {
itemIds.push( this.id );
});
<script type="text/javascript">
gloader.load(['glow', '1', 'glow.dom', 'glow.anim'], {
async: false,
onLoad: function(glow) {
window.glow2 = glow;
}
});
</script>
<script type="text/javascript">
// glow2 is available here
<script type="text/javascript" src="scripts/glow/2.0.0/core.js"></script>
<script type="text/javascript" src="scripts/glow/2.0.0/widgets/widgets.js"></script>
<link rel="stylesheet" href="scripts/glow/2.0.0/widgets/widgets.css" type="text/css" />
<script type="text/javascript">
glow.dom.get('#yey');
// etc etc
</script>