1ContactsContactSearchBehaviour = function(dom_element, options) { 2 dom_element = $(dom_element); 3 var form = dom_element.find('form'); 4 var input = dom_element.find('.js_input'); 5 var list = dom_element.next(); 6 var more_list = $('#more_list'); 7 var timeout = undefined; 8 9 // prevent default 10 form.submit(function(e) { 11 e.preventDefault(); 12 }); 13 14 // bind submit 15 form.on('submit', function(e) { 16 //alert('submit'); 17 input.keyup(); 18 }); 19 // bind function 20 input.on('keyup', function(e) { 21 var $this = this; 22 23 if (timeout != undefined) { 24 clearTimeout(timeout); 25 } 26 27 timeout = setTimeout(function() { 28 timeout = undefined; 29 30 $.ajax({ 31 type: 'GET', 32 url: form.attr('action'), 33 data: form.serialize(), 34 dataType: 'json' 35 }).done(function(data) { 36 if (data.status === 'ok') { 37 // disable or enable pager 38 if (typeof data.next !== 'undefined') { 39 jsb.fireEvent('GeneralPagerBehaviour::enable', {'index': 0}); 40 } else { 41 jsb.fireEvent('GeneralPagerBehaviour::disable', {'index': 0}); 42 } 43 44 list.addClass('jsb_ jsb_general_report').empty(); 45 if(data.is_search) { 46 list.append('<li>Suchergebnis für "'+data.cq+'" <a class="search_close" href="#" onclick="javascript:$(\'.search_results\').hide(); $(\'.tab_content\').show(); $(\'#contact_search_input\').val(\'\');">schlieÃen</a></li>'); 47 $(data.data).each(function() { 48 list.append('<li tabindex="0">' + 49 '<div class="block">' + 50 '<a class="user_pic" href="' + this.user_link + '"><img src="'+((this.image) ? this.image : '/static/images/default_avatar_'+((this.gender_id == 1) ? 'female' : 'male')+'_120x120.png')+'" alt="' + this.name + '" width="120" height="120" /></a>' + 51 '<div class="contact_info">' + 52 '<span class="user_title">' + this.gender + '</span>' + 53 '<h3 class="user_name"><a href="' + this.user_link + '">' + ((this.academictitle) ? this.academictitle : '') + ' ' + this.name + '</a></h3>' + 54 '<h4 class="user_function">' + this.position + '</h4>' + 55 '<h5 class="user_company">' + this.organization + '</h5>' + 56 '</div>' + 57 '</div>' + 58 '<div class="jsb_ jsb_general_confirmation"><a class="btn_green small contact_action js_confirm js_refresh" href="' + this.add_link + '" role="button">Zu Kontakten hinzufügen</a></div>' + 59 '<ul class="action_list">' + 60 '<li>' + 61 '<div class="wrapper_flyout_report">' + 62 '<a title="Person melden" href="#" class="ico report js_toggle_btn">Person melden</a>' + 63 '<div class="flyout hide">' + 64 '<span class="close js_close" tabindex="0">schlieÃen</span>' + 65 '<h3 class="title">Person melden</h3>' + 66 '<p class="description">Warum wollen Sie diese Person melden?</p>' + 67 '<form id="report' + this.id + '" class="yform" action="' + this.report_link + '" method="post">' + 68 '<fieldset>' + 69 '<legend class="hide">Profil melden</legend>' + 70 '<div class="type-radio">' + 71 '<input id="report_fake_radio' + this.id + '" class="radio" name="report" value="1" type="radio" aria-labelledby="report_fake_label' + this.id + '" />' + 72 '<label id="report_fake_label' + this.id + '" for="report_fake_radio' + this.id + '">Gefälschtes Profil</label>' + 73 '</div>' + 74 '<div class="type-radio">' + 75 '<input id="report_abuse_radio' + this.id + '" class="radio" name="report" value="2" type="radio" aria-labelledby="report_abuse_label' + this.id + '" />' + 76 '<label id="report_abuse_label' + this.id + '" for="report_abuse_radio' + this.id + '">Missbrauch der Seite</label>' + 77 '</div>' + 78 '<div class="type-radio">' + 79 '<input id="report_spam_radio' + this.id + '" class="radio" name="report" value="3" type="radio" aria-labelledby="report_spam_label' + this.id + '" />' + 80 '<label id="report_spam_label' + this.id + '" for="report_spam_radio' + this.id + '">Spam</label>' + 81 '</div>' + 82 '<div class="type-text">' + 83 '<label id="report_text_label' + this.id + '" for="report_textarea' + this.id + '">Spezifizieren Sie ihre Meldung</label>' + 84 '<textarea id="report_textarea' + this.id + '" class="text" cols="5" rows="3" name="report_text" aria-required="true" aria-labelledby="report_text_label' + this.id + '" placeholder="Spezifizieren Sie ihre Meldung hier."></textarea>' + 85 '</div>' + 86 '<button id="report_submit' + this.id + '" class="btn_green small" type="submit" title="Absenden">Profil melden</button>' + 87 '</fieldset>' + 88 '</form>' + 89 '</div>' + 90 '</div>' + 91 '</li>' + 92 '<li><a title="Nachricht schreiben" href="' + this.message_link + '" class="ico unread">Nachricht verfassen</a></li>' + 93 '</ul>' + 94 '</li>'); 95 96 97 }); 98 $('.tab_content').hide(); 99 $('.search_results').show(); 100 } else if(data.is_more) { 101 //We gonna use this for more link 102 $(data.data).each(function() { 103 more_list.append('<li tabindex="0">' + 104 '<label class="message_select_label" for="contact_id_' + this.id + '">' + 105 '<span class="visuallyhidden">Nachricht auswählen</span>' + 106 '<input id="contact_id_' + this.id + '" name="contact_id[' + this.id + ']" value="' + this.id + '" class="message_select" type="checkbox" />' + 107 '</label>' + 108 '<div class="block">' + 109 '<a class="user_pic" href="' + this.user_link + '"><img src="'+((this.image) ? this.image : '/static/images/default_avatar_'+((this.gender_id == 1) ? 'female' : 'male')+'_120x120.png')+'" alt="' + this.name + '" width="120" height="120" /></a>' + 110 '<div class="contact_info">' + 111 '<span class="user_title">' + this.gender + '</span>' + 112 '<h3 class="user_name"><a href="' + this.user_link + '">' + ((this.academictitle) ? this.academictitle : '') + ' ' + this.name + '</a></h3>' + 113 '<h4 class="user_function">' + this.position + '</h4>' + 114 '<h5 class="user_company">' + this.organization + '</h5>' + 115 '</div>' + 116 '</div>' + 117 '<ul class="action_list">' + 118 '<li>' + 119 '<div class="wrapper_flyout_report">' + 120 '<a title="Person melden" href="#" class="ico report js_toggle_btn">Person melden</a>' + 121 '<div class="flyout hide">' + 122 '<span class="close js_close" tabindex="0">schlieÃen</span>' + 123 '<h3 class="title">Person melden</h3>' + 124 '<p class="description">Warum wollen Sie diese Person melden?</p>' + 125 '<form id="report' + this.id + '" class="yform" action="' + this.report_link + '" method="post">' + 126 '<fieldset>' + 127 '<legend class="hide">Profil melden</legend>' + 128 '<div class="type-radio">' + 129 '<input id="report_fake_radio' + this.id + '" class="radio" name="report" value="1" type="radio" aria-labelledby="report_fake_label' + this.id + '" />' + 130 '<label id="report_fake_label' + this.id + '" for="report_fake_radio' + this.id + '">Gefälschtes Profil</label>' + 131 '</div>' + 132 '<div class="type-radio">' + 133 '<input id="report_abuse_radio' + this.id + '" class="radio" name="report" value="2" type="radio" aria-labelledby="report_abuse_label' + this.id + '" />' + 134 '<label id="report_abuse_label' + this.id + '" for="report_abuse_radio' + this.id + '">Missbrauch der Seite</label>' + 135 '</div>' + 136 '<div class="type-radio">' + 137 '<input id="report_spam_radio' + this.id + '" class="radio" name="report" value="3" type="radio" aria-labelledby="report_spam_label' + this.id + '" />' + 138 '<label id="report_spam_label' + this.id + '" for="report_spam_radio' + this.id + '">Spam</label>' + 139 '</div>' + 140 '<div class="type-text">' + 141 '<label id="report_text_label' + this.id + '" for="report_textarea' + this.id + '">Spezifizieren Sie ihre Meldung</label>' + 142 '<textarea id="report_textarea' + this.id + '" class="text" cols="5" rows="3" name="report_text" aria-required="true" aria-labelledby="report_text_label' + this.id + '" placeholder="Spezifizieren Sie ihre Meldung hier."></textarea>' + 143 '</div>' + 144 '<button id="report_submit' + this.id + '" class="btn_green small" type="submit" title="Absenden">Profil melden</button>' + 145 '</fieldset>' + 146 '</form>' + 147 '</div>' + 148 '</div>' + 149 '</li>' + 150 '<li><a title="Nachricht schreiben" href="' + this.message_link + '" class="ico unread">Nachricht verfassen</a></li>' + 151 '</ul>' + 152 '</li>'); 153 154 155 }); 156 //Add more form here 157 if(!data.next) { 158 $('#contact_more').hide(); 159 } else { 160 $('#id_of_next_page').val(data.next); 161 } 162 } else { 163 //Just an empty search 164 $('.tab_content').show(); 165 $('.search_results').hide(); 166 } 167 jsb.applyBehaviour(window.document); 168 } 169 }); 170 }, 200); 171 }); 172}; 173 174jsb.registerHandler('contacts_contact_search', ContactsContactSearchBehaviour);
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.