Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit f1bbb1fe authored by Marc Duez's avatar Marc Duez

database.js : upgrade suggestion box, access to complete suggestion list

parent 0399dc31
...@@ -1185,7 +1185,7 @@ select>option:hover { ...@@ -1185,7 +1185,7 @@ select>option:hover {
.suggest_box { .suggest_box {
height: 0px; height: 0px;
display: none; display: block;
position: relative; position: relative;
} }
...@@ -1196,5 +1196,33 @@ select>option:hover { ...@@ -1196,5 +1196,33 @@ select>option:hover {
background: @background; background: @background;
border-color: @border; border-color: @border;
max-height: 100px; max-height: 100px;
display: block; display: none;
width : 250px;
}
.suggest_arrow {
position : absolute;
width : 12px;
height : 16px;
top : -22px;
right : 0px;
cursor : pointer;
background: url("icon/arrow-down.png") 50% 50% no-repeat;
}
.suggestion {
cursor : pointer;
}
.suggestion:hover {
background : @highlight;
}
input:focus, textarea:focus {
border-color: @border;
-webkit-box-shadow: inset 0 1px 1px @background, 0 0 8px @border;
-moz-box-shadow: inset 0 1px 1px @background, 0 0 8px @border;
box-shadow: inset 0 1px 1px @background, 0 0 8px @border;
outline: 0;
outline: thin dotted \9;
} }
\ No newline at end of file
...@@ -499,12 +499,32 @@ function suggest_box(id, list) { ...@@ -499,12 +499,32 @@ function suggest_box(id, list) {
//positionnement d'une boite vide pour contenir les suggestions //positionnement d'une boite vide pour contenir les suggestions
var suggest_box = document.createElement('div') var suggest_box = document.createElement('div')
suggest_box.className = "suggest_box" suggest_box.className = "suggest_box"
suggest_box.style.width = input_box.style.width suggest_box.style.width = getComputedStyle(input_box,null).width
var suggest_list = document.createElement('div') var suggest_list = document.createElement('div')
suggest_list.className = "suggest_list" suggest_list.className = "suggest_list"
suggest_box.appendChild(suggest_list) suggest_box.appendChild(suggest_list)
var suggest_arrow = document.createElement('div')
suggest_arrow.className = "suggest_arrow"
suggest_arrow.title = "show all suggestions"
suggest_arrow.onclick = function(){
suggest_list.style.display = "block"
suggest_list.innerHTML=""
input_box.focus()
for (var i=0; i<list.length; i++){
var suggestion = document.createElement("div")
suggestion.className = "suggestion"
suggestion.appendChild(document.createTextNode(list[i]))
suggestion.onclick = function(){
input_box.value = this.innerHTML
setTimeout(function(){suggest_list.style.display = "none"}, 200)
}
suggest_list.appendChild(suggestion)
}
}
suggest_box.appendChild(suggest_arrow)
//ajout de la suggest_box apres l'input correspondant //ajout de la suggest_box apres l'input correspondant
if (input_box.nextSibling) { if (input_box.nextSibling) {
input_box.parentNode.insertBefore(suggest_box, input_box.nextSibling); input_box.parentNode.insertBefore(suggest_box, input_box.nextSibling);
...@@ -514,17 +534,18 @@ function suggest_box(id, list) { ...@@ -514,17 +534,18 @@ function suggest_box(id, list) {
//réactualise la liste a chaque changement d'input //réactualise la liste a chaque changement d'input
input_box.onkeyup = function(){ input_box.onkeyup = function(){
suggest_box.style.display = "block" suggest_list.style.display = "block"
suggest_list.innerHTML="" suggest_list.innerHTML=""
var value = this.value.toUpperCase(); var value = this.value.toUpperCase();
var count = 0 var count = 0
for (var i=0; i<list.length; i++){ for (var i=0; i<list.length; i++){
if (list[i].toUpperCase().indexOf(value) != -1){ if (list[i].toUpperCase().indexOf(value) != -1){
var suggestion = document.createElement("div") var suggestion = document.createElement("div")
suggestion.className = "suggestion"
suggestion.appendChild(document.createTextNode(list[i])) suggestion.appendChild(document.createTextNode(list[i]))
suggestion.onclick = function(){ suggestion.onclick = function(){
input_box.value = this.innerHTML input_box.value = this.innerHTML
setTimeout(function(){suggest_box.style.display = "none"}, 200) setTimeout(function(){suggest_list.style.display = "none"}, 200)
} }
suggest_list.appendChild(suggestion) suggest_list.appendChild(suggestion)
count++ count++
...@@ -539,6 +560,6 @@ function suggest_box(id, list) { ...@@ -539,6 +560,6 @@ function suggest_box(id, list) {
//masque la liste //masque la liste
input_box.onblur = function(){ input_box.onblur = function(){
setTimeout(function(){suggest_box.style.display = "none"}, 200) setTimeout(function(){suggest_list.style.display = "none"}, 200)
}; };
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment