Skip to content

Commit

Permalink
Finalize new file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
t4t5 committed Apr 16, 2015
1 parent 056d367 commit 40dcb0a
Show file tree
Hide file tree
Showing 30 changed files with 2,091 additions and 2,214 deletions.
4 changes: 1 addition & 3 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"define"
],
"browser": true,
"strict": true,
"esnext": true,
"validthis": true,
"node": true
"validthis": true
}
56 changes: 37 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#SweetAlert
SweetAlert
==========

An awesome replacement for JavaScript's alert.

![A success modal](https://raw.github.com/t4t5/sweetalert/master/sweetalert.gif)

[See it in action!](http://tristanedwards.me/sweetalert)
[See it in action!](http://t4t5.github.io/sweetalert)

[Learn how to use it!](https://www.ludu.co/lesson/how-to-use-sweetalert)

#Usage

Usage
-----

You can install SweetAlert through bower:

Expand All @@ -25,15 +28,20 @@ npm install sweetalert
Alternatively, download the package and reference the JavaScript and CSS files manually:

```html
<script src="lib/sweet-alert.min.js"></script>
<link rel="stylesheet" type="text/css" href="lib/sweet-alert.css">
<script src="dist/sweetalert.min.js"></script>
<link rel="stylesheet" type="text/css" href="dist/sweetalert.css">
```
**Note:** If you're using an older version than v1.0.0, the files are `lib/sweet-alert.min.js` and `lib/sweet-alert.css`


#Tutorial
Tutorial
--------

The easiest way to get started is follow the [SweetAlert tutorial on Ludu](https://www.ludu.co/lesson/how-to-use-sweetalert)!

#Examples

Examples
--------

The most basic message:

Expand Down Expand Up @@ -81,14 +89,25 @@ sweerAlert({
});
```

[View more examples](http://tristanedwards.me/sweetalert)
[View more examples](http://t4t5.github.io/sweetalert)


Themes
------

SweetAlert can easily be themed to fit your site's design. SweetAlert comes with three example themes that you can try out: **facebook**, **twitter** and **google**. They can be referenced right after the intial sweetalert-CSS:
```html
<link rel="stylesheet" href="dist/sweetalert.css">
<link rel="stylesheet" href="themes/twitter/twitter.css">
```


#Browser compatibility
Browser compatibility
---------------------

SweetAlert works in all major browsers (yes, even IE). Some details:
SweetAlert works in most major browsers (yes, even IE). Some details:

- **IE8**: Works, but icons (checkmark, x-mark...) are hidden.
- **IE8**: (Dropped since v1.0.0-beta)
- **IE9**: Works, but icons are not animated.
- **IE10+**: Works!
- **Safari 4+**: Works!
Expand All @@ -97,23 +116,22 @@ SweetAlert works in all major browsers (yes, even IE). Some details:
- **Opera 15+**: Works!


#Contributing
Contributing
------------

If you want to contribute:

- Fork the repo

- Make sure you have [Node](http://nodejs.org/), [NPM](https://www.npmjs.com/) and [Gulp](http://gulpjs.com/) installed. When in the SweetAlert directory, run the command:
```
npm install
```
to install the dependencies. Then run ```gulp``` while working to automatically minify the SCSS and JS-files.
- Make sure you have [Node](http://nodejs.org/), [NPM](https://www.npmjs.com/) and [Gulp](http://gulpjs.com/) installed. When in the SweetAlert directory, run `npm install` to install the dependencies. Then run `gulp` while working to automatically minify the SCSS and JS-files.

- After you're done, make a pull request and wait for approval! :)
- Keep in min that SweetAlert uses Browserify in order to compile ES6-files. For easy debugging, make sure you reference the file `dist/sweetalert-dev.js` instead of `sweetalert.js`.

- After you're done, make a pull request and wait for approval! :)


#Related projects
Related projects
----------------

* [SweetAlert for Android](https://github.com/pedant/sweet-alert-dialog)
* [SweetAlert for Bootstrap](https://github.com/lipis/bootstrap-sweetalert)
Expand Down
10 changes: 5 additions & 5 deletions lib/ie9.css → dev/ie9.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
/* This file is automatically merged into sweet-alert.min.js through Gulp */

/* Error icon */
.sweet-alert .icon.error .line.left {
.sweet-alert .sa-icon.sa-error .sa-line.sa-left {
-ms-transform: rotate(45deg)\9;
}
.sweet-alert .icon.error .line.right {
.sweet-alert .sa-icon.sa-error .sa-line.sa-right {
-ms-transform: rotate(-45deg)\9;
}


/* Success icon */
.sweet-alert .icon.success {
.sweet-alert .sa-icon.sa-success {
border-color: transparent\9;
}
.sweet-alert .icon.success .line.tip {
.sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
-ms-transform: rotate(45deg)\9;
}
.sweet-alert .icon.success .line.long {
.sweet-alert .sa-icon.sa-success .sa-line.sa-long {
-ms-transform: rotate(-45deg)\9;
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/handle-dom.js → dev/modules/handle-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ export {
fadeIn, fadeOut,
fireClick,
stopEventPropagation
}
};
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/handle-swal-dom.js → dev/modules/handle-swal-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ export {
resetInput,
resetInputError,
fixVerticalPosition
}
};
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/set-params.js → dev/modules/set-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ var setParameters = function(params) {
* Timer
*/
modal.setAttribute('data-timer', params.timer);
}
};

export default setParameters;
2 changes: 1 addition & 1 deletion lib/utils.js → dev/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ export {
isIE8,
logStr,
colorLuminance
}
};
16 changes: 7 additions & 9 deletions lib/sweet-alert.js → dev/sweetalert.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// 2014-2015 (c) - Tristan Edwards
// github.com/t4t5/sweetalert

"use strict";

/*
* jQuery-like functions for manipulating the DOM
*/
Expand All @@ -16,7 +14,7 @@ import {
fadeIn, fadeOut,
fireClick,
stopEventPropagation
} from './handle-dom';
} from './modules/handle-dom';

/*
* Handy utilities
Expand All @@ -27,7 +25,7 @@ import {
isIE8,
logStr,
colorLuminance
} from './utils';
} from './modules/utils';

/*
* Handle sweetAlert's DOM elements
Expand All @@ -41,17 +39,17 @@ import {
openModal,
resetInput,
fixVerticalPosition
} from './handle-swal-dom';
} from './modules/handle-swal-dom';


// Handle button events and keyboard events
import { handleButton, handleConfirm, handleCancel } from './handle-click';
import handleKeyDown from './handle-key';
import { handleButton, handleConfirm, handleCancel } from './modules/handle-click';
import handleKeyDown from './modules/handle-key';


// Default values
import defaultParams from './default-params';
import setParameters from './set-params';
import defaultParams from './modules/default-params';
import setParameters from './modules/set-params';

/*
* Remember state in cases where opening and handling a modal will fiddle with it.
Expand Down
File renamed without changes.
Loading

0 comments on commit 40dcb0a

Please sign in to comment.