diff --git a/css/style.css b/css/style.css index 4147575..8ecf291 100644 --- a/css/style.css +++ b/css/style.css @@ -1542,6 +1542,17 @@ button.disabled:hover #notifyForm p, #choseLanguage p, #keysOpt p { margin-top: 15px; } +.suboptions { + margin: 5px 30px; + border: double 2px rgba( 69, 71, 77, .1 ); + height: 0px; + overflow: hidden; + transition: height 1s linear; + -webkit-transition: height 1s linear; + -moz-transition: height 1s linear; + -o-transition: height 1s linear; + -ms-transition: height 1s linear; +} /* Autocomplite*/ .textcomplete-wrapper textarea { diff --git a/following.html b/following.html index 642f36c..8d3145f 100644 --- a/following.html +++ b/following.html @@ -229,6 +229,7 @@
140 +
@@ -282,6 +283,7 @@
140 +
@@ -329,6 +331,7 @@
140 +
diff --git a/home.html b/home.html index 8269906..af21dc7 100644 --- a/home.html +++ b/home.html @@ -127,6 +127,7 @@
140 +
@@ -251,6 +252,7 @@
140 +
@@ -305,6 +307,7 @@
140 +
@@ -352,6 +355,7 @@
140 +
diff --git a/js/interface_common.js b/js/interface_common.js index c38c426..0eb89de 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -424,6 +424,8 @@ function replyTextKeypress(e) { var $this = $( this ); var tweetForm = $this.parents("form"); if( tweetForm != undefined ) { + if ($.Options.getUnicodeConversionOpt() !== "disable") + $this.val(convert2Unicodes($this.val(), $this)); var c = 140 - $this.val().length; var remainingCount = tweetForm.find(".post-area-remaining"); remainingCount.text(c); @@ -458,6 +460,442 @@ function replyTextKeypress(e) { } } +/* + * unicode convertion list + * k: original string to be replaced + * u: unicode + * n: index of char to be stored and appended to result + */ +var unicodeConversionList = { + "ponctuations": [ + { + "k": /\.\.\./, + "u": "…", + "n": -1 + }, + { + "k": /\.\../, + "u": "‥", + "n": 2 + }, + { + "k": /\?\?/, + "u": "⁇", + "n": -1 + }, + { + "k": /\?!/, + "u": "⁈", + "n": -1 + }, + { + "k": /!\?/, + "u": "⁉", + "n": -1 + }, + { + "k": /!!/, + "u": "‼", + "n": -1 + } + ], + "emotions": [ + { + "k": /:.{0,1}D/, + "u": "😃", + "n": -1 + }, + { + "k": /(0|O):-{0,1}\)/i, + "u": "😇", + "n": -1 + }, + { + "k": /:beer:/, + "u": "🍺", + "n": -1 + }, + { + "k": /3:.{0,1}\)/, + "u": "😈", + "n": -1 + }, + { + "k": /<3/, + "u":"❤", + "n": -1 + }, + { + "k": /o.O|:\/|:\\/, + "u": "😕", + "n": -1 + }, + { + "k": /:\'\(/, + "u": "😢", + "n": -1 + }, + { + "k": /(:|=).{0,1}\(/, + "u": "😞", + "n": -1 + }, + { + "k": /8(\)<|\|)/, + "u": "😎", + "n": -1 + }, + { + "k": /(:|=)-{0,1}(\)|\])/, + "u": "😊", + "n": -1 + }, + { + "k": /(\(|\[)-{0,1}(:|=)/, + "u": "😊", + "n": -1 + }, + { + "k": /:\*/, + "u": "😗", + "n": -1 + }, + { + "k": /\^.{0,1}\^/, + "u": "😆", + "n": -1 + }, + { + "k": /:p/i, + "u": "😛", + "n": -1 + }, + { + "k": /;-{0,1}\)/, + "u": "😉", + "n": -1 + }, + { + "k": /\(-{0,1};/, + "u": "😉", + "n": -1 + }, + { + "k": /:(O|0)/, + "u": "😮", + "n": -1 + }, + { + "k": /:@/, + "u": "😱", + "n": -1 + } + ], + "signs": [ + { + "k": / tel( |:|=)/i, + "u": " ℡", + "n": 4 + }, + { + "k": /^tel( |:|=)/i, + "u": "℡", + "n": 3 + }, + { + "k": / fax( |:|=)/i, + "u": " ℻", + "n": 4 + }, + { + "k": /^fax( |:|=)/i, + "u": "℻", + "n": 3 + } + ], + "fractions": [ + { + "k": /1\/2/, + "u": "½", + "n": -1 + }, + { + "k": /1\/3/, + "u": "⅓", + "n": -1 + }, + { + "k": /2\/3/, + "u": "⅔", + "n": -1 + }, + { + "k": /1\/4/, + "u": "¼", + "n": -1 + }, + { + "k": /3\/4/, + "u": "¾", + "n": -1 + }, + { + "k": /1\/5/, + "u": "⅕", + "n": -1 + }, + { + "k": /2\/5/, + "u": "⅖", + "n": -1 + }, + { + "k": /3\/5/, + "u": "⅗", + "n": -1 + }, + { + "k": /4\/5/, + "u": "⅘", + "n": -1 + }, + { + "k": /1\/6/, + "u": "⅙", + "n": -1 + }, + { + "k": /5\/6/, + "u": "⅚", + "n": -1 + }, + { + "k": /1\/7/, + "u": "⅐", + "n": -1 + }, + { + "k": /1\/8/, + "u": "⅛", + "n": -1 + }, + { + "k": /3\/8/, + "u": "⅜", + "n": -1 + }, + { + "k": /5\/8/, + "u": "⅝", + "n": -1 + }, + { + "k": /7\/8/, + "u": "⅞", + "n": -1 + }, + { + "k": /1\/9/, + "u": "⅑", + "n": -1 + }, + { + "k": /1\/10/, + "u": "⅒", + "n": -1 + } + ] +}; + +/* + * a stack for undo... + * element for the unicodeConversionStack + * { + k: original string that's replaced + u: unicode + p: position in string + l: length of k + m: new string length after convertion + * } + */ +var unicodeConversionStack = []; +//we want to handle new typed text after the last conversion. +var lastConvertedIndex = -1; + +function convert2Unicodes(s, ta) { + + var tmp = s; + + //check if there is a deletion... + //NOTE: BUGGY... can't handle everytime... + if (unicodeConversionStack.length>0 && s.length < unicodeConversionStack[0].m){ + //check if a replaced unicode was deleted... + for (var i=unicodeConversionStack.length-1; i>=0; i--){ + //get position and check the positions are same... + var ni = s.indexOf(unicodeConversionStack[i].u); + if (ni > -1 && s[ni] !== unicodeConversionStack[i].p){ + var op = -1; + for (var j=i-1; j>=0; j--){ + if (unicodeConversionStack[j].u === unicodeConversionStack[i].u){ + if (unicodeConversionStack[j].p === ni){ + op = -1; + break; + } + op = unicodeConversionStack[j].p; + } + } + if (op === -1) { + //remove deleted unicode... + unicodeConversionStack.splice(i, 1); + } else { + //update the position of the unicode! + unicodeConversionStack[i].p = ni; + } + } + } + unicodeConversionStack[0].m = s.length; + } + + if (s.length < lastConvertedIndex) + lastConvertedIndex = s.length; + + if ($.Options.getUnicodeConversionOpt() === "enable" || $.Options.getConvertPunctuationsOpt()){ + + var list = unicodeConversionList.ponctuations; + for (var i=0; i 0 && kl.index >= lastConvertedIndex) { + var nc = ""; + if (list[i].n > -1){ + //if it's necessary, get any next char to prevent from any data loss + nc = tmp[kl.index + list[i].n]; + } + tmp = tmp.replace(list[i].k, list[i].u + nc); + var len = s.length - tmp.length + list[i].u.length; + unicodeConversionStack.unshift({ + "k": s.substr(kl.index, len), + "u": list[i].u + nc, + "p": kl.index, + "l": len, + "m": tmp.length + }); + s = tmp; + lastConvertedIndex = tmp.length; + } + } + } + + if ($.Options.getUnicodeConversionOpt() === "enable"|| $.Options.getConvertEmotionsOpt()){ + + var list = unicodeConversionList.emotions; + for (var i=0; i 0 && kl.index >= lastConvertedIndex) { + var nc = ""; + if (list[i].n > -1){ + //if it's necessary, get any next char to prevent from any data loss + nc = tmp[kl.index + list[i].n]; + } + tmp = tmp.replace(list[i].k, list[i].u + nc); + var len = s.length - tmp.length + list[i].u.length; + unicodeConversionStack.unshift({ + "k": s.substr(kl.index, len), + "u": list[i].u + nc, + "p": kl.index, + "l": len, + "m": tmp.length + }); + s = tmp; + lastConvertedIndex = tmp.length; + } + } + } + + if ($.Options.getUnicodeConversionOpt() === "enable"|| $.Options.getConvertSignsOpt()){ + + var list = unicodeConversionList.signs; + for (var i=0; i 0 && kl.index >= lastConvertedIndex) { + var nc = ""; + if (list[i].n > -1){ + //if it's necessary, get any next char to prevent from any data loss + nc = tmp[kl.index + list[i].n]; + } + tmp = tmp.replace(list[i].k, list[i].u + nc); + var len = s.length - tmp.length + list[i].u.length; + unicodeConversionStack.unshift({ + "k": s.substr(kl.index, len), + "u": list[i].u + nc, + "p": kl.index, + "l": len, + "m": tmp.length + }); + s = tmp; + lastConvertedIndex = tmp.length; + } + } + } + + if ($.Options.getUnicodeConversionOpt() === "enable"|| $.Options.getConvertFractionsOpt()){ + + var list = unicodeConversionList.fractions; + for (var i=0; i 0 && kl.index >= lastConvertedIndex) { + var nc = ""; + if (list[i].n > -1){ + //if it's necessary, get any next char to prevent from any data loss + nc = tmp[kl.index + list[i].n]; + } + tmp = tmp.replace(list[i].k, list[i].u + nc); + var len = s.length - tmp.length + list[i].u.length; + unicodeConversionStack.unshift({ + "k": s.substr(kl.index, len), + "u": list[i].u + nc, + "p": kl.index, + "l": len, + "m": tmp.length + }); + s = tmp; + lastConvertedIndex = tmp.length; + } + } + } + + if (unicodeConversionStack.length > 0){ + var ub = ta.closest(".post-area-new").find(".undo-unicode"); + ub.text("undo: " + unicodeConversionStack[0].u); + $.MAL.enableButton(ub); + } else { + $.MAL.disableButton(ta.closest(".post-area-new").find(".undo-unicode")); + } + + return tmp; +} + +//BUGGY... if user deletes something in the middle, stack could be deformed... +function undoLastUnicode(e) { + e.stopPropagation(); + e.preventDefault(); + + if (unicodeConversionStack.length === 0) + return; + + var uc = unicodeConversionStack.shift(); + + $ta = $(this).closest(".post-area-new").find("textarea"); + var pt = $ta.val(); + + if (pt.substr(uc.p, uc.u.length) === uc.u) + $ta.val(pt.substr(0,uc.p) + uc.k + pt.substr(uc.p + 2)); + + if (unicodeConversionStack.length > 0) + $(this).text("undo: " + unicodeConversionStack[0].u); + else + $.MAL.disableButton($(this)); +} + var postSubmit = function(e) { e.stopPropagation(); @@ -518,6 +956,11 @@ function initInterfaceCommon() { $( ".post-submit").click( postSubmit ); $( ".modal-propagate").click( retweetSubmit ); + if ($.Options.getUnicodeConversionOpt() === "disable") + $( ".undo-unicode" ).click( undoLastUnicode ).css("display", "none"); + else + $( ".undo-unicode" ).click( undoLastUnicode ); + var $replyText = $( ".post-area-new textarea" ); $replyText.on("keyup", replyTextKeypress ); diff --git a/js/interface_localization.js b/js/interface_localization.js index 5e7c26a..728dae6 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -1742,7 +1742,42 @@ if(preferredLanguage == "tr"){ "Secret key:": "Gizli anahtar:", "Options": "Ayarlar", "Switch to Promoted posts": "Destekli Mesajlara Geç", - "Switch to Normal posts": "Normal Mesajlara Geç" + "Switch to Normal posts": "Normal Mesajlara Geç", + "Use language": "Dil ayarla", + "Ignore": "Görmezden gel", + "Theme": "Tema", + "Keys": "Tuşlar", + "Sound notifications": "Sesli uyarılar", + "Send key": "Gönderme tuşu", + "Posts display": "Gönderiler", + "Post editor": "Gönderi düzenleyici", + "Inline image preview": "Dahili resim ön izleme", + "Display": "Göster", + "Line feeds": "Satır sonları", + "Supported punctuations:": "Desteklenen noktalama işaretleri:", + "Supported emotions:": "Desteklenen duygu simgeleri:", + "Supported signs:": "Desteklenen işaretler:", + "Supported fractions:": "Desteklenen kesirler:", + "Automatic unicode conversion options": "Otomatik unicode dönüştürme seçenekleri", + "Convert punctuations to unicode": "Noktalama işaretlerini unicode'a dönüştür", + "Convert emotions codes to unicode symbols": "Duygu simge kodlarını unicode simgelerine dönüştür", + "Convert common signs to unicode": "Yaygın işaretleri unicode'a dönüştür", + "Convert fractions to unicode": "Kesirleri unicode'a dönüştür", + "Convert all": "Hepsini dönüştür", + "Auto": "Otomatik", + "Original": "Orjinal", + "none": "Hiçbiri", + "Custom": "Özel", + "Mentions": "Bahsedenler", + "You have to log in to post messages.": "Mesaj göndermek için giriş yapmalısınız.", + "You have to log in to post replies.": "Cevap göndermek için giriş yapmalısınız.", + "You have to log in to retransmit messages.": "Yeniden iletmek için giriş yapmalısınız.", + "You have to log in to use direct messages.": "Direk masajları kullanabilmek için giriş yapmalısınız.", + "You have to log in to follow users.": "Kullanıcı takip etmek için giriş yapmalısınız.", + "You are not following anyone because you are not logged in.": "Giriş yapmadığınız için kimseyi takip etmiyorsunuz.", + "You don't have any followers because you are not logged in.": "Giriş yapmadığınız için hiç takipçiniz yok.", + "No one can mention you because you are not logged in.": "Giriş yapmadığınız için kimse adınıza mesaj gönderemiyor.", + "You don't have any profile because you are not logged in.": "Giriş yapmadığınız için profiliniz yok." }; } @@ -1791,7 +1826,10 @@ var fixedLabels = [ ".module span", ".login span", ".login-local-username", - ".login input" + ".login input", + + //options page + "option" ]; $(document).ready(function(){ for(var i=0;i
-

Use language

+

Use language

@@ -91,10 +91,10 @@
-

Sound notifications

+

Sound notifications

-

Mentions

+

Mentions


-

Direct Messages

+

Direct Messages

@@ -133,10 +133,10 @@
- +
-

Posts display

+

Posts display

Line feeds

@@ -148,7 +148,7 @@
-

Inline image preview

+

Inline image preview

+ + + + +
+ Convert punctuations to unicode
+
+ + ‥ … ⁇ ⁈ ⁉ ‼ +
+
+ Convert emotions codes to unicode symbols
+
+ + 😃 😇 🍺 😈 ❤ 😕 😢 😞 😎 😊 😊 😗 😆 😛 😉 😉 😮 😱 +
+
+ Convert common signs to unicode
+
+ + ℡ ℻ +
+
+ Convert fractions to unicode
+
+ + ½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅐ ⅛ ⅜ ⅝ ⅞ ⅑ ⅒ +
+
+ +
+
+
+