├── .gitignore ├── CHANGELOG ├── LICENSE ├── README.md ├── bower.json ├── doc ├── AJAX.md ├── CACHE.md ├── DEPENDENCY.md ├── DISPATCHER.md ├── FAQ.md ├── MESSAGE.md ├── PLATFORM.md ├── TEMPLATE.md ├── WIDGET.md └── guide │ ├── Build.Scalable.Web.System.md │ └── Build.Scalable.Web.System │ ├── Module.md │ └── Platform.md ├── package.json ├── res ├── audio_sprite.png ├── cors │ ├── cross-origin-0.0.2-sources.jar │ └── cross-origin-0.0.2.jar ├── crossdomain.xml ├── frame.png ├── nej_blank.gif ├── nej_clipboard.swf ├── nej_color.png ├── nej_color_btn.png ├── nej_color_mask.png ├── nej_editor.png ├── nej_player_audio.swf ├── nej_proxy_flash.swf ├── nej_proxy_frame.html ├── nej_proxy_upload.html ├── nej_storage.swf ├── nej_upload_image.swf └── src │ ├── nej_proxy_frame.html │ └── nej_proxy_upload.html └── src ├── base ├── .dep ├── chain.js ├── config.js ├── constant.js ├── demo │ ├── define │ │ ├── a.css │ │ ├── a.js │ │ ├── a.json │ │ ├── define.html │ │ └── style.html │ ├── element.html │ ├── event.html │ ├── klass.html │ ├── test.html │ └── util.html ├── element.js ├── event.js ├── global.js ├── klass.js ├── platform.js ├── platform │ ├── config.js │ ├── config.patch.js │ ├── element.js │ ├── element.patch.js │ ├── event.js │ ├── event.patch.js │ ├── util.js │ └── util.patch.js ├── test │ ├── config.test.html │ ├── config.test.js │ ├── constant.test.html │ ├── constant.test.js │ ├── element.test.html │ ├── element.test.js │ ├── event.test.html │ ├── event.test.js │ ├── global.test.html │ ├── global.test.js │ ├── klass.test.html │ ├── klass.test.js │ ├── platform.test.html │ ├── platform.test.js │ ├── util.test.html │ └── util.test.js └── util.js ├── define.js ├── ui ├── audio │ ├── audio.css │ ├── audio.html │ ├── audio.js │ ├── mp3.css │ ├── mp3.html │ ├── mp3.js │ └── test │ │ ├── audio.test.html │ │ ├── audio.test.js │ │ ├── mp3.test.html │ │ └── mp3.test.js ├── base.js ├── carousel.list │ └── carousel.list.js ├── carousel │ ├── carousel.js │ ├── carousel.list.js │ ├── carousel.x.js │ ├── carousel.y.js │ ├── indicator.js │ ├── list.js │ ├── test │ │ ├── carousel.test.html │ │ └── carousel.test.js │ ├── x.js │ └── y.js ├── colorpick │ ├── colorpanel.css │ ├── colorpanel.html │ ├── colorpanel.js │ ├── colorpick.complex.js │ ├── colorpick.css │ ├── colorpick.html │ ├── colorpick.js │ ├── colorpick.simple.js │ ├── complex.html │ ├── complex.js │ ├── demo │ │ ├── colorpanel.html │ │ ├── colorpick.html │ │ ├── complex.html │ │ └── simple.html │ ├── simple.css │ ├── simple.html │ ├── simple.js │ └── test │ │ ├── colorpanel.test.html │ │ └── colorpanel.test.js ├── datepick │ ├── datepick.css │ ├── datepick.html │ ├── datepick.js │ ├── demo │ │ └── datepick.html │ └── test │ │ ├── datepick.test.html │ │ └── datepick.test.js ├── editor │ ├── command │ │ ├── color.complex.js │ │ ├── color.css │ │ ├── color.js │ │ ├── color.simple.js │ │ ├── complex.css │ │ ├── complex.js │ │ ├── font.css │ │ ├── font.html │ │ ├── font.js │ │ ├── fontname.js │ │ ├── fontsize.js │ │ ├── link.css │ │ ├── link.html │ │ ├── link.js │ │ ├── simple.css │ │ ├── simple.js │ │ ├── uploadimage.css │ │ ├── uploadimage.html │ │ └── uploadimage.js │ ├── custom.js │ ├── demo │ │ ├── 0.jpg │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ └── custom.html │ ├── editor.css │ ├── editor.html │ ├── editor.js │ └── test │ │ ├── custom.test.html │ │ └── custom.test.js ├── item │ ├── item.js │ └── list.js ├── layer │ ├── card.css │ ├── card.js │ ├── card.wrapper.js │ ├── demo │ │ ├── card.html │ │ └── window.html │ ├── layer.js │ ├── layer.wrapper.js │ ├── test │ │ ├── card.test.html │ │ ├── card.test.js │ │ ├── layer.test.html │ │ ├── layer.test.js │ │ ├── mylayer.js │ │ ├── mylayercard.js │ │ ├── mylayerwrapper.js │ │ ├── mywindow.js │ │ ├── window.test.html │ │ ├── window.test.js │ │ ├── window.wrapper.test.html │ │ └── window.wrapper.test.js │ ├── window.css │ ├── window.html │ ├── window.js │ ├── window.wrapper.js │ └── wrapper │ │ ├── card.js │ │ ├── layer.js │ │ └── window.js ├── lightbox │ ├── demo │ │ └── lightbox.html │ ├── lightbox.css │ ├── lightbox.html │ └── lightbox.js ├── mask │ ├── mask.css │ ├── mask.js │ └── test │ │ ├── mask.test.html │ │ └── mask.test.js ├── pager │ ├── base.css │ ├── base.js │ ├── demo │ │ └── pager.html │ ├── pager.base.js │ ├── pager.js │ ├── pager.simple.js │ ├── simple.js │ └── test │ │ ├── pager.test.html │ │ └── pager.test.js ├── portrait │ ├── complex.css │ ├── complex.html │ ├── complex.js │ ├── demo │ │ ├── complex.html │ │ └── simple.html │ ├── portrait.complex.js │ ├── portrait.css │ ├── portrait.html │ ├── portrait.js │ ├── portrait.simple.js │ └── simple.js ├── range │ ├── range.css │ └── range.js ├── resizer │ ├── demo │ │ └── resizer.html │ ├── resizer.css │ ├── resizer.html │ └── resizer.js ├── scroller.list │ ├── scroller.list.js │ └── test │ │ ├── scroller.list.test.html │ │ └── scroller.list.test.js ├── scroller │ ├── demo │ │ └── y.html │ ├── list.css │ ├── list.js │ ├── scroller.js │ ├── scroller.x.js │ ├── scroller.y.js │ ├── test │ │ ├── scroller.y.test.html │ │ └── scroller.y.test.js │ ├── x.css │ ├── x.js │ ├── y.css │ └── y.js ├── suggest │ ├── demo │ │ └── suggest.html │ ├── suggest.css │ ├── suggest.html │ ├── suggest.js │ └── test │ │ ├── suggest.test.html │ │ └── suggest.test.js └── timepick │ ├── demo │ └── timepick.html │ ├── test │ ├── timepick.test.html │ └── timepick.test.js │ ├── timepick.css │ ├── timepick.html │ └── timepick.js └── util ├── ajax ├── demo │ ├── a.html │ ├── a.js │ ├── b.html │ ├── b.json │ ├── rest.html │ ├── tag.html │ ├── upload.html │ └── xdr.html ├── dwr.js ├── jsonp.js ├── loader │ ├── html.js │ ├── loader.js │ ├── platform │ │ ├── html.js │ │ └── html.patch.js │ ├── script.js │ ├── style.js │ ├── test │ │ ├── loader.test.html │ │ └── loader.test.js │ └── text.js ├── message.js ├── platform │ ├── message.js │ ├── message.patch.js │ ├── xdr.js │ └── xdr.patch.js ├── proxy │ ├── flash.js │ ├── frame.js │ ├── platform │ │ ├── xhr.js │ │ └── xhr.patch.js │ ├── proxy.js │ ├── upload.js │ └── xhr.js ├── rest.js ├── tag.js ├── test │ ├── a.html │ ├── a.js │ ├── b.html │ ├── b.js │ ├── message.test.html │ ├── message.test.js │ ├── tag.test.html │ ├── tag.test.js │ ├── x.css │ ├── xdr.test.html │ ├── xdr.test.js │ ├── xx.css │ └── xxx.txt └── xdr.js ├── animation ├── animation.js ├── bezier.js ├── bounce.js ├── decelerate.js ├── demo │ └── easeout.html ├── easein.js ├── easeinout.js ├── easeout.js ├── linear.js └── test │ ├── animation.test.html │ └── animation.test.js ├── audio ├── audio.js ├── demo │ ├── a.aac │ ├── a.amr │ └── audio.html ├── platform │ ├── audio.js │ └── audio.patch.js └── test │ ├── audio.test.html │ └── audio.test.js ├── cache ├── abstract.js ├── cache.js ├── cache.list.base.js ├── cache.list.js ├── cache.share.js ├── cookie.js ├── database.js ├── demo │ ├── cookie.html │ ├── list.html │ ├── list.js │ └── storage.html ├── list.js ├── manager.js ├── platform │ ├── storage.js │ └── storage.patch.js ├── share.js ├── storage.js └── test │ ├── cache.custom.js │ ├── cache.list.custom.js │ ├── cache.test.html │ ├── cache.test.js │ ├── cookie.test.html │ ├── cookie.test.js │ ├── storage.test.html │ └── storage.test.js ├── calendar └── calendar.js ├── chain ├── NodeList.js ├── README.md ├── chainable.js └── test │ ├── chainable.test.html │ ├── chainable.test.js │ ├── fixture.test.html │ ├── playjs.sublime-project │ └── playjs.sublime-workspace ├── chart └── chart.js ├── clipboard ├── clipboard.js ├── demo │ └── clipboard.html └── test │ ├── clipboard.test.html │ └── clipboard.test.js ├── clipper ├── clipper.js └── demo │ ├── 1.jpg │ └── clipper.html ├── clock └── clock.js ├── color ├── color.js └── demo │ └── color.html ├── counter ├── counter.js ├── demo │ └── counter.html ├── platform │ ├── counter.js │ └── counter.patch.js └── test │ ├── counter.test.html │ └── counter.test.js ├── cursor ├── cursor.js ├── demo │ └── cursor.html └── platform │ ├── cursor.js │ └── cursor.patch.js ├── cycler ├── cycler.js └── test │ ├── cycler.test.html │ └── cycler.test.js ├── data ├── portrait │ └── portrait.js └── region │ └── zh.js ├── dispatcher ├── dispatcher.2.js ├── dispatcher.js ├── dsp │ ├── group.js │ ├── node.js │ ├── single.js │ └── util.js ├── module.base.js ├── module.js ├── platform │ ├── dispatcher.js │ └── dispatcher.patch.js ├── regularModule.js ├── test.js └── test │ ├── c │ ├── c1.js │ ├── c2.js │ ├── index.css │ └── index.js │ ├── dispatcher.2.test.html │ ├── dispatcher.2.test.js │ ├── m │ ├── a.html │ ├── b.html │ ├── c.html │ ├── c1.html │ ├── c2.html │ └── root.html │ ├── private.module.test.html │ ├── private.module.test.js │ └── root │ ├── index.css │ └── index.js ├── dragger ├── dragger.js ├── simple.js └── test │ ├── dragger.test.html │ └── dragger.test.js ├── editor ├── area.js ├── command.js ├── command │ ├── backcolor.js │ ├── blockquote.js │ ├── bold.js │ ├── card.js │ ├── color.js │ ├── font.js │ ├── fontname.js │ ├── fontsize.js │ ├── forecolor.js │ ├── format.js │ ├── insertorderedlist.js │ ├── insertunorderedlist.js │ ├── italic.js │ ├── justifycenter.js │ ├── justifyleft.js │ ├── justifyright.js │ ├── link.js │ ├── removeformat.js │ ├── simple.js │ ├── space.js │ ├── strikethrough.js │ ├── superscript.js │ ├── underline.js │ └── uploadimage.js ├── demo │ └── text.html ├── editor.js ├── platform │ ├── editor.js │ ├── editor.patch.js │ ├── editor.td.js │ └── text.js ├── text.html ├── text.js └── toolbar.js ├── effect ├── api.js ├── effect.api.js ├── effect.js ├── platform │ ├── effect.api.js │ ├── effect.api.patch.js │ ├── effect.js │ └── effect.patch.js └── test │ ├── effcet.api.test.html │ ├── effect.api.test.js │ ├── effect.test.html │ └── effect.test.js ├── encode ├── base64.js ├── crc32.js ├── demo │ ├── json.html │ └── md5.html ├── json.js ├── md5.js ├── platform │ ├── 3rd.json.js │ ├── json.js │ └── json.patch.js ├── sha.md5.js └── test │ ├── base64.test.html │ └── base64.test.js ├── es ├── array.js ├── demo │ └── array.html └── platform │ ├── array.js │ └── array.patch.js ├── event.js ├── event ├── esb.js └── event.js ├── file ├── demo │ ├── file.html │ ├── paste.html │ ├── select.html │ └── upload ├── paste.js ├── platform │ ├── paste.js │ ├── paste.patch.js │ ├── select.js │ └── select.patch.js ├── save.js ├── select.js └── test │ ├── save.test.html │ ├── save.test.js │ ├── select.test.html │ └── select.test.js ├── flash ├── flash.html ├── flash.js ├── platform │ ├── flash.js │ └── flash.patch.js └── test │ ├── flash.test.html │ └── flash.test.js ├── focus ├── focus.js ├── platform │ ├── focus.js │ └── focus.patch.js └── test │ ├── focus.test.html │ └── focus.test.js ├── form ├── demo │ └── form.html ├── form.js └── test │ ├── form.test.html │ └── form.test.js ├── gestrue ├── drag.js ├── gestrue.js ├── pinch.js ├── rotate.js ├── swipe.js └── tap.js ├── helper └── select.js ├── highlight ├── test │ ├── highlight.test.html │ └── highlight.test.js └── touch.js ├── history ├── history.js ├── history.override.js ├── manager.js └── platform │ ├── history.js │ └── history.patch.js ├── hover ├── hover.js ├── platform │ ├── hover.js │ └── hover.patch.js └── test │ ├── hover.test.html │ └── hover.test.js ├── lazy ├── demo │ └── image.html ├── image.js └── loading.js ├── lightbox ├── demo │ └── lightbox.html └── lightbox.js ├── list ├── demo │ ├── data.js │ ├── list │ │ ├── cache.js │ │ ├── item.js │ │ ├── jst.html │ │ ├── ntp.html │ │ ├── pg.html │ │ └── wf.html │ ├── page.html │ └── waterfall.html ├── holder.js ├── module.js ├── module.pager.js ├── module.waterfall.js ├── page.js ├── test │ ├── cache.list.custom.js │ ├── module.pager.test.html │ └── module.pager.test.js └── waterfall.js ├── media ├── audio.js ├── flash.js ├── media.js ├── playlist.js └── test │ ├── audio.test.html │ └── audio.test.js ├── page ├── base.js ├── page.base.js ├── page.js ├── page.simple.js └── simple.js ├── placeholder ├── demo │ └── placeholder.html ├── placeholder.js ├── platform │ ├── holder.js │ └── holder.patch.js └── test │ ├── placeholder.test.html │ └── placeholder.test.js ├── profile └── profile.js ├── query ├── demo │ └── demo.html ├── nes.js └── query.js ├── range ├── demo │ └── range.html ├── range.js └── test │ ├── range.test.html │ └── range.test.js ├── region ├── demo │ └── at.html ├── region.zh.js ├── test │ ├── region.zh.test.html │ └── region.zh.test.js └── zh.js ├── resize ├── demo │ └── resize.html ├── resize.js └── test │ ├── resize.test.html │ └── resize.test.js ├── scroll ├── demo │ ├── simple.html │ └── smart.html ├── platform │ ├── simple.js │ └── simple.patch.js ├── scroll.simple.js ├── simple.js └── smart.js ├── selector ├── cascade.js ├── demo │ ├── cascade.html │ └── selector.html ├── range.js ├── selector.js └── selector.range.js ├── slider ├── demo │ ├── simple.html │ └── y.html ├── simple.js ├── slider.js ├── slider.simple.js ├── slider.x.js ├── slider.xy.js ├── slider.y.js ├── test │ ├── slider.test.html │ ├── slider.test.js │ └── sorter.test.js ├── x.js ├── xy.js └── y.js ├── sort ├── demo │ ├── horizontal.html │ ├── horizontal.trigger.html │ ├── vertical.html │ └── vertical.trigger.html ├── horizontal.js ├── sortable.js └── vertical.js ├── suggest ├── at.js ├── demo │ ├── at.html │ └── suggest.html ├── suggest.js └── test │ ├── suggest.test.html │ └── suggest.test.js ├── tab ├── tab.js ├── tab.view.js ├── test │ ├── tab.test.html │ └── tab.test.js └── view.js ├── template ├── demo │ ├── a.css │ ├── a.html │ ├── a.js │ ├── b.css │ ├── b.html │ ├── b.js │ ├── jst.html │ └── tpl.html ├── jst.js ├── test │ ├── jst.test.html │ ├── jst.test.js │ ├── myItem.js │ ├── tpl.test.html │ └── tpl.test.js ├── tpl.js └── trimpath.js ├── timer ├── animation.js ├── demo │ ├── a.js │ ├── output.js │ ├── test.html │ └── test.min.html ├── interval.js └── platform │ ├── animation.js │ └── animation.patch.js └── toggle ├── demo └── toggle.html ├── test ├── toggle.test.html └── toggle.test.js └── toggle.js /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | .project 3 | .svn 4 | .idea/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | NEJ is released under the MIT license 2 | 3 | Copyright 2012 (c) NetEase, Inc 4 | 5 | Uses 6 | TrimPath (http://code.google.com/p/trimpath/) 7 | json2.js (http://www.JSON.org/json2.js) 8 | json_parse.js (https://github.com/douglascrockford/JSON-js) 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nej", 3 | "version": "0.5.2", 4 | "homepage": "https://github.com/genify/nej", 5 | "authors": [ 6 | "genify " 7 | ], 8 | "description": "JavaScript Cross-Platform Framework", 9 | "main": "./src/define.js", 10 | "keywords": [ 11 | "nej", 12 | "javascript", 13 | "cross platform", 14 | "framework" 15 | ], 16 | "ignore": [ 17 | ".*", 18 | "**/test/", 19 | "**/demo/", 20 | "doc", 21 | "res" 22 | ], 23 | "license": "MIT" 24 | } -------------------------------------------------------------------------------- /doc/CACHE.md: -------------------------------------------------------------------------------- 1 | # 前端存储机制 2 | 3 | ## 概述 4 | 5 | 6 | 7 | ## 内存缓存 8 | 9 | 10 | 11 | 12 | ## 本地存储 13 | 14 | 15 | 16 | 17 | ## 本地数据库 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doc/FAQ.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/doc/FAQ.md -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nej-framework", 3 | "description": "JavaScript Cross-Platform Framework", 4 | "version": "0.5.2", 5 | "license": "MIT", 6 | "keywords": [ 7 | "nej", 8 | "javascript", 9 | "cross platform", 10 | "framework" 11 | ], 12 | "author": "genify ", 13 | "main": "./src/define.js", 14 | "homepage": "https://github.com/genify/nej", 15 | "scripts": { 16 | "test": "echo \"Error: no test specified\" && exit 1" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/genify/nej.git" 21 | }, 22 | "bugs": { 23 | "url": "https://github.com/genify/nej/issues" 24 | } 25 | } -------------------------------------------------------------------------------- /res/audio_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/audio_sprite.png -------------------------------------------------------------------------------- /res/cors/cross-origin-0.0.2-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/cors/cross-origin-0.0.2-sources.jar -------------------------------------------------------------------------------- /res/cors/cross-origin-0.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/cors/cross-origin-0.0.2.jar -------------------------------------------------------------------------------- /res/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /res/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/frame.png -------------------------------------------------------------------------------- /res/nej_blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_blank.gif -------------------------------------------------------------------------------- /res/nej_clipboard.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_clipboard.swf -------------------------------------------------------------------------------- /res/nej_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_color.png -------------------------------------------------------------------------------- /res/nej_color_btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_color_btn.png -------------------------------------------------------------------------------- /res/nej_color_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_color_mask.png -------------------------------------------------------------------------------- /res/nej_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_editor.png -------------------------------------------------------------------------------- /res/nej_player_audio.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_player_audio.swf -------------------------------------------------------------------------------- /res/nej_proxy_flash.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_proxy_flash.swf -------------------------------------------------------------------------------- /res/nej_proxy_upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 15 | -------------------------------------------------------------------------------- /res/nej_storage.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_storage.swf -------------------------------------------------------------------------------- /res/nej_upload_image.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/res/nej_upload_image.swf -------------------------------------------------------------------------------- /res/src/nej_proxy_upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 15 | -------------------------------------------------------------------------------- /src/base/.dep: -------------------------------------------------------------------------------- 1 | 基础库依赖关系 2 | 3 | global <- klass 4 | <- platform 5 | <- config <- constant 6 | <- util <- element <-> event -------------------------------------------------------------------------------- /src/base/demo/define/a.css: -------------------------------------------------------------------------------- 1 | .a{color:#f00;} 2 | .b{color:#0000FF;} -------------------------------------------------------------------------------- /src/base/demo/define/a.js: -------------------------------------------------------------------------------- 1 | console.log('aaaaa'); 2 | -------------------------------------------------------------------------------- /src/base/demo/define/a.json: -------------------------------------------------------------------------------- 1 | { 2 | "a":"aaaaaaaaa", 3 | "b":"bbbbbbbbbb" 4 | } 5 | -------------------------------------------------------------------------------- /src/base/demo/define/define.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | define demo 5 | 6 | 13 | 14 | 15 | 16 | 17 | 30 | 31 | -------------------------------------------------------------------------------- /src/base/demo/define/style.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | define demo 5 | 6 | 13 | 14 | 15 | 16 |

aaaaaaaaaaaaaaaa

17 |

bbbbbbbbbbbbbbbbbbbbbbbbbb

18 | 25 | 26 | -------------------------------------------------------------------------------- /src/base/demo/element.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | element demo 5 | 6 | 13 | 14 | 15 | 16 | 17 | 33 | 34 | -------------------------------------------------------------------------------- /src/base/demo/util.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | util demo 5 | 6 | 13 | 14 | 15 |
16 | 17 | 18 |
19 | 20 | 35 | 36 | -------------------------------------------------------------------------------- /src/base/platform/config.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './config.js', 10 | 'base/platform' 11 | ],function(_h,_m,_p,_o,_f,_r){ 12 | // for ie 13 | NEJ.patch('TR',function(){ 14 | _h.__set( 15 | 'storage.swf', 16 | (this.NEJ_CONF||_o).storage|| 17 | (_h.__get('root')+'nej_storage.swf') 18 | ); 19 | }); 20 | // for ie7- data uri not available 21 | NEJ.patch('TR<=3.0',function(){ 22 | _h.__set( 23 | 'blank.png', 24 | (this.NEJ_CONF||_o).blank|| 25 | (_h.__get('root')+'nej_blank.gif') 26 | ); 27 | }); 28 | 29 | return _h; 30 | }); 31 | -------------------------------------------------------------------------------- /src/base/platform/event.patch.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/base/platform/event.patch.js -------------------------------------------------------------------------------- /src/base/test/config.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | config测试页 6 | 7 | 8 | 9 | 10 |

Qunit config test

11 |

12 |
13 |

14 |
    15 |
    16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/base/test/constant.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | constant测试页 6 | 7 | 8 | 9 | 10 |

    Qunit constant test

    11 |

    12 |
    13 |

    14 |
      15 |
      16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/base/test/event.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | event.js测试页面 6 | 7 | 8 | 12 | 13 | 14 |

      nej event.js test

      15 |

      16 |
      17 |

      18 |
        19 |
        20 |
        21 | 点击我 22 |
        23 |
        touch测试
        24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/base/test/global.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | global测试页面 6 | 7 | 8 | 9 | 10 |

        nej global.js test

        11 |

        12 |
        13 |

        14 |
          15 |
          16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/base/test/klass.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | klass测试页面 6 | 7 | 8 | 9 | 10 |

          nej klass.js test

          11 |

          12 |
          13 |

          14 |
            15 |
            16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/base/test/platform.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | platform测试页 6 | 7 | 8 | 9 | 10 |

            Qunit platform test

            11 |

            12 |
            13 |

            14 |
              15 |
              16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/base/test/platform.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("platform"); 4 | var _p = NEJ.P('nej.p'); 5 | 6 | //开始单元测试 7 | test('NEJ配置文件测试', function() { 8 | var _isWindows = _p._$is('desktop'); 9 | equal(_isWindows,true,'判断是否指定平台'); 10 | }); 11 | } 12 | module('依赖模块'); 13 | test('define',function(){expect(0); 14 | define('{pro}platform.test.js', 15 | ['{lib}base/platform.js'],f); 16 | }); 17 | -------------------------------------------------------------------------------- /src/base/test/util.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | util测试页面 6 | 7 | 8 | 9 | 10 |

              nej util.js test

              11 |

              12 |
              13 |

              14 |
                15 |
                16 |
                node
                17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/ui/audio/audio.html: -------------------------------------------------------------------------------- 1 |
                2 | 3 |
                 
                4 |
                -------------------------------------------------------------------------------- /src/ui/audio/mp3.html: -------------------------------------------------------------------------------- 1 |
                2 |
                3 |
                4 |
                5 |   6 |   7 |   8 |
                9 |
                10 |
                11 |   12 |
                13 |
                14 |
                15 | 16 |   17 | 18 | 00:00 19 |
                20 |
                21 |
                22 |
                23 |   24 |
                25 |
                26 |
                27 |
                28 | 00:00 29 |   30 |
                31 |
                32 |
                33 |
                -------------------------------------------------------------------------------- /src/ui/audio/test/audio.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | audio测试页 6 | 7 | 8 | 11 | 12 | 13 |

                Qunit audio test

                14 |

                15 |
                16 |

                17 |
                  18 |
                  19 |
                  20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/ui/audio/test/audio.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("audio"); 4 | //开始单元测试 5 | test('audio',function(){ 6 | expect(0); 7 | var _audio = nej.ui._$$AudioPlayer._$allocate({ 8 | parent:document.getElementById('id-box'), 9 | title:'Track01', 10 | url:'http://www.zhlongyin.com/UploadFiles/xrxz/2011/5/201105051307513619.mp3', 11 | onstatechange:function(_event){ 12 | } 13 | }); 14 | setTimeout(function(){ 15 | _audio._$play(); 16 | },500); 17 | // _audio._$pause(); 18 | // _audio._$stop(); 19 | // _audio._$play(); 20 | }); 21 | } 22 | module('依赖模块'); 23 | test('define',function(){expect(0); 24 | define('{pro}audio.test.js',['ui/audio/audio'],f); 25 | }); -------------------------------------------------------------------------------- /src/ui/audio/test/mp3.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mp3测试页 6 | 7 | 8 | 9 | 10 |

                  Qunit mask test

                  11 |

                  12 |
                  13 |

                  14 |
                    15 |
                    16 |
                    17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/ui/carousel.list/carousel.list.js: -------------------------------------------------------------------------------- 1 | // link to ui/carousel/list for compatible 2 | // use ui/carousel/list for new project 3 | NEJ.define(['ui/carousel/list'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/carousel/carousel.list.js: -------------------------------------------------------------------------------- 1 | // link to ui/carousel/list for compatible 2 | // use ui/carousel/list for new project 3 | NEJ.define(['./list.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/carousel/carousel.x.js: -------------------------------------------------------------------------------- 1 | // link to ui/carousel/x for compatible 2 | // use ui/carousel/x for new project 3 | NEJ.define(['./x.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/ui/carousel/carousel.y.js: -------------------------------------------------------------------------------- 1 | // link to ui/carousel/y for compatible 2 | // use ui/carousel/y for new project 3 | NEJ.define(['./y.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/carousel/test/carousel.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | carousel测试页 7 | 8 | 9 | 13 | 14 | 15 |

                    Qunit carousel test

                    16 |

                    17 |
                    18 |

                    19 |
                      20 |
                      21 |

                      10秒后统计卡片播放结果

                      22 | 23 |
                       
                      24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/ui/carousel/test/carousel.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("carousel"); 4 | var _ = NEJ.P, 5 | _v = _('nej.v'), 6 | _e = _('nej.e'), 7 | _p = _('nej.ui'); 8 | 9 | 10 | //开始单元测试 11 | test('carouselX',function(){ 12 | stop(); 13 | // _v._$addEvent('carousel-box','touchstart',_v._$stopDefault); 14 | // _v._$addEvent('carousel-box','touchmove',_v._$stopDefault); 15 | var _cx = _p._$$CarouselX._$allocate({ 16 | parent:_e._$get('carousel-box'), 17 | mode:1, 18 | buffer:10, 19 | current:2, 20 | onaddcard:function(_index){ 21 | var _img = _e._$create('img'); 22 | _img.draggable = false; 23 | _img.src = 'http://www.baidu.com/img/baidu_sylogo1.gif'; 24 | _cx._$appendItem(_index,_img); 25 | }, 26 | onscrollstart:function(_index){ 27 | ok(true,'onscrollstart') 28 | }, 29 | onscroll:function(_index){ 30 | ok(true,'onscroll') 31 | }, 32 | onbouncerelease:function(_index){ 33 | ok(true,'onbouncerelease') 34 | } 35 | }); 36 | setTimeout(function(){ 37 | start(); 38 | },10000); 39 | 40 | }); 41 | 42 | //开始单元测试 43 | test('carouselY',function(){ 44 | expect(0); 45 | }); 46 | } 47 | module('依赖模块'); 48 | test('define',function(){expect(0); 49 | define('{pro}carousel.test.js',['ui/carousel/carousel.x','ui/carousel/carousel.y'],f); 50 | }); -------------------------------------------------------------------------------- /src/ui/carousel/x.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 水平模块播放器实现文件 4 | * @version 1.0 5 | * @author huxueliang(huxueliang@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** @module ui/carousel/x */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'ui/carousel/carousel' 13 | ],function(NEJ,_k,_i0,_p,_o,_f,_r){ 14 | // variable declaration 15 | var _pro; 16 | /** 17 | * 卡片水平播放器对象 18 | * 19 | * @class module:ui/carousel/x._$$CarouselX 20 | * @extends module:ui/carousel/carousel._$$Carousel 21 | */ 22 | _p._$$CarouselX = _k._$klass(); 23 | _pro = _p._$$CarouselX._$extend(_i0._$$Carousel); 24 | /** 25 | * 获得配置参数 26 | * 27 | * @protected 28 | * @method module:ui/carousel/x._$$CarouselX#__getConfig 29 | * @return {Object} 配置参数对象 30 | */ 31 | _pro.__getConfig = function(){ 32 | return { 33 | m:'moveX', 34 | p:'m41', 35 | l:'width', 36 | o:'offsetWidth', 37 | v:!1 38 | }; 39 | }; 40 | 41 | if (CMPT){ 42 | NEJ.copy(NEJ.P('nej.ui'),_p); 43 | } 44 | 45 | return _p; 46 | }); 47 | 48 | -------------------------------------------------------------------------------- /src/ui/carousel/y.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 卡片垂直播放器实现文件 4 | * @version 1.0 5 | * @author huxueliang(huxueliang@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** @module ui/carousel/y */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'ui/carousel/carousel' 13 | ],function(NEJ,_k,_i0,_p,_o,_f,_r){ 14 | // variable declaration 15 | var _pro; 16 | /** 17 | * 卡片水平播放器对象 18 | * 19 | * @class module:ui/carousel/y._$$CarouselY 20 | * @extends module:ui/carousel/carousel._$$Carousel 21 | */ 22 | _p._$$CarouselY = _k._$klass(); 23 | _pro = _p._$$CarouselY._$extend(_i0._$$Carousel); 24 | /** 25 | * 获得配置参数 26 | * 27 | * @protected 28 | * @method module:ui/carousel/y._$$CarouselY#__getConfig 29 | * @return {Object} 配置参数对象 30 | */ 31 | _pro.__getConfig = function(){ 32 | return { 33 | m:'moveY', 34 | p:'m42', 35 | l:'height', 36 | o:'offsetHeight', 37 | v:!0 38 | }; 39 | }; 40 | 41 | if (CMPT){ 42 | NEJ.copy(NEJ.P('nej.ui'),_p); 43 | } 44 | 45 | return _p; 46 | }); 47 | 48 | -------------------------------------------------------------------------------- /src/ui/colorpick/colorpanel.css: -------------------------------------------------------------------------------- 1 | .#{width:160px;margin:0 auto;overflow:hidden;$:none;} 2 | .# .zbg{background:url(#nej_color_btn.png) no-repeat -50px -50px;} 3 | .# .zwrp{position:relative;padding:3px;zoom:1;cursor:default;font-size:1px;} 4 | .# .zwrp .zdot{position:absolute;top:0;left:0;height:8px;overflow:hidden;} 5 | .# .zwrp .zshw{height:104px;border:1px solid #bdbabd;} 6 | .# .zpnl{float:left;} 7 | .# .zpnl .zdot{width:8px;background-position:0 0;} 8 | .# .zpnl .zshw{width:104px;background:url(#nej_color.png) no-repeat;} 9 | .# .zhlt{float:right;padding:3px 7px;} 10 | .# .zhlt .zdot{width:44px;height:9px;background-position:0 -30px;} 11 | .# .zhlt .zshw{width:26px;background:url(#nej_color_mask.png) repeat-x;} -------------------------------------------------------------------------------- /src/ui/colorpick/colorpanel.html: -------------------------------------------------------------------------------- 1 |
                      2 |
                      3 |   4 |
                       
                      5 |
                      6 |
                      7 |   8 |
                       
                      9 |
                      10 |
                      -------------------------------------------------------------------------------- /src/ui/colorpick/colorpick.complex.js: -------------------------------------------------------------------------------- 1 | // link to ui/colorpick/complex for compatible 2 | // use ui/colorpick/complex for new project 3 | NEJ.define(['./complex.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/colorpick/colorpick.css: -------------------------------------------------------------------------------- 1 | .# .zbx{background:url(<#root>nej_color_btn.png) no-repeat -50px -50px;} 2 | .# .zinf{width:160px;margin:0 auto;padding-bottom:2px;overflow:hidden;font-size:12px;} 3 | .# .zinf .zfl{float:left;} 4 | .# .zinf .zes{width:19px;height:19px;margin:0 2px 0 3px;background-position:-22px 0;cursor:pointer;} 5 | .# .zinf .zpv{width:17px;height:17px;border:1px solid #bdbabd;} 6 | .# .zinf .ztxt{width:56px;height:13px;line-height:13px;} 7 | .# .zinf .zbtn{width:49px;height:20px;line-height:20px;padding:0;cursor:pointer;} -------------------------------------------------------------------------------- /src/ui/colorpick/colorpick.html: -------------------------------------------------------------------------------- 1 |
                      2 |
                      3 |   4 |   5 | 6 | 7 |
                      8 |
                      -------------------------------------------------------------------------------- /src/ui/colorpick/colorpick.simple.js: -------------------------------------------------------------------------------- 1 | // link to ui/colorpick/simple for compatible 2 | // use ui/colorpick/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/colorpick/complex.html: -------------------------------------------------------------------------------- 1 | {list xlist as x} 2 |   3 | {/list} -------------------------------------------------------------------------------- /src/ui/colorpick/demo/colorpanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo for colorpick 5 | 6 | 9 | 17 | 18 | 19 |
                      20 |
                      21 | 22 | 27 | 28 | 43 | 44 | -------------------------------------------------------------------------------- /src/ui/colorpick/demo/colorpick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo for colorpick 5 | 6 | 13 | 14 | 15 | 20 | 21 | 38 | 39 | -------------------------------------------------------------------------------- /src/ui/colorpick/demo/complex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo for colorpick 5 | 6 | 13 | 14 | 15 | 20 | 21 | 38 | 39 | -------------------------------------------------------------------------------- /src/ui/colorpick/demo/simple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo for colorpick 5 | 6 | 13 | 14 | 15 | 20 | 21 | 38 | 39 | -------------------------------------------------------------------------------- /src/ui/colorpick/simple.css: -------------------------------------------------------------------------------- 1 | .#{text-align:left;} 2 | .# .zdft{display:block;padding:3px 1px 3px 5px;margin:3px;cursor:pointer;} 3 | .# .zdft:hover{padding:2px 0 2px 4px;background:#ffeec2;border:1px solid #000080;text-decoration:none;} 4 | .# .zprv{display:block;width:28px;height:11px;overflow:hidden;border:1px solid #aca899;} 5 | .# .zbox{width:152px;margin:0 5px;overflow:hidden;} 6 | .# .zbox .zitm{display:block;float:left;width:11px;height:11px;overflow:hidden;margin:3px;border:1px solid #aca899;cursor:pointer;} 7 | .# .zbox2{width:220px;margin-left:9px;border-width:1px 0 0 1px;border-color:#000;border-style:solid;} 8 | .# .zbox2 .zitm2{width:10px;height:10px;margin:-1px 0 0 -1px;border-color:#000;} -------------------------------------------------------------------------------- /src/ui/colorpick/simple.html: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /src/ui/colorpick/test/colorpanel.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | colorpanel测试页 6 | 7 | 8 | 9 | 10 |

                      Qunit colorpanel test

                      11 |

                      12 |
                      13 |

                      14 |
                        15 |
                        16 |
                        17 |
                        18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/ui/colorpick/test/colorpanel.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("colorpanel"); 4 | var _ = NEJ.P, 5 | _e = _('nej.e'), 6 | _p = _('nej.ui'); 7 | //开始单元测试 8 | // test('colorpanel',function(){ 9 | // stop(); 10 | // var _cp = _p._$$ColorPanel._$allocate({ 11 | // parent:'colorpanel-box', 12 | // onchange:function(_color){ 13 | // ok(true,'设置的颜色为:' + _color); 14 | // start(); 15 | // } 16 | // }); 17 | // }); 18 | 19 | test('colorpick',function(){ 20 | stop(); 21 | expect(0); 22 | var _cp = _p._$$ColorPick._$allocate({ 23 | parent:'colorpanel-box2', 24 | onchange:function(_color){ 25 | // ok(true,'设置的颜色为:' + _color); 26 | }, 27 | onselect:function(_color){ 28 | // ok(true,'最后设置的颜色为:' + _color); 29 | start(); 30 | } 31 | }); 32 | _cp._$setColor('#00ff00'); 33 | }); 34 | } 35 | module('依赖模块'); 36 | test('define',function(){expect(0); 37 | define('{pro}colorpanel.test.js',['ui/colorpick/colorpick'],f); 38 | }); -------------------------------------------------------------------------------- /src/ui/datepick/datepick.css: -------------------------------------------------------------------------------- 1 | .#{width:210px;border:1px solid #aaa;font-size:14px;text-align:center;} 2 | .# .zact{line-height:30px;overflow:hidden;zoom:1;} 3 | .# .zact .zfl{float:left;} 4 | .# .zact .zfr{float:right;} 5 | .# .zact .zbtn{padding:0 5px;cursor:pointer;} 6 | .# .zact .ztxt{margin-left:10px;} 7 | .# .zday{table-layout:fixed;border-collapse:collapse;width:100%;} 8 | .# .zday th{font-weight:normal;} 9 | .# .zday a{display:block;height:22px;line-height:22px;color:#333;text-decoration:none;} 10 | .# .zday a:hover{background:#eee;} 11 | .# .zday a.js-extended{color:#aaa;} 12 | .# .zday a.js-selected, 13 | .# .zday a.js-selected:hover{background:#DAE4E7;} 14 | .# .zday a.js-disabled, 15 | .# .zday a.js-disabled:hover{background:#fff;color:#eee;cursor:default;} -------------------------------------------------------------------------------- /src/ui/datepick/datepick.html: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /src/ui/editor/command/color.complex.js: -------------------------------------------------------------------------------- 1 | // link to ui/editor/command/complex for compatible 2 | // use ui/editor/command/complex for new project 3 | NEJ.define(['./complex.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/editor/command/color.css: -------------------------------------------------------------------------------- 1 | .#{width:160px;padding:10px 5px 5px;border:1px solid #9FAC87;} -------------------------------------------------------------------------------- /src/ui/editor/command/color.simple.js: -------------------------------------------------------------------------------- 1 | // link to ui/editor/command/simple for compatible 2 | // use ui/editor/command/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/editor/command/complex.css: -------------------------------------------------------------------------------- 1 | .#{width:238px;padding:5px 0 8px;border:1px solid #9FAC87;} -------------------------------------------------------------------------------- /src/ui/editor/command/font.css: -------------------------------------------------------------------------------- 1 | .#{border:1px solid #9FAC87;font-size:12px;text-align:left;} 2 | .# .zitm{display:block;position:relative;margin:1px;outline:none;padding:2px 0 2px 8px;border:1px solid #ddd;color:#000;background-color:#fff;text-decoration:none;} 3 | .# .zitm:hover{background-color:#e5e5e1;text-decoration:none;} 4 | .# .zitm .ztip{position:absolute;top:2px;right:5px;font-size:10px;} -------------------------------------------------------------------------------- /src/ui/editor/command/font.html: -------------------------------------------------------------------------------- 1 | {list xlist as x} 2 | 3 | ${x.name} 4 | {if !!x.tip}${x.tip}{/if} 5 | 6 | {/list} -------------------------------------------------------------------------------- /src/ui/editor/command/link.css: -------------------------------------------------------------------------------- 1 | .#{padding:20px 20px 32px 20px;} 2 | .# .u-title{color:#ccc;height:35px;line-height:35px;border-bottom: solid 1px #ccc;} 3 | .# .u-row{margin-bottom:10px;} 4 | .# .u-error{color:red;padding-top:10px;font-size:12px;height:2em;} 5 | .# .u-edit{position: relative;z-index: 101;background: #FAFAFA;border: 1px solid #DFDFDF;-webkit-box-shadow: inset 1px 1px 2px #DFDFDF;-moz-box-shadow: inset 1px 1px 2px #dfdfdf;box-shadow: inset 1px 1px 2px #DFDFDF;} 6 | .# .btn a{border:solid 1px #ccc;padding:5px;} 7 | .# .ipt{display:block;font-size: 14px;position: relative;z-index: 101;line-height:35px;height:35px;width: 290px;resize: none;background: transparent;border: none;color: #444;overflow:hidden;} -------------------------------------------------------------------------------- /src/ui/editor/command/link.html: -------------------------------------------------------------------------------- 1 |
                        2 |
                        标题
                        3 |
                        链接
                        4 |
                        5 |
                        6 | 取消 7 | 确定 8 |
                        9 |
                        -------------------------------------------------------------------------------- /src/ui/editor/command/simple.css: -------------------------------------------------------------------------------- 1 | .#{width:160px;padding:5px 0;border:1px solid #9FAC87;} -------------------------------------------------------------------------------- /src/ui/editor/command/uploadimage.css: -------------------------------------------------------------------------------- 1 | .#{width:336px;} 2 | .# .m-iframe{position:absolute;height:0px;width:0px;left:-9000px;} 3 | .# .u-upload-file{height:0px;width:0px;font-size:0px;} 4 | .# .u-error{color:red;padding-top:10px;} 5 | .# .choose_file{position:relative;margin-bottom:10px;} 6 | .# .choose_file object{position:absolute;left:0;top:0;} 7 | .# .web_img{margin-bottom:8px;} 8 | .# .web_img .u-edit{margin-bottom:10px;} 9 | .# .u-desc{color:#ccc;} 10 | .# .middle{color:#528CE0;} 11 | .# .u-btn{cursor:pointer;color:#528CE0;} 12 | .# .u-image{width:0px;height:0px;visibility:hidden;} -------------------------------------------------------------------------------- /src/ui/editor/command/uploadimage.html: -------------------------------------------------------------------------------- 1 |
                        2 | 7 |
                        8 |
                        9 |
                        10 | 选择图片 11 |
                        12 |
                        13 |

                        14 |
                        15 |
                        16 |
                        17 |
                        18 |
                        19 | 确定 20 |
                        21 |
                        22 |

                        23 |
                        24 |
                        25 |
                        -------------------------------------------------------------------------------- /src/ui/editor/demo/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/ui/editor/demo/0.jpg -------------------------------------------------------------------------------- /src/ui/editor/demo/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/ui/editor/demo/1.jpg -------------------------------------------------------------------------------- /src/ui/editor/demo/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/ui/editor/demo/2.jpg -------------------------------------------------------------------------------- /src/ui/editor/demo/custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test editor 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 25 | 26 | -------------------------------------------------------------------------------- /src/ui/editor/editor.css: -------------------------------------------------------------------------------- 1 | .#{width:500px;border:1px solid #ddd;text-align:center;} 2 | .# .zbg{background:url(#nej_editor.png?20131028) no-repeat 100px 100px;} 3 | .# .ztbar{height:30px;background-color:#eee;zoom:1;} 4 | .# .ztbar:after{display:block;clear:both;visibility:hidden;height:0;content:".";} 5 | .# .zitm{float:left;width:24px;height:24px;margin:3px 0;cursor:pointer;} 6 | .# .zitm:hover{background-position:0 0;} 7 | .# .zitm.js-selected{background-position:-30px 0;} 8 | .# .zitm .zicn{width:16px;height:16px;margin:4px auto 0;overflow:hidden;text-indent:100px;} 9 | .# .zitm .ztxt{display:none;} 10 | .# .zisp{float:left;width:10px;height:24px;margin:3px 0;background-position:-60px 0;overflow:hidden;} 11 | .# .zsel{float:left;position:relative;height:20px;overflow:hidden;line-height:20px;padding:0 5px;margin:4px;border:1px solid #C5C5C5;background:#fff;font-size:12px;text-align:left;cursor:pointer;} 12 | .# .zsel .zarw{position:absolute;top:0;right:0;width:18px;height:18px;background-position:0px -244px;} 13 | .# .zsel.zfs{width:60px;} 14 | .# .zsel.zfm{width:140px;} 15 | .# .zarea{height:200px;} 16 | .# .zarea iframe{width:100%;height:100%;overflow:hidden;} -------------------------------------------------------------------------------- /src/ui/editor/editor.html: -------------------------------------------------------------------------------- 1 | 12 | 18 | -------------------------------------------------------------------------------- /src/ui/editor/test/custom.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | custom测试页 6 | 7 | 8 | 11 | 12 | 13 |

                        nej custom.js test

                        14 |

                        15 |
                        16 |

                        17 |
                          18 |
                          19 |
                          20 |
                          getcnt
                          21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/ui/layer/card.css: -------------------------------------------------------------------------------- 1 | .#{position:absolute;background:#fff;} -------------------------------------------------------------------------------- /src/ui/layer/card.wrapper.js: -------------------------------------------------------------------------------- 1 | // link to ui/layer/wrapper/card for compatible 2 | // use ui/layer/wrapper/card for new project 3 | NEJ.define(['./wrapper/card.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/layer/layer.wrapper.js: -------------------------------------------------------------------------------- 1 | // link to ui/layer/wrapper/layer for compatible 2 | // use ui/layer/wrapper/layer for new project 3 | NEJ.define(['./wrapper/layer.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/layer/test/card.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | card测试页 6 | 7 | 8 | 11 | 12 | 13 |

                          Qunit card test

                          14 |

                          15 |
                          16 |

                          17 |
                            18 |
                            19 |
                            20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/ui/layer/test/card.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("ui-card"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _p = _('nej.ui'); 8 | 9 | //开始单元测试 10 | test('card',function(){ 11 | stop(); 12 | var _card = _p._$$Card._$allocate({ 13 | parent:'card-box', 14 | top:10, 15 | left:10, 16 | destroyable:true, 17 | content:'
                            请点击一下页面,完成卡片的回收
                            ', 18 | oncontentready:function(_html){ 19 | ok(true,'设置卡片内容成功'); 20 | }, 21 | onbeforerecycle:function(){ 22 | ok(true,'destroyable属性决定回收前是否触发'); 23 | start(); 24 | } 25 | }); 26 | }); 27 | } 28 | module('依赖模块'); 29 | test('define',function(){expect(0); 30 | define('{pro}card.test.js',['ui/layer/card'],f); 31 | }); -------------------------------------------------------------------------------- /src/ui/layer/test/layer.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | layer测试页 6 | 7 | 8 | 9 | 10 |

                            Qunit layer test

                            11 |

                            12 |
                            13 |

                            14 |
                              15 |
                              16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/ui/layer/test/layer.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("layer"); 4 | var _ = NEJ.P, 5 | _e = _('nej.e'), 6 | _p = _('nej.ui'); 7 | 8 | //开始单元测试 9 | test('layer',function(){ 10 | stop(); 11 | var _ly = _p._$$MyLayerCard._$allocate({ 12 | parent:document.body, 13 | destroyable:false, 14 | oncontentready:function(_html){ 15 | ok(true,'设置卡片内容成功'); 16 | start(); 17 | } 18 | }); 19 | }); 20 | } 21 | module('依赖模块'); 22 | test('define',function(){expect(0); 23 | define('{pro}layer.test.js',['{pro}mylayercard.js'],f); 24 | }); -------------------------------------------------------------------------------- /src/ui/layer/test/mylayercard.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | var _ = NEJ.P, 3 | _f = NEJ.F, 4 | _u = _('nej.u'), 5 | _e = _('nej.e'), 6 | _p = _('nej.ui'), 7 | _proMyLayerCard; 8 | var _seed_html = _e._$addNodeTemplate('
                              您要展示的内容部分
                              '); 9 | /** 10 | * 弹出层封装基类对象,主要实现层里面内容部分的业务逻辑 11 | * @class 弹出层封装基类对象 12 | * @extends {nej.ui._$$CardWrapper} 13 | * @param {Object} _options 可选配置参数 14 | * 15 | */ 16 | _p._$$MyLayerCard = NEJ.C(); 17 | _proMyLayerCard = _p._$$MyLayerCard._$extend(_p._$$MyCardWrapper); 18 | 19 | _proMyLayerCard.__initXGui = function(){ 20 | this.__seed_html = _seed_html; 21 | }; 22 | }; 23 | define('{pro}mylayercard.js', 24 | ['{pro}mylayerwrapper.js'],f); -------------------------------------------------------------------------------- /src/ui/layer/test/mywindow.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | var _ = NEJ.P, 3 | _f = NEJ.F, 4 | _u = _('nej.u'), 5 | _e = _('nej.e'), 6 | _p = _('nej.ui'), 7 | _proMyWindow; 8 | var _seed_html = _e._$addNodeTemplate('
                              您要展示的内容部分
                              '); 9 | /** 10 | * 弹出层封装基类对象,主要实现层里面内容部分的业务逻辑 11 | * @class 弹出层封装基类对象 12 | * @extends {nej.ui._$$CardWrapper} 13 | * @param {Object} _options 可选配置参数 14 | * 15 | */ 16 | _p._$$MyWindow = NEJ.C(); 17 | _proMyWindow = _p._$$MyWindow._$extend(_p._$$WindowWrapper); 18 | 19 | _proMyWindow.__initXGui = function(){ 20 | this.__seed_html = _seed_html; 21 | }; 22 | 23 | _proMyWindow.__reset = function(_options){ 24 | _options = _options || {}; 25 | _options.draggable = !!_options.draggable ? true : false; 26 | _options.destroyable = !!_options.destroyable ? true : false; 27 | this.__super(_options); 28 | }; 29 | }; 30 | define('{pro}mywindow.js', 31 | ['ui/layer/window.wrapper'],f); -------------------------------------------------------------------------------- /src/ui/layer/test/window.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | window测试页 6 | 7 | 8 | 12 | 13 | 14 |

                              Qunit window test

                              15 |

                              16 |
                              17 |

                              18 |
                                19 |
                                20 |
                                21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/ui/layer/test/window.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("ui-window"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _p = _('nej.ui'); 8 | 9 | //开始单元测试 10 | test('window',function(){ 11 | stop(); 12 | var _window = _p._$$Window._$allocate({ 13 | parent:document.body, 14 | title:'弹出框标题', 15 | align:'left middle', 16 | draggable:true, 17 | onclose:function(){ 18 | ok(true,'成功关闭窗口'); 19 | start(); 20 | } 21 | }); 22 | _window._$show(); 23 | }); 24 | } 25 | module('依赖模块'); 26 | test('define',function(){expect(0); 27 | define('{pro}window.test.js',['ui/layer/window'],f); 28 | }); -------------------------------------------------------------------------------- /src/ui/layer/test/window.wrapper.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | windowWarpper测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                Qunit windowWarpper test

                                14 |

                                15 |
                                16 |

                                17 |
                                  18 |
                                  19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/ui/layer/test/window.wrapper.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("ui-windowWarpper"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _p = _('nej.ui'), 8 | _v = _('nej.v'); 9 | 10 | //开始单元测试 11 | test('windowWarpper',function(){ 12 | stop(); 13 | var _myCard = _p._$$MyWindow._$allocate({ 14 | parent:document.body, 15 | title:'窗口标题', 16 | draggable:false, 17 | mask:true, 18 | onclose:function(){ 19 | ok(true,'成功关闭浮层'); 20 | start(); 21 | } 22 | }); 23 | }); 24 | 25 | // test('windowWarpper-2',function(){ 26 | // stop(); 27 | // var _myCard = _p._$$MyWindow._$allocate({ 28 | // parent:document.body, 29 | // title:'窗口标题2', 30 | // draggable:true, 31 | // mask:true, 32 | // onclose:function(){ 33 | // ok(true,'成功关闭浮层'); 34 | // start(); 35 | // } 36 | // }); 37 | // }); 38 | } 39 | module('依赖模块'); 40 | test('define',function(){expect(0); 41 | define('{pro}window.wrapper.test.js',['{pro}mywindow.js'],f); 42 | }); -------------------------------------------------------------------------------- /src/ui/layer/window.css: -------------------------------------------------------------------------------- 1 | .#{position:absolute;z-index:1000;border:1px solid #aaa;background:#fff;} 2 | .# .zbar{line-height:30px;background:#8098E7;border-bottom:1px solid #aaa;} 3 | .# .zcnt{padding:10px 5px;} 4 | .# .zttl{margin-right:20px;text-align:left;} 5 | .# .zcls{position:absolute;top:5px;right:0;width:20px;height:20px;line-height:20px;cursor:pointer;} 6 | -------------------------------------------------------------------------------- /src/ui/layer/window.html: -------------------------------------------------------------------------------- 1 |
                                  2 |
                                  标题
                                  3 |
                                  4 | × 5 |
                                  -------------------------------------------------------------------------------- /src/ui/layer/window.wrapper.js: -------------------------------------------------------------------------------- 1 | // link to ui/layer/wrapper/window for compatible 2 | // use ui/layer/wrapper/window for new project 3 | NEJ.define(['./wrapper/window.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/lightbox/lightbox.css: -------------------------------------------------------------------------------- 1 | .#-mask{position:fixed;_position:absolute;z-index:5000;top:0;bottom:0;left:0;right:0;width:100%;height:100%;background:#aaa;} 2 | .#{position:fixed;_position:absolute;z-index:5001;background:#fff;text-align:center;$transition-duration:300ms;} 3 | .# .zbtn{position:absolute;cursor:pointer;width:24px;height:24px;line-height:24px;border:2px solid #fff;background:#333;color:#fff;$border-radius:50%;font-weight:bold;} 4 | .# .zcls{top:-12px;right:-12px;} 5 | .# .zbtn{opacity:0;*filter:alpha(opacity=0);$transition-duration:300ms;$transition-property:opacity;} 6 | .# .zprv{left:5px;} 7 | .# .znxt{right:5px;} 8 | .# .ztrp{position:absolute;left:0;right:0;bottom:0;width:100%;} 9 | .# .zshw{display:block;width:100%;height:100%;} 10 | .#:hover .zbtn{opacity:1;*filter:alpha(opacity=100);} 11 | .# .js-disabled,.#.js-loading .zbpt{visibility:hidden;} 12 | -------------------------------------------------------------------------------- /src/ui/lightbox/lightbox.html: -------------------------------------------------------------------------------- 1 |
                                  2 | × 3 | < 4 | > 5 | 6 |
                                  7 |
                                  8 |
                                  9 |
                                  -------------------------------------------------------------------------------- /src/ui/mask/mask.css: -------------------------------------------------------------------------------- 1 | .#{position:fixed;_position:absolute;z-index:100;top:0;bottom:0;left:0;right:0;width:100%;height:100%;background-image:url(#);} -------------------------------------------------------------------------------- /src/ui/mask/test/mask.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mask测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                  Qunit mask test

                                  14 |

                                  15 |
                                  16 |

                                  17 |
                                    18 |
                                    19 |
                                    20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/ui/mask/test/mask.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("ui-mask"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _p = _('nej.ui'); 8 | 9 | //开始单元测试 10 | test('mask',function(){ 11 | expect(0); 12 | var _mask = _p._$$Mask._$allocate({ 13 | parent:document.body, 14 | content:'
                                    搞一点盖层的内容
                                    ' 15 | }); 16 | _mask._$hide(); 17 | _mask._$show(); 18 | }); 19 | } 20 | module('依赖模块'); 21 | test('define',function(){expect(0); 22 | define('{pro}mask.test.js',['ui/mask/mask'],f); 23 | }); -------------------------------------------------------------------------------- /src/ui/pager/base.css: -------------------------------------------------------------------------------- 1 | .#{font-size:12px;line-height:160%;} 2 | .# a{margin:0 2px;padding:2px 8px;color:#333;border:1px solid #aaa;text-decoration:none;} 3 | .# .js-disabled{cursor:default;} 4 | .# .js-selected{cursor:default;background-color:#bbb;} -------------------------------------------------------------------------------- /src/ui/pager/demo/pager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo for pager 5 | 6 | 9 | 16 | 17 | 18 | 19 | 33 | 34 | -------------------------------------------------------------------------------- /src/ui/pager/pager.base.js: -------------------------------------------------------------------------------- 1 | // link to ui/pager/base for compatible 2 | // use ui/pager/base for new project 3 | NEJ.define(['./base.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/pager/pager.simple.js: -------------------------------------------------------------------------------- 1 | // link to ui/pager/simple for compatible 2 | // use ui/pager/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/portrait/complex.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /src/ui/portrait/demo/complex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test complex portrait 5 | 6 | 13 | 14 | 15 | 20 | 21 | 32 | 33 | -------------------------------------------------------------------------------- /src/ui/portrait/demo/simple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test simple portrait 5 | 6 | 13 | 14 | 15 | 20 | 21 | 32 | 33 | -------------------------------------------------------------------------------- /src/ui/portrait/portrait.complex.js: -------------------------------------------------------------------------------- 1 | // link to ui/portrait/complex for compatible 2 | // use ui/portrait/complex for new project 3 | NEJ.define(['./complex.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/portrait/portrait.css: -------------------------------------------------------------------------------- 1 | .#{width:310px;padding:5px;background:#e5e5e1;border:1px solid #888;} 2 | .# .zlst{position:relative;height:190px;} 3 | .# .zlst .zitm{display:block;float:left;margin:-1px 0 0 -1px;text-indent:200px;overflow:hidden;border:1px solid #e5e5e1;cursor:pointer;background:no-repeat;} 4 | .# .zlst .zitm:hover{position:relative;border-color:#000;zoom:1;} 5 | .# .zlst .z30{width:30px;height:30px;line-height:30px;} 6 | .# .zlst .z60{width:61px;height:60px;line-height:60px;} 7 | # 8 | .# .zpbx{padding:5px 0 1px;text-align:right;} 9 | .# .zpager .zbtn,.# .zpager .zpgi{border:0;margin:0;} 10 | .# .zpager .zpgi{display:none;} 11 | .# .zpager .js-disabled{color:#777;} 12 | .# .js-prev{position:absolute;top:0;left:0;background:#fff no-repeat center center;border:1px solid #888;} 13 | .# .js-prev-30{width:60px;height:60px;} 14 | .# .js-prev-30 img{display:none;} -------------------------------------------------------------------------------- /src/ui/portrait/portrait.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /src/ui/portrait/portrait.simple.js: -------------------------------------------------------------------------------- 1 | // link to ui/portrait/simple for compatible 2 | // use ui/portrait/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/range/range.css: -------------------------------------------------------------------------------- 1 | .#{position:absolute;top:0;left:0;width:0;height:0;overflow:hidden;border:1px solid #0C32F6;background:#B8D4F0;_filter:alpha(opacity=70);opacity:0.7;} -------------------------------------------------------------------------------- /src/ui/resizer/demo/resizer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | resizer demo 5 | 6 | 9 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | -------------------------------------------------------------------------------- /src/ui/resizer/resizer.css: -------------------------------------------------------------------------------- 1 | .#-parent{position:relative;} 2 | .#{position:absolute;top:0;left:0;border:1px solid #aaa;cursor:move;$:none;z-index:1000;} 3 | .# .zln{width:48px;height:48px;border:1px solid #fff;background:url(#);} 4 | .# .zpc{border:1px solid #aaa;} 5 | .# .zpt{position:absolute;width:5px;height:5px;font-size:1px;overflow:hidden;} 6 | .# .znt{top:-1px;left:-1px;width:100%;cursor:n-resize;} 7 | .# .znr{top:-1px;right:-1px;height:100%;cursor:e-resize;} 8 | .# .znb{bottom:-1px;left:-1px;width:100%;cursor:s-resize;} 9 | .# .znl{top:-1px;left:-1px;height:100%;cursor:w-resize;} 10 | .# .zntl{top:-1px;left:-1px;cursor:nw-resize;} 11 | .# .zntr{top:-1px;right:-1px;cursor:ne-resize;} 12 | .# .znbr{bottom:-1px;right:-1px;cursor:se-resize;} 13 | .# .znbl{bottom:-1px;left:-1px;cursor:sw-resize;} -------------------------------------------------------------------------------- /src/ui/resizer/resizer.html: -------------------------------------------------------------------------------- 1 |
                                    2 |
                                    3 | {list clazz as x} 4 |
                                     
                                    5 | {/list} 6 |
                                    7 |
                                    8 | -------------------------------------------------------------------------------- /src/ui/scroller.list/scroller.list.js: -------------------------------------------------------------------------------- 1 | // link to ui/scroller/list for compatible 2 | // use ui/scroller/list for new project 3 | NEJ.define(['ui/scroller/list'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/scroller.list/test/scroller.list.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | scrollList测试页 6 | 7 | 8 | 12 | 13 | 14 |

                                    Qunit scrollList test

                                    15 |

                                    16 |
                                    17 |

                                    18 |
                                      19 |
                                      20 |
                                      21 |
                                      22 |
                                      23 |
                                      24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/ui/scroller/demo/y.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test scroll y 5 | 6 | 10 | 11 | 12 |
                                      13 |

                                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

                                      14 |

                                      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

                                      15 |

                                      cccccccccccccccccccccccccccccccccc

                                      16 |

                                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

                                      17 |

                                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

                                      18 |

                                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

                                      19 |

                                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

                                      20 |
                                      21 | 22 | 31 | 32 | -------------------------------------------------------------------------------- /src/ui/scroller/list.css: -------------------------------------------------------------------------------- 1 | .#{position:relative;} -------------------------------------------------------------------------------- /src/ui/scroller/scroller.x.js: -------------------------------------------------------------------------------- 1 | // link to ui/scroller/x for compatible 2 | // use ui/scroller/x for new project 3 | NEJ.define(['./x.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/scroller/scroller.y.js: -------------------------------------------------------------------------------- 1 | // link to ui/scroller/y for compatible 2 | // use ui/scroller/y for new project 3 | NEJ.define(['./y.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/ui/scroller/test/scroller.y.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | scrolly测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                      Qunit scrolly test

                                      14 |

                                      15 |
                                      16 |

                                      17 |
                                        18 |
                                        19 |
                                        20 |
                                        21 | 123 22 |
                                        23 |
                                        24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/ui/scroller/test/scroller.y.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("scrolly"); 4 | 5 | var _ = NEJ.P, 6 | _p = _('nej.ui'); 7 | 8 | //开始单元测试 9 | test('scrolly',function(){ 10 | expect(0); 11 | var _sly = _p._$$ScrollerY._$allocate({ 12 | parent:'scroll-y-container', 13 | onscroll:function(){ 14 | 15 | }, 16 | onscrollend:function(){ 17 | 18 | }, 19 | onbounce:function(_event){ 20 | 21 | }, 22 | onbouncend:function(_event){ 23 | 24 | }, 25 | onbouncestart:function(_event){ 26 | 27 | }, 28 | onrelease:function(){ 29 | 30 | } 31 | }); 32 | }); 33 | } 34 | module('依赖模块'); 35 | test('define',function(){expect(0); 36 | define('{pro}scroller.y.test.js',['ui/scroller/scroller.y'],f); 37 | }); -------------------------------------------------------------------------------- /src/ui/scroller/x.css: -------------------------------------------------------------------------------- 1 | .#{position:absolute;z-index:10;$-origin:0 0;$-property:opacity;$-duration:250ms;background-color:rgba(0,0,0,0.6);$:4px;border:1px solid rgba(255,255,255,0.2);opacity:0;overflow:hidden;} 2 | .#-view{position:relative;z-index:5;$:$;} 3 | .#{bottom:1px;left:0;height:4px;} -------------------------------------------------------------------------------- /src/ui/scroller/y.css: -------------------------------------------------------------------------------- 1 | .#{position:absolute;z-index:10;$-origin:0 0;$-property:opacity;$-duration:250ms;background-color:rgba(0,0,0,0.6);$:4px;border:1px solid rgba(255,255,255,0.2);opacity:0;overflow:hidden;} 2 | .#-view{position:relative;z-index:5;$:$;} 3 | .#{top:0;right:1px;width:6px;} -------------------------------------------------------------------------------- /src/ui/suggest/demo/suggest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test suggest 5 | 6 | 10 | 11 | 12 | 13 |
                                        14 | 15 | 16 | 34 | 35 | -------------------------------------------------------------------------------- /src/ui/suggest/suggest.css: -------------------------------------------------------------------------------- 1 | .#-parent{position:relative;} 2 | .#{position:absolute;border:1px solid #aaa;background:#fff;text-align:left;visibility:hidden;} 3 | .# .zitm{height:20px;line-height:20px;cursor:default;} 4 | .# .js-selected{background:#1257F9;} -------------------------------------------------------------------------------- /src/ui/suggest/suggest.html: -------------------------------------------------------------------------------- 1 | {if defined("xlist")&&!!xlist.length} 2 | {list xlist as x}
                                        ${x}
                                        {/list} 3 | {/if} -------------------------------------------------------------------------------- /src/ui/suggest/test/suggest.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | suggest测试页 6 | 7 | 8 | 9 | 10 |

                                        nej suggest.js test

                                        11 |

                                        12 |
                                        13 |

                                        14 |
                                          15 |
                                          16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/ui/suggest/test/suggest.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("suggest",{ 4 | setup:function(){ 5 | this._e = nej.e; 6 | this._ui = nej.ui; 7 | } 8 | }); 9 | 10 | //开始单元测试 11 | test('生成一个suggest', function() { 12 | expect(0); 13 | var _input = this._e._$get('suggest-input'); 14 | var _onchage = function(_value){ 15 | _suggest._$setList(['0','1','2','3','4','5','6','7','8','9']); 16 | }; 17 | var _onselect = function(_value,_options){ 18 | console.log(_options.type); 19 | }; 20 | var _suggest = this._ui._$$Suggest._$allocate({ 21 | input:_input, 22 | onchange:_onchage._$bind(this), 23 | onselect:_onselect._$bind(this) 24 | }); 25 | 26 | }); 27 | } 28 | module('依赖模块'); 29 | test('define',function(){expect(0); 30 | define('{pro}suggest.test.js', 31 | ['ui/suggest/suggest','base/element'],f); 32 | }); 33 | -------------------------------------------------------------------------------- /src/ui/timepick/demo/timepick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | demo for colorpick 5 | 6 | 13 | 14 | 15 | 16 | 31 | 32 | -------------------------------------------------------------------------------- /src/util/ajax/demo/a.html: -------------------------------------------------------------------------------- 1 |
                                          2 |

                                          aaaaaaaaaaa

                                          3 |
                                          -------------------------------------------------------------------------------- /src/util/ajax/demo/a.js: -------------------------------------------------------------------------------- 1 | console.log('111111111111'); -------------------------------------------------------------------------------- /src/util/ajax/demo/b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
                                          -------------------------------------------------------------------------------- /src/util/ajax/demo/b.json: -------------------------------------------------------------------------------- 1 | { 2 | "a":"aaaaa" 3 | } -------------------------------------------------------------------------------- /src/util/ajax/demo/rest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test rest 5 | 6 | 13 | 14 | 15 | 16 | 17 | 46 | 47 | -------------------------------------------------------------------------------- /src/util/ajax/demo/upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test file upload 5 | 6 | 7 | 8 | 9 | 10 | 23 | 24 | -------------------------------------------------------------------------------- /src/util/ajax/demo/xdr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test xdr 5 | 6 | 7 | 8 | 9 | 10 | 37 | 38 | -------------------------------------------------------------------------------- /src/util/ajax/loader/platform/html.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/element' 10 | ],function(_e,_p,_o,_f,_r){ 11 | /** 12 | * 删除IFrame节点,保留历史 13 | * @param {Node} iframe节点 14 | * @return {Void} 15 | */ 16 | _p.__removeIFrameKeepHistory = function(_iframe){ 17 | _e._$remove(_iframe); 18 | }; 19 | 20 | return _p; 21 | }); 22 | -------------------------------------------------------------------------------- /src/util/ajax/loader/platform/html.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './html.js', 10 | 'base/element', 11 | 'base/platform' 12 | ],function(_h,_e,_m,_p,_o,_f,_r){ 13 | // for ie6- 14 | NEJ.patch('TR<=2.0',function(){ 15 | /** 16 | * 删除IFrame节点,保留历史 17 | * @param {Node} iframe节点 18 | * @return {Void} 19 | */ 20 | _h.__removeIFrameKeepHistory = function(_iframe){ 21 | _e._$setStyle(_iframe,'display','none'); 22 | try{_iframe.contentWindow.document.body.innerHTML = ' ';}catch(ex){} 23 | }; 24 | }); 25 | 26 | return _h; 27 | }); 28 | -------------------------------------------------------------------------------- /src/util/ajax/loader/test/loader.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | load测试页 6 | 7 | 8 | 9 | 10 |

                                          Qunit load test

                                          11 |

                                          12 |
                                          13 |

                                          14 |
                                            15 |
                                            16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/ajax/platform/xdr.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | '../proxy/xhr.js', 10 | '../proxy/flash.js', 11 | '../proxy/frame.js', 12 | '../proxy/upload.js' 13 | ],function(_t0,_t1,_t2,_t3,_p,_o,_f,_r){ 14 | /** 15 | * 根据模式返回代理实例,模式说明 16 | * 0 - 自动模式,高版本使用HTML5的CORS协议,低版本采用Frame代理方式 17 | * 1 - 高版本使用HTML5的CORS协议,普通请求低版本采用Flash代理方式 18 | * 2 - 全部使用Frame代理方式 19 | * 3 - 全部使用Flash代理方式 20 | * @param {Number} 模式 21 | * @param {Boolean} 是否文件上传 22 | * @param {Object} 构造配置参数 23 | * @return {_$$ProxyAbstract} 代理实例 24 | */ 25 | _p.__getProxyByMode = function(_mode,_upload,_options){ 26 | var _map = !!_upload 27 | ? {2:_t3._$$ProxyUpload} 28 | : {2:_t2._$$ProxyFrame,3:_t1._$$ProxyFlash}; 29 | return (_map[_mode]||_t0._$$ProxyXHR)._$allocate(_options); 30 | }; 31 | 32 | return _p; 33 | }); 34 | -------------------------------------------------------------------------------- /src/util/ajax/platform/xdr.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './xdr.js' 10 | ],function(_h,_p,_o,_f,_r){ 11 | // for ie9- 12 | NEJ.patch('TR<=5.0',function(){ 13 | /** 14 | * 根据模式返回代理实例,模式说明 15 | * 0 - 自动模式,高版本使用HTML5的CORS协议,低版本采用Frame代理方式 16 | * 1 - 高版本使用HTML5的CORS协议,普通请求低版本采用Flash代理方式 17 | * 2 - 全部使用Frame代理方式 18 | * 3 - 全部使用Flash代理方式 19 | * @param {Number} 模式 20 | * @param {Boolean} 是否文件上传 21 | * @param {Object} 构造配置参数 22 | * @return {_$$ProxyAbstract} 代理实例 23 | */ 24 | _h.__getProxyByMode = (function(){ 25 | var _pmap = {0:2,1:3}; 26 | return _h.__getProxyByMode._$aop(function(_event){ 27 | var _args = _event.args, 28 | _mode = _args[0]||0; 29 | _args[0] = !!_args[1] ? 2 : 30 | _pmap[_mode]||_mode; 31 | }); 32 | })(); 33 | }); 34 | 35 | return _h; 36 | }); 37 | -------------------------------------------------------------------------------- /src/util/ajax/proxy/platform/xhr.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define(function(_p,_o,_f,_r){ 9 | /** 10 | * 取XHR对象 11 | * @return {XMLHttpRequest} XHR对象 12 | */ 13 | _p.__getXMLHttpRequest = function(){ 14 | return new XMLHttpRequest(); 15 | }; 16 | /** 17 | * 判断是否有Abort事件 18 | * @return {Boolean} 19 | */ 20 | _p.__hasAbortEvent = function(){ 21 | return !0; 22 | }; 23 | return _p; 24 | }); 25 | -------------------------------------------------------------------------------- /src/util/ajax/test/a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | message test 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/util/ajax/test/a.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['{lib}base/event.js','{lib}util/ajax/message.js'],function(_v,_j){ 2 | _v._$addEvent('openIframe','click',function(){ 3 | var _iframe = document.createElement('iframe'); 4 | _iframe.src = 'http://b.c.com:8000/util/ajax/test/b.html'; 5 | _iframe.id = "loginFrame"; 6 | document.body.appendChild(_iframe); 7 | _iframe.style.width = '200px'; 8 | _iframe.style.height = '400px'; 9 | _iframe.style.position = 'absolute'; 10 | _iframe.style.border = '1px solid #ccc'; 11 | _iframe.style.zIndex = '9999'; 12 | _iframe.style.top = '100px'; 13 | _iframe.style.left = '50%'; 14 | _iframe.style.marginLeft = '-100px'; 15 | }); 16 | 17 | _v._$addEvent(window,'message',function(_event){ 18 | alert(_event.data); 19 | }) 20 | }); 21 | -------------------------------------------------------------------------------- /src/util/ajax/test/b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | message test 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/util/ajax/test/b.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['lib/base/event','{lib}util/ajax/message.js'],function(_v,_j){ 2 | _v._$addEvent('sendMsg','click',function(_event){ 3 | _j._$postMessage('_top',{data:'{"name":"nihao"}'}); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /src/util/ajax/test/message.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | message测试页 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/util/ajax/test/message.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | var _ = NEJ.P, 3 | _v = _('nej.v'), 4 | _j = _('nej.j'); 5 | _v._$addEvent(window,'message',function(_event){ 6 | nej.j._$postMessage(_event.source,{ 7 | data:'你好!', 8 | origin:_event.origin 9 | }); 10 | }); 11 | } 12 | NEJ.define('{pro}message.test.js', 13 | ['{lib}util/ajax/message.js'],f); 14 | -------------------------------------------------------------------------------- /src/util/ajax/test/tag.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tag测试页 6 | 7 | 8 | 9 | 10 |

                                            Qunit xdr test

                                            11 |

                                            12 |
                                            13 |

                                            14 |
                                              15 |
                                              16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/ajax/test/x.css: -------------------------------------------------------------------------------- 1 | x.css -------------------------------------------------------------------------------- /src/util/ajax/test/xdr.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | xdr测试页 6 | 7 | 8 | 9 | 10 |

                                              Qunit xdr test

                                              11 |

                                              12 |
                                              13 |

                                              14 |
                                                15 |
                                                16 |
                                                17 | 18 | 19 | 20 | 21 | 22 |
                                                23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/util/ajax/test/xx.css: -------------------------------------------------------------------------------- 1 | xx.css -------------------------------------------------------------------------------- /src/util/ajax/test/xxx.txt: -------------------------------------------------------------------------------- 1 | xxx.txt -------------------------------------------------------------------------------- /src/util/audio/demo/a.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/audio/demo/a.aac -------------------------------------------------------------------------------- /src/util/audio/demo/a.amr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/audio/demo/a.amr -------------------------------------------------------------------------------- /src/util/audio/platform/audio.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | define([ 9 | 'util/media/audio' 10 | ],function(_t,_p,_o,_f,_r){ 11 | /** 12 | * 取音频播放器实例d 13 | * @param {Object} 配置信息 14 | * @return {_$$Media} 音频播放器实例 15 | */ 16 | _p.__getAudioInst = function(_options){ 17 | return _t._$$MediaAudio._$allocate(_options); 18 | }; 19 | 20 | return _p; 21 | }); -------------------------------------------------------------------------------- /src/util/audio/platform/audio.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | define([ 9 | './audio.js' 10 | ],function(_h,_p,_o,_f,_r){ 11 | // for ie8- 12 | NEJ.patch('TR<=4.0',['util/media/flash'],function(_t){ 13 | /** 14 | * 取音频播放器实例d 15 | * @param {Object} 配置信息 16 | * @return {_$$Media} 音频播放器实例 17 | */ 18 | _h.__getAudioInst = function(_options){ 19 | return _t._$$MediaFlash._$allocate(_options); 20 | }; 21 | }); 22 | 23 | return _h; 24 | }); -------------------------------------------------------------------------------- /src/util/audio/test/audio.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | audio测试页 6 | 7 | 8 | 9 | 10 |

                                                Qunit xdr test

                                                11 |

                                                12 |
                                                13 |

                                                14 |
                                                  15 |
                                                  16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/cache/cache.list.base.js: -------------------------------------------------------------------------------- 1 | // link to util/cache/abstract for compatible 2 | // use util/cache/abstract for new project 3 | NEJ.define(['./abstract.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/cache/cache.list.js: -------------------------------------------------------------------------------- 1 | // link to util/cache/list for compatible 2 | // use util/cache/list for new project 3 | NEJ.define(['./list.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/cache/cache.share.js: -------------------------------------------------------------------------------- 1 | // link to util/cache/share for compatible 2 | // use util/cache/share for new project 3 | NEJ.define(['./share.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/cache/demo/cookie.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test cookie 5 | 6 | 13 | 14 | 15 | 16 | 17 | 33 | 34 | -------------------------------------------------------------------------------- /src/util/cache/demo/list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test cookie 5 | 6 | 13 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /src/util/cache/demo/storage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test cookie 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 35 | 36 | -------------------------------------------------------------------------------- /src/util/cache/test/cache.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | cache测试页 6 | 7 | 8 | 9 | 10 |

                                                  Qunit cache test

                                                  11 |

                                                  12 |
                                                  13 |

                                                  14 |
                                                    15 |
                                                    16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/cache/test/cookie.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | cookie测试页 6 | 7 | 8 | 9 | 10 |

                                                    Qunit cookie test

                                                    11 |

                                                    12 |
                                                    13 |

                                                    14 |
                                                      15 |
                                                      16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/cache/test/cookie.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/cache/cookie'],function(_j){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('cookie',function(){ 6 | expect(1); 7 | _j._$cookie('name',{value:'abc'}); 8 | equal(_j._$cookie('name'),'abc','set cookie 成功'); 9 | }); 10 | 11 | test('cookie',function(){ 12 | expect(1); 13 | _j._$cookie('name',''); 14 | _j._$cookie('name',{expires:-1}); 15 | equal(_j._$cookie('name'),'','delete cookie 成功'); 16 | }); 17 | 18 | test('cookie',function(){ 19 | expect(1); 20 | var _cookie = _j._$cookie('name2',{ 21 | value:'abc', 22 | path:'/', 23 | domain:'nei.hz.netease.com', 24 | expires:1 25 | }); 26 | equal(_j._$cookie('name2'),'abc','name2 set cookie 成功'); 27 | }); 28 | }); -------------------------------------------------------------------------------- /src/util/cache/test/storage.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | storage测试页 6 | 7 | 8 | 9 | 10 |

                                                      Qunit storage test

                                                      11 |

                                                      12 |
                                                      13 |

                                                      14 |
                                                        15 |
                                                        16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/cache/test/storage.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/cache/storage','util/encode/json'],function(_t){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('storage',function(){ 6 | expect(1); 7 | _t._$setDataInStorage('a','b'); 8 | equal(_t._$getDataInStorage('a'),'b','storage --set,get成功'); 9 | }); 10 | test('storage',function(){ 11 | expect(1); 12 | equal(_t._$getDataInStorageWithDefault('ccc','ccc'),'ccc','有默认数据') 13 | }); 14 | test('storage',function(){ 15 | expect(1); 16 | _t._$delDataInStorage('a','b'); 17 | equal(_t._$getDataInStorage('a'),undefined,'storage --set,get成功'); 18 | }); 19 | }); -------------------------------------------------------------------------------- /src/util/chain/README.md: -------------------------------------------------------------------------------- 1 | # chainable.js 2 | 类似于jQuery的链式操作模块, 3 | 命名空间 nej.$ 4 | 5 | ## 使用 6 | 7 | ### 1. 引入依赖 8 | 9 | ```javascript 10 | // Push 进了 nej所有节点相关API的 11 | define('xxx模块', ['{lib}util/chain/chainable.js'], f)` 12 | 13 | // 如果你不习惯使用链式使用nej的原API,但是又有对新API的需求, 你可以只引入NodeList.js 14 | define('xxx模块', ['{lib}util/chain/NodeList.js'], f); 15 | 16 | ``` 17 | 18 | 19 | ### 2. 使用 20 | 21 | ``` 22 | 23 | 24 | 25 | 26 | ## API介绍 27 | 28 | ### 1. 原有API支持列表(通过) 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/util/chain/chainable.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 利用NEJ原有API包装成链式调用风格API, * @version 0.1 4 | * @author hzzhenghaibo 5 | * ------------------------------------------ 6 | */ 7 | NEJ.define([ 8 | './NodeList.js' 9 | ],function(_l){ 10 | return _l; 11 | }); 12 | -------------------------------------------------------------------------------- /src/util/chain/test/playjs.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": "/E/code/playjs" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /src/util/clipboard/demo/clipboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test clipboard 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 22 | 23 | -------------------------------------------------------------------------------- /src/util/clipboard/test/clipboard.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | clipboard测试页 6 | 7 | 8 | 9 | 10 |

                                                        Qunit xdr test

                                                        11 |

                                                        12 |
                                                        13 |

                                                        14 |
                                                          15 |
                                                          16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/clipboard/test/clipboard.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/clipboard/clipboard'],function(){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('clipboard',function(){ 6 | expect(0); 7 | _e._$bindCopyAction('copyBtn','text to clipboard'); 8 | }); 9 | }); -------------------------------------------------------------------------------- /src/util/clipper/demo/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/clipper/demo/1.jpg -------------------------------------------------------------------------------- /src/util/counter/demo/counter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - 计数器 5 | 6 | 7 | 8 |

                                                          9 |

                                                          10 | 11 | 12 | 20 | 21 | -------------------------------------------------------------------------------- /src/util/counter/platform/counter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/platform' 10 | ],function(_p){ 11 | /** 12 | * 取字符串长度 13 | * @param {String} 字符串 14 | * @return {Number} 字符串长度 15 | */ 16 | _p.__length = (function(){ 17 | var _reg = /(\r\n|\r|\n)/g; 18 | return function(_content){ 19 | return (_content||'').replace(_reg,'**').length; 20 | }; 21 | })(); 22 | 23 | return _p; 24 | }); -------------------------------------------------------------------------------- /src/util/counter/platform/counter.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './counter.js' 10 | ],function(_h){ 11 | // for ie 12 | NEJ.patch('TR',function(){ 13 | /** 14 | * 取字符串长度 15 | * @param {String} 字符串 16 | * @return {Number} 字符串长度 17 | */ 18 | _h.__length = function(){ 19 | return (_event.args[0]||'').length; 20 | }; 21 | }); 22 | 23 | return _h; 24 | }); -------------------------------------------------------------------------------- /src/util/counter/test/counter.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | counter测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                                          Qunit xdr test

                                                          14 |

                                                          15 |
                                                          16 |

                                                          17 |
                                                            18 |
                                                            19 |
                                                            20 |
                                                            21 |
                                                            22 |
                                                            23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/util/counter/test/counter.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/counter/counter'],function(){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('counter',function(){ 6 | expect(0); 7 | _e._$counter('input-id-0',{ 8 | onchange:function(_event){ 9 | // 自定义提示内容 10 | _event.value = '还可输入input'+_event.delta+'字'; 11 | } 12 | }); 13 | _e._$counter('input-id-1',{ 14 | onchange:function(_event){ 15 | // 自定义提示内容 16 | _event.value = '还可输入input'+_event.delta+'字'; 17 | } 18 | }); 19 | 20 | _e._$counter('textarea-id-0',{ 21 | onchange:function(_event){ 22 | // 自定义提示内容 23 | _event.value = '还可输入textarea'+_event.delta+'字'; 24 | } 25 | }); 26 | 27 | _e._$counter('textarea-id-1',{ 28 | onchange:function(_event){ 29 | // 自定义提示内容 30 | _event.value = '还可输入textarea'+_event.delta+'字'; 31 | } 32 | }); 33 | }); 34 | }); -------------------------------------------------------------------------------- /src/util/cycler/test/cycler.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | cycler测试页 6 | 7 | 8 | 9 | 10 |

                                                            Qunit cycler test

                                                            11 |

                                                            12 |
                                                            13 |

                                                            14 |
                                                              15 |
                                                              16 |
                                                              17 |
                                                              18 | 123 19 |
                                                              20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/util/cycler/test/cycler.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("cycler"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _v = _('nej.v'), 8 | _p = _('nej.ut'); 9 | 10 | test('cycler test',function(){ 11 | // stop(); 12 | expect(0); 13 | _p._$$Cycler._$allocate( 14 | { 15 | list:['http://t1.gstatic.com/images?q=tbn:ANd9GcQrxfh6Z30dfii0p6XxH6wwuZ42dYTagoI24tybY2STiEpSPXvRzA', 16 | 'http://t1.gstatic.com/images?q=tbn:ANd9GcQrxfh6Z30dfii0p6XxH6wwuZ42dYTagoI24tybY2STiEpSPXvRzA', 17 | 'http://t1.gstatic.com/images?q=tbn:ANd9GcQrxfh6Z30dfii0p6XxH6wwuZ42dYTagoI24tybY2STiEpSPXvRzA'], 18 | nbox:'nbox', 19 | pbox:'pbox', 20 | event:'click', 21 | interval:5, 22 | onchange:function(_index){ 23 | // ok(true,'切换到'+_index+'页'); 24 | // start(); 25 | } 26 | }); 27 | }); 28 | //开始单元测试 29 | } 30 | module('依赖模块'); 31 | test('define',function(){expect(0); 32 | define('{pro}cycler.test.js', 33 | ['{lib}util/cycler/cycler.js'],f); 34 | }); 35 | -------------------------------------------------------------------------------- /src/util/dispatcher/dispatcher.2.js: -------------------------------------------------------------------------------- 1 | // link to util/dispatcher/dispatcher for compatible 2 | // use util/dispatcher/dispatcher for new project 3 | NEJ.define(['./dispatcher.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/dispatcher/module.base.js: -------------------------------------------------------------------------------- 1 | // link to util/dispatcher/module for compatible 2 | // use util/dispatcher/module for new project 3 | NEJ.define(['./module.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/dispatcher/platform/dispatcher.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/platform' 10 | ],function(_m,_p,_o,_f,_r){ 11 | /** 12 | * 修正标题 13 | * @param {String} 上次标题 14 | * @return {String} 修正后的标题 15 | */ 16 | _p.__doFixTitle = (function(){ 17 | var _reg = /#.*?$/i; 18 | return function(_title){ 19 | var _odttl = document.title, 20 | _nwttl = _odttl.replace(_reg,''); 21 | if (_odttl!=_nwttl){ 22 | _title = _nwttl||_title; 23 | document.title = _title; 24 | } 25 | return document.title; 26 | }; 27 | })(); 28 | /** 29 | * 修正标题被Hash污染问题 30 | * @param {String} 原始标题 31 | * @return {Void} 32 | */ 33 | _p.__doFixHashTitle = function(_title){ 34 | // TODO 35 | }; 36 | 37 | return _p; 38 | }); 39 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/c/c1.js: -------------------------------------------------------------------------------- 1 | /* 2 | * -------------------------------------------- 3 | * 专辑-专辑详情模块实现文件 4 | * @version 1.0 5 | * @author cheng-lin(cheng-lin@corp.netease.com) 6 | * -------------------------------------------- 7 | */ 8 | define(['{lib}util/dispatcher/module.base.js'], 9 | function(){ 10 | // variable 11 | var _ = NEJ.P, 12 | _e = _('nej.e'), 13 | _pm = _('nej.ut'), 14 | _pp = _('t.y'), 15 | _pro; 16 | /** 17 | * 专辑详情模块对象 18 | * @class {nm.m.y._$$MAlbumComment} 19 | * @extends {nm.m._$$Module} 20 | * @property {String} 21 | */ 22 | _pp._$$ModuleC1 = NEJ.C(); 23 | _pro = _pp._$$ModuleC1._$extend(_pm._$$AbstractModule); 24 | 25 | _pro.__doBuild = function(){ 26 | this.__namespace = 'm-c1'; 27 | this.__supDoBuild(); 28 | var _html = _e._$getTextTemplate( 29 | this.__namespace+'-module'); 30 | if (!!_html){ 31 | this.__body = _e._$html2node(_html); 32 | } 33 | }; 34 | 35 | dispatcher._$loaded('/?/c1',_pp._$$ModuleC1); 36 | }); -------------------------------------------------------------------------------- /src/util/dispatcher/test/c/c2.js: -------------------------------------------------------------------------------- 1 | /* 2 | * -------------------------------------------- 3 | * 专辑-专辑详情模块实现文件 4 | * @version 1.0 5 | * @author cheng-lin(cheng-lin@corp.netease.com) 6 | * -------------------------------------------- 7 | */ 8 | define(['{lib}util/dispatcher/module.base.js'], 9 | function(){ 10 | // variable 11 | var _ = NEJ.P, 12 | _e = _('nej.e'), 13 | _pm = _('nej.ut'), 14 | _pp = _('t.y'), 15 | _pro; 16 | /** 17 | * 专辑详情模块对象 18 | * @class {nm.m.y._$$MAlbumComment} 19 | * @extends {nm.m._$$Module} 20 | * @property {String} 21 | */ 22 | _pp._$$ModuleC2 = NEJ.C(); 23 | _pro = _pp._$$ModuleC2._$extend(_pm._$$AbstractModule); 24 | 25 | _pro.__doBuild = function(){ 26 | this.__namespace = 'm-c2'; 27 | this.__supDoBuild(); 28 | var _html = _e._$getTextTemplate( 29 | this.__namespace+'-module'); 30 | if (!!_html){ 31 | this.__body = _e._$html2node(_html); 32 | } 33 | }; 34 | 35 | dispatcher._$loaded('/?/c2',_pp._$$ModuleC2); 36 | }); -------------------------------------------------------------------------------- /src/util/dispatcher/test/c/index.css: -------------------------------------------------------------------------------- 1 | index.css -------------------------------------------------------------------------------- /src/util/dispatcher/test/dispatcher.2.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | dispatcher2测试页 6 | 7 | 8 | 9 | 10 |

                                                              Qunit dispatcher2 test

                                                              11 |

                                                              12 |
                                                              13 |

                                                              14 |
                                                                15 |
                                                                16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/dispatcher.2.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("dispatcher2"); 4 | var _ = NEJ.P, 5 | _p = _('nej.ut'), 6 | _j = _('nej.j'); 7 | 8 | test('dispatcher2 single function',function(){ 9 | stop(); 10 | var _dispatcher = _p._$$Dispatcher._$allocate(); 11 | // _dispatcher._$rule([ 12 | // {'/m/a':'/m/','/m/c':'/m/d'}, // <---- 此处两条规则匹配与顺序无关 13 | // {'/m/b':/^\/m\/b.*$/i}, 14 | // {'404':'/m/a'} // <---- 模块不存在时定向到/m/a模块 15 | // ]); 16 | _dispatcher._$rule('title',{ 17 | '/m/root/':'root', 18 | '/m/root/a':'a', 19 | '/m/root/b':'b', 20 | '/m/root/c':'c', 21 | '/m/root/c/?/c1':'c1', 22 | '/m/root/c/?/c2':'c2', 23 | '/m/root/c/?/c3':'c3' 24 | }); 25 | _dispatcher._$rule('rewrite',{ 26 | 27 | }); 28 | }); 29 | } 30 | module('依赖模块'); 31 | test('define',function(){expect(0); 32 | define('{pro}dispatcher.2.test.js', 33 | ['{lib}util/dispatcher/dispatcher.2.js'],f); 34 | }); 35 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/m/a.html: -------------------------------------------------------------------------------- 1 | a.html -------------------------------------------------------------------------------- /src/util/dispatcher/test/m/b.html: -------------------------------------------------------------------------------- 1 | b.html -------------------------------------------------------------------------------- /src/util/dispatcher/test/m/c.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/m/c1.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/m/c2.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/m/root.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/private.module.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | cache测试页 6 | 7 | 8 | 9 | 10 |

                                                                Qunit privateModule test

                                                                11 |

                                                                12 |
                                                                13 |

                                                                14 |
                                                                  15 |
                                                                  16 | 26 |
                                                                  27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/util/dispatcher/test/root/index.css: -------------------------------------------------------------------------------- 1 | index.css -------------------------------------------------------------------------------- /src/util/dragger/test/dragger.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | dragger测试页 6 | 7 | 8 | 12 | 13 | 14 |

                                                                  Qunit dragger test

                                                                  15 |

                                                                  16 |
                                                                  17 |

                                                                  18 |
                                                                    19 |
                                                                    20 |
                                                                    21 |
                                                                    22 |
                                                                    23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/util/dragger/test/dragger.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("dragger"); 4 | var _ = NEJ.P, 5 | _p = _('nej.ut'), 6 | _e = _('nej.e'); 7 | 8 | //开始单元测试 9 | test('dragger',function(){ 10 | // stop(); 11 | expect(0); 12 | var _box = _e._$get('box'); 13 | var _dg = _p._$$Dragger._$allocate({ 14 | view:_e._$get('view'), 15 | body:_box, 16 | overflow:false, 17 | direction:0, 18 | onchange:function(_event){ 19 | // ok(true,'设置位置'); 20 | }, 21 | ondragend:function(_event){ 22 | // ok(true,'当前位置top:'+_event.top+'left:'+_event.left); 23 | // start(); 24 | } 25 | }) 26 | }); 27 | 28 | } 29 | module('依赖模块'); 30 | test('define',function(){expect(0); 31 | define('{pro}dragger.test.js',['{lib}util/dragger/dragger.js'],f); 32 | }); -------------------------------------------------------------------------------- /src/util/editor/command/bold.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 加粗执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** @module util/editor/command/bold */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 加粗执行命令封装 16 | * 17 | * @class module:util/editor/command/bold._$$Bold 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$Bold = _k._$klass(); 22 | _p._$$Bold._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/bold._$$Bold.command 27 | */ 28 | _p._$$Bold.command = 'bold'; 29 | // regist command implemention 30 | _p._$$Bold._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/format.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 清除样式命令封装实现文件 4 | * @version 1.0 5 | * @author cheng-lin(cheng-lin@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/format */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 清除样式命令封装 16 | * 17 | * @class module:util/editor/command/format._$$Format 18 | * @extends module:util/editor/command._$$EditorCommand 19 | * @param {Object} 可选配置参数 20 | */ 21 | _p._$$Format = _k._$klass(); 22 | _pro = _p._$$Format._$extend(_t0._$$EditorCommand); 23 | /** 24 | * 命令名称 25 | * @const {String} module:util/editor/command/format._$$Format.command 26 | */ 27 | _p._$$Format.command = 'format'; 28 | 29 | /** 30 | * 执行命令 31 | * 32 | * @method module:util/editor/command/format._$$Format#_$execute 33 | * @return {Void} 34 | */ 35 | _pro._$execute = function(){ 36 | this.__editor._$setContentNoStyle(); 37 | }; 38 | // regist command implemention 39 | _p._$$Format._$regist(); 40 | 41 | if (CMPT){ 42 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 43 | } 44 | 45 | return _p; 46 | }); -------------------------------------------------------------------------------- /src/util/editor/command/insertorderedlist.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 有序列表执行命令封装实现文件 4 | * @version 1.0 5 | * @author cheng-lin(cheng-lin@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/insertorderedlist */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 有序列表执行命令封装 16 | * 17 | * @class module:util/editor/command/insertorderedlist._$$InsertOrderedList 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$InsertOrderedList = _k._$klass(); 22 | _p._$$InsertOrderedList._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/insertorderedlist._$$InsertOrderedList.command 27 | */ 28 | _p._$$InsertOrderedList.command = 'insertorderedlist'; 29 | // regist command implemention 30 | _p._$$InsertOrderedList._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/insertunorderedlist.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 无序列表执行命令封装实现文件 4 | * @version 1.0 5 | * @author cheng-lin(cheng-lin@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/insertunorderedlist */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 无序列表执行命令封装 16 | * 17 | * @class module:util/editor/command/insertunorderedlist._$$InsertUnorderedList 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$InsertUnorderedList = _k._$klass(); 22 | _p._$$InsertUnorderedList._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/insertunorderedlist._$$SimpleCommand.command 27 | */ 28 | _p._$$InsertUnorderedList.command = 'insertunorderedlist'; 29 | // regist command implemention 30 | _p._$$InsertUnorderedList._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/italic.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 斜体执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/italic */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 斜体执行命令封装 16 | * 17 | * @class module:util/editor/command/italic._$$Italic 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$Italic = _k._$klass(); 22 | _p._$$Italic._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/italic._$$Italic.command 27 | */ 28 | _p._$$Italic.command = 'italic'; 29 | // regist command implemention 30 | _p._$$Italic._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/justifycenter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 居中对齐执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** @module util/editor/command/justifycenter */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 居中对齐执行命令封装 16 | * 17 | * @class module:util/editor/command/justifycenter._$$JustifyCenter 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$JustifyCenter = _k._$klass(); 22 | _p._$$JustifyCenter._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/justifycenter._$$JustifyCenter.command 27 | */ 28 | _p._$$JustifyCenter.command = 'justifyCenter'; 29 | // regist command implemention 30 | _p._$$JustifyCenter._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/justifyleft.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 左对齐执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/justifyleft */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 左对齐执行命令封装 16 | * 17 | * @class module:util/editor/command/justifyleft._$$JustifyLeft 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$JustifyLeft = _k._$klass(); 22 | _p._$$JustifyLeft._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/justifyleft._$$JustifyLeft.command 27 | */ 28 | _p._$$JustifyLeft.command = 'justifyLeft'; 29 | // regist command implemention 30 | _p._$$JustifyLeft._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/justifyright.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 右对齐执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/justifyright */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 右对齐执行命令封装 16 | * 17 | * @class module:util/editor/command/justifyright._$$JustifyRight 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$JustifyRight = _k._$klass(); 22 | _p._$$JustifyRight._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/justifyright._$$JustifyRight.command 27 | */ 28 | _p._$$JustifyRight.command = 'justifyRight'; 29 | // regist command implemention 30 | _p._$$JustifyRight._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/removeformat.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 清除格式执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/removeformat */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 清除格式执行命令封装 16 | * 17 | * @class module:util/editor/command/removeformat._$$RemoveFormat 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$RemoveFormat = _k._$klass(); 22 | _p._$$RemoveFormat._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/removeformat._$$RemoveFormat.command 27 | */ 28 | _p._$$RemoveFormat.command = 'RemoveFormat'; 29 | // regist command implemention 30 | _p._$$RemoveFormat._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/space.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 空格执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/space */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | var _pro; 15 | /** 16 | * 空格执行命令封装 17 | * @class module:util/editor/command/space._$$Blank 18 | * @extends module:util/editor/command._$$EditorCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$Blank = _k._$klass(); 22 | _pro = _p._$$Blank._$extend(_t0._$$EditorCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/space._$$Blank.command 27 | */ 28 | _p._$$Blank.command = 'space'; 29 | /** 30 | * 执行命令 31 | * 32 | * @method module:util/editor/command/space._$$Blank#_$execute 33 | * @return {Void} 34 | */ 35 | _pro._$execute = function(){ 36 | this.__editor._$execCommand('inserthtml',' '); 37 | }; 38 | // regist command implemention 39 | _p._$$Blank._$regist(); 40 | 41 | if (CMPT){ 42 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 43 | } 44 | 45 | return _p; 46 | }); -------------------------------------------------------------------------------- /src/util/editor/command/strikethrough.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 删除线执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/strikethrough */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 删除线执行命令封装 16 | * 17 | * @class module:util/editor/command/strikethrough._$$StrikeThrough 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$StrikeThrough = _k._$klass(); 22 | _p._$$StrikeThrough._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * @const {String} module:util/editor/command/strikethrough._$$StrikeThrough.command 26 | */ 27 | _p._$$StrikeThrough.command = 'strikethrough'; 28 | // regist command implemention 29 | _p._$$StrikeThrough._$regist(); 30 | 31 | if (CMPT){ 32 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 33 | } 34 | 35 | return _p; 36 | }); -------------------------------------------------------------------------------- /src/util/editor/command/superscript.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 加粗执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/superscript */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 加粗执行命令封装 16 | * 17 | * @class module:util/editor/command/superscript._$$SuperScript 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$SuperScript = _k._$klass(); 22 | _p._$$SuperScript._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/superscript._$$SuperScript.command 27 | */ 28 | _p._$$SuperScript.command = 'superscript'; 29 | // regist command implemention 30 | _p._$$SuperScript._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/command/underline.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 下划线执行命令封装实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | /** util/editor/command/underline */ 9 | NEJ.define([ 10 | 'base/global', 11 | 'base/klass', 12 | 'util/editor/command/simple' 13 | ],function(NEJ,_k,_t0,_p,_o,_f,_r){ 14 | /** 15 | * 下划线执行命令封装 16 | * 17 | * @class module:util/editor/command/underline._$$UnderLine 18 | * @extends module:util/editor/command/simple._$$SimpleCommand 19 | * @param {Object} options - 可选配置参数 20 | */ 21 | _p._$$UnderLine = _k._$klass(); 22 | _p._$$UnderLine._$extend(_t0._$$SimpleCommand); 23 | /** 24 | * 命令名称 25 | * 26 | * @const {String} module:util/editor/command/underline._$$UnderLine.command 27 | */ 28 | _p._$$UnderLine.command = 'underline'; 29 | // regist command implemention 30 | _p._$$UnderLine._$regist(); 31 | 32 | if (CMPT){ 33 | NEJ.copy(NEJ.P('nej.ut.cmd'),_p); 34 | } 35 | 36 | return _p; 37 | }); -------------------------------------------------------------------------------- /src/util/editor/demo/text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - 文本编辑器 5 | 6 | 10 | 11 | 12 | 13 |
                                                                    14 | 15 | 16 | 25 | 26 | -------------------------------------------------------------------------------- /src/util/editor/platform/editor.td.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ------------------------------------------ 3 | * 富文本编辑器接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/element', 10 | './editor.js' 11 | ],function(_e,_h,_p,_o,_f,_r){ 12 | 13 | return _h; 14 | }); 15 | -------------------------------------------------------------------------------- /src/util/editor/platform/text.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/editor/platform/text.js -------------------------------------------------------------------------------- /src/util/editor/text.html: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /src/util/effect/effect.api.js: -------------------------------------------------------------------------------- 1 | // link to util/effect/api for compatible 2 | // use util/effect/api for new project 3 | NEJ.define(['./api.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/util/effect/platform/effect.api.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/effect/platform/effect.api.js -------------------------------------------------------------------------------- /src/util/effect/platform/effect.api.patch.js: -------------------------------------------------------------------------------- 1 | NEJ.define([ 2 | 'base/element' 3 | ],function(_e,_h,_o,_f,_r){ 4 | // ie8- 5 | NEJ.patch('TR<=4.0',function(){ 6 | _h.__formatTo = function(_to){ 7 | return _to * 100; 8 | }; 9 | 10 | _h.__formatNumber = function(_node){ 11 | var _filter = _e._$getStyle(_node,'filter'); 12 | // 没设置透明度默认为100 13 | if(_filter === ''){ 14 | _e._$setStyle(_node,'filter','alpha(opacity=100)'); 15 | _number = 100; 16 | }else{ 17 | _number = parseFloat(_filter.split('=')[1])||0; 18 | } 19 | return _number; 20 | }; 21 | }); 22 | 23 | return _h; 24 | }); -------------------------------------------------------------------------------- /src/util/encode/demo/json.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - JSON接口 5 | 6 | 7 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /src/util/encode/demo/md5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - JSON接口 5 | 6 | 7 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/encode/json.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['{platform}json.js'],function(){return JSON;}); -------------------------------------------------------------------------------- /src/util/encode/platform/json.js: -------------------------------------------------------------------------------- 1 | // do nothing 2 | -------------------------------------------------------------------------------- /src/util/encode/platform/json.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/platform' 10 | ],function(_m,_p,_o,_f,_r){ 11 | // ie8- 12 | NEJ.patch('TR<=5.0',['./3rd.json.js']); 13 | 14 | // ie6 json patch 15 | NEJ.patch('TR==2.0',function(){ 16 | // eval for big string 17 | JSON.parse = (function(){ 18 | // check save json string 19 | // http://www.ietf.org/rfc/rfc4627.txt 20 | var _isSafeJSON = function(_content){ 21 | return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( 22 | _content.replace(/"(\\.|[^"\\])*"/g,'') 23 | )); 24 | }; 25 | return JSON.parse._$aop(function(_event){ 26 | var _str = _event.args[0]||''; 27 | if (_str.length>=500000){ // &&_isSafeJSON(_str) 28 | _event.stopped = !0; 29 | _event.value = eval('('+_str+')'); 30 | } 31 | }); 32 | })(); 33 | }); 34 | 35 | return JSON; 36 | }); -------------------------------------------------------------------------------- /src/util/encode/sha.md5.js: -------------------------------------------------------------------------------- 1 | // link to util/encode/md5 for compatible 2 | // use util/encode/md5 for new project 3 | NEJ.define(['./md5.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/encode/test/base64.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | base64测试页 6 | 7 | 8 | 9 | 10 |

                                                                    Qunit base64 test

                                                                    11 |

                                                                    12 |
                                                                    13 |

                                                                    14 |
                                                                      15 |
                                                                      16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/es/demo/array.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - ES-Array兼容接口 5 | 6 | 7 | 8 | 9 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /src/util/es/platform/array.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/es/platform/array.js -------------------------------------------------------------------------------- /src/util/file/demo/file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test file 5 | 6 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /src/util/file/demo/select.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test file upload 5 | 6 | 7 | 8 | 9 | 10 | 30 | 31 | -------------------------------------------------------------------------------- /src/util/file/demo/upload: -------------------------------------------------------------------------------- 1 | {"result":true} -------------------------------------------------------------------------------- /src/util/file/platform/paste.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/file/platform/paste.js -------------------------------------------------------------------------------- /src/util/file/platform/select.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define(function(p){ 9 | /** 10 | * 关联file的label点击事件 11 | * @return {Void} 12 | */ 13 | p.__handleFileLabelClick = function(){ 14 | //do nothing 15 | }; 16 | 17 | return p; 18 | }); -------------------------------------------------------------------------------- /src/util/file/platform/select.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/event', 10 | './select.js' 11 | ],function(_v,_h,_p,_o,_f,_r){ 12 | // fro gecko 13 | NEJ.patch('GR',function(){ 14 | /** 15 | * 关联file的label点击事件 16 | * @return {Void} 17 | */ 18 | _h.__handleFileLabelClick = (function(){ 19 | var _doLabelClick = function(_event){ 20 | _v._$stop(_event); 21 | _v._$getElement(_event,'t:label').control.click(); 22 | }; 23 | return function(_label){ 24 | _v._$addEvent( 25 | _label,'click',_doLabelClick 26 | ); 27 | }; 28 | })(); 29 | }); 30 | 31 | return _h; 32 | }); 33 | -------------------------------------------------------------------------------- /src/util/file/test/save.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | save测试页 6 | 7 | 8 | 9 | 10 |

                                                                      Qunit save test

                                                                      11 |

                                                                      12 |
                                                                      13 |

                                                                      14 |
                                                                        15 |
                                                                        16 | save 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/util/file/test/save.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/file/save'],function(){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('save',function(){ 6 | expect(1); 7 | stop(); 8 | _e._$bindSaveAsAction('save-box',{ 9 | name:'xxx', 10 | url:function(){ 11 | ok('save ok'); 12 | start(); 13 | return 'xxx' 14 | } 15 | }); 16 | }); 17 | }); -------------------------------------------------------------------------------- /src/util/file/test/select.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | select测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                                                        Qunit select test

                                                                        14 |

                                                                        15 |
                                                                        16 |

                                                                        17 |
                                                                          18 |
                                                                          19 |
                                                                          20 |
                                                                          21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/util/file/test/select.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | module("selectTest"); 3 | 4 | var _ = NEJ.P, 5 | _e = _('nej.e'), 6 | _v = _('nej.v'), 7 | _i = _('nej.ui.cmd'); 8 | 9 | test('selectTest',function(){ 10 | stop(); 11 | _e._$file('select-box',{ 12 | multiple:false, 13 | onchange:function(_event){ 14 | ok(true,'文件ID为'+_event.id); 15 | ok(true,'表单ID为'+_event.form.id); 16 | start(); 17 | } 18 | }); 19 | }); 20 | 21 | test('selectTest multiple',function(){ 22 | stop(); 23 | _e._$file('select-box2',{ 24 | multiple:true, 25 | onchange:function(_event){ 26 | ok(true,'文件ID为'+_event.id); 27 | ok(true,'表单ID为'+_event.form.id); 28 | start(); 29 | } 30 | }); 31 | }); 32 | } 33 | module('依赖模块'); 34 | test('define',function(){expect(0); 35 | define('{pro}select.test.js',['{lib}util/file/select.js'],f); 36 | }); 37 | 38 | -------------------------------------------------------------------------------- /src/util/flash/flash.html: -------------------------------------------------------------------------------- 1 | {var hide = defined("hidden")&&!!hidden} 2 | {var param = defined("params")&¶ms||NEJ.O} 3 | {var width = !hide?width:"1px",height = !hide?height:"1px"} 4 | {if hide}
                                                                          {/if} 5 | 9 | 10 | {for x in param} 11 | 12 | {/for} 13 | 19 | 20 | {if hide}
                                                                          {/if} -------------------------------------------------------------------------------- /src/util/flash/platform/flash.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | 'base/platform' 10 | ],function(_m,_p,_o,_f,_r){ 11 | /** 12 | * 判断是否需要对Flash事件做代理, 13 | * 主要fix flash上的鼠标事件没法响应到DOM节点上的问题 14 | * @return {Boolean} 是否做代理 15 | */ 16 | _p.__canFlashEventBubble = function(_wmode){ 17 | return (_wmode||'').toLowerCase()!='transparent'; 18 | }; 19 | 20 | return _p; 21 | }); 22 | -------------------------------------------------------------------------------- /src/util/flash/platform/flash.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './flash.js', 10 | 'base/platform' 11 | ],function(_h,_m,_p,_o,_f,_r){ 12 | // for ie 13 | NEJ.patch('TR',function(){ 14 | /** 15 | * 判断是否需要对Flash事件做代理, 16 | * 主要fix flash上的鼠标事件没法响应到DOM节点上的问题 17 | * @return {Boolean} 是否做代理 18 | */ 19 | _h.__canFlashEventBubble = function(_wmode){ 20 | return !0; 21 | }; 22 | 23 | }); 24 | 25 | NEJ.patch('WV',function(){ 26 | /** 27 | * 判断是否需要对Flash事件做代理, 28 | * 主要fix flash上的鼠标事件没法响应到DOM节点上的问题 29 | * @return {Boolean} 是否做代理 30 | */ 31 | _h.__canFlashEventBubble = function(_wmode){ 32 | return !0; 33 | }; 34 | 35 | }); 36 | 37 | return _h; 38 | }); 39 | -------------------------------------------------------------------------------- /src/util/flash/test/flash.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | flash测试页 6 | 7 | 8 | 9 | 10 |

                                                                          Qunit xdr test

                                                                          11 |

                                                                          12 |
                                                                          13 |

                                                                          14 |
                                                                            15 |
                                                                            16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/flash/test/flash.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/flash/flash'],function(){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('flash',function(){ 6 | expect(0) 7 | var _flash = _e._$flash({ 8 | src:'../../../../res/nej_upload_image.swf', 9 | hidden:false, 10 | parent:document.body, 11 | width:900, 12 | height:600, 13 | params:{ 14 | flashvars:'', 15 | wmode:'transparent', 16 | allowscriptaccess:'always' 17 | }, 18 | onready:function(_flash){ 19 | }, 20 | oncustom:function(_event){ 21 | } 22 | }); 23 | }); 24 | }); -------------------------------------------------------------------------------- /src/util/focus/test/focus.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | focus测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                                                            Qunit xdr test

                                                                            14 |

                                                                            15 |
                                                                            16 |

                                                                            17 |
                                                                              18 |
                                                                              19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/util/focus/test/focus.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/focus/focus'],function(){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('focus',function(){ 6 | expect(0) 7 | _e._$focus('abc',{clazz:'js-focus-2',mode:0}); 8 | }); 9 | }); -------------------------------------------------------------------------------- /src/util/form/test/form.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("form"); 4 | var p = NEJ.P('nej.ut'), 5 | v = NEJ.P('nej.v'), 6 | e = NEJ.P('nej.e'); 7 | 8 | //开始单元测试 9 | test('验证完整的form表单,', function() { 10 | var _check = e._$get('check'); 11 | var _form = p._$$WebForm._$allocate({ 12 | form:'form', 13 | message:{ 14 | 'email100':'两次email地址不一致', 15 | 'emailt100':'两次email地址不一致', 16 | 'email2-5':'email地址太长' 17 | }, 18 | oncheck:function(_event){ 19 | // if(_event.target.name=="emailt"){ 20 | // _event.value = 100; 21 | // } 22 | }, 23 | oninvalid:function(_event){ 24 | // _event.value = ''+_event.code+'' 25 | // if (_event.target.name=='address'&&_event.code==-1){ 26 | // _event.value = '必须输入密码!'; 27 | // } 28 | }, 29 | onvalid:function(_event){ 30 | // if (_event.target.name == 'emailt') { 31 | // } 32 | } 33 | }); 34 | v._$addEvent(_check,'click',function(){ 35 | _form._$checkValidity(); 36 | }); 37 | setTimeout(function(){ 38 | v._$dispatchEvent(_check,'click'); 39 | },2000); 40 | ok(true,'没有异常中断'); 41 | }); 42 | } 43 | module('依赖模块'); 44 | test('define',function(){expect(0); 45 | define('{pro}form.test.js', 46 | ['{lib}util/form/form.js'],f); 47 | }); 48 | -------------------------------------------------------------------------------- /src/util/highlight/test/highlight.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | highlight测试页 6 | 7 | 8 | 11 | 12 | 13 |

                                                                              Qunit xdr test

                                                                              14 |

                                                                              15 |
                                                                              16 |

                                                                              17 |
                                                                                18 |
                                                                                19 |
                                                                                aaaaa
                                                                                20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/util/highlight/test/highlight.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/highlight/touch'],function(_t){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('highlight',function(){ 6 | expect(0); 7 | _t._$highlight('abc','red'); 8 | }); 9 | }); -------------------------------------------------------------------------------- /src/util/history/history.override.js: -------------------------------------------------------------------------------- 1 | // link to util/history/manager for compatible 2 | // use util/history/manager for new project 3 | NEJ.define(['./manager.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/history/platform/history.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define(function(_p){ 9 | /** 10 | * 将Hash推入历史 11 | * @param {String} HASH值 12 | * @return {Void} 13 | */ 14 | _p.__pushHistory = function(_hash){ 15 | // do nothing 16 | }; 17 | 18 | return _p; 19 | }); 20 | -------------------------------------------------------------------------------- /src/util/hover/platform/hover.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define(function(_p,_o,_f,_r){ 9 | /** 10 | * 节点hover行为 11 | * @param {Node} 节点 12 | * @param {String} 样式,默认为js-hover 13 | * @return {Void} 14 | */ 15 | _p.__hoverElement = function(){ 16 | // use css :hover 17 | }; 18 | /** 19 | * 移除节点hover行为 20 | * @param {String} 节点ID 21 | * @return {Void} 22 | */ 23 | _p.__unhoverElement = function(_id){ 24 | // use css :hover 25 | }; 26 | 27 | return _p; 28 | }); 29 | -------------------------------------------------------------------------------- /src/util/hover/test/hover.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define([ 2 | 'base/element', 3 | 'util/hover/hover' 4 | ],function(_e,_t){ 5 | var _v = NEJ.P('nej.v'); 6 | //开始单元测试 7 | test('元素hover测试', function() { 8 | expect(10); 9 | var _list = _e._$getChildren(_e._$get('box')); 10 | for (var i = _list.length-1; i >=0; i--){ 11 | var _i = _list[i]; 12 | _t._$hover(_i,'js-hover'); 13 | _v._$dispatchEvent(_list[i],'mouseenter'); 14 | equal(_list[i].className.indexOf('js-hover')>-1,true,'样式加上去了'); 15 | } 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /src/util/list/demo/data.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/genify/nej/9c0ceb9755c959d65f9b11c4b832c3fddf7b2dcd/src/util/list/demo/data.js -------------------------------------------------------------------------------- /src/util/list/demo/list/jst.html: -------------------------------------------------------------------------------- 1 | {list beg..end as y} 2 | {var x=xlist[y]} 3 |
                                                                                4 | [删除] 5 | [更新] 6 |

                                                                                ${beg+y_index}. ${x.name}:${x.loginTime|format:'yyyy-MM-dd HH:mm:ss'}

                                                                                7 |
                                                                                8 | {/list} -------------------------------------------------------------------------------- /src/util/list/demo/list/ntp.html: -------------------------------------------------------------------------------- 1 |
                                                                                2 | [删除] 3 | [更新] 4 |

                                                                                5 |
                                                                                -------------------------------------------------------------------------------- /src/util/list/module.pager.js: -------------------------------------------------------------------------------- 1 | // link to util/list/page for compatible 2 | // use util/list/page for new project 3 | NEJ.define(['./page.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/list/module.waterfall.js: -------------------------------------------------------------------------------- 1 | // link to util/list/waterfall for compatible 2 | // use util/list/waterfall for new project 3 | NEJ.define(['./waterfall.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/list/test/module.pager.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("module.pager"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _v = _('nej.v'), 8 | _p = _('nej.ut'); 9 | 10 | test('module.pager test',function(){ 11 | expect(0); 12 | _e._$parseTemplate('jst-list'); 13 | var _lmgp = _p._$$ListModulePG._$allocate({ 14 | item:'jst-list', 15 | parent:'list-box', 16 | pager:{parent:'pager-box'}, 17 | cache:{ 18 | key:'name', 19 | klass:_p._$$CacheListCustom 20 | } 21 | }); 22 | }); 23 | //开始单元测试 24 | } 25 | module('依赖模块'); 26 | test('define',function(){expect(0); 27 | define('{pro}module.pager.test.js', 28 | ['{lib}util/list/module.pager.js','{pro}cache.list.custom.js'],f); 29 | }); 30 | -------------------------------------------------------------------------------- /src/util/media/test/audio.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | audio测试页 6 | 7 | 8 | 9 | 10 |

                                                                                Qunit audio test

                                                                                11 |

                                                                                12 |
                                                                                13 |

                                                                                14 |
                                                                                  15 |
                                                                                  16 |
                                                                                  17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/util/media/test/audio.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("audio"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _v = _('nej.v'), 8 | _p = _('nej.ut'); 9 | 10 | test('audio',function(){ 11 | expect(0); 12 | var _mda = _p._$$MediaAudio._$allocate({ 13 | preload:false, 14 | url:'http://www.zhlongyin.com/UploadFiles/xrxz/2011/5/201105051307513619.mp3', 15 | onstatechange:function(_event){ 16 | } 17 | }); 18 | _mda = _p._$$MediaAudio._$recycle(_mda); 19 | _mda = _p._$$MediaAudio._$allocate({ 20 | preload:false, 21 | url:'http://www.zhlongyin.com/UploadFiles/xrxz/2011/5/201105051307513619.mp3', 22 | onstatechange:function(_event){ 23 | } 24 | }); 25 | _mda = _p._$$MediaAudio._$recycle(_mda); 26 | _mda = _p._$$MediaAudio._$allocate({ 27 | preload:false, 28 | url:'http://www.zhlongyin.com/UploadFiles/xrxz/2011/5/201105051307513619.mp3', 29 | onstatechange:function(_event){ 30 | } 31 | }); 32 | _mda._$play(); 33 | }); 34 | } 35 | module('依赖模块'); 36 | test('define',function(){expect(0); 37 | define('{pro}audio.test.js', 38 | ['{lib}util/media/audio.js'],f); 39 | }); 40 | -------------------------------------------------------------------------------- /src/util/page/page.base.js: -------------------------------------------------------------------------------- 1 | // link to util/page/base for compatible 2 | // use util/page/base for new project 3 | NEJ.define(['./base.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/page/page.simple.js: -------------------------------------------------------------------------------- 1 | // link to util/page/simple for compatible 2 | // use util/page/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/placeholder/demo/placeholder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - Place Holder 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 |

                                                                                  16 |

                                                                                  17 | 18 | 19 | 27 | 28 | -------------------------------------------------------------------------------- /src/util/placeholder/platform/holder.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 占位提示接口平台适配实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define(function(_p,_o,_f,_r){ 9 | /** 10 | * 节点占位符行为,高版本浏览器用样式处理 11 | * @param {String|Node} 节点 12 | * @param {String} 样式 13 | * @return {Void} 14 | */ 15 | _p.__setPlaceholder = function(_element,_clazz){ 16 | // do nothing 17 | }; 18 | 19 | return _p; 20 | }); -------------------------------------------------------------------------------- /src/util/placeholder/test/placeholder.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define([ 2 | '{lib}util/placeholder/placeholder.js' 3 | ],function(){ 4 | //定义测试模块 5 | module("placeholder"); 6 | 7 | var _ = NEJ.P, 8 | _e = _('nej.e'), 9 | _v = _('nej.v'), 10 | _p = _('nej.ut'); 11 | 12 | test('placeholder',function(){ 13 | expect(0); 14 | _e._$placeholder('placeholder1','zw'); 15 | _e._$placeholder('placeholder2','zw'); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /src/util/query/demo/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - NES 5 | 6 | 7 | 8 | 9 |
                                                                                  10 | 11 | 12 | 25 | 28 | 29 | -------------------------------------------------------------------------------- /src/util/range/test/range.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | range测试页 6 | 7 | 8 | 9 | 10 |

                                                                                  Qunit range test

                                                                                  11 |

                                                                                  12 |
                                                                                  13 |

                                                                                  14 |
                                                                                    15 |
                                                                                    16 |
                                                                                    111
                                                                                    17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/util/range/test/range.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("range"); 4 | var p = NEJ.P('nej.ut'), 5 | e = NEJ.P('nej.e'); 6 | //开始单元测试 7 | test('range',function(){ 8 | stop(); 9 | var _box2 = e._$get('box2'); 10 | var _rg = p._$$Range._$allocate({ 11 | body:_box2, 12 | onchange:function(_event){ 13 | ok(true,'选择区域'); 14 | }, 15 | onbeforechange:function(_event){ 16 | }, 17 | onafterchange:function(_event){ 18 | ok(true,'区域选择完毕'); 19 | start(); 20 | } 21 | }); 22 | }); 23 | } 24 | module('依赖模块'); 25 | test('define',function(){expect(0); 26 | define('{pro}range.test.js',['{lib}util/range/range.js'],f); 27 | }); 28 | -------------------------------------------------------------------------------- /src/util/region/demo/at.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - 三级联动省市区选择 5 | 6 | 7 | 8 |
                                                                                    9 | 10 | 11 | 12 |
                                                                                    13 | 14 | 15 | 32 | 33 | -------------------------------------------------------------------------------- /src/util/region/region.zh.js: -------------------------------------------------------------------------------- 1 | // link to util/region/zh for compatible 2 | // use util/region/zh for new project 3 | NEJ.define(['./zh.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/region/test/region.zh.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | regionSelector测试页 6 | 7 | 8 | 9 | 10 |

                                                                                    Qunit regionSelector test

                                                                                    11 |

                                                                                    12 |
                                                                                    13 |

                                                                                    14 |
                                                                                      15 |
                                                                                      16 |
                                                                                      17 | 18 | 19 | 20 |
                                                                                      21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/util/region/test/region.zh.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("regionSelector"); 4 | 5 | var _ = NEJ.P, 6 | _e = _('nej.e'), 7 | _v = _('nej.v'), 8 | _p = _('nej.ut'); 9 | 10 | test('regionSelector test',function(){ 11 | expect(0); 12 | var _rsr = _p._$$RegionSelector._$allocate({ 13 | province:'a', 14 | city:'b', 15 | area:'c', 16 | data:{province:'浙江省',city:'杭州市',area:'滨江区'}, 17 | onchange:function(_type){ 18 | } 19 | }); 20 | _rsr._$setRegion({province:'浙江省',city:'杭州市',area:'下城区'}) 21 | }); 22 | //开始单元测试 23 | } 24 | module('依赖模块'); 25 | test('define',function(){expect(0); 26 | define('{pro}region.zh.test.js', 27 | ['{lib}util/data/region/zh.js','{lib}util/region/region.zh.js'],f); 28 | }); 29 | -------------------------------------------------------------------------------- /src/util/resize/test/resize.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("resize"); 4 | var p = NEJ.P('nej.ut'), 5 | e = NEJ.P('nej.e'); 6 | //开始单元测试 7 | test('resize',function(){ 8 | expect(0); 9 | p._$$Resize._$allocate({ 10 | body:e._$get('box'), 11 | clazz:['','top','right','bottom','left','lefttop','righttop','rightbottom','leftbottom'], 12 | onresize: function(_value){ 13 | } 14 | }); 15 | }); 16 | } 17 | module('依赖模块'); 18 | test('define',function(){expect(0); 19 | define('{pro}resize.test.js',['{lib}util/resize/resize.js'],f); 20 | }); 21 | -------------------------------------------------------------------------------- /src/util/scroll/demo/smart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test smart scroll 5 | 6 | 9 | 10 | 11 |

                                                                                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

                                                                                      12 |

                                                                                      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

                                                                                      13 |

                                                                                      ccccccccccccccccccccccccccccccccccc

                                                                                      14 |

                                                                                      dddddddddddddddddddddddddddddddddddd

                                                                                      15 |

                                                                                      eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

                                                                                      16 |

                                                                                      fffffffffffffffffffffffffffffffffff

                                                                                      17 |

                                                                                      ggggggggggggggggggggggggggggggggggggg

                                                                                      18 |

                                                                                      111111111111111111111111111111

                                                                                      19 |

                                                                                      222222222222222222222222222

                                                                                      20 |

                                                                                      33333333333333333333333333333

                                                                                      21 | 22 | 29 | 30 | -------------------------------------------------------------------------------- /src/util/scroll/platform/simple.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define(function(p){ 9 | /** 10 | * 插入回车换行 11 | * @param doc 12 | * @private 13 | */ 14 | p.__getOverflowParent = function(parent){ 15 | return parent; 16 | }; 17 | }); -------------------------------------------------------------------------------- /src/util/scroll/platform/simple.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 需要平台适配的接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './simple.js' 10 | ],function(h){ 11 | // for ie 12 | NEJ.patch('TR',function(){ 13 | /** 14 | * 插入回车换行 15 | * @param doc 16 | * @private 17 | */ 18 | h.__getOverflowParent = function(parent){ 19 | var ret = parent; 20 | if (ret.tagName=='BODY'){ 21 | ret = ret.ownerDocument.documentElement; 22 | } 23 | return ret; 24 | }; 25 | }); 26 | return h; 27 | }); 28 | -------------------------------------------------------------------------------- /src/util/scroll/scroll.simple.js: -------------------------------------------------------------------------------- 1 | // link to util/scroll/simple for compatible 2 | // use util/scroll/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/selector/selector.range.js: -------------------------------------------------------------------------------- 1 | // link to util/slector/range for compatible 2 | // use util/slector/range for new project 3 | NEJ.define(['./range.js'],function(_t){return _t;}); -------------------------------------------------------------------------------- /src/util/slider/demo/simple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - 简易滑块 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
                                                                                      17 |
                                                                                      18 |   19 |
                                                                                      20 |
                                                                                      21 | 22 | 23 | 40 | 41 | -------------------------------------------------------------------------------- /src/util/slider/demo/y.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - 简易滑块 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
                                                                                      17 |
                                                                                      18 |   19 |
                                                                                      20 |
                                                                                      21 | 22 | 23 | 24 | 37 | 38 | -------------------------------------------------------------------------------- /src/util/slider/slider.simple.js: -------------------------------------------------------------------------------- 1 | // link to util/slider/simple for compatible 2 | // use util/slider/simple for new project 3 | NEJ.define(['./simple.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/slider/slider.x.js: -------------------------------------------------------------------------------- 1 | // link to util/slider/x for compatible 2 | // use util/slider/x for new project 3 | NEJ.define(['./x.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/slider/slider.xy.js: -------------------------------------------------------------------------------- 1 | // link to util/slider/xy for compatible 2 | // use util/slider/xy for new project 3 | NEJ.define(['./xy.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/slider/slider.y.js: -------------------------------------------------------------------------------- 1 | // link to util/slider/y for compatible 2 | // use util/slider/y for new project 3 | NEJ.define(['./y.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/slider/test/sorter.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | //定义测试模块 3 | module("sorter"); 4 | var p = NEJ.P('nej.ut'), 5 | e = NEJ.P('nej.e'), 6 | u = NEJ.P('nej.u'); 7 | 8 | //开始单元测试 9 | test('生成排序控件', function() { 10 | expect(0); 11 | stop(); 12 | var _selector = p._$$MultiSelector._$allocate({ 13 | parent:'selector' 14 | }); 15 | var _sorter = p._$$Sorter._$allocate({ 16 | selector:_selector, 17 | holder:'holder', 18 | mover:'mover', 19 | onbeforesort:function(_options){ 20 | }, 21 | onaftersort:function(_options){ 22 | var _list = _options.list, 23 | _p = e._$get('selector'); 24 | // 刷新父亲节点 25 | _p.innerHTML = ''; 26 | u._$forEach(_list,function(_item){ 27 | _p.appendChild(_item); 28 | }); 29 | }, 30 | onsort:function(_options){ 31 | } 32 | }); 33 | start(); 34 | }); 35 | } 36 | module('依赖模块'); 37 | test('define',function(){expect(0); 38 | define('{pro}sorter.test.js', 39 | ['{lib}util/selector/selector.js','{lib}util/sorter/sorter.js'],f); 40 | }); 41 | -------------------------------------------------------------------------------- /src/util/suggest/test/suggest.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | suggest测试页 6 | 7 | 8 | 14 | 15 | 16 |

                                                                                      Qunit suggest test

                                                                                      17 |

                                                                                      18 |
                                                                                      19 |

                                                                                      20 |
                                                                                        21 |
                                                                                        22 |
                                                                                        23 | 24 |
                                                                                        25 |
                                                                                        26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/util/suggest/test/suggest.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | module("suggest"); 3 | 4 | var _ = NEJ.P, 5 | _e = _('nej.e'), 6 | _v = _('nej.v'), 7 | _p = _('nej.ut'); 8 | test('suggest',function(){ 9 | stop(); 10 | expect(0); 11 | var _ipt = _e._$get('suggest-input'); 12 | var _card0 = _e._$get('card0'); 13 | var _sg = _p._$$Suggest._$allocate({ 14 | input:_ipt, 15 | body:'card0', 16 | selected:'xuanzhong', 17 | onchange:function(_value){ 18 | var _item = ''; 19 | for(var i = 1; i < 10;i++){ 20 | _item += '

                                                                                        '+i+'

                                                                                        '; 21 | } 22 | _card0.innerHTML = _item; 23 | _sg._$setList(_e._$getChildren(_card0)); 24 | }, 25 | onselect:function(_value){ 26 | // ok(true,'选择了一个值'+_value); 27 | // start(); 28 | } 29 | }); 30 | }); 31 | } 32 | module('依赖模块'); 33 | test('define',function(){expect(0); 34 | define('{pro}suggest.test.js',['{lib}util/suggest/suggest.js'],f); 35 | }); 36 | 37 | -------------------------------------------------------------------------------- /src/util/tab/tab.view.js: -------------------------------------------------------------------------------- 1 | // link to util/tab/view for compatible 2 | // use util/tab/view for new project 3 | NEJ.define(['./view.js'],function(_t){return _t;}); 4 | -------------------------------------------------------------------------------- /src/util/tab/test/tab.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tab测试页 6 | 7 | 8 | 13 | 14 | 15 |

                                                                                        Qunit tab test

                                                                                        16 |

                                                                                        17 |
                                                                                        18 |

                                                                                        19 |
                                                                                          20 |
                                                                                          21 |
                                                                                          22 | 1 23 | 2 24 | 3 25 | 4 26 |
                                                                                          27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/util/tab/test/tab.test.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | module("tab"); 3 | 4 | var _ = NEJ.P, 5 | _e = _('nej.e'), 6 | _v = _('nej.v'), 7 | _p = _('nej.ut'); 8 | 9 | test('tab',function(){ 10 | stop(); 11 | var _tb = _p._$$Tab._$allocate({ 12 | list:_e._$getChildren(_e._$get('box')), 13 | index:1, 14 | onchange:function(_event){ 15 | ok(true,'上一次页面是:'+_event.last); 16 | ok(true,'当前页面是:'+_event.index); 17 | start(); 18 | } 19 | }); 20 | // _tb._$go(2); 21 | }); 22 | } 23 | module('依赖模块'); 24 | test('define',function(){expect(0); 25 | define('{pro}tab.test.js',['{lib}util/tab/tab.js'],f); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /src/util/template/demo/a.css: -------------------------------------------------------------------------------- 1 | .aa{color:#df3563;} -------------------------------------------------------------------------------- /src/util/template/demo/a.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/util/template/demo/a.js: -------------------------------------------------------------------------------- 1 | console.log('textarea exline script') -------------------------------------------------------------------------------- /src/util/template/demo/b.css: -------------------------------------------------------------------------------- 1 | .bb{color:#00bb00;} -------------------------------------------------------------------------------- /src/util/template/demo/b.html: -------------------------------------------------------------------------------- 1 |

                                                                                          222222222

                                                                                          2 |


                                                                                          44444455555555555

                                                                                          -------------------------------------------------------------------------------- /src/util/template/demo/b.js: -------------------------------------------------------------------------------- 1 | console.log('script exline script') -------------------------------------------------------------------------------- /src/util/template/demo/jst.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test template 5 | 6 | 7 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /src/util/template/test/jst.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jst测试页 6 | 7 | 8 | 9 | 10 |

                                                                                          Qunit jst test

                                                                                          11 |

                                                                                          12 |
                                                                                          13 |

                                                                                          14 |
                                                                                            15 |
                                                                                            16 | 19 | 22 | 25 |
                                                                                            26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/util/template/test/myItem.js: -------------------------------------------------------------------------------- 1 | var f = function(){ 2 | var _ = NEJ.P, 3 | _p = _('nej.ut'), 4 | _e = _('nej.e'), 5 | _v = _('nej.v'), 6 | _u = _('nej.ui'), 7 | _proMyItem; 8 | var _html_key = _e._$addNodeTemplate('
                                                                                            123
                                                                                            '); 9 | _p._$$MyItem = NEJ.C(); 10 | _proMyItem = _p._$$MyItem._$extend(_u._$$Item); 11 | 12 | 13 | _proMyItem.__reset = function(_options){ 14 | this.__data = _options.data; 15 | this.__supReset(_options); 16 | } 17 | /** 18 | * 刷新一项的信息 19 | */ 20 | _proMyItem.__doRefresh = function(){ 21 | this.__body.innerText = this.__data.name; 22 | }; 23 | 24 | _proMyItem.__initXGui = function(){ 25 | this.__seed_html = _e._$getNodeTemplate(_html_key); 26 | }; 27 | }; 28 | define('{pro}myItem.js',['{lib}ui/item/item.js'],f) 29 | -------------------------------------------------------------------------------- /src/util/timer/demo/a.js: -------------------------------------------------------------------------------- 1 | NEJ.define([ 2 | 'util/timer/animation' 3 | ],function(p){ 4 | var abc = function () { 5 | log(+new Date); 6 | p.requestAnimationFrame(abc); 7 | }; 8 | p.requestAnimationFrame(abc); 9 | }); -------------------------------------------------------------------------------- /src/util/timer/demo/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | klass demo 5 | 6 | 13 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /src/util/timer/demo/test.min.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | animation demo 5 | 6 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/util/timer/platform/animation.patch.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------ 3 | * 平台适配接口实现文件 4 | * @version 1.0 5 | * @author genify(caijf@corp.netease.com) 6 | * ------------------------------------------ 7 | */ 8 | NEJ.define([ 9 | './animation.js', 10 | 'base/platform' 11 | ],function(_h,_m){ 12 | return _h; 13 | }); 14 | -------------------------------------------------------------------------------- /src/util/toggle/demo/toggle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEJ实例 - Toggle 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 |
                                                                                            123456
                                                                                            16 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /src/util/toggle/test/toggle.test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | toggle测试页 6 | 7 | 8 | 9 | 10 |

                                                                                            Qunit xdr test

                                                                                            11 |

                                                                                            12 |
                                                                                            13 |

                                                                                            14 |
                                                                                              15 |
                                                                                              16 |
                                                                                              可点击区域
                                                                                              17 |
                                                                                              18 |

                                                                                              content content

                                                                                              19 |

                                                                                              content content

                                                                                              20 |

                                                                                              content content

                                                                                              21 |

                                                                                              content content

                                                                                              22 |
                                                                                              23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/util/toggle/test/toggle.test.js: -------------------------------------------------------------------------------- 1 | NEJ.define(['util/toggle/toggle'],function(){ 2 | var _ = NEJ.P, 3 | _e = _('nej.e'), 4 | _v = _('nej.v'); 5 | test('toggle',function(){ 6 | _e._$toggle('click-bar',{element:'toggle-node',clazz:'cxx'}); 7 | _v._$dispatchEvent('click-bar','click'); 8 | equal(_e._$get('toggle-node').className.indexOf('cxx') >= 0,true,'toggle') 9 | 10 | // // 同时自定义切换样式和节点 11 | // _e._$toggle('click-bar',{ 12 | // clazz:'js-show', 13 | // element:'toggle-node', 14 | // ontoggle:function(_event){ 15 | // // _event.clazz 切换的样式名称 16 | // // _event.target 触发切换事件的节点 17 | // // _event.toggled 是否增加了切换样式 18 | // debugger; 19 | // // TODO 20 | // } 21 | // }); 22 | }); 23 | }); --------------------------------------------------------------------------------