3919 |
28 Oct 10 |
gregory |
function empty() |
3919 |
28 Oct 10 |
gregory |
2 |
{ |
3919 |
28 Oct 10 |
gregory |
return true; |
3919 |
28 Oct 10 |
gregory |
4 |
} |
3919 |
28 Oct 10 |
gregory |
5 |
|
805 |
30 Oct 06 |
gregory |
function goToLocation(location) |
805 |
30 Oct 06 |
gregory |
7 |
{ |
3920 |
28 Oct 10 |
gregory |
window.location = location; |
805 |
30 Oct 06 |
gregory |
9 |
} |
2495 |
10 Jan 08 |
gregory |
10 |
|
3919 |
28 Oct 10 |
gregory |
function getScrollXY() |
3919 |
28 Oct 10 |
gregory |
12 |
{ |
3919 |
28 Oct 10 |
gregory |
var scrOfX = 0, scrOfY = 0; |
3919 |
28 Oct 10 |
gregory |
if( typeof( window.pageYOffset ) == 'number' ) |
3919 |
28 Oct 10 |
gregory |
15 |
{ |
3919 |
28 Oct 10 |
gregory |
//Netscape compliant |
3919 |
28 Oct 10 |
gregory |
scrOfY = window.pageYOffset; |
3919 |
28 Oct 10 |
gregory |
scrOfX = window.pageXOffset; |
3919 |
28 Oct 10 |
gregory |
19 |
} |
3919 |
28 Oct 10 |
gregory |
else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) |
3919 |
28 Oct 10 |
gregory |
21 |
{ |
3919 |
28 Oct 10 |
gregory |
//DOM compliant |
3919 |
28 Oct 10 |
gregory |
scrOfY = document.body.scrollTop; |
3919 |
28 Oct 10 |
gregory |
scrOfX = document.body.scrollLeft; |
3919 |
28 Oct 10 |
gregory |
25 |
} |
3919 |
28 Oct 10 |
gregory |
else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) |
3919 |
28 Oct 10 |
gregory |
27 |
{ |
3919 |
28 Oct 10 |
gregory |
//IE6 standards compliant mode |
3919 |
28 Oct 10 |
gregory |
scrOfY = document.documentElement.scrollTop; |
3919 |
28 Oct 10 |
gregory |
scrOfX = document.documentElement.scrollLeft; |
3919 |
28 Oct 10 |
gregory |
31 |
} |
3919 |
28 Oct 10 |
gregory |
return [ scrOfX, scrOfY ]; |
1950 |
14 Sep 07 |
gregory |
33 |
} |
3409 |
14 Sep 09 |
gregory |
34 |
|
3919 |
28 Oct 10 |
gregory |
function getXYSize() |
3919 |
28 Oct 10 |
gregory |
36 |
{ |
3919 |
28 Oct 10 |
gregory |
var myWidth = 0, myHeight = 0; |
3919 |
28 Oct 10 |
gregory |
if( typeof( window.innerWidth ) == 'number' ) { |
3919 |
28 Oct 10 |
gregory |
// Non-IE |
3919 |
28 Oct 10 |
gregory |
myWidth = window.innerWidth; |
3919 |
28 Oct 10 |
gregory |
myHeight = window.innerHeight; |
3919 |
28 Oct 10 |
gregory |
42 |
} |
3919 |
28 Oct 10 |
gregory |
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) |
3919 |
28 Oct 10 |
gregory |
44 |
{ |
3919 |
28 Oct 10 |
gregory |
// IE 6+ in 'standards compliant mode' |
3919 |
28 Oct 10 |
gregory |
myWidth = document.documentElement.clientWidth; |
3919 |
28 Oct 10 |
gregory |
myHeight = document.documentElement.clientHeight; |
3919 |
28 Oct 10 |
gregory |
48 |
} |
3919 |
28 Oct 10 |
gregory |
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) |
3919 |
28 Oct 10 |
gregory |
50 |
{ |
3919 |
28 Oct 10 |
gregory |
// IE 4 compatible |
3919 |
28 Oct 10 |
gregory |
myWidth = document.body.clientWidth; |
3919 |
28 Oct 10 |
gregory |
myHeight = document.body.clientHeight; |
3919 |
28 Oct 10 |
gregory |
54 |
} |
3919 |
28 Oct 10 |
gregory |
return [ myWidth, myHeight ]; |
1950 |
14 Sep 07 |
gregory |
56 |
} |
3409 |
14 Sep 09 |
gregory |
57 |
|
3919 |
28 Oct 10 |
gregory |
// Returns node by the given id, or null if it does not exist |
678 |
04 Oct 06 |
gregory |
function getElement(id) |
678 |
04 Oct 06 |
gregory |
60 |
{ |
4436 |
08 Mar 13 |
olle |
if (id != null && id != '') |
4436 |
08 Mar 13 |
olle |
62 |
{ |
4436 |
08 Mar 13 |
olle |
return document.all ? document.all[id] : document.getElementById(id); |
4436 |
08 Mar 13 |
olle |
64 |
} |
4436 |
08 Mar 13 |
olle |
else |
4436 |
08 Mar 13 |
olle |
66 |
{ |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
68 |
} |
678 |
04 Oct 06 |
gregory |
69 |
} |
678 |
04 Oct 06 |
gregory |
70 |
|
881 |
11 Nov 06 |
gregory |
function submitForm(formId) |
881 |
11 Nov 06 |
gregory |
72 |
{ |
3919 |
28 Oct 10 |
gregory |
getElement(formId).submit(); |
881 |
11 Nov 06 |
gregory |
74 |
} |
881 |
11 Nov 06 |
gregory |
75 |
|
695 |
04 Oct 06 |
gregory |
function addHiliteEvents(item) |
695 |
04 Oct 06 |
gregory |
77 |
{ |
3919 |
28 Oct 10 |
gregory |
item.onmouseover = function() |
3919 |
28 Oct 10 |
gregory |
79 |
{ |
3919 |
28 Oct 10 |
gregory |
this.className = "hover " + this.className; |
3919 |
28 Oct 10 |
gregory |
81 |
}; |
3919 |
28 Oct 10 |
gregory |
item.onmouseout = function() |
3919 |
28 Oct 10 |
gregory |
83 |
{ |
3919 |
28 Oct 10 |
gregory |
this.className = this.className.slice(6); |
3919 |
28 Oct 10 |
gregory |
85 |
}; |
695 |
04 Oct 06 |
gregory |
86 |
} |
695 |
04 Oct 06 |
gregory |
87 |
|
881 |
11 Nov 06 |
gregory |
function submitFormAs(formId, action) |
881 |
11 Nov 06 |
gregory |
89 |
{ |
3920 |
28 Oct 10 |
gregory |
getElement(formId + "action").value = action; |
3920 |
28 Oct 10 |
gregory |
getElement(formId).submit(); |
881 |
11 Nov 06 |
gregory |
92 |
} |
881 |
11 Nov 06 |
gregory |
93 |
|
3919 |
28 Oct 10 |
gregory |
// Toggles visibility of a div |
678 |
04 Oct 06 |
gregory |
function toggle(id) |
678 |
04 Oct 06 |
gregory |
96 |
{ |
3919 |
28 Oct 10 |
gregory |
var div = getElement(id); |
3919 |
28 Oct 10 |
gregory |
if(div.style.display == "block") |
3919 |
28 Oct 10 |
gregory |
99 |
{ |
3919 |
28 Oct 10 |
gregory |
div.style.display = "none"; |
3919 |
28 Oct 10 |
gregory |
101 |
} |
3919 |
28 Oct 10 |
gregory |
else |
3919 |
28 Oct 10 |
gregory |
103 |
{ |
3919 |
28 Oct 10 |
gregory |
div.style.display = "block"; |
3919 |
28 Oct 10 |
gregory |
105 |
} |
678 |
04 Oct 06 |
gregory |
106 |
} |
678 |
04 Oct 06 |
gregory |
107 |
|
3919 |
28 Oct 10 |
gregory |
// Toggles visibility of a fieldset |
3894 |
20 Oct 10 |
gregory |
function toggleFieldset(id) |
3894 |
20 Oct 10 |
gregory |
110 |
{ |
3919 |
28 Oct 10 |
gregory |
var node = getElement(id); |
3919 |
28 Oct 10 |
gregory |
var icon = getElement("btn" + id); |
3919 |
28 Oct 10 |
gregory |
if(node.style.display == "block") |
3919 |
28 Oct 10 |
gregory |
114 |
{ |
3919 |
28 Oct 10 |
gregory |
node.style.display = "none"; |
3919 |
28 Oct 10 |
gregory |
icon.src = "static/img/plus.gif"; |
3919 |
28 Oct 10 |
gregory |
117 |
} |
3919 |
28 Oct 10 |
gregory |
else |
3919 |
28 Oct 10 |
gregory |
119 |
{ |
3919 |
28 Oct 10 |
gregory |
node.style.display = "block"; |
3919 |
28 Oct 10 |
gregory |
icon.src = "static/img/minus.gif"; |
3919 |
28 Oct 10 |
gregory |
122 |
} |
3894 |
20 Oct 10 |
gregory |
123 |
} |
3894 |
20 Oct 10 |
gregory |
124 |
|
2503 |
14 Jan 08 |
gregory |
var visiblePopup = 0; |
3919 |
28 Oct 10 |
gregory |
// popup, toggles the visibility and positions a div so it's visible |
1950 |
14 Sep 07 |
gregory |
function popup(id) |
1950 |
14 Sep 07 |
gregory |
128 |
{ |
3919 |
28 Oct 10 |
gregory |
var div = getElement(id); |
3919 |
28 Oct 10 |
gregory |
var xy = getScrollXY(); |
3919 |
28 Oct 10 |
gregory |
var newTop = (xy[1]+50) + "px"; |
3919 |
28 Oct 10 |
gregory |
div.style.top = newTop; |
3919 |
28 Oct 10 |
gregory |
toggle(id); |
3919 |
28 Oct 10 |
gregory |
visiblePopup=id; |
1950 |
14 Sep 07 |
gregory |
135 |
} |
1950 |
14 Sep 07 |
gregory |
136 |
|
3919 |
28 Oct 10 |
gregory |
// TODO there might be a situation where more popups have been shown, this method should close them all |
2503 |
14 Jan 08 |
gregory |
function closeAllVisiblePopups() |
2503 |
14 Jan 08 |
gregory |
139 |
{ |
3919 |
28 Oct 10 |
gregory |
hide(visiblePopup); |
2503 |
14 Jan 08 |
gregory |
141 |
} |
2503 |
14 Jan 08 |
gregory |
142 |
|
3919 |
28 Oct 10 |
gregory |
// Sets display:none for the given elementId |
678 |
04 Oct 06 |
gregory |
function hide(id) |
678 |
04 Oct 06 |
gregory |
145 |
{ |
3919 |
28 Oct 10 |
gregory |
var div = getElement(id); |
3919 |
28 Oct 10 |
gregory |
div.style.display = "none"; |
678 |
04 Oct 06 |
gregory |
148 |
} |
678 |
04 Oct 06 |
gregory |
149 |
|
3919 |
28 Oct 10 |
gregory |
// Sets display:block for the given elementId |
678 |
04 Oct 06 |
gregory |
function show(id) |
678 |
04 Oct 06 |
gregory |
152 |
{ |
3919 |
28 Oct 10 |
gregory |
var div = getElement(id); |
3919 |
28 Oct 10 |
gregory |
div.style.display = "block"; |
678 |
04 Oct 06 |
gregory |
155 |
} |
678 |
04 Oct 06 |
gregory |
156 |
|
1101 |
15 Jan 07 |
gregory |
var LASTTABID = 0; |
1101 |
15 Jan 07 |
gregory |
function showTab(id) |
1101 |
15 Jan 07 |
gregory |
159 |
{ |
3919 |
28 Oct 10 |
gregory |
var prefix = "contentOf"; |
3919 |
28 Oct 10 |
gregory |
if(LASTTABID != 0) |
3919 |
28 Oct 10 |
gregory |
162 |
{ |
3919 |
28 Oct 10 |
gregory |
var last = getElement(LASTTABID); |
3919 |
28 Oct 10 |
gregory |
last.className = "tab"; |
3919 |
28 Oct 10 |
gregory |
hide(prefix + LASTTABID); |
3919 |
28 Oct 10 |
gregory |
166 |
} |
3919 |
28 Oct 10 |
gregory |
show(prefix + id); |
3919 |
28 Oct 10 |
gregory |
var tab = getElement(id); |
3919 |
28 Oct 10 |
gregory |
tab.className = "hover tab here"; |
3919 |
28 Oct 10 |
gregory |
LASTTABID = id; |
1101 |
15 Jan 07 |
gregory |
171 |
} |
678 |
04 Oct 06 |
gregory |
172 |
|
3919 |
28 Oct 10 |
gregory |
// Initiates a table with correct class and eventhandlers |
3409 |
14 Sep 09 |
gregory |
function initTable(id) |
678 |
04 Oct 06 |
gregory |
175 |
{ |
3919 |
28 Oct 10 |
gregory |
var table = getElement(id); |
3919 |
28 Oct 10 |
gregory |
if(table != null) |
3919 |
28 Oct 10 |
gregory |
178 |
{ |
3919 |
28 Oct 10 |
gregory |
var tableRows = table.rows; |
4436 |
08 Mar 13 |
olle |
if (tableRows != null) |
3919 |
28 Oct 10 |
gregory |
181 |
{ |
4436 |
08 Mar 13 |
olle |
for(var i = 0; i<tableRows.length;i++) |
4436 |
08 Mar 13 |
olle |
183 |
{ |
4436 |
08 Mar 13 |
olle |
var row = tableRows[i]; |
4436 |
08 Mar 13 |
olle |
addHiliteEvents(row); |
4436 |
08 Mar 13 |
olle |
186 |
} |
3919 |
28 Oct 10 |
gregory |
187 |
} |
3919 |
28 Oct 10 |
gregory |
188 |
} |
678 |
04 Oct 06 |
gregory |
189 |
} |
678 |
04 Oct 06 |
gregory |
190 |
|
3919 |
28 Oct 10 |
gregory |
// Binds hover events to all LI elements |
2733 |
01 Jul 08 |
gregory |
function initUl(id) { |
3919 |
28 Oct 10 |
gregory |
var ul = getElement(id); |
3919 |
28 Oct 10 |
gregory |
var elements = ul.getElementsByTagName("LI"); |
3919 |
28 Oct 10 |
gregory |
for(var i = 0; i< elements.length-1;i++) |
3919 |
28 Oct 10 |
gregory |
196 |
{ |
3919 |
28 Oct 10 |
gregory |
if(elements[i].nodeName == "LI") |
3919 |
28 Oct 10 |
gregory |
198 |
{ |
3919 |
28 Oct 10 |
gregory |
var li = elements[i]; |
3919 |
28 Oct 10 |
gregory |
addHiliteEvents(li); |
3919 |
28 Oct 10 |
gregory |
201 |
} |
3919 |
28 Oct 10 |
gregory |
202 |
} |
819 |
31 Oct 06 |
gregory |
203 |
} |
819 |
31 Oct 06 |
gregory |
204 |
|
881 |
11 Nov 06 |
gregory |
function setNameField(select) |
881 |
11 Nov 06 |
gregory |
206 |
{ |
3919 |
28 Oct 10 |
gregory |
var form = select.form; |
3919 |
28 Oct 10 |
gregory |
var option = select.options[select.selectedIndex]; |
3919 |
28 Oct 10 |
gregory |
var value = option.text; |
3919 |
28 Oct 10 |
gregory |
var elements = form.getElementsByTagName("input"); |
3919 |
28 Oct 10 |
gregory |
for(var i = 0; i < elements.length;i++) |
3919 |
28 Oct 10 |
gregory |
212 |
{ |
3919 |
28 Oct 10 |
gregory |
var input = elements[i]; |
3919 |
28 Oct 10 |
gregory |
if(input.id == "annotationName") |
3919 |
28 Oct 10 |
gregory |
215 |
{ |
3919 |
28 Oct 10 |
gregory |
if(option.value == "0") |
3919 |
28 Oct 10 |
gregory |
217 |
{ |
3919 |
28 Oct 10 |
gregory |
input.value = ""; |
3919 |
28 Oct 10 |
gregory |
input.disabled = !(input.disabled); |
3919 |
28 Oct 10 |
gregory |
220 |
} |
3919 |
28 Oct 10 |
gregory |
else |
3919 |
28 Oct 10 |
gregory |
222 |
{ |
3919 |
28 Oct 10 |
gregory |
input.value = option.text; |
3919 |
28 Oct 10 |
gregory |
input.disabled = "disabled"; |
3919 |
28 Oct 10 |
gregory |
225 |
} |
3919 |
28 Oct 10 |
gregory |
226 |
} |
3919 |
28 Oct 10 |
gregory |
227 |
} |
881 |
11 Nov 06 |
gregory |
228 |
} |
819 |
31 Oct 06 |
gregory |
229 |
|
1664 |
23 May 07 |
gregory |
function checkAllRowsInTable(formId) |
1664 |
23 May 07 |
gregory |
231 |
{ |
3919 |
28 Oct 10 |
gregory |
var form = getElement(formId); |
3919 |
28 Oct 10 |
gregory |
var elements = form.getElementsByTagName("input"); |
3919 |
28 Oct 10 |
gregory |
for(var i = 0; i < elements.length;i++) |
3919 |
28 Oct 10 |
gregory |
235 |
{ |
3919 |
28 Oct 10 |
gregory |
var input = elements[i]; |
3919 |
28 Oct 10 |
gregory |
if(input.id == "itemId") |
3919 |
28 Oct 10 |
gregory |
238 |
{ |
3919 |
28 Oct 10 |
gregory |
input.checked = !input.checked; |
3919 |
28 Oct 10 |
gregory |
240 |
} |
3919 |
28 Oct 10 |
gregory |
241 |
} |
1664 |
23 May 07 |
gregory |
242 |
} |
1664 |
23 May 07 |
gregory |
243 |
|
1791 |
21 Jun 07 |
gregory |
244 |
/* |
3921 |
28 Oct 10 |
gregory |
Add a field to a form. If it already exists, the value is changed. |
1791 |
21 Jun 07 |
gregory |
246 |
*/ |
1791 |
21 Jun 07 |
gregory |
function addField(formId, name, value) |
1791 |
21 Jun 07 |
gregory |
248 |
{ |
3919 |
28 Oct 10 |
gregory |
var field = null; |
3919 |
28 Oct 10 |
gregory |
var form = getElement(formId); |
3919 |
28 Oct 10 |
gregory |
for(var i = 0; i < form.elements.length; i++) |
3453 |
19 Oct 09 |
gregory |
252 |
{ |
3919 |
28 Oct 10 |
gregory |
var e = form.elements[i]; |
3919 |
28 Oct 10 |
gregory |
if(e.name == name) |
3919 |
28 Oct 10 |
gregory |
255 |
{ |
3919 |
28 Oct 10 |
gregory |
field = e; |
3919 |
28 Oct 10 |
gregory |
break; |
3919 |
28 Oct 10 |
gregory |
258 |
} |
3453 |
19 Oct 09 |
gregory |
259 |
} |
3919 |
28 Oct 10 |
gregory |
if(field == null) |
3919 |
28 Oct 10 |
gregory |
261 |
{ |
3919 |
28 Oct 10 |
gregory |
// Create new element |
3919 |
28 Oct 10 |
gregory |
field = document.createElement("input"); |
3919 |
28 Oct 10 |
gregory |
field.type = "hidden"; |
3919 |
28 Oct 10 |
gregory |
field.name = name; |
3919 |
28 Oct 10 |
gregory |
form.appendChild(field); |
3919 |
28 Oct 10 |
gregory |
267 |
} |
3453 |
19 Oct 09 |
gregory |
field.value = value; |
1791 |
21 Jun 07 |
gregory |
269 |
} |
1791 |
21 Jun 07 |
gregory |
270 |
|
2597 |
05 Mar 08 |
gregory |
function addShadeUnshade(obj) |
2597 |
05 Mar 08 |
gregory |
272 |
{ |
3919 |
28 Oct 10 |
gregory |
obj.shade = function() |
3919 |
28 Oct 10 |
gregory |
274 |
{ |
3919 |
28 Oct 10 |
gregory |
this.className = "shade " + this.className; |
3919 |
28 Oct 10 |
gregory |
276 |
}; |
3409 |
14 Sep 09 |
gregory |
277 |
|
3919 |
28 Oct 10 |
gregory |
obj.unshade = function() |
3919 |
28 Oct 10 |
gregory |
279 |
{ |
3919 |
28 Oct 10 |
gregory |
this.className = this.className.slice(6); |
3919 |
28 Oct 10 |
gregory |
281 |
}; |
2597 |
05 Mar 08 |
gregory |
282 |
} |
2597 |
05 Mar 08 |
gregory |
283 |
|
3919 |
28 Oct 10 |
gregory |
// http://blog.firetree.net/2005/07/04/javascript-find-position/ |
3919 |
28 Oct 10 |
gregory |
function findPosX(obj) |
3919 |
28 Oct 10 |
gregory |
286 |
{ |
2807 |
22 Aug 08 |
gregory |
var curleft = 0; |
2807 |
22 Aug 08 |
gregory |
if(obj.offsetParent) |
3919 |
28 Oct 10 |
gregory |
while(1) |
3919 |
28 Oct 10 |
gregory |
290 |
{ |
3919 |
28 Oct 10 |
gregory |
curleft += obj.offsetLeft; |
3919 |
28 Oct 10 |
gregory |
if(!obj.offsetParent) |
2807 |
22 Aug 08 |
gregory |
293 |
{ |
2807 |
22 Aug 08 |
gregory |
break; |
2807 |
22 Aug 08 |
gregory |
295 |
} |
3919 |
28 Oct 10 |
gregory |
obj = obj.offsetParent; |
3919 |
28 Oct 10 |
gregory |
297 |
} |
2807 |
22 Aug 08 |
gregory |
else if(obj.x) |
3919 |
28 Oct 10 |
gregory |
299 |
{ |
2807 |
22 Aug 08 |
gregory |
curleft += obj.x; |
3919 |
28 Oct 10 |
gregory |
301 |
} |
3919 |
28 Oct 10 |
gregory |
302 |
|
2807 |
22 Aug 08 |
gregory |
return curleft; |
3919 |
28 Oct 10 |
gregory |
304 |
} |
2807 |
22 Aug 08 |
gregory |
305 |
|
3919 |
28 Oct 10 |
gregory |
function findPosY(obj) |
3919 |
28 Oct 10 |
gregory |
307 |
{ |
2807 |
22 Aug 08 |
gregory |
var curtop = 0; |
2807 |
22 Aug 08 |
gregory |
if(obj.offsetParent) |
3919 |
28 Oct 10 |
gregory |
while(1) |
3919 |
28 Oct 10 |
gregory |
311 |
{ |
3919 |
28 Oct 10 |
gregory |
curtop += obj.offsetTop; |
3919 |
28 Oct 10 |
gregory |
if(!obj.offsetParent) |
2807 |
22 Aug 08 |
gregory |
314 |
{ |
2807 |
22 Aug 08 |
gregory |
break; |
2807 |
22 Aug 08 |
gregory |
316 |
} |
3919 |
28 Oct 10 |
gregory |
obj = obj.offsetParent; |
3919 |
28 Oct 10 |
gregory |
318 |
} |
2807 |
22 Aug 08 |
gregory |
else if(obj.y) |
3919 |
28 Oct 10 |
gregory |
320 |
{ |
2807 |
22 Aug 08 |
gregory |
curtop += obj.y; |
3919 |
28 Oct 10 |
gregory |
322 |
} |
3919 |
28 Oct 10 |
gregory |
323 |
|
2807 |
22 Aug 08 |
gregory |
return curtop; |
3919 |
28 Oct 10 |
gregory |
325 |
} |
3409 |
14 Sep 09 |
gregory |
326 |
|
3919 |
28 Oct 10 |
gregory |
// http://bytes.com/forum/thread763579.html |
3919 |
28 Oct 10 |
gregory |
function resize_all_iframes() |
3919 |
28 Oct 10 |
gregory |
329 |
{ |
2807 |
22 Aug 08 |
gregory |
var f_list = document.getElementsByTagName("IFRAME"); |
2807 |
22 Aug 08 |
gregory |
if(f_list.length > 0) |
2807 |
22 Aug 08 |
gregory |
332 |
{ |
3919 |
28 Oct 10 |
gregory |
for (var i = 0, f; f = f_list[i]; i++) |
3919 |
28 Oct 10 |
gregory |
334 |
{ |
3919 |
28 Oct 10 |
gregory |
resize_iframe(f.id); |
3919 |
28 Oct 10 |
gregory |
336 |
} |
2807 |
22 Aug 08 |
gregory |
337 |
} |
3919 |
28 Oct 10 |
gregory |
338 |
} |
3409 |
14 Sep 09 |
gregory |
339 |
|
3919 |
28 Oct 10 |
gregory |
// http://guymal.com/mycode/100_percent_iframe/ |
2807 |
22 Aug 08 |
gregory |
function resize_iframe(frameId) |
2807 |
22 Aug 08 |
gregory |
342 |
{ |
2807 |
22 Aug 08 |
gregory |
343 |
|
3919 |
28 Oct 10 |
gregory |
var height=window.innerWidth;//Firefox |
3919 |
28 Oct 10 |
gregory |
if (document.body.clientHeight) |
3919 |
28 Oct 10 |
gregory |
346 |
{ |
3919 |
28 Oct 10 |
gregory |
height=document.body.clientHeight;//IE |
3919 |
28 Oct 10 |
gregory |
348 |
} |
3919 |
28 Oct 10 |
gregory |
// resize the iframe according to the size of the |
3919 |
28 Oct 10 |
gregory |
// window (all these should be on the same line) |
3919 |
28 Oct 10 |
gregory |
var iframe = getElement(frameId); |
3919 |
28 Oct 10 |
gregory |
var y = findPosY(iframe); |
3919 |
28 Oct 10 |
gregory |
iframe.style.height=parseInt(height-y-8)+"px"; |
2807 |
22 Aug 08 |
gregory |
354 |
} |
2807 |
22 Aug 08 |
gregory |
355 |
|
3919 |
28 Oct 10 |
gregory |
// http://www.dynamicdrive.com/dynamicindex5/texttool.htm |
3441 |
13 Oct 09 |
olle |
function showtip(current,e,text) |
3441 |
13 Oct 09 |
olle |
358 |
{ |
3919 |
28 Oct 10 |
gregory |
if (document.all || document.getElementById) |
3919 |
28 Oct 10 |
gregory |
360 |
{ |
3919 |
28 Oct 10 |
gregory |
thetitle = text.split('<br>'); |
3919 |
28 Oct 10 |
gregory |
if (thetitle.length > 1) |
3919 |
28 Oct 10 |
gregory |
363 |
{ |
3919 |
28 Oct 10 |
gregory |
thetitles = ''; |
3919 |
28 Oct 10 |
gregory |
for (i=0; i < thetitle.length; i++) |
3919 |
28 Oct 10 |
gregory |
366 |
{ |
3919 |
28 Oct 10 |
gregory |
thetitles += thetitle[i]; |
3919 |
28 Oct 10 |
gregory |
368 |
} |
3919 |
28 Oct 10 |
gregory |
current.title = thetitles; |
3919 |
28 Oct 10 |
gregory |
370 |
} |
3919 |
28 Oct 10 |
gregory |
else |
3919 |
28 Oct 10 |
gregory |
372 |
{ |
3919 |
28 Oct 10 |
gregory |
current.title = text; |
3919 |
28 Oct 10 |
gregory |
374 |
} |
3919 |
28 Oct 10 |
gregory |
375 |
} |
3919 |
28 Oct 10 |
gregory |
else if (document.layers) |
3919 |
28 Oct 10 |
gregory |
377 |
{ |
3919 |
28 Oct 10 |
gregory |
document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>'); |
3919 |
28 Oct 10 |
gregory |
document.tooltip.document.close(); |
3919 |
28 Oct 10 |
gregory |
document.tooltip.left = e.pageX + 5; |
3919 |
28 Oct 10 |
gregory |
document.tooltip.top = e.pageY + 5; |
3919 |
28 Oct 10 |
gregory |
document.tooltip.visibility = "show"; |
3919 |
28 Oct 10 |
gregory |
383 |
} |
3441 |
13 Oct 09 |
olle |
384 |
} |
3441 |
13 Oct 09 |
olle |
385 |
|
3441 |
13 Oct 09 |
olle |
function hidetip() |
3441 |
13 Oct 09 |
olle |
387 |
{ |
3919 |
28 Oct 10 |
gregory |
if (document.layers) |
3919 |
28 Oct 10 |
gregory |
389 |
{ |
3919 |
28 Oct 10 |
gregory |
document.tooltip.visibility = "hidden"; |
3919 |
28 Oct 10 |
gregory |
391 |
} |
3441 |
13 Oct 09 |
olle |
392 |
} |
3441 |
13 Oct 09 |
olle |
393 |
|
3919 |
28 Oct 10 |
gregory |
// this will resize all iframes every time you change the size of the window. |
3409 |
14 Sep 09 |
gregory |
window.onresize=resize_all_iframes; |
2807 |
22 Aug 08 |
gregory |
396 |
|
4436 |
08 Mar 13 |
olle |
397 |
/** |
4436 |
08 Mar 13 |
olle |
* Returns a JSON object with element position for upper left corner. |
4436 |
08 Mar 13 |
olle |
* Code from http://www.kirupa.com/html5/get_element_position_using_javascript.htm |
4436 |
08 Mar 13 |
olle |
400 |
* |
4436 |
08 Mar 13 |
olle |
* @param GUIelement element The GUI element to get the position for. |
4436 |
08 Mar 13 |
olle |
* @return JSON object with keys 'x' and 'y' with position values. |
4436 |
08 Mar 13 |
olle |
403 |
*/ |
4436 |
08 Mar 13 |
olle |
function getElementPosition(element) |
4410 |
12 Feb 13 |
olle |
405 |
{ |
4436 |
08 Mar 13 |
olle |
var xPos = 0; |
4436 |
08 Mar 13 |
olle |
var yPos = 0; |
4436 |
08 Mar 13 |
olle |
// Add relative offsets for element parents |
4436 |
08 Mar 13 |
olle |
while (element) |
4436 |
08 Mar 13 |
olle |
410 |
{ |
4436 |
08 Mar 13 |
olle |
xPos += (element.offsetLeft - element.scrollLeft + element.clientLeft); |
4436 |
08 Mar 13 |
olle |
yPos += (element.offsetTop - element.scrollTop + element.clientTop); |
4436 |
08 Mar 13 |
olle |
element = element.offsetParent; |
4436 |
08 Mar 13 |
olle |
414 |
} |
4436 |
08 Mar 13 |
olle |
return {x: xPos, y: yPos}; |
4436 |
08 Mar 13 |
olle |
416 |
} |
4436 |
08 Mar 13 |
olle |
417 |
|
4436 |
08 Mar 13 |
olle |
418 |
/** |
4436 |
08 Mar 13 |
olle |
* Returns the last element with a given name. |
4436 |
08 Mar 13 |
olle |
420 |
* |
4436 |
08 Mar 13 |
olle |
* @param elementName Name of the GUIElements. |
4436 |
08 Mar 13 |
olle |
* @return GUIElement The last element with given name. |
4436 |
08 Mar 13 |
olle |
423 |
*/ |
4436 |
08 Mar 13 |
olle |
function getLastElementByName(elementName) |
4436 |
08 Mar 13 |
olle |
425 |
{ |
4436 |
08 Mar 13 |
olle |
var element = null; |
4436 |
08 Mar 13 |
olle |
if (elementName != null && elementName != '') |
4436 |
08 Mar 13 |
olle |
428 |
{ |
4436 |
08 Mar 13 |
olle |
var elArray = document.getElementsByName(elementName); |
4436 |
08 Mar 13 |
olle |
if (elArray != null) |
4436 |
08 Mar 13 |
olle |
431 |
{ |
4436 |
08 Mar 13 |
olle |
// Get last element |
4436 |
08 Mar 13 |
olle |
element = elArray[elArray.length - 1]; |
4436 |
08 Mar 13 |
olle |
434 |
} |
4436 |
08 Mar 13 |
olle |
435 |
} |
4436 |
08 Mar 13 |
olle |
return element; |
4436 |
08 Mar 13 |
olle |
437 |
} |
4436 |
08 Mar 13 |
olle |
438 |
|
4436 |
08 Mar 13 |
olle |
function updateNodeFirstChildText(nodeId, nodeText) |
4436 |
08 Mar 13 |
olle |
440 |
{ |
4410 |
12 Feb 13 |
olle |
var node = document.getElementById(nodeId); |
4410 |
12 Feb 13 |
olle |
if (node != null) |
4410 |
12 Feb 13 |
olle |
443 |
{ |
4410 |
12 Feb 13 |
olle |
node.firstChild.nodeValue = nodeText; |
4410 |
12 Feb 13 |
olle |
445 |
} |
4410 |
12 Feb 13 |
olle |
446 |
} |
4410 |
12 Feb 13 |
olle |
447 |
|
4410 |
12 Feb 13 |
olle |
448 |
/** |
4410 |
12 Feb 13 |
olle |
* Returns a string with comma-separated id values for job items, |
4410 |
12 Feb 13 |
olle |
* shown in the job table of current web page. |
4410 |
12 Feb 13 |
olle |
451 |
* |
4410 |
12 Feb 13 |
olle |
* @return String A string with comma-separated id values for shown job items. |
4410 |
12 Feb 13 |
olle |
453 |
*/ |
4410 |
12 Feb 13 |
olle |
function getJobIdList() |
4410 |
12 Feb 13 |
olle |
455 |
{ |
4410 |
12 Feb 13 |
olle |
var jobIdList = ''; |
4410 |
12 Feb 13 |
olle |
var tables = document.getElementsByTagName('table'); |
4410 |
12 Feb 13 |
olle |
for (var i = 0; i < tables.length; i++) |
4410 |
12 Feb 13 |
olle |
459 |
{ |
4410 |
12 Feb 13 |
olle |
if (tables[i].id != null && tables[i].id == 'Job') |
4410 |
12 Feb 13 |
olle |
461 |
{ |
4410 |
12 Feb 13 |
olle |
// Jobs id values are used as id for table rows in job table |
4410 |
12 Feb 13 |
olle |
// All other table rows have no id value |
4410 |
12 Feb 13 |
olle |
var jobTable = tables[i]; |
4410 |
12 Feb 13 |
olle |
var tableRows = jobTable.getElementsByTagName('tr'); |
4410 |
12 Feb 13 |
olle |
for (var k = 0; k < tableRows.length; k++) |
4410 |
12 Feb 13 |
olle |
467 |
{ |
4410 |
12 Feb 13 |
olle |
if (tableRows[k].id != null && tableRows[k].id != '') |
4410 |
12 Feb 13 |
olle |
469 |
{ |
4410 |
12 Feb 13 |
olle |
// Add table row id to list |
4410 |
12 Feb 13 |
olle |
if (jobIdList != '') |
4410 |
12 Feb 13 |
olle |
472 |
{ |
4410 |
12 Feb 13 |
olle |
jobIdList += ','; |
4410 |
12 Feb 13 |
olle |
474 |
} |
4410 |
12 Feb 13 |
olle |
jobIdList += tableRows[k].id; |
4410 |
12 Feb 13 |
olle |
476 |
} |
4410 |
12 Feb 13 |
olle |
477 |
} |
4410 |
12 Feb 13 |
olle |
478 |
} |
4410 |
12 Feb 13 |
olle |
479 |
} |
4410 |
12 Feb 13 |
olle |
return jobIdList; |
4410 |
12 Feb 13 |
olle |
481 |
} |
4410 |
12 Feb 13 |
olle |
482 |
|
4410 |
12 Feb 13 |
olle |
483 |
/** |
4410 |
12 Feb 13 |
olle |
* Uses Ajax to send a list if id values for shown job items |
4410 |
12 Feb 13 |
olle |
* to servlet, that retrieves current values for variables, |
4410 |
12 Feb 13 |
olle |
* that may change without the user's input. The data is |
4410 |
12 Feb 13 |
olle |
* sent back to the script as a JSON object, and is used |
4410 |
12 Feb 13 |
olle |
* to update specific elements of the job and job queue tables. |
4410 |
12 Feb 13 |
olle |
489 |
*/ |
4410 |
12 Feb 13 |
olle |
function updateJobTableColumns() |
4410 |
12 Feb 13 |
olle |
491 |
{ |
4421 |
25 Feb 13 |
olle |
// Set cmd |
4419 |
21 Feb 13 |
olle |
var cmd = 'updateJobTable'; |
4421 |
25 Feb 13 |
olle |
// Set requestType to "Ajax" to prevent action from being returned as "last action" |
4421 |
25 Feb 13 |
olle |
var requestType = 'Ajax'; |
4410 |
12 Feb 13 |
olle |
// Get job id values in comma-separated list |
4410 |
12 Feb 13 |
olle |
var jobIdList = getJobIdList(); |
4421 |
25 Feb 13 |
olle |
// Create url for Ajax XMLHttpRequest |
4421 |
25 Feb 13 |
olle |
var url = 'app?action=org.proteios.action.job.ListJobsAjax&requestType=' + requestType + '&cmd=' + cmd + '&jobIdList=' + jobIdList; |
4410 |
12 Feb 13 |
olle |
var request = new XMLHttpRequest(); |
4410 |
12 Feb 13 |
olle |
request.open("GET", url, false); |
4410 |
12 Feb 13 |
olle |
request.send(null); |
4410 |
12 Feb 13 |
olle |
503 |
|
4410 |
12 Feb 13 |
olle |
var response = JSON.parse(request.responseText); |
4410 |
12 Feb 13 |
olle |
if (response.status != 'ok') |
4410 |
12 Feb 13 |
olle |
506 |
{ |
4410 |
12 Feb 13 |
olle |
// Optional error handler |
4410 |
12 Feb 13 |
olle |
//setFatalError(response.message); |
4410 |
12 Feb 13 |
olle |
return false; |
4410 |
12 Feb 13 |
olle |
510 |
} |
4410 |
12 Feb 13 |
olle |
// Get JSON array for column data |
4410 |
12 Feb 13 |
olle |
var jsonColumnDataArray = response.tableupdate; |
4410 |
12 Feb 13 |
olle |
if (jsonColumnDataArray != null) |
4410 |
12 Feb 13 |
olle |
514 |
{ |
4410 |
12 Feb 13 |
olle |
for (var index in jsonColumnDataArray) |
4410 |
12 Feb 13 |
olle |
516 |
{ |
4410 |
12 Feb 13 |
olle |
var jsonCell = jsonColumnDataArray[index]; |
4410 |
12 Feb 13 |
olle |
// Get cell id from JSON key |
4410 |
12 Feb 13 |
olle |
for (var cellId in jsonCell) |
4410 |
12 Feb 13 |
olle |
520 |
{ |
4410 |
12 Feb 13 |
olle |
// Get JSON table cell data |
4410 |
12 Feb 13 |
olle |
var cellData = jsonCell[cellId]; |
4410 |
12 Feb 13 |
olle |
if (cellData == null) |
4410 |
12 Feb 13 |
olle |
524 |
{ |
4410 |
12 Feb 13 |
olle |
cellData = ''; |
4410 |
12 Feb 13 |
olle |
526 |
} |
4410 |
12 Feb 13 |
olle |
// Update table cell data |
4436 |
08 Mar 13 |
olle |
updateNodeFirstChildText(cellId, "" + cellData); |
4410 |
12 Feb 13 |
olle |
529 |
} |
4410 |
12 Feb 13 |
olle |
530 |
} |
4410 |
12 Feb 13 |
olle |
531 |
} |
4410 |
12 Feb 13 |
olle |
532 |
} |
4410 |
12 Feb 13 |
olle |
533 |
|
4410 |
12 Feb 13 |
olle |
var secondsBetweenUpdates = 5; |
4410 |
12 Feb 13 |
olle |
535 |
|
4410 |
12 Feb 13 |
olle |
function startRegularUpdates() |
4410 |
12 Feb 13 |
olle |
537 |
{ |
4410 |
12 Feb 13 |
olle |
setInterval('updateJobTableColumns()', 1000*secondsBetweenUpdates); |
4410 |
12 Feb 13 |
olle |
539 |
} |
4410 |
12 Feb 13 |
olle |
540 |
|
4436 |
08 Mar 13 |
olle |
541 |
/** |
4436 |
08 Mar 13 |
olle |
* Returns a mass value corresponding to an x-position in a mass spectrum image. |
4436 |
08 Mar 13 |
olle |
* Returns null if any argument values are invalid. |
4436 |
08 Mar 13 |
olle |
544 |
* |
4436 |
08 Mar 13 |
olle |
* @param e event The event to get position from |
4436 |
08 Mar 13 |
olle |
* @param imgId String The element id of the spectrum img tag in the html page |
4436 |
08 Mar 13 |
olle |
* @param spectrumWidth int The spectrum width in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetLeft int The spectrum offset from the left image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetRight int The spectrum offset from the right image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param massMin double The lowest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
* @param massMax double The highest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
552 |
*/ |
4436 |
08 Mar 13 |
olle |
function fetchMassValue(e, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax) |
4436 |
08 Mar 13 |
olle |
554 |
{ |
4436 |
08 Mar 13 |
olle |
// Return if basic arguments are missing or have odd values |
4436 |
08 Mar 13 |
olle |
if (imgId == null || imgId == '' || massMin == null || massMax == null || massMin == massMax) |
4436 |
08 Mar 13 |
olle |
557 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('Returned at check 1'); |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
560 |
} |
4436 |
08 Mar 13 |
olle |
// Return if effective spectrum width or massrange are <= 0 |
4436 |
08 Mar 13 |
olle |
var spectrumEffWidth = spectrumWidth - spectrumOffsetLeft - spectrumOffsetRight; |
4436 |
08 Mar 13 |
olle |
var massRange = massMax - massMin; |
4436 |
08 Mar 13 |
olle |
if (spectrumEffWidth <= 0 || massRange <= 0) |
4436 |
08 Mar 13 |
olle |
565 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('Returned at check 2 spectrumEffWidth = ' + spectrumEffWidth + ' massRange = ' + massRange); |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
568 |
} |
4436 |
08 Mar 13 |
olle |
// Get image element |
4436 |
08 Mar 13 |
olle |
var imgEl = document.getElementById(imgId); |
4436 |
08 Mar 13 |
olle |
if (imgEl == null) |
4436 |
08 Mar 13 |
olle |
572 |
{ |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
574 |
} |
4436 |
08 Mar 13 |
olle |
// Get position on page for event |
4436 |
08 Mar 13 |
olle |
var x = e.pageX; |
4436 |
08 Mar 13 |
olle |
// Get relative position inside current GUI element |
4436 |
08 Mar 13 |
olle |
var xRel = 0; |
4436 |
08 Mar 13 |
olle |
var pos = getElementPosition(imgEl); |
4436 |
08 Mar 13 |
olle |
xRel = x - pos.x; |
4436 |
08 Mar 13 |
olle |
var spectrumPixelOffsetLeft = xRel - spectrumOffsetLeft; |
4436 |
08 Mar 13 |
olle |
var mass = null; |
4436 |
08 Mar 13 |
olle |
// Return if basic arguments are missing or have odd values |
4436 |
08 Mar 13 |
olle |
if (massMin == null || massMax == null || massMin == massMax) |
4436 |
08 Mar 13 |
olle |
585 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('Returned at check 3'); |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
588 |
} |
4436 |
08 Mar 13 |
olle |
// Return if effective spectrum width or massrange are <= 0 |
4436 |
08 Mar 13 |
olle |
var spectrumEffWidth = spectrumWidth - spectrumOffsetLeft - spectrumOffsetRight; |
4436 |
08 Mar 13 |
olle |
var massRange = massMax - massMin; |
4436 |
08 Mar 13 |
olle |
if (spectrumEffWidth <= 0 || massRange <= 0) |
4436 |
08 Mar 13 |
olle |
593 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('Returned at check 4 spectrumEffWidth = ' + spectrumEffWidth + ' massRange = ' + massRange); |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
596 |
} |
4436 |
08 Mar 13 |
olle |
var spectrumPixelOffsetLeft = xRel - spectrumOffsetLeft; |
4436 |
08 Mar 13 |
olle |
// Calculate mass value from event pixel coordinate |
4436 |
08 Mar 13 |
olle |
mass = massMin + (spectrumPixelOffsetLeft/spectrumEffWidth)*massRange; |
4436 |
08 Mar 13 |
olle |
// Round mass value to nearest integer |
4436 |
08 Mar 13 |
olle |
mass = Math.floor(mass + 0.5); |
4436 |
08 Mar 13 |
olle |
return mass; |
4436 |
08 Mar 13 |
olle |
603 |
} |
4436 |
08 Mar 13 |
olle |
604 |
|
4436 |
08 Mar 13 |
olle |
605 |
/** |
4436 |
08 Mar 13 |
olle |
* Returns a mass cuttoff string corresponding to an x-position in a mass spectrum image. |
4436 |
08 Mar 13 |
olle |
* Returns null if any argument values are invalid. |
4436 |
08 Mar 13 |
olle |
608 |
* |
4436 |
08 Mar 13 |
olle |
* @param e event The event to get position from |
4436 |
08 Mar 13 |
olle |
* @param inputElName String The element name of the mass cutoff input field in the html page |
4436 |
08 Mar 13 |
olle |
* @param imgId String The element id of the spectrum img tag in the html page |
4436 |
08 Mar 13 |
olle |
* @param spectrumWidth int The spectrum width in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetLeft int The spectrum offset from the left image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetRight int The spectrum offset from the right image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param massMin double The lowest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
* @param massMax double The highest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
617 |
*/ |
4436 |
08 Mar 13 |
olle |
function fetchMassCutoffStr(e, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax) |
4436 |
08 Mar 13 |
olle |
619 |
{ |
4436 |
08 Mar 13 |
olle |
// Get mass value (equals null if any input argument values are invalid) |
4436 |
08 Mar 13 |
olle |
var mass = fetchMassValue(e, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax); |
4436 |
08 Mar 13 |
olle |
if (mass == null) |
4436 |
08 Mar 13 |
olle |
623 |
{ |
4436 |
08 Mar 13 |
olle |
return null; |
4436 |
08 Mar 13 |
olle |
625 |
} |
4436 |
08 Mar 13 |
olle |
// Get mass cutoff string |
4436 |
08 Mar 13 |
olle |
var massCutoffStr = ''; |
4436 |
08 Mar 13 |
olle |
if (mass >= massMin && mass <= massMax) |
4436 |
08 Mar 13 |
olle |
629 |
{ |
4436 |
08 Mar 13 |
olle |
// Mouse event inside spectrum range, set mass value |
4436 |
08 Mar 13 |
olle |
massCutoffStr = '' + mass; |
4436 |
08 Mar 13 |
olle |
632 |
} |
4436 |
08 Mar 13 |
olle |
else if (mass < massMin) |
4436 |
08 Mar 13 |
olle |
634 |
{ |
4436 |
08 Mar 13 |
olle |
// Mouse event below spectrum range, set mass value to below lowest mass |
4436 |
08 Mar 13 |
olle |
massCutoffStr = '' + (massMin - 0.1).toFixed(1); |
4436 |
08 Mar 13 |
olle |
637 |
} |
4436 |
08 Mar 13 |
olle |
else if (mass > massMax) |
4436 |
08 Mar 13 |
olle |
639 |
{ |
4436 |
08 Mar 13 |
olle |
// Mouse event above spectrum range, set mass value to above highest mass |
4436 |
08 Mar 13 |
olle |
massCutoffStr = '' + (massMax + 0.1).toFixed(1); |
4436 |
08 Mar 13 |
olle |
642 |
} |
4436 |
08 Mar 13 |
olle |
return massCutoffStr; |
4436 |
08 Mar 13 |
olle |
644 |
} |
4436 |
08 Mar 13 |
olle |
645 |
|
4436 |
08 Mar 13 |
olle |
var lastMouseDownMassCutoffStr = ''; |
4436 |
08 Mar 13 |
olle |
var isNextClickReservedForMouseUpEvent = false; |
4436 |
08 Mar 13 |
olle |
648 |
|
4436 |
08 Mar 13 |
olle |
649 |
/** |
4436 |
08 Mar 13 |
olle |
* Converts an event in a spectrum image to a mass value and |
4436 |
08 Mar 13 |
olle |
* sets mass cutoff value to the found mass. |
4436 |
08 Mar 13 |
olle |
* In order to support setting of cutoff masses using |
4436 |
08 Mar 13 |
olle |
* two clicks instead of dragging, a mass cutoff |
4437 |
08 Mar 13 |
olle |
* value will not be set if isNextClickReservedForMouseUpEvent == true. |
4436 |
08 Mar 13 |
olle |
655 |
* |
4436 |
08 Mar 13 |
olle |
* @param e event The event to get position from |
4436 |
08 Mar 13 |
olle |
* @param inputElName String The element name of the mass cutoff input field in the html page |
4436 |
08 Mar 13 |
olle |
* @param imgId String The element id of the spectrum img tag in the html page |
4436 |
08 Mar 13 |
olle |
* @param spectrumWidth int The spectrum width in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetLeft int The spectrum offset from the left image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetRight int The spectrum offset from the right image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param massMin double The lowest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
* @param massMax double The highest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
664 |
*/ |
4436 |
08 Mar 13 |
olle |
function setMouseDownMassCutoffValue(e, inputElName, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax) |
4436 |
08 Mar 13 |
olle |
666 |
{ |
4436 |
08 Mar 13 |
olle |
if (isNextClickReservedForMouseUpEvent) |
4436 |
08 Mar 13 |
olle |
668 |
{ |
4436 |
08 Mar 13 |
olle |
// Mouse click reserved for mouse up event |
4436 |
08 Mar 13 |
olle |
//alert('setMouseDownMassCutoffValue(): isNextClickReservedForMouseUpEvent = ' + isNextClickReservedForMouseUpEvent); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
672 |
} |
4436 |
08 Mar 13 |
olle |
// Prevent default dragging of image in older browsers |
4436 |
08 Mar 13 |
olle |
e.preventDefault(); |
4436 |
08 Mar 13 |
olle |
if (inputElName == null || inputElName == '') |
4436 |
08 Mar 13 |
olle |
676 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('setMouseDownMassCutoffValue(): inputElName == ' + inputElName); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
679 |
} |
4436 |
08 Mar 13 |
olle |
// Get mass cutoff string (equals null if any input argument values are invalid) |
4436 |
08 Mar 13 |
olle |
var massCutoffStr = fetchMassCutoffStr(e, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax); |
4436 |
08 Mar 13 |
olle |
if (massCutoffStr == null) |
4436 |
08 Mar 13 |
olle |
683 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('setMouseDownMassCutoffValue(): massCutoffStr == null'); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
686 |
} |
4436 |
08 Mar 13 |
olle |
// Get input field element |
4436 |
08 Mar 13 |
olle |
var inputEl = getLastElementByName(inputElName); |
4436 |
08 Mar 13 |
olle |
if (inputEl == null) |
4436 |
08 Mar 13 |
olle |
690 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('setMouseDownMassCutoffValue(): inputEl == null'); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
693 |
} |
4436 |
08 Mar 13 |
olle |
// Set input field value |
4436 |
08 Mar 13 |
olle |
inputEl.value = massCutoffStr; |
4436 |
08 Mar 13 |
olle |
// Store value set |
4436 |
08 Mar 13 |
olle |
lastMouseDownMassCutoffStr = massCutoffStr; |
4436 |
08 Mar 13 |
olle |
698 |
} |
4436 |
08 Mar 13 |
olle |
699 |
|
4436 |
08 Mar 13 |
olle |
700 |
/** |
4436 |
08 Mar 13 |
olle |
* Converts an event in a spectrum image to a mass value and |
4436 |
08 Mar 13 |
olle |
* sets mass cutoff value to the found mass. |
4436 |
08 Mar 13 |
olle |
* In order to support setting of cutoff masses using |
4436 |
08 Mar 13 |
olle |
* two clicks instead of dragging, a mass cutoff |
4436 |
08 Mar 13 |
olle |
* value will not be set if the mass value equals lastMouseDownMassCutoffStr. |
4436 |
08 Mar 13 |
olle |
706 |
* |
4436 |
08 Mar 13 |
olle |
* @param e event The event to get position from |
4436 |
08 Mar 13 |
olle |
* @param inputElName String The element name of the mass cutoff input field in the html page |
4436 |
08 Mar 13 |
olle |
* @param imgId String The element id of the spectrum img tag in the html page |
4436 |
08 Mar 13 |
olle |
* @param spectrumWidth int The spectrum width in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetLeft int The spectrum offset from the left image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param spectrumOffsetRight int The spectrum offset from the right image border in pixels |
4436 |
08 Mar 13 |
olle |
* @param massMin double The lowest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
* @param massMax double The highest mass value in the displayed spectrum |
4436 |
08 Mar 13 |
olle |
715 |
*/ |
4436 |
08 Mar 13 |
olle |
function setMouseUpMassCutoffValue(e, inputElName, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax) |
4436 |
08 Mar 13 |
olle |
717 |
{ |
4436 |
08 Mar 13 |
olle |
// Prevent default dragging of image in older browsers |
4436 |
08 Mar 13 |
olle |
e.preventDefault(); |
4436 |
08 Mar 13 |
olle |
if (inputElName == null || inputElName == '') |
4436 |
08 Mar 13 |
olle |
721 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('setMouseUpMassCutoffValue(): inputElName == ' + inputElName); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
724 |
} |
4436 |
08 Mar 13 |
olle |
// Get mass cutoff string (equals null if any input argument values are invalid) |
4436 |
08 Mar 13 |
olle |
var massCutoffStr = fetchMassCutoffStr(e, imgId, spectrumWidth, spectrumOffsetLeft, spectrumOffsetRight, massMin, massMax); |
4436 |
08 Mar 13 |
olle |
if (massCutoffStr == null) |
4436 |
08 Mar 13 |
olle |
728 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('setMouseUpMassCutoffValue(): massCutoffStr == null'); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
731 |
} |
4436 |
08 Mar 13 |
olle |
if (massCutoffStr == lastMouseDownMassCutoffStr) |
4436 |
08 Mar 13 |
olle |
733 |
{ |
4436 |
08 Mar 13 |
olle |
// No drag, mouse click intended for mouse down event |
4436 |
08 Mar 13 |
olle |
//alert('setMouseDownMassCutoffValue(): massCutoffStr == lastMouseDownMassCutoffStr = ' + massCutoffStr); |
4436 |
08 Mar 13 |
olle |
isNextClickReservedForMouseUpEvent = true; |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
738 |
} |
4436 |
08 Mar 13 |
olle |
// Get input field element |
4436 |
08 Mar 13 |
olle |
var inputEl = getLastElementByName(inputElName); |
4436 |
08 Mar 13 |
olle |
if (inputEl == null) |
4436 |
08 Mar 13 |
olle |
742 |
{ |
4436 |
08 Mar 13 |
olle |
//alert('setMouseUpMassCutoffValue(): inputEl == null'); |
4436 |
08 Mar 13 |
olle |
return; |
4436 |
08 Mar 13 |
olle |
745 |
} |
4436 |
08 Mar 13 |
olle |
// Set input field value |
4436 |
08 Mar 13 |
olle |
inputEl.value = massCutoffStr; |
4436 |
08 Mar 13 |
olle |
// Set focus to input field |
4436 |
08 Mar 13 |
olle |
inputEl.focus(); |
4436 |
08 Mar 13 |
olle |
// Set isNextClickReservedForMouseUpEvent to false |
4436 |
08 Mar 13 |
olle |
isNextClickReservedForMouseUpEvent = false; |
4436 |
08 Mar 13 |
olle |
752 |
} |
4436 |
08 Mar 13 |
olle |
753 |
|
2597 |
05 Mar 08 |
gregory |
var body; |
3919 |
28 Oct 10 |
gregory |
window.onload =function() |
3919 |
28 Oct 10 |
gregory |
756 |
{ |
3919 |
28 Oct 10 |
gregory |
body = getElement("rightFrameBody"); |
3919 |
28 Oct 10 |
gregory |
addShadeUnshade(body); |
3919 |
28 Oct 10 |
gregory |
var elements = document.getElementsByTagName("LI"); |
3919 |
28 Oct 10 |
gregory |
for(var i = 0; i < elements.length;i++) |
3919 |
28 Oct 10 |
gregory |
761 |
{ |
3919 |
28 Oct 10 |
gregory |
addHiliteEvents(elements[i]); |
3919 |
28 Oct 10 |
gregory |
763 |
} |
4410 |
12 Feb 13 |
olle |
// Start regular updates for Jobs table |
4422 |
25 Feb 13 |
olle |
if (document.forms[0] != null) |
4410 |
12 Feb 13 |
olle |
766 |
{ |
4422 |
25 Feb 13 |
olle |
if (document.forms[0].name == 'formOfJob') |
4422 |
25 Feb 13 |
olle |
768 |
{ |
4422 |
25 Feb 13 |
olle |
startRegularUpdates(); |
4422 |
25 Feb 13 |
olle |
770 |
} |
4410 |
12 Feb 13 |
olle |
771 |
} |
3919 |
28 Oct 10 |
gregory |
772 |
}; |
2597 |
05 Mar 08 |
gregory |
773 |
|