-
Notifications
You must be signed in to change notification settings - Fork 50
/
HTMLAnnotHeader.html
267 lines (230 loc) · 6.8 KB
/
HTMLAnnotHeader.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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<style type="text/css">
.annotSet { /* Annotation Set - A grouping which spans a complete set of
linked annotations. */
border-right: 1px solid;
padding-right: 10px;
}
.bluediv { /* The style for every other line. Used to create
a report effect */
background: url("bluegrad.jpg")top right repeat-y;
background-color: #bacdff;
margin-bottom: 5px;
margin-top: 5px;
}
pre { /* Required change in pre formatting. This fixes problems
with spacing inside of annotSet div tags */
margin: 0px 0px 0px 0px;
font-family: monospace;
}
.nound {
font-weight:bold;
color:navy;
text-decoration:none;
}
</style>
<script language="javascript">
/** JavaScript to detect text resizing events. Culled verbatim
** from Lawrence Carvalho's great article on the subject
**/
/**
* @fileoverview TextResizeDetector
*
* Detects changes to font sizes when user changes browser settings
* <br>Fires a custom event with the following data:<br><br>
* iBase : base font size
* iDelta : difference in pixels from previous setting<br>
* iSize : size in pixel of text<br>
*
* * @author Lawrence Carvalho carvalho@uk.yahoo-inc.com
* @version 1.0
*/
/**
* @constructor
*/
TextResizeDetector = function() {
var el = null;
var iIntervalDelay = 200;
var iInterval = null;
var iCurrSize = -1;
var iBase = -1;
var aListeners = [];
var createControlElement = function() {
el = document.createElement('span');
el.id='textResizeControl';
el.innerHTML=' ';
el.style.position="absolute";
el.style.left="-9999px";
var elC = document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID);
// insert before firstChild
if (elC)
elC.insertBefore(el,elC.firstChild);
iBase = iCurrSize = TextResizeDetector.getSize();
};
function _stopDetector() {
window.clearInterval(iInterval);
iInterval=null;
};
function _startDetector() {
if (!iInterval) {
iInterval = window.setInterval('TextResizeDetector.detect()',
iIntervalDelay);
}
};
function _detect() {
var iNewSize = TextResizeDetector.getSize();
if(iNewSize!== iCurrSize) {
for (var i=0;i <aListeners.length;i++) {
aListnr = aListeners[i];
var oArgs = { iBase: iBase,iDelta:((iCurrSize!=-1) ? iNewSize - iCurrSize + 'px' : "0px"),iSize:iCurrSize = iNewSize};
if (!aListnr.obj) {
aListnr.fn('textSizeChanged',[oArgs]);
}
else {
aListnr.fn.apply(aListnr.obj,['textSizeChanged',[oArgs]]);
}
}
}
return iCurrSize;
};
var onAvailable = function() {
if (!TextResizeDetector.onAvailableCount_i ) {
TextResizeDetector.onAvailableCount_i =0;
}
if (document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID)) {
TextResizeDetector.init();
if (TextResizeDetector.USER_INIT_FUNC){
TextResizeDetector.USER_INIT_FUNC();
}
TextResizeDetector.onAvailableCount_i = null;
}
else {
if (TextResizeDetector.onAvailableCount_i<600) {
TextResizeDetector.onAvailableCount_i++;
setTimeout(onAvailable,200)
}
}
};
setTimeout(onAvailable,500);
return {
/*
* Initializes the detector
*
* @param {String} sId The id of the element in which to
* create the control element
*/
init: function() {
createControlElement();
_startDetector();
},
/**
* Adds listeners to the ontextsizechange event.
* Returns the base font size
*
*/
addEventListener:function(fn,obj,bScope) {
aListeners[aListeners.length] = {
fn: fn,
obj: obj
}
return iBase;
},
/**
* performs the detection and fires textSizeChanged event
* @return the current font size
* @type {integer}
*/
detect:function() {
return _detect();
},
/**
* Returns the height of the control element
*
* @return the current height of control element
* @type {integer}
*/
getSize:function() {
var iSize;
return el.offsetHeight;
},
/**
* Stops the detector
*/
stopDetector:function() {
return _stopDetector();
},
/*
* Starts the detector
*/
startDetector:function() {
return _startDetector();
}
}
}();
TextResizeDetector.TARGET_ELEMENT_ID = 'doc';
TextResizeDetector.USER_INIT_FUNC = null;
// Setup the font-resize listener
function init()
{
var iBase = TextResizeDetector.addEventListener(onFontResize,null);
}
function onFontResize(e,args)
{
adjustRepeatTableWidth();
}
//id of element to check for and insert control
TextResizeDetector.TARGET_ELEMENT_ID = 'repeatTable';
//function to call once TextResizeDetector has init'd
TextResizeDetector.USER_INIT_FUNC = init;
/**
** Our code to handle page specific elements
**/
// Setup the table expansion/collapse handler
function toggleDiv(divid){
if(document.getElementById(divid).style.display == 'none'){
document.getElementById(divid).style.display = 'block';
}else{
document.getElementById(divid).style.display = 'none';
}
}
// Setup the table resize method
function adjustRepeatTableWidth()
{
var numInsertionLevels = 3;
var pixelPaddingPerLevel = 10;
var objColHeaderText = document.getElementById("colHeaderText");
if ( objColHeaderText != null )
{
var newWidth = objColHeaderText.offsetWidth +
( pixelPaddingPerLevel * (numInsertionLevels - 1) ) + 30;
document.getElementById("repeatTable").style.width = newWidth + "px";
}
}
function toggleAllHsps()
{
var idx = 1;
while( document.getElementById('hsps'+idx) != null ) {
toggleDiv( 'hsps'+idx );
idx++;
}
return false;
}
function openAllHsps(){
var idx = 1;
while( document.getElementById('hsps'+idx) != null ) {
document.getElementById('hsps'+idx).style.display = 'block';
idx++;
}
return false;
}
function closeAllHsps(){
var idx = 1;
while( document.getElementById('hsps'+idx) != null ) {
document.getElementById('hsps'+idx).style.display = 'none';
idx++;
}
return false;
}
</script>
<body onload="adjustRepeatTableWidth()">
<a href="javascript:;" onmousedown="closeAllHsps();">[ close all hsps ]</a>
<a href="javascript:;" onmousedown="openAllHsps();">[ open all hsps ]</a>