diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..48c00d3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[package.json] +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5bbff15 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +/bower_components/ diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6da44f0 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,18 @@ +{ + "node": true, + "browser": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 4, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": true +} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e98eb38 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - '0.10' +before_script: + - 'npm install -g bower grunt-cli' + - 'bower install' \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..5903ea6 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,117 @@ +'use strict'; +module.exports = function (grunt) { + // Load all grunt tasks + require('load-grunt-tasks')(grunt); + // Show elapsed time at the end + require('time-grunt')(grunt); + + // Project configuration. + grunt.initConfig({ + // Metadata. + pkg: grunt.file.readJSON('package.json'), + banner: '/*! angular-flash - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed MIT */\n', + // Task configuration. + clean: { + files: ['dist'] + }, + concat: { + options: { + banner: '<%= banner %>', + stripBanners: true + }, + basic: { + src: ['src/angular-flash.js'], + dest: 'dist/angular-flash.js' + }, + extras: { + src: ['src/angular-flash.css'], + dest: 'dist/angular-flash.css' + } + }, + uglify: { + options: { + banner: '<%= banner %>' + }, + dist: { + src: 'src/angular-flash.js', + dest: 'dist/angular-flash.min.js' + } + }, + cssmin: { + target: { + files: [{ + expand: true, + cwd: 'src', + src: ['*.css', '!*.min.css'], + dest: 'dist', + ext: '.min.css' + }] + } + }, + qunit: { + all: { + options: { + urls: ['http://localhost:9000/test/angular-flash.html'] + } + } + }, + jshint: { + options: { + reporter: require('jshint-stylish') + }, + gruntfile: { + options: { + jshintrc: '.jshintrc' + }, + src: 'Gruntfile.js' + }, + src: { + options: { + jshintrc: 'src/.jshintrc' + }, + src: ['src/**/*.js'] + }, + test: { + options: { + jshintrc: 'test/.jshintrc' + }, + src: ['test/**/*.js'] + } + }, + watch: { + gruntfile: { + files: '<%= jshint.gruntfile.src %>', + tasks: ['jshint:gruntfile'] + }, + src: { + files: '<%= jshint.src.src %>', + tasks: ['jshint:src', 'qunit'] + }, + test: { + files: '<%= jshint.test.src %>', + tasks: ['jshint:test', 'qunit'] + } + }, + connect: { + server: { + options: { + hostname: '*', + port: 9000 + } + } + } + }); + + // Default task. + grunt.registerTask('default', ['jshint', 'connect', 'qunit', 'clean', 'concat', 'uglify', 'cssmin']); + grunt.registerTask('server', function () { + grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); + grunt.task.run(['serve']); + }); + grunt.registerTask('serve', ['connect', 'watch']); + grunt.registerTask('test', ['jshint', 'connect', 'qunit']); +}; \ No newline at end of file diff --git a/README.md b/README.md index abe52f8..1c8f9cd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ -angular-flash -============= +![license](https://img.shields.io/npm/l/angular-flash-alert.svg) +![travis](https://travis-ci.org/sachinchoolur/angular-flash.svg?branch=master) +![bower](https://img.shields.io/bower/v/angular-flash-alert.svg) +![npm](https://img.shields.io/npm/v/angular-flash-alert.svg) +# angular-flash Demo @@ -8,7 +11,23 @@ Demo -#### How to use angular-flash? #### +How to use +--- +#### Bower + +You can Install angular-flash using the [Bower](http://bower.io) package manager. + +```sh +$ bower install angular-flash-alert --save +``` + +#### npm + +You can also find angular-flash on [npm](http://npmjs.org) + +```sh +$ npm install angular-flash-alert +``` Add the Following code to the <head> of your document. ```html @@ -34,7 +53,7 @@ Inject the `Flash` factory in your controller myApp.controller('demoCtrl', ['Flash', function(Flash) { $scope.successAlert = function () { var message = 'Well done! You successfully read this important alert message.'; - Flash.add('success', message, 'custom-class'); + Flash.create('success', message, 'custom-class'); // First argument (success) is the type of the flash alert // Second argument (message) is the message displays in the flash alert // you can inclide html as message (not just text) @@ -55,3 +74,6 @@ Flash.pause(); Flash.dismiss() // Dismiss the flash ``` +#### [guidelines for contributors](https://github.com/sachinchoolur/angular-flash-alert/blob/master/contributing.md) + +#### MIT © [Sachin](https://twitter.com/sachinchoolur) \ No newline at end of file diff --git a/angular-flash.min.js b/angular-flash.min.js deleted file mode 100644 index 47d4b22..0000000 --- a/angular-flash.min.js +++ /dev/null @@ -1 +0,0 @@ -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('!2(){"y 13";k t=12.Z("3",[]);t.Y(2(t){t.3={},t.3.g="",t.3.7="",t.3.8=M,t.5=!1}),t.f("j",2(t){6{o:"A",L:!0,b:2(s,n,a){s.$K(a.j,2(a){n.F(a),t(n.E())(s)})}}}),t.f("C",2(t,s){6{b:2(t,n){n.B("P",2(){s.v()})}}}),t.f("w",2(t,s){6{o:"A",16:\' <4 j="3.g"> <4 N-O="x">&Q;<4 h="R-S">T \',b:2(t,n,a){s.3.8=U(a.w,10)}}}),t.V("W",["$X","$8",2(t,s){k n,a={},e=0,l=!1;6 a.11=2(a,i,c){t.3.7=a,t.3.g=i,t.3.p=c,l=!1,s(2(){t.5=!0},14),e++,n=s(2(){l===!1&&(1==e&&s(2(){t.5=!1}),e--)},t.3.8)},a.15=2(){e=0,s.q(n),l=!0},a.v=2(){s.q(n),l=!0,e=0,s(2(){t.5=!1})},a}])}();',62,69,'||function|flash|span|hasFlash|return|type|timeout|alert||link||button||directive|text|class||dynamic|var||close||restrict|addClass|cancel|ng|||div|dismiss|flashMessage|true|use|role||on|closeFlash|show|contents|html|dismissible|hide|alertIn|alertOut|watch|replace|5e3|aria|hidden|click|times|sr|only|Close|parseInt|factory|Flash|rootScope|run|module||create|angular|strict|100|pause|template'.split('|'),0,{})) \ No newline at end of file diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..9cb0266 --- /dev/null +++ b/bower.json @@ -0,0 +1,28 @@ +{ + "name": "angular-flash-alert", + "version": "1.0.0", + "homepage": "https://github.com/sachinchoolur/angular-flash", + "authors": [ + "Sachin N " + ], + "description": "Flash message for angularjs", + "main": "dist/angular-flash.js", + "keywords": [ + "angular-flash", + "flash", + "message", + "alert", + "angularjs", + "bootstrap" + ], + "dependencies": { + "angular": ">=1.2.0" + }, + "devDependencies": { + "qunit": "~1.12.0" + }, + "ignore": [ + "README.md", + "demo" + ] +} diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..e9a8b47 --- /dev/null +++ b/contributing.md @@ -0,0 +1,32 @@ +# Contributing + +## Important notes +Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory! + +### Code style +Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** + +### PhantomJS +While Grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers. + +## Modifying the code +First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed. + +Test that Grunt's CLI and Bower are installed by running `grunt --version` and `bower --version`. If the commands aren't found, run `npm install -g grunt-cli bower`. For more information about installing the tools, see the [getting started with Grunt guide](http://gruntjs.com/getting-started) or [bower.io](http://bower.io/) respectively. + +1. Fork and clone the repo. +1. Run `npm install` to install all build dependencies (including Grunt). +1. Run `bower install` to install the front-end dependencies. +1. Run `grunt` to grunt this project. + +Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken. + +## Submitting pull requests + +1. Create a new branch, please don't work in your `master` branch directly. +1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail. +1. Fix stuff. +1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done. +1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere. +1. Update the documentation to reflect any changes. +1. Push to your fork and submit a pull request. diff --git a/demo/images/bg_hr.png b/demo/images/bg_hr.png new file mode 100644 index 0000000..514aee5 Binary files /dev/null and b/demo/images/bg_hr.png differ diff --git a/demo/images/blacktocat.png b/demo/images/blacktocat.png new file mode 100644 index 0000000..e160053 Binary files /dev/null and b/demo/images/blacktocat.png differ diff --git a/demo/images/body-bg.png b/demo/images/body-bg.png new file mode 100644 index 0000000..5e8c4c2 Binary files /dev/null and b/demo/images/body-bg.png differ diff --git a/demo/images/highlight-bg.jpg b/demo/images/highlight-bg.jpg new file mode 100644 index 0000000..355e089 Binary files /dev/null and b/demo/images/highlight-bg.jpg differ diff --git a/demo/images/hr.png b/demo/images/hr.png new file mode 100644 index 0000000..d32f689 Binary files /dev/null and b/demo/images/hr.png differ diff --git a/demo/images/icon_download.png b/demo/images/icon_download.png new file mode 100644 index 0000000..5a793f1 Binary files /dev/null and b/demo/images/icon_download.png differ diff --git a/demo/images/octocat-icon.png b/demo/images/octocat-icon.png new file mode 100644 index 0000000..2406608 Binary files /dev/null and b/demo/images/octocat-icon.png differ diff --git a/demo/images/sprite_download.png b/demo/images/sprite_download.png new file mode 100644 index 0000000..f9f8de2 Binary files /dev/null and b/demo/images/sprite_download.png differ diff --git a/demo/images/tar-gz-icon.png b/demo/images/tar-gz-icon.png new file mode 100644 index 0000000..502e67d Binary files /dev/null and b/demo/images/tar-gz-icon.png differ diff --git a/demo/images/zip-icon.png b/demo/images/zip-icon.png new file mode 100644 index 0000000..732aced Binary files /dev/null and b/demo/images/zip-icon.png differ diff --git a/demo/index.html b/demo/index.html new file mode 100644 index 0000000..0e0eb96 --- /dev/null +++ b/demo/index.html @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + Angular-flash + + + + + +
+
+ View on GitHub + +

Angular-flash

+

Flash message for angularjs

+ + + + + + +
+ Download this project as a .zip file + Download this project as a tar.gz file +
+
+
+ + +
+
+
+

Demo

+

Flash message for angularjs

+
+ + + + + +
+
+

Another Demo

+
+
    +
  • +
    + {{list.content}} + + Delete + +
    +
  • +
    +
    + + + add + +
    +
    +
+
+
+
+

+ How to use angular-flash?

+

Add the Following code to the of your document.

+
+<link type="text/css" rel="stylesheet" href="css/angular-flash.min.css" />
+// If you are using bootstrap v3 no need to include angular-flash.css
+<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
+<script src="angular-flash.min.js"></script>
+// Do not include both angular-flash.js and angular-flash.min.js
+    
+

Add flash dependency to your module

+
+var myApp = angular.module("app", ["flash"]);
+

Include flash-message="5000" directive in your html template.

+
+<div flash-message="5000" ></div> 
+// 5000 milli-secs is the display duration.
+// Flash alert will be automatically dismissed after 5000 milli-secs.
+

Inject the Flash factory in your controller

+
+myApp.controller('demoCtrl', ['Flash', function(Flash) {
+  $scope.successAlert = function () {
+    var message = '<strong> Well done!</strong>  You successfully read this important alert message.';
+    Flash.create('success', message, 'custom-class');
+    // First argument (success) is the type of the flash alert
+    // Second argument (message) is the message displays in the flash alert
+    // You can inclide html as message (not just text)
+    // Third argument (custom-class) is the custom class for the perticular flash alert
+  }
+}]);
+ +
+
+

Flash alert types

+
    +
  • success
  • +
  • info
  • +
  • warning
  • +
  • danger
  • +
+
+ +
+

Methods

+
+Flash.pause()
+// Pause flash auto dismiss.
+Flash.dismiss()
+// Dismiss the flash
+
+ +
+

Bootstrap

+

Angular-flash is fully compatible with twitter bootstrap. It uses standard bootstrap classes. If bootstrap css is already included in your document then no need to include angular-flash.css in your document

+
+ +
+

ngAnimate

+

If you want animations include ngAnimate module. you can use inbuilt classes .alertIn and .alertOut for applying css

+
+var myApp = angular.module("app", ["flash", "ngAnimate"]);
+
+
+.alertIn, .alertOut {...}
+.alertIn.ng-hide-remove, .alertOut.ng-hide-add.ng-hide-add-active {...}
+.alertOut.ng-hide-add, .alertIn.ng-hide-remove.ng-hide-remove-active {...}
+
+
+
+

Edit on Codepen

+

See the Pen Flash message for AngularJS by Sachin choolur (@sachinchoolur) on CodePen.

+ +
+
+ + + + +
+
+

Like angular-flash? you may also like

+ +
+
+ + + + + + +
+
+ +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/javascripts/main.js b/demo/javascripts/main.js new file mode 100644 index 0000000..415c743 --- /dev/null +++ b/demo/javascripts/main.js @@ -0,0 +1,150 @@ +$.fn.putCursorAtEnd = function () { + + return this.each(function () { + + $(this).focus(); + + // If this function exists... + if (this.setSelectionRange) { + // ... then use it (Doesn't work in IE) + + // Double the length because Opera is inconsistent about whether a carriage return is one character or two. Sigh. + var len = $(this).val().length * 2; + + this.setSelectionRange(len, len); + + } else { + // ... otherwise replace the contents with itself + // (Doesn't work in Google Chrome) + + $(this).val($(this).val()); + + } + + // Scroll to the bottom, in case we're in a tall textarea + // (Necessary for Firefox and Google Chrome) + this.scrollTop = 999999; + + }); + +}; + + +// Demo controller +var app = angular.module('demoApp', ['flash', 'ngAnimate']); +app.controller('FlashDemoCtrl', ['$rootScope', '$scope', 'Flash', '$timeout', function ($rootScope, $scope, Flash, $timeout) { + $scope.success = function () { + var message = 'Well done! You successfully read this important alert message.'; + Flash.create('success', message); + }; + $scope.info = function () { + var message = 'Heads up! This alert needs your attention, but it\'s not super important.'; + Flash.create('info', message); + }; + $scope.warning = function () { + var message = 'Warning! Better check yourself, you\'re not looking too good.'; + Flash.create('warning', message); + }; + $scope.danger = function () { + var message = 'Oh snap! Change a few things up and try submitting again.'; + Flash.create('danger', message); + }; + $scope.pause = function () { + Flash.pause(); + }; + + function addMinutes(minutes) { + var d1 = new Date(), + d2 = new Date(d1); + d2.setMinutes(d1.getMinutes() - minutes); + return d2; + } + + $scope.editing = {}; + + $scope.lists = [{ + content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', + createdOn: addMinutes(30) + }, { + content: 'Ut rhoncus tortor eu mollis viverra.', + createdOn: addMinutes(20) + }, { + content: 'Nulla commodo arcu id turpis fermentum fringilla.', + createdOn: addMinutes(10) + } + + ]; + + $scope.lastAdded = []; + + + $scope.add = function () { + $scope.lastAdded = { + content: $scope.newList, + createdOn: new Date() + }; + $scope.lists.push($scope.lastAdded); + $scope.newList = ''; + var message = "List Created! The list " + $scope.lastAdded.content + " has been created. Undo"; + Flash.create('danger', message, 'customAlert'); + }; + + $scope.delete = function (item) { + $scope.deletedItem = item; + $scope.lists.splice($scope.lists.indexOf(item), 1); + var message = "List Deleted! The list " + $scope.deletedItem.content + " has been deleted. Undo"; + Flash.create('danger', message, 'customAlert'); + }; + + $scope.undoAdd = function () { + $scope.deletedItem = $scope.lastAdded; + $scope.lists.splice($scope.lists.indexOf($scope.lastAdded), 1); + var message = "List Deleted! The list " + $scope.deletedItem.content + " has been deleted."; + Flash.create('danger', message, 'customAlert'); + }; + + $scope.undoDelete = function () { + Flash.create('danger', '', 'customAlert'); + Flash.pause(); + setTimeout(function(){ + var opts = { + lines: 13, // The number of lines to draw + length: 6, // The length of each line + width: 2, // The line thickness + radius: 6, // The radius of the inner circle + corners: 1, // Corner roundness (0..1) + rotate: 0, // The rotation offset + direction: 1, // 1: clockwise, -1: counterclockwise + color: '#000', // #rgb or #rrggbb or array of colors + speed: 1, // Rounds per second + trail: 60, // Afterglow percentage + shadow: false, // Whether to render a shadow + hwaccel: false, // Whether to use hardware acceleration + className: 'spinner', // The CSS class to assign to the spinner + zIndex: 2e9, // The z-index (defaults to 2000000000) + top: '50%', // Top position relative to parent + left: '50%' // Left position relative to parent + }; + var target = document.getElementById('spinner'); + var spinner = new Spinner(opts).spin(target); + },100); + + setTimeout(function(){ + $scope.lists.push($scope.deletedItem); + var message = "List Restored! The list '" + $scope.deletedItem.content + "' has been restored."; + Flash.create('danger', message, 'customAlert'); + },800); + }; + + $('#newList').on('keypress', function (e) { + if ($(this).val() !== '') { + if (e.which == 13) { + $timeout(function () { + $scope.add(); + return false; + }, 100); + } + } + }); + +}]); \ No newline at end of file diff --git a/demo/javascripts/prettify.js b/demo/javascripts/prettify.js new file mode 100644 index 0000000..1aedb74 --- /dev/null +++ b/demo/javascripts/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p .pln, a> .pun{ + color:#CD3420; +} + +.prettyprint { + background-color: #F7F7F9; + border: 1px solid #E8E8E8; + font-size: 12px; + padding: 8px; + white-space:pre-wrap; +} + +/* Specify class=linenums on a pre to get line numbering */ + +ol.linenums { + margin: 0; + padding-left: 33px; + list-style-position: outside; +} +ol.linenums li { + padding-left: 12px; + color: #bebec5; + line-height: 20px; + text-shadow: 0 1px 0 #fff; +} \ No newline at end of file diff --git a/demo/stylesheets/stylesheet.css b/demo/stylesheets/stylesheet.css new file mode 100644 index 0000000..5e9b616 --- /dev/null +++ b/demo/stylesheets/stylesheet.css @@ -0,0 +1,557 @@ +/******************************************************************************* +Slate Theme for GitHub Pages +by Jason Costello, @jsncostello +*******************************************************************************/ + + +/******************************************************************************* +MeyerWeb Reset +*******************************************************************************/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font: inherit; + vertical-align: baseline; +} + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} + +ol, ul { + list-style: none; +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +/******************************************************************************* +Theme Styles +*******************************************************************************/ + +body { + box-sizing: border-box; + color:#373737; + background: #212121; + font-size: 16px; + font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif; + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} + +h1, h2, h3, h4, h5, h6 { + margin: 10px 0; + font-weight: 700; + color:#222222; + font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif; + letter-spacing: -1px; +} + +h1 { + font-size: 36px; + font-weight: 700; +} + +h2 { + padding-bottom: 10px; + font-size: 32px; + background: url('../images/bg_hr.png') repeat-x bottom; +} + +h3 { + font-size: 24px; +} + +h4 { + font-size: 21px; +} + +h5 { + font-size: 18px; +} + +h6 { + font-size: 16px; +} + +p { + margin: 10px 0 15px 0; +} + +footer p { + color: #f2f2f2; +} + +a { + text-decoration: none; + color: #007edf; + text-shadow: none; + + transition: color 0.5s ease; + transition: text-shadow 0.5s ease; + -webkit-transition: color 0.5s ease; + -webkit-transition: text-shadow 0.5s ease; + -moz-transition: color 0.5s ease; + -moz-transition: text-shadow 0.5s ease; + -o-transition: color 0.5s ease; + -o-transition: text-shadow 0.5s ease; + -ms-transition: color 0.5s ease; + -ms-transition: text-shadow 0.5s ease; +} + +a:hover, a:focus {text-decoration: underline;} + +footer a { + color: #F2F2F2; + text-decoration: underline; +} + +em { + font-style: italic; +} + +strong { + font-weight: bold; +} + +img { + position: relative; + margin: 0 auto; + max-width: 739px; + padding: 5px; + margin: 10px 0 10px 0; + border: 1px solid #ebebeb; + + box-shadow: 0 0 5px #ebebeb; + -webkit-box-shadow: 0 0 5px #ebebeb; + -moz-box-shadow: 0 0 5px #ebebeb; + -o-box-shadow: 0 0 5px #ebebeb; + -ms-box-shadow: 0 0 5px #ebebeb; +} + +p img { + display: inline; + margin: 0; + padding: 0; + vertical-align: middle; + text-align: center; + border: none; +} + +pre, code { + width: 100%; + color: #222; + background-color: #fff; + + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + font-size: 14px; + + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +pre { + width: 100%; + padding: 10px; + box-shadow: 0 0 10px rgba(0,0,0,.1); + overflow: auto; +} + +code { + padding: 3px; + margin: 0 3px; + box-shadow: 0 0 10px rgba(0,0,0,.1); +} + +pre code { + display: block; + box-shadow: none; +} + +blockquote { + color: #666; + margin-bottom: 20px; + padding: 0 0 0 20px; + border-left: 3px solid #bbb; +} + + +ul, ol, dl { + margin-bottom: 15px +} + +ul { + list-style-position: inside; + list-style: disc; + padding-left: 20px; +} + +ol { + list-style-position: inside; + list-style: decimal; + padding-left: 20px; +} + +dl dt { + font-weight: bold; +} + +dl dd { + padding-left: 20px; + font-style: italic; +} + +dl p { + padding-left: 20px; + font-style: italic; +} + +hr { + height: 1px; + margin-bottom: 5px; + border: none; + background: url('../images/bg_hr.png') repeat-x center; +} + +table { + border: 1px solid #373737; + margin-bottom: 20px; + text-align: left; + } + +th { + font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif; + padding: 10px; + background: #373737; + color: #fff; + } + +td { + padding: 10px; + border: 1px solid #373737; + } + +form { + background: #f2f2f2; + padding: 20px; +} + +/******************************************************************************* +Full-Width Styles +*******************************************************************************/ + +.outer { + width: 100%; +} + +.inner { + position: relative; + max-width: 800px; + padding: 20px 10px; + margin: 0 auto; +} + +#forkme_banner { + display: block; + position: absolute; + top:0; + right: 10px; + z-index: 10; + padding: 10px 50px 10px 10px; + color: #fff; + background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%; + font-weight: 700; + box-shadow: 0 0 10px rgba(0,0,0,.5); + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; +} + +#header_wrap { + background: #212121; + background: -moz-linear-gradient(top, #373737, #212121); + background: -webkit-linear-gradient(top, #373737, #212121); + background: -ms-linear-gradient(top, #373737, #212121); + background: -o-linear-gradient(top, #373737, #212121); + background: linear-gradient(top, #373737, #212121); +} + +#header_wrap .inner { + padding: 50px 10px 30px 10px; +} + +#project_title { + margin: 0; + color: #fff; + font-size: 42px; + font-weight: 700; + text-shadow: #111 0px 0px 10px; +} + +#project_tagline { + color: #fff; + font-size: 24px; + font-weight: 300; + background: none; + text-shadow: #111 0px 0px 10px; +} + +#downloads { + position: absolute; + width: 210px; + z-index: 10; + bottom: -40px; + right: 0; + height: 70px; + background: url('../images/icon_download.png') no-repeat 0% 90%; +} + +.zip_download_link { + display: block; + float: right; + width: 90px; + height:70px; + text-indent: -5000px; + overflow: hidden; + background: url(../images/sprite_download.png) no-repeat bottom left; +} + +.tar_download_link { + display: block; + float: right; + width: 90px; + height:70px; + text-indent: -5000px; + overflow: hidden; + background: url(../images/sprite_download.png) no-repeat bottom right; + margin-left: 10px; +} + +.zip_download_link:hover { + background: url(../images/sprite_download.png) no-repeat top left; +} + +.tar_download_link:hover { + background: url(../images/sprite_download.png) no-repeat top right; +} + +#main_content_wrap { + background: #f2f2f2; + border-top: 1px solid #111; + border-bottom: 1px solid #111; +} + +#main_content { + padding-top: 90px; + overflow: hidden; +} +.section{ + margin-bottom: 40px; +} +#footer_wrap { + background: #212121; +} + + + +/******************************************************************************* +Small Device Styles +*******************************************************************************/ + +@media screen and (max-width: 480px) { + body { + font-size:14px; + } + + #downloads { + display: none; + } + + .inner { + min-width: 320px; + max-width: 480px; + } + + #project_title { + font-size: 32px; + } + + h1 { + font-size: 28px; + } + + h2 { + font-size: 24px; + } + + h3 { + font-size: 21px; + } + + h4 { + font-size: 18px; + } + + h5 { + font-size: 14px; + } + + h6 { + font-size: 12px; + } + + code, pre { + min-width: 320px; + max-width: 480px; + font-size: 11px; + } + +} +.alert { + position: absolute; + right: 0; + top: 42px; +} +.btn{ + margin-right: 20px; +} +.mRb15{ + margin-bottom: 15px !important; +} + + +.prettyprint{ + background: none repeat scroll 0 0 #fafafa !important; + border: 1px solid rgba(0, 0, 0, 0.12) !important; +} + + +/*/ Demo */ + + +.listDemo { + list-style-type: none; + margin: 0; + padding: 0; +} +.listDemo li, .listDemo .newList { + border-top: 1px solid rgba(0, 0, 0, 0.12); + margin: 0; + padding: 12px 20px; + color: #555; + position: relative; +} +.listDemo a { + font-size: 13px; + margin-left: 5px; +} +.listDemo .action { + margin-left: 10px; + position: absolute; + right: 15px; +} +.listDemo input { + border: medium none; + box-shadow: none; + display: inline; + font-size: 16px; + height: 21px; + width: 100%; + padding: 0px; +} +.form-control::-moz-placeholder { + color: #aaa; + line-height: 1.5; + opacity: 1; +} +.form-control:-ms-input-placeholder { + color: #aaa; + line-height: 1.5; +} +.form-control::-webkit-input-placeholder { + color: #aaa; + line-height: 1.5; +} +.form-control:focus { + border-color: #bcbcbc; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + outline: 0 none; +} +a[disabled] { + background-color: #eee; + cursor: default; + opacity: 0.5; + pointer-events: none; +} + + +.listDemoCont { + background: none repeat scroll 0 0 #fafafa; + border: 1px solid rgba(0, 0, 0, 0.12); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + width: 520px; +} +.listDemo li:first-child { + border-top: 0 none; +} + + +/*/ customAlert */ +.alert.customAlert { + background-color: #fafafa; + border: 1px solid rgba(0, 0, 0, 0.12); + border-radius: 0; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + color: #666; + min-width: 403px; + padding : 20px 50px 20px 30px; + position: fixed; + right: 20px; + top: 20px; + z-index: 9999; + height: 92px; +} + +.customAlert strong { + display: block; + font-size: 16px; + margin-bottom: 5px; +} +.customAlert .close { + position: absolute !important; + right: 15px !important; + top: 5px !important; +} +.customAlert em { + color: #999; + display: inline-block; + margin: 0 5px; + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + white-space: pre; +} +.listAddCont .action{ + top: 13px; +} \ No newline at end of file diff --git a/dist/angular-flash.css b/dist/angular-flash.css new file mode 100644 index 0000000..89f6b8b --- /dev/null +++ b/dist/angular-flash.css @@ -0,0 +1,135 @@ +/*! angular-flash - v1.0.0 - 2015-03-18 +* https://github.com/sachinchoolur/angular-flash +* Copyright (c) 2015 Sachin; Licensed MIT */ +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 4px; +} +.alert h4 { + margin-top: 0; + color: inherit; +} +.alert .alert-link { + font-weight: bold; +} +.alert > p, +.alert > ul { + margin-bottom: 0; +} +.alert > p + p { + margin-top: 5px; +} +.alert-dismissable, +.alert-dismissible { + padding-right: 35px; +} +.alert-dismissable .close, +.alert-dismissible .close { + position: relative; + top: -2px; + right: -21px; + color: inherit; +} +.alert-success { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.alert-success hr { + border-top-color: #c9e2b3; +} +.alert-success .alert-link { + color: #2b542c; +} +.alert-info { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.alert-info hr { + border-top-color: #a6e1ec; +} +.alert-info .alert-link { + color: #245269; +} +.alert-warning { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.alert-warning hr { + border-top-color: #f7e1b5; +} +.alert-warning .alert-link { + color: #66512c; +} +.alert-danger { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.alert-danger hr { + border-top-color: #e4b9c0; +} +.alert-danger .alert-link { + color: #843534; +} + +.close { + float: right; + font-size: 21px; + font-weight: bold; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + filter: alpha(opacity=20); + opacity: .2; +} +.close:hover, +.close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + filter: alpha(opacity=50); + opacity: .5; +} +button.close { + -webkit-appearance: none; + padding: 0; + cursor: pointer; + background: transparent; + border: 0; +} +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} + + + +.alertIn, .alertOut { + -webkit-transition: -webkit-transform 0.22s cubic-bezier(0.25, 0, 0.25, 1), opacity 0.22s cubic-bezier(0.25, 0, 0.25, 1); + -moz-transition: -moz-transform 0.22s cubic-bezier(0.25, 0, 0.25, 1), opacity 0.22s cubic-bezier(0.25, 0, 0.25, 1); + -o-transition: -o-transform 0.22s cubic-bezier(0.25, 0, 0.25, 1), opacity 0.22s cubic-bezier(0.25, 0, 0.25, 1); + transition: transform 0.22s cubic-bezier(0.25, 0, 0.25, 1), opacity 0.22s cubic-bezier(0.25, 0, 0.25, 1); +} +.alertIn.ng-hide-remove, .alertOut.ng-hide-add.ng-hide-add-active { + opacity: 0; + -webkit-transform: translate3d(100px, 0px, 0px); + transform: translate3d(100px, 0px, 0px); + display: block !important; +} +.alertOut.ng-hide-add, .alertIn.ng-hide-remove.ng-hide-remove-active { + opacity: 1; + display: block !important; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); +} \ No newline at end of file diff --git a/angular-flash.js b/dist/angular-flash.js similarity index 81% rename from angular-flash.js rename to dist/angular-flash.js index 2fa3a81..e60e0ab 100644 --- a/angular-flash.js +++ b/dist/angular-flash.js @@ -1,3 +1,6 @@ +/*! angular-flash - v1.0.0 - 2015-03-18 +* https://github.com/sachinchoolur/angular-flash +* Copyright (c) 2015 Sachin; Licensed MIT */ (function() { 'use strict'; var app = angular.module('flash', []); @@ -28,7 +31,7 @@ // Directive for closing the flash message app.directive('closeFlash', function($compile, Flash) { return { - link: function(scope, ele, attrs) { + link: function(scope, ele) { ele.on('click', function() { Flash.dismiss(); }); @@ -52,45 +55,31 @@ function($rootScope, $timeout) { var dataFactory = {}, - num = 0, - timeOut, - canceled = false; - + timeOut; // Create flash message dataFactory.create = function(type, text, addClass) { + var $this = this; + $timeout.cancel(timeOut); $rootScope.flash.type = type; $rootScope.flash.text = text; $rootScope.flash.addClass = addClass; - canceled = false; $timeout(function() { $rootScope.hasFlash = true; }, 100); - num++; timeOut = $timeout(function() { - if (canceled === false) { - if (num == 1) { - $timeout(function() { - $rootScope.hasFlash = false; - }); - } - num--; - } + $this.dismiss(); }, $rootScope.flash.timeout); }; // Cancel flashmessage timeout function dataFactory.pause = function() { - num = 0; $timeout.cancel(timeOut); - canceled = true; }; // Dismiss flash message dataFactory.dismiss = function() { $timeout.cancel(timeOut); - canceled = true; - num = 0; $timeout(function() { $rootScope.hasFlash = false; }); diff --git a/dist/angular-flash.min.css b/dist/angular-flash.min.css new file mode 100644 index 0000000..0e2339c --- /dev/null +++ b/dist/angular-flash.min.css @@ -0,0 +1 @@ +.alert .alert-link,.close{font-weight:700}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}.close{float:right;font-size:21px;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.alertIn,.alertOut{-webkit-transition:-webkit-transform .22s cubic-bezier(.25,0,.25,1),opacity .22s cubic-bezier(.25,0,.25,1);-moz-transition:-moz-transform .22s cubic-bezier(.25,0,.25,1),opacity .22s cubic-bezier(.25,0,.25,1);-o-transition:-o-transform .22s cubic-bezier(.25,0,.25,1),opacity .22s cubic-bezier(.25,0,.25,1);transition:transform .22s cubic-bezier(.25,0,.25,1),opacity .22s cubic-bezier(.25,0,.25,1)}.alertIn.ng-hide-remove,.alertOut.ng-hide-add.ng-hide-add-active{opacity:0;-webkit-transform:translate3d(100px,0,0);transform:translate3d(100px,0,0);display:block!important}.alertIn.ng-hide-remove.ng-hide-remove-active,.alertOut.ng-hide-add{opacity:1;display:block!important;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)} \ No newline at end of file diff --git a/dist/angular-flash.min.js b/dist/angular-flash.min.js new file mode 100644 index 0000000..acee28e --- /dev/null +++ b/dist/angular-flash.min.js @@ -0,0 +1,4 @@ +/*! angular-flash - v1.0.0 - 2015-03-18 +* https://github.com/sachinchoolur/angular-flash +* Copyright (c) 2015 Sachin; Licensed MIT */ +!function(){"use strict";var a=angular.module("flash",[]);a.run(function(a){a.flash={},a.flash.text="",a.flash.type="",a.flash.timeout=5e3,a.hasFlash=!1}),a.directive("dynamic",function(a){return{restrict:"A",replace:!0,link:function(b,c,d){b.$watch(d.dynamic,function(d){c.html(d),a(c.contents())(b)})}}}),a.directive("closeFlash",function(a,b){return{link:function(a,c){c.on("click",function(){b.dismiss()})}}}),a.directive("flashMessage",function(a,b){return{restrict:"A",template:'',link:function(a,c,d){b.flash.timeout=parseInt(d.flashMessage,10)}}}),a.factory("Flash",["$rootScope","$timeout",function(a,b){var c,d={};return d.create=function(d,e,f){var g=this;b.cancel(c),a.flash.type=d,a.flash.text=e,a.flash.addClass=f,b(function(){a.hasFlash=!0},100),c=b(function(){g.dismiss()},a.flash.timeout)},d.pause=function(){b.cancel(c)},d.dismiss=function(){b.cancel(c),b(function(){a.hasFlash=!1})},d}])}(); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..63d775e --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "angular-flash-alert", + "version": "1.0.0", + "description": "Flash message for angularjs", + "keywords": [ + "angular-flash", + "flash", + "message", + "alert", + "angularjs", + "bootstrap" + ], + "homepage": "https://github.com/sachinchoolur/angular-flash", + "bugs": { + "url": "https://github.com/sachinchoolur/angular-flash/issues", + "email": "sachi77n@gmail.com" + }, + "author": { + "name": "Sachin", + "email": "sachi77n@gmail.com", + "url": "https://github.com/sachinchoolur" + }, + "repository": { + "type": "git", + "url": "git@github.com:sachinchoolur/angular-flash.git" + }, + "main": "dist/angular-flash.js", + "license": "MIT", + "scripts": { + "test": "grunt" + }, + "devDependencies": { + "grunt": "^0.4.5", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-concat": "^0.5.0", + "grunt-contrib-connect": "^0.9.0", + "grunt-contrib-jshint": "^0.10.0", + "grunt-contrib-qunit": "^0.5.1", + "grunt-contrib-uglify": "^0.7.0", + "grunt-contrib-cssmin": "^0.12.1", + "grunt-contrib-watch": "^0.6.1", + "jshint-stylish": "^1.0.0", + "load-grunt-tasks": "^2.0.0", + "time-grunt": "^1.0.0" + } +} \ No newline at end of file diff --git a/src/.jshintrc b/src/.jshintrc new file mode 100644 index 0000000..31cd6a7 --- /dev/null +++ b/src/.jshintrc @@ -0,0 +1,17 @@ +{ + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "sub": true, + "undef": true, + "unused": true, + "boss": true, + "eqnull": true, + "browser": true, + "predef": [ + "angular" + ] +} diff --git a/angular-flash.css b/src/angular-flash.css similarity index 100% rename from angular-flash.css rename to src/angular-flash.css diff --git a/src/angular-flash.js b/src/angular-flash.js new file mode 100644 index 0000000..9ea4a8c --- /dev/null +++ b/src/angular-flash.js @@ -0,0 +1,87 @@ +(function() { + 'use strict'; + var app = angular.module('flash', []); + + app.run(function($rootScope) { + // initialize variables + $rootScope.flash = {}; + $rootScope.flash.text = ''; + $rootScope.flash.type = ''; + $rootScope.flash.timeout = 5000; + $rootScope.hasFlash = false; + }); + + // Directive for compiling dynamic html + app.directive('dynamic', function($compile) { + return { + restrict: 'A', + replace: true, + link: function(scope, ele, attrs) { + scope.$watch(attrs.dynamic, function(html) { + ele.html(html); + $compile(ele.contents())(scope); + }); + } + }; + }); + + // Directive for closing the flash message + app.directive('closeFlash', function($compile, Flash) { + return { + link: function(scope, ele) { + ele.on('click', function() { + Flash.dismiss(); + }); + } + }; + }); + + // Create flashMessage directive + app.directive('flashMessage', function($compile, $rootScope) { + return { + restrict: 'A', + template: '', + link: function(scope, ele, attrs) { + // get timeout value from directive attribute and set to flash timeout + $rootScope.flash.timeout = parseInt(attrs.flashMessage, 10); + } + }; + }); + + app.factory('Flash', ['$rootScope', '$timeout', + function($rootScope, $timeout) { + + var dataFactory = {}, + timeOut; + + // Create flash message + dataFactory.create = function(type, text, addClass) { + var $this = this; + $timeout.cancel(timeOut); + $rootScope.flash.type = type; + $rootScope.flash.text = text; + $rootScope.flash.addClass = addClass; + $timeout(function() { + $rootScope.hasFlash = true; + }, 100); + timeOut = $timeout(function() { + $this.dismiss(); + }, $rootScope.flash.timeout); + }; + + // Cancel flashmessage timeout function + dataFactory.pause = function() { + $timeout.cancel(timeOut); + }; + + // Dismiss flash message + dataFactory.dismiss = function() { + $timeout.cancel(timeOut); + $timeout(function() { + $rootScope.hasFlash = false; + }); + }; + return dataFactory; + } + ]); +}()); \ No newline at end of file diff --git a/test/.jshintrc b/test/.jshintrc new file mode 100644 index 0000000..09a978d --- /dev/null +++ b/test/.jshintrc @@ -0,0 +1,33 @@ +{ + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "sub": true, + "undef": true, + "unused": true, + "boss": true, + "eqnull": true, + "browser": true, + "node": true, + "predef": [ + "QUnit", + "angular", + "module", + "test", + "asyncTest", + "expect", + "start", + "stop", + "ok", + "equal", + "notEqual", + "deepEqual", + "notDeepEqual", + "strictEqual", + "notStrictEqual", + "throws" + ] +} diff --git a/test/angular-flash.html b/test/angular-flash.html new file mode 100644 index 0000000..e91e038 --- /dev/null +++ b/test/angular-flash.html @@ -0,0 +1,23 @@ + + + + + angular-flash Test Suite + + + + + + + + + + +
+
+ lame test markup + normal test markup + awesome test markup +
+ + diff --git a/test/angular-flash_test.js b/test/angular-flash_test.js new file mode 100644 index 0000000..4b74274 --- /dev/null +++ b/test/angular-flash_test.js @@ -0,0 +1,10 @@ +var injector = angular.injector(['ng', 'flash']); +test('flash test', function(){ + var scope = injector.get('$rootScope').$new(), + $compile = injector.get('$compile'), + element; + element = angular.element(''); + $compile(element)(scope); + scope.$digest(); + ok(element.html !== ''); +}); \ No newline at end of file