Skip to content

Commit

Permalink
纠正依赖错误!
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed Dec 25, 2013
1 parent e122d14 commit e0f2c83
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 14 deletions.
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
<script type="text/javascript" src="../../../src/core/widget.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs_ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
<script type="text/javascript" src="../../../src/core/widget.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs_history.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
<script type="text/javascript" src="../../../src/core/widget.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs_json.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
<script type="text/javascript" src="../../../src/core/widget.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs_nocache.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
<script type="text/javascript" src="../../../src/core/widget.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs_render.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/extend/parseTpl.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions examples/widget/tabs/tabs_tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="../../../dist/zepto.js"></script>
<script type="text/javascript" src="../../../src/extend/touch.js"></script>
<script type="text/javascript" src="../../../src/extend/highlight.js"></script>
<script type="text/javascript" src="../../../src/extend/matchMedia.js"></script>
<script type="text/javascript" src="../../../src/extend/event.ortchange.js"></script>
<script type="text/javascript" src="../../../src/core/gmu.js"></script>
<script type="text/javascript" src="../../../src/core/event.js"></script>
<script type="text/javascript" src="../../../src/core/widget.js"></script>
Expand Down
16 changes: 8 additions & 8 deletions src/extend/matchMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@
* - ***addListener*** 添加MediaQueryList对象监听器,接收回调函数,回调参数为MediaQueryList对象<br />
* - ***removeListener*** 移除MediaQueryList对象监听器<br />
*
*
*
* @method $.matchMedia
* @grammar $.matchMedia(query) ⇒ MediaQueryList
* @param {String} query 查询的css query,类似\'screen and (orientation: portrait)\'
* @return {Object} MediaQueryList
* @example
* @example
* $.matchMedia('screen and (orientation: portrait)').addListener(fn);
*/


$.matchMedia = (function() {
var mediaId = 0,
cls = 'gmu-media-detect',
transitionEnd = $.fx.transitionEnd,
cssPrefix = $.fx.cssPrefix,
$style = $('<style></style>').append('.' + cls + '{' + cssPrefix + 'transition: width 0.001ms; width: 0; position: absolute; top: -10000px;}\n').appendTo('head');
$style = $('<style></style>').append('.' + cls + '{' + cssPrefix + 'transition: width 0.001ms; width: 0; position: absolute; clip: rect(1px, 1px, 1px, 1px);}\n').appendTo('head');

return function (query) {
var id = cls + mediaId++,
Expand All @@ -43,9 +41,11 @@
ret;

$style.append('@media ' + query + ' { #' + id + ' { width: 1px; } }\n') ; //原生matchMedia也需要添加对应的@media才能生效
if ('matchMedia' in window) {
return window.matchMedia(query);
}

// 统一用模拟的,时机更好。
// if ('matchMedia' in window) {
// return window.matchMedia(query);
// }

$mediaElem = $('<div class="' + cls + '" id="' + id + '"></div>')
.appendTo('body')
Expand Down
12 changes: 6 additions & 6 deletions src/widget/tabs/tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file 选项卡组件
* @import extend/touch.js, core/widget.js, extend/highlight.js
* @import extend/touch.js, core/widget.js, extend/highlight.js, extend/event.ortchange.js
* @importCSS transitions.css, loading.css
* @module GMU
*/
Expand Down Expand Up @@ -80,7 +80,7 @@
$el.addClass('ui-tabs');
_opts._nav.on('tap', eventHandler).children().highlight('ui-state-hover');
} );

$(window).on('ortchange', eventHandler);
},

Expand Down Expand Up @@ -258,31 +258,31 @@
* @param {Event} e gmu.Event对象
* @description 当组件初始化完后触发。
*/

/**
* @event beforeActivate
* @param {Event} e gmu.Event对象
* @param {Object} to 包含如下属性:div(内容div), index(位置), title(标题), content(内容), href(链接)
* @param {Object} from 包含如下属性:div(内容div), index(位置), title(标题), content(内容), href(链接)
* @description 内容切换之前触发,可以通过e.preventDefault()来阻止
*/

/**
* @event activate
* @param {Event} e gmu.Event对象
* @param {Object} to 包含如下属性:div(内容div), index(位置), title(标题), content(内容), href(链接)
* @param {Object} from 包含如下属性:div(内容div), index(位置), title(标题), content(内容), href(链接)
* @description 内容切换之后触发
*/

/**
* @event animateComplete
* @param {Event} e gmu.Event对象
* @param {Object} to 包含如下属性:div(内容div), index(位置), title(标题), content(内容), href(链接)
* @param {Object} from 包含如下属性:div(内容div), index(位置), title(标题), content(内容), href(链接)
* @description 动画完成后执行,如果没有设置动画,此时间不会触发
*/

/**
* @event destroy
* @param {Event} e gmu.Event对象
Expand Down

0 comments on commit e0f2c83

Please sign in to comment.