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
});
147 function getQuerystring(key
)
149 key
= key
.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
150 var regex
= new RegExp("[\\?&]"+key
+"=([^&#]*)");
151 var qs
= regex
.exec(window
.location
.href
);
159 helpRoot
="."; fixTOC();
160 newinput
= document
.getElementById("search_input").value
;
163 for(var i
=0;i
<fields
.length
;i
++) {
164 checkboxes
[i
] = document
.getElementById("check_"+fields
[i
]);
167 var x
= ["check_extensions", "check_methods","ignore_case","check_word","check_prefix","check_suffix","check_title","check_summary","check_categories"];
168 for(var i
=0;i
<x
.length
;i
++) {
169 document
.getElementById(x
[i
]).onchange
= doSearch
;
172 for(var i
=0;i
<x
.length
;i
++) {
174 var val
= getQuerystring(name
);
176 document
.getElementById(name
).checked
= true;
177 else if(val
== "false")
178 document
.getElementById(name
).checked
= false;
181 document
.getElementById("check_regexp").onchange = function(e
) {
182 var x
= document
.getElementsByClassName("nonregex");
183 for(var i
=0;i
<x
.length
;i
++) {
184 x
[i
].disabled
= e
.target
.checked
;
189 document
.getElementById("search_input").focus();
191 node
= document
.getElementById("search_results");
197 filter
= document
.getElementById("menu_filter");
198 filter
.onchange
= doSearch
;
200 setInterval(delayed_update
,250);
203 function checkHash() {
204 var x
= unescape(window
.location
.hash
.slice(1));
205 if(x
!="" && newinput
!=x
) {
206 document
.getElementById("search_input").value
= x
;
208 // window.location.hash = "";
212 function SearchKeyPressed(e
) {
214 if(newinput
!= input
) {
215 document
.getElementById("search_results").innerHTML
= "Searching...";
219 /*function updateHash() {
220 if(window.location.hash != input)
221 window.location.hash = input;
225 function matchDoc(doc
,file
,folder
,re
) {
226 doc
.matched_kw
= null;
228 if(filter
.value
!= "all") {
229 if(folder
.toLowerCase() != filter
.value
)
233 if(doc
.installed
=="extension" && !document
.getElementById("check_extensions").checked
)
236 for(var i
=0;i
<fields
.length
;i
++) {
238 if(checkboxes
[i
].checked
&& doc
.hasOwnProperty(f
) && re
.test(doc
[f
])) {
239 doc
.match_weight
= i
;
244 if(doc
.hasOwnProperty('keywords')) {
245 for(var i
=0;i
<doc
.keywords
.length
;i
++) {
246 var kw
= doc
.keywords
[i
];
249 doc
.match_weight
= fields
.length
;
261 var inProgress
= false;
267 var subclassCache
= {};
269 function strCmp(a
,b
) {
277 function getSubClasses(doc
) {
280 for(var i
=0;i
<doc
.subclasses
.length
;i
++) {
281 var x
= doc
.subclasses
[i
];
282 var v
= docmap
["Classes/"+x
];
285 a
= a
.concat(getSubClasses(v
));
292 var now
= Date
.now();
294 for(; cindex
<docs
.length
; cindex
++) {
295 var k
= docs
[cindex
][0];
296 var c
= docs
[cindex
][1];
298 var div
= document
.createElement("div");
299 div
.className
="result_category";
300 if(!k
) k
= "(uncategorized)";
302 node
.appendChild(div
);
304 for(;cindex2
<c
.length
;cindex2
++) {
306 var x
= v
.path
.split("/");
307 var div
= document
.createElement("div");
308 div
.className
= "result_item";
310 var n
= document
.createElement("a");
312 n
.setAttribute("href",v
.path
+".html#kw_"+v
.matched_kw
);
314 n
.setAttribute("href",v
.path
+".html");
316 n
.innerHTML
= v
.title
;
318 div
.appendChild(document
.createTextNode(" - "+v
.summary
+" "));
320 if(v
.installed
!="standard") {
321 var n
= document
.createElement("span");
322 n
.className
= "soft";
324 if(v
.installed
=="extension")
326 else if(v
.installed
=="missing")
328 n
.innerHTML
= res
+"]";
333 node
.appendChild(div
);
335 if(Date
.now()-now
> 200) {
346 var div
= document
.createElement("div");
347 div
.className
="result_category";
348 div
.innerHTML
= "Methods";
349 node
.appendChild(div
);
352 for(;mindex
<mets
.length
; mindex
++) {
353 var mname
= mets
[mindex
][0]; //name
354 var div
= document
.createElement("div");
355 div
.className
= "result_item";
356 var x
= document
.createElement("div");
357 x
.appendChild(document
.createTextNode(mname
));
358 x
.className
= "result_met";
360 var cnt
= document
.createElement("span");
361 cnt
.className
= "soft";
362 cnt
.innerHTML
= " ("+mets
[mindex
][1].length
+" matches)";
365 var x
= mets
[mindex
][1].sort(function(a
,b
) { //document list
366 a
= a
.pfx
+ a
.doc
.title
;
367 b
= b
.pfx
+ b
.doc
.title
;
371 for(var i
=0;i
<x
.length
;i
++) {
375 var div2
= document
.createElement("div");
376 div2
.className
= "met_docs";
377 div
.appendChild(div2
);
381 div2
.appendChild(document
.createTextNode(p
+" "));
382 var a
= document
.createElement("a");
383 a
.setAttribute("href",helpRoot
+"/"+v
.path
+".html#"+m
.pfx
+mname
);
384 a
.innerHTML
= v
.title
;
387 div2
.appendChild(document
.createTextNode("+"));
388 div2
.appendChild(document
.createTextNode(" - "+v
.summary
+" "));
389 var n
= document
.createElement("span");
390 n
.className
= "soft";
391 var res
= "["+v
.path
.split("/")[0];
392 if(v
.installed
=="extension")
394 else if(v
.installed
=="missing")
395 res
+= " - missing!";
396 n
.innerHTML
= res
+"]";
398 if(v
.path
=="Classes/Object") {
399 var n
= document
.createElement("div");
400 n
.className
= "met_subclasses";
401 n
.appendChild(document
.createTextNode("Inherited by: All classes"));
404 if(v
.subclasses
&& v
.subclasses
.length
>0) {
406 if(subclassCache
[v
.path
]) {
407 n
= subclassCache
[v
.path
].cloneNode(true);
409 var subs
= getSubClasses(v
);
410 n
= document
.createElement("div");
412 n
.className
= "met_subclasses";
413 n
.appendChild(document
.createTextNode("Inherited by: "));
414 for(var j
=0;j
<subs
.length
;j
++) {
415 var a
= document
.createElement("a");
416 a
.setAttribute("href", helpRoot
+"/Classes/"+subs
[j
]+".html");
417 if(j
==10 && subs
.length
> 14) {
418 m
= document
.createElement("span");
419 m
.className
= "hiddenspan";
420 m
.style
.display
= "none";
422 var a2
= document
.createElement("a");
423 a2
.setAttribute("href","#");
424 a2
.className
= "seemore";
425 a2
.innerHTML
= "… see "+(subs
.length
-10)+" more";
426 n
.appendChild(document
.createTextNode(" "));
430 m
.appendChild(document
.createTextNode(", "));
431 a
.innerHTML
= subs
[j
];
434 subclassCache
[v
.path
] = n
;
437 var a
= n
.getElementsByClassName("seemore")[0];
439 var m
= n
.getElementsByClassName("hiddenspan")[0];
440 a
.onclick = function() {
441 m
.style
.display
= "";
442 a
.parentNode
.removeChild(a
);
452 node
.appendChild(div
);
454 if(Date
.now()-now
> 200) {
462 function randomDoc() {
463 while(node
.hasChildNodes())
464 node
.removeChild(node
.lastChild
);
472 document
.getElementById("search_input").value
= "";
475 for(var k
in docmap
) {
476 if(docmap
.hasOwnProperty(k
))
477 list
.push(docmap
[k
]);
480 for(var i
=0;i
<100;i
++) {
481 var v
= list
[Math
.floor(Math
.random()*list
.length
)];
482 if(! /Undocumented classes/.test(v
.categories
)) {
483 docs
= [[v
.path
.split("/")[0],[v
]]];
490 document
.getElementById("search_count").innerHTML
= "random document";
493 function doSearch() {
496 while(node
.hasChildNodes())
497 node
.removeChild(node
.lastChild
);
511 if(!document
.getElementById("check_regexp").checked
) {
512 str
= escape_regexp(str
); //escape special chars
513 if(document
.getElementById("check_word").checked
)
514 str
= "\\b" + str
+ "\\b";
515 if(document
.getElementById("check_prefix").checked
)
517 if(document
.getElementById("check_suffix").checked
)
520 re
= RegExp(str
,document
.getElementById("ignore_case").checked
?"i":"");
522 document
.getElementById("search_count").innerHTML
= "Invalid regexp";
523 document
.getElementById("search_results").innerHTML
= err
;
529 for(var k
in docmap
) {
531 var x
= v
.path
.split("/");
533 var file
= x
[x
.length
-1];
535 if(matchDoc(v
,file
,folder
,re
)) {
536 if(!docs
.hasOwnProperty(folder
))
538 docs
[folder
].push(v
);
542 var tmp
= []; for(var k
in docs
) tmp
.push(
543 [k
, docs
[k
].sort(function(a
,b
) {
549 var order
= { Classes
:1, Reference
:2, Overviews
:3, Guides
:4, Tutorials
:5 };
550 docs
= tmp
.sort(function(a
,b
) {
551 a
= order
[a
[0]] || 10;
552 b
= order
[b
[0]] || 10;
557 var include_ext_classes
= document
.getElementById("check_extensions").checked
;
558 var filter_val
= filter
.value
;
559 if(document
.getElementById("check_methods").checked
) {
560 for(var mname
in methods
) {
561 var m
= methods
[mname
];
564 for(var i
=0;i
<m
.length
;i
++) {
567 if(doc
.installed
== "extension" && !include_ext_classes
) continue;
568 if(filter_val
!= "all" && doc
.path
.split("/")[0].toLowerCase() != filter_val
) continue
572 mets
.push([mname
,c
]);
578 mets
= mets
.sort(function(a
,b
) {
588 document
.getElementById("search_count").innerHTML
= count
+" results";
591 function delayed_update() {
592 if(input
!= newinput
) {
595 } else if(inProgress
) {
599 window
.onhashchange
= checkHash
;
604 <ul id=
"menubar"></ul>
605 <body onload=
"onLoad()">
606 <div class='contents'
>
608 <div id='label'
>SuperCollider
</div>
610 <div id='summary'
>Search all documents
</div>
612 <div id=
"search_checks0">
614 <select id=
"menu_filter">
615 <option SELECTED
value=
"all">All documents
</option>
616 <option value=
"classes">Classes only
</option>
617 <option value=
"reference">Reference only
</option>
618 <option value=
"guides">Guides only
</option>
619 <option value=
"tutorials">Tutorials only
</option>
620 <option value=
"overviews">Overviews only
</option>
621 <option value=
"other">Other only
</option>
623 <input type=
"checkbox" id=
"check_extensions" checked=
"true">Include extensions
</input>
626 <div id=
"search_box">
627 Search text:
<input type=
"text" id=
"search_input" value=
"" size=
"40" onkeyup=
"SearchKeyPressed(this)"/>
630 <table id=
"search_settings">
633 <div id=
"search_checks">
634 <input type=
"checkbox" id=
"ignore_case" checked=
"true">Ignore case
</input>
635 <input class=
"nonregex" type=
"checkbox" id=
"check_word">Whole word
</input>
636 <input class=
"nonregex" type=
"checkbox" id=
"check_prefix">Starts with
</input>
637 <input class=
"nonregex" type=
"checkbox" id=
"check_suffix">Ends with
</input>
638 <input type=
"checkbox" id=
"check_regexp">Regexp
</input>
643 <div id=
"search_checks">
644 <input type=
"checkbox" id=
"check_title" checked=
"true">Title/Class
</input>
645 <input type=
"checkbox" id=
"check_summary" checked=
"true">Summary
</input>
646 <input type=
"checkbox" id=
"check_categories">Categories
</input>
647 <input type=
"checkbox" id=
"check_methods" checked=
"true">Methods
</input>
650 <div id=
"random"><a href=
"javascript:randomDoc()">random page
</a></div>
651 <div id=
"search_count">0 results
</div>
652 <div id=
"search_results"></div>
653 <div id=
"js_error"></div>