diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index c273a4f1..cd1e55db 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -70,6 +70,7 @@ function cleanAuthorName() { document.forms["editForm"].elements["content"].focus(); <%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) and !@page.categories.include?('S5-slideshow') -%> +setupSVGedit('<%= compute_public_path("editor/svg-editor.html", "svg-edit").split(/\?/)[0] %>'); addS5button('<%= CGI.escapeHTML(@page.name) %>'); <%- end -%> //--> diff --git a/app/views/wiki/new.rhtml b/app/views/wiki/new.rhtml index b0c7ab70..6ea45be8 100644 --- a/app/views/wiki/new.rhtml +++ b/app/views/wiki/new.rhtml @@ -32,6 +32,7 @@ function cleanAuthorName() { } document.forms["editForm"].elements["content"].focus(); <%- if [:markdownMML, :markdownPNG, :markdown].include?(@web.markup) -%> +setupSVGedit('<%= compute_public_path("editor/svg-editor.html", "svg-edit").split(/\?/)[0] %>'); addS5button('<%= CGI.escapeHTML(@page_name) %>'); <%- end -%> diff --git a/lib/sanitizer.rb b/lib/sanitizer.rb index d26d99ae..2a5e738a 100644 --- a/lib/sanitizer.rb +++ b/lib/sanitizer.rb @@ -23,10 +23,10 @@ module Sanitizer munderover none semantics] svg_elements = Set.new %w[a animate animateColor animateMotion animateTransform - circle clipPath defs desc ellipse font-face font-face-name font-face-src - foreignObject g glyph hkern linearGradient line marker metadata - missing-glyph mpath path polygon polyline radialGradient rect set - stop svg switch text title tspan use] + circle clipPath defs desc ellipse feGaussianBlur filter font-face + font-face-name font-face-src foreignObject g glyph hkern linearGradient + line marker mask metadata missing-glyph mpath path pattern polygon + polyline radialGradient rect set stop svg switch text textPath title tspan use] acceptable_attributes = Set.new %w[abbr accept accept-charset accesskey action align alt axis border cellpadding cellspacing char charoff charset @@ -50,23 +50,25 @@ module Sanitizer arabic-form ascent attributeName attributeType baseProfile bbox begin by calcMode cap-height class clip-path clip-rule color color-rendering content cx cy d dx dy descent display dur end fill fill-opacity fill-rule - font-family font-size font-stretch font-style font-variant font-weight from - fx fy g1 g2 glyph-name gradientUnits hanging height horiz-adv-x horiz-origin-x - id ideographic k keyPoints keySplines keyTimes lang marker-end - marker-mid marker-start markerHeight markerUnits markerWidth - mathematical max min name offset opacity orient origin - overline-position overline-thickness panose-1 path pathLength points - preserveAspectRatio r refX refY repeatCount repeatDur - requiredExtensions requiredFeatures restart rotate rx ry slope stemh - stemv stop-color stop-opacity strikethrough-position - strikethrough-thickness stroke stroke-dasharray stroke-dashoffset - stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity - stroke-width systemLanguage target text-anchor to transform type u1 - u2 underline-position underline-thickness unicode unicode-range - units-per-em values version viewBox visibility width widths x - x-height x1 x2 xlink:actuate xlink:arcrole xlink:href xlink:role - xlink:show xlink:title xlink:type xml:base xml:lang xml:space xmlns - xmlns:xlink y y1 y2 zoomAndPan] + filterRes filterUnits font-family font-size font-stretch font-style + font-variant font-weight from fx fy g1 g2 glyph-name gradientUnits + hanging height horiz-adv-x horiz-origin-x id ideographic k keyPoints + keySplines keyTimes lang marker-end marker-mid marker-start + markerHeight markerUnits markerWidth maskContentUnits maskUnits + mathematical max method min name offset opacity orient origin + overline-position overline-thickness panose-1 path pathLength + patternContentUnits patternTransform patternUnits points + preserveAspectRatio primitiveUnits r refX refY repeatCount repeatDur + requiredExtensions requiredFeatures restart rotate rx ry slope spacing + startOffset stdDeviation stemh stemv stop-color stop-opacity + strikethrough-position strikethrough-thickness stroke stroke-dasharray + stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit + stroke-opacity stroke-width systemLanguage target text-anchor + to transform type u1 u2 underline-position underline-thickness + unicode unicode-range units-per-em values version viewBox + visibility width widths x x-height x1 x2 xlink:actuate + xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type + xml:base xml:lang xml:space xmlns xmlns:xlink y y1 y2 zoomAndPan] attr_val_is_uri = Set.new %w[href src cite action longdesc xlink:href xml:base] diff --git a/public/javascripts/page_helper.js b/public/javascripts/page_helper.js index 297ba78f..e773f99f 100644 --- a/public/javascripts/page_helper.js +++ b/public/javascripts/page_helper.js @@ -71,6 +71,69 @@ function addS5button(page_name) { } } +function setupSVGedit(path){ + var f = $('MarkupHelp'); + var selected; + var before; + var after; +// create a control button + if (f) { + var SVGeditButton = new Element('input', {id:'SVGeditButton', type:'button', value: 'Create an SVG graphic'}); + f.insert({top: SVGeditButton}); + SVGeditButton.disabled = true; + Event.observe(SVGeditButton, 'click', function(){ + if (selected) { + var editor = window.open(path +'?source=data:image/svg+xml;base64,' + window.btoa(selected), 'Spoons!'); + } else { + var editor = window.open(path, 'Spoons!'); + } + }); + } + var t = $('content'); + + var callback = function(){ +// This is triggered by 'onmouseup' events + var sel = window.getSelection(); + var a = sel.anchorOffset; + var f = sel.focusOffset; +// A bit of ugliness, because Gecko-based browsers +// don't support getSelection in textareas + if (t.selectionStart ) { + var begin = t.selectionStart; + var end = t.selectionEnd; + } else { + if( a < f) { + begin = a; + end = f; + } else { + begin = f; + end = a; + } + } +// finally, slice up the textarea content into before, selected, & after pieces + before = t.value.slice(0, begin); + selected = t.value.slice(begin, end); + after = t.value.slice(end, t.value.length-1); + if (selected && selected != '') { + if ( selected.match(/^$/) ) { + SVGeditButton.disabled = false; + SVGeditButton.value = 'Edit existing SVG graphic'; + } else { + SVGeditButton.disabled = true; + } + } else { + SVGeditButton.disabled = false; + SVGeditButton.value = 'Create SVG graphic'; + } + } + Event.observe(t, 'mouseup', callback ); + var my_loc = window.location.protocol + '//' + window.location.host; + Event.observe(window, "message", function(event){ + if(event.origin !== my_loc) { return;} + t.value = before + event.data + after; + }); +} + function updateSize(elt, w, h) { // adjust to the size of the user's browser area. // w and h are the original, unadjusted, width and height per row/column diff --git a/public/svg-edit/AUTHORS b/public/svg-edit/AUTHORS new file mode 100644 index 00000000..f15ee8e0 --- /dev/null +++ b/public/svg-edit/AUTHORS @@ -0,0 +1,21 @@ +Narendra Sisodiya +Pavol Rusnak +Jeff Schiller +Vidar Hokstad +Alexis Deveria + +Translation credits: + +ar: Tarik Belaam (العربية) +cs: Jan Ptacek (Čeština) +de: Reimar Bauer (Deutsch) +es: Alicia Puerto (Español) +fa: Payman Delshad (فارسی) +fr: wormsxulla (Français) +fy: Wander Nauta (Frysk) +hi: Tavish Naruka (हिन्दी) +nl: Jaap Blom (Nederlands) +ro: Christian Tzurcanu (Româneşte) +ru: Laurent Dufloux (Русский язык) +sk: Pavol Rusnak (Slovenčina) +zh-TW: 黃瀚生(han sheng Huang) (台灣正體) \ No newline at end of file diff --git a/public/svg-edit/CHANGES b/public/svg-edit/CHANGES new file mode 100644 index 00000000..c8e4c86e --- /dev/null +++ b/public/svg-edit/CHANGES @@ -0,0 +1,72 @@ +2.4 - January 11, 2010 +------------------- +* Zoom +* Layers +* UI Localization +* Wireframe Mode +* Resizable UI (SVG icons) +* Set background color and/or image (for tracing) +* Convert Shapes to Paths +* X, Y coordinates for all elements +* Draggable Dialog boxes +* Select Non-Adjacent Elements +* Fixed-ratio resize +* Automatic Tool Switching +* Raster Images +* Group elements +* Add/Remove path nodes +* Curved Paths +* Floating point values for all attributes +* Text fields for all attributes +* Title element + +2.3 - September 08, 2009 +------------------- +* Align Objects +* Rotate Objects +* Clone Objects +* Select Next/Prev Object +* Edit SVG Source +* Gradient picking +* Polygon Mode (Path Editing, Phase 1) + +2.2 - July 08, 2009 +------------------- +* Multiselect Mode +* Undo/Redo Actions +* Resize Elements +* Contextual tools for rect, circle, ellipse, line, text elements +* Some updated button images +* Stretched the UI to fit the browser window +* Resizing of the SVG canvas +* Upgraded to jPicker 1.0.8 + +2.1 - June 17, 2009 +------------------- +* tooltips added to all UI elements +* fix flyout menus +* ask before clearing the drawing (suggested by martin.vidner) +* control group, fill and stroke opacity +* fix flyouts when using color picker +* change license from GPLv2 to Apache License v2.0 +* replaced Farbtastic with jPicker, because of the license issues +* removed dependency on svgcanvas.svg, now created in JavaScript +* added Select tool +* using jQuery hosted by Google instead of local version +* allow dragging of elements +* save SVG file to separate tab +* create and edit text elements +* context panel tools +* change rect radius, font-family, font-size +* added keystroke shortcuts for all tools +* move to top/bottom + +2.0 - June 03, 2009 +------------------- +* rewritten SVG-edit, so now it uses OOP +* draw ellipse, square +* created HTML interface similar to Inkscape + +1.0 - February 06, 2009 +------------------- +* SVG-Edit released \ No newline at end of file diff --git a/public/svg-edit/LICENSE b/public/svg-edit/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/public/svg-edit/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/public/svg-edit/Makefile b/public/svg-edit/Makefile new file mode 100644 index 00000000..3446a13a --- /dev/null +++ b/public/svg-edit/Makefile @@ -0,0 +1,46 @@ +NAME=svg-edit +VERSION=2.5 +MAKEDOCS=naturaldocs/NaturalDocs +PACKAGE=$(NAME)-$(VERSION) +YUI=build/yuicompressor.jar +ZIP=zip + +all: release firefox opera + +build/$(PACKAGE): + rm -rf config + mkdir config + $(MAKEDOCS) -i editor/ -o html docs/ -p config/ -oft -r + mkdir -p build/$(PACKAGE) + cp -r editor/* build/$(PACKAGE) + -find build/$(PACKAGE) -name .svn -type d -exec rm -rf {} \; +# minify spin button + java -jar $(YUI) build/$(PACKAGE)/spinbtn/JQuerySpinBtn.js > build/$(PACKAGE)/spinbtn/JQuerySpinBtn.min.js +# minify SVG-edit files + java -jar $(YUI) build/$(PACKAGE)/svg-editor.js > build/$(PACKAGE)/svg-editor.min.js + java -jar $(YUI) build/$(PACKAGE)/svgcanvas.js > build/$(PACKAGE)/svgcanvas.min.js +# CSS files do not work remotely +# java -jar $(YUI) build/$(PACKAGE)/spinbtn/JQuerySpinBtn.css > build/$(PACKAGE)/spinbtn/JQuerySpinBtn.min.css +# java -jar $(YUI) build/$(PACKAGE)/svg-editor.css > build/$(PACKAGE)/svg-editor.min.css + +release: build/$(PACKAGE) + cd build ; $(ZIP) $(PACKAGE).zip -r $(PACKAGE) ; cd .. + +firefox: build/$(PACKAGE) + mkdir -p build/firefox/content/editor + cp -r firefox-extension/* build/firefox + rm -rf build/firefox/content/.svn + cp -r build/$(PACKAGE)/* build/firefox/content/editor + cd build/firefox ; $(ZIP) ../$(PACKAGE).xpi -r * ; cd ../.. + +opera: build/$(PACKAGE) + mkdir -p build/opera/editor + cp opera-widget/* build/opera + cp -r build/$(PACKAGE)/* build/opera/editor + cd build/opera ; $(ZIP) ../$(PACKAGE).wgt -r * ; cd ../.. + +clean: + rm -rf config + rm -rf build/$(PACKAGE) + rm -rf build/firefox + rm -rf build/opera diff --git a/public/svg-edit/README b/public/svg-edit/README new file mode 100644 index 00000000..f8fe9436 --- /dev/null +++ b/public/svg-edit/README @@ -0,0 +1,21 @@ +SVG-edit, a web based SVG editor + +http://code.google.com/p/svg-edit/ + +see AUTHORS file for authors + +----- + +SVG-edit contains code from these projects: + +jQuery JavaScript Library v1.3.2 +http://jquery.com/ +Copyright (c) 2009 John Resig + +jQuery js-Hotkeys +http://code.google.com/p/js-hotkeys/ +Copyright (c) 2008 Tzury Bar Yochay + +jPicker +http://www.digitalmagicpro.com/jPicker/ +Copyright (c) 2009 Christopher T. Tillman diff --git a/public/svg-edit/build/yuicompressor.jar b/public/svg-edit/build/yuicompressor.jar new file mode 100644 index 00000000..b48f3973 Binary files /dev/null and b/public/svg-edit/build/yuicompressor.jar differ diff --git a/public/svg-edit/docs/files/svgcanvas-js.html b/public/svg-edit/docs/files/svgcanvas-js.html new file mode 100644 index 00000000..a6375c28 --- /dev/null +++ b/public/svg-edit/docs/files/svgcanvas-js.html @@ -0,0 +1,88 @@ + + +/Users/jschill1/Documents/svg-edit/editor/svgcanvas.js + + + + + + + + + +

svgcanvas.js

Summary
svgcanvas.js
Selection
clearSelectionClears the selection.
addToSelectionAdds a list of elements to the selection.
removeFromSelectionRemoves elements from the selection.
Serialization
openCalls the ‘opened’ handler and sends the SVG XML text.
saveSerializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
getSvgStringReturns the current drawing as raw SVG XML text.
setSvgStringThis function sets the current drawing as the input SVG XML.
Layers
createLayerCreates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.
deleteCurrentLayerDeletes the current layer from the drawing and then clears the selection.
getNumLayersReturns the number of layers in the current drawing.
getLayerReturns the name of the ith layer.
getCurrentLayerReturns the name of the currently selected layer.
setCurrentLayerSets the current layer.
renameCurrentLayerRenames the current layer.
setCurrentLayerPositionChanges the position of the current layer to the new value.
getLayerVisibilityReturns whether the layer is visible.
setLayerVisibilitySets the visibility of the layer.
moveSelectedToLayerMoves the selected elements to layername.
getLayerOpacityReturns the opacity of the given layer.
setLayerOpacitySets the opacity of the given layer.
clearClears the current document.
Fill and Stroke
+ +

Selection

+ +

clearSelection

this.clearSelection = function()

Clears the selection.  The ‘selected’ handler is then called.

+ +

addToSelection

this.addToSelection = function(elemsToAdd,
showGrips)

Adds a list of elements to the selection.  The ‘selected’ handler is then called.

Parameters

elemsToAddan array of DOM elements to add to the selection
showGripsa boolean flag indicating whether the resize grips should be shown
+ +

removeFromSelection

this.removeFromSelection = function(elemsToRemove)

Removes elements from the selection.

Parameters

elemsToRemovean array of elements to remove from selection
+ +

Serialization

+ +

open

this.open = function(str)

Calls the ‘opened’ handler and sends the SVG XML text.  Clients of the SvgCanvas bind their load function (typically calls to setSvgString() to the ‘opened’ event.

+ +

save

this.save = function()

Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.  This function also includes the XML prolog.  Clients of the SvgCanvas bind their save function to the ‘saved’ event.

Returns

Nothing

+ +

getSvgString

this.getSvgString = function()

Returns the current drawing as raw SVG XML text.

Returns

The current drawing as raw SVG XML text.

+ +

setSvgString

this.setSvgString = function(xmlString)

This function sets the current drawing as the input SVG XML.

Parameters

xmlStringThe SVG as XML text.

Returns

This function returns false if the set was unsuccessful, true otherwise.

+ +

Layers

+ +

createLayer

this.createLayer = function(name)

Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.  This is an undoable action.

Parameters

nameThe given name
+ +

deleteCurrentLayer

this.deleteCurrentLayer = function()

Deletes the current layer from the drawing and then clears the selection.  This function then calls the ‘changed’ handler.  This is an undoable action.

+ +

getNumLayers

this.getNumLayers = function()

Returns the number of layers in the current drawing.

Returns

The number of layers in the current drawing.

+ +

getLayer

this.getLayer = function(i)

Returns the name of the ith layer.  If the index is out of range, an empty string is returned.

Parameters

ithe zero-based index of the layer you are querying.

Returns

The name of the ith layer

+ +

getCurrentLayer

this.getCurrentLayer = function()

Returns the name of the currently selected layer.  If an error occurs, an empty string is returned.

Returns

The name of the currently active layer.

+ +

setCurrentLayer

this.setCurrentLayer = function(name)

Sets the current layer.  If the name is not a valid layer name, then this function returns false.  Otherwise it returns true.  This is not an undo-able action.

Parameters

namethe name of the layer you want to switch to.

Returns

true if the current layer was switched, otherwise false

+ +

renameCurrentLayer

this.renameCurrentLayer = function(newname)

Renames the current layer.  If the layer name is not valid (i.e. unique), then this function does nothing and returns false, otherwise it returns true.  This is an undo-able action.

Parameters

newnamethe new name you want to give the current layer.  This name must be unique among all layer names.

Returns

true if the rename succeeded, false otherwise.

+ +

setCurrentLayerPosition

this.setCurrentLayerPosition = function(newpos)

Changes the position of the current layer to the new value.  If the new index is not valid, this function does nothing and returns false, otherwise it returns true.  This is an undo-able action.

Parameters

newposThe zero-based index of the new position of the layer.  This should be between
0 and (number of layers1)

Returns

true if the current layer position was changed, false otherwise.

+ +

getLayerVisibility

this.getLayerVisibility = function(layername)

Returns whether the layer is visible.  If the layer name is not valid, then this function returns false.

Parameters

layernamethe name of the layer which you want to query.

Returns

The visibility state of the layer, or false if the layer name was invalid.

+ +

setLayerVisibility

this.setLayerVisibility = function(layername,
bVisible)

Sets the visibility of the layer.  If the layer name is not valid, this function return false, otherwise it returns true.  This is an undo-able action.

Parameters

layernamethe name of the layer to change the visibility
bVisibletrue/false, whether the layer should be visible

Returns

true if the layer’s visibility was set, false otherwise

+ +

moveSelectedToLayer

this.moveSelectedToLayer = function(layername)

Moves the selected elements to layername.  If the name is not a valid layer name, then false is returned.  Otherwise it returns true.  This is an undo-able action.

Parameters

layernamethe name of the layer you want to which you want to move the selected elements

Returns

true if the selected elements were moved to the layer, false otherwise.

+ +

getLayerOpacity

this.getLayerOpacity = function(layername)

Returns the opacity of the given layer.  If the input name is not a layer, null is returned.

Parameters

layernamename of the layer on which to get the opacity

Returns

The opacity value of the given layer.  This will be a value between 0.0 and 1.0, or null if layername is not a valid layer

+ +

setLayerOpacity

this.setLayerOpacity = function(layername,
opacity)

Sets the opacity of the given layer.  If the input name is not a layer, nothing happens.  This is not an undo-able action.  NOTE: this function exists solely to apply a highlighting/de-emphasis effect to a layer, when it is possible for a user to affect the opacity of a layer, we will need to allow this function to produce an undo-able action.  If opacity is not a value between 0.0 and 1.0, then nothing happens.

Parameters

layernamename of the layer on which to set the opacity
opacitya float value in the range 0.0-1.0
+ +

clear

this.clear = function()

Clears the current document.  This is not an undoable action.

+ +

Fill and Stroke

+ +
+ + + + + + + + + + +
this.clearSelection = function()
Clears the selection.
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
this.open = function(str)
Calls the ‘opened’ handler and sends the SVG XML text.
this.save = function()
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
this.setSvgString = function(xmlString)
This function sets the current drawing as the input SVG XML.
this.createLayer = function(name)
Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.
this.deleteCurrentLayer = function()
Deletes the current layer from the drawing and then clears the selection.
this.getNumLayers = function()
Returns the number of layers in the current drawing.
this.getLayer = function(i)
Returns the name of the ith layer.
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.setCurrentLayer = function(name)
Sets the current layer.
this.renameCurrentLayer = function(newname)
Renames the current layer.
this.setCurrentLayerPosition = function(newpos)
Changes the position of the current layer to the new value.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
this.setLayerVisibility = function(layername,
bVisible)
Sets the visibility of the layer.
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.setLayerOpacity = function(layername,
opacity)
Sets the opacity of the given layer.
this.clear = function()
Clears the current document.
+ + + + + + + + \ No newline at end of file diff --git a/public/svg-edit/docs/index.html b/public/svg-edit/docs/index.html new file mode 100644 index 00000000..635c3177 --- /dev/null +++ b/public/svg-edit/docs/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/svg-edit/docs/index/Files.html b/public/svg-edit/docs/index/Files.html new file mode 100644 index 00000000..6be68e67 --- /dev/null +++ b/public/svg-edit/docs/index/Files.html @@ -0,0 +1,33 @@ + + +File Index + + + + + + + + + +
File Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
S
 svgcanvas.js
+ + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/public/svg-edit/docs/index/Functions.html b/public/svg-edit/docs/index/Functions.html new file mode 100644 index 00000000..05017936 --- /dev/null +++ b/public/svg-edit/docs/index/Functions.html @@ -0,0 +1,61 @@ + + +Function Index + + + + + + + + + +
Function Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
A
 addToSelection
C
 clear
 clearSelection
 createLayer
D
 deleteCurrentLayer
G
 getCurrentLayer
 getLayer
 getLayerOpacity
 getLayerVisibility
 getNumLayers
 getSvgString
M
 moveSelectedToLayer
O
 open
R
 removeFromSelection
 renameCurrentLayer
S
 save
 setCurrentLayer
 setCurrentLayerPosition
 setLayerOpacity
 setLayerVisibility
 setSvgString
+ +
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
+ + + +
this.clear = function()
Clears the current document.
this.clearSelection = function()
Clears the selection.
this.createLayer = function(name)
Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.
+ + + +
this.deleteCurrentLayer = function()
Deletes the current layer from the drawing and then clears the selection.
+ + + +
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.getLayer = function(i)
Returns the name of the ith layer.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
this.getNumLayers = function()
Returns the number of layers in the current drawing.
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
+ + + +
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
+ + + +
this.open = function(str)
Calls the ‘opened’ handler and sends the SVG XML text.
+ + + +
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
this.renameCurrentLayer = function(newname)
Renames the current layer.
+ + + +
this.save = function()
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.setCurrentLayer = function(name)
Sets the current layer.
this.setCurrentLayerPosition = function(newpos)
Changes the position of the current layer to the new value.
this.setLayerOpacity = function(layername,
opacity)
Sets the opacity of the given layer.
this.setLayerVisibility = function(layername,
bVisible)
Sets the visibility of the layer.
this.setSvgString = function(xmlString)
This function sets the current drawing as the input SVG XML.
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/public/svg-edit/docs/index/General.html b/public/svg-edit/docs/index/General.html new file mode 100644 index 00000000..f929ee07 --- /dev/null +++ b/public/svg-edit/docs/index/General.html @@ -0,0 +1,69 @@ + + +Index + + + + + + + + + +
Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
A
 addToSelection
C
 clear
 clearSelection
 createLayer
D
 deleteCurrentLayer
F
 Fill and Stroke
G
 getCurrentLayer
 getLayer
 getLayerOpacity
 getLayerVisibility
 getNumLayers
 getSvgString
L
 Layers
M
 moveSelectedToLayer
O
 open
R
 removeFromSelection
 renameCurrentLayer
S
 save
 Selection
 Serialization
 setCurrentLayer
 setCurrentLayerPosition
 setLayerOpacity
 setLayerVisibility
 setSvgString
 svgcanvas.js
+ +
this.addToSelection = function(elemsToAdd,
showGrips)
Adds a list of elements to the selection.
+ + + +
this.clear = function()
Clears the current document.
this.clearSelection = function()
Clears the selection.
this.createLayer = function(name)
Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the ‘changed’ handler.
+ + + +
this.deleteCurrentLayer = function()
Deletes the current layer from the drawing and then clears the selection.
+ + + + + + + +
this.getCurrentLayer = function()
Returns the name of the currently selected layer.
this.getLayer = function(i)
Returns the name of the ith layer.
this.getLayerOpacity = function(layername)
Returns the opacity of the given layer.
this.getLayerVisibility = function(layername)
Returns whether the layer is visible.
this.getNumLayers = function()
Returns the number of layers in the current drawing.
this.getSvgString = function()
Returns the current drawing as raw SVG XML text.
+ + + + + + + +
this.moveSelectedToLayer = function(layername)
Moves the selected elements to layername.
+ + + +
this.open = function(str)
Calls the ‘opened’ handler and sends the SVG XML text.
+ + + +
this.removeFromSelection = function(elemsToRemove)
Removes elements from the selection.
this.renameCurrentLayer = function(newname)
Renames the current layer.
+ + + +
this.save = function()
Serializes the current drawing into SVG XML text and returns it to the ‘saved’ handler.
this.setCurrentLayer = function(name)
Sets the current layer.
this.setCurrentLayerPosition = function(newpos)
Changes the position of the current layer to the new value.
this.setLayerOpacity = function(layername,
opacity)
Sets the opacity of the given layer.
this.setLayerVisibility = function(layername,
bVisible)
Sets the visibility of the layer.
this.setSvgString = function(xmlString)
This function sets the current drawing as the input SVG XML.
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/public/svg-edit/docs/javascript/main.js b/public/svg-edit/docs/javascript/main.js new file mode 100644 index 00000000..efcdca96 --- /dev/null +++ b/public/svg-edit/docs/javascript/main.js @@ -0,0 +1,836 @@ +// This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL + + +// +// Browser Styles +// ____________________________________________________________________________ + +var agt=navigator.userAgent.toLowerCase(); +var browserType; +var browserVer; + +if (agt.indexOf("opera") != -1) + { + browserType = "Opera"; + + if (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1) + { browserVer = "Opera7"; } + else if (agt.indexOf("opera 8") != -1 || agt.indexOf("opera/8") != -1) + { browserVer = "Opera8"; } + else if (agt.indexOf("opera 9") != -1 || agt.indexOf("opera/9") != -1) + { browserVer = "Opera9"; } + } + +else if (agt.indexOf("applewebkit") != -1) + { + browserType = "Safari"; + + if (agt.indexOf("version/3") != -1) + { browserVer = "Safari3"; } + else if (agt.indexOf("safari/4") != -1) + { browserVer = "Safari2"; } + } + +else if (agt.indexOf("khtml") != -1) + { + browserType = "Konqueror"; + } + +else if (agt.indexOf("msie") != -1) + { + browserType = "IE"; + + if (agt.indexOf("msie 6") != -1) + { browserVer = "IE6"; } + else if (agt.indexOf("msie 7") != -1) + { browserVer = "IE7"; } + } + +else if (agt.indexOf("gecko") != -1) + { + browserType = "Firefox"; + + if (agt.indexOf("rv:1.7") != -1) + { browserVer = "Firefox1"; } + else if (agt.indexOf("rv:1.8)") != -1 || agt.indexOf("rv:1.8.0") != -1) + { browserVer = "Firefox15"; } + else if (agt.indexOf("rv:1.8.1") != -1) + { browserVer = "Firefox2"; } + } + + +// +// Support Functions +// ____________________________________________________________________________ + + +function GetXPosition(item) + { + var position = 0; + + if (item.offsetWidth != null) + { + while (item != document.body && item != null) + { + position += item.offsetLeft; + item = item.offsetParent; + }; + }; + + return position; + }; + + +function GetYPosition(item) + { + var position = 0; + + if (item.offsetWidth != null) + { + while (item != document.body && item != null) + { + position += item.offsetTop; + item = item.offsetParent; + }; + }; + + return position; + }; + + +function MoveToPosition(item, x, y) + { + // Opera 5 chokes on the px extension, so it can use the Microsoft one instead. + + if (item.style.left != null) + { + item.style.left = x + "px"; + item.style.top = y + "px"; + } + else if (item.style.pixelLeft != null) + { + item.style.pixelLeft = x; + item.style.pixelTop = y; + }; + }; + + +// +// Menu +// ____________________________________________________________________________ + + +function ToggleMenu(id) + { + if (!window.document.getElementById) + { return; }; + + var display = window.document.getElementById(id).style.display; + + if (display == "none") + { display = "block"; } + else + { display = "none"; } + + window.document.getElementById(id).style.display = display; + } + +function HideAllBut(ids, max) + { + if (document.getElementById) + { + ids.sort( function(a,b) { return a - b; } ); + var number = 1; + + while (number < max) + { + if (ids.length > 0 && number == ids[0]) + { ids.shift(); } + else + { + document.getElementById("MGroupContent" + number).style.display = "none"; + }; + + number++; + }; + }; + } + + +// +// Tooltips +// ____________________________________________________________________________ + + +var tooltipTimer = 0; + +function ShowTip(event, tooltipID, linkID) + { + if (tooltipTimer) + { clearTimeout(tooltipTimer); }; + + var docX = event.clientX + window.pageXOffset; + var docY = event.clientY + window.pageYOffset; + + var showCommand = "ReallyShowTip('" + tooltipID + "', '" + linkID + "', " + docX + ", " + docY + ")"; + + tooltipTimer = setTimeout(showCommand, 1000); + } + +function ReallyShowTip(tooltipID, linkID, docX, docY) + { + tooltipTimer = 0; + + var tooltip; + var link; + + if (document.getElementById) + { + tooltip = document.getElementById(tooltipID); + link = document.getElementById(linkID); + } +/* else if (document.all) + { + tooltip = eval("document.all['" + tooltipID + "']"); + link = eval("document.all['" + linkID + "']"); + } +*/ + if (tooltip) + { + var left = GetXPosition(link); + var top = GetYPosition(link); + top += link.offsetHeight; + + + // The fallback method is to use the mouse X and Y relative to the document. We use a separate if and test if its a number + // in case some browser snuck through the above if statement but didn't support everything. + + if (!isFinite(top) || top == 0) + { + left = docX; + top = docY; + } + + // Some spacing to get it out from under the cursor. + + top += 10; + + // Make sure the tooltip doesnt get smushed by being too close to the edge, or in some browsers, go off the edge of the + // page. We do it here because Konqueror does get offsetWidth right even if it doesnt get the positioning right. + + if (tooltip.offsetWidth != null) + { + var width = tooltip.offsetWidth; + var docWidth = document.body.clientWidth; + + if (left + width > docWidth) + { left = docWidth - width - 1; } + + // If there's a horizontal scroll bar we could go past zero because it's using the page width, not the window width. + if (left < 0) + { left = 0; }; + } + + MoveToPosition(tooltip, left, top); + tooltip.style.visibility = "visible"; + } + } + +function HideTip(tooltipID) + { + if (tooltipTimer) + { + clearTimeout(tooltipTimer); + tooltipTimer = 0; + } + + var tooltip; + + if (document.getElementById) + { tooltip = document.getElementById(tooltipID); } + else if (document.all) + { tooltip = eval("document.all['" + tooltipID + "']"); } + + if (tooltip) + { tooltip.style.visibility = "hidden"; } + } + + +// +// Blockquote fix for IE +// ____________________________________________________________________________ + + +function NDOnLoad() + { + if (browserVer == "IE6") + { + var scrollboxes = document.getElementsByTagName('blockquote'); + + if (scrollboxes.item(0)) + { + NDDoResize(); + window.onresize=NDOnResize; + }; + }; + }; + + +var resizeTimer = 0; + +function NDOnResize() + { + if (resizeTimer != 0) + { clearTimeout(resizeTimer); }; + + resizeTimer = setTimeout(NDDoResize, 250); + }; + + +function NDDoResize() + { + var scrollboxes = document.getElementsByTagName('blockquote'); + + var i; + var item; + + i = 0; + while (item = scrollboxes.item(i)) + { + item.style.width = 100; + i++; + }; + + i = 0; + while (item = scrollboxes.item(i)) + { + item.style.width = item.parentNode.offsetWidth; + i++; + }; + + clearTimeout(resizeTimer); + resizeTimer = 0; + } + + + +/* ________________________________________________________________________________________________________ + + Class: SearchPanel + ________________________________________________________________________________________________________ + + A class handling everything associated with the search panel. + + Parameters: + + name - The name of the global variable that will be storing this instance. Is needed to be able to set timeouts. + mode - The mode the search is going to work in. Pass CommandLineOption()>, so the + value will be something like "HTML" or "FramedHTML". + + ________________________________________________________________________________________________________ +*/ + + +function SearchPanel(name, mode, resultsPath) + { + if (!name || !mode || !resultsPath) + { alert("Incorrect parameters to SearchPanel."); }; + + + // Group: Variables + // ________________________________________________________________________ + + /* + var: name + The name of the global variable that will be storing this instance of the class. + */ + this.name = name; + + /* + var: mode + The mode the search is going to work in, such as "HTML" or "FramedHTML". + */ + this.mode = mode; + + /* + var: resultsPath + The relative path from the current HTML page to the results page directory. + */ + this.resultsPath = resultsPath; + + /* + var: keyTimeout + The timeout used between a keystroke and when a search is performed. + */ + this.keyTimeout = 0; + + /* + var: keyTimeoutLength + The length of in thousandths of a second. + */ + this.keyTimeoutLength = 500; + + /* + var: lastSearchValue + The last search string executed, or an empty string if none. + */ + this.lastSearchValue = ""; + + /* + var: lastResultsPage + The last results page. The value is only relevant if is set. + */ + this.lastResultsPage = ""; + + /* + var: deactivateTimeout + + The timeout used between when a control is deactivated and when the entire panel is deactivated. Is necessary + because a control may be deactivated in favor of another control in the same panel, in which case it should stay + active. + */ + this.deactivateTimout = 0; + + /* + var: deactivateTimeoutLength + The length of in thousandths of a second. + */ + this.deactivateTimeoutLength = 200; + + + + + // Group: DOM Elements + // ________________________________________________________________________ + + + // Function: DOMSearchField + this.DOMSearchField = function() + { return document.getElementById("MSearchField"); }; + + // Function: DOMSearchType + this.DOMSearchType = function() + { return document.getElementById("MSearchType"); }; + + // Function: DOMPopupSearchResults + this.DOMPopupSearchResults = function() + { return document.getElementById("MSearchResults"); }; + + // Function: DOMPopupSearchResultsWindow + this.DOMPopupSearchResultsWindow = function() + { return document.getElementById("MSearchResultsWindow"); }; + + // Function: DOMSearchPanel + this.DOMSearchPanel = function() + { return document.getElementById("MSearchPanel"); }; + + + + + // Group: Event Handlers + // ________________________________________________________________________ + + + /* + Function: OnSearchFieldFocus + Called when focus is added or removed from the search field. + */ + this.OnSearchFieldFocus = function(isActive) + { + this.Activate(isActive); + }; + + + /* + Function: OnSearchFieldChange + Called when the content of the search field is changed. + */ + this.OnSearchFieldChange = function() + { + if (this.keyTimeout) + { + clearTimeout(this.keyTimeout); + this.keyTimeout = 0; + }; + + var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + + if (searchValue != this.lastSearchValue) + { + if (searchValue != "") + { + this.keyTimeout = setTimeout(this.name + ".Search()", this.keyTimeoutLength); + } + else + { + if (this.mode == "HTML") + { this.DOMPopupSearchResultsWindow().style.display = "none"; }; + this.lastSearchValue = ""; + }; + }; + }; + + + /* + Function: OnSearchTypeFocus + Called when focus is added or removed from the search type. + */ + this.OnSearchTypeFocus = function(isActive) + { + this.Activate(isActive); + }; + + + /* + Function: OnSearchTypeChange + Called when the search type is changed. + */ + this.OnSearchTypeChange = function() + { + var searchValue = this.DOMSearchField().value.replace(/ +/g, ""); + + if (searchValue != "") + { + this.Search(); + }; + }; + + + + // Group: Action Functions + // ________________________________________________________________________ + + + /* + Function: CloseResultsWindow + Closes the results window. + */ + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = "none"; + this.Activate(false, true); + }; + + + /* + Function: Search + Performs a search. + */ + this.Search = function() + { + this.keyTimeout = 0; + + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + var searchTopic = this.DOMSearchType().value; + + var pageExtension = searchValue.substr(0,1); + + if (pageExtension.match(/^[a-z]/i)) + { pageExtension = pageExtension.toUpperCase(); } + else if (pageExtension.match(/^[0-9]/)) + { pageExtension = 'Numbers'; } + else + { pageExtension = "Symbols"; }; + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + // indexSectionsWithContent is defined in searchdata.js + if (indexSectionsWithContent[searchTopic][pageExtension] == true) + { + resultsPage = this.resultsPath + '/' + searchTopic + pageExtension + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else + { + resultsPage = this.resultsPath + '/NoResults.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + }; + + var resultsFrame; + if (this.mode == "HTML") + { resultsFrame = window.frames.MSearchResults; } + else if (this.mode == "FramedHTML") + { resultsFrame = window.top.frames['Content']; }; + + + if (resultsPage != this.lastResultsPage || + + // Bug in IE. If everything becomes hidden in a run, none of them will be able to be reshown in the next for some + // reason. It counts the right number of results, and you can even read the display as "block" after setting it, but it + // just doesn't work in IE 6 or IE 7. So if we're on the right page but the previous search had no results, reload the + // page anyway to get around the bug. + (browserType == "IE" && hasResultsPage && + (!resultsFrame.searchResults || resultsFrame.searchResults.lastMatchCount == 0)) ) + + { + resultsFrame.location.href = resultsPageWithSearch; + } + + // So if the results page is right and there's no IE bug, reperform the search on the existing page. We have to check if there + // are results because NoResults.html doesn't have any JavaScript, and it would be useless to do anything on that page even + // if it did. + else if (hasResultsPage) + { + // We need to check if this exists in case the frame is present but didn't finish loading. + if (resultsFrame.searchResults) + { resultsFrame.searchResults.Search(searchValue); } + + // Otherwise just reload instead of waiting. + else + { resultsFrame.location.href = resultsPageWithSearch; }; + }; + + + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (this.mode == "HTML" && domPopupSearchResultsWindow.style.display != "block") + { + var domSearchType = this.DOMSearchType(); + + var left = GetXPosition(domSearchType); + var top = GetYPosition(domSearchType) + domSearchType.offsetHeight; + + MoveToPosition(domPopupSearchResultsWindow, left, top); + domPopupSearchResultsWindow.style.display = 'block'; + }; + + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + }; + + + + // Group: Activation Functions + // Functions that handle whether the entire panel is active or not. + // ________________________________________________________________________ + + + /* + Function: Activate + + Activates or deactivates the search panel, resetting things to their default values if necessary. You can call this on every + control's OnBlur() and it will handle not deactivating the entire panel when focus is just switching between them transparently. + + Parameters: + + isActive - Whether you're activating or deactivating the panel. + ignoreDeactivateDelay - Set if you're positive the action will deactivate the panel and thus want to skip the delay. + */ + this.Activate = function(isActive, ignoreDeactivateDelay) + { + // We want to ignore isActive being false while the results window is open. + if (isActive || (this.mode == "HTML" && this.DOMPopupSearchResultsWindow().style.display == "block")) + { + if (this.inactivateTimeout) + { + clearTimeout(this.inactivateTimeout); + this.inactivateTimeout = 0; + }; + + this.DOMSearchPanel().className = 'MSearchPanelActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == 'Search') + { searchField.value = ""; } + } + else if (!ignoreDeactivateDelay) + { + this.inactivateTimeout = setTimeout(this.name + ".InactivateAfterTimeout()", this.inactivateTimeoutLength); + } + else + { + this.InactivateAfterTimeout(); + }; + }; + + + /* + Function: InactivateAfterTimeout + + Called by , which is set by . Inactivation occurs on a timeout because a control may + receive OnBlur() when focus is really transferring to another control in the search panel. In this case we don't want to + actually deactivate the panel because not only would that cause a visible flicker but it could also reset the search value. + So by doing it on a timeout instead, there's a short period where the second control's OnFocus() can cancel the deactivation. + */ + this.InactivateAfterTimeout = function() + { + this.inactivateTimeout = 0; + + this.DOMSearchPanel().className = 'MSearchPanelInactive'; + this.DOMSearchField().value = "Search"; + + this.lastSearchValue = ""; + this.lastResultsPage = ""; + }; + }; + + + + +/* ________________________________________________________________________________________________________ + + Class: SearchResults + _________________________________________________________________________________________________________ + + The class that handles everything on the search results page. + _________________________________________________________________________________________________________ +*/ + + +function SearchResults(name, mode) + { + /* + var: mode + The mode the search is going to work in, such as "HTML" or "FramedHTML". + */ + this.mode = mode; + + /* + var: lastMatchCount + The number of matches from the last run of . + */ + this.lastMatchCount = 0; + + + /* + Function: Toggle + Toggles the visibility of the passed element ID. + */ + this.Toggle = function(id) + { + if (this.mode == "FramedHTML") + { return; }; + + var parentElement = document.getElementById(id); + + var element = parentElement.firstChild; + + while (element && element != parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'ISubIndex') + { + if (element.style.display == 'block') + { element.style.display = "none"; } + else + { element.style.display = 'block'; } + }; + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { element = element.firstChild; } + else if (element.nextSibling) + { element = element.nextSibling; } + else + { + do + { + element = element.parentNode; + } + while (element && element != parentElement && !element.nextSibling); + + if (element && element != parentElement) + { element = element.nextSibling; }; + }; + }; + }; + + + /* + Function: Search + + Searches for the passed string. If there is no parameter, it takes it from the URL query. + + Always returns true, since other documents may try to call it and that may or may not be possible. + */ + this.Search = function(search) + { + if (!search) + { + search = window.location.search; + search = search.substring(1); // Remove the leading ? + search = unescape(search); + }; + + search = search.replace(/^ +/, ""); + search = search.replace(/ +$/, ""); + search = search.toLowerCase(); + + if (search.match(/[^a-z0-9]/)) // Just a little speedup so it doesn't have to go through the below unnecessarily. + { + search = search.replace(/\_/g, "_und"); + search = search.replace(/\ +/gi, "_spc"); + search = search.replace(/\~/g, "_til"); + search = search.replace(/\!/g, "_exc"); + search = search.replace(/\@/g, "_att"); + search = search.replace(/\#/g, "_num"); + search = search.replace(/\$/g, "_dol"); + search = search.replace(/\%/g, "_pct"); + search = search.replace(/\^/g, "_car"); + search = search.replace(/\&/g, "_amp"); + search = search.replace(/\*/g, "_ast"); + search = search.replace(/\(/g, "_lpa"); + search = search.replace(/\)/g, "_rpa"); + search = search.replace(/\-/g, "_min"); + search = search.replace(/\+/g, "_plu"); + search = search.replace(/\=/g, "_equ"); + search = search.replace(/\{/g, "_lbc"); + search = search.replace(/\}/g, "_rbc"); + search = search.replace(/\[/g, "_lbk"); + search = search.replace(/\]/g, "_rbk"); + search = search.replace(/\:/g, "_col"); + search = search.replace(/\;/g, "_sco"); + search = search.replace(/\"/g, "_quo"); + search = search.replace(/\'/g, "_apo"); + search = search.replace(/\/g, "_ran"); + search = search.replace(/\,/g, "_com"); + search = search.replace(/\./g, "_per"); + search = search.replace(/\?/g, "_que"); + search = search.replace(/\//g, "_sla"); + search = search.replace(/[^a-z0-9\_]i/gi, "_zzz"); + }; + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); + + if (search.length <= rowMatchName.length && rowMatchName.substr(0, search.length) == search) + { + row.style.display = "block"; + matches++; + } + else + { row.style.display = "none"; }; + }; + + i++; + }; + + document.getElementById("Searching").style.display="none"; + + if (matches == 0) + { document.getElementById("NoMatches").style.display="block"; } + else + { document.getElementById("NoMatches").style.display="none"; } + + this.lastMatchCount = matches; + + return true; + }; + }; + diff --git a/public/svg-edit/docs/javascript/searchdata.js b/public/svg-edit/docs/javascript/searchdata.js new file mode 100644 index 00000000..ba97c181 --- /dev/null +++ b/public/svg-edit/docs/javascript/searchdata.js @@ -0,0 +1,92 @@ +var indexSectionsWithContent = { + "General": { + "Symbols": false, + "Numbers": false, + "A": false, + "B": false, + "C": true, + "D": true, + "E": false, + "F": true, + "G": true, + "H": false, + "I": false, + "J": false, + "K": false, + "L": false, + "M": false, + "N": false, + "O": false, + "P": false, + "Q": false, + "R": false, + "S": true, + "T": false, + "U": false, + "V": false, + "W": false, + "X": false, + "Y": false, + "Z": false + }, + "Functions": { + "Symbols": false, + "Numbers": false, + "A": true, + "B": false, + "C": true, + "D": true, + "E": false, + "F": false, + "G": true, + "H": false, + "I": false, + "J": false, + "K": false, + "L": false, + "M": true, + "N": false, + "O": true, + "P": false, + "Q": false, + "R": true, + "S": true, + "T": false, + "U": false, + "V": false, + "W": false, + "X": false, + "Y": false, + "Z": false + }, + "Files": { + "Symbols": false, + "Numbers": false, + "A": false, + "B": false, + "C": false, + "D": false, + "E": false, + "F": false, + "G": false, + "H": false, + "I": false, + "J": false, + "K": false, + "L": false, + "M": false, + "N": false, + "O": false, + "P": false, + "Q": false, + "R": false, + "S": true, + "T": false, + "U": false, + "V": false, + "W": false, + "X": false, + "Y": false, + "Z": false + } + } \ No newline at end of file diff --git a/public/svg-edit/docs/search/FilesS.html b/public/svg-edit/docs/search/FilesS.html new file mode 100644 index 00000000..a8c4e958 --- /dev/null +++ b/public/svg-edit/docs/search/FilesS.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsA.html b/public/svg-edit/docs/search/FunctionsA.html new file mode 100644 index 00000000..6e5d1c8a --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsA.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsC.html b/public/svg-edit/docs/search/FunctionsC.html new file mode 100644 index 00000000..82dc6c82 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsC.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsD.html b/public/svg-edit/docs/search/FunctionsD.html new file mode 100644 index 00000000..9ec2a931 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsD.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsG.html b/public/svg-edit/docs/search/FunctionsG.html new file mode 100644 index 00000000..aa992db2 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsG.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsM.html b/public/svg-edit/docs/search/FunctionsM.html new file mode 100644 index 00000000..6fd8b399 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsM.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsO.html b/public/svg-edit/docs/search/FunctionsO.html new file mode 100644 index 00000000..76f92f65 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsO.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsR.html b/public/svg-edit/docs/search/FunctionsR.html new file mode 100644 index 00000000..6ac35c73 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsR.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/FunctionsS.html b/public/svg-edit/docs/search/FunctionsS.html new file mode 100644 index 00000000..4e983e92 --- /dev/null +++ b/public/svg-edit/docs/search/FunctionsS.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralA.html b/public/svg-edit/docs/search/GeneralA.html new file mode 100644 index 00000000..6e5d1c8a --- /dev/null +++ b/public/svg-edit/docs/search/GeneralA.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralC.html b/public/svg-edit/docs/search/GeneralC.html new file mode 100644 index 00000000..82dc6c82 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralC.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralD.html b/public/svg-edit/docs/search/GeneralD.html new file mode 100644 index 00000000..9ec2a931 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralD.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralF.html b/public/svg-edit/docs/search/GeneralF.html new file mode 100644 index 00000000..02eed885 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralF.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralG.html b/public/svg-edit/docs/search/GeneralG.html new file mode 100644 index 00000000..aa992db2 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralG.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralL.html b/public/svg-edit/docs/search/GeneralL.html new file mode 100644 index 00000000..010b70c0 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralL.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralM.html b/public/svg-edit/docs/search/GeneralM.html new file mode 100644 index 00000000..6fd8b399 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralM.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralO.html b/public/svg-edit/docs/search/GeneralO.html new file mode 100644 index 00000000..76f92f65 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralO.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralR.html b/public/svg-edit/docs/search/GeneralR.html new file mode 100644 index 00000000..6ac35c73 --- /dev/null +++ b/public/svg-edit/docs/search/GeneralR.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/GeneralS.html b/public/svg-edit/docs/search/GeneralS.html new file mode 100644 index 00000000..dadec1af --- /dev/null +++ b/public/svg-edit/docs/search/GeneralS.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
Loading...
Searching...
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/search/NoResults.html b/public/svg-edit/docs/search/NoResults.html new file mode 100644 index 00000000..02ce8886 --- /dev/null +++ b/public/svg-edit/docs/search/NoResults.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + +
No Matches
\ No newline at end of file diff --git a/public/svg-edit/docs/styles/main.css b/public/svg-edit/docs/styles/main.css new file mode 100644 index 00000000..17e9cbc3 --- /dev/null +++ b/public/svg-edit/docs/styles/main.css @@ -0,0 +1,767 @@ +/* + IMPORTANT: If you're editing this file in the output directory of one of + your projects, your changes will be overwritten the next time you run + Natural Docs. Instead, copy this file to your project directory, make your + changes, and you can use it with -s. Even better would be to make a CSS + file in your project directory with only your changes, which you can then + use with -s [original style] [your changes]. + + On the other hand, if you're editing this file in the Natural Docs styles + directory, the changes will automatically be applied to all your projects + that use this style the next time Natural Docs is run on them. + + This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure + Natural Docs is licensed under the GPL +*/ + +body { + font: 10pt Verdana, Arial, sans-serif; + color: #000000; + margin: 0; padding: 0; + } + +.ContentPage, +.IndexPage, +.FramedMenuPage { + background-color: #E8E8E8; + } +.FramedContentPage, +.FramedIndexPage, +.FramedSearchResultsPage, +.PopupSearchResultsPage { + background-color: #FFFFFF; + } + + +a:link, +a:visited { color: #900000; text-decoration: none } +a:hover { color: #900000; text-decoration: underline } +a:active { color: #FF0000; text-decoration: underline } + +td { + vertical-align: top } + +img { border: 0; } + + +/* + Comment out this line to use web-style paragraphs (blank line between + paragraphs, no indent) instead of print-style paragraphs (no blank line, + indented.) +*/ +p { + text-indent: 5ex; margin: 0 } + + +/* Opera doesn't break with just wbr, but will if you add this. */ +.Opera wbr:after { + content: "\00200B"; + } + + +/* Blockquotes are used as containers for things that may need to scroll. */ +blockquote { + padding: 0; + margin: 0; + overflow: auto; + } + + +.Firefox1 blockquote { + padding-bottom: .5em; + } + +/* Turn off scrolling when printing. */ +@media print { + blockquote { + overflow: visible; + } + .IE blockquote { + width: auto; + } + } + + + +#Menu { + font-size: 9pt; + padding: 10px 0 0 0; + } +.ContentPage #Menu, +.IndexPage #Menu { + position: absolute; + top: 0; + left: 0; + width: 31ex; + overflow: hidden; + } +.ContentPage .Firefox #Menu, +.IndexPage .Firefox #Menu { + width: 27ex; + } + + + .MTitle { + font-size: 16pt; font-weight: bold; font-variant: small-caps; + text-align: center; + padding: 5px 10px 15px 10px; + border-bottom: 1px dotted #000000; + margin-bottom: 15px } + + .MSubTitle { + font-size: 9pt; font-weight: normal; font-variant: normal; + margin-top: 1ex; margin-bottom: 5px } + + + .MEntry a:link, + .MEntry a:hover, + .MEntry a:visited { color: #606060; margin-right: 0 } + .MEntry a:active { color: #A00000; margin-right: 0 } + + + .MGroup { + font-variant: small-caps; font-weight: bold; + margin: 1em 0 1em 10px; + } + + .MGroupContent { + font-variant: normal; font-weight: normal } + + .MGroup a:link, + .MGroup a:hover, + .MGroup a:visited { color: #545454; margin-right: 10px } + .MGroup a:active { color: #A00000; margin-right: 10px } + + + .MFile, + .MText, + .MLink, + .MIndex { + padding: 1px 17px 2px 10px; + margin: .25em 0 .25em 0; + } + + .MText { + font-size: 8pt; font-style: italic } + + .MLink { + font-style: italic } + + #MSelected { + color: #000000; background-color: #FFFFFF; + /* Replace padding with border. */ + padding: 0 10px 0 10px; + border-width: 1px 2px 2px 0; border-style: solid; border-color: #000000; + margin-right: 5px; + } + + /* Close off the left side when its in a group. */ + .MGroup #MSelected { + padding-left: 9px; border-left-width: 1px } + + /* A treat for Mozilla users. Blatantly non-standard. Will be replaced with CSS 3 attributes when finalized/supported. */ + .Firefox #MSelected { + -moz-border-radius-topright: 10px; + -moz-border-radius-bottomright: 10px } + .Firefox .MGroup #MSelected { + -moz-border-radius-topleft: 10px; + -moz-border-radius-bottomleft: 10px } + + + #MSearchPanel { + padding: 0px 6px; + margin: .25em 0; + } + + + #MSearchField { + font: italic 9pt Verdana, sans-serif; + color: #606060; + background-color: #E8E8E8; + border: none; + padding: 2px 4px; + width: 100%; + } + /* Only Opera gets it right. */ + .Firefox #MSearchField, + .IE #MSearchField, + .Safari #MSearchField { + width: 94%; + } + .Opera9 #MSearchField, + .Konqueror #MSearchField { + width: 97%; + } + .FramedMenuPage .Firefox #MSearchField, + .FramedMenuPage .Safari #MSearchField, + .FramedMenuPage .Konqueror #MSearchField { + width: 98%; + } + + /* Firefox doesn't do this right in frames without #MSearchPanel added on. + It's presence doesn't hurt anything other browsers. */ + #MSearchPanel.MSearchPanelInactive:hover #MSearchField { + background-color: #FFFFFF; + border: 1px solid #C0C0C0; + padding: 1px 3px; + } + .MSearchPanelActive #MSearchField { + background-color: #FFFFFF; + border: 1px solid #C0C0C0; + font-style: normal; + padding: 1px 3px; + } + + #MSearchType { + visibility: hidden; + font: 8pt Verdana, sans-serif; + width: 98%; + padding: 0; + border: 1px solid #C0C0C0; + } + .MSearchPanelActive #MSearchType, + /* As mentioned above, Firefox doesn't do this right in frames without #MSearchPanel added on. */ + #MSearchPanel.MSearchPanelInactive:hover #MSearchType, + #MSearchType:focus { + visibility: visible; + color: #606060; + } + #MSearchType option#MSearchEverything { + font-weight: bold; + } + + .Opera8 .MSearchPanelInactive:hover, + .Opera8 .MSearchPanelActive { + margin-left: -1px; + } + + + iframe#MSearchResults { + width: 60ex; + height: 15em; + } + #MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000000; + background-color: #E8E8E8; + } + #MSearchResultsWindowClose { + font-weight: bold; + font-size: 8pt; + display: block; + padding: 2px 5px; + } + #MSearchResultsWindowClose:link, + #MSearchResultsWindowClose:visited { + color: #000000; + text-decoration: none; + } + #MSearchResultsWindowClose:active, + #MSearchResultsWindowClose:hover { + color: #800000; + text-decoration: none; + background-color: #F4F4F4; + } + + + + +#Content { + padding-bottom: 15px; + } + +.ContentPage #Content { + border-width: 0 0 1px 1px; + border-style: solid; + border-color: #000000; + background-color: #FFFFFF; + font-size: 9pt; /* To make 31ex match the menu's 31ex. */ + margin-left: 31ex; + } +.ContentPage .Firefox #Content { + margin-left: 27ex; + } + + + + .CTopic { + font-size: 10pt; + margin-bottom: 3em; + } + + + .CTitle { + font-size: 12pt; font-weight: bold; + border-width: 0 0 1px 0; border-style: solid; border-color: #A0A0A0; + margin: 0 15px .5em 15px } + + .CGroup .CTitle { + font-size: 16pt; font-variant: small-caps; + padding-left: 15px; padding-right: 15px; + border-width: 0 0 2px 0; border-color: #000000; + margin-left: 0; margin-right: 0 } + + .CClass .CTitle, + .CInterface .CTitle, + .CDatabase .CTitle, + .CDatabaseTable .CTitle, + .CSection .CTitle { + font-size: 18pt; + color: #FFFFFF; background-color: #A0A0A0; + padding: 10px 15px 10px 15px; + border-width: 2px 0; border-color: #000000; + margin-left: 0; margin-right: 0 } + + #MainTopic .CTitle { + font-size: 20pt; + color: #FFFFFF; background-color: #7070C0; + padding: 10px 15px 10px 15px; + border-width: 0 0 3px 0; border-color: #000000; + margin-left: 0; margin-right: 0 } + + .CBody { + margin-left: 15px; margin-right: 15px } + + + .CToolTip { + position: absolute; visibility: hidden; + left: 0; top: 0; + background-color: #FFFFE0; + padding: 5px; + border-width: 1px 2px 2px 1px; border-style: solid; border-color: #000000; + font-size: 8pt; + } + + .Opera .CToolTip { + max-width: 98%; + } + + /* Scrollbars would be useless. */ + .CToolTip blockquote { + overflow: hidden; + } + .IE6 .CToolTip blockquote { + overflow: visible; + } + + .CHeading { + font-weight: bold; font-size: 10pt; + margin: 1.5em 0 .5em 0; + } + + .CBody pre { + font: 10pt "Courier New", Courier, monospace; + margin: 1em 0; + } + + .CBody ul { + /* I don't know why CBody's margin doesn't apply, but it's consistent across browsers so whatever. + Reapply it here as padding. */ + padding-left: 15px; padding-right: 15px; + margin: .5em 5ex .5em 5ex; + } + + .CDescriptionList { + margin: .5em 5ex 0 5ex } + + .CDLEntry { + font: 10pt "Courier New", Courier, monospace; color: #808080; + padding-bottom: .25em; + white-space: nowrap } + + .CDLDescription { + font-size: 10pt; /* For browsers that don't inherit correctly, like Opera 5. */ + padding-bottom: .5em; padding-left: 5ex } + + + .CTopic img { + text-align: center; + display: block; + margin: 1em auto; + } + .CImageCaption { + font-variant: small-caps; + font-size: 8pt; + color: #808080; + text-align: center; + position: relative; + top: 1em; + } + + .CImageLink { + color: #808080; + font-style: italic; + } + a.CImageLink:link, + a.CImageLink:visited, + a.CImageLink:hover { color: #808080 } + + + + + +.Prototype { + font: 10pt "Courier New", Courier, monospace; + padding: 5px 3ex; + border-width: 1px; border-style: solid; + margin: 0 5ex 1.5em 5ex; + } + + .Prototype td { + font-size: 10pt; + } + + .PDefaultValue, + .PDefaultValuePrefix, + .PTypePrefix { + color: #8F8F8F; + } + .PTypePrefix { + text-align: right; + } + .PAfterParameters { + vertical-align: bottom; + } + + .IE .Prototype table { + padding: 0; + } + + .CFunction .Prototype { + background-color: #F4F4F4; border-color: #D0D0D0 } + .CProperty .Prototype { + background-color: #F4F4FF; border-color: #C0C0E8 } + .CVariable .Prototype { + background-color: #FFFFF0; border-color: #E0E0A0 } + + .CClass .Prototype { + border-width: 1px 2px 2px 1px; border-style: solid; border-color: #A0A0A0; + background-color: #F4F4F4; + } + .CInterface .Prototype { + border-width: 1px 2px 2px 1px; border-style: solid; border-color: #A0A0D0; + background-color: #F4F4FF; + } + + .CDatabaseIndex .Prototype, + .CConstant .Prototype { + background-color: #D0D0D0; border-color: #000000 } + .CType .Prototype, + .CEnumeration .Prototype { + background-color: #FAF0F0; border-color: #E0B0B0; + } + .CDatabaseTrigger .Prototype, + .CEvent .Prototype, + .CDelegate .Prototype { + background-color: #F0FCF0; border-color: #B8E4B8 } + + .CToolTip .Prototype { + margin: 0 0 .5em 0; + white-space: nowrap; + } + + + + + +.Summary { + margin: 1.5em 5ex 0 5ex } + + .STitle { + font-size: 12pt; font-weight: bold; + margin-bottom: .5em } + + + .SBorder { + background-color: #FFFFF0; + padding: 15px; + border: 1px solid #C0C060 } + + /* In a frame IE 6 will make them too long unless you set the width to 100%. Without frames it will be correct without a width + or slightly too long (but not enough to scroll) with a width. This arbitrary weirdness simply astounds me. IE 7 has the same + problem with frames, haven't tested it without. */ + .FramedContentPage .IE .SBorder { + width: 100% } + + /* A treat for Mozilla users. Blatantly non-standard. Will be replaced with CSS 3 attributes when finalized/supported. */ + .Firefox .SBorder { + -moz-border-radius: 20px } + + + .STable { + font-size: 9pt; width: 100% } + + .SEntry { + width: 30% } + .SDescription { + width: 70% } + + + .SMarked { + background-color: #F8F8D8 } + + .SDescription { padding-left: 2ex } + .SIndent1 .SEntry { padding-left: 1.5ex } .SIndent1 .SDescription { padding-left: 3.5ex } + .SIndent2 .SEntry { padding-left: 3.0ex } .SIndent2 .SDescription { padding-left: 5.0ex } + .SIndent3 .SEntry { padding-left: 4.5ex } .SIndent3 .SDescription { padding-left: 6.5ex } + .SIndent4 .SEntry { padding-left: 6.0ex } .SIndent4 .SDescription { padding-left: 8.0ex } + .SIndent5 .SEntry { padding-left: 7.5ex } .SIndent5 .SDescription { padding-left: 9.5ex } + + .SDescription a { color: #800000} + .SDescription a:active { color: #A00000 } + + .SGroup td { + padding-top: .5em; padding-bottom: .25em } + + .SGroup .SEntry { + font-weight: bold; font-variant: small-caps } + + .SGroup .SEntry a { color: #800000 } + .SGroup .SEntry a:active { color: #F00000 } + + + .SMain td, + .SClass td, + .SDatabase td, + .SDatabaseTable td, + .SSection td { + font-size: 10pt; + padding-bottom: .25em } + + .SClass td, + .SDatabase td, + .SDatabaseTable td, + .SSection td { + padding-top: 1em } + + .SMain .SEntry, + .SClass .SEntry, + .SDatabase .SEntry, + .SDatabaseTable .SEntry, + .SSection .SEntry { + font-weight: bold; + } + + .SMain .SEntry a, + .SClass .SEntry a, + .SDatabase .SEntry a, + .SDatabaseTable .SEntry a, + .SSection .SEntry a { color: #000000 } + + .SMain .SEntry a:active, + .SClass .SEntry a:active, + .SDatabase .SEntry a:active, + .SDatabaseTable .SEntry a:active, + .SSection .SEntry a:active { color: #A00000 } + + + + + +.ClassHierarchy { + margin: 0 15px 1em 15px } + + .CHEntry { + border-width: 1px 2px 2px 1px; border-style: solid; border-color: #A0A0A0; + margin-bottom: 3px; + padding: 2px 2ex; + font-size: 10pt; + background-color: #F4F4F4; color: #606060; + } + + .Firefox .CHEntry { + -moz-border-radius: 4px; + } + + .CHCurrent .CHEntry { + font-weight: bold; + border-color: #000000; + color: #000000; + } + + .CHChildNote .CHEntry { + font-style: italic; + font-size: 8pt; + } + + .CHIndent { + margin-left: 3ex; + } + + .CHEntry a:link, + .CHEntry a:visited, + .CHEntry a:hover { + color: #606060; + } + .CHEntry a:active { + color: #800000; + } + + + + + +#Index { + background-color: #FFFFFF; + } + +/* As opposed to .PopupSearchResultsPage #Index */ +.IndexPage #Index, +.FramedIndexPage #Index, +.FramedSearchResultsPage #Index { + padding: 15px; + } + +.IndexPage #Index { + border-width: 0 0 1px 1px; + border-style: solid; + border-color: #000000; + font-size: 9pt; /* To make 27ex match the menu's 27ex. */ + margin-left: 27ex; + } + + + .IPageTitle { + font-size: 20pt; font-weight: bold; + color: #FFFFFF; background-color: #7070C0; + padding: 10px 15px 10px 15px; + border-width: 0 0 3px 0; border-color: #000000; border-style: solid; + margin: -15px -15px 0 -15px } + + .FramedSearchResultsPage .IPageTitle { + margin-bottom: 15px; + } + + .INavigationBar { + font-size: 10pt; + text-align: center; + background-color: #FFFFF0; + padding: 5px; + border-bottom: solid 1px black; + margin: 0 -15px 15px -15px; + } + + .INavigationBar a { + font-weight: bold } + + .IHeading { + font-size: 16pt; font-weight: bold; + padding: 2.5em 0 .5em 0; + text-align: center; + width: 3.5ex; + } + #IFirstHeading { + padding-top: 0; + } + + .IEntry { + font-size: 10pt; + padding-left: 1ex; + } + .PopupSearchResultsPage .IEntry { + font-size: 8pt; + padding: 1px 5px; + } + .PopupSearchResultsPage .Opera9 .IEntry, + .FramedSearchResultsPage .Opera9 .IEntry { + text-align: left; + } + .FramedSearchResultsPage .IEntry { + padding: 0; + } + + .ISubIndex { + padding-left: 3ex; padding-bottom: .5em } + .PopupSearchResultsPage .ISubIndex { + display: none; + } + + /* While it may cause some entries to look like links when they aren't, I found it's much easier to read the + index if everything's the same color. */ + .ISymbol { + font-weight: bold; color: #900000 } + + .IndexPage .ISymbolPrefix, + .FramedIndexPage .ISymbolPrefix { + font-size: 10pt; + text-align: right; + color: #C47C7C; + background-color: #F8F8F8; + border-right: 3px solid #E0E0E0; + border-left: 1px solid #E0E0E0; + padding: 0 1px 0 2px; + } + .PopupSearchResultsPage .ISymbolPrefix, + .FramedSearchResultsPage .ISymbolPrefix { + color: #900000; + } + .PopupSearchResultsPage .ISymbolPrefix { + font-size: 8pt; + } + + .IndexPage #IFirstSymbolPrefix, + .FramedIndexPage #IFirstSymbolPrefix { + border-top: 1px solid #E0E0E0; + } + .IndexPage #ILastSymbolPrefix, + .FramedIndexPage #ILastSymbolPrefix { + border-bottom: 1px solid #E0E0E0; + } + .IndexPage #IOnlySymbolPrefix, + .FramedIndexPage #IOnlySymbolPrefix { + border-top: 1px solid #E0E0E0; + border-bottom: 1px solid #E0E0E0; + } + + a.IParent, + a.IFile { + display: block; + } + + .PopupSearchResultsPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; + } + .FramedSearchResultsPage .SRStatus { + font-size: 10pt; + font-style: italic; + } + + .SRResult { + display: none; + } + + + +#Footer { + font-size: 8pt; + color: #989898; + text-align: right; + } + +#Footer p { + text-indent: 0; + margin-bottom: .5em; + } + +.ContentPage #Footer, +.IndexPage #Footer { + text-align: right; + margin: 2px; + } + +.FramedMenuPage #Footer { + text-align: center; + margin: 5em 10px 10px 10px; + padding-top: 1em; + border-top: 1px solid #C8C8C8; + } + + #Footer a:link, + #Footer a:hover, + #Footer a:visited { color: #989898 } + #Footer a:active { color: #A00000 } + diff --git a/public/svg-edit/editor/embedapi.js b/public/svg-edit/editor/embedapi.js new file mode 100644 index 00000000..72b53817 --- /dev/null +++ b/public/svg-edit/editor/embedapi.js @@ -0,0 +1,157 @@ +/* +function embedded_svg_edit(frame){ + //initialize communication + this.frame = frame; + this.stack = []; //callback stack + + var editapi = this; + + window.addEventListener("message", function(e){ + if(e.data.substr(0,5) == "ERROR"){ + editapi.stack.splice(0,1)[0](e.data,"error") + }else{ + editapi.stack.splice(0,1)[0](e.data) + } + }, false) +} + +embedded_svg_edit.prototype.call = function(code, callback){ + this.stack.push(callback); + this.frame.contentWindow.postMessage(code,"*"); +} + +embedded_svg_edit.prototype.getSvgString = function(callback){ + this.call("svgCanvas.getSvgString()",callback) +} + +embedded_svg_edit.prototype.setSvgString = function(svg){ + this.call("svgCanvas.setSvgString('"+svg.replace(/'/g, "\\'")+"')"); +} +*/ + + +/* +Embedded SVG-edit API + +General usage: +- Have an iframe somewhere pointing to a version of svg-edit > r1000 +- Initialize the magic with: +var svgCanvas = new embedded_svg_edit(window.frames['svgedit']); +- Pass functions in this format: +svgCanvas.setSvgString("string") +- Or if a callback is needed: +svgCanvas.setSvgString("string")(function(data, error){ + if(error){ + //there was an error + }else{ + //handle data + } +}) + +Everything is done with the same API as the real svg-edit, +and all documentation is unchanged. The only difference is +when handling returns, the callback notation is used instead. + +var blah = new embedded_svg_edit(window.frames['svgedit']); +blah.clearSelection("woot","blah",1337,[1,2,3,4,5,"moo"],-42,{a: "tree",b:6, c: 9})(function(){console.log("GET DATA",arguments)}) +*/ + +function embedded_svg_edit(frame){ + //initialize communication + this.frame = frame; + //this.stack = [] //callback stack + this.callbacks = {}; //successor to stack + this.encode = embedded_svg_edit.encode; + //List of functions extracted with this: + //Run in firebug on http://svg-edit.googlecode.com/svn/trunk/docs/files/svgcanvas-js.html + + //for(var i=0,q=[],f = document.querySelectorAll("div.CFunction h3.CTitle a");i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/align-center.png b/public/svg-edit/editor/images/align-center.png new file mode 100644 index 00000000..d1f0c5bc Binary files /dev/null and b/public/svg-edit/editor/images/align-center.png differ diff --git a/public/svg-edit/editor/images/align-center.svg b/public/svg-edit/editor/images/align-center.svg new file mode 100644 index 00000000..ddf49fce --- /dev/null +++ b/public/svg-edit/editor/images/align-center.svg @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/align-left.png b/public/svg-edit/editor/images/align-left.png new file mode 100644 index 00000000..41fa8bcc Binary files /dev/null and b/public/svg-edit/editor/images/align-left.png differ diff --git a/public/svg-edit/editor/images/align-left.svg b/public/svg-edit/editor/images/align-left.svg new file mode 100644 index 00000000..b1a24a5a --- /dev/null +++ b/public/svg-edit/editor/images/align-left.svg @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/align-middle.png b/public/svg-edit/editor/images/align-middle.png new file mode 100644 index 00000000..f72bbb79 Binary files /dev/null and b/public/svg-edit/editor/images/align-middle.png differ diff --git a/public/svg-edit/editor/images/align-middle.svg b/public/svg-edit/editor/images/align-middle.svg new file mode 100644 index 00000000..d2b42e6a --- /dev/null +++ b/public/svg-edit/editor/images/align-middle.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/align-right.png b/public/svg-edit/editor/images/align-right.png new file mode 100644 index 00000000..5ca99caa Binary files /dev/null and b/public/svg-edit/editor/images/align-right.png differ diff --git a/public/svg-edit/editor/images/align-right.svg b/public/svg-edit/editor/images/align-right.svg new file mode 100644 index 00000000..c2f8f19e --- /dev/null +++ b/public/svg-edit/editor/images/align-right.svg @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/align-top.png b/public/svg-edit/editor/images/align-top.png new file mode 100644 index 00000000..51bfc2ec Binary files /dev/null and b/public/svg-edit/editor/images/align-top.png differ diff --git a/public/svg-edit/editor/images/align-top.svg b/public/svg-edit/editor/images/align-top.svg new file mode 100644 index 00000000..f314f32d --- /dev/null +++ b/public/svg-edit/editor/images/align-top.svg @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/bold.png b/public/svg-edit/editor/images/bold.png new file mode 100644 index 00000000..19ac5bbd Binary files /dev/null and b/public/svg-edit/editor/images/bold.png differ diff --git a/public/svg-edit/editor/images/cancel.png b/public/svg-edit/editor/images/cancel.png new file mode 100644 index 00000000..8595f5d9 Binary files /dev/null and b/public/svg-edit/editor/images/cancel.png differ diff --git a/public/svg-edit/editor/images/circle.png b/public/svg-edit/editor/images/circle.png new file mode 100644 index 00000000..e7bd228b Binary files /dev/null and b/public/svg-edit/editor/images/circle.png differ diff --git a/public/svg-edit/editor/images/clear.png b/public/svg-edit/editor/images/clear.png new file mode 100644 index 00000000..514710d1 Binary files /dev/null and b/public/svg-edit/editor/images/clear.png differ diff --git a/public/svg-edit/editor/images/clone.png b/public/svg-edit/editor/images/clone.png new file mode 100644 index 00000000..c8713c80 Binary files /dev/null and b/public/svg-edit/editor/images/clone.png differ diff --git a/public/svg-edit/editor/images/conn.svg b/public/svg-edit/editor/images/conn.svg new file mode 100644 index 00000000..1af5e9a4 --- /dev/null +++ b/public/svg-edit/editor/images/conn.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + Layer 1 + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/svg-edit/editor/images/copy.png b/public/svg-edit/editor/images/copy.png new file mode 100644 index 00000000..23ba357b Binary files /dev/null and b/public/svg-edit/editor/images/copy.png differ diff --git a/public/svg-edit/editor/images/cut.png b/public/svg-edit/editor/images/cut.png new file mode 100644 index 00000000..d586098e Binary files /dev/null and b/public/svg-edit/editor/images/cut.png differ diff --git a/public/svg-edit/editor/images/delete.png b/public/svg-edit/editor/images/delete.png new file mode 100644 index 00000000..e71dd96f Binary files /dev/null and b/public/svg-edit/editor/images/delete.png differ diff --git a/public/svg-edit/editor/images/document-properties.png b/public/svg-edit/editor/images/document-properties.png new file mode 100644 index 00000000..a5ad7287 Binary files /dev/null and b/public/svg-edit/editor/images/document-properties.png differ diff --git a/public/svg-edit/editor/images/dropdown.gif b/public/svg-edit/editor/images/dropdown.gif new file mode 100644 index 00000000..4180d5eb Binary files /dev/null and b/public/svg-edit/editor/images/dropdown.gif differ diff --git a/public/svg-edit/editor/images/ellipse.png b/public/svg-edit/editor/images/ellipse.png new file mode 100644 index 00000000..1402a2d8 Binary files /dev/null and b/public/svg-edit/editor/images/ellipse.png differ diff --git a/public/svg-edit/editor/images/eye.png b/public/svg-edit/editor/images/eye.png new file mode 100644 index 00000000..564a1a97 Binary files /dev/null and b/public/svg-edit/editor/images/eye.png differ diff --git a/public/svg-edit/editor/images/fhpath.png b/public/svg-edit/editor/images/fhpath.png new file mode 100644 index 00000000..9255cc50 Binary files /dev/null and b/public/svg-edit/editor/images/fhpath.png differ diff --git a/public/svg-edit/editor/images/flyouth.png b/public/svg-edit/editor/images/flyouth.png new file mode 100644 index 00000000..5822ed83 Binary files /dev/null and b/public/svg-edit/editor/images/flyouth.png differ diff --git a/public/svg-edit/editor/images/flyup.gif b/public/svg-edit/editor/images/flyup.gif new file mode 100644 index 00000000..c027e137 Binary files /dev/null and b/public/svg-edit/editor/images/flyup.gif differ diff --git a/public/svg-edit/editor/images/freehand-circle.png b/public/svg-edit/editor/images/freehand-circle.png new file mode 100644 index 00000000..43cb17f9 Binary files /dev/null and b/public/svg-edit/editor/images/freehand-circle.png differ diff --git a/public/svg-edit/editor/images/freehand-square.png b/public/svg-edit/editor/images/freehand-square.png new file mode 100644 index 00000000..328fc77d Binary files /dev/null and b/public/svg-edit/editor/images/freehand-square.png differ diff --git a/public/svg-edit/editor/images/go-down.png b/public/svg-edit/editor/images/go-down.png new file mode 100644 index 00000000..3dd7fccd Binary files /dev/null and b/public/svg-edit/editor/images/go-down.png differ diff --git a/public/svg-edit/editor/images/go-up.png b/public/svg-edit/editor/images/go-up.png new file mode 100644 index 00000000..fa9a7d71 Binary files /dev/null and b/public/svg-edit/editor/images/go-up.png differ diff --git a/public/svg-edit/editor/images/image.png b/public/svg-edit/editor/images/image.png new file mode 100644 index 00000000..10f46719 Binary files /dev/null and b/public/svg-edit/editor/images/image.png differ diff --git a/public/svg-edit/editor/images/italic.png b/public/svg-edit/editor/images/italic.png new file mode 100644 index 00000000..63485dea Binary files /dev/null and b/public/svg-edit/editor/images/italic.png differ diff --git a/public/svg-edit/editor/images/line.png b/public/svg-edit/editor/images/line.png new file mode 100644 index 00000000..37975742 Binary files /dev/null and b/public/svg-edit/editor/images/line.png differ diff --git a/public/svg-edit/editor/images/link_controls.png b/public/svg-edit/editor/images/link_controls.png new file mode 100644 index 00000000..516a094b Binary files /dev/null and b/public/svg-edit/editor/images/link_controls.png differ diff --git a/public/svg-edit/editor/images/logo.png b/public/svg-edit/editor/images/logo.png new file mode 100644 index 00000000..c9c61ae9 Binary files /dev/null and b/public/svg-edit/editor/images/logo.png differ diff --git a/public/svg-edit/editor/images/logo.svg b/public/svg-edit/editor/images/logo.svg new file mode 100644 index 00000000..9adffe46 --- /dev/null +++ b/public/svg-edit/editor/images/logo.svg @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/move_bottom.png b/public/svg-edit/editor/images/move_bottom.png new file mode 100644 index 00000000..6b132507 Binary files /dev/null and b/public/svg-edit/editor/images/move_bottom.png differ diff --git a/public/svg-edit/editor/images/move_top.png b/public/svg-edit/editor/images/move_top.png new file mode 100644 index 00000000..9d54b6a4 Binary files /dev/null and b/public/svg-edit/editor/images/move_top.png differ diff --git a/public/svg-edit/editor/images/none.png b/public/svg-edit/editor/images/none.png new file mode 100644 index 00000000..04c0765f Binary files /dev/null and b/public/svg-edit/editor/images/none.png differ diff --git a/public/svg-edit/editor/images/open.png b/public/svg-edit/editor/images/open.png new file mode 100644 index 00000000..254a6b81 Binary files /dev/null and b/public/svg-edit/editor/images/open.png differ diff --git a/public/svg-edit/editor/images/paste.png b/public/svg-edit/editor/images/paste.png new file mode 100644 index 00000000..ad983155 Binary files /dev/null and b/public/svg-edit/editor/images/paste.png differ diff --git a/public/svg-edit/editor/images/path.png b/public/svg-edit/editor/images/path.png new file mode 100644 index 00000000..c75a8d71 Binary files /dev/null and b/public/svg-edit/editor/images/path.png differ diff --git a/public/svg-edit/editor/images/polygon.png b/public/svg-edit/editor/images/polygon.png new file mode 100644 index 00000000..bcd640c2 Binary files /dev/null and b/public/svg-edit/editor/images/polygon.png differ diff --git a/public/svg-edit/editor/images/polygon.svg b/public/svg-edit/editor/images/polygon.svg new file mode 100644 index 00000000..a7f955d8 --- /dev/null +++ b/public/svg-edit/editor/images/polygon.svg @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Draw Rectangle + 2005-10-10 + + + Andreas Nilsson + + + + + draw + rectangle + square + + + + + + + + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/rect.png b/public/svg-edit/editor/images/rect.png new file mode 100644 index 00000000..4fd15f83 Binary files /dev/null and b/public/svg-edit/editor/images/rect.png differ diff --git a/public/svg-edit/editor/images/redo.png b/public/svg-edit/editor/images/redo.png new file mode 100644 index 00000000..1169fc3b Binary files /dev/null and b/public/svg-edit/editor/images/redo.png differ diff --git a/public/svg-edit/editor/images/reorient.png b/public/svg-edit/editor/images/reorient.png new file mode 100644 index 00000000..9455a82c Binary files /dev/null and b/public/svg-edit/editor/images/reorient.png differ diff --git a/public/svg-edit/editor/images/rotate.png b/public/svg-edit/editor/images/rotate.png new file mode 100644 index 00000000..afa68c6f Binary files /dev/null and b/public/svg-edit/editor/images/rotate.png differ diff --git a/public/svg-edit/editor/images/save.png b/public/svg-edit/editor/images/save.png new file mode 100644 index 00000000..9c4c8d9d Binary files /dev/null and b/public/svg-edit/editor/images/save.png differ diff --git a/public/svg-edit/editor/images/select.png b/public/svg-edit/editor/images/select.png new file mode 100644 index 00000000..1d741f16 Binary files /dev/null and b/public/svg-edit/editor/images/select.png differ diff --git a/public/svg-edit/editor/images/select_node.png b/public/svg-edit/editor/images/select_node.png new file mode 100644 index 00000000..5ed97db9 Binary files /dev/null and b/public/svg-edit/editor/images/select_node.png differ diff --git a/public/svg-edit/editor/images/sep.png b/public/svg-edit/editor/images/sep.png new file mode 100644 index 00000000..6b902777 Binary files /dev/null and b/public/svg-edit/editor/images/sep.png differ diff --git a/public/svg-edit/editor/images/shape_group.png b/public/svg-edit/editor/images/shape_group.png new file mode 100644 index 00000000..bb2ff516 Binary files /dev/null and b/public/svg-edit/editor/images/shape_group.png differ diff --git a/public/svg-edit/editor/images/shape_ungroup.png b/public/svg-edit/editor/images/shape_ungroup.png new file mode 100644 index 00000000..3a6f369a Binary files /dev/null and b/public/svg-edit/editor/images/shape_ungroup.png differ diff --git a/public/svg-edit/editor/images/source.png b/public/svg-edit/editor/images/source.png new file mode 100644 index 00000000..c1f07944 Binary files /dev/null and b/public/svg-edit/editor/images/source.png differ diff --git a/public/svg-edit/editor/images/spinbtn_updn_big.png b/public/svg-edit/editor/images/spinbtn_updn_big.png new file mode 100644 index 00000000..3873736f Binary files /dev/null and b/public/svg-edit/editor/images/spinbtn_updn_big.png differ diff --git a/public/svg-edit/editor/images/square.png b/public/svg-edit/editor/images/square.png new file mode 100644 index 00000000..0ca71a67 Binary files /dev/null and b/public/svg-edit/editor/images/square.png differ diff --git a/public/svg-edit/editor/images/svg_edit_icons.svg b/public/svg-edit/editor/images/svg_edit_icons.svg new file mode 100644 index 00000000..d297a8c3 --- /dev/null +++ b/public/svg-edit/editor/images/svg_edit_icons.svg @@ -0,0 +1,732 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + s + v + g + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/svg-edit/editor/images/svg_edit_icons.svgz b/public/svg-edit/editor/images/svg_edit_icons.svgz new file mode 100644 index 00000000..cb8c80cc Binary files /dev/null and b/public/svg-edit/editor/images/svg_edit_icons.svgz differ diff --git a/public/svg-edit/editor/images/text.png b/public/svg-edit/editor/images/text.png new file mode 100644 index 00000000..5652e2fa Binary files /dev/null and b/public/svg-edit/editor/images/text.png differ diff --git a/public/svg-edit/editor/images/text.svg b/public/svg-edit/editor/images/text.svg new file mode 100644 index 00000000..5c28753c --- /dev/null +++ b/public/svg-edit/editor/images/text.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/public/svg-edit/editor/images/to_path.png b/public/svg-edit/editor/images/to_path.png new file mode 100644 index 00000000..4209828d Binary files /dev/null and b/public/svg-edit/editor/images/to_path.png differ diff --git a/public/svg-edit/editor/images/undo.png b/public/svg-edit/editor/images/undo.png new file mode 100644 index 00000000..cd4ab955 Binary files /dev/null and b/public/svg-edit/editor/images/undo.png differ diff --git a/public/svg-edit/editor/images/view-refresh.png b/public/svg-edit/editor/images/view-refresh.png new file mode 100644 index 00000000..3fd71d6e Binary files /dev/null and b/public/svg-edit/editor/images/view-refresh.png differ diff --git a/public/svg-edit/editor/images/wave.png b/public/svg-edit/editor/images/wave.png new file mode 100644 index 00000000..10fa7122 Binary files /dev/null and b/public/svg-edit/editor/images/wave.png differ diff --git a/public/svg-edit/editor/images/wireframe.png b/public/svg-edit/editor/images/wireframe.png new file mode 100644 index 00000000..89db7e9e Binary files /dev/null and b/public/svg-edit/editor/images/wireframe.png differ diff --git a/public/svg-edit/editor/images/zoom.png b/public/svg-edit/editor/images/zoom.png new file mode 100644 index 00000000..c4fb6f17 Binary files /dev/null and b/public/svg-edit/editor/images/zoom.png differ diff --git a/public/svg-edit/editor/jgraduate/LICENSE b/public/svg-edit/editor/jgraduate/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/public/svg-edit/editor/jgraduate/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/public/svg-edit/editor/jgraduate/README b/public/svg-edit/editor/jgraduate/README new file mode 100644 index 00000000..ef3e21ff --- /dev/null +++ b/public/svg-edit/editor/jgraduate/README @@ -0,0 +1,3 @@ +jGraduate - A jQuery plugin for picking gradients + +Licensed under the Apache License 2. See LICENSE for more information. diff --git a/public/svg-edit/editor/jgraduate/css/jGraduate-0.2.0.css b/public/svg-edit/editor/jgraduate/css/jGraduate-0.2.0.css new file mode 100644 index 00000000..4b86287a --- /dev/null +++ b/public/svg-edit/editor/jgraduate/css/jGraduate-0.2.0.css @@ -0,0 +1,176 @@ +/* + * jGraduate Default CSS + * + * Copyright (c) 2009 Jeff Schiller + * + * Licensed under the Apache License Version 2 + */ + +h2.jGraduate_Title { + font-family: Arial, Helvetica, Sans-Serif; + font-size: 11px !important; + font-weight: bold; + margin: -13px 0px 0px 0px; + padding: 0px; + text-align: center; +} + +.jGraduate_Picker { + font-family: Arial, Helvetica, Sans-Serif; + font-size: 12px; + border-style: solid; + border-color: lightgrey black black lightgrey; + border-width: 1px; + background-color: #EFEFEF; + position: absolute; + padding: 10px; +} + +li.jGraduate_tab_color, li.jGraduate_tab_lingrad { + background-color: #ccc; + display: inline; + border: solid 1px grey; + padding: 3px; + margin: 2px; + cursor: pointer; +} + +li.jGraduate_tab_current { + background-color: #EFEFEF; + display: inline; + padding: 3px; + margin: 2px; + border: solid 1px black; + cursor: pointer; +} + +.jGraduate_colPick { + display: none; +} + +.jGraduate_lgPick { + display: none; + border: outset 1px #666; + padding: 10px 7px 5px 5px; + overflow: auto; +} + +.jGraduate_tabs { + position: relative; + background-color: #EFEFEF; + padding: 0px; + margin: 0px; + margin-bottom: 5px; +} + +div.jGraduate_Swatch { + float: left; + margin: 8px; +} +div.jGraduate_GradContainer { + border: 2px inset #EEE; + background-image: url(../images/map-opacity.png); + background-position: 0px 0px; + height: 256px; +} + +.jGraduate_AlphaArrows { + position: absolute; + margin-top: -10px; + margin-left: 250.5px; +} + +div.jGraduate_Opacity { + border: 2px inset #eee; + margin-top: 14px; + background-color: black; + background-image: url(../images/Maps.png); + background-position: 0px -2816px; + height: 20px; + cursor: ew-resize; +} + +div.jGraduate_OpacityField { + position: absolute; + bottom: 25px; + left: 292px; +} + +div.jGraduate_Form { + float: left; + width: 140px; + margin: -3px 3px 0px 4px; +} + +div.jGraduate_StopSection { + width: 120px; + text-align: center; +} + +div.jGraduate_OkCancel { + float: left; + width: 113px; +} + +input.jGraduate_Ok, input.jGraduate_Cancel { + display: block; + width: 100px; + margin-left: -4px; + margin-right: -4px; +} +input.jGraduate_Ok { + margin: 9px -4px 5px -4px; +} + +.colorBox { + float: left; + height: 16px; + width: 16px; + border: 1px solid #808080; + cursor: pointer; + margin: 4px 4px 4px 30px; +} + +.colorBox + label { + float: left; + margin-top: 7px; +} + +label.jGraduate_Form_Heading { + position: relative; + top: 10px; + background-color: #EFEFEF; + padding: 2px; + font-weight: bold; + font-size: 13px; +} + +div.jGraduate_Form_Section { + border-style: solid; + border-width: 1px; + border-color: grey; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + padding: 15px 5px 5px 5px; + margin: 2px; + width: 110px; + text-align: center; + overflow: auto; +} + +div.jGraduate_LightBox { + position: fixed; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background-color: #000; + opacity: 0.5; + display: none; +} + +div.jGraduate_stopPicker { + position: absolute; + display: none; + background: #E8E8E8; +} \ No newline at end of file diff --git a/public/svg-edit/editor/jgraduate/css/jPicker-1.0.12.css b/public/svg-edit/editor/jgraduate/css/jPicker-1.0.12.css new file mode 100644 index 00000000..c943ae16 --- /dev/null +++ b/public/svg-edit/editor/jgraduate/css/jPicker-1.0.12.css @@ -0,0 +1,191 @@ +.jPicker_Picker { + display: inline-block; + height: 24px; /* change this value if using a different sized color picker icon */ + position: relative; /* make this element an absolute positioning container */ + text-align: left; /* make the zero width children position to the left of container */ + width: 25px; /* change this value if using a different sized color picker icon */ +} +.jPicker_Color, .jPicker_Alpha { + background-position: 2px 2px; + display: block; + height: 100%; + left: 0px; + position: absolute; + top: 0px; + width: 100%; +} +.jPicker_Icon { + background-repeat: no-repeat; + cursor: pointer; + display: block; + height: 100%; + left: 0px; + position: absolute; + top: 0px; + width: 100%; +} +.jPicker_Container { + display: none; + z-index: 10; /* make sure container draws above color picker icon in Firefox/Safari/Chrome/Opera/etc. - + IE calculates z-index so this won't work - we will hide all color picker icons placed after the selected one in code when shown in IE */ +} +.jPicker_table { + background-color: #efefef; + border: 1px outset #666; + font-family: Arial, Helvetica, Sans-Serif; + font-size: 12px; + margin: 0px; + padding: 5px; + width: 550px; +} +.jPicker_table td { + margin: 0px; + padding: 0px; + vertical-align: top; +} +.jPicker_MoveBar { + background-color: #dddddd; + border: 1px outset #aaa; + cursor: move; + height: 12px; +} +.jPicker_Title { + font-size: 11px !important; + font-weight: bold; + margin: -2px 0px 0px 0px; + padding: 0px; + text-align: center; + width: 100%; +} +.jPicker_ColorMap { + border: 2px inset #eee; + cursor: crosshair; + height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ + margin: 0px 5px 0px 5px; + overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */ + padding: 0px; + position: relative; /* make this element an absolute positioning container */ + width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ +} +div[class="jPicker_ColorMap"] { + height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ + width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ +} +.jPicker_ColorBar { + border: 2px inset #eee; + cursor: n-resize; + height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ + margin: 12px 10px 0px 5px; + padding: 0px; + position: relative; + width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ +} +div[class="jPicker_ColorBar"] { + height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ + width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ +} +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3, .jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_ColorBar_l6 { + background-color: transparent; + background-image: none; + display: block; + height: 256px; /* must specific pixel height. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar + would not be drawn if its overflow is set to hidden. */ + left: 0px; + position: absolute; + top: 0px; +} +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3 { + width: 256px; /* must specific pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar + would not be drawn if its overflow is set to hidden. */ +} +.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_ColorBar_l6 { + width: 20px; /* must specific pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar + would not be drawn if its overflow is set to hidden. */ +} +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorBar_l6 { + background-repeat: no-repeat; +} +.jPicker_ColorMap_l3, .jPicker_ColorBar_l5 { + background-repeat: repeat; +} +.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4 { + background-repeat: repeat-x; +} +.jPicker_ColorMap_Arrow { + display: block; + position: absolute; +} +.jPicker_ColorBar_Arrow { + display: block; + left: -10px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */ + position: absolute; +} +.jPicker_Preview { + font-size: x-small; + text-align: center; +} +.jPicker_Preview div { + border: 2px inset #eee; + height: 62px; + margin: 0px auto; + padding: 0px; + width: 62px; +} +.jPicker_Preview div span { + border: 1px solid #000; + display: block; + height: 30px; + margin: 0px auto; + padding: 0px; + width: 60px; +} +.jPicker_Preview div span.jPicker_Active { + border-bottom-width: 0px; +} +.jPicker_Preview div span.jPicker_Current { + border-top-width: 0px; + cursor: pointer; +} +.jPicker_OkCancel { + text-align: center; + width: 120px; +} +.jPicker_OkCancel input { + width: 100px; +} +.jPicker_OkCancel input.jPicker_Ok { + margin: 12px 0px 5px 0px; +} +.jPicker_Text { + text-align: left; +} +.jPicker_HueText, .jPicker_SaturationText, .jPicker_BrightnessText, .jPicker_RedText, .jPicker_GreenText, .jPicker_BlueText, .jPicker_AlphaText { + background-color: #fff; + border: 1px inset #aaa; + margin: 0px 0px 0px 5px; + text-align: left; + width: 30px; +} +.jPicker_HexText { + background-color: #fff; + border: 1px inset #aaa; + margin: 0px 0px 0px 5px; + width: 65px; +} +.jPicker_Grid { + text-align: center; +} +span.jPicker_QuickColor { + border: 1px inset #aaa; + cursor: pointer; + display: block; + float: left; + height: 13px; + line-height: 13px; + margin: 2px 2px 1px 2px; + padding: 0px; + width: 15px; +} +span[class="jPicker_QuickColor"] { + width: 13px; +} \ No newline at end of file diff --git a/public/svg-edit/editor/jgraduate/images/AlphaBar.png b/public/svg-edit/editor/jgraduate/images/AlphaBar.png new file mode 100644 index 00000000..2950daeb Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/AlphaBar.png differ diff --git a/public/svg-edit/editor/jgraduate/images/Bars.png b/public/svg-edit/editor/jgraduate/images/Bars.png new file mode 100644 index 00000000..a9801ec1 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/Bars.png differ diff --git a/public/svg-edit/editor/jgraduate/images/Maps.png b/public/svg-edit/editor/jgraduate/images/Maps.png new file mode 100644 index 00000000..de33e3de Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/Maps.png differ diff --git a/public/svg-edit/editor/jgraduate/images/NoColor.png b/public/svg-edit/editor/jgraduate/images/NoColor.png new file mode 100644 index 00000000..ae361455 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/NoColor.png differ diff --git a/public/svg-edit/editor/jgraduate/images/bar-opacity.png b/public/svg-edit/editor/jgraduate/images/bar-opacity.png new file mode 100644 index 00000000..e42ad081 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/bar-opacity.png differ diff --git a/public/svg-edit/editor/jgraduate/images/map-opacity.png b/public/svg-edit/editor/jgraduate/images/map-opacity.png new file mode 100644 index 00000000..6756cee6 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/map-opacity.png differ diff --git a/public/svg-edit/editor/jgraduate/images/mappoint.gif b/public/svg-edit/editor/jgraduate/images/mappoint.gif new file mode 100644 index 00000000..f5f85574 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/mappoint.gif differ diff --git a/public/svg-edit/editor/jgraduate/images/picker.gif b/public/svg-edit/editor/jgraduate/images/picker.gif new file mode 100644 index 00000000..374d8910 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/picker.gif differ diff --git a/public/svg-edit/editor/jgraduate/images/preview-opacity.png b/public/svg-edit/editor/jgraduate/images/preview-opacity.png new file mode 100644 index 00000000..0dd9a2f8 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/preview-opacity.png differ diff --git a/public/svg-edit/editor/jgraduate/images/rangearrows.gif b/public/svg-edit/editor/jgraduate/images/rangearrows.gif new file mode 100644 index 00000000..218872cc Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/rangearrows.gif differ diff --git a/public/svg-edit/editor/jgraduate/images/rangearrows2.gif b/public/svg-edit/editor/jgraduate/images/rangearrows2.gif new file mode 100644 index 00000000..fdeb54a1 Binary files /dev/null and b/public/svg-edit/editor/jgraduate/images/rangearrows2.gif differ diff --git a/public/svg-edit/editor/jgraduate/jpicker-1.0.12.min.js b/public/svg-edit/editor/jgraduate/jpicker-1.0.12.min.js new file mode 100644 index 00000000..9b408ad9 --- /dev/null +++ b/public/svg-edit/editor/jgraduate/jpicker-1.0.12.min.js @@ -0,0 +1 @@ +(function(e,a){var d=function(t,k){var o=this,j=t.find("img"),B=0,A=100,s=100,z=0,w=100,r=100,q=0,p=0,m,n=function(x){var y=t.offset();m={left:y.left+parseInt(t.css("border-left-width")),top:y.top+parseInt(t.css("border-top-width"))};u(x);o.draw();e(document).bind("mousemove",l).bind("mouseup",h);x.stopPropagation();x.preventDefault();return false;},l=function(x){u(x);o.draw();x.stopPropagation();x.preventDefault();return false;},h=function(x){e(document).unbind("mouseup",h).unbind("mousemove",l);x.stopPropagation();x.preventDefault();return false;},u=function(E){var C=E.pageX-m.left,x=E.pageY-m.top,D=t.w,y=t.h;if(C<0){C=0;}else{if(C>D){C=D;}}if(x<0){x=0;}else{if(x>y){x=y;}}o.set_X(((C/D)*s)+B);o.set_Y(((x/y)*r)+z);e.isFunction(o.valuesChanged)&&o.valuesChanged(o);};e.extend(true,o,{settings:k,valuesChanged:e.isFunction(arguments[2])&&arguments[2]||null,get_X:function(){return q;},set_X:function(x){x=Math.floor(x);if(q==x){return;}if(xA){x=A;}}q=x;},get_Y:function(){return p;},set_Y:function(x){x=Math.floor(x);if(p==x){return;}if(xw){x=w;}}p=x;},set_RangeX:function(y,x){if(B==y&&A==x){return;}if(y>x){return;}B=y;A=x;s=A-B;},set_RangeY:function(y,x){if(z==y&&w==x){return;}if(y>x){return;}z=y;w=x;r=w-z;},draw:function(){var D=0,x=0,F=t.w,C=t.h,E=j.w,y=j.h;if(s>0){if(q==A){D=F;}else{D=Math.floor((q/s)*F);}}if(r>0){if(p==w){x=C;}else{x=Math.floor((p/r)*C);}}if(E>F){D=(F>>1)-(E>>1);}else{D-=E>>1;}if(y>C){x=(C>>1)-(y>>1);}else{x-=y>>1;}j.css({left:D+"px",top:x+"px"});},destroy:function(){e(document).unbind("mouseup",h).unbind("mousemove",l);t.unbind("mousedown",n);t=null;j=null;o.valuesChanged=null;}});var v=o.settings;j.src=v.arrow&&v.arrow.image;j.w=v.arrow&&v.arrow.width||j.width();j.h=v.arrow&&v.arrow.height||j.height();t.w=v.map&&v.map.width||t.width();t.h=v.map&&v.map.height||t.height();t.bind("mousedown",n);o.draw();e.isFunction(o.valuesChanged)&&o.valuesChanged(o);},b=function(m){var l=this,w=function(A){if(A.target.value==""){return;}if(!u.get_R()){s.red.val(0);}if(!u.get_G()){s.green.val(0);}if(!u.get_B()){s.blue.val(0);}if(!u.get_A()){s.alpha.val(100);}q(A);l.setValuesFromHsva();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},p=function(A){if(A.target.value==""){return;}if(!u.get_H()){s.hue.val(0);}if(!u.get_S()){s.saturation.val(0);}if(!u.get_V()){s.value.val(0);}if(!u.get_A()){s.alpha.val(100);}o(A);l.setValuesFromRgba();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},r=function(A){if(A.target.value==""){return;}if(!u.get_R()){s.red.val(0);}if(!u.get_G()){s.green.val(0);}if(!u.get_B()){s.blue.val(0);}if(!u.get_H()){s.hue.val(0);}if(!u.get_S()){s.saturation.val(0);}if(!u.get_V()){s.value.val(0);}y(A);l.setValuesFromRgba();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},t=function(A){if(A.target.value==""){l.setValuesFromRgba();}e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},k=function(A){if(A.target.value==""){l.setValuesFromHsva();}e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},x=function(A){if(A.target.value==""){s.alpha.val(100);}e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},z=function(A){v(A);l.setValuesFromHex();e.isFunction(l.valuesChanged)&&l.valuesChanged(l);},j=function(A){if(A.target.value==""){l.setValuesFromHex();}},o=function(D){if(!n(D)){return D;}var C=h(s.red.val(),0,255),B=h(s.green.val(),0,255),A=h(s.blue.val(),0,255);s.red.val(C!=null?C:"");s.green.val(B!=null?B:"");s.blue.val(A!=null?A:"");},y=function(B){if(!n(B)){return B;}var A=h(s.alpha.val(),0,100);s.alpha.val(A!=null?A:"");},q=function(D){if(!n(D)){return D;}var A=h(s.hue.val(),0,360),B=h(s.saturation.val(),0,100),C=h(s.value.val(),0,100);s.hue.val(A!=null?A:"");s.saturation.val(B!=null?B:"");s.value.val(C!=null?C:"");},v=function(A){if(!n(A)){return A;}s.hex.val(s.hex.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,8));},n=function(A){switch(A.keyCode){case 9:case 16:case 29:case 37:case 38:case 40:return false;case"c".charCodeAt():case"v".charCodeAt():if(A.ctrlKey){return false;}}return true;},h=function(C,B,A){if(C==""||isNaN(C)){return B;}if(C>A){return A;}if(C6){l=m.substring(0,2);k=m.substring(2,4);h=m.substring(4,6);j=m.substring(6,m.length);}else{if(m.length>4){l=m.substring(4,m.length);m=m.substring(0,4);}if(m.length>2){k=m.substring(2,m.length);m=m.substring(0,2);}if(m.length>0){h=m.substring(0,m.length);}}return{r:this.hexToInt(l),g:this.hexToInt(k),b:this.hexToInt(h),a:Math.floor((this.hexToInt(j)*100)/255)};},validateHex:function(h){h=h.toLowerCase().replace(/[^a-f0-9]/g,"");if(h.length>8){h=h.substring(0,8);}return h;},rgbaToHex:function(h){return this.intToHex(h.r)+this.intToHex(h.g)+this.intToHex(h.b)+this.intToHex(Math.floor((h.a*255)/100));},intToHex:function(j){var h=Math.floor(j).toString(16);if(h.length==1){h=("0"+h);}return h.toLowerCase();},hexToInt:function(h){return parseInt(h,16);},rgbToHsv:function(l){var o=l.r/255,n=l.g/255,j=l.b/255,k={h:0,s:0,v:0},m=0,h=0,p;if(o>=n&&o>=j){h=o;m=n>j?j:n;}else{if(n>=j&&n>=o){h=n;m=o>j?j:o;}else{h=j;m=n>o?o:n;}}k.v=h;k.s=h?(h-m)/h:0;if(!k.s){k.h=0;}else{p=h-m;if(o==h){k.h=(n-j)/p;}else{if(n==h){k.h=2+(j-o)/p;}else{k.h=4+(o-n)/p;}}k.h=parseInt(k.h*60);if(k.h<0){k.h+=360;}}k.s=Math.floor(k.s*100);k.v=Math.floor(k.v*100);return k;},hsvToRgb:function(n){var r={r:0,g:0,b:0,a:100},m=n.h,x=n.s,u=n.v;if(x==0){if(u==0){r.r=r.g=r.b=0;}else{r.r=r.g=r.b=Math.floor(u*255/100);}}else{if(m==360){m=0;}m/=60;x=x/100;u=u/100;var l=Math.floor(m),o=m-l,k=u*(1-x),j=u*(1-(x*o)),w=u*(1-(x*(1-o)));switch(l){case 0:r.r=u;r.g=w;r.b=k;break;case 1:r.r=j;r.g=u;r.b=k;break;case 2:r.r=k;r.g=u;r.b=w;break;case 3:r.r=k;r.g=j;r.b=u;break;case 4:r.r=w;r.g=k;r.b=u;break;case 5:r.r=u;r.g=k;r.b=j;break;}r.r=Math.floor(r.r*255);r.g=Math.floor(r.g*255);r.b=Math.floor(r.b*255);}return r;}}};var f=e.jPicker.Color,c=e.jPicker.List,g=e.jPicker.ColorMethods;e.fn.jPicker=function(j){var h=arguments;return this.each(function(){var w=e(this),y=e.extend(true,{},e.fn.jPicker.defaults,j);if(w.get(0).nodeName.toLowerCase()=="input"){e.extend(true,y,{window:{bindToInput:true,expandable:true,input:w}});if(g.validateHex(w.val())){y.color.active=new f({hex:w.val(),a:y.color.active.get_A()});y.color.current=new f({hex:w.val(),a:y.color.active.get_A()});}}if(y.window.expandable){w.after('    ');}else{y.window.liveUpdate=false;}var U=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,ay=null,av=null,au=null,T=null,S=null,R=null,Q=null,P=null,O=null,V=null,aa=null,aA=null,ak=null,am=null,ao=null,I=null,aw=null,G=null,Y=null,az=null,M=null,L=null,at=null,aq=null,A=null,l=null,J=null,ap=null,ab=null,ai=null,o=null,m=null,C=null,u=null,an=function(aE){K.active=az.color;var aF=K.active,aG=q.clientPath,aD=aF.get_Hex(),aC=function(aH){ad(aH,100);aH.css({backgroundColor:"transparent",backgroundPosition:"0px 0px",filter:""});};aC(ay);aC(av);aC(au);aC(T);aC(S);aC(R);aC(Q);aC(P);aC(O);aa.add(aA).add(ak).add(am).add(ao).add(I).removeAttr("checked");switch(aE){case"h":aa.attr({checked:true});ay.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});av.css({backgroundColor:"transparent"});x(av,-256);ad(av,100);x(Q,-256);ad(O,0);break;case"s":aA.attr({checked:true});x(ay,-512);x(av,-768);z(R,aF.get_Hex());x(Q,-512);ad(O,0);break;case"v":ak.attr({checked:true});z(ay,"000000");x(av,-1024);R.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});x(Q,-768);ad(O,0);break;case"r":am.attr({checked:true});x(av,-1536);x(ay,-1280);x(Q,-1024);x(R,-1280);x(S,-1536);x(T,-1792);ad(O,0);break;case"g":ao.attr({checked:true});x(av,-2048);x(ay,-1792);x(Q,-2048);x(R,-2304);x(S,-2560);x(T,-2816);ad(O,0);break;case"b":I.attr({checked:true});x(av,-2560);x(ay,-2304);x(Q,-3072);x(R,-3328);x(S,-3584);x(T,-3840);ad(O,0);break;case"a":aw.attr({checked:true});x(ay,-512);x(av,-768);ad(av,0);z(R,aF.get_Hex());ad(Q,0);ad(P,0);ad(O,100);break;default:throw ("Invalid Mode");break;}switch(aE){case"h":G.set_RangeX(0,100);G.set_RangeY(0,100);Y.set_RangeY(0,360);break;case"s":case"v":case"a":G.set_RangeX(0,360);G.set_RangeY(0,100);Y.set_RangeY(0,100);break;case"r":case"g":case"b":G.set_RangeX(0,255);G.set_RangeY(0,255);Y.set_RangeY(0,255);break;}K.mode=aE;v();G.draw();Y.draw();ah();if(aj.expandable&&aj.liveUpdate){o.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});ad(m,100-aF.get_A());if(aj.bindToInput){aj.input.val(aF.get_Rgba()||"").css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent",color:aF.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aF);},n=function(){v();G.draw();Y.draw();ah();K.active=az.color;var aD=K.active;if(aj.expandable&&aj.liveUpdate){var aC=aD.get_Hex();o.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(m,100-aD.get_A());if(aj.bindToInput){aj.input.val(az.fields.hex.val()||"").css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent",color:aD.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aD);},B=function(){if(!az||!G||!Y){return;}K.active=az.color;var aC=az.fields,aE=K.active;switch(K.mode){case"h":aC.saturation.val(G.get_X());aC.value.val(100-G.get_Y());if(aE.get_H()==null){aC.hue.val(0);}break;case"s":case"a":aC.hue.val(G.get_X());aC.value.val(100-G.get_Y());if(aE.get_S()==null){aC.saturation.val(0);}break;case"v":aC.hue.val(G.get_X());aC.saturation.val(100-G.get_Y());if(aE.get_V()==null){aC.value.val(0);}break;case"r":aC.green.val(255-G.get_Y());aC.blue.val(G.get_X());if(aE.get_R()==null){aC.red.val(0);}break;case"g":aC.red.val(255-G.get_Y());aC.blue.val(G.get_X());if(aE.get_G()==null){aC.green.val(0);}break;case"b":aC.red.val(G.get_X());aC.green.val(255-G.get_Y());if(aE.get_B()==null){aC.blue.val(0);}break;}if(aE.get_A()==null){aC.alpha.val(100);az.setValuesFromHsva();v();Y.draw();}switch(K.mode){case"h":case"s":case"v":case"a":az.setValuesFromHsva();break;case"r":case"g":case"b":az.setValuesFromRgba();break;}ah();if(aj.expandable&&aj.liveUpdate){var aD=aE.get_Hex();o.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});ad(m,100-aE.get_A());if(aj.bindToInput){aj.input.val(aE.get_Rgba()||"").css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent",color:aE.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},al=function(){if(!az||!G||!Y){return;}K.active=az.color;var aC=az.fields,aE=K.active;switch(K.mode){case"h":aC.hue.val(360-Y.get_Y());if(aE.get_S()==null){aC.saturation.val(0);}if(aE.get_V()==null){aC.value.val(0);}break;case"s":aC.saturation.val(100-Y.get_Y());if(aE.get_H()==null){aC.hue.val(0);}if(aE.get_V()==null){aC.value.val(0);}break;case"v":aC.value.val(100-Y.get_Y());if(aE.get_H()==null){aC.hue.val(0);}if(aE.get_S()==null){aC.saturation.val(0);}break;case"r":aC.red.val(255-Y.get_Y());if(aE.get_G()==null){aC.green.val(0);}if(aE.get_B()==null){aC.blue.val(0);}break;case"g":aC.green.val(255-Y.get_Y());if(aE.get_R()==null){aC.red.val(0);}if(aE.get_B()==null){aC.blue.val(0);}break;case"b":aC.blue.val(255-Y.get_Y());if(aE.get_R()==null){aC.red.val(0);}if(aE.get_G()==null){aC.green.val(0);}break;case"a":aC.alpha.val(100-Y.get_Y());if(aE.get_R()==null){aC.red.val(0);}if(aE.get_G()==null){aC.green.val(0);}if(aE.get_B()==null){aC.blue.val(0);}break;}if(aE.get_A()==null){aC.alpha.val(100);}switch(K.mode){case"h":case"s":case"v":az.setValuesFromHsva();break;case"r":case"g":case"b":case"a":az.setValuesFromRgba();break;}ah();if(aj.expandable&&aj.liveUpdate){var aD=aE.get_Hex();o.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});ad(m,100-aE.get_A());if(aj.bindToInput){aj.input.val(aE.get_Rgba()||"").css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent",color:aE.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},v=function(){K.active=az.color;var aF=0,aE=K.active;switch(w.settings.color.mode){case"h":aF=360-aE.get_H();break;case"s":aF=100-aE.get_S();break;case"v":aF=100-aE.get_V();break;case"r":aF=255-aE.get_R();break;case"g":aF=255-aE.get_G();break;case"b":aF=255-aE.get_B();break;case"a":aF=100-aE.get_A();break;}Y.set_Y(aF);var aD=0,aC=0;switch(w.settings.color.mode){case"h":aD=aE.get_S();aC=100-aE.get_V();break;case"s":case"a":aD=aE.get_H();aC=100-aE.get_V();break;case"v":aD=aE.get_H();aC=100-aE.get_S();break;case"r":aD=aE.get_B();aC=255-aE.get_G();break;case"g":aD=aE.get_B();aC=255-aE.get_R();break;case"b":aD=aE.get_R();aC=255-aE.get_G();break;}G.set_X(aD);G.set_Y(aC);},ah=function(){aB();ar();Z();},aB=function(){try{var aC=az.color.get_Hex();A.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(A,az.color.get_A());}catch(aD){}},ar=function(){if(!K||!az){return;}K.active=az.color;var aC=K.active;switch(K.mode){case"h":z(ay,new f({h:aC.get_H(),s:100,v:100}).get_Hex());break;case"s":case"a":ad(av,100-aC.get_S());break;case"v":ad(av,aC.get_V());break;case"r":ad(av,aC.get_R()/255*100);break;case"g":ad(av,aC.get_G()/255*100);break;case"b":ad(av,aC.get_B()/255*100);break;}ad(au,100-aC.get_A());},Z=function(){if(!K||!az){return;}K.active=az.color;var aG=K.active;switch(K.mode){case"h":ad(P,100-aG.get_A());break;case"s":var aH=new f({h:aG.get_H(),s:100,v:aG.get_V()});z(R,aH.get_Hex());ad(P,100-aG.get_A());break;case"v":var aJ=new f({h:aG.get_H(),s:aG.get_S(),v:100});z(R,aJ.get_Hex());ad(P,100-aG.get_A());break;case"r":case"g":case"b":var aI=0,aK=0;if(K.mode=="r"){aI=aG.get_B();aK=aG.get_G();}else{if(K.mode=="g"){aI=aG.get_B();aK=aG.get_R();}else{if(K.mode=="b"){aI=aG.get_R();aK=aG.get_G();}}}var aC=aI/255*100,aF=aK/255*100,aE=(255-aI)/255*100,aD=(255-aK)/255*100;ad(T,aD>aE?aE:aD);ad(S,aD>aC?aC:aD);ad(R,aF>aC?aC:aF);ad(Q,aF>aE?aE:aF);ad(P,100-aG.get_A());break;case"a":z(R,aG.get_Hex());break;}},z=function(aC,aD){aC.css({backgroundColor:aD&&aD.length==6?"#"+aD:"transparent"});},t=function(aC,aD){aC.css({backgroundImage:"url("+aD+")"});},x=function(aC,aD){aC.css({backgroundPosition:"0px "+aD+"px"});},ad=function(aD,aC){aD.css({visibility:aC>0?"visible":"hidden"});if(aC>0&&aC<100){aD.css({opacity:aC/100});}else{if(aC==0||aC==100){aD.css({opacity:""});}}},E=function(){az.fields.hex.val(K.current.get_Rgba()||"");az.setValuesFromHex();e.isFunction(az.valuesChanged)&&az.valuesChanged(az);},D=function(aC){an(aC.target.value);},ae=function(){E();},s=function(){E();aj.expandable&&w.hide();e.isFunction(w.cancelCallback)&&w.cancelCallback(K.active);},X=function(){var aD=K.active;K.current=new f({hex:aD.get_Rgba()});var aC=aD.get_Hex();l.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(l,az.color.get_A());if(aj.expandable){o.css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent"});ad(m,100-aD.get_A());if(aj.bindToInput){aj.input.val(aD.get_Rgba()||"").css({backgroundColor:aC&&aC.length==6?"#"+aC:"transparent",color:aD.get_V()>75?"#000000":"#ffffff"});}}e.isFunction(w.commitCallback)&&w.commitCallback(aD);},p=function(){X();aj.expandable&&w.hide();},ag=function(){w.show();},W=function(aE){var aC=aj.element,aD=aj.page;M=parseInt(V.css("left"));L=parseInt(V.css("top"));at=aE.pageX;aq=aE.pageY;e(document).bind("mousemove",k).bind("mouseup",r);aE.stopPropagation();aE.preventDefault();return false;},k=function(aC){V.css({left:M-(at-aC.pageX)+"px",top:L-(aq-aC.pageY)+"px"});aC.stopPropagation();aC.preventDefault();return false;},r=function(aC){e(document).unbind("mousemove",k).unbind("mouseup",r);aC.stopPropagation();aC.preventDefault();return false;},F=function(aC){az.fields.hex.val(w.settings.window.input.val());az.bindedHexKeyUp(aC);},H=function(aC){az.fields.hex.val(new f({hex:e(this).attr("title")}).get_Rgba()||"");az.setValuesFromHex();e.isFunction(az.valuesChanged)&&az.valuesChanged(az);};e.extend(true,w,{id:w.attr("id"),settings:y,color:null,icon:null,commitCallback:e.isFunction(h[1])&&h[1]||null,liveCallback:e.isFunction(h[2])&&h[2]||null,cancelCallback:e.isFunction(h[3])&&h[3]||null,show:function(){if(document.all){var aD=false;for(i=0;i>1)-259)-w.next().offset().left+"px":aj.position.x,position:"absolute",top:aj.position.y=="top"?"-350px":aj.position.y=="center"?"-158px":aj.position.y=="bottom"?"25px":aj.position.y});}if((typeof(K.active)).toString().toLowerCase()=="string"){K.active=new f({hex:K.active});}V.html(''+(aj.expandable?'':"")+'
 

'+(aj.title||af.text.title)+'

   
      
'+af.text.newColor+'
  
'+af.text.currentColor+'

 
°
%


%
%
');aa=V.find(".jPicker_HueRadio");aA=V.find(".jPicker_SaturationRadio");ak=V.find(".jPicker_BrightnessRadio");am=V.find(".jPicker_RedRadio");ao=V.find(".jPicker_GreenRadio");I=V.find(".jPicker_BlueRadio");aw=V.find(".jPicker_AlphaRadio");ay=V.find(".jPicker_ColorMap_l1");av=V.find(".jPicker_ColorMap_l2");au=V.find(".jPicker_ColorMap_l3");T=V.find(".jPicker_ColorBar_l1");S=V.find(".jPicker_ColorBar_l2");R=V.find(".jPicker_ColorBar_l3");Q=V.find(".jPicker_ColorBar_l4");P=V.find(".jPicker_ColorBar_l5");O=V.find(".jPicker_ColorBar_l6");J=V.find(".jPicker_NewCurrent");var ac=K.active.get_Hex();A=V.find(".jPicker_Active").css({backgroundColor:ac&&ac.length==6?"#"+ac:"transparent"});l=V.find(".jPicker_Current").css({backgroundColor:ac&&ac.length==6?"#"+ac:"transparent"});ap=V.find(".jPicker_Ok");ab=V.find(".jPicker_Cancel");ai=V.find(".jPicker_Grid");w.color=e(".Picker_Color");w.icon=e(".jPicker_Icon");az=new b(V,n);G=new d(V.find(".jPicker_ColorMap"),{map:{width:q.colorMap.width,height:q.colorMap.height},arrow:{image:q.clientPath+q.colorMap.arrow.file,width:q.colorMap.arrow.width,height:q.colorMap.arrow.height}},B);Y=new d(V.find(".jPicker_ColorBar"),{map:{width:q.colorBar.width,height:q.colorBar.height},arrow:{image:q.clientPath+q.colorBar.arrow.file,width:q.colorBar.arrow.width,height:q.colorBar.arrow.height}},al);t(ay,q.clientPath+"Maps.png");t(av,q.clientPath+"Maps.png");t(au,q.clientPath+"map-opacity.png");t(T,q.clientPath+"Bars.png");t(S,q.clientPath+"Bars.png");t(R,q.clientPath+"Bars.png");t(Q,q.clientPath+"Bars.png");t(P,q.clientPath+"bar-opacity.png");t(O,q.clientPath+"AlphaBar.png");t(J,q.clientPath+"preview-opacity.png");if(aj.expandable){o=w.next().find(".jPicker_Color").css({backgroundColor:ac&&ac.length==6?"#"+ac:"transparent"});m=w.next().find(".jPicker_Alpha");t(m,q.clientPath+"bar-opacity.png");ad(m,100-K.active.get_A());C=w.next().find(".jPicker_Icon").css({backgroundImage:"url("+q.clientPath+q.picker.file+")"}).bind("click",ag);if(aj.bindToInput){aj.input.bind("keyup",F).bind("change",F);}}aa.add(aA).add(ak).add(am).add(ao).add(I).add(aw).bind("click",D);l.bind("click",ae);ab.bind("click",s);ap.bind("click",p);if(aj.expandable){u=V.find(".jPicker_MoveBar").bind("mousedown",W);}if(K.quickList&&K.quickList.length>0){ai.html("");for(i=0;i ');var N=K.quickList[i].get_Hex();V.find(".jPicker_QuickColor").eq(i).css({backgroundColor:N&&N.length==6?"#"+N:"transparent",backgroundImage:N?"none":"url("+q.clientPath+"NoColor.png)"}).click(H);}}an(K.mode);az.fields.hex.val(K.active.get_Rgba()||"");az.setValuesFromHex();v();ah();if(!aj.expandable){w.show();}c.push(w);});};e.fn.jPicker.defaults={window:{title:null,position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true},color:{mode:"h",active:new f({hex:"#ffcc00ff"}),quickList:[new f({h:360,s:33,v:100}),new f({h:360,s:66,v:100}),new f({h:360,s:100,v:100}),new f({h:360,s:100,v:75}),new f({h:360,s:100,v:50}),new f({h:180,s:0,v:100}),new f({h:30,s:33,v:100}),new f({h:30,s:66,v:100}),new f({h:30,s:100,v:100}),new f({h:30,s:100,v:75}),new f({h:30,s:100,v:50}),new f({h:180,s:0,v:90}),new f({h:60,s:33,v:100}),new f({h:60,s:66,v:100}),new f({h:60,s:100,v:100}),new f({h:60,s:100,v:75}),new f({h:60,s:100,v:50}),new f({h:180,s:0,v:80}),new f({h:90,s:33,v:100}),new f({h:90,s:66,v:100}),new f({h:90,s:100,v:100}),new f({h:90,s:100,v:75}),new f({h:90,s:100,v:50}),new f({h:180,s:0,v:70}),new f({h:120,s:33,v:100}),new f({h:120,s:66,v:100}),new f({h:120,s:100,v:100}),new f({h:120,s:100,v:75}),new f({h:120,s:100,v:50}),new f({h:180,s:0,v:60}),new f({h:150,s:33,v:100}),new f({h:150,s:66,v:100}),new f({h:150,s:100,v:100}),new f({h:150,s:100,v:75}),new f({h:150,s:100,v:50}),new f({h:180,s:0,v:50}),new f({h:180,s:33,v:100}),new f({h:180,s:66,v:100}),new f({h:180,s:100,v:100}),new f({h:180,s:100,v:75}),new f({h:180,s:100,v:50}),new f({h:180,s:0,v:40}),new f({h:210,s:33,v:100}),new f({h:210,s:66,v:100}),new f({h:210,s:100,v:100}),new f({h:210,s:100,v:75}),new f({h:210,s:100,v:50}),new f({h:180,s:0,v:30}),new f({h:240,s:33,v:100}),new f({h:240,s:66,v:100}),new f({h:240,s:100,v:100}),new f({h:240,s:100,v:75}),new f({h:240,s:100,v:50}),new f({h:180,s:0,v:20}),new f({h:270,s:33,v:100}),new f({h:270,s:66,v:100}),new f({h:270,s:100,v:100}),new f({h:270,s:100,v:75}),new f({h:270,s:100,v:50}),new f({h:180,s:0,v:10}),new f({h:300,s:33,v:100}),new f({h:300,s:66,v:100}),new f({h:300,s:100,v:100}),new f({h:300,s:100,v:75}),new f({h:300,s:100,v:50}),new f({h:180,s:0,v:0}),new f({h:330,s:33,v:100}),new f({h:330,s:66,v:100}),new f({h:330,s:100,v:100}),new f({h:330,s:100,v:75}),new f({h:330,s:100,v:50}),new f()]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:40,height:9}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press “OK” To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},brightness:{radio:"Set To “Brightness” Color Mode",textbox:"Enter A “Brightness” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)"}}}};})(jQuery,"1.0.12"); \ No newline at end of file diff --git a/public/svg-edit/editor/jgraduate/jquery.jgraduate.js b/public/svg-edit/editor/jgraduate/jquery.jgraduate.js new file mode 100644 index 00000000..fe3f3c24 --- /dev/null +++ b/public/svg-edit/editor/jgraduate/jquery.jgraduate.js @@ -0,0 +1,571 @@ +/* + * jGraduate 0.3.x + * + * jQuery Plugin for a gradient picker + * + * Copyright (c) 2009 Jeff Schiller + * http://blog.codedread.com/ + * + * Apache 2 License + +jGraduate( options, okCallback, cancelCallback ) + +where options is an object literal: + { + window: { title: "Pick the start color and opacity for the gradient" }, + images: { clientPath: "images/" }, + paint: a Paint object + } + +- the Paint object is: + Paint { + type: String, // one of "none", "solidColor", "linearGradient", "radialGradient" + alpha: Number representing opacity (0-100), + solidColor: String representing #RRGGBB hex of color, + linearGradient: object of interface SVGLinearGradientElement, + } + +$.jGraduate.Paint() -> constructs a 'none' color +$.jGraduate.Paint({copy: o}) -> creates a copy of the paint o +$.jGraduate.Paint({hex: "#rrggbb"}) -> creates a solid color paint with hex = "#rrggbb" +$.jGraduate.Paint({linearGradient: o, a: 50}) -> creates a linear gradient paint with opacity=0.5 +$.jGraduate.Paint({hex: "#rrggbb", linearGradient: o}) -> throws an exception? + +- picker accepts the following object as input: + { + okCallback: function to call when Ok is pressed + cancelCallback: function to call when Cancel is pressed + paint: object describing the paint to display initially, if not set, then default to opaque white + } + +- okCallback receives a Paint object + + * + */ +var ns = { svg: 'http://www.w3.org/2000/svg', xlink: 'http://www.w3.org/1999/xlink' }; +if(!window.console) { + window.console = new function() { + this.log = function(str) {}; + this.dir = function(str) {}; + }; +} +$.cloneNode = function(el) { + if(!window.opera) return el.cloneNode(true); + // manually create a copy of the element + opera.postError(ns.svg, el.nodeName); + var new_el = document.createElementNS(ns.svg, el.nodeName); + $.each(el.attributes, function(i, attr) { + new_el.setAttributeNS(ns.svg, attr.nodeName, attr.nodeValue); + }); + $.each(el.childNodes, function(i, child) { + if(child.nodeType == 1) { + new_el.appendChild($.cloneNode(child)); + } + }); + return new_el; +} + +$.jGraduate = { + Paint: + function(opt) { + var options = opt || {}; + this.alpha = options.alpha || 100; + // copy paint object + if (options.copy) { + this.type = options.copy.type; + this.alpha = options.copy.alpha; + switch(this.type) { + case "none": + this.solidColor = null; + this.linearGradient = null; + break; + case "solidColor": + this.solidColor = options.copy.solidColor; + this.linearGradient = null; + break; + case "linearGradient": + this.solidColor = null; + this.linearGradient = $.cloneNode(options.copy.linearGradient); + break; + } + } + // create linear gradient paint + else if (options.linearGradient) { + this.type = "linearGradient"; + this.solidColor = null; + this.linearGradient = $.cloneNode(options.linearGradient); + } + // create solid color paint + else if (options.solidColor) { + this.type = "solidColor"; + this.solidColor = options.solidColor; + } + // create empty paint + else { + this.type = "none"; + this.solidColor = null; + this.linearGradient = null; + } + } +}; + +jQuery.fn.jGraduateDefaults = { + paint: new $.jGraduate.Paint(), + window: { + pickerTitle: "Drag markers to pick a paint", + }, + images: { + clientPath: "images/", + }, +}; + +jQuery.fn.jGraduate = + function(options) { + var $arguments = arguments; + return this.each( function() { + var $this = $(this), $settings = $.extend(true, {}, jQuery.fn.jGraduateDefaults, options), + id = $this.attr('id'), + idref = '#'+$this.attr('id')+' '; + + if (!idref) + { + alert('Container element must have an id attribute to maintain unique id strings for sub-elements.'); + return; + } + + var okClicked = function() { + $.isFunction($this.okCallback) && $this.okCallback($this.paint); + $this.hide(); + }, + cancelClicked = function() { + $.isFunction($this.cancelCallback) && $this.cancelCallback(); + $this.hide(); + }; + + $.extend(true, $this, // public properties, methods, and callbacks + { + // make a copy of the incoming paint + paint: new $.jGraduate.Paint({copy: $settings.paint}), + okCallback: $.isFunction($arguments[1]) && $arguments[1] || null, + cancelCallback: $.isFunction($arguments[2]) && $arguments[2] || null, + }); + + var pos = $this.position(), + color = null; + + if ($this.paint.type == "none") { + $this.paint = $.jGraduate.Paint({solidColor: 'ffffff'}); + } + + $this.addClass('jGraduate_Picker'); + $this.html('
    ' + + '
  • Solid Color
  • ' + + '
  • Linear Gradient
  • ' + + '
' + + '
' + + '
'); + var colPicker = $(idref + '> .jGraduate_colPick'); + var lgPicker = $(idref + '> .jGraduate_lgPick'); + + lgPicker.html( + '
' + + '

' + $settings.window.pickerTitle + '

' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '' + + '' + + '' + + '' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + + '
' + + '' + + '' + + '' + + '' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + + '%' + + '
' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '
'); + + // -------------- + // Set up all the SVG elements (the gradient, stops and rectangle) + var MAX = 256, MARGINX = 0, MARGINY = 0, STOP_RADIUS = 15/2, + SIZEX = MAX - 2*MARGINX, SIZEY = MAX - 2*MARGINY; + var container = document.getElementById(id+'_jGraduate_GradContainer'); + var svg = container.appendChild(document.createElementNS(ns.svg, 'svg')); + svg.id = id+'_jgraduate_svg'; + svg.setAttribute('width', MAX); + svg.setAttribute('height', MAX); + svg.setAttribute("xmlns", ns.svg); + + // if we are sent a gradient, import it + if ($this.paint.type == "linearGradient") { + $this.paint.linearGradient.id = id+'_jgraduate_grad'; + $this.paint.linearGradient = svg.appendChild($.cloneNode($this.paint.linearGradient)); + } + else { // we create a gradient + var grad = svg.appendChild(document.createElementNS(ns.svg, 'linearGradient')); + grad.id = id+'_jgraduate_grad'; + grad.setAttribute('x1','0.0'); + grad.setAttribute('y1','0.0'); + grad.setAttribute('x2','1.0'); + grad.setAttribute('y2','1.0'); + + var begin = grad.appendChild(document.createElementNS(ns.svg, 'stop')); + begin.setAttribute('offset', '0.0'); + begin.setAttribute('stop-color', '#ff0000'); + + var end = grad.appendChild(document.createElementNS(ns.svg, 'stop')); + end.setAttribute('offset', '1.0'); + end.setAttribute('stop-color', '#ffff00'); + + $this.paint.linearGradient = grad; + } + + var gradalpha = $this.paint.alpha; + $('#' + id + '_jGraduate_OpacityInput').val(gradalpha); + var posx = parseInt(255*(gradalpha/100)) - 4.5; + $('#' + id + '_jGraduate_AlphaArrows').css({'margin-left':posx}); + $('#' + id + '_jgraduate_rect').attr('fill-opacity', gradalpha/100); + + var x1 = parseFloat($this.paint.linearGradient.getAttribute('x1')||0.0), + y1 = parseFloat($this.paint.linearGradient.getAttribute('y1')||0.0), + x2 = parseFloat($this.paint.linearGradient.getAttribute('x2')||1.0), + y2 = parseFloat($this.paint.linearGradient.getAttribute('y2')||0.0); + + var rect = document.createElementNS(ns.svg, 'rect'); + rect.id = id + '_jgraduate_rect'; + rect.setAttribute('x', MARGINX); + rect.setAttribute('y', MARGINY); + rect.setAttribute('width', SIZEY); + rect.setAttribute('height', SIZEY); + rect.setAttribute('fill', 'url(#'+id+'_jgraduate_grad)'); + rect.setAttribute('fill-opacity', '1.0'); + rect = svg.appendChild(rect); + + // stop visuals created here + var beginStop = document.createElementNS(ns.svg, 'image'); + beginStop.id = id + "_stop1"; + beginStop.setAttribute('class', 'stop'); + beginStop.setAttributeNS(ns.xlink, 'href', $settings.images.clientPath + 'mappoint.gif'); + beginStop.setAttributeNS(ns.xlink, "title", "Begin Stop"); + beginStop.appendChild(document.createElementNS(ns.svg, 'title')).appendChild( + document.createTextNode("Begin Stop")); + beginStop.setAttribute('width', 18); + beginStop.setAttribute('height', 18); + beginStop.setAttribute('x', MARGINX + SIZEX*x1 - STOP_RADIUS); + beginStop.setAttribute('y', MARGINY + SIZEY*y1 - STOP_RADIUS); + beginStop.setAttribute('cursor', 'move'); + // must append only after setting all attributes due to Webkit Bug 27952 + // https://bugs.webkit.org/show_bug.cgi?id=27592 + beginStop = svg.appendChild(beginStop); + + var endStop = document.createElementNS(ns.svg, 'image'); + endStop.id = id + "_stop2"; + endStop.setAttribute('class', 'stop'); + endStop.setAttributeNS(ns.xlink, 'href', $settings.images.clientPath + 'mappoint.gif'); + endStop.setAttributeNS(ns.xlink, "title", "End Stop"); + endStop.appendChild(document.createElementNS(ns.svg, 'title')).appendChild( + document.createTextNode("End Stop")); + endStop.setAttribute('width', 18); + endStop.setAttribute('height', 18); + endStop.setAttribute('x', MARGINX + SIZEX*x2 - STOP_RADIUS); + endStop.setAttribute('y', MARGINY + SIZEY*y2 - STOP_RADIUS); + endStop.setAttribute('cursor', 'move'); + endStop = svg.appendChild(endStop); + + // bind GUI elements + $('#'+id+'_jGraduate_Ok').bind('click', function() { + $this.paint.type = "linearGradient"; + $this.paint.solidColor = null; + okClicked(); + }); + $('#'+id+'_jGraduate_Cancel').bind('click', function(paint) { + cancelClicked(); + }); + + var x1 = $this.paint.linearGradient.getAttribute('x1'); + if(!x1) x1 = "0.0"; + x1Input = $('#'+id+'_jGraduate_x1'); + x1Input.val(x1); + x1Input.change( function() { + if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) { + this.value = 0.0; + } + $this.paint.linearGradient.setAttribute('x1', this.value); + beginStop.setAttribute('x', MARGINX + SIZEX*this.value - STOP_RADIUS); + }); + + var y1 = $this.paint.linearGradient.getAttribute('y1'); + if(!y1) y1 = "0.0"; + y1Input = $('#'+id+'_jGraduate_y1'); + y1Input.val(y1); + y1Input.change( function() { + if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) { + this.value = 0.0; + } + $this.paint.linearGradient.setAttribute('y1', this.value); + beginStop.setAttribute('y', MARGINY + SIZEY*this.value - STOP_RADIUS); + }); + + var x2 = $this.paint.linearGradient.getAttribute('x2'); + if(!x2) x2 = "1.0"; + x2Input = $('#'+id+'_jGraduate_x2'); + x2Input.val(x2); + x2Input.change( function() { + if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) { + this.value = 1.0; + } + $this.paint.linearGradient.setAttribute('x2', this.value); + endStop.setAttribute('x', MARGINX + SIZEX*this.value - STOP_RADIUS); + }); + + var y2 = $this.paint.linearGradient.getAttribute('y2'); + if(!y2) y2 = "0.0"; + y2Input = $('#'+id+'_jGraduate_y2'); + y2Input.val(y2); + y2Input.change( function() { + if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) { + this.value = 0.0; + } + $this.paint.linearGradient.setAttribute('y2', this.value); + endStop.setAttribute('y', MARGINY + SIZEY*this.value - STOP_RADIUS); + }); + + var stops = $this.paint.linearGradient.getElementsByTagNameNS(ns.svg, 'stop'); + var numstops = stops.length; + // if there are not at least two stops, then + if (numstops < 2) { + while (numstops < 2) { + $this.paint.linearGradient.appendChild( document.createElementNS(ns.svg, 'stop') ); + ++numstops; + } + stops = $this.paint.linearGradient.getElementsByTagNameNS(ns.svg, 'stop'); + } + + var setOpacitySlider = function(e, div) { + var offset = div.offset(); + var x = (e.pageX - offset.left - parseInt(div.css('border-left-width'))); + if (x > 255) x = 255; + if (x < 0) x = 0; + var posx = x - 4.5; + x /= 255; + $('#' + id + '_jGraduate_AlphaArrows').css({'margin-left':posx}); + $('#' + id + '_jgraduate_rect').attr('fill-opacity', x); + x = parseInt(x*100); + $('#' + id + '_jGraduate_OpacityInput').val(x); + $this.paint.alpha = x; + }; + + // handle dragging on the opacity slider + var bSlidingOpacity = false; + $('.jGraduate_Opacity').mousedown(function(evt) { + setOpacitySlider(evt, $(this)); + bSlidingOpacity = true; + evt.preventDefault(); + }); + $('.jGraduate_Opacity').mousemove(function(evt) { + if (bSlidingOpacity) { + setOpacitySlider(evt, $(this)); + evt.preventDefault(); + } + }); + $('.jGraduate_Opacity').mouseup(function(evt) { + setOpacitySlider(evt, $(this)); + bSlidingOpacity = false; + evt.preventDefault(); + }); + + // handle dragging the stop around the swatch + var draggingStop = null; + var startx = -1, starty = -1; + // for whatever reason, Opera does not allow $('image.stop') here, + // and Firefox 1.5 does not allow $('.stop') + $('.stop, #color_picker_jGraduate_GradContainer image').mousedown(function(evt) { + draggingStop = this; + startx = evt.clientX; + starty = evt.clientY; + evt.preventDefault(); + }); + $('#'+id+'_jgraduate_svg').mousemove(function(evt) { + if (null != draggingStop) { + var dx = evt.clientX - startx; + var dy = evt.clientY - starty; + startx += dx; + starty += dy; + var x = parseFloat(draggingStop.getAttribute('x')) + dx; + var y = parseFloat(draggingStop.getAttribute('y')) + dy; + + // clamp stop to the swatch + if (x < MARGINX - STOP_RADIUS) x = MARGINX - STOP_RADIUS; + if (y < MARGINY - STOP_RADIUS) y = MARGINY - STOP_RADIUS; + if (x > MARGINX + SIZEX - STOP_RADIUS) x = MARGINX + SIZEX - STOP_RADIUS; + if (y > MARGINY + SIZEY - STOP_RADIUS) y = MARGINY + SIZEY - STOP_RADIUS; + + draggingStop.setAttribute('x', x); + draggingStop.setAttribute('y', y); + + // calculate stop offset + var fracx = (x - MARGINX + STOP_RADIUS)/SIZEX; + var fracy = (y - MARGINY + STOP_RADIUS)/SIZEY; + + if (draggingStop.id == (id+'_stop1')) { + x1Input.val(fracx); + y1Input.val(fracy); + $this.paint.linearGradient.setAttribute('x1', fracx); + $this.paint.linearGradient.setAttribute('y1', fracy); + } + else { + x2Input.val(fracx); + y2Input.val(fracy); + $this.paint.linearGradient.setAttribute('x2', fracx); + $this.paint.linearGradient.setAttribute('y2', fracy); + } + + evt.preventDefault(); + } + }); + $('#'+id+'_jgraduate_svg').mouseup(function(evt) { + draggingStop = null; + }); + + var beginColor = stops[0].getAttribute('stop-color'); + if(!beginColor) beginColor = '#000'; + beginColorBox = $('#'+id+'_jGraduate_colorBoxBegin'); + beginColorBox.css({'background-color':beginColor}); + + var beginOpacity = stops[0].getAttribute('stop-opacity'); + if(!beginOpacity) beginOpacity = '1.0'; + $('#'+id+'jGraduate_beginOpacity').html( (beginOpacity*100)+'%' ); + + var endColor = stops[stops.length-1].getAttribute('stop-color'); + if(!endColor) endColor = '#000'; + endColorBox = $('#'+id+'_jGraduate_colorBoxEnd'); + endColorBox.css({'background-color':endColor}); + + var endOpacity = stops[stops.length-1].getAttribute('stop-opacity'); + if(!endOpacity) endOpacity = '1.0'; + $('#'+id+'jGraduate_endOpacity').html( (endOpacity*100)+'%' ); + + $('#'+id+'_jGraduate_colorBoxBegin').click(function() { + $('div.jGraduate_LightBox').show(); + var colorbox = $(this); + var thisAlpha = (parseFloat(beginOpacity)*255).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = beginColor.substr(1) + thisAlpha; + $('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'bottom': 15}).jPicker({ + window: { title: "Pick the start color and opacity for the gradient" }, + images: { clientPath: $settings.images.clientPath }, + color: { active: color, alphaSupport: true } + }, function(color){ + beginColor = color.get_Hex() ? ('#'+color.get_Hex()) : "none"; + beginOpacity = color.get_A() ? color.get_A()/100 : 1; + colorbox.css('background', beginColor); + $('#'+id+'_jGraduate_beginOpacity').html(parseInt(beginOpacity*100)+'%'); + stops[0].setAttribute('stop-color', beginColor); + stops[0].setAttribute('stop-opacity', beginOpacity); + $('div.jGraduate_LightBox').hide(); + $('#'+id+'_jGraduate_stopPicker').hide(); + }, null, function() { + $('div.jGraduate_LightBox').hide(); + $('#'+id+'_jGraduate_stopPicker').hide(); + }); + }); + $('#'+id+'_jGraduate_colorBoxEnd').click(function() { + $('div.jGraduate_LightBox').show(); + var colorbox = $(this); + var thisAlpha = (parseFloat(endOpacity)*255).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = endColor.substr(1) + thisAlpha; + $('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'top': 15}).jPicker({ + window: { title: "Pick the end color and opacity for the gradient" }, + images: { clientPath: $settings.images.clientPath }, + color: { active: color, alphaSupport: true } + }, function(color){ + endColor = color.get_Hex() ? ('#'+color.get_Hex()) : "none"; + endOpacity = color.get_A() ? color.get_A()/100 : 1; + colorbox.css('background', endColor); + $('#'+id+'_jGraduate_endOpacity').html(parseInt(endOpacity*100)+'%'); + stops[1].setAttribute('stop-color', endColor); + stops[1].setAttribute('stop-opacity', endOpacity); + $('div.jGraduate_LightBox').hide(); + $('#'+id+'_jGraduate_stopPicker').hide(); + }, null, function() { + $('div.jGraduate_LightBox').hide(); + $('#'+id+'_jGraduate_stopPicker').hide(); + }); + }); + + // -------------- + var thisAlpha = ($this.paint.alpha*255/100).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = $this.paint.solidColor == "none" ? "" : $this.paint.solidColor + thisAlpha; + colPicker.jPicker( + { + window: { title: $settings.window.pickerTitle }, + images: { clientPath: $settings.images.clientPath }, + color: { active: color, alphaSupport: true } + }, + function(color) { + $this.paint.type = "solidColor"; + $this.paint.alpha = color.get_A() ? color.get_A() : 100; + $this.paint.solidColor = color.get_Hex() ? color.get_Hex() : "none"; + $this.paint.linearGradient = null; + okClicked(); + }, + null, + function(){ cancelClicked(); } + ); + + $(idref + ' .jGraduate_tab_color').click( function(){ + $(idref + ' .jGraduate_tab_lingrad').removeClass('jGraduate_tab_current'); + $(idref + ' .jGraduate_tab_color').addClass('jGraduate_tab_current'); + lgPicker.hide(); + colPicker.show(); + }); + $(idref + ' .jGraduate_tab_lingrad').click( function(){ + $(idref + ' .jGraduate_tab_color').removeClass('jGraduate_tab_current'); + $(idref + ' .jGraduate_tab_lingrad').addClass('jGraduate_tab_current'); + colPicker.hide(); + lgPicker.show(); + }); + + if ($this.paint.type == "linearGradient") { + lgPicker.show(); + colPicker.hide(); + $(idref + ' .jGraduate_tab_color').removeClass('jGraduate_tab_current'); + $(idref + ' .jGraduate_tab_lingrad').addClass('jGraduate_tab_current'); + } + else { + colPicker.show(); + lgPicker.hide(); + $(idref + ' .jGraduate_tab_color').addClass('jGraduate_tab_current'); + $(idref + ' .jGraduate_tab_lingrad').removeClass('jGraduate_tab_current'); + } + + $this.show(); + }); + }; diff --git a/public/svg-edit/editor/jgraduate/jquery.jgraduate.min.js b/public/svg-edit/editor/jgraduate/jquery.jgraduate.min.js new file mode 100644 index 00000000..c149d2df --- /dev/null +++ b/public/svg-edit/editor/jgraduate/jquery.jgraduate.min.js @@ -0,0 +1 @@ +;var ns={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console){window.console=new function(){this.log=function(a){};this.dir=function(a){}}}$.jGraduate={Paint:function(b){var a=b||{};this.alpha=a.alpha||100;if(a.copy){this.type=a.copy.type;this.alpha=a.copy.alpha;switch(this.type){case"none":this.solidColor=null;this.linearGradient=null;break;case"solidColor":this.solidColor=a.copy.solidColor;this.linearGradient=null;break;case"linearGradient":this.solidColor=null;this.linearGradient=a.copy.linearGradient.cloneNode(true);break}}else{if(a.linearGradient){this.type="linearGradient";this.solidColor=null;this.linearGradient=a.linearGradient.cloneNode(true)}else{if(a.solidColor){this.type="solidColor";this.solidColor=a.solidColor}else{this.type="none";this.solidColor=null;this.linearGradient=null}}}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint(),window:{pickerTitle:"Drag markers to pick a paint",},images:{clientPath:"images/",},};jQuery.fn.jGraduate=function(b){var a=arguments;return this.each(function(){var l=$(this),m=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),H=l.attr("id"),e="#"+l.attr("id")+" ";if(!e){alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");return}var c=function(){$.isFunction(l.okCallback)&&l.okCallback(l.paint);l.hide()},i=function(){$.isFunction(l.cancelCallback)&&l.cancelCallback();l.hide()};$.extend(true,l,{paint:new $.jGraduate.Paint({copy:m.paint}),okCallback:$.isFunction(a[1])&&a[1]||null,cancelCallback:$.isFunction(a[2])&&a[2]||null,});var F=l.position(),B=null;if(l.paint.type=="none"){l.paint=$.jGraduate.Paint({solidColor:"ffffff"})}l.addClass("jGraduate_Picker");l.html('
  • Solid Color
  • Linear Gradient
');var K=$(e+"> .jGraduate_colPick");var s=$(e+"> .jGraduate_lgPick");s.html('

'+m.window.pickerTitle+'

%
');var N=256,E=0,D=0,j=15/2,w=N-2*E,u=N-2*D;var G=document.getElementById(H+"_jGraduate_GradContainer");var g=G.appendChild(document.createElementNS(ns.svg,"svg"));g.id=H+"_jgraduate_svg";g.setAttribute("width",N);g.setAttribute("height",N);g.setAttribute("xmlns",ns.svg);if(l.paint.type=="linearGradient"){l.paint.linearGradient.id=H+"_jgraduate_grad";l.paint.linearGradient=g.appendChild(document.importNode(l.paint.linearGradient,true))}else{var v=g.appendChild(document.createElementNS(ns.svg,"linearGradient"));v.id=H+"_jgraduate_grad";v.setAttribute("x1","0.0");v.setAttribute("y1","0.0");v.setAttribute("x2","1.0");v.setAttribute("y2","1.0");var o=v.appendChild(document.createElementNS(ns.svg,"stop"));o.setAttribute("offset","0.0");o.setAttribute("stop-color","#ff0000");var t=v.appendChild(document.createElementNS(ns.svg,"stop"));t.setAttribute("offset","1.0");t.setAttribute("stop-color","#ffff00");l.paint.linearGradient=v}var z=l.paint.alpha;$("#"+H+"_jGraduate_OpacityInput").val(z);var r=parseInt(255*(z/100))-4.5;$("#"+H+"_jGraduate_AlphaArrows").css({"margin-left":r});$("#"+H+"_jgraduate_rect").attr("fill-opacity",z/100);var q=parseFloat(l.paint.linearGradient.getAttribute("x1")||0);var Q=parseFloat(l.paint.linearGradient.getAttribute("y1")||0);var p=parseFloat(l.paint.linearGradient.getAttribute("x2")||1);var P=parseFloat(l.paint.linearGradient.getAttribute("y2")||0);var C=document.createElementNS(ns.svg,"rect");C.id=H+"_jgraduate_rect";C.setAttribute("x",E);C.setAttribute("y",D);C.setAttribute("width",u);C.setAttribute("height",u);C.setAttribute("fill","url(#"+H+"_jgraduate_grad)");C.setAttribute("fill-opacity","1.0");C=g.appendChild(C);var k=document.createElementNS(ns.svg,"image");k.id=H+"_stop1";k.setAttribute("class","stop");k.setAttributeNS(ns.xlink,"href",m.images.clientPath+"mappoint.gif");k.setAttributeNS(ns.xlink,"title","Begin Stop");k.appendChild(document.createElementNS(ns.svg,"title")).appendChild(document.createTextNode("Begin Stop"));k.setAttribute("width",18);k.setAttribute("height",18);k.setAttribute("x",E+w*q-j);k.setAttribute("y",D+u*Q-j);k.setAttribute("cursor","move");k=g.appendChild(k);var M=document.createElementNS(ns.svg,"image");M.id=H+"_stop2";M.setAttribute("class","stop");M.setAttributeNS(ns.xlink,"href",m.images.clientPath+"mappoint.gif");M.setAttributeNS(ns.xlink,"title","End Stop");M.appendChild(document.createElementNS(ns.svg,"title")).appendChild(document.createTextNode("End Stop"));M.setAttribute("width",18);M.setAttribute("height",18);M.setAttribute("x",E+w*p-j);M.setAttribute("y",D+u*P-j);M.setAttribute("cursor","move");M=g.appendChild(M);$("#"+H+"_jGraduate_Ok").bind("click",function(){l.paint.type="linearGradient";l.paint.solidColor=null;c()});$("#"+H+"_jGraduate_Cancel").bind("click",function(R){i()});var q=l.paint.linearGradient.getAttribute("x1");if(!q){q="0.0"}x1Input=$("#"+H+"_jGraduate_x1");x1Input.val(q);x1Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=0}l.paint.linearGradient.setAttribute("x1",this.value);k.setAttribute("x",E+w*this.value-j)});var Q=l.paint.linearGradient.getAttribute("y1");if(!Q){Q="0.0"}y1Input=$("#"+H+"_jGraduate_y1");y1Input.val(Q);y1Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=0}l.paint.linearGradient.setAttribute("y1",this.value);k.setAttribute("y",D+u*this.value-j)});var p=l.paint.linearGradient.getAttribute("x2");if(!p){p="1.0"}x2Input=$("#"+H+"_jGraduate_x2");x2Input.val(p);x2Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=1}l.paint.linearGradient.setAttribute("x2",this.value);M.setAttribute("x",E+w*this.value-j)});var P=l.paint.linearGradient.getAttribute("y2");if(!P){P="0.0"}y2Input=$("#"+H+"_jGraduate_y2");y2Input.val(P);y2Input.change(function(){if(isNaN(parseFloat(this.value))||this.value<0||this.value>1){this.value=0}l.paint.linearGradient.setAttribute("y2",this.value);M.setAttribute("y",D+u*this.value-j)});var A=l.paint.linearGradient.getElementsByTagNameNS(ns.svg,"stop");var I=A.length;if(I<2){while(I<2){l.paint.linearGradient.appendChild(document.createElementNS(ns.svg,"stop"));++I}A=l.paint.linearGradient.getElementsByTagNameNS(ns.svg,"stop")}var n=function(T,V){var U=V.offset();var S=(T.pageX-U.left-parseInt(V.css("border-left-width")));if(S>255){S=255}if(S<0){S=0}var R=S-4.5;S/=255;$("#"+H+"_jGraduate_AlphaArrows").css({"margin-left":R});$("#"+H+"_jgraduate_rect").attr("fill-opacity",S);S=parseInt(S*100);$("#"+H+"_jGraduate_OpacityInput").val(S);l.paint.alpha=S};var O=false;$(".jGraduate_Opacity").mousedown(function(R){n(R,$(this));O=true;R.preventDefault()});$(".jGraduate_Opacity").mousemove(function(R){if(O){n(R,$(this));R.preventDefault()}});$(".jGraduate_Opacity").mouseup(function(R){n(R,$(this));O=false;R.preventDefault()});var L=null;var h=-1,f=-1;$(".stop, #color_picker_jGraduate_GradContainer image").mousedown(function(R){L=this;h=R.clientX;f=R.clientY;R.preventDefault()});$("#"+H+"_jgraduate_svg").mousemove(function(T){if(null!=L){var V=T.clientX-h;var S=T.clientY-f;h+=V;f+=S;var R=parseFloat(L.getAttribute("x"))+V;var X=parseFloat(L.getAttribute("y"))+S;if(RE+w-j){R=E+w-j}if(X>D+u-j){X=D+u-j}L.setAttribute("x",R);L.setAttribute("y",X);var W=(R-E+j)/w;var U=(X-D+j)/u;if(L.id==(H+"_stop1")){x1Input.val(W);y1Input.val(U);l.paint.linearGradient.setAttribute("x1",W);l.paint.linearGradient.setAttribute("y1",U)}else{x2Input.val(W);y2Input.val(U);l.paint.linearGradient.setAttribute("x2",W);l.paint.linearGradient.setAttribute("y2",U)}T.preventDefault()}});$("#"+H+"_jgraduate_svg").mouseup(function(R){L=null});var J=A[0].getAttribute("stop-color");if(!J){J="#000"}beginColorBox=$("#"+H+"_jGraduate_colorBoxBegin");beginColorBox.css({"background-color":J});var x=A[0].getAttribute("stop-opacity");if(!x){x="1.0"}$("#"+H+"jGraduate_beginOpacity").html((x*100)+"%");var d=A[A.length-1].getAttribute("stop-color");if(!d){d="#000"}endColorBox=$("#"+H+"_jGraduate_colorBoxEnd");endColorBox.css({"background-color":d});var y=A[A.length-1].getAttribute("stop-opacity");if(!y){y="1.0"}$("#"+H+"jGraduate_endOpacity").html((y*100)+"%");$("#"+H+"_jGraduate_colorBoxBegin").click(function(){$("div.jGraduate_LightBox").show();var R=$(this);B=new $.jPicker.Color({hex:J.substr(1),a:(parseFloat(x)*100)});$("#"+H+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:m.images.clientPath},color:{active:B,alphaSupport:true}},function(S){J="#"+this.settings.color.active.hex;x=this.settings.color.active.a/100;R.css("background",J);$("#"+H+"_jGraduate_beginOpacity").html(parseInt(x*100)+"%");A[0].setAttribute("stop-color",J);A[0].setAttribute("stop-opacity",x);$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()})});$("#"+H+"_jGraduate_colorBoxEnd").click(function(){$("div.jGraduate_LightBox").show();var R=$(this);B=new $.jPicker.Color({hex:d.substr(1),a:(parseFloat(y)*100)});$("#"+H+"_jGraduate_stopPicker").css({left:100,top:15}).jPicker({window:{title:"Pick the end color and opacity for the gradient"},images:{clientPath:m.images.clientPath},color:{active:B,alphaSupport:true}},function(S){d="#"+this.settings.color.active.hex;y=this.settings.color.active.a/100;R.css("background",d);$("#"+H+"_jGraduate_endOpacity").html(parseInt(y*100)+"%");A[1].setAttribute("stop-color",d);A[1].setAttribute("stop-opacity",y);$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+H+"_jGraduate_stopPicker").hide()})});K.jPicker({window:{title:m.window.pickerTitle},images:{clientPath:m.images.clientPath},color:{active:new $.jPicker.Color({hex:l.paint.solidColor,a:l.paint.alpha}),alphaSupport:true}},function(R){l.paint.type="solidColor";l.paint.alpha=R.a;l.paint.solidColor=R.hex;l.paint.linearGradient=null;c()},null,function(){i()});$(e+" .jGraduate_tab_color").click(function(){$(e+" .jGraduate_tab_lingrad").removeClass("jGraduate_tab_current");$(e+" .jGraduate_tab_color").addClass("jGraduate_tab_current");s.hide();K.show()});$(e+" .jGraduate_tab_lingrad").click(function(){$(e+" .jGraduate_tab_color").removeClass("jGraduate_tab_current");$(e+" .jGraduate_tab_lingrad").addClass("jGraduate_tab_current");K.hide();s.show()});if(l.paint.type=="linearGradient"){s.show();K.hide();$(e+" .jGraduate_tab_color").removeClass("jGraduate_tab_current");$(e+" .jGraduate_tab_lingrad").addClass("jGraduate_tab_current")}else{K.show();s.hide();$(e+" .jGraduate_tab_color").addClass("jGraduate_tab_current");$(e+" .jGraduate_tab_lingrad").removeClass("jGraduate_tab_current")}l.show()})}; \ No newline at end of file diff --git a/public/svg-edit/editor/jquery-ui/jquery-ui-1.7.2.custom.min.js b/public/svg-edit/editor/jquery-ui/jquery-ui-1.7.2.custom.min.js new file mode 100755 index 00000000..7dfde325 --- /dev/null +++ b/public/svg-edit/editor/jquery-ui/jquery-ui-1.7.2.custom.min.js @@ -0,0 +1,34 @@ +/* + * jQuery UI 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* + * jQuery UI Draggable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ +(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.leftthis.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("
")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){if(!c.disabled){a(this).addClass("ui-state-hover")}},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(!c.disabled){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}else{a(this).blur()}}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((this.options.values.length==2&&this.options.range===true)&&((e==0&&d>b)||(e==1&&d1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else{this.handles.removeAttr("disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(cthis._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);; \ No newline at end of file diff --git a/public/svg-edit/editor/jquery.js b/public/svg-edit/editor/jquery.js new file mode 100644 index 00000000..8e6c063c --- /dev/null +++ b/public/svg-edit/editor/jquery.js @@ -0,0 +1,152 @@ +/*! + * jQuery JavaScript Library v1.4.1 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Jan 25 19:43:33 2010 -0500 + */ +(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f, +a.currentTarget);m=0;for(s=i.length;m)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent, +va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]], +[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a, +this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this, +a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice}; +c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support= +{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null}; +b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="";a=r.createDocumentFragment();a.appendChild(d.firstChild); +c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props= +{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true, +{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this, +a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d); +return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]|| +a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m= +c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value|| +{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d); +f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText= +""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j= +function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a, +d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+ +s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a, +"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d, +b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b, +d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), +fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| +d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b= +0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true}; +c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b= +a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!== +"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this, +"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"|| +d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a= +a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this, +f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a, +b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g|| +typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u= +l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&& +y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&& +"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true); +return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"=== +g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2=== +0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return hk[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k= +0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="? +k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g}; +try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id"); +return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href", +2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== +0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[], +l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var i=d;i0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e +-1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(), +a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")}, +nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e): +e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!== +b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"], +col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)}, +wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length? +d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments, +false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&& +!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/ + + + + + + + + + + + + + + + + + + + + + + +SVG-edit + + + +
+ +
+ +
+
+ +
+
+

Layers

+
+
+
+
+
+
+
+ + + + + + +
Layer 1
+ Move elements to: + +
+
L a y e r s
+
+ +
+
+ + + +
+ + +
+ + + +
+ +
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+ + + +
+ + +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+
+ + +
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+
B
+
i
+
+ +
+ + +
+ + + +
+ +
+
+ +
+ + + + + +
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+ + +
+ zoom: + + +
+
+ +
+ + + + + + + + + + + + +
fill:
100%
stroke:
100 %
+ + + +
+
+ +
+
+
+ +
+ + +
+ + + +
+ +
+
+
+
+ + +
+
+ +
+
+
+ +
+
+
+
+ + +
+ + +
+ Image Properties + + +
+ Canvas Dimensions + + + + + + +
+ +
+ Included Images + + +
+ + +
+ +
+ Editor Preferences + + + + + +
+ Editor Background +
+ +

Note: Background will not be saved with image.

+
+ +
+ +
+
+ +
+
+
+
+ Test message +
+
+
+
+ + + diff --git a/public/svg-edit/editor/svg-editor.js b/public/svg-edit/editor/svg-editor.js new file mode 100644 index 00000000..bb026e14 --- /dev/null +++ b/public/svg-edit/editor/svg-editor.js @@ -0,0 +1,2869 @@ +/* + * svg-editor.js + * + * Licensed under the Apache License, Version 2 + * + * Copyright(c) 2010 Alexis Deveria + * Copyright(c) 2010 Pavol Rusnak + * Copyright(c) 2010 Jeff Schiller + * Copyright(c) 2010 Narendra Sisodya + * + */ + +function svg_edit_setup() { + var uiStrings = { + 'invalidAttrValGiven':'Invalid value given', + 'noContentToFitTo':'No content to fit to', + 'layer':"Layer", + 'dupeLayerName':"There is already a layer named that!", + 'enterUniqueLayerName':"Please enter a unique layer name", + 'enterNewLayerName':"Please enter the new layer name", + 'layerHasThatName':"Layer already has that name", + 'QmoveElemsToLayer':"Move selected elements to layer '%s'?", + 'QwantToClear':'Do you want to clear the drawing?\nThis will also erase your undo history!', + 'QerrorsRevertToSource':'There were parsing errors in your SVG source.\nRevert back to original SVG source?', + 'QignoreSourceChanges':'Ignore changes made to SVG source?', + 'featNotSupported':'Feature not supported', + 'enterNewImgURL':'Enter the new image URL', + 'ok':'OK', + 'cancel':'Cancel', + 'key_up':'Up', + 'key_down':'Down', + 'key_backspace':'Backspace', + 'key_del':'Del' + }, + + palette = ["#000000","#202020","#404040","#606060","#808080","#a0a0a0","#c0c0c0","#e0e0e0","#ffffff","#800000","#ff0000","#808000","#ffff00","#008000","#00ff00","#008080","#00ffff","#000080","#0000ff","#800080","#ff00ff","#2b0000","#550000","#800000","#aa0000","#d40000","#ff0000","#ff2a2a","#ff5555","#ff8080","#ffaaaa","#ffd5d5","#280b0b","#501616","#782121","#a02c2c","#c83737","#d35f5f","#de8787","#e9afaf","#f4d7d7","#241c1c","#483737","#6c5353","#916f6f","#ac9393","#c8b7b7","#e3dbdb","#2b1100","#552200","#803300","#aa4400","#d45500","#ff6600","#ff7f2a","#ff9955","#ffb380","#ffccaa","#ffe6d5","#28170b","#502d16","#784421","#a05a2c","#c87137","#d38d5f","#deaa87","#e9c6af","#f4e3d7","#241f1c","#483e37","#6c5d53","#917c6f","#ac9d93","#c8beb7","#e3dedb","#2b2200","#554400","#806600","#aa8800","#d4aa00","#ffcc00","#ffd42a","#ffdd55","#ffe680","#ffeeaa","#fff6d5","#28220b","#504416","#786721","#a0892c","#c8ab37","#d3bc5f","#decd87","#e9ddaf","#f4eed7","#24221c","#484537","#6c6753","#918a6f","#aca793","#c8c4b7","#e3e2db","#222b00","#445500","#668000","#88aa00","#aad400","#ccff00","#d4ff2a","#ddff55","#e5ff80","#eeffaa","#f6ffd5","#22280b","#445016","#677821","#89a02c","#abc837","#bcd35f","#cdde87","#dde9af","#eef4d7","#22241c","#454837","#676c53","#8a916f","#a7ac93","#c4c8b7","#e2e3db","#112b00","#225500","#338000","#44aa00","#55d400","#66ff00","#7fff2a","#99ff55","#b3ff80","#ccffaa","#e5ffd5","#17280b","#2d5016","#447821","#5aa02c","#71c837","#8dd35f","#aade87","#c6e9af","#e3f4d7","#1f241c","#3e4837","#5d6c53","#7c916f","#9dac93","#bec8b7","#dee3db","#002b00","#005500","#008000","#00aa00","#00d400","#00ff00","#2aff2a","#55ff55","#80ff80","#aaffaa","#d5ffd5","#0b280b","#165016","#217821","#2ca02c","#37c837","#5fd35f","#87de87","#afe9af","#d7f4d7","#1c241c","#374837","#536c53","#6f916f","#93ac93","#b7c8b7","#dbe3db","#002b11","#005522","#008033","#00aa44","#00d455","#00ff66","#2aff80","#55ff99","#80ffb3","#aaffcc","#d5ffe6","#0b2817","#16502d","#217844","#2ca05a","#37c871","#5fd38d","#87deaa","#afe9c6","#d7f4e3","#1c241f","#37483e","#536c5d","#6f917c","#93ac9d","#b7c8be","#dbe3de","#002b22","#005544","#008066","#00aa88","#00d4aa","#00ffcc","#2affd5","#55ffdd","#80ffe6","#aaffee","#d5fff6","#0b2822","#165044","#217867","#2ca089","#37c8ab","#5fd3bc","#87decd","#afe9dd","#d7f4ee","#1c2422","#374845","#536c67","#6f918a","#93aca7","#b7c8c4","#dbe3e2","#00222b","#004455","#006680","#0088aa","#00aad4","#00ccff","#2ad4ff","#55ddff","#80e5ff","#aaeeff","#d5f6ff","#0b2228","#164450","#216778","#2c89a0","#37abc8","#5fbcd3","#87cdde","#afdde9","#d7eef4","#1c2224","#374548","#53676c","#6f8a91","#93a7ac","#b7c4c8","#dbe2e3","#00112b","#002255","#003380","#0044aa","#0055d4","#0066ff","#2a7fff","#5599ff","#80b3ff","#aaccff","#d5e5ff","#0b1728","#162d50","#214478","#2c5aa0","#3771c8","#5f8dd3","#87aade","#afc6e9","#d7e3f4","#1c1f24","#373e48","#535d6c","#6f7c91","#939dac","#b7bec8","#dbdee3","#00002b","#000055","#000080","#0000aa","#0000d4","#0000ff","#2a2aff","#5555ff","#8080ff","#aaaaff","#d5d5ff","#0b0b28","#161650","#212178","#2c2ca0","#3737c8","#5f5fd3","#8787de","#afafe9","#d7d7f4","#1c1c24","#373748","#53536c","#6f6f91","#9393ac","#b7b7c8","#dbdbe3","#11002b","#220055","#330080","#4400aa","#5500d4","#6600ff","#7f2aff","#9955ff","#b380ff","#ccaaff","#e5d5ff","#170b28","#2d1650","#442178","#5a2ca0","#7137c8","#8d5fd3","#aa87de","#c6afe9","#e3d7f4","#1f1c24","#3e3748","#5d536c","#7c6f91","#9d93ac","#beb7c8","#dedbe3","#22002b","#440055","#660080","#8800aa","#aa00d4","#cc00ff","#d42aff","#dd55ff","#e580ff","#eeaaff","#f6d5ff","#220b28","#441650","#672178","#892ca0","#ab37c8","#bc5fd3","#cd87de","#ddafe9","#eed7f4","#221c24","#453748","#67536c","#8a6f91","#a793ac","#c4b7c8","#e2dbe3","#2b0022","#550044","#800066","#aa0088","#d400aa","#ff00cc","#ff2ad4","#ff55dd","#ff80e5","#ffaaee","#ffd5f6","#280b22","#501644","#782167","#a02c89","#c837ab","#d35fbc","#de87cd","#e9afdd","#f4d7ee","#241c22","#483745","#6c5367","#916f8a","#ac93a7","#c8b7c4","#e3dbe2","#2b0011","#550022","#800033","#aa0044","#d40055","#ff0066","#ff2a7f","#ff5599","#ff80b2","#ffaacc","#ffd5e5","#280b17","#50162d","#782144","#a02c5a","#c83771","#d35f8d","#de87aa","#e9afc6","#f4d7e3","#241c1f","#48373e","#6c535d","#916f7c","#ac939d","#c8b7be","#e3dbde"], + + isMac = false, //(navigator.platform.indexOf("Mac") != -1); + modKey = "", //(isMac ? "meta+" : "ctrl+"); + svgCanvas = new SvgCanvas(document.getElementById("svgcanvas")), + path = svgCanvas.pathActions, + default_img_url = "images/logo.png", + workarea = $("#workarea"); + + + // Store and retrieve preferences + $.pref = function(key, val) { + if(val) curPrefs[key] = val; + key = 'svg-edit-'+key; + var host = location.hostname, + onweb = host && host.indexOf('.') != -1, + store = (val != undefined), + storage = false; + // Some FF versions throw security errors here + try { + if(window.localStorage && onweb) { + storage = localStorage; + } + } catch(e) {} + try { + if(window.globalStorage && onweb) { + storage = globalStorage[host]; + } + } catch(e) {} + + if(storage) { + if(store) storage.setItem(key, val); + else return storage.getItem(key); + } else if(window.widget) { + if(store) widget.setPreferenceForKey(val, key); + else return widget.preferenceForKey(key); + } else { + if(store) { + var d = new Date(); + d.setTime(d.getTime() + 31536000000); + val = encodeURIComponent(val); + document.cookie = key+'='+val+'; expires='+d.toUTCString(); + } else { + var result = document.cookie.match(new RegExp(key + "=([^;]+)")); + return result?decodeURIComponent(result[1]):''; + } + } + } + + var curPrefs = { + lang:'en', + iconsize:'m', + bkgd_color:'#FFF', + bkgd_url:'', + img_save:'embed' + }; + + // This sets up alternative dialog boxes. They mostly work the same way as + // their UI counterparts, expect instead of returning the result, a callback + // needs to be included that returns the result as its first parameter. + // In the future we may want to add additional types of dialog boxes, since + // they should be easy to handle this way. + (function() { + $('#dialog_container').draggable({cancel:'#dialog_content, #dialog_buttons *'}); + var box = $('#dialog_box'), btn_holder = $('#dialog_buttons'); + + var dbox = function(type, msg, callback, defText) { + $('#dialog_content').html('

'+msg.replace(/\n/g,'

')+'

') + .toggleClass('prompt',(type=='prompt')); + btn_holder.empty(); + + var ok = $('').appendTo(btn_holder); + + if(type != 'alert') { + $('') + .appendTo(btn_holder) + .click(function() { box.hide();callback(false)}); + } + + if(type == 'prompt') { + var input = $('').prependTo(btn_holder); + input.val(defText || ''); + input.bind('keydown', {combi:'return'}, function() {ok.click();}); + } + + box.show(); + + ok.click(function() { + box.hide(); + var resp = (type == 'prompt')?input.val():true; + if(callback) callback(resp); + }).focus(); + + if(type == 'prompt') input.focus(); + } + + $.alert = function(msg, cb) { dbox('alert', msg, cb);}; + $.confirm = function(msg, cb) { dbox('confirm', msg, cb);}; + $.prompt = function(msg, txt, cb) { dbox('prompt', msg, cb, txt);}; + }()); + + var setSelectMode = function() { + $('.tool_button_current').removeClass('tool_button_current').addClass('tool_button'); + $('#tool_select').addClass('tool_button_current'); + $('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}'); + svgCanvas.setMode('select'); + }; + + var togglePathEditMode = function(editmode, elems) { + $('#path_node_panel').toggle(editmode); + $('#tools_bottom_2,#tools_bottom_3').toggle(!editmode); + var size = $('#tool_select > svg, #tool_select > img')[0].getAttribute('width'); + if(editmode) { + // Change select icon + $('.tool_button').removeClass('tool_button_current'); + $('#tool_select').addClass('tool_button_current') + .empty().append($.getSvgIcon('select_node')); + multiselected = false; + if(elems.length) { + selectedElement = elems[0]; + } + } else { + $('#tool_select').empty().append($.getSvgIcon('select')); + } + $.resizeSvgIcons({'#tool_select .svg_icon':size}); + } + + // used to make the flyouts stay on the screen longer the very first time + var flyoutspeed = 1250; + var textBeingEntered = false; + var selectedElement = null; + var multiselected = false; + var editingsource = false; + var docprops = false; + var length_attrs = ['x','y','x1','x2','y1','y2','cx','cy','width','height','r','rx','ry','width','height','radius']; + var length_types = ['em','ex','px','cm','mm','in','pt','pc','%']; + + var fillPaint = new $.jGraduate.Paint({solidColor: "FF0000"}); // solid red + var strokePaint = new $.jGraduate.Paint({solidColor: "000000"}); // solid black + + // TODO: Unfortunately Mozilla does not handle internal references to gradients + // inside a data: URL document. This means that any elements filled/stroked + // with a gradient will appear black in Firefox, etc. See bug 308590 + // https://bugzilla.mozilla.org/show_bug.cgi?id=308590 + var saveHandler = function(window,svg) { + window.opener.postMessage(svg, window.location.protocol + '//' + window.location.host); +// window.open("data:image/svg+xml;base64," + Utils.encode64(svg)); + }; + + // called when we've selected a different element + var selectedChanged = function(window,elems) { + var mode = svgCanvas.getMode(); + var is_node = (mode == "pathedit"); + // if elems[1] is present, then we have more than one element + selectedElement = (elems.length == 1 || elems[1] == null ? elems[0] : null); + multiselected = (elems.length >= 2 && elems[1] != null); + if (selectedElement != null) { + // unless we're already in always set the mode of the editor to select because + // upon creation of a text element the editor is switched into + // select mode and this event fires - we need our UI to be in sync + + if (mode != "multiselect" && !is_node) { + setSelectMode(); + updateToolbar(); + } + + } // if (elem != null) + + // Deal with pathedit mode + togglePathEditMode(is_node, elems); + updateContextPanel(); + svgCanvas.runExtensions("selectedChanged", { + elems: elems, + selectedElement: selectedElement, + multiselected: multiselected + }); + }; + + // called when any element has changed + var elementChanged = function(window,elems) { + for (var i = 0; i < elems.length; ++i) { + var elem = elems[i]; + + // if the element changed was the svg, then it could be a resolution change + if (elem && elem.tagName == "svg") { + populateLayers(); + updateCanvas(); + } + // Update selectedElement if element is no longer part of the image. + // This occurs for the text elements in Firefox + else if(elem && selectedElement && selectedElement.parentNode == null) { + selectedElement = elem; + } + } + + // we update the contextual panel with potentially new + // positional/sizing information (we DON'T want to update the + // toolbar here as that creates an infinite loop) + // also this updates the history buttons + + // we tell it to skip focusing the text control if the + // text element was previously in focus + updateContextPanel(); + + svgCanvas.runExtensions("elementChanged", { + elems: elems + }); + }; + + var zoomChanged = function(window, bbox, autoCenter) { + var scrbar = 15, + res = svgCanvas.getResolution(), + w_area = workarea, + canvas_pos = $('#svgcanvas').position(); + w_area.css('cursor','auto'); + var z_info = svgCanvas.setBBoxZoom(bbox, w_area.width()-scrbar, w_area.height()-scrbar); + if(!z_info) return; + var zoomlevel = z_info.zoom, + bb = z_info.bbox; + $('#zoom').val(Math.round(zoomlevel*100)); + + if(autoCenter) { + updateCanvas(); + } else { + updateCanvas(false, {x: bb.x * zoomlevel + (bb.width * zoomlevel)/2, y: bb.y * zoomlevel + (bb.height * zoomlevel)/2}); + } + + if(svgCanvas.getMode() == 'zoom' && bb.width) { + // Go to select if a zoom box was drawn + setSelectMode(); + } + zoomDone(); + } + + var flyout_funcs = {}; + + var setupFlyouts = function(holders) { + $.each(holders, function(hold_sel, btn_opts) { + var buttons = $(hold_sel).children(); + var show_sel = hold_sel + '_show'; + var def = false; + buttons.addClass('tool_button') + .unbind('click mousedown mouseup') // may not be necessary + .each(function(i) { + // Get this buttons options + var opts = btn_opts[i]; + + // Remember the function that goes with this ID + flyout_funcs[opts.sel] = opts.fn; + + if(opts.isDefault) def = i; + + // Clicking the icon in flyout should set this set's icon + + var func = function() { + if($(this).hasClass('disabled')) return false; + if (toolButtonClick(show_sel)) { + opts.fn(); + } + if(opts.icon) { + var icon = $.getSvgIcon(opts.icon).clone(); + } else { + // + var icon = $(opts.sel).children().eq(0).clone(); + } + + var shower = $(show_sel); + icon[0].setAttribute('width',shower.width()); + icon[0].setAttribute('height',shower.height()); + shower.children(':not(.flyout_arrow_horiz)').remove(); + shower.append(icon).attr('data-curopt', opts.sel); // This sets the current mode + } + + $(this).mouseup(func); + if(opts.key) { + $(document).bind('keydown', {combi: opts.key+'', disableInInput:true}, func); + } + }); + + if(def) { + $(show_sel).attr('data-curopt', btn_opts[def].sel); + } else if(!$(show_sel).attr('data-curopt')) { + // Set first as default + $(show_sel).attr('data-curopt', btn_opts[0].sel); + } + + var timer; + + // Clicking the "show" icon should set the current mode + $(show_sel).mousedown(function(evt) { + if($(show_sel).hasClass('disabled')) return false; + var holder = $(show_sel.replace('_show','')); + var l = holder.css('left'); + var w = holder.width()*-1; + var time = holder.data('shown_popop')?200:0; + timer = setTimeout(function() { + // Show corresponding menu + holder.css('left', w).show().animate({ + left: l + },150); + holder.data('shown_popop',true); + },time); + evt.preventDefault(); + }).mouseup(function() { + clearTimeout(timer); + var opt = $(this).attr('data-curopt'); + if (toolButtonClick(show_sel)) { + flyout_funcs[opt](); + } + }); + + // $('#tools_rect').mouseleave(function(){$('#tools_rect').fadeOut();}); + + var pos = $(show_sel).position(); + $(hold_sel).css({'left': pos.left+34, 'top': pos.top+77}); + }); + + setFlyoutTitles(); + } + + var makeFlyoutHolder = function(id, child) { + var div = $('
',{ + 'class': 'tools_flyout', + id: id + }).appendTo('#svg_editor').append(child); + + return div; + } + + var setFlyoutPositions = function() { + $('.tools_flyout').each(function() { + var shower = $('#' + this.id + '_show'); + var pos = shower.offset(); + var w = shower.outerWidth(); + $(this).css({left: pos.left + w, top: pos.top}); + }); + } + + var setFlyoutTitles = function() { + $('.tools_flyout').each(function() { + var shower = $('#' + this.id + '_show'); + var tooltips = []; + $(this).children().each(function() { + tooltips.push(this.title); + }); + shower[0].title = tooltips.join(' / '); + }); + } + + var extAdded = function(window, ext) { + if("buttons" in ext) { + var fallback_obj = {}, + placement_obj = {}, + svgicons = ext.svgicons; + + var holders = {}; + + // Add buttons given by extension + $.each(ext.buttons, function(i, btn) { + var icon; + var id = btn.id; + var num = i; + + // Give button a unique ID + while($('#'+id).length) { + id = btn.id + '_' + (++num); + } + + if(!svgicons) { + icon = $(''); + } else { + fallback_obj[id] = btn.icon; + placement_obj['#' + id] = btn.id; + } + + var cls, parent; + + // Set button up according to its type + switch ( btn.type ) { + case 'mode': + cls = 'tool_button'; + parent = "#tools_left"; + break; + } + + var button = $('
') + .attr("id", id) + .attr("title", btn.title) + .addClass(cls); + + if(!btn.includeWith) { + button.appendTo(parent); + } else { + // Add to flyout menu / make flyout menu + var opts = btn.includeWith; + // opts.button, default, position + var ref_btn = $(opts.button); + + var flyout_holder = ref_btn.parent(); + // Create a flyout menu if there isn't one already + if(!ref_btn.parent().hasClass('tools_flyout')) { + // Create flyout placeholder + var arr_div = $('
',{id:'flyout_arrow_horiz'}) + + var tls_id = ref_btn[0].id.replace('tool_','tools_') + var show_btn = ref_btn.clone() + .attr('id',tls_id + '_show') + .append($('
',{'class':'flyout_arrow_horiz'})); + + ref_btn.before(show_btn); + + // Create a flyout div + flyout_holder = makeFlyoutHolder(tls_id, ref_btn); + } + + var ref_data = Actions.getButtonData(opts.button); + + if(opts.isDefault) { + placement_obj['#' + tls_id + '_show'] = btn.id; + } + // TODO: Find way to set the current icon using the iconloader if this is not default + + // Include data for extension button as well as ref button + var cur_h = holders['#'+flyout_holder[0].id] = [{ + sel: '#'+id, + fn: btn.events.click, + icon: btn.id, + key: btn.key, + isDefault: btn.includeWith?btn.includeWith.isDefault:0 + }, ref_data]; + + // {sel:'#tool_rect', fn: clickRect, evt: 'mouseup', key: 4, parent: '#tools_rect', icon: 'rect'} + + var pos = ("position" in opts)?opts.position:'last'; + var len = flyout_holder.children().length; + + // Add at given position or end + if(!isNaN(pos) && pos >= 0 && pos < len) { + flyout_holder.children().eq(pos).before(button); + } else { + flyout_holder.append(button); + cur_h.reverse(); + } + } + + if(!svgicons) { + button.append(icon); + } + + // Add given events to button + $.each(btn.events, function(name, func) { + if(name == "click") { + if(btn.type == 'mode') { + button.bind(name, func); + if(btn.key) { + $(document).bind('keydown', {combi: btn.key, disableInInput: true}, func); + if(btn.title) button.attr("title", btn.title + ' ['+btn.key+']'); + } + } + } else { + button.bind(name, func); + } + }); + + setupFlyouts(holders); + }); + + $.svgIcons(svgicons, { + w:24, h:24, + id_match: false, + no_img: true, + fallback: fallback_obj, + placement: placement_obj, + callback: function(icons) { + + // Bad hack to make the icon match the current size + // TODO: Write better hack! + var old = curPrefs.iconsize; + if(curPrefs.iconsize != 'm') { + setIconSize('m'); + setIconSize(old); + } + } + + }); + } + }; + + var getPaint = function(color, opac) { + // update the editor's fill paint + var opts = null; + if (color.substr(0,5) == "url(#") { + opts = { + alpha: opac, + linearGradient: document.getElementById(color.substr(5,color.length-6)) + }; + } + else if (color.substr(0,1) == "#") { + opts = { + alpha: opac, + solidColor: color.substr(1) + }; + } + else { + opts = { + alpha: opac, + solidColor: 'none' + }; + } + return new $.jGraduate.Paint(opts); + }; + + // updates the toolbar (colors, opacity, etc) based on the selected element + var updateToolbar = function() { + if (selectedElement != null && + selectedElement.tagName != "image" && + selectedElement.tagName != "g") + { + // get opacity values + var fillOpacity = parseFloat(selectedElement.getAttribute("fill-opacity")); + if (isNaN(fillOpacity)) { + fillOpacity = 1.0; + } + + var strokeOpacity = parseFloat(selectedElement.getAttribute("stroke-opacity")); + if (isNaN(strokeOpacity)) { + strokeOpacity = 1.0; + } + + // update fill color and opacity + var fillColor = selectedElement.getAttribute("fill")||"black"; + // prevent undo on these canvas changes + svgCanvas.setFillColor(fillColor, true); + svgCanvas.setFillOpacity(fillOpacity, true); + + // update stroke color and opacity + var strokeColor = selectedElement.getAttribute("stroke")||"none"; + // prevent undo on these canvas changes + svgCanvas.setStrokeColor(strokeColor, true); + svgCanvas.setStrokeOpacity(strokeOpacity, true); + + fillOpacity *= 100; + strokeOpacity *= 100; + + fillPaint = getPaint(fillColor, fillOpacity); + strokePaint = getPaint(strokeColor, strokeOpacity); + + fillOpacity = fillOpacity + " %"; + strokeOpacity = strokeOpacity + " %"; + + // update fill color + if (fillColor == "none") { + fillOpacity = "N/A"; + } + document.getElementById("gradbox_fill").parentNode.firstChild.setAttribute("fill", fillColor); + if (strokeColor == null || strokeColor == "" || strokeColor == "none") { + strokeColor = "none"; + strokeOpacity = "N/A"; + } + + // update the rect inside #fill_color + document.getElementById("gradbox_stroke").parentNode.firstChild.setAttribute("fill", strokeColor); + $('#fill_opacity').html(fillOpacity); + $('#stroke_opacity').html(strokeOpacity); + $('#stroke_width').val(selectedElement.getAttribute("stroke-width")||1); + $('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none"); + } + + // All elements including image and group have opacity + if(selectedElement != null) { + var opac_perc = ((selectedElement.getAttribute("opacity")||1.0)*100); + $('#group_opacity').val(opac_perc); + $('#opac_slider').slider('option', 'value', opac_perc); + } + + updateToolButtonState(); + }; + + // updates the context panel tools based on the selected element + var updateContextPanel = function() { + var elem = selectedElement; + // If element has just been deleted, consider it null + if(elem != null && !elem.parentNode) elem = null; + var currentLayer = svgCanvas.getCurrentLayer(); + var currentMode = svgCanvas.getMode(); + + // No need to update anything else in rotate mode + if (currentMode == 'rotate' && elem != null) { + var ang = svgCanvas.getRotationAngle(elem); + $('#angle').val(ang); + $('#tool_reorient').toggleClass('disabled', ang == 0); + return; + } + var is_node = currentMode == 'pathedit'; //elem ? (elem.id && elem.id.indexOf('pathpointgrip') == 0) : false; + + $('#selected_panel, #multiselected_panel, #g_panel, #rect_panel, #circle_panel,\ + #ellipse_panel, #line_panel, #text_panel, #image_panel').hide(); + if (elem != null) { + var elname = elem.nodeName; + var angle = svgCanvas.getRotationAngle(elem); + $('#angle').val(angle); + + if(svgCanvas.addedNew) { + if(elname == 'image') { + promptImgURL(); + } else if(elname == 'text') { + // TODO: Do something here for new text + } + } + + if(!is_node && currentMode != 'pathedit') { + $('#selected_panel').show(); + // Elements in this array already have coord fields + if($.inArray(elname, ['line', 'circle', 'ellipse']) != -1) { + $('#xy_panel').hide(); + } else { + var x,y; + // Get BBox vals for g, polyline and path + if($.inArray(elname, ['g', 'polyline', 'path']) != -1) { + var bb = svgCanvas.getStrokedBBox([elem]); + if(bb) { + x = bb.x; + y = bb.y; + } + } else { + x = elem.getAttribute('x'); + y = elem.getAttribute('y'); + } + $('#selected_x').val(x || 0); + $('#selected_y').val(y || 0); + $('#xy_panel').show(); + } + + // Elements in this array cannot be converted to a path + var no_path = $.inArray(elname, ['image', 'text', 'path', 'g', 'use']) == -1; + $('#tool_topath').toggle(no_path); + $('#tool_reorient').toggle(elname == 'path'); + $('#tool_reorient').toggleClass('disabled', angle == 0); + } else { + var point = path.getNodePoint(); + $('#tool_node_delete').toggleClass('disabled', !path.canDeleteNodes); + if(point) { + var seg_type = $('#seg_type'); + $('#path_node_x').val(point.x); + $('#path_node_y').val(point.y); + if(point.type) { + seg_type.val(point.type).removeAttr('disabled'); + } else { + seg_type.val(4).attr('disabled','disabled'); + } + } + return; + } + + // update contextual tools here + var panels = { + g: [], + rect: ['rx','width','height'], + image: ['width','height'], + circle: ['cx','cy','r'], + ellipse: ['cx','cy','rx','ry'], + line: ['x1','y1','x2','y2'], + text: [] + }; + + var el_name = elem.tagName; + + if(panels[el_name]) { + var cur_panel = panels[el_name]; + + + $('#' + el_name + '_panel').show(); + + $.each(cur_panel, function(i, item) { + $('#' + el_name + '_' + item).val(elem.getAttribute(item) || 0); + }); + + if(el_name == 'text') { + $('#text_panel').css("display", "inline"); + if (svgCanvas.getItalic()) { + $('#tool_italic').addClass('tool_button_current'); + } + else { + $('#tool_italic').removeClass('tool_button_current'); + } + if (svgCanvas.getBold()) { + $('#tool_bold').addClass('tool_button_current'); + } + else { + $('#tool_bold').removeClass('tool_button_current'); + } + $('#font_family').val(elem.getAttribute("font-family")); + $('#font_size').val(elem.getAttribute("font-size")); + $('#text').val(elem.textContent); + if (svgCanvas.addedNew) { + $('#text').focus().select(); + } + } // text + else if(el_name == 'image') { + var xlinkNS="http://www.w3.org/1999/xlink"; + var href = elem.getAttributeNS(xlinkNS, "href"); + setImageURL(href); + } // image + } + } // if (elem != null) + else if (multiselected) { + $('#multiselected_panel').show(); + } + + // update history buttons + if (svgCanvas.getUndoStackSize() > 0) { + $('#tool_undo').removeClass( 'disabled'); + } + else { + $('#tool_undo').addClass( 'disabled'); + } + if (svgCanvas.getRedoStackSize() > 0) { + $('#tool_redo').removeClass( 'disabled'); + } + else { + $('#tool_redo').addClass( 'disabled'); + } + + svgCanvas.addedNew = false; + + if ( (elem && !is_node) || multiselected) { + // update the selected elements' layer + $('#selLayerNames').removeAttr('disabled').val(currentLayer); + } + else { + $('#selLayerNames').attr('disabled', 'disabled'); + } + }; + + $('#text').focus( function(){ textBeingEntered = true; } ); + $('#text').blur( function(){ textBeingEntered = false; } ); + + // bind the selected event to our function that handles updates to the UI + svgCanvas.bind("selected", selectedChanged); + svgCanvas.bind("changed", elementChanged); + svgCanvas.bind("saved", saveHandler); + svgCanvas.bind("zoomed", zoomChanged); + svgCanvas.bind("extension_added", extAdded); + + var str = '
' + $.each(palette, function(i,item){ + str += '
'; + }); + $('#palette').append(str); + + // Set up editor background functionality + // TODO add checkerboard as "pattern" + var color_blocks = ['#FFF','#888','#000']; // ,'url(data:image/gif;base64,R0lGODlhEAAQAIAAAP%2F%2F%2F9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG%2Bgq4jM3IFLJgpswNly%2FXkcBpIiVaInlLJr9FZWAQA7)']; + var str = ''; + $.each(color_blocks, function() { + str += '
'; + }); + $('#bg_blocks').append(str); + var blocks = $('#bg_blocks div'); + var cur_bg = 'cur_background'; + blocks.each(function() { + var blk = $(this); + blk.click(function() { + blocks.removeClass(cur_bg); + $(this).addClass(cur_bg); + }); + }); + + if($.pref('bkgd_color')) { + setBackground($.pref('bkgd_color'), $.pref('bkgd_url')); + } + + if($.pref('img_save')) { + curPrefs.img_save = $.pref('img_save'); + $('#image_save_opts input').val([curPrefs.img_save]); + } + + var changeRectRadius = function(ctl) { + svgCanvas.setRectRadius(ctl.value); + } + + var changeFontSize = function(ctl) { + svgCanvas.setFontSize(ctl.value); + } + + var changeStrokeWidth = function(ctl) { + var val = ctl.value; + if(val == 0 && selectedElement && $.inArray(selectedElement.nodeName, ['line', 'polyline']) != -1) { + val = ctl.value = 1; + } + svgCanvas.setStrokeWidth(val); + } + + var changeRotationAngle = function(ctl) { + svgCanvas.setRotationAngle(ctl.value); + $('#tool_reorient').toggleClass('disabled', ctl.value == 0); + } + var changeZoom = function(ctl) { + var zoomlevel = ctl.value / 100; + var zoom = svgCanvas.getZoom(); + var w_area = workarea; + + zoomChanged(window, { + width: 0, + height: 0, + // center pt of scroll position + x: (w_area[0].scrollLeft + w_area.width()/2)/zoom, + y: (w_area[0].scrollTop + w_area.height()/2)/zoom, + zoom: zoomlevel + }, true); + } + + var changeOpacity = function(ctl, val) { + if(val == null) val = ctl.value; + $('#group_opacity').val(val); + if(!ctl || !ctl.handle) { + $('#opac_slider').slider('option', 'value', val); + } + svgCanvas.setOpacity(val/100); + } + + var operaRepaint = function() { + // Repaints canvas in Opera. Needed for stroke-dasharray change as well as fill change + if(!window.opera) return; + $('

').hide().appendTo('body').remove(); + } + + $('#stroke_style').change(function(){ + svgCanvas.setStrokeStyle(this.options[this.selectedIndex].value); + operaRepaint(); + }); + + // Lose focus for select elements when changed (Allows keyboard shortcuts to work better) + $('select').change(function(){$(this).blur();}); + + // fired when user wants to move elements to another layer + var promptMoveLayerOnce = false; + $('#selLayerNames').change(function(){ + var destLayer = this.options[this.selectedIndex].value; + var confirm_str = uiStrings.QmoveElemsToLayer.replace('%s',destLayer); + var moveToLayer = function(ok) { + if(!ok) return; + promptMoveLayerOnce = true; + svgCanvas.moveSelectedToLayer(destLayer); + svgCanvas.clearSelection(); + populateLayers(); + } + if (destLayer) { + if(promptMoveLayerOnce) { + moveToLayer(true); + } else { + $.confirm(confirm_str, moveToLayer); + } + } + }); + + $('#font_family').change(function() { + svgCanvas.setFontFamily(this.value); + }); + + $('#seg_type').change(function() { + svgCanvas.setSegType($(this).val()); + }); + + $('#text').keyup(function(){ + svgCanvas.setTextContent(this.value); + }); + + $('#image_url').change(function(){ + setImageURL(this.value); + }); + + $('.attr_changer').change(function() { + var attr = this.getAttribute("data-attr"); + var val = this.value; + var valid = false; + if($.inArray(attr, length_attrs) != -1) { + if(!isNaN(val)) { + valid = true; + } else { + //TODO: Allow the values in length_types, then uncomment this: +// val = val.toLowerCase(); +// $.each(length_types, function(i, unit) { +// if(valid) return; +// var re = new RegExp('^-?[\\d\\.]+' + unit + '$'); +// if(re.test(val)) valid = true; +// }); + } + } else valid = true; + + if(!valid) { + $.alert(uiStrings.invalidAttrValGiven); + this.value = selectedElement.getAttribute(attr); + return false; + } + svgCanvas.changeSelectedAttribute(attr, val); + }); + + // Prevent selection of elements when shift-clicking + $('#palette').mouseover(function() { + var inp = $(''); + $(this).append(inp); + inp.focus().remove(); + }); + + $('.palette_item').click(function(evt){ + var picker = (evt.shiftKey ? "stroke" : "fill"); + var id = (evt.shiftKey ? '#stroke_' : '#fill_'); + var color = $(this).attr('data-rgb'); + var rectbox = document.getElementById("gradbox_"+picker).parentNode.firstChild; + var paint = null; + + // Webkit-based browsers returned 'initial' here for no stroke + if (color == 'transparent' || color == 'initial') { + color = 'none'; + $(id + "opacity").html("N/A"); + paint = new $.jGraduate.Paint(); + } + else { + paint = new $.jGraduate.Paint({alpha: 100, solidColor: color.substr(1)}); + } + rectbox.setAttribute("fill", color); + + if (evt.shiftKey) { + strokePaint = paint; + if (svgCanvas.getStrokeColor() != color) { + svgCanvas.setStrokeColor(color); + } + if (color != 'none' && svgCanvas.getStrokeOpacity() != 1) { + svgCanvas.setStrokeOpacity(1.0); + $("#stroke_opacity").html("100 %"); + } + } else { + fillPaint = paint; + if (svgCanvas.getFillColor() != color) { + svgCanvas.setFillColor(color); + } + if (color != 'none' && svgCanvas.getFillOpacity() != 1) { + svgCanvas.setFillOpacity(1.0); + $("#fill_opacity").html("100 %"); + } + } + updateToolButtonState(); + }); + + // This is a common function used when a tool has been clicked (chosen) + // It does several common things: + // - removes the tool_button_current class from whatever tool currently has it + // - hides any flyouts + // - adds the tool_button_current class to the button passed in + var toolButtonClick = function(button, fadeFlyouts) { + if ($(button).hasClass('disabled')) return false; + if($(button).parent().hasClass('tools_flyout')) return true; + var fadeFlyouts = fadeFlyouts || 'normal'; + $('.tools_flyout').fadeOut(fadeFlyouts); + $('#styleoverrides').text(''); + $('.tool_button_current').removeClass('tool_button_current').addClass('tool_button'); + $(button).addClass('tool_button_current'); + // when a tool is selected, we should deselect any currently selected elements + svgCanvas.clearSelection(); + return true; + }; + + (function() { + var button = $('#main_icon'); + var overlay = $('#main_icon span'); + var list = $('#main_menu'); + var on_button = false; + var height = 0; + var js_hover = true; + var set_click = false; + + var hideMenu = function() { + list.fadeOut(200); + }; + + $(window).mouseup(function(evt) { + if(!on_button) { + button.removeClass('down'); + // do not hide if it was the file input as that input needs to be visible + // for its change event to fire + if (evt.target.localName != "input") { + list.fadeOut(200); + } else if(!set_click) { + set_click = true; + $(evt.target).click(function() { + list.css('margin-left','-9999px').show(); + }); + } + } + on_button = false; + }).mousedown(function() { + $('.tools_flyout:visible').fadeOut(); + }); + + overlay.bind('mousedown',function() { + if (!button.hasClass('down')) { + button.addClass('down'); + // Margin must be reset in case it was changed before; + list.css('margin-left',0).show(); + if(!height) { + height = list.height(); + } + // Using custom animation as slideDown has annoying "bounce effect" + list.css('height',0).animate({ + 'height': height + },200); + on_button = true; + return false; + } else { + button.removeClass('down'); + list.fadeOut(200); + } + }).hover(function() { + on_button = true; + }).mouseout(function() { + on_button = false; + }); + + var list_items = $('#main_menu li'); + + // Check if JS method of hovering needs to be used (Webkit bug) + list_items.mouseover(function() { + js_hover = ($(this).css('background-color') == 'rgba(0, 0, 0, 0)'); + + list_items.unbind('mouseover'); + if(js_hover) { + list_items.mouseover(function() { + this.style.backgroundColor = '#FFC'; + }).mouseout(function() { + this.style.backgroundColor = 'transparent'; + return true; + }); + } + }); + }()); + + var addDropDown = function(elem, callback, dropUp) { + var button = $(elem).find('button'); + var list = $(elem).find('ul'); + var on_button = false; + if(dropUp) { + $(elem).addClass('dropup'); + } + + $(elem).find('li').bind('mouseup', callback); + + $(window).mouseup(function(evt) { + if(!on_button) { + button.removeClass('down'); + list.hide(); + } + on_button = false; + }); + + button.bind('mousedown',function() { + if (!button.hasClass('down')) { + button.addClass('down'); + list.show(); + on_button = true; + } else { + button.removeClass('down'); + list.hide(); + } + }).hover(function() { + on_button = true; + }).mouseout(function() { + on_button = false; + }); + } + + addDropDown('#font_family_dropdown', function() { + var fam = $(this).text(); + $('#font_family').val($(this).text()).change(); + }); + + addDropDown('#opacity_dropdown', function() { + if($(this).find('div').length) return; + var perc = parseInt($(this).text().split('%')[0]); + changeOpacity(false, perc); + }); + + // For slider usage, see: http://jqueryui.com/demos/slider/ + $("#opac_slider").slider({ + start: function() { + $('#opacity_dropdown li:not(.special)').hide(); + }, + stop: function() { + $('#opacity_dropdown li').show(); + $(window).mouseup(); + }, + slide: function(evt, ui){ + changeOpacity(ui); + } + }); + + addDropDown('#zoom_dropdown', function() { + var item = $(this); + var val = item.attr('data-val'); + if(val) { + zoomChanged(window, val); + } else { + changeZoom({value:parseInt(item.text())}); + } + }, true); + + /* + + When a flyout icon is selected + (if flyout) { + - Change the icon + - Make pressing the button run its stuff + } + - Run its stuff + + When its shortcut key is pressed + - If not current in list, do as above + , else: + - Just run its stuff + + */ + +// var setIcon = function(holder_sel, id) { +// var icon = $.getSvgIcon(id).clone(); +// var holder = $(holder_sel); +// icon[0].setAttribute('width',holder.width()); +// icon[0].setAttribute('height',holder.height()); +// holder.empty().append(icon) +// .attr('data-curopt', holder_sel.replace('_show','')); // This sets the current mode +// } + + var clickSelect = function() { + if (toolButtonClick('#tool_select')) { + svgCanvas.setMode('select'); + $('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}'); + } + }; + + var clickFHPath = function() { + if (toolButtonClick('#tool_fhpath')) { + svgCanvas.setMode('fhpath'); + } + }; + + var clickLine = function() { + if (toolButtonClick('#tool_line')) { + svgCanvas.setMode('line'); + } + }; + + var clickSquare = function(){ + svgCanvas.setMode('square'); + }; + + var clickRect = function(){ + svgCanvas.setMode('rect'); + }; + + var clickFHRect = function(){ + svgCanvas.setMode('fhrect'); + }; + + var clickCircle = function(){ + svgCanvas.setMode('circle'); + }; + + var clickEllipse = function(){ + svgCanvas.setMode('ellipse'); + }; + + var clickFHEllipse = function(){ + svgCanvas.setMode('fhellipse'); + }; + + var clickImage = function(){ + if (toolButtonClick('#tool_image')) { + svgCanvas.setMode('image'); + } + }; + + var clickZoom = function(){ + if (toolButtonClick('#tool_zoom')) { + workarea.css('cursor','crosshair'); + svgCanvas.setMode('zoom'); + } + }; + + var dblclickZoom = function(){ + if (toolButtonClick('#tool_zoom')) { + zoomImage(); + setSelectMode(); + } + }; + + var clickText = function(){ + toolButtonClick('#tool_text'); + svgCanvas.setMode('text'); + }; + + var clickPath = function(){ + toolButtonClick('#tool_path'); + svgCanvas.setMode('path'); + }; + + // Delete is a contextual tool that only appears in the ribbon if + // an element has been selected + var deleteSelected = function() { + if (selectedElement != null || multiselected) { + svgCanvas.deleteSelectedElements(); + } + }; + + var moveToTopSelected = function() { + if (selectedElement != null) { + svgCanvas.moveToTopSelectedElement(); + } + }; + + var moveToBottomSelected = function() { + if (selectedElement != null) { + svgCanvas.moveToBottomSelectedElement(); + } + }; + + var convertToPath = function() { + if (selectedElement != null) { + svgCanvas.convertToPath(); + } + } + + var reorientPath = function() { + if (selectedElement != null) { + path.reorient(); + } + } + + var moveSelected = function(dx,dy) { + if (selectedElement != null || multiselected) { + svgCanvas.moveSelectedElements(dx,dy); + } + }; + + var linkControlPoints = function() { + $('#tool_node_link').toggleClass('push_button_pressed'); + var linked = $('#tool_node_link').hasClass('push_button_pressed'); + path.linkControlPoints(linked); + } + + var clonePathNode = function() { + if (path.getNodePoint()) { + path.clonePathNode(); + } + }; + + var deletePathNode = function() { + if (path.getNodePoint()) { + path.deletePathNode(); + } + }; + + var selectNext = function() { + svgCanvas.cycleElement(1); + }; + + var selectPrev = function() { + svgCanvas.cycleElement(0); + }; + + var rotateSelected = function(cw) { + if (selectedElement == null || multiselected) return; + var step = 5; + if(!cw) step *= -1; + var new_angle = $('#angle').val()*1 + step; + svgCanvas.setRotationAngle(new_angle); + updateContextPanel(); + }; + + var clickClear = function(){ + $.confirm(uiStrings.QwantToClear, function(ok) { + if(!ok) return; + setSelectMode(); + svgCanvas.clear(); + svgCanvas.setResolution(640, 480); + updateCanvas(true); + zoomImage(); + populateLayers(); + updateContextPanel(); + }); + }; + + var clickBold = function(){ + svgCanvas.setBold( !svgCanvas.getBold() ); + updateContextPanel(); + }; + + var clickItalic = function(){ + svgCanvas.setItalic( !svgCanvas.getItalic() ); + updateContextPanel(); + }; + + var clickSave = function(){ + // In the future, more options can be provided here + var saveOpts = { + 'images': curPrefs.img_save, + 'round_digits': 6 + } + svgCanvas.save(saveOpts); + }; + + // by default, svgCanvas.open() is a no-op. + // it is up to an extension mechanism (opera widget, etc) + // to call setCustomHandlers() which will make it do something + var clickOpen = function(){ + svgCanvas.open(); + }; + + var clickUndo = function(){ + if (svgCanvas.getUndoStackSize() > 0) { + svgCanvas.undo(); + populateLayers(); + } + }; + + var clickRedo = function(){ + if (svgCanvas.getRedoStackSize() > 0) { + svgCanvas.redo(); + populateLayers(); + } + }; + + var clickGroup = function(){ + // group + if (multiselected) { + svgCanvas.groupSelectedElements(); + } + // ungroup + else if(selectedElement && selectedElement.tagName == 'g'){ + svgCanvas.ungroupSelectedElement(); + } + }; + + var clickClone = function(){ + svgCanvas.cloneSelectedElements(); + }; + + var clickAlign = function() { + var letter = this.id.replace('tool_align','').charAt(0); + svgCanvas.alignSelectedElements(letter, $('#align_relative_to').val()); + }; + + var zoomImage = function(multiplier) { + var res = svgCanvas.getResolution(); + multiplier = multiplier?res.zoom * multiplier:1; +// setResolution(res.w * multiplier, res.h * multiplier, true); + $('#zoom').val(multiplier * 100); + svgCanvas.setZoom(multiplier); + zoomDone(); + updateCanvas(true); + }; + + var zoomDone = function() { +// updateBgImage(); + updateWireFrame(); + //updateCanvas(); // necessary? + } + + var clickWireframe = function() { + $('#tool_wireframe').toggleClass('push_button_pressed'); + workarea.toggleClass('wireframe'); + + if(supportsNonSS) return; + var wf_rules = $('#wireframe_rules'); + if(!wf_rules.length) { + wf_rules = $(' +

+
+ +
+
+

Layers

+
+
+
+
+
+
+
+ + + + + + +
Layer 1
+ Move elements to: + +
+
L a y e r s
+
+ + + +
+ + +
+
+ +
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+ + +
+
+ + + + +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ relative to: + +
+ +
+ +
+
+
+
+ +
+
+ + + + +
+
+ + +
+
+ +
+
+ + + + +
+
+ + + +
+
+
+ +
+
+ + + + +
+
+ + +
+
+ +
+
+ + + + +
+
+ + + + +
+
+ +
+
+ + + + +
+
+ + + + +
+
+ +
+
B
+
i
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+ + + + + +
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+ zoom: + + +
+
+ +
+ + + + + + + + + + + + +
fill:
100%
stroke:
100 %
+ + + +
+
+ +
+
+
+ +
+ + +
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+
+ + +
+
+ +
+
+
+ +
+
+
+
+ + +
+ + +
+ Image Properties + + +
+ Canvas Dimensions + + + + + + +
+ +
+ Included Images + + +
+ + +
+ +
+ Editor Preferences + + + + + +
+ Editor Background +
+ +

Note: Background will not be saved with image.

+
+ +
+ +
+
+ +
+
+
+
+ Test message +
+
+
+
+ + ]]> + + diff --git a/public/svg-edit/wave/wave.js b/public/svg-edit/wave/wave.js new file mode 100644 index 00000000..c3723f77 --- /dev/null +++ b/public/svg-edit/wave/wave.js @@ -0,0 +1,147 @@ +var shapetime = {}; +var nodelete = false; + +function stateUpdated() { + + // 'state' is an object of key-value pairs that map ids to JSON serialization of SVG elements + // 'keys' is an array of all the keys in the state + var state = wave.getState(); + var keys = state.getKeys(); + svgCanvas.each(function(e) { + // 'this' is the SVG DOM element node (ellipse, rect, etc) + // 'e' is an integer describing the position within the document + var k = this.id; + var v = state.get(k); + if(k == "selectorParentGroup" || k == "svgcontent"){ + //meh + }else if (v) { + var ob = JSON.parse(v); + if (ob) { + // do nothing + } else { + //var node = document.getElementById(k); + //if (node) node.parentNode.removeChild(node); + } + //keys.remove(k); + + } else if(!nodelete){ + + this.parentNode.removeChild(this); + } + }); + + // New nodes + for (var k in keys) { + var v = state.get(keys[k]); + var ob = JSON.parse(v); + if (ob){ + if(!shapetime[k] || ob.time > shapetime[k]){ + var a; + if(a = document.getElementById(k)){ + var attrs = get_attrs(a); + if(JSON.stringify(attrs) != JSON.stringify(ob.attr)){ + shapetime[k] = ob.time + svgCanvas.updateElementFromJson(ob) + } + }else{ + shapetime[k] = ob.time + svgCanvas.updateElementFromJson(ob) + } + + } + } + } +} + + +function getId(canvas, objnum) { + var id = wave.getViewer().getId().split("@")[0]; + var extra = SHA256(wave.getViewer().getId()); //in case the next step kills all the characters + for(var i = 0, l = id.length, n = ""; i < l; i++){ + if("abcdefghijklmnopqrstuvwxyz0123456789".indexOf(id[i]) != -1){ + n+=id[i]; + } + } + return "svg_"+n+"_"+extra.substr(0,5)+"_"+objnum; +} + +function get_attrs(a){ + var attrs = {}; + for(var i = a.length; i--;){ + var attr = a.item(i).nodeName; + if(",style,".indexOf(","+attr+",") == -1){ + attrs[attr] = a.item(i).nodeValue; + } + } + return attrs +} + +function main() { + $(document).ready(function(){ + if (wave && wave.isInWaveContainer()) { + wave.setStateCallback(function(){setTimeout(stateUpdated,10)}); + } + + var oldchanged = svgCanvas.bind("changed", function(canvas, elem){ + if(oldchanged)oldchanged.apply(this, [canvas,elem]); + + var delta = {} + $.each(elem, function(){ + + var attrs = {}; + var a = this.attributes; + if(a){ + var attrs = get_attrs(a) + var ob = {element: this.nodeName, attr: attrs}; + + ob.time = shapetime[this.id] = (new Date).getTime() + delta[this.id] = JSON.stringify(ob); + } + }) + + wave.getState().submitDelta(delta) + //sendDelta(canvas, elem) + + }); + //* + + var oldselected = svgCanvas.bind("selected", function(canvas, elem){ + + if(oldselected)oldselected.apply(this, [canvas,elem]); + + + var delta = {} + var deletions = 0; + $.each(elem, function(){ + if(!this.parentNode && this != window){ + delta[this.id] = null; + deletions ++ + } + }); + if(deletions > 0){ + wave.getState().submitDelta(delta) + } + }); + /// + svgCanvas.bind("cleared", function(){ + //alert("cleared") + var state = {}, keys = wave.getState().getKeys() + for(var i = 0; i < keys.length; i++){ + state[keys[i]] = null; + } + wave.getState().submitDelta(state) + }); + //*/ + svgCanvas.bind("getid", getId); + }) +} + + + +if(window.gadgets) gadgets.util.registerOnLoadHandler(main); + +//$(main) + +//and why not use my stuff? +function SHA256(b){function h(j,k){return(j>>e)+(k>>e)+((p=(j&o)+(k&o))>>e)<>>k|j<<32-k}var g=[],d,c=3,l=[2],p,i,q,a,m=[],n=[];i=b.length*8;for(var e=16,o=65535,r="";c<312;c++){for(d=l.length;d--&&c%l[d]!=0;);d<0&&l.push(c)}b+="\u0080";for(c=0;c<=i;c+=8)n[c>>5]|=(b.charCodeAt(c/8)&255)<<24-c%32;n[(i+64>>9<<4)+15]=i;for(c=8;c--;)m[c]=parseInt(Math.pow(l[c],0.5).toString(e).substr(2,8),e);for(c=0;c>>10,g[b-7]),f(g[b-15],7)^f(g[b-15],18)^g[b-15]>>>3),g[b-e]);i=h(h(h(h(a[7],f(a[4],6)^f(a[4],11)^f(a[4],25)),a[4]&a[5]^~a[4]&a[6]),parseInt(Math.pow(l[b],1/3).toString(e).substr(2,8),e)),g[b]);q=(f(a[0],2)^f(a[0],13)^f(a[0],22))+(a[0]&a[1]^a[0]&a[2]^a[1]&a[2]);for(d=8;--d;)a[d]=d==4?h(a[3],i):a[d-1];a[0]=h(i,q)}for(d=8;d--;)m[d]+=a[d]}for(c=0;c<8;c++)for(b=8;b--;)r+=(m[c]>>>b*4&15).toString(e);return r} +