Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-lawrence committed Aug 2, 2013
0 parents commit 0d22c3e
Show file tree
Hide file tree
Showing 18 changed files with 937 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# IDE Specific
############################
.idea
*.iml
.project
.buildpath
/.settings
*.sublime-project
*.sublime-workspace
*.sublime-projectcompletions
*.user
*.suo
*.vspscc
*.vscc
_vti_cnf
_notes

# General Cache
############################
.sass-cache

# OS Generated
############################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.swp

# Node.js
############################
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2013 Rhythm Agency

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rhythm.framework
================
123 changes: 123 additions & 0 deletions constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
module.exports = {
'CSS' : {
'ACTIVE' : 'active'
},

'EVENTS' : {
'BLUR' : 'blur',
'CHANGE' : 'change',
'CLICK' : 'click',
'ERROR' : 'error',
'FOCUS' : 'focus',
'HASH_CHANGE' : 'hashchange',
'KEY_DOWN' : 'keydown',
'KEY_PRESS' : 'keypress',
'KEY_UP' : 'keyup',
'LOAD' : 'load',
'MOUSE_DOWN' : 'mousedown',
'MOUSE_ENTER' : 'mouseenter',
'MOUSE_LEAVE' : 'mouseleave',
'MOUSE_MOVE' : 'mousemove',
'MOUSE_OUT' : 'mouseout',
'MOUSE_OVER' : 'mouseover',
'MOUSE_UP' : 'mouseup',
'MOUSE_WHEEL' : 'mousewheel',
'RESET' : 'reset',
'RESIZE' : 'resize',
'SCROLL' : 'scroll',
'SELECT' : 'select',
'SUBMIT' : 'submit',
'VALID' : 'valid',
'INVALID' : 'invalid',
'DESELECT' : 'deselect',
'ERROR' : 'error'
},

'DATA_ATTRIBUTES' : {
'ADD_ACTIVE' : 'add-active',
'REMOVE_ACTIVE' : 'remove-active',
'TOGGLE_ACTIVE' : 'toggle-active',
'SHOW_OVERLAY' : 'show-overlay',
'HIDE_OVERLAY' : 'hide-overlay',
'TOGGLE_OVERLAY' : 'toggle-overlay',
'FORM_ADD_ACTIVE' : 'form-add-active',
'FORM_REMOVE_ACTIVE' : 'form-remove-active',
'FORM_TOGGLE_ACTIVE' : 'form-toggle-active',
'FORM_SHOW_OVERLAY' : 'form-show-overlay',
'FORM_HIDE_OVERLAY' : 'form-hide-overlay',
'FORM_TOGGLE_OVERLAY' : 'form-toggle-overlay',
'FOCUS' : 'focus',
'REMOVE_HASH' : 'remove-hash',
'HASH_ACTIVE' : 'hash-active',
'ADD_ACTIVE_ON_CHECKED' : 'add-active-on-checked',
'SCROLL_TARGET' : 'scroll-target',
'SCROLL_TO' : 'scroll-to',
'SVG_FALLBACK' : 'svg-fallback'
},

'SELECTORS' : {
'IMAGE_DATA_FALLBACK' : 'img[data-fallback]',
'INPUT' : {
'FILE' : 'input[type=file]',
'RADIO' : 'input[type=radio]',
'CHECKBOX' : 'input[type=checkbox]',
'TEXT' : 'input[type=text], textarea, input[type=tel], input[type=email]'
}
},

'EASING' : {
'LINEAR' : 'linear',
'SWING' : 'swing',
'JSWING' : 'jswing',
'EASE_IN_QUAD' : 'easeInQuad',
'EASE_IN_CUBIC' : 'easeInCubic',
'EASE_IN_QUART' : 'easeInQuart',
'EASE_IN_QUINT' : 'easeInQuint',
'EASE_IN_SINE' : 'easeInSine',
'EASE_IN_EXPO' : 'easeInExpo',
'EASE_IN_CIRC' : 'easeInCirc',
'EASE_IN_ELASTIC' : 'easeInElastic',
'EASE_IN_BACK' : 'easeInBack',
'EASE_IN_BOUNCE' : 'easeInBounce',
'EASE_OUT_QUAD' : 'easeOutQuad',
'EASE_OUT_CUBIC' : 'easeOutCubic',
'EASE_OUT_QUART' : 'easeOutQuart',
'EASE_OUT_QUINT' : 'easeOutQuint',
'EASE_OUT_SINE' : 'easeOutSine',
'EASE_OUT_EXPO' : 'easeOutExpo',
'EASE_OUT_CIRC' : 'easeOutCirc',
'EASE_OUT_ELASTIC' : 'easeOutElastic',
'EASE_OUT_BACK' : 'easeOutBack',
'EASE_OUT_BOUNCE' : 'easeOutBounce',
'EASE_IN_OUT_QUAD' : 'easeInOutQuad',
'EASE_IN_OUT_CUBIC' : 'easeInOutCubic',
'EASE_IN_OUT_QUART' : 'easeInOutQuart',
'EASE_IN_OUT_QUINT' : 'easeInOutQuint',
'EASE_IN_OUT_SINE' : 'easeInOutSine',
'EASE_IN_OUT_EXPO' : 'easeInOutExpo',
'EASE_IN_OUT_CIRC' : 'easeInOutCirc',
'EASE_IN_OUT_ELASTIC' : 'easeInOutElastic',
'EASE_IN_OUT_BACK' : 'easeInOutBack',
'EASE_IN_OUT_BOUNCE' : 'easeInOutBounce'
},

'DURATIONS' : {
'FAST' : 'fast',
'SLOW' : 'slow',
'DEFAULT' : 400,
'1s' : 1000
},

'POSITIONS' : {
'TOP' : 'left',
'RIGHT' : 'right',
'LEFT' : 'left',
'BOTTOM' : 'bottom',
'TOP_RIGHT' : 'top-right',
'TOP_LEFT' : 'top-left',
'BOTTOM_RIGHT' : 'bottom-right',
'BOTTOM_LEFT' : 'bottom-left',
'CENTER' : 'center',
'MIDDLE' : 'middle'
}
};
60 changes: 60 additions & 0 deletions jquery/jquery.backbone.hijax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
jquery.backboneHijax - jQuery plugin for Backbone that implements Hijax routing.
Allows us to find any links that start with '/' and intercept them and add a '#'
to the beginning. This prevents the page from reloading.
Version: 1.0
Author: Michael Lawrence (michael.lawrence@rhythmagency.com)
Copyright: 2013 Rhythm Interactive
Usage:
var router = Backbone.Router.extend({
'routes': {
'home' : 'home',
'about' : 'about'
},
'home' : function () {
...
},
'about' : function () {
...
}
});
$.backboneHijax(router);
*/

'use strict';

(function () {
var name = 'backboneHijax';

module.exports = exports[name] = function ($) {
$ = $ || window.$;

// Constants
var CONST = require('../constants');

var fn = function () {
return $(document).on(CONST.EVENTS.CLICK, 'a[href]:not([data-bypass])', function (e) {
var href = $(this).attr('href'),
url = href.replace(/^\//,'').replace('\#\!\/','');

if (href.charAt(0) === '/') {
router.navigate(url, { 'trigger' : true });

e.preventDefault();
return false;
}
});
};

$.fn[name] = fn;

return fn;
};
})();
42 changes: 42 additions & 0 deletions jquery/jquery.classSwitcher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
jquery.classSwitcher - A jQuery plugin that switches the class of an element based on the prefix supplied.
Version: 1.0
Author: Michael Lawrence (michael.lawrence@rhythmagency.com)
Copyright: 2013 Rhythm Interactive
TODO: Provide documentation for this plugin.
*/

'use strict';

(function () {
var name = 'classSwitcher';

module.exports = exports[name] = function ($) {
$ = $ || window.$;

// jQuery plugins
require('jquery.removeClassWithPrefix');

// Constants
var CONST = require('../constants');

var fn = function (prefix, $target) {
var $el = $(this);

$target = $target || $('body');

$el.on(CONST.EVENTS.CHANGE, function (e) {
$target.removeClassWithPrefix(prefix).addClass(prefix + '-' + $(this).val());
e.preventDefault();
});

return $el;
};

$.fn[name] = fn;

return fn;
};
})();
40 changes: 40 additions & 0 deletions jquery/jquery.customFileInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
jquery.customFileInput - Replaces the standard HTML file input element with a stylized button.
Version: 1.0
Author: Michael Lawrence (michael.lawrence@rhythmagency.com)
Copyright: 2013 Rhythm Interactive
TODO: Provide documentation for this plugin.
*/

'use strict';

(function () {
var name = 'customFileInput';

module.exports = exports[name] = function ($) {
$ = $ || window.$;

// Constants
var CONST = require('../constants');

var fn = function (query) {
query = query || CONST.SELECTORS.INPUT.FILE;

$(query).each(function() {
var $el = $(this),
proxy = $('<a class="button radius" href="#">Choose File</a>').on(CONST.EVENTS.CLICK, function (e) {
$el.trigger(CONST.EVENTS.CLICK);
e.preventDefault();
});

$el.css('display', 'none').parent().append(proxy);
});
};

$[name] = fn;

return fn;
};
})();
Loading

0 comments on commit 0d22c3e

Please sign in to comment.