Skip to content

Commit

Permalink
topic.js code addition translate function
Browse files Browse the repository at this point in the history
  • Loading branch information
heyanuja committed Nov 14, 2024
1 parent e803f5d commit a7a321e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions public/src/client/topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,27 @@ define('forum/topic', [
handleThumbs();

$(window).on('scroll', utils.debounce(updateTopicTitle, 250));
configurePostToggle();

handleTopicSearch();

hooks.fire('action:topic.loaded', ajaxify.data);
};

function configurePostToggle() {
$(".topic").on("click", ".view-translated-btn", function () {

Check failure on line 82 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 2 tabs but found 8 spaces

Check failure on line 82 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Strings must use singlequote

Check failure on line 82 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Strings must use singlequote

Check failure on line 82 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Strings must use singlequote
// Toggle the visibility of the next .translated-content div

Check failure on line 83 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 3 tabs but found 12 spaces
$(this).closest('.sensitive-content-message').next('.translated-content').toggle();

Check failure on line 84 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 3 tabs but found 12 spaces
// Optionally, change the button text based on visibility

Check failure on line 85 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 3 tabs but found 12 spaces
var isVisible = $(this).closest('.sensitive-content-message').next('.translated-content').is(':visible');

Check failure on line 86 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 3 tabs but found 12 spaces
if (isVisible) {

Check failure on line 87 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 3 tabs but found 12 spaces
$(this).text('Hide the translated message.');

Check failure on line 88 in public/src/client/topic.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 4 tabs but found 16 spaces
} else {
$(this).text('Click here to view the translated message.');
}
});
}

function handleTopicSearch() {
require(['mousetrap'], (mousetrap) => {
if (config.topicSearchEnabled) {
Expand Down

0 comments on commit a7a321e

Please sign in to comment.