LinkAlert v1.1
A jQuery plugin made by jerone.
Intro
LinkAlert is a jQuery plugin that makes it easy to detect which type of link it is. If it's a link to a pdf file or a link to a ftp location, this plugin will detect it and put a regornizable icon beside it.
There are two situations available for showing what for link it is; inline (beside the link) or beside your mouse pointer when you hover over it. Offcourse you can choose also both options.
Besides this plugin already contains a lot regornizable links, you can easaly add your own or customize an excisting one.
Some of the features are:
- Detects protocols, extension and custom conditions.
- Already detects all common links + a few others.
- Easy to add your own conditions or customize an existing one.
- No style is added in the script itself, so all is fully changable with CSS.
- Cross browser. Tested working in all major browsers: Internet Explorer 6 - 8, Firefox 1 - 3.5, Opera 9 & 10, Chrome 1 - 3 and Safari 4. It should work with newer browsers and may work with older browsers, no promise until tested.
Options
Usage
Place the following code in the head of your page.
<!-- LinkAlert style -->
<style type="text/css">
span.linkAlertSpan { }
div.linkAlertDiv { }
img.linkAlertImg {
border: 0 none;
}
</style>
<!-- Mandatory JavaScript files -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script type="text/javascript" src="jquery-linkalert.js"></script>
<!-- LinkAlert definition -->
<script type="text/javascript">
(function($) {
$(function() {
$.LinkAlert({ folder: "images/" });
});
})(jQuery);
</script>
The LinkAlert plugin must be called after the document is loaded.
Please note that a new protocols, extensions or conditions will be added to the existing list.
If you want to delete a sertain match, you should override the sertain key with null.
That can be done in 2 ways:
$.LinkAlert.defaults.conditions["External"] = null;
$.LinkAlert({ conditions: { "External": null} });
If you want to override a sertain match, you should override the sertain key with the new value.
That can again be done in 2 ways:
$.LinkAlert.defaults.conditions["External"].match = "new value";
$.LinkAlert({ conditions: { "External": { match: "new value"}} });
Download
A zip archive for this plugin is available here: jquery-linkalert-1.1.zip (size: 50kb).
The zip archive contains the following files:
- jquery-linkalert.js - actual plugin (size: 7kb).
- jquery-linkalert-min.js - minified plugin version (size: 6kb).
jquery-linkalert-vsdoc.js - VSDoc documentation file (size: 0kb).- jquery-linkalert.html - clean example page (size: 20kb).
- all needed images (size: 44kb).
Older versions
- jquery-linkalert-1.0.1.zip (size: 50kb).
- jquery-linkalert-1.0.zip (size: 48kb).
Changelog
-
version 1.1 (09-3-2010):
- MOD: Updated to jQuery 1.4.2;
- MOD: Cleaned up code;
-
version 1.0.1 (20-7-2009):
- ADD: Added minified script version;
-
version 1.0 (19-7-2009):
- Initial release;
FAQ
Which versions of jQuery is this plugin compatible with?
Version 1.1 is compatible with jQuery 1.4.2 and higher.
If you want a working version for jQuery 1.3.2 and lower, you can use version 1.0.1.
Which browsers is this plugin compatible with?
Tested working in Internet Explorer 6 - 8, Firefox 1 - 3.6, Opera 9 & 10.5, Chrome 1 - 4 and Safari 4.
It should work with newer browsers and can work with older browsers, no promise until tested.
Does the plugin work with any other plugins?
There's no build-in support for other plugins.
Is there a VSDoc file available for this plugin?
Yes, there's a VSDoc file available on the download page.
What is VSDoc?
VSDoc is documentation format for Visual Studio.
By using this file information is added to JavaScript Intellisense. This is only available in VS2008 SP1.
Todo
- ...
Site Search