PageSourceSearch

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

js looke.com.br collected 2026-09-24 09:32:22 UTC 35,145 bytes, 1,104 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    Helpers.formatMoney = function (value) {
673
674        var decimalSeparator = Number("1.2").toLocaleString().substr(1, 1);
675        var currencySymbol = "R$";
676
677        var amountWithCommas = value.toLocaleString();
678        var arParts = String(amountWithCommas).split(decimalSeparator);
679        var intPart = arParts[0];
680        var decPart = (arParts.length > 1 ? arParts[1] : '');
681        decPart = (decPart + '00').substr(0, 2);
682
683        return currencySymbol + ' ' + intPart + ',' + decPart;
684    };
685
686    Helpers.RemoveDevice = function (device, id) {
687        Helpers.showLoading();
688        $('#item' + id).fadeOut();
689        $.getJSON("/Account/RemoveDevice/?device=" + device,
690            function () {
691                Helpers.hideLoading();
692            }
693        );
694    };
695
696    Helpers.showCancelSubscription = function () {
697
698        $.ajaxSetup({ cache: false });
699
700        Helpers.showLoading();
701
702        $.get('/Payment/_SubscriptionCancel/',
703            function (data) {
704                Helpers.hideLoading();
705
706                var $data = $(data);
707                $data.hide();
708                $("#modal_container").html($data);
709                $data.show();
710            });
711    };
712
713    Helpers.showNewCancelSubscription = function (id) {
714        if (id === undefined) {
715            id = 0;
716        }
717
718        $.ajaxSetup({ cache: false });
719
720        Helpers.showLoading();
721
722        $.get('/Payment/_SubscriptionCancelNew/?id=' + id,
723            function (data) {
724                Helpers.hideLoading();
725
726                var $data = $(data);
727                $data.hide();
728                $("#modal_container").html($data);
729                $data.show();
730            });
731    };
732
733    Helpers.RefreshPage = function () {
734        $('#modal_container').html('');
735        location.reload();
736    };
737
738    Helpers.GuidBuilder = new function () {
739        "use strict";
740
741        var self = this;
742
743        function s4() {
744            return Math
745                .floor((1 + Math.random()) * 0x10000)
746                .toString(16)
747                .substring(1);
748        }
749
750        self.newGuid = function () {
751            return s4() +
752                s4() +
753                '-' +
754                s4() +
755                '-' +
756                s4() +
757                '-' +
758                s4() +
759                '-' +
760                s4() +
761                s4() +
762                s4();
763        };
764    };
765
766    Helpers.LoadScript = function (src) {
767
768        return new window.Promise(function (resolve, reject) {
769            var timeoutId;
770
771            var newScript = document.createElement('script');
772
773            newScript.onload = function () {
774                clearTimeout(timeoutId);
775                resolve();
776            };
777
778            newScript.src = src;
779
780            document.body.appendChild(newScript);
781
782            timeoutId = setTimeout(function () {
783                reject();
784            },
785                5000);
786        });
787    };
788
789    Helpers.LoadMultipleScripts = function (scriptsUrl) {
790        var loadScriptsPromisses = [];
791
792        for (var i = 0; i < scriptsUrl.length; i++) {
793            loadScriptsPromisses.push(Helpers.LoadScript(scriptsUrl[i]));
794        }
795
796        return window.Promise.all(loadScriptsPromisses);
797    };
798
799    String.prototype.escapeASCII = function () {
800        var str = this;
801        return str.replace(/&#(\d+);/g, function (m, n) { return String.fromCharCode(n); });
802    };
803
804    String.prototype.formatTimer = function () {
805        "use strict";
806
807        var currentTime = this;
808
809        var sec_num = parseInt(currentTime, 10);
810        var hours = Math.floor(sec_num / 3600);
811        var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
812        var seconds = sec_num - (hours * 3600) - (minutes * 60);
813
814        if (hours < 10) {
815            hours = "0" + hours;
816        }
817        if (minutes < 10) {
818            minutes = "0" + minutes;
819        }
820        if (seconds < 10) {
821            seconds = "0" + seconds;
822        }
823        var time = hours + ':' + minutes + ':' + seconds;
824        return time;
825    };
826
827    Number.prototype.formatTimer = function () {
828        return this.toString().formatTimer();
829    };
830
831    Helpers.generateMyGiftcode = function () {
832        $.ajaxSetup({ cache: false });
833
834        $.ajax({
835            url: '/Settings/generateMyGiftcode',
836            type: 'POST',
837            success: function (data) {
838                window.location.reload();
839            },
840        });
841    };
842
843    Helpers.useGiftcode = function () {
844        var gifCode = $('#GiftCodeNumber').val();
845        if (gifCode.length >= 5) {
846            $.ajaxSetup({ cache: false });
847            Helpers.showLoading();
848            $('#msgFuncode').text('');
849            $.ajax({
850                url: '/Payment/UseGiftcode/' + gifCode,
851                type: 'POST',
852                success: function (data) {
853                    if (data.Status == 0) {
854                        $('#msgFuncode').text(data.Message);
855                    } else {
856                        $('#msgFuncode').text(data.Message);
857                    }
858                },
859                error: (function (data) {
860                    alert('Erro inesperado');
861                }),
862                complete: function () {
863                    Helpers.hideLoading();
864                }
865            });
866        } else {
867            $('#msgFuncode').text('Este funcode não é válido.');
868        }
869    };
870
871    $(document).ready(function () {
872        try {
873            new Fingerprint2().get(function (result, components) {
874                $.ajaxSetup({ cache: false });
875                var settings = { settings: result };
876                $.post('/Settings/Set', settings, function (result) { });
877            });
878        } catch (e) {
879        }
880    });
881
882    Helpers.emailIndication = function () {
883        var emails = $('#emails').val();
884        if (emails.length > 5) {
885            $.ajaxSetup({ cache: false });
886            Helpers.showLoading();
887            $('#msgEmail').text('');
888            $.ajax({
889                url: '/Settings/EmailIndication/',
890                type: 'POST',
891                data: { 'id': emails },
892                success: function (resp) {
893                    if (resp.Status == 0) {
894                        $('#msgEmail').text(resp.Message + ' para: ' + emails);
895                        $('#emails').val('');
896                    } else {
897                        $('#msgEmail').text(resp.Message);
898                    }
899                },
900                error: (function (resp) {
901                    alert('Erro inesperado');
902                }),
903                complete: function () {
904                    Helpers.hideLoading();
905                }
906            });
907        } else {
908            $('#msgEmail').text('Este e-mail não é válido.');
909        }
910    };
911
912    Helpers.loadSetting = function ($element, $href) {
913        $('.container').css("display", "block !important");
914        $('.container').css("overflow", "hidden");
915        $('.container').animate({ height: "1px" },
916            200,
917            function () {
918                $('.container').html("");
919                $(".sideMenuItem").find("a").css("font-weight", "normal");
920                $('html,body').remove(".loadingSettings");
921                $element.append("<div class='loadingSettings'></div>");
922                $element.find("a").css("font-weight", "bold");
923                $('html,body').animate({ scrollTop: ($element.offset().top - 130) }, 200);
924            });
925        setTimeout(function () {
926            window.location.href = $href;
927        },
928            450);
929    };
930
931    Helpers.showSetting = function ($element) {
932        $($element).find("a").first().css("font-weight", "bold");
933        $('.container').css("display", "block !important");
934        $('.container').css("overflow", "hidden");
935        $(".container").height("auto");
936        containerHeight = $(".container").first().height();
937        $(".container").height("1px");
938        $(".container").appendTo($element);
939        $('html,body').scrollTop($($element).offset().top - 120);
940        setTimeout(function () {
941            $('.container').stop(false, false).animate({ height: containerHeight + "px" },
942                300,
943                function () {
944                    $(".container").height("auto");
945                });
946        },
947            200);
948    };
949
950    Helpers.funcodeType = {
951        subscription: 3,
952        subscriptionDiscount: 9,
953        discount: 11,
954        subscriptionAndDiscount: 12,
955        all: 0
956    };
957
958    Helpers.CleanGiftcodeMessages = function () {
959        $(".giftcodeError").html("");
960        $(".giftcodeSuccess").html("");
961        $(".giftcodeInfo .descriptionGiftcode").html("");
962        $(".giftcodeInfo .priceGiftcode").html("");
963        $(".giftcodeInfo").hide();
964    };
965
966    Helpers.VerifyGiftcode = function (giftcode, validGiftCode, planId, subscriptionDiscount, subPlanId) {
967        if (giftcode.length == 0) {
968            Helpers.CleanGiftcodeMessages();
969            return;
970        }
971        if (giftcode.length > 5) {
972            $.ajax({
973                type: "POST",
974                url: "/Payment/GetGiftcodeInfo",
975                data: `GiftCode=${giftcode}&SubPlanId=${subPlanId}`,
976                success: function (data) {
977                    Helpers.onVerifyGiftcode(data, validGiftCode, planId, subscriptionDiscount);
978                },
979                error: function (xhr, ajaxOptions, thrownError) {
980                    console.log(`loadNextPage error (${page}):`, thrownError);
981                }
982            });
983        }
984    };
985
986    Helpers.VerifyBradescoCardPromotion = async function (cardNumber, subPlanId) {
987        return new Promise((resolve, reject) => {
988            $.ajax({
989                type: "POST",
990                url: "/Payment/GetCardIsInBradescoPromotion",
991                data: {
992                    "cardNumber": cardNumber,
993                    "subPlanId": subPlanId,
994                },
995                success: function (data) {
996                    resolve(data);
997                },
998                error: function (xhr, ajaxOptions, thrownError) {
999                    console.log(`loadNextPage error (${page}):`, thrownError);
1000                    reject({
1001                        Status: -1,
1002                        Description: ""
1003                    });
1004                }
1005            });
1006        });
1007    };
1008
1009    Helpers.VerifyCardPromotion = function (cardNumber, validGiftCode, planId, subscriptionDiscount, acquisitionType) {
1010        $.ajax({
1011            type: "POST",
1012            url: "/Payment/GetCardPromotionIfAvailable",
1013            data: {
1014                "cardNumber": cardNumber,
1015                "acquisitionType": acquisitionType
1016            },
1017            success: function (data) {
1018                if (data.Success) {
1019                    if (!data.GiftCodeInfo.Status) {
1020                        Helpers.onVerifyGiftcode(data.GiftCodeInfo, validGiftCode, planId, subscriptionDiscount);
1021                        if (acquisitionType === 1) {
1022                            $("#useGiftcode .paymentMethod").hide();
1023                            $("#useGiftcode .giftCodeContainer").hide();
1024                        } else {
1025                            $("#giftCodeInputContainer").hide();
1026                        }
1027                        return;
1028                    }
1029                }
1030                if (acquisitionType === 1) {
1031                    $("#useGiftcode .paymentMethod").show();
1032                    $("#useGiftcode .giftCodeContainer").show();
1033                } else {
1034                    $("#giftCodeInputContainer").show();
1035                }
1036            },
1037            error: function (xhr, ajaxOptions, thrownError) {
1038                console.log(`loadNextPage error (${page}):`, thrownError);
1039            }
1040        });
1041    };
1042
1043    Helpers.onVerifyGiftcode = function (data, validGiftCode, planId, subscriptionDiscount) {
1044        Helpers.CleanGiftcodeMessages();
1045        if (data.Status == 1) {
1046            $(".giftcodeError").html(`<span style="color: red; font-weight: normal">Código inválido ou expirado.<span>`);
1047        }
1048        else if (data.funcodeType != validGiftCode && data.funcodeType != Helpers.funcodeType.subscriptionAndDiscount && validGiftCode != Helpers.funcodeType.all) {
1049            $(".giftcodeError").html(`${data.name}<br/><span>Código inválido ou expirado.<span>`);
1050        }
1051        else {
1052            if (data.funcodeType == Helpers.funcodeType.discount || (data.funcodeType == Helpers.funcodeType.subscriptionAndDiscount && validGiftCode == Helpers.funcodeType.discount)) {
1053                if ((planId > 0 && parseFloat(data.discount) > parseFloat(subscriptionDiscount)) || planId <= 0) {
1054                    Helpers.showGiftcodeInfo(data);
1055                }
1056                else {
1057                    $(".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
1057o.</span>`);
1058                }
1059            }
1060            else if (data.funcodeType == Helpers.funcodeType.subscription || data.funcodeType == Helpers.funcodeType.subscriptionDiscount || data.funcodeType == Helpers.funcodeType.subscriptionAndDiscount) {
1061                Helpers.showGiftcodeInfo(data);
1062            }
1063        }
1064    };
1065
1066    Helpers.showGiftcodeInfo = function (data) {
1067        Helpers.CleanGiftcodeMessages();
1068        $(".giftcodeSuccess").html(`<span>Desconto aplicado com sucesso!</span>`);
1069        $(".giftcodeInfo .descriptionGiftcode").html(data.name);
1070        $(".giftcodeInfo .priceGiftcode").html(`Valor com desconto: <span>R$ ${Helpers.discountCalc(price, data.discount).toString().replace(".", ",")}</span>`);
1071        $(".giftcodeInfo").show();
1072        $(".giftcodeSuccess").show();
1073    };
1074
1075    Helpers.discountCalc = function (price, discount) {
1076        priceDiscount = price * (1 - discount);
1077        priceDiscount = Math.ceil(priceDiscount * 100) / 100;
1078        return priceDiscount.toFixed(2);
1079    };
1080
1081    Helpers.getImagesRetencao = function () {
1082        return $.ajax({
1083            url: "https://looke-service.ottvs.com.br/v1/browser/ListBanner",
1084            method: "POST",
1085            contentType: "application/json",
1086            data: JSON.stringify({
1087                "BannerLocationId": 1140,
1088                "AgeRatingId": "8",
1089                "AuthenticationTicket": "looke@looke:v7c8ad@#$"
1090            })
1091        });
1092    };
1093
1094    Helpers.checkDataCompletion = function () {
1095        $.getJSON('/Account/DataCompletionStatus', function (result) {
1096            if (result && result.shouldShow) {
1097                $.get('/Account/_DataCompletionModal', function (data) {
1098                    $('#data_completion_modal_container').html(data);
1099                });
1100            }
1101        });
1102    };
1103
1104})();

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.