forked from medialize/URI.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
104 lines (88 loc) · 5.04 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>URI.js</title>
<meta name="description" content="Mutation facility for URLs." />
<script src="jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="prettify/prettify.js" type="text/javascript"></script>
<script src="screen.js" type="text/javascript"></script>
<link href="screen.css" rel="stylesheet" type="text/css" />
<link href="prettify/prettify.sunburst.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8922143-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<a id="github-forkme" href="https://github.com/medialize/URI.js"><img src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
<div id="github-watch"><a href="https://github.com/medialize/URI.js" class="gitwatch">URI.js Github Repository</a></div>
<div id="container">
<h1><a href="https://github.com/medialize/URI.js">URI.js</a></h1>
<ul class="menu">
<li class="active"><a href="index.html">About</a></li>
<li><a href="docs.html">Documentation</a></li>
<li><a href="http://rodneyrehm.de/en/">Author</a></li>
</ul>
<p>URI.js is a facility for working with URLs. It offers a "jQuery-style" API to read and write all regular components and a number of convenience methods like
.<a href="docs.html#accessors-directory">directory</a>() and .<a href="docs.html#accessors-authority">authority</a>().</p>
<p>URI.js offers simple, yet powerful ways of working with query string, has a number of URI-normalization functions and converts relative/absolute paths.</p>
<h2>Examples</h2>
<p>How do you like manipulating URLs the "jQuery-style"?</p>
<pre class="prettyprint lang-js">// mutating URLs
URI("http://example.org/foo.html?hello=world")
.<a href="docs.html#accessors-username">username</a>("rodneyrehm")
// -> http://[email protected]/foo.html?hello=world
.<a href="docs.html#accessors-username">username</a>("")
// -> http://example.org/foo.html?hello=world
.<a href="docs.html#accessors-directory">directory</a>("bar")
// -> http://example.org/bar/foo.html?hello=world
.<a href="docs.html#accessors-suffix">suffix</a>("xml")
// -> http://example.org/bar/foo.xml?hello=world
.<a href="docs.html#accessors-search">search</a>("")
// -> http://example.org/bar/foo.xml
.<a href="docs.html#accessors-tld">tld</a>("com")
// -> http://example.com/bar/foo.xml
.<a href="docs.html#accessors-search">search</a>({ foo: "bar", hello: ["world", "mars"] });
// -> http://example.com/bar/foo.xml?foo=bar&hello=world&hello=mars</pre>
<p>How do you like working query strings?</p>
<pre class="prettyprint lang-js">URI("?hello=world")
.<a href="docs.html#search-add">addSearch</a>("hello", "mars")
// -> ?hello=world&hello=mars
.<a href="docs.html#search-add">addSearch</a>({ foo: ["bar", "baz"] })
// -> ?hello=world&hello=mars&foo=bar&foo=baz
.<a href="docs.html#search-remove">removeSearch</a>("hello", "mars")
// -> ?hello=world&foo=bar&foo=baz
.<a href="docs.html#search-remove">removeSearch</a>("foo")
// -> ?hello=world
</pre>
<p>How do you like relative paths?</p>
<pre class="prettyprint lang-js">URI("/relative/path")
.<a href="docs.html#relativeto">relativeTo</a>("/relative/sub/foo/sub/file")
// -> ../../../path
.<a href="docs.html#absolute">absoluteTo</a>("/relative/sub/foo/sub/file");
// -> /relative/path </pre>
<p>How do you like cleaning things up?</p>
<pre class="prettyprint lang-js">URI("?&foo=bar&&foo=bar&foo=baz&")
.<a href="docs.html#normalize-search">normalizeSearch</a>();
// -> ?foo=bar&foo=baz
URI("/hello/foo/woo/.././../world.html")
.<a href="docs.html#normalize-path">normalizePathname</a>();
// -> /hello/world.html </pre>
<h2 id="authors">Authors</h2>
<ul>
<li><a href="http://rodneyrehm.de/en/">Rodney Rehm</a></li>
</ul>
<h2 id="license">License</h2>
<p>URI.js is published under the <a href="http://www.opensource.org/licenses/mit-license">MIT license</a> and <a href="http://opensource.org/licenses/GPL-3.0">GPL v3</a>.</p>
</div>
<script type="text/javascript" src="https://raw.github.com/addyosmani/github-watchers-button/master/github-watchers.min.js"></script>
</body>
</html>