diff --git a/Gruntfile.js b/Gruntfile.js index 419752e4..b077b431 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,6 +55,12 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: packageJson, + osdVersion: { + versionStr: packageJson.version, + major: parseInt(packageJson.version.split('.')[0], 10), + minor: parseInt(packageJson.version.split('.')[1], 10), + revision: parseInt(packageJson.version.split('.')[2], 10) + }, clean: { build: ["build"], package: [packageDir], diff --git a/changelog.txt b/changelog.txt index 01a3900f..c72b2cea 100644 --- a/changelog.txt +++ b/changelog.txt @@ -56,6 +56,7 @@ OPENSEADRAGON CHANGELOG * Viewer.innerTracker.scrollHandler: preventDefaultAction == true prevents viewer zooming on mousewheel/pinch * Fixed: IE8 error with custom buttons - "Object doesn't support this action" (#279) * Support IIIF servers that don't report tile dimensions (#286) +* Added a static 'version' property to OpenSeadragon. Useful for plugins that require specific OpenSeadragon versions. 0.9.131: diff --git a/package.json b/package.json index 63c432b9..9c53ceb0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "OpenSeadragon", - "version": "0.9.131", + "version": "1.0.0", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "devDependencies": { "grunt": "~0.4.1", diff --git a/src/openseadragon.js b/src/openseadragon.js index 33d0be8e..96b177de 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -415,24 +415,44 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ (function( $ ){ + /** + * The OpenSeadragon version. + * + * @member {Object} OpenSeadragon.version + * @property {String} versionStr - The version number as a string ('major.minor.revision'). + * @property {Number} major - The major version number. + * @property {Number} minor - The minor version number. + * @property {Number} revision - The revision number. + * @since 1.0.0 + */ + /* jshint ignore:start */ + $.version = { + versionStr: '<%= osdVersion.versionStr %>', + major: <%= osdVersion.major %>, + minor: <%= osdVersion.minor %>, + revision: <%= osdVersion.revision %> + }; + /* jshint ignore:end */ + + /** * Taken from jquery 1.6.1 * [[Class]] -> type pairs * @private */ var class2type = { - '[object Boolean]': 'boolean', - '[object Number]': 'number', - '[object String]': 'string', - '[object Function]': 'function', - '[object Array]': 'array', - '[object Date]': 'date', - '[object RegExp]': 'regexp', - '[object Object]': 'object' - }, - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty; + '[object Boolean]': 'boolean', + '[object Number]': 'number', + '[object String]': 'string', + '[object Function]': 'function', + '[object Array]': 'array', + '[object Date]': 'date', + '[object RegExp]': 'regexp', + '[object Object]': 'object' + }, + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty; /** * Taken from jQuery 1.6.1