v1.18.x
barisusakli 9 years ago
parent 4af631666a
commit d43c19c173

@ -435,7 +435,9 @@ app.cacheBuster = null;
$('#search-form').on('submit', function () { $('#search-form').on('submit', function () {
var input = $(this).find('input'); var input = $(this).find('input');
require(['search'], function(search) { require(['search'], function(search) {
search.query({term: input.val()}, function() { var data = search.getSearchPreferences();
data.term = input.val();
search.query(data, function() {
input.val(''); input.val('');
}); });
}); });

@ -1,6 +1,6 @@
'use strict'; 'use strict';
/* globals app, define, utils, socket*/ /* globals app, define, utils*/
define('forum/search', ['search', 'autocomplete'], function(searchModule, autocomplete) { define('forum/search', ['search', 'autocomplete'], function(searchModule, autocomplete) {
var Search = {}; var Search = {};
@ -67,7 +67,7 @@ define('forum/search', ['search', 'autocomplete'], function(searchModule, autoco
function fillOutForm() { function fillOutForm() {
var params = utils.params(); var params = utils.params();
var searchData = getSearchPreferences(); var searchData = searchModule.getSearchPreferences();
params = utils.merge(searchData, params); params = utils.merge(searchData, params);
if (params) { if (params) {
@ -156,14 +156,6 @@ define('forum/search', ['search', 'autocomplete'], function(searchModule, autoco
}); });
} }
function getSearchPreferences() {
try {
return JSON.parse(localStorage.getItem('search-preferences'));
} catch(e) {
return {};
}
}
function enableAutoComplete() { function enableAutoComplete() {
autocomplete.user($('#posted-by-user')); autocomplete.user($('#posted-by-user'));
} }

@ -73,6 +73,14 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
return decodeURIComponent($.param(query)); return decodeURIComponent($.param(query));
} }
Search.getSearchPreferences = function() {
try {
return JSON.parse(localStorage.getItem('search-preferences'));
} catch(e) {
return {};
}
};
Search.queryTopic = function(tid, term, callback) { Search.queryTopic = function(tid, term, callback) {
socket.emit('topics.search', { socket.emit('topics.search', {
tid: tid, tid: tid,

Loading…
Cancel
Save