Skip to content
Browse files

Added todo and license

  • Loading branch information...
1 parent 4e98e52 commit 25659085bbcff23117365abff1206a2ba200410e @leejones committed
Showing with 65 additions and 2 deletions.
  1. +19 −0 LICENSE
  2. +45 −2 README.mdown
  3. +1 −0 TODO
View
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Lee Jones
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
47 README.mdown
@@ -1,9 +1,52 @@
# jQuery Prepare Links Plugin
-Opens external links in a new window
+Automagically open links to other sites in a new window.
+
+I'm generally not a huge fan of opening links in a new window, but clients frequently want this functionality on their sites.
+
+## Basic Usage
+Opens all links outside of your domain in a new window.
$(document).ready(function() {
$("a").prepare_links();
});
-Considers same domain, subdomain, and localhost to be internal links by default
+Considers same domain, subdomain, and localhost to be internal links by default. See the options to change default behavior.
+
+## Options
+
+ subdomains_are_external
+
+boolean
+defaults to false
+determines whether subdomains like www.example.com and blog.example.com open in a new window
+
+ additional_internal_sites
+
+array
+defaults to empty
+allows you to specify additional domains that should open in the same window
+
+### Example with options
+
+ $(document).ready(function() {
+
+ // build options for prepare links
+ var options = {
+ subdomains_are_external : true,
+ additional_internal_sites : [
+ "http://github.com",
+ "http://google.com"
+ ]
+ };
+
+ // call prepare links with predefined options
+ $("a").prepare_links(options);
+ });
+
+Links for the current domain, github.com, and google.com will open in the current window. All other links including subdomains will open in a new window.
+
+## Feedback
+
+If you find a bug, please write a unit test for it and submit a patch. You can also raise an issue on [github](http://github.com/leejones/prepare_links).
+
View
1 TODO
@@ -0,0 +1 @@
+• implement event delegation so that a click handler is not set for every link

0 comments on commit 2565908

Please sign in to comment.
Something went wrong with that request. Please try again.