PageSourceSearch

https://gdfconf.com/public/js/stories-loader.js

js gdfconf.com collected 2026-10-04 14:41:14 UTC 2,260 bytes, 77 lines download raw bytes

1(function () {
2  'use strict';
3
4  var loadPromise = null;
5  var storiesReady = false;
6
7  function loadStylesheet(href) {
8    if (document.querySelector('link[href="' + href + '"]')) return;
9    var link = document.createElement('link');
10    link.rel = 'stylesheet';
11    link.href = href;
12    document.head.appendChild(link);
13  }
14
15  function loadScript(src, isReady) {
16    if (isReady()) return Promise.resolve();
17
18    return new Promise(function (resolve, reject) {
19      var existing = document.querySelector('script[src="' + src + '"]');
20      if (existing) {
21        existing.addEventListener('load', resolve, { once: true });
22        existing.addEventListener('error', reject, { once: true });
23        return;
24      }
25
26      var script = document.createElement('script');
27      script.src = src;
28      script.onload = resolve;
29      script.onerror = reject;
30      document.body.appendChild(script);
31    });
32  }
33
34  function loadStories() {
35    if (loadPromise) return loadPromise;
36
37    loadStylesheet('https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css');
38    loadPromise = loadScript(
39      'https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js',
40      function () { return typeof window.Swiper !== 'undefined'; }
41    )
42      .then(function () {
43        return loadScript(
44          'https://code.jquery.com/jquery-3.7.0.min.js',
45          function () { return typeof window.jQuery !== 'undefined'; }
46        );
47      })
48      .then(function () {
49        return loadScript('/public/js/stories.js', function () { return storiesReady; });
50      })
51      .then(function () {
52        storiesReady = true;
53      });
54
55    return loadPromise;
56  }
57
58  document.addEventListener('click', function (event) {
59    var trigger = event.target.closest('.open_stories, .stories_item');
60    if (!trigger || storiesReady) return;
61
62    event.preventDefault();
63    event.stopImmediatePropagation();
64    trigger.classList.add('is-loading');
65
66    loadStories()
67      .then(function () {
68        trigger.classList.remove('is-loading');
69        trigger.click();
70      })
71      .catch(function (error) {
72        trigger.classList.remove('is-loading');
73        loadPromise = null;
74        console.error('Failed to load GDF.Life', error);
75      });
76  }, true);
77})();

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.