Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Empty the suggestedWordInput
  • Loading branch information
Kira-D authored and sushain97 committed Aug 29, 2016
commit d22834e1b7de08d54e9044609a304458ccba1059
6 changes: 6 additions & 0 deletions assets/js/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ if(modeEnabled('translation')) {
});

$('#translatedText').css('height', $('#originalText').css('height'));
$('#suggestCloseBtn').click(function() {
$('#suggestedWordInput').val('');
});
$('#suggestBtn').click(function() {
var fromWord = $('#suggestionTargetWord').html();
var toWord = $('#suggestedWordInput').val();
Expand Down Expand Up @@ -578,6 +581,7 @@ function translateText() {
$('#translatedText').html(
$('#translatedText').html().replace(/(\*|\@|\#)(\S+)/g, '<span class="wordSuggestPop text-danger" title="Improve Apertium\'s translation">$2</span>'));
}

$('#translatedTextClone').html(
$('#translatedText').attr('pristineText'));

Expand All @@ -596,11 +600,13 @@ function translateText() {

$('#suggestionTargetWord').html($(this).text().replace(/(\*|\@|\#)/g, ''));
$('#suggestedWordInput').val('');

});

$('#suggestSentenceContainer').html(
dynamicLocalizations['Suggest_Sentence'].replace('{{targetWordCode}}', '<code><span id="suggestionTargetWord"></span></code>'))
$('#suggestionTargetWord').html($(this).text().replace(/(\*|\@|\#)/g, ''));

$('#wordSuggestModal').modal();
});
}
Expand Down
26 changes: 26 additions & 0 deletions index.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,32 @@
</div>
</div>

<div class="modal fade" id="wordSuggestModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="suggestCloseBtn">&times;</button>
<h4 class="modal-title" data-text="Suggest_Title"></h4>
</div>
<div class="modal-body">
<p id="translatedTextClone"></p>
<hr>
<p id="suggestSentenceContainer"></p>

<form class="form-search form-inline">
<input type="text" class="form-control"
id="suggestedWordInput"
placeholder="New Word">
<div id="suggestRecaptcha"></div>
<button type="submit" class="btn btn-primary btn-block" id="suggestBtn">
<span data-text="Suggest_Button"></span>
</button>
</form>
</div>
</div>
</div>
</div>

<div id="noscript">
<div class="lead text-warning well well-sm" data-text="Enable_JS_Warning"></div>
<noscript><p><img src="@include_piwik_url@/piwik.php?idsite=@include_piwik_siteid@" style="border: 0;" alt=""></p></noscript>
Expand Down