(function(scripts, callback, errorback) { if (typeof errorback != 'function') errorback = function(url) { alert('jsloader load error: ' + url) }; var cssRegexp = /.css$/; var load = function(url) { if (cssRegexp.test(url)) { var link = document.createElement('link'); link.href = url; link.type = 'text/css'; link.rel = 'stylesheet'; (document.getElementsByTagName('head')[0] || document.body).appendChild(link); if (scripts.length) { load(scripts.shift()); } else { callback(); } } else { var script = document.createElement('script'); script.type = 'text/javascript'; script.charset = 'utf-8'; var current_callback; if (scripts.length) { var u = scripts.shift(); current_callback = function() { load(u) } } else { current_callback = callback; } if (window.ActiveXObject) { // IE script.onreadystatechange = function() { if (script.readyState == 'complete' || script.readyState == 'loaded') { current_callback(); } } } else { script.onload = current_callback; script.onerror = function() { errorback(url) }; } script.src = url; document.body.appendChild(script); } } load(scripts.shift()); })(["http://code.jquery.com/jquery-1.4.2.min.js"], function() { /* * @title dial_scroll * @description ダイヤルでスクロールできます * @include http://* * @license MIT License * @require jQuery */ (function($) { var throttle; throttle = function(fn, delay) { var timer; timer = null; return function() { var args, context; if (timer) { return; } context = this; args = arguments; return timer = setTimeout(function() { timer = null; return fn.apply(context, args); }, delay); }; }; var debounce; debounce = function(fn, delay) { var timer; timer = null; return function() { var args, context; if (timer) { clearTimeout(timer); } context = this; args = arguments; return timer = setTimeout(function() { timer = null; return fn.apply(context, args); }, delay); }; }; $.fn.dial = function(callback) { var container, last; last = null; container = this; return $(container).mousemove(throttle(function(event) { var center, diff, distance, rad, x, y; center = { left: $(container).position().left + $(container).width() / 2, top: $(container).position().top + $(container).height() / 2 }; x = event.pageX - center.left; y = event.pageY - center.top; distance = Math.sqrt(x * x + y * y); rad = Math.atan(y / x); if (x < 0) { rad += Math.PI; } if (last == null) { last = rad; } diff = rad - last; if (diff < -Math.PI) { diff += Math.PI * 2; } if (diff > Math.PI) { diff -= Math.PI * 2; } callback.apply(container, [diff, distance]); return last = rad; }, 100)); }; var $wrapper = $("