Fakultas Ilmu Komputer UI

detail_materi.html 25.6 KB
Newer Older
1
{% extends 'base.html' %}
2
{% load static %} {% load humanize %}
3
4

{% block header %}
5
<link href="{% static 'css/sb-admin-2.min.css' %}" rel="stylesheet">
6
<link rel="stylesheet" type="text/css" href="{% static 'app/css/detail_materi.css' %}">
7
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;1,100&display=swap" rel="stylesheet">
8
9
<script async defer crossorigin="anonymous"
    src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v6.0"></script>
10
<script src="{% static 'js/detail_materi.js'%}"></script>
11
12
13
{% endblock header %}

{% block title %}
14
{{materi_data.title}} | Digipus
15
{% endblock title %}
16
17

{% block content %}
18
19
20
21
{% block verification %} {% endblock verification %}
<div id="fb-root"></div>
<div class="container-fluid p-0 bg detail-materi-color">
    <nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
22

23
24
        <!-- Sidebar Toggle (Topbar) -->
        <button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
25
            <i class="fa fa-bars" aria-hidden="true"></i>
26
        </button>
27

28
        <div class="sidebar-brand-text mx-3">Diskominfo Kota Depok</div>
29

30
31
        <!-- Topbar Navbar -->
        <ul class="navbar-nav ml-auto">
32

33
            {% if request.user.is_contributor %}
34
35
36
37
38
39
40
41
42
            {% if materi_data.status == "DISAPPROVE" %}
            <li class="nav-item black-text">
                <a class="nav-link feedback" data-toggle="modal" data-target="#umpanBalikModal">
                    <span class="mr-2 d-none d-lg-inline text-gray-600 small">Umpan Balik Materi</span>
                </a>
                <div class="modal fade" id="umpanBalikModal" tabindex="-1" role="dialog"
                    aria-labelledby="exampleModalLabel" aria-hidden="true">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
43
                            <div class="modal-header">
44
45
46
47
                                <h5 class="modal-title black-text" id="exampleModalLabel">Umpan Balik Materi</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
48
49
                            </div>
                            <div class="modal-body">
50
                                {% for item in report %}
51
52
                                <p class="black-text">Alasan materi ditolak:</p>
                                <p class="black-text">{{ item.report.feedback }}</p>
53
54
55
                                <p class="black-text">Untuk merevisi materi, sila tekan tombol revisi di halaman riwayat
                                    unggah.</p>
                                {% endfor %}
56
57
                            </div>
                            <div class="modal-footer">
58
                                <button type="button" class="btn btn-danger" data-dismiss="modal">Tutup</button>
59
60
                            </div>
                        </div>
61
62
63
64
                    </div>
                </div>
            </li>
            {% endif %}
65
66
            {% endif %}

67
68
69
70
            <li class="nav-item">
                <a class="nav-link" href="/">
                    <span class="mr-2 d-none d-lg-inline text-gray-600 small">Halaman Katalog</span>
                </a>
71
72
            </li>

73
74
75
76
77
78
79
80
            {% if request.user.is_contributor %}
            <li class="nav-item">
                <a class="nav-link" href="/dashboard/">
                    <span class="mr-2 d-none d-lg-inline text-gray-600 small">Dasbor</span>
                </a>
            </li>
            {% endif %}

81
82
83
            <div class="topbar-divider d-none d-sm-block"></div>

            <!-- Nav Item - User Information -->
84
            {% if request.user.is_authenticated %}
85
            <li class="nav-item dropdown no-arrow">
86
87
88
89
90
91
92
93
94
95
                <a class="nav-link dropdown-toggle" href="/dashboard/">
                    <span class="mr-2 d-none d-lg-inline text-gray-600 small">{{ user.name }}</span>
                    {% if not user.default_profile_picture %}
                    <img class="img-profile rounded-circle" src="https://i.ibb.co/9wgPzyZ/default-image.png"
                        alt="User profile picture">
                    {% else %}
                    <img class="img-profile rounded-circle" src="{{ user.profile_picture.url }}"
                        alt="User profile picture">
                    {% endif %}
                </a>
96
            </li>
97
            {% endif %}
98

99
        </ul>
100

101
102
103
104
105
106
107
108
109
110
111
    </nav>
    <div class="row materi-data mr-4 ml-4 p-3 shadow-sm rounded">
        <div class="col col-3 cover">
            <img src={{materi_data.cover.url}} alt="cover">
        </div>
        <div class="col col-6 ml-3 book">
            <h2>{{materi_data.title}}</h2>
            <div class="category-wrapper">
                {% for category in materi_data.categories.all %}
                <span class="mr-1">#{{category.name}}</span>
                {% endfor %}
112
            </div>
113
114
115
116
117
118
119
120
            <div class="info-wrapper">
                <div class="info" id="1">
                    <dl class="col col-4">
                        <dt class="info-name">Penulis</dt>
                    </dl>
                    <dd>
                        <p class="info-content">{{materi_data.author}}</p>
                    </dd>
121
                </div>
122
123
124
125
126
127
128
                <div class="info" id="1">
                    <dl class="col col-4">
                        <dt class="info-name">Penerbit</dt>
                    </dl>
                    <dd>
                        <p class="info-content">{{materi_data.publisher}}</p>
                    </dd>
129
                </div>
130
131
132
133
134
135
136
137
                <div class="info" id="1">
                    <dl class="col col-4">
                        <dt class="info-name">Tahun Terbit</dt>
                    </dl>
                    <dd>
                        <p class="info-content">{{materi_data.release_year}}</p>
                    </dd>
                </div>
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
                <div class="info" id="1">
                    <dl class="col col-4">
                        <dt class="info-name">Kontributor</dt>
                    </dl>
                    <dd>
                        <a class="info-content"
                            href="{% url 'katalog-per-kontributor' materi_data.uploader.email %}">{{materi_data.uploader.name}}</a>
                    </dd>
                </div>
                <div class="info" id="1">
                    <dl class="col col-4">
                        <dt class="info-name">Jumlah Halaman</dt>
                    </dl>
                    <dd>
                        <p class="info-content">{{materi_data.pages}}</p>
                    </dd>
                </div>
                <div class="info" id="1">
                    <dl class="col col-4">
                        <dt class="info-name">Ukuran File</dt>
                    </dl>
                    <dd>
                        <p class="info-content">{{materi_data.content.size|filesizeformat}}</p>
                    </dd>
                </div>
            </div>
            <div class="buttons d-flex flex-row bd-highlight mb-1">
                <a href="{% url 'view-materi' materi_data.id %}"
                    class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Baca</a>
                <a href="{% url 'download-materi' materi_data.id %}"
                    class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Unduh</a>
                <div class="dropdown">
                    <button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded" type="button"
                        id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Bagikan
                    </button>
                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                        <div class="fb-share-button" data-href="{% url 'detail-materi' materi_data.id %}"
                            data-layout="button" data-size="small">
                            <a target="_blank"
                                href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdigipus-staging-2.herokuapp.com%2Fmateri%2F{{materi_data.id}}%2F&amp;src=sdkpreparse"
                                class="dropdown-item fb-xfbml-parse-ignore">Facebook</a>
180
                        </div>
181
182
183
184
185
186
187
188
189
190
191
192
                        <a class="twitter-share-button dropdown-item"
                            href="https://twitter.com/intent/tweet?text=Cek%20materi%20ini%20yuk%20https%3A%2F%2Fdigipus-staging-2.herokuapp.com%2Fmateri%2F{{materi_data.id}}%2F"
                            target="_blank" data-size="large">
                            Twitter
                        </a>
                        <a class="dropdown-item"
                            href="whatsapp://send?text=Cek materi ini yuk! https://digipus-staging-2.herokuapp.com{{request.path}}"
                            target="_blank">Whatsapp</a>
                        <a class="dropdown-item"
                            href="https://social-plugins.line.me/lineit/share?url=https%3A%2F%2Fdigipus-staging-2.herokuapp.com%2Fmateri%2F{{materi_data.id}}%2F"
                            target="_blank">Line</a>
                        <p id="url" style="display: none">https://digipus-staging-2.herokuapp.com{{request.path}}</p>
193
194
                        <a class="dropdown-item"
                            href="{% url 'save-to-gdrive' materi_data.id %}">Google Drive</a>
195
                        <button class="dropdown-item btn-book" onclick="copyToClipboard('#url')">Bagikan Tautan</button>
196
197
                    </div>
                </div>
198
199
200
201
202
203
204
205
206
207
208
209
210
211
                <div class="dropdown">
                    <button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded" type="button"
                        id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Sitasi
                    </button>
                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                        <div class="buttons">
                            <button class="dropdown-item" onclick="getCitation('{{citationAPA}}')">Citate APA</button>
                        </div>
                        <div class="buttons">
                            <button class="dropdown-item" onclick="getCitation('{{citationIEEE}}')">Citate IEEE</button>
                        </div>
                    </div>
                </div>
212
213
214
215
216
217
218
219
220
221
                <form action="" method="POST">
                    <input type="hidden" name="action" value="like">
                </form>
                {% if has_liked %}
                <button id="thumb" class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded"><i id="thumbIcon"
                        aria-hidden="true" class="fas fa-thumbs-up"></i> Disukai</button>
                {% else %}
                <button id="thumb" class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded"><i id="thumbIcon"
                        aria-hidden="true" class="far fa-thumbs-up"></i> Sukai</button>
                {% endif %}
222

223
224
225
226
227
228
229
230
231
232
233
234
235
236
                {% if user.is_authenticated %}
                <div class="dropdown">
                    <button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded align-self-center"
                        type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <em id="button-rating-star-icon" class="align-self-center far fa-star"></em>
                        <span id="button-rating-text">Beri Rating</span>
                    </button>
                    <div id="star-dropdown" class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                        <div class="text-center btn-book">
                            <em onclick="postAddRating(1)" id="star-1" class="far fa-star fa-lg"></em>
                            <em onclick="postAddRating(2)" id="star-2" class="far fa-star fa-lg"></em>
                            <em onclick="postAddRating(3)" id="star-3" class="far fa-star fa-lg"></em>
                            <em onclick="postAddRating(4)" id="star-4" class="far fa-star fa-lg"></em>
                            <em onclick="postAddRating(5)" id="star-5" class="far fa-star fa-lg"></em>
237
238
239
                        </div>
                    </div>
                </div>
240
241
242
243
244
245
246
                {% else %}
                <button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded align-self-center"
                    type="button" id="dropdownMenuButton" aria-haspopup="true" aria-expanded="false" data-toggle="modal"
                    data-target="#notLoggedInModal">
                    <em class="align-self-center far fa-star"></em> Beri Rating
                </button>
                {% endif %}
247
248
            </div>
        </div>
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
    </div>
    <div class="row menu-wrapper mr-4 ml-4 p-3">
        <nav class="navbar navbar-expand-sm border-top border-bottom p-0 mt-3 mb-3">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" href="#deskripsi">Deskripsi</a>
                </li>
                {% if materi_data.status == "APPROVE" %}
                <li class="nav-item">
                    <a class="nav-link" href="#komentar">Komentar</a>
                </li>
                {% endif %}
            </ul>
        </nav>
        <div id="deskripsi" class="container-fluid description-wrapper bg-white shadow-sm rounded p-3">
            <h1>Deskripsi</h1>
            <div class="col col-8 description">
                <p>{{materi_data.descriptions}}</p>
267
            </div>
268
269
270
        </div>
        {% if materi_data.status == "APPROVE" %}
        <div id="komentar" class="container-fluid comments-wrapper p-0">
271
            {% if is_authenticated %}
272
273
274
275
276
277
278
279
280
            <div class="add-comments col col-8 bg-white shadow-sm rounded p-3 mb-3">
                <form method="POST">
                    {% csrf_token %}
                    <h1>Komentar</h1>
                    <div class="form-group">
                        <textarea placeholder="Beri komentar..." class="form-control" id="exampleFormControlTextarea1"
                            rows="3" name="comment" required></textarea>
                        <button type="submit"
                            class="btn btn-link btn-book shadow-sm p-2 mt-2 bg-white rounded">Kirim</button>
281
                    </div>
282
283
                </form>
            </div>
284
285
286
            {% else %}
                <h3>Login terlebih dahulu untuk berkomentar</h3>
            {% endif %}
287
288
289
290
291
292
293
294
295
296
297
298
            {% for comment in comment_data %}
            <div class="col col-8 comment shadow-sm p-3 mb-1 bg-white rounded">
                <div class="d-flex bd-highlight mb-3 align-items-center user">
                    {% if comment.user != Null %}
                    {% if not user.default_profile_picture %}
                    <img class="profile" src="https://i.ibb.co/9wgPzyZ/default-image.png" alt="profile-picture">
                    {% else %}
                    <img class="profile" src="{{ comment.user.profile_picture.url }}" alt="profile-picture">
                    {% endif %}
                    {% else %}
                    <span style="background-color: #{{comment.profile}}" class="profile p-1 bd-highligh"></span>
                    {% endif %}
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
                    <div class="d-flex flex-row justify-content-end">
                        <p class="p-1 bd-highligh m-0"><strong>{{comment.user.name}}</strong></p>
                        <p class="p-1 bd-highligh m-0"></p>
                        <p class="timestamp p-1 bd-highligh m-0 text-muted">
                            {{ comment.timestamp|naturaltime }}
                        </p>
                        <div>
                            <button id="thumb-like-comment-{{ comment.id }}" class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded" onClick="postLikeComment({{ comment.id }})">
                                <div class="d-flex flex-row">
                                    {% if has_liked.comment.id %}
                                    <i id="thumb-like-comment-icon-{{ comment.id }}" aria-hidden="true" class="fas fa-thumbs-up"></i>
                                    {% else %}
                                    <i id="thumb-like-comment-icon-{{ comment.id }}" aria-hidden="true" class="far fa-thumbs-up"></i>
                                    {% endif %}
                                    <div id="like-comment-{{ comment.id }}">{{ comment.like_count }}</div>
                                </div
                            </button>
                            <button id="thumb-dislike-comment-{{ comment.id }}" class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded" onClick="postDislikeComment({{ comment.id }})">
                                <div class="d-flex flex-row">
                                    {% if has_disliked.comment.id %}
                                    <i id="thumb-dislike-comment-icon-{{ comment.id }}" aria-hidden="true" class="fas fa-thumbs-down"></i>
                                    {% else %}
                                    <i id="thumb-dislike-comment-icon-{{ comment.id }}" aria-hidden="true" class="far fa-thumbs-down"></i>
                                    {% endif %}
                                    <div id="dislike-comment-{{ comment.id }}">{{ comment.dislike_count }}</div>
                                </div>
                            </button>
                        </div>
                    </div>
328
329
330
331
332
333
                    {% if user.is_admin %}
                    <a class="ml-auto p-1 bd-highlight close"
                        href="{% url 'delete-comment' materi_data.id comment.id %}">
                        <span aria-hidden="true">&times;</span>
                    </a>
                    {% endif %}
334
                </div>
335
336
337
                <p class="text">{{comment.comment}}</p>
            </div>
            {% endfor %}
338
        </div>
339
        {% endif %}
340
    </div>
341
342
343
344
</div>
<footer class="sticky-footer bg-white p-4">
    <div class="container my-auto">
        <div class="copyright text-center my-auto">
345
346
            <span>Copyright &copy; Diskominfo Kota Depok 2020</span>
        </div>
347
348
    </div>
</footer>
349

350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<!-- Modal -->
<div class="modal fade" id="notLoggedInModal" tabindex="-1" role="dialog" aria-labelledby="notLoggedInModalLabel"
    aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="notLoggedInModalLabel">Belum Login</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                Login untuk memberikan rating
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
                <button type="button" class="btn btn-primary" onclick="window.location.href = '/login';">Login</button>
367
368
369
            </div>
        </div>
    </div>
370
</div>
371
{% endblock content %}
372
373
374
375
376
{% block extra_scripts %}
<script src="https://kit.fontawesome.com/bc2cedd6b2.js" crossorigin="anonymous"></script>
<script type="text/javascript">
    // using jQuery
    var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403

    let currentRating = {{ materi_rating_score }};
    fillRatingStar(currentRating)

    function changeButtonIntoRated() {
        $('#button-rating-star-icon').addClass('fas');
        $('#button-rating-star-icon').removeClass('far');
        $('#button-rating-text').text("Rating Anda")
    }

    if (currentRating > 0) {
        changeButtonIntoRated()
    }

    $("#star-dropdown").click(function (e) {
        e.stopPropagation();
    });

    function clearRatingStar() {
        for (let i = 1; i <= 5; i++) {
            $('#star-' + i).addClass('far');
            $('#star-' + i).removeClass('fas');
        }
    }

    function fillRatingStar(ratingScore) {
        for (let i = 1; i <= ratingScore; i++) {
404
405
406
            $('#star-' + i).addClass('fas');
            $('#star-' + i).removeClass('far');
        }
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
    }

    function makeHoverStar(starAmount) {
        function hoverStar() {
            clearRatingStar()
            fillRatingStar(starAmount)
        }

        return hoverStar
    }

    function makeUnHoverStar(starAmount) {
        function unHoverStar() {
            clearRatingStar()
            fillRatingStar(currentRating)
        }

        return unHoverStar
    }

    $('#star-1').hover(makeHoverStar(1), makeUnHoverStar(1));
    $('#star-2').hover(makeHoverStar(2), makeUnHoverStar(2));
    $('#star-3').hover(makeHoverStar(3), makeUnHoverStar(3));
    $('#star-4').hover(makeHoverStar(4), makeUnHoverStar(4));
    $('#star-5').hover(makeHoverStar(5), makeUnHoverStar(5));
432
433
434
435
436
437
438
439
</script>
<script>
    function csrfSafeMethod(method) {
        // these HTTP methods do not require CSRF protection
        return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
    }
</script>
<script>
440
    $('#thumb').click(function () {
441

442
443
444
445
        $.ajaxSetup({
            beforeSend: function (xhr, settings) {
                if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                    xhr.setRequestHeader("X-CSRFToken", csrftoken);
446
                }
447
            }
448
        });
449
450
451
452
453
454
455
456
457
458
459
        $.ajax({
            type: 'POST',
            url: "{% url 'PostLikeToggle' %}",
            data: {
                'materi_id': "{{ materi_data.id }}",
                'session_id': "{{ session_id }}"
            },
            success: LikePost,
            dataType: 'html'
        });
    });
460

461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
    function postLikeComment(comment_id) {
        $.ajaxSetup({
            beforeSend: function (xhr, settings) {
                if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                    xhr.setRequestHeader("X-CSRFToken", csrftoken);
                }
            }
        });
        $.ajax({
            type: 'POST',
            url: "{% url 'comment-like-toggle' %}",
            data: {
                'comment_id': comment_id,
                'session_id': "{{ session_id }}"
            },
            success: likeComment,
            dataType: 'html'
        });
    }

    function postDislikeComment(comment_id) {
        $.ajaxSetup({
            beforeSend: function (xhr, settings) {
                if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                    xhr.setRequestHeader("X-CSRFToken", csrftoken);
                }
            }
        });
        $.ajax({
            type: 'POST',
            url: "{% url 'comment-dislike-toggle' %}",
            data: {
                'comment_id': comment_id,
                'session_id': "{{ session_id }}"
            },
            success: dislikeComment,
            dataType: 'html'
        });
    }

501
502
503
504
505
    function postAddRating(rating_score) {
        $.ajaxSetup({
            beforeSend: function (xhr, settings) {
                if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                    xhr.setRequestHeader("X-CSRFToken", csrftoken);
506
                }
507
            }
508
        });
509

510
511
512
513
514
515
516
517
518
519
520
521
        $.ajax({
            type: 'POST',
            url: "{% url 'rate-materi' %}",
            data: {
                'materi_id': "{{ materi_data.id }}",
                'rating_score': rating_score
            },
            success: function (data) {
                const response = JSON.parse(data)
                currentRating = response.rating_score
                makeUnHoverStar(currentRating)()
                changeButtonIntoRated()
522

523
524
525
526
            },
            dataType: 'html'
        });
    }
527

528
529
530
531
532
533
534
535
    function LikePost(data, jqXHR) {
        var data = $.parseJSON(data)
        if (data['liked']) {
            $('#thumbIcon').removeClass("fas fa-thumbs-up").addClass('far fa-thumbs-up')
            document.getElementById("thumb").firstChild.data = " Sukai"
        } else {
            $('#thumbIcon').removeClass("far fa-thumbs-up").addClass('fas fa-thumbs-up')
            document.getElementById("thumb").firstChild.data = " Disukai"
536
        }
537
    }
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563

    function likeComment(data, jqXHR) {
        var data = $.parseJSON(data)
        likeIcon = $('#thumb-like-comment-icon-' + data['comment_id'])
        likeValue = $('#like-comment-' + data['comment_id'])
        if (data['liked']) {
            likeIcon.removeClass("fas fa-thumbs-up").addClass('far fa-thumbs-up')
            likeValue.text(parseInt(likeValue.text())-1)
        } else {
            likeIcon.removeClass("far fa-thumbs-up").addClass('fas fa-thumbs-up')
            likeValue.text(parseInt(likeValue.text())+1)
        }
    }

    function dislikeComment(data, jqXHR) {
        var data = $.parseJSON(data)
        dislikeIcon = $('#thumb-dislike-comment-icon-' + data['comment_id'])
        dislikeValue = $('#dislike-comment-' + data['comment_id'])
        if (data['disliked']) {
            dislikeIcon.removeClass("fas fa-thumbs-down").addClass('far fa-thumbs-down')
            dislikeValue.text(parseInt(dislikeValue.text())-1)
        } else {
            dislikeIcon.removeClass("far fa-thumbs-down").addClass('fas fa-thumbs-down')
            dislikeValue.text(parseInt(dislikeValue.text())+1)
        }
    }
564
565
566
567
568
569
570
571
572
        
    function getCitation(text){
        var $temp = $("<input>");
        $("body").append($temp);
        $temp.val(text).select();
        document.execCommand("copy");
        $temp.remove();
        window.alert("Hasil sitasi: "+ text + "\n\nBerhasil disalin ke clipboard!");
    }
573
574

        
575
</script>
576
{% endblock extra_scripts %}