diff --git a/.gitignore b/.gitignore
new file mode 100755
index 000000000..7e4260bbf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+bin-debug
+bin-release
+/.git.7z
diff --git a/JC.js b/JC.js
old mode 100644
new mode 100755
index 6da6d1e53..6de670f34
--- a/JC.js
+++ b/JC.js
@@ -1,23 +1,48 @@
//TODO: use 方法 nginx 模式添加 url 最大长度判断
//TODO: use add custom type
+//TODO: 支持解析带 JC. 命名空间
+/**
+ *
业务逻辑命名空间
+ *
这个命名空间的组件主要为满足业务需求, 不是通用组件~
+ *
但在某个项目中应该是常用组件~
+ *
+ * - 业务组件的存放位置:
+ * - libpath/bizs/
+ *
+ * - 使用业务组件
+ * - JC.use( 'Bizs.BizComps' ); // libpath/bizs/BizComps/BizComps.js
+ *
+ * - 使用业务文件
+ * - JC.use( 'bizs.BizFile' ); // libpath/bizs/BizFile.js
+ *
+ * @namespace
+ * @class Bizs
+ * @static
+ */
+window.Bizs = window.Bizs || {};
;(function( $ ){
- if( window.JC && typeof JC.PATH != 'undefined' ) return;
+ if( window.JC && typeof JC.compsDir != 'undefined' ) return;
+ window.JC && JC.f && JC.f.backward( 1 ); //这里启用 JC.common 的向后兼容, 为 window 注入全局静态函数变量
/**
* JC jquery 组件库 资源调用控制类
*
这是一个单例模式, 全局访问使用 JC 或 window.JC
- * requires: jQuery
+ * require:
+ * jQuery
+ * , JC.common
+ *
* JC Project Site
- * | API docs
+ * | API docs
* | demo link
+ * @namespace
* @class JC
- * @namespace window
* @static
* @example
* JC.use( 组件名[,组件名] );
* @author qiushaowei | 75 team
* @date 2013-08-04
*/
- window.JC = {
+ window.JC = window.JC || {};
+ var CLASS = {
/**
* JC组件库所在路径
* @property PATH
@@ -39,12 +64,11 @@
* 导入JC组件
* @method use
* @static
- * @param {string} _names - 模块名
+ * @param {string} _items - 模块名
* 或者模块下面的某个js文件(test/test1.js, 路径前面不带"/"将视为test模块下的test1.js)
* 或者一个绝对路径的js文件, 路径前面带 "/"
+ * @param {callback} _readyCb
*
- * @param {string} _basePath - 指定要导入资源所在的主目录, 这个主要应用于 nginx 路径输出
- * @param {bool} _enableNginxStyle - 指定是否需要使用 nginx 路径输出脚本资源
*
* @example
JC.use( 'SomeClass' ); //导入类 SomeClass
@@ -75,8 +99,9 @@
].join()
);
*/
- , use: function( _items ){
+ , use: function( _items, _readyCb ){
if( ! _items ) return;
+ _readyCb && $( document ).ready( function( _evt ){ _readyCb( _evt ); } );
var _p = this
, _paths = []
, _parts = $.trim( _items ).split(/[\s]*?,[\s]*/)
@@ -92,6 +117,12 @@
_parts = JC._usePatch( _parts, 'Form', 'AutoSelect' );
_parts = JC._usePatch( _parts, 'Form', 'AutoChecked' );
+ _parts = JC._usePatch( _parts, 'Form', 'FormFillUrl' );
+
+ /*
+ _parts = JC._usePatch( _parts, 'AjaxUpload', 'plugins.SWFUpload' );
+ */
+ _parts = JC._usePatch( _parts, 'AjaxUpload', 'Panel' );
$.each( _parts, function( _ix, _part ){
var _isComps = !_compRe.test( _part )
@@ -119,7 +150,7 @@
}else if( _compFileRe.test( _path ) ){//组件文件
_path = printf( '{0}{1}{2}.js', JC.PATH, JC.compsDir, _part.replace( _compFileRe, '' ) );
}else{//组件
- _path = printf( '{0}{1}{2}/{2}.js', JC.PATH, JC.compsDir, _part );
+ _path = printf( '{0}{1}{2}/{2}.js', JC.PATH, JC.compsDir, _part.replace( /^JC\./, '' ) );
}
}
!_isComps && !_isFullpath && ( _path = printf( '{0}/{1}', JC.PATH, _part ) );
@@ -137,7 +168,7 @@
_paths.push( _path );
});
- JC.log( _paths );
+ //JC.log( _paths );
!JC.enableNginxStyle && JC._writeNormalScript( _paths );
JC.enableNginxStyle && JC._writeNginxScript( _paths );
@@ -156,7 +187,7 @@
function( _items, _fromClass, _patchClass ){
var i, j, k, l, _find;
for( i = 0, j = _items.length; i < j; i++ ){
- if( ( $.trim( _items[i].toString() ) == _fromClass ) ){
+ if( ( $.trim( _items[i].toString() ).replace( /^JC\./, '' ) == _fromClass ) ){
_find = true;
break;
}
@@ -170,7 +201,8 @@
* @method log
* @static
*/
- , log: function(){ JC.debug && window.console && console.log( sliceArgs( arguments ).join(' ') ); }
+ //, log: function(){ JC.debug && window.console && console.log( sliceArgs( arguments ).join(' ') ); }
+ //已在 JC.common 声明
/**
* 定义输出路径的 v 参数, 以便控制缓存
* @property pathPostfix
@@ -187,6 +219,14 @@
* @static
*/
, enableNginxStyle: false
+ /**
+ * 定义 nginx 合并文件时, URL 的最大长度
+ * @property nginxUrlLen
+ * @type int
+ * @default 200
+ * @static
+ */
+ , nginxUrlLen: 280
/**
* 定义 nginx style 的基础路径
*
注意: 如果这个属性为空, 即使 enableNginxStyle = true, 也是直接输出默认路径
@@ -234,18 +274,11 @@
http://jc.openjavascript.org/plugins/jquery.form.js
*/
, FILE_MAP: null
- /**
- * 输出 nginx concat 模块的脚本路径格式
- * @method _writeNginxScript
- * @param {array} _paths
- * @private
- * @static
- */
, _writeNginxScript:
function( _paths ){
if( !JC.enableNginxStyle ) return;
for( var i = 0, j = _paths.length, _ngpath = [], _npath = []; i < j; i++ ){
- JC.log( _paths[i].slice( 0, JC.nginxBasePath.length ).toLowerCase(), JC.nginxBasePath.toLowerCase() );
+ //JC.log( _paths[i].slice( 0, JC.nginxBasePath.length ).toLowerCase(), JC.nginxBasePath.toLowerCase() );
if(
_paths[i].slice( 0, JC.nginxBasePath.length ).toLowerCase()
== JC.nginxBasePath.toLowerCase() )
@@ -256,12 +289,48 @@
}
}
- var _postfix = JC.pathPostfix ? '?v=' + JC.pathPostfix : '';
+ var _postfix = JC.pathPostfix ? '?v=' + JC.pathPostfix : '';
+ /*
_ngpath.length && document.write( printf( '
+
+
+
+
+ - JC.use 使用示例 - 自动截断长URL
+
+
+
+