PageSourceSearch

https://local-restaurants.ro/assets/packages/flutter_inappwebview_web/assets/web/web_support.js

js local-restaurants.ro collected 2026-10-02 02:05:57 UTC 28,367 bytes, 589 lines download raw bytes

1window.flutter_inappwebview = {
2    webViews: {},
3    createFlutterInAppWebView: function(viewId, iframeId) {
4        var webView = {
5            viewId: viewId,
6            iframeId: iframeId,
7            iframe: null,
8            iframeContainer: null,
9            windowAutoincrementId: 0,
10            windows: {},
11            isFullscreen: false,
12            documentTitle: null,
13            functionMap: {},
14            settings: {},
15            disableContextMenuHandler: function(event) {
16                event.preventDefault();
17                event.stopPropagation();
18                return false;
19            },
20            prepare: function(settings) {
21                webView.settings = settings;
22                var iframe = document.getElementById(iframeId);
23                var iframeContainer = document.getElementById(iframeId + '-container');
24
25                document.addEventListener('fullscreenchange', function(event) {
26                    // document.fullscreenElement will point to the element that
27                    // is in fullscreen mode if there is one. If there isn't one,
28                    // the value of the property is null.
29                    if (document.fullscreenElement && document.fullscreenElement.id == iframeId) {
30                        webView.isFullscreen = true;
31                        window.flutter_inappwebview.nativeCommunication('onEnterFullscreen', viewId);
32                    } else if (!document.fullscreenElement && webView.isFullscreen) {
33                        webView.isFullscreen = false;
34                        window.flutter_inappwebview.nativeCommunication('onExitFullscreen', viewId);
35                    } else {
36                        webView.isFullscreen = false;
37                    }
38                });
39
40                if (iframe != null) {
41                    webView.iframe = iframe;
42                    webView.iframeContainer = iframeContainer;
43                    iframe.addEventListener('load', function (event) {
44                        webView.windowAutoincrementId = 0;
45                        webView.windows = {};
46
47                        var url = iframe.src;
48                        try {
49                            url = iframe.contentWindow.location.href;
50                        } catch (e) {
51                            console.log(e);
52                        }
53                        window.flutter_inappwebview.nativeCommunication('onLoadStart', viewId, [url]);
54
55                        try {
56                            var oldLogs = {
57                                'log': iframe.contentWindow.console.log,
58                                'debug': iframe.contentWindow.console.debug,
59                                'error': iframe.contentWindow.console.error,
60                                'info': iframe.contentWindow.console.info,
61                                'warn': iframe.contentWindow.console.warn
62                            };
63                            for (var k in oldLogs) {
64                                (function(oldLog) {
65                                    iframe.contentWindow.console[oldLog] = function() {
66                                        var message = '';
67                                        for (var i in arguments) {
68                                            if (message == '') {
69                                                message += arguments[i];
70                                            } else {
71                                                message += ' ' + arguments[i];
72                                            }
73                                        }
74                                        oldLogs[oldLog].call(iframe.contentWindow.console, ...arguments);
75                                        window.flutter_inappwebview.nativeCommunication('onConsoleMessage', viewId, [oldLog, message]);
76                                    }
77                                })(k);
78                            }
79                        } catch (e) {
80                            console.log(e);
81                        }
82
83                        try {
84                            var originalPushState = iframe.contentWindow.history.pushState;
85                            iframe.contentWindow.history.pushState = function (state, unused, url) {
86                                originalPushState.call(iframe.contentWindow.history, state, unused, url);
87                                var iframeUrl = iframe.src;
88                                try {
89                                    iframeUrl = iframe.contentWindow.location.href;
90                                } catch (e) {
91                                    console.log(e);
92                                }
93                                window.flutter_inappwebview.nativeCommunication('onUpdateVisitedHistory', viewId, [iframeUrl]);
94                            };
95
96                            var originalReplaceState = iframe.contentWindow.history.replaceState;
97                            iframe.contentWindow.history.replaceState = function (state, unused, url) {
98                                originalReplaceState.call(iframe.contentWindow.history, state, unused, url);
99                                var iframeUrl = iframe.src;
100                                try {
101                                    iframeUrl = iframe.contentWindow.location.href;
102                                } catch (e) {
103                                    console.log(e);
104                                }
105                                window.flutter_inappwebview.nativeCommunication('onUpdateVisitedHistory', viewId, [iframeUrl]);
106                            };
107
108                            var originalOpen = iframe.contentWindow.open;
109                            iframe.contentWindow.open = function (url, target, windowFeatures) {
110                                var newWindow = originalOpen.call(iframe.contentWindow, ...arguments);
111                                var windowId = webView.windowAutoincrementId;
112                                webView.windowAutoincrementId++;
113                                webView.windows[windowId] = newWindow;
114                                window.flutter_inappwebview.nativeCommunication('onCreateWindow', viewId, [windowId, url, target, windowFeatures]).then(function(){}, function(handledByClient) {
115                                    if (handledByClient) {
116                                        newWindow.close();
117                                    }
118                                });
119                                return newWindow;
120                            };
121
122                            var originalPrint = iframe.contentWindow.print;
123                            iframe.contentWindow.print = function() {
124                                var iframeUrl = iframe.src;
125                                try {
126                                    iframeUrl = iframe.contentWindow.location.href;
127                                } catch (e) {
128                                    console.log(e);
129                                }
130                                window.flutter_inappwebview.nativeCommunication('onPrintRequest', viewId, [iframeUrl]);
131                                originalPrint.call(iframe.contentWindow);
132                            };
133
134                            webView.functionMap = {
135                                "window.open": iframe.contentWindow.open,
136                                "window.print": iframe.contentWindow.print,
137                                "window.history.pushState": iframe.contentWindow.history.pushState,
138                                "window.history.replaceState": iframe.contentWindow.history.replaceState,
139                            }
140
141                            var initialTitle = iframe.contentDocument.title;
142                            var titleEl = iframe.contentDocument.querySelector('title');
143                            webView.documentTitle = initialTitle;
144                            window.flutter_inappwebview.nativeCommunication('onTitleChanged', viewId, [initialTitle]);
145                            if (titleEl != null) {
146                                new MutationObserver(function(mutations) {
147                                    var title = mutations[0].target.innerText;
148                                    if (title != webView.documentTitle) {
149                                        webView.documentTitle = title;
150                                        window.flutter_inappwebview.nativeCommunication('onTitleChanged', viewId, [title]);
151                                    }
152                                }).observe(
153                                    titleEl,
154                                    { subtree: true, characterData: true, childList: true }
155                                );
156                            }
157
158                            var oldPixelRatio = iframe.contentWindow.devicePixelRatio;
159                            iframe.contentWindow.addEventListener('resize', function (e) {
160                                var newPixelRatio = iframe.contentWindow.devicePixelRatio;
161                                if(newPixelRatio !== oldPixelRatio){
162                                    window.flutter_inappwebview.nativeCommunication('onZoomScaleChanged', viewId, [oldPixelRatio, newPixelRatio]);
163                                    oldPixelRatio = newPixelRatio;
164                                }
165                            });
166
167                            iframe.contentWindow.addEventListener('popstate', function (event) {
168                                var iframeUrl = iframe.src;
169                                try {
170                                    iframeUrl = iframe.contentWindow.location.href;
171                                } catch (e) {
172                                    console.log(e);
173                                }
174                                window.flutter_inappwebview.nativeCommunication('onUpdateVisitedHistory', viewId, [iframeUrl]);
175                            });
176
177                            iframe.contentWindow.addEventListener('scroll', function (event) {
178                                var x = 0;
179                                var y = 0;
180                                try {
181                                    x = iframe.contentWindow.scrollX;
182                                    y = iframe.contentWindow.scrollY;
183                                } catch (e) {
184                                    console.log(e);
185                                }
186                                window.flutter_inappwebview.nativeCommunication('onScrollChanged', viewId, [x, y]);
187                            });
188
189                            iframe.contentWindow.addEventListener('focus', function (event) {
190                                window.flutter_inappwebview.nativeCommunication('onWindowFocus', viewId);
191                            });
192
193                            iframe.contentWindow.addEventListener('blur', function (event) {
194                                window.flutter_inappwebview.nativeCommunication('onWindowBlur', viewId);
195                            });
196                        } catch (e) {
197                            console.log(e);
198                        }
199
200                        try {
201
202                            if (!webView.settings.javaScriptCanOpenWindowsAutomatically) {
203                                iframe.contentWindow.open = function() {
204                                    throw new Error('JavaScript cannot open windows automatically');
205                                };
206                            }
207
208                            if (!webView.settings.verticalScrollBarEnabled && !webView.settings.horizontalScrollBarEnabled) {
209                                var style = iframe.contentDocument.createElement('style');
210                                style.id = "settings.verticalScrollBarEnabled-settings.horizontalScrollBarEnabled";
211                                style.innerHTML = "body::-webkit-scrollbar { width: 0px; height: 0px; }";
212                                iframe.contentDocument.head.append(style);
213                            }
214
215                            if (webView.settings.disableVerticalScroll) {
216                                var style = iframe.contentDocument.createElement('style');
217                                style.id = "settings.disableVerticalScroll";
218                                style.innerHTML = "body { overflow-y: hidden; }";
219                                iframe.contentDocument.head.append(style);
220                            }
221
222                            if (webView.settings.disableHorizontalScroll) {
223                                var style = iframe.contentDocument.createElement('style');
224                                style.id = "settings.disableHorizontalScroll";
225                                style.innerHTML = "body { overflow-x: hidden; }";
226                                iframe.contentDocument.head.append(style);
227                            }
228
229                            if (webView.settings.disableContextMenu) {
230                                iframe.contentWindow.addEventListener('contextmenu', webView.disableContextMenuHandler);
231                            }
232                        } catch (e) {
233                            console.log(e);
234                        }
235
236                        window.flutter_inappwebview.nativeCommunication('onLoadStop', viewId, [url]);
237                    });
238                }
239            },
240            setSettings: function(newSettings) {
241                var iframe = webView.iframe;
242                try {
243                    if (webView.settings.javaScriptCanOpenWindowsAutomatically != newSettings.javaScriptCanOpenWindowsAutomatically) {
244                        if (!newSettings.javaScriptCanOpenWindowsAutomatically) {
245                            iframe.contentWindow.open = function() {
246                                throw new Error('JavaScript cannot open windows automatically');
247                            };
248                        } else {
249                            iframe.contentWindow.open = webView.functionMap["window.open"];
250                        }
251                    }
252
253                    if (webView.settings.verticalScrollBarEnabled != newSettings.verticalScrollBarEnabled &&
254                        webView.settings.horizontalScrollBarEnabled != newSettings.horizontalScrollBarEnabled) {
255                        if (!newSettings.verticalScrollBarEnabled && !newSettings.horizontalScrollBarEnabled) {
256                            var style = iframe.contentDocument.createElement('style');
257                            style.id = "settings.verticalScrollBarEnabled-settings.horizontalScrollBarEnabled";
258                            style.innerHTML = "body::-webkit-scrollbar { width: 0px; height: 0px; }";
259                            iframe.contentDocument.head.append(style);
260                        } else {
261                            var styleElement = iframe.contentDocument.getElementById("settings.verticalScrollBarEnabled-settings.horizontalScrollBarEnabled");
262                            if (styleElement) { styleElement.remove() }
263                        }
264                    }
265
266                    if (webView.settings.disableVerticalScroll != newSettings.disableVerticalScroll) {
267                        if (newSettings.disableVerticalScroll) {
268                            var style = iframe.contentDocument.createElement('style');
269                            style.id = "settings.disableVerticalScroll";
270                            style.innerHTML = "body { overflow-y: hidden; }";
271                            iframe.contentDocument.head.append(style);
272                        } else {
273                             var styleElement = iframe.contentDocument.getElementById("settings.disableVerticalScroll");
274                            if (styleElement) { styleElement.remove() }
275                        }
276                    }
277
278                    if (webView.settings.disableHorizontalScroll != newSettings.disableHorizontalScroll) {
279                        if (newSettings.disableHorizontalScroll) {
280                            var style = iframe.contentDocument.createElement('style');
281                            style.id = "settings.disableHorizontalScroll";
282                            style.innerHTML = "body { overflow-x: hidden; }";
283                            iframe.contentDocument.head.append(style);
284                        } else {
285                             var styleElement = iframe.contentDocument.getElementById("settings.disableHorizontalScroll");
286                            if (styleElement) { styleElement.remove() }
287                        }
288                    }
289
290                    if (webView.settings.disableContextMenu != newSettings.disableContextMenu) {
291                        if (newSettings.disableContextMenu) {
292                            iframe.contentWindow.addEventListener('contextmenu', webView.disableContextMenuHandler);
293                        } else {
294                            iframe.contentWindow.removeEventListener('contextmenu', webView.disableContextMenuHandler);
295                        }
296                    }
297                } catch (e) {
298                    console.log(e);
299                }
300
301                webView.settings = newSettings;
302            },
303            reload: function() {
304                var iframe = webView.iframe;
305                if (iframe != null && iframe.contentWindow != null) {
306                    try {
307                        iframe.contentWindow.location.reload();
308                    } catch (e) {
309                        console.log(e);
310                        iframe.contentWindow.location.href = iframe.
310src;
311                    }
312                }
313            },
314            goBack: function() {
315                var iframe = webView.iframe;
316                if (iframe != null) {
317                    try {
318                        iframe.contentWindow.history.back();
319                    } catch (e) {
320                        console.log(e);
321                    }
322                }
323            },
324            goForward: function() {
325                var iframe = webView.iframe;
326                if (iframe != null) {
327                    try {
328                        iframe.contentWindow.history.forward();
329                    } catch (e) {
330                        console.log(e);
331                    }
332                }
333            },
334            goBackOrForward: function(steps) {
335                var iframe = webView.iframe;
336                if (iframe != null) {
337                    try {
338                        iframe.contentWindow.history.go(steps);
339                    } catch (e) {
340                        console.log(e);
341                    }
342                }
343            },
344            evaluateJavascript: function(source) {
345                var iframe = webView.iframe;
346                var result = null;
347                if (iframe != null) {
348                    try {
349                        result = JSON.stringify(iframe.contentWindow.eval(source));
350                    } catch (e) {}
351                }
352                return result;
353            },
354            stopLoading: function(steps) {
355                var iframe = webView.iframe;
356                if (iframe != null) {
357                    try {
358                        iframe.contentWindow.stop();
359                    } catch (e) {
360                        console.log(e);
361                    }
362                }
363            },
364            getUrl: function() {
365                var iframe = webView.iframe;
366                var url = iframe.src;
367                try {
368                    url = iframe.contentWindow.location.href;
369                } catch (e) {
370                    console.log(e);
371                }
372                return url;
373            },
374            getTitle: function() {
375                var iframe = webView.iframe;
376                var title = null;
377                try {
378                    title = iframe.contentDocument.title;
379                } catch (e) {
380                    console.log(e);
381                }
382                return title;
383            },
384            injectJavascriptFileFromUrl: function(urlFile, scriptHtmlTagAttributes) {
385                var iframe = webView.iframe;
386                try {
387                    var d = iframe.contentDocument;
388                    var script = d.createElement('script');
389                    for (var key of Object.keys(scriptHtmlTagAttributes)) {
390                        if (scriptHtmlTagAttributes[key] != null) {
391                            script[key] = scriptHtmlTagAttributes[key];
392                        }
393                    }
394                    if (script.id != null) {
395                        script.onload = function() {
396                            window.flutter_inappwebview.nativeCommunication('onInjectedScriptLoaded', webView.viewId, [script.id]);
397                        }
398                        script.onerror = function() {
399                            window.flutter_inappwebview.nativeCommunication('onInjectedScriptError', webView.viewId, [script.id]);
400                        }
401                    }
402                    script.src = urlFile;
403                    if (d.body != null) {
404                        d.body.appendChild(script);
405                    }
406                } catch (e) {
407                    console.log(e);
408                }
409            },
410            injectCSSCode: function(source) {
411                var iframe = webView.iframe;
412                try {
413                    var d = iframe.contentDocument;
414                    var style = d.createElement('style');
415                    style.innerHTML = source;
416                    if (d.head != null) {
417                        d.head.appendChild(style);
418                    }
419                } catch (e) {
420                    console.log(e);
421                }
422            },
423            injectCSSFileFromUrl: function(urlFile, cssLinkHtmlTagAttributes) {
424                var iframe = webView.iframe;
425                try {
426                    var d = iframe.contentDocument;
427                    var link = d.createElement('link');
428                    for (var key of Object.keys(cssLinkHtmlTagAttributes)) {
429                        if (cssLinkHtmlTagAttributes[key] != null) {
430                            link[key] = cssLinkHtmlTagAttributes[key];
431                        }
432                    }
433                    link.type = 'text/css';
434                    var alternateStylesheet = "";
435                    if (cssLinkHtmlTagAttributes.alternateStylesheet) {
436                        alternateStylesheet = "alternate ";
437                    }
438                    link.rel = alternateStylesheet + "stylesheet";
439                    link.href = urlFile;
440                    if (d.head != null) {
441                        d.head.appendChild(link);
442                    }
443                } catch (e) {
444                    console.log(e);
445                }
446            },
447            scrollTo: function(x, y, animated) {
448                var iframe = webView.iframe;
449                try {
450                    if (animated) {
451                        iframe.contentWindow.scrollTo({top: y, left: x, behavior: 'smooth'});
452                    } else {
453                        iframe.contentWindow.scrollTo(x, y);
454                    }
455                } catch (e) {
456                    console.log(e);
457                }
458            },
459            scrollBy: function(x, y, animated) {
460                var iframe = webView.iframe;
461                try {
462                    if (animated) {
463                        iframe.contentWindow.scrollBy({top: y, left: x, behavior: 'smooth'});
464                    } else {
465                        iframe.contentWindow.scrollBy(x, y);
466                    }
467                } catch (e) {
468                    console.log(e);
469                }
470            },
471            printCurrentPage: function() {
472                var iframe = webView.iframe;
473                try {
474                    iframe.contentWindow.print();
475                } catch (e) {
476                    console.log(e);
477                }
478            },
479            getContentHeight: function() {
480                var iframe = webView.iframe;
481                try {
482                    return iframe.contentDocument.documentElement.scrollHeight;
483                } catch (e) {
484                    console.log(e);
485                }
486                return null;
487            },
488            getContentWidth: function() {
489                var iframe = webView.iframe;
490                try {
491                    return iframe.contentDocument.documentElement.scrollWidth;
492                } catch (e) {
493                    console.log(e);
494                }
495                return null;
496            },
497            getSelectedText: function() {
498                var iframe = webView.iframe;
499                try {
500                    var txt;
501                    var w = iframe.contentWindow;
502                    if (w.getSelection) {
503                        txt = w.getSelection().toString();
504                    } else if (w.document.getSelection) {
505                        txt = w.document.getSelection().toString();
506                    } else if (w.document.selection) {
507                        txt = w.document.selection.createRange().text;
508                    }
509                    return txt;
510                } catch (e) {
511                    console.log(e);
512                }
513                return null;
514            },
515            getScrollX: function() {
516                var iframe = webView.iframe;
517                try {
518                    return iframe.contentWindow.scrollX;
519                } catch (e) {
520                    console.log(e);
521                }
522                return null;
523            },
524            getScrollY: function() {
525                var iframe = webView.iframe;
526                try {
527                    return iframe.contentWindow.scrollY;
528                } catch (e) {
529                    console.log(e);
530                }
531                return null;
532            },
533            isSecureContext: function() {
534                var iframe = webView.iframe;
535                try {
536                    return iframe.contentWindow.isSecureContext;
537                } catch (e) {
538                    console.log(e);
539                }
540                return false;
541            },
542            canScrollVertically: function() {
543                var iframe = webView.iframe;
544                try {
545                    return iframe.contentDocument.body.scrollHeight > iframe.contentWindow.innerHeight;
546                } catch (e) {
547                    console.log(e);
548                }
549                return false;
550            },
551            canScrollHorizontally: function() {
552                var iframe = webView.iframe;
553                try {
554                    return iframe.contentDocument.body.scrollWidth > iframe.contentWindow.innerWidth;
555                } catch (e) {
556                    console.log(e);
557                }
558                return false;
559            },
560            getSize: function() {
561                var iframeContainer = webView.iframeContainer;
562                var width = 0.0;
563                var height = 0.0;
564                if (iframeContainer.style.width != null && iframeContainer.style.width != '' && iframeContainer.style.width.indexOf('px') > 0) {
565                    width = parseFloat(iframeContainer.style.width);
566                }
567                if (width == null || width == 0.0) {
568                    width = iframeContainer.getBoundingClientRect().width;
569                }
570                if (iframeContainer.style.height != null && iframeContainer.style.height != '' && iframeContainer.style.height.indexOf('px') > 0) {
571                    height = parseFloat(iframeContainer.style.height);
572                }
573                if (height == null || height == 0.0) {
574                    height = iframeContainer.getBoundingClientRect().height;
575                }
576
577                return {
578                    width: width,
579                    height: height
580                };
581            }
582        };
583
584        return webView;
585    },
586    getCookieExpirationDate: function(timestamp) {
587        return (new Date(timestamp)).toUTCString();
588    }
589};

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.