├── test
├── grower.test.js
├── swipereveal.test.js
├── chai.helper.js
├── fixtures
│ ├── afui-view.html
│ ├── popup.html
│ ├── toast.html
│ ├── afui.html
│ └── drawer.html
├── cssTranslate.test.js
├── vendorCss.test.js
├── transition.test.js
├── animation.test.js
├── getCssMatrix.test.js
├── replaceClass.test.js
├── desktopbrowsers.test.js
├── actionSheet.test.js
├── shim.test.js
├── toasts.test.js
├── drawer.test.js
└── popup.test.js
├── samples
├── react
│ ├── js
│ │ ├── form.jsx
│ │ └── app.jsx
│ ├── readme.md
│ └── index.html
├── angular
│ ├── js
│ │ ├── app.js
│ │ ├── directives.js
│ │ └── controllers.js
│ ├── partials
│ │ └── todo.html
│ ├── readme.md
│ └── index.html
└── backbone
│ ├── readme.md
│ ├── js
│ └── app.js
│ └── index.html
├── .travis.yml
├── docs
├── build
├── plugins
│ ├── af.animateheader.md
│ ├── af.splashscreen.md
│ ├── af.swipereveal.md
│ ├── af.transform.md
│ ├── af.touchevents.md
│ ├── af.animation.md
│ ├── af.lockscreen.md
│ ├── af.drawer.md
│ ├── af.toast.md
│ ├── af.actionsheet.md
│ └── af.popup.md
├── af.ui
│ ├── $.afui.hideMask.md
│ ├── $.afui.autoLaunch.md
│ ├── $.afui.getTitle.md
│ ├── $.afui.unblockUI.md
│ ├── $.afui.goBack.md
│ ├── $.afui.clearHistory.md
│ ├── $.afui.disableTabBar.md
│ ├── $.afui.removeBadge.md
│ ├── $.afui.setBackButtonText.md
│ ├── $.afui.blockUI.md
│ ├── $.afui.setTitle.md
│ ├── $.afui.ready.md
│ ├── $.afui.manageHistory.md
│ ├── $.afui.useAjaxCacheBuster.md
│ ├── $.afui.setBackButtonVisbility.md
│ ├── $.afui.drawer.show.md
│ ├── $.afui.launch.md
│ ├── $.afui.loadDefaultHash.md
│ ├── $.afui.showMask.md
│ ├── $.afui.registerDataDirective.md
│ ├── $.afui.loadContent.md
│ ├── $.afui.updateBadge.md
│ ├── $.afui.actionsheet.md
│ └── $.afui.popup.md
└── docgen.js
├── lancaster
├── images
│ ├── minus.png
│ ├── plus.png
│ ├── circle.png
│ ├── divide2.png
│ ├── home60.png
│ ├── chalkboard.jpg
│ ├── multiply2.png
│ └── triangle_stroked.png
└── index.html
├── .settings
└── settings.json
├── ajax.html
├── .gitignore
├── src
├── af.splashscreen.js
├── less
│ ├── grid.less
│ ├── badges.less
│ ├── af.swipereveal.less
│ ├── anim2.less
│ ├── splitview.less
│ ├── af.popup.less
│ ├── af.toast.less
│ ├── af.actionsheet.less
│ ├── af.splashscreen.less
│ ├── lists.less
│ ├── lockscreen.css
│ ├── af.lockscreen.less
│ ├── buttons.less
│ ├── tizen.less
│ └── appframework.less
├── af.animateheader.js
├── af.swipereveal.js
├── af.grower.js
├── af.lockscreen.js
├── af.toast.js
├── af.actionsheet.js
└── af.animation.js
├── partials
├── lockscreen.html
├── leftnav.html
├── toast.html
├── actionsheet.html
├── popup.html
├── touch.html
└── forms.html
├── .jshintrc
├── license.txt
├── README.md
├── package.json
├── jquery-widgets
├── af.popup.html
├── af.lockscreen.html
├── af.lockscreen.js
├── af.lockscreen.css
└── af.popup.js
├── animgenerator
└── generate.js
├── templates
├── tabview.html
├── drawer.html
└── listview.html
├── karma.conf.js
└── Gruntfile.js
/test/grower.test.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples/react/js/form.jsx:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/swipereveal.test.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "0.10"
4 | - "0.8"
5 |
--------------------------------------------------------------------------------
/docs/build:
--------------------------------------------------------------------------------
1 | dox <../src/af.ui.js > af.ui.json
2 | node docgen.js "af.ui.json"
3 |
--------------------------------------------------------------------------------
/lancaster/images/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/minus.png
--------------------------------------------------------------------------------
/lancaster/images/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/plus.png
--------------------------------------------------------------------------------
/.settings/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | }
--------------------------------------------------------------------------------
/lancaster/images/circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/circle.png
--------------------------------------------------------------------------------
/lancaster/images/divide2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/divide2.png
--------------------------------------------------------------------------------
/lancaster/images/home60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/home60.png
--------------------------------------------------------------------------------
/lancaster/images/chalkboard.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/chalkboard.jpg
--------------------------------------------------------------------------------
/lancaster/images/multiply2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/multiply2.png
--------------------------------------------------------------------------------
/ajax.html:
--------------------------------------------------------------------------------
1 | This is an ajax panel. It will be added to the view
2 | Main
3 |
--------------------------------------------------------------------------------
/lancaster/images/triangle_stroked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/appframework/master/lancaster/images/triangle_stroked.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.bat
2 | *.DS_Store
3 | /dev
4 | *.svn
5 | /node_modules
6 | /.idea
7 | /3rdparty
8 | /coverage
9 | /src/css
10 | >>>>>>> 3.0beta
11 |
--------------------------------------------------------------------------------
/docs/plugins/af.animateheader.md:
--------------------------------------------------------------------------------
1 | #animateheader
2 |
3 | This plugin will animate headers during transitions. Simply include the script to enable header animations during panel transitions.
4 |
5 |
--------------------------------------------------------------------------------
/samples/angular/js/app.js:
--------------------------------------------------------------------------------
1 | angular.module('todoaf',[])
2 | .config(function () {
3 |
4 | });
5 |
6 |
7 |
8 | $.afui.ready(function(){
9 | angular.bootstrap(document, ['todoaf']);
10 | });
--------------------------------------------------------------------------------
/samples/backbone/readme.md:
--------------------------------------------------------------------------------
1 | #sample
2 |
3 | This sample is to show basic usage of Backbone and App Framework UI. This does not go into more advanced features, such as page routing/navigation. This shows initiating the view when App Framework UI is ready, and responding to a custom "longTap" event.
--------------------------------------------------------------------------------
/docs/af.ui/$.afui.hideMask.md:
--------------------------------------------------------------------------------
1 | #$.afui.hideMask();
2 |
3 | ```
4 |
5 | Hide the loading mask
6 |
7 | ```
8 |
9 | ##Example
10 |
11 | ```
12 | $.afui.hideMask();
13 |
14 | ```
15 |
16 |
17 | ##Parameters
18 |
19 | ```
20 |
21 | ```
22 |
23 | ##Returns
24 |
25 | ```
26 | undefined
27 | ```
28 |
29 |
--------------------------------------------------------------------------------
/samples/react/readme.md:
--------------------------------------------------------------------------------
1 | #sample
2 |
3 | This sample is to show basic usage of React and App Framework UI. This does not go into more advanced features, such as page routing/navigation. This shows how to create custom React components and load them in an App Framework UI app, along with responding to custom "longTap" events.
--------------------------------------------------------------------------------
/docs/af.ui/$.afui.autoLaunch.md:
--------------------------------------------------------------------------------
1 | #$.afui.autoLaunch
2 |
3 | ```
4 |
5 | Boolean if you want to auto launch afui
6 |
7 | ```
8 |
9 | ##Example
10 |
11 | ```
12 | $.afui.autoLaunch = false; //
13 |
14 | ```
15 |
16 |
17 | ##Parameters
18 |
19 | ```
20 |
21 | ```
22 |
23 | ##Returns
24 |
25 | ```
26 | undefined
27 | ```
28 |
29 |
--------------------------------------------------------------------------------
/docs/af.ui/$.afui.getTitle.md:
--------------------------------------------------------------------------------
1 | #$.afui.getTitle
2 |
3 | ```
4 |
5 | Get the title of the active header
6 |
7 | ```
8 |
9 | ##Example
10 |
11 | ```
12 | $.afui.getTitle()
13 |
14 | ```
15 |
16 |
17 | ##Parameters
18 |
19 | ```
20 |
21 | ```
22 |
23 | ##Returns
24 |
25 | ```
26 | undefined
27 | ```
28 |
29 |
--------------------------------------------------------------------------------
/docs/af.ui/$.afui.unblockUI.md:
--------------------------------------------------------------------------------
1 | #$.afui.unblockUI()
2 |
3 | ```
4 |
5 | This will remove the UI mask
6 |
7 | ```
8 |
9 | ##Example
10 |
11 | ```
12 | $.afui.unblockUI()
13 |
14 | ```
15 | `
16 |
17 | ##Parameters
18 |
19 | ```
20 |
21 | ```
22 |
23 | ##Returns
24 |
25 | ```
26 | undefined
27 | ```
28 |
29 |
--------------------------------------------------------------------------------
/docs/af.ui/$.afui.goBack.md:
--------------------------------------------------------------------------------
1 | #$.afui.goBack()
2 |
3 | ```
4 |
5 | Initiate a back transition
6 |
7 | ```
8 |
9 | ##Example
10 |
11 | ```
12 | $.afui.goBack()
13 |
14 | ```
15 |
16 |
17 | ##Parameters
18 |
19 | ```
20 | delta number=
21 |
22 | ```
23 |
24 | ##Returns
25 |
26 | ```
27 | undefined
28 | ```
29 |
30 |
--------------------------------------------------------------------------------
/src/af.splashscreen.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * af.splashscreen
4 | * @copyright Intel 2014
5 | *
6 | */
7 | (function($){
8 | "use strict";
9 | $.afui.ready(function(){
10 | //delay to hide the splashscreen
11 | setTimeout(function(){
12 | $("#splashscreen").remove();
13 | },250);
14 | });
15 | })(jQuery);
--------------------------------------------------------------------------------
/samples/angular/partials/todo.html:
--------------------------------------------------------------------------------
1 |
","\n```\n\n##Example\n\n```\n").
75 | replace("","\n```\n").
76 | replace(//g,"\n"). 78 | replace(/```js/g,"```"). 79 | replace(/ /g,""); 80 | summary=stripTags(summary); 81 | var paramsTxt=""; 82 | var returnTxt=rPad(returnObj.types," ",30)+returnObj.desc; 83 | Object.keys(params).forEach(function(key){ 84 | paramsTxt+=rPad(key," ",30)+params[key].join("|")+"\n"; 85 | }); 86 | var extra=""; 87 | var extraName=title.replace(";",""); 88 | if(extraName.indexOf("(")!==-1) 89 | extraName=extraName.substr(0,extraName.indexOf("(")); 90 | 91 | try { 92 | if(fs.statSync("./detail/"+extraName+".md")) 93 | { 94 | extra=fs.readFileSync("./detail/"+extraName+".md").toString(); 95 | extra=extra.replace(/```js/g,"```"); 96 | extra=extra.replace(/```html/g,"```"); 97 | extra="##Detail\n\n"+extra; 98 | } 99 | } 100 | catch(e){ 101 | } 102 | var md=makeMD(title,summary,paramsTxt,returnTxt,extra); 103 | fs.writeFileSync("./"+name+"/"+extraName+".md",md); 104 | }); 105 | } 106 | }); 107 | 108 | -------------------------------------------------------------------------------- /jquery-widgets/af.lockscreen.css: -------------------------------------------------------------------------------- 1 | #lockScreen * { 2 | padding:0; 3 | margin:0; 4 | box-sizing:border-box; 5 | -webkit-tap-highlight-color: rgba(0,0,0,0); 6 | -webkit-user-select: none; 7 | } 8 | 9 | #lockScreen { 10 | position: absolute; 11 | top:0px; 12 | bottom:0px; 13 | width:100%; 14 | height:100%; 15 | left:0px; 16 | z-index:99999999999999; 17 | background: #ccc; 18 | } 19 | 20 | #lockScreen .flexContainer { 21 | display: -webkit-box; 22 | display: -moz-box; 23 | display: box; 24 | 25 | -webkit-box-orient: vertical; 26 | -moz-box-orient: vertical; 27 | box-orient: vertical; 28 | 29 | -webkit-box-align: center; 30 | -moz-box-align: center; 31 | box-align: center; 32 | -webkit-box-pack: center; 33 | -moz-box-pack: center; 34 | box-pack: center; 35 | } 36 | 37 | #lockScreen .keyboard { 38 | width:100%; 39 | position:absolute; 40 | bottom:0px; 41 | } 42 | 43 | #lockScreen .content { 44 | position:absolute; 45 | top:0px; 46 | bottom:170px; 47 | width:100%; 48 | text-align:center; 49 | -moz-box-flex: 0; 50 | -webkit-box-flex: 0; 51 | -ms-box-flex: 0; 52 | box-flex: 0; 53 | -moz-box-ordinal-group: 1; 54 | -webkit-box-ordinal-group: 1; 55 | -ms-box-ordinal-group: 1; 56 | box-ordinal-group: 1; 57 | align-items: center; 58 | justify-content: center; 59 | } 60 | 61 | #lockScreen .keyboard .row { 62 | display: block; 63 | width:100%; 64 | text-align: center; 65 | height:50px; 66 | line-height:50px; 67 | font-size:1.3em; 68 | font-weight: bold; 69 | 70 | } 71 | 72 | #lockScreen .keyboard .row div { 73 | display: block; 74 | width:33.33%; 75 | float:left; 76 | border:1px solid #000; 77 | justify-content: center; 78 | text-align: center; 79 | } 80 | 81 | #lockScreen .keyboard .row div.grey { 82 | background:white; 83 | } 84 | 85 | #lockScreen .touched { 86 | background-color: white; 87 | } 88 | 89 | #lockScreen input[type="password"] { 90 | height:50px; 91 | font-size:40px; 92 | width:200px; 93 | text-align: center; 94 | 95 | } 96 | 97 | #lockScreen .icon { 98 | font-size:50px; 99 | color:white; 100 | margin-bottom: 10px; 101 | 102 | } 103 | #lockScreen .error { 104 | padding-top:10px; 105 | visibility: hidden; 106 | color:red; 107 | font-weight:bold; 108 | font-size:1.3em; 109 | } 110 | 111 | #lockScreen.round .keyboard{ 112 | bottom:10px; 113 | } 114 | 115 | #lockScreen.round .keyboard .row { 116 | display: -webkit-box; 117 | display: -moz-box; 118 | display: box; 119 | 120 | -webkit-box-align: center; 121 | -moz-box-align: center; 122 | box-align: center; 123 | 124 | -webkit-box-pack: center; 125 | -moz-box-pack: center; 126 | box-pack: center; 127 | margin-bottom:20px; 128 | 129 | } 130 | 131 | #lockScreen.round .keyboard .row div { 132 | -moz-box-flex: 0; 133 | -webkit-box-flex: 0; 134 | -ms-box-flex: 0; 135 | box-flex: 0; 136 | -moz-box-ordinal-group: 1; 137 | -webkit-box-ordinal-group: 1; 138 | -ms-box-ordinal-group: 1; 139 | box-ordinal-group: 1; 140 | float:none; 141 | width:60px; 142 | height:60px; 143 | border-radius:60px; 144 | line-height:60px; 145 | margin:10px; 146 | cursor:pointer; 147 | 148 | } 149 | 150 | #lockScreen.round input[type="password"] { 151 | height:50px; 152 | font-size:40px; 153 | width:200px; 154 | text-align: center; 155 | background: transparent; 156 | color:white; 157 | } 158 | 159 | #lockScreen.round input[type="password"]::-webkit-input-placeholder { 160 | color: white; 161 | } 162 | 163 | 164 | #lockScreen.round input[type="password"]::-moz-placeholder { /* Firefox 19+ */ 165 | color: white; 166 | } 167 | 168 | #lockScreen.round input[type="password"]:-ms-input-placeholder { 169 | color: white; 170 | } 171 | 172 | #lockScreen.round .keyboard .row div.grey { 173 | background:transparent; 174 | border:none; 175 | } -------------------------------------------------------------------------------- /test/toasts.test.js: -------------------------------------------------------------------------------- 1 | describe("toast",function(){ 2 | before(function(){ 3 | $("#toasttest").remove(); 4 | $(document.body).append("
"); 5 | $("#toasttest").append(__html__['test/fixtures/toast.html']); 6 | $.afui.isLaunching=false; 7 | $.afui.hasLaunched=true; 8 | $.afui.launchCompleted=false; 9 | $.afui.defaultPanel=null; 10 | $.afui.activeDiv=null; 11 | $.afui.launch(); 12 | }); 13 | 14 | after(function(){ 15 | $("#toasttest").remove(); 16 | }); 17 | 18 | 19 | it("should display a toast and auto hide",function(done){ 20 | 21 | var msg="Hello 1"; 22 | $(document.body).toast({message:msg,delay:100}); 23 | setTimeout(function(){ 24 | $('.afToastContainer').find(".afToast div").html().should.eql(msg); 25 | setTimeout(function(){ 26 | expect( $('.afToastContainer').find(".afToast").length===0).to.be.true; 27 | done(); 28 | },500); 29 | },50); 30 | }); 31 | it("should display a toast and stay open",function(done){ 32 | 33 | var msg="Hello 2"; 34 | $(document.body).toast({message:msg,autoClose:false}); 35 | setTimeout(function(){ 36 | $('.afToastContainer').find(".afToast div").html().should.eql(msg); 37 | setTimeout(function(){ 38 | expect( $('.afToastContainer').find(".afToast").length===1).to.be.true; 39 | done(); 40 | },500); 41 | },50); 42 | }); 43 | 44 | it("should close a toast by clicking it",function(done){ 45 | expect( $('.afToastContainer').find(".afToast").length===1).to.be.true; 46 | $('.afToastContainer').find(".afToast").trigger("click"); 47 | setTimeout(function(){ 48 | expect( $('.afToastContainer').find(".afToast").length===0).to.be.true; 49 | done(); 50 | },350); 51 | }); 52 | it("should not animate hiding",function(done){ 53 | var msg="Hello 2"; 54 | $.os.android=true; 55 | $(document.body).toast({message:msg,autoClose:true,delay:100}); 56 | setTimeout(function(){ 57 | $('.afToastContainer').find(".afToast div").html().should.eql(msg); 58 | setTimeout(function(){ 59 | expect( $('.afToastContainer').find(".afToast").length===0).to.be.true; 60 | $.os.android=false; 61 | done(); 62 | },300); 63 | },50); 64 | }); 65 | 66 | it("should be bottom center with warning class",function(done){ 67 | var msg="Hello 6"; 68 | $(document.body).toast({message:msg,autoClose:true,delay:100,position:"bc",type:"warning"}); 69 | setTimeout(function(){ 70 | var elem=$('.afToastContainer').find(".afToast"); 71 | expect(elem.hasClass("warning")).to.be.true; 72 | expect(elem.parent().hasClass("bc")).to.be.true; 73 | setTimeout(function(){ 74 | expect( $('.afToastContainer').find(".afToast").length===0).to.be.true; 75 | done(); 76 | },500); 77 | },50); 78 | }); 79 | 80 | it("should launch and dispatch ready function",function(done){ 81 | 82 | $.afui.ready(function(){ 83 | done(); 84 | }); 85 | $.afui.launch(); 86 | 87 | }); 88 | it("should use the data directive for a toast",function(done){ 89 | var item=$("#toasttest").find("a").eq(1); 90 | item.trigger("click"); 91 | 92 | setTimeout(function(){ 93 | $('.afToastContainer').find(".afToast div").html().should.eql(item.attr("data-message")); 94 | var elem=$('.afToastContainer').find(".afToast"); 95 | expect(elem.hasClass(item.attr("data-type"))).to.be.true; 96 | expect(elem.parent().hasClass(item.attr("data-position"))).to.be.true; 97 | $('.afToastContainer').find(".afToast div").trigger("click"); 98 | setTimeout(function(){ 99 | expect( $('.afToastContainer').find(".afToast").length===0).to.be.true; 100 | done(); 101 | },500); 102 | },50); 103 | }) 104 | 105 | }); -------------------------------------------------------------------------------- /test/drawer.test.js: -------------------------------------------------------------------------------- 1 | describe("drawerTests",function(){ 2 | 3 | before(function(){ 4 | $.afui.hasLaunched=false; 5 | $("#drawertest").remove(); 6 | $(document.body).append(""); 7 | 8 | $("#drawertest").append(__html__['test/fixtures/drawer.html']); 9 | $.afui.isLaunching=false; 10 | $.afui.hasLaunched=true; 11 | $.afui.launchCompleted=false; 12 | $.afui.defaultPanel=null; 13 | $.afui.activeDiv=null; 14 | $.afui.launch(); 15 | 16 | }); 17 | 18 | after(function(){ 19 | $("#drawertest").remove(); 20 | }); 21 | it("should wait for afui read",function(done){ 22 | $.afui.ready(function(){ 23 | done(); 24 | }); 25 | }); 26 | 27 | it("should show left menu by cover js call",function(done){ 28 | //$("#leftcover").trigger("click"); 29 | $.afui.drawer.show("#left","left","cover"); 30 | setTimeout(function(){ 31 | 32 | expect($("#left").hasClass("active")).to.be.true; 33 | done(); 34 | },500); 35 | }); 36 | 37 | it("should close the left menu",function(done){ 38 | $.afui.drawer.hide('#left'); 39 | setTimeout(function(){ 40 | expect($("#left").hasClass("active")).to.be.false; 41 | done(); 42 | },500); 43 | }); 44 | it("should show left menu by push data directive",function(done){ 45 | $("#leftpush").trigger("click"); 46 | setTimeout(function(){ 47 | expect($("#left").hasClass("active")).to.be.true; 48 | expect($($.afui.activeDiv).closest('.view').find('.slide-left-out').length===3).to.be.true 49 | done(); 50 | },500); 51 | }); 52 | 53 | it("should close the left menu by data directive",function(done){ 54 | $("#hideactive").trigger("click"); 55 | setTimeout(function(){ 56 | expect($("#left").hasClass("active")).to.be.false; 57 | done(); 58 | },500); 59 | }); 60 | 61 | it("should show right menu by cover js call",function(done){ 62 | //$("#leftcover").trigger("click"); 63 | $.afui.drawer.show("#right","right","reveal"); 64 | setTimeout(function(){ 65 | expect($("#right").hasClass("active")).to.be.true; 66 | expect($($.afui.activeDiv).closest('.view').find('.slide-right-out').length===3).to.be.true 67 | done(); 68 | },500); 69 | }); 70 | 71 | it("should close the right menu",function(done){ 72 | $("#hideright").trigger("click"); 73 | setTimeout(function(){ 74 | expect($("#right").hasClass("active")).to.be.false; 75 | done(); 76 | },500); 77 | }); 78 | 79 | it("should show left menu and auto hide",function(done){ 80 | //$("#leftcover").trigger("click"); 81 | $.afui.drawer.show("#left","left","reveal"); 82 | setTimeout(function(){ 83 | expect($("#left").hasClass("active")).to.be.true; 84 | $.afui.drawer.hide(); 85 | setTimeout(function(){ 86 | expect($("#left").hasClass("active")).to.be.false; 87 | done(); 88 | },500); 89 | },500); 90 | }); 91 | 92 | it("should show left",function(done){ 93 | //$("#leftcover").trigger("click"); 94 | $.afui.drawer.show("#left","left","reveal"); 95 | setTimeout(function(){ 96 | done(); 97 | },500); 98 | }); 99 | it("should hide left when showing right",function(done){ 100 | //$("#leftcover").trigger("click"); 101 | expect($("#left").hasClass("active")).to.be.true; 102 | $.afui.drawer.show("#right","right","reveal"); 103 | setTimeout(function(){ 104 | expect($("#right").hasClass("active")).to.be.true; 105 | expect($("#left").hasClass("active")).to.be.false; 106 | done(); 107 | },500); 108 | }); 109 | 110 | it("should do nothing when already shown",function(done){ 111 | //$("#leftcover").trigger("click"); 112 | $.afui.drawer.show("#left","left","reveal"); 113 | setTimeout(function(){ 114 | $.afui.drawer.show("#left","left","reveal"); 115 | done(); 116 | },500); 117 | }); 118 | }); -------------------------------------------------------------------------------- /src/af.toast.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | (function ($) { 6 | "use strict"; 7 | $.fn.toast = function (opts) { 8 | return new Toast(this[0], opts); 9 | }; 10 | var Toast = (function () { 11 | var Toast = function (containerEl, opts) { 12 | 13 | if (typeof containerEl === "string" || containerEl instanceof String) { 14 | this.container = document.getElementById(containerEl); 15 | } else { 16 | this.container = containerEl; 17 | } 18 | if (!this.container) { 19 | window.alert("Error finding container for toast " + containerEl); 20 | return; 21 | } 22 | if (typeof (opts) === "string" || typeof (opts) === "number") { 23 | opts = { 24 | message: opts 25 | }; 26 | } 27 | this.addCssClass = opts.addCssClass ? opts.addCssClass : ""; 28 | this.message = opts.message || ""; 29 | this.delay=opts.delay||this.delay; 30 | this.position=opts.position||""; 31 | this.addCssClass+=" "+this.position; 32 | this.type=opts.type||""; 33 | //Check if the container exists 34 | this.container=$(this.container); 35 | if(this.container.find(".afToastContainer").length===0) 36 | { 37 | this.container.append(""); 38 | } 39 | this.container=this.container.find(".afToastContainer"); 40 | this.container.removeClass("tr br tl bl tc bc").addClass(this.addCssClass); 41 | if(opts.autoClose===false) 42 | this.autoClose=false; 43 | this.show(); 44 | }; 45 | 46 | Toast.prototype = { 47 | addCssClass: null, 48 | message: null, 49 | delay:5000, 50 | el:null, 51 | container:null, 52 | timer:null, 53 | autoClose:true, 54 | show: function () { 55 | var self = this; 56 | var markup = "This is detail view for Item 1
63 |This is detail view for Item 2
67 |This is detail view for Item 3
71 |This is detail view for Item 4
75 |This is detail view for Item 5
79 |This is detail view for Item 6
83 |This is detail view for Item 7
87 |This is detail view for Item 8
91 |This is detail view for Item 9
95 |This is detail view for Item 10
99 |This is detail view for Item 11
103 |This is detail view for Item 12
107 |