Commit 15f7cf4f authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Redesigning OfficeJS file tree.

There is a grunt directory reserved for tests, concat and uglify.
A small script named 'gruntall' in this directory will test all grunt.js in the
subdirectories.
parent 7829d14e
../../../JIO/src/base64.requirejs_module.js
\ No newline at end of file
../../../JIO/src/jquery.requirejs_module.js
\ No newline at end of file
div.color_picker {
height: 16px;
width: 16px;
padding: 0 !important;
border: 1px solid #ccc;
background: url(arrow.gif) no-repeat top right;
cursor: pointer;
line-height: 16px;
}
div#color_selector {
width: 110px;
position: absolute;
border: 1px solid #598FEF;
background-color: #EFEFEF;
padding: 2px;
}
div#color_custom {width: 100%; float:left }
div#color_custom label {font-size: 95%; color: #2F2F2F; margin: 5px 2px; width: 25%}
div#color_custom input {margin: 5px 2px; padding: 0; font-size: 95%; border: 1px solid #000; width: 65%; }
div.color_swatch {
height: 12px;
width: 12px;
border: 1px solid #000;
margin: 2px;
float: left;
cursor: pointer;
line-height: 12px;
}
(function(c){c.fn.colorPicker=function(){if(this.length>0){buildSelector()}return this.each(function(d){buildPicker(this)})};var a;var b=false;buildPicker=function(d){control=c("<div class='color_picker'>&nbsp;</div>");control.css("background-color",c(d).val());control.bind("click",toggleSelector);c(d).after(control);c(d).hide()};buildSelector=function(){selector=c("<div id='color_selector'></div>");c.each(c.fn.colorPicker.defaultColors,function(d){swatch=c("<div class='color_swatch'>&nbsp;</div>");swatch.css("background-color","#"+this);swatch.bind("click",function(f){changeColor(c(this).css("background-color"))});swatch.bind("mouseover",function(f){c(this).css("border-color","#598FEF");c("input#color_value").val(toHex(c(this).css("background-color")))});swatch.bind("mouseout",function(f){c(this).css("border-color","#000");c("input#color_value").val(toHex(c(a).css("background-color")))});swatch.appendTo(selector)});hex_field=c("<label for='color_value'>Hex</label><input type='text' size='8' id='color_value'/>");hex_field.bind("keydown",function(d){if(d.keyCode==13){changeColor(c(this).val())}if(d.keyCode==27){toggleSelector()}});c("<div id='color_custom'></div>").append(hex_field).appendTo(selector);c("body").append(selector);selector.hide()};checkMouse=function(e){var d="div#color_selector";var f=c(e.target).parents(d).length;if(e.target==c(d)[0]||e.target==a||f>0){return}hideSelector()};hideSelector=function(){var d=c("div#color_selector");c(document).unbind("mousedown",checkMouse);d.hide();b=false};showSelector=function(){var d=c("div#color_selector");d.css({top:c(a).offset().top+(c(a).outerHeight()),left:c(a).offset().left});hexColor=c(a).next("input").val();c("input#color_value").val(hexColor);d.show();c(document).bind("mousedown",checkMouse);b=true};toggleSelector=function(d){a=this;b?hideSelector():showSelector()};changeColor=function(d){if(selectedValue=toHex(d)){c(a).css("background-color",selectedValue);c(a).prev("input").val(selectedValue).change();hideSelector()}};toHex=function(e){if(e.match(/[0-9a-fA-F]{3}$/)||e.match(/[0-9a-fA-F]{6}$/)){e=(e.charAt(0)=="#")?e:("#"+e)}else{if(e.match(/^rgb\(([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-4][0-9]|[2][5][0-5]),[ ]{0,1}([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-4][0-9]|[2][5][0-5]),[ ]{0,1}([0-9]|[1-9][0-9]|[1][0-9]{2}|[2][0-4][0-9]|[2][5][0-5])\)$/)){var j=([parseInt(RegExp.$1),parseInt(RegExp.$2),parseInt(RegExp.$3)]);var i=function(l){if(l.length<2){for(var k=0,g=2-l.length;k<g;k++){l="0"+l}}return l};if(j.length==3){var h=i(j[0].toString(16)),f=i(j[1].toString(16)),d=i(j[2].toString(16));e="#"+h+f+d}}else{e=false}}return e};c.fn.colorPicker.addColors=function(d){c.fn.colorPicker.defaultColors=c.fn.colorPicker.defaultColors.concat(d)};c.fn.colorPicker.defaultColors=["000000","993300","333300","000080","333399","333333","800000","FF6600","808000","008000","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","999999","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFFF","99CCFF","FFFFFF"]})(jQuery);
\ No newline at end of file
/**
* @name Elastic
* @descripton Elastic is Jquery plugin that grow and shrink your textareas automaticliy
* @version 1.6.4
* @requires Jquery 1.2.6+
*
* @author Jan Jarfalk
* @author-email jan.jarfalk@unwrongest.com
* @author-website http://www.unwrongest.com
*
* @licens MIT License - http://www.opensource.org/licenses/mit-license.php
*/
(function(a){a.fn.extend({elastic:function(){var b=["paddingTop","paddingRight","paddingBottom","paddingLeft","fontSize","lineHeight","fontFamily","width","fontWeight"];return this.each(function(){if(this.type!="textarea"){return false}var g=a(this),c=a("<div />").css({position:"absolute",display:"none","word-wrap":"break-word"}),h=parseInt(g.css("line-height"),10)||parseInt(g.css("font-size"),"10"),k=parseInt(g.css("height"),10)||h*3,j=parseInt(g.css("max-height"),10)||Number.MAX_VALUE,d=0,f=0;if(j<0){j=Number.MAX_VALUE}c.appendTo(g.parent());var f=b.length;while(f--){c.css(b[f].toString(),g.css(b[f].toString()))}function l(i,m){curratedHeight=Math.floor(parseInt(i,10));if(g.height()!=curratedHeight){g.css({height:curratedHeight+"px",overflow:m})}}function e(){var n=g.val().replace(/&/g,"&amp;").replace(/ /g,"&nbsp;").replace(/<|>/g,"&gt;").replace(/\n/g,"<br />");var i=c.html();if(n+"&nbsp;"!=i){c.html(n+"&nbsp;");if(Math.abs(c.height()+h-g.height())>3){var m=c.height()+h;if(m>=j){l(j,"auto")}else{if(m<=k){l(k,"hidden")}else{l(m,"hidden")}}}}}g.css({overflow:"hidden"});g.keyup(function(){e()});g.live("input paste",function(i){setTimeout(e,250)});e()})}})})(jQuery);
\ No newline at end of file
#About
**jQuery Hotkeys** is a plug-in that lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination.
This plugin is based off of the plugin by Tzury Bar Yochay: [jQuery.hotkeys](http://github.com/tzuryby/hotkeys)
The syntax is as follows:
$(expression).bind(types, keys, handler);
$(expression).unbind(types, handler);
$(document).bind('keydown', 'ctrl+a', fn);
// e.g. replace '$' sign with 'EUR'
$('input.foo').bind('keyup', '$', function(){
this.value = this.value.replace('$', 'EUR');
});
## Types
Supported types are `'keydown'`, `'keyup'` and `'keypress'`
## Notes
If you want to use more than one modifiers (e.g. alt+ctrl+z) you should define them by an alphabetical order e.g. alt+ctrl+shift
Hotkeys aren't tracked if you're inside of an input element (unless you explicitly bind the hotkey directly to the input). This helps to avoid conflict with normal user typing.
## jQuery Compatibility
Works with jQuery 1.4.2 and newer.
It known to be working with all the major browsers on all available platforms (Win/Mac/Linux)
* IE 6/7/8
* FF 1.5/2/3
* Opera-9
* Safari-3
* Chrome-0.2
### Addendum
Firefox is the most liberal one in the manner of letting you capture all short-cuts even those that are built-in in the browser such as `Ctrl-t` for new tab, or `Ctrl-a` for selecting all text. You can always bubble them up to the browser by returning `true` in your handler.
Others, (IE) either let you handle built-in short-cuts, but will add their functionality after your code has executed. Or (Opera/Safari) will *not* pass those events to the DOM at all.
*So, if you bind `Ctrl-Q` or `Alt-F4` and your Safari/Opera window is closed don't be surprised.*
\ No newline at end of file
/*
* jQuery Hotkeys Plugin
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* http://github.com/jeresig/jquery.hotkeys
*
* Based upon the plugin by Tzury Bar Yochay:
* http://github.com/tzuryby/hotkeys
*
* Original idea by:
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
*/
(function(b){b.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};function a(d){if(typeof d.data!=="string"){return}var c=d.handler,e=d.data.toLowerCase().split(" ");d.handler=function(n){if(this!==n.target&&(/textarea|select/i.test(n.target.nodeName)||n.target.type==="text")){return}var h=n.type!=="keypress"&&b.hotkeys.specialKeys[n.which],o=String.fromCharCode(n.which).toLowerCase(),k,m="",g={};if(n.altKey&&h!=="alt"){m+="alt+"}if(n.ctrlKey&&h!=="ctrl"){m+="ctrl+"}if(n.metaKey&&!n.ctrlKey&&h!=="meta"){m+="meta+"}if(n.shiftKey&&h!=="shift"){m+="shift+"}if(h){g[m+h]=true}else{g[m+o]=true;g[m+b.hotkeys.shiftNums[o]]=true;if(m==="shift+"){g[b.hotkeys.shiftNums[o]]=true}}for(var j=0,f=e.length;j<f;j++){if(g[e[j]]){return c.apply(this,arguments)}}}}b.each(["keydown","keyup","keypress"],function(){b.event.special[this]={add:a}})})(jQuery);
\ No newline at end of file
This diff is collapsed.
jGraduate - A jQuery plugin for picking gradients
Licensed under the Apache License 2. See LICENSE for more information.
.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
/*
* 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;
}
.jGraduate_tabs li {
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_rgPick {
display: none;
border: outset 1px #666;
padding: 10px 7px 5px 5px;
overflow: auto;
/* position: relative;*/
}
.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.lg_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_RadiusField {
text-align: center;
float: left;
}
div.jGraduate_RadiusField input {
margin-top: 10px;
}
.jGraduate_RadiusField .jGraduate_Form_Section {
width: 250px;
padding: 2px;
height: 80px;
overflow: visible;
}
.jGraduate_Form_Section input[type=text] {
width: 38px;
}
.jGraduate_Radius {
border:1px solid #BBB;
cursor:ew-resize;
height:20px;
margin-top:14px;
position: relative;
}
.jGraduate_RadiusArrows {
top: 0;
left: 0;
position: absolute;
margin-top: -10px;
margin-left: 250.5px;
}
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;
}
.jGraduate_rgPick {
width: 530px;
}
.jGraduate_rgPick div.jGraduate_Form {
width: 270px;
position: absolute;
left: 284px;
width: 266px;
top: 130px;
margin: -3px 3px 0px 4px;
}
.jGraduate_Colorblocks {
display: table;
border-spacing: 0 5px;
}
.jGraduate_colorblock {
display: table-row;
}
.jGraduate_Colorblocks .jGraduate_colorblock > * {
display: table-cell;
vertical-align: middle;
margin: 0;
float: none;
}
.jGraduate_rgPick div.jGraduate_StopSection {
float: left;
width: 133px;
margin: 0;
}
.jGraduate_rgPick .jGraduate_OkCancel {
position: absolute;
right: 0;
}
.rg_jGraduate_OpacityField {
position: absolute;
left: 288px;
bottom: 24px;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/*
*
* jQuery Google Charts plugin 0.9
*
* $Date: 2009-02-19 11:56:22 +0100 (gio, 19 feb 2009) $
* $Rev: 46 $
*
* @requires
* Sugar Arrays - Dustin Diaz | http://www.dustindiaz.com
*
* Copyright (c) 2008 Massimiliano Balestrieri
* Examples and docs at: http://maxb.net/blog/
* Licensed GPL licenses:
* http://www.gnu.org/licenses/gpl.html
*
*/
if(!window.jGCharts){jGCharts={}}jGCharts.Api=function(){var G=0;var h=0;var C=0;var an=0;var g="http://chart.apis.google.com/chart?";var p={type:"cht",size:"chs",data:"chd",colors:"chco",scaling:"chds",axis_type:"chxt",axis_range:"chxr",axis_labels:"chxl",legend:"chdl",bar_width:"chbh",background:"chf",fillarea:"chm",title:"chtt",title_style:"chts",grid:"chg",line_style:"chls",agent:"agent"};var N=false;var ak=false;var ad=false;var E=false;var Z=false;var q=false;var S=false;var ap="bvg";var j="300x200";var T=false;var R=false;var am=false;var ao=false;var W=[];var X=1;var e="x,y";var al=false;var H=false;var I=false;var ae=false;var af="solid";var B="solid";var ab=90;var V=90;var y=10;var s=10;var aj=false;var w=false;var J=false;var i=false;var ac=false;var u=20;var l=1;var aa=false;var x=10;var A=10;var Q=10;var k=0;var U=false;var r=["5131C9","FFCC00","DA1B1B","FF9900","FF6600","CCFFFF","CCFF00","CCCCCC","FF99CC","999900","999999","66FF00","66CC00","669900","660099","33CC00","333399","000000"];var ag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function D(at,av){var au=[];for(var aq=0;aq<at.length;aq++){var ar=at[aq];if(!isNaN(ar)&&ar>=0){au.push(ag.charAt(Math.round((ag.length-1)*ar/av)))}else{au.push("_")}}return au.join("")}function P(){var aq=u;if(l){aq+=","+l}return aq}function K(){if(!ao.constructor==Array){throw new Error("Legend must be Array")}var ar="";for(var aq=0;aq<ao.length;aq++){ar+=ao[aq]+"|"}ar=O(ar,"|");return ar}function ai(){if(!am.constructor==Array){throw new Error("Data must be Array")}var ar="";var at=[];for(var aq=0;aq<am.length;aq++){if(am[aq].constructor!=Array){am[aq]=[am[aq]]}for(var au=0;au<am[aq].length;au++){if(!at[au]){at[au]=[]}at[au].push((am[aq][au]));if(at[au].length>h){h=at[au].length;G=am[aq].length}}if(N){L(sum(am[aq]));d(sum(am[aq]))}else{L(am[aq]);d(am[aq])}}if(E&&ac){at=c(at)}if(E&&i){at=o(at)}for(var au=0;au<at.length;au++){ar+=D(at[au],C)+","}ar=O(ar,",");return"s:"+ar}function o(at){var ar=[];for(var aq=1;aq<=h;aq++){ar.push(0)}at.push(ar);return at}function c(ar){var at=[];for(var aq=1;aq<=h;aq++){at.push(C)}ar.unshift(at);return ar}function M(){var at="";var au="";var ar=G;if(E&&ac){ar++}for(var aq=0;aq<ar;aq++){au=_colors[aq]||r[aq];at+=au+","}at=O(at,",");return at}function z(){return an+","+C}function L(aq){if(aq.constructor==Array){aq.forEach(function(ar){L(ar)})}else{if(C<aq){C=aq}}}function d(aq){if(aq.constructor==Array){aq.forEach(function(ar){d(ar)})}else{if(an>aq){an=aq}}}function F(){return"0,"+an+","+C+"|1,"+an+","+C}function f(){var au="";if(W.length==0&&h>10){X=parseInt(h/10)}if(ak){var ar=[];for(var aq=W.length;aq>0;aq--){ar.push(W[(aq-1)])}W=ar}for(var aq=0;aq<h;aq++){var av=(aq%X)==0?(W[aq]||aq):"";au+=av+"|"}au=O(au,"|");var at=(ak)?1:0;return at+":|"+au}function n(){var aq=a(af);var at=a(B);var ar="";if(al&&aj){al+=parseInt(aj)}if(al&&aq=="s"){ar="bg,s,"+al}if(al&&aq=="lg"){ar="bg,lg,"+ab+","+al+",0,"+I+",1"}if(al&&aq=="ls"){ar="bg,ls,"+ab+","+al+",0."+parseInt(y/10)+","+I+",0."+parseInt(y/10)}if(H&&w){H+=parseInt(w)}if(H&&al){ar+="|"}if(H&&at=="s"){ar+="c,s,"+H}if(H&&at=="lg"){ar+="c,lg,"+V+","+H+",0,"+ae+",1"}if(H&&at=="ls"){ar+="c,ls,"+V+","+H+",0."+parseInt(s/10)+","+ae+",0."+parseInt(s/10)}return ar}function a(aq){if(aq=="solid"){return"s"}if(aq=="gradient"){return"lg"}if(aq=="stripes"){return"ls"}return aq}function b(){var aq=[];var ar="";if(E){aq=M(_colors,ac).split(",");aq.forEach(function(au,at){ar+="b,"+au+","+at+","+(at+1)+",0|"});ar=O(ar,"|")}return ar}function Y(){var aq="";if(A>=0){aq+=A}if(x>=0){aq+=","+x}if(Q>=0){aq+=","+Q}if(k>=0){aq+=","+k}return aq}function t(){var aq="";U.forEach(function(ar){aq+=ar.join(",")+"|"});aq=O(aq,"|");return aq}function ah(aq){if(jGCharts.Api.type.indexOf(aq.type)!==-1){ap=aq.type}if(aq.size){j=aq.size}if(aq.data){am=aq.data}if(aq.legend){ao=aq.legend}if(aq.axis_labels){W=aq.axis_labels}if(aq.axis_step){X=aq.axis_step}if(aq.colors){_colors=aq.colors}else{_colors=[]}if(aq.lines){U=aq.lines}if(aq.title){T=aq.title}if(aq.title_color&&aq.title_size){R=aq.title_color+","+aq.title_size}if(aq.bar_width){u=aq.bar_width}if(aq.bar_spacing>=0){l=aq.bar_spacing}if(aq.fillarea){J=aq.fillarea}if(aq.fillbottom){i=aq.fillbottom}if(aq.filltop){ac=aq.filltop}if(aq.axis_type){e=aq.axis_type}if(aq.bg){al=aq.bg}if(aq.bg_type){af=aq.bg_type}if(aq.bg_offset){I=aq.bg_offset}if(aq.bg_width){y=aq.bg_width}if(aq.bg_angle>=0){ab=aq.bg_angle}if(aq.bg_trasparency){aj=aq.bg_trasparency}if(aq.chbg){H=aq.chbg}if(aq.chbg_type){B=aq.chbg_type}if(aq.chbg_offset){ae=aq.chbg_offset}if(aq.chbg_width){s=aq.chbg_width}if(aq.chbg_angle>=0){V=aq.chbg_angle}if(aq.chbg_trasparency){w=aq.chbg_trasparency}if(aq.grid){aa=aq.grid;if(aq.grid_x>=0){A=aq.grid_x}if(aq.grid_y>=0){x=aq.grid_y}if(aq.grid_line>=0){Q=aq.grid_line}if(aq.grid_blank>=0){k=aq.grid_blank}}}function m(ar,au,at){var aq=at?"":"&";return p[ar]+"="+au+aq}function v(){ad=ap.indexOf("v")!==-1;ak=ap.indexOf("h")!==-1;N=ap.indexOf("s")!==-1&&ap!="ls"&&ap!="lc";q=(ap=="ls"||ap=="lc");S=(ap=="p"||ap=="p3");E=q&&J;Z=ap.indexOf("b")!==-1}function O(ar,aq){return(ar.lastIndexOf(aq)!==-1)?ar.substr(0,ar.lastIndexOf(aq)):ar}return{make:function(ar){var aq=g;ah(ar);v();aq+=m("type",ap);aq+=m("size",j);if(T){aq+=m("title",T)}if(R){aq+=m("title_style",R)}if(Z){aq+=m("bar_width",P())}aq+=m("axis_type",e);if(!S&&ao.length>0){aq+=m("legend",K())}aq+=m("data",ai());aq+=m("scaling",z());aq+=m("axis_range",F());aq+=m("axis_labels",f());aq+=m("background",n());aq+=m("colors",M());if(q&&U){aq+=m("line_style",t())}if(aa){aq+=m("grid",Y())}if(q&&E){aq+=m("fillarea",b())}aq+=m("agent","jgcharts",true);return aq}}};jGCharts.Api.type=["bhs","bvs","bhg","bvg","lc","ls","p","p3"];function sum(a){return foldl(a,0,function(c,b){return c+b})}function foldl(a,d,c){for(var b=0;b<a.length;b++){d=c(d,a[b])}return d}Function.prototype.method=function(a,b){this.prototype[a]=b;return this};if(!Array.prototype.forEach){Array.method("forEach",function(d,e){var c=e||window;for(var b=0,a=this.length;b<a;++b){d.call(c,this[b],b,this)}}).method("every",function(d,e){var c=e||window;for(var b=0,a=this.length;b<a;++b){if(!d.call(c,this[b],b,this)){return false}}return true}).method("some",function(d,e){var c=e||window;for(var b=0,a=this.length;b<a;++b){if(d.call(c,this[b],b,this)){return true}}return false}).method("map",function(f,g){var e=g||window;var b=[];for(var d=0,c=this.length;d<c;++d){b.push(f.call(e,this[d],d,this))}return b}).method("filter",function(f,g){var e=g||window;var b=[];for(var d=0,c=this.length;d<c;++d){if(!f.call(e,this[d],d,this)){continue}b.push(this[d])}return b}).method("indexOf",function(c,d){var d=d||0;for(var b=d,a=this.length;b<a;++b){if(this[b]===c){return b}}return -1}).method("lastIndexOf",function(b,c){var c=c||this.length;if(c>=this.length){c=this.length}if(c<0){c=this.length+c}for(var a=c;a>=0;--a){if(this[a]===b){return a}}return -1})}jGCharts.Base={init:function(a){a=jQuery.extend({},a);return this.each(function(){if(!a.data){throw new Error("No Data")}var c=new jGCharts.Api();var b=c.make(a);jQuery("<img>").attr("src",b).appendTo(this);jQuery("<p>"+b+"</p>").appendTo(this)})}};jQuery.fn.jgcharts=jGCharts.Base.init;
\ No newline at end of file
/*
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
/*
* jQuery hashchange event - v1.2 - 2/11/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
\ No newline at end of file
This diff is collapsed.
/* Controls styling */
.jSheetControls_loc
{
border-width: 0px ! important;
background: none ! important;
width: 35px;
text-align: right;
}
.jSheetControls_formula
{
width: 99%;
height: 17px;
}
.jSheetLog
{
height: 100px;
width: 100%;
overflow-y: scroll;
position: relative;
}
.jSheetControls, .jSheetControls table
{
padding: 0px ! important;
border: none ! important;
width: 100%;
margin: 0px;
}
.jSheetMenu
{
cursor: pointer;
background-color: transparent ! important;
padding: 0px ! important;
margin: 0px ! important;
border: none ! important;
}
.jSheetMenu *
{
color: inherit ! important;
background-color: inherit ! important;
}
.menu
{
display: none;
}
#titleHolder
{
padding-left: 10px;
}
.jSheetUI
{
width: inherit ! important;
border-color: inherit ! important;
}
.jSheetTabContainer
{
vertical-align: bottom;
text-align: left ! important;
}
.jSheetTabContainer span
{
padding: 2px 5px 0 5px ! important;
cursor: pointer;
}
.jSheetTabContainer *, .menuDiv *
{
font-size: 1em ! important;
}
.tableControl
{
border-collapse: collapse ! important;
border: none ! important;
margin: none ! important;
padding: none ! important;
position: absolute ! important;
}
/* Sheet styling */
.jSheet
{
position: relative ! important;
margin-top: -1px ! important;
margin-left: -1px ! important;
table-layout: fixed;
empty-cells: show;
background-image: none ! important;
font-family: arial, serif;
overflow: hidden;
height: auto ! important;
border-spacing: 0px ! important;
border-width: 1px ! important;
margin-bottom: 20px ! important;
cursor: cell;
}
.jSheet tbody
{
background-color: transparent;
color: inherit ! important;
border-color: inherit ! important;
}
.jSheet tr {
border-color: inherit ! important;
padding: 0px ! important;
border-style: solid ! important;
background-color: transparent;
-moz-border-radius: 0px 0px 0px 0px;
color: inherit ! important;
border-width: 0px ! important;
}
.jSheet td, .jSheet th {
border-width: 1px ! important;
border-color: inherit;
padding: 0px ! important;
border-style: solid ! important;
-moz-border-radius: 0px 0px 0px 0px;
overflow: hidden ! important;
text-overflow: ellipsis ! important;
white-space: nowrap ! important;
margin: 0px ! important;
padding: 0px ! important;
font-size: 1em;
height: inherit ! important;
color: inherit;
position: relative;
min-width: 25px ! important;
}
.jSheet colgroup col
{
border: none ! important;
}
/* Containers styleing*/
.jSheetBarCorner
{
cursor: pointer;
border-width: 1px ! important;
}
.jSheetBarCornerParent
{
border: none ! important;
}
.jSheetBarTopParent
{
position: relative ! important;
background-image: none ! important;
vertical-align: middle;
overflow: hidden ! important;
cursor: pointer;
overflow: hidden ! important;
}
.jSheetBarLeftParent
{
position: relative ! important;
background-image: none ! important;
vertical-align: middle;
overflow: hidden ! important;
cursor: pointer;
overflow: hidden ! important;
}
.jSheetEditPane
{
overflow: auto ! important;
background-image: none ! important;
border-width: 0px;
position: relative ! important;
}
/* Bar item styling */
.jSheetBarTop
{
position: relative ! important;
border-width: 0px ! important;
min-width: 100000px;
}
.jSheetBarLeft
{
position: relative ! important;
border-width: 0px ! important;
min-height: 100000px;
}
.jSheetBarLeft div
{
text-align: center;
font-size: .8em;
height: inherit;
border-left: none ! important;
border-right: none ! important;
position: relative ! important;
vertical-align: middle ! important;
min-width: 14px ! important;
}
.jSheetBarTop div
{
text-align: center ! important;
font-size: .8em;
float: left;
display:block;
height: inherit ! important;
padding-top: 2px;
overflow: hidden;
border-top: none ! important;
border-bottom: none ! important;
min-width: 25px ! important;
}
.jSheetControls img
{
border: none;
}
.safeImg
{
display: inline;
height: inherit ! important;
width: inherit ! important;
}
.jSheetInPlaceEdit
{
position: absolute;
}
.colorPickers *
{
display: inline-block;
width: 16px ! important;
height: 16px ! important;
background-color: transparent ! important;
}
.jSheetFullScreen
{
top: 5px;
left: 5px;
position: fixed;
top: expression(eval(document.body.scrollTop + 15) + "px");
left: expression(eval(document.body.scrollLeft) + "px");
z-index: 9999;
}
.jSheetFullScreenTabContainer
{
bottom: 10px;
left: 10px;
position: fixed;
top: expression(eval(document.body.scrollTop + 15) + "px");
left: expression(eval(document.body.scrollLeft) + "px");
}
.jSheetAutoFiller
{
position: absolute;
height: 8px;
width: 8px;
top: 0px;
left: 0px;
cursor: crosshair ! important;
display: none;
}
.jSheetTitle, .jSheetInlineMenu
{
width: auto;
text-align: center;
}
.jSheetChart
{
width: inherit;
height: inherit;
}
.bodyNoScroll
{
overflow: hidden ! important;
}
.jSheetParent, .jSheetParent div
{
padding: 0px ! important;
}
/* Cell styler classes */
.styleBold
{ font-weight: bold; }
.styleItalics
{ font-style: italic; }
.styleUnderline
{ text-decoration: underline; }
.styleLineThrough
{ text-decoration: line-through;}
.styleLeft
{ text-align: left; }
.styleRight
{ text-align: right; }
.styleCenter
{ text-align: center; }
.styleTop
{ vertical-align: top; }
.styleMiddle
{ vertical-align: middle; }
.styleBottom
{ vertical-align: bottom; }
.styleUpper
{ text-transform: uppercase; }
.styleCapital
{ text-transform: capitalize; }
.styleLower
{ text-transform: lowercase; }
.styleHidden
{ display: none; }
.styleWrap
{ word-wrap: break-word; }
\ No newline at end of file
This diff is collapsed.
/*
Styles to make ordinary <INPUT type="text"/> look like a spinbutton/spinbox control.
Use with JQuerySpinBtn.js to provide the spin functionality by reacting to mouse etc.
(Requires a reference to the JQuery library found at http://jquery.com/src/latest/)
(Hats-off to John Resig for creating the excellent JQuery library. It is fab.)
This control is achieved with no extra html markup whatsoever and uses unobtrusive javascript.
Written by George Adamson, Software Unity (george.jquery@softwareunity.com) September 2006.
Big improvements added by Mark Gibson, (mgibson@designlinks.net) September 2006.
Do contact me with comments and suggestions but please don't ask for support.
As much as I'd love to help with specific problems I have plenty to get on with already!
Go ahead and use it in your own projects. This code is provided 'as is'.
Sure I've tested in heaps of ways. Its good for me, but you use it at your own risk.
SoftwareUnity and I are certainly not responsible if your computer sets fire to the sofa,
hacks into the pentagon, hijacks a plane or gives you any kind of hassle whatsoever.
If you'd like your spin-button image in a different place then you'll need to alter both
the CSS below and the javascript isMouseOverUpDn() function to accommodate the new position.
You could even have left and right buttons either side of the textbox.
*/
INPUT.spin-button {
/* explicitly put padding for top/bottom/left in here so that Opera displays it better */
padding: 2px 20px 2px 2px;
background-repeat:no-repeat; /* Warning: Img may disappear in Firefox if you use 'background-attachment:fixed' ! */
background-position:100% 0%;
background-image:url('spinbtn_updn.png');
background-color:white; /* Needed for Opera */
}
INPUT.spin-button.up { /* Change button img when mouse is over the UP-arrow */
cursor:pointer;
background-position:100% -18px; /* 18px matches height of 2 visible buttons */
}
INPUT.spin-button.down { /* Change button img when mouse is over the DOWN-arrow */
cursor:pointer;
background-position:100% -36px; /* 36px matches height of 2x2 visible buttons */
}
/* SpinButton control
*
* Adds bells and whistles to any ordinary textbox to
* make it look and feel like a SpinButton Control.
*
* Originally written by George Adamson, Software Unity (george.jquery@softwareunity.com) August 2006.
* - Added min/max options
* - Added step size option
* - Added bigStep (page up/down) option
*
* Modifications made by Mark Gibson, (mgibson@designlinks.net) September 2006:
* - Converted to jQuery plugin
* - Allow limited or unlimited min/max values
* - Allow custom class names, and add class to input element
* - Removed global vars
* - Reset (to original or through config) when invalid value entered
* - Repeat whilst holding mouse button down (with initial pause, like keyboard repeat)
* - Support mouse wheel in Firefox
* - Fix double click in IE
* - Refactored some code and renamed some vars
*
* Modifications by Jeff Schiller, June 2009:
* - provide callback function for when the value changes based on the following
* http://www.mail-archive.com/jquery-en@googlegroups.com/msg36070.html
* Modifications by Jeff Schiller, July 2009:
* - improve styling for widget in Opera
* - consistent key-repeat handling cross-browser
* Modifications by Alexis Deveria, October 2009:
* - provide "stepfunc" callback option to allow custom function to run when changing a value
* - Made adjustValue(0) only run on certain keyup events, not all.
*
* Tested in IE6, Opera9, Firefox 1.5
* v1.0 11 Aug 2006 - George Adamson - First release
* v1.1 Aug 2006 - George Adamson - Minor enhancements
* v1.2 27 Sep 2006 - Mark Gibson - Major enhancements
* v1.3a 28 Sep 2006 - George Adamson - Minor enhancements
* v1.4 18 Jun 2009 - Jeff Schiller - Added callback function
* v1.5 06 Jul 2009 - Jeff Schiller - Fixes for Opera.
* v1.6 13 Oct 2009 - Alexis Deveria - Added stepfunc function
* v1.7 21 Oct 2009 - Alexis Deveria - Minor fixes
* Fast-repeat for keys and live updating as you type.
* v1.8 12 Jan 2010 - Benjamin Thomas - Fixes for mouseout behavior.
* Added smallStep
Sample usage:
// Create group of settings to initialise spinbutton(s). (Optional)
var myOptions = {
min: 0, // Set lower limit.
max: 100, // Set upper limit.
step: 1, // Set increment size.
smallStep: 0.5, // Set shift-click increment size.
spinClass: mySpinBtnClass, // CSS class to style the spinbutton. (Class also specifies url of the up/down button image.)
upClass: mySpinUpClass, // CSS class for style when mouse over up button.
downClass: mySpinDnClass // CSS class for style when mouse over down button.
}
$(document).ready(function(){
// Initialise INPUT element(s) as SpinButtons: (passing options if desired)
$("#myInputElement").SpinButton(myOptions);
});
*/
$.fn.SpinButton = function(cfg){
return this.each(function(){
this.repeating = false;
// Apply specified options or defaults:
// (Ought to refactor this some day to use $.extend() instead)
this.spinCfg = {
//min: cfg && cfg.min ? Number(cfg.min) : null,
//max: cfg && cfg.max ? Number(cfg.max) : null,
min: cfg && !isNaN(parseFloat(cfg.min)) ? Number(cfg.min) : null, // Fixes bug with min:0
max: cfg && !isNaN(parseFloat(cfg.max)) ? Number(cfg.max) : null,
step: cfg && cfg.step ? Number(cfg.step) : 1,
stepfunc: cfg && cfg.stepfunc ? cfg.stepfunc : false,
page: cfg && cfg.page ? Number(cfg.page) : 10,
upClass: cfg && cfg.upClass ? cfg.upClass : 'up',
downClass: cfg && cfg.downClass ? cfg.downClass : 'down',
reset: cfg && cfg.reset ? cfg.reset : this.value,
delay: cfg && cfg.delay ? Number(cfg.delay) : 500,
interval: cfg && cfg.interval ? Number(cfg.interval) : 100,
_btn_width: 20,
_direction: null,
_delay: null,
_repeat: null,
callback: cfg && cfg.callback ? cfg.callback : null
};
// if a smallStep isn't supplied, use half the regular step
this.spinCfg.smallStep = cfg && cfg.smallStep ? cfg.smallStep : this.spinCfg.step/2;
this.adjustValue = function(i){
var v;
if(isNaN(this.value)) {
v = this.spinCfg.reset;
} else if($.isFunction(this.spinCfg.stepfunc)) {
v = this.spinCfg.stepfunc(this, i);
} else {
// weirdest javascript bug ever: 5.1 + 0.1 = 5.199999999
v = Number((Number(this.value) + Number(i)).toFixed(5));
}
if (this.spinCfg.min !== null) v = Math.max(v, this.spinCfg.min);
if (this.spinCfg.max !== null) v = Math.min(v, this.spinCfg.max);
this.value = v;
if ($.isFunction(this.spinCfg.callback)) this.spinCfg.callback(this);
};
$(this)
.addClass(cfg && cfg.spinClass ? cfg.spinClass : 'spin-button')
.mousemove(function(e){
// Determine which button mouse is over, or not (spin direction):
var x = e.pageX || e.x;
var y = e.pageY || e.y;
var el = e.target || e.srcElement;
var height = $(el).outerHeight()/2;
var direction =
(x > coord(el,'offsetLeft') + el.offsetWidth - this.spinCfg._btn_width)
? ((y < coord(el,'offsetTop') + height) ? 1 : -1) : 0;
if (direction !== this.spinCfg._direction) {
// Style up/down buttons:
switch(direction){
case 1: // Up arrow:
$(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);
break;
case -1: // Down arrow:
$(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);
break;
default: // Mouse is elsewhere in the textbox
$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);
}
// Set spin direction:
this.spinCfg._direction = direction;
}
})
.mouseout(function(){
// Reset up/down buttons to their normal appearance when mouse moves away:
$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);
this.spinCfg._direction = null;
window.clearInterval(this.spinCfg._repeat);
window.clearTimeout(this.spinCfg._delay);
})
.mousedown(function(e){
if ( e.button === 0 && this.spinCfg._direction != 0) {
// Respond to click on one of the buttons:
var self = this;
var stepSize = e.shiftKey ? self.spinCfg.smallStep : self.spinCfg.step
var adjust = function() {
self.adjustValue(self.spinCfg._direction * stepSize);
};
adjust();
// Initial delay before repeating adjustment
self.spinCfg._delay = window.setTimeout(function() {
adjust();
// Repeat adjust at regular intervals
self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
}, self.spinCfg.delay);
}
})
.mouseup(function(e){
// Cancel repeating adjustment
window.clearInterval(this.spinCfg._repeat);
window.clearTimeout(this.spinCfg._delay);
})
.dblclick(function(e) {
if ($.browser.msie)
this.adjustValue(this.spinCfg._direction * this.spinCfg.step);
})
.keydown(function(e){
// Respond to up/down arrow keys.
switch(e.keyCode){
case 38: this.adjustValue(this.spinCfg.step); break; // Up
case 40: this.adjustValue(-this.spinCfg.step); break; // Down
case 33: this.adjustValue(this.spinCfg.page); break; // PageUp
case 34: this.adjustValue(-this.spinCfg.page); break; // PageDown
}
})
/*
http://unixpapa.com/js/key.html describes the current state-of-affairs for
key repeat events:
- Safari 3.1 changed their model so that keydown is reliably repeated going forward
- Firefox and Opera still only repeat the keypress event, not the keydown
*/
.keypress(function(e){
if (this.repeating) {
// Respond to up/down arrow keys.
switch(e.keyCode){
case 38: this.adjustValue(this.spinCfg.step); break; // Up
case 40: this.adjustValue(-this.spinCfg.step); break; // Down
case 33: this.adjustValue(this.spinCfg.page); break; // PageUp
case 34: this.adjustValue(-this.spinCfg.page); break; // PageDown
}
}
// we always ignore the first keypress event (use the keydown instead)
else {
this.repeating = true;
}
})
// clear the 'repeating' flag
.keyup(function(e) {
this.repeating = false;
switch(e.keyCode){
case 38: // Up
case 40: // Down
case 33: // PageUp
case 34: // PageDown
case 13: this.adjustValue(0); break; // Enter/Return
}
})
.bind("mousewheel", function(e){
// Respond to mouse wheel in IE. (It returns up/dn motion in multiples of 120)
if (e.wheelDelta >= 120)
this.adjustValue(this.spinCfg.step);
else if (e.wheelDelta <= -120)
this.adjustValue(-this.spinCfg.step);
e.preventDefault();
})
.change(function(e){
this.adjustValue(0);
});
if (this.addEventListener) {
// Respond to mouse wheel in Firefox
this.addEventListener('DOMMouseScroll', function(e) {
if (e.detail > 0)
this.adjustValue(-this.spinCfg.step);
else if (e.detail < 0)
this.adjustValue(this.spinCfg.step);
e.preventDefault();
}, false);
}
});
function coord(el,prop) {
var c = el[prop], b = document.body;
while ((el = el.offsetParent) && (el != b)) {
if (!$.browser.msie || (el.currentStyle.position != 'relative'))
c += el[prop];
}
return c;
}
};
;$.fn.SpinButton=function(a){return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(d){var c;if(isNaN(this.value)){c=this.spinCfg.reset}else{if($.isFunction(this.spinCfg.stepfunc)){c=this.spinCfg.stepfunc(this,d)}else{c=Number((Number(this.value)+Number(d)).toFixed(5))}}if(this.spinCfg.min!==null){c=Math.max(c,this.spinCfg.min)}if(this.spinCfg.max!==null){c=Math.min(c,this.spinCfg.max)}this.value=c;if($.isFunction(this.spinCfg.callback)){this.spinCfg.callback(this)}};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(h){var d=h.pageX||h.x;var i=h.pageY||h.y;var f=h.target||h.srcElement;var c=$(f).outerHeight()/2;var g=(d>b(f,"offsetLeft")+f.offsetWidth-this.spinCfg._btn_width)?((i<b(f,"offsetTop")+c)?1:-1):0;if(g!==this.spinCfg._direction){switch(g){case 1:$(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);break;case -1:$(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);break;default:$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass)}this.spinCfg._direction=g}}).mouseout(function(){$(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);this.spinCfg._direction=null;window.clearInterval(this.spinCfg._repeat);window.clearTimeout(this.spinCfg._delay)}).mousedown(function(g){if(g.button===0&&this.spinCfg._direction!=0){var d=this;var c=g.shiftKey?d.spinCfg.smallStep:d.spinCfg.step;var f=function(){d.adjustValue(d.spinCfg._direction*c)};f();d.spinCfg._delay=window.setTimeout(function(){f();d.spinCfg._repeat=window.setInterval(f,d.spinCfg.interval)},d.spinCfg.delay)}}).mouseup(function(c){window.clearInterval(this.spinCfg._repeat);window.clearTimeout(this.spinCfg._delay)}).dblclick(function(c){if($.browser.msie){this.adjustValue(this.spinCfg._direction*this.spinCfg.step)}}).keydown(function(c){switch(c.keyCode){case 38:this.adjustValue(this.spinCfg.step);break;case 40:this.adjustValue(-this.spinCfg.step);break;case 33:this.adjustValue(this.spinCfg.page);break;case 34:this.adjustValue(-this.spinCfg.page);break}}).keypress(function(c){if(this.repeating){switch(c.keyCode){case 38:this.adjustValue(this.spinCfg.step);break;case 40:this.adjustValue(-this.spinCfg.step);break;case 33:this.adjustValue(this.spinCfg.page);break;case 34:this.adjustValue(-this.spinCfg.page);break}}else{this.repeating=true}}).keyup(function(c){this.repeating=false;switch(c.keyCode){case 38:case 40:case 33:case 34:case 13:this.adjustValue(0);break}}).bind("mousewheel",function(c){if(c.wheelDelta>=120){this.adjustValue(this.spinCfg.step)}else{if(c.wheelDelta<=-120){this.adjustValue(-this.spinCfg.step)}}c.preventDefault()}).change(function(c){this.adjustValue(0)});if(this.addEventListener){this.addEventListener("DOMMouseScroll",function(c){if(c.detail>0){this.adjustValue(-this.spinCfg.step)}else{if(c.detail<0){this.adjustValue(this.spinCfg.step)}}c.preventDefault()},false)}});function b(e,g){var f=e[g],d=document.body;while((e=e.offsetParent)&&(e!=d)){if(!$.browser.msie||(e.currentStyle.position!="relative")){f+=e[g]}}return f}};
\ No newline at end of file
This diff is collapsed.
/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* @link http://www.phpied.com/rgb-color-parser-in-javascript/
* @license Use it if you like it
*/
function RGBColor(color_string)
{
this.ok = false;
// strip any leading #
if (color_string.charAt(0) == '#') { // remove # if any
color_string = color_string.substr(1,6);
}
color_string = color_string.replace(/ /g,'');
color_string = color_string.toLowerCase();
// before getting into regexps, try simple matches
// and overwrite the input
var simple_colors = {
aliceblue: 'f0f8ff',
antiquewhite: 'faebd7',
aqua: '00ffff',
aquamarine: '7fffd4',
azure: 'f0ffff',
beige: 'f5f5dc',
bisque: 'ffe4c4',
black: '000000',
blanchedalmond: 'ffebcd',
blue: '0000ff',
blueviolet: '8a2be2',
brown: 'a52a2a',
burlywood: 'deb887',
cadetblue: '5f9ea0',
chartreuse: '7fff00',
chocolate: 'd2691e',
coral: 'ff7f50',
cornflowerblue: '6495ed',
cornsilk: 'fff8dc',
crimson: 'dc143c',
cyan: '00ffff',
darkblue: '00008b',
darkcyan: '008b8b',
darkgoldenrod: 'b8860b',
darkgray: 'a9a9a9',
darkgreen: '006400',
darkkhaki: 'bdb76b',
darkmagenta: '8b008b',
darkolivegreen: '556b2f',
darkorange: 'ff8c00',
darkorchid: '9932cc',
darkred: '8b0000',
darksalmon: 'e9967a',
darkseagreen: '8fbc8f',
darkslateblue: '483d8b',
darkslategray: '2f4f4f',
darkturquoise: '00ced1',
darkviolet: '9400d3',
deeppink: 'ff1493',
deepskyblue: '00bfff',
dimgray: '696969',
dodgerblue: '1e90ff',
feldspar: 'd19275',
firebrick: 'b22222',
floralwhite: 'fffaf0',
forestgreen: '228b22',
fuchsia: 'ff00ff',
gainsboro: 'dcdcdc',
ghostwhite: 'f8f8ff',
gold: 'ffd700',
goldenrod: 'daa520',
gray: '808080',
green: '008000',
greenyellow: 'adff2f',
honeydew: 'f0fff0',
hotpink: 'ff69b4',
indianred : 'cd5c5c',
indigo : '4b0082',
ivory: 'fffff0',
khaki: 'f0e68c',
lavender: 'e6e6fa',
lavenderblush: 'fff0f5',
lawngreen: '7cfc00',
lemonchiffon: 'fffacd',
lightblue: 'add8e6',
lightcoral: 'f08080',
lightcyan: 'e0ffff',
lightgoldenrodyellow: 'fafad2',
lightgrey: 'd3d3d3',
lightgreen: '90ee90',
lightpink: 'ffb6c1',
lightsalmon: 'ffa07a',
lightseagreen: '20b2aa',
lightskyblue: '87cefa',
lightslateblue: '8470ff',
lightslategray: '778899',
lightsteelblue: 'b0c4de',
lightyellow: 'ffffe0',
lime: '00ff00',
limegreen: '32cd32',
linen: 'faf0e6',
magenta: 'ff00ff',
maroon: '800000',
mediumaquamarine: '66cdaa',
mediumblue: '0000cd',
mediumorchid: 'ba55d3',
mediumpurple: '9370d8',
mediumseagreen: '3cb371',
mediumslateblue: '7b68ee',
mediumspringgreen: '00fa9a',
mediumturquoise: '48d1cc',
mediumvioletred: 'c71585',
midnightblue: '191970',
mintcream: 'f5fffa',
mistyrose: 'ffe4e1',
moccasin: 'ffe4b5',
navajowhite: 'ffdead',
navy: '000080',
oldlace: 'fdf5e6',
olive: '808000',
olivedrab: '6b8e23',
orange: 'ffa500',
orangered: 'ff4500',
orchid: 'da70d6',
palegoldenrod: 'eee8aa',
palegreen: '98fb98',
paleturquoise: 'afeeee',
palevioletred: 'd87093',
papayawhip: 'ffefd5',
peachpuff: 'ffdab9',
peru: 'cd853f',
pink: 'ffc0cb',
plum: 'dda0dd',
powderblue: 'b0e0e6',
purple: '800080',
red: 'ff0000',
rosybrown: 'bc8f8f',
royalblue: '4169e1',
saddlebrown: '8b4513',
salmon: 'fa8072',
sandybrown: 'f4a460',
seagreen: '2e8b57',
seashell: 'fff5ee',
sienna: 'a0522d',
silver: 'c0c0c0',
skyblue: '87ceeb',
slateblue: '6a5acd',
slategray: '708090',
snow: 'fffafa',
springgreen: '00ff7f',
steelblue: '4682b4',
tan: 'd2b48c',
teal: '008080',
thistle: 'd8bfd8',
tomato: 'ff6347',
turquoise: '40e0d0',
violet: 'ee82ee',
violetred: 'd02090',
wheat: 'f5deb3',
white: 'ffffff',
whitesmoke: 'f5f5f5',
yellow: 'ffff00',
yellowgreen: '9acd32'
};
for (var key in simple_colors) {
if (color_string == key) {
color_string = simple_colors[key];
}
}
// emd of simple type-in colors
// array of color definition objects
var color_defs = [
{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process: function (bits){
return [
parseInt(bits[1]),
parseInt(bits[2]),
parseInt(bits[3])
];
}
},
{
re: /^(\w{2})(\w{2})(\w{2})$/,
example: ['#00ff00', '336699'],
process: function (bits){
return [
parseInt(bits[1], 16),
parseInt(bits[2], 16),
parseInt(bits[3], 16)
];
}
},
{
re: /^(\w{1})(\w{1})(\w{1})$/,
example: ['#fb0', 'f0f'],
process: function (bits){
return [
parseInt(bits[1] + bits[1], 16),
parseInt(bits[2] + bits[2], 16),
parseInt(bits[3] + bits[3], 16)
];
}
}
];
// search through the definitions to find a match
for (var i = 0; i < color_defs.length; i++) {
var re = color_defs[i].re;
var processor = color_defs[i].process;
var bits = re.exec(color_string);
if (bits) {
channels = processor(bits);
this.r = channels[0];
this.g = channels[1];
this.b = channels[2];
this.ok = true;
}
}
// validate/cleanup values
this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
// some getters
this.toRGB = function () {
return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
}
this.toHex = function () {
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
if (r.length == 1) r = '0' + r;
if (g.length == 1) g = '0' + g;
if (b.length == 1) b = '0' + b;
return '#' + r + g + b;
}
// help
this.getHelpXML = function () {
var examples = new Array();
// add regexps
for (var i = 0; i < color_defs.length; i++) {
var example = color_defs[i].example;
for (var j = 0; j < example.length; j++) {
examples[examples.length] = example[j];
}
}
// add type-in colors
for (var sc in simple_colors) {
examples[examples.length] = sc;
}
var xml = document.createElement('ul');
xml.setAttribute('id', 'rgbcolor-examples');
for (var i = 0; i < examples.length; i++) {
try {
var list_item = document.createElement('li');
var list_color = new RGBColor(examples[i]);
var example_div = document.createElement('div');
example_div.style.cssText =
'margin: 3px; '
+ 'border: 1px solid black; '
+ 'background:' + list_color.toHex() + '; '
+ 'color:' + list_color.toHex()
;
example_div.appendChild(document.createTextNode('test'));
var list_item_value = document.createTextNode(
' ' + examples[i] + ' -> ' + list_color.toRGB() + ' -> ' + list_color.toHex()
);
list_item.appendChild(example_div);
list_item.appendChild(list_item_value);
xml.appendChild(list_item);
} catch(e){}
}
return xml;
}
}
/*
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<f.length;i++){q.push(f[i].name)};q
//var functions = ["clearSelection", "addToSelection", "removeFromSelection", "open", "save", "getSvgString", "setSvgString", "createLayer", "deleteCurrentLayer", "getNumLayers", "getLayer", "getCurrentLayer", "setCurrentLayer", "renameCurrentLayer", "setCurrentLayerPosition", "getLayerVisibility", "setLayerVisibility", "moveSelectedToLayer", "getLayerOpacity", "setLayerOpacity", "clear"];
//Newer, well, it extracts things that aren't documented as well. All functions accessible through the normal thingy can now be accessed though the API
//var l=[];for(var i in svgCanvas){if(typeof svgCanvas[i] == "function"){l.push(i)}};
//run in svgedit itself
var functions = ["updateElementFromJson", "embedImage", "fixOperaXML", "clearSelection", "addToSelection", "removeFromSelection", "addNodeToSelection", "open", "save", "getSvgString", "setSvgString", "createLayer", "deleteCurrentLayer", "getNumLayers", "getLayer", "getCurrentLayer", "setCurrentLayer", "renameCurrentLayer", "setCurrentLayerPosition", "getLayerVisibility", "setLayerVisibility", "moveSelectedToLayer", "getLayerOpacity", "setLayerOpacity", "clear", "clearPath", "getNodePoint", "clonePathNode", "deletePathNode", "getResolution", "getImageTitle", "setImageTitle", "setResolution", "setBBoxZoom", "setZoom", "getMode", "setMode", "getStrokeColor", "setStrokeColor", "getFillColor", "setFillColor", "setStrokePaint", "setFillPaint", "getStrokeWidth", "setStrokeWidth", "getStrokeStyle", "setStrokeStyle", "getOpacity", "setOpacity", "getFillOpacity", "setFillOpacity", "getStrokeOpacity", "setStrokeOpacity", "getTransformList", "getBBox", "getRotationAngle", "setRotationAngle", "each", "bind", "setIdPrefix", "getBold", "setBold", "getItalic", "setItalic", "getFontFamily", "setFontFamily", "getFontSize", "setFontSize", "getText", "setTextContent", "setImageURL", "setRectRadius", "setSegType", "quickClone", "beginUndoableChange", "changeSelectedAttributeNoUndo", "finishUndoableChange", "changeSelectedAttribute", "deleteSelectedElements", "groupSelectedElements", "ungroupSelectedElement", "moveToTopSelectedElement", "moveToBottomSelectedElement", "moveSelectedElements", "getStrokedBBox", "getVisibleElements", "cycleElement", "getUndoStackSize", "getRedoStackSize", "getNextUndoCommandText", "getNextRedoCommandText", "undo", "redo", "cloneSelectedElements", "alignSelectedElements", "getZoom", "getVersion", "setIconSize", "setLang", "setCustomHandlers"]
//TODO: rewrite the following, it's pretty scary.
for(var i = 0; i < functions.length; i++){
this[functions[i]] = (function(d){
return function(){
var t = this //new callback
for(var g = 0, args = []; g < arguments.length; g++){
args.push(arguments[g]);
}
var cbid = t.send(d,args, function(){}) //the callback (currently it's nothing, but will be set later
return function(newcallback){
t.callbacks[cbid] = newcallback; //set callback
}
}
})(functions[i])
}
//TODO: use AddEvent for Trident browsers, currently they dont support SVG, but they do support onmessage
var t = this;
window.addEventListener("message", function(e){
if(e.data.substr(0,4)=="SVGe"){ //because svg-edit is too longish
var data = e.data.substr(4);
var cbid = data.substr(0, data.indexOf(";"));
if(t.callbacks[cbid]){
if(data.substr(0,6) != "error:"){
t.callbacks[cbid](eval("("+data.substr(cbid.length+1)+")"))
}else{
t.callbacks[cbid](data, "error");
}
}
}
//this.stack.shift()[0](e.data,e.data.substr(0,5) == "ERROR"?'error':null) //replace with shift
}, false)
}
embedded_svg_edit.encode = function(obj){
//simple partial JSON encoder implementation
if(window.JSON && JSON.stringify) return JSON.stringify(obj);
var enc = arguments.callee; //for purposes of recursion
if(typeof obj == "boolean" || typeof obj == "number"){
return obj+'' //should work...
}else if(typeof obj == "string"){
//a large portion of this is stolen from Douglas Crockford's json2.js
return '"'+
obj.replace(
/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g
, function (a) {
return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
})
+'"'; //note that this isn't quite as purtyful as the usualness
}else if(obj.length){ //simple hackish test for arrayish-ness
for(var i = 0; i < obj.length; i++){
obj[i] = enc(obj[i]); //encode every sub-thingy on top
}
return "["+obj.join(",")+"]";
}else{
var pairs = []; //pairs will be stored here
for(var k in obj){ //loop through thingys
pairs.push(enc(k)+":"+enc(obj[k])); //key: value
}
return "{"+pairs.join(",")+"}" //wrap in the braces
}
}
embedded_svg_edit.prototype.send = function(name, args, callback){
var cbid = Math.floor(Math.random()*31776352877+993577).toString();
//this.stack.push(callback);
this.callbacks[cbid] = callback;
for(var argstr = [], i = 0; i < args.length; i++){
argstr.push(this.encode(args[i]))
}
var t = this;
setTimeout(function(){//delay for the callback to be set in case its synchronous
t.frame.contentWindow.postMessage(cbid+";svgCanvas['"+name+"']("+argstr.join(",")+")","*");
}, 0);
return cbid;
//this.stack.shift()("svgCanvas['"+name+"']("+argstr.join(",")+")")
}
Change type of xml / svg stuff
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg">
<g id="tool_closepath">
<svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<title>Layer 1</title>
<path stroke="#000" stroke-width="15" fill="#ffc8c8" d="m121.5,40l-84,106l27,115l166,2l29,-111"/>
<line x1="240" y1="136" x2="169.5" y2="74" stroke="#A00" stroke-width="25" fill="none"/>
<path stroke="none" fill ="#A00" d="m158,65l31,74l-3,-50l51,-3z"/>
<g stroke-width="15" stroke="#00f" fill="#0ff">
<circle r="30" cy="41" cx="123"/>
<circle r="30" cy="146" cx="40"/>
<circle r="30" cy="260" cx="69"/>
<circle r="30" cy="260" cx="228"/>
<circle r="30" cy="148" cx="260"/>
</g>
</g>
</svg>
</g>
<g id="tool_openpath">
<svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<title>Layer 1</title>
<path stroke="#000" stroke-width="15" fill="#ffc8c8" d="m123.5,38l-84,106l27,115l166,2l29,-111"/>
<line x1="276.5" y1="153" x2="108.5" y2="24" stroke="#000" stroke-width="10" fill="none"/>
<g stroke-width="15" stroke="#00f" fill="#0ff">
<circle r="30" cy="41" cx="123"/>
<circle r="30" cy="146" cx="40"/>
<circle r="30" cy="260" cx="69"/>
<circle r="30" cy="260" cx="228"/>
<circle r="30" cy="148" cx="260"/>
</g>
<g stroke="#A00" stroke-width="15" fill="none">
<line x1="168" y1="24" x2="210" y2="150"/>
<line x1="210" y1="24" x2="168" y2="150"/>
</g>
</g>
</svg>
</g>
<g id="svg_eof"/>
</svg>
\ No newline at end of file
/*
* ext-closepath.js
*
* Licensed under the Apache License, Version 2
*
* Copyright(c) 2010 Jeff Schiller
*
*/
// This extension adds a simple button to the contextual panel for paths
// The button toggles whether the path is open or closed
svgEditor.addExtension("ClosePath", function(S) {
var selElems,
updateButton = function(path) {
var seglist = path.pathSegList,
closed = seglist.getItem(seglist.numberOfItems - 1).pathSegType==1,
showbutton = closed ? '#tool_openpath' : '#tool_closepath',
hidebutton = closed ? '#tool_closepath' : '#tool_openpath';
$(hidebutton).hide();
$(showbutton).show();
},
showPanel = function(on) {
$('#closepath_panel').toggle(on);
if (on) {
var path = selElems[0];
if (path) updateButton(path);
}
},
toggleClosed = function() {
var path = selElems[0];
if (path) {
var seglist = path.pathSegList,
last = seglist.numberOfItems - 1;
// is closed
if(seglist.getItem(last).pathSegType == 1) {
seglist.removeItem(last);
}
else {
seglist.appendItem(path.createSVGPathSegClosePath());
}
updateButton(path);
}
};
return {
name: "ClosePath",
svgicons: "jquery_plugin/svg-editor/extensions/closepath_icons.svg",
buttons: [{
id: "tool_openpath",
type: "context",
panel: "closepath_panel",
title: "Open path",
events: {
'click': function() {
toggleClosed();
}
}
},
{
id: "tool_closepath",
type: "context",
panel: "closepath_panel",
title: "Close path",
events: {
'click': function() {
toggleClosed();
}
}
}],
callback: function() {
$('#closepath_panel').hide();
},
selectedChanged: function(opts) {
selElems = opts.elems;
var i = selElems.length;
while(i--) {
var elem = selElems[i];
if(elem && elem.tagName == 'path') {
if(opts.selectedElement && !opts.multiselected) {
showPanel(true);
} else {
showPanel(false);
}
} else {
showPanel(false);
}
}
}
};
});
<svg xmlns="http://www.w3.org/2000/svg">
<g id="tool_eyedropper">
<svg viewBox="0 0 320 320" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<defs>
<radialGradient id="eyedropper_svg_6" cx="0.5" cy="0.5" r="0.5">
<stop offset="0" stop-color="#ffffff" stop-opacity="1"/>
<stop offset="1" stop-color="#e5e5e5" stop-opacity="0.38"/>
</radialGradient>
<linearGradient id="eyedropper_svg_15" x1="0" y1="0" x2="0.58594" y2="0.55078">
<stop offset="0" stop-color="#ffffff" stop-opacity="0.57"/>
<stop offset="1" stop-color="#000056" stop-opacity="1"/>
</linearGradient>
<linearGradient id="eyedropper_svg_19" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffffff" stop-opacity="1"/>
<stop offset="1" stop-color="#ffffff" stop-opacity="0"/>
</linearGradient>
</defs>
<g display="inline">
<title>Layer 1</title>
<path d="m193.899994,73l-119.899979,118l-15,39.5l10.25,4.5l43.750015,-20l108.999969,-112l-28.100006,-30z" id="svg_3" fill="none" stroke="#000000" stroke-width="5"/>
<path d="m58.649994,232c-2.75,28.200012 -26.399994,28.950012 -21.899994,59c4.5,30.049988 55,28 55.5,-1.25c0.5,-29.25 -20.25,-28.75 -22.25,-54.75l-11.350006,-3z" id="svg_4" fill="#aa56ff" stroke="#000000" stroke-width="7"/>
<path d="m45.474976,269.275024l13.775024,0.474976l-0.75,16.75l-14.25,-1.25l1.224976,-15.974976z" id="svg_5" fill="url(#eyedropper_svg_6)" stroke-width="5" fill-opacity="0.73"/>
<path d="m217.899994,46c21.5,-101.549999 141.600006,20.449997 28.100006,33l-5,44l-63,-66l39.899994,-11z" id="svg_2" fill="#000000" stroke-width="5"/>
<path d="m206.825012,61.075008c3.712494,-2.46249 7.637482,-3.53751 14.424988,-5.575008c10.125,-16.5 32.875,-41.5 40.5,-35c7.625,6.5 -21.25,35.625 -37.5,39.25c-5.5,10.125 -8,13.875 -17.25,16.5c-2.837494,-8.162514 -4.262482,-12.337486 -0.174988,-15.174992z" id="svg_7" fill="url(#eyedropper_svg_15)" stroke-width="5"/>
<path d="m133.049988,134.75l46.950012,9.25l-66,70l-42.5,20.5l-11.5,-5l14,-37.5l59.049988,-57.25z" id="svg_11" fill="#aa56ff" stroke="#000000" stroke-width="7"/>
<path d="m71.425034,212.350006l9.050888,-20.022537l51.516724,-49.327469l8.507355,0.97197l-69.074966,68.378036z" id="svg_16" fill="url(#eyedropper_svg_19)" stroke-width="5"/>
</g>
</svg>
</g>
<g id="svg_eof"/>
</svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg">
<!--
Sample icons file. This file looks like an SVG file with groups as its
children. Each group element has an ID that must match the ID of the button given
in the extension. The SVG inside the group makes up the actual icon, and
needs use a viewBox instead of width/height for it to scale properly.
Multiple icons can be included, each within their own group.
-->
<g id="hello_world">
<svg width="102" height="102" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>Layer 1</title>
<rect ry="30" rx="30" x="2.5" y="2.5" width="97" height="97" id="svg_3" fill="#008000" stroke="#000000" stroke-width="5"/>
<text x="52.668" y="42.5" id="svg_1" fill="#ffffff" stroke="#000000" stroke-width="0" font-size="24" font-family="Monospace" text-anchor="middle" xml:space="preserve">Hello</text>
<text x="52.668" y="71.5" fill="#ffffff" stroke="#000000" stroke-width="0" font-size="24" font-family="Monospace" text-anchor="middle" xml:space="preserve" id="svg_2">World!</text>
</g>
</svg>
</g>
</svg>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment