Skip to content

Commit 8c83919

Browse files
committed
Updated docs
1 parent 41ea0e6 commit 8c83919

6 files changed

+35
-71
lines changed

.gitignore

100644100755
-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
*~
44
*.log
55
node_modules
6-
*.env
7-
.DS_Store
8-
package-lock.json
9-
.bloggify/*

DOCUMENTATION.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ You can see below the API reference of this module.
66
Finds the value of parameter passed in first argument.
77

88
#### Params
9-
109
- **String** `name`: The parameter name.
1110
- **Boolean** `notDecoded`: If `true`, the result will be encoded.
1211

@@ -20,7 +19,6 @@ the parameter is there, but it doesn't have a value, the value will
2019
be `true`.
2120

2221
#### Params
23-
2422
- **String** `search`: An optional string that should be parsed (default: `window.location.search`).
2523

2624
#### Return
@@ -30,7 +28,6 @@ be `true`.
3028
Stringifies a query object.
3129

3230
#### Params
33-
3431
- **Object** `queryObj`: The object that should be stringified.
3532

3633
#### Return
@@ -40,7 +37,6 @@ Stringifies a query object.
4037
Adds, updates or deletes a parameter (without page refresh).
4138

4239
#### Params
43-
4440
- **String|Object** `param`: The parameter name or name-value pairs as object.
4541
- **String** `value`: The parameter value. If `undefined`, the parameter will be removed.
4642
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
@@ -50,17 +46,19 @@ will not bring you to the old location.
5046
#### Return
5147
- **Url** The `Url` object.
5248

53-
### `getLocation()`
49+
### `getLocation(excludeHash)`
5450
Returns the page url, but not including the domain name.
5551

52+
#### Params
53+
- **Boolean** `excludeHash`: If `true`, the location hash will not be appended in the result.
54+
5655
#### Return
5756
- **String** The page url (without domain).
5857

5958
### `hash(newHash, triggerPopState)`
6059
Sets/gets the hash value.
6160

6261
#### Params
63-
6462
- **String** `newHash`: The hash to set.
6563
- **Boolean** `triggerPopState`: Triggers the popstate handlers (by default falsly).
6664

@@ -71,7 +69,6 @@ Sets/gets the hash value.
7169
Update the full url (pathname, search, hash).
7270

7371
#### Params
74-
7572
- **String** `s`: The new url to set.
7673
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
7774
will not bring you to the old location.
@@ -85,7 +82,6 @@ pathname
8582
Sets/gets the pathname.
8683

8784
#### Params
88-
8985
- **String** `pathname`: The pathname to set.
9086
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
9187
will not bring you to the old location.
@@ -101,14 +97,12 @@ Calls the popstate handlers.
10197
Adds a popstate handler.
10298

10399
#### Params
104-
105100
- **Function** `cb`: The callback function.
106101

107102
### `removeHash(push, trigger)`
108103
Removes the hash from the url.
109104

110105
#### Params
111-
112106
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
113107
will not bring you to the old location.
114108
- **Boolean** `trigger`: Triggers the popstate handlers (by default falsly).
@@ -117,7 +111,6 @@ will not bring you to the old location.
117111
Removes the querystring parameters from the url.
118112

119113
#### Params
120-
121114
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
122115
will not bring you to the old location.
123116
- **Boolean** `trigger`: Triggers the popstate handlers (by default falsly).

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-20 jillix <[email protected]> (http://jillix.com)
3+
Copyright (c) 2014-21 jillix <[email protected]> (http://jillix.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+24-54
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,58 @@
1-
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
21

32

4-
# url.js
53

6-
[![Version](https://img.shields.io/npm/v/urljs.svg)](https://www.npmjs.com/package/urljs) [![Downloads](https://img.shields.io/npm/dt/urljs.svg)](https://www.npmjs.com/package/urljs)
74

8-
> A lightweight JavaScript library to manipulate the page url.
95

10-
## Demo
116

127

13-
Browse the demos on http://jillix.github.io/url.js/
148

159

16-
[![](http://i.imgur.com/BYxaxU1.png)](http://jillix.github.io/url.js/)
1710

18-
## CDN
1911

2012

21-
The library is available on [CDNJS](https://cdnjs.com/libraries/urljs) as well. To use it, just do:
2213

23-
```html
24-
<script src="https://cdnjs.cloudflare.com/ajax/libs/urljs/1.2.0/url.min.js"></script>
25-
```
26-
27-
## Usage
2814

29-
```html
30-
<script src="path/to/url.js"></script>
31-
<!-- or use the cdn
32-
<script src="https://cdnjs.cloudflare.com/ajax/libs/urljs/1.2.0/url.min.js"></script>
33-
-->
34-
<script>
35-
Url.updateSearchParam("answer", 42);
36-
</script>
37-
```
3815

39-
## CommonJS-compatible
4016

4117

42-
The library is CommonJS-compatible. You can `require("url.js")` in your files.
18+
# urljs
4319

20+
A lightweight JavaScript library to manipulate the page url.
4421

45-
## :cloud: Installation
4622

4723

48-
Check out the [`src`](/src) directory to download the needed files and include them on your page.
4924

50-
If you're using this module in a CommonJS environment, you can install it using `npm` or `yarn` and `require` it:
25+
## Installation
5126

5227
```sh
53-
# Using npm
54-
npm install --save urljs
55-
56-
# Using yarn
57-
yarn add urljs
28+
$ npm i urljs
5829
```
5930

6031

6132

6233

6334

64-
## :question: Get Help
6535

66-
There are few ways to get help:
6736

68-
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
69-
2. For bug reports and feature requests, open issues. :bug:
7037

7138

7239

7340

74-
## :memo: Documentation
41+
42+
43+
44+
45+
46+
## Documentation
47+
48+
49+
7550

7651

7752
### `queryString(name, notDecoded)`
7853
Finds the value of parameter passed in first argument.
7954

8055
#### Params
81-
8256
- **String** `name`: The parameter name.
8357
- **Boolean** `notDecoded`: If `true`, the result will be encoded.
8458

@@ -92,7 +66,6 @@ the parameter is there, but it doesn't have a value, the value will
9266
be `true`.
9367

9468
#### Params
95-
9669
- **String** `search`: An optional string that should be parsed (default: `window.location.search`).
9770

9871
#### Return
@@ -102,7 +75,6 @@ be `true`.
10275
Stringifies a query object.
10376

10477
#### Params
105-
10678
- **Object** `queryObj`: The object that should be stringified.
10779

10880
#### Return
@@ -112,7 +84,6 @@ Stringifies a query object.
11284
Adds, updates or deletes a parameter (without page refresh).
11385

11486
#### Params
115-
11687
- **String|Object** `param`: The parameter name or name-value pairs as object.
11788
- **String** `value`: The parameter value. If `undefined`, the parameter will be removed.
11889
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
@@ -122,17 +93,19 @@ will not bring you to the old location.
12293
#### Return
12394
- **Url** The `Url` object.
12495

125-
### `getLocation()`
96+
### `getLocation(excludeHash)`
12697
Returns the page url, but not including the domain name.
12798

99+
#### Params
100+
- **Boolean** `excludeHash`: If `true`, the location hash will not be appended in the result.
101+
128102
#### Return
129103
- **String** The page url (without domain).
130104

131105
### `hash(newHash, triggerPopState)`
132106
Sets/gets the hash value.
133107

134108
#### Params
135-
136109
- **String** `newHash`: The hash to set.
137110
- **Boolean** `triggerPopState`: Triggers the popstate handlers (by default falsly).
138111

@@ -143,7 +116,6 @@ Sets/gets the hash value.
143116
Update the full url (pathname, search, hash).
144117

145118
#### Params
146-
147119
- **String** `s`: The new url to set.
148120
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
149121
will not bring you to the old location.
@@ -157,7 +129,6 @@ pathname
157129
Sets/gets the pathname.
158130

159131
#### Params
160-
161132
- **String** `pathname`: The pathname to set.
162133
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
163134
will not bring you to the old location.
@@ -173,14 +144,12 @@ Calls the popstate handlers.
173144
Adds a popstate handler.
174145

175146
#### Params
176-
177147
- **Function** `cb`: The callback function.
178148

179149
### `removeHash(push, trigger)`
180150
Removes the hash from the url.
181151

182152
#### Params
183-
184153
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
185154
will not bring you to the old location.
186155
- **Boolean** `trigger`: Triggers the popstate handlers (by default falsly).
@@ -189,23 +158,24 @@ will not bring you to the old location.
189158
Removes the querystring parameters from the url.
190159

191160
#### Params
192-
193161
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
194162
will not bring you to the old location.
195163
- **Boolean** `trigger`: Triggers the popstate handlers (by default falsly).
196164

197165

198166

199-
## :yum: How to contribute
167+
168+
169+
170+
## How to contribute
200171
Have an idea? Found a bug? See [how to contribute][contributing].
201172

202173

203174

204-
## :scroll: License
175+
## License
176+
See the [LICENSE][license] file.
205177

206-
[MIT][license] © [jillix][website]
207178

208-
[license]: http://showalicense.com/?fullname=jillix%20%3Ccontact%40jillix.com%3E%20(http%3A%2F%2Fjillix.com)&year=2014#license-mit
209-
[website]: http://jillix.com
179+
[license]: /LICENSE
210180
[contributing]: /CONTRIBUTING.md
211181
[docs]: /DOCUMENTATION.md

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@
8989
}
9090
]
9191
}
92-
}
92+
}

0 commit comments

Comments
 (0)