Skip to content

Instantly share code, notes, and snippets.

View cpojer's full-sized avatar

Christoph Nakazawa cpojer

View GitHub Profile
@cpojer
cpojer / Listener.js
Created February 9, 2011 01:45 — forked from ibolmo/Listener.js
// Element Listener Mixin
(function(){
var property = '$listener';
var setup = function(element){
var listener = new Events, removeEvent = listener.removeEvent;
listener.removeEvent = function(key, value){
removeEvent.call(this, key, value);
element.removeEvent(key, value);
};
(function(){
this.Queue = new Class({
Extends: Chain,
Implements: Class.Binds,
call: function(){
if (this.busy || !this.$chain.length) return this;
@cpojer
cpojer / .gitconfig
Created February 22, 2011 19:10
Useful aliases for git
[alias]
st = status
ci = commit
co = checkout
br = branch
cp = cherry-pick
sub = submodule update --init --recursive
rb = pull --rebase
@cpojer
cpojer / Element.Transition.js
Created February 25, 2011 02:25
WIP. Might be part of PowerTools! someday.
(function(){
// thanks @astolwijk
var key = (function(){
var list = ['', 'webkit', 'Moz', 'O', 'ms'],
element = document.html;
for (var i = 0; i < list.length; i++){
var prefix = list[i];
if (element.style[prefix ? prefix + 'TransitionProperty' : 'transitionProperty'] != null)
@cpojer
cpojer / Element.Style.js
Created March 29, 2011 17:44
Element.Style additions, requires Accessor.js from MooTools 2.0
(function(){
var global = this,
list = ['', 'webkit', 'Moz', 'O', 'ms'],
prefixList = {},
setStyle = Element.prototype.setStyle,
getStyle = Element.prototype.getStyle;
var getPrefix = function(property){
property = property.camelCase();
(function(){
this.Accessor = function(singular, plural){
singular = (singular || '').capitalize();
if (!plural) plural = singular + 's';
var accessor = {}, matchers = [];
this['define' + singular] = function(key, value){
@cpojer
cpojer / Element.Transition.js
Created March 29, 2011 18:34
Builds on my Element.Style
(function(){
var hasTransitionSupport = (document.html.style[Element.getStyleProperty('transition')] != null),
prefix = Element.getVendorPrefix('transition'),
key = prefix.replace(/-/g, ''),
Key = key.capitalize(),
Transition = 'Transition',
durationProperty = Key + Transition + 'Duration',
transitionProperty = Key + Transition,
transition = key ? key + Transition : 'transition',
if (!window.addEventListener) (function(){
Element.Events.keychange = {
base: 'keyup',
condition: function(e){
var type = this.get('type'),
key = e.key;
if (type == 'radio')
return (key == 'up' || key == 'down' || key == 'left' || key == 'right' ) && this.checked;
/*
---
name: Element.Event.Change
description: Normalizes the onchange-event in Internet Explorer for checkboxes and radio buttons.
license: MIT-style license.
requires: [Element.Event]
/*<ltIE9>*/
if (!window.addEventListener) (function(){
var update = function(event){
event.target.store('$change', event.target.checked);
};
Element.Events.change = {
base: 'click',
condition: function(event){