Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharlss committed Nov 14, 2019
0 parents commit d5c16e4
Show file tree
Hide file tree
Showing 26 changed files with 4,759 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

indent_style = space
indent_size = 4

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{*.json,*.yml}]
indent_size = 2

[*.html]
indent_style = tab
indent_size = 2
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
node_modules
.sass-cache
Gemfile.lock
_site

# Ignore files beginning with a #
\#*
25 changes: 25 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"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",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"jQuery": true,
"define": true
}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

## 1.0.0-alpha - 2019-11

initial version
1 change: 1 addition & 0 deletions Credits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Icon tax by I Putu Kharismayadi from the Noun Project
173 changes: 173 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
module.exports = function (grunt) {

'use strict';

// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);

// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);

// Project configuration.
grunt.initConfig({

config: {
src: 'src',
dist: 'dist'
},

pkg: require('./package'),

// Content of banner appended to files
meta: {
banner: '/**\n' +
' * <%= pkg.title %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' * (c) <%= grunt.template.today("yyyy") %> <%= pkg.maintainers[0].name %>\n' +
' * <%= pkg.license %> license\n' +
' */\n'
},

// Watches files for changes and runs tasks based on the changed files
watch: {
compass: {
files: ['<%= config.src %>/{,*/}*.{scss,sass}'],
tasks: ['compass:dist', 'postcss:dist', 'cssmin:dist']
},

jshint: {
files: '<%= config.src %>/{,*/}*.js',
tasks: ['jshint']
},

concat: {
files: '<%= config.src %>/{,*/}*.js',
tasks: ['concat:dist', 'uglify:dist']
}
},

// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= config.src %>/{,*/}*.js'
],
},

// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: 'src',
cssDir: '<%= config.dist %>'
},
dist: {
options: {
// banner: '<%= meta.banner %>',
// specify: '<%= config.src %>/editpricehelper.scss',
debugInfo: false,
noLineComments: true
}
}
},

// Add post-processors to CSS
postcss: {
options: {
processors: [
require('autoprefixer')({
flexbox: 'no-2009'
}),
]
},
dist: {
src: '<%= config.dist %>/editpricehelper.css'
}
},

// Prepend a banner to the files
concat: {
options: {
banner: '<%= meta.banner %>'
},
dist: {
src: ['<%= config.src %>/jquery.editpricehelper.js'],
dest: '<%= config.dist %>/jquery.editpricehelper.js'
}
},

// Generate a minified version of JS
uglify: {
options: {
//banner: '<%= meta.banner %>'
},
dist: {
src: ['<%= config.dist %>/jquery.editpricehelper.js'],
dest: '<%= config.dist %>/jquery.editpricehelper.min.js'
}
},

// Generate a minified version of CSS
cssmin: {
options: {
banner: '<%= meta.banner %>'
},
dist: {
src: ['<%= config.dist %>/editpricehelper.css'],
dest: '<%= config.dist %>/editpricehelper.min.css'
}
},

// Increment version
bump: {
options: {
files: [
'bower.json',
'package.json',
],
updateConfigs: ['pkg'],
commitMessage: 'Release v%VERSION%',
commitFiles: [
'bower.json',
'package.json',
'dist'
],
push: false,
pushTo: 'origin',
createTag: false,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
prereleaseName: 'alpha'
}
}

});

// Build task
grunt.registerTask('build', [
'compass:dist',
'postcss:dist',
'jshint',
'concat:dist',
'uglify:dist',
'cssmin:dist'
]);

// Release task
grunt.registerTask('release', [
'bump-only',
'build',
'bump-commit'
]);

// Pre-release task
grunt.registerTask('prerelease', [
'bump-only:prerelease',
'build',
'bump-commit'
]);

};
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ![logo](docs/_medias/editpricehelper.svg) Edit Price Helper

> A small jQuery plugin to help edit prices with taxes.
The goal of this script is to give a real-time feedback of the taxes when you edit a price.

Say you have a no-tax price input and another one for the tax rate on a form: the script will add an all taxes included price input and the tax amount, keeping all values in sync. The added inputs are just here to help fill the original inputs, their values are not meant to be posted.

![preview](docs/_medias/editpricehelper_on.png)

* ~2.3kB gzipped

**[Check the documentation](https://tcharlss.github.io/editpricehelper/) to get started and see some examples.**
34 changes: 34 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "editpricehelper",
"description": "A small jQuery plugin to help edit prices with taxes.",
"title": "Edit Price Helper",
"version": "0.1.0-alpha.1",
"authors": [
"tcharlss <[email protected]>",
],
"main": "dist/jquery.editpricehelper.js",
"keywords": [
"price",
"helper",
"tax",
"input"
],
"license": "MIT",
"homepage": "https://tcharlss.github.io/editpricehelper/",
"docs": "https://tcharlss.github.io/editpricehelper/",
"download": "https://github.com/tcharlss/editpricehelper/releases",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"repository": {
"type": "git",
"url": "git+https://github.com/tcharlss/editpricehelper.git"
},
"dependencies": {
"jquery": ">=3.0"
}
}
62 changes: 62 additions & 0 deletions dist/editpricehelper.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* =================
* Edit Price Helper
* =================
*
* Markup :
*
* label
* span.price.price_notax
* label
* input
* span.price.price_tax
* label
* input
* span.tax tax_amount
* span span
* span.tax tax.rate
* span span
*/
.price {
display: block;
}
.price__label {
display: inline-block;
font-style: italic;
padding-right: 1em;
}
.price__input {
-webkit-transition: background 0.5s;
transition: background 0.5s;
}
.price__input.highlight {
-webkit-animation-name: editpricehelper-highlight;
animation-name: editpricehelper-highlight;
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
}
.price__tax-rate {
margin-left: 0.5em;
}

@-webkit-keyframes editpricehelper-highlight {
from {
-webkit-box-shadow: inset 0 0 0 99em #f7e06e;
box-shadow: inset 0 0 0 99em #f7e06e;
}
to {
-webkit-box-shadow: none;
box-shadow: none;
}
}

@keyframes editpricehelper-highlight {
from {
-webkit-box-shadow: inset 0 0 0 99em #f7e06e;
box-shadow: inset 0 0 0 99em #f7e06e;
}
to {
-webkit-box-shadow: none;
box-shadow: none;
}
}
1 change: 1 addition & 0 deletions dist/editpricehelper.min.css

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

Loading

0 comments on commit d5c16e4

Please sign in to comment.