(function($) { var q = {}; var r; var s; var t; var u; var v = '<div class="customScrollerContainer">'; v += '<div class="customScrollerContent">'; v += '</div></div>'; var w = '<div class="divVScrollerBar">'; w += '<span class="divVScrollerBarUp"><span></span></span>'; w += '<span class="divVScrollerBarTrace">'; w += '<span class="divVScrollerBarCursor"><span></span></span>'; w += '</span>'; w += '<span class="divVScrollerBarDown"><span></span></span>'; w += '</div>'; var x = '<div class="divOScrollerBar">'; x += '<span class="divOScrollerBarLeft"><span></span></span>'; x += '<span class="divOScrollerBarTrace">'; x += '<span class="divOScrollerBarCursor"><span></span></span>'; x += '</span>'; x += '<span class="divOScrollerBarRight"><span></span></span>'; x += '<div style="clear: both;"></div></div>'; $.fn.customScroller = function(l) { l = $.extend({ width: null, height: null, horizontal: 1, vertical: 1, speed: 4 }, l); if (this.length > 0) { this.each(function(h, i) { var j = new Date().getTime(); if (undefined === this.id || !this.id.length) this.id = "customScroller_" + j; var k = this.id; if (!q[k]) q[k] = {}; q[k].div = this; if (!l.width) { if ($(this).css('width') !== 'auto') { q[k].width = ($(this).css('width').indexOf('%') > 0) ? '100%' : parseInt($(this).css('width'), 10) + 'px' } else { return false } } else { q[k].width = ((l.width + '').indexOf('%') > 0 || (l.width + '').indexOf('px') > 0) ? l.width : parseInt(l.width, 10) + 'px'; $(this).css('width', q[k].width) } if (!l.height) { if ($(this).css('height') !== 'auto') { q[k].height = ($(this).css('height').indexOf('%') > 0) ? '100%' : parseInt($(this).css('height'), 10) + 'px' } else { return false } } else { q[k].height = ((l.height + '').indexOf('%') > 0 || (l.height + '').indexOf('px') > 0) ? l.height : parseInt(l.height, 10) + 'px'; $(this).css('height', q[k].height) } $(this).css("overflow", "hidden"); $(this).css("position", "relative"); q[k].speed = (!$(this).attr('speed')) ? l.speed : parseInt($(this).attr('speed'), 10); if (isNaN(q[k].speed)) { q[k].speed = l.speed } q[k].vertical = (!$(this).attr('vertical')) ? l.vertical : parseInt($(this).attr('vertical'), 10); if (isNaN(q[k].vertical)) { q[k].vertical = l.vertical } q[k].horizontal = (!$(this).attr('horizontal')) ? l.horizontal : parseInt($(this).attr('horizontal'), 10); if (isNaN(q[k].horizontal)) { q[k].horizontal = l.horizontal } $(this).wrapInner(v); q[k].objContainer = $(".customScrollerContainer", this); q[k].objContent = $(".customScrollerContent", this); q[k].objContainer.css({ position: 'relative', float: 'left', width: '100%', height: '100%', overflow: 'hidden', margin: '0px', border: '0px', padding: '0px' }); q[k].objContent.css({ position: 'absolute', top: '0px', left: '0px', margin: '0px', border: '0px', padding: '0 0 10px 0' }); $(this).prepend(w); q[k].objVScroller = $(".divVScrollerBar", this); q[k].objUp = $(".divVScrollerBarUp", this); q[k].objDown = $(".divVScrollerBarDown", this); q[k].objVTrace = $(".divVScrollerBarTrace", this); q[k].objVCursor = $(".divVScrollerBarCursor", this); q[k].objVScroller.css({ float: 'right', overflow: 'hidden', padding: '0px' }); q[k].objUp.css({ display: 'block', width: '100%', overflow: 'hidden' }); q[k].objDown.css({ display: 'block', width: '100%', overflow: 'hidden' }); q[k].objVTrace.css({ display: 'block', position: 'relative', width: '100%', overflow: 'hidden', margin: '0px', border: '0px', padding: '0px' }); q[k].objVCursor.css({ display: 'block', position: 'absolute', width: '100%', overflow: 'hidden', top: '0px', left: '0px', margin: '0px', border: '0px', padding: '0px' }); $(this).append(x); q[k].objOScroller = $(".divOScrollerBar", this); q[k].objLeft = $(".divOScrollerBarLeft", this); q[k].objRight = $(".divOScrollerBarRight", this); q[k].objOTrace = $(".divOScrollerBarTrace", this); q[k].objOCursor = $(".divOScrollerBarCursor", this); q[k].objOScroller.css({ float: 'left', overflow: 'hidden', padding: '0px' }); q[k].objLeft.css({ float: 'left', display: 'block', height: '100%', margin: '0px', overflow: 'hidden' }); q[k].objRight.css({ float: 'left', display: 'block', height: '100%', margin: '0px', overflow: 'hidden' }); q[k].objOTrace.css({ float: 'left', display: 'block', position: 'relative', height: '100%', overflow: 'hidden', margin: '0px', border: '0px', padding: '0px' }); q[k].objOCursor.css({ display: 'block', position: 'absolute', height: '100%', overflow: 'hidden', top: '0px', left: '0px', margin: '0px', border: '0px', padding: '0px' }); $(this).append('<div style="clear: both;"></div>'); $.fn.setCustomScroller = function() { if (this.length > 0) { this.each(function(b, c) { if (this.id !== undefined && this.id.length > 0) { var d = this.id; if (q[d] && $(q[d].div).length > 0) { q[d]._vscroll = false; q[d]._oscroll = false; q[d].objOScroller.hide(); q[d].objVScroller.hide(); q[d].objContainer.css({ width: '100%', height: '100%' }); if ($.browser.msie) { q[d].objContent.css({ width: 'auto' }) } if (q[d].vertical === 1 && q[d]._vscroll === false && q[d].objContainer.height() > 0 && q[d].objContent.outerHeight(true) > q[d].objContainer.height()) { q[d]._vscroll = true; q[d].objVScroller.show(); q[d].objContainer.css('width', (q[d].objContainer.width() - q[d].objVScroller.outerWidth(true) - 1) + 'px'); q[d].containerHeight = q[d].objContainer.height(); q[d].contentHeight = q[d].objContent.outerHeight(true); q[d].objVScroller.css('height', q[d].containerHeight + 'px'); q[d].traceHeight = q[d].containerHeight - q[d].objUp.outerHeight(true) - q[d].objDown.outerHeight(true); q[d].objVTrace.css('height', q[d].traceHeight + 'px'); q[d].cursorHeight = Math.ceil((q[d].traceHeight * q[d].containerHeight) / q[d].contentHeight); q[d].objVCursor.css('height', q[d].cursorHeight + 'px'); q[d].traceVVoid = q[d].traceHeight - q[d].cursorHeight; q[d].posVTrace = q[d].objVTrace.offset().top; var f = (0 - parseInt(q[d].objContent.css('top'), 10)) * q[d].traceVVoid / (q[d].contentHeight - q[d].containerHeight); q[d].objVCursor.css('top', f + 'px') } if (q[d].horizontal === 1 && q[d]._oscroll === false && q[d].objContainer.width() > 0 && q[d].objContent.outerWidth(true) > q[d].objContainer.width()) { q[d]._oscroll = true; q[d].objOScroller.show(); q[d].objContainer.css('height', (q[d].objContainer.height() - q[d].objOScroller.outerHeight(true)) + 'px'); q[d].containerWidth = q[d].objContainer.width(); q[d].contentWidth = q[d].objContent.outerWidth(true); q[d].objOScroller.css('width', q[d].containerWidth + 'px'); q[d].traceWidth = q[d].containerWidth - q[d].objLeft.outerWidth(true) - q[d].objRight.outerWidth(true); q[d].objOTrace.css('width', q[d].traceWidth + 'px'); q[d].cursorWidth = Math.ceil((q[d].traceWidth * q[d].containerWidth) / q[d].contentWidth); q[d].objOCursor.css('width', q[d].cursorWidth + 'px'); q[d].traceOVoid = q[d].traceWidth - q[d].cursorWidth; q[d].posOTrace = q[d].objOTrace.offset().left; var g = (0 - parseInt(q[d].objContent.css('left'), 10)) * q[d].traceOVoid / (q[d].contentWidth - q[d].containerWidth); q[d].objOCursor.css('left', g + 'px'); if (q[d].vertical === 1 && q[d]._vscroll === true) { q[d].containerHeight = q[d].objContainer.height(); q[d].contentHeight = q[d].objContent.outerHeight(true); q[d].objVScroller.css('height', q[d].containerHeight + 'px'); q[d].traceHeight = q[d].containerHeight - q[d].objUp.outerHeight(true) - q[d].objDown.outerHeight(true); q[d].objVTrace.css('height', q[d].traceHeight + 'px'); q[d].cursorHeight = Math.ceil((q[d].traceHeight * q[d].containerHeight) / q[d].contentHeight); q[d].objVCursor.css('height', q[d].cursorHeight + 'px'); q[d].traceVVoid = q[d].traceHeight - q[d].cursorHeight; q[d].posVTrace = q[d].objVTrace.offset().top; var f = (0 - parseInt(q[d].objContent.css('top'), 10)) * q[d].traceVVoid / (q[d].contentHeight - q[d].containerHeight); q[d].objVCursor.css('top', f + 'px') } } if ($.browser.msie) { q[d].objContent.css({ width: q[d].objContent.width() + 'px' }) } if (q[d]._vscroll === false) { q[d].objContent.css('top', '0px') } if (q[d]._oscroll === false) { q[d].objContent.css('left', '0px') } q[d].containerOffset = q[d].objContainer.offset(); q[d].containerHeight = q[d].objContainer.height(); q[d].contentHeight = q[d].objContent.outerHeight(); q[d].containerWidth = q[d].objContainer.width(); q[d].contentWidth = q[d].objContent.outerWidth(true); if ($().mousewheel) { if (q[d]._vscroll === true) { q[d].objContainer.unbind('mousewheel').bind('mousewheel', function(e, a) { (a > 0) ? E(q[d], a) : D(q[d], a); return false }) } else { q[d].objContainer.unbind('mousewheel').bind('mousewheel', function(e, a) { (a > 0) ? G(q[d], a) : F(q[d], a); return false }) } } } } }) } }; $(this).setCustomScroller(); $(this).bind('mousedown', function(e) { e.stopPropagation(); r = k }); q[k].objContainer.bind('mousedown', function(e) { s = k; t = null }); q[k].objContainer.bind('mousemove', function(e) { if (!s || !q[s] || !$(q[s].div).length) return; var a = q[s].containerOffset; var b = q[s].containerHeight; var c = q[s].containerWidth; C(); if (q[s]._vscroll === true && e.pageY > a.top && e.pageY < a.top + 10) { t = 'up'; z(q[s], 1) } else if (q[s]._oscroll === true && e.pageX > a.left && e.pageX < a.left + 10) { t = 'left'; B(q[s], 1) } else if (q[s]._vscroll === true && e.pageY > (a.top + b - 10) && e.pageY < (a.top + b)) { t = 'down'; y(q[s], -1) } else if (q[s]._oscroll === true && e.pageX > (a.left + c - 10) && e.pageX < (a.left + c)) { t = 'right'; A(q[s], -1) } }); q[k].objContainer.bind('mouseup', function(e) { C(); s = null; t = null }); q[k].objVTrace.bind("mousedown", function(e) { var a = (e.pageY - q[k].posVTrace); if (a > (q[k].cursorHeight + parseInt(q[k].objVCursor.css('top'), 10))) { D(q[k], -3) } else if (a < parseInt(q[k].objVCursor.css('top'), 10)) { E(q[k], 3) } return false }); q[k].objUp.bind("mouseover", function(e) { $('span', this).addClass('hover'); z(q[k]); return false }); q[k].objDown.bind("mouseover", function(e) { $('span', this).addClass('hover'); y(q[k]); return false }); q[k].objUp.bind("mouseout", function(e) { $('span', this).removeClass('hover'); C(); return false }); q[k].objDown.bind("mouseout", function(e) { $('span', this).removeClass('hover'); C(); return false }); q[k].objVCursor.bind("mouseover", function(e) { $('span', this).addClass('hover'); return false }); q[k].objVCursor.bind("mouseout", function(e) { $('span', this).removeClass('hover'); return false }); $(q[k].objVCursor).dragCursor(k, 'bottom'); $(q[k].objVCursor).ondrag(function(e, a) { var b = parseInt(q[k].objVCursor.css('top'), 10); var c = 0 - (b * (q[k].contentHeight - q[k].containerHeight) / q[k].traceVVoid); q[k].objContent.css('top', c + "px"); return false }); q[k].objOTrace.bind("mousedown", function(e) { var a = (e.pageX - q[k].posOTrace); if (a > (q[k].cursorWidth + parseInt(q[k].objOCursor.css('left'), 10))) { F(q[k], -3) } else if (a < parseInt(q[k].objOCursor.css('left'), 10)) { G(q[k], 3) } return false }); q[k].objLeft.bind("mouseover", function(e) { $('span', this).addClass('hover'); B(q[k]); return false }); q[k].objRight.bind("mouseover", function(e) { $('span', this).addClass('hover'); A(q[k]); return false }); q[k].objLeft.bind("mouseout", function(e) { $('span', this).removeClass('hover'); C(); return false }); q[k].objRight.bind("mouseout", function(e) { $('span', this).removeClass('hover'); C(); return false }); q[k].objOCursor.bind("mouseover", function(e) { $('span', this).addClass('hover'); return false }); q[k].objOCursor.bind("mouseout", function(e) { $('span', this).removeClass('hover'); return false }); $(q[k].objOCursor).dragCursor(k, 'right'); $(q[k].objOCursor).ondrag(function(e, a) { var b = parseInt(q[k].objOCursor.css('left'), 10); var c = 0 - (b * (q[k].contentWidth - q[k].containerWidth) / q[k].traceOVoid); q[k].objContent.css('left', c + "px"); return false }) }); $.anchorFix() } }; $.anchorFix = function() { $('a').each(function(k, l) { $(this).bind('click', function(e) { var a = $(this).attr('href'); if (a && a.indexOf('#') !== -1) { var b = a.replace(window.location.href, ''); b = b.substring(b.indexOf('#')) } var c = $(this).attr('target'); if (b && c && q[c]) { if (b.length > 0 && b.charAt(0) === '#') { var d = $('a[name=' + b.substring(1) + ']').parent().offset().top; var f = q[c].objContainer.offset().top; var g = parseInt(q[c].objContent.css('top'), 10); var h = g + ((0 - parseInt(d - f, 10))); var i = ((0 - q[c].contentHeight) + q[c].containerHeight); if (h < i) { h = i } q[c].objContent.css('top', h + 'px'); var j = (0 - parseInt(h, 10)) * q[c].traceVVoid / (q[c].contentHeight - q[c].containerHeight); q[c].objVCursor.css('top', j + 'px'); return false } } }) }) }; var y = function(a, b) { u = window.setInterval(function() { D(a, b) }, 20) }; var z = function(a, b) { u = window.setInterval(function() { E(a, b) }, 20) }; var A = function(a, b) { u = window.setInterval(function() { F(a, b) }, 20) }; var B = function(a, b) { u = window.setInterval(function() { G(a, b) }, 20) }; var C = function() { if (u) window.clearInterval(u) }; var D = function(a, b) { var c; if (b) c = (0 - parseInt(b * 5, 10)); else c = 1; var d = parseInt(a.objContent.css('top'), 10); var e = ((0 - a.contentHeight) + a.containerHeight); if (d >= e) { var f = d - parseInt(a.speed * c, 10); if (f < e) f = e; a.objContent.css('top', f + 'px'); var g = parseInt((((0 - f) * a.traceVVoid) / (a.contentHeight - a.containerHeight)), 10); a.objVCursor.css('top', g + 'px') } }; var E = function(a, b) { var c; if (b) c = parseInt(b * 5, 10); else c = 1; var d = parseInt(a.objContent.css('top'), 10); if (d <= 0) { var e = d + parseInt(a.speed * c, 10); if (e > 0) e = 0; a.objContent.css('top', e + 'px'); var f = parseInt((((0 - e) * a.traceVVoid) / (a.contentHeight - a.containerHeight)), 10); a.objVCursor.css('top', f + 'px') } }; var F = function(a, b) { var c; if (b) c = (0 - parseInt(b * 5, 10)); else c = 1; var d = parseInt(a.objContent.css('left'), 10); var e = ((0 - a.contentWidth) + a.containerWidth); if (d >= e) { var f = d - parseInt(a.speed * c, 10); if (f < e) f = e; a.objContent.css('left', f + 'px'); var g = parseInt((((0 - f) * a.traceOVoid) / (a.contentWidth - a.containerWidth)), 10); a.objOCursor.css('left', g + 'px') } }; var G = function(a, b) { var c; if (b) c = parseInt(b * 5, 10); else c = 1; var d = parseInt(a.objContent.css('left'), 10); if (d <= 0) { var e = d + parseInt(a.speed * c, 10); if (e > 0) e = 0; a.objContent.css('left', e + 'px'); var f = parseInt((((0 - e) * a.traceOVoid) / (a.contentWidth - a.containerWidth)), 10); a.objOCursor.css('left', f + 'px') } }; $.fn.dragCursor = function(g, h) { var i = false; var j = null; var k = {}; var l; var m; var n; var o; if (q[g] && $(q[g].div).length > 0) { options = { maxTop: 0, maxRight: 0, maxBottom: 0, maxLeft: 0 }; $.fn.ondrag = function(a) { if (this.length > 0) { return this.each(function() { k[this.id] = a }) } }; if (this.length > 0) { this.each(function(d, f) { $(this).bind("mousedown", function(e) { if (h === 'bottom') { options.maxTop = 0; options.maxRight = 0; options.maxBottom = q[g].traceVVoid; options.maxLeft = 0 } if (h === 'right') { options.maxTop = 0; options.maxRight = q[g].traceOVoid; options.maxBottom = 0; options.maxLeft = 0 } i = true; j = this; var a = $(this).offset(); var b = $(this).offsetParent(); var c = {}; if (b.length > 0) { c.top = b.offset().top; c.left = b.offset().left } l = e.pageX; m = e.pageY; n = a.top - c.top; o = a.left - c.left; p(e); return false }) }) } var p = function(e) { var a = (e.pageX - l); var b = (e.pageY - m); var Y = n + b; var X = o + a; if (options.maxTop !== null && Y < options.maxTop) Y = options.maxTop; if (options.maxLeft !== null && X < options.maxLeft) X = options.maxLeft; if (options.maxBottom !== null && Y > options.maxBottom) Y = options.maxBottom; if (options.maxRight !== null && X > options.maxRight) X = options.maxRight; $(j).css("top", Y + 'px'); $(j).css("left", X + 'px') }; $(document).bind("mousemove", function(e) { if (i === true) { p(e); if (typeof k[j.id] === 'function') { k[j.id](e, j) } return false } }); $(document).bind("mouseup", function(e) { i = false; return false }) } }; $.fn.ajaxScroller = function(f, g, h) { h = $.extend({}, h); if (this.length > 0) { this.each(function(d, e) { $(this).html("Loading..."); $(this).load(f, g, function(a, b, c) { if (b === "success") { $(this).customScroller(h) } else { alert('Error') } }) }) } }; $(document).ready(function() { $(document).bind('mousedown', function(e) { r = null }); $(document).bind("keydown keypress", function(e) { if (!r || !q[r] || !$(q[r].div).length) return; switch (e.which) { case 38: E(q[r], 1); break; case 40: D(q[r], -1); break; case 37: G(q[r], 1); break; case 39: F(q[r], -1); break; case 33: E(q[r], 3); break; case 34: D(q[r], -3); break; case 36: G(q[r], 3); break; case 35: F(q[r], -3); break; default: return true; break } return false }); if ($().wresize) { $(window).wresize(function() { if (u) clearTimeout(u); u = setTimeout(function() { $.each(q, function(a, b) { if ($(q[a].div).length > 0) { $(q[a].div).setCustomScroller() } }) }, 100); return false }) } }) })(jQuery);
(function($) { $.fn.wresize = function(f) { version = '1.1'; wresize = { fired: false, width: 0 }; function resizeOnce() { if ($.browser.msie) { if (!wresize.fired) { wresize.fired = true } else { var a = parseInt($.browser.version, 10); wresize.fired = false; if (a < 7) { return false } else if (a == 7) { var b = $(window).width(); if (b != wresize.width) { wresize.width = b; return false } } } } return true } function handleWResize(e) { if (resizeOnce()) { return f.apply(this, [e]) } } this.each(function() { if (this == window) { $(this).resize(handleWResize) } else { $(this).resize(f) } }); return this } })(jQuery);
(function(c) { var a = ["DOMMouseScroll", "mousewheel"]; c.event.special.mousewheel = { setup: function() { if (this.addEventListener) { for (var d = a.length; d; ) { this.addEventListener(a[--d], b, false) } } else { this.onmousewheel = b } }, teardown: function() { if (this.removeEventListener) { for (var d = a.length; d; ) { this.removeEventListener(a[--d], b, false) } } else { this.onmousewheel = null } } }; c.fn.extend({ mousewheel: function(d) { return d ? this.bind("mousewheel", d) : this.trigger("mousewheel") }, unmousewheel: function(d) { return this.unbind("mousewheel", d) } }); function b(f) { var d = [].slice.call(arguments, 1), g = 0, e = true; f = c.event.fix(f || window.event); f.type = "mousewheel"; if (f.wheelDelta) { g = f.wheelDelta / 120 } if (f.detail) { g = -f.detail / 3 } d.unshift(f, g); return c.event.handle.apply(this, d) } })(jQuery);