-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathjQuery.mobile.path.isSameDomain.xml
75 lines (74 loc) · 2.24 KB
/
jQuery.mobile.path.isSameDomain.xml
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
<?xml version="1.0"?>
<entry type="method" name="jQuery.mobile.path.isSameDomain" return="Boolean">
<title>jQuery.mobile.path.isSameDomain()</title>
<desc>Utility method for determining if a URL has the same domain.</desc>
<signature>
<argument name="absUrl1">
<type name="String">
<desc>An absolute URL.</desc>
</type>
</argument>
<argument name="absUrl2">
<type name="String">
<desc>Another absolute URL.</desc>
</type>
</argument>
</signature>
<example>
<desc>Various uses of jQuery.mobile.path.isSameDomain</desc>
<height>350px</height>
<css><![CDATA[
.versus {
display: inline-block;
}
.compare {
margin-bottom: 2.3em;
}
#myResult{
border: 1px solid;
border-color: #108040;
padding: 10px;
}
]]></css>
<html><![CDATA[
<div role="main" class="ui-content ui-mini">
<div>
<a href="javascript:void(0)" class="ui-button ui-corner-all ui-button-inline ui-shadow compare">Same Domain?</a>
<div class="versus">
<pre><code>http://example.com/</code></pre>
<pre><code>http://slashdot.org/</code></pre>
</div>
</div>
<div>
<a href="javascript:void(0)" class="ui-button ui-corner-all ui-button-inline ui-shadow compare">Same Domain?</a>
<div class="versus">
<pre><code>http://edition.cnn.com/</code></pre>
<pre><code>http://cnn.com/</code></pre>
</div>
</div>
<div>
<a href="javascript:void(0)" class="ui-button ui-corner-all ui-button-inline ui-shadow compare">Same Domain?</a>
<div class="versus">
<pre><code>http://www.amazon.co.uk/</code></pre>
<pre><code>http://www.amazon.co.uk/</code></pre>
</div>
</div>
<div id="myResult"></div>
</div>
]]></html>
<code><![CDATA[
$(document).ready(function() {
$( ".compare" ).on( "click", function() {
var urlContainers = $( this ).siblings( ".versus" ).find( "code" ),
url1 = urlContainers.first().text(),
url2 = urlContainers.last().text();
$( "#myResult" ).text( String( $.mobile.path.isSameDomain( url1, url2 ) ) );
})
});
]]></code>
</example>
<longdesc>
<p>Utility method for determining if two different URLs share the same domain. This function returns a boolean <code>true</code> if the domain is the same, <code>false</code> if not.</p>
</longdesc>
<category slug="methods/path"/>
</entry>