-
Notifications
You must be signed in to change notification settings - Fork 8
/
profile.js
86 lines (73 loc) · 2.46 KB
/
profile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
$(function(){
$('#profilecardname').text(Cookies.get('name'));
$('#profilecarduid').text('@'+Cookies.get('uid'));
$statslistitemcount = $('#statslistitemcount');
$totalchars = $('#totalchars');
$posttweetta = $('#posttweetta');
$tweetscontainer = $('#tweetscontainer');
$posttweetta.keypress(function(e){
if (e.keyCode == 13 && !e.shiftKey)
{
e.preventDefault();
return false;
}
});
$posttweetta.keyup(function(e){
$totchars = $(this).val().length;
if($totchars <= 250)
$totalchars.text($totchars);
else
{
$totalchars.text('250');
$(this).val($(this).val().substring(0, 250));
}
});
$('#posttweetbut').click(function(){
if(($taval = $.trim($posttweetta.val())).length > 0)
{
$tweetscontainer.prepend(tweetitem($taval));
$posttweetta.val('');
$statslistitemcount.text(parseInt($statslistitemcount.text()) + 1);
}
});
$tweetscontainer.on('click', 'span.retweet', function(){
$tweetstatscount = $(this).children('.tweetstatscount');
$tweetstatscount.text(parseInt($tweetstatscount.text()) + 1);
$tweetscontainer.prepend(tweetitem($tweetstatscount.closest('.tweetcontainer').find('p').text()));
$statslistitemcount.text(parseInt($statslistitemcount.text()) + 1);
});
$tweetscontainer.on('click', 'span.like', function(){
$tweetstatscount = $(this).children('.tweetstatscount');
if($(this).hasClass('red'))
{
$(this).removeClass('red');
$tweetstatscount.text(parseInt($tweetstatscount.text()) - 1);
}
else
{
$(this).addClass('red');
$tweetstatscount.text(parseInt($tweetstatscount.text()) + 1);
}
});
function tweetitem($taval)
{
return '<li class="tweetcontainer">'+
'<img class="tweetprofimg" src="http:https://3.bp.blogspot.com/-JCYefwq__2U/TxCfC3s1ZpI/AAAAAAAAKcM/u5mw7qPAL0w/s300-c/Camilla-Belle-6.jpg">'+
'<span class="tweetprofname">'+Cookies.get('name')+'</span>'+
'<span class="tweetprofuid">@'+Cookies.get('uid')+'</span>'+
'<div class="ml58px">'+
'<p style="margin: 0px;">'+$taval+'</p>'+
'<div class="mt10px">'+
'<span class="retweet tweetstats">'+
'<i class="fa fa-retweet"></i>'+
'<span class="tweetstatscount">0</span>'+
'</span>'+
'<span class="like tweetstats">'+
'<i class="fa fa-heart-o"></i>'+
'<span class="tweetstatscount">0</span>'+
'</span>'+
'</div>'+
'</div>'+
'</li>';
}
});