Skip to content

Node.js based forum software built for the modern web

closed #2442

Julian Lam1b526026a053
diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json
index 2562dfe575..eaf15bff36 100644
--- a/public/language/en_GB/user.json
+++ b/public/language/en_GB/user.json
@@ -79,6 +79,9 @@
"browsing": "Browsing Settings",
"open_links_in_new_tab": "Open outgoing links in new tab?",
+ "enable_topic_searching": "Enable In-Topic Searching",
+ "topic_search_help": "If enabled, in-topic searching will override the browser's default page search behaviour and allow you to search through the entire topic, instead of what is only shown on screen.",
+
"follow_topics_you_reply_to": "Follow topics that you reply to.",
"follow_topics_you_create": "Follow topics you create."
}
diff --git a/public/src/app.js b/public/src/app.js
index 9dc3f17579..1bd80d9fac 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -488,14 +488,16 @@ var socket,
});
Mousetrap.bind('ctrl+f', function(e) {
- // If in topic, open search window and populate, otherwise regular behaviour
- var match = ajaxify.currentPage.match(/^topic\/([\d]+)/),
- tid;
- if (match) {
- e.preventDefault();
- tid = match[1];
- searchInput.val('in:topic-' + tid + ' ');
- prepareSearch();
+ if (config.topicSearchEnabled) {
+ // If in topic, open search window and populate, otherwise regular behaviour
+ var match = ajaxify.currentPage.match(/^topic\/([\d]+)/),
+ tid;
+ if (match) {
+ e.preventDefault();
+ tid = match[1];
+ searchInput.val('in:topic-' + tid + ' ');
+ prepareSearch();
+ }
}
});
});
diff --git a/src/controllers/api.js b/src/controllers/api.js
index 083126fa08..5f96861299 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -76,6 +76,7 @@ apiController.getConfig = function(req, res, next) {
config.userLang = settings.language || config.defaultLang;
config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab;
config.topicPostSort = settings.topicPostSort || config.topicPostSort;
+ config.topicSearchEnabled = settings.topicSearchEnabled || false;
if (res.locals.isAPI) {
res.status(200).json(config);
diff --git a/src/user/settings.js b/src/user/settings.js
index 99ca426d20..0e857833db 100644
--- a/src/user/settings.js
+++ b/src/user/settings.js
@@ -30,6 +30,7 @@ module.exports = function(User) {
settings.followTopicsOnReply = parseInt(settings.followTopicsOnReply, 10) === 1;
settings.sendChatNotifications = parseInt(settings.sendChatNotifications, 10) === 1;
settings.restrictChat = parseInt(settings.restrictChat, 10) === 1;
+ settings.topicSearchEnabled = parseInt(settings.topicSearchEnabled, 10) === 1;
callback(null, settings);
});
@@ -94,7 +95,8 @@ module.exports = function(User) {
followTopicsOnCreate: data.followTopicsOnCreate,
followTopicsOnReply: data.followTopicsOnReply,
sendChatNotifications: data.sendChatNotifications,
- restrictChat: data.restrictChat
+ restrictChat: data.restrictChat,
+ topicSearchEnabled: data.topicSearchEnabled
}, callback);
};