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 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
|
// FIXME:
// It still does not update icons previous to a type/member name when
// certain icon kinds are unchecked (when an item has "todo" and "missing",
// the default display is "missing" and when "missing" is unchecked it
// should turn into "todo").
function toggle (elt)
{
if (elt == null)
return;
var eltLink = firstElement (elt);
if (eltLink != null && eltLink.className == 't') // toggle
{
var ich = elt.className.indexOf ('_');
if (ich < 0)
{
eltLink.src = 'tp.gif';
elt.className += '_';
}
else
{
eltLink.src = 'tm.gif';
elt.className = elt.className.slice (0, ich);
}
}
}
function setView (elt, fView)
{
var eltLink = firstElement (elt);
if (eltLink != null && eltLink.className == 't') // toggle
{
var ich = elt.className.indexOf ('_');
if (ich < 0 && !fView)
{
eltLink.src = 'tp.gif';
elt.className += '_';
}
else if (ich >= 0 && fView)
{
eltLink.src = 'tm.gif';
elt.className = elt.className.slice (0, ich);
}
}
}
function firstElement (elt)
{
var c = elt.firstChild;
while (c != null) {
if (c.nodeType == 1) // Node.ELEMENT_NODE (IE6 does not recognize it)
return c;
c = c.nextSibling;
}
return null;
}
function trimSrc (strSrc)
{
return strSrc.slice (strSrc.lastIndexOf ('/') + 1, strSrc.lastIndexOf ('.'));
}
function getChildrenByTagName (elt, strTag)
{
strTag = strTag.toLowerCase ();
var rgChildren = new Array ();
var eltChild = firstElement (elt);
while (eltChild)
{
if (eltChild.tagName && eltChild.tagName.toLowerCase () == strTag)
rgChildren.push (eltChild);
eltChild = eltChild.nextSibling;
}
return rgChildren;
}
function viewAll (elt, dictTypes)
{
var fView = isShown (elt, dictTypes);
var aCounts = new Array (4);
for (i = 0; i < 4; i++)
aCounts [i] = 0;
var rgElts = getChildrenByTagName (elt, 'DIV');
for (iElt in rgElts) {
var aChildRet = viewAll (rgElts [iElt], dictTypes);
if (aChildRet != null) {
fView = true;
for (i = 0; i < 4; i++)
aCounts [i] += aChildRet [i];
}
}
elt.style.display = fView ? '' : 'none';
if (!fView)
return null;
rgShownDivs = getChildrenByTagName (elt, 'DIV');
for (i = 0; i < rgShownDivs.length; i++) {
var cDiv = rgShownDivs [i];
if (cDiv.style.display == 'none')
continue;
incrementCount (cDiv, aCounts, dictTypes);
}
// update the numbers
rgSpans = getChildrenByTagName (elt, 'SPAN');
for (iSpan in rgSpans) {
var cSpan = rgSpans [iSpan];
var cImage = firstElement (cSpan);
if (cImage == null)
continue;
switch (trimSrc (cImage.src)) {
case 'st': cSpan.lastChild.nodeValue = ": " + aCounts [0]; break;
case 'sm': cSpan.lastChild.nodeValue = ": " + aCounts [1]; break;
case 'sx': cSpan.lastChild.nodeValue = ": " + aCounts [2]; break;
case 'se': cSpan.lastChild.nodeValue = ": " + aCounts [3]; break;
}
}
return aCounts;
}
function isShown (elt, dictTypes)
{
if (!isShownMarkType (elt, dictTypes))
return false;
return true;
}
function isShownMarkType (elt, dictTypes)
{
var rgImages = getChildrenByTagName (elt, 'IMG');
var cImages = rgImages.length;
for (var iImage = 0; iImage < cImages; iImage++)
{
var strImage = trimSrc (rgImages [iImage].src);
if (dictTypes [strImage])
return true;
}
return false;
}
function incrementCount (cDiv, aCounts, dictTypes)
{
switch (cDiv.className) {
case 'y': case 'y_': // assembly
case 'n': case 'n_': // namespace
// types
case 'c': case 'c_': case 'i': case 'i_':
case 'en': case 'en_': case 'd': case 'd_':
// members
case 'r': case 'r_': case 'x': case 'x_': case 'm': case 'm_':
case 'f': case 'f_': case 'e': case 'e_': case 'p': case 'p_':
case 'o': case 'o_': case 'a': case 'a_':
var rgImgs = getChildrenByTagName (cDiv, 'IMG');
for (iImg = 0; iImg < rgImgs.length; iImg++) {
var cImg = rgImgs [iImg];
if (cImg.className != 't')
continue;
var stype = trimSrc (cImg.src);
if (!dictTypes [stype])
continue;
switch (stype) {
case "st": aCounts [0]++; break;
case "sm": aCounts [1]++; break;
case "sx": aCounts [2]++; break;
case "se": aCounts [3]++; break;
default:
continue;
}
break;
}
break;
}
}
/* just for debugging use now.
function firstInnerText (elt)
{
var s = elt.innerText;
if (s != null)
return s;
var n = elt.firstChild;
while (n != null) {
s = n.nodeValue;
if (s != null && s.replace (/^\s+/g, '') != '')
return s;
s = firstInnerText (n);
if (s != null)
return s;
n = n.nextSibling;
}
return s;
}
*/
function getView (elt)
{
var eltLink = firstElement (elt);
if (eltLink != null && eltLink.className == 't') // toggle
{
var ich = elt.className.indexOf ('_');
if (ich < 0)
return true;
}
return false;
}
function getParentDiv (elt)
{
if (elt)
{
do
{
elt = elt.parentNode;
}
while (elt && elt.tagName != 'DIV');
}
return elt;
}
function getName (elt)
{
var rgSpans = getChildrenByTagName (elt, 'SPAN');
for (var iSpan = 0; iSpan < rgSpans.length; iSpan ++)
{
var span = rgSpans [iSpan];
if (span.className == 'l') // label
{
if (span.innerText)
return span.innerText;
else
return span.firstChild.nodeValue;
}
}
return null;
}
function clickHandler (evt)
{
var elt;
if (document.layers)
elt = evt.taget;
else if (window.event && window.event.srcElement)
{
elt = window.event.srcElement;
evt = window.event;
}
else if (evt && evt.stopPropagation)
elt = evt.target;
if (!elt.className && elt.parentNode)
elt = elt.parentNode;
if (elt.className == 'l') // label
{
var strClass;
var strField;
var strNamespace;
var strAssembly;
var strFieldType;
elt = getParentDiv (elt);
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'x') // constructor
{
strField = 'ctor';
elt = getParentDiv (elt);
}
else
if (strEltClass == 'm' || // method
strEltClass == 'p' || // property
strEltClass == 'e' || // event
strEltClass == 'f') // field
{
strFieldType = strEltClass;
strField = getName (elt);
var match = strField.match ( /[\.A-Z0-9_]*/i );
if (match)
strField = match [0];
elt = getParentDiv (elt);
}
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'c' || // class
strEltClass == 's' || // struct
strEltClass == 'i' || // struct
strEltClass == 'd' || // delegate
strEltClass == 'en') // enum
{
strClass = getName (elt);
if (strEltClass == 'en')
strField = null;
elt = getParentDiv (elt);
}
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'n')
{
strNamespace = getName (elt);
elt = getParentDiv (elt);
}
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'y')
{
strAssembly = getName (elt);
}
if (evt.ctrlKey)
{
var strRoot = 'http://anonsvn.mono-project.com/viewcvs/trunk/mcs/class/';
var strExtra = '';
if (strAssembly)
{
if (strAssembly == 'mscorlib')
strAssembly = 'corlib';
else if (strAssembly == 'System.Xml')
strAssembly = 'System.XML';
strRoot = strRoot + strAssembly + '/';
if (strNamespace)
{
strRoot = strRoot + strNamespace + '/';
if (strClass)
{
strRoot += strClass + '.cs';
strExtra += '?view=markup';
}
}
window.open (strRoot + strExtra, 'CVS');
}
}
else if (strNamespace)
{
if (document.getElementById ('TargetMsdn1').checked)
{
var re = /\./g ;
strNamespace = strNamespace.toLowerCase ().replace (re, '');
if (strClass)
strNamespace += strClass.toLowerCase () + 'class';
if (strField)
strNamespace += strField;
if (strClass || strField)
strNamespace += 'topic';
window.open ('http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf' + strNamespace + '.asp', 'MSDN');
}
else
{
if (strClass)
strNamespace += '.' + strClass;
if (strField)
strNamespace += '.' + strField;
if (document.getElementById ('TargetMonodoc').checked)
{
var category = null;
if (strClass == null)
category = "N:";
else if (strField == null)
category = "T:";
else {
switch (strFieldType) {
case 'f': category = "F:"; break;
case 'p': category = "P:"; break;
case 'm': category = "M:"; break;
case 'e': category = "E:"; break;
}
}
if (category != null)
window.open ('http://www.go-mono.com/docs/monodoc.ashx?link=' + category + strNamespace);
}
else
{
window.open ('http://msdn2.microsoft.com/library/' + strNamespace + '.aspx', 'MSDN');
}
}
}
}
else
{
if (elt.parentNode && elt.parentNode.className == 't') // toggle
elt = elt.parentNode;
else if (elt.className != 't') // toggle
return;
while (elt != null && elt.tagName != 'DIV')
elt = elt.parentNode;
if (evt.shiftKey)
{
var rgElts = getChildrenByTagName (elt, 'DIV');
var cElts = rgElts.length;
if (cElts != 0)
{
var fView = false;
var iElt;
for (iElt = 0; iElt < cElts; iElt ++)
{
if (getView (rgElts [iElt]))
{
fView = true;
break;
}
}
for (iElt = 0; iElt < cElts; iElt ++)
{
setView (rgElts [iElt], !fView);
}
}
}
else if (evt.ctrlKey)
{
setView (elt, true);
var eltParent = getParentDiv (elt);
while (eltParent)
{
var rgSiblings = getChildrenByTagName (eltParent, 'DIV');
var cSiblings = rgSiblings.length;
for (var iSibling = 0; iSibling < cSiblings; iSibling++)
{
var eltSibling = rgSiblings [iSibling];
if (eltSibling != elt)
{
setView (eltSibling, false);
}
}
elt = eltParent;
eltParent = getParentDiv (elt);
}
}
else
toggle (elt);
}
return false;
}
function filterTree ()
{
var eltMissing = document.getElementById ('missing');
var eltTodo = document.getElementById ('todo');
var eltExtra = document.getElementById ('extra');
var eltErrors = document.getElementById ('errors');
var eltStable = document.getElementById ('stable');
var dictTypes = new Object ();
if (eltMissing.checked)
dictTypes ['sm'] = true;
if (eltTodo.checked)
dictTypes ['st'] = true;
if (eltErrors.checked)
dictTypes ['se'] = true;
if (eltExtra.checked)
dictTypes ['sx'] = true;
if (eltStable.checked)
dictTypes ['sc'] = true;
viewAll (document.getElementById ('ROOT'), dictTypes);
}
function addAndFilter ()
{
var newInput = document.getElementById ('NewFilterTarget');
var newAttr = newInput.value;
if (newAttr.length > 0) {
var selection = document.getElementById ('FilteredAttributes');
var newElem = document.createElement ('option');
newElem.appendChild (document.createTextNode (newAttr));
selection.appendChild (newElem);
newInput.value = '';
filterTree ();
}
}
function removeAndFilter ()
{
var selection = document.getElementById ('FilteredAttributes');
if (selection.selectedIndex >= 0) {
var newInput = document.getElementById ('NewFilterTarget');
if (newInput.value.length == 0)
newInput.value = selection.options [selection.selectedIndex].firstChild.nodeValue;
selection.removeChild (selection.options [selection.selectedIndex]);
filterTree ();
}
}
function selectMissing ()
{
toggleFilter ('missing');
}
function selectTodo ()
{
toggleFilter ('todo');
}
function selectExtra ()
{
toggleFilter ('extra');
}
function selectErrors ()
{
toggleFilter ('errors');
}
function selectStable ()
{
toggleFilter ('stable');
}
function toggleAttributeFilter (attrName)
{
toggleFilter (attrName);
}
function toggleFilter (strFilter)
{
var eltTodo = document.getElementById ('todo');
var eltMissing = document.getElementById ('missing');
var eltExtra = document.getElementById ('extra');
var eltErrors = document.getElementById ('errors');
var eltToggle = document.getElementById (strFilter);
if (window && window.event && window.event.shiftKey)
{
eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = false;
eltToggle.checked = true;
}
else
if (!eltTodo.checked && !eltMissing.checked && !eltExtra.checked && !eltErrors.checked)
{
eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
eltToggle.checked = false;
}
filterTree ();
}
function onLoad ()
{
var eltMissing = document.getElementById ('missing');
var eltTodo = document.getElementById ('todo');
var eltExtra = document.getElementById ('extra');
var eltErrors = document.getElementById ('errors');
eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
filterTree ();
}
if (document.layers)
{
document.captureEvents (Event.MOUSEUP);
document.onmouseup = clickHandler;
}
else if (document.attachEvent)
{
document.attachEvent('onclick', clickHandler);
}
else if (document.addEventListener)
{
document.addEventListener('click', clickHandler, false);
}
else
document.onclick = clickHandler;
|