PageSourceSearch

https://www.inastana.kz/js/trailerPopUp.js?v=1789825604

js inastana.kz collected 2026-09-29 15:33:08 UTC 4,116 bytes, 106 lines download raw bytes

1(function ($) {
2    $.fn.trailerPopup = function (option) {
3
4        var TrailerPopup = function (element, options) {
5            this.settings = $.extend({}, TrailerPopup.defaultOptions, options);
6
7            this.$element = $(element);
8            this.$trailerContainer = $(this.settings.trailerContainerSelector, this.$element);
9            this._initEventHandlers();
10        };
11
12        TrailerPopup.namespace = "trailerPopup";
13
14        TrailerPopup.defaultOptions = {
15            trailerContainerSelector: "div.modal-inner.trailer div.yt-video",
16            jsonRpcUrl: "/afisha/jsonrpc"
17        };
18
19        TrailerPopup.prototype._initEventHandlers = function () {
20            var self = this,
21                settings = this.settings;
22            this.$element.on("show.bs.modal", function (event) {
23                var eventId = $(event.relatedTarget).data("event-id");
24                self.$trailerContainer.empty();
25                jsonrpcWrapper(settings.jsonRpcUrl, "getFilmTrailer", {id: eventId}, function (xhr, status) {
26                    var data = xhr.responseJSON.result;
27                    if (data) {
28                        self.$trailerContainer.append($(data));
29                    }
30                });
31            });
32        };
33
34        TrailerPopup.methods = {
35        };
36
37        var scopeArguments = arguments;
38        if ("string" === typeof option && "function" === typeof TrailerPopup.methods[option]) {
39            var data = this.data("cis." + TrailerPopup.namespace);
40            if (data) {
41                return TrailerPopup.methods[option].apply(data, Array.prototype.slice.call(scopeArguments, 1));
42            }
43        }
44        return this.each(function (index, element) {
45            var $this = $(this);
46            var data = $this.data("cis." + TrailerPopup.namespace);
47            var options = "object" === typeof option && option;
48
49            if (!data) {
50                $this.data("cis." + TrailerPopup.namespace, (data = new TrailerPopup(this, options)));
51            }
52            if ("string" === typeof option && "function" === typeof TrailerPopup.methods[option]) {
53                TrailerPopup.methods[option].apply(data, Array.prototype.slice.call(scopeArguments, 1));
54            }
55        });
56
57    };
58})(jQuery);
59
60/**
61 * Created by carleone on 07.11.16.
62 */
63
64$(document).on('click', '.item .but.play', function (event) {
65    var getTrailerUrl = $(this).data('trailer-url') || false;
66    var method = $(this).data('callback');
67    var parentElem = $(this).closest('.item');
68    /** using settings from frontend display info for trailer*/
69    var trailerHeight = 504;
70    var trailerWidth = 940;
71    var dialog = $('#modal-trailer-content');
72    var dialogTitleHeightPBM = 60;
73    var dialogWidthPBM = dialog.outerWidth(true) - dialog.width();
74    var dialogHeightPBM = dialog.outerHeight(true) - dialog.height();
75    var totalDialogHeight = trailerHeight + dialogHeightPBM + dialogTitleHeightPBM;
76    var totalDialogWidth = trailerWidth + dialogWidthPBM;
77    $('<img/>', {"class": 'trailer-loader', src: '/design/images/loader.gif'}).appendTo(dialog);
78    dialog.dialog('option', 'height', totalDialogHeight);
79    dialog.dialog('option', 'width', totalDialogWidth);
80    dialog.dialog('open');
81    if (getTrailerUrl) {
82        jsonrpcWrapper(getTrailerUrl, method, {'id': (+parentElem.data('item-id'))},
83            function (xhr, status) {
84                var data = xhr.responseJSON.result;
85                if (data) {
86                    var $trailerObject = $(data);
87                    $('#trailer-content').append($trailerObject);
88                }
89                /** @todo: find out way to fide spinner when YT player loaded */
90                dialog.find('img').toggle();
91            });
92    }
93    event.preventDefault();
94});
95
96$(document).on('ready', function () {
97    $('#modal-trailer-content').dialog({
98        modal: true,
99        autoOpen: false,
100        resizable: false,
101        close: function (event, ui) {
102            $(this).children('#trailer-content').empty();
103            $(this).children('img').remove();
104        }
105    });
106});

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.