diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index ffede22..0000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "components" -} \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index da032f1..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store - -node_modules/ -components/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 3258d05..0000000 --- a/.jshintrc +++ /dev/null @@ -1,67 +0,0 @@ -{ - "bitwise" : true, - "curly" : true, - "eqeqeq" : false, - "forin" : true, - "immed" : true, - "latedef" : true, - "newcap" : true, - "noarg" : true, - "noempty" : true, - "nonew" : true, - "plusplus" : false, - "regexp" : true, - "undef" : true, - "strict" : false, - "trailing" : true, - - "asi" : false, - "boss" : false, - "debug" : false, - "eqnull" : false, - "es5" : false, - "esnext" : false, - "evil" : false, - "expr" : false, - "funcscope" : false, - "globalstrict" : false, - "iterator" : false, - "lastsemic" : false, - "laxbreak" : false, - "laxcomma" : false, - "loopfunc" : false, - "multistr" : false, - "onecase" : false, - "proto" : false, - "regexdash" : false, - "scripturl" : false, - "smarttabs" : false, - "shadow" : false, - "sub" : false, - "supernew" : false, - "validthis" : false, - - "browser" : true, - "couch" : false, - "devel" : true, - "dojo" : false, - "jquery" : true, - "mootools" : false, - "node" : true, - "nonstandard" : false, - "prototypejs" : false, - "rhino" : false, - "wsh" : false, - - "nomen" : false, - "onevar" : false, - "passfail" : false, - "white" : false, - - "maxerr" : 100, - "predef" : [ - "test", - "deepEqual" - ], - "indent" : 4 -} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d30ba63..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.11 -before_script: - - npm install -g grunt-cli bower diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..deef93f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +## Change log + +### 2.0.3 + +- Add MIT License + +### 2.0.2 + +- Add support for $.noConflict mode + +### 2.0.0 + +*Major version change: Camel casing of names have been removed. Please use +version 1.0.4 if you require camel casing of names.* + +- Remove `$.data` like camelCasing on names + +### 1.0.4 + +- Fix an issue (#2) where arrays longer than 2 resulted in incorrect values diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 2ff9623..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,43 +0,0 @@ - -module.exports = function (grunt) { - -// Project configuration - - grunt.initConfig({ - pkg: '', - - files: { - all: ['jquery.serializeObject.js'], - tests: ['test/**/*.js'] - }, - - docs: { - all: ['README.markdown'] - }, - - uglify: { - dist: { - 'dist/jquery.serializeObject.min.js': '' - } - }, - - jshint: { - options: '', - all: '' - }, - - qunit: { - all: ['test/*.html'] - } - - }); - - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-qunit'); - -// Default grunt task - - grunt.registerTask('default', ['jshint', 'uglify', 'qunit']); - -}; \ No newline at end of file diff --git a/README.markdown b/README.markdown deleted file mode 100644 index 7407517..0000000 --- a/README.markdown +++ /dev/null @@ -1,74 +0,0 @@ -[![Build Status](https://travis-ci.org/hongymagic/jQuery.serializeObject.png)](https://travis-ci.org/hongymagic/jQuery.serializeObject) - -# What is it? - -`$.serializeObject` is a variant of existing `$.serialize` method which, instead -of encoding form elements to string, converts form elements to a valid JSON -object which can be used in your JavaScript application. - -# Why? - -Whilst it isn't necessary in most cases, and by that I mean 99.99% kind of most, -there are times when we manipulate form data on client side. Personally I find -JSON much easier to work with than DOM or string manipulation. - -# How do I use it? - -If you want to see the code and demo first: http://jsfiddle.net/davidhong/PRpJT/ - -Simply include the `jQuery.serializeObject.js` along with any `jQuery` instance -and use it like `$.serialize`. - -If you have a `form` like the following: - -
- - - - - - -
- -and wish to convert them to a JSON object: - - var minutes = $('form#minutes').serializeObject(); - -will return: - - { - "subject": "", - "minute-taker": "", - "attendees": [ - "David", - "Daniel", - "Darwin" - ] - } - -## Change log - -### 2.0.3 - -- Add MIT License - -### 2.0.2 - -- Add support for $.noConflict mode - -### 2.0.0 - -*Major version change: Camel casing of names have been removed. Please use -version 1.0.4 if you require camel casing of names.* - -- Remove `$.data` like camelCasing on names - -### 1.0.4 - -- Fix an issue (#2) where arrays longer than 2 resulted in incorrect values - -## Known issues - -- In rare cases, this won't work with old checkbox/hidden hack. See [this issue for more details](https://github.com/hongymagic/jQuery.serializeObject/issues/9). - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/hongymagic/jquery.serializeobject/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b31221 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# What is it? + +`$.serializeObject` is a variant of existing `$.serialize` method which, instead +of encoding form elements to string, converts form elements to a valid JSON +object which can be used in your JavaScript application. + +# Why? + +Whilst it isn't necessary in most cases, and by that I mean 99.99% kind of most, +there are times when we manipulate form data on client side. Personally I find +JSON much easier to work with than DOM or string manipulation. + +# How do I use it? + +Simply include the `jQuery.serializeObject.js` along with any `jQuery` instance +and use it like `$.serialize`. + +If you have a `form` like the following: +```HTML +
+ + + + + + +
+``` +and wish to convert them to a JSON object: +```JS +var minutes = $('form#minutes').serializeObject(); +``` +will return: +```JSON +{ + "subject": "", + "minute-taker": "", + "attendees": [ + "David", + "Daniel", + "Darwin" + ] +} +``` +## Change log +[See here](https://github.com/long76/jQuery.serializeObject/blob/master/CHANGELOG.markdown) + +## Known issues + +- In rare cases, this won't work with old checkbox/hidden hack. See [this issue for more details](https://github.com/hongymagic/jQuery.serializeObject/issues/9). diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..600d3dd --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,48 @@ + + + + + {% if site.google_analytics %} + + + {% endif %} + + +{% seo %} + + + + + + + Skip to the content. + + + +
+ {{ content }} + + +
+ + diff --git a/bower.json b/bower.json deleted file mode 100644 index 2612443..0000000 --- a/bower.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "jQuery.serializeObject", - "version": "2.0.3", - "main": "jquery.serializeObject.js", - "ignore": [ - "**/.*", - "node_modules", - "components" - ], - "dependencies": { - "jquery": "1.9.1" - }, - "devDependencies": { - "qunit": "~1.14.0" - } -} diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..3d06aa3 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,3 @@ +## Demo + +Will be added later \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index b07a0b7..0000000 --- a/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "jQuery.serializeObject", - "version": "2.0.4", - "description": "A jQuery plugin to turn form data into JSON", - "main": "jquery.serializeObject.js", - "types": "jquery.serializeObject.d.ts", - "directories": { - "test": "test" - }, - "scripts": { - "pretest": "bower install", - "test": "grunt" - }, - "repository": { - "type": "git", - "url": "git://github.com/hongymagic/jQuery.serializeObject.git" - }, - "keywords": [ - "jquery", - "serialize", - "object", - "json", - "serializeJSON", - "serializeObject" - ], - "author": "David G. Hong", - "license": "MIT", - "gitHead": "7789084425b353624fc95487024459f364d11df6", - "readmeFilename": "README.markdown", - "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-uglify": "~0.2.0", - "grunt-contrib-jshint": "~0.4.3", - "grunt-contrib-qunit": "~0.2.1" - } -} diff --git a/serializeObject.jquery.json b/serializeObject.jquery.json deleted file mode 100644 index bbc4022..0000000 --- a/serializeObject.jquery.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "serializeObject", - "version": "2.0.3", - "title": "jQuery serializeObject", - "author": { - "name": "David G. Hong", - "email": "davidhong.code@gmail.com", - "url": "https://github.com/hongymagic" - }, - "licenses": [ - { - "type": "MIT", - "url": "MIT-LICENSE.txt" - } - ], - "dependencies": { - "jquery": ">=1.4" - }, - "description": "Convert your form data to into JSON (JavaScript Object Notation) format, so you can manipulate them easily. See Github project page for information.", - "tags": [ - "form", - "JSON", - "serializeObject", - "serialize", - "serialise" - ], - "homepage": "https://github.com/hongymagic/jQuery.serializeObject", - "bugs": "https://github.com/hongymagic/jQuery.serializeObject/issues", - "maintainers": [ - { - "name": "David G. Hong", - "url": "https://github.com/hongymagic" - } - ] -} \ No newline at end of file diff --git a/jquery.serializeObject.js b/src/jquery.serializeObject.js similarity index 100% rename from jquery.serializeObject.js rename to src/jquery.serializeObject.js diff --git a/test/serialization-test.js b/test/serialization-test.js deleted file mode 100644 index 8f43b66..0000000 --- a/test/serialization-test.js +++ /dev/null @@ -1,32 +0,0 @@ - -module('serialization test'); - -test('simple form test', function () { - var form = $('form#simple-form'); - var data = form.serializeObject(); - var expected = { - name: 'John Apple', - age: '21', - email: 'john.apple@apple.com', - password: '', - 'legal-age': 'yes' - }; - - deepEqual(data, expected, 'Key/value pairs should be identical'); -}); - -test('multi value inputs', function () { - var form = $('form#multi-value-form'); - var data = form.serializeObject(); - var expected = { - food: ['Banana', 'Melon'], - drink: [ - 'Water', - 'Milk', - 'Beer', - 'Cocktail' - ] - }; - - deepEqual(data, expected, 'Multiple values should be an array'); -}); diff --git a/test/tests.html b/test/tests.html deleted file mode 100644 index efc21ff..0000000 --- a/test/tests.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - $.serializeObject tests - - - - - - - - - - -

QUnit Test Suite - Step Addon

-

-
-

-
    - -
    -
    - - - - - - - -
    - -
    - - - - - - - - - -
    -
    - -