jquery-slugify-1.2.5/ 0000775 0000000 0000000 00000000000 13165752037 0014527 5 ustar 00root root 0000000 0000000 jquery-slugify-1.2.5/.gitignore 0000664 0000000 0000000 00000000067 13165752037 0016522 0 ustar 00root root 0000000 0000000 node_modules/ nbproject/ .idea bower_components .local jquery-slugify-1.2.5/.jshintrc 0000664 0000000 0000000 00000000343 13165752037 0016354 0 ustar 00root root 0000000 0000000 { "curly": true, "eqeqeq": true, "immed": true, "jquery": true, "latedef": true, "newcap": true, "noarg": true, "sub": true, "undef": true, "unused": true, "boss": true, "eqnull": true, "node": true } jquery-slugify-1.2.5/.travis.yml 0000664 0000000 0000000 00000000122 13165752037 0016633 0 ustar 00root root 0000000 0000000 language: node_js node_js: - "0.10" before_script: - npm install -g grunt-cli jquery-slugify-1.2.5/CONTRIBUTING.md 0000664 0000000 0000000 00000003212 13165752037 0016756 0 ustar 00root root 0000000 0000000 # Contributing ## Important notes Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory! ### Code style Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** ### PhantomJS While Grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers. ## Modifying the code First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed. Test that Grunt's CLI is installed by running `grunt --version`. If the command isn't found, run `npm install -g grunt-cli`. For more information about installing Grunt, see the [getting started guide](http://gruntjs.com/getting-started). 1. Fork and clone the repo. 1. Run `npm install` to install all dependencies (including Grunt). 1. Run `grunt` to grunt this project. Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken. ## Submitting pull requests 1. Create a new branch, please don't work in your `master` branch directly. 1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail. 1. Fix stuff. 1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done. 1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere. 1. Update the documentation to reflect any changes. 1. Push to your fork and submit a pull request. jquery-slugify-1.2.5/Gruntfile.js 0000664 0000000 0000000 00000007160 13165752037 0017030 0 ustar 00root root 0000000 0000000 'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON('package.json'), banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', // Task configuration. clean: { files: ['dist'] }, concat: { options: { banner: '<%= banner %>', stripBanners: true }, dist: { src: ['src/<%= pkg.filename %>.js'], dest: 'dist/<%= pkg.filename %>.js' } }, uglify: { options: { banner: '<%= banner %>' }, dist: { src: '<%= concat.dist.dest %>', dest: 'dist/<%= pkg.filename %>.min.js' } }, qunit: { all: { options: { urls: [ '1.7.2', '1.8.3', '1.9.1', '1.10.2', '1.11.2', '2.0.3', '2.1.3', '3.0.0', '3.1.0', '3.2.1' ].map(function(version) { return ( 'http://localhost:<%= connect.server.options.port %>/test/slugify.html?jquery=' + version ); }) } } }, jshint: { gruntfile: { options: { jshintrc: '.jshintrc' }, src: 'Gruntfile.js' }, src: { options: { jshintrc: 'src/.jshintrc' }, src: ['src/**/*.js'] }, test: { options: { jshintrc: 'test/.jshintrc' }, src: ['test/**/*.js'] } }, watch: { gruntfile: { files: '<%= jshint.gruntfile.src %>', tasks: ['jshint:gruntfile'] }, src: { files: '<%= jshint.src.src %>', tasks: ['jshint:src', 'qunit'] }, test: { files: '<%= jshint.test.src %>', tasks: ['jshint:test', 'qunit'] } }, connect: { server: { options: { port: 4321, hostname: 'localhost' } } } }); // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-connect'); // Default task. grunt.registerTask('default', [ 'connect', 'jshint', 'qunit', 'clean', 'concat', 'uglify' ]); // Test task grunt.registerTask('test', ['connect', 'jshint', 'qunit']); }; jquery-slugify-1.2.5/LICENSE-MIT 0000664 0000000 0000000 00000002046 13165752037 0016165 0 ustar 00root root 0000000 0000000 Copyright (c) 2013-2017 Florian Reiss 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. jquery-slugify-1.2.5/README.md 0000664 0000000 0000000 00000002371 13165752037 0016011 0 ustar 00root root 0000000 0000000 [](https://travis-ci.org/madflow/jquery-slugify) # jQuery Slugify Just another another (another) url slug creation plugin for jQuery. ## Getting Started You can install the plugin using Bower: bower install jquery-slugify You can download the [production version][min] or the [development version][max]. [min]: https://raw.github.com/madflow/jquery-slugify/master/dist/slugify.min.js [max]: https://raw.github.com/madflow/jquery-slugify/master/dist/slugify.js The plugin depends on [speakingurl][speakingurl]. [speakingurl]: https://github.com/pid/speakingurl In your web page: ```html ``` jquery-slugify-1.2.5/bower.json 0000664 0000000 0000000 00000001114 13165752037 0016535 0 ustar 00root root 0000000 0000000 { "name": "jquery-slugify", "homepage": "https://github.com/madflow/jquery-slugify", "authors": [ "madflow" ], "description": "Just another another (another) url slug creation plugin for jQuery", "main": "dist/slugify.js", "keywords": [ "slugify", "slugs", "strings" ], "dependencies": { "jquery": ">=1.7", "speakingurl": "~9.0.0" }, "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components", "test", "libs", "Gruntfile.js", "package.json", "CONTRIBUTING.md", "slugify.jquery.json" ] } jquery-slugify-1.2.5/dist/ 0000775 0000000 0000000 00000000000 13165752037 0015472 5 ustar 00root root 0000000 0000000 jquery-slugify-1.2.5/dist/slugify.js 0000664 0000000 0000000 00000004251 13165752037 0017514 0 ustar 00root root 0000000 0000000 /*! jquery-slugify - v1.2.5 - 2017-10-06 * Copyright (c) 2017 madflow; Licensed */ (function($) { $.fn.slugify = function(source, options) { return this.each(function() { var $target = $(this), $source = $(source); $target.on('keyup change', function() { if ($target.val() !== '' && $target.val() !== undefined) { $target.data('locked', true); } else { $target.data('locked', false); } }); $source.on('keyup change', function() { // If the target is empty - it cannot be locked if ($target.val() === '' || $target.val() === undefined) { $target.data('locked', false); } if (true === $target.data('locked')) { return; } if ($target.is('input') || $target.is('textarea')) { $target.val($.slugify($source.val(), options)); } else { $target.text($.slugify($source.val(), options)); } }); }); }; // Static method. $.slugify = function(sourceString, options) { // Override default options with passed-in options. options = $.extend({}, $.slugify.options, options); // Guess language specifics from html.lang attribute // when options.lang is not defined options.lang = options.lang || $('html').prop('lang'); // Apply preSlug function - if exists if (typeof options.preSlug === 'function') { sourceString = options.preSlug(sourceString); } sourceString = options.slugFunc(sourceString, options); // Apply postSlug function - if exists if (typeof options.postSlug === 'function') { sourceString = options.postSlug(sourceString); } return sourceString; }; // Default plugin options $.slugify.options = { preSlug: null, postSlug: null, slugFunc: function(input, opts) { return window.getSlug(input, opts); } }; })(jQuery); jquery-slugify-1.2.5/package.json 0000664 0000000 0000000 00000001674 13165752037 0017025 0 ustar 00root root 0000000 0000000 { "name": "jquery-slugify", "filename": "slugify", "description": "Just another another (another) url slug plugin for jQuery", "version": "1.2.5", "main": "dist/slugify.min.js", "author": { "name": "madflow", "url": "https://github.com/madflow/jquery-slugify" }, "scripts": { "test": "grunt test" }, "keywords": [ "javascript", "jquery", "slugs", "slug", "strings", "jquery-plugin" ], "license": "MIT", "repository": { "type": "git", "url": "git@github.com:madflow/jquery-slugify.git" }, "devDependencies": { "connect": "~2.27.1", "grunt": "~0.4.5", "grunt-contrib-clean": "~0.6.0", "grunt-contrib-concat": "~0.5.1", "grunt-contrib-connect": "~0.11.1", "grunt-contrib-jshint": "~0.11.0", "grunt-contrib-qunit": "~0.7.0", "grunt-contrib-uglify": "~0.9.1", "grunt-contrib-watch": "~0.6.1" }, "dependencies": { "speakingurl": "~9.0.0" } } jquery-slugify-1.2.5/src/ 0000775 0000000 0000000 00000000000 13165752037 0015316 5 ustar 00root root 0000000 0000000 jquery-slugify-1.2.5/src/.jshintrc 0000664 0000000 0000000 00000000547 13165752037 0017151 0 ustar 00root root 0000000 0000000 { "curly": true, "eqeqeq": true, "immed": true, "latedef": true, "newcap": true, "noarg": true, "sub": true, "undef": true, "unused": true, "boss": true, "eqnull": true, "browser": true, "predef": ["jQuery"], "globals": { "module": true, "require": true, "console": true } } jquery-slugify-1.2.5/src/slugify.js 0000664 0000000 0000000 00000004331 13165752037 0017337 0 ustar 00root root 0000000 0000000 /* * https://github.com/madflow/jquery-slugify * * Copyright (c) 2015-2017 Florian Reiss * Licensed under the MIT license. */ (function($) { $.fn.slugify = function(source, options) { return this.each(function() { var $target = $(this), $source = $(source); $target.on('keyup change', function() { if ($target.val() !== '' && $target.val() !== undefined) { $target.data('locked', true); } else { $target.data('locked', false); } }); $source.on('keyup change', function() { // If the target is empty - it cannot be locked if ($target.val() === '' || $target.val() === undefined) { $target.data('locked', false); } if (true === $target.data('locked')) { return; } if ($target.is('input') || $target.is('textarea')) { $target.val($.slugify($source.val(), options)); } else { $target.text($.slugify($source.val(), options)); } }); }); }; // Static method. $.slugify = function(sourceString, options) { // Override default options with passed-in options. options = $.extend({}, $.slugify.options, options); // Guess language specifics from html.lang attribute // when options.lang is not defined options.lang = options.lang || $('html').prop('lang'); // Apply preSlug function - if exists if (typeof options.preSlug === 'function') { sourceString = options.preSlug(sourceString); } sourceString = options.slugFunc(sourceString, options); // Apply postSlug function - if exists if (typeof options.postSlug === 'function') { sourceString = options.postSlug(sourceString); } return sourceString; }; // Default plugin options $.slugify.options = { preSlug: null, postSlug: null, slugFunc: function(input, opts) { return window.getSlug(input, opts); } }; })(jQuery); jquery-slugify-1.2.5/test/ 0000775 0000000 0000000 00000000000 13165752037 0015506 5 ustar 00root root 0000000 0000000 jquery-slugify-1.2.5/test/.jshintrc 0000664 0000000 0000000 00000000725 13165752037 0017337 0 ustar 00root root 0000000 0000000 { "curly": true, "eqeqeq": true, "immed": true, "latedef": true, "newcap": true, "noarg": true, "sub": true, "undef": true, "unused": true, "boss": true, "eqnull": true, "browser": true, "predef": [ "jQuery", "QUnit", "module", "test", "asyncTest", "expect", "start", "stop", "ok", "equal", "notEqual", "deepEqual", "notDeepEqual", "strictEqual", "notStrictEqual", "throws" ] } jquery-slugify-1.2.5/test/slugify.html 0000664 0000000 0000000 00000002344 13165752037 0020061 0 ustar 00root root 0000000 0000000