PageSourceSearch

https://looke.com.br/scripts/Helpers.js?20200907

js looke.com.br collected 2026-10-01 11:45:32 UTC 35,727 bytes, 1,116 lines download raw bytes

1var Helpers = Helpers || {};
2
3(function helpers() {
4
5    var _loadingTimeout = [];
6    var _globalOrderBy = null;
7    var _globalCriteria = null;
8
9
10    var PlanUser;
11
12    Helpers.clearProfile = function () {
13        $.post('/account/clearprofile', {}, function (response) {
14            location.href = '/Account/chooseprofile';
15        });
16    };
17
18    Helpers.verifyStyleShowImage = function (element) {
19        if ($(element).css('opacity') == 0) $(element).css('opacity', 1);
20    };
21
22    Helpers.showMenuMobile = function () {
23        $(".rightContaint").hide();
24        if (PlanUser) $(".headerAssine").show();
25        $(".leftContainer .headerButton").show();
26        $(".menuGenero div").removeClass("showMenu");
27        $(".menuDestaque div").removeClass("showMenu");
28        $(".settingsLateralMenu #menu-item-destaque").removeClass("MenuShow");
29        $(".settingsLateralMenu #menu-item-genero").removeClass("MenuShow");
30        $(".menuButtonMobile .settingsLateralMenu").css("left", 0);
31        if ($(".menuButtonMobile .settingsLateralMenu").is(":visible")) {
32            $(".menuButtonMobile .settingsLateralMenu").stop(true, true).animate({ "margin-left": '-500px' }, 200, "swing", function () {
33                $(".menuButtonMobile .settingsLateralMenu").hide();
34            });
35            $(".backgroundLateralMenu").hide();
36        } else {
37            $(".backgroundLateralMenu").show();
38            $(".menuButtonMobile .settingsLateralMenu").show();
39            $(".menuButtonMobile .settingsLateralMenu .containerLateralMenu").scrollTop("0px");
40            $(".menuButtonMobile .settingsLateralMenu").stop(true, true).animate({ "margin-left": '0' }, 200, "swing", function () {
41                //
42            });
43
44        }
45    };
46
47    Helpers.showSearchMobile = function () {
48        var leftContainerWidth = $(".leftContainer").width() + ($(".headerUserDescriptionItem").is(":visible") ? $(".headerUserDescriptionItem").width() : ($(".header-button").is(":visible") ? $(".header-button").width() : 0)) + 50 + ($("#menu-item-experimente").is(":visible") ? $("#menu-item-experimente").width() : 0);
49        var inputWidth = $(window).width() - leftContainerWidth;
50        if (inputWidth > 250) inputWidth = 250;
51        $(".rightContaint").css("width", "1px");
52        $(".rightContaint .searchtextbox").css("width", inputWidth + 11);
53        $(".rightContaint").show();
54        $(".rightContaint").stop(true, true).animate({ "width": inputWidth }, 250, "swing", function () {
55            $(".searchtextbox").focus();
56        });
57    };
58
59    Helpers.customShare = function (uniqueUrl) {
60        var width = 900;
61        var height = 600;
62        var left = ($(window).width() / 2) - (900 / 2);
63        var top = ($(window).height() / 2) - (600 / 2);
64        window.open(uniqueUrl, "Looke", "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left);
65    };
66
67    Helpers.setCookie = function (name, value, days) {
68        var expires;
69
70        if (days) {
71            var date = new Date();
72            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
73            expires = "; expires=" + date.toGMTString();
74        }
75        else {
76            expires = "";
77        }
78        document.cookie = name + "=" + value + expires + "; path=/";
79    };
80
81    Helpers.getCookie = function (c_name) {
82
83        if (document.cookie.length <= 0)
84            return "";
85
86        c_start = document.cookie.indexOf(c_name + "=");
87
88        if (c_start == -1) {
89            return "";
90        }
91
92        c_start = c_start + c_name.length + 1;
93        c_end = document.cookie.indexOf(";", c_start);
94
95        if (c_end == -1) {
96            c_end = document.cookie.length;
97        }
98
99        return unescape(document.cookie.substring(c_start, c_end));
100    };
101
102    Helpers.getOrderBy = function () {
103
104        if (_globalOrderBy == null || _globalOrderBy == "")
105            return "R";
106        else
107            return _globalOrderBy;
108    };
109
110    Helpers.getCriteria = function () {
111        if (_globalCriteria == null || _globalCriteria == "")
112            return "A";
113        else
114            return _globalCriteria;
115    };
116
117    Helpers.setOrderBy = function (value) {
118        if (_globalOrderBy != value) {
119            _globalOrderBy = value;
120            //Helpers.refreshCriterias();
121        }
122    };
123
124    Helpers.setCriteria = function (value) {
125        if (_globalCriteria != value) {
126            _globalCriteria = value;
127            //Helpers.refreshCriterias();
128        }
129    };
130
131    Helpers.refreshCriterias = function () {
132
133        if (typeof Carousel !== "undefined") {
134            var sections = Carousel.sections;
135
136            Carousel.initSection();
137
138            for (var i = 0; i < sections.length; i++) {
139
140                $(".video-js").each(function () {
141                    var videoId = ($(this)).attr('id');
142                    _V_(videoId).dispose();
143                });
144                Carousel.$carousel.find(".carousel_media_details").hide();
145
146                $(".mediaCarousel").find(".carousel_loader").show();
147                Carousel.fillBySectionID(sections[i].ID, sections[i].NAME, sections[i].CAROUSELID, true);
148            }
149        }
150        else {
151            var parent = $(".movie-list-panel").parent();
152
153            Helpers.refreshMovieList(parent);
154        }
155    };
156
157    Helpers.refreshMovieList = function (el) {
158
159        $.get(location.href, function (data) {
160
161            var $data = $(data);
162            var sectionID = $data.find(".hdd-sectionid").val();
163            var searchString = $data.find(".hdd-searchstring").val();
164
165            el.replaceWith($data.find(".movie-list-panel-container"));
166
167            var movie;
168            if (sectionID != null && sectionID != "") {
169                movie = new Movies(79, sectionID, null, false);
170                movie.fill();
171            }
172            else {
173                movie = new Movies(79, null, searchString, false);
174                movie.fill();
175            }
176        });
177    };
178
179    Helpers.startCriterias = function () {
180        Helpers.toggleTopMenu();
181        $(".sort-date").on("click", function () {
182            Helpers.setOrderBy("R");
183            Helpers.toggleTopMenu();
184        });
185        $(".sort-name").on("click", function () {
186            Helpers.setOrderBy("N");
187            Helpers.toggleTopMenu();
188        });
189        $(".show-all").on("click", function () {
190            Helpers.setCriteria("A");
191            Helpers.toggleTopMenu();
192        });
193        $(".show-free").on("click", function () {
194            Helpers.setCriteria("F");
195            Helpers.toggleTopMenu();
196        });
197    };
198
199    Helpers.toggleTopMenu = function () {
200
201        var orderBy = Helpers.getOrderBy();
202        var show = Helpers.getCriteria();
203
204        if (orderBy == "N") {
205            Helpers.toggleSortByName();
206        }
207        else {
208            Helpers.toggleSortByReleaseDate();
209        }
210
211        if (show == "A") {
212            Helpers.toggleShowAll();
213        }
214        else {
215            Helpers.toggleShowFree();
216        }
217    };
218
219    Helpers.toggleShowAll = function () {
220        $(".show-all").addClass("toppmenu-selected");
221        $(".show-all").removeClass("toppmenu-unselected");
222        $(".show-free").addClass("toppmenu-unselected");
223        $(".show-free").removeClass("toppmenu-selected");
224    };
225
226    Helpers.toggleShowFree = function () {
227        $(".show-all").addClass("toppmenu-unselected");
228        $(".show-all").removeClass("toppmenu-selected");
229        $(".show-free").addClass("toppmenu-selected");
230        $(".show-free").removeClass("toppmenu-unselected");
231    };
232
233    Helpers.toggleSortByName = function () {
234        $(".sort-name").addClass("toppmenu-selected");
235        $(".sort-name").removeClass("toppmenu-unselected");
236        $(".sort-date").addClass("toppmenu-unselected");
237        $(".sort-date").removeClass("toppmenu-selected");
238    };
239
240    Helpers.toggleSortByReleaseDate = function () {
241        $(".sort-name").addClass("toppmenu-unselected");
242        $(".sort-name").removeClass("toppmenu-selected");
243        $(".sort-date").addClass("toppmenu-selected");
244        $(".sort-date").removeClass("toppmenu-unselected");
245    };
246
247    Helpers.startPlayback = function (mediaId, directToPlayAction = false) {
248        directToPlayAction = directToPlayAction || false;
249        $.ajaxSetup({ cache: false });
250
251        Helpers.showLoading();
252        if (!directToPlayAction) {
253            $.get('/History/_StartPlayBack/?m=' + mediaId, function (data) {
254
255
256                Helpers.hideLoading();
257
258                var $data = $(data);
259                $data.hide();
260                $("#modal_container").html($data);
261                $data.show();
262            });
263        } else {
264            window.location = '/history/play/?d=0&m=' + mediaId;
265        }
266    };
267
268    Helpers.startSVODAuthorize = function (mediaId, directToPlayAction) {
269        directToPlayAction = directToPlayAction || false;
270        $.ajaxSetup({ cache: false });
271
272        Helpers.showLoading();
273        if (!directToPlayAction) {
274            $.ajaxSetup({ cache: false });
275
276            Helpers.showLoading();
277            $.get('/Payment/_StartSVODAuthorize/?m=' + mediaId, function (data) {
278
279                Helpers.hideLoading();
280
281                var $data = $(data);
282                $data.hide();
283                $("#modal_container").html($data);
284                $data.show();
285            });
286        } else {
287            window.location = '/history/play/?d=0&m=' + mediaId;
288        }
289    };
290
291    Helpers.showRechargePaymentForm = function (funcodeNumber, funcodeValue) {
292
293        $.ajaxSetup({ cache: false });
294
295        Helpers.showLoading();
296
297        $.get('/Payment/_PaymentRechargeCardDetails/?f=' + funcodeNumber + '&v=' + funcodeValue, function (data) {
298
299            Helpers.hideLoading();
300
301            var $data = $(data);
302            $data.hide();
303            $("#modal_container").html($data);
304            $data.show();
305        });
306    };
307
308    Helpers.htmlEncode = function (value) {
309        return $('<div/>').text(value).html();
310    };
311
312    Helpers.htmlDecode = function (value) {
313        return $('<div/>').html(value).text();
314    };
315
316    Helpers.getUrlParameter = function (sParam) {
317        var sPageURL = window.location.search.substring(1),
318            sURLVariables = sPageURL.split('&'),
319            sParameterName,
320            i;
321
322        for (i = 0; i < sURLVariables.length; i++) {
323            sParameterName = sURLVariables[i].split('=');
324
325            if (sParameterName[0] === sParam) {
326                return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
327            }
328        }
329    };
330
331    Helpers.reenviarCodigo = function (e) {
332        $.ajaxSetup({ cache: false });
333        Helpers.showLoading();
334        $('#validationError').text('');
335        $.ajax({
336            url: '/Settings/ReenviarCodigo/',
337            type: 'get',
338            data: {
339                'paramsValues': e
340            },
341            success: function (resp) {
342                $('#errorReceivedCodeSMSDiv').css('display', 'none');
343                $('#validationError').html(resp.message);
344                if (resp.enviado === true) {
345                    $("#validationError").css('-moz-text-decoration-color', 'blue');
346                    $("#validationError").css('text-decoration-color', 'blue');
347                    $("#validationError").css('color', 'blue');
348                } else {
349                    $("#validationError").css('-moz-text-decoration-color', 'red');
350                    $("#validationError").css('text-decoration-color', 'red');
351                    $("#validationError").css('color', 'red');
352                }
353            },
354            error: (function (resp) {
355                $('#field-validation-error').hide = true;
356                $('#validationError').html(resp.responseText);
357                $("#validationError").css('-moz-text-decoration-color', 'red');
358                $("#validationError").css('text-decoration-color', 'red');
359                $("#validationError").css('color', 'red');
360            }),
361            complete: function () {
362                Helpers.hideLoading();
363            }
364        });
365    };
366
367    Helpers.showFirebaseSmsCode = function (paramValues) {
368        $.ajaxSetup({ cache: false });
369        Helpers.showLoading();
370
371        $.get('/Settings/SmsFirebaseCode',
372            { paramsValues: paramValues },
373            function (data) {
374                Helpers.hideLoading();
375
376                var $data = $(data);
377                $("#modal_container").html($data);
378                $data.show();
379            });
380    };
381
382    Helpers.showSmsCode = function (paramValues) {
383        $.ajaxSetup({ cache: false });
384        Helpers.showLoading();
385
386        $.get('/Settings/SmsCode',
387            { paramsValues: paramValues },
388            function (data) {
389                Helpers.hideLoading();
390
391                var $data = $(data);
392                $("#modal_container").html($data);
393                $data.show();
394            });
395    };
396
397    Helpers.enviarCodigoCelular = function (paramValues) {
398        $.ajaxSetup({ cache: false });
399        Helpers.showLoading();
400
401        $.get('/Settings/SmsCode',
402            { paramsValues: paramValues },
403            function (data) {
404                Helpers.hideLoading();
405
406                var $data = $(data);
407                $("#modal_container").html($data);
408                $data.show();
409            });
410    };
411
412    Helpers.showRechargeCurrentAccountPaymentForm = function (funcodeNumber, funcodeValue) {
413
414        $.ajaxSetup({ cache: false });
415
416        Helpers.showLoading();
417
418        $.get('/Payment/_PaymentRechargeCurrentAccount/?f=' + funcodeNumber + '&v=' + funcodeValue,
419            function (data) {
420
421                Helpers.hideLoading();
422
423                var $data = $(data);
424                $data.hide();
425                $("#modal_container").html($data);
426                $data.show();
427            });
428    };
429
430    Helpers.transferRedeem = function (funcodeValueCredit, funcodeValueDebit) {
431
432        $.ajaxSetup({ cache: false });
433
434        Helpers.showLoading();
435
436        $.get('/Payment/_PaymentTransferCredit/?f=' + funcodeValueCredit + '&v=' + funcodeValueDebit,
437            function (data) {
438
439                Helpers.hideLoading();
440
441                var $data = $(data);
442                $data.hide();
443                $("#modal_container").html($data);
444                $data.show();
445            });
446    };
447
448    Helpers.showPaymentForm = function (mediaId, transactionType) {
449
450        $.ajaxSetup({ cache: false });
451
452        Helpers.showLoading();
453
454        $.post("/Payment/_PaymentDetails", { MediaId: mediaId, TransactionType: transactionType, IsSerie: false }, function (data) {
455            Helpers.hideLoading();
456            $("#modal_container").html(data);
457        }).fail(function (msg) {
458        }).always(function () {
459        });
460    };
461
462    Helpers.showSeriesPaymentForm = function (mediaId, transactionType) {
463
464        $.ajaxSetup({ cache: false });
465
466        Helpers.showLoading();
467
468        $.get('/Payment/_PaymentSerieCardDetails/?m=' + mediaId + '&t=' + transactionType,
469            function (data) {
470
471                Helpers.hideLoading();
472
473                var $data = $(data);
474                $data.hide();
475                $("#modal_container").html($data);
476                $data.show();
477            });
478    };
479
480    Helpers.showNewSubscriptionForm = function (p, f) {
481        $.ajaxSetup({ cache: false });
482
483        Helpers.showLoading();
484
485        $.get('/Payment/_SubscriptionCardDetailsNewForm?p=' + p + '&f=' + f,
486            function (data) {
487
488                Helpers.hideLoading();
489
490                var $data = $(data);
491                $data.hide();
492                $("#modal_container").html($data);
493                $data.show();
494            });
495    };
496
497    Helpers.showNewSubscriptionFormFlow = function (p, f) {
498        $.ajaxSetup({ cache: false });
499
500        Helpers.showLoading();
501
502        $.get('/Payment/_SubscriptionCardDetailsNewFormFlow?p=' + p + '&f=' + f,
503            function (data) {
504
505                Helpers.hideLoading();
506
507                var $data = $(data);
508                $data.hide();
509                $("#modal_container").html($data);
510                $data.show();
511            });
512    };
513
514    Helpers.showNewSubscriptionPicPayForm = function () {
515        $.ajaxSetup({ cache: false });
516        Helpers.showLoading();
517    };
518
519    Helpers.showChangePlanForm = function () {
520        $(".planContainer").show();
521        $(".planContainer").height(1);
522        $(".alterPlan").hide();
523        $(".container").height("auto");
524        $(".planContainer").stop(true, true).animate({ "height": '428px' },
525            200,
526            "swing",
527            function () {
528                //
529            }
530        );
531    };
532
533    Helpers.changeSubPlan = function (planId, subPlanId) {
534        $.ajaxSetup({ cache: false });
535        Helpers.showLoading();
536        $.ajax({
537            url: '/Settings/SubscriptionChangePlanMethod/',
538            type: 'POST',
539            data: { 'subscriptionPlanId': planId, 'subscriptionSubPlanId': subPlanId },
540            success: function (data) {
541                var $data = $(data);
542                $data.hide();
543                $("#modal_container").html($data);
544                $data.show();
545            },
546            error: (function (resp) {
547                //alert('Erro inesperado');
548            }),
549            complete: function () {
550                Helpers.hideLoading();
551            }
552        });
553    };
554
555    Helpers.showChangePaymentForm = function (subscriptionId) {
556        if (subscriptionId === undefined) {
557            subscriptionId = 0;
558        }
559
560        $.ajaxSetup({ cache: false });
561
562        Helpers.showLoading();
563
564        $.get('/Payment/_SubscriptionChangePaymentMethod?id=' + subscriptionId,
565            function (data) {
566                Helpers.hideLoading();
567
568                var $data = $(data);
569                $data.hide();
570                $("#modal_container").html($data);
571                $data.show();
572            });
573    };
574
575    Helpers.activeSubscription = function (subscriptionId) {
576        if (subscriptionId === undefined) {
577            subscriptionId = 0;
578        }
579
580        $.ajaxSetup({ cache: false });
581
582        $.ajax({
583            url: '/Payment/SetSubscriptionActive?id=' + subscriptionId,
584            type: 'POST',
585            success: function (data) {
586                if (data.Success) {
587                    window.location.reload();
588                }
589            },
590        });
591    };
592
593    Helpers.showLoginPromoFlow = function () {
594
595        $.ajaxSetup({ cache: false });
596
597        Helpers.showLoading();
598
599        $.get('/Account/_LoginPromoFlow',
600            function (data) {
601
602                Helpers.hideLoading();
603
604                var $data = $(data);
605                $data.hide();
606                $("#promoflowContent").html($data);
607                $data.show();
608            });
609    };
610
611    Helpers.showLoginRoku = function () {
612
613        $.ajaxSetup({ cache: false });
614
615        Helpers.showLoading();
616
617        $.get('/Account/_RokuLogin',
618            function (data) {
619
620                Helpers.hideLoading();
621
622                var $data = $(data);
623                $data.hide();
624                $("#modal_container").html($data);
625                $data.show();
626            });
627    };
628
629    Helpers.showLogin = function () {
630
631        $.ajaxSetup({ cache: false });
632
633        Helpers.showLoading();
634
635        $.get('/Account/_Login',
636            function (data) {
637
638                Helpers.hideLoading();
639
640                var $data = $(data);
641                $data.hide();
642                $("#modal_container").html($data);
643                $data.show();
644            });
645    };
646
647    Helpers.hideLogin = function () {
648        $("#modal_container").html("");
649    };
650
651    Helpers.showLoading = function () {
652
653        var timeout = setTimeout(function () {
654            $('#full_loader').show();
655        },
656            200);
657
658        _loadingTimeout.push(timeout);
659    };
660
661    Helpers.hideLoading = function () {
662
663        for (var i = 0; i < _loadingTimeout.length; i++) {
664            clearTimeout(_loadingTimeout[i]);
665        }
666
667        _loadingTimeout = [];
668
669        $("#full_loader").hide();
670    };
671
672    // Quando a página volta do bfcache (ex: clique em "voltar" do navegador após
673    // Helpers.showLoading() + window.location.href, ou após um modal como o de
674    // "Registro de dispositivo" ficar aberto no momento em que a página foi para
675    // outra tela), o JS não roda de novo do zero, então o loader e/ou o modal
676    // podem ficar presos visíveis. Limpamos os dois nesse caso.
677    window.addEventListener('pageshow', function (event) {
678        if (event.persisted) {
679            Helpers.hideLoading();
680            $("#modal_container").empty();
681        }
682    });
683
684    Helpers.formatMoney = function (value) {
685
686        var decimalSeparator = Number("1.2").toLocaleString().substr(1, 1);
687        var currencySymbol = "R$";
688
689        var amountWithCommas = value.toLocaleString();
690        var arParts = String(amountWithCommas).split(decimalSeparator);
691        var intPart = arParts[0];
692        var decPart = (arParts.length > 1 ? arParts[1] : '');
693        decPart = (decPart + '00').substr(0, 2);
694
695        return currencySymbol + ' ' + intPart + ',' + decPart;
696    };
697
698    Helpers.RemoveDevice = function (device, id) {
699        Helpers.showLoading();
700        $('#item' + id).fadeOut();
701        $.getJSON("/Account/RemoveDevice/?device=" + device,
702            function () {
703                Helpers.hideLoading();
704            }
705        );
706    };
707
708    Helpers.showCancelSubscription = function () {
709
710        $.ajaxSetup({ cache: false });
711
712        Helpers.showLoading();
713
714        $.get('/Payment/_SubscriptionCancel/',
715            function (data) {
716                Helpers.hideLoading();
717
718                var $data = $(data);
719                $data.hide();
720                $("#modal_container").html($data);
721                $data.show();
722            });
723    };
724
725    Helpers.showNewCancelSubscription = function (id) {
726        if (id === undefined) {
727            id = 0;
728        }
729
730        $.ajaxSetup({ cache: false });
731
732        Helpers.showLoading();
733
734        $.get('/Payment/_SubscriptionCancelNew/?id=' + id,
735            function (data) {
736                Helpers.hideLoading();
737
738                var $data = $(data);
739                $data.hide();
740                $("#modal_container").html($data);
741                $data.show();
742            });
743    };
744
745    Helpers.RefreshPage = function () {
746        $('#modal_container').html('');
747        location.reload();
748    };
749
750    Helpers.GuidBuilder = new function () {
751        "use strict";
752
753        var self = this;
754
755        function s4() {
756            return Math
757                .floor((1 + Math.random()) * 0x10000)
758                .toString(16)
759                .substring(1);
760        }
761
762        self.newGuid = function () {
763            return s4() +
764                s4() +
765                '-' +
766                s4() +
767                '-' +
768                s4() +
769                '-' +
770                s4() +
771                '-' +
772                s4() +
773                s4() +
774                s4();
775        };
776    };
777
778    Helpers.LoadScript = function (src) {
779
780        return new window.Promise(function (resolve, reject) {
781            var timeoutId;
782
783            var newScript = document.createElement('script');
784
785            newScript.onload = function () {
786                clearTimeout(timeoutId);
787                resolve();
788            };
789
790            newScript.src = src;
791
792            document.body.appendChild(newScript);
793
794            timeoutId = setTimeout(function () {
795                reject();
796            },
797                5000);
798        });
799    };
800
801    Helpers.LoadMultipleScripts = function (scriptsUrl) {
802        var loadScriptsPromisses = [];
803
804        for (var i = 0; i < scriptsUrl.length; i++) {
805            loadScriptsPromisses.push(Helpers.LoadScript(scriptsUrl[i]));
806        }
807
808        return window.Promise.all(loadScriptsPromisses);
809    };
810
811    String.prototype.escapeASCII = function () {
812        var str = this;
813        return str.replace(/&#(\d+);/g, function (m, n) { return String.fromCharCode(n); });
814    };
815
816    String.prototype.formatTimer = function () {
817        "use strict";
818
819        var currentTime = this;
820
821        var sec_num = parseInt(currentTime, 10);
822        var hours = Math.floor(sec_num / 3600);
823        var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
824        var seconds = sec_num - (hours * 3600) - (minutes * 60);
825
826        if (hours < 10) {
827            hours = "0" + hours;
828        }
829        if (minutes < 10) {
830            minutes = "0" + minutes;
831        }
832        if (seconds < 10) {
833            seconds = "0" + seconds;
834        }
835        var time = hours + ':' + minutes + ':' + seconds;
836        return time;
837    };
838
839    Number.prototype.formatTimer = function () {
840        return this.toString().formatTimer();
841    };
842
843    Helpers.generateMyGiftcode = function () {
844        $.ajaxSetup({ cache: false });
845
846        $.ajax({
847            url: '/Settings/generateMyGiftcode',
848            type: 'POST',
849            success: function (data) {
850                window.location.reload();
851            },
852        });
853    };
854
855    Helpers.useGiftcode = function () {
856        var gifCode = $('#GiftCodeNumber').val();
857        if (gifCode.length >= 5) {
858            $.ajaxSetup({ cache: false });
859            Helpers.showLoading();
860            $('#msgFuncode').text('');
861            $.ajax({
862                url: '/Payment/UseGiftcode/' + gifCode,
863                type: 'POST',
864                success: function (data) {
865                    if (data.Status == 0) {
866                        $('#msgFuncode').text(data.Message);
867                    } else {
868                        $('#msgFuncode').text(data.Message);
869                    }
870                },
871                error: (function (data) {
872                    alert('Erro inesperado');
873                }),
874                complete: function () {
875                    Helpers.hideLoading();
876                }
877            });
878        } else {
879            $('#msgFuncode').text('Este funcode não é válido.');
880        }
881    };
882
883    $(document).ready(function () {
884        try {
885            new Fingerprint2().get(function (result, components) {
886                $.ajaxSetup({ cache: false });
887                var settings = { settings: result };
888                $.post('/Settings/Set', settings, function (result) { });
889            });
890        } catch (e) {
891        }
892    });
893
894    Helpers.emailIndication = function () {
895        var emails = $('#emails').val();
896        if (emails.length > 5) {
897            $.ajaxSetup({ cache: false });
898            Helpers.showLoading();
899            $('#msgEmail').text('');
900            $.ajax({
901                url: '/Settings/EmailIndication/',
902                type: 'POST',
903                data: { 'id': emails },
904                success: function (resp) {
905                    if (resp.Status == 0) {
906                        $('#msgEmail').text(resp.Message + ' para: ' + emails);
907                        $('#emails').val('');
908                    } else {
909                        $('#msgEmail').text(resp.Message);
910                    }
911                },
912                error: (function (resp) {
913                    alert('Erro inesperado');
914                }),
915                complete: function () {
916                    Helpers.hideLoading();
917                }
918            });
919        } else {
920            $('#msgEmail').text('Este e-mail não é válido.');
921        }
922    };
923
924    Helpers.loadSetting = function ($element, $href) {
925        $('.container').css("display", "block !important");
926        $('.container').css("overflow", "hidden");
927        $('.container').animate({ height: "1px" },
928            200,
929            function () {
930                $('.container').html("");
931                $(".sideMenuItem").find("a").css("font-weight", "normal");
932                $('html,body').remove(".loadingSettings");
933                $element.append("<div class='loadingSettings'></div>");
934                $element.find("a").css("font-weight", "bold");
935                $('html,body').animate({ scrollTop: ($element.offset().top - 130) }, 200);
936            });
937        setTimeout(function () {
938            window.location.href = $href;
939        },
940            450);
941    };
942
943    Helpers.showSetting = function ($element) {
944        $($element).find("a").first().css("font-weight", "bold");
945        $('.container').css("display", "block !important");
946        $('.container').css("overflow", "hidden");
947        $(".container").height("auto");
948        containerHeight = $(".container").first().height();
949        $(".container").height("1px");
950        $(".container").appendTo($element);
951        $('html,body').scrollTop($($element).offset().top - 120);
952        setTimeout(function () {
953            $('.container').stop(false, false).animate({ height: containerHeight + "px" },
954                300,
955                function () {
956                    $(".container").height("auto");
957                });
958        },
959            200);
960    };
961
962    Helpers.funcodeType = {
963        subscription: 3,
964        subscriptionDiscount: 9,
965        discount: 11,
966        subscriptionAndDiscount: 12,
967        all: 0
968    };
969
970    Helpers.CleanGiftcodeMessages = function () {
971        $(".giftcodeError").html("");
972        $(".giftcodeSuccess").html("");
973        $(".giftcodeInfo .descriptionGiftcode").html("");
974        $(".giftcodeInfo .priceGiftcode").html("");
975        $(".giftcodeInfo").hide();
976    };
977
978    Helpers.VerifyGiftcode = function (giftcode, validGiftCode, planId, subscriptionDiscount, subPlanId) {
979        if (giftcode.length == 0) {
980            Helpers.CleanGiftcodeMessages();
981            return;
982        }
983        if (giftcode.length > 5) {
984            $.ajax({
985                type: "POST",
986                url: "/Payment/GetGiftcodeInfo",
987                data: `GiftCode=${giftcode}&SubPlanId=${subPlanId}`,
988                success: function (data) {
989                    Helpers.onVerifyGiftcode(data, validGiftCode, planId, subscriptionDiscount);
990                },
991                error: function (xhr, ajaxOptions, thrownError) {
992                    console.log(`loadNextPage error (${page}):`, thrownError);
993                }
994            });
995        }
996    };
997
998    Helpers.VerifyBradescoCardPromotion = async function (cardNumber, subPlanId) {
999        return new Promise((resolve, reject) => {
1000            $.ajax({
1001                type: "POST",
1002                url: "/Payment/GetCardIsInBradescoPromotion",
1003                data: {
1004                    "cardNumber": cardNumber,
1005                    "subPlanId": subPlanId,
1006                },
1007                success: function (data) {
1008                    resolve(data);
1009                },
1010                error: function (xhr, ajaxOptions, thrownError) {
1011                    console.log(`loadNextPage error (${page}):`, thrownError);
1012                    reject({
1013                        Status: -1,
1014                        Description: ""
1015                    });
1016                }
1017            });
1018        });
1019    };
1020
1021    Helpers.VerifyCardPromotion = function (cardNumber, validGiftCode, planId, subscriptionDiscount, acquisitionType) {
1022        $.ajax({
1023            type: "POST",
1024            url: "/Payment/GetCardPromotionIfAvailable",
1025            data: {
1026                "cardNumber": cardNumber,
1027                "acquisitionType": acquisitionType
1028            },
1029            success: function (data) {
1030                if (data.Success) {
1031                    if (!data.GiftCodeInfo.Status) {
1032                        Helpers.onVerifyGiftcode(data.GiftCodeInfo, validGiftCode, planId, subscriptionDiscount);
1033                        if (acquisitionType === 1) {
1034                            $("#useGiftcode .paymentMethod").hide();
1035                            $("#useGiftcode .giftCodeContainer").hide();
1036                        } else {
1037                            $("#giftCodeInputContainer").hide();
1038                        }
1039                        return;
1040                    }
1041                }
1042                if (acquisitionType === 1) {
1043                    $("#useGiftcode .paymentMethod").show();
1044                    $("#useGiftcode .giftCodeContainer").show();
1045                } else {
1046                    $("#giftCodeInputContainer").show();
1047                }
1048            },
1049            error: function (xhr, ajaxOptions, thrownError) {
1050                console.log(`loadNextPage error (${page}):`, thrownError);
1051            }
1052        });
1053    };
1054
1055    Helpers.onVerifyGiftcode = function (data, validGiftCode, planId, subscriptionDiscount) {
1056        Helpers.CleanGiftcodeMessages();
1057        if (data.Status == 1) {
1058            $(".giftcodeError").html(`<span style="color: red; font-weight: normal">Código inválido ou expirado.<span>`);
1059        }
1060        else if (data.funcodeType != validGiftCode && data.funcodeType != Helpers.funcodeType.subscriptionAndDiscount && validGiftCode != Helpers.funcodeType.all) {
1061            $(".giftcodeError").html(`${data.name}<br/><span>Código inválido ou expirado.<span>`);
1062        }
1063        else {
1064            if (data.funcodeType == Helpers.funcodeType.discount || (data.funcodeType == Helpers.funcodeType.subscriptionAndDiscount && validGiftCode == Helpers.funcodeType.discount)) {
1065                if ((planId > 0 && parseFloat(data.discount) > parseFloat(subscriptionDiscount)) || planId <= 0) {
1066                    Helpers.showGiftcodeInfo(data);
1067                }
1068                else {
1069                    $(".giftcodeError").html(`${data.name}<br/><span>Você é assinante Videoclub e já paga ${(parseFloat(subscriptionDiscount) * 100)}% a menos em qualquer locação ou compra, por isso o desconto não será aplicad
1069o.</span>`);
1070                }
1071            }
1072            else if (data.funcodeType == Helpers.funcodeType.subscription || data.funcodeType == Helpers.funcodeType.subscriptionDiscount || data.funcodeType == Helpers.funcodeType.subscriptionAndDiscount) {
1073                Helpers.showGiftcodeInfo(data);
1074            }
1075        }
1076    };
1077
1078    Helpers.showGiftcodeInfo = function (data) {
1079        Helpers.CleanGiftcodeMessages();
1080        $(".giftcodeSuccess").html(`<span>Desconto aplicado com sucesso!</span>`);
1081        $(".giftcodeInfo .descriptionGiftcode").html(data.name);
1082        $(".giftcodeInfo .priceGiftcode").html(`Valor com desconto: <span>R$ ${Helpers.discountCalc(price, data.discount).toString().replace(".", ",")}</span>`);
1083        $(".giftcodeInfo").show();
1084        $(".giftcodeSuccess").show();
1085    };
1086
1087    Helpers.discountCalc = function (price, discount) {
1088        priceDiscount = price * (1 - discount);
1089        priceDiscount = Math.ceil(priceDiscount * 100) / 100;
1090        return priceDiscount.toFixed(2);
1091    };
1092
1093    Helpers.getImagesRetencao = function () {
1094        return $.ajax({
1095            url: "https://looke-service.ottvs.com.br/v1/browser/ListBanner",
1096            method: "POST",
1097            contentType: "application/json",
1098            data: JSON.stringify({
1099                "BannerLocationId": 1140,
1100                "AgeRatingId": "8",
1101                "AuthenticationTicket": "looke@looke:v7c8ad@#$"
1102            })
1103        });
1104    };
1105
1106    Helpers.checkDataCompletion = function () {
1107        $.getJSON('/Account/DataCompletionStatus', function (result) {
1108            if (result && result.shouldShow) {
1109                $.get('/Account/_DataCompletionModal', function (data) {
1110                    $('#data_completion_modal_container').html(data);
1111                });
1112            }
1113        });
1114    };
1115
1116})();

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.