[31383] | 1 |
|
---|
[31619] | 2 | var langs_with_pos = [ "en","de","pt","da","nl", "sv" ];
|
---|
[31383] | 3 |
|
---|
[31619] | 4 | var langs_without_pos = [
|
---|
| 5 | "af","ar","bg","bn","cs","el","es","et","fa","fi","fr","he","hi","hr","hu",
|
---|
| 6 | "id","it","ja","kn","ko","lt","lv","mk","ml","mr","ne","no","pa","pl",
|
---|
| 7 | "ro","ru","sk","sl","so","sq","sv","sw","ta","te","th","tl","tr",
|
---|
| 8 | "uk","ur","vi","zh-cn","zh-tw" ];
|
---|
| 9 |
|
---|
[31385] | 10 | var num_rows = 20;
|
---|
| 11 |
|
---|
[31383] | 12 | function lang_pos_toggle(event) {
|
---|
| 13 | var $this =$(this);
|
---|
| 14 | var checked_state = $this.prop("checked");
|
---|
| 15 |
|
---|
| 16 | var id = $this.attr("id");
|
---|
| 17 | var split_id = id.split("-");
|
---|
| 18 | var related_id = split_id[0] + "-pos-choice";
|
---|
| 19 |
|
---|
| 20 | var disable_state = !checked_state;
|
---|
| 21 | $('#'+related_id + " *").prop('disabled',disable_state);
|
---|
[31619] | 22 | }
|
---|
[31383] | 23 |
|
---|
| 24 | function ajax_error(jqXHR, textStatus, errorThrown) {
|
---|
| 25 | alert('An error occurred... Look at the console (F12 or Ctrl+Shift+I, Console tab) for more information!');
|
---|
| 26 |
|
---|
| 27 | console.log('jqXHR:' + jqXHR);
|
---|
| 28 | console.log('textStatus:' + textStatus);
|
---|
| 29 | console.log('errorThrown:' + errorThrown);
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | function add_titles(json_data) {
|
---|
| 34 | $.each( json_data, function( htid_with_prefix, htid_val ) {
|
---|
| 35 | var htid = htid_with_prefix.replace(/^htid:/,"");
|
---|
| 36 |
|
---|
| 37 | $.each(htid_val.records, function( internalid, metadata ) {
|
---|
| 38 | var title = metadata.titles[0];
|
---|
| 39 | $("[name='"+htid+"']").each(function() {$(this).html(title)});
|
---|
| 40 | console.log(htid + ", title = " + metadata.titles[0]);
|
---|
| 41 | });
|
---|
| 42 | });
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[31385] | 45 | function show_new_results(delta)
|
---|
| 46 | {
|
---|
[31524] | 47 | $('.search-in-progress').css("cursor","wait");
|
---|
[31613] | 48 |
|
---|
| 49 | var start = parseInt(store_search_args.start)
|
---|
[31524] | 50 |
|
---|
[31613] | 51 | store_search_args.start = start + parseInt(delta);
|
---|
[31385] | 52 |
|
---|
| 53 | $.ajax({
|
---|
| 54 | type: 'GET',
|
---|
| 55 | url: store_search_action,
|
---|
| 56 | data: store_search_args,
|
---|
| 57 | dataType: 'json',
|
---|
| 58 | success: show_results,
|
---|
| 59 | error: ajax_error
|
---|
| 60 | });
|
---|
| 61 | }
|
---|
| 62 |
|
---|
[31524] | 63 | function generate_item(line,id,id_pages)
|
---|
| 64 | {
|
---|
| 65 | var css_class = (line%2 == 0) ? 'class="evenline"' : 'class="oddline"';
|
---|
| 66 |
|
---|
| 67 | var html_item = "";
|
---|
| 68 |
|
---|
| 69 | var id_pages_len = id_pages.length;
|
---|
| 70 |
|
---|
| 71 | for (var pi=0; pi<id_pages_len; pi++) {
|
---|
| 72 | var page = id_pages[pi];
|
---|
| 73 |
|
---|
[31613] | 74 | var seqnum = page;
|
---|
[31524] | 75 | var babel_url = "https://babel.hathitrust.org/cgi/pt?id="+id+";view=1up;seq="+seqnum;
|
---|
| 76 |
|
---|
| 77 | if (id_pages_len>1) {
|
---|
| 78 |
|
---|
| 79 | if (pi==0) {
|
---|
| 80 | html_item += '<p ' + css_class + '>';
|
---|
[31619] | 81 | html_item += '<span style="font-style: italic;" name="'
|
---|
| 82 | +id+'"><span style="cursor: progress;">Loading ...</span></span><br>';
|
---|
[31524] | 83 |
|
---|
[31613] | 84 | html_item += id + ': <a target="_blank" href="' + babel_url + '">seq ' + seqnum + '</a> ';
|
---|
[31524] | 85 | }
|
---|
| 86 | else {
|
---|
[31613] | 87 | html_item += ', <a target="_blank" href="' + babel_url + '">seq ' + seqnum + '</a> ';
|
---|
[31524] | 88 | }
|
---|
| 89 | }
|
---|
| 90 | else {
|
---|
| 91 | html_item += '<p ' + css_class + '>';
|
---|
[31619] | 92 | html_item += ' <span style="font-style: italic;" name="'
|
---|
| 93 | +id+'"><span style="cursor: progress;">Loading ...</span></span><br>';
|
---|
[31613] | 94 | html_item += '<a target="_blank" href="' + babel_url + '">' + id + ', seq ' + seqnum + '</a>';
|
---|
[31524] | 95 | html_item += '</p>';
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | if (id_pages_len>1) {
|
---|
| 101 | html_item += "</p>";
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | return html_item;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
[31570] | 107 |
|
---|
| 108 |
|
---|
[31383] | 109 | function show_results(jsonData) {
|
---|
| 110 | var response = jsonData.response;
|
---|
| 111 | var num_found = response.numFound;
|
---|
| 112 | var docs = response.docs;
|
---|
| 113 | var num_docs = docs.length;
|
---|
| 114 |
|
---|
[31524] | 115 | $('.search-in-progress').css("cursor","auto");
|
---|
| 116 |
|
---|
[31383] | 117 | var $search_results = $('#search-results');
|
---|
[31524] | 118 |
|
---|
[31383] | 119 | if (num_docs>0) {
|
---|
[31524] | 120 | $search_results.html("<p>Results: " + num_found + " pages matched</p>");
|
---|
| 121 | var from = parseInt(store_search_args.start);
|
---|
[31385] | 122 | var to = from + num_rows;
|
---|
| 123 | $search_results.append("<p>Showing matches: "+from+"-" + to + "</p>");
|
---|
[31383] | 124 | }
|
---|
| 125 | else {
|
---|
[31524] | 126 | $search_results.html("<p>No pages matched your query</p>");
|
---|
[31383] | 127 | }
|
---|
| 128 |
|
---|
[31618] | 129 | // Example form of URL
|
---|
| 130 | // https://babel.hathitrust.org/cgi/pt?id=hvd.hnnssu;view=1up;seq=11
|
---|
[31383] | 131 |
|
---|
| 132 | var htids = [];
|
---|
[31524] | 133 |
|
---|
| 134 | var prev_id = null;
|
---|
| 135 | var prev_pages = [];
|
---|
[31383] | 136 |
|
---|
[31524] | 137 | var i=0;
|
---|
| 138 | var line_num = 0;
|
---|
| 139 | while (i<num_docs) {
|
---|
[31383] | 140 | var doc = docs[i];
|
---|
| 141 | var id_and_page = doc.id.split(".page-");
|
---|
| 142 | var id = id_and_page[0];
|
---|
[31613] | 143 | var seqnum = parseInt(id_and_page[1]) +1; // fix up ingest error
|
---|
| 144 | var page = seqnum;
|
---|
[31383] | 145 |
|
---|
[31524] | 146 | if ((prev_id != null) && (id != prev_id)) {
|
---|
| 147 | // time to output previous item
|
---|
| 148 | var html_item = generate_item(line_num,prev_id,prev_pages);
|
---|
| 149 | $search_results.append(html_item);
|
---|
| 150 | line_num++;
|
---|
| 151 | prev_pages = [page];
|
---|
| 152 | }
|
---|
| 153 | else {
|
---|
| 154 | // accumulate pages
|
---|
| 155 | prev_pages.push(page)
|
---|
| 156 | }
|
---|
[31383] | 157 |
|
---|
| 158 | htids.push("htid:"+id);
|
---|
| 159 |
|
---|
[31524] | 160 | prev_id = id;
|
---|
| 161 | i++;
|
---|
[31383] | 162 | }
|
---|
[31524] | 163 |
|
---|
| 164 | var html_item = generate_item(line_num,prev_id,prev_pages);
|
---|
| 165 | $search_results.append(html_item);
|
---|
[31383] | 166 |
|
---|
[31524] | 167 |
|
---|
[31385] | 168 | document.location.href="#search-results-anchor";
|
---|
| 169 |
|
---|
| 170 | 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>';
|
---|
| 171 |
|
---|
| 172 | $search_results.append(next_prev);
|
---|
| 173 | $('#search-prev').click(function(event) { show_new_results(-1*num_rows); });
|
---|
| 174 | $('#search-next').click(function(event) { show_new_results(num_rows); });
|
---|
| 175 |
|
---|
| 176 | var search_start = store_search_args.start;
|
---|
| 177 | if (search_start==0) {
|
---|
| 178 | $('#search-prev').hide();
|
---|
| 179 | }
|
---|
| 180 |
|
---|
[31383] | 181 | // Example URL for catalog metadata (multiple items)
|
---|
[31618] | 182 | // http://catalog.hathitrust.org/api/volumes/brief/json/id:552;lccn:70628581|isbn:0030110408
|
---|
[31383] | 183 |
|
---|
| 184 | var htids_str = htids.join("|",htids);
|
---|
| 185 | var cat_url = "http://catalog.hathitrust.org/api/volumes/brief/json/" + htids_str;
|
---|
| 186 | $.ajax({
|
---|
| 187 | url: cat_url,
|
---|
| 188 | dataType: 'jsonp',
|
---|
| 189 | jsonpCallback: "add_titles"
|
---|
| 190 | });
|
---|
| 191 | }
|
---|
| 192 |
|
---|
[31385] | 193 | var store_search_args = null;
|
---|
| 194 | var store_search_action = null;
|
---|
| 195 |
|
---|
[31524] | 196 | var group_by_vol_checked = 0;
|
---|
| 197 |
|
---|
[31613] | 198 |
|
---|
| 199 | function expand_field_lang_pos(q_text,langs_with_pos,langs_without_pos,search_all_checked)
|
---|
| 200 | {
|
---|
| 201 | var fields = [];
|
---|
| 202 | var universal_pos_tags = [ "VERB", "NOUN", "ADJ", "ADV", "ADP", "CONJ", "DET", "NUM", "PRT", "X" ];
|
---|
| 203 |
|
---|
| 204 | for (var li=0; li<langs_with_pos.length; li++) {
|
---|
| 205 | var lang = langs_with_pos[li];
|
---|
| 206 | var lang_enabled_id = lang + "-enabled";
|
---|
| 207 | var $lang_enabled_cb = $('#'+lang_enabled_id);
|
---|
| 208 | if ($lang_enabled_cb.is(':checked')) {
|
---|
| 209 | console.log("Extracting POS tags for: " + lang);
|
---|
| 210 |
|
---|
| 211 | for (var ti=0; ti<universal_pos_tags.length; ti++) {
|
---|
| 212 | var tag = universal_pos_tags[ti];
|
---|
| 213 | var lang_tag_id = lang+"-"+tag+"-htrctoken-cb";
|
---|
| 214 | var $lang_tag_cb = $('#'+lang_tag_id);
|
---|
| 215 | if (search_all_checked || ($lang_tag_cb.is(':checked'))) {
|
---|
| 216 | var lang_tag_field = lang+"_"+tag+"_htrctoken";
|
---|
| 217 | fields.push(lang_tag_field+":"+q_text);
|
---|
| 218 | }
|
---|
| 219 | }
|
---|
| 220 | }
|
---|
| 221 | }
|
---|
| 222 |
|
---|
| 223 | for (var li=0; li<langs_without_pos.length; li++) {
|
---|
| 224 | var lang = langs_without_pos[li];
|
---|
| 225 | var lang_enabled_id = lang + "-enabled";
|
---|
| 226 | var $lang_enabled_cb = $('#'+lang_enabled_id);
|
---|
| 227 |
|
---|
| 228 | if (search_all_checked || ($lang_enabled_cb.is(':checked'))) {
|
---|
| 229 | console.log("Adding in non-POS field for: " + lang);
|
---|
| 230 | var lang_tag_field = lang+"_htrctoken";
|
---|
| 231 | fields.push(lang_tag_field+":"+q_text);
|
---|
| 232 | }
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | var fields_str = fields.join(" OR ");
|
---|
| 236 |
|
---|
| 237 | return fields_str;
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | function expand_query_field_and_boolean(query,langs_with_pos,langs_without_pos,search_all_checked)
|
---|
| 241 | {
|
---|
| 242 | // boolean terms
|
---|
| 243 | // => pos and lang field
|
---|
| 244 |
|
---|
| 245 | var query_terms = query.split(/\s+/);
|
---|
| 246 | var query_terms_len = query_terms.length;
|
---|
| 247 |
|
---|
| 248 | var bool_query_term = [];
|
---|
| 249 |
|
---|
| 250 | var i=0;
|
---|
| 251 | var prev_bool = "";
|
---|
| 252 |
|
---|
| 253 | for (var i=0; i<query_terms_len; i++) {
|
---|
| 254 | var term = query_terms[i];
|
---|
| 255 | if (term.match(/^(and|or)$/i)) {
|
---|
| 256 | prev_bool = term.toUpperCase();
|
---|
| 257 | }
|
---|
| 258 | else {
|
---|
| 259 | if (i>0) {
|
---|
| 260 | if (prev_bool == "") {
|
---|
| 261 | prev_bool = "AND";
|
---|
| 262 | }
|
---|
| 263 | }
|
---|
| 264 |
|
---|
| 265 | var expanded_term = expand_field_lang_pos(term,langs_with_pos,langs_without_pos,search_all_checked)
|
---|
| 266 |
|
---|
| 267 | term = "(" + expanded_term + ")";
|
---|
| 268 |
|
---|
| 269 | if (prev_bool != "") {
|
---|
| 270 | bool_query_term.push(prev_bool);
|
---|
| 271 | prev_bool = "";
|
---|
| 272 | }
|
---|
| 273 | bool_query_term.push(term);
|
---|
| 274 | }
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | var bool_query = bool_query_term.join(" ");
|
---|
| 278 |
|
---|
| 279 | return bool_query;
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 |
|
---|
[31384] | 283 | function submit_action(event)
|
---|
| 284 | {
|
---|
| 285 | event.preventDefault();
|
---|
[31383] | 286 |
|
---|
[31524] | 287 | $('.search-in-progress').css("cursor","wait");
|
---|
| 288 |
|
---|
[31385] | 289 | store_search_action = $('#search-form').attr("action");
|
---|
[31384] | 290 |
|
---|
| 291 | var arg_indent = $('#indent').attr('value');
|
---|
| 292 | var arg_wt = $('#wt').attr('value');
|
---|
| 293 | var arg_start = $('#start').attr('value');
|
---|
| 294 | var arg_rows = $('#rows').attr('value');
|
---|
| 295 | var q_text = $('#q').val();
|
---|
[31524] | 296 |
|
---|
| 297 | group_by_vol_checked = $('#group-results-by-id:checked').length;
|
---|
[31571] | 298 | var search_all_checked = $('#search-all-langs:checked').length;
|
---|
[31384] | 299 |
|
---|
| 300 | if (q_text === "") {
|
---|
[31524] | 301 | $('.search-in-progress').css("cursor","auto");
|
---|
[31384] | 302 | alert("No query term entered");
|
---|
| 303 | return;
|
---|
| 304 | }
|
---|
[31613] | 305 |
|
---|
| 306 | arg_q = expand_query_field_and_boolean(q_text,langs_with_pos,langs_without_pos,search_all_checked);
|
---|
| 307 |
|
---|
| 308 | if (arg_q == "") {
|
---|
| 309 | $('.search-in-progress').css("cursor","auto");
|
---|
| 310 | alert("No languages selected");
|
---|
| 311 | return;
|
---|
| 312 | }
|
---|
[31384] | 313 |
|
---|
| 314 |
|
---|
| 315 | // Example search on one of the htrc-full-ef fields is:
|
---|
[31524] | 316 | // q=en_NOUN_htrctoken:farming
|
---|
[31384] | 317 |
|
---|
[31385] | 318 | store_search_args = { q: arg_q, indent: arg_indent, wt: arg_wt, start: arg_start, rows: arg_rows };
|
---|
[31524] | 319 |
|
---|
| 320 | if (group_by_vol_checked) {
|
---|
| 321 | store_search_args.sort="id asc";
|
---|
| 322 | }
|
---|
[31384] | 323 |
|
---|
[31524] | 324 |
|
---|
[31384] | 325 | $.ajax({
|
---|
| 326 | type: 'GET',
|
---|
[31385] | 327 | url: store_search_action,
|
---|
| 328 | data: store_search_args,
|
---|
[31384] | 329 | dataType: 'json',
|
---|
| 330 | success: show_results,
|
---|
| 331 | error: ajax_error
|
---|
| 332 | });
|
---|
| 333 |
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | function generate_pos_langs()
|
---|
| 337 | {
|
---|
| 338 | var pos_checkbox = [
|
---|
| 339 | { pos:"VERB", label:"Verbs", tooltip:"Verbs (all tenses and modes)" },
|
---|
| 340 | { pos:"NOUN", label:"Nouns", tooltip:"Nouns (common and proper)" },
|
---|
| 341 | { pos:"ADJ", label:"Adjectives", tooltip: null },
|
---|
| 342 | { pos:"ADV", label:"Adverbs", tooltip: null },
|
---|
| 343 | { pos:"ADP", label:"Adpositions", tooltip:"Adpositions (prepositions and postpositions)" },
|
---|
| 344 | { pos:"CONJ", label:"Conjunctions",tooltip: null },
|
---|
| 345 | { pos:"DET", label:"Determiners", tooltip: null },
|
---|
| 346 | { pos:"NUM", label:"Numbers", tooltip:"Cardinal numbers" },
|
---|
| 347 | { pos:"PRT", label:"Particles", tooltip:"Particles or other function words" },
|
---|
| 348 | { pos:"X", label:"Other", tooltip:"Other words, such as foreign words, typos, abbreviations"}
|
---|
| 349 | ];
|
---|
| 350 |
|
---|
| 351 | var $pos_fieldsets = $('#pos-fieldsets');
|
---|
| 352 |
|
---|
| 353 | for (var li=0; li<langs_with_pos.length; li++) {
|
---|
| 354 |
|
---|
| 355 | var l = langs_with_pos[li];
|
---|
| 356 | var lang_full = isoLangs[l].name;
|
---|
| 357 | var lang_native_full = isoLangs[l].nativeName;
|
---|
| 358 | var opt_title = (lang_full !== lang_native_full) ? 'title="'+lang_native_full+'"' : "";
|
---|
| 359 |
|
---|
| 360 | var opt_enabled = (l == "en") ? 'checked="checked"' : "";
|
---|
| 361 |
|
---|
| 362 | var legend = "";
|
---|
| 363 | legend += ' <legend style="margin-bottom: 5px; padding-top: 15px;">\n';
|
---|
| 364 | legend += ' <input type="checkbox" name="'+l+'-enabled" id="'+l+'-enabled" ' + opt_enabled +'/>\n';
|
---|
| 365 | legend += ' <span ' + opt_title + '>'+lang_full+':</span>\n';
|
---|
| 366 | legend += ' </legend>\n';
|
---|
| 367 |
|
---|
| 368 |
|
---|
| 369 | var check_box_list = [];
|
---|
| 370 |
|
---|
| 371 | for (var pi=0; pi<pos_checkbox.length; pi++) {
|
---|
| 372 | var pos_info = pos_checkbox[pi];
|
---|
| 373 | var pos = pos_info.pos;
|
---|
| 374 | var label = pos_info.label;
|
---|
| 375 | var tooltip = pos_info.tooltip;
|
---|
| 376 | var opt_tooltip = (tooltip != null) ? 'title="'+tooltip+'"' : "";
|
---|
| 377 |
|
---|
| 378 | var check_box = "";
|
---|
| 379 | check_box += ' <input type="checkbox" name="'+l+'-'+pos+'-htrctoken-cb" id="'+l+'-'+pos+'-htrctoken-cb" checked="checked" />\n';
|
---|
| 380 | check_box += ' <label for="'+l+'-'+pos+'-htrctoken-cb" '+opt_tooltip+'>'+label+'</label>\n';
|
---|
| 381 |
|
---|
| 382 | check_box_list.push(check_box);
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | var fieldset = "";
|
---|
[31524] | 386 | var opt_showhide_class = (li>0) ? 'class="show-hide-lang"' : "";
|
---|
| 387 |
|
---|
| 388 | if (li==1) {
|
---|
| 389 | fieldset += '<button id="show-hide-lang">Show other languages ...</button>';
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | fieldset += '<fieldset ' + opt_showhide_class + '>\n';
|
---|
[31384] | 393 | fieldset += legend;
|
---|
| 394 | fieldset += ' <div id="'+l+'-pos-choice">\n';
|
---|
| 395 |
|
---|
| 396 | var check_box_join = check_box_list.join(' ');
|
---|
| 397 | fieldset += check_box_join;
|
---|
| 398 |
|
---|
| 399 | fieldset += ' </div>\n';
|
---|
| 400 | fieldset += '</fieldset>\n';
|
---|
| 401 |
|
---|
| 402 | $pos_fieldsets.append(fieldset);
|
---|
| 403 | $('#'+l+'-enabled').click(lang_pos_toggle);
|
---|
| 404 |
|
---|
| 405 | if (l == "en") {
|
---|
| 406 | $('#en-pos-choice *').prop('disabled',false);
|
---|
| 407 | }
|
---|
| 408 | else {
|
---|
| 409 | $('#'+l+'-pos-choice *').prop('disabled',true);
|
---|
| 410 | }
|
---|
| 411 | }
|
---|
| 412 |
|
---|
[31524] | 413 | show_hide_lang()
|
---|
[31384] | 414 | }
|
---|
| 415 |
|
---|
[31524] | 416 | function show_hide_lang()
|
---|
| 417 | {
|
---|
| 418 | $( "#show-hide-lang" ).click(function(event) {
|
---|
| 419 | event.preventDefault();
|
---|
| 420 | if($('.show-hide-lang:visible').length) {
|
---|
| 421 | $('.show-hide-lang').hide("slide", {direction: "up" } , 1000);
|
---|
| 422 | $('#show-hide-lang').html("Show other languages ...");
|
---|
| 423 | }
|
---|
| 424 | else {
|
---|
| 425 | $('.show-hide-lang').show("slide", {direction: "up" } , 1000);
|
---|
| 426 | $('#show-hide-lang').html("Hide other languages ...");
|
---|
| 427 | }
|
---|
| 428 | });
|
---|
| 429 | }
|
---|
| 430 |
|
---|
[31384] | 431 | function generate_other_langs()
|
---|
| 432 | {
|
---|
[31383] | 433 | // setup other languages
|
---|
| 434 | // for each 'langs_without_pos' generate HTML of the form:
|
---|
| 435 | // <input type="checkbox" name="fr-enabled" id="fr-enabled" />French
|
---|
| 436 | var $other_langs = $('#other-langs');
|
---|
[31384] | 437 |
|
---|
[31383] | 438 | for (var i=0; i<langs_without_pos.length; i++) {
|
---|
| 439 | var lang = langs_without_pos[i];
|
---|
[31385] | 440 | var labeled_checkbox = '<nobr>';
|
---|
| 441 |
|
---|
| 442 | labeled_checkbox += '<input type="checkbox" name="'+lang+'-enabled" id="'+lang+'-enabled" />';
|
---|
[31383] | 443 | /*
|
---|
| 444 | if (lang === "zh-cn") {
|
---|
| 445 | console.log("Mapping zh-cn => zh");
|
---|
| 446 | lang = "zh";
|
---|
| 447 | }
|
---|
| 448 | if (lang === "zh-tw") {
|
---|
| 449 | console.log("Mapping zh-tw => zh");
|
---|
| 450 | lang = "zh";
|
---|
| 451 | }
|
---|
| 452 | */
|
---|
| 453 | var lang_full = isoLangs[lang].name;
|
---|
| 454 | var lang_native_full = isoLangs[lang].nativeName;
|
---|
| 455 | var opt_title = (lang_full !== lang_native_full) ? 'title="'+lang_native_full+'"' : "";
|
---|
| 456 |
|
---|
[31385] | 457 | labeled_checkbox += '<label for="'+lang+'-enabled" style="padding-left: 5px; padding-right: 10px;" ' + opt_title + '>'+lang_full+'</label>';
|
---|
[31618] | 458 |
|
---|
[31385] | 459 | labeled_checkbox += '</nobr> ';
|
---|
[31383] | 460 |
|
---|
[31385] | 461 | $other_langs.append(labeled_checkbox);
|
---|
| 462 |
|
---|
[31383] | 463 | }
|
---|
[31384] | 464 | }
|
---|
[31383] | 465 |
|
---|
[31384] | 466 | $(function() {
|
---|
| 467 | generate_pos_langs();
|
---|
| 468 |
|
---|
| 469 | generate_other_langs();
|
---|
[31570] | 470 |
|
---|
| 471 | if ($('#search-submit').length>0) {
|
---|
| 472 | $('#search-submit').click(submit_action);
|
---|
| 473 | }
|
---|
[31383] | 474 |
|
---|
| 475 | });
|
---|