Merge branch 'feature/ybStatic' into develop
Showing
26 changed files
with
229 additions
and
116 deletions
libs/.gitignore
0 → 100644
libs/.spmignore
0 → 100644
libs/.travis.yml
0 → 100644
1 | +language: node_js | ||
2 | + | ||
3 | +node_js: | ||
4 | + - "0.10" | ||
5 | + | ||
6 | +install: | ||
7 | + - npm install spm coveralls | ||
8 | + | ||
9 | +before_script: | ||
10 | + - node_modules/spm/bin/spm-install | ||
11 | + | ||
12 | +script: | ||
13 | + - node_modules/spm/bin/spm-test | ||
14 | + | ||
15 | +after_success: | ||
16 | + - node_modules/spm/bin/spm-test --coveralls | node_modules/.bin/coveralls |
libs/HISTORY.md
0 → 100644
libs/README.md
0 → 100644
1 | +# yohobuy-mobile [![spm version](http://spm.yoho.cn/badge/yohobuy-mobile)](http://spm.yoho.cn/package/yohobuy-mobile) | ||
2 | + | ||
3 | +--- | ||
4 | + | ||
5 | +yohobuy-mobile libs | ||
6 | + | ||
7 | +## Install | ||
8 | + | ||
9 | +``` | ||
10 | +$ spm install yohobuy-mobile --save | ||
11 | +``` | ||
12 | + | ||
13 | +## Usage | ||
14 | + | ||
15 | +```js | ||
16 | +var yohobuyMobile = require('yohobuy-mobile'); | ||
17 | +// use yohobuyMobile | ||
18 | +``` |
libs/gulpfile.js
0 → 100644
1 | +/** | ||
2 | + * gulp file 执行compass解析,spm build以及文件合并压缩等 | ||
3 | + * author: xuqi(qi.xu@yoho.cn) | ||
4 | + * date; 2015/3/27 | ||
5 | + */ | ||
6 | +var gulp = require('gulp'), | ||
7 | + fs = require('fs'), | ||
8 | + exec = require('child_process').exec, | ||
9 | + concat = require('gulp-concat'); | ||
10 | + | ||
11 | +var config = JSON.parse(fs.readFileSync('./package.json').toString()); | ||
12 | +//spm build | ||
13 | +gulp.task('build', function() { | ||
14 | + exec('spm build', function() { | ||
15 | + //development ENV | ||
16 | + gulp.src('dist/yoho-mobile.js') | ||
17 | + .pipe(concat('libs-dev.js')) | ||
18 | + .pipe(gulp.dest('../mobile/public/dist/')); | ||
19 | + //production ENV | ||
20 | + gulp.src(['sea/sea.js', 'dist/yoho-mobile.js']) | ||
21 | + .pipe(concat('libs.js')) | ||
22 | + .pipe(gulp.dest('../mobile/dist/' + config.name + '/' + config.version + '/')); | ||
23 | + gulp.src(['sea/sea-debug.js', 'dist/yoho-mobile-debug.js']) | ||
24 | + .pipe(concat('libs-debug.js')) | ||
25 | + .pipe(gulp.dest('../mobile/dist/' + config.name + '/' + config.version + '/')); | ||
26 | + }); | ||
27 | +}); |
libs/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "yohobuy-mobile", | ||
3 | + "version": "1.1.0", | ||
4 | + "description": "yohobuy-mobile libs", | ||
5 | + "keywords": [], | ||
6 | + "homepage": "", | ||
7 | + "author": "xuqi <xuqi9010@gmail.com>", | ||
8 | + "repository": { | ||
9 | + "type": "git", | ||
10 | + "url": "" | ||
11 | + }, | ||
12 | + "licenses": "MIT", | ||
13 | + "spm": { | ||
14 | + "main": "yoho-mobile.js", | ||
15 | + "dependencies": { | ||
16 | + "jquery": "1.8.3", | ||
17 | + "mlellipsis": "0.0.6", | ||
18 | + "lazyload": "1.9.6", | ||
19 | + "iscroll": "5.1.2", | ||
20 | + "mustache": "2.0.0", | ||
21 | + "underscore": "1.6.0" | ||
22 | + }, | ||
23 | + "devDependencies": { | ||
24 | + "expect.js": "0.3.1" | ||
25 | + }, | ||
26 | + "buildArgs": "--idleading {{}} --include all" | ||
27 | + }, | ||
28 | + "devDependencies": { | ||
29 | + "spm": "3" | ||
30 | + }, | ||
31 | + "scripts": { | ||
32 | + "test": "spm test", | ||
33 | + "build": "spm build" | ||
34 | + }, | ||
35 | + "main": "index.js", | ||
36 | + "directories": { | ||
37 | + "example": "examples", | ||
38 | + "test": "tests" | ||
39 | + }, | ||
40 | + "license": "ISC", | ||
41 | + "dependencies": { | ||
42 | + "gulp": "^3.8.11", | ||
43 | + "gulp-concat": "^2.5.2" | ||
44 | + } | ||
45 | +} |
1 | /*! Sea.js 2.3.0 | seajs.org/LICENSE.md */ | 1 | /*! Sea.js 2.3.0 | seajs.org/LICENSE.md */ |
2 | !function(a,b){function c(a){return function(b){return{}.toString.call(b)=="[object "+a+"]"}}function d(){return z++}function e(a){return a.match(C)[0]}function f(a){for(a=a.replace(D,"/"),a=a.replace(F,"$1/");a.match(E);)a=a.replace(E,"/");return a}function g(a){var b=a.length-1,c=a.charAt(b);return"#"===c?a.substring(0,b):".js"===a.substring(b-2)||a.indexOf("?")>0||"/"===c?a:a+".js"}function h(a){var b=u.alias;return b&&w(b[a])?b[a]:a}function i(a){var b=u.paths,c;return b&&(c=a.match(G))&&w(b[c[1]])&&(a=b[c[1]]+c[2]),a}function j(a){var b=u.vars;return b&&a.indexOf("{")>-1&&(a=a.replace(H,function(a,c){return w(b[c])?b[c]:a})),a}function k(a){var b=u.map,c=a;if(b)for(var d=0,e=b.length;e>d;d++){var f=b[d];if(c=y(f)?f(a)||a:a.replace(f[0],f[1]),c!==a)break}return c}function l(a,b){var c,d=a.charAt(0);if(I.test(a))c=a;else if("."===d)c=f((b?e(b):u.cwd)+a);else if("/"===d){var g=u.cwd.match(J);c=g?g[0]+a.substring(1):a}else c=u.base+a;return 0===c.indexOf("//")&&(c=location.protocol+c),c}function m(a,b){if(!a)return"";a=h(a),a=i(a),a=j(a),a=g(a);var c=l(a,b);return c=k(c)}function n(a){return a.hasAttribute?a.src:a.getAttribute("src",4)}function o(a,b,c){var d=K.createElement("script");if(c){var e=y(c)?c(a):c;e&&(d.charset=e)}p(d,b,a),d.async=!0,d.src=a,R=d,Q?P.insertBefore(d,Q):P.appendChild(d),R=null}function p(a,b,c){function d(){a.onload=a.onerror=a.onreadystatechange=null,u.debug||P.removeChild(a),a=null,b()}var e="onload"in a;e?(a.onload=d,a.onerror=function(){B("error",{uri:c,node:a}),d()}):a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&d()}}function q(){if(R)return R;if(S&&"interactive"===S.readyState)return S;for(var a=P.getElementsByTagName("script"),b=a.length-1;b>=0;b--){var c=a[b];if("interactive"===c.readyState)return S=c}}function r(a){var b=[];return a.replace(U,"").replace(T,function(a,c,d){d&&b.push(d)}),b}function s(a,b){this.uri=a,this.dependencies=b||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(!a.seajs){var t=a.seajs={version:"2.3.0"},u=t.data={},v=c("Object"),w=c("String"),x=Array.isArray||c("Array"),y=c("Function"),z=0,A=u.events={};t.on=function(a,b){var c=A[a]||(A[a]=[]);return c.push(b),t},t.off=function(a,b){if(!a&&!b)return A=u.events={},t;var c=A[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]===b&&c.splice(d,1);else delete A[a];return t};var B=t.emit=function(a,b){var c=A[a],d;if(c){c=c.slice();for(var e=0,f=c.length;f>e;e++)c[e](b)}return t},C=/[^?#]*\//,D=/\/\.\//g,E=/\/[^/]+\/\.\.\//,F=/([^:/])\/+\//g,G=/^([^/:]+)(\/.+)$/,H=/{([^{]+)}/g,I=/^\/\/.|:\//,J=/^.*?\/\/.*?\//,K=document,L=location.href&&0!==location.href.indexOf("about:")?e(location.href):"",M=K.scripts,N=K.getElementById("seajsnode")||M[M.length-1],O=e(n(N)||L);t.resolve=m;var P=K.head||K.getElementsByTagName("head")[0]||K.documentElement,Q=P.getElementsByTagName("base")[0],R,S;t.request=o;var T=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,U=/\\\\/g,V=t.cache={},W,X={},Y={},Z={},$=s.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};s.prototype.resolve=function(){for(var a=this,b=a.dependencies,c=[],d=0,e=b.length;e>d;d++)c[d]=s.resolve(b[d],a.uri);return c},s.prototype.load=function(){var a=this;if(!(a.status>=$.LOADING)){a.status=$.LOADING;var c=a.resolve();B("load",c);for(var d=a._remain=c.length,e,f=0;d>f;f++)e=s.get(c[f]),e.status<$.LOADED?e._waitings[a.uri]=(e._waitings[a.uri]||0)+1:a._remain--;if(0===a._remain)return a.onload(),b;var g={};for(f=0;d>f;f++)e=V[c[f]],e.status<$.FETCHING?e.fetch(g):e.status===$.SAVED&&e.load();for(var h in g)g.hasOwnProperty(h)&&g[h]()}},s.prototype.onload=function(){var a=this;a.status=$.LOADED,a.callback&&a.callback();var b=a._waitings,c,d;for(c in b)b.hasOwnProperty(c)&&(d=V[c],d._remain-=b[c],0===d._remain&&d.onload());delete a._waitings,delete a._remain},s.prototype.fetch=function(a){function c(){t.request(g.requestUri,g.onRequest,g.charset)}function d(){delete X[h],Y[h]=!0,W&&(s.save(f,W),W=null);var a,b=Z[h];for(delete Z[h];a=b.shift();)a.load()}var e=this,f=e.uri;e.status=$.FETCHING;var g={uri:f};B("fetch",g);var h=g.requestUri||f;return!h||Y[h]?(e.load(),b):X[h]?(Z[h].push(e),b):(X[h]=!0,Z[h]=[e],B("request",g={uri:f,requestUri:h,onRequest:d,charset:u.charset}),g.requested||(a?a[g.requestUri]=c:c()),b)},s.prototype.exec=function(){function a(b){return s.get(a.resolve(b)).exec()}var c=this;if(c.status>=$.EXECUTING)return c.exports;c.status=$.EXECUTING;var e=c.uri;a.resolve=function(a){return s.resolve(a,e)},a.async=function(b,c){return s.use(b,c,e+"_async_"+d()),a};var f=c.factory,g=y(f)?f(a,c.exports={},c):f;return g===b&&(g=c.exports),delete c.factory,c.exports=g,c.status=$.EXECUTED,B("exec",c),g},s.resolve=function(a,b){var c={id:a,refUri:b};return B("resolve",c),c.uri||t.resolve(c.id,b)},s.define=function(a,c,d){var e=arguments.length;1===e?(d=a,a=b):2===e&&(d=c,x(a)?(c=a,a=b):c=b),!x(c)&&y(d)&&(c=r(""+d));var f={id:a,uri:s.resolve(a),deps:c,factory:d};if(!f.uri&&K.attachEvent){var g=q();g&&(f.uri=g.src)}B("define",f),f.uri?s.save(f.uri,f):W=f},s.save=function(a,b){var c=s.get(a);c.status<$.SAVED&&(c.id=b.id||a,c.dependencies=b.deps||[],c.factory=b.factory,c.status=$.SAVED,B("save",c))},s.get=function(a,b){return V[a]||(V[a]=new s(a,b))},s.use=function(b,c,d){var e=s.get(d,x(b)?b:[b]);e.callback=function(){for(var b=[],d=e.resolve(),f=0,g=d.length;g>f;f++)b[f]=V[d[f]].exec();c&&c.apply(a,b),delete e.callback},e.load()},t.use=function(a,b){return s.use(a,b,u.cwd+"_use_"+d()),t},s.define.cmd={},a.define=s.define,t.Module=s,u.fetchedList=Y,u.cid=d,t.require=function(a){var b=s.get(s.resolve(a));return b.status<$.EXECUTING&&(b.onload(),b.exec()),b.exports},u.base=O,u.dir=O,u.cwd=L,u.charset="utf-8",t.config=function(a){for(var b in a){var c=a[b],d=u[b];if(d&&v(d))for(var e in c)d[e]=c[e];else x(d)?c=d.concat(c):"base"===b&&("/"!==c.slice(-1)&&(c+="/"),c=l(c)),u[b]=c}return B("config",a),t}}}(this); | 2 | !function(a,b){function c(a){return function(b){return{}.toString.call(b)=="[object "+a+"]"}}function d(){return z++}function e(a){return a.match(C)[0]}function f(a){for(a=a.replace(D,"/"),a=a.replace(F,"$1/");a.match(E);)a=a.replace(E,"/");return a}function g(a){var b=a.length-1,c=a.charAt(b);return"#"===c?a.substring(0,b):".js"===a.substring(b-2)||a.indexOf("?")>0||"/"===c?a:a+".js"}function h(a){var b=u.alias;return b&&w(b[a])?b[a]:a}function i(a){var b=u.paths,c;return b&&(c=a.match(G))&&w(b[c[1]])&&(a=b[c[1]]+c[2]),a}function j(a){var b=u.vars;return b&&a.indexOf("{")>-1&&(a=a.replace(H,function(a,c){return w(b[c])?b[c]:a})),a}function k(a){var b=u.map,c=a;if(b)for(var d=0,e=b.length;e>d;d++){var f=b[d];if(c=y(f)?f(a)||a:a.replace(f[0],f[1]),c!==a)break}return c}function l(a,b){var c,d=a.charAt(0);if(I.test(a))c=a;else if("."===d)c=f((b?e(b):u.cwd)+a);else if("/"===d){var g=u.cwd.match(J);c=g?g[0]+a.substring(1):a}else c=u.base+a;return 0===c.indexOf("//")&&(c=location.protocol+c),c}function m(a,b){if(!a)return"";a=h(a),a=i(a),a=j(a),a=g(a);var c=l(a,b);return c=k(c)}function n(a){return a.hasAttribute?a.src:a.getAttribute("src",4)}function o(a,b,c){var d=K.createElement("script");if(c){var e=y(c)?c(a):c;e&&(d.charset=e)}p(d,b,a),d.async=!0,d.src=a,R=d,Q?P.insertBefore(d,Q):P.appendChild(d),R=null}function p(a,b,c){function d(){a.onload=a.onerror=a.onreadystatechange=null,u.debug||P.removeChild(a),a=null,b()}var e="onload"in a;e?(a.onload=d,a.onerror=function(){B("error",{uri:c,node:a}),d()}):a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&d()}}function q(){if(R)return R;if(S&&"interactive"===S.readyState)return S;for(var a=P.getElementsByTagName("script"),b=a.length-1;b>=0;b--){var c=a[b];if("interactive"===c.readyState)return S=c}}function r(a){var b=[];return a.replace(U,"").replace(T,function(a,c,d){d&&b.push(d)}),b}function s(a,b){this.uri=a,this.dependencies=b||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(!a.seajs){var t=a.seajs={version:"2.3.0"},u=t.data={},v=c("Object"),w=c("String"),x=Array.isArray||c("Array"),y=c("Function"),z=0,A=u.events={};t.on=function(a,b){var c=A[a]||(A[a]=[]);return c.push(b),t},t.off=function(a,b){if(!a&&!b)return A=u.events={},t;var c=A[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]===b&&c.splice(d,1);else delete A[a];return t};var B=t.emit=function(a,b){var c=A[a],d;if(c){c=c.slice();for(var e=0,f=c.length;f>e;e++)c[e](b)}return t},C=/[^?#]*\//,D=/\/\.\//g,E=/\/[^/]+\/\.\.\//,F=/([^:/])\/+\//g,G=/^([^/:]+)(\/.+)$/,H=/{([^{]+)}/g,I=/^\/\/.|:\//,J=/^.*?\/\/.*?\//,K=document,L=location.href&&0!==location.href.indexOf("about:")?e(location.href):"",M=K.scripts,N=K.getElementById("seajsnode")||M[M.length-1],O=e(n(N)||L);t.resolve=m;var P=K.head||K.getElementsByTagName("head")[0]||K.documentElement,Q=P.getElementsByTagName("base")[0],R,S;t.request=o;var T=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,U=/\\\\/g,V=t.cache={},W,X={},Y={},Z={},$=s.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};s.prototype.resolve=function(){for(var a=this,b=a.dependencies,c=[],d=0,e=b.length;e>d;d++)c[d]=s.resolve(b[d],a.uri);return c},s.prototype.load=function(){var a=this;if(!(a.status>=$.LOADING)){a.status=$.LOADING;var c=a.resolve();B("load",c);for(var d=a._remain=c.length,e,f=0;d>f;f++)e=s.get(c[f]),e.status<$.LOADED?e._waitings[a.uri]=(e._waitings[a.uri]||0)+1:a._remain--;if(0===a._remain)return a.onload(),b;var g={};for(f=0;d>f;f++)e=V[c[f]],e.status<$.FETCHING?e.fetch(g):e.status===$.SAVED&&e.load();for(var h in g)g.hasOwnProperty(h)&&g[h]()}},s.prototype.onload=function(){var a=this;a.status=$.LOADED,a.callback&&a.callback();var b=a._waitings,c,d;for(c in b)b.hasOwnProperty(c)&&(d=V[c],d._remain-=b[c],0===d._remain&&d.onload());delete a._waitings,delete a._remain},s.prototype.fetch=function(a){function c(){t.request(g.requestUri,g.onRequest,g.charset)}function d(){delete X[h],Y[h]=!0,W&&(s.save(f,W),W=null);var a,b=Z[h];for(delete Z[h];a=b.shift();)a.load()}var e=this,f=e.uri;e.status=$.FETCHING;var g={uri:f};B("fetch",g);var h=g.requestUri||f;return!h||Y[h]?(e.load(),b):X[h]?(Z[h].push(e),b):(X[h]=!0,Z[h]=[e],B("request",g={uri:f,requestUri:h,onRequest:d,charset:u.charset}),g.requested||(a?a[g.requestUri]=c:c()),b)},s.prototype.exec=function(){function a(b){return s.get(a.resolve(b)).exec()}var c=this;if(c.status>=$.EXECUTING)return c.exports;c.status=$.EXECUTING;var e=c.uri;a.resolve=function(a){return s.resolve(a,e)},a.async=function(b,c){return s.use(b,c,e+"_async_"+d()),a};var f=c.factory,g=y(f)?f(a,c.exports={},c):f;return g===b&&(g=c.exports),delete c.factory,c.exports=g,c.status=$.EXECUTED,B("exec",c),g},s.resolve=function(a,b){var c={id:a,refUri:b};return B("resolve",c),c.uri||t.resolve(c.id,b)},s.define=function(a,c,d){var e=arguments.length;1===e?(d=a,a=b):2===e&&(d=c,x(a)?(c=a,a=b):c=b),!x(c)&&y(d)&&(c=r(""+d));var f={id:a,uri:s.resolve(a),deps:c,factory:d};if(!f.uri&&K.attachEvent){var g=q();g&&(f.uri=g.src)}B("define",f),f.uri?s.save(f.uri,f):W=f},s.save=function(a,b){var c=s.get(a);c.status<$.SAVED&&(c.id=b.id||a,c.dependencies=b.deps||[],c.factory=b.factory,c.status=$.SAVED,B("save",c))},s.get=function(a,b){return V[a]||(V[a]=new s(a,b))},s.use=function(b,c,d){var e=s.get(d,x(b)?b:[b]);e.callback=function(){for(var b=[],d=e.resolve(),f=0,g=d.length;g>f;f++)b[f]=V[d[f]].exec();c&&c.apply(a,b),delete e.callback},e.load()},t.use=function(a,b){return s.use(a,b,u.cwd+"_use_"+d()),t},s.define.cmd={},a.define=s.define,t.Module=s,u.fetchedList=Y,u.cid=d,t.require=function(a){var b=s.get(s.resolve(a));return b.status<$.EXECUTING&&(b.onload(),b.exec()),b.exports},u.base=O,u.dir=O,u.cwd=L,u.charset="utf-8",t.config=function(a){for(var b in a){var c=a[b],d=u[b];if(d&&v(d))for(var e in c)d[e]=c[e];else x(d)?c=d.concat(c):"base"===b&&("/"!==c.slice(-1)&&(c+="/"),c=l(c)),u[b]=c}return B("config",a),t}}}(this); |
3 | -; | ||
4 | -seajs.config({ | 3 | +;seajs.config({ |
5 | base: 'http://cdn.yoho.cn', | 4 | base: 'http://cdn.yoho.cn', |
6 | charset: 'utf-8' | 5 | charset: 'utf-8' |
7 | }); | 6 | }); |
libs/yoho-mobile.js
0 → 100644
@@ -27,6 +27,7 @@ var ftpConfig = { | @@ -27,6 +27,7 @@ var ftpConfig = { | ||
27 | pass: 'yoho9646' | 27 | pass: 'yoho9646' |
28 | }; | 28 | }; |
29 | 29 | ||
30 | +// 本地运行时 | ||
30 | // 启动 | 31 | // 启动 |
31 | gulp.task('default', ['server', 'server:restart', 'compass-watch', 'compass']); | 32 | gulp.task('default', ['server', 'server:restart', 'compass-watch', 'compass']); |
32 | 33 | ||
@@ -60,31 +61,9 @@ gulp.task('compass', function() { | @@ -60,31 +61,9 @@ gulp.task('compass', function() { | ||
60 | ) | 61 | ) |
61 | }); | 62 | }); |
62 | 63 | ||
63 | -//spm build | ||
64 | -gulp.task('build', function() { | ||
65 | - exec('spm build --include all', function() { | ||
66 | - exec('gulp build-debug'); | ||
67 | - exec('gulp build-production'); | ||
68 | - }); | ||
69 | -}); | ||
70 | - | ||
71 | -//generate all-debug.js for development ENV | ||
72 | -gulp.task('build-debug', function() { | ||
73 | - gulp.src(['public/lib/sea.js', 'dist/yohobuy-mobile/1.0.0/index-debug.js']) | ||
74 | - .pipe(concat('all-debug.js')) | ||
75 | - .pipe(gulp.dest('public/dist')) | ||
76 | -}); | ||
77 | - | ||
78 | -//generate all.js for production ENV | ||
79 | -gulp.task('build-production', function() { | ||
80 | - gulp.src(['public/lib/sea.js', 'dist/yohobuy-mobile/1.0.0/index.js']) | ||
81 | - .pipe(concat('all.js')) | ||
82 | - .pipe(gulp.dest('public/dist')) | ||
83 | -}); | ||
84 | - | ||
85 | -//线上环境使用 | 64 | +//发布 |
86 | //发布到CND | 65 | //发布到CND |
87 | -gulp.task('dist', ['assets', 'compass-production', 'spm-build-production'], function() { | 66 | +gulp.task('dist', ['assets', 'compass-production', 'build'], function() { |
88 | var ftpstream = ftp(ftpConfig); | 67 | var ftpstream = ftp(ftpConfig); |
89 | return gulp.src('dist/**/') | 68 | return gulp.src('dist/**/') |
90 | .pipe(ftpstream) | 69 | .pipe(ftpstream) |
@@ -118,14 +97,10 @@ gulp.task('compass-production', function() { | @@ -118,14 +97,10 @@ gulp.task('compass-production', function() { | ||
118 | }); | 97 | }); |
119 | }); | 98 | }); |
120 | 99 | ||
121 | -//STEP3:spm | ||
122 | -gulp.task('spm-build-production', function() { | ||
123 | - exec('spm build --include all', function() { | ||
124 | - gulp.src(['public/lib/sea-pro.js', 'dist/yohobuy-mobile/1.0.0/index-debug.js']) | ||
125 | - .pipe(concat('index-debug.js')) | 100 | +//spm build |
101 | +gulp.task('build', function() { | ||
102 | + exec('spm build', function() { | ||
103 | + gulp.src(['dist/index-debug.js', 'dist/index.js']) | ||
126 | .pipe(gulp.dest(dist_dir.js)); | 104 | .pipe(gulp.dest(dist_dir.js)); |
127 | - gulp.src(['public/lib/sea-pro.js', 'dist/yohobuy-mobile/1.0.0/index.js']) | ||
128 | - .pipe(concat('index.js')) | ||
129 | - .pipe(gulp.dest(dist_dir.js)) | ||
130 | }); | 105 | }); |
131 | }); | 106 | }); |
@@ -8,11 +8,11 @@ | @@ -8,11 +8,11 @@ | ||
8 | {{> header}} | 8 | {{> header}} |
9 | </head> | 9 | </head> |
10 | <body> | 10 | <body> |
11 | - <div id="container" class="hide"> | ||
12 | - {{{body}}} | ||
13 | - </div> | ||
14 | <div id="login-tip" class="login-tip">未登录</div> | 11 | <div id="login-tip" class="login-tip">未登录</div> |
15 | <input id="is-login" type="hidden" value="{{isLogin}}"> | 12 | <input id="is-login" type="hidden" value="{{isLogin}}"> |
13 | + <div id="container"> | ||
14 | + {{{body}}} | ||
15 | + </div> | ||
16 | </body> | 16 | </body> |
17 | {{> footer}} | 17 | {{> footer}} |
18 | </html> | 18 | </html> |
1 | { | 1 | { |
2 | "name": "yohobuy-mobile", | 2 | "name": "yohobuy-mobile", |
3 | - "version": "1.0.0", | 3 | + "version": "1.1.0", |
4 | "description": "yohobuy-mobile frontend", | 4 | "description": "yohobuy-mobile frontend", |
5 | "keywords": [], | 5 | "keywords": [], |
6 | "homepage": "", | 6 | "homepage": "", |
@@ -14,15 +14,16 @@ | @@ -14,15 +14,16 @@ | ||
14 | "main": "index.js", | 14 | "main": "index.js", |
15 | "dependencies": { | 15 | "dependencies": { |
16 | "jquery": "1.8.3", | 16 | "jquery": "1.8.3", |
17 | - "mlellipsis": "0.0.2", | ||
18 | - "lazyload": "1.9.5", | 17 | + "mlellipsis": "0.0.6", |
18 | + "lazyload": "1.9.6", | ||
19 | "iscroll": "5.1.2", | 19 | "iscroll": "5.1.2", |
20 | "mustache": "2.0.0", | 20 | "mustache": "2.0.0", |
21 | "underscore": "1.6.0" | 21 | "underscore": "1.6.0" |
22 | }, | 22 | }, |
23 | "devDependencies": { | 23 | "devDependencies": { |
24 | "expect.js": "0.3.1" | 24 | "expect.js": "0.3.1" |
25 | - } | 25 | + }, |
26 | + "buildArgs": "--idleading {{}}" | ||
26 | }, | 27 | }, |
27 | "devDependencies": { | 28 | "devDependencies": { |
28 | "spm": "3" | 29 | "spm": "3" |
@@ -40,13 +40,13 @@ exports.init = function() { | @@ -40,13 +40,13 @@ exports.init = function() { | ||
40 | 40 | ||
41 | //文字截取 | 41 | //文字截取 |
42 | ellipsis.init(); | 42 | ellipsis.init(); |
43 | + $intro[0].mlellipsis(3); //品牌介绍 | ||
44 | + $('.info-block-content, .info-block-title').each(function() { //相关文章 | ||
45 | + this.mlellipsis(2); | ||
46 | + }); | ||
43 | setTimeout(function() { | 47 | setTimeout(function() { |
44 | - $intro.mlellipsis(3); //品牌介绍 | ||
45 | - $('.info-block-content, .info-block-title').each(function() { //相关文章 | ||
46 | - $(this).mlellipsis(2); | ||
47 | - }); | ||
48 | mIntro = $intro.text(); | 48 | mIntro = $intro.text(); |
49 | - aIntro = $intro.attr('_title'); | 49 | + aIntro = $intro.attr('title'); |
50 | }, 0); | 50 | }, 0); |
51 | 51 | ||
52 | //lazyload | 52 | //lazyload |
@@ -45,10 +45,10 @@ exports.initAndroid = function() { | @@ -45,10 +45,10 @@ exports.initAndroid = function() { | ||
45 | //相关文章截取文字 | 45 | //相关文章截取文字 |
46 | ellipsis.init(); | 46 | ellipsis.init(); |
47 | $('.post-list').find('span').each(function() { | 47 | $('.post-list').find('span').each(function() { |
48 | - $(this).mlellipsis(2); | 48 | + this.mlellipsis(2); |
49 | }); | 49 | }); |
50 | $('.brand-name').each(function() { | 50 | $('.brand-name').each(function() { |
51 | - $(this).mlellipsis(1); | 51 | + this.mlellipsis(1); |
52 | }); | 52 | }); |
53 | 53 | ||
54 | //图片懒加载 | 54 | //图片懒加载 |
@@ -211,10 +211,10 @@ exports.initOther = function() { | @@ -211,10 +211,10 @@ exports.initOther = function() { | ||
211 | //相关文章截取文字 | 211 | //相关文章截取文字 |
212 | ellipsis.init(); | 212 | ellipsis.init(); |
213 | $('.post-list').find('span').each(function() { | 213 | $('.post-list').find('span').each(function() { |
214 | - $(this).mlellipsis(2); | 214 | + this.mlellipsis(2); |
215 | }); | 215 | }); |
216 | $('.brand-name').each(function() { | 216 | $('.brand-name').each(function() { |
217 | - $(this).mlellipsis(1); | 217 | + this.mlellipsis(1); |
218 | }); | 218 | }); |
219 | 219 | ||
220 | //提示信息位置 | 220 | //提示信息位置 |
@@ -6,8 +6,7 @@ | @@ -6,8 +6,7 @@ | ||
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | ellipsis = require('mlellipsis'), | 8 | ellipsis = require('mlellipsis'), |
9 | - Mustache = require('mustache'), | ||
10 | - timer = null; | 9 | + Mustache = require('mustache'); |
11 | 10 | ||
12 | require('lazyload'); | 11 | require('lazyload'); |
13 | 12 | ||
@@ -18,14 +17,9 @@ exports.init = function() { | @@ -18,14 +17,9 @@ exports.init = function() { | ||
18 | var tpl; | 17 | var tpl; |
19 | //相关文章截取文字 | 18 | //相关文章截取文字 |
20 | ellipsis.init(); | 19 | ellipsis.init(); |
21 | - | ||
22 | - clearTimeout(timer); | ||
23 | - | ||
24 | - timer = setTimeout(function(){ | ||
25 | - $('.tag-text, .tag-title').each(function() { | ||
26 | - $(this).mlellipsis(2); | ||
27 | - }); | ||
28 | - }, 0); | 20 | + $('.tag-text, .tag-title').each(function() { |
21 | + this.mlellipsis(2); | ||
22 | + }); | ||
29 | 23 | ||
30 | $(function() { | 24 | $(function() { |
31 | var $tagList = $('#tag-list'), | 25 | var $tagList = $('#tag-list'), |
@@ -35,7 +29,6 @@ exports.init = function() { | @@ -35,7 +29,6 @@ exports.init = function() { | ||
35 | $loading = $loadStatus.filter('.loading'), | 29 | $loading = $loadStatus.filter('.loading'), |
36 | winH = $(window).height(), | 30 | winH = $(window).height(), |
37 | loadMoreH = $loadMore.height(), | 31 | loadMoreH = $loadMore.height(), |
38 | - showLoad = false, | ||
39 | canScroll = true, | 32 | canScroll = true, |
40 | dataEnd = false, | 33 | dataEnd = false, |
41 | hasAuthor = false, | 34 | hasAuthor = false, |
@@ -161,14 +154,14 @@ exports.init = function() { | @@ -161,14 +154,14 @@ exports.init = function() { | ||
161 | }); | 154 | }); |
162 | //文字截取 | 155 | //文字截取 |
163 | $tagList.find('.tag-text, .tag-title').each(function() { | 156 | $tagList.find('.tag-text, .tag-title').each(function() { |
164 | - $(this).mlellipsis(2); | 157 | + this.mlellipsis(2); |
165 | }); | 158 | }); |
166 | } | 159 | } |
167 | canScroll = true; | 160 | canScroll = true; |
168 | } | 161 | } |
169 | }); | 162 | }); |
170 | } | 163 | } |
171 | - | 164 | + |
172 | if ($(document).height() === winH) { | 165 | if ($(document).height() === winH) { |
173 | //应对初始加载时数据不满屏不能触发scroll的情况 | 166 | //应对初始加载时数据不满屏不能触发scroll的情况 |
174 | $(document).one('touchmove', function() { | 167 | $(document).one('touchmove', function() { |
@@ -101,10 +101,10 @@ exports.init = function() { | @@ -101,10 +101,10 @@ exports.init = function() { | ||
101 | //ellipsis | 101 | //ellipsis |
102 | ellipsis.init(); | 102 | ellipsis.init(); |
103 | $('.reco .name').each(function() { | 103 | $('.reco .name').each(function() { |
104 | - $(this).mlellipsis(2); | 104 | + this.mlellipsis(2); |
105 | }); | 105 | }); |
106 | $('.brand-name').each(function() { | 106 | $('.brand-name').each(function() { |
107 | - $(this).mlellipsis(1); | 107 | + this.mlellipsis(1); |
108 | }); | 108 | }); |
109 | 109 | ||
110 | //read good-info template | 110 | //read good-info template |
mobile/public/lib/sea.js
deleted
100644 → 0
1 | -/*! Sea.js 2.3.0 | seajs.org/LICENSE.md */ | ||
2 | -!function(a,b){function c(a){return function(b){return{}.toString.call(b)=="[object "+a+"]"}}function d(){return z++}function e(a){return a.match(C)[0]}function f(a){for(a=a.replace(D,"/"),a=a.replace(F,"$1/");a.match(E);)a=a.replace(E,"/");return a}function g(a){var b=a.length-1,c=a.charAt(b);return"#"===c?a.substring(0,b):".js"===a.substring(b-2)||a.indexOf("?")>0||"/"===c?a:a+".js"}function h(a){var b=u.alias;return b&&w(b[a])?b[a]:a}function i(a){var b=u.paths,c;return b&&(c=a.match(G))&&w(b[c[1]])&&(a=b[c[1]]+c[2]),a}function j(a){var b=u.vars;return b&&a.indexOf("{")>-1&&(a=a.replace(H,function(a,c){return w(b[c])?b[c]:a})),a}function k(a){var b=u.map,c=a;if(b)for(var d=0,e=b.length;e>d;d++){var f=b[d];if(c=y(f)?f(a)||a:a.replace(f[0],f[1]),c!==a)break}return c}function l(a,b){var c,d=a.charAt(0);if(I.test(a))c=a;else if("."===d)c=f((b?e(b):u.cwd)+a);else if("/"===d){var g=u.cwd.match(J);c=g?g[0]+a.substring(1):a}else c=u.base+a;return 0===c.indexOf("//")&&(c=location.protocol+c),c}function m(a,b){if(!a)return"";a=h(a),a=i(a),a=j(a),a=g(a);var c=l(a,b);return c=k(c)}function n(a){return a.hasAttribute?a.src:a.getAttribute("src",4)}function o(a,b,c){var d=K.createElement("script");if(c){var e=y(c)?c(a):c;e&&(d.charset=e)}p(d,b,a),d.async=!0,d.src=a,R=d,Q?P.insertBefore(d,Q):P.appendChild(d),R=null}function p(a,b,c){function d(){a.onload=a.onerror=a.onreadystatechange=null,u.debug||P.removeChild(a),a=null,b()}var e="onload"in a;e?(a.onload=d,a.onerror=function(){B("error",{uri:c,node:a}),d()}):a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&d()}}function q(){if(R)return R;if(S&&"interactive"===S.readyState)return S;for(var a=P.getElementsByTagName("script"),b=a.length-1;b>=0;b--){var c=a[b];if("interactive"===c.readyState)return S=c}}function r(a){var b=[];return a.replace(U,"").replace(T,function(a,c,d){d&&b.push(d)}),b}function s(a,b){this.uri=a,this.dependencies=b||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(!a.seajs){var t=a.seajs={version:"2.3.0"},u=t.data={},v=c("Object"),w=c("String"),x=Array.isArray||c("Array"),y=c("Function"),z=0,A=u.events={};t.on=function(a,b){var c=A[a]||(A[a]=[]);return c.push(b),t},t.off=function(a,b){if(!a&&!b)return A=u.events={},t;var c=A[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]===b&&c.splice(d,1);else delete A[a];return t};var B=t.emit=function(a,b){var c=A[a],d;if(c){c=c.slice();for(var e=0,f=c.length;f>e;e++)c[e](b)}return t},C=/[^?#]*\//,D=/\/\.\//g,E=/\/[^/]+\/\.\.\//,F=/([^:/])\/+\//g,G=/^([^/:]+)(\/.+)$/,H=/{([^{]+)}/g,I=/^\/\/.|:\//,J=/^.*?\/\/.*?\//,K=document,L=location.href&&0!==location.href.indexOf("about:")?e(location.href):"",M=K.scripts,N=K.getElementById("seajsnode")||M[M.length-1],O=e(n(N)||L);t.resolve=m;var P=K.head||K.getElementsByTagName("head")[0]||K.documentElement,Q=P.getElementsByTagName("base")[0],R,S;t.request=o;var T=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,U=/\\\\/g,V=t.cache={},W,X={},Y={},Z={},$=s.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};s.prototype.resolve=function(){for(var a=this,b=a.dependencies,c=[],d=0,e=b.length;e>d;d++)c[d]=s.resolve(b[d],a.uri);return c},s.prototype.load=function(){var a=this;if(!(a.status>=$.LOADING)){a.status=$.LOADING;var c=a.resolve();B("load",c);for(var d=a._remain=c.length,e,f=0;d>f;f++)e=s.get(c[f]),e.status<$.LOADED?e._waitings[a.uri]=(e._waitings[a.uri]||0)+1:a._remain--;if(0===a._remain)return a.onload(),b;var g={};for(f=0;d>f;f++)e=V[c[f]],e.status<$.FETCHING?e.fetch(g):e.status===$.SAVED&&e.load();for(var h in g)g.hasOwnProperty(h)&&g[h]()}},s.prototype.onload=function(){var a=this;a.status=$.LOADED,a.callback&&a.callback();var b=a._waitings,c,d;for(c in b)b.hasOwnProperty(c)&&(d=V[c],d._remain-=b[c],0===d._remain&&d.onload());delete a._waitings,delete a._remain},s.prototype.fetch=function(a){function c(){t.request(g.requestUri,g.onRequest,g.charset)}function d(){delete X[h],Y[h]=!0,W&&(s.save(f,W),W=null);var a,b=Z[h];for(delete Z[h];a=b.shift();)a.load()}var e=this,f=e.uri;e.status=$.FETCHING;var g={uri:f};B("fetch",g);var h=g.requestUri||f;return!h||Y[h]?(e.load(),b):X[h]?(Z[h].push(e),b):(X[h]=!0,Z[h]=[e],B("request",g={uri:f,requestUri:h,onRequest:d,charset:u.charset}),g.requested||(a?a[g.requestUri]=c:c()),b)},s.prototype.exec=function(){function a(b){return s.get(a.resolve(b)).exec()}var c=this;if(c.status>=$.EXECUTING)return c.exports;c.status=$.EXECUTING;var e=c.uri;a.resolve=function(a){return s.resolve(a,e)},a.async=function(b,c){return s.use(b,c,e+"_async_"+d()),a};var f=c.factory,g=y(f)?f(a,c.exports={},c):f;return g===b&&(g=c.exports),delete c.factory,c.exports=g,c.status=$.EXECUTED,B("exec",c),g},s.resolve=function(a,b){var c={id:a,refUri:b};return B("resolve",c),c.uri||t.resolve(c.id,b)},s.define=function(a,c,d){var e=arguments.length;1===e?(d=a,a=b):2===e&&(d=c,x(a)?(c=a,a=b):c=b),!x(c)&&y(d)&&(c=r(""+d));var f={id:a,uri:s.resolve(a),deps:c,factory:d};if(!f.uri&&K.attachEvent){var g=q();g&&(f.uri=g.src)}B("define",f),f.uri?s.save(f.uri,f):W=f},s.save=function(a,b){var c=s.get(a);c.status<$.SAVED&&(c.id=b.id||a,c.dependencies=b.deps||[],c.factory=b.factory,c.status=$.SAVED,B("save",c))},s.get=function(a,b){return V[a]||(V[a]=new s(a,b))},s.use=function(b,c,d){var e=s.get(d,x(b)?b:[b]);e.callback=function(){for(var b=[],d=e.resolve(),f=0,g=d.length;g>f;f++)b[f]=V[d[f]].exec();c&&c.apply(a,b),delete e.callback},e.load()},t.use=function(a,b){return s.use(a,b,u.cwd+"_use_"+d()),t},s.define.cmd={},a.define=s.define,t.Module=s,u.fetchedList=Y,u.cid=d,t.require=function(a){var b=s.get(s.resolve(a));return b.status<$.EXECUTING&&(b.onload(),b.exec()),b.exports},u.base=O,u.dir=O,u.cwd=L,u.charset="utf-8",t.config=function(a){for(var b in a){var c=a[b],d=u[b];if(d&&v(d))for(var e in c)d[e]=c[e];else x(d)?c=d.concat(c):"base"===b&&("/"!==c.slice(-1)&&(c+="/"),c=l(c)),u[b]=c}return B("config",a),t}}}(this); | ||
3 | -;seajs.config({ | ||
4 | - base: 'localhost:5000/dist' | ||
5 | -}); |
1 | +<script src="http://localhost:8000/public/js/ps.js"></script> | ||
1 | <script type="text/javascript"> | 2 | <script type="text/javascript"> |
2 | - seajs.use(['jquery/1.8.3/jquery-debug', 'yohobuy-mobile/1.0.0/public/js/ps-debug'], function($, ps) { | ||
3 | - $("#container").removeClass('hide'); | ||
4 | - | 3 | + seajs.use('public/js/ps', function(ps) { |
5 | if (ps) { | 4 | if (ps) { |
6 | ps.init(); | 5 | ps.init(); |
7 | } | 6 | } |
1 | +<script src="http://localhost:8000/public/js/saunter.js"></script> | ||
1 | <script type="text/javascript"> | 2 | <script type="text/javascript"> |
2 | - seajs.use(['jquery/1.8.3/jquery-debug', | ||
3 | - 'yohobuy-mobile/1.0.0/public/js/saunter-debug'], function($, saunter) { | 3 | + seajs.use('public/js/saunter', function(saunter) { |
4 | var u = navigator.userAgent; | 4 | var u = navigator.userAgent; |
5 | - | ||
6 | - $("#container").removeClass('hide'); | ||
7 | if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { | 5 | if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { |
8 | saunter.initAndroid(); | 6 | saunter.initAndroid(); |
9 | } else { | 7 | } else { |
1 | +<script src="http://localhost:8000/public/js/tag.js"></script> | ||
1 | <script type="text/javascript"> | 2 | <script type="text/javascript"> |
2 | - seajs.use(['jquery/1.8.3/jquery-debug','yohobuy-mobile/1.0.0/public/js/tag-debug'], function($, tag) { | ||
3 | - $("#container").removeClass('hide'); | ||
4 | - | 3 | + seajs.use('public/js/tag', function(tag) { |
5 | if(tag) { | 4 | if(tag) { |
6 | tag.init(); | 5 | tag.init(); |
7 | } | 6 | } |
1 | +<script src="http://localhost:8000/public/js/template.js"></script> | ||
1 | <script type="text/javascript"> | 2 | <script type="text/javascript"> |
2 | - seajs.use(['jquery/1.8.3/jquery-debug', 'yohobuy-mobile/1.0.0/public/js/template-debug'], function($, tpl) { | ||
3 | - $("#container").removeClass('hide'); | ||
4 | - | 3 | + seajs.use('public/js/template', function(tpl) { |
5 | if (tpl) { | 4 | if (tpl) { |
6 | tpl.init(); | 5 | tpl.init(); |
7 | } | 6 | } |
1 | -<script type="text/javascript"> | ||
2 | - (function (doc, win) { | ||
3 | - var docEl = doc.documentElement, | ||
4 | - resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | ||
5 | - recalc = function () { | ||
6 | - var clientWidth = docEl.clientWidth; | ||
7 | - if (!clientWidth) { | ||
8 | - return; | ||
9 | - } | ||
10 | - docEl.style.fontSize = 20 * (clientWidth / 320) + 'px'; | ||
11 | - }; | ||
12 | - | ||
13 | - if (!doc.addEventListener) { | ||
14 | - return; | ||
15 | - } | ||
16 | - win.addEventListener(resizeEvt, recalc, false); | ||
17 | - doc.addEventListener('DOMContentLoaded', recalc, false); | ||
18 | - })(document, window); | 1 | +<script src="http://localhost:8000/static/js/sea.js?nowrap"></script> |
2 | +<script> | ||
3 | + seajs.config({ | ||
4 | + base: 'http://localhost:8000/' | ||
5 | + }) | ||
19 | </script> | 6 | </script> |
20 | -<script src="//localhost:5000/dist/all-debug.js"></script> | 7 | +<script src="http://localhost:8000/public/dist/libs-dev.js"></script> |
21 | {{! 根据标识字段添加模块对应JS入口文件}} | 8 | {{! 根据标识字段添加模块对应JS入口文件}} |
22 | {{# isSaunter}} | 9 | {{# isSaunter}} |
23 | {{> footer_js/saunter}} | 10 | {{> footer_js/saunter}} |
1 | +<script type="text/javascript"> | ||
2 | + (function (doc, win) { | ||
3 | + var docEl = doc.documentElement, | ||
4 | + resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | ||
5 | + recalc = function () { | ||
6 | + var clientWidth = docEl.clientWidth; | ||
7 | + if (!clientWidth) { | ||
8 | + return; | ||
9 | + } | ||
10 | + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px'; | ||
11 | + }; | ||
12 | + | ||
13 | + if (!doc.addEventListener) { | ||
14 | + return; | ||
15 | + } | ||
16 | + win.addEventListener(resizeEvt, recalc, false); | ||
17 | + doc.addEventListener('DOMContentLoaded', recalc, false); | ||
18 | + })(document, window); | ||
19 | +</script> | ||
1 | <link rel="stylesheet" href="../css/index.css"> | 20 | <link rel="stylesheet" href="../css/index.css"> |
-
Please register or login to post a comment