diff --git a/README.md b/README.md index 84e6498..45acc2b 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,30 @@ -SVG-optimiser.js -================ +# `SVG-optimiser.js` +> An online SVG optimiser using JavaScript and jQuery -An online SVG optimiser using Javascript and jQuery +Use it now: https://mountainash.github.io/SVG-optimiser.js/ -##Using optimise-functions.js and SVG-elements.js +## Using `optimise-functions.js` and `SVG-elements.js` -###Create an SVG_Root object +### Create an `SVG_Root` object The `SVG_Root` object is what parses the SVG and allows you to access the optimisation functions. You can pass it either a complete SVG or an SVG element (which can have child elements). You can pass it a string with: `var SVGObject = SVG_Root('');` -Or a JQuery object with: +Or a jQuery object with: `var SVGObject = SVG_Root($('#my-svg'));` -###Optimise the SVG +### Optimise the SVG Optimisation is done with: `svg.optimise();` There are many options which I will have to write about at some point. -###Write the SVG +### Write the SVG You can get the SVG as a string with: `SVGObject.write();` Or as a DOM element with: `SVGObject.createSVGObject();` + +## Licence +- [MIT](./LICENSE) diff --git a/test.html b/index.html similarity index 56% rename from test.html rename to index.html index 8b236a9..048c4a4 100644 --- a/test.html +++ b/index.html @@ -1,16 +1,43 @@ - - SVG optimisation - - - - - - - + SVG Optimisation + + + + + + +

SVG optimiser

@@ -18,11 +45,13 @@

SVG optimiser

Upload

+
@@ -53,7 +82,7 @@

Options

Output

-
+
\ No newline at end of file diff --git a/index.md b/index.md new file mode 100644 index 0000000..9da3e5e --- /dev/null +++ b/index.md @@ -0,0 +1,2 @@ +# [index.html](./index.html) +- [Go here](./index.html) diff --git a/scripts/interface.js b/scripts/interface.js index 625d1d2..1b7f07c 100644 --- a/scripts/interface.js +++ b/scripts/interface.js @@ -126,17 +126,15 @@ function loadSVG(id) { optimiseSVG(svgObj); // Update interface - $('#upload-container').hide("fast"); + $('#upload-section').hide('fast'); addOptions(svgObj); - $('#output-section').show(); - $('#optimise-section').show(); + $('#output-section,#optimise-section').show(); } -$(document).ready(function() { +$(function() { $('#upload-section > h2').click(function() { $('#upload-container').toggle('fast'); }); - $('#output-section').hide(); - $('#optimise-section').hide(); -}); \ No newline at end of file + $('#output-section,#optimise-section').hide(); +}); diff --git a/test.css b/test.css deleted file mode 100644 index 49f7037..0000000 --- a/test.css +++ /dev/null @@ -1,24 +0,0 @@ -#optimise-container > div { - display: inline-block; - background: #e8e8e8; - margin: 5px; - padding: 5px; -} - -#input-svg { - width:800px; - height:200px; - border: 1px solid #888; -} - -#options-container { - -webkit-columns: 300px 3; - -moz-columns: 300px 3; - columns: 300px 3; -} - -#output-container { - white-space: pre-wrap; - font-family: Fixed, 'Courier New', monospace; - font-size: 12px; -} \ No newline at end of file