From cb765afea2521f7820b0e2ca912b03becafc70cd Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Sat, 23 Nov 2013 10:39:37 -0800 Subject: [PATCH 1/6] Added an OpenSeadragon.version property --- changelog.txt | 1 + package.json | 2 +- src/openseadragon.js | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) 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 4a1fb29d..efae6051 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -277,6 +277,30 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ (function( $ ){ + /** + * The OpenSeadragon version. + * + * @member {Object} version + * @memberof OpenSeadragon + * @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. + */ + $.version = (function () { + // The version string ('x.x.x') is filled in by the grunt concat build task + // from the 'version' value in package.json + var versionStr = '<%= pkg.version %>', + versionComponents = versionStr.split( '.' ); + return { + versionStr: versionStr, + major: parseInt( versionComponents[ 0 ] ), + minor: parseInt( versionComponents[ 1 ] ), + revision: parseInt( versionComponents[ 2 ] ) + }; + }()); + + /** * Taken from jquery 1.6.1 * [[Class]] -> type pairs From 2a1b797767aa549710804e28fba3c6a6cded1b34 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 25 Nov 2013 09:19:50 -0800 Subject: [PATCH 2/6] Modified OpenSeadragon.version property Let grunt do more of the work! --- Gruntfile.js | 6 ++++++ src/openseadragon.js | 42 ++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 419752e4..80d133e1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,6 +55,12 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: packageJson, + version: { + versionStr: packageJson.version, + major: parseInt(packageJson.version.split('.')[0]), + minor: parseInt(packageJson.version.split('.')[1]), + revision: parseInt(packageJson.version.split('.')[2]) + }, clean: { build: ["build"], package: [packageDir], diff --git a/src/openseadragon.js b/src/openseadragon.js index efae6051..f1e6ba8c 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -287,18 +287,12 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ * @property {Number} minor - The minor version number. * @property {Number} revision - The revision number. */ - $.version = (function () { - // The version string ('x.x.x') is filled in by the grunt concat build task - // from the 'version' value in package.json - var versionStr = '<%= pkg.version %>', - versionComponents = versionStr.split( '.' ); - return { - versionStr: versionStr, - major: parseInt( versionComponents[ 0 ] ), - minor: parseInt( versionComponents[ 1 ] ), - revision: parseInt( versionComponents[ 2 ] ) - }; - }()); + $.version = { + versionStr: '<%= version.versionStr %>', + major: parseInt('<%= version.major %>'), + minor: parseInt('<%= version.minor %>'), + revision: parseInt('<%= version.revision %>') + }; /** @@ -307,18 +301,18 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ * @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 From f0d6a5872fb09bd23a78d871de7288e751955477 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 25 Nov 2013 09:30:49 -0800 Subject: [PATCH 3/6] OpenSeadragon.version property change grunt property name changed to be more OpenSeadragon-specific --- Gruntfile.js | 2 +- src/openseadragon.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 80d133e1..5243921a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,7 +55,7 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: packageJson, - version: { + osdVersion: { versionStr: packageJson.version, major: parseInt(packageJson.version.split('.')[0]), minor: parseInt(packageJson.version.split('.')[1]), diff --git a/src/openseadragon.js b/src/openseadragon.js index f1e6ba8c..368646ee 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -280,18 +280,17 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ /** * The OpenSeadragon version. * - * @member {Object} version - * @memberof OpenSeadragon + * @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. */ $.version = { - versionStr: '<%= version.versionStr %>', - major: parseInt('<%= version.major %>'), - minor: parseInt('<%= version.minor %>'), - revision: parseInt('<%= version.revision %>') + versionStr: '<%= osdVersion.versionStr %>', + major: parseInt('<%= osdVersion.major %>'), + minor: parseInt('<%= osdVersion.minor %>'), + revision: parseInt('<%= osdVersion.revision %>') }; From 2684f0ab3a0c0ecedeab92e6addd8195a2ab0926 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 25 Nov 2013 10:44:34 -0800 Subject: [PATCH 4/6] Added radix to parseInt()s --- Gruntfile.js | 6 +++--- src/openseadragon.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5243921a..b077b431 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -57,9 +57,9 @@ module.exports = function(grunt) { pkg: packageJson, osdVersion: { versionStr: packageJson.version, - major: parseInt(packageJson.version.split('.')[0]), - minor: parseInt(packageJson.version.split('.')[1]), - revision: parseInt(packageJson.version.split('.')[2]) + major: parseInt(packageJson.version.split('.')[0], 10), + minor: parseInt(packageJson.version.split('.')[1], 10), + revision: parseInt(packageJson.version.split('.')[2], 10) }, clean: { build: ["build"], diff --git a/src/openseadragon.js b/src/openseadragon.js index 368646ee..1eadf026 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -288,9 +288,9 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ */ $.version = { versionStr: '<%= osdVersion.versionStr %>', - major: parseInt('<%= osdVersion.major %>'), - minor: parseInt('<%= osdVersion.minor %>'), - revision: parseInt('<%= osdVersion.revision %>') + major: parseInt( '<%= osdVersion.major %>', 10 ), + minor: parseInt( '<%= osdVersion.minor %>', 10 ), + revision: parseInt( '<%= osdVersion.revision %>', 10 ) }; From f34fe1b6e50d9472ca1e39815c98af86e06c9029 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 25 Nov 2013 11:51:36 -0800 Subject: [PATCH 5/6] Added @since doclet tag to OpenSeadragon.version --- src/openseadragon.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openseadragon.js b/src/openseadragon.js index 1eadf026..0dfd989c 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -285,6 +285,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ * @property {Number} major - The major version number. * @property {Number} minor - The minor version number. * @property {Number} revision - The revision number. + * @since 1.0.0 */ $.version = { versionStr: '<%= osdVersion.versionStr %>', From 12596b2ee5a6c41b63133a03113614be89fe8b9d Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 25 Nov 2013 12:02:43 -0800 Subject: [PATCH 6/6] Add jshint ignore directives to version --- src/openseadragon.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 0dfd989c..6b584e2f 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -287,12 +287,14 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ * @property {Number} revision - The revision number. * @since 1.0.0 */ + /* jshint ignore:start */ $.version = { versionStr: '<%= osdVersion.versionStr %>', - major: parseInt( '<%= osdVersion.major %>', 10 ), - minor: parseInt( '<%= osdVersion.minor %>', 10 ), - revision: parseInt( '<%= osdVersion.revision %>', 10 ) + major: <%= osdVersion.major %>, + minor: <%= osdVersion.minor %>, + revision: <%= osdVersion.revision %> }; + /* jshint ignore:end */ /**