PageSourceSearch

https://bidhawk-demo-app.web.app/embed.js

js bidhawk-demo-app.web.app collected 2026-10-03 12:20:02 UTC 3,166 bytes, 99 lines download raw bytes

1(function() {
2  'use strict';
3
4  // Find the embed script - try multiple methods for compatibility
5  function findEmbedScript() {
6    // Method 1: document.currentScript (works for sync scripts)
7    if (document.currentScript) {
8      return document.currentScript;
9    }
10
11    // Method 2: Find by src pattern (works for async/deferred scripts)
12    var scripts = document.querySelectorAll('script[src*="embed.js"][data-embed-id]');
13    if (scripts.length > 0) {
14      return scripts[scripts.length - 1]; // Get the last one (most recently added)
15    }
16
17    // Method 3: Find by data attribute only
18    var scriptsWithId = document.querySelectorAll('script[data-embed-id]');
19    if (scriptsWithId.length > 0) {
20      return scriptsWithId[scriptsWithId.length - 1];
21    }
22
23    return null;
24  }
25
26  function init() {
27    var script = findEmbedScript();
28
29    if (!script) {
30      console.error('BidHawk: Could not find embed script element');
31      return;
32    }
33
34    var embedId = script.getAttribute('data-embed-id');
35
36    if (!embedId) {
37      console.error('BidHawk: Missing data-embed-id attribute');
38      return;
39    }
40
41    // Check if already initialized
42    if (document.getElementById('bidhawk-widget-' + embedId)) {
43      console.log('BidHawk: Widget already initialized for', embedId);
44      return;
45    }
46
47    // Determine base URL - use script src or fallback to production
48    var scriptSrc = script.src || script.getAttribute('src');
49    var baseUrl = 'https://bidhawk.com';
50
51    if (scriptSrc && scriptSrc.indexOf('http') === 0) {
52      // Extract base URL from script source
53      var urlParts = scriptSrc.split('/');
54      urlParts.pop(); // Remove 'embed.js'
55      baseUrl = urlParts.join('/');
56    }
57
58    console.log('BidHawk: Loading embed', embedId, 'from', baseUrl);
59
60    // Create container
61    var container = document.createElement('div');
62    container.id = 'bidhawk-widget-' + embedId;
63    document.body.appendChild(container);
64
65    // Load styles (cache-bust with version)
66    var cacheBust = 'v=' + Date.now();
67    var styles = document.createElement('link');
68    styles.rel = 'stylesheet';
69    styles.href = baseUrl + '/embed-bundle.css?' + cacheBust;
70    styles.crossOrigin = 'anonymous';
71    document.head.appendChild(styles);
72
73    // Load the React bundle
74    var bundle = document.createElement('script');
75    bundle.src = baseUrl + '/embed-bundle.js?' + cacheBust;
76    bundle.async = true;
77    bundle.crossOrigin = 'anonymous';
78    bundle.onload = function() {
79      if (window.BidHawk && window.BidHawk.init) {
80        window.BidHawk.init(embedId, container);
81        console.log('BidHawk: Widget initialized successfully');
82      } else {
83        console.error('BidHawk: Widget bundle loaded but BidHawk.init not found');
84      }
85    };
86    bundle.onerror = function(e) {
87      console.error('BidHawk: Failed to load widget bundle from', bundle.src, e);
88    };
89    document.head.appendChild(bundle);
90  }
91
92  // Run when DOM is ready
93  if (document.readyState === 'loading') {
94    document.addEventListener('DOMContentLoaded', init);
95  } else {
96    // Small delay to ensure script element is in DOM
97    setTimeout(init, 0);
98  }
99})();

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.