PageSourceSearch

https://oakville.edu.pk/js/site-base.js

js oakville.edu.pk collected 2026-10-09 04:48:35 UTC 2,931 bytes, 99 lines download raw bytes

1(function () {
2  var FONTS_HREF =
3    "https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;0,800;1,500&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400&display=swap";
4
5  function injectSiteFonts() {
6    if (document.getElementById("site-fonts")) return;
7    var head = document.head || document.getElementsByTagName("head")[0];
8    if (!head) return;
9
10    var preconnectGoogle = document.createElement("link");
11    preconnectGoogle.rel = "preconnect";
12    preconnectGoogle.href = "https://fonts.googleapis.com";
13    head.appendChild(preconnectGoogle);
14
15    var preconnectStatic = document.createElement("link");
16    preconnectStatic.rel = "preconnect";
17    preconnectStatic.href = "https://fonts.gstatic.com";
18    preconnectStatic.crossOrigin = "anonymous";
19    head.appendChild(preconnectStatic);
20
21    var fonts = document.createElement("link");
22    fonts.id = "site-fonts";
23    fonts.rel = "stylesheet";
24    fonts.href = FONTS_HREF;
25    head.appendChild(fonts);
26  }
27
28  injectSiteFonts();
29
30  function pathDepth() {
31    var path = location.pathname.replace(/\\/g, "/");
32    var segments = path.split("/").filter(Boolean);
33    if (segments.length && /\.[a-z0-9]+$/i.test(segments[segments.length - 1])) {
34      segments.pop();
35    }
36    return segments.length;
37  }
38
39  function relPrefix() {
40    var depth = pathDepth();
41    if (!depth) return "";
42    var prefix = "";
43    for (var i = 0; i < depth; i += 1) {
44      prefix += "../";
45    }
46    return prefix;
47  }
48
49  function siteRootHref() {
50    if (location.protocol === "file:") {
51      var href = location.href.replace(/[#?].*$/, "");
52      var parts = href.split("/");
53      parts.pop();
54      var depth = pathDepth();
55      while (depth > 0) {
56        parts.pop();
57        depth -= 1;
58      }
59      return parts.join("/") + "/";
60    }
61    return location.origin + "/";
62  }
63
64  function siteAsset(path) {
65    if (!path || path.charAt(0) !== "/") {
66      return path;
67    }
68    if (location.protocol === "file:") {
69      return relPrefix() + path.slice(1);
70    }
71    return path;
72  }
73
74  function siteHref(path) {
75    if (!path || location.protocol !== "file:") {
76      return path;
77    }
78    var hash = "";
79    var hashIndex = path.indexOf("#");
80    if (hashIndex !== -1) {
81      hash = path.slice(hashIndex);
82      path = path.slice(0, hashIndex);
83    }
84    if (path === "/") {
85      return relPrefix() + "index.html" + hash;
86    }
87    if (path.charAt(0) === "/" && path.charAt(path.length - 1) === "/") {
88      return relPrefix() + path.slice(1) + "index.html" + hash;
89    }
90    if (path.charAt(0) === "/") {
91      return relPrefix() + path.slice(1) + hash;
92    }
93    return path + hash;
94  }
95
96  window.siteAsset = siteAsset;
97  window.siteHref = siteHref;
98  window.siteRootHref = siteRootHref;
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.