PageSourceSearch

https://www.fahrschuletischer.de/js/_essentials/basics.js

js fahrschuletischer.de collected 2026-10-08 11:14:00 UTC 7,842 bytes, 236 lines download raw bytes

1// add target="_blank" to external links
2var links = document.links;
3for (var i = 0, l = links.length; i < l; i++)
4{
5    if (links[i].hostname != window.location.hostname && !links[i].href.startsWith('javascript:') )
6    {
7        if(!links[i].target) {
8            links[i].target = '_blank';
9        }
10        if(!links[i].hasAttribute("rel")) {
11            links[i].setAttribute('rel', 'noreferrer');
12        }
13    }
14}
15
16// IE11 endsWith polyfill
17if (!String.prototype.endsWith) {
18	String.prototype.endsWith = function(suffix) {
19        return this.indexOf(suffix, this.length - suffix.length) !== -1;
20    };
21}
22
23// check if session and localStorage are available,
24// if not, set a flag and provide a fallback solution via window.getStorage
25try {
26    window.localStorage;
27    window.sessionStorage;
28    window._storageDisabled = false; 
29}
30catch(e) {
31    console.log("sessionStorage and/or localStorage not available, falling back to in-memory storage: ", e);
32
33    // store factory to retrieve in-memory session 
34    window.getStorage = function() {
35        return {
36            _items: new Map(),
37            setItem(key, val) {
38                this._items.set(key, val);
39            },
40            getItem(key) {
41                return this._items.has(key) ? this._items.get(key): null;
42            }
43        }
44    }
45    // set flag 
46    window._storageDisabled = true; 
47}
48
49/* BODY CLASS HANDLING */
50var body = document.querySelector('body');
51body.classList.remove('no-js');
52body.classList.add('javascript');
53if ('ontouchstart' in document.documentElement) body.classList.add('is-touch');
54
55/* MAILMASK */
56function maillink() {var maillinks = document.querySelectorAll('a[data-email]');for (i = 0; i < maillinks.length; i++) {var data = JSON.parse(maillinks[i].getAttribute('data-email')),escape = maillinks[i].querySelector('span.escape');maillinks[i].href = "mailto:" + data.name + "@" +data.host;if(escape) escape.outerHTML = '@';}};
57maillink();
58
59/*
60 * css breakpoints in javascript object
61 * https://github.com/ma-zou/breakpoints_from_css/blob/master/script.js
62*/
63window.breakpoint = function (width, direction) {
64    var breakpoints = new Array();
65    for(bp in cssData['gridMap']) {
66        if(cssData['gridMap'][bp].width === '$rowMaxWidth') breakpoints[bp] = parseInt(cssData['rowMaxWidth'].replace('px', '')) / 16 + 'em';
67        else breakpoints[bp] = parseInt(cssData['gridMap'][bp].width.replace('px', '')) / 16 +'em'; 
68    }
69    direction = (typeof direction === 'undefined') ? 'min' : direction;
70    if(typeof width === 'undefined') {
71        return breakpoints
72    } else {
73        if (direction === 'min') return window.matchMedia("(min-width: " + breakpoints[width] + ")").matches;
74        else return window.matchMedia("(max-width: " + breakpoints[width].replace(/(\d|\W)*/, function(m) {return parseFloat(m) - 0.0625}) + ")").matches
75    }
76}
77/**
78 * @author Dominik Kressler
79 * @thanks Eric Holtkamp
80 * @date 2020-05-05
81 * 
82 */
83window.currentBp = function() {
84    let bp = breakpoint();
85    let checkWidth = (window.innerWidth + 1) / parseInt(cssData['base-font-size']);
86    let values = Object.values(bp).map(function (x) {return parseFloat(x);});
87    values.sort(function(a, b) {return a - b;});
88    let result = false;
89
90    for(let i = 0, c = values.length; i < c; i++)
91    {
92        if(i < values.length-1 && checkWidth >= values[i] && checkWidth <= values[ (i+1) ]) 
93        {
94            result = values[i];
95            break;
96        }
97    }
98    if(result === false) result = values[values.length-1];
99
100    return Object.keys(bp)[Object.values(bp).indexOf(result+'em')];
101};
102
103/*
104 * new scrollDir(document.body); 
105 * Adds a class to an element to indicate the scroll direction
106 */
107function ScrollDir(elm) 
108{
109    var lastScrollTop = 0;
110    document.addEventListener('scroll', function(e)
111    {
112        var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
113        if (scrollTop > lastScrollTop) 
114        {
115            elm.classList.add('scrolling-down');
116            elm.classList.remove('scrolling-up');
117        }
118        else if (scrollTop != lastScrollTop)
119        {
120            elm.classList.remove('scrolling-down');
121            elm.classList.add('scrolling-up');
122        }
123        lastScrollTop = scrollTop <= 0 ? 0 : scrollTop;
124    });
125}
126
127window.addEventListener('keydown', function(e) {if(e.which == 13 && document.activeElement.getAttribute('tabindex') != null) document.activeElement.click();});
128
129/**
130 * @desc J Library with handy helper functions
131 * @version 1.0.0
132 * @author Dominik Kressler
133 * @author Malte Zoudlik
134*/
135var J = function()
136{
137    return this
138};
139J.prototype.mergeDeep = function() 
140{ 
141    var self = this; 
142    Object.keys(arguments).forEach(obj => 
143    { 
144        Object.keys(self).forEach(val => 
145        { 
146            if (arguments[obj].hasOwnProperty(val)) { 
147                var tmp = arguments[obj][val] instanceof Array ? arguments[obj][val] : [arguments[obj][val]]; 
148                self[val] = self[val].concat(tmp); 
149            }   
150        }); 
151    }); 
152    return self; 
153} 
154J.prototype.merge = function(obj1, obj2)
155{
156    for (var p in obj2) {
157        try {
158            if ( obj2[p].constructor==Object ) {
159                obj1[p] = obj1[p].mergeDeep(obj2[p]);
160            } else {
161                obj1[p] = obj2[p];
162            }
163        }
164        catch(e) {
165            obj1[p] = obj2[p];
166        }
167    }
168    return obj1;
169};
170J.prototype.isOnScreen = function(node, offset)
171{
172    if (typeof node != 'object') return true;
173
174    if(typeof offset == 'undefined') offset = 0;
175
176    var bounding = node.getBoundingClientRect();
177    var isOnScreen = (
178        bounding.top + bounding.height >= 0 
179        && bounding.left + bounding.width >= 0 
180        && bounding.right - bounding.width <= (window.innerWidth || document.documentElement.clientWidth) 
181        && bounding.bottom - bounding.height <= ( (window.innerHeight || document.documentElement.clientHeight) + offset )
182    );
183
184    if(isOnScreen) {
185        node.classList.add('isOnScreen');
186    }
187    else node.classList.remove('isOnScreen');
188
189    return isOnScreen;
190};
191J.prototype.isNodeElement = function(element) {
192    return element instanceof Element || element instanceof HTMLDocument; 
193};
194J.prototype.deepValue = function(obj, path) {
195    for (var i=0, path=path.split('.'), len=path.length; i<len; i++){
196        if(obj[path[i]] == null || typeof obj[path[i]] == "undefined") obj = '';
197        else obj = obj[path[i]];
198    };
199    return obj;
200};
201J.prototype.isURL = function(str) {
202    var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
203    '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name
204    '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
205    '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
206    '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
207    '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
208    return pattern.test(str);
209};
210J = new J();
211
212if (typeof String.prototype.replaceAll !== "undefined") { 
213    String.prototype.replaceAll = function(search, replacement) {
214        var target = this;
215        return target.replace(new RegExp(search, 'g'), replacement);
216    };
217}
218
219// require some optional global services
220rIt({
221    "form[data-evercaptcha]": {
222      "assets": ['/js/_essentials/formix.js', '/securewebapps/evercdn/assets/evercaptcha/v1/scripts/main.min.js','/securewebapps/evercdn/assets/evercaptcha/v1/styles/main.min.css'],
223      "function": function(selector){
224            const formix = new Formix({ 
225                selector: selector,
226                eventName: "evercaptcha-valid"
227            });
228            const everCaptcha = new EverCAPTCHA(selector, true, {
229                hookSending: function(form) {
230                    form.dispatchEvent(new CustomEvent('evercaptcha-valid'));
231                }
232            });
233      },
234      "lazy": true
235    }
236});

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.