//var langs_with_pos =["da","de","en","nl","pt"]; var langs_with_pos =["en","de","pt","da","nl"]; 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"]; function lang_pos_toggle(event) { var $this =$(this); var checked_state = $this.prop("checked"); var id = $this.attr("id"); var split_id = id.split("-"); var related_id = split_id[0] + "-pos-choice"; //console.log("checked state = " + checked_state); var disable_state = !checked_state; $('#'+related_id + " *").prop('disabled',disable_state); }; function ajax_error(jqXHR, textStatus, errorThrown) { alert('An error occurred... Look at the console (F12 or Ctrl+Shift+I, Console tab) for more information!'); console.log('jqXHR:' + jqXHR); console.log('textStatus:' + textStatus); console.log('errorThrown:' + errorThrown); } function add_titles(json_data) { $.each( json_data, function( htid_with_prefix, htid_val ) { var htid = htid_with_prefix.replace(/^htid:/,""); $.each(htid_val.records, function( internalid, metadata ) { var title = metadata.titles[0]; $("[name='"+htid+"']").each(function() {$(this).html(title)}); console.log(htid + ", title = " + metadata.titles[0]); }); }); } function show_results(jsonData) { var response = jsonData.response; var num_found = response.numFound; var docs = response.docs; var num_docs = docs.length; var $search_results = $('#search-results'); if (num_docs>0) { $search_results.html("
Results: " + num_found + " volumes/documents matched
"); $search_results.append("Showing matches: 1-" + num_docs + "
"); } else { $search_results.html("No volumes/documents matched your query
"); } // https://babel.hathitrust.org/cgi/pt?id=hvd.hnnssu;view=1up;seq=11 var htids = []; for (var i=0; i'+result_item+'
'); htids.push("htid:"+id); } // Example URL for catalog metadata (multiple items) // http://catalog.hathitrust.org/api/volumes/brief/json/id:552;lccn:70628581|isbn:0030110408 var htids_str = htids.join("|",htids); var cat_url = "http://catalog.hathitrust.org/api/volumes/brief/json/" + htids_str; $.ajax({ url: cat_url, dataType: 'jsonp', jsonpCallback: "add_titles" }); //var json_pretty = JSON.stringify(jsonData.response, null, '\t'); //$('#search-results').text(json_pretty) } function submit_action(event) { event.preventDefault(); var action = $('#search-form').attr("action"); var arg_indent = $('#indent').attr('value'); var arg_wt = $('#wt').attr('value'); var arg_start = $('#start').attr('value'); var arg_rows = $('#rows').attr('value'); var q_text = $('#q').val(); if (q_text === "") { alert("No query term entered"); return; } var fields = []; //var langs_with_pos = [ "da", "de", "en", "nl", "pt", "se" ]; var universal_pos_tags = [ "VERB", "NOUN", "ADJ", "ADV", "ADP", "CONJ", "DET", "NUM", "PRT", "X" ]; for (var li=0; li