TagSpaces is an offline, open source, document manager with tagging support
jquery mousewheel added to the viewerImage extension
Ilianabf3f84411f9
diff --git a/data/ext/viewerImage/jquery.mousewheel/LICENSE.txt b/data/ext/viewerImage/jquery.mousewheel/LICENSE.txtnew file mode 100644index 000000000..d64b7076b--- /dev/null+++ b/data/ext/viewerImage/jquery.mousewheel/LICENSE.txt@@ -0,0 +1,20 @@+Copyright (c) 2013, Brandon Aaron (http://brandonaaron.net/)++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.diff --git a/data/ext/viewerImage/jquery.mousewheel/jquery.mousewheel.js b/data/ext/viewerImage/jquery.mousewheel/jquery.mousewheel.jsnew file mode 100644index 000000000..021e90319--- /dev/null+++ b/data/ext/viewerImage/jquery.mousewheel/jquery.mousewheel.js@@ -0,0 +1,140 @@+/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)+ * Licensed under the MIT License (LICENSE.txt).+ *+ * Version: 3.1.6+ *+ * Requires: jQuery 1.2.2++ */++(function (factory) {+ if ( typeof define === 'function' && define.amd ) {+ // AMD. Register as an anonymous module.+ define(['jquery'], factory);+ } else if (typeof exports === 'object') {+ // Node/CommonJS style for Browserify+ module.exports = factory;+ } else {+ // Browser globals+ factory(jQuery);+ }+}(function ($) {++ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],+ slice = Array.prototype.slice,+ nullLowestDeltaTimeout, lowestDelta;++ if ( $.event.fixHooks ) {+ for ( var i = toFix.length; i; ) {+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;+ }+ }++ $.event.special.mousewheel = {+ version: '3.1.6',++ setup: function() {+ if ( this.addEventListener ) {+ for ( var i = toBind.length; i; ) {+ this.addEventListener( toBind[--i], handler, false );+ }+ } else {+ this.onmousewheel = handler;+ }+ },++ teardown: function() {+ if ( this.removeEventListener ) {+ for ( var i = toBind.length; i; ) {+ this.removeEventListener( toBind[--i], handler, false );+ }+ } else {+ this.onmousewheel = null;+ }+ }+ };++ $.fn.extend({+ mousewheel: function(fn) {+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');+ },++ unmousewheel: function(fn) {+ return this.unbind('mousewheel', fn);+ }+ });+++ function handler(event) {+ var orgEvent = event || window.event,+ args = slice.call(arguments, 1),+ delta = 0,+ deltaX = 0,+ deltaY = 0,+ absDelta = 0;+ event = $.event.fix(orgEvent);+ event.type = 'mousewheel';++ // Old school scrollwheel delta+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }++ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {+ deltaX = deltaY * -1;+ deltaY = 0;+ }++ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy+ delta = deltaY === 0 ? deltaX : deltaY;++ // New school wheel delta (wheel event)+ if ( 'deltaY' in orgEvent ) {+ deltaY = orgEvent.deltaY * -1;+ delta = deltaY;+ }+ if ( 'deltaX' in orgEvent ) {+ deltaX = orgEvent.deltaX;+ if ( deltaY === 0 ) { delta = deltaX * -1; }+ }++ // No change actually happened, no reason to go any further+ if ( deltaY === 0 && deltaX === 0 ) { return; }++ // Store lowest absolute delta to normalize the delta values+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );+ if ( !lowestDelta || absDelta < lowestDelta ) {+ lowestDelta = absDelta;+ }++ // Get a whole, normalized value for the deltas+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);++ // Add information to the event object+ event.deltaX = deltaX;+ event.deltaY = deltaY;+ event.deltaFactor = lowestDelta;++ // Add event and delta to the front of the arguments+ args.unshift(event, delta, deltaX, deltaY);++ // Clearout lowestDelta after sometime to better+ // handle multiple device types that give different+ // a different lowestDelta+ // Ex: trackpad = 3 and mouse wheel = 120+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);++ return ($.event.dispatch || $.event.handle).apply(this, args);+ }++ function nullLowestDelta() {+ lowestDelta = null;+ }++}));