This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
ix
123 lines (117 loc) · 6.96 KB
/
ix
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- this doesn't work on Arelle LocalViewer but is required on sec.gov website
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
-->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>XBRL Viewer</title>
<script language="JavaScript">
/* <![CDATA[ */
/* Created by staff of the U.S. Securities and Exchange Commission.
* Data and content created by government employees within the scope of their employment
* are not subject to domestic copyright protection. 17 U.S.C. 105.
*
* This script checks the accession number of the document requested to determine
* the year and sequence of filing. If filed after the availability of ixviewer-plus
* this script redirects to that viewer, otherwise to a prior ixviewer in effect
* or deemed compatible with the filing.
*/
function loadViewer(ixvUrl) {
// load viewer in an iframe so the end user's browser URL is not changed
var iFrame = document.getElementById("ixvFrame");
iFrame.src = ixvUrl;
}
const url = location.href;
// url doc pattern is /Archives/edgar/data/ciknum/{10digits}{YY}{sequence}/{more params}
// uncomment one of the following urlPatterns depending on usage:
// for SEC.GOV: const urlPattern = /(\?doc=(\/Archives\/edgar\/data\/[0-9]+\/[0-9]{10}([0-9]{8})\/).*$)/;
// for Arelle GUI: const urlPattern = /(\?doc=(\/[0-9]+\/).*$)/;
const urlPattern = /(\?doc=(\/[0-9]+\/).*$)/;
const ixvPlusNsPattern = /http:\/\/xbrl.sec.gov\/(ffd|sbs)\/.*$/;
var ixvUrl = null;
if (! urlPattern.test(url)) {
alert("Not an EDGAR inline XBRL document viewing request, please check URL");
// this hangs: loadViewer("/ixviewer/ix.html" + ixParams);
} else {
const match = url.match(urlPattern);
const ixParams = match[1];
const docPath = match[2];
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
const ml = JSON.parse(this.responseText);
if (!(typeof ml === 'object' && "instance" in ml)) {
console.log("Metalinks does not have instance objects");
// Unable to read MetaLinks.json, use 23.2 ixviewer
loadViewer("/ixviewer/ix.html" + ixParams);
} else {
const numInstances = Object.keys(ml["instance"]).length;
let maxDocsPerInst = 0;
let hasIxvPlusExhibit = false;
Object.keys(ml["instance"]).forEach(instanceNames => {
let docsInInstance = instanceNames.split(" ").length;
if (docsInInstance > maxDocsPerInst)
maxDocsPerInst = docsInInstance;
if ("baseTaxonomies" in ml["instance"][instanceNames]) {
Object.keys(ml["instance"][instanceNames]["baseTaxonomies"])
.forEach(baseTaxonomyUrl => {
if (ixvPlusNsPattern.test(baseTaxonomyUrl))
hasIxvPlusExhibit = true;
});
}
});
if (numInstances > 1 || maxDocsPerInst > 1 || hasIxvPlusExhibit || url.includes("&redline=true") )
loadViewer("/ixviewer-plus/ix.xhtml" + ixParams);
else
loadViewer("/ixviewer/ix.html" + ixParams);
}
} else {
console.log("Unable to read MetaLinks.json for this accession");
// Unable to read MetaLinks.json, use 23.2 ixviewer
loadViewer("/ixviewer/ix.html" + ixParams);
}
}
};
xhr.ontimeout = function() {
console.log("Timeout reading MetaLinks.json for this accession");
// Unable to read MetaLinks.json, use 23.2 ixviewer
loadViewer("/ixviewer/ix.html" + ixParams);
};
xhr.open("GET", docPath + 'MetaLinks.json', true);
xhr.timeout = 2000; // milliseconds
xhr.send();
/* Arelle GUI usage: set title for tab in browser for when there are multiple tabs */
const urlTitleParamPattern = /&title=([^&]+),*$/;
if (urlTitleParamPattern.test(url)) {
const match = url.match(urlTitleParamPattern);
document.title = decodeURIComponent(match[1]);
}
/* alternative select viewer using accession number
const acsnYrSeq = match[3];
if (acsnYrSeq > "24905000") {
loadViewer(docPath + "ixbrlviewer.xhtml");
} else if (acsnYrSeq > "23905000") {
loadViewer("/ixviewer-plus/ix.xhtml" + ixParams);
} else {
loadViewer("/ixviewer/ix.html" + ixParams);
}
*/
}
/* ]]> */
</script>
</head>
<body style="margin: 0">
<noscript>
Please enable JavaScript to use the EDGAR Inline XBRL Viewer.
</noscript>
<iframe id="ixvFrame"
title="Inline XBRL Viewer"
style="position: absolute; height: 100%; width: 100%; border: none"
/>
</body>
</html>