PageSourceSearch

https://partner.callcabinet.com/_assets/scripts/faq-list.js

js callcabinet.com collected 2026-09-25 14:20:05 UTC 4,557 bytes, 91 lines download raw bytes

1$(function() {
2    $.getRestScript(function() {
3        
4        $.fn.faq = function (options) {
5            var default_labels = {
6                no_records_to_display: "No records to display."
7            };
8
9            var settings = $.extend({ id: null, token: null, mode: "list", headingClass: "", callback: null, labels: default_labels }, options);
10            var acc_template_arr = [
11                "<div class='panel panel-default'><div class='panel-heading' role='tab' id='h{0}'>",
12                "<h4 class='panel-title'>",
13                "<a role='button' data-toggle='collapse' data-parent='#{3}' href='#c{0}' aria-expanded='false' aria-controls='c{0}'>{1}</a>",
14                "</h4></div>",
15                "<div id='c{0}' class='panel-collapse collapse' role='tabpanel' aria-labelledby='h{0}'><div class='panel-body'>",
16                "{2}</div></div></div>"
17            ];
18
19            var acc_template = acc_template_arr.join(" ");
20            var panels_template_arr = [
21                "<div class='panel panel-default' style='margin-bottom:20px;'>",
22                "<div class='panel-heading'><h4 class='panel-title'>{1}</h4></div>",
23                "<div class='panel-body'>{2}</div></div>"
24            ];
25
26            var panels_template = panels_template_arr.join(" ");
27
28            var list_template = "<div style='margin-bottom:20px'><h4>{1}</h4><div>{2}</div></div><div class='horizontalLine'></div>";
29            var $this = $(this);
30
31            REST2.exec({
32                url: "/faq/getfaqs",
33                data: {
34                    ids: [settings.id],
35                    token: settings.token
36                },
37                callback: function (context) {
38                    if (REST2.isSuccess(context)) {
39                        var faqs = context.Result;
40
41                        if (faqs) {
42                            $.each(faqs, function (i, faq) {
43                                var $target = $this;
44
45                                if ($target.length == 0)
46                                    return true;
47
48                                $target.append(`<h2 class='faq-title ${settings.headingClass}'>${htmlEncode(faq.Name)}</h2>`);
49                                var parentId = $target.attr("id") + "flist";
50                                var $panelGroup = $("<div id='{0}' class='faq-list panel-group mt-1' role='tablist' aria-multiselectable='true'></div>".format(parentId));
51                                $target.append($panelGroup);
52
53                                if (faq.Items.length == 0) {
54                                    $panelGroup.append(`<div class='horizontalLine'></div><div class='text-muted'>${htmlEncode(settings.labels.no_records_to_display)}</div>`);
55                                } else {
56
57                                    if (settings.mode == "accordion") {
58                                        $.each(faq.Items, function (j, item) {
59                                            $panelGroup.append(acc_template.format(item.id, htmlEncode(item.question), item.answer, parentId));
60                                        });
61                                    } else if (settings.mode == "panels") {
62                                        $.each(faq.Items, function (j, item) {
63                                            $panelGroup.append(panels_template.format(item.id, htmlEncode(item.question), item.answer));
64                                        });
65                                    } else {
66                                        $.each(faq.Items, function (j, item) {
67                                            $panelGroup.append(list_template.format(item.id, htmlEncode(item.question), item.answer));
68                                        });
69                                    }
70                                }
71                            });
72                        }
73
74                        if (settings.callback && isFunction(settings.callback))
75                            settings.callback(faqs);
76                    }
77                }
78            });
79
80        };
81
82        $(".mag-faq-list").each(function () {
83            $(this).each(function () {
84                var faqID = $(this).attr("data-id");
85                var token = $(this).attr("data-token");
86                var layout = $(this).attr("data-layout");
87                $(this).faq({ id: faqID, token: token, mode: layout });
88            });
89        });
90    }, "2.0");
91});

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.