forked from hayageek/jQuery-URL-shortener
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
69 lines (56 loc) · 2.12 KB
/
Copy pathexample.html
File metadata and controls
69 lines (56 loc) · 2.12 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.js" type="text/javascript"></script>
<script src="jquery.urlshortener.js" type="text/javascript"></script>
<style>
.info
{
display:inline;
}
</style>
<title>JQuery URL Shortener Demo</title>
</head>
<body>
<h1>jQuery URL Shortener Demo</h1>
Long URL : <input type='text' id='longUrl' value='http://hayageek.com/google-url-shortener-api/' /> <input type="button" id="shortIt" value="Short It" /> <div class="info" id="shortUrlInfo"></div> <br/><br/>
Short URL : <input type='text' id='shortUrl' value='http://goo.gl/eDcZI' /> <input type="button" id="longIt" value="Get Long URL" /> <div class="info" id="longUrlInfo"></div>
<br/> </br>
Short URL Info: <input type='text' id='shortUrl1' value='http://goo.gl/eDcZI' />
<select id="projection">
<option name="FULL">Full</option>
<option name="ANALYTICS_CLICKS">ANALYTICS_CLICKS</option>
<option name="ANALYTICS_TOP_STRINGS">ANALYTICS_TOP_STRINGS</option>
</select>
<input type="button" id="getUrlInfo" value="Get URL Info" /> <br/><br/>
<div id="fullUrlInfo"></div>
<script type="text/javascript">
$(document).ready(function()
{
//jQuery.urlShortener.settings.apiKey='AIzaSyDoE0akrBvl1f3IIRLpuXpVBDsxTfa4ceg';
$("#shortIt").click(function()
{
$("#shortUrlInfo").html("<img src='images/loading.gif'/>");
var longUrlLink =$("#longUrl").val();
shortUrl = jQuery.urlShortener({longUrl:longUrlLink});
$("#shortUrlInfo").html(shortUrl);
});
$("#longIt").click(function()
{
$("#longUrlInfo").html("<img src='images/loading.gif'/>");
var shortUrlLink =$("#shortUrl").val();
longUrl = jQuery.urlShortener({shortUrl:shortUrlLink});
$("#longUrlInfo").html(longUrl);
});
$("#getUrlInfo").click(function()
{
$("#fullUrlInfo").html("<img src='images/loading.gif'/>");
var shortUrlLink =$("#shortUrl1").val();
var projectionType =$("#projection :selected").val();
urlInfo = jQuery.urlShortener({shortUrl:shortUrlLink,projection:projectionType});
$("#fullUrlInfo").html(JSON.stringify(urlInfo));
});
});
</script>
</body>
</html>