PageSourceSearch

https://www.alaskaair.com/search/widget/planbook-loader.js

js alaskaair.com collected 2026-10-09 22:40:36 UTC 1,377 bytes, 40 lines download raw bytes

1/**
2 * Planbook Loader
3 *
4 * Drop this script onto any page to automatically load the planbook custom element.
5 *
6 * Usage:
7 *   <script src="https://flightsearch.alaskaair.com/search/widget/planbook-loader.js"></script>
8 *
9 * The loader:
10 *  1. Derives the base URL from its own <script> src.
11 *  2. Injects a <script type="module"> for the versioned planbook-ce.js bundle.
12 *
13 * The 1.5.1 placeholder is replaced at build time by the copy-widget Vite plugin.
14 */
15(function () {
16  const version = "1.5.1";
17  const unreplacedVersionPlaceholder = "__" + "APP_VERSION__";
18  if (version === unreplacedVersionPlaceholder) {
19    console.error("[planbook-loader] Version was not injected at build time.");
20    return;
21  }
22
23  const currentScript = document.currentScript;
24  if (!(currentScript instanceof HTMLScriptElement) || !currentScript.src) {
25    console.error("[planbook-loader] Unable to determine script source.");
26    return;
27  }
28
29  const baseUrl = currentScript.src.substring(0, currentScript.src.lastIndexOf("/") + 1);
30
31  const planbookUrl = baseUrl + "v" + version + "/planbook/planbook-ce.js";
32
33  const script = document.createElement("script");
34  script.type = "module";
35  script.src = planbookUrl;
36  script.onerror = function () {
37    console.error("[planbook-loader] Failed to load planbook v" + version, planbookUrl);
38  };
39  document.head.appendChild(script);
40})();

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.