ello-ja

Unofficial Japanese localisation of Ello.

目前為 2014-10-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           ello-ja
// @namespace      https://ello.co
// @include        https://ello.co/*
// @version        0.0.1
// @description    Unofficial Japanese localisation of Ello.
// @description:ja Ello を日本語化するスクリプトです(非公式)
// ==/UserScript==

var L = {};

L.invitations = function() {
  var doc = document;
  var header_title = doc.querySelector(".invitation__header h1");
  var header_descriptions = doc.querySelectorAll(".invitation__header p");
  var accepted_texts = doc.querySelectorAll("#invitations h2.heading");
  var text;


  // Invite your friends
  header_title.childNodes[0].nodeValue = "友達を招待しよう";

  // Ello is invitation-only.
  header_descriptions[0].childNodes[0].nodeValue = "Ello は招待制の SNS です。";
  // Use the buttons below to invite your friends. You may also send a friend an invite code manually and they can sign up at ello.co/join.
  header_descriptions[1].childNodes[0].nodeValue = "下のボタンから友達に招待メールを送りましょう。もしくは招待コードをコピーして ";
  header_descriptions[1].childNodes[2].nodeValue = " から直接登録することもできます。";

  for (var i=accepted_texts.length; i--;) {
    //text = ;
    accepted_texts[i].childNodes[1].nodeValue = " が招待を承認しました。";
  }

};

L.search = function() {
  document.getElementsByClassName("searchbar__field")[0].setAttribute("placeholder", "検索する");
}

L.settings = function() {
  
  var doc = document;
  var titles = doc.querySelectorAll("h2.heading--normal");
  var items = doc.querySelectorAll(".preference__legend span:nth-child(1)");
  var descriptions = doc.querySelectorAll(".preference__legend span:nth-child(2)");

  // Profile
  titles[0].childNodes[0].nodeValue                     = "プロフィール";

  // Your username, name, bio and links appear on your public Ello profile. Your email address remains private.
  doc.querySelector(".credentials__form p").childNodes[0].nodeValue                    = "ユーザ名、名前、自己紹介、リンクはあなたのプロフィールページで公開されます。メールアドレスは公開されません。";

  doc.querySelector(".asset__error-msg").childNodes[0].nodeValue                       = "アバター画像の保存に失敗しました。再度アバター画像をアップロードしてください。";

  doc.querySelector("label.string.required.form__label").childNodes[0].nodeValue       = "ユーザ名";
  doc.querySelector("label.email.required.form__label").childNodes[0].nodeValue        = "メールアドレス";
  doc.querySelector("label.password.required.form__label").childNodes[0].nodeValue     = "パスワード";
  doc.querySelectorAll(".password label")[1].childNodes[0].nodeValue                    = "現在のパスワード";
  doc.querySelectorAll("fieldset.form__fieldset p")[0].childNodes[0].nodeValue            = "変更を保存するため、パスワード(8 文字以上)を再度入力してください。";
  doc.querySelector("label.string.optional.form__label").childNodes[0].nodeValue       = "名前";
  doc.querySelector("label.text.optional.form__label").childNodes[0].nodeValue         = "自己紹介";
  doc.querySelectorAll("label.string.optional.form__label")[1].childNodes[0].nodeValue = "リンク";
  doc.querySelector("p.profile__flash-message").childNodes[0].nodeValue                = "プロフィールを保存しました";
  doc.querySelector("fieldset.form__fieldset a").childNodes[0].nodeValue               = "プロフィールを見る";


  doc.querySelector(".bio__counter").style.left = "3.5rem";

  // Settings
  titles[1].childNodes[0].nodeValue       = "設定";

  items[0].childNodes[0].nodeValue        = "プロフィールを Ello の外部に公開";
  // Make your profile viewable to people outside of the Ello network.
  descriptions[0].childNodes[0].nodeValue = "Ello に登録していない人たちもあなたのプロフィールを閲覧できるようにします。";

  items[1].childNodes[0].nodeValue        = "コメントの許可";
  // Allow other users to comment on your posts.
  descriptions[1].childNodes[0].nodeValue = "他のユーザがあなたの投稿にコメントをつけることができるようにします。";

  items[2].childNodes[0].nodeValue        = "情報収集の許可";
  // Allow Ello to gather anonymous information about your visit, which helps us make Ello better. <a href="/wtf/post/information-use">Learn more</a>.
  descriptions[2].childNodes[0].nodeValue = "Ello の質を向上させるため、Ello があなたの訪問情報を匿名化して収集することを許可します。";

  // Notifications
  titles[2].childNodes[0].nodeValue       = "通知";

  items[3].childNodes[0].nodeValue        = "コメント";
  descriptions[3].childNodes[0].nodeValue = "他のユーザがあなたの投稿にコメントをつけたことを知らせるメールを受信します。";

  items[4].childNodes[0].nodeValue        = "メンション";
  descriptions[4].childNodes[0].nodeValue = "他のユーザがあなたについて @ で言及したことを知らせるメールを受信します。";

  items[5].childNodes[0].nodeValue        = "新規フォロワー";
  descriptions[5].childNodes[0].nodeValue = "他のユーザがあなたをフォローし始めたことを知らせるメールを受信します。。";

  items[6].childNodes[0].nodeValue        = "招待の受け入れ";
  descriptions[6].childNodes[0].nodeValue = "他のユーザがあなたの招待を受け入れたことを知らせるメールを受信します。";

  items[7].childNodes[0].nodeValue        = "Ello からのお知らせ";
  descriptions[7].childNodes[0].nodeValue = "Ello のアップデートの告知や Ello の機能を紹介するメールを受信します。";

  // Account Deletion
  titles[3].childNodes[0].nodeValue = "アカウントの削除";
  // By deleting your account you remove your personal information from Ello. Your account cannot be restored.
  items[8].childNodes[0].nodeValue  = "Ello アカウントを削除すると、あなたの個人情報は Ello から取り除かれます。削除されたアカウントの復元はできません。";

};



function localiseSpecialPages() {
  console.log(window.location.href);
  var reservedSlug = {
    "beta-public-profiles"  : function(){ console.log(self); },
    "request-an-invitation" : function(){ console.log(self); },
    "manifesto"             : function(){ console.log(self); },
    "who-made-this"         : function(){ console.log(self); },
    "wtf"                   : function(){ console.log(self); },
    "search"                : function(){ L.search(); },
    "invitations"           : function(){ L.invitations(); },
    "settings"              : function(){ L.settings(); },
    "friends"               : function(){ console.log(self); },
    "noise"                 : function(){ console.log(self); },
    "facemaker"             : function(){ console.log(self); },
    "enter"                 : function(){ console.log(self); },
    "forgot-my-password"    : function(){ console.log(self); },
    "join"                  : function(){ console.log(self); }
   };

   var current_page = reservedSlug[window.location.href.split("/")[3]];

   if (current_page !== undefined) {
      current_page.call();
  }
}

function localiseGeneralElements() {
  var doc = document;
  var deleting_text = doc.querySelectorAll(".delete__dialog p")[0].childNodes;

  doc.querySelector(".ismuted").childNodes[0].nodeValue                    = "ミュート解除";
  doc.querySelector(".notmuted").childNodes[0].nodeValue                   = "ミュート";
  doc.querySelectorAll(".block-user__column p")[0].childNodes[0].nodeValue = "このユーザをミュートすると、あなたのフィード上からこのユーザのアクティビティが取り除かれます。また、このユーザ関連のメール通知も Ello から送られなくなります。このユーザはあなたをフォローし続けることもあなたの投稿にコメントをつけることもできますが、それらはあなたに一切通知されません。";

  doc.querySelector(".isblocked").childNodes[0].nodeValue                  = "ブロック解除";
  doc.querySelector(".notblocked").childNodes[0].nodeValue                 = "ブロック";
  doc.querySelectorAll(".block-user__column p")[1].childNodes[0].nodeValue = "このユーザをブロックすると、このユーザはあなたのフィード上やメール通知からミュートされます。それに加え、このユーザはあなたの投稿やプロフィールを閲覧することもできなくなります。ブロック機能を活用する際は、Ello の外部からあなたの投稿やプロフィールが閲覧されることを防ぐため、設定画面からアカウントを非公開にすることをおすすめします。";

  doc.querySelector(".delete-s1").childNodes[0].nodeValue                  = "アカウントを削除しますか?";
  doc.querySelector(".delete-s2").childNodes[0].nodeValue                  = "本当にアカウントを削除しますか?";

  deleting_text[0].nodeValue = "あなたのアカウントを削除中です。";
  deleting_text[2].nodeValue = " 秒後にリダイレクトします。";

  doc.querySelectorAll(".delete__dialog p")[1].childNodes[0].nodeValue     = "※ Ello アカウントを削除すると、あなたの個人情報は Ello から取り除かれます。削除されたアカウントの復元はできません。";
}


(function() {
  var target = document.querySelector('body');

  var config = {
    childList: true,
    subtree: true
  };

  var observer = new MutationObserver(function(mutations, self) {
    mutations.forEach(function(mutation) {
      if (mutation.type === 'childList') {
        localiseSpecialPages();
      }
    });
  });

  observer.observe(target, config);

  localiseGeneralElements();
})();