mirror of
https://github.com/twisterarmy/twister-calm.git
synced 2025-02-06 03:54:19 +00:00
Revert "Imported split long posts from original client"
This reverts commit b83cd20b6c28235604f3e3d42cc3a5acec39d657.
This commit is contained in:
parent
b83cd20b6c
commit
08aae0a4db
@ -1489,26 +1489,6 @@ input.userMenu-search-field:focus::-ms-input-placeholder {
|
|||||||
margin-left: -20px;
|
margin-left: -20px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
textarea.splited-post {
|
|
||||||
box-shadow: none!important;
|
|
||||||
animation-name: sent-part;
|
|
||||||
animation-duration: 0,5s;
|
|
||||||
animation-easing-function: linear;
|
|
||||||
-webkit-animation-name: sent-part;
|
|
||||||
-webkit-animation-duration: 0.5s;
|
|
||||||
-webkit-animation-easing-function: linear;
|
|
||||||
-moz-animation-name: sent-part;
|
|
||||||
-moz-animation-duration: 0.5s;
|
|
||||||
-moz-animation-easing-function: linear;
|
|
||||||
}
|
|
||||||
@keyframes sent-part {
|
|
||||||
from {
|
|
||||||
height: 0px;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
height: 80px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.highlight {
|
.highlight {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
@ -2069,11 +2049,6 @@ textarea.splited-post {
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
#splitPostWarning {
|
|
||||||
font-size: 12px;
|
|
||||||
font-style: italic;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
/* Following page */
|
/* Following page */
|
||||||
.following ol.following-list > li{
|
.following ol.following-list > li{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -2116,4 +2091,69 @@ textarea.splited-post {
|
|||||||
font: 12px "Open Sans", sans-serif;
|
font: 12px "Open Sans", sans-serif;
|
||||||
display: block;
|
display: block;
|
||||||
float: right;
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Autocomplite*/
|
||||||
|
.textcomplete-wrapper textarea {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
ul.dropdown-menu {
|
||||||
|
position: absolute;
|
||||||
|
top: 23px;
|
||||||
|
left: 170px;
|
||||||
|
z-index: 100;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
min-width: 160px;
|
||||||
|
padding: 5px 0;
|
||||||
|
margin: 2px 0 0;
|
||||||
|
list-style: none;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid rgba(0,0,0, .2);
|
||||||
|
border-radius: 6px;
|
||||||
|
-webkit-border-radius: 6px;
|
||||||
|
-moz-border-radius: 6px;
|
||||||
|
-webkit-box-shadow: 0 5px 10px rgba(0,0,0, .2);
|
||||||
|
-moz-box-shadow: 0 5px 10px rgba(0,0,0, .2);
|
||||||
|
box-shadow: 0 5px 10px rgba(0,0,0, .2);
|
||||||
|
|
||||||
|
}
|
||||||
|
ul.dropdown-menu li {
|
||||||
|
line-height: 20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
ul.dropdown-menu > .active > a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: #7691ce;
|
||||||
|
background-image: linear-gradient(to bottom, #6f88c1, #7e9bdb);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
|
||||||
|
}
|
||||||
|
ul.dropdown-menu > li > a {
|
||||||
|
display: block;
|
||||||
|
padding: 3px 20px;
|
||||||
|
clear: both;
|
||||||
|
font: 13px/20px "Open Sans", sans-serif;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-transition: all 200ms;
|
||||||
|
-moz-transition: all 200ms;
|
||||||
|
-ms-transition: all 200ms;
|
||||||
|
-o-transition: all 200ms;
|
||||||
|
transition: all 200ms;
|
||||||
|
}
|
||||||
|
ul.dropdown-menu img {
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
margin-right: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
p.post-text img {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply textarea{
|
||||||
|
margin-top: 20px;
|
||||||
}
|
}
|
@ -382,23 +382,7 @@ var composeNewPost = function( e, postAreaNew )
|
|||||||
if( !postAreaNew.hasClass("open") ) {
|
if( !postAreaNew.hasClass("open") ) {
|
||||||
postAreaNew.addClass( "open" );
|
postAreaNew.addClass( "open" );
|
||||||
//se o usuário clicar fora é pra fechar
|
//se o usuário clicar fora é pra fechar
|
||||||
postAreaNew.clickoutside( unfocusThis );
|
postAreaNew.clickoutside( unfocusThis )
|
||||||
|
|
||||||
if ($.Options.getOption('splitPosts', 'disable') === "enable")
|
|
||||||
usePostSpliting = true;
|
|
||||||
else if ($.Options.getOption('splitPosts', 'disable') === "only-new") {
|
|
||||||
var $postOrig = postAreaNew.closest(".post-data");
|
|
||||||
|
|
||||||
if (!$postOrig.length) {
|
|
||||||
$postOrig = postAreaNew.closest(".modal-content").find(".post-data");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($postOrig.length)
|
|
||||||
usePostSpliting = false;
|
|
||||||
else
|
|
||||||
usePostSpliting = true;
|
|
||||||
} else
|
|
||||||
usePostSpliting = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var textArea = postAreaNew.find("textarea");
|
var textArea = postAreaNew.find("textarea");
|
||||||
@ -415,73 +399,16 @@ var unfocusThis = function()
|
|||||||
$this.removeClass( "open" );
|
$this.removeClass( "open" );
|
||||||
}
|
}
|
||||||
|
|
||||||
var splitedPosts = [""];
|
|
||||||
var splitedPostsCount = 1;
|
|
||||||
var usePostSpliting = false;
|
|
||||||
|
|
||||||
function replyTextKeypress(e) {
|
function replyTextKeypress(e) {
|
||||||
var e = e || event;
|
var e = e || event;
|
||||||
var $this = $( this );
|
var $this = $( this );
|
||||||
var tweetForm = $this.parents("form");
|
var tweetForm = $this.parents("form");
|
||||||
if( tweetForm != undefined ) {
|
if( tweetForm != undefined ) {
|
||||||
var c = 140 - $this.val().length;
|
var c = 140 - $this.val().length;
|
||||||
if (usePostSpliting) {
|
|
||||||
if (splitedPosts.length == 0)
|
|
||||||
splitedPosts = [""];
|
|
||||||
|
|
||||||
var $tas = tweetForm.find("textarea");
|
|
||||||
splitedPosts[splitedPosts.length - 1] = $tas[$tas.length - 1].value;
|
|
||||||
|
|
||||||
for (var i = 0; i < $tas.length - 1; i++) {
|
|
||||||
if ($tas[i].value.length > 131) {
|
|
||||||
var ci = $tas[i].value.lastIndexOf(" ", 131);
|
|
||||||
ci = (ci == -1 ? 131 : ci);
|
|
||||||
$tas[i + 1].value = $tas[i].value.substr(ci) + $tas[i + 1].value;
|
|
||||||
$tas[i].value = $tas[i].value.substr(0, ci);
|
|
||||||
splitedPosts[i+1] = $tas[i + 1].value;
|
|
||||||
}else if ($tas[i].value.length === 0) {
|
|
||||||
$($tas[i]).remove();
|
|
||||||
splitedPosts.splice(i, 1);
|
|
||||||
}
|
|
||||||
splitedPosts[i] = $tas[i].value;
|
|
||||||
}
|
|
||||||
c = 140 - splitedPosts[splitedPosts.length - 1].length;
|
|
||||||
}
|
|
||||||
|
|
||||||
var remainingCount = tweetForm.find(".post-area-remaining");
|
var remainingCount = tweetForm.find(".post-area-remaining");
|
||||||
|
remainingCount.text(c);
|
||||||
if( c < 0 ) {
|
if( c < 0 ) remainingCount.addClass("warn");
|
||||||
if (usePostSpliting){
|
else remainingCount.removeClass("warn");
|
||||||
var cp = splitedPosts[splitedPosts.length-1];
|
|
||||||
var ci = cp.lastIndexOf(" ", 131);
|
|
||||||
ci = (ci == -1 ? 131 : ci);
|
|
||||||
splitedPosts[splitedPosts.length-1] = cp.substr(0, ci);
|
|
||||||
splitedPosts.push(cp.substr(ci));
|
|
||||||
splitedPostsCount = splitedPosts.length;
|
|
||||||
c += ci - 1;
|
|
||||||
} else
|
|
||||||
remainingCount.addClass("warn");
|
|
||||||
} else
|
|
||||||
remainingCount.removeClass("warn");
|
|
||||||
|
|
||||||
if (usePostSpliting) {
|
|
||||||
//var np = "";
|
|
||||||
var $tas = tweetForm.find("textarea");
|
|
||||||
|
|
||||||
if ($tas.length < splitedPosts.length){
|
|
||||||
tweetForm.prepend("<textarea class='splited-post'></textarea>");
|
|
||||||
$tas = tweetForm.find("textarea");
|
|
||||||
$($tas[0]).on("click", function(e) {e.stopPropagation()});
|
|
||||||
$tas.on("blur", replyTextKeypress);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < splitedPosts.length; i++) {
|
|
||||||
$tas[i].value = splitedPosts[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
remainingCount.text(splitedPostsCount.toString() + ". post: " + c.toString());
|
|
||||||
} else
|
|
||||||
remainingCount.text(c.toString());
|
|
||||||
|
|
||||||
var tweetAction = tweetForm.find(".post-submit");
|
var tweetAction = tweetForm.find(".post-submit");
|
||||||
if( !tweetAction.length ) tweetAction = tweetForm.find(".dm-submit");
|
if( !tweetAction.length ) tweetAction = tweetForm.find(".dm-submit");
|
||||||
@ -520,48 +447,19 @@ var replyTextSendKeys = function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var postSubmit = function(e)
|
var postSubmit = function(e)
|
||||||
{
|
{
|
||||||
if (!(e instanceof $)) {
|
e.stopPropagation();
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
var $this = $( this );
|
var $this = $( this );
|
||||||
var $replyText = $this.closest(".post-area-new").find("textarea");
|
var $replyText = $this.closest(".post-area-new").find("textarea");
|
||||||
|
|
||||||
if (!$replyText.length)
|
|
||||||
$replyText = e;
|
|
||||||
|
|
||||||
var $postOrig = $this.closest(".post-data");
|
var $postOrig = $this.closest(".post-data");
|
||||||
|
|
||||||
if (!$postOrig.length) {
|
if (!$postOrig.length) {
|
||||||
$postOrig = $this.closest(".modal-content").find(".post-data");
|
$postOrig = $this.closest(".modal-content").find(".post-data");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (splitedPostsCount > 1) {
|
newPostMsg($replyText.val(), $postOrig);
|
||||||
if (splitedPosts.length < splitedPostsCount) {
|
|
||||||
//current part will be sent as reply to the previous part...
|
|
||||||
$postOrig = $("<div data-id='" + lastPostId + "' data-screen-name='" + defaultScreenName + "'></div>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (splitedPosts.length == 1) {
|
|
||||||
if (splitedPostsCount > 1)
|
|
||||||
newPostMsg("(" + splitedPostsCount.toString() + "/" + splitedPostsCount.toString() + ") " + splitedPosts[0], $postOrig);
|
|
||||||
else
|
|
||||||
newPostMsg($replyText.val(), $postOrig);
|
|
||||||
|
|
||||||
splitedPosts[0] = '';
|
|
||||||
splitedPostsCount = 1;
|
|
||||||
} else {
|
|
||||||
var $twistform = $replyText.parents("form");
|
|
||||||
var $tas = $twistform.find("textarea");
|
|
||||||
$($tas[0]).remove();
|
|
||||||
|
|
||||||
newPostMsg("(" + (splitedPostsCount-splitedPosts.length+1).toString() + "/" + splitedPostsCount.toString() + ") " + splitedPosts.shift() + " + ", $postOrig);
|
|
||||||
setTimeout(postSubmit, 1000, $tas);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$replyText.val("");
|
$replyText.val("");
|
||||||
$replyText.attr("placeholder", polyglot.t("Your message was sent!"));
|
$replyText.attr("placeholder", polyglot.t("Your message was sent!"));
|
||||||
|
@ -131,27 +131,7 @@ var TwisterOptions = function()
|
|||||||
$('input[type="checkbox"]').on('click', function(){
|
$('input[type="checkbox"]').on('click', function(){
|
||||||
$.Options.setOption(this.name, this.checked)
|
$.Options.setOption(this.name, this.checked)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
this.splitPostsOpt = function (){
|
|
||||||
$('#splitPosts').val($.Options.getOption('splitPosts', 'disable'))
|
|
||||||
|
|
||||||
if ($.Options.getOption('splitPosts', 'disable') === 'enable'){
|
|
||||||
$("#splitPostWarning").css('display', 'inline')
|
|
||||||
}else{
|
|
||||||
$("#splitPostWarning").css('display', 'none')
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#splitPosts').on('change', function (){
|
|
||||||
$.Options.setOption(this.id, this.value);
|
|
||||||
|
|
||||||
if (this.value === 'enable'){
|
|
||||||
$("#splitPostWarning").css('display', 'inline');
|
|
||||||
}else{
|
|
||||||
$("#splitPostWarning").css('display', 'none');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.initOptions = function() {
|
this.initOptions = function() {
|
||||||
this.soundNotifOptions();
|
this.soundNotifOptions();
|
||||||
@ -159,7 +139,6 @@ var TwisterOptions = function()
|
|||||||
this.keysSend();
|
this.keysSend();
|
||||||
this.locLang();
|
this.locLang();
|
||||||
this.showPreviewOpt();
|
this.showPreviewOpt();
|
||||||
this.splitPostsOpt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -269,9 +269,7 @@ function htmlFormatMsg( msg, output, mentions ) {
|
|||||||
function _formatText(msg)
|
function _formatText(msg)
|
||||||
{
|
{
|
||||||
msg = $.emotions(msg);
|
msg = $.emotions(msg);
|
||||||
msg = msg
|
msg = msg.replace(/\n/g, '<br />');
|
||||||
.replace(/(\r?\n){2,}/g, '\n\n')
|
|
||||||
.replace(/\n/g, '<br />');
|
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
10
options.html
10
options.html
@ -126,16 +126,6 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="module">
|
|
||||||
<p class="label">Split long posts</p>
|
|
||||||
<select name="" id="splitPosts">
|
|
||||||
<option value="disable">Don't split</option>
|
|
||||||
<option value="enable">Split all</option>
|
|
||||||
<option value="only-new">Split only new post</option>
|
|
||||||
</select>
|
|
||||||
<span style="display:none" class="label" id="splitPostWarning">Mentions at replies aren't handled!</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user