PageSourceSearch

https://www.tahrirdocuments.org/Tahrir/wbhack.js

js tahrirdocuments.org collected 2026-10-02 11:09:40 UTC 1,130 bytes, 38 lines download raw bytes

1// Wayback Machine hacks
2var __wbhack = new function(){
3  var prefix;
4  var orig_document = {
5    createElementNS: document.createElementNS
6  };
7  this.init = function(_prefix) {
8    this.checkCookiesNumber();
9    prefix = _prefix;
10    document.createElementNS = function(ns,name) {
11      if (ns.indexOf(prefix)==0) {
12	ns = ns.substring(prefix.length).replace(/\/?[0-9]+\//, '');
13      }
14      return orig_document.createElementNS.call(this, ns, name);
15    };
16  };
17  this.createCookie = function(name,value,days) {
18    if (days) {
19        var date = new Date();
20        date.setTime(date.getTime()+(days*24*60*60*1000));
21        var expires = "; expires="+date.toGMTString();
22    }
23    else var expires = "";
24    document.cookie = name+"="+value+expires+"; path=/";
25  };
26  this.eraseCookie = function(name) {
27    this.createCookie(name, "", -1);
28  };
29  this.checkCookiesNumber = function() {
30    var cookies = document.cookie.split(";");
31    if(cookies.length > 40) {
32        for(var i=0; i<cookies.length; i++) {
33            var name = cookies[i].split("=")[0].trim();
34            this.eraseCookie(name);
35        }
36    }
37  };
38};

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.