Changeset 31385 for other-projects/hathitrust/wcsa
- Timestamp:
- 2017-02-02T23:40:09+13:00 (7 years ago)
- Location:
- other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.html
r31384 r31385 167 167 <input type="hidden" id="wt" name="wt" value="json"/> 168 168 <input type="hidden" id="start" name="start" value="0"/> 169 <input type="hidden" id="rows" name="rows" value="2 5"/>169 <input type="hidden" id="rows" name="rows" value="20"/> 170 170 <input type="text" id="q" name="q" style="width: 600px;"/> 171 171 <input type="submit" id="search-submit" /> … … 265 265 --> 266 266 267 <div id="search-results-anchor"> 268 </div> 269 267 270 <fieldset> 268 271 <legend style="margin-bottom: 5px; padding-top: 15px;"> -
other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.js
r31384 r31385 3 3 var langs_with_pos =["en","de","pt","da","nl"]; 4 4 var langs_without_pos =["af","ar","bg","bn","cs","el","es","et","fa","fi","fr","he","hi","hr","hu","id","it","ja","kn","ko","lt","lv","mk","ml","mr","ne","no","pa","pl","ro","ru","sk","sl","so","sq","sv","sw","ta","te","th","tl","tr","uk","ur","vi","zh-cn","zh-tw"]; 5 6 var num_rows = 20; 5 7 6 8 function lang_pos_toggle(event) { … … 39 41 } 40 42 43 function show_new_results(delta) 44 { 45 store_search_args.start += delta; 46 47 $.ajax({ 48 type: 'GET', 49 url: store_search_action, 50 data: store_search_args, 51 dataType: 'json', 52 success: show_results, 53 error: ajax_error 54 }); 55 } 56 41 57 function show_results(jsonData) { 42 58 var response = jsonData.response; … … 48 64 if (num_docs>0) { 49 65 $search_results.html("<p>Results: " + num_found + " volumes/documents matched</p>"); 50 $search_results.append("<p>Showing matches: 1-" + num_docs + "</p>"); 66 var from = parseInt(store_search_args.start)+1; 67 var to = from + num_rows; 68 $search_results.append("<p>Showing matches: "+from+"-" + to + "</p>"); 51 69 } 52 70 else { … … 54 72 } 55 73 74 56 75 // https://babel.hathitrust.org/cgi/pt?id=hvd.hnnssu;view=1up;seq=11 57 76 … … 78 97 } 79 98 99 document.location.href="#search-results-anchor"; 100 101 var next_prev = '<p style="width:100%;"><div id="search-prev" style="float: left;"><a>< Previous</a></div><div id="search-next" style="float: right;"><a>Next ></a></div></p>'; 102 103 $search_results.append(next_prev); 104 $('#search-prev').click(function(event) { show_new_results(-1*num_rows); }); 105 $('#search-next').click(function(event) { show_new_results(num_rows); }); 106 107 var search_start = store_search_args.start; 108 if (search_start==0) { 109 $('#search-prev').hide(); 110 } 111 80 112 // Example URL for catalog metadata (multiple items) 81 113 // http://catalog.hathitrust.org/api/volumes/brief/json/id:552;lccn:70628581|isbn:0030110408 … … 94 126 } 95 127 128 var store_search_args = null; 129 var store_search_action = null; 130 96 131 function submit_action(event) 97 132 { 98 133 event.preventDefault(); 99 134 100 varaction = $('#search-form').attr("action");135 store_search_action = $('#search-form').attr("action"); 101 136 102 137 var arg_indent = $('#indent').attr('value'); … … 157 192 // q=xxxxen_NOUN_htrctoken:farming 158 193 159 varargs = { q: arg_q, indent: arg_indent, wt: arg_wt, start: arg_start, rows: arg_rows };194 store_search_args = { q: arg_q, indent: arg_indent, wt: arg_wt, start: arg_start, rows: arg_rows }; 160 195 161 196 $.ajax({ 162 197 type: 'GET', 163 url: action,164 data: args,198 url: store_search_action, 199 data: store_search_args, 165 200 dataType: 'json', 166 201 success: show_results, … … 256 291 for (var i=0; i<langs_without_pos.length; i++) { 257 292 var lang = langs_without_pos[i]; 258 $other_langs.append('<input type="checkbox" name="'+lang+'-enabled" id="'+lang+'-enabled" />'); 293 //var labeled_checkbox = '<span style="white-space:nowrap;">\n'; 294 var labeled_checkbox = '<nobr>'; 295 296 labeled_checkbox += '<input type="checkbox" name="'+lang+'-enabled" id="'+lang+'-enabled" />'; 259 297 /* 260 298 if (lang === "zh-cn") { … … 271 309 var opt_title = (lang_full !== lang_native_full) ? 'title="'+lang_native_full+'"' : ""; 272 310 273 $other_langs.append('<span style="padding-right: 10px;" ' + opt_title + '>'+lang_full+'</span> '); 311 labeled_checkbox += '<label for="'+lang+'-enabled" style="padding-left: 5px; padding-right: 10px;" ' + opt_title + '>'+lang_full+'</label>'; 312 //labeled_checkbox += '</span>\n'; 313 labeled_checkbox += '</nobr> '; 314 315 $other_langs.append(labeled_checkbox); 274 316 275 317 }
Note:
See TracChangeset
for help on using the changeset viewer.