cleaning out scripts
git-svn-id: file:///home/shish/svn/shimmie2/trunk@80 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
c25427a5d1
commit
5c16e860a1
1 changed files with 0 additions and 70 deletions
|
@ -4,8 +4,6 @@ window.onload = function(e) {
|
|||
var sections=get_sections();
|
||||
for(var i=0;i<sections.length;i++) toggle(sections[i]);
|
||||
|
||||
// initAjax("searchBox", "search_completions");
|
||||
// initAjax("tagBox", "upload_completions");
|
||||
initGray("search_input", "Search");
|
||||
initGray("commentBox", "Comment");
|
||||
initGray("tagBox", "tagme");
|
||||
|
@ -18,60 +16,6 @@ window.onload = function(e) {
|
|||
}
|
||||
|
||||
|
||||
function endWord(sentance) {
|
||||
words = sentance.split(" ");
|
||||
return words[words.length-1];
|
||||
}
|
||||
|
||||
var resultCache = new Array();
|
||||
resultCache[""] = new Array();
|
||||
|
||||
function complete(boxname, text) {
|
||||
box = byId(boxname);
|
||||
words = box.value.split(" ");
|
||||
box.value = "";
|
||||
for(n=0; n<words.length-1; n++) {
|
||||
box.value += words[n]+" ";
|
||||
}
|
||||
box.value += text+" ";
|
||||
box.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
function fillCompletionZone(boxname, areaname, results) {
|
||||
byId(areaname).innerHTML = "";
|
||||
for(i=0; i<results.length; i++) {
|
||||
byId(areaname).innerHTML += "<br><a href=\"#\" onclick=\"complete('"+boxname+"', '"+results[i]+"');\">"+results[i]+"</a>";
|
||||
}
|
||||
}
|
||||
|
||||
function initAjax(boxname, areaname) {
|
||||
var box = byId(boxname);
|
||||
if(!box) return;
|
||||
|
||||
addEvent(
|
||||
box,
|
||||
"keyup",
|
||||
function f() {
|
||||
starter = endWord(box.value);
|
||||
|
||||
if(resultCache[starter]) {
|
||||
fillCompletionZone(boxname, areaname, resultCache[starter]);
|
||||
}
|
||||
else {
|
||||
ajaxRequest(
|
||||
"ajax.php?start="+starter,
|
||||
function g(text) {
|
||||
resultCache[starter] = text.split("\n");
|
||||
fillCompletionZone(boxname, areaname, resultCache[starter]);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
function initGray(boxname, text) {
|
||||
var box = byId(boxname);
|
||||
if(!box) return;
|
||||
|
@ -115,17 +59,3 @@ function showUp(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function check_int(box, min, max) {
|
||||
check(box, (box.value >= min && box.value <= max));
|
||||
}
|
||||
|
||||
function check(box, bool) {
|
||||
if(bool) {
|
||||
box.style.background = "#AFA";
|
||||
}
|
||||
else {
|
||||
box.style.background = "#FAA";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue