• R/O
  • HTTP
  • SSH
  • HTTPS

clientJs: コミット

クライアント側 js 開発用


コミットメタ情報

リビジョン43b7875a2aadc07439db67724e60644f129bcc90 (tree)
日時2015-11-20 00:27:14
作者itozyun <itozyun@user...>
コミッターitozyun

ログメッセージ

Version 0.6.196, bug fixes X.XML & X.UI.ScrollBox.

変更サマリ

差分

--- a/0.6.x/js/01_core/03_XScript.js
+++ b/0.6.x/js/01_core/03_XScript.js
@@ -9,20 +9,20 @@ var X_Script_VBS_ENABLED = X_UA[ 'Windows' ] && !X_UA[ 'WinCE' ] && !X_UA[ 'WinP
99 * @type {object}
1010 */
1111 X[ 'Script' ] = {
12- 'tryCatch' : X_Script_try
12+
13+ 'tryIfSafe' : X_Script_try,
1314
15+ /**
16+ * Visual Basic Script が使えるか?
17+ * @alias X.Script.VBS
18+ * @type {boolean}
19+ */
20+ 'VBS' : X_Script_VBS_ENABLED
1421 // git, strict mode, asm.js,
1522 };
1623
1724 if( X_Script_VBS_ENABLED ){
1825
19-/**
20- * Visual Basic Script が使えるか?
21- * @alias X.Script.VBS
22- * @type {boolean}
23- */
24- X[ 'Script' ][ 'VBS' ] = true;
25-
2626 X_Script_gte15 || document.write( '<script type=text/vbscript>' +
2727 [
2828 'Function vbs_testAXO(v)',
@@ -66,6 +66,12 @@ if( X_Script_VBS_ENABLED ){
6666 // byte Array を扱う vba
6767 };
6868
69+/**
70+ * try-catch 構文が使えて安全に実行できるなら、コードを実行する
71+ * @alias X.Script.tryIfSafe
72+ * @param {funciton} func
73+ * @param {array=} 引数の入った配列
74+ */
6975 function X_Script_try( func, args ){
7076 if( !X_Script_gte15 ){
7177 //return func.apply( {}, args );
--- a/0.6.x/js/02_dom/04_XBoxModel.js
+++ b/0.6.x/js/02_dom/04_XBoxModel.js
@@ -65,7 +65,7 @@ X_ViewPort[ 'listenOnce' ]( X_EVENT_INIT, function(){
6565 function X_Node_BoxModel_mesure( that, name ){
6666 var flags = that[ '_flags' ], elm;
6767
68- if( !this[ '_tag' ] || ( ( flags & X_NodeFlags_IN_TREE ) === 0 ) || ( flags & X_NodeFlags_STYLE_IS_DISPLAY_NONE ) ) return 0;
68+ if( !that[ '_tag' ] || ( ( flags & X_NodeFlags_IN_TREE ) === 0 ) || ( flags & X_NodeFlags_STYLE_IS_DISPLAY_NONE ) ) return 0;
6969
7070 X_Node_updateTimerID && X_Node_startUpdate();
7171
--- a/0.6.x/js/02_dom/08_XNodeSelector.js
+++ b/0.6.x/js/02_dom/08_XNodeSelector.js
@@ -196,7 +196,7 @@ function X_Node_Selector__parse( query, last ){
196196 not = true;
197197 selector = 0;
198198 phase = 0x0;
199- name = null;
199+ name = null;
200200 };
201201 //continue;
202202 } else
--- a/0.6.x/js/02_dom/20_XNode.js
+++ b/0.6.x/js/02_dom/20_XNode.js
@@ -445,6 +445,7 @@ function X_Node_toggleInGPUFlag( gpuRoot, xnodes, flag ){
445445 */
446446 function X_Node_create( tag, opt_attrs, opt_css ){
447447 var xnode;
448+
448449 if( !this[ '_tag' ] ) return;
449450 this[ 'append' ]( xnode = X_Doc_create( tag, opt_attrs, opt_css ) );
450451 return xnode;
--- a/0.6.x/js/05_util/04_XXML.js
+++ b/0.6.x/js/05_util/04_XXML.js
@@ -171,7 +171,7 @@ function XMLWrapper_val( queryString, type ){
171171 n = -1;
172172 isMulti = isMulti || 1 < l;
173173
174- console.log( 'combinator ' + combinator );
174+ //console.log( 'combinator ' + combinator );
175175
176176 switch( combinator ){
177177 // > TagName|*
@@ -222,12 +222,12 @@ function XMLWrapper_val( queryString, type ){
222222 break;
223223 default :
224224 if( combinator === 1 || ( isStart && selector < 7 ) ){
225- console.log( l + ' > ' + xmlList.length + ' tag:' + tagName );
225+ //console.log( l + ' > ' + xmlList.length + ' tag:' + tagName );
226226 for( ; i < l; ++i ){
227227 xml = parents[ i ];
228228 xml.childNodes && xml.childNodes.length && XMLWrapper_fetchElements( xmlList, xml, isAll ? null : tagName );
229229 };
230- console.log( l + ' >> ' + xmlList.length + ' tag:' + tagName );
230+ //console.log( l + ' >> ' + xmlList.length + ' tag:' + tagName );
231231 };
232232 };
233233
@@ -245,7 +245,7 @@ function XMLWrapper_val( queryString, type ){
245245 // :, 擬似クラス
246246 case 4 :
247247 if( !( filter = XMLWrapper_filter[ name ] ) ){
248- return XMLListWrapper_0;;
248+ return XMLListWrapper_0;
249249 };
250250 break;
251251 // [] 属性
@@ -267,7 +267,7 @@ function XMLWrapper_val( queryString, type ){
267267 filter = [ 'class', 3, name ]; break;
268268 // :, 擬似クラス
269269 case 4 :
270- if( !( filter = X_Node_Selector__filter[ name ] ) ){
270+ if( !( filter = XMLWrapper_filter[ name ] ) ){
271271 return [];
272272 };
273273 break;
@@ -442,13 +442,13 @@ function XMLWrapper_val( queryString, type ){
442442 function XMLWrapper_funcSelectorChild( type, flag_all, flags, xmlList ){
443443 var res = [],
444444 flag_not = flags.not,
445- i = 0, n = -1, xnode, node,
445+ i = 0, n = -1, xml, node,
446446 tagName, tmp;
447- for( ; xnode = xmlList[ i ]; ++i ){
448- tagName = flag_all || xnode.tagName;
447+ for( ; xml = xmlList[ i ]; ++i ){
448+ tagName = flag_all || xml.tagName;
449449 tmp = null;
450450 if( /* tmp === null && */ type <= 0 ){
451- for( node = xnode.previousSibling; node; node = node.previousSibling ){
451+ for( node = xml.previousSibling; node; node = node.previousSibling ){
452452 if( node.nodeType === 1 && ( flag_all || tagName === node.tagName ) ){
453453 tmp = false;
454454 break;
@@ -456,7 +456,7 @@ function XMLWrapper_val( queryString, type ){
456456 };
457457 };
458458 if( tmp === null && 0 <= type ){
459- for( node = xnode.nextSibling; node; node = node.nextSibling ){
459+ for( node = xml.nextSibling; node; node = node.nextSibling ){
460460 if( node.nodeType === 1 && ( flag_all || tagName === node.tagName ) ){
461461 tmp = false;
462462 break;
@@ -464,29 +464,32 @@ function XMLWrapper_val( queryString, type ){
464464 };
465465 };
466466 if( tmp === null ) tmp = true;
467- if( tmp ^ flag_not ) res[ ++n ] = xnode;
467+ if( tmp ^ flag_not ) res[ ++n ] = xml;
468468 };
469469 return res;
470470 };
471471 function XMLWrapper_funcSelectorNth( pointer, sibling, flag_all, flags, xmlList, a, b ){
472- var res = [],
472+ var uids = X_Array_copy( xmlList ),
473+ res = [],
473474 checked = {},
474475 flag_not = flags.not,
475- i = 0, n = -1, uid,
476- c, xnode, tmp, node, tagName;
477- for( ; xnode = xmlList[ i ]; ++i ){
478- uid = xnode._uid;
479- tmp = checked[ uid ];
476+ i = 0, n = -1,
477+ c, xml, tmp, node, tagName, uid;
478+
479+ for( ; xml = xmlList[ i ]; ++i ){
480+ tmp = checked[ i ];
480481 if( tmp === undefined ){
481- for( c = 0, node = xnode.parentNode[ pointer ], tagName = flag_all || xnode.tagName; node; node = node[ sibling ] ){
482+ for( c = 0, node = xml.parentNode[ pointer ], tagName = flag_all || xml.tagName; node; node = node[ sibling ] ){
482483 if( node.nodeType === 1 && ( flag_all || tagName === node.tagName ) ){
483484 ++c;
484- checked[ node._uid ] = a === 0 ? c === b : (c - b) % a === 0 && (c - b) / a >= 0;
485- };
485+ uid = uids.indexOf( node );
486+ if( uid === -1 ) uids[ uid = uids.length ] = node;
487+ checked[ uid ] = a === 0 ? c === b : (c - b) % a === 0 && (c - b) / a >= 0;
488+ };
486489 };
487- tmp = checked[ uid ];
490+ tmp = checked[ i ];
488491 };
489- if( tmp ^ flag_not ) res[ ++n ] = xnode;
492+ if( tmp ^ flag_not ) res[ ++n ] = xml;
490493 };
491494 return res;
492495 };
@@ -494,9 +497,9 @@ function XMLWrapper_val( queryString, type ){
494497 function XMLWrapper_funcSelectorProp( prop, flag, flags, xmlList ){
495498 var res = [],
496499 flag_not = flag ? flags.not : !flags.not,
497- i = 0, n = -1, xnode;
498- for( ; xnode = xmlList[ i ]; ++i ){
499- if( xnode.getAttributeNode( prop ) ^ flag_not ) res[ ++n ] = xnode;
500+ i = 0, n = -1, xml;
501+ for( ; xml = xmlList[ i ]; ++i ){
502+ if( xml.getAttributeNode( prop ) ^ flag_not ) res[ ++n ] = xml;
500503 };
501504 return res;
502505 }; */
@@ -536,16 +539,16 @@ var XMLWrapper_filter = {
536539 m : function( flags, xmlList ){
537540 var res = [],
538541 flag_not = flags.not,
539- i = 0, n = -1, xnode, tmp, node;
540- for( ; xnode = xmlList[i]; ++i ){
542+ i = 0, n = -1, xml, tmp, node;
543+ for( ; xml = xmlList[i]; ++i ){
541544 tmp = true;
542- for( node = xnode.firstChild; node; node = node.nextSibling ){
545+ for( node = xml.firstChild; node; node = node.nextSibling ){
543546 if( node.nodeType === 1 || ( node.nodeType === 3 && node.nodeValue ) ){
544547 tmp = false;
545548 break;
546549 };
547550 };
548- if( tmp ^ flag_not ) res[ ++n ] = xnode;
551+ if( tmp ^ flag_not ) res[ ++n ] = xml;
549552 };
550553 return res;
551554 }
@@ -554,20 +557,19 @@ var XMLWrapper_filter = {
554557 m : function( flags, xmlList, arg ){
555558 var res = [],
556559 flag_not = flags.not,
557- i = 0, n = -1, xnode, text = '';
560+ i = 0, n = -1, xml, text = '';
558561
559- for( ; xnode = xmlList[ i ]; ++i ){
560- switch( xnode.nodeType ){
562+ for( ; xml = xmlList[ i ]; ++i ){
563+ switch( xml.nodeType ){
561564 case 1 :
562- text = xml.nodeType === 1 ? xml.innerText || xml.text || xml.textContent : xml.nodeValue;
565+ text = xml.innerText || xml.text || xml.textContent;
563566 break;
564567 //case 2 :
565568 case 3 :
566- text = xnode.nodeValue;
569+ text = xml.nodeValue;
567570 break;
568571 };
569- console.log( text + ' ' + arg );
570- if ( ( -1 < text.indexOf( arg ) ) ^ flag_not ) res[ ++n ] = xnode;
572+ if ( ( -1 < text.indexOf( arg ) ) ^ flag_not ) res[ ++n ] = xml;
571573 };
572574 return res;
573575 }
--- a/0.6.x/js/20_ui/05_XUI_Gesture.js
+++ b/0.6.x/js/20_ui/05_XUI_Gesture.js
@@ -259,7 +259,7 @@ function XUI_Gesture_handleEvent( e ){
259259 isMouse = e.pointerType === 'mouse',
260260 touches = [],
261261 numTouches = 0,// count the total touches on the screen
262- i, p, l, j, captured, ret, activated, gesture, startEv,
262+ i, p, l, j, captured, hammerEvent, ret, activated, gesture, startEv,
263263 deltaTime, deltaX, deltaY, velocity, center, startCenter;
264264
265265 if( !isStart && !hammer.gestureStartEvent ) return;
--- a/0.6.x/js/20_ui/15_ScrollBox.js
+++ b/0.6.x/js/20_ui/15_ScrollBox.js
@@ -12,8 +12,10 @@ function XUI_ScrollBox_start( scrollBox ){
1212 if( scrollBox.hasVScroll ){
1313 if( !XUI_ScrollBox_indicatorV ){
1414 XUI_ScrollBox_indicatorV = X_Doc_create( 'div' )[ 'className' ]( 'ScrollBox-IndicatorV' );
15-
1615 };
16+ if( XUI_ScrollBox_current )
17+ XUI_ScrollBox_current[ 'unlisten' ]( [ X_EVENT_CANCELED, XUI_Event.SCROLL_END ], XUI_ScrollBox_indicatorV, XUI_ScrollBox_indicatorHandleEvent );
18+
1719 scrollBox.xnode[ 'append' ]( XUI_ScrollBox_indicatorV );
1820 XUI_ScrollBox_indicatorV[ 'animate' ](
1921 { opacity : 0 },
@@ -22,11 +24,17 @@ function XUI_ScrollBox_start( scrollBox ){
2224 );
2325 scrollBox
2426 [ 'listenOnce' ]( [ X_EVENT_CANCELED, XUI_Event.SCROLL_END ], XUI_ScrollBox_indicatorV, XUI_ScrollBox_indicatorHandleEvent );
27+ } else
28+ if( XUI_ScrollBox_indicatorV ){
29+ XUI_ScrollBox_indicatorV[ 'remove' ]();
2530 };
31+
2632 if( scrollBox.hasHScroll ){
2733 if( !XUI_ScrollBox_indicatorH ){
2834 XUI_ScrollBox_indicatorH = X_Doc_create( 'div' )[ 'className' ]( 'ScrollBox-IndicatorH' );
2935 };
36+ if( XUI_ScrollBox_current )
37+ XUI_ScrollBox_current[ 'unlisten' ]( [ X_EVENT_CANCELED, XUI_Event.SCROLL_END ], XUI_ScrollBox_indicatorH, XUI_ScrollBox_indicatorHandleEvent );
3038 scrollBox.xnode[ 'append' ]( XUI_ScrollBox_indicatorH );
3139 XUI_ScrollBox_indicatorH[ 'animate' ](
3240 { opacity : 0 },
@@ -35,7 +43,11 @@ function XUI_ScrollBox_start( scrollBox ){
3543 );
3644 scrollBox
3745 [ 'listenOnce' ]( [ X_EVENT_CANCELED, XUI_Event.SCROLL_END ], XUI_ScrollBox_indicatorH, XUI_ScrollBox_indicatorHandleEvent );
46+ } else
47+ if( XUI_ScrollBox_indicatorH ){
48+ XUI_ScrollBox_indicatorH[ 'remove' ]();
3849 };
50+ XUI_ScrollBox_current = scrollBox;
3951 };
4052
4153 function XUI_ScrollBox_indicatorHandleEvent( e ){
旧リポジトリブラウザで表示