diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js index e1cffc202..a0c7c18a8 100644 --- a/htroot/js/yacysearch.js +++ b/htroot/js/yacysearch.js @@ -1,3 +1,56 @@ +function Progressbar(length, parent) { + // the description, should be translated + var DESCRIPTION_STRING = "Loading results..."; + + // the number of steps of the bar + this.length = length; + // the current position, expressed in steps (so 100% = length) + this.position = 0; + // the current percentage of the bar + this.percentage = 0 + + + // use this function to display the progress, because it updates everything + this.step = function(count) { + this.position += count; + // update the bar + this.percentage = this.position*(100/this.length); + this.fill.style.width = this.percentage + "%"; + + // if the end is reached, the bar is hidden/removed + if(this.position==this.length) + removeAllChildren(this.element); + } + + // the actual progressbar + var bar = document.createElement("div"); + bar.className = "ProgressBar"; + bar.style.width = "100%"; + bar.style.height = "20px"; + bar.style.margin = "10px auto"; + bar.style.textAlign = "left"; + + // the actual bar + this.fill = document.createElement("div"); + this.fill.className = "ProgressBarFill"; + this.fill.style.width = "0%" + bar.appendChild(this.fill); + + // a description for the bar + var description = document.createTextNode(DESCRIPTION_STRING); + var textcontainer = document.createElement("strong"); + textcontainer.appendChild(description); + + // the container for the elements used by the Progressbar + this.element = document.createElement("div"); + this.element.style.textAlign = "center"; + // get hasLayout in IE, needed because of the percentage as width of the bar + this.element.className = "gainlayout"; + this.element.appendChild(textcontainer); + this.element.appendChild(bar); + parent.appendChild(this.element); +} + function AllTextSnippets(query) { var span = document.getElementsByTagName("span"); for(var x=0;x 0) { - div.className = "snippetLoaded"; - for (i = 0; i < links; i++) { - var type = response.getElementsByTagName("type")[i].firstChild.data; - var href = response.getElementsByTagName("href")[i].firstChild.data; - var name = response.getElementsByTagName("name")[i].firstChild.data; - var attr = response.getElementsByTagName("attr")[i].firstChild.data; + if (links > 0) { + for (i = 0; i < links; i++) { + var type = response.getElementsByTagName("type")[i].firstChild.data; + var href = response.getElementsByTagName("href")[i].firstChild.data; + var name = response.getElementsByTagName("name")[i].firstChild.data; + var attr = response.getElementsByTagName("attr")[i].firstChild.data; //
#[name]# - var img = document.createElement("img"); - img.setAttribute("src", "/ViewImage.png?maxwidth=96&maxheight=96&url=" + href); - img.setAttribute("alt", name); + var img = document.createElement("img"); + img.setAttribute("src", "/ViewImage.png?maxwidth=96&maxheight=96&url=" + href); + img.setAttribute("alt", name); - var imganchor = document.createElement("a"); - imganchor.setAttribute("href", href); - imganchor.className = "thumblink"; - imganchor.appendChild(img); + var imganchor = document.createElement("a"); + imganchor.setAttribute("href", href); + imganchor.className = "thumblink"; + imganchor.appendChild(img); - var nameanchor = document.createElement("a"); - nameanchor.setAttribute("href", href); - nameanchor.appendChild(document.createTextNode(name)); + var nameanchor = document.createElement("a"); + nameanchor.setAttribute("href", href); + nameanchor.appendChild(document.createTextNode(name)); - var textcontainer = document.createElement("div"); - textcontainer.className = "TableCellDark"; - textcontainer.appendChild(nameanchor); + var textcontainer = document.createElement("div"); + textcontainer.className = "TableCellDark"; + textcontainer.appendChild(nameanchor); - var thumbcontainer = document.createElement("div"); - thumbcontainer.className = "thumbcontainer"; - thumbcontainer.appendChild(imganchor); - thumbcontainer.appendChild(textcontainer); - div.appendChild(thumbcontainer); - //span.appendChild(imganchor); - } - } else { - div.className = "snippetError"; - div.appendChild(document.createTextNode("")); - } + var thumbcontainer = document.createElement("div"); + thumbcontainer.className = "thumbcontainer"; + thumbcontainer.appendChild(imganchor); + thumbcontainer.appendChild(textcontainer); + div.appendChild(thumbcontainer); + //span.appendChild(imganchor); + + document.getElementById("linkcount").innerHTML ++ + } + } + } + progressbar.step(1); } diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index 6e2998f9d..e213bad6a 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -193,17 +193,27 @@ document.getElementById("Enter").value = "search again - catch up more links"; :: - - #{results}# - -
loading snippet from #[urlname]#
- - #{/results}# - + + +
+
+
::