PageSourceSearch

https://akun.republika.co.id/assets/dashboard/js/comment.js

js republika.co.id collected 2026-09-24 08:43:55 UTC 12,402 bytes, 383 lines download raw bytes

1var baseUrl = "https://akun.republika.co.id/user/comments",
2  pageURL = $(location).attr("href"),
3  timesSubmitted = 0,
4  timeCounter = 6e4,
5  Timer = null;
6$(document).ready(function () {
7  function t() {
8    interval ||
9      (interval = setTimeout(function () {
10        (interval = void 0),
11          (timesSubmitted = 0),
12          $("div").append("TIMER RESET. Submit again.<br />");
13      }, intervalMilliseconds)),
14      ++timesSubmitted > maxSubmits && alert("limit");
15  }
16  function e(t) {
17    t[$(".txt_csrfname").attr("name")] = $(".txt_csrfname").val();
18  }
19  function n(t) {
20    var n = parseInt($("#post_comment_limit").val()),
21      r = { post_id: t, limit: n, url: pageURL };
22    e(r),
23      $("#load_comment_spinner").show(),
24      $.ajax({
25        type: "POST",
26        url: baseUrl + "/load-more-comment",
27        data: r,
28        success: function (t) {
29          setTimeout(function () {
30            $("#load_comment_spinner").hide();
31            var e = JSON.parse(t);
32            1 == e.result &&
33              (document.getElementById("comment-result").innerHTML = e.content);
34          }, 1e3);
35        },
36      });
37  }
38  $(document).on("submit", "#form_add_comment_registered", function (t) {
39    t.preventDefault();
40    var e = $(this).serializeArray(),
41      n = { limit: $("#post_comment_limit").val() },
42      r = $(this).attr("data-parent-id"),
43      a = $("#commentSection").attr("data-id"),
44      e = $(this).serializeArray(),
45      n = {
46        post_id: a,
47        parent_id: r,
48        comment: $.trim(e[2].value),
49        url: pageURL,
50        limit: $("#post_comment_limit").val(),
51      },
52      i = !0;
53    timesSubmitted > 1 &&
54      (alert("Jeda waktu 1 menit sebelum mengirim komen lainnya"), exit),
55      $(e).each(function (t, e) {
56        $.trim(e.value).length < 1
57          ? ($("#form_add_comment_registered [name='" + e.name + "']").addClass(
58              "is-invalid"
59            ),
60            (i = !1))
61          : ($(
62              "#form_add_comment_registered [name='" + e.name + "']"
63            ).removeClass("is-invalid"),
64            (n[e.name] = e.value));
65      }),
66      !0 == i &&
67        $.ajax({
68          type: "POST",
69          url: baseUrl + "/add-comment",
70          data: n,
71          crossDomain: !0,
72          beforeSend: function (t, e) {
73            t.setRequestHeader(
74              "Authorization",
75              "Bearer " + $("#commentSection").attr("data-token")
76            );
77          },
78          success: function (t) {
79            var e = t;
80            "content" == e.type
81              ? (document.getElementById("message-comment-result").innerHTML =
82                  e.content)
83              : (document.getElementById("comment-result").innerHTML =
84                  e.content),
85              e.hasOwnProperty("message") && console.log("The key exists."),
86              $("#form_add_comment_registered")[0].reset(),
87              null === Timer &&
88                (Timer = setTimeout(function () {
89                  timesSubmitted > 0 && alert("Submissions Reset"),
90                    (timesSubmitted = 0);
91                }, timeCounter)),
92              timesSubmitted++;
93          },
94          errror: function () {
95            console.warn("something wrong");
96          },
97        });
98  }),
99    $(document).on("click", ".btn-subcomment-registered", function (t) {
100      t.preventDefault();
101      var n = $(this).attr("data-parent-id"),
102        r = $("#commentSection").attr("data-id"),
103        a = $("#form_add_subcomment_registered_" + r).serializeArray(),
104        i = $.trim(a[0].value),
105        o = { post_id: r, parent_id: n, comment: i, url: pageURL };
106      if (
107        (e(o),
108        timesSubmitted > 1 &&
109          (alert("Jeda waktu 1 menit sebelum mengirim komen lainnya"), exit),
110        i.length < 1)
111      )
112        return $(".form-comment-text").addClass("is-invalid"), !1;
113      $(".form-comment-text").removeClass("is-invalid"),
114        $.ajax({
115          type: "POST",
116          url: baseUrl + "/add-comment",
117          data: o,
118          cache: !1,
119          crossDomain: !0,
120          beforeSend: function (t, e) {
121            t.setRequestHeader(
122              "Authorization",
123              "Bearer " + $("#commentSection").attr("data-token")
124            );
125          },
126          success: function (t) {
127            var e = t;
128            "content" == e.type
129              ? (document.getElementById(
130                  "message-subcomment-result-" + r
131                ).innerHTML = e.content)
132              : (document.getElementById("comment-result").innerHTML =
133                  e.content),
134              e.hasOwnProperty("message") && console.log("The key exists."),
135              $(".visible-sub-comment form").empty(),
136              null === Timer &&
137                (Timer = setTimeout(function () {
138                  timesSubmitted > 0 && alert("Submissions Reset"),
139                    (timesSubmitted = 0);
140                }, timeCounter)),
141              timesSubmitted++;
142          },
143          errror: function () {
144            console.warn("something wrong");
145          },
146        });
147    }),
148    $("#submit").click(function () {
149      let t = $("#comment").val();
150      if ("" == t) return $.notify("comment input is required", "error"), !1;
151      $.ajax({
152        type: "POST",
153        url: baseUrl,
154        data: { comment: t, url: pageURL },
155        success: function (t) {
156          "OK" == t.status
157            ? ($("#commentSection").html(""),
158              getComment(),
159              $("#comment").val(""),
160              $.notify("Comment has been Added", "success"))
161            : $.notify("Error : " + t.status, "warning");
162        },
163        errror: function () {
164          console.warn("something wrong"), $.notify("Something wrong", "error");
165        },
166      });
167    }),
168    $.ajax({
169      type: "GET",
170      url:
171        baseUrl +
172        "/get/" +
173        $("#commentSection").attr("data-id") +
174        "?url=" +
175        encodeURI(pageURL),
176      success: function (t) {
177        document.getElementById("commentSection").innerHTML = t.content;
178      },
179      beforeSend: function (t, e) {
180        t.setRequestHeader(
181          "Authorization",
182          "Bearer " + $("#commentSection").attr("data-token")
183        );
184      },
185      errror: function () {
186        console.warn("something wrong");
187      },
188    }),
189    $(document).on("click", ".col-reaction-like", function (t) {
190      var n = {
191        post_id: $(this).attr("data-post-id"),
192        reaction: $(this).attr("data-reaction"),
193        url: pageURL,
194      };
195      e(n),
196        $.ajax({
197          type: "POST",
198          url: baseUrl + "/save-reaction",
199          data: n,
200
201          beforeSend: function (t, e) {
202            t.setRequestHeader(
203              "Authorization",
204              "Bearer " + $("#commentSection").attr("data-token")
205            );
206          },
207          success: function (t) {
208            var e = t;
209            1 == e.result &&
210              (document.getElementById("reactions_result").innerHTML =
211                e.content);
212          },
213          error: function (xhr, status, error) {
214            console.error("Error:", xhr.status, status, error);
215            console.log("Response Headers:", xhr.getAllResponseHeaders());
216          },
217        });
218    }),
219    $(document).on("click", ".btn-reply", function (t) {
220      t.preventDefault();
221      var n = $(this).attr("data-comment-id"),
222        r = $(this).attr("data-parent-id");
223      $(".visible-sub-comment").empty();
224      var a = parseInt($("#post_comment_limit").val()),
225        i = { comment_id: n, parent_id: r, limit: a };
226      e(i),
227        $.ajax({
228          type: "POST",
229          url: baseUrl + "/load-subcomment",
230          data: i,
231          success: function (t) {
232            var e = t;
233            1 == e.result && $("#sub_comment_form_" + r).html(e.content);
234          },
235        });
236    }),
237    $(document).on("click", ".share-button", function (t) {
238      (tbl = $(this).attr("id")),
239        ($log = $("#commentSection").length > 0),
240        "share-facebook" == tbl && app.facebook.share($log),
241        "share-twitter" == tbl && app.twitter.share($log),
242        "share-whatsapp" == tbl && app.whatsapp.share($log),
243        "share-copy" == tbl && app.copy.share($log),
244        "share-print" == tbl && app.print.share($log);
245    });
246});
247var share = {
248  fbAppID: $('meta[property="fb:app_id"]').attr("content"),
249  url: $('meta[property="og:url"]').attr("content"),
250  title: $('meta[property="og:title"]').attr("content"),
251  desc: $('meta[property="og:description"]').attr("content"),
252  image: $('meta[property="og:image"]').attr("content"),
253};
254!(function (t, e) {
255  var n,
256    r = t.getElementsByTagName(e)[0],
257    a = t.createDocumentFragment(),
258    i = function (r, i) {
259      !t.getElementById(i) &&
260        (((n = t.createElement(e)).src = r), i && (n.id = i), a.appendChild(n));
261    };
262  i(
263    "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=" +
264      share.fbAppID,
265    "facebook-jssdk"
266  ),
267    i("https://platform.twitter.com/widgets.js"),
268    r.parentNode.insertBefore(a, r);
269})(document, "script");
270var app = app || {};
271function tweetIntentToAnalytics() {}
272function setActivity(t) {
273  var e = $("#commentSection").attr("data-id");
274  $.ajax({
275    type: "POST",
276    url: baseUrl + "/share-activity",
277    data: { post_id: e, provider: t, url: pageURL },
278    crossDomain: !0,
279    beforeSend: function (t, e) {
280      t.setRequestHeader(
281        "Authorization",
282        "Bearer " + $("#commentSection").attr("data-token")
283      );
284    },
285    success: function (t) {},
286    errror: function () {
287      console.warn("something wrong");
288    },
289  });
290}
291(app.facebook = {
292  share: function (t) {
293    (stat = ""),
294      FB.ui(
295        {
296          method: "share",
297          href: share.url + "?utm_campaign=rolsosmed%26utm_source=facebook",
298        },
299        function (e) {
300          console.log(e),
301            e && !e.error_code
302              ? t && setActivity("facebook")
303              : (stat = "error");
304        }
305      );
306  },
307  feed: function (t) {
308    FB.ui(
309      {
310        method: "feed",
311        name: share.title,
312        link: share.url,
313        picture: share.image,
314        caption: "",
315        description: share.desc,
316      },
317      function (t) {
318        console.log(t),
319          t && t.post_id
320            ? console.log("published")
321            : console.log("not published");
322      }
323    );
324  },
325}),
326  (app.twitter = {
327    share: function (t) {
328      console.log("clicked"),
329        "undefined" != typeof twttr &&
330          twttr.ready(function (t) {
331            t.events.bind("tweet", tweetIntentToAnalytics);
332          }),
333        twttr.ready(function (e) {
334          e.events.bind("tweet", function (e) {
335            t && setActivity("twitter");
336          });
337        }),
338        window
339          .open(
340            "https://twitter.com/intent/tweet?text=" +
341              encodeURI(share.title) +
342              " " +
343              encodeURI(share.url) +
344              "?utm_campaign=rolsosmed%26utm_source=twitter",
345            "popupwindow",
346            "scrollbars=yes,width=800,height=400"
347          )
348          .focus();
349    },
350  }),
351  (app.copy = {
352    share: function (t) {
353      var e = document.createElement("input");
354      e.setAttribute("value", ""),
355        document.body.appendChild(e),
356        e.select(),
357        document.execCommand("copy"),
358        document.body.removeChild(e),
359        console.log("URL copy to clipboard");
360    },
361  }),
362  (app.whatsapp = {
363    share: function () {
364      window.open(
365        "https://api.whatsapp.com/send?text=" +
366          share.title +
367          " " +
368          share.url +
369          "?utm_campaign=rolsosmed%26utm_source=whatsapp"
370      );
371    },
372  }),
373  (app.print = {
374    share: function () {
375      (getid = share.url.split("/")),
376        window.open(
377          "https://akun.republika.co.id/print/" +
378            getid[4] +
379            "?token=" +
380            btoa(share.url)
381        );
382    },
383  });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.