-
Notifications
You must be signed in to change notification settings - Fork 0
/
commonLinks.php
198 lines (153 loc) · 3.14 KB
/
commonLinks.php
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?
require_once("autoInclude.php");
require_once("sessionStart.php");
?>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script>
///////////
// Support functions for handler
///////////
function CommonLink()
{
this._id = null;
this.url = null;
this.x = null;
this.y = null;
this.remove = function()
{
$.getJSON(
"link.php?action=remove&_id="+this._id,
function(data) {
// It should return true
// alert("Remove return("+data+")");
}
);
}
this.close = function()
{
}
}
</script>
<script>
///////////////
//public var
///////////////
var keyword;
<?
print "keyword='".$_GET["keyword"]."';";
?>
function getQueryParam(url, key)
{
var uParts = url.split("?");
if (uParts.length <= 1)
{
return null;
}
gy = uParts[1].split("&");
for (i=0;i<gy.length;i++)
{
ft = gy[i].split("=");
if (ft[0] == key)
{
return ft[1];
}
}
}
function showDebug(msg)
{
var debugText = document.getElementById("debugText");
debugText.innerHTML = msg;
}
function linkEnter(x, y)
{
//showDebug(document.location+x+y);
}
function linkDragging(x, y)
{
//showDebug(x +","+y);
}
function linkExit()
{
//showDebug("Exit");
}
function linkDropped(x, y, url)
{
var insideUrl = getQueryParam(url, "url");
if (insideUrl != null)
{
url = unescape(insideUrl);
}
var newLink = new Link();
newLink._id = "";
newLink.url = url;
newLink.x = x;
newLink.y = y;
showLink(newLink);
$.getJSON(
"link.php?action=add&keyword="+keyword+"&x="+x+"&y="+y+"&url="+url,
function(data) {
// it will return id of newly added link _id
newLink._id = data;
}
);
}
function addCommonLink(newCommonLink)
{
var url = newCommonLink.url;
}
function showLinkExtra(x, y, url, _id)
{
var newLink = new Link();
newLink._id = _id;
newLink.url = url;
newLink.x = x;
newLink.y = y;
//alert(newLink.toSource());
showLink(newLink);
}
</script>
<script>
$(document).ready(function(){
<?
/*
$links = Link::getAll($sessionId);
foreach ($links as $link)
{
//print "<a class='bookmarkLink' href='".$link["url"]."' >".$link["url"]."</a><br>";
print "showLinkExtra(".$link["x"].",".$link["y"].",'".$link["url"]."', '".$link["_id"]."');";
}
*/
?>
});
</script>
<link href="global.css" media="screen" rel="stylesheet" type="text/css" />
<style>
*{margin:0px;padding:0px;}
body{text-align:center;}
#commonLinks{}
div.commonLink{display:inline;}
a.commonLinkLink{}
img.commonLinkIcon{width:16px; height:16px; border:0px;display:inline;}
span.commonLinkIconText{font-size:80%;color:#898989;background-color:red;}
</style>
</head>
<body>
<div id="debugText">
<!--
No debug text
-->
</div>
<div id="commonLinks">
<!--
<div class="commonLink">
<a target="searchFrame" class="commonLinkLink" href="http://www.google.com/"><table><tr><td><img src="http://www.google.com/favicon.ico" alt="Google" /><td><span class="commonLinkIconText">Google</span></table></a>
</div>
-->
<div class="commonLink">
<a target="searchFrame" class="commonLinkLink" href="http://www.google.com/"><img src="http://www.google.com/favicon.ico" alt="Google" /></a>
</div>
</div>
</body>
</html>