aboutsummaryrefslogtreecommitdiff
path: root/web/scripts3.js
blob: ec86d39e67d1b180fd483361672ec9b6e8e4f8dd (plain) (blame)
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
function inlinevideo(mid) {
    var flashvars={
        file:'http://i.juick.com/video/'+mid+'.mp4',
        image:'http://i.juick.com/thumbs/'+mid+'.jpg',
        skin:'http://static.juick.com/glow.zip'
    };
    var params={
        allowfullscreen:'true'
    };
    swfobject.embedSWF('http://static.juick.com/player.swf','video-'+mid,'640','390','9.0.115','false',flashvars,params,null);
}

function postformListener(formEl,ev) {
    if(ev.ctrlKey && (ev.keyCode==10 || ev.keyCode==13)) formEl.submit();
}

function showMoreReplies(id) {
    $('#'+id+' .msg-comments').hide();

    var replies=$('#replies>li');
    var flagshow=0;
    for(var i=0; i<replies.length; i++) {
        if(flagshow==1) {
            if(replies[i].style.display=="none") {
                replies[i].style.display="block";
            } else {
                break;
            }
        }
        if(replies[i].id==id) {
            flagshow=1;
        }
    }
    return false;
}

function showCommentForm(mid,rid) {
    if($('#replies #'+rid+' textarea').length==0) {
        var c=$('#replies #'+rid+' .msg-comment');
        c.wrap('<form action="/post" method="POST" enctype="multipart/form-data"/>');
        c.before('<input type="hidden" name="mid" value="'+mid+'"/><input type="hidden" name="rid" value="'+rid+'"/>');
        c.append('<textarea name="body" rows="1" placeholder="Add a comment..." onkeypress="postformListener(this.form,event)"></textarea>');
    }
    $('#replies #'+rid+' .msg-links').hide();
    $('#replies #'+rid+' .msg-comment').show();
    $('#replies #'+rid+' textarea')[0].focus();
    return false;
}