- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented
- Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
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.
|
||||
Use with jQuery.SpinButton.js to provide the spin functionality by reacting to mouse etc.
|
||||
(Requires a reference to the JQuery library found at http://code.jquery.com/)
|
||||
(Hats-off to John Resig for creating the excellent JQuery library. It is fab.)
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
/* SpinButton control
|
||||
/**
|
||||
* SpinButton control
|
||||
*
|
||||
* Adds bells and whistles to any ordinary textbox to
|
||||
* make it look and feel like a SpinButton Control.
|
||||
*
|
||||
* Supplies {@link external:jQuery.fn.SpinButton} (and also {@link external:jQuery.loadingStylesheets})
|
||||
*
|
||||
* Originally written by George Adamson, Software Unity (george.jquery@softwareunity.com) August 2006.
|
||||
* - Added min/max options
|
||||
* - Added step size option
|
||||
@@ -21,29 +24,32 @@
|
||||
*
|
||||
* Modifications by Jeff Schiller, June 2009:
|
||||
* - provide callback function for when the value changes based on the following
|
||||
* https://www.mail-archive.com/jquery-en@googlegroups.com/msg36070.html
|
||||
* {@link https://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
|
||||
* ? 20 May 2018 - Brett Zamir - Avoid SVGEdit dependency via `stateObj` config;
|
||||
convert to ES6 module
|
||||
Sample usage:
|
||||
*
|
||||
* | Version | Date | Author | Notes
|
||||
* |---------|------|--------|------|
|
||||
* | 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.<br />Fast-repeat for keys and live updating as you type.
|
||||
* | v1.8 | 12 Jan 2010 | Benjamin Thomas | Fixes for mouseout behavior.<br />Added smallStep
|
||||
* | v1.9 | 20 May 2018 | Brett Zamir | Avoid SVGEdit dependency via `stateObj` config;<br />convert to ES6 module |
|
||||
* @module jQuerySpinButton
|
||||
* @example
|
||||
|
||||
// Create group of settings to initialise spinbutton(s). (Optional)
|
||||
const myOptions = {
|
||||
@@ -62,14 +68,51 @@
|
||||
$("#myInputElement").SpinButton(myOptions);
|
||||
});
|
||||
*/
|
||||
/**
|
||||
* @function module:jQuerySpinButton.jQuerySpinButton
|
||||
* @param {external:jQuery} $ The jQuery object to which to add the plug-in
|
||||
* @returns {external:jQuery}
|
||||
*/
|
||||
export default function ($) {
|
||||
if (!$.loadingStylesheets) {
|
||||
$.loadingStylesheets = [];
|
||||
}
|
||||
const stylesheet = 'spinbtn/JQuerySpinBtn.css';
|
||||
const stylesheet = 'spinbtn/jQuery.SpinButton.css';
|
||||
if (!$.loadingStylesheets.includes(stylesheet)) {
|
||||
$.loadingStylesheets.push(stylesheet);
|
||||
}
|
||||
/**
|
||||
* @callback module:jQuerySpinButton.StepCallback
|
||||
* @param {external:jQuery} thisArg Value of `this`
|
||||
*/
|
||||
/**
|
||||
* @callback module:jQuerySpinButton.ValueCallback
|
||||
* @param {external:jQuery} thisArg Value of `this`
|
||||
* @param {Float} value Value that was changed
|
||||
*/
|
||||
/**
|
||||
* @typedef {PlainObject} module:jQuerySpinButton.SpinButtonConfig
|
||||
* @property {Float} min Set lower limit
|
||||
* @property {Float} max Set upper limit.
|
||||
* @property {Float} step Set increment size.
|
||||
* @property {module:jQuerySpinButton.StepCallback} stepfunc Custom function to run when changing a value; called with `this` of object and the value to adjust
|
||||
* @property {module:jQuerySpinButton.ValueCallback} callback Called after value adjusted (with `this` of object)
|
||||
* @property {Float} smallStep Set shift-click increment size.
|
||||
* @property {PlainObject} stateObj Object to allow passing in live-updating scale
|
||||
* @property {Float} stateObj.tool_scale
|
||||
* @property {string} spinClass CSS class to style the spinbutton. (Class also specifies url of the up/down button image.)
|
||||
* @property {string} upClass CSS class for style when mouse over up button.
|
||||
* @property {string} downClass CSS class for style when mouse over down button.
|
||||
* @property {Float} page Value to be adjusted on page up/page down
|
||||
* @property {Float} reset Reset value when invalid value entered
|
||||
* @property {Float} delay Millisecond delay
|
||||
* @property {Float} interval Millisecond interval
|
||||
*/
|
||||
/**
|
||||
* @function external:jQuery.fn.SpinButton
|
||||
* @param {module:jQuerySpinButton.SpinButtonConfig} cfg
|
||||
* @returns {external:jQuery}
|
||||
*/
|
||||
$.fn.SpinButton = function (cfg) {
|
||||
cfg = cfg || {};
|
||||
function coord (el, prop) {
|
||||
Reference in New Issue
Block a user