|
Lines 26-54
$(document).ready(function(){
Link Here
|
| 26 |
} |
26 |
} |
| 27 |
|
27 |
|
| 28 |
// remove any error states and show the results area (except right pane) |
28 |
// remove any error states and show the results area (except right pane) |
| 29 |
$('#browse-suggestionserror').addClass('hidden'); |
29 |
$('#browse-suggestionserror').addClass('d-none'); |
| 30 |
$('#browse-searchresults .no-results').addClass('hidden'); |
30 |
$('#browse-searchresults .no-results').addClass('d-none'); |
| 31 |
$('#browse-resultswrapper').removeClass('hidden'); |
31 |
$('#browse-resultswrapper').removeClass('d-none'); |
| 32 |
$('#browse-selection').addClass('hidden').text(""); |
32 |
$('#browse-selection').addClass('d-none').text(""); |
| 33 |
$('#browse-selectionsearch').addClass('hidden'); |
33 |
$('#browse-selectionsearch').addClass('d-none'); |
| 34 |
|
34 |
|
| 35 |
// clear any results from left and right panes |
35 |
// clear any results from left and right panes |
| 36 |
leftPaneResults.remove(); |
36 |
leftPaneResults.remove(); |
| 37 |
rightPaneResults.remove(); |
37 |
rightPaneResults.remove(); |
| 38 |
|
38 |
|
| 39 |
// show the spinner in the left pane |
39 |
// show the spinner in the left pane |
| 40 |
$('#browse-searchresults .loading').removeClass('hidden'); |
40 |
$('#browse-searchresults .loading').removeClass('d-none'); |
| 41 |
|
41 |
|
| 42 |
xhrGetSuggestions = $.get(window.location.pathname, {api: "GetSuggestions", field: userField, prefix: userInput, fuzziness: userFuzziness}) |
42 |
xhrGetSuggestions = $.get(window.location.pathname, {api: "GetSuggestions", field: userField, prefix: userInput, fuzziness: userFuzziness}) |
| 43 |
.always(function() { |
43 |
.always(function() { |
| 44 |
// hide spinner |
44 |
// hide spinner |
| 45 |
$('#browse-searchresults .loading').addClass('hidden'); |
45 |
$('#browse-searchresults .loading').addClass('d-none'); |
| 46 |
}) |
46 |
}) |
| 47 |
.done(function(data) { |
47 |
.done(function(data) { |
| 48 |
var fragment = document.createDocumentFragment(); |
48 |
var fragment = document.createDocumentFragment(); |
| 49 |
|
49 |
|
| 50 |
if (data.length === 0) { |
50 |
if (data.length === 0) { |
| 51 |
$('#browse-searchresults .no-results').removeClass('hidden'); |
51 |
$('#browse-searchresults .no-results').removeClass('d-none'); |
| 52 |
|
52 |
|
| 53 |
return; |
53 |
return; |
| 54 |
} |
54 |
} |
|
Lines 75-82
$(document).ready(function(){
Link Here
|
| 75 |
.fail(function(jqXHR) { |
75 |
.fail(function(jqXHR) { |
| 76 |
//if 500 or 404 (abort is okay though) |
76 |
//if 500 or 404 (abort is okay though) |
| 77 |
if (jqXHR.statusText !== "abort") { |
77 |
if (jqXHR.statusText !== "abort") { |
| 78 |
$('#browse-resultswrapper').addClass('hidden'); |
78 |
$('#browse-resultswrapper').addClass('d-none'); |
| 79 |
$('#browse-suggestionserror').removeClass('hidden'); |
79 |
$('#browse-suggestionserror').removeClass('d-none'); |
| 80 |
} |
80 |
} |
| 81 |
}); |
81 |
}); |
| 82 |
}); |
82 |
}); |
|
Lines 99-129
$(document).ready(function(){
Link Here
|
| 99 |
$(this).addClass('selected'); |
99 |
$(this).addClass('selected'); |
| 100 |
|
100 |
|
| 101 |
// copy in the clicked text |
101 |
// copy in the clicked text |
| 102 |
$('#browse-selection').removeClass('hidden').text(term); |
102 |
$('#browse-selection').removeClass('d-none').text(term); |
| 103 |
|
103 |
|
| 104 |
// show the right hand pane if it is not shown already |
104 |
// show the right hand pane if it is not shown already |
| 105 |
$('#browse-selectionsearch').removeClass('hidden'); |
105 |
$('#browse-selectionsearch').removeClass('d-none'); |
| 106 |
|
106 |
|
| 107 |
// hide the no results element |
107 |
// hide the no results element |
| 108 |
$('#browse-selectionsearch .no-results').addClass('hidden'); |
108 |
$('#browse-selectionsearch .no-results').addClass('d-none'); |
| 109 |
|
109 |
|
| 110 |
// clear results |
110 |
// clear results |
| 111 |
rightPaneResults.remove(); |
111 |
rightPaneResults.remove(); |
| 112 |
|
112 |
|
| 113 |
// turn the spinner on |
113 |
// turn the spinner on |
| 114 |
$('#browse-selectionsearch .loading').removeClass('hidden'); |
114 |
$('#browse-selectionsearch .loading').removeClass('d-none'); |
| 115 |
|
115 |
|
| 116 |
// do the query for the term |
116 |
// do the query for the term |
| 117 |
xhrGetResults = $.get(window.location.pathname, {api: "GetResults", field: field, term: term}) |
117 |
xhrGetResults = $.get(window.location.pathname, {api: "GetResults", field: field, term: term}) |
| 118 |
.always(function() { |
118 |
.always(function() { |
| 119 |
// hide spinner |
119 |
// hide spinner |
| 120 |
$('#browse-selectionsearch .loading').addClass('hidden'); |
120 |
$('#browse-selectionsearch .loading').addClass('d-none'); |
| 121 |
}) |
121 |
}) |
| 122 |
.done(function(data) { |
122 |
.done(function(data) { |
| 123 |
var fragment = document.createDocumentFragment(); |
123 |
var fragment = document.createDocumentFragment(); |
| 124 |
|
124 |
|
| 125 |
if (data.length === 0) { |
125 |
if (data.length === 0) { |
| 126 |
$('#browse-selectionsearch .no-results').removeClass('hidden'); |
126 |
$('#browse-selectionsearch .no-results').removeClass('d-none'); |
| 127 |
|
127 |
|
| 128 |
return; |
128 |
return; |
| 129 |
} |
129 |
} |
|
Lines 162-169
$(document).ready(function(){
Link Here
|
| 162 |
.fail(function(jqXHR) { |
162 |
.fail(function(jqXHR) { |
| 163 |
//if 500 or 404 (abort is okay though) |
163 |
//if 500 or 404 (abort is okay though) |
| 164 |
if (jqXHR.statusText !== "abort") { |
164 |
if (jqXHR.statusText !== "abort") { |
| 165 |
$('#browse-resultswrapper').addClass('hidden'); |
165 |
$('#browse-resultswrapper').addClass('d-none'); |
| 166 |
$('#browse-suggestionserror').removeClass('hidden'); |
166 |
$('#browse-suggestionserror').removeClass('d-none'); |
| 167 |
} |
167 |
} |
| 168 |
}); |
168 |
}); |
| 169 |
|
169 |
|
| 170 |
- |
|
|