initial commit

This commit is contained in:
t1m0n 2015-09-26 17:25:04 +03:00
commit 44aea716ec
15 changed files with 297 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.idea
node_modules

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# Datepicker plugin

56
css/style.css Normal file
View File

@ -0,0 +1,56 @@
/* -------------------------------------------------
Reset
------------------------------------------------- */
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, sub, sup, tt, var, 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, menu, nav, output, ruby, section,
summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
vertical-align: baseline; }
body {
margin: 0; }
html, body {
width: 100%;
height: 100%; }
* {
box-sizing: border-box; }
*:after, *:before {
box-sizing: border-box; }
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block; }
b, strong {
font-weight: bold; }
i {
font-style: italic; }
a {
outline: none; }
textarea {
overflow: auto; }

0
dist/css/datepicker.css vendored Normal file
View File

36
dist/js/datepicker.js vendored Normal file
View File

@ -0,0 +1,36 @@
;(function () {
var pluginName = 'datepicker';
function Datepicker () {
}
Datepicker.prototype = {
init: function () {
}
};
$.fn[pluginName] = function ( options ) {
if (Datepicker.prototype[options]) {
Datepicker.prototype[options].apply(this.data(pluginName), Array.prototype.slice.call(arguments, 1));
} else {
return this.each(function () {
if (!$.data(this, pluginName)) {
$.data(this, pluginName,
new Datepicker( this, options ));
} else {
var _this = $.data(this, pluginName),
oldOpts = _this.opts;
_this.opts = $.extend({}, oldOpts, options);
}
});
}
};
})();
Datepicker.Cell = function () {
};

48
gulpfile.js Normal file
View File

@ -0,0 +1,48 @@
var gulp = require('gulp'),
watch = require('gulp-watch'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
livereload = require('gulp-livereload'),
concat = require('gulp-concat');
gulp.task('js', function () {
gulp.src(['js/datepicker/datepicker.js', 'js/datepicker/cell.js'])
.pipe(concat('datepicker.js'))
.pipe(gulp.dest('dist/js/'))
.pipe(livereload())
});
gulp.task('sass', function () {
gulp.src('sass/datepicker.scss')
.pipe(sass().on('error', sass.logError))
.pipe(rename('datepicker.css'))
.pipe(gulp.dest('dist/css/'))
.pipe(livereload())
});
gulp.task('build', ['js', 'sass']);
gulp.task('pageSass', function () {
gulp.src('sass/page-init.scss')
.pipe(sass().on('error', sass.logError))
.pipe(rename('style.css'))
.pipe(gulp.dest('css/'))
.pipe(livereload())
});
gulp.task('watch', function () {
livereload.listen();
gulp.watch('sass/**/*.scss', ['pageSass', 'sass']).on('change', function (file) {
livereload.changed(file)
});
gulp.watch('js/**/*.js', ['js']).on('change', function (file) {
livereload.changed(file)
});
});
gulp.task('default', ['build', 'pageSass', 'watch']);

17
index.html Normal file
View File

@ -0,0 +1,17 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Datepicker</title>
<link rel="stylesheet" href="css/style.css"/>
<link rel="stylesheet" href="dist/css/datepicker.css"/>
<script type="text/javascript" src="dist/js/datepicker.js"></script>
</head>
<body>
<div class="calendar"></div>
<script type="text/javascript">
$('.calendar').datepicker();
</script>
</body>
</html>

3
js/datepicker/cell.js Normal file
View File

@ -0,0 +1,3 @@
Datepicker.Cell = function () {
};

View File

@ -0,0 +1,33 @@
;(function () {
var pluginName = 'datepicker';
function Datepicker () {
}
Datepicker.prototype = {
init: function () {
}
};
$.fn[pluginName] = function ( options ) {
if (Datepicker.prototype[options]) {
Datepicker.prototype[options].apply(this.data(pluginName), Array.prototype.slice.call(arguments, 1));
} else {
return this.each(function () {
if (!$.data(this, pluginName)) {
$.data(this, pluginName,
new Datepicker( this, options ));
} else {
var _this = $.data(this, pluginName),
oldOpts = _this.opts;
_this.opts = $.extend({}, oldOpts, options);
}
});
}
};
})();

13
package.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "datepicker",
"version": "0.0.1",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-livereload": "^3.8.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.0.4",
"gulp-uglify": "^1.2.0",
"gulp-watch": "^4.3.5"
}
}

0
sass/_page.scss Normal file
View File

82
sass/_reset.scss Normal file
View File

@ -0,0 +1,82 @@
/* -------------------------------------------------
Reset
------------------------------------------------- */
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, sub, sup, tt, var, 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, menu, nav, output, ruby, section,
summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
vertical-align: baseline;
}
body {
margin: 0;
}
html, body {
width: 100%;
height: 100%;
}
* {
box-sizing: border-box;
}
*:after, *:before {
box-sizing: border-box;
}
// HTML 5 roles for ie8/eie9
// -------------------------------------------------
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
// Default font weight
// -------------------------------------------------
b, strong {
font-weight: bold;
}
// Default font style
// -------------------------------------------------
i {
font-style: italic;
}
// Remove link outline
// -------------------------------------------------
a {
outline: none;
}
// Remove scroll in ie
// -------------------------------------------------
textarea {
overflow: auto;
}

1
sass/datepicker.scss Normal file
View File

@ -0,0 +1 @@
@import "datepicker/datepicker";

View File

2
sass/page-init.scss Normal file
View File

@ -0,0 +1,2 @@
@import "reset";
@import "page";