PageSourceSearch

https://www.wiesengrund-frauenau.de/basewebinterface/com/v02/logic/inline-frame.js?revision=

js wiesengrund-frauenau.de collected 2026-10-04 15:38:05 UTC 16,666 bytes, 541 lines download raw bytes

1"use strict";
2window.inlineEditor = window.inlineEditor || {};
3window.inlineEditor._functions = window.inlineEditor._functions || {};
4window.inlineEditor._functionsSend = window.inlineEditor._functionsSend || {};
5window.inlineEditor._functionsReceive =
6  window.inlineEditor._functionsReceive || {};
7window.inlineEditor.store = window.inlineEditor.store || {};
8
9// init receive logic
10function receiveMessage(event) {
11  var origin = event.origin || event.originalEvent.origin;
12  if (event.data && event.data.type) {
13    var action = event.data;
14    if (action.type == "INIT_CONTENT_FRAME" || action.type == "INIT_EDITOR") {
15      //TODO: INIT_EDITOR is deprecated
16      //console.debug(3333, "INIT_CONTENT_FRAME", action);
17      if (action.version == "v01") {
18        // old
19        window.inlineEditor["interfaceKey"] = action.interfaceKey;
20        window.inlineEditor["methodPrefix"] = action.methodPrefix;
21        window.inlineEditor["store"]["pageControllerPrefix"] = "EditorDetail";
22      } else {
23        // new
24        window.inlineEditor["origin"] = action.origin;
25        window.inlineEditor["appKey"] = action.appKey;
26        window.inlineEditor["moduleKey"] = action.moduleKey;
27        window.inlineEditor["roleKey"] = action.roleKey;
28        window.inlineEditor["rootElementId"] = action.rootElementId;
29        window.inlineEditor["revision"] = action.revision;
30        window.inlineEditor["store"] = action.store;
31        window.inlineEditor["developmentModeEvents"] =
32          action.developmentModeEvents;
33      }
34      if (window.inlineEditor.onInitContentFrame[action.appKey]) {
35        window.inlineEditor.onInitContentFrame[action.appKey]({
36          appKey: action.appKey,
37          moduleKey: action.moduleKey,
38        });
39      } else {
40        console.warn(
41          'onInitContentFrame for "' + action.appKey + '" not defined',
42        );
43      }
44
45      var head = document.getElementsByTagName("head")[0];
46      for (var i = 0; i < action.jsUrls.length; i++) {
47        var script = document.createElement("script");
48        script.type = "text/javascript";
49        script.src = action.jsUrls[i];
50        head.appendChild(script);
51        console.debug("added", action.jsUrls[i]);
52      }
53      for (var i = 0; i < action.cssUrls.length; i++) {
54        var link = document.createElement("link");
55        link.type = "text/css";
56        link.rel = "stylesheet";
57        link.href = action.cssUrls[i];
58        head.appendChild(link);
59        console.debug("added", action.cssUrls[i]);
60      }
61    } else if (action.type == "CALL_METHOD") {
62      if (origin == window.inlineEditor.origin) {
63        if (
64          window.inlineEditor &&
65          window.inlineEditor._functionsReceive &&
66          window.inlineEditor._functionsReceive[action.methodKey]
67        ) {
68          window.inlineEditor._functionsReceive[action.methodKey](
69            action.payload,
70          );
71        } else {
72          console.warn(
73            "received unkown action: " + action.methodKey,
74            action,
75            window.inlineEditor._functionsReceive,
76          );
77        }
78      } else {
79        console.warn(
80          `inline-frame.js -> INIT_CONTENT_FRAME: origin not matching: ${origin}, ${window.inlineEditor.origin}`,
81        );
82      }
83    } else {
84      console.warn("inline-frame.js -> INIT_CONTENT_FRAME: unknown action " + action.type + ": ", action);
85    }
86  }
87}
88window.addEventListener("message", receiveMessage, false);
89
90// _functions
91window.inlineEditor._functions["ScrollToPosition"] = function (position) {
92  //console.debug("inline-iframe.js > ScrollToPosition", position);
93  window.scrollTo(position.x, position.y);
94};
95
96window.inlineEditor._functions["PrepareBeforeUnload"] = function (action) {
97  //console.debug("inline-iframe.js > PrepareBeforeUnload", action);
98  var parser = document.createElement("a");
99  parser.href = action.url.next;
100  if (parser.protocol !== "javascript:") {
101    var beforeUnload = window.inlineEditor.beforeUnload;
102    if (
103      !beforeUnload ||
104      beforeUnload.url.current !== window.location.href ||
105      beforeUnload.url.next !== parser.href ||
106      beforeUnload.ts + 500 > new Date().getTime()
107    ) {
108      // debounce
109      window.inlineEditor.beforeUnload = {
110        url: {
111          current: window.location.href,
112          next: parser.href,
113        },
114        markedUID: {
115          next: action.markedUID?.next || null,
116        },
117        ts: new Date().getTime(),
118      };
119    }
120  }
121};
122
123window.inlineEditor._functions["ChangeCurrentPage"] = function (action) {
124  let url = action.url;
125  let markedUID = action.markedUID;
126  url =
127    url === null ||
128    url.startsWith("/") ||
129    url.startsWith("https://") ||
130    url.startsWith("http://")
131      ? url
132      : "/" + url;
133  window.inlineEditor.functions("PrepareBeforeUnload")({
134    url: { next: url },
135    markedUID: { next: markedUID },
136  });
137  window.location.href = url;
138};
139
140// _functionsSend
141window.inlineEditor._functionsSend["EventContentDOMChanged"] = function (
142  payload,
143) {
144  window.inlineEditor.functions("SendMethodCall")({
145    methodKey: "EventContentDOMChanged",
146    payload: payload,
147  });
148};
149
150window.inlineEditor._functionsSend["AddLoadingTimer"] = function (
151  context,
152  timeout,
153  onLoaded,
154  loadingTimerId,
155) {
156  if (onLoaded) {
157    console.error(
158      "AddLoadingTimer -> onLoaded is not supported for contentFrame",
159    );
160  }
161  window.inlineEditor.functions("SendMethodCall")({
162    methodKey: "AddLoadingTimer",
163    payload: {
164      context: context,
165      timeout: timeout,
166      onLoaded: undefined,
167      loadingTimerId: loadingTimerId,
168    },
169  });
170};
171
172window.inlineEditor._functionsSend["AddNotifications"] = function (payload) {
173  window.inlineEditor.functions("SendMethodCall")({
174    methodKey: "AddNotifications",
175    payload: {
176      status: payload.status,
177      messages: payload.messages,
178    },
179  });
180};
181
182window.inlineEditor._functionsSend["StopLoadingTimer"] = function (
183  loadingTimerId,
184) {
185  window.inlineEditor.functions("SendMethodCall")({
186    methodKey: "StopLoadingTimer",
187    payload: { loadingTimerId: loadingTimerId },
188  });
189};
190
191// _functionsReceive
192window.inlineEditor._functionsReceive["ScrollToPosition"] = function (action) {
193  window.inlineEditor.functions("ScrollToPosition")(action.position);
194};
195window.inlineEditor._functionsReceive["ChangeCurrentPage"] = function (
196  arg1,
197  arg2,
198) {
199  var payload = arg1;
200  if (typeof arg1 === "string") {
201    payload = {
202      url: arg1,
203      suppressLoadingBar: arg2 !== undefined ? arg2 : null,
204    };
205  }
206  window.inlineEditor.functions("ChangeCurrentPage")(payload);
207};
208
209window.inlineEditor._functionsReceive["PrepareBeforeUnload"] = function (
210  action,
211) {
212  if (action.url && action.url.url) {
213    // TODO: hack needed until new bundle is created
214    action.url = action.url.url;
215  }
216  window.inlineEditor.functions("PrepareBeforeUnload")({ url: url });
217};
218
219// init functions
220window.inlineEditor["functions"] = function (methodKey) {
221  //console.debug('functions call', '->', methodKey)
222  return function () {
223    if (
224      window.inlineEditor &&
225      window.inlineEditor._functionsSend &&
226      window.inlineEditor._functionsSend[methodKey]
227    ) {
228      return window.inlineEditor._functionsSend[methodKey].apply(
229        null,
230        arguments,
231      );
232    } else if (window.inlineEditor._functions[methodKey]) {
233      return window.inlineEditor._functions[methodKey].apply(null, arguments);
234    } else if (window[window.inlineEditor.methodPrefix + methodKey]) {
235      //throw Error('method-call on global-functions is deprecated: ' + window.inlineEditor.methodPrefix+methodKey);
236      return window[window.inlineEditor.methodPrefix + methodKey].apply(
237        null,
238        arguments,
239      );
240    } else {
241      console.warn("method not found: " + methodKey, window.inlineEditor);
242      return null;
243    }
244  };
245};
246
247// init send logic
248window.inlineEditor._functions["SendMethodCall"] = function (action) {
249  if (action.methodKey) {
250    action.type = "CALL_METHOD";
251    action.appKey = action.appKey || window.inlineEditor.appKey;
252    action.moduleKey = action.moduleKey || window.inlineEditor.moduleKey;
253    /*
254    console.debug(
255      "inline-frame > SendMethodCall",
256      action,
257      window.inlineEditor.origin
258    );
259    */
260    if (action.data !== undefined) {
261      console.warn(
262        "DEPRECATED: SendMethodCall -> action.data is deprecated. Use action.payload instead.",
263      );
264    }
265    action.data = action.payload; // action.data is deprecated. Used for compat-mode.
266    window.parent.postMessage(
267      action,
268      action.origin || window.inlineEditor.origin,
269    );
270  } else {
271    throw new Error("invalid action" + action);
272  }
273};
274// resize iframe
275var pendingResize = null;
276window.addEventListener("resize", function (event) {
277  // resize
278  window.inlineEditor.functions("ResizeFrameContent")();
279
280  // resize again (after all dom-elements have rendered again)
281  pendingResize = pendingResize || true;
282  setTimeout(function () {
283    if (pendingResize) {
284      window.inlineEditor.functions("ResizeFrameContent")();
285      pendingResize = false;
286    }
287  }, 500);
288});
289
290window.addEventListener("beforeunload", function (event) {
291  var beforeUnload =
292    (window.inlineEditor && window.inlineEditor.beforeUnload) || null;
293  console.debug("inline-iframe.js > beforeunload", beforeUnload);
294  var urlNext = null;
295  if (beforeUnload && beforeUnload.ts + 500 > new Date().getTime()) {
296    urlNext = beforeUnload.url.next;
297    window.inlineEditor.functions("SendMethodCall")({
298      methodKey: "EventFramePageChanging",
299      payload: {
300        url: {
301          current: window.location.href,
302          next: urlNext,
303        },
304        markedUID: {
305          next: beforeUnload.markedUID.next,
306        },
307      },
308    });
309  } else {
310    if (window.inlineEditor.origin) {
311      window.inlineEditor.functions("SendMethodCall")({
312        methodKey: "EventFramePageUnloaded",
313        payload: { url: window.location.href },
314        origin: window.inlineEditor.origin,
315      });
316    }
317  }
318  window.inlineEditor.beforeUnload = null;
319});
320
321window.addEventListener("click", function (event) {
322  var ele = $(event.target)
323    .closest("a, .ev-clickable, .clickable, .jquerylink")
324    .get(0);
325  var url = null;
326  if (ele) {
327    if (ele.tagName === "A") {
328      url = ele.href;
329    } else {
330      url = $("a", ele).attr("href");
331    }
332    //console.debug("inline-iframe.js > click", url, event.target);
333    if (url) {
334      window.inlineEditor.functions("PrepareBeforeUnload")({
335        url: {
336          next: url,
337        },
338      });
339    }
340  }
341});
342
343if (0) {
344  window.addEventListener("popstate", function (event) {
345    //console.debug("inline-iframe.js > popstate", event);
346    //window.inlineEditor.functions("PrepareBeforeUnload")({ url: { next: '' } });
347  });
348  //window.history.pushState(null, null, window.location.href);
349}
350
351function restArguments(func, startIndex) {
352  startIndex = startIndex == null ? func.length - 1 : +startIndex;
353  return function () {
354    var length = Math.max(arguments.length - startIndex, 0),
355      rest = Array(length),
356      index = 0;
357    for (; index < length; index++) {
358      rest[index] = arguments[index + startIndex];
359    }
360    switch (startIndex) {
361      case 0:
362        return func.call(this, rest);
363      case 1:
364        return func.call(this, arguments[0], rest);
365      case 2:
366        return func.call(this, arguments[0], arguments[1], rest);
367    }
368    var args = Array(startIndex + 1);
369    for (index = 0; index < startIndex; index++) {
370      args[index] = arguments[index];
371    }
372    args[startIndex] = rest;
373    return func.apply(this, args);
374  };
375}
376
377window.debounce = function debounce(func, wait, immediate) {
378  var timeout, previous, args, result, context;
379  var later = function () {
380    var passed = new Date().getTime() - previous;
381    if (wait > passed) {
382      timeout = setTimeout(later, wait - passed);
383    } else {
384      timeout = null;
385      if (!immediate) result = func.apply(context, args);
386      if (!timeout) args = context = null;
387    }
388  };
389
390  var debounced = restArguments(function (_args) {
391    context = this;
392    args = _args;
393    previous = new Date().getTime();
394    if (!timeout) {
395      timeout = setTimeout(later, wait);
396      if (immediate) result = func.apply(context, args);
397    }
398    return result;
399  });
400
401  debounced.cancel = function () {
402    clearTimeout(timeout);
403    timeout = args = context = null;
404  };
405
406  return debounced;
407};
408
409window.addEventListener(
410  "scroll",
411  window.debounce(function (event) {
412    window.inlineEditor.functions("SendMethodCall")({
413      methodKey: "EventFrameScrolled",
414      payload: { position: { x: window.scrollX, y: window.scrollY } },
415    });
416  }, 500),
417);
418
419window.addEventListener("keydown", (e) => {
420  if ((e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) && !e.repeat) {
421    //console.debug(3333, 'EventKeyboardShortcut');
422    window.inlineEditor.functions("SendMethodCall")({
423      methodKey: "EventKeyboardShortcut",
424      payload: {
425        code: e.code,
426        ctrlKey: e.ctrlKey,
427        metaKey: e.metaKey,
428        altKey: e.altKey,
429        shiftKey: e.shiftKey,
430      },
431    });
432  }
433});
434
435window.addEventListener("keyup", (e) => {
436  if ((e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) && !e.repeat) {
437    //console.debug(3333, 'EventKeyboardShortcutKeyUp');
438    window.inlineEditor.functions("SendMethodCall")({
439      methodKey: "EventKeyboardShortcutKeyUp",
440      payload: {
441        code: e.code,
442        ctrlKey: e.ctrlKey,
443        metaKey: e.metaKey,
444        altKey: e.altKey,
445        shiftKey: e.shiftKey,
446      },
447    });
448  }
449});
450
451window.inlineEditor._functions["InlineFrameInitScriptLoaded"] = function (
452  payload,
453) {
454  console.debug("inline-frame.js -> InlineFrameInitScriptLoaded", payload);
455
456  window.inlineEditor.onInitContentFrame =
457    window.inlineEditor.onInitContentFrame || {};
458
459  window.inlineEditor.onInitContentFrame[payload.appKey] = function (payload) {
460    //console.debug(3333, 'onInitContentFrame', payload.appKey, payload);
461    var alreadyInited = false;
462    var i = 0;
463    var intervalInit = setInterval(function () {
464      // console.debug("wait for init", i, alreadyInited, document.readyState, window?.inlineEditor?._functions, window.$, window.document.getElementById(window?.inlineEditor?.rootElementId));
465      // document.readyState == 'interactive' &&
466      if (
467        !alreadyInited &&
468        window.inlineEditor &&
469        window.inlineEditor._functions["InitFrameContent"] &&
470        window.document.getElementById(window.inlineEditor.rootElementId) &&
471        window.$
472      ) {
473        // execute frame
474        // console.debug("<<<<<<<<<<<<<<clear222");
475        window.inlineEditor.functions("InitFrameContent")(payload);
476        alreadyInited = true;
477        clearInterval(intervalInit);
478      } else if (i > 30) {
479        clearInterval(intervalInit);
480      } else {
481        i += 1;
482      }
483    }, 1000);
484  };
485  var origin = payload.origin || window.inlineEditor.origin;
486  window.inlineEditor.functions("SendMethodCall")({
487    methodKey: "EventFrameReadyToInit",
488    appKey: payload.appKey,
489    moduleKey: payload.moduleKey,
490    payload: {
491      url: window.location.href,
492      rootElementId: payload.rootElementId,
493      origin: origin,
494    },
495    origin: origin,
496    url: window.location.href, // deprecated
497  });
498
499  let objBody = document.getElementsByTagName("body")[0];
500  if (objBody) {
501    // document.readyState !== "complete" &&
502    let pageUID = objBody
503      ? [].slice
504          .apply(objBody.classList)
505          .filter(function (key) {
506            return key.startsWith("uid-");
507          })
508          .map(function (key) {
509            return key.substring(4);
510          })[0] || null
511      : null;
512    let eleMaingroup = objBody.querySelector(".key-maingroup");
513    let mainGroupUID = eleMaingroup?.classList
514      ? [].slice
515          .apply(eleMaingroup.classList)
516          .filter(function (key) {
517            return key.startsWith("uid-");
518          })
519          .map(function (key) {
520            return key.substring(4);
521          })[0] || null
522      : null;
523    let datasetBody = Object.assign({}, window.document.body.dataset || {})
524    window.inlineEditor.functions("SendMethodCall")({
525      methodKey: "EventFramePageLoading",
526      appKey: payload.appKey,
527      moduleKey: payload.moduleKey,
528      payload: {
529        url: window.location.href,
530        projectId: datasetBody.projectId,
531        languageId: datasetBody.languageId,
532        datasetBody: datasetBody,
533        pageUID: pageUID,
534        mainGroupUID: mainGroupUID,
535      },
536      origin: origin,
537    });
538  }
539};
540
541console.debug("loaded inline-frame.js");

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.