Skip to content

Commit

Permalink
Update to the settings page to more closely integrate with look of th…
Browse files Browse the repository at this point in the history
…at page
  • Loading branch information
Thomas Moore committed Aug 16, 2018
1 parent d47fe4b commit d42b200
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions index.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name MastodonTranslate
// @namespace https://niu.moe/@tomo
// @version 1.7.4
// @version 1.7.5
// @description Provides a translate toot option for Mastodon users via GoogleTranslate
// @author [email protected] / https://niu.moe/@tomo
// @match *://*/web/*
Expand Down Expand Up @@ -142,13 +142,14 @@
var actions = document.querySelector('div.actions');

var settingsGroup = form.querySelector('div.fields-group').cloneNode(true);
settingsGroup.children[1].remove(); // Remove the privacy element from the clone
settingsGroup.children[1].remove(); // Remove the posting language
settingsGroup.children[1].remove(); // Remove the filtered language

var notice = document.createElement('div');
var noticeMsg = 'Translation is currently provided by Google Translate, if you\'re not happy with this please don\'t check the checkbox below or just uninstall the script. I\'m looking to offer alternatives to Google which you can track here: <a style="color: #2b90d9" href="https://github.com/tomouchuu/mastodon-translate/issues/6">https://github.com/tomouchuu/mastodon-translate/issues/6</a>';
noticeMsg += '<br>If you have an issue please give me a buzz <a style="color: #2b90d9" href="https://niu.moe/@tomo">@[email protected]</a> via mastodon or raise an issue on <a style="color: #2b90d9" href="https://github.com/tomouchuu/mastodon-translate/issues">Github</a>';
notice.setAttribute('id', 'translation_notice');
notice.innerHTML = '<h3 style="color: #d9e1e8; font-size: 20px; line-height: 24px; font-weight: 400; margin-bottom: 20px;">Tampermonkey Translation Script</h3><p style="margin-bottom: 20px;">'+noticeMsg+'</p>';
notice.innerHTML = '<h4>Tampermonkey Translation Script</h4><p style="margin-bottom: 20px;">'+noticeMsg+'</p>';

var toggle = document.createElement('div');
toggle.classList.add('input');
Expand All @@ -169,11 +170,12 @@
input.setAttribute('name', 'user[translation]');
input.setAttribute('id', 'translation_locale');
input.value = localStorage.getItem('lang');
languageDiv.children[1].textContent = 'The language to translate toots into';

settingsGroup.insertBefore(notice, languageDiv);
settingsGroup.insertBefore(toggle, languageDiv);

form.insertBefore(settingsGroup, actions);
form.insertBefore(settingsGroup, actions.nextSibling);

document.querySelector('body').addEventListener('click', saveSettings, false);
}
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Next head to your instance and head to your preferences (/settings/preferences)

### What it does

Upon clicking the ellipsis (...) you should see an option to translate toot, click this and it will translate the toot via GoogleTranslate proxy (https://github.com/uchuuio/translate-server || https://translate.uchuu.io) into english by default. To change this to your desired language, head to your mastodon preferences in settings and you should see an option for translate language. Select the language you'd like and then save changes, head back to the feed and refresh the page.
Upon clicking the ellipsis (...) you should see an option to translate toot, click this and it will translate the toot via a GoogleTranslate proxy (https://github.com/uchuuio/translate-server || https://translate.uchuu.io) into english by default. To change this to your desired language, head to your mastodon preferences in settings and you should see an option for translate language. Select the language you'd like and then save changes, head back to the feed and refresh the page.

If you haven't yet agreed to using Google Translate it will take you to your preferences page where you can enable this option.

Expand Down

0 comments on commit d42b200

Please sign in to comment.