Ticket #31823: 31823.5.diff
File 31823.5.diff, 21.4 KB (added by , 8 years ago) |
---|
-
Gruntfile.js
1 /* jshint node:true */2 module.exports = function( grunt) {3 var path = require( 'path'),1 /* global module, require, __dirname */ 2 module.exports = function( grunt ) { 3 var path = require( 'path' ), 4 4 fs = require( 'fs' ), 5 5 SOURCE_DIR = 'src/', 6 6 BUILD_DIR = 'build/', 7 autoprefixer = require( 'autoprefixer'),7 autoprefixer = require( 'autoprefixer' ), 8 8 mediaConfig = {}, 9 mediaBuilds = [ 'audiovideo', 'grid', 'models', 'views'];9 mediaBuilds = [ 'audiovideo', 'grid', 'models', 'views' ]; 10 10 11 11 // Load tasks. 12 require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); 12 require( 'matchdep' ).filterDev([ 'grunt-*', '!grunt-legacy-util' ]).forEach( grunt.loadNpmTasks ); 13 13 14 // Load legacy utils 14 grunt.util = require( 'grunt-legacy-util');15 grunt.util = require( 'grunt-legacy-util' ); 15 16 16 mediaBuilds.forEach( function 17 mediaBuilds.forEach( function( build ) { 17 18 var path = SOURCE_DIR + 'wp-includes/js/media'; 18 mediaConfig[ build ] = { files 19 mediaConfig[ build ] = { files: {} }; 19 20 mediaConfig[ build ].files[ path + '-' + build + '.js' ] = [ path + '/' + build + '.manifest.js' ]; 20 } 21 }); 21 22 22 23 // Project configuration. 23 24 grunt.initConfig({ … … 57 58 } 58 59 }, 59 60 clean: { 60 all: [ BUILD_DIR],61 all: [ BUILD_DIR ], 61 62 dynamic: { 62 63 dot: true, 63 64 expand: true, 64 65 cwd: BUILD_DIR, 65 66 src: [] 66 67 }, 67 tinymce: [ '<%= concat.tinymce.dest %>'],68 qunit: [ 'tests/qunit/compiled.html']68 tinymce: [ '<%= concat.tinymce.dest %>' ], 69 qunit: [ 'tests/qunit/compiled.html' ] 69 70 }, 70 71 copy: { 71 72 files: { … … 115 116 dest: BUILD_DIR + 'wp-admin/css/wp-admin.min.css' 116 117 }, 117 118 { 118 src: 119 src: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css', 119 120 dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.min.css' 120 121 } 121 122 ] … … 130 131 version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd.HHMMss' ) ); 131 132 132 133 /* jshint quotmark: true */ 133 return "$wp_version = '" + version + "';";134 return '$wp_version = \'' + version + '\';'; 134 135 }); 135 136 } 136 137 }, … … 149 150 dest: 'tests/qunit/compiled.html', 150 151 options: { 151 152 processContent: function( src ) { 152 return src.replace( /(\".+?\/)src(\/.+?)(?:.min)?(.js\")/g , function( match, $1, $2, $3 ) { 153 return src.replace( /(\".+?\/)src(\/.+?)(?:.min)?(.js\")/g, function( match, $1, $2, $3 ) { 154 153 155 // Don't add `.min` to files that don't have it. 154 156 return $1 + 'build' + $2 + ( /jquery$/.test( $2 ) ? '' : '.min' ) + $3; 155 } 157 }); 156 158 } 157 159 } 158 160 } … … 164 166 cwd: SOURCE_DIR, 165 167 dest: BUILD_DIR, 166 168 ext: '.css', 167 src: [ 'wp-admin/css/colors/*/colors.scss'],169 src: [ 'wp-admin/css/colors/*/colors.scss' ], 168 170 options: { 169 171 outputStyle: 'expanded' 170 172 } … … 209 211 }, 210 212 rtlcss: { 211 213 options: { 214 212 215 // rtlcss options 213 216 opts: { 214 217 clean: false, … … 240 243 { 241 244 expr: /content/im, 242 245 action: function( prop, value ) { 243 if ( value === '"\\f141"') { // dashicons-arrow-left246 if ( '"\\f141"' === value ) { // dashicons-arrow-left 244 247 value = '"\\f139"'; 245 } else if ( value === '"\\f340"') { // dashicons-arrow-left-alt248 } else if ( '"\\f340"' === value ) { // dashicons-arrow-left-alt 246 249 value = '"\\f344"'; 247 } else if ( value === '"\\f341"') { // dashicons-arrow-left-alt2250 } else if ( '"\\f341"' === value ) { // dashicons-arrow-left-alt2 248 251 value = '"\\f345"'; 249 } else if ( value === '"\\f139"') { // dashicons-arrow-right252 } else if ( '"\\f139"' === value ) { // dashicons-arrow-right 250 253 value = '"\\f141"'; 251 } else if ( value === '"\\f344"') { // dashicons-arrow-right-alt254 } else if ( '"\\f344"' === value ) { // dashicons-arrow-right-alt 252 255 value = '"\\f340"'; 253 } else if ( value === '"\\f345"') { // dashicons-arrow-right-alt2256 } else if ( '"\\f345"' === value ) { // dashicons-arrow-right-alt2 254 257 value = '"\\f341"'; 255 258 } 256 259 return { prop: prop, value: value }; … … 292 295 src: [] 293 296 } 294 297 }, 298 eslint: { 299 grunt: { 300 options: { 301 configFile: 'node_modules/eslint-config-wordpress/index.js' 302 }, 303 src: [ 'Gruntfile.js' ] 304 }, 305 core: { 306 options: { 307 configFile: 'node_modules/eslint-config-wordpress/index.js' 308 }, 309 cwd: SOURCE_DIR, 310 src: [ 311 'wp-admin/js/*.js', 312 'wp-includes/js/*.js', 313 314 // Built scripts. 315 '!wp-includes/js/media-*', 316 317 // WordPress scripts inside directories 318 'wp-includes/js/jquery/jquery.table-hotkeys.js', 319 'wp-includes/js/mediaelement/wp-mediaelement.js', 320 'wp-includes/js/mediaelement/wp-playlist.js', 321 'wp-includes/js/plupload/handlers.js', 322 'wp-includes/js/plupload/wp-plupload.js', 323 'wp-includes/js/tinymce/plugins/wordpress/plugin.js', 324 'wp-includes/js/tinymce/plugins/wp*/plugin.js', 325 326 // Third party scripts 327 '!wp-admin/js/farbtastic.js', 328 '!wp-includes/js/backbone*.js', 329 '!wp-includes/js/swfobject.js', 330 '!wp-includes/js/underscore*.js', 331 '!wp-includes/js/colorpicker.js', 332 '!wp-includes/js/hoverIntent.js', 333 '!wp-includes/js/json2.js', 334 '!wp-includes/js/tw-sack.js', 335 '!wp-includes/js/twemoji.js', 336 '!**/*.min.js' 337 ] 338 }, 339 themes: { 340 options: { 341 configFile: 'node_modules/eslint-config-wordpress/index.js' 342 }, 343 expand: true, 344 cwd: SOURCE_DIR + 'wp-content/themes', 345 src: [ 346 'twenty*/**/*.js', 347 '!twenty{eleven,twelve,thirteen}/**', 348 349 // Third party scripts 350 '!twenty{fourteen,fifteen,sixteen,seventeen}/**/html5.js', 351 '!twentyseventeen/assets/js/jquery.scrollTo.js' 352 ] 353 } 354 }, 295 355 jshint: { 296 options: grunt.file.readJSON( '.jshintrc'),356 options: grunt.file.readJSON( '.jshintrc' ), 297 357 grunt: { 298 src: [ 'Gruntfile.js']358 src: [ 'Gruntfile.js' ] 299 359 }, 300 360 tests: { 301 361 src: [ … … 303 363 '!tests/qunit/vendor/*', 304 364 '!tests/qunit/editor/**' 305 365 ], 306 options: grunt.file.readJSON( 'tests/qunit/.jshintrc')366 options: grunt.file.readJSON( 'tests/qunit/.jshintrc' ) 307 367 }, 308 368 themes: { 309 369 expand: true, … … 311 371 src: [ 312 372 'twenty*/**/*.js', 313 373 '!twenty{eleven,twelve,thirteen}/**', 374 314 375 // Third party scripts 315 376 '!twenty{fourteen,fifteen,sixteen}/js/html5.js', 316 377 '!twentyseventeen/assets/js/html5.js', … … 331 392 src: [ 332 393 'wp-admin/js/**/*.js', 333 394 'wp-includes/js/*.js', 395 334 396 // Built scripts. 335 397 '!wp-includes/js/media-*', 398 336 399 // WordPress scripts inside directories 337 400 'wp-includes/js/jquery/jquery.table-hotkeys.js', 338 401 'wp-includes/js/mediaelement/wp-mediaelement.js', … … 341 404 'wp-includes/js/plupload/wp-plupload.js', 342 405 'wp-includes/js/tinymce/plugins/wordpress/plugin.js', 343 406 'wp-includes/js/tinymce/plugins/wp*/plugin.js', 407 344 408 // Third party scripts 345 409 '!wp-admin/js/farbtastic.js', 346 410 '!wp-includes/js/backbone*.js', … … 353 417 '!wp-includes/js/twemoji.js', 354 418 '!**/*.min.js' 355 419 ], 420 356 421 // Remove once other JSHint errors are resolved 357 422 options: { 358 423 curly: false, 359 424 eqeqeq: false 360 425 }, 426 361 427 // Limit JSHint's run to a single specified file: 362 428 // 363 429 // grunt jshint:core --file=filename.js … … 367 433 // grunt jshint:core --file=path/to/filename.js 368 434 // 369 435 filter: function( filepath ) { 370 var index, file = grunt.option( 'file' ); 436 var index, 437 file = grunt.option( 'file' ); 371 438 372 439 // Don't filter when no target file is specified 373 440 if ( ! file ) { … … 393 460 '**/*.js', 394 461 '!**/*.min.js' 395 462 ], 463 396 464 // Limit JSHint's run to a single specified plugin directory: 397 465 // 398 466 // grunt jshint:plugins --dir=foldername 399 467 // 400 468 filter: function( dirpath ) { 401 var index, dir = grunt.option( 'dir' ); 469 var index, 470 dir = grunt.option( 'dir' ); 402 471 403 472 // Don't filter when no target folder is specified 404 473 if ( ! dir ) { … … 426 495 phpunit: { 427 496 'default': { 428 497 cmd: 'phpunit', 429 args: [ '--verbose', '-c', 'phpunit.xml.dist']498 args: [ '--verbose', '-c', 'phpunit.xml.dist' ] 430 499 }, 431 500 ajax: { 432 501 cmd: 'phpunit', 433 args: [ '--verbose', '-c', 'phpunit.xml.dist', '--group', 'ajax']502 args: [ '--verbose', '-c', 'phpunit.xml.dist', '--group', 'ajax' ] 434 503 }, 435 504 multisite: { 436 505 cmd: 'phpunit', 437 args: [ '--verbose', '-c', 'tests/phpunit/multisite.xml']506 args: [ '--verbose', '-c', 'tests/phpunit/multisite.xml' ] 438 507 }, 439 508 'external-http': { 440 509 cmd: 'phpunit', 441 args: [ '--verbose', '-c', 'phpunit.xml.dist', '--group', 'external-http']510 args: [ '--verbose', '-c', 'phpunit.xml.dist', '--group', 'external-http' ] 442 511 }, 443 512 'restapi-jsclient': { 444 513 cmd: 'phpunit', 445 args: [ '--verbose', '-c', 'phpunit.xml.dist', '--group', 'restapi-jsclient']514 args: [ '--verbose', '-c', 'phpunit.xml.dist', '--group', 'restapi-jsclient' ] 446 515 } 447 516 }, 448 517 uglify: { … … 488 557 cwd: SOURCE_DIR, 489 558 dest: BUILD_DIR, 490 559 ext: '.min.js', 491 src: [ 'wp-includes/js/wp-embed.js']560 src: [ 'wp-includes/js/wp-embed.js' ] 492 561 }, 493 562 media: { 494 563 expand: true, … … 504 573 }, 505 574 jqueryui: { 506 575 options: { 576 507 577 // Preserve comments that start with a bang. 508 578 preserveComments: /^!/ 509 579 }, … … 511 581 cwd: SOURCE_DIR, 512 582 dest: BUILD_DIR, 513 583 ext: '.min.js', 514 src: [ 'wp-includes/js/jquery/ui/*.js']584 src: [ 'wp-includes/js/jquery/ui/*.js' ] 515 585 }, 516 586 bookmarklet: { 517 587 options: { … … 524 594 }, 525 595 masonry: { 526 596 options: { 597 527 598 // Preserve comments that start with a bang. 528 599 preserveComments: /^!/ 529 600 }, … … 571 642 dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz' 572 643 } 573 644 }, 574 jsvalidate: {645 jsvalidate: { 575 646 options: { 576 647 globals: {}, 577 esprimaOptions: {},648 esprimaOptions: {}, 578 649 verbose: false 579 650 }, 580 651 build: { … … 612 683 files: [ 613 684 SOURCE_DIR + '**', 614 685 '!' + SOURCE_DIR + 'wp-includes/js/media/**', 686 615 687 // Ignore version control directories. 616 688 '!' + SOURCE_DIR + '**/.{svn,git}/**' 617 689 ], 618 tasks: [ 'clean:dynamic', 'copy:dynamic'],690 tasks: [ 'clean:dynamic', 'copy:dynamic' ], 619 691 options: { 620 692 dot: true, 621 693 spawn: false, … … 626 698 files: 'Gruntfile.js' 627 699 }, 628 700 colors: { 629 files: [ SOURCE_DIR + 'wp-admin/css/colors/**'],630 tasks: [ 'sass:colors']701 files: [ SOURCE_DIR + 'wp-admin/css/colors/**' ], 702 tasks: [ 'sass:colors' ] 631 703 }, 632 704 rtl: { 633 705 files: [ 634 706 SOURCE_DIR + 'wp-admin/css/*.css', 635 707 SOURCE_DIR + 'wp-includes/css/*.css' 636 708 ], 637 tasks: [ 'rtlcss:dynamic'],709 tasks: [ 'rtlcss:dynamic' ], 638 710 options: { 639 711 spawn: false, 640 712 interval: 2000 … … 645 717 'tests/qunit/**', 646 718 '!tests/qunit/editor/**' 647 719 ], 648 tasks: [ 'qunit']720 tasks: [ 'qunit' ] 649 721 } 650 722 } 651 723 }); 652 724 653 725 // Allow builds to be minimal 654 if ( grunt.option( 'minimal-copy' ) ) {726 if ( grunt.option( 'minimal-copy' ) ) { 655 727 var copyFilesOptions = grunt.config.get( 'copy.files.files' ); 656 728 copyFilesOptions[0].src.push( '!wp-content/plugins/**' ); 657 729 copyFilesOptions[0].src.push( '!wp-content/themes/!(twenty*)/**' ); … … 662 734 // Register tasks. 663 735 664 736 // RTL task. 665 grunt.registerTask( 'rtl', ['rtlcss:core', 'rtlcss:colors']);737 grunt.registerTask( 'rtl', [ 'rtlcss:core', 'rtlcss:colors' ]); 666 738 667 739 // Color schemes task. 668 grunt.registerTask( 'colors', ['sass:colors', 'postcss:colors']);740 grunt.registerTask( 'colors', [ 'sass:colors', 'postcss:colors' ]); 669 741 670 742 // JSHint task. 671 743 grunt.registerTask( 'jshint:corejs', [ … … 674 746 'jshint:themes', 675 747 'jshint:core', 676 748 'jshint:media' 677 ] 749 ]); 678 750 679 751 grunt.registerTask( 'restapi-jsclient', [ 680 752 'phpunit:restapi-jsclient', 681 753 'qunit:compiled' 682 ] 754 ]); 683 755 684 756 grunt.renameTask( 'watch', '_watch' ); 685 757 686 758 grunt.registerTask( 'watch', function() { 687 if ( ! this.args.length || this.args.indexOf( 'browserify' ) > -1) {759 if ( ! this.args.length || -1 < this.args.indexOf( 'browserify' ) ) { 688 760 grunt.config( 'browserify.options', { 689 761 browserifyOptions: { 690 762 debug: true 691 763 }, 692 764 watch: true 693 } 765 }); 694 766 695 767 grunt.task.run( 'browserify' ); 696 768 } 697 769 698 770 grunt.task.run( '_' + this.nameArgs ); 699 } 771 }); 700 772 701 773 grunt.registerTask( 'precommit:image', [ 702 774 'imagemin:core' 703 ] 775 ]); 704 776 705 777 grunt.registerTask( 'precommit:js', [ 706 778 'browserify', … … 708 780 'uglify:bookmarklet', 709 781 'uglify:masonry', 710 782 'qunit:compiled' 711 ] 783 ]); 712 784 713 785 grunt.registerTask( 'precommit:css', [ 714 786 'postcss:core' 715 ] 787 ]); 716 788 717 789 grunt.registerTask( 'precommit:php', [ 718 790 'phpunit' 719 ] 791 ]); 720 792 721 793 grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() { 722 794 var done = this.async(); … … 725 797 git: 'git status --short' 726 798 }; 727 799 728 find( 800 find([ 729 801 __dirname + '/.svn', 730 802 __dirname + '/.git', 731 803 path.dirname( __dirname ) + '/.svn' 732 ] 804 ]); 733 805 734 806 function find( set ) { 735 807 var dir; 736 808 737 809 if ( set.length ) { 738 810 fs.stat( dir = set.shift(), function( error ) { 739 error ? find( set ) : run( path.basename( dir ).substr( 1 ) ); 740 } ); 811 if ( error ) { 812 find( set ); 813 } else { 814 run( path.basename( dir ).substr( 1 ) ); 815 } 816 }); 741 817 } else { 742 818 grunt.fatal( 'This WordPress install is not under version control.' ); 743 819 } … … 746 822 function run( type ) { 747 823 var command = map[ type ].split( ' ' ); 748 824 749 grunt.util.spawn( 825 grunt.util.spawn({ 750 826 cmd: command.shift(), 751 827 args: command 752 828 }, function( error, result, code ) { 753 829 var taskList = []; 754 830 755 if ( code !== 0) {831 if ( 0 !== code ) { 756 832 grunt.fatal( 'The `' + map[ type ] + '` command returned a non-zero exit code.', code ); 757 833 } 758 834 … … 768 844 return regex.test( result.stdout ); 769 845 } 770 846 771 if ( 847 if ([ 'package.json', 'Gruntfile.js' ].some( testPath ) ) { 772 848 grunt.log.writeln( 'Configuration files modified. Running `prerelease`.' ); 773 849 taskList.push( 'prerelease' ); 774 850 } else { 775 if ( 851 if ([ 'png', 'jpg', 'gif', 'jpeg' ].some( testExtension ) ) { 776 852 grunt.log.writeln( 'Image files modified. Minifying.' ); 777 853 taskList.push( 'precommit:image' ); 778 854 } … … 782 858 grunt.log.writeln( extension.toUpperCase() + ' files modified. ' + extension.toUpperCase() + ' tests will be run.' ); 783 859 taskList.push( 'precommit:' + extension ); 784 860 } 785 } 861 }); 786 862 } 787 863 788 864 grunt.task.run( taskList ); 789 865 790 866 done(); 791 } 867 }); 792 868 } 793 } 869 }); 794 870 795 871 grunt.registerTask( 'copy:all', [ 796 872 'copy:files', 797 873 'copy:wp-admin-css-compat-rtl', 798 874 'copy:wp-admin-css-compat-min', 799 875 'copy:version' 800 ] 876 ]); 801 877 802 878 grunt.registerTask( 'build', [ 803 879 'clean:all', … … 817 893 'includes:emoji', 818 894 'includes:embed', 819 895 'jsvalidate:build' 820 ] 896 ]); 821 897 822 898 grunt.registerTask( 'prerelease', [ 823 899 'precommit:php', 824 900 'precommit:js', 825 901 'precommit:css', 826 902 'precommit:image' 827 ] 903 ]); 828 904 829 905 // Testing tasks. 830 grunt.registerMultiTask( 'phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {906 grunt.registerMultiTask( 'phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() { 831 907 grunt.util.spawn({ 832 908 cmd: this.data.cmd, 833 909 args: this.data.args, 834 910 opts: {stdio: 'inherit'} 835 }, this.async() );911 }, this.async() ); 836 912 }); 837 913 838 grunt.registerTask( 'qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',839 [ 'build', 'copy:qunit', 'qunit']);914 grunt.registerTask( 'qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.', 915 [ 'build', 'copy:qunit', 'qunit' ]); 840 916 841 grunt.registerTask( 'test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);917 grunt.registerTask( 'test', 'Runs all QUnit and PHPUnit tasks.', [ 'qunit:compiled', 'phpunit' ]); 842 918 843 919 // Travis CI tasks. 844 grunt.registerTask( 'travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]);845 grunt.registerTask( 'travis:phpunit', 'Runs PHPUnit Travis CI tasks.', 'phpunit');920 grunt.registerTask( 'travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]); 921 grunt.registerTask( 'travis:phpunit', 'Runs PHPUnit Travis CI tasks.', 'phpunit' ); 846 922 847 923 // Patch task. 848 grunt.renameTask( 'patch_wordpress', 'patch');924 grunt.renameTask( 'patch_wordpress', 'patch' ); 849 925 850 926 // Add an alias `apply` of the `patch` task name. 851 grunt.registerTask( 'apply', 'patch');927 grunt.registerTask( 'apply', 'patch' ); 852 928 853 929 // Default task. 854 grunt.registerTask( 'default', ['build']);930 grunt.registerTask( 'default', [ 'build' ]); 855 931 856 932 /* 857 933 * Automatically updates the `:dynamic` configurations 858 934 * so that only the changed files are updated. 859 935 */ 860 grunt.event.on( 'watch', function( action, filepath, target ) {936 grunt.event.on( 'watch', function( action, filepath, target ) { 861 937 var src; 862 938 863 if ( [ 'all', 'rtl', 'browserify' ].indexOf( target ) === -1) {939 if ( -1 === [ 'all', 'rtl', 'browserify' ].indexOf( target ) ) { 864 940 return; 865 941 } 866 942 867 943 src = [ path.relative( SOURCE_DIR, filepath ) ]; 868 944 869 if ( action === 'deleted') {870 grunt.config( 945 if ( 'deleted' === action ) { 946 grunt.config([ 'clean', 'dynamic', 'src' ], src ); 871 947 } else { 872 grunt.config( 948 grunt.config([ 'copy', 'dynamic', 'src' ], src ); 873 949 874 if ( target === 'rtl') {875 grunt.config( 950 if ( 'rtl' === target ) { 951 grunt.config([ 'rtlcss', 'dynamic', 'src' ], src ); 876 952 } 877 953 } 878 954 }); -
package.json
13 13 "license": "GPL-2.0+", 14 14 "devDependencies": { 15 15 "autoprefixer": "^6.5.1", 16 "eslint": "~3.19.0", 17 "eslint-config-wordpress": "~2.0.0", 16 18 "grunt": "~0.4.5", 17 19 "grunt-browserify": "~5.0.0", 18 20 "grunt-contrib-clean": "~1.0.0", … … 25 27 "grunt-contrib-qunit": "^1.2.0", 26 28 "grunt-contrib-uglify": "~2.0.0", 27 29 "grunt-contrib-watch": "~1.0.0", 30 "grunt-eslint": "~19.0.0", 28 31 "grunt-includes": "~0.5.1", 29 32 "grunt-jsvalidate": "~0.2.2", 30 33 "grunt-legacy-util": "^0.2.0", -
src/wp-content/themes/twentyfourteen/js/slider.js
20 20 // Make variables public. 21 21 slider.vars = $.extend( {}, $.featuredslider.defaults, options ); 22 22 23 namespace = slider.vars.namespace ,23 namespace = slider.vars.namespace; 24 24 25 25 // Store a reference to the slider object. 26 26 $.data( el, 'featuredslider', slider ); … … 105 105 var type = 'control-paging', 106 106 j = 1, 107 107 item, 108 slide,109 108 i; 110 109 111 110 slider.controlNavScaffold = $( '<ol class="' + namespace + 'control-nav ' + namespace + type + '"></ol>' ); 112 111 113 112 if ( slider.pagingCount > 1 ) { 114 113 for ( i = 0; i < slider.pagingCount; i++ ) { 115 slide = slider.slides.eq( i );116 114 item = '<a>' + j + '</a>'; 117 115 slider.controlNavScaffold.append( '<li>' + item + '</li>' ); 118 116 j++; … … 120 118 } 121 119 122 120 // CONTROLSCONTAINER 123 ( slider.controlsContainer ) ? $( slider.controlsContainer ).append( slider.controlNavScaffold ) : slider.append( slider.controlNavScaffold ); 121 if ( slider.controlsContainer ) { 122 $( slider.controlsContainer ).append( slider.controlNavScaffold ); 123 } else { 124 slider.append( slider.controlNavScaffold ); 125 } 124 126 methods.controlNav.set(); 125 127 126 128 methods.controlNav.active(); … … 162 164 slider.controlNav.eq( pos ).closest( 'li' ).remove(); 163 165 } 164 166 methods.controlNav.set(); 165 ( slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length ) ? slider.update( pos, action ) : methods.controlNav.active(); 167 if ( slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length ) { 168 slider.update( pos, action ); 169 } else { 170 methods.controlNav.active(); 171 } 166 172 } 167 173 }, 168 174 … … 315 321 return; 316 322 } 317 323 318 transX = -e.translationX ,324 transX = -e.translationX; 319 325 transY = -e.translationY; 320 326 321 327 // Accumulate translations. … … 349 355 } 350 356 351 357 if ( slider.animatingTo === slider.currentSlide && ! scrolling && dx !== null ) { 352 updateDx = dx ,358 updateDx = dx; 353 359 target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' ); 354 360 355 361 slider.featureAnimate( target ); … … 376 382 377 383 smoothHeight: function( dur ) { 378 384 var $obj = slider.viewport; 379 ( dur ) ? $obj.animate( { 'height': slider.slides.eq( slider.animatingTo ).height() }, dur ) : $obj.height( slider.slides.eq( slider.animatingTo ).height() ); 385 if ( dur ) { 386 $obj.animate( { 'height': slider.slides.eq( slider.animatingTo ).height() }, dur ); 387 } else { 388 $obj.height( slider.slides.eq( slider.animatingTo ).height() ); 389 } 380 390 }, 381 391 382 392 setToClearWatchedEvent: function() {