Browse Source

updates for twitter 280 limit

pull/96/head
Aaron Parecki 7 years ago
parent
commit
6448298d95
No known key found for this signature in database GPG Key ID: 276C2817346D6056
  1. 11
      views/new-post.php

11
views/new-post.php

@ -37,7 +37,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div id="note_content_remaining" class="pcheck206"><img src="/images/twitter.ico"> <span>140</span></div>
<div id="note_content_remaining" class="pcheck206"><img src="/images/twitter.ico"> <span>280</span></div>
<label for="note_content">Content</label> <label for="note_content">Content</label>
<textarea id="note_content" value="" class="form-control" style="height: 4em;"></textarea> <textarea id="note_content" value="" class="form-control" style="height: 4em;"></textarea>
</div> </div>
@ -222,7 +222,7 @@
.pcheck206 { color: #6ba15c; } /* tweet fits within the limit even after adding RT @username */ .pcheck206 { color: #6ba15c; } /* tweet fits within the limit even after adding RT @username */
.pcheck207 { color: #c4b404; } /* danger zone, tweet will overflow when RT @username is added */ .pcheck207 { color: #c4b404; } /* danger zone, tweet will overflow when RT @username is added */
.pcheck200,.pcheck208 { color: #59cb3a; } /* exactly fits 140 chars, both with or without RT */
.pcheck200,.pcheck208 { color: #59cb3a; } /* exactly fits 280 chars, both with or without RT */
.pcheck413 { color: #a73b3b; } /* over max tweet length */ .pcheck413 { color: #a73b3b; } /* over max tweet length */
.reply-context { .reply-context {
@ -529,8 +529,8 @@ $(function(){
$("#note_content").on('change keyup', function(e){ $("#note_content").on('change keyup', function(e){
var text = $("#note_content").val(); var text = $("#note_content").val();
var tweet_length = tw_text_proxy(text).length; var tweet_length = tw_text_proxy(text).length;
var tweet_check = tw_length_check(text, 140, "<?= $this->user->twitter_username ?>");
var remaining = 140 - tweet_length;
var tweet_check = tw_length_check(text, 280, "<?= $this->user->twitter_username ?>");
var remaining = 280 - tweet_length;
$("#note_content_remaining span").html(remaining); $("#note_content_remaining span").html(remaining);
$("#note_content_remaining").removeClass("pcheck200 pcheck206 pcheck207 pcheck208 pcheck413"); $("#note_content_remaining").removeClass("pcheck200 pcheck206 pcheck207 pcheck208 pcheck413");
$("#note_content_remaining").addClass("pcheck"+tweet_check); $("#note_content_remaining").addClass("pcheck"+tweet_check);
@ -568,6 +568,8 @@ $(function(){
// } // }
// $("#note_category").val(category.join(", ")); // $("#note_category").val(category.join(", "));
/*
// stop auto-populating usernames in replies, since Twitter no longer requires it
if($("#note_content").val() == "" && data.mentions) { if($("#note_content").val() == "" && data.mentions) {
var mentions = ''; var mentions = '';
for(var i in data.mentions) { for(var i in data.mentions) {
@ -575,6 +577,7 @@ $(function(){
} }
$("#note_content").val(mentions); $("#note_content").val(mentions);
} }
*/
if(data.entry) { if(data.entry) {
$(".reply-context .content").text(data.entry.content.text); $(".reply-context .content").text(data.entry.content.text);

Loading…
Cancel
Save