1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00
Raymond Hill 2018-10-15 14:15:00 -03:00
parent f38df80959
commit c192045e1d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 20 additions and 12 deletions

View File

@ -44,22 +44,27 @@
color: #888;
font-size: 140%;
}
.cm-search-widget > span {
position: relative;
.cm-search-widget-input {
border: 1px solid gray;
border-radius: 3px;
display: inline-flex;
min-width: 16em;
}
.cm-search-widget .cm-search-widget-count {
.cm-search-widget-input > input {
border: 0;
flex-grow: 1;
}
.cm-search-widget-input > .cm-search-widget-count {
align-items: center;
bottom: 0;
color: #888;
display: none;
margin-right: 4px;
flex-grow: 0;
font-size: 80%;
padding: 0 0.4em;
pointer-events: none;
position: absolute;
right: 0;
top: 0;
}
.cm-search-widget[data-query] .cm-search-widget-count {
display: flex;
display: inline-flex;
}
.cm-search-widget .cm-search-widget-button:hover {
color: #000;

View File

@ -54,8 +54,8 @@
var searchWidgetHtml =
'<div class="cm-search-widget">' +
'<span class="fa">&#xf002;</span>&ensp;' +
'<span>' +
'<input type="text" size="20">' +
'<span class="cm-search-widget-input">' +
'<input type="text">' +
'<span class="cm-search-widget-count">' +
'<span><!-- future use --></span><span>0</span>' +
'</span>' +
@ -211,11 +211,14 @@
state.query,
queryCaseInsensitive(state.query)
);
var count = state.annotate.matches.length;
let count = state.annotate.matches.length;
state.widget
.querySelector('.cm-search-widget-count > span:nth-of-type(2)')
.textContent = count > 1000 ? '1000+' : count;
state.widget.setAttribute('data-query', state.queryText);
// Ensure the caret is visible
let input = state.widget.querySelector('.cm-search-widget-input > input');
input.selectionStart = input.selectionStart;
}
}