Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevinoo/jquery.sake
Collection of some utility for web development, extending the collection methods of the jQuery library (http://jquery.com/download/)
https://github.com/kevinoo/jquery.sake
checkboxes escape hash jquery jquery-library sake trim validation validation-plugin
Last synced: 20 days ago
JSON representation
Collection of some utility for web development, extending the collection methods of the jQuery library (http://jquery.com/download/)
- Host: GitHub
- URL: https://github.com/kevinoo/jquery.sake
- Owner: kevinoo
- Created: 2015-05-29T11:09:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-05T15:12:32.000Z (about 6 years ago)
- Last Synced: 2023-08-06T17:05:47.196Z (over 1 year ago)
- Topics: checkboxes, escape, hash, jquery, jquery-library, sake, trim, validation, validation-plugin
- Language: JavaScript
- Homepage: https://www.lucichkevin.it/portfolio/#js_libraries
- Size: 163 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelogs
Awesome Lists containing this project
README
jQuery.sake
===========Collection of some utility for web development, extending the collection methods of the jQuery library (http://jquery.com/download/).
Features:
##### $.fn.scrollTo( speed, easing )
Performs scrolling the page using the parameters passed (or the default)
```javascript// Scroll to the element using default params (500ms of speed and linear easing)
$('#to_element').scrollTo();// Overwrite params
$('#to_element').scrollTo( 500, 'linear' );// Overwrite params using an object
$('#to_element').scrollTo({
'speed': 500,
'easing': 'linear'
});
```##### $.fn.validate(method, params)
Checks if the fields into *selector* are valid: returns true if are valid else returns false.
```html
Everything value is allowed (also empty text):
No allowed an empty value:
Text at least 3 chars:
Hidden input with a happy value:
```
```javascript
// Check fields inside the box - Returns FALSE if at least one is emptyif( $('#box_to_validate').validate() === false ){
alert('Error in fields');// To retrieve invalid fields :)
var $invalid_fields = $('#box_to_validate').find('.invalid');return;
}var data_in_box = $('#box_to_validate').getDataInfo();
// What is in *data_in_box* variable:
// {
// 'everything_value_is_allowed': '',
// 'everything_value_except_the_empty_field': 'test text',
// 'must_be_a_text_at_least_3_chars': 'something is happy',
// 'my_key': 'Smile! Here there is Sake!'
// }
```##### $.fn.check(type, subtype)
Check the data into the *selector* (input or select).##### $.fn.escape()
Return the value of the *selector* escaped.##### $.escape(str)
Return the string "str" escaped##### $.fn.replace(search, replacement, modifier)
Replace the text *search* (can be a regular expression) in the *selector* with the *replacement*.##### $.fn.lorem(params, length, random)
Write in the *selector* a lorem text##### $.fn.hash()
Return the hash of the selector's value##### $.fn.trim()
Replace and returns the value of *selector* with the value "trimmed"##### $.fn.realOuterWidth(includeMargin)
Return a width of an element (also hidden)##### $.fn.realOuterHeight(includeMargin)
Return a width of an element (also hidden)##### $.fn.getDataInfo(delimiter, ignoreHidden, types)
Returns an object with field data inside the $container (*selector*)
```html
Everything value is allowed (also empty text):
No allowed an empty value:
Text at least 3 chars:
Hidden input with a happy value:
```
```javascript
// Check fields inside the box - Returns FALSE if at least one is emptyif( $('#box_to_validate').validate() === false ){
alert('Error in fields');// To retrieve invalid fields :)
var $invalid_fields = $('#box_to_validate').find('.invalid');return;
}var data_in_box = $('#box_to_validate').getDataInfo();
// What is in *data_in_box* variable:
// {
// 'everything_value_is_allowed': '',
// 'everything_value_except_the_empty_field': 'test text',
// 'must_be_a_text_at_least_3_chars': 'something is happy',
// 'my_key': 'Smile! Here there is Sake!'
// }
```##### $.fn.setDataInfo(data, options)
Set data-info attribute to children of $container (*selector*)
```javascript$('#box_to_validate').setDataInfo({
'everything_value_is_allowed': 'Blaaaaa :-)',
'everything_value_except_the_empty_field': 'text test',
'must_be_a_text_at_least_3_chars': 'happy is something',
'my_key': 'Here there is Sake! Smile!'
});
```##### $.fn.checkboxes(action)
Trigger an action to checkboxes contain in a $container (*selector*)
```html
```
```javascript$('#my_checkboxes_box').checkboxes('values');
// [3]
// Only last checkbox is checked :P// Invert selection of all checkboxes
$('#my_checkboxes_box').checkboxes('invert');
```