Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
onokumus committed Sep 27, 2015
1 parent a30fe9b commit aaa0c7c
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 54 deletions.
67 changes: 52 additions & 15 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

module.exports = function(grunt) {
'use strict';

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

Expand All @@ -23,13 +23,9 @@ module.exports = function(grunt) {
]
},
concat: {
plugin: {
dist: {
src: ['src/metisMenu.js'],
dest: 'dist/metisMenu.js'
},
css: {
src: ['src/metisMenu.css'],
dest: 'dist/metisMenu.css'
}
},
uglify: {
Expand All @@ -38,10 +34,51 @@ module.exports = function(grunt) {
dest: 'dist/metisMenu.min.js'
}
},
cssmin: {
menucss: {
src: ['src/metisMenu.css'],
dest: 'dist/metisMenu.min.css'
postcss: {
dev: {
options: {
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({
browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]
}) // add vendor prefixes
]
},
files: {
'dist/metisMenu.css': ['src/metisMenu.css']
}
},
min: {
options: {
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({
browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]
}), // add vendor prefixes
require('cssnano')
]
},
files: {
'dist/metisMenu.min.css': ['src/metisMenu.css']
}
}
},
usebanner: {
Expand Down Expand Up @@ -73,11 +110,11 @@ module.exports = function(grunt) {
watch: {
script: {
files: ['src/**/*.js'],
tasks: ['concat:plugin', 'uglify', 'usebanner']
tasks: ['concat', 'uglify', 'usebanner']
},
style: {
files: ['src/**/*.css'],
tasks: ['concat:css', 'cssmin', 'usebanner']
tasks: ['postcss', 'usebanner']
},
livereload: {
options: {
Expand All @@ -96,17 +133,17 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-postcss');

grunt.registerTask('travis', ['jshint']);
grunt.registerTask('serve', ['connect:livereload', 'watch']);
grunt.registerTask('default', [
'jshint',
'concat',
'uglify',
'cssmin',
'postcss',
'usebanner'
]);
};
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ composer require onokumus/metismenu:dev-master
1. Include metisMenu StyleSheet

```html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.1.0/metisMenu.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.2.0/metisMenu.min.css">
```
OR
```html
<link rel="stylesheet" href="//cdn.jsdelivr.net/jquery.metismenu/2.1.0/metisMenu.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/jquery.metismenu/2.2.0/metisMenu.min.css">
```

2. Include jQuery
Expand All @@ -50,11 +50,11 @@ composer require onokumus/metismenu:dev-master
3. Include metisMenu plugin's code

```html
<script src="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.1.0/metisMenu.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.2.0/metisMenu.min.js"></script>
```
OR
```html
<script src="//cdn.jsdelivr.net/jquery.metismenu/2.1.0/metisMenu.min.js"></script>
<script src="//cdn.jsdelivr.net/jquery.metismenu/2.2.0/metisMenu.min.js"></script>
```

4. Add class `metismenu` to unordered list
Expand Down Expand Up @@ -217,6 +217,7 @@ Contains a simple HTML file to demonstrate metisMenu plugin.

### Release History
**DATE** **VERSION** **CHANGES**
* 2015-09-27 v2.2.0 Events supported & added preventDefault options
* 2015-08-06 v2.1.0 RTL & `aria-expanded` attribute & TypeScript type definitions support
* 2015-07-25 v2.0.3 When the active item has doubleTapToGo should not collapse
* 2015-05-23 v2.0.2 [fixed](https://github.com/onokumus/metisMenu/issues/34#issuecomment-104656754)
Expand Down
14 changes: 7 additions & 7 deletions dist/metisMenu.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* metismenu - v2.1.0
* metismenu - v2.2.0
* A jQuery menu plugin
* https://github.com/onokumus/metisMenu#readme
*
Expand Down Expand Up @@ -45,35 +45,32 @@
*/

.metismenu .ion.arrow:before {
content:"\f3d2"
content: "\f3d2"
}
.metismenu .active > a > .ion.arrow:before {
content:"\f3d0";
content: "\f3d0";
}
.metismenu .plus-times {
float: right;
}

*[dir="rtl"] .metismenu .plus-times {
float: left;
}

.metismenu .fa.plus-times:before {
content: "\f067";
}
.metismenu .active > a > .fa.plus-times {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.metismenu .plus-minus {
float: right;
}

*[dir="rtl"] .metismenu .plus-minus {
float: left;
}

.metismenu .fa.plus-minus:before {
content: "\f067";
}
Expand All @@ -91,9 +88,12 @@
height: 0;
overflow: hidden;
-webkit-transition-timing-function: ease;
-o-transition-timing-function: ease;
transition-timing-function: ease;
-webkit-transition-duration: .35s;
-o-transition-duration: .35s;
transition-duration: .35s;
-webkit-transition-property: height, visibility;
-o-transition-property: height, visibility;
transition-property: height, visibility;
}
22 changes: 18 additions & 4 deletions dist/metisMenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* metismenu - v2.1.0
* metismenu - v2.2.0
* A jQuery menu plugin
* https://github.com/onokumus/metisMenu#readme
*
Expand Down Expand Up @@ -74,10 +74,13 @@
MetisMenu.DEFAULTS = {
toggle: true,
doubleTapToGo: false,
preventDefault: true,
activeClass: 'active',
collapseClass: 'collapse',
collapseInClass: 'in',
collapsingClass: 'collapsing'
collapsingClass: 'collapsing',
onTransitionStart: false,
onTransitionEnd: false
};

MetisMenu.prototype.init = function() {
Expand Down Expand Up @@ -122,8 +125,9 @@
var self = $(this);
var $parent = self.parent('li');
var $list = $parent.children('ul');
e.preventDefault();

if($this.options.preventDefault){
e.preventDefault();
}
if ($parent.hasClass(activeClass) && !$this.options.doubleTapToGo) {
$this.hide($list);
self.attr('aria-expanded',false);
Expand All @@ -132,6 +136,10 @@
self.attr('aria-expanded',true);
}

if($this.options.onTransitionStart) {
$this.options.onTransitionStart();
}

//Do we need to enable the double tap
if ($this.options.doubleTapToGo) {
//if we hit a second time on the link and the href is valid, navigate to that url
Expand Down Expand Up @@ -187,6 +195,9 @@

this.transitioning = 1;
var complete = function() {
if(this.transitioning && this.options.onTransitionEnd) {
this.options.onTransitionEnd();
}
$this
.removeClass(collapsingClass)
.addClass(collapseClass + ' ' + collapseInClass)
Expand Down Expand Up @@ -225,6 +236,9 @@
this.transitioning = 1;

var complete = function() {
if(this.transitioning && this.options.onTransitionEnd) {
this.options.onTransitionEnd();
}
this.transitioning = 0;
$this
.removeClass(collapsingClass)
Expand Down
4 changes: 2 additions & 2 deletions dist/metisMenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/metisMenu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metismenu",
"version": "2.1.0",
"version": "2.2.0",
"description": "A jQuery menu plugin",
"main": "./dist/metisMenu.js",
"scripts": {
Expand All @@ -27,21 +27,26 @@
"Rein de Vries <info@reinos.nl> (https://github.com/reinos/)",
"Arthur CHAN <arthur@talkgoal.com> (http://catchtop.com)",
"Andrew Eastwood (https://github.com/AndrewEastwood)",
"Marcelo Tosco <capy.net@gmail.com> (http://ecapy.com)"
"Marcelo Tosco <capy.net@gmail.com> (http://ecapy.com)",
"Radoslav Štofko (http://www.stoweb.cz)",
"Umut Karcı <umutkarci@std.sehir.edu.tr>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/onokumus/metisMenu/issues"
},
"homepage": "https://github.com/onokumus/metisMenu#readme",
"devDependencies": {
"autoprefixer": "^6.0.3",
"cssnano": "^3.2.0",
"grunt": "^0.4.5",
"grunt-banner": "^0.4.0",
"grunt-banner": "^0.5.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-connect": "^0.11.2",
"grunt-contrib-cssmin": "^0.12.3",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "0.6.1"
"grunt-contrib-watch": "0.6.1",
"grunt-postcss": "^0.6.0",
"pixrem": "^3.0.0"
}
}
Loading

0 comments on commit aaa0c7c

Please sign in to comment.