4 <link rel='stylesheet' href='./scdoc.css' type='text/css'
/>
5 <meta http-equiv='Content-Type' content='text/html; charset=UTF-
8'
/>
6 <script src=
"docmap.js" type=
"text/javascript"></script>
7 <script src=
"scdoc.js" type=
"text/javascript"></script>
8 <!-- <script src="methods.js" type="text/javascript"></script>-->
15 border:
1px solid #aaa;
20 border-bottom:
2px solid #aaa;
29 font-family: Andale Mono, monospace;
40 border-bottom:
1px solid #ccc;*/
46 /* margin-left:
2em;*/
54 div.met_subclasses a {
57 div.met_subclasses a.seemore {
64 padding-bottom:
0.25em;
72 border-bottom:
1px solid #ddd;
76 table#search_settings {
84 border-collapse: collapse;
95 font-family: Andale Mono, monospace;
102 <p>The search page needs JavaScript.
105 <script type=
"text/javascript">
109 var fields
= ["title","summary","categories"];
111 //var docmapdict = {};
113 escape_regexp = function(str
) {
114 var specials
= new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
115 return str
.replace(specials
, "\\$&");
118 function debug(str
) {
119 document
.getElementById("js_error").innerHTML
+= str
+ "<br>"
123 function buildMethodList() {
125 for(var k
in docmap
) {
127 var mets
= doc
.methods
;
129 for(var j
=0;j
<mets
.length
;j
++) {
131 var mname
= m
.slice(2);
134 if(!methods
.hasOwnProperty(mname
))
136 if(!methods
[mname
].push
) {
137 debug("Problem with method '"+mname
+"' in "+doc
.path
);
138 debug(methods
[mname
].toString());
140 methods
[mname
].push({doc
:doc
,pfx
:pfx
,ext
:ext
});
148 helpRoot
="."; fixTOC();
149 newinput
= document
.getElementById("search_input").value
;
152 for(var i
=0;i
<fields
.length
;i
++) {
153 checkboxes
[i
] = document
.getElementById("check_"+fields
[i
]);
154 checkboxes
[i
].onchange
= doSearch
;
157 var x
= ["check_extensions", "check_methods","ignore_case","check_word","check_prefix","check_suffix"];
158 for(var i
=0;i
<x
.length
;i
++) {
159 document
.getElementById(x
[i
]).onchange
= doSearch
;
162 document
.getElementById("check_regexp").onchange = function(e
) {
163 var x
= document
.getElementsByClassName("nonregex");
164 for(var i
=0;i
<x
.length
;i
++) {
165 x
[i
].disabled
= e
.target
.checked
;
170 document
.getElementById("search_input").focus();
172 node
= document
.getElementById("search_results");
178 filter
= document
.getElementById("menu_filter");
179 filter
.onchange
= doSearch
;
181 setInterval(delayed_update
,250);
184 function checkHash() {
185 var x
= unescape(window
.location
.hash
.slice(1));
186 if(x
!="" && newinput
!=x
) {
187 document
.getElementById("search_input").value
= x
;
189 window
.location
.hash
= "";
193 function SearchKeyPressed(e
) {
195 if(newinput
!= input
) {
196 document
.getElementById("search_results").innerHTML
= "Searching...";
200 /*function updateHash() {
201 if(window.location.hash != input)
202 window.location.hash = input;
206 function matchDoc(doc
,file
,folder
,re
) {
207 doc
.matched_kw
= null;
209 if(filter
.value
!= "all") {
210 if(folder
.toLowerCase() != filter
.value
)
214 if(doc
.installed
=="extension" && !document
.getElementById("check_extensions").checked
)
217 for(var i
=0;i
<fields
.length
;i
++) {
219 if(checkboxes
[i
].checked
&& doc
.hasOwnProperty(f
) && re
.test(doc
[f
])) {
220 doc
.match_weight
= i
;
225 if(doc
.hasOwnProperty('keywords')) {
226 for(var i
=0;i
<doc
.keywords
.length
;i
++) {
227 var kw
= doc
.keywords
[i
];
230 doc
.match_weight
= fields
.length
;
242 var inProgress
= false;
248 var subclassCache
= {};
250 function getSubClasses(doc
) {
253 for(var i
=0;i
<doc
.subclasses
.length
;i
++) {
254 var x
= doc
.subclasses
[i
];
255 var v
= docmap
["Classes/"+x
];
258 a
= a
.concat(getSubClasses(v
));
265 var now
= Date
.now();
267 for(; cindex
<docs
.length
; cindex
++) {
268 var k
= docs
[cindex
][0];
269 var c
= docs
[cindex
][1];
271 var div
= document
.createElement("div");
272 div
.className
="result_category";
273 if(!k
) k
= "(uncategorized)";
275 node
.appendChild(div
);
277 for(;cindex2
<c
.length
;cindex2
++) {
279 var x
= v
.path
.split("/");
280 var div
= document
.createElement("div");
281 div
.className
= "result_item";
283 var n
= document
.createElement("a");
285 n
.setAttribute("href",v
.path
+".html#kw_"+v
.matched_kw
);
287 n
.setAttribute("href",v
.path
+".html");
289 n
.innerHTML
= v
.title
;
291 div
.appendChild(document
.createTextNode(" - "+v
.summary
+" "));
293 if(v
.installed
!="standard") {
294 var n
= document
.createElement("span");
295 n
.className
= "soft";
297 if(v
.installed
=="extension")
299 else if(v
.installed
=="missing")
301 n
.innerHTML
= res
+"]";
306 node
.appendChild(div
);
308 if(Date
.now()-now
> 200) {
319 var div
= document
.createElement("div");
320 div
.className
="result_category";
321 div
.innerHTML
= "Methods";
322 node
.appendChild(div
);
325 for(;mindex
<mets
.length
; mindex
++) {
326 var mname
= mets
[mindex
][0]; //name
327 var div
= document
.createElement("div");
328 div
.className
= "result_item";
329 var x
= document
.createElement("div");
330 x
.appendChild(document
.createTextNode(mname
));
331 x
.className
= "result_met";
334 var x
= mets
[mindex
][1].sort(function(a
,b
) { //document list
335 a
= a
.pfx
+ a
.doc
.title
;
336 b
= b
.pfx
+ b
.doc
.title
;
344 for(var i
=0;i
<x
.length
;i
++) {
348 var div2
= document
.createElement("div");
349 div2
.className
= "met_docs";
350 div
.appendChild(div2
);
354 div2
.appendChild(document
.createTextNode(p
+" "));
355 var a
= document
.createElement("a");
356 a
.setAttribute("href",helpRoot
+"/"+v
.path
+".html#"+m
.pfx
+mname
);
357 a
.innerHTML
= v
.title
;
360 div2
.appendChild(document
.createTextNode("+"));
361 div2
.appendChild(document
.createTextNode(" - "+v
.summary
+" "));
362 var n
= document
.createElement("span");
363 n
.className
= "soft";
364 var res
= "["+v
.path
.split("/")[0];
365 if(v
.installed
=="extension")
367 else if(v
.installed
=="missing")
368 res
+= " - missing!";
369 n
.innerHTML
= res
+"]";
371 if(v
.path
=="Classes/Object") {
372 var n
= document
.createElement("div");
373 n
.className
= "met_subclasses";
374 n
.appendChild(document
.createTextNode("Inherited by: All classes"));
377 if(v
.subclasses
&& v
.subclasses
.length
>0) {
379 if(subclassCache
[v
.path
]) {
380 n
= subclassCache
[v
.path
].cloneNode(true);
382 var subs
= getSubClasses(v
);
383 n
= document
.createElement("div");
385 n
.className
= "met_subclasses";
386 n
.appendChild(document
.createTextNode("Inherited by: "));
387 for(var j
=0;j
<subs
.length
;j
++) {
388 var a
= document
.createElement("a");
389 a
.setAttribute("href", helpRoot
+"/Classes/"+subs
[j
]+".html");
390 if(j
==10 && subs
.length
> 14) {
391 m
= document
.createElement("span");
392 m
.className
= "hiddenspan";
393 m
.style
.display
= "none";
395 var a2
= document
.createElement("a");
396 a2
.setAttribute("href","#");
397 a2
.className
= "seemore";
398 a2
.innerHTML
= "… see "+(subs
.length
-10)+" more";
399 n
.appendChild(document
.createTextNode(" "));
403 m
.appendChild(document
.createTextNode(", "));
404 a
.innerHTML
= subs
[j
];
407 subclassCache
[v
.path
] = n
;
410 var a
= n
.getElementsByClassName("seemore")[0];
412 var m
= n
.getElementsByClassName("hiddenspan")[0];
413 a
.onclick = function() {
414 m
.style
.display
= "";
415 a
.parentNode
.removeChild(a
);
425 node
.appendChild(div
);
427 if(Date
.now()-now
> 200) {
435 function randomDoc() {
436 while(node
.hasChildNodes())
437 node
.removeChild(node
.lastChild
);
445 document
.getElementById("search_input").value
= "";
448 for(var k
in docmap
) {
449 if(docmap
.hasOwnProperty(k
))
450 list
.push(docmap
[k
]);
453 for(var i
=0;i
<100;i
++) {
454 var v
= list
[Math
.floor(Math
.random()*list
.length
)];
455 if(! /Undocumented classes/.test(v
.categories
)) {
456 docs
= [[v
.path
.split("/")[0],[v
]]];
463 document
.getElementById("search_count").innerHTML
= "random document";
466 function doSearch() {
469 while(node
.hasChildNodes())
470 node
.removeChild(node
.lastChild
);
484 if(!document
.getElementById("check_regexp").checked
) {
485 str
= escape_regexp(str
); //escape special chars
486 if(document
.getElementById("check_word").checked
)
487 str
= "\\b" + str
+ "\\b";
488 if(document
.getElementById("check_prefix").checked
)
490 if(document
.getElementById("check_suffix").checked
)
493 re
= RegExp(str
,document
.getElementById("ignore_case").checked
?"i":"");
495 document
.getElementById("search_count").innerHTML
= "Invalid regexp";
496 document
.getElementById("search_results").innerHTML
= err
;
502 for(var k
in docmap
) {
504 var x
= v
.path
.split("/");
506 var file
= x
[x
.length
-1];
508 if(matchDoc(v
,file
,folder
,re
)) {
509 if(!docs
.hasOwnProperty(folder
))
511 docs
[folder
].push(v
);
515 var tmp
= []; for(var k
in docs
) tmp
.push(
516 [k
, docs
[k
].sort(function(a
,b
) {
526 var order
= { Classes
:1, Reference
:2, Overviews
:3, Guides
:4, Tutorials
:5 };
527 docs
= tmp
.sort(function(a
,b
) {
528 a
= order
[a
[0]] || 10;
529 b
= order
[b
[0]] || 10;
538 var include_ext_classes
= document
.getElementById("check_extensions").checked
;
539 var filter_val
= filter
.value
;
540 if(document
.getElementById("check_methods").checked
) {
541 for(var mname
in methods
) {
542 var m
= methods
[mname
];
545 for(var i
=0;i
<m
.length
;i
++) {
548 if(doc
.installed
== "extension" && !include_ext_classes
) continue;
549 if(filter_val
!= "all" && doc
.path
.split("/")[0].toLowerCase() != filter_val
) continue
553 mets
.push([mname
,c
]);
564 document
.getElementById("search_count").innerHTML
= count
+" results";
567 function delayed_update() {
568 if(input
!= newinput
) {
571 } else if(inProgress
) {
575 window
.onhashchange
= checkHash
;
580 <ul id=
"menubar"></ul>
581 <body onload=
"onLoad()">
582 <div class='contents'
>
584 <div id='label'
>SuperCollider
</div>
586 <div id='summary'
>Search all documents
</div>
588 <div id=
"search_checks0">
590 <select id=
"menu_filter">
591 <option SELECTED
value=
"all">All documents
</option>
592 <option value=
"classes">Classes only
</option>
593 <option value=
"reference">Reference only
</option>
594 <option value=
"guides">Guides only
</option>
595 <option value=
"tutorials">Tutorials only
</option>
596 <option value=
"overviews">Overviews only
</option>
597 <option value=
"other">Other only
</option>
599 <input type=
"checkbox" id=
"check_extensions" checked=
"true">Include extensions
</input>
602 <div id=
"search_box">
603 Search text:
<input type=
"text" id=
"search_input" value=
"" size=
"40" onkeyup=
"SearchKeyPressed(this)"/>
606 <table id=
"search_settings">
609 <div id=
"search_checks">
610 <input type=
"checkbox" id=
"ignore_case" checked=
"true">Ignore case
</input>
611 <input class=
"nonregex" type=
"checkbox" id=
"check_word">Whole word
</input>
612 <input class=
"nonregex" type=
"checkbox" id=
"check_prefix">Starts with
</input>
613 <input class=
"nonregex" type=
"checkbox" id=
"check_suffix">Ends with
</input>
614 <input type=
"checkbox" id=
"check_regexp">Regexp
</input>
619 <div id=
"search_checks">
620 <input type=
"checkbox" id=
"check_title" checked=
"true">Title/Class
</input>
621 <input type=
"checkbox" id=
"check_summary" checked=
"true">Summary
</input>
622 <input type=
"checkbox" id=
"check_categories">Categories
</input>
623 <input type=
"checkbox" id=
"check_methods" checked=
"true">Methods
</input>
626 <div id=
"random"><a href=
"javascript:randomDoc()">random page
</a></div>
627 <div id=
"search_count">0 results
</div>
628 <div id=
"search_results"></div>
629 <div id=
"js_error"></div>