Wednesday, 21 May 2014

12 More jQuery Code Snippets That You Can Use!


Code snippets in jQuery for when you are running out of ideas by yourself!
We recently published a collection of 10 jQuery Code Snippets that you could use. If that wasn't enough for you then here are 12 more. Copy and enjoy!

1. Enable submit button if text entered with jQuery
$('‪#‎username‬').keyup(function() {
$('‪#‎submit‬').attr('disabled', !$('#username').val());
});

2. Center Div on div with jQuery
// Centers on screen
jQuery.fn.center = function (div) {
this.css("position", "absolute");
var position = div.position();
this.css("top", Math.max(0, ((div.height() - this.outerHeight()) / 2) + position.top) + "px");
this.css("left", Math.max(0, ((div.width() - this.outerWidth()) / 2) + position.left) + "px");
return this;
};
//use
$('‪#‎ajxload‬').center($('‪#‎mapWrapper‬')).show();

3. jQuery Show Content Based on Select Option
jQuery(function () {
jQuery('‪#‎select_ID‬').change(function () {
var selected = $(this).find(':selected').val();
jQuery(".item_to_hide").hide();
jQuery('#' + selected).show();
}).change();
});

4. Prevent multiple submit of your form with jQuery
$(document).ready(function() {
$('form').submit(function() {
if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
jQuery.data(this, "disabledOnSubmit", { submited: true });
$('input[type=submit], input[type=button]', this).each(function() {
$(this).attr("disabled", "disabled");
});
return true;
}
else
{
return false;
}
});
});

5. jQuery Highlight related label when input in focus
$("form :input").focus(function() {
$("label[for='" + this.id + "']").addClass("labelfocus");
}).blur(function() {
$("label").removeClass("labelfocus");
});

6. Document Ready with Global Ajax Listener and Status Indicator in jQuery
$(function(){
/**
* ATTACH AJAX LISTENER TO BODY TO MAKE A GLOBAL
* AJAX STATUS MONITOR FOR THE WHOLE PAGE. ANY AJAX
* CALL FROM ANY FUNCTION THAT RUNS ON THE PAGE
* WILL AUTOMATICALLY REPORT ITS STATUS
*/
$("body").ajaxStart(function(){
$('‪#‎ajax_status_div‬').html("Ajax Request Sent");//update text message
$('.activity_indicator').show(); //show ajax activity image(spinner gif)
});
$("body").ajaxSuccess(function(event,xmlHttp,options){
var status = xmlHttp.statusText;
var url = options.url;
var data = options.data;
$('.activity_indicator').hide(); //hide ajax activity image(spinner gif)
$('#ajax_status_div').html("URL : "+url+" <br/> Status : "+status);//update text message
});
});

7. Set Default Value for Select Lists Using value attribute with jQuery
$(function(){
$('select[value]').each(function(){
$(this).val(this.getAttribute("value"));
});
});
//The Markup Looks Like This
<select name="category" id="category" value="PHP"> //NOTICE value attribute!!!
<option value="ARTICLE">ARTICLE</option>
<option value="PHP">PHP</option> //THIS IS THE DEFAULT OPTION
<option value="MySql">MYSQL</option>
<option value="jQuery">jQuery</option>
<option value="CSS(3)">CSS(3)</option>
</select>

8. Blink Text using jQuery
<script type="text/javascript" >
function blink(selector){
$(selector).fadeOut('slow', function(){
$(this).fadeIn('slow', function(){
blink(this);
});
});
}
$(document).ready(function(){
blink('.blink');
});
</script>

9. jQuery Making textfield only accept numeric values
$(document).ready(function() {
$("‪#‎txtboxToFilter‬").keydown(function(event) {
// Allow only backspace and delete
if ( event.keyCode == 46 || event.keyCode == 8 ) {
// let it happen, don't do anything
}
else {
// Ensure that it is a number and stop the keypress
if (event.keyCode < 48 || event.keyCode > 57 ) {
event.preventDefault();
}
}
});
});

10. jQuery Hide datepicker on key press and submit on enter
$(document).ready(function() {
$(".datepicker").keypress(function (e) {
$(".datepicker").datepicker("hide");
if (e.which == 13) {
var param = 'change_expiry_date_'+getId(this.name);
$("‪#‎operation‬").attr("value",param);
form.submit();
}
});
});

11. Add class depending on browser with jQuery
$(document).ready(function(){
$('html').addClass($.browser);
});
<b>

12. Form Field Default Values with jQuery</b>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
$(document).ready(function() {
$('.someClass').each(function() {
var $this = $(this);
var defaultVal = $this.attr('title');
$this.focus(function() {
if ($this.val() === defaultVal) {
$this.val('');
}
});
$this.blur(function() {
if ($this.val().length === 0) {
$this.val(defaultVal);
}
});
});
});
</script>
<style>
input {
display:block;
margin-bottom:5px;
}
</style>
</head>
<body>
<input class="someClass" type="text" title="Name" value="Name" />
<input class="someClass" type="text" title="Email Address" value="Email Address" />
<input class="someClass" type="text" title="Default Value Here" value="Insert form refill here" />
</body>
</html>
5 Best Wi-Fi Hacking Tools And Software!

1. Kismet
Kismet is an 802.11 layer2 wireless network detector, sniffer, and intrusion detection system. Kismet will work with any wireless card which supports raw monitoring (rfmon) mode, and (with appropriate hardware) can sniff 802.11b, 802.11a, 802.11g, and 802.11n traffic. Kismet also supports plugins which allow sniffing other media such as DECT. Kismet identifies networks by passively collecting packets and detecting standard named networks, detecting (and given time, decloaking) hidden networks, and infering the presence of nonbeaconing networks via data traffic.
-Features :
1. 802.11b, 802.11g, 802.11a, 802.11n sniffing
2. Standard PCAP file logging (Wireshark, Tcpdump, etc)
3. Client/Server modular architecture
4. Multi-card and channel hopping support
5. Runtime WEP decoding
6. Tun/Tap virtual network interface drivers for realtime export of packets
7. Hidden SSID decloaking
8. Distributed remote sniffing with Kismet drones
9. XML logging for integration with other tools
10. Linux, OSX, Windows, and BSD support (devices and drivers permitting)

2. NetStumbler
NetStumbler is a tool for Windows that facilitates detection of Wireless LANs using the 802.11b, 802.11a and 802.11g WLAN standards. It runs on Microsoft Windows operating systems from Windows 2000 to Windows XP. A trimmed-down version called MiniStumbler is available for the handheld Windows CE operating system.
-Used for :
1. Wardriving
2. Verifying network configurations
3. Finding locations with poor coverage in a WLAN
4. Detecting causes of wireless interference
5. Detecting unauthorized ("rogue") access points
6. Aiming directional antennas for long-haul WLAN links

3. WireShark
Wireshark is the world's foremost network protocol analyser. It lets you see what's happening on your network at a microscopic level. It is the de facto standard across many industries and educational institutions.
-Features :
1. Deep inspection of hundreds of protocols, with more being added all the time
2. Live capture and offline analysis
3. Standard three-pane packet browser
4. Multi-platform: Runs on Windows, Linux, OS X, Solaris, FreeBSD, NetBSD, and many others
5. Captured network data can be browsed via a GUI, or via the TTY-mode TShark utility

4. AirSnort
AirSnort is a Linux and Microsoft Windows utility (using GTK+) for decrypting WEP encryption on an 802.11b network. Distributed under the GNU General Public License,[1] AirSnort is free software. However, it is no longer maintained or supported.

5. CoWPAtty
CoWPAtty automates the dictionary attack for WPA-PSK. It runs on Linux. The program is started using a command-line interface, specifying a word-list that contains the passphrase, a dump file that contains the four-way EAPOL handshake, and the SSID of the network.

New Android Trojan targeting Facebook users

Looking To Learn Web Designing? Here Are 10 Good Sites To Help You!


1.HTML Tutorial – Web Design
This HTML tutorial takes you through the steps to building a Web page. You'll start out with the basic tags for a page, and run through adding text and graphics to the page, and much more.

2.HTML Tutorial-HS Scripts
This is a free online tutorial to help you learn the basics of html.

3.Easy Html Tutorials
On this tutorials blog, you will find codes that the author has written himself, as well as codes from other sources (these will be cited in the tutorial itself).

4.Help Learn HTML Tag Coding
Within these basic html coding tutorials and website building resources you will only find information that promotes good coding practices, accessibility improvement of your website and improved overall website visitor experiences.

5.Bravenet HTML and CSS Tutorials
In these tutorials you will learn how to code HTML and CSS together, as they have become basic web essentials. HTML is used to define your content and CSS is used to style your content. The sections 'HTML Basics', and 'Before you Code' will give you the run down on how to get started; each section thereafter is a tutorial in itself although they are quite dependant on the previous tutorial's knowledge and should be done in order.

6.HTML Tutorial – Lesson Plan – Alternet Web Design
This interactive HTML tutorial has been specifically designed to be applicable to Alternet Web Design clients. The lessons explain HTML coding and teach you how modify existing Web pages. The tutorial uses a "hands-on" approach to teaching HTML so you will be able to test out the HTML lessons as you go through them.

7.HTML Badge Collection – Treehouse
This HTML tutorial helps you master HTML. Mastering HTML and its many elements is critical for any type of web professional. HTML or "Hyper Text Markup Language" describes the basic structure and content of a web page.

8.Learn from DTP and HTML Tutorial
This site is a compilation of tutorial and lesson pages relating to, DTP - Desktop Publishing - Prepress and HTML - Internet - Hyper Text Markup Language, free perl cgi scripts etc. plus it includes a couple of utilities and free Web Graphics for down loading.

9.HTML Source
If you are just starting your illustrious HTML career, have a leaf through the two “Starting Off” sections. If you want more specific tutorials check out the in-depth “Lessons” on each aspect of HTML and CSS, and if you’re well-versed in the arts of web development you should read the “Advanced” stuff.

10.HTML Tutorials for the Complete Idiot
These tutorials have been designed to help people build better home pages the easy way. Step by step tutorials in plain english will enable you to gain the knowledge needed; HTML tips, tricks, and techniques. Web page design tools, lists, tables, META tags, backgrounds, images, page jumps, fonts, headings, color codes and many other instructional resources.

How to stop video ads on Facebook from playing automatically



5 Best Wi-Fi Hacking Tools And Software!


1. Kismet
Kismet is an 802.11 layer2 wireless network detector, sniffer, and intrusion detection system. Kismet will work with any wireless card which supports raw monitoring (rfmon) mode, and (with appropriate hardware) can sniff 802.11b, 802.11a, 802.11g, and 802.11n traffic. Kismet also supports plugins which allow sniffing other media such as DECT. Kismet identifies networks by passively collecting packets and detecting standard named networks, detecting (and given time, decloaking) hidden networks, and infering the presence of nonbeaconing networks via data traffic.
-Features :
1. 802.11b, 802.11g, 802.11a, 802.11n sniffing
2. Standard PCAP file logging (Wireshark, Tcpdump, etc)
3. Client/Server modular architecture
4. Multi-card and channel hopping support
5. Runtime WEP decoding
6. Tun/Tap virtual network interface drivers for realtime export of packets
7. Hidden SSID decloaking
8. Distributed remote sniffing with Kismet drones
9. XML logging for integration with other tools
10. Linux, OSX, Windows, and BSD support (devices and drivers permitting)

2. NetStumbler
NetStumbler is a tool for Windows that facilitates detection of Wireless LANs using the 802.11b, 802.11a and 802.11g WLAN standards. It runs on Microsoft Windows operating systems from Windows 2000 to Windows XP. A trimmed-down version called MiniStumbler is available for the handheld Windows CE operating system.
-Used for :
1. Wardriving
2. Verifying network configurations
3. Finding locations with poor coverage in a WLAN
4. Detecting causes of wireless interference
5. Detecting unauthorized ("rogue") access points
6. Aiming directional antennas for long-haul WLAN links

3. WireShark
Wireshark is the world's foremost network protocol analyser. It lets you see what's happening on your network at a microscopic level. It is the de facto standard across many industries and educational institutions.
-Features :
1. Deep inspection of hundreds of protocols, with more being added all the time
2. Live capture and offline analysis
3. Standard three-pane packet browser
4. Multi-platform: Runs on Windows, Linux, OS X, Solaris, FreeBSD, NetBSD, and many others
5. Captured network data can be browsed via a GUI, or via the TTY-mode TShark utility

4. AirSnort
AirSnort is a Linux and Microsoft Windows utility (using GTK+) for decrypting WEP encryption on an 802.11b network. Distributed under the GNU General Public License,[1] AirSnort is free software. However, it is no longer maintained or supported.

5. CoWPAtty
CoWPAtty automates the dictionary attack for WPA-PSK. It runs on Linux. The program is started using a command-line interface, specifying a word-list that contains the passphrase, a dump file that contains the four-way EAPOL handshake, and the SSID of the network.