PageSourceSearch

https://st.drweb.cn/static/??newera/assets/www.drweb.com/tpl_ne/_n…/tpl_ne/_newera/lib/utils/utils-anchor.js

js drweb.cn collected 2026-10-02 17:08:53 UTC 1,581 bytes, 59 lines download raw bytes

1/* https redir on client */
2
3function host_looks_like_prod_cv_bmocq_07rdfei()
4{
5	    let rv = false;
6
7	    if( window && window.location && window.location.host && window.location.host.match( /[a-z]/i ) )
8	    {
9			rv = true;
10	    }
11	    
12	    return rv;
13}
14
15var proto_re = new RegExp("^http:");
16
17if( proto_re.test( window.location.href ) && host_looks_like_prod_cv_bmocq_07rdfei() )
18{
19	    var u = new String( window.location.href );
20	    
21	    u1 = u.replace( proto_re, 'https:' );
22	    if( u1 != u )
23	    {
24			window.location.replace( u1 );
25	    }
26}
27/*
28Easy filter for acceptable browsers for 2023 (by module)
29Global 94.89% (https://caniuse.com/?search=module)
30ECMAScript 6 (http://kangax.github.io/compat-table/es6/)
31*/
32; (function () {
33    if (!checkModuleSupport()) document.documentElement.className += ' oldBrowser-';
34}());
35
36function checkModuleSupport() {
37    if ('supports' in HTMLScriptElement) {
38        return HTMLScriptElement.supports('module');
39    }
40    return 'noModule' in HTMLScriptElement.prototype;
41}function toAnchor() {
42  let href = document.location.href;
43  let text = href.split("#");
44  let id = text[1];
45  let anchore = document.getElementById(id);
46  if (id && anchore) {
47    let header = document.querySelector("header");
48    setTimeout(() => {
49      const anchorePosition =
50        anchore.getBoundingClientRect().top + window.pageYOffset;
51      position = anchorePosition - header.clientHeight - 10;
52      window.scrollTo({ top: position, behavior: "smooth" });
53    }, 0);
54  }
55}
56
57document.addEventListener("DOMContentLoaded", () => {
58  toAnchor();
59});

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.