Ads

Friday, 19 December 2014

tweetParser.js

http://www.htmluse.com/wp-content/uploads/2014/12/tweetparser.jpg
Download Demo
tweetParser.js Parse elements containing a tweets and turn URLS, @users & #hashtags into working urls.
1. INCLUDE JS FILES
<script src="js/jquery.min.js"></script>
<script src="js/jquery.tweetParser.min.js"></script>
2. HTML
<p class="tweets">This is my awesome text only tweet ! #web #twitter @twitter http://www.twitter.com/ !!</p>
3. JAVASCRIPT
//basic usage
$("p.tweets").tweetParser();
 
//With parameters
$("p.tweets").tweetParser({
    urlClass : "tweet_link", //this is default
    userClass : "tweet_user", //this is default
    hashtagClass : "hashtag", //this is default
    target : "_blank" //this is default
});
4. OPTIONS
Parameters Type default description
urlClass String tweet_link css Class used for url in the tweet
userClass String tweet_user css Class used for @user profil url in the tweet
hashtagClass String hashtag css Class used for hashtags url in the tweet
target HTML attribute for anchor tags _blank target used for all generated



Formcache - A simple jQuery form cache plugin



 123




Download Demo
Formcache is a simple jQuery form cache plugin.
Browser Support
  • Chrome 31+
  • Firefox 31+
  • Internet Explorer 8+
  • Opera 26+
  • Safari 5.1+
  • iOS Safari 7.1+
  • Android Browser 4.1+
  • Chrome for Android 39+
1. INCLUDE JS FILES
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/formcache.js"></script>
2. HTML
<form id="form"></form>
3. JAVASCRIPT
$('#form').formcache();
4. OPTIONS
key
  • Type: String | Number
  • Default: ”
A special identification for the form cache, must be different to other forms in the same page.
By default, the form’s index in the document will be used as the key.
local
  • Type: Boolean
  • Default: true
Store cache in localStorage.
session
  • Type: Boolean
  • Default: true
Store cache in sessionStorage.
autoStore
  • Type: Boolean
  • Default: true
Update and store the cache automatically when a form control changed or before page unload.
maxAge
  • Type: Number
  • Default: undefined
set the stored time (in seconds) of the caches, just like the max-age for cookie.
By default, the session caches will be cleared when the browser closes, and the local caches will be stored all the time.
Notes:
  • session caches still will be cleared when the browser closes.
  • local caches still will be cleared when the browser caches clears.
controls
  • Type: Array
  • Default:
[
  'select',
  'textarea',
  'input'
]
A jQuery selectors array. Defines the form controls which need to be cached.
Note: All file inputs will be ignored always by default.
5. METHODS
getCache([index])
Params Type Default Description
index Number 0 Cache index
Get the default cache object or a special one.
Examples:
$().formcache('getCache')
$().formcache('getCache', 1)
getCaches()
Get all cache objects.
Examples:
$().formcache('getCaches')
setCache([index, ]data)
Params Type Default Description
index Number 0 Cache index
data Object
Cache item
Override the default cache object or add a new one.
Examples:
$().formcache('setCache', {})
$().formcache('setCache', 1, {})
setCaches(data)
Params Type Description
data Array Cache items
Override the old caches with new caches.
Examples:
$().formcache('setCaches', [{}])
$().formcache('setCaches', [{}, {}])
removeCache([index])
Params Type Default Description
index Number 0 Cache index
Remove the default cache object or a special one.
Examples:
$().formcache('removeCache')
$().formcache('removeCache', 1)
removeCaches()
Remove all cache objects.
Examples:
$().formcache('removeCaches')
outputCache([index])
Params Type Default Description
index Number 0 Cache index
Output the default cache object or a special one to the form.
The outputed cache object will be updated automatically when any form control changed.
Examples:
$().formcache('outputCache')
$().formcache('outputCache', 1)
serialize()
Serialize the form and return a cache object.
Examples:
var cache = $('form').formcache('serialize');

$('form').formcache('setCache', cache);
$('form').formcache('setCaches', [cache, cache]);
store()
Store all caches to sessionStorage or localStorage.
The plugin will do this automatically when a form control changed, or the window unloaded.
clear()
Clear all caches.
destroy()
Destroy the formcache instance, but keep the caches.
If you want to remove all caches, you can call clear method first and then call the destroy method.






NotifIt - Simple notifications with JQuery

notifit


Download Demo
NotifIt is a simple colorful animated notifications with JQuery
Now you can send notifications of everything you want and when you want, simply and quickly. Easy to learn and use. Customize with your favorite colors, define the size you want, set the opacity, make a sticky one and much more!
1. INCLUDE CSS AND JS FILES
<script type="text/javascript" src="jquery.js"></script>
<script type='text/javascript' src='js/notifIt.js'></script>
<link rel='stylesheet' type='text/css' href='css/notifIt.css'>
2. JAVASCRIPT
notif({
    msg: "<b>Oops!</b> A wild error appeared!",
    type: "error",
    position: "center"
});
3. OPTIONS
Variable name Type Posible values Default
type String success, error, warning, info default
msg String Message
position String left, center, right, bottom right
width Integer-String Number > 0, ‘all’ 400
height Integer Number between 0 and 100 60
autohide Boolean true, false true
opacity Float From 0 to 1 1
multiline Boolean true, false false
fade Boolean true, false false
bgcolor String HEX color #444
color String HEX color #EEE
timeout Integer Miliseconds 5000
zindex Integer The z-index of the notification null (ignored)
offset Integer The offset in pixels from the edge of the screen 0
callback Function Function null (ignored),
clickable Boolean true, false false

Thursday, 18 December 2014

Skidder jQuery slideshow pugin



Skidder is a jQuery slideshow pugin that supports centering, swiping and responsive scaling.
Features
  • optional paging
  • optional cycling
  • optional centering
  • optional image scaling, also on resize
  • iOS-like swiping on touch devices
  • works with: Chrome, Firefox, Safari, IE8+ …
1. INCLUDE CSS AND JS FILES
<link rel="stylesheet" href="../src/jquery.skidder.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../src/jquery.skidder.js"></script>
2.  HTML
<div class="slideshow" style="display: none;">
  <div class="slide"><img src="1.jpg"></div>
  <div class="slide"><img src="2.jpg"></div>
  <div class="slide"><img src="3.jpg"></div>
</div>
3. JAVASCRIPT
$('.slideshow').skidder();
Make sure that images are loaded before initialising the plug-in, or the slideshow might not get sized correctly. You can use imagesloaded.js for this purpose – load it, then call like this:
$('.slideshow').each( function() {  
  var $slideshow = $(this);
  $slideshow.imagesLoaded( function() {
    $slideshow.skidder();
  });
});
Sliding contriols are disabled for slideshows with less than two images.
4. OPTIONS
OptionDescription
slideClassDefault: ‘.slide’
scaleImagesScales widest image to maxSlideWidth. Adjusts slideshow height accordingly. Requires images! Default: false
maxSlideWidthScale widest image to this width if scaleImages == true. Default: 800
pagingCreates a clickable and stylable paging dot for each slide. Default: true
swipingEnable swiping on touch device. Default: true
leftalignedSet to true if you don’t want your slideshow centered. (true = buggy!) Default: false
cycleSet to false if you don’t want your slideshow to wrap around (false = buggy!).Default: true
jumpbackIn non-cycling mode jumpback will display a ‘return to first slide’ arrow at the last slide. Default: false
speedTransition speed. Default: 400
autoplay_Default: false
intervalAutoplay interval _Default: 4000
afterSlidingDefine if you need a callback function
5. RESIZING
$(‘.slideshow’).skidder(‘resize’);
You will want to debounce this to save some trees

jQuery Tristate


Download Demo
jQuery standalone tristate (indeterminate) checkbox with pseudo selectors and optional value modification and .val() overwrite. Standalone, so usable for purposes other than list/tree marking.
Features
  • Simple syntax: .tristate()
  • Options to set alternative values for true, false and null state.
  • Access using val() (when alternative values specified).
  • Set state using widget-like syntax .tristate(‘state’, true/false/null);
  • :tristate, :indeterminate and :determinate pseudo selectors included.
  • Indeterminate state can be set using indeterminate=”indeterminate” attribute.
  • Alternative values can be set using checkedvalue, uncheckedvalue and indeterminatevalueattributes or options.
  • HTML attributes modified by the plugin.
  • Should support every major browser, including IE6.
Browser support
Tested with v1.0.5
  • Chrome 31
  • FireFox 25
  • Opera 17
  • Internet Explorer 10
1. INCLUDE CSS AND JS FILES
<!-- jQuery/jQueryUI (hosted) -->
<!-- Markdown parser -->
<!-- Prettyprint -->
<link href="https://google-code-prettify.googlecode.com/svn/loader/prettify.css" rel="stylesheet" type="text/css"/>
 
<script src="jquery.tristate.js"></script>
2. HTML
<input type="checkbox" class="tristate"/>
<input type="checkbox" class="tristate" checked="checked"/>
<input type="checkbox" class="tristate" indeterminate="1"/>
3. JAVASCRIPT
$(function() {
        $('.tristate').tristate({
            change: function(state, value) {
                console.log('Input:', this);
                console.log('Unknown?', state === null);
                console.log('Known?', state !== null);
                console.log('Checked?', state === true);
                console.log('Unhecked?', state === false);
            }
        });
});
4. OPTIONS
  • state: true for checked, false for unchecked or null for undeterminate.
  • value: Set the value in order to set the state. Only works if values are specified for checked, uncheckedand/or indeterminate.
  • checked: The value to return for checked state. If not specified, the value in the value attribute is returned.
  • unchecked: The value to return for unchecked state. If not specified, the value in the value attribute is returned.
  • indeterminate: The value to return for indeterminate state. If not specified, the value in the value attribute is returned.
5. EVENTS
  • init(state, value): Triggered upon initialization. State can be true, false or null. Value is the value as it would be returned from .val().
  • change(state, value): Triggered whenever the state changes. State can be true, false or null. Value is the value as it would be returned from .val().
6. METHODS
  • state: Either get or set the state of the checkbox. Uses true for checked, false for unchecked or null for indeterminate state.
  • value: Get the current value or set the state by specifying the value. Setting the value only works if you have specified values (either using expando attributes or options) for the different states.