-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy patharchive.html
136 lines (128 loc) · 8.86 KB
/
archive.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<!--suppress HtmlUnknownAnchorTarget -->
<html>
<head>
<meta charset="UTF-8">
<title>Internet Archive</title>
<!--TODO links should refer to content addressable files-->
<script src="./includes/jquery-1.10.2.min.js" type="text/javascript"></script>
<link href="./includes/archive.min.css" rel="stylesheet" type="text/css">
<script>var archive_setup=[]</script>
<!-- JW now replaced by RenderMedia (part of WebTorrent) stuffing a Video tag -->
<script src="./includes/build/js/play8.min.js" type="text/javascript"></script>
<script src="./includes/build/js/playset.min.js" type="text/javascript"></script>
<link rel='stylesheet' href='dweb-archive-styles.css'>
<!--This group Copied from archive.html for a texts obj, removed version locking, and made relative paths-->
<script src="./includes/bootstrap.min.js" type="text/javascript"></script>
<!-- Dont have react/umd on flight, switched with react, its needed even though in JS as refered to in archive.min.js" -->
<script src="./includes/node_modules/react/dist/react.js" type="text/javascript"></script>
<!--
<script src="//archive.org/includes/node_modules/react/umd/react.production.min.js" type="text/javascript"></script>
<script src="//archive.org/includes/node_modules/react-dom/umd/react-dom.production.min.js" type="text/javascript"></script>
-->
<!-- TODO Re webpack when online, then make this /includes
<script src="//archive.org/includes/build/js/polyfill.min.js" type="text/javascript"></script>
-->
<!-- Dont have build, but have own copy of archive.min -->
<script src="./includes/archive.min.js" type="text/javascript"></script>
<link href="./bookreader/BookReader/mmenu/dist/css/jquery.mmenu.css" rel="stylesheet" type="text/css"/>
<link href="./bookreader/BookReader/mmenu/dist/addons/navbars/jquery.mmenu.navbars.css" rel="stylesheet" type="text/css"/>
<link href="./bookreader/BookReader/BookReader.css" rel="stylesheet" type="text/css"/>
<!-- not part of repo - for flight copied into this location -->
<!--Commented out because it has "important" styles that really dont want in non-bookreader esp padding-top -->
<!--<link href="./bookreader/BookReader-ia.css" rel="stylesheet" type="text/css"/>-->
<!-- come from @internetarchive/bookreader/BookReader repo -->
<script src="./bookreader/BookReader/jquery-ui-1.12.0.min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/jquery.ui.touch-punch.min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/jquery.browser.min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/dragscrollable-br.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/jquery.colorbox-min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/jquery.bt.min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/soundmanager/script/soundmanager2-jsmin.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/mmenu/dist/js/jquery.mmenu.min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/mmenu/dist/addons/navbars/jquery.mmenu.navbars.min.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/BookReader.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.mobile_nav.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.search.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.chapters.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.tts.js" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.url.js?v=891b5f7" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.resume.js?v=891b5f7" type="text/javascript"></script>
<script src="./bookreader/BookReader/plugins/plugin.archive_analytics.js" type="text/javascript"></script>
<!-- not part. of repo - for flight copied into this location -->
<script src="./bookreader/BookReaderHelpers.js" type="text/javascript"></script>
<!-- not part of repo - for flight copied into this location -->
<script src="./bookreader/LendingFlow.js" type="text/javascript"></script>
<!-- not part of repo - for flight copied into this location -->
<script src="./bookreader/BookReaderJSIA.js" type="text/javascript"></script>
<!-- TODO-SPLIT Just experimental as part of dweb-transports#split, should normally be commented out also moved to dweb-mirror -->
<script type="text/javascript">
// SEE-OTHER-ADDTRANSPORT in dweb-transports dweb-archive dweb-mirror
// TODO-SPLIT these will need to move into local server or may be excluded by cross-origin low-bandwidth rule in chrome
// TODO-SPLIT move this function into Transports.js
/**
* Process searchparams to something appropriate to pass to dweb-transports, allowing for defaults and mistakes etc.
*
* @param searchparams mirror=HOST:PORT&transport=XXXX&transport=YYYY
* @returns {{statuselement: *, transports: *, paused: *, mirror: *, defaulttransports: ([string]|[string, string, string]), http: {urlbase: *}}}
* @private
*/
function _transportsOptions(searchparams) {
// Allows abbreviation like mirror=localhost:4244, also allows mirror to specify https://xyz.org
let mirror = searchparams.get("mirror");
if (mirror && !(mirror === null) && !mirror.startsWith('http')) {
mirror = location.protocol + '//' + mirror;
}
const transports = searchparams.getAll("transport");
DwebArchive.mirror = mirror || null; // So DwebArchive can check it locally (null check turns "" into null)
return {
statuselement: document.getElementById("dweb-status"),
http: {urlbase: (mirror && !(mirror === null)) ? mirror : "https://dweb.archive.org"},
transports,
defaulttransports: (mirror && !(mirror === null)) ? ["HTTP"] : ["HTTP", "WEBTORRENT", "IPFS", "GUN"],
paused: searchparams.getAll("paused"),
mirror: mirror,
}
}
function _opts(searchparams, transportsOptions) {
// Now setup opts, which has to happen after transportsOptions
// Save the persistent (cross-window) state (transport & mirror & paused), and returns any other searchparams not saved
const opts = Nav.setState(searchparams, {transport: DwebTransports._tabbrevs(transportsOptions), mirror: transportsOptions.mirror});
const pathParts = window.location.pathname.split('/');
const k = ['details', 'download'].find(kPossible => pathParts.includes(kPossible));
opts.identifier = k
? pathParts[pathParts.length - 1] // identifier must be last part of URL for this to work
: opts.identifier || opts.item;
opts.download = pathParts.includes('download') || opts.download || false;
return opts;
}
</script>
<style>
#jw6, #jw6__list { background-color:black; }
</style>
<script type="text/javascript">localStorage.debug = "dweb-archive dweb-archive:* dweb-archivecontroller:* dweb-transports dweb-transports:* ia-components:*";</script>
<!-- <script type="text/javascript" src="dweb-serviceworker-proxy-bundle.js"></script> <!-- Transport via Proxy -->
<script type="text/javascript" src="dweb-archive-bundle.js"></script>
<script type="text/javascript">
// This block has to run before and probably in separate <script> so that the document.write's happen before p_connect is called.
const searchparams = new URL(window.location.href).searchParams
const transportsOptions = _transportsOptions(searchparams);
const opts = _opts(searchparams, transportsOptions); // Side effect of saving persistent state we want to hold across history etc
DwebTransports.loadIntoHtmlPage(transportsOptions); // Writes script tags to document to dynamically load any transports specified that require it (generates warnings in log)
</script>
</head>
<!-- TODO-DETAILS missing scripts, properties and links that appear before body tag on archive/details/commute etc -->
<body class="navia ia-module navbar-no-margin-bottom tiles responsive">
<!--suppress HtmlUnknownAnchorTarget -->
<a href="#maincontent" class="hidden-for-screen-readers">Skip to main content</a>
<div id="main"></div><!-- destination for part accumulated by ArchiveBase as html-->
<script>
$(function(){ $('.navbar [data-toggle="tooltip"]').tooltip({}); });
DwebTransports.p_connect(transportsOptions)
.then(unusedRes =>
Nav.metaFactory(opts))
.catch(err =>
console.log("ERROR in archive.html call to p_connect failed to even run "));
</script>
</body>
</html>