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
define([], function() { | |
'use strict'; | |
var optionsDefault = { | |
lines: 4, | |
cols: 4 | |
}; | |
function BlocksBoard(options) { |
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
/* | |
Based on: http://css-tricks.com/media-query-change-detection-in-javascript-through-css-animations/ | |
*/ | |
define( [ | |
/*'jquery', 'modernizr'*/ | |
], function() { |
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
/* | |
Based on: http://css-tricks.com/media-query-change-detection-in-javascript-through-css-animations/ | |
*/ | |
body { | |
@include animation-duration( 0.001s ); | |
@media screen and (min-width: 48em) { |
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 fixTouches( e ) { | |
if(e.originalEvent.touches && e.originalEvent.touches.length) { | |
e.touches = e.originalEvent.touches; | |
} else if(e.originalEvent.changedTouches && e.originalEvent.changedTouches.length) { | |
e.touches = e.originalEvent.changedTouches; | |
} | |
} | |
// Solve jQuery touch events |
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 maskBehavior = function(val) { | |
return val.match(/^(\(?11\)? ?9(5[0-9]|6[0-9]|7[01234569]|8[0-9]|9[0-9])[0-9]{1})/g) ? '(00) 00000-0000' : '(00) 0000-00009'; | |
}, | |
options = { | |
onKeyPress: function(val, e, field, options) { | |
field.mask(maskBehavior.apply({}, arguments), options); | |
} | |
}; | |
$('.phone').mask(maskBehavior, options); |
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
//On validate: | |
ignore: function(index, element) { | |
return !!$(element).parents(':hidden').length; | |
} | |
//On chosen: | |
$('.chosen-select').chosen().change(function() { | |
$(this).trigger('click'); |
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
'validate--scope-dependence': { | |
required: function(element) { | |
var hasFilled = !!$(element).closest('.validate--scope') | |
.find('input, select, textarea') | |
.not( element ) | |
.filter(function() { | |
return $(this).val().length > 0; | |
}).length; |
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
$.validator.addMethod("cMaxlength", function(value, element, param) { | |
return $.validator.methods.maxlength.call(this, value, element, param[1]); | |
}, '{0}'); | |
/* | |
USE | |
$.validator.addClassRules({ |
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
jQuery.validator.setDefaults({ | |
onkeyup: function(element) { | |
var _this = this, | |
$element = $(element), | |
element_id = $element.attr('id'), | |
classes = $element.attr('class') || ''; | |
$.each(classes.split(' '), function() { | |
if (this in $.validator.classRuleSettings && $.validator.classRuleSettings[this].onkeyup !== false) { | |
$.validator.defaults.onkeyup.apply(_this, arguments); |
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
$.validator.addMethod('onlyOne', function(value, element, params) { | |
var _this = this, | |
$element = $(element), | |
siblingsSelector = params[1], | |
scopeSelector = params[2], | |
repeated = false, | |
$repeat, | |
$elements = $element.closest(scopeSelector).find(siblingsSelector).not(element), | |
$elementsFirst = $elements.eq(0), |