1/** 2 * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!) 3 * Common usage: wipe images (left and right to show the previous or next image) 4 * 5 * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de) 6 * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems) 7 * @version 1.1 (1st September 2010) - support wipe up and wipe down 8 * @version 1.0 (15th July 2010) 9 */ 10(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery); 11 12/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) 13* Licensed under the MIT License (LICENSE.txt). 14* 15* Version: 3.1.6 16* 17* Requires: jQuery 1.2.2+ 18*/ 19 20(function (factory) { 21 if ( typeof define === 'function' && define.amd ) { 22 // AMD. Register as an anonymous module. 23 define(['jquery'], factory); 24 } else if (typeof exports === 'object') { 25 // Node/CommonJS style for Browserify 26 module.exports = factory; 27 } else { 28 // Browser globals 29 factory(jQuery); 30 } 31}(function ($) { 32 33 var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], 34 toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? 35 ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], 36 slice = Array.prototype.slice, 37 nullLowestDeltaTimeout, lowestDelta; 38 39 if ( $.event.fixHooks ) { 40 for ( var i = toFix.length; i; ) { 41 $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 42 } 43 } 44 45 $.event.special.mousewheel = { 46 version: '3.1.6', 47 48 setup: function() { 49 if ( this.addEventListener ) { 50 for ( var i = toBind.length; i; ) { 51 this.addEventListener( toBind[--i], handler, false ); 52 } 53 } else { 54 this.onmousewheel = handler; 55 } 56 }, 57 58 teardown: function() { 59 if ( this.removeEventListener ) { 60 for ( var i = toBind.length; i; ) { 61 this.removeEventListener( toBind[--i], handler, false ); 62 } 63 } else { 64 this.onmousewheel = null; 65 } 66 } 67 }; 68 69 $.fn.extend({ 70 mousewheel: function(fn) { 71 return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); 72 }, 73 74 unmousewheel: function(fn) { 75 return this.unbind('mousewheel', fn); 76 } 77 }); 78 79 80 function handler(event) { 81 var orgEvent = event || window.event, 82 args = slice.call(arguments, 1), 83 delta = 0, 84 deltaX = 0, 85 deltaY = 0, 86 absDelta = 0; 87 event = $.event.fix(orgEvent); 88 event.type = 'mousewheel'; 89 90 // Old school scrollwheel delta 91 if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } 92 if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } 93 if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } 94 if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } 95 96 // Firefox < 17 horizontal scrolling related to DOMMouseScroll event 97 if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 98 deltaX = deltaY * -1; 99 deltaY = 0; 100 } 101 102 // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy 103 delta = deltaY === 0 ? deltaX : deltaY; 104 105 // New school wheel delta (wheel event) 106 if ( 'deltaY' in orgEvent ) { 107 deltaY = orgEvent.deltaY * -1; 108 delta = deltaY; 109 } 110 if ( 'deltaX' in orgEvent ) { 111 deltaX = orgEvent.deltaX; 112 if ( deltaY === 0 ) { delta = deltaX * -1; } 113 } 114 115 // No change actually happened, no reason to go any further 116 if ( deltaY === 0 && deltaX === 0 ) { return; } 117 118 // Store lowest absolute delta to normalize the delta values 119 absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); 120 if ( !lowestDelta || absDelta < lowestDelta ) { 121 lowestDelta = absDelta; 122 } 123 124 // Get a whole, normalized value for the deltas 125 delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); 126 deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); 127 deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); 128 129 // Add information to the event object 130 event.deltaX = deltaX; 131 event.deltaY = deltaY; 132 event.deltaFactor = lowestDelta; 133 134 // Add event and delta to the front of the arguments 135 args.unshift(event, delta, deltaX, deltaY); 136 137 // Clearout lowestDelta after sometime to better 138 // handle multiple device types that give different 139 // a different lowestDelta 140 // Ex: trackpad = 3 and mouse wheel = 120
141 if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } 142 nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); 143 144 return ($.event.dispatch || $.event.handle).apply(this, args); 145 } 146 147 function nullLowestDelta() { 148 lowestDelta = null; 149 } 150 151})); 152 153jQuery(function() { 154 $=jQuery; 155 $.event.special.tap = { 156 // Abort tap if touch moves further than 10 pixels in any direction 157 distanceThreshold: 10, 158 // Abort tap if touch lasts longer than half a second 159 timeThreshold: 500, 160 setup: function() { 161 var self = this, 162 $self = $(self); 163 164 // Bind touch start 165 $self.on('touchstart', function(startEvent) { 166 // Save the target element of the start event 167 var target = startEvent.target, 168 touchStart = startEvent.originalEvent.touches[0], 169 startX = touchStart.pageX, 170 startY = touchStart.pageY, 171 threshold = $.event.special.tap.distanceThreshold, 172 timeout; 173 174 function removeTapHandler() { 175 clearTimeout(timeout); 176 $self.off('touchmove', moveHandler).off('touchend', tapHandler); 177 }; 178 179 function tapHandler(endEvent) { 180 removeTapHandler(); 181 182 // When the touch end event fires, check if the target of the 183 // touch end is the same as the target of the start, and if 184 // so, fire a click. 185 if (target == endEvent.target) { 186 $.event.simulate('tap', self, endEvent); 187 } 188 }; 189 190 // Remove tap and move handlers if the touch moves too far 191 function moveHandler(moveEvent) { 192 var touchMove = moveEvent.originalEvent.touches[0], 193 moveX = touchMove.pageX, 194 moveY = touchMove.pageY; 195 196 if (Math.abs(moveX - startX) > threshold || 197 Math.abs(moveY - startY) > threshold) { 198 removeTapHandler(); 199 } 200 }; 201 202 // Remove the tap and move handlers if the timeout expires 203 timeout = setTimeout(removeTapHandler, $.event.special.tap.timeThreshold); 204 205 // When a touch starts, bind a touch end and touch move handler 206 $self.on('touchmove', moveHandler).on('touchend', tapHandler); 207 }); 208 } 209 }; 210}); 211 212 jQuery(function() { 213 jQuery("#meisterbox_overlay").click(function() { 214 jQuery(this).fadeOut(); 215 }); 216 217 }); 218 219 Meisterbox = (function() { 220 var $=jQuery, data, current, hooked=false; 221 var $all, $box, $overlay, $left, $right, $bottom, $slides, $circles; 222 223 function Meisterbox(data) { 224 this.data = data; 225 this.init(); 226 } 227 228 Meisterbox.prototype.init = function() { 229 this.$slides = []; 230 this.$circles = []; 231 this.current = 0; 232 this.scrollright = 0; 233 this.scrollleft = 0; 234 this.create_elements(); 235 this.bind_methods(); 236 this.prepare(); 237 }; 238 239 Meisterbox.prototype.prepare = function() { 240 $.each(this.$slides, function(i, v) { 241 v.hide().css({ marginLeft: -18, marginTop: -18, opacity: 0.3}); 242 }); 243 this.$slides[this.current].show(); 244 this.$circles[this.current].addClass("selected"); 245 } 246 247 Meisterbox.prototype.show_slide = function(i) { 248 var pos = i; 249 if(pos>=this.data.length) 250 pos = 0; 251 if(pos<0) 252 pos = this.data.length-1; 253 254 this.load_slide(pos); 255 this.resize_slide(pos); 256 this.$slides[pos].show(); 257 this.$bottom.find(".meister_circle").removeClass("selected"); 258 this.$circles[pos].addClass("selected"); 259 this.current = pos; 260 $.each(this.$slides, function(i, v) { 261 if(pos!=i) 262 v.hide(); 263 }); 264 } 265 266 Meisterbox.prototype.load_slide = function(i) { 267 var _i = i; 268 var _this = this; 269 var src = this.data[i]["src"]; 270 var $slide = this.$slides[i]; 271 var $img = $slide.find("img"); 272 273 if($img.attr("status")!=="notloaded") 274 return; 275 276 loader = new Image(); 277 loader.onload = function() { 278 $slide.css("visibility", "hidden"); 279 $img.attr("src", src) 280 .attr("status", "loaded") 281 .attr("o_width", loader.width) 282 .attr("o_height", loader.height); 283 284 _this.resize_slide(_i); 285 } 286 287 loader.src = src; 288 } 289 290 Meisterbox.prototype.resize_slide = function(i) { 291 var max_width = $(document).width() - 128 - 128 - 30; 292 var max_height = $(document).height() - this.$bottom.height()*2 - 30-52; 293 if(document!==top.document) { 294 max_width = $(top).width() - 128 - 128 - 30; 295 max_height = $(top).height() - this.$bottom.height()*2 - 30-52; 296 } 297 //console.log(document===top.document); 298 var $slide = this.$slides[i]; 299 var $img = $slide.find("img"); 300 301 if($img.attr("status")==="notloaded") 302 return; 303 304 var image_width = parseInt($img.attr("o_width"),10); 305 var image_height = parseInt($img.attr("o_height"),10); 306 307 308 if ((image_width > max_width) || (image_height> max_height)) { 309 if ((image_width / max_width) > (image_height / max_height)) { 310 image_height = parseInt(image_height / (image_width / max_width), 10); 311 image_width = max_width; 312 } else { 313 image_width = parseInt(image_width / (image_height / max_height), 10); 314 image_height = max_height; 315 } 316 } 317 $slide.stop().css({ marginLeft: -(image_width+22)/2, marginTop: -(image_height+22)/2, opacity: 1.0}).stop().css("visibility", "visible");
318 $img.height(image_height) 319 .width(image_width); 320 321 } 322 323 Meisterbox.prototype.create_elements = function() { 324 var _this = this; 325 this.create_slides(); 326 this.$all = $("<div>"); 327 this.$box = $("<div>").addClass("meisterbox"); 328 $.each(this.$slides, function(i, v) { 329 _this.$box.append(v); 330 }); 331 this.$overlay = $("<div>").addClass("meisterbox_overlay"); 332 this.$box.append(this.$overlay); 333 this.$left = $("<div>").addClass("meisterbox_left"); 334 this.$right = $("<div>").addClass("meisterbox_right"); 335 this.$bottom = $("<div>").addClass("meisterbox_bottom"); 336 $.each(this.$circles, function(i, v) { 337 _this.$bottom.append(v); 338 }); 339 this.$all.append(this.$box) 340 .append(this.$left) 341 .append(this.$right) 342 .append(this.$bottom); 343 }; 344 345 Meisterbox.prototype.create_slides = function() { 346 var _this = this; 347 $.each(this.data, function(i, v) { 348 var type=v["type"], src=v["src"], caption=v["caption"]; 349 350 $slide = $("<div>").addClass("meisterbox_content").attr("slide", i); 351 $img = $("<img>").attr("status", "notloaded");//.attr("src", "../images/ajax-loader.gif") 352 $slide.append($img); 353 if(caption!="") { 354 $div = $("<div>").addClass("meisterbox_caption").hide(); 355 $p = $("<p>").text(v["caption"]); 356 $slide.append($div.append($p)); 357 } 358 $circle = $("<span>").addClass("meister_circle"); 359 _this.$slides.push($slide); 360 _this.$circles.push($circle); 361 }); 362 } 363 364 Meisterbox.prototype.enable = function(element) { 365 if(!this.hooked) 366 $("body", top.document).append(this.$all); 367 this.$all.fadeIn(); 368 this.load_slide(this.current); 369 this.enable_keyboard(); 370 this.enable_resize(); 371 } 372 373 Meisterbox.prototype.enable_keyboard = function() { 374 var _this = this; 375 $(top.document).bind("keyup", function(e) { 376 var code = e.keyCode; 377 if(code==39) 378 _this.show_slide(_this.current+1); 379 else if(code==37) 380 _this.show_slide(_this.current-1); 381 else if(code===27) 382 _this.disable(); 383 //console.log(e); 384 }); 385 } 386 387 Meisterbox.prototype.enable_resize = function() { 388 var _this = this; 389 $(top).bind("resize", function(e) { 390 //console.log(e); 391 _this.resize_slide(_this.current); 392 }); 393 _this.resize_slide(_this.current); 394 } 395 Meisterbox.prototype.disable_resize = function() { 396 $(top).unbind("resize"); 397 } 398 Meisterbox.prototype.disable_keyboard = function() { 399 $(document).unbind("keyup"); 400 } 401 402 Meisterbox.prototype.disable = function(element) { 403 this.$all.fadeOut(); 404 this.disable_keyboard(); 405 this.disable_resize(); 406 } 407 408 Meisterbox.prototype.bind_methods = function(element) { 409 var _this = this; 410 this.$overlay.click(function() { 411 _this.disable(); 412 }); 413 this.$left.bind("tap click", function(e) { 414 _this.show_slide(_this.current-1); 415 e.preventDefault(); 416 }); 417 418 this.$right.on("tap click", function(e) { 419 _this.show_slide(_this.current+1); 420 e.preventDefault(); 421 }); 422 423 $.each(this.$slides, function(i, v) { 424 var __this = _this; 425 v.mouseenter(function() { 426 jQuery(this).find(".meisterbox_caption").fadeIn(); 427 }); 428 v.mouseleave(function() { 429 jQuery(this).find(".meisterbox_caption").fadeOut(); 430 }); 431 }); 432 this.$all.touchwipe({ 433 wipeLeft: function() { _this.show_slide(_this.current+1); }, 434 wipeRight: function() { _this.show_slide(_this.current-1); }, 435 min_move_x: 40, 436 min_move_y: 40, 437 }); 438 $.each(this.$circles, function(i, v) { 439 var __this = _this; 440 v.click(function() { 441 __this.show_slide(i); 442 }); 443 }); 444 this.$all.bind('touchmove', function(event) { event.preventDefault() }); 445 this.$all.on('mousewheel', function(event) { 446 if(event.deltaY==-1) { 447 if(_this.scrollright>=1) { 448 _this.show_slide(_this.current+1); 449 _this.scrollright=0; 450 } else { 451 _this.scrollright++; 452 } 453 _this.scrollleft=0; 454 } else if(event.deltaY==1) { 455 if(_this.scrollleft>=1) { 456 _this.show_slide(_this.current-1); 457 _this.scrollleft=0; 458 } else { 459 _this.scrollleft++; 460 } 461 _this.scrollright=0; 462 463 } 464 event.preventDefault(); 465 //console.log(event.deltaX, event.deltaY, event.deltaFactor); 466 }); 467 } 468 469 Meisterbox.prototype.set_background_color = function(color) { 470 this.$overlay.css({backgroundColor: color}); 471 return this; 472 } 473 474 Meisterbox.prototype.set_background_opacity = function(op) { 475 this.$overlay.css({opacity: op}); 476 return this; 477 } 478 479 return Meisterbox; 480 481 })();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.