forked from hayageek/jQuery-URL-shortener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
87 lines (76 loc) · 2.63 KB
/
example.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.js" type="text/javascript"></script>
<script src="jquery.urlshortener.new.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">
jQuery.urlShortener.settings.apiKey = '';
$("#shortIt").click(function () {
$("#shortUrlInfo").html("<img src='images/loading.gif'/>");
var longUrlLink = $("#longUrl").val();
jQuery.urlShortener({
longUrl: longUrlLink,
success: function (shortUrl) {
$("#shortUrlInfo").html(shortUrl);
},
error: function(err)
{
$("#shortUrlInfo").html(JSON.stringify(err));
}
});
});
$("#longIt").click(function () {
$("#longUrlInfo").html("<img src='images/loading.gif'/>");
var shortUrlLink = $("#shortUrl").val();
jQuery.urlShortener({
shortUrl: shortUrlLink,
success: function (longUrl) {
$("#longUrlInfo").html(longUrl);
},
error: function(err)
{
$("#longUrlInfo").html(JSON.stringify(err));
}
});
});
$("#getUrlInfo").click(function () {
$("#fullUrlInfo").html("<img src='images/loading.gif'/>");
var shortUrlLink = $("#shortUrl1").val();
var projectionType = $("#projection :selected").val();
jQuery.urlShortener({
shortUrl: shortUrlLink,
projection: projectionType,
success: function (urlInfo) {
$("#fullUrlInfo").html(JSON.stringify(urlInfo));
},
error: function(err)
{
$("#fullUrlInfo").html(JSON.stringify(err));
}
});
});
</script>
</body>
</html>