code style
This commit is contained in:
parent
47218bd7a6
commit
c43a12ac06
9
.jscsrc
9
.jscsrc
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"preset": "google",
|
"preset": "node-style-guide",
|
||||||
"validateIndentation": "\t",
|
"validateIndentation": 4,
|
||||||
"maximumLineLength": 120,
|
"maximumLineLength": 120,
|
||||||
"jsDoc": {
|
"jsDoc": {
|
||||||
"checkAnnotations": {
|
"checkAnnotations": {
|
||||||
|
@ -10,5 +10,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requireCamelCaseOrUpperCaseIdentifiers": true
|
"requireCamelCaseOrUpperCaseIdentifiers": true,
|
||||||
|
"validateLineBreaks": false,
|
||||||
|
"requireTrailingComma": false,
|
||||||
|
"excludeFiles": ["dist/*.js"]
|
||||||
}
|
}
|
||||||
|
|
13
Gruntfile.js
13
Gruntfile.js
|
@ -1,10 +1,11 @@
|
||||||
module.exports = function (grunt) {
|
module.exports = function(grunt) {
|
||||||
grunt.loadNpmTasks('grunt-sass');
|
grunt.loadNpmTasks('grunt-sass');
|
||||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
grunt.loadNpmTasks('grunt-doctoc');
|
grunt.loadNpmTasks('grunt-doctoc');
|
||||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
grunt.loadNpmTasks('grunt-jscs');
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
sass: {
|
sass: {
|
||||||
|
@ -54,14 +55,18 @@ module.exports = function (grunt) {
|
||||||
removeAd: false
|
removeAd: false
|
||||||
},
|
},
|
||||||
readme: {
|
readme: {
|
||||||
target: "./README.md"
|
target: './README.md'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
jshint: {
|
jshint: {
|
||||||
all: ['src/*.js']
|
all: ['src/*.js']
|
||||||
}
|
},
|
||||||
|
|
||||||
|
jscs: {
|
||||||
|
all: ['*.js', 'src/*.js', ],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask('default', ['sass', 'cssmin', 'copy', 'uglify', 'doctoc', 'jshint']);
|
grunt.registerTask('default', ['sass', 'cssmin', 'copy', 'uglify', 'doctoc', 'jshint', 'jscs']);
|
||||||
};
|
};
|
||||||
|
|
20
dist/gridstack.js
vendored
20
dist/gridstack.js
vendored
|
@ -22,8 +22,8 @@
|
||||||
|
|
||||||
var obsolete = function(f, oldName, newName) {
|
var obsolete = function(f, oldName, newName) {
|
||||||
var wrapper = function() {
|
var wrapper = function() {
|
||||||
console.warn('gridstack.js: Function `' + oldName + '` is deprecated as of v0.2.5 and has been replaced with `' +
|
console.warn('gridstack.js: Function `' + oldName + '` is deprecated as of v0.2.5 and has been replaced ' +
|
||||||
newName + '`. It will be **completely** removed in v1.0.');
|
'with `' + newName + '`. It will be **completely** removed in v1.0.');
|
||||||
return f.apply(this, arguments);
|
return f.apply(this, arguments);
|
||||||
};
|
};
|
||||||
wrapper.prototype = f.prototype;
|
wrapper.prototype = f.prototype;
|
||||||
|
@ -633,7 +633,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStack.prototype._initStyles = function() {
|
GridStack.prototype._initStyles = function() {
|
||||||
if (!this.opts.cellHeight) { //that will be handled by CSS
|
if (!this.opts.cellHeight) { // That will be handled by CSS
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (this._stylesId) {
|
if (this._stylesId) {
|
||||||
|
@ -660,7 +660,7 @@
|
||||||
this._initStyles();
|
this._initStyles();
|
||||||
this._updateContainerHeight();
|
this._updateContainerHeight();
|
||||||
}
|
}
|
||||||
if (!this.opts.cellHeight) { //the rest will be handled by CSS
|
if (!this.opts.cellHeight) { // The rest will be handled by CSS
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (this._styles._max !== 0 && maxHeight <= this._styles._max) {
|
if (this._styles._max !== 0 && maxHeight <= this._styles._max) {
|
||||||
|
@ -669,12 +669,14 @@
|
||||||
|
|
||||||
if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) {
|
if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) {
|
||||||
getHeight = function(nbRows, nbMargins) {
|
getHeight = function(nbRows, nbMargins) {
|
||||||
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) + self.opts.cellHeightUnit;
|
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) +
|
||||||
|
self.opts.cellHeightUnit;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
getHeight = function(nbRows, nbMargins) {
|
getHeight = function(nbRows, nbMargins) {
|
||||||
if (!nbRows || !nbMargins) {
|
if (!nbRows || !nbMargins) {
|
||||||
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) + self.opts.cellHeightUnit;
|
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) +
|
||||||
|
self.opts.cellHeightUnit;
|
||||||
}
|
}
|
||||||
return 'calc(' + ((self.opts.cellHeight * nbRows) + self.opts.cellHeightUnit) + ' + ' +
|
return 'calc(' + ((self.opts.cellHeight * nbRows) + self.opts.cellHeightUnit) + ' + ' +
|
||||||
((self.opts.verticalMargin * nbMargins) + self.opts.verticalMarginUnit) + ')';
|
((self.opts.verticalMargin * nbMargins) + self.opts.verticalMarginUnit) + ')';
|
||||||
|
@ -1156,11 +1158,9 @@
|
||||||
if (typeof val == 'undefined') {
|
if (typeof val == 'undefined') {
|
||||||
if (this.opts.cellHeight) {
|
if (this.opts.cellHeight) {
|
||||||
return this.opts.cellHeight;
|
return this.opts.cellHeight;
|
||||||
} else {
|
|
||||||
var o = this.container.children('.' + this.opts.itemClass).first();
|
|
||||||
return Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
|
||||||
}
|
}
|
||||||
|
var o = this.container.children('.' + this.opts.itemClass).first();
|
||||||
|
return Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
||||||
}
|
}
|
||||||
var heightData = parseHeight(val);
|
var heightData = parseHeight(val);
|
||||||
|
|
||||||
|
|
2
dist/gridstack.min.map
vendored
2
dist/gridstack.min.map
vendored
File diff suppressed because one or more lines are too long
|
@ -22,8 +22,8 @@
|
||||||
|
|
||||||
var obsolete = function(f, oldName, newName) {
|
var obsolete = function(f, oldName, newName) {
|
||||||
var wrapper = function() {
|
var wrapper = function() {
|
||||||
console.warn('gridstack.js: Function `' + oldName + '` is deprecated as of v0.2.5 and has been replaced with `' +
|
console.warn('gridstack.js: Function `' + oldName + '` is deprecated as of v0.2.5 and has been replaced ' +
|
||||||
newName + '`. It will be **completely** removed in v1.0.');
|
'with `' + newName + '`. It will be **completely** removed in v1.0.');
|
||||||
return f.apply(this, arguments);
|
return f.apply(this, arguments);
|
||||||
};
|
};
|
||||||
wrapper.prototype = f.prototype;
|
wrapper.prototype = f.prototype;
|
||||||
|
@ -633,7 +633,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStack.prototype._initStyles = function() {
|
GridStack.prototype._initStyles = function() {
|
||||||
if (!this.opts.cellHeight) { //that will be handled by CSS
|
if (!this.opts.cellHeight) { // That will be handled by CSS
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (this._stylesId) {
|
if (this._stylesId) {
|
||||||
|
@ -660,7 +660,7 @@
|
||||||
this._initStyles();
|
this._initStyles();
|
||||||
this._updateContainerHeight();
|
this._updateContainerHeight();
|
||||||
}
|
}
|
||||||
if (!this.opts.cellHeight) { //the rest will be handled by CSS
|
if (!this.opts.cellHeight) { // The rest will be handled by CSS
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (this._styles._max !== 0 && maxHeight <= this._styles._max) {
|
if (this._styles._max !== 0 && maxHeight <= this._styles._max) {
|
||||||
|
@ -669,12 +669,14 @@
|
||||||
|
|
||||||
if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) {
|
if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) {
|
||||||
getHeight = function(nbRows, nbMargins) {
|
getHeight = function(nbRows, nbMargins) {
|
||||||
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) + self.opts.cellHeightUnit;
|
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) +
|
||||||
|
self.opts.cellHeightUnit;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
getHeight = function(nbRows, nbMargins) {
|
getHeight = function(nbRows, nbMargins) {
|
||||||
if (!nbRows || !nbMargins) {
|
if (!nbRows || !nbMargins) {
|
||||||
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) + self.opts.cellHeightUnit;
|
return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) +
|
||||||
|
self.opts.cellHeightUnit;
|
||||||
}
|
}
|
||||||
return 'calc(' + ((self.opts.cellHeight * nbRows) + self.opts.cellHeightUnit) + ' + ' +
|
return 'calc(' + ((self.opts.cellHeight * nbRows) + self.opts.cellHeightUnit) + ' + ' +
|
||||||
((self.opts.verticalMargin * nbMargins) + self.opts.verticalMarginUnit) + ')';
|
((self.opts.verticalMargin * nbMargins) + self.opts.verticalMarginUnit) + ')';
|
||||||
|
@ -1156,11 +1158,9 @@
|
||||||
if (typeof val == 'undefined') {
|
if (typeof val == 'undefined') {
|
||||||
if (this.opts.cellHeight) {
|
if (this.opts.cellHeight) {
|
||||||
return this.opts.cellHeight;
|
return this.opts.cellHeight;
|
||||||
} else {
|
|
||||||
var o = this.container.children('.' + this.opts.itemClass).first();
|
|
||||||
return Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
|
||||||
}
|
}
|
||||||
|
var o = this.container.children('.' + this.opts.itemClass).first();
|
||||||
|
return Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
||||||
}
|
}
|
||||||
var heightData = parseHeight(val);
|
var heightData = parseHeight(val);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue