feat(native): doc loader for common native (#9941)

This commit is contained in:
darkskygit
2025-02-25 07:50:56 +00:00
parent 26674b0cb8
commit 842c39c3be
42 changed files with 2989 additions and 36 deletions

Binary file not shown.

View File

@@ -0,0 +1,28 @@
# DOCX Demo
# <a name="OLE_LINK1"></a><a name="OLE_LINK2"></a><a name="_Toc359077851"></a>Demonstration of DOCX support in calibre
This document demonstrates the ability of the calibre DOCX Input plugin to convert the various typographic features in a Microsoft Word (2007 and newer) document. Convert this document to a modern ebook format, such as AZW3 for Kindles or EPUB for other ebook readers, to see it in action.
There is support for images, tables, lists, footnotes, endnotes, links, dropcaps and various types of text and paragraph level formatting.
To see the DOCX conversion in action, simply add this file to calibre using the **“Add Books” **button and then click “**Convert”. ** Set the output format in the top right corner of the conversion dialog to EPUB or AZW3 and click **“OK”**.
# <a name="_Toc359077852"></a>Text Formatting
## <a name="_Toc359077853"></a>Inline formatting
Here, we demonstrate various types of inline text formatting and the use of embedded fonts.
Here is some **bold, ***italic, ****bold-italic, ***__underlined __and ~~struck out ~~ text. Then, we have a superscript and a subscript. Now we see some red, green and blue text. Some text with a yellow highlight. Some text in a box. Some text in inverse video.
A paragraph with styled text: subtle emphasis followed by strong text and intense emphasis. This paragraph uses document wide styles for styling rather than inline text properties as demonstrated in the previous paragraph — calibre can handle both with equal ease.
## <a name="_Toc359077854"></a>Fun with fonts
This document has embedded the Ubuntu font family. The body text is in the Ubuntu typeface, here is some text in the Ubuntu Mono typeface, notice how every letter has the same width, even i and m. Every embedded font will automatically be embedded in the output ebook during conversion.
## ***<a name="_Paragraph_level_formatting"></a>******<a name="_Toc359077855"></a>******Paragraph level formatting***
You can do crazy things with paragraphs, if the urge strikes you. For instance this paragraph is right aligned and has a right border. It has also been given a light gray background.

View File

@@ -0,0 +1,28 @@
For the lovers of poetry amongst you, paragraphs with hanging indents, like this often come in handy. You can use hanging indents to ensure that a line of poetry retains its individual identity as a line even when the screen is too narrow to display it as a single line. Not only does this paragraph have a hanging indent, it is also has an extra top margin, setting it apart from the preceding paragraph.
# <a name="_Toc359077856"></a>Tables
| | |
| ----------- | -------- |
| ITEM | NEEDED |
| Books | 1 |
| Pens | 3 |
| Pencils | 2 |
| Highlighter | 2 colors |
| Scissors | 1 pair |
Tables in Word can vary from the extremely simple to the extremely complex. calibre tries to do its best when converting tables. While you may run into trouble with the occasional table, the vast majority of common cases should be converted very well, as demonstrated in this section. Note that for optimum results, when creating tables in Word, you should set their widths using percentages, rather than absolute units. To the left of this paragraph is a floating two column table with a nice green border and header row.
Now lets look at a fancier table—one with alternating row colors and partial borders. This table is stretched out to take 100% of the available width.
| | | | | | |
| ------------ | ------- | ------- | ------- | ------- | ------- |
| City or Town | Point A | Point B | Point C | Point D | Point E |
| Point A | — | | | | |
| Point B | 87 | — | | | |
| Point C | 64 | 56 | — | | |
| Point D | 37 | 32 | 91 | — | |
| Point E | 93 | 35 | 54 | 43 | — |
Next, we see a table with special formatting in various locations. Notice how the formatting for the header row and sub header rows is preserved.

View File

@@ -0,0 +1,21 @@
| | | | |
| ---------------- | ------------- | ------------------- | ------ |
| College | New students | Graduating students | Change |
| | Undergraduate | | |
| Cedar University | 110 | 103 | +7 |
| Oak Institute | 202 | 210 | -8 |
| | Graduate | | |
| Cedar University | 24 | 20 | +4 |
| Elm College | 43 | 53 | -10 |
| Total | 998 | 908 | 90 |
Source: Fictitious data, for illustration purposes only
Next, we have something a little more complex, a nested table, i.e. a table inside another table. Additionally, the inner table has some of its cells merged. The table is displayed horizontally centered.
| | |
| --- | -------------------------------------------------------------- |
| | To the left is a table inside a table, with some cells merged. |
We end with a fancy calendar, note how much of the original formatting is preserved. Note that this table will only display correctly on relatively wide screens. In general, very wide tables or tables whose cells have fixed width requirements dont fare well in ebooks.

View File

@@ -0,0 +1,18 @@
| | | | | | | | | | | | | |
| ------------- | | --- | | --- | | --- | | --- | | --- | | --- |
| December 2007 | | | | | | | | | | | | |
| Sun | | Mon | | Tue | | Wed | | Thu | | Fri | | Sat |
| | | | | | | | | | | | | 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 | | | | | | | | | | |
# <a name="_Toc359077857"></a>Structural Elements

View File

@@ -0,0 +1,20 @@
Miscellaneous structural elements you can add to your document, like footnotes, endnotes, dropcaps and the like.
## <a name="_Toc359077858"></a>Footnotes & Endnotes
Footnotes and endnotes are automatically recognized and both are converted to endnotes, with backlinks for maximum ease of use in ebook devices.
## <a name="_Toc359077859"></a>Dropcaps
D
rop caps are used to emphasize the leading paragraph at the start of a section. In Word it is possible to specify how many lines of text a drop-cap should use. Because of limitations in ebook technology, this is not possible when converting. Instead, the converted drop cap will use font size and line height to simulate the effect as well as possible. While not as good as the original, the result is usually tolerable. This paragraph has a “D” dropcap set to occupy three lines of text with a font size of 58.5 pts. Depending on the screen width and capabilities of the device you view the book on, this dropcap can look anything from perfect to ugly.
## <a name="_Toc359077860"></a>Links
Two kinds of links are possible, those that refer to an external website and those that refer to locations inside the document itself. Both are supported by calibre. For example, here is a link pointing to the [calibre download page](http://calibre-ebook.com/download). Then we have a link that points back to the section on [paragraph level formatting](#_Paragraph_level_formatting) in this document.
## <a name="_Toc359077861"></a>Table of Contents
There are two approaches that calibre takes when generating a Table of Contents. The first is if the Word document has a Table of Contents itself. Provided that the Table of Contents uses hyperlinks, calibre will automatically use it. The levels of the Table of Contents are identified by their left indent, so if you want the ebook to have a multi-level Table of Contents, make sure you create a properly indented Table of Contents in Word.

View File

@@ -0,0 +1,30 @@
If no Table of Contents is found in the document, then a table of contents is automatically generated from the headings in the document. A heading is identified as something that has the Heading 1 or Heading 2, etc. style applied to it. These headings are turned into a Table of Contents with Heading 1 being the topmost level, Heading 2 the second level and so on.
You can see the Table of Contents created by calibre by clicking the Table of Contents button in whatever viewer you are using to view the converted ebook.
# <a name="_Toc359077862"></a>Images
Images can be of three main types. Inline images are images that are part of the normal text flow, like this image of a green dot ![dot_green.png](./media/image2.png). Inline images do not cause breaks in the text and are usually small in size. The next category of image is a floating image, one that “floats “ on the page and is surrounded by text. Word supports more types of floating images than are possible with current ebook technology, so the conversion maps floating images to simple left and right floats, as you can see with the left and right arrow images on the sides of this paragraph.
The final type of image is a “block” image, one that becomes a paragraph on its own and has no text on either side. Below is a centered green dot.
Centered images like this are useful for large pictures that should be a focus of attention.
Generally, it is not possible to translate the exact positioning of images from a Word document to an ebook. That is because in Word, image positioning is specified in absolute units from the page boundaries. There is no analogous technology in ebooks, so the conversion will usually end up placing the image either centered or floating close to the point in the text where it was inserted, not necessarily where it appears on the page in Word.
# <a name="_Toc359077863"></a>Lists
All types of lists are supported by the conversion, with the exception of lists that use fancy bullets, these get converted to regular bullets.
## <a name="_Toc359077864"></a>Bulleted List
- One
- Two
## <a name="_Toc359077865"></a>Numbered List
1. One, with a very long line to demonstrate that the hanging indent for the list is working correctly
2. Two

View File

@@ -0,0 +1,37 @@
## <a name="_Toc359077866"></a>Multi-level Lists
1. One
2. Two
3. Three
4. Four with a very long line to demonstrate that the hanging indent for the list is working correctly.
5. Five
6. Six
A Multi-level list with bullets:
- One
- Two
- This bullet uses an image as the bullet item
- Four
- Five
## <a name="_Toc359077867"></a>Continued Lists
i. One
j. Two
An interruption in our regularly scheduled listing, for this essential and very relevant public service announcement.
k. We now resume our normal programming
l. Four

View File

@@ -0,0 +1,182 @@
# DOCX Demo
# <a name="OLE_LINK1"></a><a name="OLE_LINK2"></a><a name="_Toc359077851"></a>Demonstration of DOCX support in calibre
This document demonstrates the ability of the calibre DOCX Input plugin to convert the various typographic features in a Microsoft Word (2007 and newer) document. Convert this document to a modern ebook format, such as AZW3 for Kindles or EPUB for other ebook readers, to see it in action.
There is support for images, tables, lists, footnotes, endnotes, links, dropcaps and various types of text and paragraph level formatting.
To see the DOCX conversion in action, simply add this file to calibre using the **“Add Books” **button and then click “**Convert”. ** Set the output format in the top right corner of the conversion dialog to EPUB or AZW3 and click **“OK”**.
# <a name="_Toc359077852"></a>Text Formatting
## <a name="_Toc359077853"></a>Inline formatting
Here, we demonstrate various types of inline text formatting and the use of embedded fonts.
Here is some **bold, ***italic, ****bold-italic, ***__underlined __and ~~struck out ~~ text. Then, we have a superscript and a subscript. Now we see some red, green and blue text. Some text with a yellow highlight. Some text in a box. Some text in inverse video.
A paragraph with styled text: subtle emphasis followed by strong text and intense emphasis. This paragraph uses document wide styles for styling rather than inline text properties as demonstrated in the previous paragraph — calibre can handle both with equal ease.
## <a name="_Toc359077854"></a>Fun with fonts
This document has embedded the Ubuntu font family. The body text is in the Ubuntu typeface, here is some text in the Ubuntu Mono typeface, notice how every letter has the same width, even i and m. Every embedded font will automatically be embedded in the output ebook during conversion.
## ***<a name="_Paragraph_level_formatting"></a>******<a name="_Toc359077855"></a>******Paragraph level formatting***
You can do crazy things with paragraphs, if the urge strikes you. For instance this paragraph is right aligned and has a right border. It has also been given a light gray background.
For the lovers of poetry amongst you, paragraphs with hanging indents, like this often come in handy. You can use hanging indents to ensure that a line of poetry retains its individual identity as a line even when the screen is too narrow to display it as a single line. Not only does this paragraph have a hanging indent, it is also has an extra top margin, setting it apart from the preceding paragraph.
# <a name="_Toc359077856"></a>Tables
| | |
| ----------- | -------- |
| ITEM | NEEDED |
| Books | 1 |
| Pens | 3 |
| Pencils | 2 |
| Highlighter | 2 colors |
| Scissors | 1 pair |
Tables in Word can vary from the extremely simple to the extremely complex. calibre tries to do its best when converting tables. While you may run into trouble with the occasional table, the vast majority of common cases should be converted very well, as demonstrated in this section. Note that for optimum results, when creating tables in Word, you should set their widths using percentages, rather than absolute units. To the left of this paragraph is a floating two column table with a nice green border and header row.
Now lets look at a fancier table—one with alternating row colors and partial borders. This table is stretched out to take 100% of the available width.
| | | | | | |
| ------------ | ------- | ------- | ------- | ------- | ------- |
| City or Town | Point A | Point B | Point C | Point D | Point E |
| Point A | — | | | | |
| Point B | 87 | — | | | |
| Point C | 64 | 56 | — | | |
| Point D | 37 | 32 | 91 | — | |
| Point E | 93 | 35 | 54 | 43 | — |
Next, we see a table with special formatting in various locations. Notice how the formatting for the header row and sub header rows is preserved.
| | | | |
| ---------------- | ------------- | ------------------- | ------ |
| College | New students | Graduating students | Change |
| | Undergraduate | | |
| Cedar University | 110 | 103 | +7 |
| Oak Institute | 202 | 210 | -8 |
| | Graduate | | |
| Cedar University | 24 | 20 | +4 |
| Elm College | 43 | 53 | -10 |
| Total | 998 | 908 | 90 |
Source: Fictitious data, for illustration purposes only
Next, we have something a little more complex, a nested table, i.e. a table inside another table. Additionally, the inner table has some of its cells merged. The table is displayed horizontally centered.
| | |
| --- | -------------------------------------------------------------- |
| | To the left is a table inside a table, with some cells merged. |
We end with a fancy calendar, note how much of the original formatting is preserved. Note that this table will only display correctly on relatively wide screens. In general, very wide tables or tables whose cells have fixed width requirements dont fare well in ebooks.
| | | | | | | | | | | | | |
| ------------- | | --- | | --- | | --- | | --- | | --- | | --- |
| December 2007 | | | | | | | | | | | | |
| Sun | | Mon | | Tue | | Wed | | Thu | | Fri | | Sat |
| | | | | | | | | | | | | 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 | | | | | | | | | | |
# <a name="_Toc359077857"></a>Structural Elements
Miscellaneous structural elements you can add to your document, like footnotes, endnotes, dropcaps and the like.
## <a name="_Toc359077858"></a>Footnotes & Endnotes
Footnotes and endnotes are automatically recognized and both are converted to endnotes, with backlinks for maximum ease of use in ebook devices.
## <a name="_Toc359077859"></a>Dropcaps
D
rop caps are used to emphasize the leading paragraph at the start of a section. In Word it is possible to specify how many lines of text a drop-cap should use. Because of limitations in ebook technology, this is not possible when converting. Instead, the converted drop cap will use font size and line height to simulate the effect as well as possible. While not as good as the original, the result is usually tolerable. This paragraph has a “D” dropcap set to occupy three lines of text with a font size of 58.5 pts. Depending on the screen width and capabilities of the device you view the book on, this dropcap can look anything from perfect to ugly.
## <a name="_Toc359077860"></a>Links
Two kinds of links are possible, those that refer to an external website and those that refer to locations inside the document itself. Both are supported by calibre. For example, here is a link pointing to the [calibre download page](http://calibre-ebook.com/download). Then we have a link that points back to the section on [paragraph level formatting](#_Paragraph_level_formatting) in this document.
## <a name="_Toc359077861"></a>Table of Contents
There are two approaches that calibre takes when generating a Table of Contents. The first is if the Word document has a Table of Contents itself. Provided that the Table of Contents uses hyperlinks, calibre will automatically use it. The levels of the Table of Contents are identified by their left indent, so if you want the ebook to have a multi-level Table of Contents, make sure you create a properly indented Table of Contents in Word.
If no Table of Contents is found in the document, then a table of contents is automatically generated from the headings in the document. A heading is identified as something that has the Heading 1 or Heading 2, etc. style applied to it. These headings are turned into a Table of Contents with Heading 1 being the topmost level, Heading 2 the second level and so on.
You can see the Table of Contents created by calibre by clicking the Table of Contents button in whatever viewer you are using to view the converted ebook.
# <a name="_Toc359077862"></a>Images
Images can be of three main types. Inline images are images that are part of the normal text flow, like this image of a green dot ![dot_green.png](./media/image2.png). Inline images do not cause breaks in the text and are usually small in size. The next category of image is a floating image, one that “floats “ on the page and is surrounded by text. Word supports more types of floating images than are possible with current ebook technology, so the conversion maps floating images to simple left and right floats, as you can see with the left and right arrow images on the sides of this paragraph.
The final type of image is a “block” image, one that becomes a paragraph on its own and has no text on either side. Below is a centered green dot.
Centered images like this are useful for large pictures that should be a focus of attention.
Generally, it is not possible to translate the exact positioning of images from a Word document to an ebook. That is because in Word, image positioning is specified in absolute units from the page boundaries. There is no analogous technology in ebooks, so the conversion will usually end up placing the image either centered or floating close to the point in the text where it was inserted, not necessarily where it appears on the page in Word.
# <a name="_Toc359077863"></a>Lists
All types of lists are supported by the conversion, with the exception of lists that use fancy bullets, these get converted to regular bullets.
## <a name="_Toc359077864"></a>Bulleted List
- One
- Two
## <a name="_Toc359077865"></a>Numbered List
1. One, with a very long line to demonstrate that the hanging indent for the list is working correctly
2. Two
## <a name="_Toc359077866"></a>Multi-level Lists
1. One
2. Two
3. Three
4. Four with a very long line to demonstrate that the hanging indent for the list is working correctly.
5. Five
6. Six
A Multi-level list with bullets:
- One
- Two
- This bullet uses an image as the bullet item
- Four
- Five
## <a name="_Toc359077867"></a>Continued Lists
i. One
j. Two
An interruption in our regularly scheduled listing, for this essential and very relevant public service announcement.
k. We now resume our normal programming
l. Four

View File

@@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}

View File

@@ -0,0 +1 @@
#include <stdio.h>

View File

@@ -0,0 +1,4 @@
int main() {
printf("Hello, World!\n");
return 0;
}

View File

@@ -0,0 +1,481 @@
<!doctype html>
<!-- saved from url=(0020)https://example.org/ -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example Domain</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',
'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0, 0, 0, 0.02);
}
a:link,
a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
</p>
<p>
<a
href="https://www.iana.org/domains/example"
rel="noreferrer"
data-ss1736873651="1"
>More information...</a
>
</p>
</div>
</body>
<script type="text/javascript">
(function (
canvas,
canvasfont,
audioblock,
battery,
webgl,
webrtcdevice,
gamepad,
webvr,
bluetooth,
timezone,
clientrects,
clipboard,
browserplugins
) {
function processFunctions(scope) {
/* Browser Plugins */
if (browserplugins == 'true') {
scope.Object.defineProperty(navigator, 'plugins', {
enumerable: true,
configurable: true,
get: function () {
var browserplugins_triggerblock =
scope.document.createElement('div');
browserplugins_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_browserplugins';
browserplugins_triggerblock.title = 'navigator.plugins';
document.documentElement.appendChild(browserplugins_triggerblock);
return '';
},
});
}
/* Canvas */
if (canvas != 'false') {
var fakecanvas = scope.document.createElement('canvas');
fakecanvas.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_canvas';
if (canvas == 'random') {
var fakewidth = (fakecanvas.width =
Math.floor(Math.random() * 999) + 1);
var fakeheight = (fakecanvas.height =
Math.floor(Math.random() * 999) + 1);
}
var canvas_a = scope.HTMLCanvasElement;
var origToDataURL = canvas_a.prototype.toDataURL;
var origToBlob = canvas_a.prototype.toBlob;
canvas_a.prototype.toDataURL = function () {
fakecanvas.title = 'toDataURL';
document.documentElement.appendChild(fakecanvas);
if (canvas == 'block') return false;
else if (canvas == 'blank') {
fakecanvas.width = this.width;
fakecanvas.height = this.height;
return origToDataURL.apply(fakecanvas, arguments);
} else if (canvas == 'random') {
return origToDataURL.apply(fakecanvas, arguments);
}
};
canvas_a.prototype.toBlob = function () {
fakecanvas.title = 'toBlob';
document.documentElement.appendChild(fakecanvas);
if (canvas == 'block') return false;
else if (canvas == 'blank') {
fakecanvas.width = this.width;
fakecanvas.height = this.height;
return origToBlob.apply(fakecanvas, arguments);
} else if (canvas == 'random') {
return origToBlob.apply(fakecanvas, arguments);
}
};
var canvas_b = scope.CanvasRenderingContext2D;
var origGetImageData = canvas_b.prototype.getImageData;
canvas_b.prototype.getImageData = function () {
fakecanvas.title = 'getImageData';
document.documentElement.appendChild(fakecanvas);
if (canvas == 'block') return false;
else if (canvas == 'blank') {
fakecanvas.width = this.width;
fakecanvas.height = this.height;
return origGetImageData.apply(
fakecanvas.getContext('2d'),
arguments
);
} else if (canvas == 'random') {
return origGetImageData.apply(fakecanvas.getContext('2d'), [
Math.floor(Math.random() * fakewidth) + 1,
Math.floor(Math.random() * fakeheight) + 1,
Math.floor(Math.random() * fakewidth) + 1,
Math.floor(Math.random() * fakeheight) + 1,
]);
}
};
var origGetLineDash = canvas_b.prototype.getLineDash;
canvas_b.prototype.getLineDash = function () {
fakecanvas.title = 'getLineDash';
document.documentElement.appendChild(fakecanvas);
if (canvas == 'block') return false;
else if (canvas == 'blank') {
fakecanvas.width = this.width;
fakecanvas.height = this.height;
return origGetLineDash.apply(fakecanvas.getContext('2d'), [0, 0]);
} else if (canvas == 'random') {
return origGetLineDash.apply(fakecanvas.getContext('2d'), [
Math.floor(Math.random() * fakewidth) + 1,
Math.floor(Math.random() * fakeheight) + 1,
]);
}
};
var canvas_c = scope.WebGLRenderingContext;
var origReadPixels = canvas_c.prototype.readPixels;
canvas_c.prototype.readPixels = function () {
fakecanvas.title = 'readPixels';
document.documentElement.appendChild(fakecanvas);
if (canvas == 'block') return false;
else if (canvas == 'blank') {
fakecanvas.width = this.width;
fakecanvas.height = this.height;
return origReadPixels.apply(
fakecanvas.getContext('webgl'),
arguments
);
} else if (canvas == 'random') {
return origReadPixels.apply(fakecanvas.getContext('webgl'), [
Math.floor(Math.random() * fakewidth) + 1,
Math.floor(Math.random() * fakeheight) + 1,
Math.floor(Math.random() * fakewidth) + 1,
Math.floor(Math.random() * fakeheight) + 1,
arguments[4],
arguments[5],
arguments[6],
]);
}
};
}
/* Audio Block */
if (audioblock == 'true') {
var audioblock_triggerblock = scope.document.createElement('div');
audioblock_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_audio';
var audioblock_a = scope.AudioBuffer;
audioblock_a.prototype.copyFromChannel = function () {
audioblock_triggerblock.title = 'copyFromChannel';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
audioblock_a.prototype.getChannelData = function () {
audioblock_triggerblock.title = 'getChannelData';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
var audioblock_b = scope.AnalyserNode;
audioblock_b.prototype.getFloatFrequencyData = function () {
audioblock_triggerblock.title = 'getFloatFrequencyData';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
audioblock_b.prototype.getByteFrequencyData = function () {
audioblock_triggerblock.title = 'getByteFrequencyData';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
audioblock_b.prototype.getFloatTimeDomainData = function () {
audioblock_triggerblock.title = 'getFloatTimeDomainData';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
audioblock_b.prototype.getByteTimeDomainData = function () {
audioblock_triggerblock.title = 'getByteTimeDomainData';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
var audioblock_c = scope;
audioblock_c.AudioContext = function () {
audioblock_triggerblock.title = 'AudioContext';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
audioblock_c.webkitAudioContext = function () {
audioblock_triggerblock.title = 'webkitAudioContext';
document.documentElement.appendChild(audioblock_triggerblock);
return false;
};
}
/* Canvas Font */
if (canvasfont == 'true') {
var canvasfont_triggerblock = scope.document.createElement('div');
canvasfont_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_canvasfont';
var canvasfont_a = scope.CanvasRenderingContext2D;
canvasfont_a.prototype.measureText = function () {
canvasfont_triggerblock.title = 'measureText';
document.documentElement.appendChild(canvasfont_triggerblock);
return false;
};
}
/* Battery */
if (battery == 'true') {
var battery_triggerblock = scope.document.createElement('div');
battery_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_battery';
var battery_a = scope.navigator;
battery_a.getBattery = function () {
battery_triggerblock.title = 'getBattery';
document.documentElement.appendChild(battery_triggerblock);
return void 0;
};
}
/* WebGL */
if (webgl == 'true') {
var webgl_triggerblock = scope.document.createElement('div');
webgl_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_webgl';
var webgl_a = scope.HTMLCanvasElement;
var origGetContext = webgl_a.prototype.getContext;
webgl_a.prototype.getContext = function (arg) {
if (arg.match(/webgl/i)) {
webgl_triggerblock.title = 'getContext';
document.documentElement.appendChild(webgl_triggerblock);
return false;
}
return origGetContext.apply(this, arguments);
};
}
/* WebRTC */
if (webrtcdevice == 'true') {
var webrtc_triggerblock = scope.document.createElement('div');
webrtc_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_webrtc';
var webrtc_a = scope.MediaStreamTrack;
webrtc_a.getSources = function () {
webrtc_triggerblock.title = 'getSources';
document.documentElement.appendChild(webrtc_triggerblock);
return false;
};
webrtc_a.getMediaDevices = function () {
webrtc_triggerblock.title = 'getMediaDevices';
document.documentElement.appendChild(webrtc_triggerblock);
return false;
};
var webrtc_b = scope.navigator.mediaDevices;
webrtc_b.enumerateDevices = function () {
webrtc_triggerblock.title = 'enumerateDevices';
document.documentElement.appendChild(webrtc_triggerblock);
return false;
};
}
/* Gamepad */
if (gamepad == 'true') {
var gamepad_triggerblock = scope.document.createElement('div');
gamepad_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_gamepad';
var gamepad_a = scope.navigator;
gamepad_a.getGamepads = function () {
gamepad_triggerblock.title = 'getGamepads';
document.documentElement.appendChild(gamepad_triggerblock);
return false;
};
}
/* WebVR */
if (webvr == 'true') {
var webvr_triggerblock = scope.document.createElement('div');
webvr_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_webvr';
var webvr_a = scope.navigator;
webvr_a.getVRDisplays = function () {
webvr_triggerblock.title = 'getVRDisplays';
document.documentElement.appendChild(webvr_triggerblock);
return false;
};
}
/* Bluetooth */
if (bluetooth == 'true') {
if (scope.navigator.bluetooth) {
var bluetooth_triggerblock = scope.document.createElement('div');
bluetooth_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_bluetooth';
var bluetooth_a = scope.navigator.bluetooth;
bluetooth_a.requestDevice = function () {
bluetooth_triggerblock.title = 'requestDevice';
document.documentElement.appendChild(bluetooth_triggerblock);
return false;
};
}
}
/* Client Rectangles */
if (clientrects == 'true') {
var clientrects_triggerblock = scope.document.createElement('div');
clientrects_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_clientrects';
Element.prototype.getClientRects = function () {
clientrects_triggerblock.title = 'getClientRects';
document.documentElement.appendChild(clientrects_triggerblock);
return [
{ top: 0, bottom: 0, left: 0, right: 0, height: 0, width: 0 },
];
};
}
/* Timezone */
if (timezone != 'false') {
var timezone_triggerblock = scope.document.createElement('div');
timezone_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_timezone';
var timezone_a = scope.Date;
timezone_a.prototype.getTimezoneOffset = function () {
timezone_triggerblock.title = 'getTimezoneOffset';
document.documentElement.appendChild(timezone_triggerblock);
if (timezone == 'random')
return [
'720',
'660',
'600',
'570',
'540',
'480',
'420',
'360',
'300',
'240',
'210',
'180',
'120',
'60',
'0',
'-60',
'-120',
'-180',
'-210',
'-240',
'-270',
'-300',
'-330',
'-345',
'-360',
'-390',
'-420',
'-480',
'-510',
'-525',
'-540',
'-570',
'-600',
'-630',
'-660',
'-720',
'-765',
'-780',
'-840',
][Math.floor(Math.random() * 39)];
return timezone;
};
}
/* Clipboard */
if (clipboard == 'true') {
var clipboard_triggerblock = scope.document.createElement('div');
clipboard_triggerblock.className =
'scriptsafe_oiigbmnaadbkfbmpbfijlflahbdbdgdf_clipboard';
var clipboard_a = document;
var origExecCommand = clipboard_a.execCommand;
clipboard_a.execCommand = function () {
clipboard_triggerblock.title = 'execCommand';
document.documentElement.appendChild(clipboard_triggerblock);
if (arguments[0] == 'cut' || arguments[0] == 'copy') return false;
return origExecCommand.apply(this, arguments);
};
}
}
processFunctions(window);
var iwin = HTMLIFrameElement.prototype.__lookupGetter__('contentWindow'),
idoc = HTMLIFrameElement.prototype.__lookupGetter__('contentDocument');
Object.defineProperties(HTMLIFrameElement.prototype, {
contentWindow: {
get: function () {
var frame = iwin.apply(this);
if (
this.src &&
this.src.indexOf('//') != -1 &&
location.host != this.src.split('/')[2]
)
return frame;
try {
frame.HTMLCanvasElement;
} catch (err) {
/* do nothing*/
}
processFunctions(frame);
return frame;
},
},
contentDocument: {
get: function () {
if (
this.src &&
this.src.indexOf('//') != -1 &&
location.host != this.src.split('/')[2]
)
return idoc.apply(this);
var frame = iwin.apply(this);
try {
frame.HTMLCanvasElement;
} catch (err) {
/* do nothing*/
}
processFunctions(frame);
return idoc.apply(this);
},
},
});
})(
'block',
'true',
'true',
'true',
'true',
'true',
'true',
'true',
'true',
'false',
'true',
'true',
'true'
);
</script>
</html>

View File

@@ -0,0 +1,6 @@
Example Domain
This domain is for use in illustrative examples in documents. You may
use this domain in literature without prior coordination or asking for
permission.
More information...

Binary file not shown.

View File

@@ -0,0 +1,17 @@
Sample PDF
This is a simple PDF file. Fun fun fun.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus facilisis odio sed mi.
Curabitur suscipit. Nullam vel nisi. Etiam semper ipsum ut lectus. Proin aliquam, erat eget
pharetra commodo, eros mi condimentum quam, sed commodo justo quam ut velit.
Integer a erat. Cras laoreet ligula cursus enim. Aenean scelerisque velit et tellus.
Vestibulum dictum aliquet sem. Nulla facilisi. Vestibulum accumsan ante vitae elit. Nulla
erat dolor, blandit in, rutrum quis, semper pulvinar, enim. Nullam varius congue risus.
Vivamus sollicitudin, metus ut interdum eleifend, nisi tellus pellentesque elit, tristique
accumsan eros quam et risus. Suspendisse libero odio, mattis sit amet, aliquet eget,
hendrerit vel, nulla. Sed vitae augue. Aliquam erat volutpat. Aliquam feugiat vulputate nisl.
Suspendisse quis nulla pretium ante pretium mollis. Proin velit ligula, sagittis at, egestas a,
pulvinar quis, nisl.

View File

@@ -0,0 +1,9 @@
Pellentesque sit amet lectus. Praesent pulvinar, nunc quis iaculis sagittis, justo quam
lobortis tortor, sed vestibulum dui metus venenatis est. Nunc cursus ligula. Nulla facilisi.
Phasellus ullamcorper consectetuer ante. Duis tincidunt, urna id condimentum luctus, nibh
ante vulputate sapien, id sagittis massa orci ut enim. Pellentesque vestibulum convallis
sem. Nulla consequat quam ut nisl. Nullam est. Curabitur tincidunt dapibus lorem. Proin
velit turpis, scelerisque sit amet, iaculis nec, rhoncus ac, ipsum. Phasellus lorem arcu,
feugiat eu, gravida eu, consequat molestie, ipsum. Nullam vel est ut ipsum volutpat
feugiat. Aenean pellentesque.

View File

@@ -0,0 +1,16 @@
In mauris. Pellentesque dui nisi, iaculis eu, rhoncus in, venenatis ac, ante. Ut odio justo,
scelerisque vel, facilisis non, commodo a, pede. Cras nec massa sit amet tortor volutpat
varius. Donec lacinia, neque a luctus aliquet, pede massa imperdiet ante, at varius lorem
pede sed sapien. Fusce erat nibh, aliquet in, eleifend eget, commodo eget, erat. Fusce
consectetuer. Cras risus tortor, porttitor nec, tristique sed, convallis semper, eros. Fusce
vulputate ipsum a mauris. Phasellus mollis. Curabitur sed urna. Aliquam nec sapien non
nibh pulvinar convallis. Vivamus facilisis augue quis quam. Proin cursus aliquet metus.
Suspendisse lacinia. Nulla at tellus ac turpis eleifend scelerisque. Maecenas a pede vitae
enim commodo interdum. Donec odio. Sed sollicitudin dui vitae justo.
Morbi elit nunc, facilisis a, mollis a, molestie at, lectus. Suspendisse eget mauris eu tellus
molestie cursus. Duis ut magna at justo dignissim condimentum. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus varius. Ut sit
amet diam suscipit mauris ornare aliquam. Sed varius. Duis arcu. Etiam tristique massa
eget dui. Phasellus congue. Aenean est erat, tincidunt eget, venenatis quis, commodo at,
quam.

View File

@@ -0,0 +1,10 @@
fn factorial(n: u64) -> u64 {
if n == 0 {
return 1;
}
n * factorial(n - 1)
}
fn main() {
println!("Hello, world!");
}

View File

@@ -0,0 +1,6 @@
fn factorial(n: u64) -> u64 {
if n == 0 {
return 1;
}
n * factorial(n - 1)
}

View File

@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -0,0 +1,3 @@
export default function sample() {
return 'sample';
}

View File

@@ -0,0 +1,3 @@
export default function sample() {
return 'sample';
}