"; $('#gz-info-calendarformat').addClass('in'); if (!($('#gz-info-calendarformat .modal-backdrop').length)) { $('#gz-info-calendarformat').prepend(backdropElem); } else { $('#gz-info-calendarformat .modal-backdrop').addClass('in'); } }); $('#gz-info-calendarformat').on('hidden.bs.modal', function (e) { $('#gz-info-calendarformat').removeClass('in'); $('#gz-info-calendarformat .modal-backdrop').remove(); }); if ($modal[0]) { $('.calendarLink').click(function (e) { $('#gz-info-calendarformat').modal('hide'); }); } })($('#gz-info-calendarformat .modal-content')); // Constructs the Find Members type ahead suggestion engine. Tokenizes on the Name item in the remote return object. Case Sensitive usage. var members = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url: MNI.BaseUrl + '/list/find?q=%searchTerm', wildcard: '%searchTerm', replace: function () { var q = MNI.BaseUrl + '/list/find?q=' + encodeURIComponent($('.gz-search-keyword').val()); var categoryId = $('#catgId').val(); var quickLinkId = $('#qlId').val(); if (categoryId) { q += "&catgId=" + encodeURIComponent(categoryId); } if (quickLinkId) { q += "&qlid=" + encodeURIComponent(quickLinkId); } return q; } } }); // Initializing the typeahead using the Bloodhound remote dataset. Display the Name and Type from the dataset via the suggestion template. Case sensitive. $('.member-typeahead').typeahead({ hint: false, }, { display: 'Name', source: members, limit: Infinity, templates: { suggestion: function (data) { return '
' + data.Name + '' + data.Type + '
' } } }); $('.member-typeahead').on('typeahead:selected', function (evt, item) { var openInNewWindow = MNI.Page.MemberPagePopup var doAction = openInNewWindow ? MNI.openNewWindow : MNI.redirectTo; switch (item.ResultType) { case 1: // AutocompleteSearchResultType.Category doAction(MNI.Path.Category(item.SlugWithID)); break; case 2: // AutocompleteSearchResultType.QuickLink doAction(MNI.Path.QuickLink(item.SlugWithID)); break; case 3: // AutocompleteSearchResultType.Member if (item.MemberPageAction == 1) { MNI.logHitStat("mbrws", item.ID).then(function () { var location = item.WebParticipation < 10 ? MNI.Path.MemberKeywordSearch(item.Name) : MNI.Path.Member(item.SlugWithID); doAction(location); }); } else { var location = item.WebParticipation < 10 ? MNI.Path.MemberKeywordSearch(item.Name) : MNI.Path.Member(item.SlugWithID); doAction(location); } break; } }) $('#category-select').change(function () { // Store the category ID in a hidden field so the remote fetch can use it when necessary var categoryId = $('#category-select option:selected').val(); $('#catgId').val(categoryId); // Don't rely on prior locally cached data when the category is changed. $('.member-typeahead').typeahead('destroy'); $('.member-typeahead').typeahead({ hint: false, }, { display: 'Name', source: members, limit: Infinity, templates: { suggestion: function (data) { return '
' + data.Name + '' + data.Type + '
' } } }); }); MNI.Plugins.AutoComplete.Init('#mn-search-geoip input', { path: '/' + MNI.MemberFilterUrl + '/find-geographic' }); }); })(MNI.jQuery);