aboutsummaryrefslogtreecommitdiff
path: root/views/js/footerscript.js
blob: 69e56e79c28286bd4e2c2ec7786f0ec9e8549fa3 (plain)
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
var imgs = document.querySelectorAll('#img');
var imgArray = [].slice.call(imgs);

imgArray.forEach(function(img, i){
    img.addEventListener("click", function(e){
        var id = img.getAttribute("id");
        var media = document.getElementById("media-" + id);
        var sensitive = document.getElementById("sensitive-" + id);     
        
        if(img.getAttribute("enlarge") == "0")
        {
            var attachment = img.getAttribute("attachment");
            img.setAttribute("enlarge", "1");
            img.setAttribute("style", "float: left; margin-right: 10px; cursor: pointer;");
            img.src = attachment;
        }
        else
        {
            var preview = img.getAttribute("preview");
            img.setAttribute("enlarge", "0");
            if(img.getAttribute("main") == 1)
            {
                img.setAttribute("style", "float: left; margin-right: 10px; max-width: 250px; max-height: 250px; cursor: pointer;");
                img.src = preview;
            }
            else
            {
                img.setAttribute("style", "float: left; margin-right: 10px; max-width: 125px; max-height: 125px; cursor: pointer;");
                img.src = preview;
            }
        }
    });
});


function viewLink(board, actor) {
    var posts = document.querySelectorAll('#view');
    var postsArray = [].slice.call(posts);

    postsArray.forEach(function(p, i){
        var id = p.getAttribute("post");
        p.href = "/" + board + "/" + shortURL(actor, id);
    });
}