1var ASSSSClass = function(element, options) { 2 'use strict'; 3 4 var voliaConfig = vConfig; 5 if (typeof voliaConfig !== 'undefined') { 6 voliaConfig = voliaConfig; 7 } 8 9 var elem = $(element), 10 obj = this; 11 12 var result_data = ''; 13 14 // Set the Out put style of the search reasult 15 var output_style = 'list'; 16 if (options.output && options.output.groups && options.output.groups.length > 1) { 17 output_style = 'group'; 18 } 19 20 // Merge options with defaults 21 obj.settings = $.extend({ 22 currlang: 'DE', 23 dbpfad: '/fdi/web.nsf/', 24 protokolldb: '/fdi/statistiken.nsf/', 25 gobutton: '#searchgo', 26 searchfield: '#searchfield', 27 content_area: '#content', 28 content_area_modal: false, 29 content_area_modal_root: '#content', 30 headline_area: '#content', 31 search_headline: 'Suchergebnisse', 32 search_headline_template: '<h1>%%HEADLINE%%</h1>', 33 urlschema: '%%db%%id/%%newpageurl%%#%%hashtagval%%', // '%%db%%id/%%newpageurl%%#%%hashtagval%%' 34 show_dummy_elements: '', //this elements are hidden for some issues (dummyelements 4 example) 35 hide_elements: '', //this can hide some elements post-search if u need 36 search_fuzzy: 1, 37 char_min: 2, 38 max_results: 20, 39 skip_media: false, 40 skip_department: false, 41 skip_teaser: false, 42 autoscroll: true, 43 typeahead: true, 44 awesome_spinner: false, 45 awesome_spinner_id: '#search_spinner', 46 fuzzysearch: 1, 47 trigger: 'gobutton', // one of ['gobutton', 'hashtag'] 48 hashtag: { 49 prefix: 'suche', 50 separator: '~' 51 }, 52 custom_fields: { 53 datefromfield: '', 54 datetofield: '', 55 maincatfield: '', 56 subcatfield: '' 57 }, 58 v_group_filter: '', 59 prev_button_text: 'Die vorherigen Ergebnisse anzeigen', 60 next_button_text: 'Die nächsten Ergebnisse anzeigen', 61 ajax_cb: function() { 62 ajaxsearch_cb(); 63 }, 64 display_cb: function(data) { 65 displayresult_group_cb(data); 66 }, 67 typeahead_cb: function() { 68 typeahead_cb(); 69 }, 70 display_ta_cb: function(data) { 71 if (jquery_ui_defined()) { 72 display_jquery_ui_ta_cb(data); 73 } else { 74 display_ta_cb(data); 75 } 76 }, 77 search_done: function() {}, 78 debug: false 79 }, options || {}); 80 81 82 var gobutton = elem.find(obj.settings.gobutton).css('cursor', 'pointer'); 83 var searchfield = elem.find(obj.settings.searchfield); 84 var tmp_headline = ""; 85 var allowed_triggers = ['gobutton', 'hashtag']; 86 var trigger = obj.settings.trigger; 87 88 89 var searchGoEvent = document.createEvent('Event'); 90 searchGoEvent.initEvent('searchgo', false, false); 91 92 93 //init jquerui autocomplete 94 if (jquery_ui_defined() && obj.settings.typeahead) { 95 searchfield.autocomplete({ 96 source: function(request, response) { 97 response(result_data.data); 98 }, 99 minLength: 2, 100 focus: function(event, ui) { 101 var decoded = $("<div/>").html(ui.item.bezeichnung).text(); 102 searchfield.val(decoded); 103 return false; 104 }, 105 select: function(event, ui) { 106 var decoded = $("<div/>").html(ui.item.bezeichnung).text(); 107 searchfield.val(decoded); 108 gobutton.trigger('click'); 109 return false; 110 } 111 }).autocomplete("instance")._renderItem = function(ul, item) { 112 ul.attr('id', 'ta'); 113 return $("<li>") 114 .append(item.bezeichnung) 115 .append('<span class="pull-xs-right">' + item.score + '</span>') 116 .appendTo(ul); 117 }; 118 } 119 120 obj.searchfield_safe = searchfield.val().replace(/<(?:.|\n)*?>/gm, ''); 121 122 if ($.inArray(obj.settings.trigger, allowed_triggers)) { 123 trigger = obj.settings.trigger; 124 } 125 126 if (obj.settings.debug) { 127 console.info('Starting ASSSS in ' + trigger + '-Mode!'); 128 console.log('loaded this settings:'); 129 console.log(obj.settings); 130 } 131 132 if (trigger !== 'gobutton' && trigger !== 'hashtag') { 133 if (obj.settings.debug) { 134 console.error('The setting "trigger" must be one of ["gobutton", "hashtag"]'); 135 } 136 return; 137 } 138 139 if (obj.settings.awesome_spinner) { 140 var search_spinner = $(obj.settings.awesome_spinner_id); 141 if (search_spinner.length) { 142 search_spinner.hide(); 143 if (obj.settings.debug) { 144 console.log('Found existing '+obj.settings.awesome_spinner_id+', will use it as "awesome_spinner"'); 145 } 146 } else { 147 search_spinner = $('<i id="search_spinner" class="fa fa-refresh fa-spin"></i>'); 148 search_spinner.hide().prependTo(elem); 149 if (obj.settings.debug) { 150 console.log('No "awesome_spinner" found, added new one to the search-container'); 151 } 152 } 153 } 154 155 if (obj.settings.typeahead && !jquery_ui_defined()) { 156 // Initzialize TA Markup ... 157 elem.append('<div id="ta"><div id="ta_pointer"></div><div id="ta_content"></div></div>'); 158 var layerTA = $("#ta"); 159 var layerTAContent = $("#ta"); 160 161 // Typeahead doesnt work with autocomplete! 162 searchfield.prop('autocomplete', 'off'); 163
164 // Hide Typeahead on Background Click..... 165 $('html').click(function() { 166 $('#ta').hide(); 167 }); 168 } 169 170 171 /* --- Define Event Handlers --- */ 172 elem.on('click', obj.settings.gobutton, function(e) { 173 e.preventDefault(); 174 if (searchfield.val().length >= obj.settings.char_min) { 175 if (obj.settings.awesome_spinner) { 176 search_spinner.fadeIn(); 177 } 178 if (obj.settings.typeahead && !jquery_ui_defined()) { 179 layerTA.fadeOut(); 180 } 181 182 var hashValue = obj.settings.hashtag.prefix + obj.settings.hashtag.separator + searchfield.val().replace(/<(?:.|\n)*?>/gm, ''); 183 184 // set custom fields to url 185 var custom_fields_ext = ""; 186 $.each(obj.settings.custom_fields, function(fieldname, fieldselector) { 187 if (elem.find(fieldselector).length > 0) { 188 custom_fields_ext += obj.settings.hashtag.separator + elem.find(fieldselector).val(); 189 } 190 }); 191 192 hashValue += custom_fields_ext; 193 194 // set v group val to url 195 if (typeof obj.settings.v_group !== 'undefined') { 196 hashValue += obj.settings.hashtag.separator + elem.find(obj.settings.v_group.selector).val(); 197 } 198 199 200 if (trigger === 'gobutton') { 201 if (obj.settings.newpageurl != "" & obj.settings.newpageurl != voliaConfig.currPageURL) { 202 window.location.href = voliaConfig.db + 'id/' + obj.settings.newpageurl + '#' + hashValue; 203 204 } else if (typeof obj.settings.ajax_cb === 'function') { 205 obj.settings.ajax_cb.call(this); 206 } else if (obj.settings.debug) { 207 console.warn('No valid AJAX Callback function!'); 208 } 209 } else if (trigger === 'hashtag') { 210 if (vConfig.isAISearch === true) { 211 var sPrompt = searchfield.val().replace(/<(?:.|\n)*?>/gm, ''); 212 $("#chat-link-chat-app-root").show(); 213 window.neurabot.openWindowAndSendMessage(sPrompt); 214 console.log("opened ai chat with prompt: " + sPrompt); 215 } else { 216 var oldHash = window.location.hash; 217 var newHash = hashValue; 218 if (obj.settings.newpageurl != "" & obj.settings.newpageurl != voliaConfig.currPageURL) { 219 var url = obj.settings.urlschema.replace(/%%db%%/gi, voliaConfig.db).replace(/%%newpageurl%%/gi, obj.settings.newpageurl).replace(/%%hashtagval%%/gi, newHash); 220 window.location.href = url; 221 } else if (oldHash === newHash) { 222 start_hashtag_search(); 223 } else { 224 window.location.hash = newHash; 225 } 226 } 227 } 228 } else if (obj.settings.debug) { 229 console.warn('Mindestens ' + obj.settings.char_min + ' Buchstaben eingeben! Eingabe: "' + searchfield.val().replace(/<(?:.|\n)*?>/gm, '') + '"'); 230 } 231 }); 232 233 // Start search with Enter 234 elem.on('keyup', obj.settings.searchfield, function(e) { 235 if (e.keyCode === 13) { 236 e.preventDefault(); 237 //gobutton.trigger('click'); 238 } else { 239 if (obj.settings.typeahead && typeof obj.settings.typeahead_cb === 'function') { 240 if (searchfield.val().length >= obj.settings.char_min) { 241 obj.settings.typeahead_cb.call(this); 242 } else { 243 if (!jquery_ui_defined) { 244 layerTA.fadeOut(); 245 } 246 247 if (obj.settings.debug) { 248 console.info('TypeAhead suche startet ab ' + obj.settings.char_min + ' Zeichen! Eingabe: "' + searchfield.val().replace(/<(?:.|\n)*?>/gm, '') + '"'); 249 } 250 } 251 } else if (obj.settings.typeahead && obj.settings.debug) { 252 console.warn('No valid TypeAhead Callback function!'); 253 } 254 } 255 }); 256 257 258 // Display AJAX Results Callback - Private method 259 var displayresult_list_cb = function(response) { 260 var i = 0, 261 counter = 0; 262 var tmp = ""; 263 var orgValue = searchfield.val().replace(/<(?:.|\n)*?>/gm, ''); 264 var standOutStr = ''; 265 266 if (obj.settings.debug) { 267 console.log("Ergebnisse: " + response.data.length); 268 } 269 270 271 var tmpContent = []; 272 // *** Ausgabedefinition *** 273 if (obj.settings.output.groups[0].type == 'condition') { 274 for (var i = response.data.length - 1; i >= 0; i--) { 275 var d = response.data[i]; 276 277 if (obj.settings.output.groups[0].condition(d)) { 278 tmpContent.push(d); 279 counter++; 280 } 281 282 } 283 } else if (obj.settings.output.groups[0].type == 'adresses') { 284 tmpContent.results = searchAdresses_cb(orgValue); 285 counter += tmpContent.length; 286 } 287 288 var hide_result = typeof obj.settings.max_results === 'number' && tmpContent.length > obj.settings.max_results; 289 290 291 //Update Typeahead Statistik 292 if (obj.settings.typeahead) { 293 logSearchQuery(orgValue, counter); 294 } 295 296 var tmpCounter = 0; 297 $.each(tmpContent, function() { 298 this.display = !(hide_result && tmpCounter >= obj.settings.max_results); 299 tmpCounter++; 300 }); 301 302 // *** Gesamtausgabe "Statistiksuche" u. "Standardsuche" *** 303 if ($(obj.settings.headline_area).length > 0) { 304 $(obj.settings.headline_area).html(obj.settings.search_headline); 305 } else { 306 tmp_headline = obj.settings.search_headline_template.replace(/%%HEADLINE%%/gi, obj.settings.search_headline); 307 } 308 309 310 tmp = nunjucks.renderString(obj.settings.output.list_template, { 311 headline: tmp_headline, 312 counter: counter, 313 searchvalue: orgValue, 314 showButtons: hide_result, 315 content: nunjucks.renderString(obj.settings.output.content_template, { 316 results: tmpContent, 317 active: 'in', 318 start: 1, 319 id: 'list' 320 }) 321 }); 322 323 //set content 324 $(obj.settings.content_area).html(tmp); 325 326 327 if (hide_result) { 328 329 var less_ln = $('#showPreviousResults'); 330 var more_ln = $('#showNextResults'); 331 332 var previous_next_func = function(e, type) { 333 e.preventDefault(); 334 if (type === 'next') { 335 $('#search-list').data('start', parseInt($('#search-list').data('start')) + obj.settings.max_results); 336 } else if (type === 'previous') { 337 $('#search-list').data('start', parseInt($('#search-list').data('start')) - obj.settings.max_results); 338 } 339 340 $('#search-list').children().hide(); 341 var actPosition = parseInt($('#search-list').data('start')) - 1; 342 var objs = $('#search-list').children().slice(actPosition, actPosition + obj.settings.max_results); 343 objs.fadeIn(); 344 if (actPosition + obj.settings.max_results >= $('#search-list').children().length) { 345 $('#showNextResults').hide(); 346 } else { 347 $('#showNextResults').show(); 348 } 349 350 if (actPosition <= 0) { 351 $('#showPreviousResults').hide(); 352 } else { 353 $('#showPreviousResults').show(); 354 } 355 }; 356 more_ln.click(function(e) { 357 previous_next_func(e, 'next'); 358 }); 359 less_ln.click(function(e) { 360 previous_next_func(e, 'previous'); 361 }); 362 363 364 $('#showMoreResults').append(less_ln).append(more_ln); 365 less_ln.hide(); 366 } 367 368 369 // *** SHOW MODAL WINDOW *** 370 if (obj.settings.content_area_modal) { 371 $(obj.settings.content_area_modal_root).modal('show'); 372 } 373 374 // *** SHOW DUMMY ELEMENTS ** 375 if (obj.settings.show_dummy_elements !== "") { 376 $(obj.settings.show_dummy_elements).show(); 377 } 378
379 // *** HIDE ELEMENTS ** 380 if (obj.settings.hide_elements !== "") { 381 $(obj.settings.hide_elements).hide(); 382 } 383 384 // *** Back to Top - Link *** 385 if (obj.settings.autoscroll) { 386 if ($(obj.settings.content_area).height() > 450) { 387 $("#backToTop").show(); 388 } 389 $('html, body').animate({ 390 scrollTop: $(obj.settings.content_area).offset().top 391 }, 1000); 392 } 393 }; 394 395 // Display result as groups for bootstrap tabs or accordion 396 var displayresult_group_cb = function(response) { 397 var counter = 0; 398 var tmp = "", 399 tmpContent = "", 400 tmpMedia= "", 401 tmpAddress = "", 402 contentCount = 0, 403 mediaCount = 0, 404 addressCount = 0; 405 406 var orgValue = searchfield.val().replace(/<(?:.|\n)*?>/gm, ''); 407 408 if (obj.settings.debug) { 409 console.log("Ungefilterte Ergebnisse: " + response.data.length); 410 } 411 412 //UpdatesTypeahead Statistik 413 414 if (obj.settings.typeahead) { 415 logSearchQuery(orgValue, counter); 416 } 417 searchAdresses_cb(orgValue); 418 $.each(response.data, function(key, value) { 419 if(value.typ == "medien" & (value.doctype != "JPG" & value.doctype != "PNG" & value.doctype != "JPEG" & value.doctype != "GIF" )){ 420 tmpMedia += '<a href="'+value.url+'"><span class="zmdi zmdi-collection-pdf"></span>'+value.bezeichnung+'</a>'; 421 mediaCount++; 422 } else if (value.typ == "eintrag" ){ 423 424 425 } else if (value.typ == "content" | value.typ=="listen"){ 426 tmpContent += '<a href="'+value.url+'">'+value.bezeichnung+'<span class="zmdi zmdi-arrow-right"></span></a>'; 427 contentCount++; 428 } 429 }); 430 431 $('#resultsWebsites').html(tmpContent); 432 $('#resultsDownloads').html(tmpMedia); 433 434 435 $('[rel="resultsWebsites"]').find('span').html('('+contentCount+')'); 436 $('[rel="resultsDownloads"]').find('span').html('('+mediaCount+')'); 437 438 $('.evenHeights').matchHeight({ 439 byRow:true 440 }); 441 442 443 444 445 // set content 446 $(obj.settings.content_area).html(tmp); 447 }; 448 449 var searchAdresses_cb = function(query_value) { 450 var adresses = []; 451 var addressCount = 0; 452 var tmpAddress = ""; 453 454 $.ajax({ 455 url: '/germering/adressen.nsf/(address_search)', 456 dataType: 'text', 457 data: 'OpenAgent&q=' + query_value + '&l=SG&' + Math.random(), 458 async: false, 459 }) 460 .done(function(response) { 461 response = JSON.parse(response); 462 $.each(response.data, function(key, value) { 463 var department = "", 464 name = "", 465 zimmer = "", 466 street = "", 467 slocation = "", 468 telefon = "", 469 fax = "", 470 bezeichnung = "", 471 mail = ""; 472 473 if(value.companyName != ''){ 474 bezeichnung = value.companyName; 475 } 476 477 if(value.firstName != ""){ 478 name = value.firstName+' '+value.lastName+'<br>'; 479 } else if(value.lastName != ""){ 480 name = value.lastName+'<br>'; 481 } 482 483 if(bezeichnung == ''){ 484 bezeichnung = name; 485 name = ''; 486 } 487 488 489 490 if(value.department != ""){ 491 department = '<strong>'+value.department+'</strong><br>'; 492 } 493 494 if(value.sfunction != ""){ 495 zimmer = value.sfunction+'<br>'; 496 } 497 if(value.street != "") { 498 street = value.street + '<br>'; 499 } 500 501 if(value.zip != "") { 502 slocation = value.zip + ' ' + value.city + '<br>' 503 } 504 505 if(value.phone != ""){ 506 telefon = value.phone+'<br>'; 507 } 508 509 if(value.fax != ""){ 510 fax = value.fax+'<br>'; 511 } 512 513 if(value.email != ""){ 514 mail = '<br><a href="../formular?OpenForm&formular=DEkontaktformular&cID='+value.vcardunid+'">Nachricht senden</a>'; 515 } 516 517 518 tmpAddress += '<div class="greyBox evenHeights"><h3>'+bezeichnung+'</h3><p>'+name+zimmer+street+slocation+telefon+fax+mail+'</p></div>'; 519 addressCount++; 520 }); 521 522 $('#resultsAddresses #greyBoxes').html(tmpAddress); 523 $('[rel="resultsAddresses"]').find('span').html('('+addressCount+')'); 524 $('.evenHeights').matchHeight({ 525 byRow:true 526 }); 527 528 }) 529 .fail(function(response) { 530 obj.settings.debug && console.warn("ERROR IN REQUEST\n" + response.responseText); 531 }); 532 533 return adresses; 534 }; 535 536 // Fill the var for the jQuery UI autocomplete 537 var display_jquery_ui_ta_cb = function(data) { 538 result_data = data; 539 }; 540 541 // Display Typeahead Results - Private method 542 var display_ta_cb = function(data) { 543 var tmp = $('<table class=""><tbody></tbody></table>'); 544 layerTAContent.html(tmp); 545 layerTA.fadeIn('fast'); 546 547 $(data.data).each( 548 function(index) { 549 var d = data.data[index]; 550 if (d.bezeichnung === "") { 551 return; 552 } 553 554 var row = $("<tr>"); 555 var cell1 = $("<td>"); 556 var ln = $('<a href="#">
556' + d.bezeichnung + '</a>'); 557 ln.click(function(e) { 558 e.preventDefault(); 559 searchfield.val($(this).text()); 560 gobutton.trigger('click'); 561 }); 562 cell1.append(ln); 563 var cell2 = $("<td>" + d.score + "</td>"); 564 row.append(cell1).append(cell2); 565 layerTAContent.find('tbody').append(row); 566 } 567 ); 568 }; 569 570 571 572 // AJAX Typeahead callback - Private method 573 var typeahead_cb = function() { 574 var theValue = searchfield.val(); 575 var protokollSuchTA = obj.settings.protokolldb + "web_suche_typeahead"; 576 var protokollSuchURL = obj.settings.protokolldb + "statistiken_suche_begriffe"; 577 578 if (obj.settings.awesome_spinner) { 579 search_spinner.fadeIn(); 580 } 581 582 $.ajax({ 583 url: protokollSuchTA, 584 dataType: 'text', // Should be 'json' if the Webserver sent correct MIME Typ 585 data: 'OpenAgent&sprache=' + obj.settings.currlang + '&query=' + theValue + '&ns=0&rnd=' + Math.random(), 586 async: true 587 }) 588 .done(function(response) { 589 response = JSON.parse(response); 590 if (response.data.length < 1) { 591 $('#ta').fadeOut(); 592 return true; 593 } else if (!$('#ta').is(":visible")) { 594 $('#ta').fadeIn(); 595 } 596 597 if (typeof obj.settings.display_ta_cb === 'function') { 598 obj.settings.display_ta_cb.call(this, response); 599 } else if (obj.settings.debug) { 600 console.warn('No valid AJAX Callback function!'); 601 } 602 }) 603 .fail(function(response) { 604 obj.settings.debug && console.warn("ERROR IN REQUEST\n" + response.responseText); 605 }) 606 .always(function(response) { 607 if (obj.settings.awesome_spinner) { 608 search_spinner.fadeOut('Slow'); 609 } 610 }); 611 }; 612 613 614 // AJAX Search Request - Private method 615 var ajaxsearch_cb = function() { 616 var result = getSearchValueFromHash(); 617 var orgValue = result.value; 618 var protokollSuchURL = obj.settings.protokolldb + "statistiken_suche_begriffe"; 619 var vCMSSuchURL = obj.settings.dbpfad + "web_suche_ft_ajax"; 620 var cat = '', 621 subcat = '', 622 datefrom = '', 623 dateto = ''; 624 625 if (result.custom_fields) { 626 if (result.custom_fields.maincatfield && result.custom_fields.maincatfield != "") 627 cat = result.custom_fields.maincatfield; 628 629 if (result.custom_fields.subcatfield && result.custom_fields.subcatfield != "") 630 subcat = result.custom_fields.subcatfield; 631 632 if (result.custom_fields.datefromfield && result.custom_fields.datefromfield != "") 633 datefrom = result.custom_fields.datefromfield; 634 635 if (result.custom_fields.datetofield && result.custom_fields.datetofield != "") 636 dateto = result.custom_fields.datetofield; 637 638 } 639 640 if (result.v_group && result.v_group != "") { 641 elem.find(obj.settings.v_group.selector).val(result.v_group); 642 } 643 644 645 // Volltextsuche auf die voila Instanz 646 $.ajax({ 647 url: vCMSSuchURL, 648 dataType: 'text', // Should be 'json' if the Webserver sent correct MIME Typ 649 data: 'OpenAgent&sprache=' + obj.settings.currlang + '&oua=0&query=' + orgValue + '&ns=0&scat=' + cat + '&ssubcat=' + subcat + '&sfromdate=' + datefrom + '&stilldate=' + dateto + '&sort=&orderby=headline&orderbytype=string&ftsearch=' + obj.settings.fuzzysearch + '&rn
649d=' + Math.random(), 650 async: true 651 }) 652 .done(function(response) { 653 response = JSON.parse(response); 654 655 // filter empty result 656 response.data = response.data.filter(function(result) { 657 return result.bezeichnung != ""; 658 }); 659 660 if (typeof obj.settings.v_group !== "undefined") { 661 if (typeof obj.settings.v_group.filter === 'function') { 662 response.data = response.data.filter(obj.settings.v_group.filter); 663 } else if(obj.settings.debug) { 664 console.warn("vGroup Filter hast to be a function"); 665 } 666 } 667 668 669 if (typeof obj.settings.display_cb === 'function') { 670 obj.settings.display_cb.call(obj, response); 671 } else if (obj.settings.debug) { 672 console.warn('No valid Display Callback function!'); 673 } 674 if (obj.settings.awesome_spinner) { 675 search_spinner.fadeOut('slow'); 676 } 677 if (typeof obj.settings.search_done === 'function') { 678 obj.settings.search_done.call(obj); 679 } 680 }) 681 .fail(function(json) { 682 if (obj.settings.debug) { 683 console.warn("ERROR IN REQUEST\n" + json.responseText); 684 } 685 }); 686 }; 687 688 // Handle hashtag-trigger events 689 if (trigger === 'hashtag') { 690 var start_hashtag_search = function() { 691 var hash = window.location.hash; 692 var hashParts = hash.split(obj.settings.hashtag.separator); 693 if (hashParts[0].toLowerCase() === "#" + obj.settings.hashtag.prefix && typeof hashParts[1] !== 'undefined') { 694 var suche = hashParts[1]; 695 696 // Decode URL-HashTag-Part 697 suche = decodeURI(suche); 698 699 if (suche.length >= 0) { 700 searchfield.val(suche); 701 702 if (typeof obj.settings.ajax_cb === 'function') { 703 obj.settings.ajax_cb.call(this); 704 } else if (obj.settings.debug) { 705 console.warn('No valid AJAX Callback function!'); 706 } 707 } else if (obj.settings.debug) { 708 console.info('No search-String given!'); 709 } 710 } else if (obj.settings.debug) { 711 console.warn('Hash "' + hash + '" doesn\'t start with "#' + obj.settings.hashtag.prefix + obj.settings.hashtag.separator + '"!'); 712 } 713 }; 714 715 if (window.location.hash.length > 0) { 716 start_hashtag_search(); 717 } 718 719 $(window).bind('hashchange', function(e) { 720 start_hashtag_search(); 721 }); 722 723 if (obj.settings.content_area_modal) { 724 $(obj.settings.content_area_modal_root).on('hidden.bs.modal', function() { 725 window.location.hash = '#'; 726 }); 727 } 728 } 729 730 /* Alle Suchanfragen, die Ergebnisse liefern (z. Zt. > 1, da vCMS ein Fake-Ergebnis zur Suchanfrage hinzufügt), 731 werden protokolliert (für die Type-Ahead-Funktion) */ 732 function logSearchQuery(theValue, theCount) { 733 var logsearchimg = obj.settings.protokolldb + "suchvorgang.gif?OpenForm&sprache=" + obj.settings.currlang + "&begriff=" + theValue.replace(/<(?:.|\n)*?>/gm, '') + "&score=" + theCount; 734 735 if (theCount > 1) { 736 if ($('logsearchimg').length > 0) { 737 $('logsearchimg').prop('src', logsearchimg); 738 } else { 739 $(document.body).append("<img id=\"logsearchquery\" style=\"display:none;\" src=\"" + logsearchimg + "\" width=\"1\" height=\"1\">"); 740 } 741 } 742 }; 743 744 function getSearchValueFromHash() { 745 var result = {}; 746 var hashParts = window.location.hash.split(obj.settings.hashtag.separator); 747 748 if (hashParts[0].toLowerCase() === "#" + obj.settings.hashtag.prefix && typeof hashParts[1] !== 'undefined') { 749 result.value = decodeURIComponent(hashParts[1]).replace(/<(?:.|\n)*?>/gm, ''); 750 751 var index = 2; 752 result.custom_fields = []; 753 754 $.each(obj.settings.custom_fields, function(fieldname, fieldselector) { 755 result.custom_fields[fieldname] = hashParts[index]; 756 index++; 757 }); 758 759 760 if (hashParts[index]) 761 result.v_group = hashParts[index]; 762 763 764 } 765 766 return result; 767 } 768}; 769 770 771/* ============= MAIN ASSSS ============= */ 772$.fn.assss = function(options) { 773 // if nothing is selected, return nothing; can't chain anyway 774 if (!this.length) { 775 if (options && options.debug && window.console) { 776 console.warn("no objects found, returning nothing."); 777 } 778 return; 779 } 780 781 782 return this.each(function() { 783 var element = $(this); 784 // Return early if this element already has a plugin instance 785 if (element.data('assss')) { 786 return; 787 } 788 var assss = new ASSSSClass(this, options); 789 // Store plugin object in this element's data 790 element.data('assss', assss); 791 }); 792} 793 794function jquery_ui_defined() { 795 return typeof jQuery.ui === "object"; 796} 797 798/** 799 polyfill for new Event 800*/ 801(function () { 802 803 if ( typeof window.CustomEvent === "function" ) return false;
804 805 function CustomEvent ( event, params ) { 806 params = params || { bubbles: false, cancelable: false, detail: undefined }; 807 var evt = document.createEvent( 'CustomEvent' ); 808 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 809 return evt; 810 } 811 812 CustomEvent.prototype = window.Event.prototype; 813 814 window.CustomEvent = CustomEvent; 815})(); 816 817 818jQuery.cachedScript = function(url, options) { 819 820 // Allow user to set any option except for dataType, cache, and url 821 options = $.extend(options || {}, { 822 dataType: "script", 823 cache: true, 824 url: url, 825 async: false 826 }); 827 828 // Use $.ajax() since it is more flexible than $.getScript 829 // Return the jqXHR object so we can chain callbacks 830 return jQuery.ajax(options); 831};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.