jquery.urianchor
Advanced tools
Comparing version 1.3.0 to 1.3.3
/* | ||
* Jquery plugin for state managment through the URI anchor (hash fragment) | ||
* jQuery plugin to manage the URI anchor component ("hash fragmant") | ||
* | ||
* Copyright (c) 2013 Michael S. Mikowski | ||
* Copyright (c) 2013-2015 Michael S. Mikowski | ||
* (mike[dot]mikowski[at]gmail[dotcom]) | ||
@@ -11,7 +11,5 @@ * | ||
* Versions | ||
* 1.1.1-3 - Initial jQuery plugin site releases | ||
* 1.2.1 - Updated documentaiton, minor bug fixes | ||
* | ||
* 1.1.1-1.1.3 - Initial jQuery plugin site releases | ||
* 1.2.1-1.3.3 - Updated documentation, minor bug fixes | ||
*/ | ||
/*jslint browser : true, continue : true, | ||
@@ -23,3 +21,2 @@ devel : true, indent : 2, maxerr : 50, | ||
*/ | ||
/*global jQuery */ | ||
@@ -32,6 +29,6 @@ | ||
configMap = { | ||
regex_anchor_clean1 : /^[#!]*/, | ||
regex_anchor_clean2 : /\?[^?]*$/, | ||
settable_map_key : { schema_map : true }, | ||
schema_map : null | ||
clean0_regex : /^[#!]*/, | ||
clean1_regex : /\?[^?]*$/, | ||
settable_map_key : { schema_map : true }, | ||
schema_map : null | ||
}, | ||
@@ -66,5 +63,5 @@ | ||
// remove any leading pounds or bangs | ||
.replace( configMap.regex_anchor_clean1 , '' ) | ||
.replace( configMap.clean0_regex , '' ) | ||
// snip off after question-mark ( a ClickStreet bug ) | ||
.replace( configMap.regex_anchor_clean2 , '' ) | ||
.replace( configMap.clean1_regex , '' ) | ||
; | ||
@@ -71,0 +68,0 @@ }; |
@@ -1,8 +0,7 @@ | ||
{ | ||
"name": "jquery.urianchor", | ||
"version": "1.3.0", | ||
"description": "uriAnchor jQuery plugin - SPA URI management made simple. Use this plugin to manage dependent and independent parameters in the hash fragment of the URI. It has been designed and updated over five commercial SPA projects and is featured in the book [Single page web applications - JavaScript end-to-end](http://manning.com/mikowski). It provides the capability to make the URI fragment your application state API. Bookmarks, browser history, the back button, and the forward button can all be made to act as the user expects.", | ||
{ "name": "jquery.urianchor", | ||
"version": "1.3.3", | ||
"description": "uriAnchor jQuery plugin - SPA URI routing made simple. Use this plugin to provide sophisticated routing to your SPA. Used in many commercial SPAs and featured in a best-selling book.", | ||
"main": "jquery.uriAnchor.js", | ||
"scripts": { | ||
"test": "echo \"No test yet specified\" && exit 1" | ||
"test": "echo \"https://github.com/mmikowski/spa/tree/master/listings/ch05_06\" && exit 1" | ||
}, | ||
@@ -9,0 +8,0 @@ "repository": { |
@@ -16,2 +16,24 @@ # uriAnchor # | ||
## Preferred listener ## | ||
The preferred listener to use with URI Anchor is `hashchange`, like so: | ||
// jQuery | ||
$(window).bind( 'hashchange', onHashChange ); | ||
// Native | ||
window.onhashchange( onHashChange ); | ||
## Example implementation ## | ||
See a full example, clone the [SPA listings](10), | ||
dereference a copy of the 6.5 listings, and then open the web page. Like so: | ||
cd spa/listings/ch05-06 | ||
cp -aL 6.5 6.5dr | ||
cd 6.5dr | ||
google-chrome spa.html | ||
You must log in -- any user name will work -- to open and close the chat window and activate the avitars. | ||
## Methods ## | ||
@@ -23,5 +45,4 @@ | ||
Sets Anchor component of the URI from a Map | ||
(The Anchor component is also known as the | ||
'hash fragment' or 'bookmark component') | ||
Sets Anchor component of the URI from a Map. | ||
The Anchor component is also known as the 'hash fragment' or 'bookmark component'. | ||
@@ -115,7 +136,7 @@ #### Arguments #### | ||
- `delimit_char` : Delimiters independent args. Default is `&`. | ||
- `delimit_kv_char`: Delimiters key and value of independent args. Default is `=`. | ||
- `sub_delimit_char` : Delimiters independent and dependent args. Defaults is `:`. | ||
- `dep_delimit_char` : Delimiters key-value pairs in dependent args. Default is `|`. | ||
- `dep_kv_delimit_char` : Delimits key and value of dependent args. Default is ',' | ||
- `delimit_char` : Delimiter between independent args. Default is `&`. | ||
- `delimit_kv_char`: Delimiter between key and value of independent args. Default is `=`. | ||
- `sub_delimit_char` : Delimiter between independent and dependent args. Defaults is `:`. | ||
- `dep_delimit_char` : Delimiter between key-value pairs in dependent args. Default is `|`. | ||
- `dep_kv_delimit_char` : Delimiter between key and value of dependent args. Default is ',' | ||
@@ -226,2 +247,3 @@ Boolean values ( as part of a key-value pair ) are convert into the stings 'true' or 'false'. | ||
| ------------ | ------------------- | ----------------------------------| | ||
| Websockets | [Socket.io][6] | Prefer websockets over AJAX. | | ||
| AJAX | jQuery native | Use jQuery AJAX methods. | | ||
@@ -243,3 +265,3 @@ | Promises | jQuery native | Use jQuery promise methods. | | ||
This suite of tools has all the capabilities of a bleeding-edge | ||
This suite of tools has all the capabilities of a bleeding-edge | ||
SPA "framework" library within the reliable and mature jQuery ecosystem. | ||
@@ -260,11 +282,14 @@ It can provide an application that is significantly more flexible and | ||
### Version 1.1.0-3 ### | ||
### Versions 1.1.0-3 ### | ||
These are the first releases registered with jQuery plugins. | ||
### Version 1.2.1 ### | ||
### Versions 1.2.0-2, 1.3.0-1 ### | ||
Updated documentation, fixed minor bug. | ||
### Version 1.3.0 ### | ||
Updated documentation. | ||
### Version 1.3.2 ### | ||
Added example to show use of hashchange listener. | ||
### Version 1.3.3 ### | ||
Added changeAnchorPart example code | ||
## TODO ## | ||
@@ -287,6 +312,6 @@ | ||
[5]:https://github.com/typicaljoe/taffydb | ||
[6]:http://linkedin.github.io/dustjs | ||
[6]:http://socket.io | ||
[7]:https://github.com/mbostock/d3 | ||
[8]:http://keith-wood.name/svg.html | ||
[9]:http://linkedin.github.io/dustjs | ||
[10]:https://github.com/mmikowski/spa |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
49696
6
1046
0
311