Index: trunk/extensions/Wikidata/OmegaWiki/resources/omegawiki-ajax.js |
— | — | @@ -11,6 +11,17 @@ |
12 | 12 | }, function(){ //On Hover Out |
13 | 13 | $(this).parent().find("ul.wd-dropdownlist").hide(); |
14 | 14 | }); |
| 15 | + |
| 16 | + // sticky explang |
| 17 | + var explangUrl = document.URL.match( /explang=\d+/gi ) ; |
| 18 | + if ( explangUrl!=null ) { |
| 19 | + var explangNb = explangUrl[0].replace("explang=","") ; |
| 20 | + $("#ca-edit, #ca-history, #ca-view").find("a").attr( "href", function(i, val) { |
| 21 | + var bigoudi = '&' ; |
| 22 | + if ( val.match( /\?/gi ) == null ) bigoudi = '?' ; |
| 23 | + return val + bigoudi + 'explang=' + explangNb ; |
| 24 | + }); |
| 25 | + } |
15 | 26 | }); // jQuery |
16 | 27 | |
17 | 28 | //TODO: convert the functions below to jQuery... |
Index: trunk/extensions/Wikidata/OmegaWiki/resources/suggest.js |
— | — | @@ -81,6 +81,27 @@ |
82 | 82 | //alert(http.responseText); |
83 | 83 | if (http.responseText != '') { |
84 | 84 | newTable.innerHTML = leftTrim(http.responseText); |
| 85 | + |
| 86 | + // put the searched text in bold within the returned string |
| 87 | + if ( suggestTextVal != "" ) { |
| 88 | + var langnames = newTable.getElementsByTagName('td') ; |
| 89 | + var searchTxt = new String ( suggestTextVal ) ; |
| 90 | + // normalizeText removes diacritics (cf. omegawiki-ajax.js) |
| 91 | + searchTxt = normalizeText ( searchTxt.toLowerCase() ) ; |
| 92 | + |
| 93 | + for ( i=0 ; i < langnames.length ; i++ ) { |
| 94 | + var searchInTxt = normalizeText ( langnames[i].innerHTML.toLowerCase() ) ; |
| 95 | + var position = searchInTxt.indexOf( searchTxt ); |
| 96 | + if ( position >= 0 ) { |
| 97 | + langnames[i].innerHTML = langnames[i].innerHTML.substr(0,position) |
| 98 | + + "<b>" |
| 99 | + + langnames[i].innerHTML.substr( position, searchTxt.length) |
| 100 | + + "</b>" |
| 101 | + + langnames[i].innerHTML.substr( position + searchTxt.length ) ; |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | + |
85 | 106 | table.parentNode.replaceChild(newTable.firstChild, table); |
86 | 107 | } |
87 | 108 | suggestText.className = ""; |
— | — | @@ -226,9 +247,12 @@ |
227 | 248 | for (var i = 0; i < displayLabelColumnIndices.length; i++) { |
228 | 249 | var columnValue = suggestRow.getElementsByTagName('td')[displayLabelColumnIndices[i]].innerHTML; |
229 | 250 | |
230 | | - if (columnValue != "") |
| 251 | + if (columnValue != "") { |
| 252 | + columnValue = columnValue.replace ("<b>",""); |
| 253 | + columnValue = columnValue.replace ("</b>",""); |
231 | 254 | labels.push(columnValue); |
232 | | - } |
| 255 | + } |
| 256 | + } |
233 | 257 | |
234 | 258 | var idColumns = 1; |
235 | 259 | |