PageSourceSearch

https://redesurftank.com.br/_cdn/workcontrol.js

js redesurftank.com.br collected 2026-10-02 01:18:30 UTC 12,987 bytes, 279 lines download raw bytes

1$(function () {
2
3    //############## GET PROJECT
4    BASE = $("link[rel='base']").attr("href");
5
6    //############## FBLIKE RESPONSIVE CONTROL
7    if ($('.fb-like').length) {
8        $(window).load(function () {
9            if ($('.fb-like').width() < 600 && $(window).width() < 600) {
10                $('.fb-like').attr('data-width', $('.fb-like').width());
11            }
12        });
13    }
14
15    //############## IFRAME RESET
16    function VideoResize() {
17        $('.htmlchars iframe').each(function () {
18            var url = $(this).attr("src");
19            var char = "?";
20            if (url.indexOf("?") != -1) {
21                var char = "&";
22            }
23
24            var iw = $(this).width();
25            var width = $('.htmlchars').outerWidth();
26            var height = (iw * 9) / 16;
27            $(this).attr({width: width, height: height}).css({width: width + "px", height: height + "px"});
28        });
29    }
30    VideoResize();
31    $(window).resize(function () {
32        VideoResize();
33    });
34
35    //############## GOTO CORE
36    $('.wc_goto').click(function () {
37        var Goto = $($(this).attr("href"));
38        if (Goto.length) {
39            $('html, body').animate({scrollTop: Goto.offset().top}, 800);
40        } else {
41            $('html, body').animate({scrollTop: 0}, 800);
42        }
43        return false;
44    });
45
46    //############## IMAGE ERROR
47    $('img').error(function () {
48        var s, w, h, b;
49        s = $(this).attr('src');
50        w = 500;
51        h = 500;
52        b = $('link[rel="base"]').attr('href');
53        $(this).attr('src', b + '/tim.php?src=admin/_img/no_image.jpg&w=' + w + "&h=" + h);
54    });
55
56    //############## GET CEP
57    $('.wc_getCep').change(function () {
58        var cep = $(this).val().replace('-', '').replace('.', '');
59        if (cep.length === 8) {
60            $.get("https://viacep.com.br/ws/" + cep + "/json", function (data) {
61                if (!data.erro) {
62                    $('.wc_bairro').val(data.bairro);
63                    $('.wc_complemento').val(data.complemento);
64                    $('.wc_localidade').val(data.localidade);
65                    $('.wc_logradouro').val(data.logradouro);
66                    $('.wc_uf').val(data.uf);
67                }
68            }, 'json');
69        }
70    });
71
72    //############## MASK INPUT
73    if ($('.formDate').length || $('.formTime').length || $('.formCep').length || $('.formCpf').length || $('.formPhone').length) {
74        $.getScript(BASE + '/_cdn/maskinput.js', function () {
75            $(".formDate").mask("99/99/9999");
76            $(".formTime").mask("99/99/9999 99:99");
77            $(".formCep").mask("99999-999");
78            $(".formCpf").mask("999.999.999-99");
79
80            var SPMaskBehavior = function (val) {
81                return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
82            },
83            spOptions = {
84                onKeyPress: function(val, e, field, options) {
85                    field.mask(SPMaskBehavior.apply({}, arguments), options);
86                }
87            };
88            $('.formPhone').mask(SPMaskBehavior, spOptions);
89
90            // $('.formPhone').focusout(function () {
91            //     var phone, element;
92            //     element = $(this);
93            //     element.unmask();
94            //     phone = element.val().replace(/\D/g, '');
95            //     if (phone.length > 10) {
96            //         element.mask("(99) 99999-999?9");
97            //     } else {
98            //         element.mask("(99) 9999-9999?9");
99            //     }
100            // }).trigger('focusout');
101        });
102    }
103
104    //############## DATEPICKER
105    if ($('.jwc_datepicker').length) {
106        $("head").append('<link rel="stylesheet" href="' + BASE + '/_cdn/datepicker/datepicker.min.css">');
107        $.getScript(BASE + '/_cdn/datepicker/datepicker.min.js');
108        $.getScript(BASE + '/_cdn/datepicker/datepicker.pt-BR.js', function () {
109            $('.jwc_datepicker').datepicker({language: 'pt-BR', autoClose: true});
110        });
111    }
112
113    //############## WC TAB
114    $('.wc_tab').click(function () {
115        if (!$(this).hasClass('wc_active')) {
116            var WcTab = $(this).attr('href');
117
118            $('.wc_tab').removeClass('wc_active');
119            $(this).addClass('wc_active');
120
121            $('.wc_tab_target.wc_active').fadeOut(200, function () {
122                $(WcTab).fadeIn(200).addClass('wc_active');
123            }).removeClass('wc_active');
124        }
125
126        if (!$(this).hasClass('wc_active_go')) {
127            return false;
128        }
129    });
130
131    //############## WC ACCORDION
132    $('.wc_accordion').click(function () {
133        $('.wc_accordion_toogle_active').slideUp(200, function () {
134            $(this).removeClass('wc_accordion_toogle_active');
135        });
136        $(this).find('.wc_accordion_toogle:not(.wc_accordion_toogle_active)').slideToggle(200).addClass('wc_accordion_toogle_active');
137    });
138
139    $('.wc_accordion div').click(function (e) {
140        e.stopPropagation();
141    });
142
143    //############## HIGHLIGHT
144    if ($('*[class="brush: php;"]').length) {
145        $("head").append('<link rel="stylesheet" href="' + BASE + '/_cdn/highlight.min.css">');
146        $.getScript(BASE + '/_cdn/highlight.min.js', function () {
147            $('*[class="brush: php;"]').each(function (i, block) {
148                hljs.highlightBlock(block);
149            });
150        });
151    }
152
153    //############## MODAL BOX
154    if ($('*[rel*="shadowbox"]').length) {
155        $("head").append('<link rel="stylesheet" href="' + BASE + '/_cdn/shadowbox/shadowbox.css">');
156        $.getScript(BASE + '/_cdn/shadowbox/shadowbox.js', function () {
157            Shadowbox.init();
158        });
159    }
160
161    //############## TWITCH LIVE POLLER
162    // 1) Badge flutuante persistente mostrando X ao vivo (click abre painel expandido)
163    // 2) Toast de notificacao quando surge streamer NOVO ao vivo
164    // OBS: NAO roda badge flutuante na pagina /assistir (obscurece o chat do Twitch
165    //      e a Twitch desabilita chat por seguranca anti-clickjacking).
166    (function () {
167        var isWatchPage = window.location.pathname.indexOf('/assistir') === 0;
168        var STORAGE_KEY = 'tw_live_seen';
169        function getSeen() {
170            try { return JSON.parse(sessionStorage.getItem(STORAGE_KEY) || '[]'); }
171            catch (e) { return []; }
172        }
173        function setSeen(arr) {
174            try { sessionStorage.setItem(STORAGE_KEY, JSON.stringify(arr)); } catch (e) {}
175        }
176
177        // Badge flutuante
178        var $badge = null;
179        var $panel = null;
180        function ensureBadge() {
181            if ($badge) return;
182            $badge = $('<div id="tw-live-badge"></div>').css({
183                position: 'fixed', bottom: '20px', right: '20px', zIndex: 9998,
184                background: 'linear-gradient(135deg,#9146FF,#772ce8)',
185                color: '#fff', padding: '10px 16px', borderRadius: '999px',
186                fontWeight: '800', fontSize: '13px', cursor: 'pointer',
187                boxShadow: '0 6px 20px rgba(145,70,255,.4)', display: 'none',
188                alignItems: 'center', gap: '8px', userSelect: 'none',
189            }).html('<span style="width:8px;height:8px;background:#fff;border-radius:50%;display:inline-block;animation:tw-pulse 1.2s infinite;"></span><span class="tw-badge-text"></span>');
190            $('body').append($badge);
191            // keyframes via style tag (injection unica)
192            if (!document.getElementById('tw-badge-style')) {
193                $('<style id="tw-badge-style">@keyframes tw-pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}#tw-live-badge:hover{transform:translateY(-2px);}</style>').appendTo('head');
194            }
195            $badge.on('click', togglePanel);
196        }
197
198        function renderPanel(channels) {
199            if ($panel) { $panel.remove(); $panel = null; return; }
200            var html = '<div style="padding:14px 16px;border-bottom:1px solid rgba(255,255,255,.08);"><b style="color:#fff;">AO VIVO agora</b> <small style="color:#aaa;">('+channels.length+')</small></div>';
201            html += '<div style="max-height:380px;overflow-y:auto;">';
202            channels.forEach(function(c){
203                var name = $('<span>').text(c.display_name || c.twitch_login).html();
204                var title = $('<span>').text(c.title || '').html();
205                html += '<a href="'+BASE+'/assistir/'+encodeURIComponent(c.twitch_login)+'" style="display:flex;gap:10px;padding:10px 14px;color:#fff;text-decoration:none;border-bottom:1px solid rgba(255,255,255,.05);align-items:center;">';
206                if (c.profile_image) html += '<img src="'+c.profile_image+'" style="width:36px;height:36px;border-radius:50%;"/>';
207                html += '<div style="flex:1;min-width:0;"><div style="font-weight:700;font-size:13px;">'+name+'</div>';
208                if (title) html += '<div style="font-size:11px;color:#9aa0ae;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">'+title+'</div>';
209                html += '</div></a>';
210            });
211            html += '</div>';
212            $panel = $('<div id="tw-live-panel"></div>').css({
213                position: 'fixed', bottom: '70px', right: '20px', zIndex: 9998,
214                background: '#1a1026', border: '1px solid rgba(145,70,255,.25)',
215                borderRadius: '12px', width: '320px', color:'#fff',
216                boxShadow: '0 12px 32px rgba(0,0,0,.5)', overflow: 'hidden',
217            }).html(html);
218            $('body').append($panel);
219            $(document).on('click.twlive', function(e){
220                if (!$(e.target).closest('#tw-live-panel,#tw-live-badge').length) {
221                    if ($panel) { $panel.remove(); $panel = null; }
222                    $(document).off('click.twlive');
223                }
224            });
225        }
226        function togglePanel() {
227            if ($panel) { $panel.remove(); $panel = null; $(document).off('click.twlive'); return; }
228            if (window.__twLiveList) renderPanel(window.__twLiveList);
229        }
230
231        function showToast(displayName, login) {
232            var t = $('<
232div class="trigger trigger_info"></div>').css({
233                position: 'fixed', top: '16px', right: '16px', zIndex: 10000,
234                maxWidth: '360px', boxShadow: '0 4px 12px rgba(0,0,0,.3)'
235            });
236            t.html('<b>🔴 AO VIVO:</b> ' + $('<span>').text(displayName).html() +
237                ' — <a href="' + BASE + '/assistir/' + encodeURIComponent(login) + '" style="color:inherit;text-decoration:underline;font-weight:700;">assistir</a>' +
238                ' <span class="ajax_close" style="float:right;cursor:pointer;margin-left:10px;">×</span>');
239            $('body').append(t);
240            t.find('.ajax_close').on('click', function () { t.fadeOut(200, function () { t.remove(); }); });
241            setTimeout(function () { t.fadeOut(400, function () { t.remove(); }); }, 15000);
242        }
243
244        function poll() {
245            fetch(BASE + '/_cdn/widgets/accddtankeiros/twitch_watch.ajax.php?action=list_live', { credentials: 'same-origin' })
246                .then(function (r) { return r.json(); })
247                .then(function (d) {
248                    if (!d || !d.ok || !Array.isArray(d.channels)) return;
249                    window.__twLiveList = d.channels;
250
251                    // Badge persistente (não roda em /assistir pra nao obscurecer chat)
252                    if (!isWatchPage) {
253                        ensureBadge();
254                        if (d.channels.length > 0) {
255                            $badge.find('.tw-badge-text').text(d.channels.length + ' ao vivo');
256                            $badge.css('display', 'inline-flex');
257                        } else {
258                            $badge.css('display', 'none');
259                            if ($panel) { $panel.remove(); $panel = null; }
260                        }
261                    }
262
263                    // Toast só pra canais novos (não vistos nesta sessão)
264                    var seen = getSeen();
265                    var seenSet = {};
266                    seen.forEach(function (s) { seenSet[s] = true; });
267                    var currentIds = d.channels.map(function (c) { return String(c.tw_channel_id); });
268                    d.channels.forEach(function (c) {
269                        var id = String(c.tw_channel_id);
270                        if (!seenSet[id]) showToast(c.display_name || c.twitch_login, c.twitch_login);
271                    });
272                    setSeen(currentIds);
273                })
274                .catch(function () {});
275        }
276        poll();
277        setInterval(poll, 30000); // 30s — mais responsivo
278    })();
279});

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.