View | Details | Raw Unified | Return to bug 172915 | Differences between
and this patch

Collapse All | Expand All

(-)advanced/searchScoped.jsp (-9 / +31 lines)
Lines 118-133 Link Here
118
var isMozilla = navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && parseInt(navigator.appVersion.substring(0,1)) >= 5;
118
var isMozilla = navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && parseInt(navigator.appVersion.substring(0,1)) >= 5;
119
119
120
var advancedDialog;
120
var advancedDialog;
121
var w = 300;
122
var h = 300;
123
121
124
function openAdvanced()
122
function openAdvanced() 
125
{
123
{ 
126
	var scope = document.getElementById("scope").firstChild;
124
    var scope = document.getElementById("scope").firstChild;
127
	var workingSet = "";
125
    var workingSet = ""; 
128
	if (scope != null)
126
    if (scope != null) 
129
	 	workingSet = document.getElementById("scope").firstChild.nodeValue;
127
              workingSet = document.getElementById("scope").firstChild.nodeValue;                
130
	 	
128
    var minSize = 300; 
129
    var maxHeight= 500;  
130
    var maxWidth = 600;       
131
    var w = minSize; 
132
    var h = minSize; 
133
      
134
    // If we have large fonts make the dialog larger, up to 500 pixels high, 600 wide
135
    try {         
136
        var letterHeight = document.getElementById("searchWord").offsetHeight; 
137
        var requiredSize = 16 * letterHeight; 
138
        if (requiredSize > minSize) { 
139
            if (requiredSize < maxWidth) { 
140
                w = requiredSize; 
141
            } else { 
142
                w =  maxWidth; 
143
            }
144
            if (requiredSize < maxHeight) { 
145
                h = requiredSize; 
146
            } else {               
147
                h = maxHeight;
148
            }
149
        } 
150
             
151
    } catch (e) {} 
152
    
131
<%
153
<%
132
if (data.isIE()){
154
if (data.isIE()){
133
%>
155
%>
(-)advanced/workingSetManager.jsp (-20 / +46 lines)
Lines 1-5 Link Here
1
<%--
1
<%--
2
 Copyright (c) 2000, 2004 IBM Corporation and others.
2
 Copyright (c) 2000, 2006 IBM Corporation and others.
3
 All rights reserved. This program and the accompanying materials 
3
 All rights reserved. This program and the accompanying materials 
4
 are made available under the terms of the Eclipse Public License v1.0
4
 are made available under the terms of the Eclipse Public License v1.0
5
 which accompanies this distribution, and is available at
5
 which accompanies this distribution, and is available at
Lines 39-50 Link Here
39
}
39
}
40
40
41
BODY {
41
BODY {
42
    font:<%=prefs.getViewFont()%>;
42
	background-color: <%=prefs.getToolbarBackground()%>;
43
	background-color: <%=prefs.getToolbarBackground()%>;
43
	color:WindowText; 	
44
	color:WindowText; 	
44
}
45
}
45
46
46
TABLE {
47
TABLE {
47
	width:auto;
48
	width:auto;
49
	margin:0px;
50
	padding:0px;
48
}
51
}
49
52
50
TD, TR {
53
TD, TR {
Lines 58-76 Link Here
58
61
59
BUTTON {
62
BUTTON {
60
	font:<%=prefs.getViewFont()%>;
63
	font:<%=prefs.getViewFont()%>;
64
	margin:5px;
65
}
66
67
BUTTON {
68
    font-size:1.0em; 
69
}
70
71
FORM {
72
    margin: 0px;
73
    border: 0px;
61
}
74
}
62
75
63
#workingSetContainer {
76
#workingSetContainer {
64
	background:Window;
65
	color:WindowText; 
77
	color:WindowText; 
66
	border: 2px inset ThreeDHighlight;
78
	border: 2px inset ThreeDHighlight;
67
	margin:0px 5px;
79
	margin:0px 5px;
68
	padding:5px;
80
	padding:5px;
69
	overflow:auto;
81
	overflow:auto;
82
	height:140px;
83
	background:<%=prefs.getViewBackground()%>;
84
}
85
86
#buttonArea {
87
    height:4em; 
70
}
88
}
71
89
72
</style>
90
</style>
73
91
92
<script language="JavaScript" src="resize.js"></script>
93
<script language="JavaScript" src="utils.js"></script>
74
<script language="JavaScript" src="list.js"></script>
94
<script language="JavaScript" src="list.js"></script>
75
<script language="JavaScript">
95
<script language="JavaScript">
76
96
Lines 94-99 Link Here
94
	sizeButtons();
114
	sizeButtons();
95
<%}%>
115
<%}%>
96
	enableButtons();
116
	enableButtons();
117
	sizeList();
97
	document.getElementById("alldocs").focus();
118
	document.getElementById("alldocs").focus();
98
}
119
}
99
120
Lines 170-175 Link Here
170
191
171
function removeWorkingSet() {
192
function removeWorkingSet() {
172
	window.location.replace("workingSetManager.jsp?operation=remove&workingSet="+encodeURIComponent(getWorkingSet()));
193
	window.location.replace("workingSetManager.jsp?operation=remove&workingSet="+encodeURIComponent(getWorkingSet()));
194
	if (getWorkingSet()==window.opener.document.getElementById("scope").firstChild.nodeValue){
195
		window.opener.document.getElementById("scope").firstChild.nodeValue=
196
		    "<%=UrlUtil.JavaScriptEncode(ServletResources.getString("All", request))%>";
197
		window.opener.document.forms["searchForm"].workingSet.value=
198
		    "<%=UrlUtil.JavaScriptEncode(ServletResources.getString("All", request))%>";
199
	}
173
}
200
}
174
201
175
var workingSetDialog;
202
var workingSetDialog;
Lines 193-199 Link Here
193
	// move the dialog just a bit higher than the middle
220
	// move the dialog just a bit higher than the middle
194
	if (t-50 > 0) t = t-50;
221
	if (t-50 > 0) t = t-50;
195
	window.location="javascript://needModal";
222
	window.location="javascript://needModal";
196
	workingSetDialog = window.open("workingSet.jsp?operation=add&workingSet="+encodeURIComponent(getWorkingSet()), "workingSetDialog", "resizeable=no,height="+h+",width="+w +",left="+l+",top="+t);
223
	workingSetDialog = window.open("workingSet.jsp?operation=add&workingSet="+encodeURIComponent(getWorkingSet()), "workingSetDialog", "resizable=yes,height="+h+",width="+w +",left="+l+",top="+t);
197
	workingSetDialog.focus(); 
224
	workingSetDialog.focus(); 
198
}
225
}
199
226
Lines 216-222 Link Here
216
	if (t-50 > 0) t = t-50;
243
	if (t-50 > 0) t = t-50;
217
		
244
		
218
	window.location="javascript://needModal";
245
	window.location="javascript://needModal";
219
	workingSetDialog = window.open("workingSet.jsp?operation=edit&workingSet="+encodeURIComponent(getWorkingSet()), "workingSetDialog", "resizeable=no,height="+h+",width="+w+",left="+l+",top="+t );
246
	workingSetDialog = window.open("workingSet.jsp?operation=edit&workingSet="+encodeURIComponent(getWorkingSet()), "workingSetDialog", "resizable=no,height="+h+",width="+w+",left="+l+",top="+t );
220
	workingSetDialog.focus(); 
247
	workingSetDialog.focus(); 
221
}
248
}
222
249
Lines 229-250 Link Here
229
	catch(e) {}
256
	catch(e) {}
230
}
257
}
231
258
259
function sizeList() {
260
    resizeVertical("workingSetContainer", "filterTable", "buttonArea", 100, 30);
261
}
262
232
</script>
263
</script>
233
264
234
</head>
265
</head>
235
266
236
<body dir="<%=direction%>" onload="onloadHandler()" onunload="closeWorkingSetDialog()">
267
<body dir="<%=direction%>" onload="onloadHandler()" onunload="closeWorkingSetDialog()" onresize = "sizeList()">
237
<form onsubmit="selectWorkingSet();return false;">
268
<form onsubmit="selectWorkingSet();return false;">
238
<div style="overflow:auto;height:250px;width:100%;">
269
  	<table id="filterTable" cellspacing=0 cellpadding=0 border=0 align=center  style="background:<%=prefs.getToolbarBackground()%>; font:<%=prefs.getToolbarFont()%>;margin-top:5px;width:100%;">
239
  	<table id="filterTable" cellspacing=0 cellpading=0 border=0 align=center  style="background:<%=prefs.getToolbarBackground()%>; font:<%=prefs.getToolbarFont()%>;margin-top:5px;width:100%;">
240
		<tr><td class="radio">
270
		<tr><td class="radio">
241
			<input id="alldocs" type="radio" name="workingSet" onclick="enableButtons()"><label for="alldocs" accesskey="<%=ServletResources.getAccessKey("selectAll", request)%>"><%=ServletResources.getLabel("selectAll", request)%></label>
271
			<input id="alldocs" type="radio" name="workingSet" onclick="enableButtons()"><label for="alldocs" accesskey="<%=ServletResources.getAccessKey("selectAll", request)%>"><%=ServletResources.getLabel("selectAll", request)%></label>
242
		</td></tr>
272
		</td></tr>
243
		<tr><td class="radio">
273
		<tr><td class="radio">
244
			<input id="selectws" type="radio" name="workingSet"  onclick="enableButtons()"><label for="selectws" accesskey="<%=ServletResources.getAccessKey("selectWorkingSet", request)%>"><%=ServletResources.getLabel("selectWorkingSet", request)%>:</label>	
274
			<input id="selectws" type="radio" name="workingSet"  onclick="enableButtons()"><label for="selectws" accesskey="<%=ServletResources.getAccessKey("selectWorkingSet", request)%>"><%=ServletResources.getLabel("selectWorkingSet", request)%>:</label>	
245
		</td></tr>
275
		</td></tr>
246
		<tr><td>
276
	</table>
247
			<div id="workingSetContainer" style="overflow:auto; height:140px; background:<%=prefs.getViewBackground()%>;">
277
<div id="workingSetContainer" >
248
278
249
<table id='list'  cellspacing='0' style="width:100%;">
279
<table id='list'  cellspacing='0' style="width:100%;">
250
<% 
280
<% 
Lines 272-281 Link Here
272
%>
302
%>
273
303
274
</table>
304
</table>
275
			</div>
305
</div>
276
		</td></tr>
306
			
277
		<tr id="actionsTable" valign="bottom"><td>
307
<div id="buttonArea">
278
  			<table cellspacing=10 cellpading=0 border=0 style="background:transparent;">
308
  			<table cellspacing=0 cellpadding=0 border=0 style="background:transparent;">
279
				<tr>
309
				<tr>
280
					<td>
310
					<td>
281
						<button type="button" onclick="newWorkingSet()" id="new" accesskey="<%=ServletResources.getAccessKey("NewWorkingSetButton", request)%>"><%=ServletResources.getLabel("NewWorkingSetButton", request)%>...</button>
311
						<button type="button" onclick="newWorkingSet()" id="new" accesskey="<%=ServletResources.getAccessKey("NewWorkingSetButton", request)%>"><%=ServletResources.getLabel("NewWorkingSetButton", request)%>...</button>
Lines 288-300 Link Here
288
					</td>
318
					</td>
289
				</tr>
319
				</tr>
290
  			</table>
320
  			</table>
291
		</td></tr>
321
	<table align="<%=isRTL?"left":"right"%>" style="background:<%=prefs.getToolbarBackground()%>">
292
	</table>
322
		<tr id="buttonsTable"><td align="<%=isRTL?"left":"right"%>">
293
</div>
323
  			<table cellspacing=0 cellpadding=0 border=0 style="background:transparent;">
294
<div style="height:50px;">
295
	<table valign="bottom" align="<%=isRTL?"left":"right"%>" style="background:<%=prefs.getToolbarBackground()%>">
296
		<tr id="buttonsTable" valign="bottom"><td valign="bottom" align="<%=isRTL?"left":"right"%>">
297
  			<table cellspacing=10 cellpading=0 border=0 style="background:transparent;">
298
				<tr>
324
				<tr>
299
					<td>
325
					<td>
300
						<button type="submit" id="ok"><%=ServletResources.getString("OK", request)%></button>
326
						<button type="submit" id="ok"><%=ServletResources.getString("OK", request)%></button>
(-)advanced/workingSet.jsp (-13 / +46 lines)
Lines 1-5 Link Here
1
<%--
1
<%--
2
 Copyright (c) 2000, 2004 IBM Corporation and others.
2
 Copyright (c) 2000, 2006 IBM Corporation and others.
3
 All rights reserved. This program and the accompanying materials 
3
 All rights reserved. This program and the accompanying materials 
4
 are made available under the terms of the Eclipse Public License v1.0
4
 are made available under the terms of the Eclipse Public License v1.0
5
 which accompanies this distribution, and is available at
5
 which accompanies this distribution, and is available at
Lines 52-61 Link Here
52
	border:0px;
52
	border:0px;
53
}
53
}
54
54
55
INPUT {
56
    font:<%=prefs.getViewFont()%>;
57
}
55
58
56
#workingSet {
59
#workingSet {
57
	width:100%;
60
	width:100%;
58
	font:<%=prefs.getViewFont()%>;
61
	font-size:1.0em;
59
}
62
}
60
63
61
#booksContainer {
64
#booksContainer {
Lines 67-79 Link Here
67
	padding-<%=isRTL?"right":"left"%>:5px;
70
	padding-<%=isRTL?"right":"left"%>:5px;
68
	overflow:auto;
71
	overflow:auto;
69
	height:350px;
72
	height:350px;
70
<%if (data.isIE()) {%>
73
<%
71
	width:100%;
74
if (data.isIE()) {
72
<%}%>
75
%>
76
    width:100%; 
77
<%
78
}
79
%>
80
}
81
82
#buttonBar {
83
    height:3em; 
73
}
84
}
74
85
75
.book {
86
.book {
76
	margin:0xp;
87
	margin:0px;
77
	border:0px;
88
	border:0px;
78
	padding:0px;
89
	padding:0px;
79
	white-space: nowrap;
90
	white-space: nowrap;
Lines 90-95 Link Here
90
	font:<%=prefs.getViewFont()%>;
101
	font:<%=prefs.getViewFont()%>;
91
}
102
}
92
103
104
BUTTON {	
105
	font-size:1.0em; 
106
}
107
93
.expanded {
108
.expanded {
94
	display:block;
109
	display:block;
95
}
110
}
Lines 107-113 Link Here
107
%>
122
%>
108
input[type="checkbox"] {
123
input[type="checkbox"] {
109
	border:2px solid WindowText; 
124
	border:2px solid WindowText; 
110
	margin:0xp; 
125
	margin:0px; 
111
	padding:0px;	
126
	padding:0px;	
112
	height:12px;
127
	height:12px;
113
	width:12px;
128
	width:12px;
Lines 120-126 Link Here
120
}
135
}
121
%>
136
%>
122
</style>
137
</style>
123
138
<script language="JavaScript" src="resize.js"></script>
124
<script language="JavaScript">
139
<script language="JavaScript">
125
140
126
// Preload images
141
// Preload images
Lines 139-144 Link Here
139
%>
154
%>
140
	sizeButtons();
155
	sizeButtons();
141
<%}%>
156
<%}%>
157
    sizeBookContainer();
142
	document.getElementById("workingSet").focus();
158
	document.getElementById("workingSet").focus();
143
	enableOK();
159
	enableOK();
144
<%-- event handlers that call enableOK() are not invoked properly on Japanese --%>
160
<%-- event handlers that call enableOK() are not invoked properly on Japanese --%>
Lines 157-162 Link Here
157
	}
173
	}
158
}
174
}
159
175
176
function sizeBookContainer() {
177
    resizeVertical("booksContainer", "wsTable", "buttonBar", 100, 20);
178
}
179
160
function doSubmit()
180
function doSubmit()
161
{
181
{
162
	try
182
	try
Lines 216-225 Link Here
216
		node.className = "collapsed";
236
		node.className = "collapsed";
217
		img.src = plus.src;
237
		img.src = plus.src;
218
		img.alt = altBookClosed;
238
		img.alt = altBookClosed;
239
		img.title = altBookClosed;
219
	} else {
240
	} else {
220
		node.className = "expanded";
241
		node.className = "expanded";
221
		img.src = minus.src;
242
		img.src = minus.src;
222
		img.alt = altBookOpen;
243
		img.alt = altBookOpen;
244
		img.title = altBookOpen;
223
	}
245
	}
224
}
246
}
225
247
Lines 230-235 Link Here
230
	node.className = "collapsed";
252
	node.className = "collapsed";
231
	img.src = plus.src;
253
	img.src = plus.src;
232
	img.alt = altBookClosed;
254
	img.alt = altBookClosed;
255
	img.title = altBookClosed;
233
}
256
}
234
257
235
function expand(nodeId) {
258
function expand(nodeId) {
Lines 239-244 Link Here
239
	node.className = "expanded";
262
	node.className = "expanded";
240
	img.src = minus.src;
263
	img.src = minus.src;
241
	img.alt = altBookOpen;
264
	img.alt = altBookOpen;
265
	img.title = altBookOpen;
242
}
266
}
243
267
244
function getParent(child) {
268
function getParent(child) {
Lines 248-254 Link Here
248
}
272
}
249
273
250
function updateParentState(checkbox,parentDiv) {
274
function updateParentState(checkbox,parentDiv) {
251
275
	enableOK();
252
	if (checkbox == null)
276
	if (checkbox == null)
253
		return;
277
		return;
254
278
Lines 271-276 Link Here
271
}
295
}
272
296
273
function setSubtreeChecked(checkbox, parentDiv) {
297
function setSubtreeChecked(checkbox, parentDiv) {
298
	enableOK();
274
	var state = checkbox.checked;
299
	var state = checkbox.checked;
275
	var children = document.getElementById(parentDiv).getElementsByTagName("INPUT");
300
	var children = document.getElementById(parentDiv).getElementsByTagName("INPUT");
276
	for (var i = children.length - 1; i >= 0; i--) {
301
	for (var i = children.length - 1; i >= 0; i--) {
Lines 332-340 Link Here
332
  	return false;
357
  	return false;
333
}
358
}
334
359
360
function hasSelections() {
361
		var hrefs = getSelectedResources();
362
		if (!hrefs || hrefs == "")
363
			return false;
364
		else
365
			return true;
366
}
367
335
function enableOK() {
368
function enableOK() {
336
	var value = document.getElementById("workingSet").value;
369
	var value = document.getElementById("workingSet").value;
337
	if (!value || value.length == 0 || value.charAt(0) == " ")
370
	if (!value || value.length == 0 || value.charAt(0) == " " || !hasSelections())
338
		document.getElementById("ok").disabled = true;
371
		document.getElementById("ok").disabled = true;
339
	else
372
	else
340
		document.getElementById("ok").disabled = false;
373
		document.getElementById("ok").disabled = false;
Lines 344-350 Link Here
344
377
345
</head>
378
</head>
346
379
347
<body dir="<%=direction%>" onload="onloadHandler()">
380
<body dir="<%=direction%>" onload="onloadHandler()"  onresize = "sizeBookContainer()">
348
<form onsubmit="doSubmit();return false;">
381
<form onsubmit="doSubmit();return false;">
349
	<table id="wsTable" width="100%" cellspacing=0 cellpading=0 border=0 align=center >
382
	<table id="wsTable" width="100%" cellspacing=0 cellpading=0 border=0 align=center >
350
		<tr><td style="padding:5px 10px 0px 10px;"><label for="workingSet" accesskey="<%=ServletResources.getAccessKey("WorkingSetName", request)%>"><%=ServletResources.getLabel("WorkingSetName", request)%>:</label>
383
		<tr><td style="padding:5px 10px 0px 10px;"><label for="workingSet" accesskey="<%=ServletResources.getAccessKey("WorkingSetName", request)%>"><%=ServletResources.getLabel("WorkingSetName", request)%>:</label>
Lines 370-376 Link Here
370
	String className = state == WorkingSetData.STATE_GRAYED ? "grayed" : "checkbox";
403
	String className = state == WorkingSetData.STATE_GRAYED ? "grayed" : "checkbox";
371
%>
404
%>
372
				<div class="book" id='<%="id"+i%>' >
405
				<div class="book" id='<%="id"+i%>' >
373
					<img id='<%="img"+i%>' alt="<%=ServletResources.getString("bookClosed", request)%>" src="<%=prefs.getImagesDirectory()%>/plus.gif" onclick="collapseOrExpand('<%=i%>')">
406
					<img id='<%="img"+i%>' alt="<%=ServletResources.getString("bookClosed", request)%>" title="<%=ServletResources.getString("bookClosed", request)%>" src="<%=prefs.getImagesDirectory()%>/plus.gif" onclick="collapseOrExpand('<%=i%>')">
374
					<input 	class='<%=className%>' 
407
					<input 	class='<%=className%>' 
375
							type="checkbox" 
408
							type="checkbox" 
376
							id='<%=data.getTocHref(i)%>' 
409
							id='<%=data.getTocHref(i)%>' 
Lines 408-414 Link Here
408
%>
441
%>
409
442
410
</div>
443
</div>
411
<div style="height:50px;">
444
<div id="buttonBar" >
412
	<table valign="bottom" align="<%=isRTL?"left":"right"%>">
445
	<table valign="bottom" align="<%=isRTL?"left":"right"%>">
413
		<tr id="buttonsTable" valign="bottom"><td valign="bottom" align="<%=isRTL?"left":"right"%>">
446
		<tr id="buttonsTable" valign="bottom"><td valign="bottom" align="<%=isRTL?"left":"right"%>">
414
  			<table cellspacing=10 cellpading=0 border=0 style="background:transparent;">
447
  			<table cellspacing=10 cellpading=0 border=0 style="background:transparent;">
(-)advanced/utils.js (+170 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
12
// Utility functions used by multiple jsp pages. This contains most of
13
// the functions that have different behavior on different browsers
14
15
// Constants used in flags, the const keyword is not supported in IE 6 and earlier
16
// so they are declared as var
17
18
var SCROLL_LEFT = 1;
19
var SCROLL_RIGHT = 2;
20
var SCROLL_UP = 4;
21
var SCROLL_DOWN = 8;
22
var SCROLL_HORIZONTAL = SCROLL_LEFT + SCROLL_RIGHT;
23
var SCROLL_VERTICAL = SCROLL_UP + SCROLL_DOWN;
24
var SCROLL_HORIZONTAL_AND_VERTICAL = SCROLL_HORIZONTAL + SCROLL_VERTICAL;
25
26
var isInternetExplorer = navigator.userAgent.indexOf('MSIE') != -1;
27
var isSafari = (navigator.userAgent.indexOf('Safari/') != -1)
28
			|| (navigator.userAgent.indexOf('AppleWebKit/') != -1);
29
30
/**
31
 * Scrolls the page to show the specified element
32
 * If the entire element can be show scroll the minimum amount necessary to 
33
 * show the entire element.
34
 * If the element is larger than the client area align it at the top or left of the page.
35
 */
36
function scrollUntilVisible(node, flags)
37
{
38
    if (node === null) { 
39
        return; 
40
    }
41
	var nodeTop = node.offsetTop;
42
	var nodeBottom = nodeTop + node.offsetHeight;
43
	var nodeLeft = node.offsetLeft;
44
	var nodeRight = nodeLeft + node.offsetWidth;
45
	var pageTop = 0;
46
	var pageBottom = 0;
47
	var pageLeft = 0;
48
	var pageRight = 0;
49
	var isScrollLeft = flags & SCROLL_LEFT;
50
	var isScrollRight = flags & SCROLL_RIGHT;
51
	var isScrollUp = flags & SCROLL_UP;
52
	var isScrollDown = flags & SCROLL_DOWN;
53
	
54
	if (isInternetExplorer)
55
	{
56
		pageTop = document.body.scrollTop; 
57
		pageBottom = pageTop + document.body.clientHeight;	
58
		pageLeft = document.body.scrollLeft;
59
		pageRight = document.body.scrollRight;
60
	} 
61
	else 
62
	{
63
		pageTop = window.pageYOffset;
64
		pageBottom = pageTop + window.innerHeight - node.offsetHeight;
65
		pageLeft = window.pageXOffset;
66
		pageRight = pageLeft + window.innerWidth - node.offsetWidth;
67
	}
68
	
69
	var vScroll = 0;
70
	var hScroll = 0;
71
	
72
	if (flags & SCROLL_VERTICAL) {
73
	    if (nodeTop < pageTop && isScrollUp) {
74
	        // Scroll up so node is at the top of the view
75
		    vScroll = nodeTop - pageTop;
76
	    } else {
77
	        if (nodeBottom > pageBottom && isScrollDown) {	
78
		        vScroll = Math.min(nodeTop - pageTop, nodeBottom - pageBottom);
79
		    } else {
80
		        vScroll = 0; // already in view
81
		    } 
82
	    }
83
	}
84
	
85
	if (flags & SCROLL_HORIZONTAL && isScrollLeft) {
86
	    if (nodeLeft < pageLeft) {
87
		    hScroll = nodeLeft - pageLeft; 
88
	    } else {
89
	        if (nodeRight > pageRight && isScrollRight) {
90
		        hScroll = Math.min(nodeLeft - pageLeft, nodeRight - pageRight);
91
		    } else {
92
		        hScroll = 0; // already in view
93
		    } 	
94
	    }
95
	}
96
		
97
	if (hScroll != 0 || vScroll != 0) {	
98
	    window.scrollBy(hScroll, vScroll);
99
	}
100
}
101
102
function cancelEventBubble(e) {
103
  	if (isInternetExplorer) {
104
  		window.event.cancelBubble = true; 	 
105
  	} 
106
  	if (e && e.preventDefault) {
107
  		e.preventDefault();
108
    }
109
}
110
111
/**
112
 * Returns the target node of an event
113
 */
114
function getEventTarget(e) {
115
	var target;
116
  	if (isIE) {
117
   		target = window.event.srcElement; 
118
   	} else {  	
119
  		target = e.target;
120
  	}
121
122
	return target;
123
}
124
125
function getKeycode(e) {
126
    if (isInternetExplorer) {
127
		return window.event.keyCode;
128
	} else {
129
		return e.keyCode;
130
	}
131
}
132
133
function getCookie(name) {
134
	var nameEquals = name + "=";
135
	var cookies = document.cookie.split(";");
136
	for (var i=0;i<cookies.length;++i) {
137
		var cookie = cookies[i];
138
		if (cookie.charAt(0) == ' ') {
139
			cookie = cookie.substring(1, cookie.length);
140
		}
141
		if (cookie.indexOf(nameEquals) == 0) {
142
			return cookie.substring(nameEquals.length, cookie.length);
143
		}
144
	}
145
	return null;
146
}
147
148
function setCookie(name, value) {
149
	var date = new Date();
150
	date.setTime(date.getTime()+(365*24*60*60*1000));
151
	document.cookie = name + "=" + value + "; expires=" + date.toGMTString() + ";path=/";
152
}
153
154
function setCSSRule(selector, property, value) {
155
	var theRules = new Array();
156
	for (var i=0;i<document.styleSheets.length;i++) {
157
		if (document.styleSheets[i].cssRules) {
158
			theRules = document.styleSheets[i].cssRules;
159
		}
160
		else {
161
			theRules = document.styleSheets[i].rules;
162
		}
163
		for (var j=theRules.length-1;j>=0;j--) {
164
			if (theRules[j].selectorText == selector) {
165
				theRules[j].style[property] = value;
166
				return;
167
			}
168
		}
169
	}
170
}
(-)advanced/resize.js (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
 
12
 /*
13
Expands or contracts the control "expandable" to be the height of
14
the window less the size of fixed1, fixed2 and padding. fixed1 and fixed2 may be null
15
*/
16
17
function resizeVertical(expandableId, fixed1Id, fixed2Id, minSize, padding) {
18
    var isSafari = (navigator.userAgent.indexOf('Safari/') != -1);
19
    if (isSafari) padding += 20;  // newHeight gets computed too large on Safari	
20
	var newHeight;
21
	if (window.innerHeight) {
22
		newHeight = window.innerHeight;
23
	} else {
24
        newHeight = document.body.clientHeight;
25
	}
26
	if (fixed1Id) {
27
	    var fixed1 = document.getElementById(fixed1Id);
28
	    if (fixed1) newHeight -= fixed1.offsetHeight;
29
	}
30
	if (fixed2Id) {
31
	    var fixed2 = document.getElementById(fixed2Id);
32
	    if (fixed2) newHeight -= fixed2.offsetHeight;
33
	}
34
	if (padding) {
35
	    newHeight = newHeight - padding;
36
	}
37
	if (newHeight < minSize) {
38
	    newHeight = minSize;
39
	}
40
	var expandable = document.getElementById(expandableId);
41
	if (expandable) {
42
	    expandable.style.height = newHeight + "px";
43
	}
44
}

Return to bug 172915