PageSourceSearch

https://app.quicktok.ai/js/utils/general.js?v=3

js quicktok.ai collected 2026-10-05 12:30:34 UTC 10,229 bytes, 308 lines download raw bytes

1window.addEventListener('load', function(e) {
2    thereAreNoEasterEggsHereGoAway();
3    $('#open-navbar-mobile').click(function(e) { // Add event to the usual button that shows in the navbar when you're on mobile
4        let navbar_mobile = $('#navbar-mobile');
5        if($(this).hasClass('false')) {
6            console.log('wfeefwewf');
7            // On open
8            $(this).attr('class', 'rotate-180 ltransition');
9            navbar_mobile.removeClass('hidden').animate({'opacity': 1}, 200);
10            $(this).html('<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>');
11
12            return false;
13        }
14        // On close
15        $(this).attr('class', 'false ltransition');
16        $(this).html('<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>');
17        navbar_mobile.animate({'opacity': 0}, 200, function() {
18            navbar_mobile.addClass('hidden');
19        });
20    });
21});
22
23function thereAreNoEasterEggsHereGoAway() {
24    console.log("\n" +
25        "     \n" +
26        "     \n" +
27        "                           ▄Γ\n" +
28        "                         ╓██\n" +
29        "                       ,████\n" +
30        "                      ╢████▒\n" +
31        "                    ╔██████▓\n" +
32        "                  ╓╢██████▒[\n" +
33        "                 ▓█████████▄▄▄▄╥⌐\n" +
34        "                ╩▀▀▀██████████╢`\n" +
35        "                    ╟▒██████╢\"\n" +
36        "                    ╢█████▌╜\n" +
37        "                   ▐█████╜\n" +
38        "                   ▓███╜\n" +
39        "                  ▐██▀\n" +
40        "                  █▀\n" +
41        "     \n" +
42        "     ");
43}
44
45function showSuccessNotification(title, message, showDuration = 9000) {
46    toastr.success(message, title, buildNotificationBody(title, message, showDuration));
47}
48
49function showErrorNotification(title, message, showDuration = 9000) {
50    toastr.error(message, title, buildNotificationBody(title, message, showDuration));
51}
52
53function showWarningNotification(title, message, showDuration = 9000) {
54    toastr.warning(message, title, buildNotificationBody(title, message, showDuration));
55}
56
57function buildNotificationBody(title, message, showDuration = 9000) {
58    return {
59        positionClass: "toast-top-center",
60        timeOut: 5e3,
61        closeButton: !0,
62        debug: !1,
63        newestOnTop: !0,
64        progressBar: !0,
65        preventDuplicates: !0,
66        onclick: null,
67        showDuration: showDuration.toString(),
68        hideDuration: "1000",
69        extendedTimeOut: "1000",
70        showEasing: "swing",
71        hideEasing: "linear",
72        showMethod: "fadeIn",
73        hideMethod: "fadeOut",
74        tapToDismiss: !1
75    };
76}
77
78function getTimeSince(timestamp) {
79    let date = new Date(timestamp * 1000);
80
81    let seconds = Math.floor((new Date() - date) / 1000);
82    let interval = seconds / 31536000;
83
84    if (interval > 1) {
85        return Math.floor(interval) + ( Math.floor(interval) == 1 ? " <span>year</span>" : " <span>years</span>");
86    }
87    interval = seconds / 2592000;
88    if (interval > 1) {
89        return Math.floor(interval) + ( Math.floor(interval) == 1 ? " <span>month</span>" : " <span>months</span>");
90    }
91    interval = seconds / 86400;
92    if (interval > 1) {
93        return Math.floor(interval) + ( Math.floor(interval) == 1 ? " <span>day</span>" : " <span>days</span>");
94    }
95    interval = seconds / 3600;
96    if (interval > 1) {
97        return Math.floor(interval) + ( Math.floor(interval) == 1 ? " <span>hour</span>" : " <span>hours</span>");
98    }
99    interval = seconds / 60;
100    if (interval > 1) {
101        return Math.floor(interval) + ( Math.floor(interval) == 1 ? " <span>minute</span>" : " <span>minutes</span>");
102    }
103
104    return Math.floor(seconds) + " <span>seconds</span>";
105}
106
107function convertSeconds(seconds) {
108    const hrs = Math.floor(seconds / 3600);
109    seconds %= 3600;
110    const mins = Math.floor(seconds / 60);
111    const secs = seconds % 60;
112
113    let result = "";
114    if(hrs > 0) {
115        result += `${hrs} <span>hour</span>${hrs > 1 ? "s" : ""} `;
116    }
117    if(mins > 0) {
118        result += `${mins} <span>minute</span>${mins > 1 ? "s" : ""} `;
119    }
120    if(secs > 0) {
121        result += `${secs} <span>second</span>${secs > 1 ? "s" : ""} `;
122    }
123    return result.trim();
124}
125
126function convertSecondsToMinutesFormat(time) {
127    let minutes = Math.floor(time / 60);
128    let seconds = time % 60;
129    return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
130}
131
132function convertMinutesFormatToSeconds(time) {
133    let splitTime = time.split(':');
134    return parseInt(splitTime[0], 10) * 60 + parseInt(splitTime[1], 10);
135}
136
137function convertTimestampToDate(timestamp) {
138    let date = new Date(timestamp * 1000);
139    let day = "0" + date.getDate();
140    let month = "0" + (date.getMonth() + 1);
141    let year = date.getFullYear().toString().substr(-2);
142    let hours = "0" + date.getHours();
143    let minutes = "0" + date.getMinutes();
144    let seconds = "0" + date.getSeconds();
145
146    return day.substr(-2) + "/" + month.substr(-2) + "/" + year + " " + hours.substr(-2) + ":" + minutes.substr(-2);
147}
148
149function downloadVideo(videoUrl, videoName){
150    let anchorElement = document.createElement('a');
151
152    anchorElement.href = videoUrl;
153
154    anchorElement.download = videoName;
155
156    anchorElement.click();
157}
158
159function createCustomModal(element, modal_id, modal_html) {
160    let modal = document.createElement('div');
161
162    modal.setAttribute('id', modal_id);
163    modal.innerHTML = modal_html;
164    modal.querySelector('div').setAttribute('style', 'opacity: 0');
165
166    element.appendChild(modal);
167
168    $(modal).find('div').first().animate({opacity: 1}, 200);
169
170    $('.modal-close').click(function(e) {
171        let modal = $('#' + modal_id);
172        modal.find('div').first().animate({opacity: 0}, 200, function() {
173            modal.remove();
174        });
175    });
176}
177
178function getVariableMethodGet(name) {
179    let params = new URLSearchParams(location.search);
180    return params.get(name);
181}
182
183function setVariableMethodGet(name, value) {
184    const url = new URL(window.location.href);
185    url.searchParams.set(name, value);
186    history.pushState({}, null, url.toString());
187}
188
189function videoPlayScroll(elementSelector) {
190    try {
191        let videoEl = $(elementSelector).find('video[autoplay]');
192        let observer;
193
194        let options = {
195            root: null,
196            rootMargin: '0px',
197            threshold: 0.5,
198        };
199
200        let playVideo = (entries, observer) => {
201            entries.forEach(entry => {
202                if (entry.isIntersecting) {
203                    entry.target.play();
204                } else {
205                    entry.target.pause();
206                }
207            });
208        }
209
210        observer = new IntersectionObserver(playVideo, options);
211
212        videoEl.each((i, video) => {
213            observer.observe(video);
214        });
215    } catch (e) {
216        console.log(e);
217    }
218}
219
220function registerInputCounters(inputs) {
221    for (let id in inputs) {
222        $('#' + id).on('input', function(e) {
223            let video_title_counter = $('#' + id + '-counter');
224
225            if($(this).val().length === 0) {
226                video_title_counter.attr('class', inputs[id][0]);
227            } else {
228                video_title_counter.attr('class', inputs[id][1]);
229                video_title_counter.text('(' + $(this).val().length + '/' + inputs[id][2] + ')');
230            }
231
232            if($(this)[0].tagName == 'TEXTAREA') {
233                $(this).text($(this).val());
234            } else $(this).attr('value', $(this).val());
235
236        });
237    }
238}
239
240function copyToClipboard(text) {
241    let $temp = $("<textarea>");
242    let brRegex = /<br\s*[\/]?>/gi;
243    $("body").append($temp);
244    $temp.val(text).select();
245    document.execCommand("copy");
246    $temp.remove();
247}
248
249function appendStyleElement(css) {
250    return $('<style>').css('type', 'text/css').text(css).appendTo(document.head);
251}
252
253function getRandomId(n) {
254    return [...Array(n)].map(i=>(~~(Math.random()*36)).toString(36)).join('');
255}
256
257function getThumbnailFromVideoURL(url, callback) {
258    let video = document.createElement('video');
259    let canvas = document.createElement('canvas');
260
261    let context = canvas.getContext('2d')
262
263    video.onloadedmetadata = function() {
264        canvas.width = video.videoWidth;
265        canvas.height = video.videoHeight;
266
267        video.addEventListener('loadeddata', function() {
268            context.drawImage(video, 0, 0, canvas.width, canvas.height);
269            video.pause();
270            video.remove();
271
272            let dataURI = canvas.toDataURL('image/jpeg');
273            callback(dataURI);
274        }, false);
275
276    };
277
278    video.preload = 'metadata';
279    video.muted = true;
280    video.playsInline = true;
281    video.setAttribute('crossOrigin', 'anonymous');
282    video.src = url;
283
284    video.play();
285}
286
287function createCookie(name, value, days) {
288    let date = new Date();
289    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
290    let expires = "; expires=" + date.toUTCString();
291    document.cookie = `${name}=${value}${expires}; path=/`;
292}
293
294function getCookie(cookie_name) {
295    let name = cookie_name + "=";
296    let decodedCookie = decodeURIComponent(document.cookie);
297    let ca = decodedCookie.split(';');
298    for(let i = 0; i < ca.length; i++) {
299        let c = ca[i];
300        while (c.charAt(0) === ' ') {
301            c = c.substring(1);
302        }
303        if (c.indexOf(name) === 0) {
304            return c.substring(name.length, c.length);
305        }
306    }
307    return null;
308}

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.