diff --git a/.gitignore b/.gitignore index a93dd75..fe5e678 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,23 @@ .DS_Store - -# Sass cache -/.sass-cache +.sass-cache # Development files -/node_modules -/bower_components +node_modules +bower_components # Development directories -/dist/ -/docs/ -/logs/ -/reports/ -/tmp/ +release/ +docs/ +tmp/ + +# Auto-Generated Files +!images/src/ +!images/src/* +!images/src/**/* +languages/*.pot +languages/*.po # Third-party dependencies -includes/vendor/ +includes/vendor/* +js/vendor/* +css/vendor/* diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..446b104 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,165 @@ +{ + "requireSpacesInConditionalExpression": { + "afterTest": true, + "beforeConsequent": true, + "afterConsequent": true, + "beforeAlternate": true + }, + "requireSpacesInFunction": { + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInAnonymousFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "requireMultipleVarDecl": "onevar", + "requireSpacesInsideObjectBrackets": "all", + "disallowSpaceAfterObjectKeys": true, + "requireSpaceAfterBinaryOperators": [ + "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", + "&=", "|=", "^=", "+=", + + "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", + "|", "^", "&&", "||", "===", "==", ">=", + "<=", "<", ">", "!=", "!==" + ], + "requireSpaceBeforeBinaryOperators": [ + "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", + "&=", "|=", "^=", "+=", + + "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", + "|", "^", "&&", "||", "===", "==", ">=", + "<=", "<", ">", "!=", "!==" + ], + "disallowKeywords": ["with"], + "disallowMultipleLineBreaks": true, + "validateLineBreaks": "LF", + "disallowMixedSpacesAndTabs": "smart", + "disallowTrailingWhitespace": true, + "requireCurlyBraces": [ + "if", + "else", + "for", + "while", + "do", + "try", + "catch" + ], + "requireSpaceBeforeBlockStatements": true, + "requireParenthesesAroundIIFE": true, + "requireBlocksOnNewline": true, + "requireOperatorBeforeLineBreak": [ + "?", + "=", + "+", + "-", + "/", + "*", + "==", + "===", + "!=", + "!==", + ">", + ">=", + "<", + "<=" + ], + "requireSpaceBeforeBinaryOperators": [ + "?", + "=", + "+", + "-", + "/", + "*", + "==", + "===", + "!=", + "!==", + ">", + ">=", + "<", + "<=" + ], + "requireSpaceAfterBinaryOperators": [ + "?", + "=", + "+", + "/", + "*", + ":", + "==", + "===", + "!=", + "!==", + ">", + ">=", + "<", + "<=" + ], + "disallowSpaceBeforeBinaryOperators": [","], + "disallowSpaceAfterBinaryOperators": [], + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], + "requireSpaceAfterPrefixUnaryOperators": ["!"], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireCamelCaseOrUpperCaseIdentifiers": true, + "disallowMultipleLineStrings": true, + "validateQuoteMarks": "'", + "validateIndentation": "\t", + "requireLineFeedAtFileEnd": true, + "requireDotNotation": true, + "disallowNewlineBeforeBlockStatements": true, + "requireSpaceAfterKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "void", + "while", + "with", + "return", + "typeof" + ], + "requireSpaceAfterLineComment": true, + "requireSpaceBeforeKeywords": [ + "else", + "while", + "catch" + ], + "requireSpaceBeforeObjectValues": true, + "requireSpaceBetweenArguments": true, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "requireSpacesInForStatement": true, + "requireSpacesInsideArrayBrackets": "all", + "requireSpacesInsideParentheses": { + "all": true, + "except": [ + "{", + "}", + "[", + "]", + "function" + ] + }, + "requireYodaConditions": true, + "validateParameterSeparator": ", ", + + "disallowTrailingComma": true, + "disallowPaddingNewlinesInBlocks": true, + "disallowEmptyBlocks": true, + "disallowQuotedKeysInObjects": "allButReserved", + "disallowDanglingUnderscores": true, + "requireCommaBeforeLineBreak": true, + "disallowKeywordsOnNewLine": ["else"], + "requireCapitalizedConstructors": true, + "safeContextKeyword": [ "that" ], + "jsDoc": { + "checkParamNames": true, + "checkRedundantParams": true, + "requireParamTypes": true + } +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..7ed49c5 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,25 @@ +{ + "boss": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "es3": true, + "expr": true, + "immed": true, + "noarg": true, + "onevar": true, + "quotmark": "single", + "trailing": true, + "undef": true, + "unused": true, + + "browser": true, + + "globals": { + "_": false, + "Backbone": false, + "jQuery": false, + "JSON": false, + "wp": false + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af77b3..4efc10e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ +## 0.3.0 + +There are quite a few internal changes in the plugin for this release, plus some nice new features and improvements on the front-end. We've streamlined everything as much as possible and also added support for some languages other than English! Here's a breakdown of everything that's changed: + +### New Features +- Automatic captioning for WordPress images and gallery items (Including Jetpack Galleries) +- Spanish language translation + +### Enhancements +- Updated [Featherlight](https://github.com/noelboss/featherlight/) to `1.3.3` +- Improved gallery styles on desktop and mobile devices +- Streamlined overall styles +- Added SVG icons for more visual consistency across various platforms +- Simplified the text used in the admin metabox to ease translations (props @toscho) + +### Bug Fixes +- Improved handling of images when certain caching plugins are enabled +- Prevented gallery arrows from being hijacked by WP Emoji +- Fixed a bug which allowed multiple light boxes to be opened using keyboard commands + +### Developer Stuff +- Reduced overhead by loading language files only when needed (props @toscho) +- Improved the save routine for our admin metabox (props @toscho) +- Added a `wp_featherlight_captions` filter to control auto-captioning. Filter it to false to disable captions. +- Re-structured the plugin's internal code base and deprecated plugin constants +- Added Grunt and Bower the plugin to allow easier updates and releases in the future + +### Added Language Support +- German +- Spanish +- French +- Portuguese (Brazil) +- Spanish (Peru) + ## 0.2.0 The primary feature in this release is the addition of a visual loader and the automatic lightboxing of external images. In prior versions, only images from the WordPress host domain were lightboxed automatically. This caused some problems with people using a CDN as the URLs were treated as external. diff --git a/README.md b/README.md index 8dce695..7e56151 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,21 @@ An ultra lightweight jQuery lightbox for WordPress images and galleries. __Contributors:__ [Robert Neu](https://github.com/robneu) -__Requires:__ WordPress 4.1 -__Tested up to:__ WordPress 4.2.2 +__Requires:__ WordPress 4.3 +__Tested up to:__ WordPress 4.3 __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html) - + ## Description ## -WP Featherlight is a WordPress plugin wrapper for the Featherlight jQuery lightbox plugin. When installed, the plugin will automatically display all standard WordPress images and galleries in a simple, minimalistic lightbox popup. It's also possible to load Videos, iframes, and ajax content using WP Featherlight by adding data attributes to your content. For more details on custom content loading, check out the [featherlight documentation](https://github.com/noelboss/featherlight/#usage). +WP Featherlight is a WordPress plugin wrapper for the Featherlight jQuery lightbox plugin. When installed, the plugin will automatically display all standard WordPress images and galleries in a simple, minimalistic lightbox popup. + +In order for WordPress images and galleries to be lightboxed, you need to select the "Media File" option when choosing where the thumbnails should link. You can also select the "Custom Link" option if you make sure to link directly to an image file. This should work for any image file even if it's hosted on another website. + + + +It's also possible to load Videos, iframes, and ajax content using WP Featherlight by adding data attributes to your content. For more details on custom content loading, check out the [featherlight documentation](https://github.com/noelboss/featherlight/#usage). There are no settings for WP Featherlight, so you should be able to install it without needing to configure anything. In the event you don't want a lightbox on certain pages or posts, there is an option to disable it from within the post editor screen. @@ -25,6 +31,12 @@ If you find a display problem, it may be related to your theme but please [open The best way to install this plugin is to either [download a copy](https://wordpress.org/plugins/wp-featherlight/) from the WordPress.org repository or search for "WP Featherlight" from your WordPress admin dashboard. +## Developer Notes ## + +While there are no options in the plugin, there are some handy filters to modify the default behavior. As of `0.3.0` all images which use the default WordPress captions will also include a caption when the image is lightboxed. To disable this behavior, filter `wp_featherlight_captions` to false. + +You can also disable inclusion of the CSS and JavaScript conditionally using filters which can be found in the `/includes/class-scripts.php` file. If you have questions about how any part of the plugin works, please don't hesitate to [open an issue](https://github.com/wpsitecare/wp-featherlight/issues). + ## Contributing ## -If you're a developer, the most current version can be found on the [develop branch](https://github.com/wpsitecare/wp-featherlight/tree/develop). Pull requests, issues, and any feedback is more than welcome. If you would like to contribute code, please make your pull requests against the develop branch rather than the master. +If you're a developer, the most current version can be found on the [develop branch](https://github.com/wpsitecare/wp-featherlight/tree/develop). Pull requests, issues, and any feedback are all more than welcome. If you would like to contribute code, please make your pull requests against the develop branch rather than the master. diff --git a/admin/class-meta.php b/admin/class-meta.php new file mode 100644 index 0000000..ba548bd --- /dev/null +++ b/admin/class-meta.php @@ -0,0 +1,160 @@ +wp_hooks(); + } + + /** + * Hook into WordPress. + * + * @since 0.1.0 + * @access protected + * @return void + */ + protected function wp_hooks() { + add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); + + if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) { + $this->user_data = $_POST; + add_action( 'save_post', array( $this, 'save_meta_boxes' ) ); + } + } + + /** + * Determine if the request to save data should be allowed to proceed. + * + * @since 0.3.0 + * @access protected + * @param int $post_id Post ID. + * @return bool Whether or not this is a valid request to save our data. + */ + protected function validate_request( $post_id ) { + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { + return false; + } + + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { + return false; + } + + if ( defined( 'DOING_CRON' ) && DOING_CRON ) { + return false; + } + + if ( ! current_user_can( 'edit_post', $post_id ) ) { + return false; + } + + if ( ! isset( $this->user_data[ $this->nonce_name ] ) ) { + return false; + } + + if ( ! wp_verify_nonce( $this->user_data[ $this->nonce_name ], $this->nonce_action ) ) { + return false; + } + // @link http://make.marketpress.com/multilingualpress/2014/10/how-to-disable-broken-save_post-callbacks/ + if ( is_multisite() && ms_is_switched() ) { + return false; + } + + return true; + } + + /** + * Add a metabox to control featherlight display options. + * + * @since 0.1.0 + * @access public + * @param string $post_type the current post type. + * @return void + */ + public function add_meta_boxes( $post_type ) { + $type = get_post_type_object( $post_type ); + if ( is_object( $type ) && $type->public ) { + add_meta_box( + 'wp_featherlight_options', + __( 'WP Featherlight Options', 'wp-featherlight' ), + array( $this, 'options_callback' ), + null, + 'side' + ); + } + } + + /** + * Output the content of our metabox. + * + * @since 0.1.0 + * @access public + * + * @param \WP_Post $post Post object. + * @return void + */ + public function options_callback( WP_Post $post ) { + wp_featherlight()->i18n->load(); + $disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true ); + $checked = empty( $disable ) ? '' : $disable; + require_once wp_featherlight()->get_dir() . 'admin/templates/metabox-sidebar.php'; + } + + /** + * Callback function for saving our meta box data. + * + * @since 0.1.0 + * @access public + * @param int $post_id Post ID. + * @return bool Whether or not data has been saved. + */ + public function save_meta_boxes( $post_id ) { + if ( ! $this->validate_request( $post_id ) ) { + return false; + } + + $value = isset( $this->user_data['wp_featherlight_disable'] ) ? 'yes' : ''; + + return (bool) update_post_meta( $post_id, 'wp_featherlight_disable', $value ); + } + +} diff --git a/templates/admin/metabox-sidebar.php b/admin/templates/metabox-sidebar.php similarity index 53% rename from templates/admin/metabox-sidebar.php rename to admin/templates/metabox-sidebar.php index fa82c33..3291734 100644 --- a/templates/admin/metabox-sidebar.php +++ b/admin/templates/metabox-sidebar.php @@ -2,17 +2,17 @@ /** * Template to display the WP Featherlight admin sidebar meta box. * - * @package WPFeatherlight + * @package WPFeatherlight\Admin\Templates * @author Robert Neu - * @copyright Copyright (c) 2015, Robert Neu + * @copyright Copyright (c) 2015, WP Site Care * @license GPL-2.0+ * @since 0.1.0 */ ?> -
+nonce_action, $this->nonce_name ); ?> diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..ce52f1d --- /dev/null +++ b/bower.json @@ -0,0 +1,10 @@ +{ + "name": "wp-featherlight", + "version": "0.1.0", + "private": true, + "dependencies": { + "featherlight": "~1.3.3", + "jquery-detect-swipe": "~2.1.1" + }, + "devDependencies": {} +} diff --git a/js/.jshintrc b/config/.jshintrc similarity index 62% rename from js/.jshintrc rename to config/.jshintrc index 1dc28a9..8dd74f4 100644 --- a/js/.jshintrc +++ b/config/.jshintrc @@ -3,22 +3,14 @@ "curly": true, "eqeqeq": true, "eqnull": true, - "es3": true, "immed": true, "latedef": true, "newcap": true, "noarg": true, "quotmark": "single", "sub": true, - "strict": true, "undef": true, "unused": true, - "browser": true, - "jquery": true, - - "globals": { - "exports": true, - "module": false - } + "node": true } diff --git a/config/grunt/aliases.js b/config/grunt/aliases.js new file mode 100644 index 0000000..d74fef6 --- /dev/null +++ b/config/grunt/aliases.js @@ -0,0 +1,46 @@ +module.exports = function() { + 'use strict'; + var tasks = { + 'build:dependencies:fonts': [ + 'clean:fonts', + 'shell:bower', + 'copy:bowerfonts' + ], + 'build:dependencies:css': [ + 'clean:css', + 'shell:bower', + 'copy:bowercss' + ], + 'build:dependencies:js': [ + 'clean:js', + 'shell:bower', + 'copy:bowerjs' + ], + 'build:fonts': [ + 'build:dependencies:fonts', + 'newer:copy:fonts' + ], + 'build:css': [ + 'build:dependencies:css', + 'newer:sass', + 'newer:usebanner', + 'newer:postcss', + 'newer:wpcss', + 'newer:rtlcss', + 'newer:cssmin', + 'newer:replace:style', + 'newer:copy:css' + ], + 'build:images': [ + 'newer:imagemin:images', + 'newer:copy:images' + ], + 'build:js': [ + 'build:dependencies:js', + 'newer:concat:js', + 'newer:uglify' + ] + }; + + return tasks; +}; diff --git a/config/grunt/concat.js b/config/grunt/concat.js new file mode 100644 index 0000000..98e0bf1 --- /dev/null +++ b/config/grunt/concat.js @@ -0,0 +1,12 @@ +// https://github.com/gruntjs/grunt-contrib-concat +module.exports = { + js: { + src: [ + '<%= paths.jsSrc %>vendor/jquery.detect_swipe.js', + '<%= paths.jsSrc %>vendor/featherlight.js', + '<%= paths.jsSrc %>vendor/featherlight.gallery.js', + '<%= paths.jsSrc %>wpFeatherlight.js' + ], + dest: 'js/<%= pkg.nameCamelLow %>.pkgd.js' + } +}; diff --git a/config/grunt/copy.js b/config/grunt/copy.js new file mode 100644 index 0000000..d7ab5ba --- /dev/null +++ b/config/grunt/copy.js @@ -0,0 +1,154 @@ +// https://github.com/gruntjs/grunt-contrib-copy +module.exports = { + css: { + files: [ + { + expand: true, + flatten: true, + cwd: '<%= paths.tmp %>', + src: [ + '*.css', + '**/*.css' + ], + dest: 'css/', + filter: 'isFile' + } + ] + }, + fonts: { + files: [ + { + expand: true, + flatten: true, + src: [ + '<%= paths.fontSrc %>fonts/**/*' + ], + dest: 'fonts/' + } + ] + }, + images: { + files: [ + { + expand: true, + flatten: true, + cwd: '<%= paths.tmp %>images', + src: [ '*' ], + dest: 'images', + filter: 'isFile' + } + ] + }, + languages: { + files: [ + { + expand: true, + cwd: '<%= paths.assets %><%= paths.languages %>', + src: [ '*.po' ], + dest: '<%= paths.plugin %><%= paths.languages %>', + filter: 'isFile' + } + ] + }, + bowercss: { + files: [ + { + expand: true, + cwd: 'bower_components/', + src: [], + dest: '<%= paths.cssSrc %>vendor' + } + ] + }, + bowerjs: { + files: [ + { + expand: true, + flatten: true, + cwd: 'bower_components/', + src: [ + 'featherlight/src/featherlight.js', + 'featherlight/src/featherlight.gallery.js', + 'jquery-detect-swipe/jquery.detect_swipe.js' + ], + dest: '<%= paths.jsSrc %>vendor' + } + ] + }, + bowerfonts: { + files: [] + }, + rename: { + files: [ + { + expand: true, + dot: true, + cwd: '', + dest: '', + src: [ + 'wp-featherlight.php' + ], + rename: function( dest, src ) { + return dest + src.replace( 'wp-featherlight', '<%= pkg.nameDashed %>' ); + } + }, + { + expand: true, + dot: true, + cwd: '<%= paths.jsSrc %>', + dest: '<%= paths.jsSrc %>', + src: [ + '**/*.js' + ], + rename: function( dest, src ) { + return dest + src.replace( 'wpFeatherlight', '<%= pkg.nameCamelLow %>' ); + } + }, + { + expand: true, + dot: true, + cwd: '<%= paths.cssSrc %>', + dest: '<%= paths.cssSrc %>', + src: [ + '**/*.scss' + ], + rename: function( dest, src ) { + return dest + src.replace( 'wp-featherlight', '<%= pkg.nameDashed %>' ); + } + } + ] + }, + release: { + files: [ + { + expand: true, + src: [ + '**', + '.*', + '!.git/**', + '!.sass-cache/**', + '!.jscsrc', + '!.jshintrc', + '!config/**', + '!release/**', + '!css/src/**', + '!languages/src/**', + '!bower_components/**', + '!node_modules/**', + '!tmp/**', + '!*.json', + '!*.sublime*', + '!.DS_Store', + '!.gitattributes', + '!.gitignore', + '!composer.lock', + '!gruntfile.js', + '!package.json', + '!CHANGELOG.md', + '!README.md' + ], + dest: '<%= paths.release %><%= pkg.version %>' + } + ] + } +}; diff --git a/config/grunt/replace.js b/config/grunt/replace.js new file mode 100644 index 0000000..8be9c96 --- /dev/null +++ b/config/grunt/replace.js @@ -0,0 +1,77 @@ +// https://github.com/outaTiME/grunt-replace +module.exports = { + style: { + options: { + patterns: [ + { + // Add line break between banner and minified + match: /\*\/(?=\S)/g, + replacement: '*/\n' + } + ] + }, + files: [ + { + expand: true, + src: [ + '<%= paths.tmp %>*.min.css' + ] + } + ] + }, + // Useful when forking this project into a new project + packagename: { + options: { + patterns: [ + { + match: /WP Featherlight/g, + replacement: '<%= pkg.nameSpaced %>' + }, + { + match: /wp featherlight/g, + replacement: '<%= pkg.nameSpacedLow %>' + }, + { + match: /wp-featherlight/g, + replacement: '<%= pkg.nameDashed %>' + }, + { + match: /wp_featherlight/g, + replacement: '<%= pkg.nameUscore %>' + }, + { + match: /WP_Featherlight/g, + replacement: '<%= pkg.nameUscoreCam %>' + }, + { + match: /WPFeatherlight/g, + replacement: '<%= pkg.nameCamel %>' + }, + { + match: /wpFeatherlight/g, + replacement: '<%= pkg.nameCamelLow %>' + } + ] + }, + files: [ + { + expand: true, + src: [ + '**', + '.*', + '!<%= paths.bower %>**/*', + '!**/*.{png,ico,jpg,gif}', + '!node_modules/**', + '!bower_components/**', + '!.sass-cache/**', + '!dist/**', + '!logs/**', + '!tmp/**', + '!*.sublime*', + '!.idea/**', + '!.DS_Store' + ] + } + ] + } +}; diff --git a/config/grunt/sass.js b/config/grunt/sass.js new file mode 100644 index 0000000..b187c16 --- /dev/null +++ b/config/grunt/sass.js @@ -0,0 +1,13 @@ +// https://github.com/sindresorhus/grunt-sass +module.exports = { + options: { + sourceMap: false, + lineNumbers: false, + outputStyle: 'expanded' + }, + plugin: { + files: { + '<%= paths.tmp %>wp-featherlight.css': '<%= paths.cssSrc %>wp-featherlight.scss' + } + } +}; diff --git a/css/src/_featherlight.scss b/css/src/_featherlight.scss deleted file mode 100644 index 848ecc7..0000000 --- a/css/src/_featherlight.scss +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Featherlight Animations - * Version 0.2.0 - * - * Copyright 2015, WP Site Care - * MIT Licensed. - */ -@import "parts/animation"; - - -/** - * Featherlight - ultra slim jQuery lightbox - * Version 1.2.3 - http://noelboss.github.io/featherlight/ - * - * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com) - * MIT Licensed. - */ -@import "parts/base"; - - -/** - * Featherlight Gallery - an extension for the ultra slim jQuery lightbox - * Version 1.2.3 - http://noelboss.github.io/featherlight/ - * - * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com) - * MIT Licensed. - */ -@import "parts/gallery"; diff --git a/css/src/partials/_animation.scss b/css/src/partials/_animation.scss new file mode 100644 index 0000000..e03c0a6 --- /dev/null +++ b/css/src/partials/_animation.scss @@ -0,0 +1,33 @@ + @keyframes featherlightLoader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } + } + +.featherlight-loading { + .featherlight-content { + animation: featherlightLoader 1s infinite linear; + background: transparent; + border: 8px solid $loader-primary-color; + border-left-color: $loader-secondary-color; + font-size: 10px; + } + + .featherlight-content, + .featherlight-content:after { + border-radius: 50%; + height: 10em; + width: 10em; + } + + .featherlight-close, + .featherlight-inner { + display: none; + } +} diff --git a/css/src/partials/_base.scss b/css/src/partials/_base.scss new file mode 100644 index 0000000..d42936d --- /dev/null +++ b/css/src/partials/_base.scss @@ -0,0 +1,108 @@ +.featherlight { + background: transparent; + cursor: zoom-out; + display: none; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + text-align: center; + white-space: nowrap; + z-index: 2147483647; + + * { + box-sizing: border-box; + } + + &:last-of-type { + background: $underlay-background-color; + } + + &:before { + content: ""; + display: inline-block; + height: 100%; + margin-right: -0.25em; + vertical-align: middle; + } + + .featherlight-content { + background: $content-background-color; + border: 0; + cursor: auto; + display: inline-block; + max-height: 80%; + max-width: 90%; + min-width: inherit; + overflow: visible; + padding: 0; + position: relative; + text-align: left; + vertical-align: middle; + white-space: normal; + + @media screen and (min-width: 980px) { + max-height: 90%; + } + } + + .featherlight-inner { + display: block; + } + + .featherlight-close-icon { + cursor: pointer; + background: $close-icon; + background-repeat: no-repeat; + background-position: center; + background-size: 100% auto; + display: block; + top: 25px; + right: 25px; + text-align: center; + width: 30px; + height: 30px; + position: fixed; + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + z-index: 9999; + } + + .featherlight-image { + max-width: 100%; + } + + iframe { + border: 0; + } +} + +[data-featherlight] { + cursor: zoom-in; +} + +.featherlight-iframe .featherlight-content { + border-bottom: 0; + padding: 0; +} + +.featherlight-content .caption { + color: $caption-text-color; + font-size: 16px; + font-weight: lighter; + max-width: 100%; + overflow: hidden; + position: absolute; + text-align: left; + text-overflow: ellipsis; + white-space: nowrap; + + &:hover, + &:focus { + white-space: normal; + overflow: visible; + } +} diff --git a/css/src/partials/_gallery.scss b/css/src/partials/_gallery.scss new file mode 100644 index 0000000..359c000 --- /dev/null +++ b/css/src/partials/_gallery.scss @@ -0,0 +1,45 @@ +.featherlight-next, +.featherlight-previous { + background-size: 100% auto; + background-repeat: no-repeat; + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + cursor: pointer; + display: block; + position: fixed; + opacity: 0.4; + top: 50%; + height: 60px; + margin-top: -30px; + width: 60px; + user-select: none; + + span { + display: none; + } + + &:hover, + &:focus { + opacity: 1; + } +} + +/* rtl:ignore */ +.featherlight-next { + background-image: $next-icon; + background-position: 0 0; + right: 10px; +} + +/* rtl:ignore */ +.featherlight-previous { + background-image: $prev-icon; + background-position: -5px 0; + left: 10px; +} + +.featherlight-loading .featherlight-previous, +.featherlight-loading .featherlight-next { + display: none; +} diff --git a/css/src/parts/_animation.scss b/css/src/parts/_animation.scss deleted file mode 100644 index a37add9..0000000 --- a/css/src/parts/_animation.scss +++ /dev/null @@ -1,8 +0,0 @@ -@keyframes featherlightLoader { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} diff --git a/css/src/parts/_base.scss b/css/src/parts/_base.scss deleted file mode 100644 index ed2713b..0000000 --- a/css/src/parts/_base.scss +++ /dev/null @@ -1,105 +0,0 @@ -.featherlight { - display: none; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 2147483647; - text-align: center; - white-space: nowrap; - cursor: pointer; - background: rgba(0, 0, 0, 0); - - * { - box-sizing: border-box; - } - - &:last-of-type { - background: rgba(0, 0, 0, 0.8); - } - - &:before { - content: ""; - display: inline-block; - height: 100%; - vertical-align: middle; - margin-right: -0.25em; - } - - .featherlight-content { - background: #fff; - position: relative; - text-align: left; - vertical-align: middle; - display: inline-block; - overflow: auto; - padding: 0; - border: 0; - min-width: inherit; - max-height: 95%; - max-width: 90%; - cursor: auto; - white-space: normal; - } - - .featherlight-inner { - display: block; - } - - .featherlight-close-icon { - position: absolute; - z-index: 9999; - top: 0; - right: 0; - line-height: 25px; - width: 20px; - cursor: pointer; - text-align: center; - font: Arial, sans-serif; - background: rgba(255, 255, 255, 0.3); - color: #000; - } - - .featherlight-image { - max-width: 100%; - border: 20px solid #fff; - - @media only screen and (max-width: 1024px) { - border: 10px solid #fff; - } - } - - iframe { - border: 0; - } -} - -.featherlight-iframe .featherlight-content { - border-bottom: 0; - padding: 0; -} - -/* Animated Loader ---------------------------------------------- */ -.featherlight-loading { - .featherlight-content { - animation: featherlightLoader 1s infinite linear; - background: transparent; - border: 8px solid #909090; - border-left-color: #fff; - font-size: 10px; - } - - .featherlight-content, - .featherlight-content:after { - border-radius: 50%; - width: 10em; - height: 10em; - } - - .featherlight-close, - .featherlight-inner { - display: none; - } -} diff --git a/css/src/parts/_gallery.scss b/css/src/parts/_gallery.scss deleted file mode 100644 index 31cc3bc..0000000 --- a/css/src/parts/_gallery.scss +++ /dev/null @@ -1,75 +0,0 @@ -.featherlight-next, -.featherlight-previous { - background: rgba(0, 0, 0, 0); // IE9 hack to fix navigation display - display: block; - position: absolute; - top: 20px; - right: 20px; - bottom: 0; - left: 80%; - cursor: pointer; - user-select: none; - - @media only screen and (max-width: 1024px) { - top: 10px; - right: 10px; - left: 85%; - } - - &:hover, - &:focus { - background: rgba(255, 255, 255, 0.25); - - @media only screen and (max-width: 1024px) { - background: none; - } - - span { - display: inline-block; - } - } - - span { - display: none; - position: absolute; - top: 50%; - left: 5%; - width: 82%; - text-align: center; - font-size: 80px; - line-height: 80px; - margin-top: -40px; - text-shadow: 0 0 5px #fff; - color: #fff; - font-style: normal; - font-weight: normal; - - @media only screen and (max-width: 1024px) { - display: block; - margin-top: -30px; - font-size: 40px; - } - } -} - -.featherlight-previous { - left: 20px; - right: 80%; - - @media only screen and (max-width: 1024px) { - left: 10px; - right: 85%; - } -} - -.featherlight-next span { - right: 5%; - left: auto; -} - -.featherlight-loading { - .featherlight-previous, - .featherlight-next { - display: none; - } -} diff --git a/css/src/variables/_colors.scss b/css/src/variables/_colors.scss new file mode 100644 index 0000000..214b8bf --- /dev/null +++ b/css/src/variables/_colors.scss @@ -0,0 +1,5 @@ +$underlay-background-color: rgba(0, 0, 0, 0.90); +$content-background-color: #fff; +$caption-text-color: #fff; +$loader-primary-color: #909090; +$loader-secondary-color: #fff; diff --git a/css/src/variables/_icons.scss b/css/src/variables/_icons.scss new file mode 100644 index 0000000..8ddbff6 --- /dev/null +++ b/css/src/variables/_icons.scss @@ -0,0 +1,3 @@ +$close-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E"); +$next-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E"); +$prev-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E"); diff --git a/css/src/wp-featherlight.scss b/css/src/wp-featherlight.scss new file mode 100644 index 0000000..000e087 --- /dev/null +++ b/css/src/wp-featherlight.scss @@ -0,0 +1,16 @@ +@import "variables/colors"; +@import "variables/icons"; + +/* Base Styles +--------------------------------------------- */ +@import "partials/base"; + + +/* Animated Loader +--------------------------------------------- */ +@import "partials/animation"; + + +/* Gallery +--------------------------------------------- */ +@import "partials/gallery"; diff --git a/css/wp-featherlight-rtl.css b/css/wp-featherlight-rtl.css new file mode 100644 index 0000000..023f4c1 --- /dev/null +++ b/css/wp-featherlight-rtl.css @@ -0,0 +1,231 @@ +/**! + * Plugin Name: WP Featherlight + * Version: 0.3.0 + * Author: WP Site Care + * License: GPL-2.0+ + */ + + +/* Base Styles +--------------------------------------------- */ + +.featherlight { + background: transparent; + cursor: -webkit-zoom-out; + cursor: -moz-zoom-out; + cursor: zoom-out; + display: none; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + text-align: center; + white-space: nowrap; + z-index: 2147483647; +} + +.featherlight * { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.featherlight:last-of-type { + background: rgba(0, 0, 0, 0.9); +} + +.featherlight:before { + content: ""; + display: inline-block; + height: 100%; + margin-left: -0.25em; + vertical-align: middle; +} + +.featherlight .featherlight-content { + background: #fff; + border: 0; + cursor: auto; + display: inline-block; + max-height: 80%; + max-width: 90%; + min-width: inherit; + overflow: visible; + padding: 0; + position: relative; + text-align: right; + vertical-align: middle; + white-space: normal; +} + +@media screen and (min-width: 980px) { + .featherlight .featherlight-content { + max-height: 90%; + } +} + +.featherlight .featherlight-inner { + display: block; +} + +.featherlight .featherlight-close-icon { + background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E"); + background-position: center; + background-repeat: no-repeat; + -webkit-background-size: 100% auto; + background-size: 100% auto; + cursor: pointer; + display: block; + height: 30px; + overflow: hidden; + position: fixed; + top: 25px; + left: 25px; + text-align: center; + text-indent: 100%; + white-space: nowrap; + width: 30px; + z-index: 9999; +} + +.featherlight .featherlight-image { + max-width: 100%; +} + +.featherlight iframe { + border: 0; +} + +[data-featherlight] { + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; +} + +.featherlight-iframe .featherlight-content { + border-bottom: 0; + padding: 0; +} + +.featherlight-content .caption { + color: #fff; + font-size: 16px; + font-weight: lighter; + max-width: 100%; + overflow: hidden; + position: absolute; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; +} + +.featherlight-content .caption:hover, +.featherlight-content .caption:focus { + overflow: visible; + white-space: normal; +} + + +/* Animated Loader +--------------------------------------------- */ + +@-webkit-keyframes featherlightLoader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(-360deg); + transform: rotate(-360deg); + } +} + +@keyframes featherlightLoader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(-360deg); + transform: rotate(-360deg); + } +} + +.featherlight-loading .featherlight-content { + -webkit-animation: featherlightLoader 1s infinite linear; + animation: featherlightLoader 1s infinite linear; + background: transparent; + border: 8px solid #909090; + border-right-color: #fff; + font-size: 10px; +} + +.featherlight-loading .featherlight-content, +.featherlight-loading .featherlight-content:after { + -webkit-border-radius: 50%; + border-radius: 50%; + height: 10em; + width: 10em; +} + +.featherlight-loading .featherlight-close, +.featherlight-loading .featherlight-inner { + display: none; +} + + +/* Gallery +--------------------------------------------- */ + +.featherlight-next, +.featherlight-previous { + background-repeat: no-repeat; + -webkit-background-size: 100% auto; + background-size: 100% auto; + cursor: pointer; + display: block; + height: 60px; + margin-top: -30px; + opacity: 0.4; + overflow: hidden; + position: fixed; + top: 50%; + text-indent: 100%; + -moz-user-select: none; + -ms-user-select: none; + -webkit-user-select: none; + user-select: none; + white-space: nowrap; + width: 60px; +} + +.featherlight-next span, +.featherlight-previous span { + display: none; +} + +.featherlight-next:hover, +.featherlight-next:focus, +.featherlight-previous:hover, +.featherlight-previous:focus { + opacity: 1; +} +.featherlight-next { + background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E"); + background-position: 0 0; + right: 10px; +} +.featherlight-previous { + background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E"); + background-position: -5px 0; + left: 10px; +} + +.featherlight-loading .featherlight-previous, +.featherlight-loading .featherlight-next { + display: none; +} diff --git a/css/wp-featherlight-rtl.min.css b/css/wp-featherlight-rtl.min.css new file mode 100644 index 0000000..4bbd9ea --- /dev/null +++ b/css/wp-featherlight-rtl.min.css @@ -0,0 +1 @@ +.featherlight{background:0 0;cursor:-webkit-zoom-out;cursor:-moz-zoom-out;cursor:zoom-out;display:none;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:fixed;top:0;left:0;bottom:0;right:0;text-align:center;white-space:nowrap;z-index:2147483647}.featherlight *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,.9)}.featherlight:before{content:"";display:inline-block;height:100%;margin-left:-.25em;vertical-align:middle}.featherlight .featherlight-content{background:#fff;border:0;cursor:auto;display:inline-block;max-height:80%;max-width:90%;min-width:inherit;overflow:visible;padding:0;position:relative;text-align:right;vertical-align:middle;white-space:normal}@media screen and (min-width:980px){.featherlight .featherlight-content{max-height:90%}}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E) center no-repeat;-webkit-background-size:100% auto;background-size:100% auto;cursor:pointer;display:block;height:30px;overflow:hidden;position:fixed;top:25px;left:25px;text-align:center;text-indent:100%;white-space:nowrap;width:30px;z-index:9999}.featherlight .featherlight-image{max-width:100%}.featherlight iframe{border:0}[data-featherlight]{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight-content .caption{color:#fff;font-size:16px;font-weight:lighter;max-width:100%;overflow:hidden;position:absolute;text-align:right;text-overflow:ellipsis;white-space:nowrap}.featherlight-content .caption:focus,.featherlight-content .caption:hover{overflow:visible;white-space:normal}@-webkit-keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(-360deg);transform:rotate(-360deg)}}@keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(-360deg);transform:rotate(-360deg)}}.featherlight-loading .featherlight-content{-webkit-animation:featherlightLoader 1s infinite linear;animation:featherlightLoader 1s infinite linear;background:0 0;border:8px solid #909090;border-right-color:#fff;font-size:10px}.featherlight-loading .featherlight-content,.featherlight-loading .featherlight-content:after{-webkit-border-radius:50%;border-radius:50%;height:10em;width:10em}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.featherlight-next,.featherlight-previous{background-repeat:no-repeat;-webkit-background-size:100% auto;background-size:100% auto;cursor:pointer;display:block;height:60px;margin-top:-30px;opacity:.4;overflow:hidden;position:fixed;top:50%;text-indent:100%;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;white-space:nowrap;width:60px}.featherlight-loading .featherlight-next,.featherlight-loading .featherlight-previous,.featherlight-next span,.featherlight-previous span{display:none}.featherlight-next:focus,.featherlight-next:hover,.featherlight-previous:focus,.featherlight-previous:hover{opacity:1}.featherlight-next{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E);background-position:0 0;right:10px}.featherlight-previous{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E);background-position:-5px 0;left:10px} \ No newline at end of file diff --git a/css/wp-featherlight.css b/css/wp-featherlight.css index 0e030ed..e9c3649 100644 --- a/css/wp-featherlight.css +++ b/css/wp-featherlight.css @@ -1,45 +1,21 @@ -/** - * Featherlight Animations - * Version 0.2.0 - * - * Copyright 2015, WP Site Care - * MIT Licensed. +/**! + * Plugin Name: WP Featherlight + * Version: 0.3.0 + * Author: WP Site Care + * License: GPL-2.0+ */ -@-webkit-keyframes featherlightLoader { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} -@keyframes featherlightLoader { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} +/* Base Styles +--------------------------------------------- */ -/** - * Featherlight - ultra slim jQuery lightbox - * Version 1.2.3 - http://noelboss.github.io/featherlight/ - * - * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com) - * MIT Licensed. - */ .featherlight { background: transparent; - cursor: pointer; + cursor: -webkit-zoom-out; + cursor: -moz-zoom-out; + cursor: zoom-out; display: none; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; position: fixed; top: 0; right: 0; @@ -57,7 +33,7 @@ } .featherlight:last-of-type { - background: rgba(0, 0, 0, 0.8); + background: rgba(0, 0, 0, 0.9); } .featherlight:before { @@ -73,10 +49,10 @@ border: 0; cursor: auto; display: inline-block; - max-height: 95%; + max-height: 80%; max-width: 90%; min-width: inherit; - overflow: auto; + overflow: visible; padding: 0; position: relative; text-align: left; @@ -84,48 +60,101 @@ white-space: normal; } +@media screen and (min-width: 980px) { + .featherlight .featherlight-content { + max-height: 90%; + } +} + .featherlight .featherlight-inner { display: block; } .featherlight .featherlight-close-icon { - background: rgba(255, 255, 255, 0.3); - color: #000; + background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E"); + background-position: center; + background-repeat: no-repeat; + -webkit-background-size: 100% auto; + background-size: 100% auto; cursor: pointer; - font: Arial, sans-serif; - line-height: 25px; - position: absolute; - top: 0; - right: 0; + display: block; + height: 30px; + overflow: hidden; + position: fixed; + top: 25px; + right: 25px; text-align: center; - width: 20px; + text-indent: 100%; + white-space: nowrap; + width: 30px; z-index: 9999; } .featherlight .featherlight-image { - border: 20px solid #fff; max-width: 100%; } -@media only screen and (max-width: 1024px) { - .featherlight .featherlight-image { - border: 10px solid #fff; - } -} - .featherlight iframe { border: 0; } +[data-featherlight] { + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; +} + .featherlight-iframe .featherlight-content { border-bottom: 0; padding: 0; } +.featherlight-content .caption { + color: #fff; + font-size: 16px; + font-weight: lighter; + max-width: 100%; + overflow: hidden; + position: absolute; + text-align: left; + text-overflow: ellipsis; + white-space: nowrap; +} + +.featherlight-content .caption:hover, +.featherlight-content .caption:focus { + overflow: visible; + white-space: normal; +} + /* Animated Loader --------------------------------------------- */ +@-webkit-keyframes featherlightLoader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes featherlightLoader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + .featherlight-loading .featherlight-content { -webkit-animation: featherlightLoader 1s infinite linear; animation: featherlightLoader 1s infinite linear; @@ -148,102 +177,56 @@ display: none; } -/** - * Featherlight Gallery - an extension for the ultra slim jQuery lightbox - * Version 1.2.3 - http://noelboss.github.io/featherlight/ - * - * Copyright 2015, Noel Raoul Bossart (http://www.noelboss.com) - * MIT Licensed. - */ + +/* Gallery +--------------------------------------------- */ + .featherlight-next, .featherlight-previous { - background: transparent; + background-repeat: no-repeat; + -webkit-background-size: 100% auto; + background-size: 100% auto; cursor: pointer; display: block; - position: absolute; - top: 20px; - right: 20px; - bottom: 0; - left: 80%; + height: 60px; + margin-top: -30px; + opacity: 0.4; + overflow: hidden; + position: fixed; + top: 50%; + text-indent: 100%; -moz-user-select: none; -ms-user-select: none; -webkit-user-select: none; user-select: none; + white-space: nowrap; + width: 60px; } -@media only screen and (max-width: 1024px) { - .featherlight-next, - .featherlight-previous { - top: 10px; - right: 10px; - left: 85%; - } +.featherlight-next span, +.featherlight-previous span { + display: none; } .featherlight-next:hover, .featherlight-next:focus, .featherlight-previous:hover, .featherlight-previous:focus { - background: rgba(255, 255, 255, 0.25); -} - -@media only screen and (max-width: 1024px) { - .featherlight-next:hover, - .featherlight-next:focus, - .featherlight-previous:hover, - .featherlight-previous:focus { - background: none; - } -} - -.featherlight-next:hover span, -.featherlight-next:focus span, -.featherlight-previous:hover span, -.featherlight-previous:focus span { - display: inline-block; -} - -.featherlight-next span, -.featherlight-previous span { - color: #fff; - display: none; - font-size: 80px; - font-style: normal; - font-weight: normal; - line-height: 80px; - margin-top: -40px; - position: absolute; - top: 50%; - left: 5%; - text-align: center; - text-shadow: 0 0 5px #fff; - width: 82%; + opacity: 1; } -@media only screen and (max-width: 1024px) { - .featherlight-next span, - .featherlight-previous span { - display: block; - font-size: 40px; - margin-top: -30px; - } +/* rtl:ignore */ +.featherlight-next { + background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E"); + background-position: 0 0; + right: 10px; } +/* rtl:ignore */ .featherlight-previous { - right: 80%; - left: 20px; -} - -@media only screen and (max-width: 1024px) { - .featherlight-previous { - right: 85%; - left: 10px; - } -} - -.featherlight-next span { - right: 5%; - left: auto; + background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E"); + background-position: -5px 0; + left: 10px; } .featherlight-loading .featherlight-previous, diff --git a/css/wp-featherlight.min.css b/css/wp-featherlight.min.css index 4ff35ce..cd70087 100644 --- a/css/wp-featherlight.min.css +++ b/css/wp-featherlight.min.css @@ -1 +1 @@ -@-webkit-keyframes featherlightLoader{0{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes featherlightLoader{0{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.featherlight{background:transparent;cursor:pointer;display:none;position:fixed;top:0;right:0;bottom:0;left:0;text-align:center;white-space:nowrap;z-index:2147483647}.featherlight *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,0.8)}.featherlight:before{content:"";display:inline-block;height:100%;margin-right:-0.25em;vertical-align:middle}.featherlight .featherlight-content{background:#fff;border:0;cursor:auto;display:inline-block;max-height:95%;max-width:90%;min-width:inherit;overflow:auto;padding:0;position:relative;text-align:left;vertical-align:middle;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{background:rgba(255,255,255,0.3);color:#000;cursor:pointer;font:Arial,sans-serif;line-height:25px;position:absolute;top:0;right:0;text-align:center;width:20px;z-index:9999}.featherlight .featherlight-image{border:20px solid #fff;max-width:100%}@media only screen and (max-width:1024px){.featherlight .featherlight-image{border:10px solid #fff}}.featherlight iframe{border:0}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight-loading .featherlight-content{-webkit-animation:featherlightLoader 1s infinite linear;animation:featherlightLoader 1s infinite linear;background:transparent;border:8px solid #909090;border-left-color:#fff;font-size:10px}.featherlight-loading .featherlight-content,.featherlight-loading .featherlight-content:after{-webkit-border-radius:50%;border-radius:50%;height:10em;width:10em}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.featherlight-next,.featherlight-previous{background:transparent;cursor:pointer;display:block;position:absolute;top:20px;right:20px;bottom:0;left:80%;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}@media only screen and (max-width:1024px){.featherlight-next,.featherlight-previous{top:10px;right:10px;left:85%}}.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:rgba(255,255,255,0.25)}@media only screen and (max-width:1024px){.featherlight-next:hover,.featherlight-next:focus,.featherlight-previous:hover,.featherlight-previous:focus{background:0}}.featherlight-next:hover span,.featherlight-next:focus span,.featherlight-previous:hover span,.featherlight-previous:focus span{display:inline-block}.featherlight-next span,.featherlight-previous span{color:#fff;display:none;font-size:80px;font-style:normal;font-weight:normal;line-height:80px;margin-top:-40px;position:absolute;top:50%;left:5%;text-align:center;text-shadow:0 0 5px #fff;width:82%}@media only screen and (max-width:1024px){.featherlight-next span,.featherlight-previous span{display:block;font-size:40px;margin-top:-30px}}.featherlight-previous{right:80%;left:20px}@media only screen and (max-width:1024px){.featherlight-previous{right:85%;left:10px}}.featherlight-next span{right:5%;left:auto}.featherlight-loading .featherlight-previous,.featherlight-loading .featherlight-next{display:none} \ No newline at end of file +.featherlight{background:0 0;cursor:-webkit-zoom-out;cursor:-moz-zoom-out;cursor:zoom-out;display:none;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:fixed;top:0;right:0;bottom:0;left:0;text-align:center;white-space:nowrap;z-index:2147483647}.featherlight *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.featherlight:last-of-type{background:rgba(0,0,0,.9)}.featherlight:before{content:"";display:inline-block;height:100%;margin-right:-.25em;vertical-align:middle}.featherlight .featherlight-content{background:#fff;border:0;cursor:auto;display:inline-block;max-height:80%;max-width:90%;min-width:inherit;overflow:visible;padding:0;position:relative;text-align:left;vertical-align:middle;white-space:normal}@media screen and (min-width:980px){.featherlight .featherlight-content{max-height:90%}}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M21%204.41L19.59%203%2012%2010.59%204.41%203%203%204.41%2010.59%2012%203%2019.59%204.41%2021%2012%2013.41%2019.59%2021%2021%2019.59%2013.41%2012%2021%204.41z%22/%3E%0A%3C/svg%3E) center no-repeat;-webkit-background-size:100% auto;background-size:100% auto;cursor:pointer;display:block;height:30px;overflow:hidden;position:fixed;top:25px;right:25px;text-align:center;text-indent:100%;white-space:nowrap;width:30px;z-index:9999}.featherlight .featherlight-image{max-width:100%}.featherlight iframe{border:0}[data-featherlight]{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight-content .caption{color:#fff;font-size:16px;font-weight:lighter;max-width:100%;overflow:hidden;position:absolute;text-align:left;text-overflow:ellipsis;white-space:nowrap}.featherlight-content .caption:focus,.featherlight-content .caption:hover{overflow:visible;white-space:normal}@-webkit-keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes featherlightLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.featherlight-loading .featherlight-content{-webkit-animation:featherlightLoader 1s infinite linear;animation:featherlightLoader 1s infinite linear;background:0 0;border:8px solid #909090;border-left-color:#fff;font-size:10px}.featherlight-loading .featherlight-content,.featherlight-loading .featherlight-content:after{-webkit-border-radius:50%;border-radius:50%;height:10em;width:10em}.featherlight-loading .featherlight-close,.featherlight-loading .featherlight-inner{display:none}.featherlight-next,.featherlight-previous{background-repeat:no-repeat;-webkit-background-size:100% auto;background-size:100% auto;cursor:pointer;display:block;height:60px;margin-top:-30px;opacity:.4;overflow:hidden;position:fixed;top:50%;text-indent:100%;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;white-space:nowrap;width:60px}.featherlight-loading .featherlight-next,.featherlight-loading .featherlight-previous,.featherlight-next span,.featherlight-previous span{display:none}.featherlight-next:focus,.featherlight-next:hover,.featherlight-previous:focus,.featherlight-previous:hover{opacity:1}.featherlight-next{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M8.59%2016.59L13.17%2012%208.59%207.41%2010%206l6%206-6%206-1.41-1.41z%22/%3E%0A%3C/svg%3E);background-position:0 0;right:10px}.featherlight-previous{background-image:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%0A%09%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M15.41%207.41L10.83%2012l4.58%204.59L14%2018l-6-6%206-6%201.41%201.41z%22/%3E%0A%3C/svg%3E);background-position:-5px 0;left:10px} \ No newline at end of file diff --git a/gruntfile.js b/gruntfile.js new file mode 100644 index 0000000..9e780ed --- /dev/null +++ b/gruntfile.js @@ -0,0 +1,9 @@ +/*jshint node:true */ + +module.exports = function( grunt ) { + 'use strict'; + var config = require( 'sitecare-plugin-config' ); + require( 'sitecare-grunt-config-loader' )( grunt, config ).init({ + pkg: grunt.file.readJSON( 'package.json' ) + }); +}; diff --git a/includes/class-i18n.php b/includes/class-i18n.php new file mode 100644 index 0000000..3dc5999 --- /dev/null +++ b/includes/class-i18n.php @@ -0,0 +1,106 @@ +text_domain = $text_domain; + $this->plugin_file = $plugin_file; + } + + /** + * Get the class running! + * + * @since 0.3.0 + * @access public + * @return void + */ + public function run() { + $this->wp_hooks(); + } + + /** + * Hook into WordPress. + * + * @since 0.3.0 + * @access protected + * @return void + */ + protected function wp_hooks() { + add_action( 'admin_head-plugins.php', array( $this, 'load' ) ); + } + + /** + * Loads translation file. + * + * @since 0.3.0 + * @access public + * @return bool true when the file was found, false otherwise. + */ + public function load() { + return load_plugin_textdomain( + $this->text_domain, + false, + dirname( plugin_basename( $this->plugin_file ) ) . '/languages' + ); + } + + /** + * Remove translations from memory. + * + * @since 0.3.0 + * @access public + * @return bool true if the text domain was loaded, false if it was not. + */ + public function unload() { + return unload_textdomain( $this->text_domain ); + } + + /** + * Whether or not the language has been loaded already. + * + * @since 0.3.0 + * @access public + * @return bool + */ + public function is_loaded() { + return is_textdomain_loaded( $this->text_domain ); + } + +} diff --git a/includes/class-plugin.php b/includes/class-plugin.php new file mode 100755 index 0000000..74835f4 --- /dev/null +++ b/includes/class-plugin.php @@ -0,0 +1,183 @@ +file = $args['file']; + $this->dir = plugin_dir_path( $this->file ); + $this->url = plugin_dir_url( $this->file ); + } + + /** + * Method to initialize the plugin. + * + * @since 0.1.0 + * @return void + */ + public function run() { + $this->includes(); + $this->instantiate(); + } + + /** + * Retrieve the plugin version number. + * + * @since 0.3.0 + * @access public + * @return string + */ + public function get_version() { + return self::VERSION; + } + + /** + * Retrieve a trailing slashed path to the plugin directory. + * + * @since 0.3.0 + * @access public + * @return string + */ + public function get_file() { + return $this->file; + } + + /** + * Retrieve a trailing slashed path to the plugin directory. + * + * @since 0.3.0 + * @access public + * @return string + */ + public function get_dir() { + return $this->dir; + } + + /** + * Retrieve a trailing slashed URL to the plugin directory. + * + * @since 0.3.0 + * @access public + * @return string + */ + public function get_url() { + return $this->url; + } + + /** + * Require all plugin files. + * + * @since 0.1.0 + * @access private + * @return void + */ + private function includes() { + require_once $this->dir . 'includes/class-scripts.php'; + require_once $this->dir . 'includes/class-i18n.php'; + if ( is_admin() ) { + require_once $this->dir . 'admin/class-meta.php'; + } + } + + /** + * Load all required files and get all of our classes running. + * + * @since 0.1.0 + * @access public + * @return void + */ + private function instantiate() { + $this->scripts = new WP_Featherlight_Scripts; + $this->scripts->run(); + if ( is_admin() ) { + $this->i18n = new WP_Featherlight_Language_Loader( 'wp-featherlight', $this->file ); + $this->meta = new WP_Featherlight_Admin_Meta; + $this->i18n->run(); + $this->meta->run(); + } + } + + /** + * Runs on plugin activation to set a default admin content label for all + * existing posts using the post title. + * + * @since 0.1.0 + * @access public + * @global $wpdb + * @return void + */ + public function activate() { + // Nothing yet. + } + +} diff --git a/includes/classes/scripts.php b/includes/class-scripts.php similarity index 71% rename from includes/classes/scripts.php rename to includes/class-scripts.php index e28d441..6d1229d 100644 --- a/includes/classes/scripts.php +++ b/includes/class-scripts.php @@ -2,9 +2,9 @@ /** * Methods used for filtering and displaying WP Featherlight images. * - * @package WPFeatherlight + * @package WPFeatherlight\Scripts * @author Robert Neu - * @copyright Copyright (c) 2015, Robert Neu + * @copyright Copyright (c) 2015, WP Site Care * @license GPL-2.0+ * @since 0.1.0 */ @@ -16,6 +16,16 @@ class WP_Featherlight_Scripts { protected $suffix; + protected $url; + + protected $version; + + public function __construct() { + $this->suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + $this->url = wp_featherlight()->get_url(); + $this->version = wp_featherlight()->get_version(); + } + /** * Get the class running! * @@ -24,21 +34,21 @@ class WP_Featherlight_Scripts { * @return void */ public function run() { - $this->suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; - self::wp_hooks(); + $this->wp_hooks(); } /** * Hook into WordPress. * * @since 0.1.0 - * @access public + * @access protected * @return void */ protected function wp_hooks() { - add_action( 'wp_enqueue_scripts', array( $this, 'load_css' ), 20 ); - add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 20 ); - add_action( 'wp_enqueue_scripts', array( $this, 'maybe_disable' ) ); + add_action( 'wp_enqueue_scripts', array( $this, 'load_css' ), 20 ); + add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 20 ); + add_action( 'wp_enqueue_scripts', array( $this, 'maybe_disable' ), 10 ); + add_action( 'body_class', array( $this, 'script_helpers' ), 10 ); } /** @@ -57,10 +67,12 @@ public function load_css() { } wp_enqueue_style( 'wp-featherlight', - WP_FEATHERLIGHT_URL . "css/wp-featherlight{$this->suffix}.css", + "{$this->url}css/wp-featherlight{$this->suffix}.css", array(), - WP_FEATHERLIGHT_VERSION + $this->version ); + wp_style_add_data( 'wp-featherlight', 'rtl', 'replace' ); + wp_style_add_data( 'wp-featherlight', 'suffix', $this->suffix ); } /** @@ -119,9 +131,9 @@ public function load_packed_js() { } wp_enqueue_script( 'wp-featherlight', - WP_FEATHERLIGHT_URL . "js/dist/wpFeatherlight.pkgd{$this->suffix}.js", + "{$this->url}js/wpFeatherlight.pkgd{$this->suffix}.js", array( 'jquery' ), - WP_FEATHERLIGHT_VERSION, + $this->version, true ); } @@ -129,8 +141,6 @@ public function load_packed_js() { /** * Load all of our JS files individually to for maximum compatibility. * - * @todo Add logic to use minified versions of scripts when not debugging. - * * @since 0.1.0 * @access public * @return void @@ -139,33 +149,34 @@ public function load_unpacked_js() { if ( $this->enable_packed_js() ) { return; } - $url = WP_FEATHERLIGHT_URL . 'js/src/'; + $suffix = $this->suffix; + $url = "{$this->url}js/src/"; wp_enqueue_script( 'jquery-detect-swipe', - $url . 'vendor/jquery.detect_swipe.js', + "{$url}vendor/jquery.detect_swipe{$suffix}.js", array( 'jquery' ), - '2.0.4', + '2.1.1', true ); wp_enqueue_script( 'featherlight', - $url . 'vendor/featherlight.js', + "{$url}vendor/featherlight{$suffix}.js", array( 'jquery-detect-swipe' ), - '1.2.3', + '1.3.2', true ); wp_enqueue_script( 'featherlight-gallery', - $url . 'vendor/featherlight.gallery.js', + "{$url}vendor/featherlight.gallery{$suffix}.js", array( 'featherlight' ), - '1.2.3', + '1.3.2', true ); wp_enqueue_script( 'wp-featherlight', - $url . 'wpFeatherlight.js', + "{$url}wpFeatherlight{$suffix}.js", array( 'featherlight-gallery' ), - WP_FEATHERLIGHT_VERSION, + $this->version, true ); } @@ -185,4 +196,20 @@ public function maybe_disable() { } } + /** + * Add custom body classes to help our script enable and disable features + * without creating true plugin database options. + * + * @since 0.3.0 + * @access public + * @param array $classes the existing body classes. + * @return array $classes the amended body classes. + */ + public function script_helpers( $classes ) { + if ( apply_filters( 'wp_featherlight_captions', true ) ) { + $classes[] = 'wp-featherlight-captions'; + } + return $classes; + } + } diff --git a/includes/classes/admin/meta.php b/includes/classes/admin/meta.php deleted file mode 100644 index eb9baba..0000000 --- a/includes/classes/admin/meta.php +++ /dev/null @@ -1,118 +0,0 @@ -post_type ); - $name = $type->labels->singular_name; - $disable = get_post_meta( $post->ID, 'wp_featherlight_disable', true ); - $checked = ''; - if ( ! empty( $disable ) ) { - $checked = $disable; - } - require_once WP_FEATHERLIGHT_DIR . 'templates/admin/metabox-sidebar.php'; - } - - /** - * Callback function for saving our testimonial details meta box data. - * Handles data validation and sanitization for our content label. - * - * @since 0.1.0 - * @access public - * @return void - */ - public function save_meta_boxes( $post_id ) { - // Bail if something is in progress. - if ( $this->stop_save() ) { - return; - } - - $nonce = ''; - if ( isset( $_POST['wp_featherlight_nonce'] ) ) { - $nonce = $_POST['wp_featherlight_nonce']; - } - - // Bail if we can't verify the nonce. - if ( ! wp_verify_nonce( $nonce, plugin_basename( WP_FEATHERLIGHT_FILE ) ) ) { - return; - } - - $disable = isset( $_POST['wp_featherlight_disable'] ) ? 'yes' : ''; - - update_post_meta( $post_id, 'wp_featherlight_disable', $disable ); - } - -} diff --git a/includes/constants.php b/includes/constants.php new file mode 100644 index 0000000..8c136f6 --- /dev/null +++ b/includes/constants.php @@ -0,0 +1,24 @@ +get_file() ); +define( 'WP_FEATHERLIGHT_VERSION', wp_featherlight()->get_version() ); + +if ( ! defined( 'WP_FEATHERLIGHT_DIR' ) ) { + define( 'WP_FEATHERLIGHT_DIR', wp_featherlight()->get_dir() ); +} + +if ( ! defined( 'WP_FEATHERLIGHT_URL' ) ) { + define( 'WP_FEATHERLIGHT_URL', wp_featherlight()->get_url() ); +} diff --git a/includes/plugin.php b/includes/plugin.php deleted file mode 100755 index a953073..0000000 --- a/includes/plugin.php +++ /dev/null @@ -1,106 +0,0 @@ -scripts = new WP_Featherlight_Scripts; - $this->scripts->run(); - if ( ! is_admin() ) { - return; - } - $this->meta = new WP_Featherlight_Admin_Meta; - $this->meta->run(); - } - - /** - * Runs on plugin activation to set a default admin content label for all - * existing posts using the post title. - * - * @since 0.1.0 - * @access public - * @global $wpdb - * @return void - */ - public function activate() { - // Nothing yet. - } - -} diff --git a/js/.esformatter b/js/.esformatter new file mode 100644 index 0000000..0afb390 --- /dev/null +++ b/js/.esformatter @@ -0,0 +1,14 @@ +{ + "plugins": [ + "esformatter-wordpress" + ], + "whiteSpace": { + "before": { + "AssignmentOperator": -1, + "PropertyValue": -1 + }, + "after": { + "VariableName": -1 + } + } +} diff --git a/js/.jscsrc b/js/.jscsrc deleted file mode 100644 index d4136ba..0000000 --- a/js/.jscsrc +++ /dev/null @@ -1,113 +0,0 @@ -{ - "requireSpacesInConditionalExpression": true, - "requireSpacesInFunction": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInFunction": { - "beforeOpeningRoundBrace": true - }, - "requireMultipleVarDecl": "onevar", - "requireSpacesInsideObjectBrackets": "all", - "disallowSpaceAfterObjectKeys": true, - "requireSpaceAfterBinaryOperators": [ - "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", - "&=", "|=", "^=", "+=", - - "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", - "|", "^", "&&", "||", "===", "==", ">=", - "<=", "<", ">", "!=", "!==" - ], - "requireSpaceBeforeBinaryOperators": [ - "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", - "&=", "|=", "^=", "+=", - - "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", - "|", "^", "&&", "||", "===", "==", ">=", - "<=", "<", ">", "!=", "!==" - ], - "disallowKeywords": ["with"], - "disallowMultipleLineBreaks": true, - "validateLineBreaks": "LF", - "disallowMixedSpacesAndTabs": "smart", - "disallowTrailingWhitespace": true, - - "requireCurlyBraces": [ "if", "else", "for", "while", "do", "try", "catch" ], - "requireSpaceBeforeBlockStatements": true, - "requireParenthesesAroundIIFE": true, - "requireBlocksOnNewline": true, - "requireOperatorBeforeLineBreak": [ - "?", - "=", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "requireSpaceBeforeBinaryOperators": [ - "?", - "=", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "requireSpaceAfterBinaryOperators": [ - "?", - "=", - "+", - "/", - "*", - ":", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "disallowSpaceBeforeBinaryOperators": [","], - "disallowSpaceAfterBinaryOperators": [], - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], - "requireSpaceAfterPrefixUnaryOperators": ["!"], - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireCamelCaseOrUpperCaseIdentifiers": true, - "disallowMultipleLineStrings": true, - "validateQuoteMarks": "'", - "validateIndentation": "\t", - "requireLineFeedAtFileEnd": true, - "requireDotNotation": true, - "disallowNewlineBeforeBlockStatements": true, - - "disallowTrailingComma": true, - "disallowPaddingNewlinesInBlocks": true, - "disallowEmptyBlocks": true, - "disallowQuotedKeysInObjects": "allButReserved", - "disallowDanglingUnderscores": true, - "requireCommaBeforeLineBreak": true, - "disallowKeywordsOnNewLine": ["else"], - "requireCapitalizedConstructors": true, - "safeContextKeyword": [ "that" ], - "validateJSDoc": { - "checkParamNames": true, - "checkRedundantParams": true, - "requireParamTypes": true - } -} diff --git a/js/dist/wpFeatherlight.pkgd.min.js b/js/dist/wpFeatherlight.pkgd.min.js deleted file mode 100644 index d49262c..0000000 --- a/js/dist/wpFeatherlight.pkgd.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){"use strict";function t(){this.removeEventListener("touchmove",n),this.removeEventListener("touchend",t),s=!1}function n(n){if(e.detectSwipe.preventDefault&&n.preventDefault(),s){var r,i=n.touches[0].pageX,c=n.touches[0].pageY,u=a-i,l=o-c;Math.abs(u)>=e.detectSwipe.threshold?r=u>0?"left":"right":Math.abs(l)>=e.detectSwipe.threshold&&(r=l>0?"down":"up"),r&&(t.call(this),e(this).trigger("swipe",r).trigger("swipe"+r))}}function r(e){1==e.touches.length&&(a=e.touches[0].pageX,o=e.touches[0].pageY,s=!0,this.addEventListener("touchmove",n,!1),this.addEventListener("touchend",t,!1))}function i(){this.addEventListener&&this.addEventListener("touchstart",r,!1)}e.detectSwipe={version:"2.1.1",enabled:"ontouchstart"in document.documentElement,preventDefault:!0,threshold:20};var a,o,s=!1;e.event.special.swipe={setup:i},e.each(["left","up","down","right"],function(){e.event.special["swipe"+this]={setup:function(){e(this).on("swipe",e.noop)}}})}(jQuery),function(e){"use strict";function t(e,n){if(!(this instanceof t)){var r=new t(e,n);return r.open(),r}this.id=t.id++,this.setup(e,n),this.chainCallbacks(t._callbackChain)}if("undefined"==typeof e)return void("console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery."));var n=[],r=function(t){return n=e.grep(n,function(e){return e!==t&&e.$instance.closest("body").length>0})},i=function(e,t){var n={},r=new RegExp("^"+t+"([A-Z])(.*)");for(var i in e){var a=i.match(r);if(a){var o=(a[1]+a[2].replace(/([A-Z])/g,"-$1")).toLowerCase();n[o]=e[i]}}return n},a={keyup:"onKeyUp",resize:"onResize"},o=function(n){e.each(t.opened().reverse(),function(){return n.isDefaultPrevented()||!1!==this[a[n.type]](n)?void 0:(n.preventDefault(),n.stopPropagation(),!1)})},s=function(n){if(n!==t._globalHandlerInstalled){t._globalHandlerInstalled=n;var r=e.map(a,function(e,n){return n+"."+t.prototype.namespace}).join(" ");e(window)[n?"on":"off"](r,o)}};t.prototype={constructor:t,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"✕",loading:"",otherClose:null,beforeOpen:e.noop,beforeContent:e.noop,beforeClose:e.noop,afterOpen:e.noop,afterContent:e.noop,afterClose:e.noop,onKeyUp:e.noop,onResize:e.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(t,n){"object"!=typeof t||t instanceof e!=!1||n||(n=t,t=void 0);var r=e.extend(this,n,{target:t}),i=r.resetCss?r.namespace+"-reset":r.namespace,a=e(r.background||['