From: ISHIKAWA Mutsumi Date: Sat, 5 Jun 2010 10:06:27 +0000 (+0900) Subject: stop to use iscroll X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=8d9dfa4e8271baa2975af6ed732e8d4eda7acc5b;p=keitairc%2Fkeitairc.git stop to use iscroll --- diff --git a/MANIFEST b/MANIFEST index 6428220..f7bda81 100644 --- a/MANIFEST +++ b/MANIFEST @@ -22,8 +22,6 @@ data/public/ajax-loader.gif data/public/apple-touch-icon.png data/public/favicon.ico data/public/geopost-keitairc.js -data/public/iscroll/iscroll.js -data/public/iscroll/scrollbar.png data/public/iui-keitairc.css data/public/iui/backButton.png data/public/iui/blueButton.png diff --git a/data/public/iscroll/iscroll.js b/data/public/iscroll/iscroll.js deleted file mode 100644 index 14c97ee..0000000 --- a/data/public/iscroll/iscroll.js +++ /dev/null @@ -1,399 +0,0 @@ -/** - * - * Find more about the scrolling function at - * http://cubiq.org/scrolling-div-for-mobile-webkit-turns-3/16 - * - * Copyright (c) 2009 Matteo Spinelli, http://cubiq.org/ - * Released under MIT license - * http://cubiq.org/dropbox/mit-license.txt - * - * Version 3.2.1 - Last updated: 2010.06.03 - * - */ - -(function(){ - -function iScroll (el, options) { - this.element = typeof el == 'object' ? el : document.getElementById(el); - this.wrapper = this.element.parentNode; - - this.element.style.webkitTransitionProperty = '-webkit-transform'; - this.element.style.webkitTransitionTimingFunction = 'cubic-bezier(0,0,0.25,1)'; - this.element.style.webkitTransitionDuration = '0'; - this.element.style.webkitTransform = 'translate3d(0,0,0)'; - - // Get options - this.options = { - bounce: true, - checkDOMChanges: true, - topOnDOMChanges: false, - hScrollBar: true, - vScrollBar: true - }; - - if (typeof options == 'object') { - for (var i in options) { - this.options[i] = options[i]; - } - } - - this.refresh(); - - this.element.addEventListener('touchstart', this); - this.element.addEventListener('touchmove', this); - this.element.addEventListener('touchend', this); - window.addEventListener('orientationchange', this); - - if (this.options.checkDOMChanges) { - this.element.addEventListener('DOMSubtreeModified', this); - } -} - -iScroll.prototype = { - x: 0, - y: 0, - - handleEvent: function (e) { - switch (e.type) { - case 'touchstart': this.onTouchStart(e); break; - case 'touchmove': this.onTouchMove(e); break; - case 'touchend': this.onTouchEnd(e); break; - case 'webkitTransitionEnd': this.onTransitionEnd(e); break; - case 'orientationchange': this.refresh(); break; - case 'DOMSubtreeModified': this.onDOMModified(e); break; - } - }, - - onDOMModified: function (e) { - this.refresh(); - - if (this.options.topOnDOMChanges && (this.x!=0 || this.y!=0)) { - this.scrollTo(0,0,'0'); - } - }, - - refresh: function () { - this.scrollWidth = this.wrapper.clientWidth; - this.scrollHeight = this.wrapper.clientHeight; - this.maxScrollX = this.scrollWidth - this.element.offsetWidth; - this.maxScrollY = this.scrollHeight - this.element.offsetHeight; - - var resetX = this.x, resetY = this.y; - if (this.scrollX) { - if (this.maxScrollX >= 0) { - resetX = 0; - } else if (this.x < this.maxScrollX) { - resetX = this.maxScrollX; - } - } - if (this.scrollY) { - if (this.maxScrollY >= 0) { - resetY = 0; - } else if (this.y < this.maxScrollY) { - resetY = this.maxScrollY; - } - } - if (resetX!=this.x || resetY!=this.y) { - this.scrollTo(resetX,resetY,'0'); - } - - this.scrollX = this.element.offsetWidth > this.scrollWidth ? true : false; - this.scrollY = this.element.offsetHeight > this.scrollHeight ? true : false; - - // Update horizontal scrollbar - if (this.options.hScrollBar && this.scrollX) { - this.scrollBarX = (this.scrollBarX instanceof scrollbar) ? this.scrollBarX : new scrollbar('horizontal', this.wrapper); - this.scrollBarX.init(this.scrollWidth, this.element.offsetWidth); - } else if (this.scrollBarX) { - this.scrollBarX = this.scrollBarX.remove(); - } - - // Update vertical scrollbar - if (this.options.vScrollBar && this.scrollY) { - this.scrollBarY = (this.scrollBarY instanceof scrollbar) ? this.scrollBarY : new scrollbar('vertical', this.wrapper); - this.scrollBarY.init(this.scrollHeight, this.element.offsetHeight); - } else if (this.scrollBarY) { - this.scrollBarY = this.scrollBarY.remove(); - } - }, - - setPosition: function (x, y) { - this.x = x !== null ? x : this.x; - this.y = y !== null ? y : this.y; - - this.element.style.webkitTransform = 'translate3d(' + this.x + 'px,' + this.y + 'px,0)'; - - // Move the scrollbars - if (this.scrollBarX) { - this.scrollBarX.setPosition(this.scrollBarX.maxScroll / this.maxScrollX * this.x); - } - if (this.scrollBarY) { - this.scrollBarY.setPosition(this.scrollBarY.maxScroll / this.maxScrollY * this.y); - } - }, - - onTouchStart: function(e) { - if (e.targetTouches.length != 1) { - return false; - } - - e.stopPropagation(); - - this.element.style.webkitTransitionDuration = '0'; - - if (this.scrollBarX) { - this.scrollBarX.bar.style.webkitTransitionDuration = '0, 250ms'; - } - if (this.scrollBarY) { - this.scrollBarY.bar.style.webkitTransitionDuration = '0, 250ms'; - } - - // Check if elem is really where it should be - var theTransform = new WebKitCSSMatrix(window.getComputedStyle(this.element).webkitTransform); - if (theTransform.m41 != this.x || theTransform.m42 != this.y) { - this.setPosition(theTransform.m41, theTransform.m42); - } - - this.touchStartX = e.touches[0].pageX; - this.scrollStartX = this.x; - - this.touchStartY = e.touches[0].pageY; - this.scrollStartY = this.y; - - this.scrollStartTime = e.timeStamp; - this.moved = false; - }, - - onTouchMove: function(e) { - if (e.targetTouches.length != 1) { - return false; - } - - e.preventDefault(); - - var leftDelta = this.scrollX === true ? e.touches[0].pageX - this.touchStartX : 0, - topDelta = this.scrollY === true ? e.touches[0].pageY - this.touchStartY : 0, - newX = this.x + leftDelta, - newY = this.y + topDelta; - - // Slow down if outside of the boundaries - if (newX > 0 || newX < this.maxScrollX) { - newX = this.options.bounce ? Math.round(this.x + leftDelta / 4) : this.x; - } - if (newY > 0 || newY < this.maxScrollY) { - newY = this.options.bounce ? Math.round(this.y + topDelta / 4) : this.y; - } - - if (this.scrollBarX && !this.scrollBarX.visible) { - this.scrollBarX.show(); - } - if (this.scrollBarY && !this.scrollBarY.visible) { - this.scrollBarY.show(); - } - - this.setPosition(newX, newY); - - this.touchStartX = e.touches[0].pageX; - this.touchStartY = e.touches[0].pageY; - this.moved = true; - - // Prevent slingshot effect - if( e.timeStamp-this.scrollStartTime > 250 ) { - this.scrollStartX = this.x; - this.scrollStartY = this.y; - this.scrollStartTime = e.timeStamp; - } - }, - - onTouchEnd: function(e) { - if (e.targetTouches.length > 0) { - return false; - } - - if (!this.moved) { - // Find the last touched element - var theTarget = e.changedTouches[0].target; - if (theTarget.nodeType == 3) { - theTarget = theTarget.parentNode; - } - // Create the fake event - var theEvent = document.createEvent('MouseEvents'); - theEvent.initMouseEvent("click", true, true, document.defaultView, - e.detail, e.screenX, e.screenY, e.clientX, e.clientY, - e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, - e.button, e.relatedTarget); - theTarget.dispatchEvent(theEvent); - return false; - } - - var time = e.timeStamp - this.scrollStartTime; - - var momentumX = this.scrollX === true - ? this.momentum(this.x - this.scrollStartX, - time, - this.options.bounce ? -this.x + this.scrollWidth/4 : -this.x, - this.options.bounce ? this.x + this.element.offsetWidth - this.scrollWidth + this.scrollWidth/4 : this.x + this.element.offsetWidth - this.scrollWidth) - : { dist: 0, time: 0 }; - - var momentumY = this.scrollY === true - ? this.momentum(this.y - this.scrollStartY, - time, - this.options.bounce ? -this.y + this.scrollHeight/4 : -this.y, - this.options.bounce ? this.y + this.element.offsetHeight - this.scrollHeight + this.scrollHeight/4 : this.y + this.element.offsetHeight - this.scrollHeight) - : { dist: 0, time: 0 }; - - if (!momentumX.dist && !momentumY.dist) { - this.resetPosition(); - return false; - } - - var newDuration = Math.max(Math.max(momentumX.time, momentumY.time), 1); // The minimum animation length must be 1ms - var newPositionX = this.x + momentumX.dist; - var newPositionY = this.y + momentumY.dist; - - this.element.addEventListener('webkitTransitionEnd', this); - - this.scrollTo(newPositionX, newPositionY, newDuration + 'ms'); - - // Move the scrollbars - if (this.scrollBarX) { - this.scrollBarX.scrollTo(this.scrollBarX.maxScroll / this.maxScrollX * newPositionX, newDuration + 'ms'); - } - if (this.scrollBarY) { - this.scrollBarY.scrollTo(this.scrollBarY.maxScroll / this.maxScrollY * newPositionY, newDuration + 'ms'); - } - }, - - onTransitionEnd: function () { - this.element.removeEventListener('webkitTransitionEnd', this); - this.resetPosition(); - }, - - resetPosition: function () { - var resetX = this.x, - resetY = this.y; - - if (this.x >= 0) { - resetX = 0; - } else if (this.x < this.maxScrollX) { - resetX = this.maxScrollX; - } - - if (this.y >= 0) { - resetY = 0; - } else if (this.y < this.maxScrollY) { - resetY = this.maxScrollY; - } - - if (resetX != this.x || resetY != this.y) { - this.scrollTo(resetX, resetY, '500ms'); - - if (this.scrollBarX && resetX != this.x) { - this.scrollBarX.scrollTo(this.scrollBarX.maxScroll / this.maxScrollX * resetX, '500ms'); - } - if (this.scrollBarY && resetY != this.y) { - this.scrollBarY.scrollTo(this.scrollBarY.maxScroll / this.maxScrollY * resetY, '500ms'); - } - } - - // Hide the scrollbars - if (this.scrollBarX) { - this.scrollBarX.hide(); - } - if (this.scrollBarY) { - this.scrollBarY.hide(); - } - }, - - scrollTo: function (destX, destY, runtime) { - this.element.style.webkitTransitionDuration = runtime || '400ms'; - this.setPosition(destX, destY); - }, - - momentum: function (dist, time, maxDistUpper, maxDistLower) { - var friction = 0.1, - deceleration = 1.5, - speed = Math.abs(dist) / time * 1000, - newDist = speed * speed / (20 * friction) / 1000; - - // Proportinally reduce speed if we are outside of the boundaries - if (dist > 0 && newDist > maxDistUpper) { - speed = speed * maxDistUpper / newDist; - newDist = maxDistUpper; - } - if (dist < 0 && newDist > maxDistLower) { - speed = speed * maxDistLower / newDist; - newDist = maxDistLower; - } - - newDist = newDist * (dist < 0 ? -1 : 1); - - var newTime = speed / deceleration; - - return { dist: Math.round(newDist), time: Math.round(newTime) }; - } -}; - -var scrollbar = function (dir, wrapper) { - this.dir = dir; - this.bar = document.createElement('div'); - this.bar.className = 'scrollbar ' + dir; - this.bar.style.webkitTransitionTimingFunction = 'cubic-bezier(0,0,0.25,1)'; - this.bar.style.webkitTransform = 'translate3d(0,0,0)'; - this.bar.style.webkitTransitionProperty = '-webkit-transform,opacity'; - this.bar.style.webkitTransitionDuration = '0,300ms'; - this.bar.style.pointerEvents = 'none'; - this.bar.style.opacity = '0'; - - wrapper.appendChild(this.bar); -} - -scrollbar.prototype = { - size: 0, - maxSize: 0, - maxScroll: 0, - visible: false, - - init: function (scroll, size) { - var offset = this.dir == 'horizontal' ? this.bar.offsetWidth - this.bar.clientWidth : this.bar.offsetHeight - this.bar.clientHeight; - this.maxSize = scroll - 8; // 8 = distance from top + distance from bottom - this.size = Math.round(this.maxSize * this.maxSize / size) + offset; - this.maxScroll = this.maxSize - this.size; - this.bar.style[this.dir == 'horizontal' ? 'width' : 'height'] = (this.size - offset) + 'px'; - }, - - setPosition: function (pos) { - if (pos < 0) { - pos = 0; - } else if (pos > this.maxScroll) { - pos = this.maxScroll; - } - - pos = this.dir == 'horizontal' ? 'translate3d(' + Math.round(pos) + 'px,0,0)' : 'translate3d(0,' + Math.round(pos) + 'px,0)'; - this.bar.style.webkitTransform = pos; - }, - - scrollTo: function (pos, runtime) { - this.bar.style.webkitTransitionDuration = (runtime || '400ms') + ',300ms'; - this.setPosition(pos); - }, - - show: function () { - this.visible = true; - this.bar.style.opacity = '1'; - }, - - hide: function () { - this.visible = false; - this.bar.style.opacity = '0'; - }, - - remove: function () { - this.bar.parentNode.removeChild(this.bar); - return null; - } -}; - -// Expose iScroll to the world -window.iScroll = iScroll; -})(); diff --git a/data/public/iscroll/scrollbar.png b/data/public/iscroll/scrollbar.png deleted file mode 100644 index 6b3456a..0000000 Binary files a/data/public/iscroll/scrollbar.png and /dev/null differ diff --git a/data/public/webkit.css b/data/public/webkit.css index e9f2e32..509a0ae 100644 --- a/data/public/webkit.css +++ b/data/public/webkit.css @@ -17,7 +17,6 @@ body > * { position: absolute; left: 0; width: 100%; - height: 100%; min-height: 416px !important; background: url(stripe.png) #c5ccd3; } @@ -466,17 +465,11 @@ form.edit.bottom { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; - position: absolute; left: 0px; - bottom: 22px; width: 100%; height: 47px; } -form.edit.bottom label { - top: 10px; -} - form.edit.bottom input[type="text"] { margin-top: 8px; } @@ -545,9 +538,7 @@ input[type="text"], input[type="password"] { box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; - position: absolute; left: 0px; - bottom: 0px; width: 100%; height: 20px; } @@ -665,60 +656,3 @@ input[type="text"], input[type="password"] { url(twg_iphone_toolbar_icons/icon_cancel.png), url(ajax-loader.gif); } - -#reload_mark { - position: absolute; - width: 100%; - height: 35px; - font-size: 28px; - display: none; - top: -35px; -} - -#reload_mark div { - background-color: transparent; - background-position: top left; - background-repeat: no-repeat; - background-image: url(twg_iphone_toolbar_icons/icon_circle_arrow_right.png); - padding-left: 30px; - height: 35px; - margin: 0px auto; - width: 85px; - color: #f0f0f0; -} - -.scroll_wrap { - height: 0px; - overflow: hidden; - box-sizing: border-box; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - width: 100%; -} - -#scroll { - min-height: 101%; - padding-bottom: 10px; -} - -.scrollbar { - position: absolute; - z-index: 10; - width: 1px; - height: 1px; - border-width: 3px; - -webkit-border-image: url(iscroll/scrollbar.png) 3; - -moz-border-image: url(iscroll/scrollbar.png) 3; - -o-border-image: url(iscroll/scrollbar.png) 3; - border-image: url(iscroll/scrollbar.png) 3; -} - -.scrollbar.horizontal { - bottom: 1px; - left: 1px; -} - -.scrollbar.vertical { - top: 1px; - right: 1px; -} diff --git a/data/public/webkit.js b/data/public/webkit.js index 0b7c108..720bc7a 100644 --- a/data/public/webkit.js +++ b/data/public/webkit.js @@ -47,12 +47,9 @@ jQuery(document).ready(function($) { el = null; var reconnect = false; - var map_load = true; - var myScroll; $(window).bind('orientationchange', function(){ - adjust_height(); adjust_map(); setTimeout(scrollTo, 300, 0, 1); }); @@ -84,20 +81,6 @@ jQuery(document).ready(function($) { return h + ':' + m; } - function adjust_height() { - $('body > *').height(window.outerHeight); - $('.scroll_wrap').each(function() { - $(this).height(0); - }); - var hi = $('.current:first').height(); - $('.toolbar, .edit, .info').each(function() { - hi -= $(this).attr('offsetHeight'); - }); - $('.scroll_wrap').each(function() { - $(this).height(hi); - }); - } - function reinit(resp, status, xhr) { if (status != 'success' || typeof resp == 'undefined' || resp == '' || xhr.status != 200) { var reload_url = window.location.protocol + '//' + window.location.host + web_root; @@ -121,7 +104,6 @@ jQuery(document).ready(function($) { function _animation_callback() { from.remove(); to.removeClass('in reverse slide'); - adjust_height(); setTimeout(scrollTo, 300, 0, 1); $('.internal').one('click', function() { @@ -157,37 +139,6 @@ jQuery(document).ready(function($) { append_location(); } } - - if ($('#scroll').length != 0) { - if (typeof myScroll != 'undefined' && myScroll != null) { - myScroll.element.removeEventListener('touchstart', myScroll); - myScroll.element.removeEventListener('touchmove', myScroll); - myScroll.element.removeEventListener('touchend', myScroll); - myScroll.element.removeEventListener('DOMSubtreeModified', myScroll); - window.removeEventListener('orientationchange', myScroll); - myScroll = null; - } - myScroll = new iScroll('scroll'); - var sc = $('#scroll'); - var mark = $('#reload_mark'); - if (mark.length != 0) { - sc.bind('touchmove', function() { - if (myScroll.y > 30) { - mark.attr('reload', 'on').show(); - } - }); - sc.bind('touchend', function() { - mark.hide(); - if (mark.attr('reload') == 'on') { - mark.removeAttr('reload'); - inner_reload(mark.attr('rel'), ''); - } - }); - } - $('.toolbar h1').bind('click', function() { - myScroll.scrollTo(0,0); - }); - } } } }); diff --git a/data/templates/webkit/all.html b/data/templates/webkit/all.html index c46df94..819aa90 100644 --- a/data/templates/webkit/all.html +++ b/data/templates/webkit/all.html @@ -2,6 +2,7 @@

+ @@ -14,9 +15,6 @@ -
-
-
Reload
    @@ -40,8 +38,6 @@
  • まだ発言がありません
-
-
keitairc diff --git a/data/templates/webkit/index.html b/data/templates/webkit/index.html index e4e6a34..579a245 100644 --- a/data/templates/webkit/index.html +++ b/data/templates/webkit/index.html @@ -2,15 +2,13 @@

チャネルリスト

+
-
-
-
Reload
  • @@ -27,8 +25,6 @@
-
-
diff --git a/data/templates/webkit/location_receiver.html b/data/templates/webkit/location_receiver.html index 127f76b..cd60f56 100644 --- a/data/templates/webkit/location_receiver.html +++ b/data/templates/webkit/location_receiver.html @@ -8,6 +8,7 @@

位置情報

+ メニュー
diff --git a/data/templates/webkit/nick.html b/data/templates/webkit/nick.html index 3e8b894..5c5775b 100644 --- a/data/templates/webkit/nick.html +++ b/data/templates/webkit/nick.html @@ -2,13 +2,10 @@

nick一覧

- +
-
-
-
Reload
  • に参加中のnick @@ -20,8 +17,6 @@
-
-
keitairc diff --git a/data/templates/webkit/recent.html b/data/templates/webkit/recent.html index 96b04c4..b642abe 100644 --- a/data/templates/webkit/recent.html +++ b/data/templates/webkit/recent.html @@ -2,11 +2,9 @@

未読一覧

+
-
-
-
Reload
  • @@ -32,8 +30,6 @@
  • 未読発言はありません
-
-
keitairc diff --git a/data/templates/webkit/root_home.html b/data/templates/webkit/root_home.html index 24c3f28..cceb9c7 100644 --- a/data/templates/webkit/root_home.html +++ b/data/templates/webkit/root_home.html @@ -14,7 +14,6 @@ var session_id = ''; - diff --git a/data/templates/webkit/topic.html b/data/templates/webkit/topic.html index 7d6fb4d..39f3ec3 100644 --- a/data/templates/webkit/topic.html +++ b/data/templates/webkit/topic.html @@ -2,11 +2,9 @@

トピック

+
-
-
-
Reload
  • @@ -21,8 +19,6 @@
-
-
keitairc diff --git a/doc/COPYING.iscroll b/doc/COPYING.iscroll deleted file mode 100644 index 78a06f4..0000000 --- a/doc/COPYING.iscroll +++ /dev/null @@ -1,6 +0,0 @@ - Find more about the scrolling function at - http://cubiq.org/scrolling-div-for-mobile-webkit-turns-3/16 - - Copyright (c) 2009 Matteo Spinelli, http://cubiq.org/ - Released under MIT license - http://cubiq.org/dropbox/mit-license.txt