Tweak demo files.
This commit is contained in:
+9
-14
@@ -2,10 +2,14 @@ html {
|
|||||||
background-color: #DDD;
|
background-color: #DDD;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
|
-webkit-box-sizing: content-box;
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
box-sizing: content-box;
|
||||||
width: 900px;
|
width: 900px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
font-family: Verdana, Helvetica, Arial, sans-serif;
|
font-family: Verdana, Helvetica, Arial, sans-serif;
|
||||||
box-shadow: 0 0 5px #000;
|
-webkit-box-shadow: 0 0 10px 2px rgba(0, 0, 0, .5);
|
||||||
|
-moz-box-shadow: 0 0 10px 2px rgba(0, 0, 0, .5);
|
||||||
box-shadow: 0 0 10px 2px rgba(0, 0, 0, .5);
|
box-shadow: 0 0 10px 2px rgba(0, 0, 0, .5);
|
||||||
padding: 7px 25px 70px;
|
padding: 7px 25px 70px;
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
@@ -28,28 +32,19 @@ form {
|
|||||||
section {
|
section {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
}
|
}
|
||||||
dt {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
#canvas {
|
#canvas {
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
}
|
}
|
||||||
#canvas, #html {
|
#canvas, #html {
|
||||||
border: 1px solid black;
|
border: 1px solid #000;
|
||||||
}
|
}
|
||||||
.filename {
|
.filename {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
#html {
|
#html {
|
||||||
box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
ms-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
webkit-box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
moz-box-sizing: border-box;
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
dt:target {
|
|
||||||
background-color: Highlight;
|
|
||||||
color: HighlightText;
|
|
||||||
}
|
|
||||||
|
|||||||
+9
-6
@@ -1,13 +1,16 @@
|
|||||||
/* FileSaver.js demo script
|
/*! FileSaver.js demo script
|
||||||
* 2012-01-23
|
* 2012-01-23
|
||||||
*
|
*
|
||||||
* By Eli Grey, http://eligrey.com
|
* By Eli Grey, http://eligrey.com
|
||||||
* License: X11/MIT
|
* License: X11/MIT
|
||||||
* See LICENSE.md
|
* See LICENSE.md
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/demo/demo.js */
|
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/demo/demo.js */
|
||||||
|
|
||||||
|
/*jshint laxbreak: true, laxcomma: true, smarttabs: true*/
|
||||||
|
/*global saveAs, self*/
|
||||||
|
|
||||||
(function(view) {
|
(function(view) {
|
||||||
"use strict";
|
"use strict";
|
||||||
// The canvas drawing portion of the demo is based off the demo at
|
// The canvas drawing portion of the demo is based off the demo at
|
||||||
@@ -186,7 +189,7 @@ html_options_form.addEventListener("submit", function(event) {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var
|
var
|
||||||
BB = get_blob()
|
BB = get_blob()
|
||||||
, xml_serializer = new XMLSerializer
|
, xml_serializer = new XMLSerializer()
|
||||||
, doc = create_html_doc(html)
|
, doc = create_html_doc(html)
|
||||||
;
|
;
|
||||||
saveAs(
|
saveAs(
|
||||||
|
|||||||
+50
-50
@@ -1,57 +1,57 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US-x-Hixie">
|
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US-x-Hixie">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>FileSaver.js demo</title>
|
<title>FileSaver.js demo</title>
|
||||||
<link rel="stylesheet" type="text/css" href="demo.css"/>
|
<link rel="stylesheet" type="text/css" href="demo.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1><a href="https://github.com/eligrey/FileSaver.js">FileSaver.js</a> demo</h1>
|
<h1><a href="https://github.com/eligrey/FileSaver.js">FileSaver.js</a> demo</h1>
|
||||||
<p>
|
<p>
|
||||||
The following examples demonstrate how it is possible to generate and save any type of data right in the browser using the W3C <code>saveAs()</code> <a href="http://www.w3.org/TR/file-writer-api/#the-filesaver-interface">FileSaver</a> interface, without contacting any servers.
|
The following examples demonstrate how it is possible to generate and save any type of data right in the browser using the W3C <code>saveAs()</code> <a href="http://www.w3.org/TR/file-writer-api/#the-filesaver-interface">FileSaver</a> interface, without contacting any servers.
|
||||||
</p>
|
</p>
|
||||||
<section id="image-demo">
|
<section id="image-demo">
|
||||||
<h2>Saving an image</h2>
|
<h2>Saving an image</h2>
|
||||||
<canvas class="input" id="canvas" width="500" height="300"/>
|
<canvas class="input" id="canvas" width="500" height="300"></canvas>
|
||||||
<form id="canvas-options">
|
<form id="canvas-options">
|
||||||
<label>Filename: <input type="text" class="filename" id="canvas-filename" placeholder="doodle"/>.png</label>
|
<label>Filename: <input type="text" class="filename" id="canvas-filename" placeholder="doodle"/>.png</label>
|
||||||
<input type="submit" value="Save"/>
|
<input type="submit" value="Save"/>
|
||||||
<input type="button" id="canvas-clear" value="Clear"/>
|
<input type="button" id="canvas-clear" value="Clear"/>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<section id="text-demo">
|
<section id="text-demo">
|
||||||
<h2>Saving text</h2>
|
<h2>Saving text</h2>
|
||||||
<textarea class="input" id="text" placeholder="Once upon a time..."/>
|
<textarea class="input" id="text" placeholder="Once upon a time..."></textarea>
|
||||||
<form id="text-options">
|
<form id="text-options">
|
||||||
<label>Filename: <input type="text" class="filename" id="text-filename" placeholder="a plain document"/>.txt</label>
|
<label>Filename: <input type="text" class="filename" id="text-filename" placeholder="a plain document"/>.txt</label>
|
||||||
<input type="submit" value="Save"/>
|
<input type="submit" value="Save"/>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<section id="html-demo">
|
<section id="html-demo">
|
||||||
<h2>Saving rich text</h2>
|
<h2>Saving rich text</h2>
|
||||||
<div class="input" id="html" contenteditable="">
|
<div class="input" id="html" contenteditable="">
|
||||||
<h3>Some example rich text</h3>
|
<h3>Some example rich text</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><del>Plain</del> <ins>Boring</ins> text.</li>
|
<li><del>Plain</del> <ins>Boring</ins> text.</li>
|
||||||
<li><em>Emphasized text!</em></li>
|
<li><em>Emphasized text!</em></li>
|
||||||
<li><strong>Strong text!</strong></li>
|
<li><strong>Strong text!</strong></li>
|
||||||
<li>
|
<li>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="70" height="70">
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="70" height="70">
|
||||||
<circle cx="35" cy="35" r="35" fill="red"/>
|
<circle cx="35" cy="35" r="35" fill="red"/>
|
||||||
<text x="10" y="40">image</text>
|
<text x="10" y="40">image</text>
|
||||||
</svg>
|
</svg>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="https://github.com/eligrey/FileSaver.js">A link.</a></li>
|
<li><a href="https://github.com/eligrey/FileSaver.js">A link.</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<form id="html-options">
|
<form id="html-options">
|
||||||
<label>Filename: <input type="text" class="filename" id="html-filename" placeholder="a rich document"/>.xhtml</label>
|
<label>Filename: <input type="text" class="filename" id="html-filename" placeholder="a rich document"/>.xhtml</label>
|
||||||
<input type="submit" value="Save"/>
|
<input type="submit" value="Save"/>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<script type="application/ecmascript" async="" src="https://raw.github.com/eligrey/Blob.js/master/Blob.min.js"/>
|
<script src="https://raw.github.com/eligrey/Blob.js/master/Blob.min.js"></script>
|
||||||
<script type="application/ecmascript" async="" src="https://raw.github.com/eligrey/canvas-toBlob.js/master/canvas-toBlob.js"/>
|
<script src="https://raw.github.com/eligrey/canvas-toBlob.js/master/canvas-toBlob.js"></script>
|
||||||
<script type="application/ecmascript" async="" src="https://raw.github.com/eligrey/FileSaver.js/master/FileSaver.js"/>
|
<script src="https://raw.github.com/eligrey/FileSaver.js/master/FileSaver.js"></script>
|
||||||
<script type="application/ecmascript" async="" src="https://raw.github.com/eligrey/FileSaver.js/master/demo/demo.js"/>
|
<script src="https://raw.github.com/eligrey/FileSaver.js/master/demo/demo.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user