Version Description
- Updated it to match original JetPack plugin updates from 2.9.3
Download this release
Release Info
| Developer | n7studios |
| Plugin | |
| Version | 0.7 |
| Comparing to | |
| See all releases | |
Code changes from version 0.6 to 0.7
- carousel-without-jetpack.php +66 -0
- carousel/class.jetpack-options.php +153 -0
- carousel/images/arrows-2x.png +0 -0
- carousel/images/arrows.png +0 -0
- {images → carousel/images}/carousel-likereblog-2x.png +0 -0
- {images → carousel/images}/carousel-likereblog.png +0 -0
- {images → carousel/images}/carousel-link-2x.png +0 -0
- {images → carousel/images}/carousel-link.png +0 -0
- carousel/images/carousel-sprite-2x.png +0 -0
- carousel/images/carousel-sprite.png +0 -0
- jetpack-carousel-ie8fix.css → carousel/jetpack-carousel-ie8fix.css +0 -0
- jetpack-carousel.css → carousel/jetpack-carousel.css +63 -31
- jetpack-carousel.js → carousel/jetpack-carousel.js +461 -227
- jetpack-carousel.php → carousel/jetpack-carousel.php +69 -73
- carousel/jquery.spin.js +104 -0
- {rtl → carousel/rtl}/jetpack-carousel-rtl.css +64 -29
- carousel/spin.js +349 -0
- images/arrows-2x.png +0 -0
- images/arrows.png +0 -0
- images/carousel-sprite-2x.png +0 -0
- images/carousel-sprite.png +0 -0
- jquery.spin.js +0 -86
- readme.txt +7 -3
- spin.js +0 -301
carousel-without-jetpack.php
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
Plugin Name: Gallery Carousel Without JetPack
|
| 4 |
+
Plugin URI: http://www.wpbeginner.com/
|
| 5 |
+
Description: Transform your standard galleries into an immersive full-screen experience without requiring you to connect to WordPress.com
|
| 6 |
+
Version: 0.7
|
| 7 |
+
Author: Syed Balkhi
|
| 8 |
+
Author URI: http://www.wpbeginner.com
|
| 9 |
+
License: GPLv2 or later
|
| 10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* This is a fork of Carousel Module from JetPack. I just wanted the Carousel to work
|
| 16 |
+
* without logging into WordPress.com because I shouldn't be forced to (that's evil). So I'm releasing
|
| 17 |
+
* this little plugin which is exactly the copy of JetPack module. I will update this plugin everytime that JetPack updates.
|
| 18 |
+
*/
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Boostrap 'carousel' module so it'll work standalone
|
| 22 |
+
*/
|
| 23 |
+
class CarouselWithoutJetpack {
|
| 24 |
+
/**
|
| 25 |
+
* Constructor
|
| 26 |
+
*/
|
| 27 |
+
function CarouselWithoutJetpack() {
|
| 28 |
+
// Plugin Details
|
| 29 |
+
$this->plugin = new stdClass;
|
| 30 |
+
$this->plugin->name = 'carousel-without-jetpack'; // Plugin Folder
|
| 31 |
+
$this->plugin->folder = WP_PLUGIN_DIR.'/'.$this->plugin->name; // Full Path to Plugin Folder
|
| 32 |
+
$this->plugin->url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); // Full URL to Plugin Folder
|
| 33 |
+
|
| 34 |
+
// Include class.jetpack-options.php
|
| 35 |
+
// Ignore if Jetpack or another plugin has already done this
|
| 36 |
+
if (!class_exists('Jetpack_Options')) {
|
| 37 |
+
require_once($this->plugin->folder.'/carousel/class.jetpack-options.php');
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
// Include class.jetpack-options.php
|
| 41 |
+
// Ignore if Jetpack or another plugin has already done this
|
| 42 |
+
if (!class_exists('No_Jetpack_Carousel')) {
|
| 43 |
+
require_once($this->plugin->folder.'/carousel/jetpack-carousel.php');
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
add_action('wp_enqueue_scripts', array(&$this, 'frontendScriptsAndCSS'));
|
| 47 |
+
add_action('plugins_loaded', array(&$this, 'loadLanguageFiles'));
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Enqueue jQuery Spin
|
| 52 |
+
*/
|
| 53 |
+
function frontendScriptsAndCSS() {
|
| 54 |
+
wp_register_script( 'spin', plugins_url( 'carousel/spin.js', __FILE__ ), false );
|
| 55 |
+
wp_register_script( 'jquery.spin', plugins_url( 'carousel/jquery.spin.js', __FILE__ ) , array( 'jquery', 'spin' ) );
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Load translations
|
| 60 |
+
*/
|
| 61 |
+
function loadLanguageFiles() {
|
| 62 |
+
load_plugin_textdomain('carousel', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
new CarouselWithoutJetpack;
|
carousel/class.jetpack-options.php
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Jetpack_Options {
|
| 4 |
+
|
| 5 |
+
public static function get_option_names( $type = 'compact' ) {
|
| 6 |
+
switch ( $type ) {
|
| 7 |
+
case 'non-compact' :
|
| 8 |
+
case 'non_compact' :
|
| 9 |
+
return array(
|
| 10 |
+
'register',
|
| 11 |
+
'activated',
|
| 12 |
+
'active_modules',
|
| 13 |
+
'do_activate',
|
| 14 |
+
'log',
|
| 15 |
+
'publicize',
|
| 16 |
+
'slideshow_background_color',
|
| 17 |
+
'widget_twitter',
|
| 18 |
+
'wpcc_options',
|
| 19 |
+
'relatedposts',
|
| 20 |
+
);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
return array(
|
| 24 |
+
'id', // (int) The Client ID/WP.com Blog ID of this site.
|
| 25 |
+
'blog_token', // (string) The Client Secret/Blog Token of this site.
|
| 26 |
+
'user_token', // (string) The User Token of this site. (deprecated)
|
| 27 |
+
'publicize_connections', // (array) An array of Publicize connections from WordPress.com
|
| 28 |
+
'master_user', // (int) The local User ID of the user who connected this site to jetpack.wordpress.com.
|
| 29 |
+
'user_tokens', // (array) User Tokens for each user of this site who has connected to jetpack.wordpress.com.
|
| 30 |
+
'version', // (string) Used during upgrade procedure to auto-activate new modules. version:time
|
| 31 |
+
'old_version', // (string) Used to determine which modules are the most recently added. previous_version:time
|
| 32 |
+
'fallback_no_verify_ssl_certs', // (int) Flag for determining if this host must skip SSL Certificate verification due to misconfigured SSL.
|
| 33 |
+
'time_diff', // (int) Offset between Jetpack server's clocks and this server's clocks. Jetpack Server Time = time() + (int) Jetpack_Options::get_option( 'time_diff' )
|
| 34 |
+
'public', // (int|bool) If we think this site is public or not (1, 0), false if we haven't yet tried to figure it out.
|
| 35 |
+
'videopress', // (array) VideoPress options array.
|
| 36 |
+
'is_network_site', // (int|bool) If we think this site is a network or a single blog (1, 0), false if we haven't yet tried to figue it out.
|
| 37 |
+
'social_links', // (array) The specified links for each social networking site.
|
| 38 |
+
'identity_crisis_whitelist', // (array) An array of options, each having an array of the values whitelisted for it.
|
| 39 |
+
'gplus_authors', // (array) The Google+ authorship information for connected users.
|
| 40 |
+
'last_heartbeat', // (int) The timestamp of the last heartbeat that fired.
|
| 41 |
+
'sync_bulk_reindexing', // (bool) If a bulk reindex is currently underway.
|
| 42 |
+
);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* Returns the requested option. Looks in jetpack_options or jetpack_$name as appropriate.
|
| 47 |
+
*
|
| 48 |
+
* @param string $name Option name
|
| 49 |
+
* @param mixed $default (optional)
|
| 50 |
+
*/
|
| 51 |
+
public static function get_option( $name, $default = false ) {
|
| 52 |
+
if ( in_array( $name, self::get_option_names( 'non_compact' ) ) ) {
|
| 53 |
+
return get_option( "jetpack_$name" );
|
| 54 |
+
} else if ( !in_array( $name, self::get_option_names() ) ) {
|
| 55 |
+
trigger_error( sprintf( 'Invalid Jetpack option name: %s', $name ), E_USER_WARNING );
|
| 56 |
+
return false;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
$options = get_option( 'jetpack_options' );
|
| 60 |
+
if ( is_array( $options ) && isset( $options[$name] ) ) {
|
| 61 |
+
return $options[$name];
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
return $default;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Updates the single given option. Updates jetpack_options or jetpack_$name as appropriate.
|
| 69 |
+
*
|
| 70 |
+
* @param string $name Option name
|
| 71 |
+
* @param mixed $value Option value
|
| 72 |
+
*/
|
| 73 |
+
public static function update_option( $name, $value ) {
|
| 74 |
+
do_action( 'pre_update_jetpack_option_' . $name, $name, $value );
|
| 75 |
+
if ( in_array( $name, self::get_option_names( 'non_compact' ) ) ) {
|
| 76 |
+
return update_option( "jetpack_$name", $value );
|
| 77 |
+
} else if ( !in_array( $name, self::get_option_names() ) ) {
|
| 78 |
+
trigger_error( sprintf( 'Invalid Jetpack option name: %s', $name ), E_USER_WARNING );
|
| 79 |
+
return false;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
$options = get_option( 'jetpack_options' );
|
| 83 |
+
if ( !is_array( $options ) ) {
|
| 84 |
+
$options = array();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
$options[$name] = $value;
|
| 88 |
+
|
| 89 |
+
return update_option( 'jetpack_options', $options );
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Updates the multiple given options. Updates jetpack_options and/or jetpack_$name as appropriate.
|
| 94 |
+
*
|
| 95 |
+
* @param array $array array( option name => option value, ... )
|
| 96 |
+
*/
|
| 97 |
+
public static function update_options( $array ) {
|
| 98 |
+
$names = array_keys( $array );
|
| 99 |
+
|
| 100 |
+
foreach ( array_diff( $names, self::get_option_names(), self::get_option_names( 'non_compact' ) ) as $unknown_name ) {
|
| 101 |
+
trigger_error( sprintf( 'Invalid Jetpack option name: %s', $unknown_name ), E_USER_WARNING );
|
| 102 |
+
unset( $array[$unknown_name] );
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
foreach ( array_intersect( $names, self::get_option_names( 'non_compact' ) ) as $name ) {
|
| 106 |
+
update_option( "jetpack_$name", $array[$name] );
|
| 107 |
+
unset( $array[$name] );
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
$options = get_option( 'jetpack_options' );
|
| 111 |
+
if ( !is_array( $options ) ) {
|
| 112 |
+
$options = array();
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
return update_option( 'jetpack_options', array_merge( $options, $array ) );
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Deletes the given option. May be passed multiple option names as an array.
|
| 120 |
+
* Updates jetpack_options and/or deletes jetpack_$name as appropriate.
|
| 121 |
+
*
|
| 122 |
+
* @param string|array $names
|
| 123 |
+
*/
|
| 124 |
+
public static function delete_option( $names ) {
|
| 125 |
+
$names = (array) $names;
|
| 126 |
+
|
| 127 |
+
foreach ( array_diff( $names, self::get_option_names(), self::get_option_names( 'non_compact' ) ) as $unknown_name ) {
|
| 128 |
+
trigger_error( sprintf( 'Invalid Jetpack option name: %s', $unknown_name ), E_USER_WARNING );
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
foreach ( array_intersect( $names, self::get_option_names( 'non_compact' ) ) as $name ) {
|
| 132 |
+
delete_option( "jetpack_$name" );
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
$options = get_option( 'jetpack_options' );
|
| 136 |
+
if ( !is_array( $options ) ) {
|
| 137 |
+
$options = array();
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
$to_delete = array_intersect( $names, self::get_option_names(), array_keys( $options ) );
|
| 141 |
+
if ( $to_delete ) {
|
| 142 |
+
foreach ( $to_delete as $name ) {
|
| 143 |
+
unset( $options[$name] );
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
return update_option( 'jetpack_options', $options );
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
return true;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
}
|
| 153 |
+
|
carousel/images/arrows-2x.png
ADDED
|
Binary file
|
carousel/images/arrows.png
ADDED
|
Binary file
|
{images → carousel/images}/carousel-likereblog-2x.png
RENAMED
|
File without changes
|
{images → carousel/images}/carousel-likereblog.png
RENAMED
|
File without changes
|
{images → carousel/images}/carousel-link-2x.png
RENAMED
|
File without changes
|
{images → carousel/images}/carousel-link.png
RENAMED
|
File without changes
|
carousel/images/carousel-sprite-2x.png
ADDED
|
Binary file
|
carousel/images/carousel-sprite.png
ADDED
|
Binary file
|
jetpack-carousel-ie8fix.css → carousel/jetpack-carousel-ie8fix.css
RENAMED
|
File without changes
|
jetpack-carousel.css → carousel/jetpack-carousel.css
RENAMED
|
@@ -48,7 +48,7 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 48 |
background: #68c9e8; /* Safari */
|
| 49 |
color: #fff;
|
| 50 |
}
|
| 51 |
-
|
| 52 |
.jp-carousel-info ::-moz-selection {
|
| 53 |
background: #68c9e8; /* Firefox */
|
| 54 |
color: #fff;
|
|
@@ -56,12 +56,15 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 56 |
|
| 57 |
.jp-carousel-photo-info {
|
| 58 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
-webkit-transition: 400ms ease-out;
|
| 60 |
-moz-transition: 400ms ease-out;
|
| 61 |
-o-transition: 400ms ease-out;
|
| 62 |
transition: 400ms ease-out;
|
| 63 |
-
left: 25%;
|
| 64 |
-
width: 50%;
|
| 65 |
}
|
| 66 |
|
| 67 |
.jp-carousel-info h2 {
|
|
@@ -96,6 +99,10 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 96 |
zoom: 1;
|
| 97 |
filter: alpha(opacity=20);
|
| 98 |
opacity: 0.2;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
-webkit-transition: 500ms opacity ease-out;
|
| 100 |
-moz-transition: 500ms opacity ease-out;
|
| 101 |
-o-transition: 500ms opacity ease-out;
|
|
@@ -133,13 +140,16 @@ div.jp-carousel-buttons a {
|
|
| 133 |
padding: 5px 2px 5px 0;
|
| 134 |
text-decoration: none !important;
|
| 135 |
text-shadow: none !important;
|
| 136 |
-
vertical-align:
|
| 137 |
-webkit-font-smoothing: subpixel-antialiased;
|
| 138 |
}
|
| 139 |
|
| 140 |
div.jp-carousel-buttons a:hover {
|
| 141 |
color: #68c9e8;
|
| 142 |
border: none !important;
|
|
|
|
|
|
|
|
|
|
| 143 |
-webkit-transition: none !important;
|
| 144 |
-moz-transition: none !important;
|
| 145 |
-o-transition: none !important;
|
|
@@ -155,7 +165,7 @@ div.jp-carousel-buttons a:hover {
|
|
| 155 |
}
|
| 156 |
|
| 157 |
.jp-carousel-slide {
|
| 158 |
-
position:
|
| 159 |
width:0;
|
| 160 |
bottom:0;
|
| 161 |
background-color:#000;
|
|
@@ -164,10 +174,24 @@ div.jp-carousel-buttons a:hover {
|
|
| 164 |
-moz-border-radius:2px;
|
| 165 |
-ms-border-radius:2px;
|
| 166 |
-o-border-radius:2px;
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
transition:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
|
| 173 |
.jp-carousel-slide img {
|
|
@@ -183,19 +207,15 @@ div.jp-carousel-buttons a:hover {
|
|
| 183 |
-moz-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 184 |
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 185 |
zoom: 1;
|
| 186 |
-
|
| 187 |
-
|
|
|
|
| 188 |
-webkit-transition: opacity 400ms linear;
|
| 189 |
-moz-transition: opacity 400ms linear;
|
| 190 |
-o-transition: opacity 400ms linear;
|
| 191 |
transition: opacity 400ms linear;
|
| 192 |
}
|
| 193 |
|
| 194 |
-
.jp-carousel-slide.selected img {
|
| 195 |
-
filter: alpha(opacity=100);
|
| 196 |
-
opacity: 1;
|
| 197 |
-
}
|
| 198 |
-
|
| 199 |
.jp-carousel-close-hint {
|
| 200 |
color: #999;
|
| 201 |
cursor: default;
|
|
@@ -204,6 +224,9 @@ div.jp-carousel-buttons a:hover {
|
|
| 204 |
position: absolute;
|
| 205 |
text-align: left;
|
| 206 |
width: 90%;
|
|
|
|
|
|
|
|
|
|
| 207 |
-webkit-transition: color 200ms linear;
|
| 208 |
-moz-transition: color 200ms linear;
|
| 209 |
-o-transition: color 200ms linear;
|
|
@@ -225,6 +248,9 @@ div.jp-carousel-buttons a:hover {
|
|
| 225 |
-moz-border-radius: 4px;
|
| 226 |
-webkit-border-radius: 4px;
|
| 227 |
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
| 228 |
-webkit-transition: border-color 200ms linear;
|
| 229 |
-moz-transition: border-color 200ms linear;
|
| 230 |
-o-transition: border-color 200ms linear;
|
|
@@ -481,7 +507,7 @@ div#carousel-reblog-box {
|
|
| 481 |
display: none;
|
| 482 |
}
|
| 483 |
|
| 484 |
-
.jp-carousel-photo-info h1:before,
|
| 485 |
.jp-carousel-photo-info h1:after,
|
| 486 |
.jp-carousel-left-column-wrapper h1:before,
|
| 487 |
.jp-carousel-left-column-wrapper h1:after {
|
|
@@ -693,7 +719,7 @@ textarea#jp-carousel-comment-form-comment-field {
|
|
| 693 |
border-radius: 3px;
|
| 694 |
overflow: hidden;
|
| 695 |
-webkit-box-sizing: border-box;
|
| 696 |
-
-moz-box-sizing: border-box;
|
| 697 |
box-sizing: border-box;
|
| 698 |
}
|
| 699 |
|
|
@@ -791,7 +817,7 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 791 |
}
|
| 792 |
|
| 793 |
#jp-carousel-comment-post-results {
|
| 794 |
-
display: none;
|
| 795 |
overflow:auto;
|
| 796 |
width:100%;
|
| 797 |
}
|
|
@@ -1050,14 +1076,14 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1050 |
margin: 0 10px !important;
|
| 1051 |
}
|
| 1052 |
|
| 1053 |
-
.jp-carousel-next-button, .jp-carousel-previous-button {
|
| 1054 |
-
display: none !important;
|
| 1055 |
}
|
| 1056 |
|
| 1057 |
.jp-carousel-buttons {
|
| 1058 |
display: none !important;
|
| 1059 |
}
|
| 1060 |
-
|
| 1061 |
.jp-carousel-image-meta {
|
| 1062 |
float: none !important;
|
| 1063 |
width: 100% !important;
|
|
@@ -1065,31 +1091,31 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1065 |
-webkit-box-sizing:border-box;
|
| 1066 |
box-sizing: border-box;
|
| 1067 |
}
|
| 1068 |
-
|
| 1069 |
.jp-carousel-close-hint {
|
| 1070 |
font-weight: 800 !important;
|
| 1071 |
font-size: 26px !important;
|
| 1072 |
position: fixed !important;
|
| 1073 |
top: -10px;
|
| 1074 |
}
|
| 1075 |
-
|
| 1076 |
.jp-carousel-slide img {
|
| 1077 |
filter: alpha(opacity=100);
|
| 1078 |
opacity: 1;
|
| 1079 |
}
|
| 1080 |
-
|
| 1081 |
.jp-carousel-wrap {
|
| 1082 |
-
background-color: #000;
|
| 1083 |
}
|
| 1084 |
-
|
| 1085 |
.jp-carousel-fadeaway {
|
| 1086 |
display: none;
|
| 1087 |
}
|
| 1088 |
-
|
| 1089 |
#jp-carousel-comment-form-container {
|
| 1090 |
display: none !important;
|
| 1091 |
}
|
| 1092 |
-
|
| 1093 |
.jp-carousel-titleanddesc {
|
| 1094 |
padding-top: 0 !important;
|
| 1095 |
border: none !important;
|
|
@@ -1097,8 +1123,14 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1097 |
.jp-carousel-titleanddesc-title {
|
| 1098 |
font-size: 1em !important;
|
| 1099 |
}
|
| 1100 |
-
|
| 1101 |
.jp-carousel-left-column-wrapper {
|
| 1102 |
padding: 0;
|
| 1103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1104 |
}
|
| 48 |
background: #68c9e8; /* Safari */
|
| 49 |
color: #fff;
|
| 50 |
}
|
| 51 |
+
|
| 52 |
.jp-carousel-info ::-moz-selection {
|
| 53 |
background: #68c9e8; /* Firefox */
|
| 54 |
color: #fff;
|
| 56 |
|
| 57 |
.jp-carousel-photo-info {
|
| 58 |
position: relative;
|
| 59 |
+
left: 25%;
|
| 60 |
+
width: 50%;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.jp-carousel-transitions .jp-carousel-photo-info {
|
| 64 |
-webkit-transition: 400ms ease-out;
|
| 65 |
-moz-transition: 400ms ease-out;
|
| 66 |
-o-transition: 400ms ease-out;
|
| 67 |
transition: 400ms ease-out;
|
|
|
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
.jp-carousel-info h2 {
|
| 99 |
zoom: 1;
|
| 100 |
filter: alpha(opacity=20);
|
| 101 |
opacity: 0.2;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.jp-carousel-transitions .jp-carousel-next-button span,
|
| 105 |
+
.jp-carousel-transitions .jp-carousel-previous-button span {
|
| 106 |
-webkit-transition: 500ms opacity ease-out;
|
| 107 |
-moz-transition: 500ms opacity ease-out;
|
| 108 |
-o-transition: 500ms opacity ease-out;
|
| 140 |
padding: 5px 2px 5px 0;
|
| 141 |
text-decoration: none !important;
|
| 142 |
text-shadow: none !important;
|
| 143 |
+
vertical-align: middle;
|
| 144 |
-webkit-font-smoothing: subpixel-antialiased;
|
| 145 |
}
|
| 146 |
|
| 147 |
div.jp-carousel-buttons a:hover {
|
| 148 |
color: #68c9e8;
|
| 149 |
border: none !important;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.jp-carousel-transitions div.jp-carousel-buttons a:hover {
|
| 153 |
-webkit-transition: none !important;
|
| 154 |
-moz-transition: none !important;
|
| 155 |
-o-transition: none !important;
|
| 165 |
}
|
| 166 |
|
| 167 |
.jp-carousel-slide {
|
| 168 |
+
position:fixed;
|
| 169 |
width:0;
|
| 170 |
bottom:0;
|
| 171 |
background-color:#000;
|
| 174 |
-moz-border-radius:2px;
|
| 175 |
-ms-border-radius:2px;
|
| 176 |
-o-border-radius:2px;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
.jp-carousel-transitions .jp-carousel-slide {
|
| 180 |
+
-webkit-transition: 300ms ease-out;
|
| 181 |
+
-moz-transition: 300ms ease-out;
|
| 182 |
+
-o-transition: 300ms ease-out;
|
| 183 |
+
transition: 300ms ease-out;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.jp-carousel-slide.selected {
|
| 187 |
+
position: absolute !important;
|
| 188 |
+
filter: alpha(opacity=100);
|
| 189 |
+
opacity: 1;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.jp-carousel-slide {
|
| 193 |
+
filter: alpha(opacity=25);
|
| 194 |
+
opacity: 0.25;
|
| 195 |
}
|
| 196 |
|
| 197 |
.jp-carousel-slide img {
|
| 207 |
-moz-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 208 |
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 209 |
zoom: 1;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.jp-carousel-transitions .jp-carousel-slide {
|
| 213 |
-webkit-transition: opacity 400ms linear;
|
| 214 |
-moz-transition: opacity 400ms linear;
|
| 215 |
-o-transition: opacity 400ms linear;
|
| 216 |
transition: opacity 400ms linear;
|
| 217 |
}
|
| 218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
.jp-carousel-close-hint {
|
| 220 |
color: #999;
|
| 221 |
cursor: default;
|
| 224 |
position: absolute;
|
| 225 |
text-align: left;
|
| 226 |
width: 90%;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
.jp-carousel-transitions .jp-carousel-close-hint {
|
| 230 |
-webkit-transition: color 200ms linear;
|
| 231 |
-moz-transition: color 200ms linear;
|
| 232 |
-o-transition: color 200ms linear;
|
| 248 |
-moz-border-radius: 4px;
|
| 249 |
-webkit-border-radius: 4px;
|
| 250 |
border-radius: 4px;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
.jp-carousel-transitions .jp-carousel-close-hint span {
|
| 254 |
-webkit-transition: border-color 200ms linear;
|
| 255 |
-moz-transition: border-color 200ms linear;
|
| 256 |
-o-transition: border-color 200ms linear;
|
| 507 |
display: none;
|
| 508 |
}
|
| 509 |
|
| 510 |
+
.jp-carousel-photo-info h1:before,
|
| 511 |
.jp-carousel-photo-info h1:after,
|
| 512 |
.jp-carousel-left-column-wrapper h1:before,
|
| 513 |
.jp-carousel-left-column-wrapper h1:after {
|
| 719 |
border-radius: 3px;
|
| 720 |
overflow: hidden;
|
| 721 |
-webkit-box-sizing: border-box;
|
| 722 |
+
-moz-box-sizing: border-box;
|
| 723 |
box-sizing: border-box;
|
| 724 |
}
|
| 725 |
|
| 817 |
}
|
| 818 |
|
| 819 |
#jp-carousel-comment-post-results {
|
| 820 |
+
display: none;
|
| 821 |
overflow:auto;
|
| 822 |
width:100%;
|
| 823 |
}
|
| 1076 |
margin: 0 10px !important;
|
| 1077 |
}
|
| 1078 |
|
| 1079 |
+
.jp-carousel-next-button, .jp-carousel-previous-button {
|
| 1080 |
+
display: none !important;
|
| 1081 |
}
|
| 1082 |
|
| 1083 |
.jp-carousel-buttons {
|
| 1084 |
display: none !important;
|
| 1085 |
}
|
| 1086 |
+
|
| 1087 |
.jp-carousel-image-meta {
|
| 1088 |
float: none !important;
|
| 1089 |
width: 100% !important;
|
| 1091 |
-webkit-box-sizing:border-box;
|
| 1092 |
box-sizing: border-box;
|
| 1093 |
}
|
| 1094 |
+
|
| 1095 |
.jp-carousel-close-hint {
|
| 1096 |
font-weight: 800 !important;
|
| 1097 |
font-size: 26px !important;
|
| 1098 |
position: fixed !important;
|
| 1099 |
top: -10px;
|
| 1100 |
}
|
| 1101 |
+
|
| 1102 |
.jp-carousel-slide img {
|
| 1103 |
filter: alpha(opacity=100);
|
| 1104 |
opacity: 1;
|
| 1105 |
}
|
| 1106 |
+
|
| 1107 |
.jp-carousel-wrap {
|
| 1108 |
+
background-color: #000;
|
| 1109 |
}
|
| 1110 |
+
|
| 1111 |
.jp-carousel-fadeaway {
|
| 1112 |
display: none;
|
| 1113 |
}
|
| 1114 |
+
|
| 1115 |
#jp-carousel-comment-form-container {
|
| 1116 |
display: none !important;
|
| 1117 |
}
|
| 1118 |
+
|
| 1119 |
.jp-carousel-titleanddesc {
|
| 1120 |
padding-top: 0 !important;
|
| 1121 |
border: none !important;
|
| 1123 |
.jp-carousel-titleanddesc-title {
|
| 1124 |
font-size: 1em !important;
|
| 1125 |
}
|
| 1126 |
+
|
| 1127 |
.jp-carousel-left-column-wrapper {
|
| 1128 |
padding: 0;
|
| 1129 |
+
width: 100% !important;
|
| 1130 |
+
}
|
| 1131 |
+
|
| 1132 |
+
.jp-carousel-photo-info {
|
| 1133 |
+
left: 0 !important;
|
| 1134 |
+
width: 100% !important;
|
| 1135 |
+
}
|
| 1136 |
}
|
jetpack-carousel.js → carousel/jetpack-carousel.js
RENAMED
|
@@ -2,14 +2,17 @@
|
|
| 2 |
jQuery(document).ready(function($) {
|
| 3 |
|
| 4 |
// gallery faded layer and container elements
|
| 5 |
-
var overlay, comments, gallery, container, nextButton, previousButton, info, title,
|
| 6 |
-
caption, resizeTimeout, mouseTimeout, photo_info, close_hint, commentInterval,
|
| 7 |
-
screenPadding = 110, originalOverflow = $('body').css('overflow'), originalHOverflow = $('html').css('overflow'), proportion = 85,
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
var keyListener = function(e){
|
| 15 |
switch(e.which){
|
|
@@ -27,6 +30,7 @@ jQuery(document).ready(function($) {
|
|
| 27 |
gallery.jp_carousel('next');
|
| 28 |
break;
|
| 29 |
case 37: // left
|
|
|
|
| 30 |
e.preventDefault();
|
| 31 |
gallery.jp_carousel('clearCommentTextAreaValue');
|
| 32 |
gallery.jp_carousel('previous');
|
|
@@ -54,9 +58,8 @@ jQuery(document).ready(function($) {
|
|
| 54 |
}, 200);
|
| 55 |
};
|
| 56 |
|
| 57 |
-
var prepareGallery = function(){
|
| 58 |
if (!overlay) {
|
| 59 |
-
|
| 60 |
overlay = $('<div></div>')
|
| 61 |
.addClass('jp-carousel-overlay')
|
| 62 |
.css({
|
|
@@ -67,7 +70,10 @@ jQuery(document).ready(function($) {
|
|
| 67 |
'left' : 0
|
| 68 |
});
|
| 69 |
|
| 70 |
-
buttons = '<a class="jp-carousel-commentlink" href="#">' + jetpackCarouselStrings.comment + '</a>';
|
|
|
|
|
|
|
|
|
|
| 71 |
buttons = $('<div class="jp-carousel-buttons">' + buttons + '</div>');
|
| 72 |
|
| 73 |
caption = $('<h2></h2>');
|
|
@@ -81,6 +87,12 @@ jQuery(document).ready(function($) {
|
|
| 81 |
'width' : '250px'
|
| 82 |
});
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
titleAndDescription = $('<div></div>')
|
| 85 |
.addClass('jp-carousel-titleanddesc')
|
| 86 |
.css({
|
|
@@ -88,26 +100,24 @@ jQuery(document).ready(function($) {
|
|
| 88 |
'margin-top' : imageMeta.css('margin-top')
|
| 89 |
});
|
| 90 |
|
| 91 |
-
var commentFormMarkup = '';
|
| 92 |
-
var iframeSrc = '';
|
| 93 |
|
| 94 |
-
|
| 95 |
-
if (iframeSrc && iframeSrc.length) {
|
| 96 |
-
// We're using Jetpack comments!
|
| 97 |
-
var iframeHeight = (jetpackCarouselStrings.is_logged_in || iframeSrc.match('comment_registration=1')) ? 220 : 340;
|
| 98 |
-
iframeSrc = iframeSrc.replace(/(blogid=\d+)/, '$1&postid='+window.location.hash.replace(/#jp-carousel-/,'')); // get initial attachment id from URL hash
|
| 99 |
-
commentFormMarkup += '<iframe src="'+iframeSrc+'" width="100%" height="'+iframeHeight+'" style="width:100%;height:'+iframeHeight+'px;" allowtransparency="true" frameBorder="0" scrolling="no" name="jp-carousel-comment-iframe" id="jp-carousel-comment-iframe"></iframe>';
|
| 100 |
-
} else if ( jetpackCarouselStrings.local_comments_commenting_as && jetpackCarouselStrings.local_comments_commenting_as.length ) {
|
| 101 |
// Jetpack comments not enabled, fallback to local comments
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
commentFormMarkup += '</div>';
|
| 113 |
|
|
@@ -134,19 +144,12 @@ jQuery(document).ready(function($) {
|
|
| 134 |
});
|
| 135 |
|
| 136 |
leftWidth = ( $(window).width() - ( screenPadding * 2 ) ) - (imageMeta.width() + 40);
|
| 137 |
-
if ( $.browser.mozilla )
|
| 138 |
-
leftWidth -= 55;
|
| 139 |
-
else if ( $.browser.msie )
|
| 140 |
-
leftWidth -= 20;
|
| 141 |
leftWidth += 'px';
|
| 142 |
|
| 143 |
-
if (isMobile)
|
| 144 |
-
leftWidth = '100%';
|
| 145 |
-
|
| 146 |
leftColWrapper = $('<div></div>')
|
| 147 |
.addClass('jp-carousel-left-column-wrapper')
|
| 148 |
.css({
|
| 149 |
-
'width' : leftWidth
|
| 150 |
})
|
| 151 |
.append(titleAndDescription)
|
| 152 |
.append(commentForm)
|
|
@@ -159,50 +162,41 @@ jQuery(document).ready(function($) {
|
|
| 159 |
info = $('<div></div>')
|
| 160 |
.addClass('jp-carousel-info')
|
| 161 |
.css({
|
| 162 |
-
'top' : ($(window).height() / 100) * proportion,
|
| 163 |
'left' : screenPadding,
|
| 164 |
'right' : screenPadding
|
| 165 |
})
|
| 166 |
.append(photo_info)
|
| 167 |
-
.append(imageMeta)
|
| 168 |
-
.append(leftColWrapper);
|
| 169 |
|
| 170 |
-
if (
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
targetBottomPos = ( $(window).height() - parseInt( info.css('top'), 10 ) ) + 'px';
|
| 176 |
|
| 177 |
nextButton = $("<div><span></span></div>")
|
| 178 |
.addClass('jp-carousel-next-button')
|
| 179 |
.css({
|
| 180 |
-
'position' : 'fixed',
|
| 181 |
-
'top' : 0,
|
| 182 |
'right' : '15px',
|
| 183 |
-
'bottom' : 0,
|
| 184 |
-
'width' : screenPadding
|
| 185 |
});
|
| 186 |
|
| 187 |
-
$('span', nextButton).css({
|
| 188 |
-
'top' : '40px',
|
| 189 |
-
'bottom' : targetBottomPos
|
| 190 |
-
});
|
| 191 |
-
|
| 192 |
previousButton = $("<div><span></span></div>")
|
| 193 |
.addClass('jp-carousel-previous-button')
|
| 194 |
.css({
|
| 195 |
-
'position' : 'fixed',
|
| 196 |
-
'top' : 0,
|
| 197 |
'left' : 0,
|
| 198 |
-
'bottom' : 0,
|
| 199 |
-
'width' : screenPadding
|
| 200 |
});
|
| 201 |
|
| 202 |
-
|
| 203 |
-
'
|
| 204 |
-
'
|
| 205 |
-
|
|
|
|
|
|
|
| 206 |
|
| 207 |
gallery = $('<div></div>')
|
| 208 |
.addClass('jp-carousel')
|
|
@@ -220,7 +214,8 @@ jQuery(document).ready(function($) {
|
|
| 220 |
});
|
| 221 |
|
| 222 |
container = $("<div></div>")
|
| 223 |
-
.addClass('jp-carousel-wrap')
|
|
|
|
| 224 |
|
| 225 |
if ( 'white' == jetpackCarouselStrings.background_color )
|
| 226 |
container.addClass('jp-carousel-light');
|
|
@@ -259,6 +254,10 @@ jQuery(document).ready(function($) {
|
|
| 259 |
container.animate({scrollTop: parseInt(info.position()['top'], 10)}, 'fast');
|
| 260 |
$('#jp-carousel-comment-form-submit-and-info-wrapper').slideDown('fast');
|
| 261 |
$('#jp-carousel-comment-form-comment-field').focus();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
} else if ( target.parents('#jp-carousel-comment-form-container').length ) {
|
| 263 |
var textarea = $('#jp-carousel-comment-form-comment-field')
|
| 264 |
.blur(function(){
|
|
@@ -320,12 +319,14 @@ jQuery(document).ready(function($) {
|
|
| 320 |
ajaxData['author'] = authorField.val();
|
| 321 |
ajaxData['url'] = urlField.val();
|
| 322 |
|
| 323 |
-
if (
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
|
|
|
|
|
|
| 329 |
}
|
| 330 |
}
|
| 331 |
|
|
@@ -363,23 +364,53 @@ jQuery(document).ready(function($) {
|
|
| 363 |
$(window).bind('keydown', keyListener);
|
| 364 |
$(window).bind('resize', resizeListener);
|
| 365 |
gallery.opened = true;
|
|
|
|
|
|
|
| 366 |
})
|
| 367 |
.bind('jp_carousel.beforeClose', function(){
|
| 368 |
var scroll = $(window).scrollTop();
|
| 369 |
|
| 370 |
$(window).unbind('keydown', keyListener);
|
| 371 |
$(window).unbind('resize', resizeListener);
|
| 372 |
-
document.location.hash = '';
|
| 373 |
$(window).scrollTop(scroll);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
gallery.opened = false;
|
| 375 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
-
$('.jp-carousel').touchwipe({
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
});
|
| 384 |
|
| 385 |
nextButton.add(previousButton).click(function(e){
|
|
@@ -397,8 +428,9 @@ jQuery(document).ready(function($) {
|
|
| 397 |
var methods = {
|
| 398 |
testForData: function(gallery) {
|
| 399 |
gallery = $( gallery ); // make sure we have it as a jQuery object.
|
| 400 |
-
if ( ! gallery.length || undefined == gallery.data( 'carousel-extra' ) )
|
| 401 |
return false;
|
|
|
|
| 402 |
return true;
|
| 403 |
},
|
| 404 |
|
|
@@ -418,8 +450,8 @@ jQuery(document).ready(function($) {
|
|
| 418 |
if ( !data )
|
| 419 |
return; // don't run if the default gallery functions weren't used
|
| 420 |
|
| 421 |
-
prepareGallery();
|
| 422 |
-
|
| 423 |
if ( gallery.jp_carousel( 'testIfOpened' ) )
|
| 424 |
return; // don't open if already opened
|
| 425 |
|
|
@@ -429,8 +461,13 @@ jQuery(document).ready(function($) {
|
|
| 429 |
$('body').css('overflow', 'hidden');
|
| 430 |
// prevent html from overflowing on some of the new themes.
|
| 431 |
originalHOverflow = $('html').css('overflow');
|
| 432 |
-
$('html').css('overflow', 'hidden');
|
| 433 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
container.data('carousel-extra', data);
|
| 435 |
|
| 436 |
return this.each(function() {
|
|
@@ -476,67 +513,28 @@ jQuery(document).ready(function($) {
|
|
| 476 |
},
|
| 477 |
|
| 478 |
next : function(){
|
| 479 |
-
var
|
| 480 |
container.animate({scrollTop:0}, 'fast');
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
gallery.jp_carousel('loopSlides');
|
| 485 |
-
} else {
|
| 486 |
-
slide = selected.next();
|
| 487 |
-
}
|
| 488 |
-
if (!slide) {
|
| 489 |
-
return this;
|
| 490 |
-
} else {
|
| 491 |
-
return this.jp_carousel('selectSlide', slide);
|
| 492 |
}
|
| 493 |
},
|
| 494 |
|
| 495 |
previous : function(){
|
| 496 |
-
var
|
| 497 |
container.animate({scrollTop:0}, 'fast');
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
gallery.jp_carousel('loopSlides', true);
|
| 502 |
-
} else {
|
| 503 |
-
slide = selected.prev();
|
| 504 |
-
}
|
| 505 |
-
if (!slide) {
|
| 506 |
-
return this;
|
| 507 |
-
} else {
|
| 508 |
-
return this.jp_carousel('selectSlide', slide);
|
| 509 |
}
|
| 510 |
},
|
| 511 |
|
| 512 |
resetButtons : function(current) {
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
gallery.jp_carousel('selectedSlide').removeClass('selected').css({'position': 'fixed'});
|
| 518 |
-
if (reverse !== true ) {
|
| 519 |
-
last = slides.last();
|
| 520 |
-
slides.first().nextAll().not(last).jp_carousel('setSlidePosition', gallery.width()+slides.first().width()).hide();
|
| 521 |
-
last.jp_carousel('setSlidePosition', -last.width());
|
| 522 |
-
last.prev().jp_carousel('setSlidePosition', -last.width() - last.prev().width());
|
| 523 |
-
slides.first().jp_carousel('setSlidePosition', gallery.width());
|
| 524 |
-
setTimeout(function(){
|
| 525 |
-
gallery.jp_carousel('selectSlide', slides.show().first());
|
| 526 |
-
}, 400);
|
| 527 |
-
|
| 528 |
-
} else {
|
| 529 |
-
first = slides.first();
|
| 530 |
-
first.jp_carousel('setSlidePosition', gallery.width());
|
| 531 |
-
first.next().jp_carousel('setSlidePosition', gallery.width() + first.width());
|
| 532 |
-
first.next().nextAll().hide().jp_carousel('setSlidePosition', -slides.last().width());
|
| 533 |
-
slides.last().jp_carousel('setSlidePosition', -slides.last().width());
|
| 534 |
-
slides.last().prevAll().not(first, first.next()).hide().jp_carousel('setSlidePosition', -slides.last().width()-slides.last().prev().width());
|
| 535 |
-
setTimeout(function(){
|
| 536 |
-
gallery.jp_carousel('selectSlide', slides.show().last());
|
| 537 |
-
}, 400);
|
| 538 |
-
|
| 539 |
-
}
|
| 540 |
},
|
| 541 |
|
| 542 |
selectedSlide : function(){
|
|
@@ -544,6 +542,8 @@ jQuery(document).ready(function($) {
|
|
| 544 |
},
|
| 545 |
|
| 546 |
setSlidePosition : function(x) {
|
|
|
|
|
|
|
| 547 |
return this.css({
|
| 548 |
'-webkit-transform':'translate3d(' + x + 'px,0,0)',
|
| 549 |
'-moz-transform':'translate3d(' + x + 'px,0,0)',
|
|
@@ -557,25 +557,41 @@ jQuery(document).ready(function($) {
|
|
| 557 |
var last = this.find('.selected').removeClass('selected'),
|
| 558 |
slides = gallery.jp_carousel('slides').css({'position': 'fixed'}),
|
| 559 |
current = $(slide).addClass('selected').css({'position': 'relative'}),
|
| 560 |
-
|
| 561 |
-
|
|
|
|
| 562 |
width = $(window).width(),
|
| 563 |
previous_previous = previous.prev(),
|
| 564 |
next_next = next.next(),
|
| 565 |
-
|
|
|
|
|
|
|
| 566 |
info_left,
|
|
|
|
| 567 |
animated,
|
| 568 |
info_min;
|
| 569 |
// center the main image
|
| 570 |
|
|
|
|
|
|
|
| 571 |
caption.hide();
|
| 572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
method = 'css';
|
| 574 |
animated = current
|
| 575 |
.add(previous)
|
| 576 |
-
.add(
|
| 577 |
.add(next)
|
| 578 |
-
.add(
|
| 579 |
.jp_carousel('loadSlide');
|
| 580 |
// slide the whole view to the x we want
|
| 581 |
slides.not(animated).hide();
|
|
@@ -587,45 +603,63 @@ jQuery(document).ready(function($) {
|
|
| 587 |
|
| 588 |
// prep the slides
|
| 589 |
var direction = last.is(current.prevAll()) ? 1 : -1;
|
|
|
|
| 590 |
if ( 1 == direction ) {
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
next_next.jp_carousel('setSlidePosition', gallery.width() + current.width()).show();
|
| 597 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
|
| 599 |
-
// if advancing prepare the slide that will enter the screen
|
| 600 |
-
previous.jp_carousel('setSlidePosition', -previous.width() + (screenPadding * 0.75)).show();
|
| 601 |
-
next.jp_carousel('setSlidePosition', gallery.width() - (screenPadding * 0.75)).show();
|
| 602 |
-
next.css({'position': ''});
|
| 603 |
-
document.location.href = document.location.href.replace(/#.*/, '') + '#jp-carousel-' + current.data('attachment-id');
|
| 604 |
gallery.jp_carousel('resetButtons', current);
|
| 605 |
container.trigger('jp_carousel.selectSlide', [current]);
|
| 606 |
|
| 607 |
-
|
| 608 |
|
| 609 |
-
|
| 610 |
-
gallery.jp_carousel('
|
| 611 |
-
gallery.jp_carousel('
|
| 612 |
-
gallery.jp_carousel('getMap', current.data('image-meta'));
|
| 613 |
-
gallery.jp_carousel('testCommentsOpened', current.data('comments-opened'));
|
| 614 |
-
gallery.jp_carousel('getComments', {'attachment_id': current.data('attachment-id'), 'offset': 0, 'clear': true});
|
| 615 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 616 |
$('#jp-carousel-comment-post-results').slideUp();
|
| 617 |
|
| 618 |
-
// $('<div />').
|
| 619 |
if ( current.data('caption') ) {
|
| 620 |
-
if ( $('<div />').
|
| 621 |
$('.jp-carousel-titleanddesc-title').fadeOut('fast').empty();
|
| 622 |
-
if ( $('<div />').
|
| 623 |
$('.jp-carousel-titleanddesc-desc').fadeOut('fast').empty();
|
| 624 |
caption.html( current.data('caption') ).fadeIn('slow');
|
| 625 |
} else {
|
| 626 |
caption.fadeOut('fast').empty();
|
| 627 |
}
|
| 628 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
},
|
| 630 |
|
| 631 |
slides : function(){
|
|
@@ -635,7 +669,7 @@ jQuery(document).ready(function($) {
|
|
| 635 |
slideDimensions : function(){
|
| 636 |
return {
|
| 637 |
width: $(window).width() - (screenPadding * 2),
|
| 638 |
-
height: $(window).height() / 100 * proportion - 60
|
| 639 |
};
|
| 640 |
},
|
| 641 |
|
|
@@ -665,10 +699,10 @@ jQuery(document).ready(function($) {
|
|
| 665 |
|
| 666 |
if ( w_ratio < h_ratio ) {
|
| 667 |
width = max.width;
|
| 668 |
-
height = width / orig_ratio;
|
| 669 |
} else if ( h_ratio < w_ratio ) {
|
| 670 |
height = max.height;
|
| 671 |
-
width = height * orig_ratio;
|
| 672 |
} else {
|
| 673 |
width = orig.width;
|
| 674 |
height = orig.height;
|
|
@@ -685,20 +719,15 @@ jQuery(document).ready(function($) {
|
|
| 685 |
size = current.jp_carousel('bestFit');
|
| 686 |
|
| 687 |
photo_info.css({
|
| 688 |
-
'left' : (info.width() - size.width) * 0.5,
|
| 689 |
-
'width' : size.width
|
| 690 |
});
|
| 691 |
|
| 692 |
-
if (isMobile){
|
| 693 |
-
photo_info.css('left', '0px');
|
| 694 |
-
photo_info.css('top', '-20px');
|
| 695 |
-
}
|
| 696 |
-
|
| 697 |
return this;
|
| 698 |
},
|
| 699 |
|
| 700 |
fitMeta : function(animated){
|
| 701 |
-
var newInfoTop = { top: ( $(window).height() / 100 * proportion + 5 ) + 'px' };
|
| 702 |
var newLeftWidth = { width: ( info.width() - (imageMeta.width() + 80) ) + 'px' };
|
| 703 |
|
| 704 |
if (animated) {
|
|
@@ -719,7 +748,7 @@ jQuery(document).ready(function($) {
|
|
| 719 |
max = gallery.jp_carousel('slideDimensions');
|
| 720 |
|
| 721 |
dimensions.left = 0;
|
| 722 |
-
dimensions.top = ( (max.height - dimensions.height) * 0.5 ) + 40;
|
| 723 |
$this[method](dimensions);
|
| 724 |
});
|
| 725 |
},
|
|
@@ -736,6 +765,13 @@ jQuery(document).ready(function($) {
|
|
| 736 |
var width = this.jp_carousel('slideDimensions').width,
|
| 737 |
x = 0;
|
| 738 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 739 |
// Calculate the new src.
|
| 740 |
items.each(function(i){
|
| 741 |
var src_item = $(this),
|
|
@@ -766,6 +802,8 @@ jQuery(document).ready(function($) {
|
|
| 766 |
if ( 0 !== start_index )
|
| 767 |
$('<img/>')[0].src = $(items[start_index]).data('gallery-src');
|
| 768 |
|
|
|
|
|
|
|
| 769 |
// create the 'slide'
|
| 770 |
items.each(function(i){
|
| 771 |
var src_item = $(this),
|
|
@@ -773,6 +811,7 @@ jQuery(document).ready(function($) {
|
|
| 773 |
comments_opened = src_item.data('comments-opened') || 0,
|
| 774 |
image_meta = src_item.data('image-meta') || {},
|
| 775 |
orig_size = src_item.data('orig-size') || '',
|
|
|
|
| 776 |
title = src_item.data('image-title') || '',
|
| 777 |
description = src_item.data('image-description') || '',
|
| 778 |
caption = src_item.parents('dl').find('dd.gallery-caption').html() || '',
|
|
@@ -790,13 +829,19 @@ jQuery(document).ready(function($) {
|
|
| 790 |
description = gallery.jp_carousel('texturize', description);
|
| 791 |
caption = gallery.jp_carousel('texturize', caption);
|
| 792 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
var slide = $('<div class="jp-carousel-slide"></div>')
|
| 794 |
.hide()
|
| 795 |
.css({
|
| 796 |
//'position' : 'fixed',
|
| 797 |
'left' : i < start_index ? -1000 : gallery.width()
|
| 798 |
})
|
| 799 |
-
.append(
|
| 800 |
.appendTo(gallery)
|
| 801 |
.data('src', src )
|
| 802 |
.data('title', title)
|
|
@@ -810,10 +855,21 @@ jQuery(document).ready(function($) {
|
|
| 810 |
.data('medium-file', medium_file)
|
| 811 |
.data('large-file', large_file)
|
| 812 |
.data('orig-file', orig_file)
|
| 813 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 814 |
|
| 815 |
-
|
| 816 |
-
slide.find('img').first().attr('src', src );
|
| 817 |
}
|
| 818 |
});
|
| 819 |
return this;
|
|
@@ -832,11 +888,11 @@ jQuery(document).ready(function($) {
|
|
| 832 |
if ( 'undefined' == typeof args.medium_file || 'undefined' == typeof args.large_file )
|
| 833 |
return args.orig_file;
|
| 834 |
|
| 835 |
-
var medium_size = args.medium_file.replace(
|
| 836 |
medium_size_parts = (medium_size != args.medium_file) ? medium_size.split('x') : [args.orig_width, 0],
|
| 837 |
medium_width = parseInt( medium_size_parts[0], 10 ),
|
| 838 |
medium_height = parseInt( medium_size_parts[1], 10 ),
|
| 839 |
-
large_size = args.large_file.replace(
|
| 840 |
large_size_parts = (large_size != args.large_file) ? large_size.split('x') : [args.orig_width, 0],
|
| 841 |
large_width = parseInt( large_size_parts[0], 10 ),
|
| 842 |
large_height = parseInt( large_size_parts[1], 10 );
|
|
@@ -878,7 +934,7 @@ jQuery(document).ready(function($) {
|
|
| 878 |
if (d >= 1)
|
| 879 |
return Math.round(d) + 's';
|
| 880 |
var df = 1, top = 1, bot = 1;
|
| 881 |
-
var limit =
|
| 882 |
while (df != d && limit-- > 0) {
|
| 883 |
if (df < d) {
|
| 884 |
top += 1;
|
|
@@ -941,8 +997,8 @@ jQuery(document).ready(function($) {
|
|
| 941 |
desc = gallery.jp_carousel('parseTitleDesc', data.desc) || '';
|
| 942 |
|
| 943 |
if ( title.length || desc.length ) {
|
| 944 |
-
// $('<div />').
|
| 945 |
-
if ( $('<div />').
|
| 946 |
title = '';
|
| 947 |
|
| 948 |
markup = ( title.length ) ? '<div class="jp-carousel-titleanddesc-title">' + title + '</div>' : '';
|
|
@@ -955,11 +1011,77 @@ jQuery(document).ready(function($) {
|
|
| 955 |
$( 'div#jp-carousel-comments-loading' ).css('margin-top', '20px');
|
| 956 |
},
|
| 957 |
|
| 958 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 959 |
if ( !meta || 1 != jetpackCarouselStrings.display_exif )
|
| 960 |
return false;
|
| 961 |
|
| 962 |
-
var $ul = $(
|
|
|
|
| 963 |
$.each( meta, function( key, val ) {
|
| 964 |
if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, [ 'camera', 'aperture', 'shutter_speed', 'focal_length' ] ) )
|
| 965 |
return;
|
|
@@ -974,22 +1096,17 @@ jQuery(document).ready(function($) {
|
|
| 974 |
case 'aperture':
|
| 975 |
val = 'f/' + val;
|
| 976 |
break;
|
| 977 |
-
default:
|
| 978 |
-
// making jslint happy
|
| 979 |
-
break;
|
| 980 |
}
|
| 981 |
|
| 982 |
$ul.append( '<li><h5>' + jetpackCarouselStrings[key] + '</h5>' + val + '</li>' );
|
| 983 |
});
|
| 984 |
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
$( 'div.jp-carousel-image-meta', 'div.jp-carousel-wrap' )
|
| 989 |
-
.append( $ul );
|
| 990 |
},
|
| 991 |
|
| 992 |
-
|
|
|
|
| 993 |
if(!current || !current.data)
|
| 994 |
return false;
|
| 995 |
var original = current.data('orig-file').replace(/\?.+$/, ''),
|
|
@@ -999,11 +1116,11 @@ jQuery(document).ready(function($) {
|
|
| 999 |
.attr( 'href', original )
|
| 1000 |
.attr( 'target', '_blank' );
|
| 1001 |
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
},
|
| 1005 |
|
| 1006 |
-
|
| 1007 |
if ( !meta.latitude || !meta.longitude || 1 != jetpackCarouselStrings.display_geo )
|
| 1008 |
return;
|
| 1009 |
|
|
@@ -1044,24 +1161,22 @@ jQuery(document).ready(function($) {
|
|
| 1044 |
},
|
| 1045 |
|
| 1046 |
getComments: function( args ) {
|
|
|
|
|
|
|
| 1047 |
if ( 'object' != typeof args )
|
| 1048 |
-
|
| 1049 |
|
| 1050 |
-
if (
|
| 1051 |
return;
|
| 1052 |
|
| 1053 |
if ( ! args.offset || 'undefined' == typeof args.offset || args.offset < 1 )
|
| 1054 |
args.offset = 0;
|
| 1055 |
|
| 1056 |
var comments = $('.jp-carousel-comments'),
|
| 1057 |
-
commentsLoading = $('#jp-carousel-comments-loading');
|
| 1058 |
|
| 1059 |
-
|
| 1060 |
-
|
| 1061 |
-
if ( args.clear ) {
|
| 1062 |
-
comments.hide();
|
| 1063 |
-
comments.empty();
|
| 1064 |
-
}
|
| 1065 |
|
| 1066 |
$.ajax({
|
| 1067 |
type: 'GET',
|
|
@@ -1074,16 +1189,13 @@ jQuery(document).ready(function($) {
|
|
| 1074 |
offset: args.offset
|
| 1075 |
},
|
| 1076 |
success: function(data, status, xhr) {
|
| 1077 |
-
if ( args.clear )
|
| 1078 |
-
comments.fadeOut('fast');
|
| 1079 |
-
comments.empty();
|
| 1080 |
-
}
|
| 1081 |
|
| 1082 |
$( data ).each(function(){
|
| 1083 |
var comment = $('<div></div>')
|
| 1084 |
.addClass('jp-carousel-comment')
|
| 1085 |
.attr('id', 'jp-carousel-comment-' + this['id'])
|
| 1086 |
-
.css({})
|
| 1087 |
.html(
|
| 1088 |
'<div class="comment-gravatar">'
|
| 1089 |
+ this['gravatar_markup']
|
|
@@ -1107,7 +1219,7 @@ jQuery(document).ready(function($) {
|
|
| 1107 |
gallery.jp_carousel('getComments',{ attachment_id: args.attachment_id, offset: args.offset + 10, clear: false });
|
| 1108 |
clearInterval( commentInterval );
|
| 1109 |
}
|
| 1110 |
-
},
|
| 1111 |
});
|
| 1112 |
|
| 1113 |
// Verify (late) that the user didn't repeatldy click the arrows really fast, in which case the requested
|
|
@@ -1157,6 +1269,47 @@ jQuery(document).ready(function($) {
|
|
| 1157 |
var commentTextArea = $('#jp-carousel-comment-form-comment-field');
|
| 1158 |
if ( commentTextArea )
|
| 1159 |
commentTextArea.val('');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1160 |
}
|
| 1161 |
};
|
| 1162 |
|
|
@@ -1183,33 +1336,114 @@ jQuery(document).ready(function($) {
|
|
| 1183 |
$(this).jp_carousel('open', {start_index: $(this).find('.gallery-item, .tiled-gallery-item').index($(e.target).parents('.gallery-item, .tiled-gallery-item'))});
|
| 1184 |
});
|
| 1185 |
|
| 1186 |
-
// Set an interval on page load to load the carousel if hash exists and not already opened.
|
| 1187 |
// Makes carousel work on page load and when back button leads to same URL with carousel hash (ie: no actual document.ready trigger)
|
| 1188 |
-
$(
|
| 1189 |
-
|
| 1190 |
-
|
| 1191 |
-
if ( ! document.location.hash || ! document.location.hash.match(/jp-carousel-(\d+)/) )
|
| 1192 |
-
return;
|
| 1193 |
|
| 1194 |
-
|
|
|
|
| 1195 |
|
| 1196 |
-
|
| 1197 |
-
return;
|
| 1198 |
|
| 1199 |
-
|
| 1200 |
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1207 |
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
}, 1000);
|
| 1211 |
});
|
|
|
|
|
|
|
|
|
|
| 1212 |
});
|
| 1213 |
|
| 1214 |
-
|
| 1215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
jQuery(document).ready(function($) {
|
| 3 |
|
| 4 |
// gallery faded layer and container elements
|
| 5 |
+
var overlay, comments, gallery, container, nextButton, previousButton, info, title, transitionBegin,
|
| 6 |
+
caption, resizeTimeout, mouseTimeout, photo_info, close_hint, commentInterval,
|
| 7 |
+
screenPadding = 110, originalOverflow = $('body').css('overflow'), originalHOverflow = $('html').css('overflow'), proportion = 85,
|
| 8 |
+
last_known_location_hash = '';
|
| 9 |
|
| 10 |
+
if ( window.innerWidth <= 760 ) {
|
| 11 |
+
screenPadding = Math.round( ( window.innerWidth / 760 ) * 110 );
|
| 12 |
|
| 13 |
+
if ( screenPadding < 40 && ( ( 'ontouchstart' in window ) || window.DocumentTouch && document instanceof DocumentTouch ) )
|
| 14 |
+
screenPadding = 0;
|
| 15 |
+
}
|
| 16 |
|
| 17 |
var keyListener = function(e){
|
| 18 |
switch(e.which){
|
| 30 |
gallery.jp_carousel('next');
|
| 31 |
break;
|
| 32 |
case 37: // left
|
| 33 |
+
case 8: // backspace
|
| 34 |
e.preventDefault();
|
| 35 |
gallery.jp_carousel('clearCommentTextAreaValue');
|
| 36 |
gallery.jp_carousel('previous');
|
| 58 |
}, 200);
|
| 59 |
};
|
| 60 |
|
| 61 |
+
var prepareGallery = function( dataCarouselExtra ){
|
| 62 |
if (!overlay) {
|
|
|
|
| 63 |
overlay = $('<div></div>')
|
| 64 |
.addClass('jp-carousel-overlay')
|
| 65 |
.css({
|
| 70 |
'left' : 0
|
| 71 |
});
|
| 72 |
|
| 73 |
+
var buttons = '<a class="jp-carousel-commentlink" href="#">' + jetpackCarouselStrings.comment + '</a>';
|
| 74 |
+
if ( 1 == jetpackCarouselStrings.is_logged_in ) {
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
buttons = $('<div class="jp-carousel-buttons">' + buttons + '</div>');
|
| 78 |
|
| 79 |
caption = $('<h2></h2>');
|
| 87 |
'width' : '250px'
|
| 88 |
});
|
| 89 |
|
| 90 |
+
imageMeta
|
| 91 |
+
.append( buttons )
|
| 92 |
+
.append( "<ul class='jp-carousel-image-exif' style='display:none;'></ul>" )
|
| 93 |
+
.append( "<a class='jp-carousel-image-download' style='display:none;'></a>" )
|
| 94 |
+
.append( "<div class='jp-carousel-image-map' style='display:none;'></div>" );
|
| 95 |
+
|
| 96 |
titleAndDescription = $('<div></div>')
|
| 97 |
.addClass('jp-carousel-titleanddesc')
|
| 98 |
.css({
|
| 100 |
'margin-top' : imageMeta.css('margin-top')
|
| 101 |
});
|
| 102 |
|
| 103 |
+
var commentFormMarkup = '<div id="jp-carousel-comment-form-container">';
|
|
|
|
| 104 |
|
| 105 |
+
if ( jetpackCarouselStrings.local_comments_commenting_as && jetpackCarouselStrings.local_comments_commenting_as.length ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
// Jetpack comments not enabled, fallback to local comments
|
| 107 |
+
|
| 108 |
+
if ( 1 != jetpackCarouselStrings.is_logged_in && 1 == jetpackCarouselStrings.comment_registration ) {
|
| 109 |
+
commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
|
| 110 |
+
} else {
|
| 111 |
+
commentFormMarkup += '<form id="jp-carousel-comment-form">';
|
| 112 |
+
commentFormMarkup += '<textarea name="comment" class="jp-carousel-comment-form-field jp-carousel-comment-form-textarea" id="jp-carousel-comment-form-comment-field" placeholder="' + jetpackCarouselStrings.write_comment + '"></textarea>';
|
| 113 |
+
commentFormMarkup += '<div id="jp-carousel-comment-form-submit-and-info-wrapper">';
|
| 114 |
+
commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
|
| 115 |
+
commentFormMarkup += '<input type="submit" name="submit" class="jp-carousel-comment-form-button" id="jp-carousel-comment-form-button-submit" value="'+jetpackCarouselStrings.post_comment+'" />';
|
| 116 |
+
commentFormMarkup += '<span id="jp-carousel-comment-form-spinner"> </span>';
|
| 117 |
+
commentFormMarkup += '<div id="jp-carousel-comment-post-results"></div>';
|
| 118 |
+
commentFormMarkup += '</div>';
|
| 119 |
+
commentFormMarkup += '</form>';
|
| 120 |
+
}
|
| 121 |
}
|
| 122 |
commentFormMarkup += '</div>';
|
| 123 |
|
| 144 |
});
|
| 145 |
|
| 146 |
leftWidth = ( $(window).width() - ( screenPadding * 2 ) ) - (imageMeta.width() + 40);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
leftWidth += 'px';
|
| 148 |
|
|
|
|
|
|
|
|
|
|
| 149 |
leftColWrapper = $('<div></div>')
|
| 150 |
.addClass('jp-carousel-left-column-wrapper')
|
| 151 |
.css({
|
| 152 |
+
'width' : Math.floor( leftWidth )
|
| 153 |
})
|
| 154 |
.append(titleAndDescription)
|
| 155 |
.append(commentForm)
|
| 162 |
info = $('<div></div>')
|
| 163 |
.addClass('jp-carousel-info')
|
| 164 |
.css({
|
| 165 |
+
'top' : Math.floor( ($(window).height() / 100) * proportion ),
|
| 166 |
'left' : screenPadding,
|
| 167 |
'right' : screenPadding
|
| 168 |
})
|
| 169 |
.append(photo_info)
|
| 170 |
+
.append(imageMeta);
|
|
|
|
| 171 |
|
| 172 |
+
if ( window.innerWidth <= 760 ) {
|
| 173 |
+
photo_info.remove().insertAfter( titleAndDescription );
|
| 174 |
+
info.prepend( leftColWrapper );
|
| 175 |
+
}
|
| 176 |
+
else {
|
| 177 |
+
info.append( leftColWrapper );
|
| 178 |
+
}
|
| 179 |
|
| 180 |
targetBottomPos = ( $(window).height() - parseInt( info.css('top'), 10 ) ) + 'px';
|
| 181 |
|
| 182 |
nextButton = $("<div><span></span></div>")
|
| 183 |
.addClass('jp-carousel-next-button')
|
| 184 |
.css({
|
|
|
|
|
|
|
| 185 |
'right' : '15px',
|
|
|
|
|
|
|
| 186 |
});
|
| 187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
previousButton = $("<div><span></span></div>")
|
| 189 |
.addClass('jp-carousel-previous-button')
|
| 190 |
.css({
|
|
|
|
|
|
|
| 191 |
'left' : 0,
|
|
|
|
|
|
|
| 192 |
});
|
| 193 |
|
| 194 |
+
nextButton.add( previousButton ).css( {
|
| 195 |
+
'position' : 'fixed',
|
| 196 |
+
'top' : '40px',
|
| 197 |
+
'bottom' : targetBottomPos,
|
| 198 |
+
'width' : screenPadding
|
| 199 |
+
} );
|
| 200 |
|
| 201 |
gallery = $('<div></div>')
|
| 202 |
.addClass('jp-carousel')
|
| 214 |
});
|
| 215 |
|
| 216 |
container = $("<div></div>")
|
| 217 |
+
.addClass('jp-carousel-wrap')
|
| 218 |
+
.addClass( 'jp-carousel-transitions' );
|
| 219 |
|
| 220 |
if ( 'white' == jetpackCarouselStrings.background_color )
|
| 221 |
container.addClass('jp-carousel-light');
|
| 254 |
container.animate({scrollTop: parseInt(info.position()['top'], 10)}, 'fast');
|
| 255 |
$('#jp-carousel-comment-form-submit-and-info-wrapper').slideDown('fast');
|
| 256 |
$('#jp-carousel-comment-form-comment-field').focus();
|
| 257 |
+
} else if ( target.hasClass('jp-carousel-comment-login') ) {
|
| 258 |
+
var url = jetpackCarouselStrings.login_url + '%23jp-carousel-' + attachment_id;
|
| 259 |
+
|
| 260 |
+
window.location.href = url;
|
| 261 |
} else if ( target.parents('#jp-carousel-comment-form-container').length ) {
|
| 262 |
var textarea = $('#jp-carousel-comment-form-comment-field')
|
| 263 |
.blur(function(){
|
| 319 |
ajaxData['author'] = authorField.val();
|
| 320 |
ajaxData['url'] = urlField.val();
|
| 321 |
|
| 322 |
+
if ( 1 == jetpackCarouselStrings.require_name_email ) {
|
| 323 |
+
if ( ! ajaxData['email'].length || ! ajaxData['email'].match('@') ) {
|
| 324 |
+
gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-email-field', 'error': jetpackCarouselStrings.no_comment_email});
|
| 325 |
+
return;
|
| 326 |
+
} else if ( ! ajaxData['author'].length ) {
|
| 327 |
+
gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-author-field', 'error': jetpackCarouselStrings.no_comment_author});
|
| 328 |
+
return;
|
| 329 |
+
}
|
| 330 |
}
|
| 331 |
}
|
| 332 |
|
| 364 |
$(window).bind('keydown', keyListener);
|
| 365 |
$(window).bind('resize', resizeListener);
|
| 366 |
gallery.opened = true;
|
| 367 |
+
|
| 368 |
+
resizeListener();
|
| 369 |
})
|
| 370 |
.bind('jp_carousel.beforeClose', function(){
|
| 371 |
var scroll = $(window).scrollTop();
|
| 372 |
|
| 373 |
$(window).unbind('keydown', keyListener);
|
| 374 |
$(window).unbind('resize', resizeListener);
|
|
|
|
| 375 |
$(window).scrollTop(scroll);
|
| 376 |
+
})
|
| 377 |
+
.bind('jp_carousel.afterClose', function(){
|
| 378 |
+
if ( history.pushState ) {
|
| 379 |
+
history.pushState("", document.title, window.location.pathname + window.location.search);
|
| 380 |
+
} else {
|
| 381 |
+
last_known_location_hash = '';
|
| 382 |
+
window.location.hash = '';
|
| 383 |
+
}
|
| 384 |
gallery.opened = false;
|
| 385 |
+
})
|
| 386 |
+
.on( 'transitionend.jp-carousel ', '.jp-carousel-slide', function ( e ) {
|
| 387 |
+
// If the movement transitions take more than twice the allotted time, disable them.
|
| 388 |
+
// There is some wiggle room in the 2x, since some of that time is taken up in
|
| 389 |
+
// JavaScript, setting up the transition and calling the events.
|
| 390 |
+
if ( 'transform' == e.originalEvent.propertyName ) {
|
| 391 |
+
var transitionMultiplier = ( ( Date.now() - transitionBegin ) / 1000 ) / e.originalEvent.elapsedTime;
|
| 392 |
+
|
| 393 |
+
container.off( 'transitionend.jp-carousel' );
|
| 394 |
+
|
| 395 |
+
if ( transitionMultiplier >= 2 )
|
| 396 |
+
$( '.jp-carousel-transitions' ).removeClass( 'jp-carousel-transitions' );
|
| 397 |
+
}
|
| 398 |
+
} );
|
| 399 |
|
| 400 |
+
$( '.jp-carousel-wrap' ).touchwipe( {
|
| 401 |
+
wipeLeft : function ( e ) {
|
| 402 |
+
e.preventDefault();
|
| 403 |
+
gallery.jp_carousel( 'next' );
|
| 404 |
+
},
|
| 405 |
+
wipeRight : function ( e ) {
|
| 406 |
+
e.preventDefault();
|
| 407 |
+
gallery.jp_carousel( 'previous' );
|
| 408 |
+
},
|
| 409 |
+
preventDefaultEvents : false
|
| 410 |
+
} );
|
| 411 |
+
|
| 412 |
+
$( '.jetpack-likes-widget-unloaded' ).each( function() {
|
| 413 |
+
jetpackLikesWidgetQueue.push( this.id );
|
| 414 |
});
|
| 415 |
|
| 416 |
nextButton.add(previousButton).click(function(e){
|
| 428 |
var methods = {
|
| 429 |
testForData: function(gallery) {
|
| 430 |
gallery = $( gallery ); // make sure we have it as a jQuery object.
|
| 431 |
+
if ( ! gallery.length || undefined == gallery.data( 'carousel-extra' ) ) {
|
| 432 |
return false;
|
| 433 |
+
}
|
| 434 |
return true;
|
| 435 |
},
|
| 436 |
|
| 450 |
if ( !data )
|
| 451 |
return; // don't run if the default gallery functions weren't used
|
| 452 |
|
| 453 |
+
prepareGallery( data );
|
| 454 |
+
|
| 455 |
if ( gallery.jp_carousel( 'testIfOpened' ) )
|
| 456 |
return; // don't open if already opened
|
| 457 |
|
| 461 |
$('body').css('overflow', 'hidden');
|
| 462 |
// prevent html from overflowing on some of the new themes.
|
| 463 |
originalHOverflow = $('html').css('overflow');
|
| 464 |
+
$('html').css('overflow', 'hidden');
|
| 465 |
+
|
| 466 |
+
// Re-apply inline-block style here and give an initial value for the width
|
| 467 |
+
// This value will get replaced with a more appropriate value once the slide is loaded
|
| 468 |
+
// This avoids the likes widget appearing initially full width below the comment button and then shuffling up
|
| 469 |
+
jQuery( '.slim-likes-widget' ).find( 'iframe' ).css( 'display', 'inline-block' ).css( 'width', '60px' );
|
| 470 |
+
|
| 471 |
container.data('carousel-extra', data);
|
| 472 |
|
| 473 |
return this.each(function() {
|
| 513 |
},
|
| 514 |
|
| 515 |
next : function(){
|
| 516 |
+
var slide = gallery.jp_carousel( 'nextSlide' );
|
| 517 |
container.animate({scrollTop:0}, 'fast');
|
| 518 |
+
|
| 519 |
+
if ( slide ) {
|
| 520 |
+
this.jp_carousel('selectSlide', slide);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
}
|
| 522 |
},
|
| 523 |
|
| 524 |
previous : function(){
|
| 525 |
+
var slide = gallery.jp_carousel( 'prevSlide' );
|
| 526 |
container.animate({scrollTop:0}, 'fast');
|
| 527 |
+
|
| 528 |
+
if ( slide ) {
|
| 529 |
+
this.jp_carousel('selectSlide', slide);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
}
|
| 531 |
},
|
| 532 |
|
| 533 |
resetButtons : function(current) {
|
| 534 |
+
if ( current.data('liked') )
|
| 535 |
+
$('.jp-carousel-buttons a.jp-carousel-like').addClass('liked').text(jetpackCarouselStrings.unlike);
|
| 536 |
+
else
|
| 537 |
+
$('.jp-carousel-buttons a.jp-carousel-like').removeClass('liked').text(jetpackCarouselStrings.like);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
},
|
| 539 |
|
| 540 |
selectedSlide : function(){
|
| 542 |
},
|
| 543 |
|
| 544 |
setSlidePosition : function(x) {
|
| 545 |
+
transitionBegin = Date.now();
|
| 546 |
+
|
| 547 |
return this.css({
|
| 548 |
'-webkit-transform':'translate3d(' + x + 'px,0,0)',
|
| 549 |
'-moz-transform':'translate3d(' + x + 'px,0,0)',
|
| 557 |
var last = this.find('.selected').removeClass('selected'),
|
| 558 |
slides = gallery.jp_carousel('slides').css({'position': 'fixed'}),
|
| 559 |
current = $(slide).addClass('selected').css({'position': 'relative'}),
|
| 560 |
+
attachmentId = current.data( 'attachment-id' ),
|
| 561 |
+
previous = gallery.jp_carousel( 'prevSlide' ),
|
| 562 |
+
next = gallery.jp_carousel( 'nextSlide' ),
|
| 563 |
width = $(window).width(),
|
| 564 |
previous_previous = previous.prev(),
|
| 565 |
next_next = next.next(),
|
| 566 |
+
galleryWidth = gallery.width(),
|
| 567 |
+
currentWidth = current.width(),
|
| 568 |
+
left = Math.floor( ( galleryWidth - currentWidth ) * 0.5 ),
|
| 569 |
info_left,
|
| 570 |
+
method,
|
| 571 |
animated,
|
| 572 |
info_min;
|
| 573 |
// center the main image
|
| 574 |
|
| 575 |
+
gallery.jp_carousel( 'loadFullImage', current );
|
| 576 |
+
|
| 577 |
caption.hide();
|
| 578 |
|
| 579 |
+
if ( next.length == 0 && slides.length <= 2 )
|
| 580 |
+
$( '.jp-carousel-next-button' ).hide();
|
| 581 |
+
else
|
| 582 |
+
$( '.jp-carousel-next-button' ).show();
|
| 583 |
+
|
| 584 |
+
if ( previous.length == 0 && slides.length <= 2 )
|
| 585 |
+
$( '.jp-carousel-previous-button' ).hide();
|
| 586 |
+
else
|
| 587 |
+
$( '.jp-carousel-previous-button' ).show();
|
| 588 |
+
|
| 589 |
method = 'css';
|
| 590 |
animated = current
|
| 591 |
.add(previous)
|
| 592 |
+
.add(previous_previous)
|
| 593 |
.add(next)
|
| 594 |
+
.add(next_next)
|
| 595 |
.jp_carousel('loadSlide');
|
| 596 |
// slide the whole view to the x we want
|
| 597 |
slides.not(animated).hide();
|
| 603 |
|
| 604 |
// prep the slides
|
| 605 |
var direction = last.is(current.prevAll()) ? 1 : -1;
|
| 606 |
+
|
| 607 |
if ( 1 == direction ) {
|
| 608 |
+
if ( ! next_next.is( previous ) )
|
| 609 |
+
next_next.jp_carousel('setSlidePosition', galleryWidth + next.width()).show();
|
| 610 |
+
|
| 611 |
+
if ( ! previous_previous.is( next ) )
|
| 612 |
+
previous_previous.jp_carousel('setSlidePosition', -previous_previous.width() - currentWidth ).show();
|
|
|
|
| 613 |
}
|
| 614 |
+
else {
|
| 615 |
+
if ( ! next_next.is( previous ) )
|
| 616 |
+
next_next.jp_carousel('setSlidePosition', galleryWidth + currentWidth ).show();
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
previous.jp_carousel('setSlidePosition', Math.floor( -previous.width() + (screenPadding * 0.75 ) ) ).show();
|
| 620 |
+
next.jp_carousel('setSlidePosition', Math.ceil( galleryWidth - (screenPadding * 0.75 ) ) ).show();
|
| 621 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
gallery.jp_carousel('resetButtons', current);
|
| 623 |
container.trigger('jp_carousel.selectSlide', [current]);
|
| 624 |
|
| 625 |
+
gallery.jp_carousel( 'getTitleDesc', { title: current.data( 'title' ), desc: current.data( 'desc' ) } );
|
| 626 |
|
| 627 |
+
// Lazy-load the Likes iframe for the current, next, and previous slides.
|
| 628 |
+
gallery.jp_carousel( 'loadLikes', attachmentId );
|
| 629 |
+
gallery.jp_carousel( 'updateLikesWidgetVisibility', attachmentId )
|
|
|
|
|
|
|
|
|
|
| 630 |
|
| 631 |
+
if ( next.length > 0 )
|
| 632 |
+
gallery.jp_carousel( 'loadLikes', next.data( 'attachment-id' ) );
|
| 633 |
+
|
| 634 |
+
if ( previous.length > 0 )
|
| 635 |
+
gallery.jp_carousel( 'loadLikes', previous.data( 'attachment-id' ) );
|
| 636 |
+
|
| 637 |
+
var imageMeta = current.data( 'image-meta' );
|
| 638 |
+
gallery.jp_carousel( 'updateExif', imageMeta );
|
| 639 |
+
gallery.jp_carousel( 'updateFullSizeLink', current );
|
| 640 |
+
gallery.jp_carousel( 'updateMap', imageMeta );
|
| 641 |
+
gallery.jp_carousel( 'testCommentsOpened', current.data( 'comments-opened' ) );
|
| 642 |
+
gallery.jp_carousel( 'getComments', { 'attachment_id': attachmentId, 'offset': 0, 'clear': true } );
|
| 643 |
$('#jp-carousel-comment-post-results').slideUp();
|
| 644 |
|
| 645 |
+
// $('<div />').text(sometext).html() is a trick to go to HTML to plain text (including HTML entities decode, etc)
|
| 646 |
if ( current.data('caption') ) {
|
| 647 |
+
if ( $('<div />').text(current.data('caption')).html() == $('<div />').text(current.data('title')).html() )
|
| 648 |
$('.jp-carousel-titleanddesc-title').fadeOut('fast').empty();
|
| 649 |
+
if ( $('<div />').text(current.data('caption')).html() == $('<div />').text(current.data('desc')).html() )
|
| 650 |
$('.jp-carousel-titleanddesc-desc').fadeOut('fast').empty();
|
| 651 |
caption.html( current.data('caption') ).fadeIn('slow');
|
| 652 |
} else {
|
| 653 |
caption.fadeOut('fast').empty();
|
| 654 |
}
|
| 655 |
|
| 656 |
+
|
| 657 |
+
// Load the images for the next and previous slides.
|
| 658 |
+
$( next ).add( previous ).each( function () {
|
| 659 |
+
gallery.jp_carousel( 'loadFullImage', $( this ) );
|
| 660 |
+
} );
|
| 661 |
+
|
| 662 |
+
window.location.hash = last_known_location_hash = '#jp-carousel-' + attachmentId;
|
| 663 |
},
|
| 664 |
|
| 665 |
slides : function(){
|
| 669 |
slideDimensions : function(){
|
| 670 |
return {
|
| 671 |
width: $(window).width() - (screenPadding * 2),
|
| 672 |
+
height: Math.floor( $(window).height() / 100 * proportion - 60 )
|
| 673 |
};
|
| 674 |
},
|
| 675 |
|
| 699 |
|
| 700 |
if ( w_ratio < h_ratio ) {
|
| 701 |
width = max.width;
|
| 702 |
+
height = Math.floor( width / orig_ratio );
|
| 703 |
} else if ( h_ratio < w_ratio ) {
|
| 704 |
height = max.height;
|
| 705 |
+
width = Math.floor( height * orig_ratio );
|
| 706 |
} else {
|
| 707 |
width = orig.width;
|
| 708 |
height = orig.height;
|
| 719 |
size = current.jp_carousel('bestFit');
|
| 720 |
|
| 721 |
photo_info.css({
|
| 722 |
+
'left' : Math.floor( (info.width() - size.width) * 0.5 ),
|
| 723 |
+
'width' : Math.floor( size.width )
|
| 724 |
});
|
| 725 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
return this;
|
| 727 |
},
|
| 728 |
|
| 729 |
fitMeta : function(animated){
|
| 730 |
+
var newInfoTop = { top: Math.floor( $(window).height() / 100 * proportion + 5 ) + 'px' };
|
| 731 |
var newLeftWidth = { width: ( info.width() - (imageMeta.width() + 80) ) + 'px' };
|
| 732 |
|
| 733 |
if (animated) {
|
| 748 |
max = gallery.jp_carousel('slideDimensions');
|
| 749 |
|
| 750 |
dimensions.left = 0;
|
| 751 |
+
dimensions.top = Math.floor( (max.height - dimensions.height) * 0.5 ) + 40;
|
| 752 |
$this[method](dimensions);
|
| 753 |
});
|
| 754 |
},
|
| 765 |
var width = this.jp_carousel('slideDimensions').width,
|
| 766 |
x = 0;
|
| 767 |
|
| 768 |
+
if ( items.length < 2 ) {
|
| 769 |
+
$( '.jp-carousel-next-button, .jp-carousel-previous-button' ).hide();
|
| 770 |
+
}
|
| 771 |
+
else {
|
| 772 |
+
$( '.jp-carousel-next-button, .jp-carousel-previous-button' ).show();
|
| 773 |
+
}
|
| 774 |
+
|
| 775 |
// Calculate the new src.
|
| 776 |
items.each(function(i){
|
| 777 |
var src_item = $(this),
|
| 802 |
if ( 0 !== start_index )
|
| 803 |
$('<img/>')[0].src = $(items[start_index]).data('gallery-src');
|
| 804 |
|
| 805 |
+
var useInPageThumbnails = items.first().closest( '.tiled-gallery.type-rectangular' ).length > 0;
|
| 806 |
+
|
| 807 |
// create the 'slide'
|
| 808 |
items.each(function(i){
|
| 809 |
var src_item = $(this),
|
| 811 |
comments_opened = src_item.data('comments-opened') || 0,
|
| 812 |
image_meta = src_item.data('image-meta') || {},
|
| 813 |
orig_size = src_item.data('orig-size') || '',
|
| 814 |
+
thumb_size = { width : src_item[0].naturalWidth, height : src_item[0].naturalHeight },
|
| 815 |
title = src_item.data('image-title') || '',
|
| 816 |
description = src_item.data('image-description') || '',
|
| 817 |
caption = src_item.parents('dl').find('dd.gallery-caption').html() || '',
|
| 829 |
description = gallery.jp_carousel('texturize', description);
|
| 830 |
caption = gallery.jp_carousel('texturize', caption);
|
| 831 |
|
| 832 |
+
// Initially, the image is a 1x1 transparent gif. The preview is shown as a background image on the slide itself.
|
| 833 |
+
var image = $( '<img/>' )
|
| 834 |
+
.attr( 'src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' )
|
| 835 |
+
.css( 'width', '100%' )
|
| 836 |
+
.css( 'height', '100%' );
|
| 837 |
+
|
| 838 |
var slide = $('<div class="jp-carousel-slide"></div>')
|
| 839 |
.hide()
|
| 840 |
.css({
|
| 841 |
//'position' : 'fixed',
|
| 842 |
'left' : i < start_index ? -1000 : gallery.width()
|
| 843 |
})
|
| 844 |
+
.append( image )
|
| 845 |
.appendTo(gallery)
|
| 846 |
.data('src', src )
|
| 847 |
.data('title', title)
|
| 855 |
.data('medium-file', medium_file)
|
| 856 |
.data('large-file', large_file)
|
| 857 |
.data('orig-file', orig_file)
|
| 858 |
+
.data('thumb-size', thumb_size)
|
| 859 |
+
;
|
| 860 |
+
|
| 861 |
+
if ( useInPageThumbnails ) {
|
| 862 |
+
// Use the image already loaded in the gallery as a preview.
|
| 863 |
+
slide
|
| 864 |
+
.data( 'preview-image', src_item.attr( 'src' ) )
|
| 865 |
+
.css( {
|
| 866 |
+
'background-image' : 'url("' + src_item.attr( 'src' ) + '")',
|
| 867 |
+
'background-size' : '100% 100%',
|
| 868 |
+
'background-position' : 'center center'
|
| 869 |
+
} );
|
| 870 |
+
}
|
| 871 |
|
| 872 |
+
slide.jp_carousel( 'fitSlide', false );
|
|
|
|
| 873 |
}
|
| 874 |
});
|
| 875 |
return this;
|
| 888 |
if ( 'undefined' == typeof args.medium_file || 'undefined' == typeof args.large_file )
|
| 889 |
return args.orig_file;
|
| 890 |
|
| 891 |
+
var medium_size = args.medium_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
|
| 892 |
medium_size_parts = (medium_size != args.medium_file) ? medium_size.split('x') : [args.orig_width, 0],
|
| 893 |
medium_width = parseInt( medium_size_parts[0], 10 ),
|
| 894 |
medium_height = parseInt( medium_size_parts[1], 10 ),
|
| 895 |
+
large_size = args.large_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
|
| 896 |
large_size_parts = (large_size != args.large_file) ? large_size.split('x') : [args.orig_width, 0],
|
| 897 |
large_width = parseInt( large_size_parts[0], 10 ),
|
| 898 |
large_height = parseInt( large_size_parts[1], 10 );
|
| 934 |
if (d >= 1)
|
| 935 |
return Math.round(d) + 's';
|
| 936 |
var df = 1, top = 1, bot = 1;
|
| 937 |
+
var limit = 1e3;
|
| 938 |
while (df != d && limit-- > 0) {
|
| 939 |
if (df < d) {
|
| 940 |
top += 1;
|
| 997 |
desc = gallery.jp_carousel('parseTitleDesc', data.desc) || '';
|
| 998 |
|
| 999 |
if ( title.length || desc.length ) {
|
| 1000 |
+
// $('<div />').text(sometext).html() is a trick to go to HTML to plain text (including HTML entities decode, etc)
|
| 1001 |
+
if ( $('<div />').text(title).html() == $('<div />').text(desc).html() )
|
| 1002 |
title = '';
|
| 1003 |
|
| 1004 |
markup = ( title.length ) ? '<div class="jp-carousel-titleanddesc-title">' + title + '</div>' : '';
|
| 1011 |
$( 'div#jp-carousel-comments-loading' ).css('margin-top', '20px');
|
| 1012 |
},
|
| 1013 |
|
| 1014 |
+
updateLikesWidgetVisibility: function ( attachmentId ) {
|
| 1015 |
+
// Only do this if likes is enabled
|
| 1016 |
+
if ( "undefined" === typeof jetpackLikesWidgetQueue )
|
| 1017 |
+
return;
|
| 1018 |
+
|
| 1019 |
+
// Hide all likes widgets except for the one for the attachmentId passed in
|
| 1020 |
+
$( '.jp-carousel-buttons .jetpack-likes-widget-wrapper' ).css( 'display', 'none' ).each( function () {
|
| 1021 |
+
var widgetWrapper = $( this );
|
| 1022 |
+
if ( widgetWrapper.attr( 'data-attachment-id' ) == attachmentId ) {
|
| 1023 |
+
widgetWrapper.css( 'display', 'inline-block' );
|
| 1024 |
+
return false;
|
| 1025 |
+
}
|
| 1026 |
+
});
|
| 1027 |
+
},
|
| 1028 |
+
|
| 1029 |
+
loadLikes : function ( attachmentId ) {
|
| 1030 |
+
var dataCarouselExtra = $( '.jp-carousel-wrap' ).data( 'carousel-extra' );
|
| 1031 |
+
var blogId = dataCarouselExtra.likes_blog_id;
|
| 1032 |
+
|
| 1033 |
+
if ( $( "#like-post-wrapper-" + blogId + "-" + attachmentId ).length == 0 ) {
|
| 1034 |
+
// Add the iframe the first time the slide is shown.
|
| 1035 |
+
var protocol = 'http';
|
| 1036 |
+
var originDomain = 'http://wordpress.com';
|
| 1037 |
+
|
| 1038 |
+
if ( dataCarouselExtra.permalink.length ) {
|
| 1039 |
+
var protocol = dataCarouselExtra.permalink.split( ':' )[0];
|
| 1040 |
+
|
| 1041 |
+
if ( ( protocol != 'http' ) && ( protocol != 'https' ) )
|
| 1042 |
+
protocol = 'http';
|
| 1043 |
+
|
| 1044 |
+
var parts = dataCarouselExtra.permalink.split( '/' );
|
| 1045 |
+
|
| 1046 |
+
if ( parts.length >= 2 )
|
| 1047 |
+
originDomain = protocol + "://" + parts[2];
|
| 1048 |
+
}
|
| 1049 |
+
|
| 1050 |
+
var dataSource = protocol + "://widgets.wp.com/likes/#blog_id=" + encodeURIComponent( blogId )
|
| 1051 |
+
+ "&post_id=" + encodeURIComponent( attachmentId )
|
| 1052 |
+
+ "&slim=1&origin=" + encodeURIComponent( originDomain );
|
| 1053 |
+
|
| 1054 |
+
if ( 'en' !== jetpackCarouselStrings.lang )
|
| 1055 |
+
dataSource += "&lang=" + encodeURIComponent( jetpackCarouselStrings.lang );
|
| 1056 |
+
|
| 1057 |
+
var likesWidget = $( "<iframe class='post-likes-widget jetpack-likes-widget jetpack-resizeable'></iframe>" )
|
| 1058 |
+
.attr( "name", "like-post-frame-" + blogId + "-" + attachmentId )
|
| 1059 |
+
.attr( 'src', dataSource )
|
| 1060 |
+
.css( "display", "inline-block" );
|
| 1061 |
+
|
| 1062 |
+
var likesWidgetWrapper = $( "<div/>" )
|
| 1063 |
+
.addClass( "jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded slim-likes-widget" )
|
| 1064 |
+
.attr( "id", "like-post-wrapper-" + blogId + "-" + attachmentId )
|
| 1065 |
+
.attr( "data-src", dataSource )
|
| 1066 |
+
.attr( "data-name", "like-post-frame-" + blogId + "-" + attachmentId )
|
| 1067 |
+
.attr( "data-attachment-id", attachmentId )
|
| 1068 |
+
.css( "display", "none" )
|
| 1069 |
+
.css( "vertical-align", "middle" )
|
| 1070 |
+
.append( likesWidget )
|
| 1071 |
+
.append( "<div class='post-likes-widget-placeholder'></div>" );
|
| 1072 |
+
|
| 1073 |
+
$( '.jp-carousel-buttons' ).append( likesWidgetWrapper );
|
| 1074 |
+
}
|
| 1075 |
+
|
| 1076 |
+
},
|
| 1077 |
+
|
| 1078 |
+
// updateExif updates the contents of the exif UL (.jp-carousel-image-exif)
|
| 1079 |
+
updateExif: function( meta ) {
|
| 1080 |
if ( !meta || 1 != jetpackCarouselStrings.display_exif )
|
| 1081 |
return false;
|
| 1082 |
|
| 1083 |
+
var $ul = $( "<ul class='jp-carousel-image-exif'></ul>" );
|
| 1084 |
+
|
| 1085 |
$.each( meta, function( key, val ) {
|
| 1086 |
if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, [ 'camera', 'aperture', 'shutter_speed', 'focal_length' ] ) )
|
| 1087 |
return;
|
| 1096 |
case 'aperture':
|
| 1097 |
val = 'f/' + val;
|
| 1098 |
break;
|
|
|
|
|
|
|
|
|
|
| 1099 |
}
|
| 1100 |
|
| 1101 |
$ul.append( '<li><h5>' + jetpackCarouselStrings[key] + '</h5>' + val + '</li>' );
|
| 1102 |
});
|
| 1103 |
|
| 1104 |
+
// Update (replace) the content of the ul
|
| 1105 |
+
$( 'div.jp-carousel-image-meta ul.jp-carousel-image-exif' ).replaceWith( $ul );
|
|
|
|
|
|
|
|
|
|
| 1106 |
},
|
| 1107 |
|
| 1108 |
+
// updateFullSizeLink updates the contents of the jp-carousel-image-download link
|
| 1109 |
+
updateFullSizeLink: function(current) {
|
| 1110 |
if(!current || !current.data)
|
| 1111 |
return false;
|
| 1112 |
var original = current.data('orig-file').replace(/\?.+$/, ''),
|
| 1116 |
.attr( 'href', original )
|
| 1117 |
.attr( 'target', '_blank' );
|
| 1118 |
|
| 1119 |
+
// Update (replace) the content of the anchor
|
| 1120 |
+
$( 'div.jp-carousel-image-meta a.jp-carousel-image-download' ).replaceWith( permalink );
|
| 1121 |
},
|
| 1122 |
|
| 1123 |
+
updateMap: function( meta ) {
|
| 1124 |
if ( !meta.latitude || !meta.longitude || 1 != jetpackCarouselStrings.display_geo )
|
| 1125 |
return;
|
| 1126 |
|
| 1161 |
},
|
| 1162 |
|
| 1163 |
getComments: function( args ) {
|
| 1164 |
+
clearInterval( commentInterval );
|
| 1165 |
+
|
| 1166 |
if ( 'object' != typeof args )
|
| 1167 |
+
return;
|
| 1168 |
|
| 1169 |
+
if ( 'undefined' == typeof args.attachment_id || ! args.attachment_id )
|
| 1170 |
return;
|
| 1171 |
|
| 1172 |
if ( ! args.offset || 'undefined' == typeof args.offset || args.offset < 1 )
|
| 1173 |
args.offset = 0;
|
| 1174 |
|
| 1175 |
var comments = $('.jp-carousel-comments'),
|
| 1176 |
+
commentsLoading = $('#jp-carousel-comments-loading').show();
|
| 1177 |
|
| 1178 |
+
if ( args.clear )
|
| 1179 |
+
comments.hide().empty();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1180 |
|
| 1181 |
$.ajax({
|
| 1182 |
type: 'GET',
|
| 1189 |
offset: args.offset
|
| 1190 |
},
|
| 1191 |
success: function(data, status, xhr) {
|
| 1192 |
+
if ( args.clear )
|
| 1193 |
+
comments.fadeOut('fast').empty();
|
|
|
|
|
|
|
| 1194 |
|
| 1195 |
$( data ).each(function(){
|
| 1196 |
var comment = $('<div></div>')
|
| 1197 |
.addClass('jp-carousel-comment')
|
| 1198 |
.attr('id', 'jp-carousel-comment-' + this['id'])
|
|
|
|
| 1199 |
.html(
|
| 1200 |
'<div class="comment-gravatar">'
|
| 1201 |
+ this['gravatar_markup']
|
| 1219 |
gallery.jp_carousel('getComments',{ attachment_id: args.attachment_id, offset: args.offset + 10, clear: false });
|
| 1220 |
clearInterval( commentInterval );
|
| 1221 |
}
|
| 1222 |
+
}, 300 );
|
| 1223 |
});
|
| 1224 |
|
| 1225 |
// Verify (late) that the user didn't repeatldy click the arrows really fast, in which case the requested
|
| 1269 |
var commentTextArea = $('#jp-carousel-comment-form-comment-field');
|
| 1270 |
if ( commentTextArea )
|
| 1271 |
commentTextArea.val('');
|
| 1272 |
+
},
|
| 1273 |
+
|
| 1274 |
+
nextSlide : function () {
|
| 1275 |
+
var slides = this.jp_carousel( 'slides' );
|
| 1276 |
+
var selected = this.jp_carousel( 'selectedSlide' );
|
| 1277 |
+
|
| 1278 |
+
if ( selected.length == 0 || ( slides.length > 2 && selected.is( slides.last() ) ) )
|
| 1279 |
+
return slides.first();
|
| 1280 |
+
|
| 1281 |
+
return selected.next();
|
| 1282 |
+
},
|
| 1283 |
+
|
| 1284 |
+
prevSlide : function () {
|
| 1285 |
+
var slides = this.jp_carousel( 'slides' );
|
| 1286 |
+
var selected = this.jp_carousel( 'selectedSlide' );
|
| 1287 |
+
|
| 1288 |
+
if ( selected.length == 0 || ( slides.length > 2 && selected.is( slides.first() ) ) )
|
| 1289 |
+
return slides.last();
|
| 1290 |
+
|
| 1291 |
+
return selected.prev();
|
| 1292 |
+
},
|
| 1293 |
+
|
| 1294 |
+
loadFullImage : function ( slide ) {
|
| 1295 |
+
var image = slide.find( 'img:first' );
|
| 1296 |
+
|
| 1297 |
+
if ( ! image.data( 'loaded' ) ) {
|
| 1298 |
+
// If the width of the slide is smaller than the width of the "thumbnail" we're already using,
|
| 1299 |
+
// don't load the full image.
|
| 1300 |
+
|
| 1301 |
+
image.on( 'load.jetpack', function () {
|
| 1302 |
+
image.off( 'load.jetpack' );
|
| 1303 |
+
$( this ).closest( '.jp-carousel-slide' ).css( 'background-image', '' );
|
| 1304 |
+
} );
|
| 1305 |
+
|
| 1306 |
+
if ( ! slide.data( 'preview-image' ) || ( slide.data( 'thumb-size' ) && slide.width() > slide.data( 'thumb-size' ).width ) )
|
| 1307 |
+
image.attr( 'src', image.closest( '.jp-carousel-slide' ).data( 'src' ) );
|
| 1308 |
+
else
|
| 1309 |
+
image.attr( 'src', slide.data( 'preview-image' ) );
|
| 1310 |
+
|
| 1311 |
+
image.data( 'loaded', 1 );
|
| 1312 |
+
}
|
| 1313 |
}
|
| 1314 |
};
|
| 1315 |
|
| 1336 |
$(this).jp_carousel('open', {start_index: $(this).find('.gallery-item, .tiled-gallery-item').index($(e.target).parents('.gallery-item, .tiled-gallery-item'))});
|
| 1337 |
});
|
| 1338 |
|
|
|
|
| 1339 |
// Makes carousel work on page load and when back button leads to same URL with carousel hash (ie: no actual document.ready trigger)
|
| 1340 |
+
$( window ).on( 'hashchange', function () {
|
| 1341 |
+
if ( ! window.location.hash || ! window.location.hash.match(/jp-carousel-(\d+)/) )
|
| 1342 |
+
return;
|
|
|
|
|
|
|
| 1343 |
|
| 1344 |
+
if ( window.location.hash == last_known_location_hash )
|
| 1345 |
+
return;
|
| 1346 |
|
| 1347 |
+
last_known_location_hash = window.location.hash;
|
|
|
|
| 1348 |
|
| 1349 |
+
var gallery = $('div.gallery, div.tiled-gallery'), index = -1, n = window.location.hash.match(/jp-carousel-(\d+)/);
|
| 1350 |
|
| 1351 |
+
if ( ! $(this).jp_carousel( 'testForData', gallery ) )
|
| 1352 |
+
return;
|
| 1353 |
+
|
| 1354 |
+
n = parseInt(n[1], 10);
|
| 1355 |
+
|
| 1356 |
+
gallery.find('img').each(function(num, el){
|
| 1357 |
+
if ( n && $(el).data('attachment-id') == n ) { // n cannot be 0 (zero)
|
| 1358 |
+
index = num;
|
| 1359 |
+
return false;
|
| 1360 |
+
}
|
| 1361 |
+
});
|
| 1362 |
|
| 1363 |
+
if ( index != -1 )
|
| 1364 |
+
gallery.jp_carousel('open', {start_index: index}); // open method checks if already opened
|
|
|
|
| 1365 |
});
|
| 1366 |
+
|
| 1367 |
+
if ( window.location.hash )
|
| 1368 |
+
$( window ).trigger( 'hashchange' );
|
| 1369 |
});
|
| 1370 |
|
| 1371 |
+
/**
|
| 1372 |
+
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
|
| 1373 |
+
* Common usage: wipe images (left and right to show the previous or next image)
|
| 1374 |
+
*
|
| 1375 |
+
* @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
|
| 1376 |
+
* Version 1.1.1, modified to pass the touchmove event to the callbacks.
|
| 1377 |
+
*/
|
| 1378 |
+
(function($) {
|
| 1379 |
+
$.fn.touchwipe = function(settings) {
|
| 1380 |
+
var config = {
|
| 1381 |
+
min_move_x: 20,
|
| 1382 |
+
min_move_y: 20,
|
| 1383 |
+
wipeLeft: function(e) { },
|
| 1384 |
+
wipeRight: function(e) { },
|
| 1385 |
+
wipeUp: function(e) { },
|
| 1386 |
+
wipeDown: function(e) { },
|
| 1387 |
+
preventDefaultEvents: true
|
| 1388 |
+
};
|
| 1389 |
+
|
| 1390 |
+
if (settings) $.extend(config, settings);
|
| 1391 |
+
|
| 1392 |
+
this.each(function() {
|
| 1393 |
+
var startX;
|
| 1394 |
+
var startY;
|
| 1395 |
+
var isMoving = false;
|
| 1396 |
+
|
| 1397 |
+
function cancelTouch() {
|
| 1398 |
+
this.removeEventListener('touchmove', onTouchMove);
|
| 1399 |
+
startX = null;
|
| 1400 |
+
isMoving = false;
|
| 1401 |
+
}
|
| 1402 |
+
|
| 1403 |
+
function onTouchMove(e) {
|
| 1404 |
+
if(config.preventDefaultEvents) {
|
| 1405 |
+
e.preventDefault();
|
| 1406 |
+
}
|
| 1407 |
+
if(isMoving) {
|
| 1408 |
+
var x = e.touches[0].pageX;
|
| 1409 |
+
var y = e.touches[0].pageY;
|
| 1410 |
+
var dx = startX - x;
|
| 1411 |
+
var dy = startY - y;
|
| 1412 |
+
if(Math.abs(dx) >= config.min_move_x) {
|
| 1413 |
+
cancelTouch();
|
| 1414 |
+
if(dx > 0) {
|
| 1415 |
+
config.wipeLeft(e);
|
| 1416 |
+
}
|
| 1417 |
+
else {
|
| 1418 |
+
config.wipeRight(e);
|
| 1419 |
+
}
|
| 1420 |
+
}
|
| 1421 |
+
else if(Math.abs(dy) >= config.min_move_y) {
|
| 1422 |
+
cancelTouch();
|
| 1423 |
+
if(dy > 0) {
|
| 1424 |
+
config.wipeDown(e);
|
| 1425 |
+
}
|
| 1426 |
+
else {
|
| 1427 |
+
config.wipeUp(e);
|
| 1428 |
+
}
|
| 1429 |
+
}
|
| 1430 |
+
}
|
| 1431 |
+
}
|
| 1432 |
+
|
| 1433 |
+
function onTouchStart(e)
|
| 1434 |
+
{
|
| 1435 |
+
if (e.touches.length == 1) {
|
| 1436 |
+
startX = e.touches[0].pageX;
|
| 1437 |
+
startY = e.touches[0].pageY;
|
| 1438 |
+
isMoving = true;
|
| 1439 |
+
this.addEventListener('touchmove', onTouchMove, false);
|
| 1440 |
+
}
|
| 1441 |
+
}
|
| 1442 |
+
if ('ontouchstart' in document.documentElement) {
|
| 1443 |
+
this.addEventListener('touchstart', onTouchStart, false);
|
| 1444 |
+
}
|
| 1445 |
+
});
|
| 1446 |
+
|
| 1447 |
+
return this;
|
| 1448 |
+
};
|
| 1449 |
+
})(jQuery);
|
jetpack-carousel.php → carousel/jetpack-carousel.php
RENAMED
|
@@ -1,22 +1,4 @@
|
|
| 1 |
<?php
|
| 2 |
-
/*
|
| 3 |
-
Plugin Name: Gallery Carousel Without JetPack
|
| 4 |
-
Plugin URI: http://www.wpbeginner.com/
|
| 5 |
-
Description: Transform your standard galleries into an immersive full-screen experience without requiring you to connect to WordPress.com
|
| 6 |
-
Version: 0.6
|
| 7 |
-
Author: Syed Balkhi
|
| 8 |
-
Author URI: http://www.wpbeginner.com
|
| 9 |
-
License: GPLv2 or later
|
| 10 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
Note: This is a fork of Carousel Module from JetPack. I just wanted the Carousel to work
|
| 14 |
-
without logging into WordPress.com because I shouldn't be forced to (that's evil). So I'm releasing
|
| 15 |
-
this little plugin which is exactly the copy of JetPack module. I will update this plugin everytime that JetPack updates.
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
load_plugin_textdomain('carousel', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
| 19 |
-
|
| 20 |
class No_Jetpack_Carousel {
|
| 21 |
|
| 22 |
var $prebuilt_widths = array( 370, 700, 1000, 1200, 1400, 2000 );
|
|
@@ -56,7 +38,7 @@ class No_Jetpack_Carousel {
|
|
| 56 |
$this->prebuilt_widths = apply_filters( 'jp_carousel_widths', $this->prebuilt_widths );
|
| 57 |
add_filter( 'post_gallery', array( $this, 'enqueue_assets' ), 1000, 2 ); // load later than other callbacks hooked it
|
| 58 |
add_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
|
| 59 |
-
add_filter( '
|
| 60 |
}
|
| 61 |
|
| 62 |
if ( $this->in_jetpack && method_exists( 'Jetpack', 'module_configuration_load' ) ) {
|
|
@@ -82,26 +64,25 @@ class No_Jetpack_Carousel {
|
|
| 82 |
if ( ! empty( $output ) && ! apply_filters( 'jp_carousel_force_enable', false ) ) {
|
| 83 |
// Bail because someone is overriding the [gallery] shortcode.
|
| 84 |
remove_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
|
| 85 |
-
remove_filter( '
|
| 86 |
return $output;
|
| 87 |
}
|
| 88 |
|
| 89 |
do_action( 'jp_carousel_thumbnails_shown' );
|
| 90 |
|
| 91 |
if ( $this->first_run ) {
|
| 92 |
-
|
| 93 |
-
wp_register_script( 'spin', plugins_url( 'spin.js', __FILE__ ), false, '1.2.4' );
|
| 94 |
-
wp_register_script( 'jquery.spin', plugins_url( 'jquery.spin.js', __FILE__ ) , array( 'jquery', 'spin' ) );
|
| 95 |
-
|
| 96 |
-
wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20130109' ), true );
|
| 97 |
|
| 98 |
// Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted)
|
| 99 |
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
|
| 100 |
$is_logged_in = is_user_logged_in();
|
| 101 |
$current_user = wp_get_current_user();
|
|
|
|
|
|
|
| 102 |
$localize_strings = array(
|
| 103 |
'widths' => $this->prebuilt_widths,
|
| 104 |
'is_logged_in' => $is_logged_in,
|
|
|
|
| 105 |
'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ),
|
| 106 |
'nonce' => wp_create_nonce( 'carousel_nonce' ),
|
| 107 |
'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
|
|
@@ -109,6 +90,7 @@ class No_Jetpack_Carousel {
|
|
| 109 |
'background_color' => $this->carousel_background_color_sanitize( get_option( 'carousel_background_color' ) ),
|
| 110 |
'comment' => __( 'Comment', 'carousel' ),
|
| 111 |
'post_comment' => __( 'Post Comment', 'carousel' ),
|
|
|
|
| 112 |
'loading_comments' => __( 'Loading Comments...', 'carousel' ),
|
| 113 |
'download_original' => sprintf( __( 'View full size <span class="photo-size">%1$s<span class="photo-size-times">×</span>%2$s</span>', 'carousel' ), '{0}', '{1}' ),
|
| 114 |
'no_comment_text' => __( 'Please be sure to submit some text with your comment.', 'carousel' ),
|
|
@@ -121,6 +103,9 @@ class No_Jetpack_Carousel {
|
|
| 121 |
'aperture' => __( 'Aperture', 'carousel' ),
|
| 122 |
'shutter_speed' => __( 'Shutter Speed', 'carousel' ),
|
| 123 |
'focal_length' => __( 'Focal Length', 'carousel' ),
|
|
|
|
|
|
|
|
|
|
| 124 |
);
|
| 125 |
|
| 126 |
if ( ! isset( $localize_strings['jetpack_comments_iframe_src'] ) || empty( $localize_strings['jetpack_comments_iframe_src'] ) ) {
|
|
@@ -129,13 +114,18 @@ class No_Jetpack_Carousel {
|
|
| 129 |
if ( $is_logged_in ) {
|
| 130 |
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf( __( 'Commenting as %s', 'carousel' ), $current_user->data->display_name ) . '</p>';
|
| 131 |
} else {
|
| 132 |
-
$
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
}
|
| 140 |
}
|
| 141 |
|
|
@@ -158,11 +148,12 @@ class No_Jetpack_Carousel {
|
|
| 158 |
return $output;
|
| 159 |
}
|
| 160 |
|
| 161 |
-
function add_data_to_images( $
|
|
|
|
| 162 |
if ( $this->first_run ) // not in a gallery
|
| 163 |
-
return $
|
| 164 |
|
| 165 |
-
$attachment_id = intval( $
|
| 166 |
$orig_file = wp_get_attachment_image_src( $attachment_id, 'full' );
|
| 167 |
$orig_file = isset( $orig_file[0] ) ? $orig_file[0] : wp_get_attachment_url( $attachment_id );
|
| 168 |
$meta = wp_get_attachment_metadata( $attachment_id );
|
|
@@ -170,7 +161,7 @@ class No_Jetpack_Carousel {
|
|
| 170 |
$img_meta = ( ! empty( $meta['image_meta'] ) ) ? (array) $meta['image_meta'] : array();
|
| 171 |
$comments_opened = intval( comments_open( $attachment_id ) );
|
| 172 |
|
| 173 |
-
|
| 174 |
* Note: Cannot generate a filename from the width and height wp_get_attachment_image_src() returns because
|
| 175 |
* it takes the $content_width global variable themes can set in consideration, therefore returning sizes
|
| 176 |
* which when used to generate a filename will likely result in a 404 on the image.
|
|
@@ -205,26 +196,17 @@ class No_Jetpack_Carousel {
|
|
| 205 |
|
| 206 |
$img_meta = json_encode( array_map( 'strval', $img_meta ) );
|
| 207 |
|
| 208 |
-
$
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
esc_attr( $medium_file ),
|
| 220 |
-
esc_attr( $large_file )
|
| 221 |
-
),
|
| 222 |
-
$html
|
| 223 |
-
);
|
| 224 |
-
|
| 225 |
-
$html = apply_filters( 'jp_carousel_add_data_to_images', $html, $attachment_id );
|
| 226 |
-
|
| 227 |
-
return $html;
|
| 228 |
}
|
| 229 |
|
| 230 |
function add_data_to_container( $html ) {
|
|
@@ -232,7 +214,20 @@ class No_Jetpack_Carousel {
|
|
| 232 |
|
| 233 |
if ( isset( $post ) ) {
|
| 234 |
$blog_id = (int) get_current_blog_id();
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
|
| 237 |
$extra_data = apply_filters( 'jp_carousel_add_data_to_container', $extra_data );
|
| 238 |
foreach ( (array) $extra_data as $data_key => $data_values ) {
|
|
@@ -272,11 +267,10 @@ class No_Jetpack_Carousel {
|
|
| 272 |
|
| 273 |
// Can't just send the results, they contain the commenter's email address.
|
| 274 |
foreach ( $comments as $comment ) {
|
| 275 |
-
$author_markup = '<a href="' . esc_url( $comment->comment_author_url ) . '">' . esc_html( $comment->comment_author ) . '</a>';
|
| 276 |
$out[] = array(
|
| 277 |
'id' => $comment->comment_ID,
|
| 278 |
'parent_id' => $comment->comment_parent,
|
| 279 |
-
'author_markup' => $
|
| 280 |
'gravatar_markup' => get_avatar( $comment->comment_author_email, 64 ),
|
| 281 |
'date_gmt' => $comment->comment_date_gmt,
|
| 282 |
'content' => wpautop($comment->comment_content),
|
|
@@ -333,23 +327,26 @@ class No_Jetpack_Carousel {
|
|
| 333 |
$email = $_POST['email'];
|
| 334 |
$url = $_POST['url'];
|
| 335 |
|
| 336 |
-
if (
|
| 337 |
-
|
|
|
|
| 338 |
|
| 339 |
-
|
| 340 |
-
|
| 341 |
|
| 342 |
-
|
| 343 |
-
|
|
|
|
| 344 |
}
|
| 345 |
|
| 346 |
$comment_data = array(
|
| 347 |
-
'comment_content'
|
| 348 |
-
'comment_post_ID'
|
| 349 |
-
'comment_author'
|
| 350 |
'comment_author_email' => $email,
|
| 351 |
-
'comment_author_url'
|
| 352 |
-
'comment_approved'
|
|
|
|
| 353 |
);
|
| 354 |
|
| 355 |
if ( ! empty( $user_id ) )
|
|
@@ -377,7 +374,7 @@ class No_Jetpack_Carousel {
|
|
| 377 |
add_settings_field('carousel_background_color', __( 'Background color', 'carousel' ), array( $this, 'carousel_background_color_callback' ), 'media', 'carousel_section' );
|
| 378 |
register_setting( 'media', 'carousel_background_color', array( $this, 'carousel_background_color_sanitize' ) );
|
| 379 |
|
| 380 |
-
add_settings_field('carousel_display_exif', __( 'Metadata', '
|
| 381 |
register_setting( 'media', 'carousel_display_exif', array( $this, 'carousel_display_exif_sanitize' ) );
|
| 382 |
|
| 383 |
// No geo setting yet, need to "fuzzify" data first, for privacy
|
|
@@ -450,7 +447,7 @@ class No_Jetpack_Carousel {
|
|
| 450 |
}
|
| 451 |
|
| 452 |
function carousel_background_color_callback() {
|
| 453 |
-
$this->settings_select( 'carousel_background_color', array( 'black' => __( 'Black', 'carousel' ), 'white' => __( 'White', '
|
| 454 |
}
|
| 455 |
|
| 456 |
function carousel_background_color_sanitize( $value ) {
|
|
@@ -466,5 +463,4 @@ class No_Jetpack_Carousel {
|
|
| 466 |
}
|
| 467 |
}
|
| 468 |
|
| 469 |
-
|
| 470 |
new No_Jetpack_Carousel;
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
class No_Jetpack_Carousel {
|
| 3 |
|
| 4 |
var $prebuilt_widths = array( 370, 700, 1000, 1200, 1400, 2000 );
|
| 38 |
$this->prebuilt_widths = apply_filters( 'jp_carousel_widths', $this->prebuilt_widths );
|
| 39 |
add_filter( 'post_gallery', array( $this, 'enqueue_assets' ), 1000, 2 ); // load later than other callbacks hooked it
|
| 40 |
add_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
|
| 41 |
+
add_filter( 'wp_get_attachment_image_attributes', array( $this, 'add_data_to_images' ), 10, 2 );
|
| 42 |
}
|
| 43 |
|
| 44 |
if ( $this->in_jetpack && method_exists( 'Jetpack', 'module_configuration_load' ) ) {
|
| 64 |
if ( ! empty( $output ) && ! apply_filters( 'jp_carousel_force_enable', false ) ) {
|
| 65 |
// Bail because someone is overriding the [gallery] shortcode.
|
| 66 |
remove_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
|
| 67 |
+
remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'add_data_to_images' ) );
|
| 68 |
return $output;
|
| 69 |
}
|
| 70 |
|
| 71 |
do_action( 'jp_carousel_thumbnails_shown' );
|
| 72 |
|
| 73 |
if ( $this->first_run ) {
|
| 74 |
+
wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20131218' ), true );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
// Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted)
|
| 77 |
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
|
| 78 |
$is_logged_in = is_user_logged_in();
|
| 79 |
$current_user = wp_get_current_user();
|
| 80 |
+
$comment_registration = intval( get_option( 'comment_registration' ) );
|
| 81 |
+
$require_name_email = intval( get_option( 'require_name_email' ) );
|
| 82 |
$localize_strings = array(
|
| 83 |
'widths' => $this->prebuilt_widths,
|
| 84 |
'is_logged_in' => $is_logged_in,
|
| 85 |
+
'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
|
| 86 |
'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ),
|
| 87 |
'nonce' => wp_create_nonce( 'carousel_nonce' ),
|
| 88 |
'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
|
| 90 |
'background_color' => $this->carousel_background_color_sanitize( get_option( 'carousel_background_color' ) ),
|
| 91 |
'comment' => __( 'Comment', 'carousel' ),
|
| 92 |
'post_comment' => __( 'Post Comment', 'carousel' ),
|
| 93 |
+
'write_comment' => __( 'Write a Comment...', 'carousel' ),
|
| 94 |
'loading_comments' => __( 'Loading Comments...', 'carousel' ),
|
| 95 |
'download_original' => sprintf( __( 'View full size <span class="photo-size">%1$s<span class="photo-size-times">×</span>%2$s</span>', 'carousel' ), '{0}', '{1}' ),
|
| 96 |
'no_comment_text' => __( 'Please be sure to submit some text with your comment.', 'carousel' ),
|
| 103 |
'aperture' => __( 'Aperture', 'carousel' ),
|
| 104 |
'shutter_speed' => __( 'Shutter Speed', 'carousel' ),
|
| 105 |
'focal_length' => __( 'Focal Length', 'carousel' ),
|
| 106 |
+
'comment_registration' => $comment_registration,
|
| 107 |
+
'require_name_email' => $require_name_email,
|
| 108 |
+
'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ),
|
| 109 |
);
|
| 110 |
|
| 111 |
if ( ! isset( $localize_strings['jetpack_comments_iframe_src'] ) || empty( $localize_strings['jetpack_comments_iframe_src'] ) ) {
|
| 114 |
if ( $is_logged_in ) {
|
| 115 |
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf( __( 'Commenting as %s', 'carousel' ), $current_user->data->display_name ) . '</p>';
|
| 116 |
} else {
|
| 117 |
+
if ( $comment_registration ) {
|
| 118 |
+
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . __( 'You must be <a href="#" class="jp-carousel-comment-login">logged in</a> to post a comment.', 'carousel' ) . '</p>';
|
| 119 |
+
} else {
|
| 120 |
+
$required = ( $require_name_email ) ? __( '%s (Required)', 'carousel' ) : '%s';
|
| 121 |
+
$localize_strings['local_comments_commenting_as'] = ''
|
| 122 |
+
. '<fieldset><label for="email">' . sprintf( $required, __( 'Email', 'carousel' ) ) . '</label> '
|
| 123 |
+
. '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>'
|
| 124 |
+
. '<fieldset><label for="author">' . sprintf( $required, __( 'Name', 'carousel' ) ) . '</label> '
|
| 125 |
+
. '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>'
|
| 126 |
+
. '<fieldset><label for="url">' . __( 'Website', 'carousel' ) . '</label> '
|
| 127 |
+
. '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
|
| 128 |
+
}
|
| 129 |
}
|
| 130 |
}
|
| 131 |
|
| 148 |
return $output;
|
| 149 |
}
|
| 150 |
|
| 151 |
+
function add_data_to_images( $attr, $attachment = null ) {
|
| 152 |
+
|
| 153 |
if ( $this->first_run ) // not in a gallery
|
| 154 |
+
return $attr;
|
| 155 |
|
| 156 |
+
$attachment_id = intval( $attachment->ID );
|
| 157 |
$orig_file = wp_get_attachment_image_src( $attachment_id, 'full' );
|
| 158 |
$orig_file = isset( $orig_file[0] ) ? $orig_file[0] : wp_get_attachment_url( $attachment_id );
|
| 159 |
$meta = wp_get_attachment_metadata( $attachment_id );
|
| 161 |
$img_meta = ( ! empty( $meta['image_meta'] ) ) ? (array) $meta['image_meta'] : array();
|
| 162 |
$comments_opened = intval( comments_open( $attachment_id ) );
|
| 163 |
|
| 164 |
+
/*
|
| 165 |
* Note: Cannot generate a filename from the width and height wp_get_attachment_image_src() returns because
|
| 166 |
* it takes the $content_width global variable themes can set in consideration, therefore returning sizes
|
| 167 |
* which when used to generate a filename will likely result in a 404 on the image.
|
| 196 |
|
| 197 |
$img_meta = json_encode( array_map( 'strval', $img_meta ) );
|
| 198 |
|
| 199 |
+
$attr['data-attachment-id'] = $attachment_id;
|
| 200 |
+
$attr['data-orig-file'] = esc_attr( $orig_file );
|
| 201 |
+
$attr['data-orig-size'] = $size;
|
| 202 |
+
$attr['data-comments-opened'] = $comments_opened;
|
| 203 |
+
$attr['data-image-meta'] = esc_attr( $img_meta );
|
| 204 |
+
$attr['data-image-title'] = esc_attr( $attachment_title );
|
| 205 |
+
$attr['data-image-description'] = esc_attr( $attachment_desc );
|
| 206 |
+
$attr['data-medium-file'] = esc_attr( $medium_file );
|
| 207 |
+
$attr['data-large-file'] = esc_attr( $large_file );
|
| 208 |
+
|
| 209 |
+
return $attr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
}
|
| 211 |
|
| 212 |
function add_data_to_container( $html ) {
|
| 214 |
|
| 215 |
if ( isset( $post ) ) {
|
| 216 |
$blog_id = (int) get_current_blog_id();
|
| 217 |
+
|
| 218 |
+
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
| 219 |
+
$likes_blog_id = $blog_id;
|
| 220 |
+
} else {
|
| 221 |
+
$likes_blog_id = Jetpack_Options::get_option( 'id' );
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
$extra_data = array(
|
| 225 |
+
'data-carousel-extra' => array(
|
| 226 |
+
'blog_id' => $blog_id,
|
| 227 |
+
'permalink' => get_permalink( $post->ID ),
|
| 228 |
+
'likes_blog_id' => $likes_blog_id
|
| 229 |
+
)
|
| 230 |
+
);
|
| 231 |
|
| 232 |
$extra_data = apply_filters( 'jp_carousel_add_data_to_container', $extra_data );
|
| 233 |
foreach ( (array) $extra_data as $data_key => $data_values ) {
|
| 267 |
|
| 268 |
// Can't just send the results, they contain the commenter's email address.
|
| 269 |
foreach ( $comments as $comment ) {
|
|
|
|
| 270 |
$out[] = array(
|
| 271 |
'id' => $comment->comment_ID,
|
| 272 |
'parent_id' => $comment->comment_parent,
|
| 273 |
+
'author_markup' => get_comment_author_link( $comment->comment_ID ),
|
| 274 |
'gravatar_markup' => get_avatar( $comment->comment_author_email, 64 ),
|
| 275 |
'date_gmt' => $comment->comment_date_gmt,
|
| 276 |
'content' => wpautop($comment->comment_content),
|
| 327 |
$email = $_POST['email'];
|
| 328 |
$url = $_POST['url'];
|
| 329 |
|
| 330 |
+
if ( get_option( 'require_name_email' ) ) {
|
| 331 |
+
if ( empty( $display_name ) )
|
| 332 |
+
die( json_encode( array( 'error' => __( 'Please provide your name.', 'carousel' ) ) ) );
|
| 333 |
|
| 334 |
+
if ( empty( $email ) )
|
| 335 |
+
die( json_encode( array( 'error' => __( 'Please provide an email address.', 'carousel' ) ) ) );
|
| 336 |
|
| 337 |
+
if ( ! is_email( $email ) )
|
| 338 |
+
die( json_encode( array( 'error' => __( 'Please provide a valid email address.', 'carousel' ) ) ) );
|
| 339 |
+
}
|
| 340 |
}
|
| 341 |
|
| 342 |
$comment_data = array(
|
| 343 |
+
'comment_content' => $comment,
|
| 344 |
+
'comment_post_ID' => $_post_id,
|
| 345 |
+
'comment_author' => $display_name,
|
| 346 |
'comment_author_email' => $email,
|
| 347 |
+
'comment_author_url' => $url,
|
| 348 |
+
'comment_approved' => 0,
|
| 349 |
+
'comment_type' => '',
|
| 350 |
);
|
| 351 |
|
| 352 |
if ( ! empty( $user_id ) )
|
| 374 |
add_settings_field('carousel_background_color', __( 'Background color', 'carousel' ), array( $this, 'carousel_background_color_callback' ), 'media', 'carousel_section' );
|
| 375 |
register_setting( 'media', 'carousel_background_color', array( $this, 'carousel_background_color_sanitize' ) );
|
| 376 |
|
| 377 |
+
add_settings_field('carousel_display_exif', __( 'Metadata', 'jetpack'), array( $this, 'carousel_display_exif_callback' ), 'media', 'carousel_section' );
|
| 378 |
register_setting( 'media', 'carousel_display_exif', array( $this, 'carousel_display_exif_sanitize' ) );
|
| 379 |
|
| 380 |
// No geo setting yet, need to "fuzzify" data first, for privacy
|
| 447 |
}
|
| 448 |
|
| 449 |
function carousel_background_color_callback() {
|
| 450 |
+
$this->settings_select( 'carousel_background_color', array( 'black' => __( 'Black', 'carousel' ), 'white' => __( 'White', 'jetpack', 'carousel' ) ) );
|
| 451 |
}
|
| 452 |
|
| 453 |
function carousel_background_color_sanitize( $value ) {
|
| 463 |
}
|
| 464 |
}
|
| 465 |
|
|
|
|
| 466 |
new No_Jetpack_Carousel;
|
carousel/jquery.spin.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Copyright (c) 2011-2013 Felix Gnass
|
| 3 |
+
* Licensed under the MIT license
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
/*
|
| 7 |
+
|
| 8 |
+
Basic Usage:
|
| 9 |
+
============
|
| 10 |
+
|
| 11 |
+
$('#el').spin(); // Creates a default Spinner using the text color of #el.
|
| 12 |
+
$('#el').spin({ ... }); // Creates a Spinner using the provided options.
|
| 13 |
+
|
| 14 |
+
$('#el').spin(false); // Stops and removes the spinner.
|
| 15 |
+
|
| 16 |
+
Using Presets:
|
| 17 |
+
==============
|
| 18 |
+
|
| 19 |
+
$('#el').spin('small'); // Creates a 'small' Spinner using the text color of #el.
|
| 20 |
+
$('#el').spin('large', '#fff'); // Creates a 'large' white Spinner.
|
| 21 |
+
|
| 22 |
+
Adding a custom preset:
|
| 23 |
+
=======================
|
| 24 |
+
|
| 25 |
+
$.fn.spin.presets.flower = {
|
| 26 |
+
lines: 9
|
| 27 |
+
length: 10
|
| 28 |
+
width: 20
|
| 29 |
+
radius: 0
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
$('#el').spin('flower', 'red');
|
| 33 |
+
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
(function(factory) {
|
| 37 |
+
|
| 38 |
+
if (typeof exports == 'object') {
|
| 39 |
+
// CommonJS
|
| 40 |
+
factory(require('jquery'), require('spin'))
|
| 41 |
+
}
|
| 42 |
+
else if (typeof define == 'function' && define.amd) {
|
| 43 |
+
// AMD, register as anonymous module
|
| 44 |
+
define(['jquery', 'spin'], factory)
|
| 45 |
+
}
|
| 46 |
+
else {
|
| 47 |
+
// Browser globals
|
| 48 |
+
if (!window.Spinner) throw new Error('Spin.js not present')
|
| 49 |
+
factory(window.jQuery, window.Spinner)
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
}(function($, Spinner) {
|
| 53 |
+
|
| 54 |
+
$.fn.spin = function(opts, color) {
|
| 55 |
+
|
| 56 |
+
return this.each(function() {
|
| 57 |
+
var $this = $(this),
|
| 58 |
+
data = $this.data();
|
| 59 |
+
|
| 60 |
+
if (data.spinner) {
|
| 61 |
+
data.spinner.stop();
|
| 62 |
+
delete data.spinner;
|
| 63 |
+
}
|
| 64 |
+
if (opts !== false) {
|
| 65 |
+
opts = $.extend(
|
| 66 |
+
{ color: color || $this.css('color') },
|
| 67 |
+
$.fn.spin.presets[opts] || opts
|
| 68 |
+
)
|
| 69 |
+
// Begin WordPress Additions
|
| 70 |
+
// To use opts.right, you need to have specified a length, width, and radius.
|
| 71 |
+
if ( typeof opts.right !== 'undefined' && typeof opts.length !== 'undefined'
|
| 72 |
+
&& typeof opts.width !== 'undefined' && typeof opts.radius !== 'undefined' ) {
|
| 73 |
+
var pad = $this.css( 'padding-left' );
|
| 74 |
+
pad = ( typeof pad === 'undefined' ) ? 0 : parseInt( pad, 10 );
|
| 75 |
+
opts.left = $this.outerWidth() - ( 2 * ( opts.length + opts.width + opts.radius ) ) - pad - opts.right;
|
| 76 |
+
delete opts.right;
|
| 77 |
+
}
|
| 78 |
+
// End WordPress Additions
|
| 79 |
+
data.spinner = new Spinner(opts).spin(this)
|
| 80 |
+
}
|
| 81 |
+
})
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
$.fn.spin.presets = {
|
| 85 |
+
tiny: { lines: 8, length: 2, width: 2, radius: 3 },
|
| 86 |
+
small: { lines: 8, length: 4, width: 3, radius: 5 },
|
| 87 |
+
large: { lines: 10, length: 8, width: 4, radius: 8 }
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
}));
|
| 91 |
+
|
| 92 |
+
// Jetpack Presets Overrides:
|
| 93 |
+
(function($){
|
| 94 |
+
$.fn.spin.presets.wp = { trail: 60, speed: 1.3 };
|
| 95 |
+
$.fn.spin.presets.small = $.extend( { lines: 8, length: 2, width: 2, radius: 3 }, $.fn.spin.presets.wp );
|
| 96 |
+
$.fn.spin.presets.medium = $.extend( { lines: 8, length: 4, width: 3, radius: 5 }, $.fn.spin.presets.wp );
|
| 97 |
+
$.fn.spin.presets.large = $.extend( { lines: 10, length: 6, width: 4, radius: 7 }, $.fn.spin.presets.wp );
|
| 98 |
+
$.fn.spin.presets['small-left'] = $.extend( { left: 5 }, $.fn.spin.presets.small );
|
| 99 |
+
$.fn.spin.presets['small-right'] = $.extend( { right: 5 }, $.fn.spin.presets.small );
|
| 100 |
+
$.fn.spin.presets['medium-left'] = $.extend( { left: 5 }, $.fn.spin.presets.medium );
|
| 101 |
+
$.fn.spin.presets['medium-right'] = $.extend( { right: 5 }, $.fn.spin.presets.medium );
|
| 102 |
+
$.fn.spin.presets['large-left'] = $.extend( { left: 5 }, $.fn.spin.presets.large );
|
| 103 |
+
$.fn.spin.presets['large-right'] = $.extend( { right: 5 }, $.fn.spin.presets.large );
|
| 104 |
+
})(jQuery);
|
{rtl → carousel/rtl}/jetpack-carousel-rtl.css
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
/* This file was automatically generated on
|
| 2 |
|
| 3 |
* {
|
| 4 |
line-height:inherit; /* prevent declarations of line-height in the universal selector */
|
|
@@ -50,7 +50,7 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 50 |
background: #68c9e8; /* Safari */
|
| 51 |
color: #fff;
|
| 52 |
}
|
| 53 |
-
|
| 54 |
.jp-carousel-info ::-moz-selection {
|
| 55 |
background: #68c9e8; /* Firefox */
|
| 56 |
color: #fff;
|
|
@@ -58,12 +58,15 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 58 |
|
| 59 |
.jp-carousel-photo-info {
|
| 60 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
-webkit-transition: 400ms ease-out;
|
| 62 |
-moz-transition: 400ms ease-out;
|
| 63 |
-o-transition: 400ms ease-out;
|
| 64 |
transition: 400ms ease-out;
|
| 65 |
-
right: 25%;
|
| 66 |
-
width: 50%;
|
| 67 |
}
|
| 68 |
|
| 69 |
.jp-carousel-info h2 {
|
|
@@ -98,6 +101,10 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 98 |
zoom: 1;
|
| 99 |
filter: alpha(opacity=20);
|
| 100 |
opacity: 0.2;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
-webkit-transition: 500ms opacity ease-out;
|
| 102 |
-moz-transition: 500ms opacity ease-out;
|
| 103 |
-o-transition: 500ms opacity ease-out;
|
|
@@ -135,13 +142,16 @@ div.jp-carousel-buttons a {
|
|
| 135 |
padding: 5px 0 5px 2px;
|
| 136 |
text-decoration: none !important;
|
| 137 |
text-shadow: none !important;
|
| 138 |
-
vertical-align:
|
| 139 |
-webkit-font-smoothing: subpixel-antialiased;
|
| 140 |
}
|
| 141 |
|
| 142 |
div.jp-carousel-buttons a:hover {
|
| 143 |
color: #68c9e8;
|
| 144 |
border: none !important;
|
|
|
|
|
|
|
|
|
|
| 145 |
-webkit-transition: none !important;
|
| 146 |
-moz-transition: none !important;
|
| 147 |
-o-transition: none !important;
|
|
@@ -157,7 +167,7 @@ div.jp-carousel-buttons a:hover {
|
|
| 157 |
}
|
| 158 |
|
| 159 |
.jp-carousel-slide {
|
| 160 |
-
position:
|
| 161 |
width:0;
|
| 162 |
bottom:0;
|
| 163 |
background-color:#000;
|
|
@@ -166,10 +176,22 @@ div.jp-carousel-buttons a:hover {
|
|
| 166 |
-moz-border-radius:2px;
|
| 167 |
-ms-border-radius:2px;
|
| 168 |
-o-border-radius:2px;
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
transition:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
}
|
| 174 |
|
| 175 |
.jp-carousel-slide img {
|
|
@@ -185,15 +207,16 @@ div.jp-carousel-buttons a:hover {
|
|
| 185 |
-moz-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 186 |
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 187 |
zoom: 1;
|
| 188 |
-
|
| 189 |
-
|
|
|
|
| 190 |
-webkit-transition: opacity 400ms linear;
|
| 191 |
-moz-transition: opacity 400ms linear;
|
| 192 |
-o-transition: opacity 400ms linear;
|
| 193 |
transition: opacity 400ms linear;
|
| 194 |
}
|
| 195 |
|
| 196 |
-
.jp-carousel-slide.selected
|
| 197 |
filter: alpha(opacity=100);
|
| 198 |
opacity: 1;
|
| 199 |
}
|
|
@@ -205,7 +228,10 @@ div.jp-carousel-buttons a:hover {
|
|
| 205 |
padding:0.35em 0 0;
|
| 206 |
position: absolute;
|
| 207 |
text-align: right;
|
| 208 |
-
width:
|
|
|
|
|
|
|
|
|
|
| 209 |
-webkit-transition: color 200ms linear;
|
| 210 |
-moz-transition: color 200ms linear;
|
| 211 |
-o-transition: color 200ms linear;
|
|
@@ -227,6 +253,9 @@ div.jp-carousel-buttons a:hover {
|
|
| 227 |
-moz-border-radius: 4px;
|
| 228 |
-webkit-border-radius: 4px;
|
| 229 |
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
| 230 |
-webkit-transition: border-color 200ms linear;
|
| 231 |
-moz-transition: border-color 200ms linear;
|
| 232 |
-o-transition: border-color 200ms linear;
|
|
@@ -483,7 +512,7 @@ div#carousel-reblog-box {
|
|
| 483 |
display: none;
|
| 484 |
}
|
| 485 |
|
| 486 |
-
.jp-carousel-photo-info h1:before,
|
| 487 |
.jp-carousel-photo-info h1:after,
|
| 488 |
.jp-carousel-left-column-wrapper h1:before,
|
| 489 |
.jp-carousel-left-column-wrapper h1:after {
|
|
@@ -695,7 +724,7 @@ textarea#jp-carousel-comment-form-comment-field {
|
|
| 695 |
border-radius: 3px;
|
| 696 |
overflow: hidden;
|
| 697 |
-webkit-box-sizing: border-box;
|
| 698 |
-
-moz-box-sizing: border-box;
|
| 699 |
box-sizing: border-box;
|
| 700 |
}
|
| 701 |
|
|
@@ -793,7 +822,7 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 793 |
}
|
| 794 |
|
| 795 |
#jp-carousel-comment-post-results {
|
| 796 |
-
display: none;
|
| 797 |
overflow:auto;
|
| 798 |
width:100%;
|
| 799 |
}
|
|
@@ -1052,14 +1081,14 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1052 |
margin: 0 10px !important;
|
| 1053 |
}
|
| 1054 |
|
| 1055 |
-
.jp-carousel-next-button, .jp-carousel-previous-button {
|
| 1056 |
-
display: none !important;
|
| 1057 |
}
|
| 1058 |
|
| 1059 |
.jp-carousel-buttons {
|
| 1060 |
display: none !important;
|
| 1061 |
}
|
| 1062 |
-
|
| 1063 |
.jp-carousel-image-meta {
|
| 1064 |
float: none !important;
|
| 1065 |
width: 100% !important;
|
|
@@ -1067,31 +1096,31 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1067 |
-webkit-box-sizing:border-box;
|
| 1068 |
box-sizing: border-box;
|
| 1069 |
}
|
| 1070 |
-
|
| 1071 |
.jp-carousel-close-hint {
|
| 1072 |
font-weight: 800 !important;
|
| 1073 |
font-size: 26px !important;
|
| 1074 |
position: fixed !important;
|
| 1075 |
top: -10px;
|
| 1076 |
}
|
| 1077 |
-
|
| 1078 |
.jp-carousel-slide img {
|
| 1079 |
filter: alpha(opacity=100);
|
| 1080 |
opacity: 1;
|
| 1081 |
}
|
| 1082 |
-
|
| 1083 |
.jp-carousel-wrap {
|
| 1084 |
-
background-color: #000;
|
| 1085 |
}
|
| 1086 |
-
|
| 1087 |
.jp-carousel-fadeaway {
|
| 1088 |
display: none;
|
| 1089 |
}
|
| 1090 |
-
|
| 1091 |
#jp-carousel-comment-form-container {
|
| 1092 |
display: none !important;
|
| 1093 |
}
|
| 1094 |
-
|
| 1095 |
.jp-carousel-titleanddesc {
|
| 1096 |
padding-top: 0 !important;
|
| 1097 |
border: none !important;
|
|
@@ -1099,8 +1128,14 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1099 |
.jp-carousel-titleanddesc-title {
|
| 1100 |
font-size: 1em !important;
|
| 1101 |
}
|
| 1102 |
-
|
| 1103 |
.jp-carousel-left-column-wrapper {
|
| 1104 |
padding: 0;
|
| 1105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1106 |
}
|
| 1 |
+
/* This file was automatically generated on Oct 30 2013 05:46:54 */
|
| 2 |
|
| 3 |
* {
|
| 4 |
line-height:inherit; /* prevent declarations of line-height in the universal selector */
|
| 50 |
background: #68c9e8; /* Safari */
|
| 51 |
color: #fff;
|
| 52 |
}
|
| 53 |
+
|
| 54 |
.jp-carousel-info ::-moz-selection {
|
| 55 |
background: #68c9e8; /* Firefox */
|
| 56 |
color: #fff;
|
| 58 |
|
| 59 |
.jp-carousel-photo-info {
|
| 60 |
position: relative;
|
| 61 |
+
right: 25%;
|
| 62 |
+
width: 50%;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.jp-carousel-transitions .jp-carousel-photo-info {
|
| 66 |
-webkit-transition: 400ms ease-out;
|
| 67 |
-moz-transition: 400ms ease-out;
|
| 68 |
-o-transition: 400ms ease-out;
|
| 69 |
transition: 400ms ease-out;
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
|
| 72 |
.jp-carousel-info h2 {
|
| 101 |
zoom: 1;
|
| 102 |
filter: alpha(opacity=20);
|
| 103 |
opacity: 0.2;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.jp-carousel-transitions .jp-carousel-next-button span,
|
| 107 |
+
.jp-carousel-transitions .jp-carousel-previous-button span {
|
| 108 |
-webkit-transition: 500ms opacity ease-out;
|
| 109 |
-moz-transition: 500ms opacity ease-out;
|
| 110 |
-o-transition: 500ms opacity ease-out;
|
| 142 |
padding: 5px 0 5px 2px;
|
| 143 |
text-decoration: none !important;
|
| 144 |
text-shadow: none !important;
|
| 145 |
+
vertical-align: middle;
|
| 146 |
-webkit-font-smoothing: subpixel-antialiased;
|
| 147 |
}
|
| 148 |
|
| 149 |
div.jp-carousel-buttons a:hover {
|
| 150 |
color: #68c9e8;
|
| 151 |
border: none !important;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.jp-carousel-transitions div.jp-carousel-buttons a:hover {
|
| 155 |
-webkit-transition: none !important;
|
| 156 |
-moz-transition: none !important;
|
| 157 |
-o-transition: none !important;
|
| 167 |
}
|
| 168 |
|
| 169 |
.jp-carousel-slide {
|
| 170 |
+
position:fixed;
|
| 171 |
width:0;
|
| 172 |
bottom:0;
|
| 173 |
background-color:#000;
|
| 176 |
-moz-border-radius:2px;
|
| 177 |
-ms-border-radius:2px;
|
| 178 |
-o-border-radius:2px;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
.jp-carousel-transitions .jp-carousel-slide {
|
| 182 |
+
-webkit-transition: 300ms ease-out;
|
| 183 |
+
-moz-transition: 300ms ease-out;
|
| 184 |
+
-o-transition: 300ms ease-out;
|
| 185 |
+
transition: 300ms ease-out;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.jp-carousel-slide.selected {
|
| 189 |
+
position: absolute;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.jp-carousel-slide {
|
| 193 |
+
filter: alpha(opacity=25);
|
| 194 |
+
opacity: 0.25;
|
| 195 |
}
|
| 196 |
|
| 197 |
.jp-carousel-slide img {
|
| 207 |
-moz-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 208 |
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 209 |
zoom: 1;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.jp-carousel-transitions .jp-carousel-slide {
|
| 213 |
-webkit-transition: opacity 400ms linear;
|
| 214 |
-moz-transition: opacity 400ms linear;
|
| 215 |
-o-transition: opacity 400ms linear;
|
| 216 |
transition: opacity 400ms linear;
|
| 217 |
}
|
| 218 |
|
| 219 |
+
.jp-carousel-slide.selected {
|
| 220 |
filter: alpha(opacity=100);
|
| 221 |
opacity: 1;
|
| 222 |
}
|
| 228 |
padding:0.35em 0 0;
|
| 229 |
position: absolute;
|
| 230 |
text-align: right;
|
| 231 |
+
width: 90%;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
.jp-carousel-transitions .jp-carousel-close-hint {
|
| 235 |
-webkit-transition: color 200ms linear;
|
| 236 |
-moz-transition: color 200ms linear;
|
| 237 |
-o-transition: color 200ms linear;
|
| 253 |
-moz-border-radius: 4px;
|
| 254 |
-webkit-border-radius: 4px;
|
| 255 |
border-radius: 4px;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
.jp-carousel-transitions .jp-carousel-close-hint span {
|
| 259 |
-webkit-transition: border-color 200ms linear;
|
| 260 |
-moz-transition: border-color 200ms linear;
|
| 261 |
-o-transition: border-color 200ms linear;
|
| 512 |
display: none;
|
| 513 |
}
|
| 514 |
|
| 515 |
+
.jp-carousel-photo-info h1:before,
|
| 516 |
.jp-carousel-photo-info h1:after,
|
| 517 |
.jp-carousel-left-column-wrapper h1:before,
|
| 518 |
.jp-carousel-left-column-wrapper h1:after {
|
| 724 |
border-radius: 3px;
|
| 725 |
overflow: hidden;
|
| 726 |
-webkit-box-sizing: border-box;
|
| 727 |
+
-moz-box-sizing: border-box;
|
| 728 |
box-sizing: border-box;
|
| 729 |
}
|
| 730 |
|
| 822 |
}
|
| 823 |
|
| 824 |
#jp-carousel-comment-post-results {
|
| 825 |
+
display: none;
|
| 826 |
overflow:auto;
|
| 827 |
width:100%;
|
| 828 |
}
|
| 1081 |
margin: 0 10px !important;
|
| 1082 |
}
|
| 1083 |
|
| 1084 |
+
.jp-carousel-next-button, .jp-carousel-previous-button {
|
| 1085 |
+
display: none !important;
|
| 1086 |
}
|
| 1087 |
|
| 1088 |
.jp-carousel-buttons {
|
| 1089 |
display: none !important;
|
| 1090 |
}
|
| 1091 |
+
|
| 1092 |
.jp-carousel-image-meta {
|
| 1093 |
float: none !important;
|
| 1094 |
width: 100% !important;
|
| 1096 |
-webkit-box-sizing:border-box;
|
| 1097 |
box-sizing: border-box;
|
| 1098 |
}
|
| 1099 |
+
|
| 1100 |
.jp-carousel-close-hint {
|
| 1101 |
font-weight: 800 !important;
|
| 1102 |
font-size: 26px !important;
|
| 1103 |
position: fixed !important;
|
| 1104 |
top: -10px;
|
| 1105 |
}
|
| 1106 |
+
|
| 1107 |
.jp-carousel-slide img {
|
| 1108 |
filter: alpha(opacity=100);
|
| 1109 |
opacity: 1;
|
| 1110 |
}
|
| 1111 |
+
|
| 1112 |
.jp-carousel-wrap {
|
| 1113 |
+
background-color: #000;
|
| 1114 |
}
|
| 1115 |
+
|
| 1116 |
.jp-carousel-fadeaway {
|
| 1117 |
display: none;
|
| 1118 |
}
|
| 1119 |
+
|
| 1120 |
#jp-carousel-comment-form-container {
|
| 1121 |
display: none !important;
|
| 1122 |
}
|
| 1123 |
+
|
| 1124 |
.jp-carousel-titleanddesc {
|
| 1125 |
padding-top: 0 !important;
|
| 1126 |
border: none !important;
|
| 1128 |
.jp-carousel-titleanddesc-title {
|
| 1129 |
font-size: 1em !important;
|
| 1130 |
}
|
| 1131 |
+
|
| 1132 |
.jp-carousel-left-column-wrapper {
|
| 1133 |
padding: 0;
|
| 1134 |
+
width: 100% !important;
|
| 1135 |
+
}
|
| 1136 |
+
|
| 1137 |
+
.jp-carousel-photo-info {
|
| 1138 |
+
right: 0 !important;
|
| 1139 |
+
width: 100% !important;
|
| 1140 |
+
}
|
| 1141 |
}
|
carousel/spin.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//fgnass.github.com/spin.js#v1.3
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Copyright (c) 2011-2013 Felix Gnass
|
| 5 |
+
* Licensed under the MIT license
|
| 6 |
+
*/
|
| 7 |
+
(function(root, factory) {
|
| 8 |
+
|
| 9 |
+
/* CommonJS */
|
| 10 |
+
if (typeof exports == 'object') module.exports = factory()
|
| 11 |
+
|
| 12 |
+
/* AMD module */
|
| 13 |
+
else if (typeof define == 'function' && define.amd) define(factory)
|
| 14 |
+
|
| 15 |
+
/* Browser global */
|
| 16 |
+
else root.Spinner = factory()
|
| 17 |
+
}
|
| 18 |
+
(this, function() {
|
| 19 |
+
"use strict";
|
| 20 |
+
|
| 21 |
+
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
|
| 22 |
+
, animations = {} /* Animation rules keyed by their name */
|
| 23 |
+
, useCssAnimations /* Whether to use CSS animations or setTimeout */
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Utility function to create elements. If no tag name is given,
|
| 27 |
+
* a DIV is created. Optionally properties can be passed.
|
| 28 |
+
*/
|
| 29 |
+
function createEl(tag, prop) {
|
| 30 |
+
var el = document.createElement(tag || 'div')
|
| 31 |
+
, n
|
| 32 |
+
|
| 33 |
+
for(n in prop) el[n] = prop[n]
|
| 34 |
+
return el
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Appends children and returns the parent.
|
| 39 |
+
*/
|
| 40 |
+
function ins(parent /* child1, child2, ...*/) {
|
| 41 |
+
for (var i=1, n=arguments.length; i<n; i++)
|
| 42 |
+
parent.appendChild(arguments[i])
|
| 43 |
+
|
| 44 |
+
return parent
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Insert a new stylesheet to hold the @keyframe or VML rules.
|
| 49 |
+
*/
|
| 50 |
+
var sheet = (function() {
|
| 51 |
+
var el = createEl('style', {type : 'text/css'})
|
| 52 |
+
ins(document.getElementsByTagName('head')[0], el)
|
| 53 |
+
return el.sheet || el.styleSheet
|
| 54 |
+
}())
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Creates an opacity keyframe animation rule and returns its name.
|
| 58 |
+
* Since most mobile Webkits have timing issues with animation-delay,
|
| 59 |
+
* we create separate rules for each line/segment.
|
| 60 |
+
*/
|
| 61 |
+
function addAnimation(alpha, trail, i, lines) {
|
| 62 |
+
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
|
| 63 |
+
, start = 0.01 + i/lines * 100
|
| 64 |
+
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
|
| 65 |
+
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
|
| 66 |
+
, pre = prefix && '-' + prefix + '-' || ''
|
| 67 |
+
|
| 68 |
+
if (!animations[name]) {
|
| 69 |
+
sheet.insertRule(
|
| 70 |
+
'@' + pre + 'keyframes ' + name + '{' +
|
| 71 |
+
'0%{opacity:' + z + '}' +
|
| 72 |
+
start + '%{opacity:' + alpha + '}' +
|
| 73 |
+
(start+0.01) + '%{opacity:1}' +
|
| 74 |
+
(start+trail) % 100 + '%{opacity:' + alpha + '}' +
|
| 75 |
+
'100%{opacity:' + z + '}' +
|
| 76 |
+
'}', sheet.cssRules.length)
|
| 77 |
+
|
| 78 |
+
animations[name] = 1
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
return name
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Tries various vendor prefixes and returns the first supported property.
|
| 86 |
+
*/
|
| 87 |
+
function vendor(el, prop) {
|
| 88 |
+
var s = el.style
|
| 89 |
+
, pp
|
| 90 |
+
, i
|
| 91 |
+
|
| 92 |
+
if(s[prop] !== undefined) return prop
|
| 93 |
+
prop = prop.charAt(0).toUpperCase() + prop.slice(1)
|
| 94 |
+
for(i=0; i<prefixes.length; i++) {
|
| 95 |
+
pp = prefixes[i]+prop
|
| 96 |
+
if(s[pp] !== undefined) return pp
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* Sets multiple style properties at once.
|
| 102 |
+
*/
|
| 103 |
+
function css(el, prop) {
|
| 104 |
+
for (var n in prop)
|
| 105 |
+
el.style[vendor(el, n)||n] = prop[n]
|
| 106 |
+
|
| 107 |
+
return el
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Fills in default values.
|
| 112 |
+
*/
|
| 113 |
+
function merge(obj) {
|
| 114 |
+
for (var i=1; i < arguments.length; i++) {
|
| 115 |
+
var def = arguments[i]
|
| 116 |
+
for (var n in def)
|
| 117 |
+
if (obj[n] === undefined) obj[n] = def[n]
|
| 118 |
+
}
|
| 119 |
+
return obj
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Returns the absolute page-offset of the given element.
|
| 124 |
+
*/
|
| 125 |
+
function pos(el) {
|
| 126 |
+
var o = { x:el.offsetLeft, y:el.offsetTop }
|
| 127 |
+
while((el = el.offsetParent))
|
| 128 |
+
o.x+=el.offsetLeft, o.y+=el.offsetTop
|
| 129 |
+
|
| 130 |
+
return o
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Built-in defaults
|
| 134 |
+
|
| 135 |
+
var defaults = {
|
| 136 |
+
lines: 12, // The number of lines to draw
|
| 137 |
+
length: 7, // The length of each line
|
| 138 |
+
width: 5, // The line thickness
|
| 139 |
+
radius: 10, // The radius of the inner circle
|
| 140 |
+
rotate: 0, // Rotation offset
|
| 141 |
+
corners: 1, // Roundness (0..1)
|
| 142 |
+
color: '#000', // #rgb or #rrggbb
|
| 143 |
+
direction: 1, // 1: clockwise, -1: counterclockwise
|
| 144 |
+
speed: 1, // Rounds per second
|
| 145 |
+
trail: 100, // Afterglow percentage
|
| 146 |
+
opacity: 1/4, // Opacity of the lines
|
| 147 |
+
fps: 20, // Frames per second when using setTimeout()
|
| 148 |
+
zIndex: 2e9, // Use a high z-index by default
|
| 149 |
+
className: 'spinner', // CSS class to assign to the element
|
| 150 |
+
top: 'auto', // center vertically
|
| 151 |
+
left: 'auto', // center horizontally
|
| 152 |
+
position: 'relative' // element position
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
/** The constructor */
|
| 156 |
+
function Spinner(o) {
|
| 157 |
+
if (typeof this == 'undefined') return new Spinner(o)
|
| 158 |
+
this.opts = merge(o || {}, Spinner.defaults, defaults)
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
// Global defaults that override the built-ins:
|
| 162 |
+
Spinner.defaults = {}
|
| 163 |
+
|
| 164 |
+
merge(Spinner.prototype, {
|
| 165 |
+
|
| 166 |
+
/**
|
| 167 |
+
* Adds the spinner to the given target element. If this instance is already
|
| 168 |
+
* spinning, it is automatically removed from its previous target b calling
|
| 169 |
+
* stop() internally.
|
| 170 |
+
*/
|
| 171 |
+
spin: function(target) {
|
| 172 |
+
this.stop()
|
| 173 |
+
|
| 174 |
+
var self = this
|
| 175 |
+
, o = self.opts
|
| 176 |
+
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
|
| 177 |
+
, mid = o.radius+o.length+o.width
|
| 178 |
+
, ep // element position
|
| 179 |
+
, tp // target position
|
| 180 |
+
|
| 181 |
+
if (target) {
|
| 182 |
+
target.insertBefore(el, target.firstChild||null)
|
| 183 |
+
tp = pos(target)
|
| 184 |
+
ep = pos(el)
|
| 185 |
+
css(el, {
|
| 186 |
+
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
|
| 187 |
+
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
|
| 188 |
+
})
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
el.setAttribute('role', 'progressbar')
|
| 192 |
+
self.lines(el, self.opts)
|
| 193 |
+
|
| 194 |
+
if (!useCssAnimations) {
|
| 195 |
+
// No CSS animation support, use setTimeout() instead
|
| 196 |
+
var i = 0
|
| 197 |
+
, start = (o.lines - 1) * (1 - o.direction) / 2
|
| 198 |
+
, alpha
|
| 199 |
+
, fps = o.fps
|
| 200 |
+
, f = fps/o.speed
|
| 201 |
+
, ostep = (1-o.opacity) / (f*o.trail / 100)
|
| 202 |
+
, astep = f/o.lines
|
| 203 |
+
|
| 204 |
+
;(function anim() {
|
| 205 |
+
i++;
|
| 206 |
+
for (var j = 0; j < o.lines; j++) {
|
| 207 |
+
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity)
|
| 208 |
+
|
| 209 |
+
self.opacity(el, j * o.direction + start, alpha, o)
|
| 210 |
+
}
|
| 211 |
+
self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
|
| 212 |
+
})()
|
| 213 |
+
}
|
| 214 |
+
return self
|
| 215 |
+
},
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Stops and removes the Spinner.
|
| 219 |
+
*/
|
| 220 |
+
stop: function() {
|
| 221 |
+
var el = this.el
|
| 222 |
+
if (el) {
|
| 223 |
+
clearTimeout(this.timeout)
|
| 224 |
+
if (el.parentNode) el.parentNode.removeChild(el)
|
| 225 |
+
this.el = undefined
|
| 226 |
+
}
|
| 227 |
+
return this
|
| 228 |
+
},
|
| 229 |
+
|
| 230 |
+
/**
|
| 231 |
+
* Internal method that draws the individual lines. Will be overwritten
|
| 232 |
+
* in VML fallback mode below.
|
| 233 |
+
*/
|
| 234 |
+
lines: function(el, o) {
|
| 235 |
+
var i = 0
|
| 236 |
+
, start = (o.lines - 1) * (1 - o.direction) / 2
|
| 237 |
+
, seg
|
| 238 |
+
|
| 239 |
+
function fill(color, shadow) {
|
| 240 |
+
return css(createEl(), {
|
| 241 |
+
position: 'absolute',
|
| 242 |
+
width: (o.length+o.width) + 'px',
|
| 243 |
+
height: o.width + 'px',
|
| 244 |
+
background: color,
|
| 245 |
+
boxShadow: shadow,
|
| 246 |
+
transformOrigin: 'left',
|
| 247 |
+
transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
|
| 248 |
+
borderRadius: (o.corners * o.width>>1) + 'px'
|
| 249 |
+
})
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
for (; i < o.lines; i++) {
|
| 253 |
+
seg = css(createEl(), {
|
| 254 |
+
position: 'absolute',
|
| 255 |
+
top: 1+~(o.width/2) + 'px',
|
| 256 |
+
transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
|
| 257 |
+
opacity: o.opacity,
|
| 258 |
+
animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite'
|
| 259 |
+
})
|
| 260 |
+
|
| 261 |
+
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
|
| 262 |
+
|
| 263 |
+
ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')))
|
| 264 |
+
}
|
| 265 |
+
return el
|
| 266 |
+
},
|
| 267 |
+
|
| 268 |
+
/**
|
| 269 |
+
* Internal method that adjusts the opacity of a single line.
|
| 270 |
+
* Will be overwritten in VML fallback mode below.
|
| 271 |
+
*/
|
| 272 |
+
opacity: function(el, i, val) {
|
| 273 |
+
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
})
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
function initVML() {
|
| 280 |
+
|
| 281 |
+
/* Utility function to create a VML tag */
|
| 282 |
+
function vml(tag, attr) {
|
| 283 |
+
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
// No CSS transforms but VML support, add a CSS rule for VML elements:
|
| 287 |
+
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
|
| 288 |
+
|
| 289 |
+
Spinner.prototype.lines = function(el, o) {
|
| 290 |
+
var r = o.length+o.width
|
| 291 |
+
, s = 2*r
|
| 292 |
+
|
| 293 |
+
function grp() {
|
| 294 |
+
return css(
|
| 295 |
+
vml('group', {
|
| 296 |
+
coordsize: s + ' ' + s,
|
| 297 |
+
coordorigin: -r + ' ' + -r
|
| 298 |
+
}),
|
| 299 |
+
{ width: s, height: s }
|
| 300 |
+
)
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
var margin = -(o.width+o.length)*2 + 'px'
|
| 304 |
+
, g = css(grp(), {position: 'absolute', top: margin, left: margin})
|
| 305 |
+
, i
|
| 306 |
+
|
| 307 |
+
function seg(i, dx, filter) {
|
| 308 |
+
ins(g,
|
| 309 |
+
ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
|
| 310 |
+
ins(css(vml('roundrect', {arcsize: o.corners}), {
|
| 311 |
+
width: r,
|
| 312 |
+
height: o.width,
|
| 313 |
+
left: o.radius,
|
| 314 |
+
top: -o.width>>1,
|
| 315 |
+
filter: filter
|
| 316 |
+
}),
|
| 317 |
+
vml('fill', {color: o.color, opacity: o.opacity}),
|
| 318 |
+
vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
|
| 319 |
+
)
|
| 320 |
+
)
|
| 321 |
+
)
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
if (o.shadow)
|
| 325 |
+
for (i = 1; i <= o.lines; i++)
|
| 326 |
+
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
|
| 327 |
+
|
| 328 |
+
for (i = 1; i <= o.lines; i++) seg(i)
|
| 329 |
+
return ins(el, g)
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
Spinner.prototype.opacity = function(el, i, val, o) {
|
| 333 |
+
var c = el.firstChild
|
| 334 |
+
o = o.shadow && o.lines || 0
|
| 335 |
+
if (c && i+o < c.childNodes.length) {
|
| 336 |
+
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
|
| 337 |
+
if (c) c.opacity = val
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
var probe = css(createEl('group'), {behavior: 'url(#default#VML)'})
|
| 343 |
+
|
| 344 |
+
if (!vendor(probe, 'transform') && probe.adj) initVML()
|
| 345 |
+
else useCssAnimations = vendor(probe, 'animation')
|
| 346 |
+
|
| 347 |
+
return Spinner
|
| 348 |
+
|
| 349 |
+
}));
|
images/arrows-2x.png
DELETED
|
Binary file
|
images/arrows.png
DELETED
|
Binary file
|
images/carousel-sprite-2x.png
DELETED
|
Binary file
|
images/carousel-sprite.png
DELETED
|
Binary file
|
jquery.spin.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
| 1 |
-
/*
|
| 2 |
-
* Matt Husby https://github.com/matthusby/spin.js
|
| 3 |
-
* Based on the jquery plugin by Bradley Smith
|
| 4 |
-
* https://gist.github.com/1290439
|
| 5 |
-
*/
|
| 6 |
-
|
| 7 |
-
/*
|
| 8 |
-
Add spin to the jQuery object
|
| 9 |
-
If color is not passed the spinner will be black
|
| 10 |
-
You can now create a spinner using any of the variants below:
|
| 11 |
-
$("#el").spin(); // Produces default Spinner
|
| 12 |
-
$("#el").spin("small"); // Produces a 'small' Spinner
|
| 13 |
-
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
|
| 14 |
-
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
|
| 15 |
-
$("#el").spin("small-right"); // Pin the small spinner to the right edge
|
| 16 |
-
$("#el").spin("{small, medium, large}-{left, right, top, bottom}"); // All options for where to pin
|
| 17 |
-
$("#el").spin(false); // Kills the spinner.
|
| 18 |
-
*/
|
| 19 |
-
|
| 20 |
-
( function( $ ) {
|
| 21 |
-
$.fn.spin = function( opts, color ) {
|
| 22 |
-
var presets = {
|
| 23 |
-
"small": { lines: 8, length: 2, width: 2, radius: 3, trail: 60, speed: 1.3 },
|
| 24 |
-
"medium": { lines: 8, length: 4, width: 3, radius: 5, trail: 60, speed: 1.3 },
|
| 25 |
-
"large": { lines: 10, length: 6, width: 4, radius: 7, trail: 60, speed: 1.3 }
|
| 26 |
-
};
|
| 27 |
-
if ( Spinner ) {
|
| 28 |
-
return this.each( function() {
|
| 29 |
-
var $this = $( this ),
|
| 30 |
-
data = $this.data();
|
| 31 |
-
|
| 32 |
-
if ( data.spinner ) {
|
| 33 |
-
data.spinner.stop();
|
| 34 |
-
delete data.spinner;
|
| 35 |
-
}
|
| 36 |
-
if ( opts !== false ) {
|
| 37 |
-
var spinner_options;
|
| 38 |
-
if ( typeof opts === "string" ) {
|
| 39 |
-
var spinner_base = opts.indexOf( '-' );
|
| 40 |
-
if( spinner_base == -1 ) {
|
| 41 |
-
spinner_base = opts;
|
| 42 |
-
} else {
|
| 43 |
-
spinner_base = opts.substring( 0, spinner_base );
|
| 44 |
-
}
|
| 45 |
-
if ( spinner_base in presets ) {
|
| 46 |
-
spinner_options = presets[spinner_base];
|
| 47 |
-
} else {
|
| 48 |
-
spinner_options = {};
|
| 49 |
-
}
|
| 50 |
-
var padding;
|
| 51 |
-
if ( opts.indexOf( "-right" ) != -1 ) {
|
| 52 |
-
padding = jQuery( this ).css( 'padding-left' );
|
| 53 |
-
if( typeof padding === "undefined" ) {
|
| 54 |
-
padding = 0;
|
| 55 |
-
} else {
|
| 56 |
-
padding = padding.replace( 'px', '' );
|
| 57 |
-
}
|
| 58 |
-
spinner_options.left = jQuery( this ).outerWidth() - ( 2 * ( spinner_options.length + spinner_options.width + spinner_options.radius ) ) - padding - 5;
|
| 59 |
-
}
|
| 60 |
-
if ( opts.indexOf( '-left' ) != -1 ) {
|
| 61 |
-
spinner_options.left = 5;
|
| 62 |
-
}
|
| 63 |
-
if ( opts.indexOf( '-top' ) != -1 ) {
|
| 64 |
-
spinner_options.top = 5;
|
| 65 |
-
}
|
| 66 |
-
if ( opts.indexOf( '-bottom' ) != -1 ) {
|
| 67 |
-
padding = jQuery( this ).css( 'padding-top' );
|
| 68 |
-
if( typeof padding === "undefined" ) {
|
| 69 |
-
padding = 0;
|
| 70 |
-
} else {
|
| 71 |
-
padding = padding.replace( 'px', '' );
|
| 72 |
-
}
|
| 73 |
-
spinner_options.top = jQuery( this ).outerHeight() - ( 2 * ( spinner_options.length + spinner_options.width + spinner_options.radius ) ) - padding - 5;
|
| 74 |
-
}
|
| 75 |
-
}
|
| 76 |
-
if( color ){
|
| 77 |
-
spinner_options.color = color;
|
| 78 |
-
}
|
| 79 |
-
data.spinner = new Spinner( spinner_options ).spin( this );
|
| 80 |
-
}
|
| 81 |
-
});
|
| 82 |
-
} else {
|
| 83 |
-
throw "Spinner class not available.";
|
| 84 |
-
}
|
| 85 |
-
};
|
| 86 |
-
})( jQuery );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
=== Gallery Carousel Without JetPack ===
|
| 2 |
-
Contributors: smub, iamdpegg
|
| 3 |
Donate link:http://www.wpbeginner.com/wpbeginner-needs-your-help/
|
| 4 |
Tags: gallery, lightbox, carousel, gallery carousel, jetpack
|
| 5 |
Requires at least: 3.4.1
|
| 6 |
-
Tested up to: 3.
|
| 7 |
-
Stable tag:
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -26,6 +26,7 @@ I often get asked what are the [best WordPress plugins](http://www.wpbeginner.co
|
|
| 26 |
|
| 27 |
Gallery Carousel feature was first intorduced for WordPress.com blogs, and now it is available for all WordPress sites. So YES you can [switch from WordPress.com to WordPress.org](http://www.wpbeginner.com/wp-tutorials/how-to-properly-move-your-blog-from-wordpress-com-to-wordpress-org/ "switch from WordPress.com to WordPress.org") and still keep the Gallery Carousel functionality by using this plugin.
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
Lastly, if you like this plugin then follow WPBeginner on [Twitter](http://twitter.com/wpbeginner "Twitter"), [Facebook](http://facebook.com/wpbeginner "Facebook"), and [Google+](https://plus.google.com/101634180904808003404/ "Google+")
|
| 31 |
|
|
@@ -62,6 +63,9 @@ However, if you want to turn off comments on Media attachments, you can follow t
|
|
| 62 |
|
| 63 |
== Changelog ==
|
| 64 |
|
|
|
|
|
|
|
|
|
|
| 65 |
= 0.6 =
|
| 66 |
* Updated it to match original JetPack plugin updates 2.2.2
|
| 67 |
* Bugfix: Comments not working due to jQuery.spin and spin.js issue (props amoshonas)
|
| 1 |
=== Gallery Carousel Without JetPack ===
|
| 2 |
+
Contributors: smub, iamdpegg, n7studios
|
| 3 |
Donate link:http://www.wpbeginner.com/wpbeginner-needs-your-help/
|
| 4 |
Tags: gallery, lightbox, carousel, gallery carousel, jetpack
|
| 5 |
Requires at least: 3.4.1
|
| 6 |
+
Tested up to: 3.9
|
| 7 |
+
Stable tag: trunk
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 26 |
|
| 27 |
Gallery Carousel feature was first intorduced for WordPress.com blogs, and now it is available for all WordPress sites. So YES you can [switch from WordPress.com to WordPress.org](http://www.wpbeginner.com/wp-tutorials/how-to-properly-move-your-blog-from-wordpress-com-to-wordpress-org/ "switch from WordPress.com to WordPress.org") and still keep the Gallery Carousel functionality by using this plugin.
|
| 28 |
|
| 29 |
+
If you like this plugin, then please leave a good rating. For support just ask the questions here.
|
| 30 |
|
| 31 |
Lastly, if you like this plugin then follow WPBeginner on [Twitter](http://twitter.com/wpbeginner "Twitter"), [Facebook](http://facebook.com/wpbeginner "Facebook"), and [Google+](https://plus.google.com/101634180904808003404/ "Google+")
|
| 32 |
|
| 63 |
|
| 64 |
== Changelog ==
|
| 65 |
|
| 66 |
+
= 0.7 =
|
| 67 |
+
* Updated it to match original JetPack plugin updates from 2.9.3
|
| 68 |
+
|
| 69 |
= 0.6 =
|
| 70 |
* Updated it to match original JetPack plugin updates 2.2.2
|
| 71 |
* Bugfix: Comments not working due to jQuery.spin and spin.js issue (props amoshonas)
|
spin.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
| 1 |
-
//fgnass.github.com/spin.js#v1.2.4
|
| 2 |
-
(function(window, document, undefined) {
|
| 3 |
-
|
| 4 |
-
/**
|
| 5 |
-
* Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
|
| 6 |
-
* Licensed under the MIT license
|
| 7 |
-
*/
|
| 8 |
-
|
| 9 |
-
var prefixes = ['webkit', 'Moz', 'ms', 'O']; /* Vendor prefixes */
|
| 10 |
-
var animations = {}; /* Animation rules keyed by their name */
|
| 11 |
-
var useCssAnimations;
|
| 12 |
-
|
| 13 |
-
/**
|
| 14 |
-
* Utility function to create elements. If no tag name is given,
|
| 15 |
-
* a DIV is created. Optionally properties can be passed.
|
| 16 |
-
*/
|
| 17 |
-
function createEl(tag, prop) {
|
| 18 |
-
var el = document.createElement(tag || 'div');
|
| 19 |
-
var n;
|
| 20 |
-
|
| 21 |
-
for(n in prop) {
|
| 22 |
-
el[n] = prop[n];
|
| 23 |
-
}
|
| 24 |
-
return el;
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Appends children and returns the parent.
|
| 29 |
-
*/
|
| 30 |
-
function ins(parent /* child1, child2, ...*/) {
|
| 31 |
-
for (var i=1, n=arguments.length; i<n; i++) {
|
| 32 |
-
parent.appendChild(arguments[i]);
|
| 33 |
-
}
|
| 34 |
-
return parent;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
/**
|
| 38 |
-
* Insert a new stylesheet to hold the @keyframe or VML rules.
|
| 39 |
-
*/
|
| 40 |
-
var sheet = function() {
|
| 41 |
-
var el = createEl('style');
|
| 42 |
-
ins(document.getElementsByTagName('head')[0], el);
|
| 43 |
-
return el.sheet || el.styleSheet;
|
| 44 |
-
}();
|
| 45 |
-
|
| 46 |
-
/**
|
| 47 |
-
* Creates an opacity keyframe animation rule and returns its name.
|
| 48 |
-
* Since most mobile Webkits have timing issues with animation-delay,
|
| 49 |
-
* we create separate rules for each line/segment.
|
| 50 |
-
*/
|
| 51 |
-
function addAnimation(alpha, trail, i, lines) {
|
| 52 |
-
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-');
|
| 53 |
-
var start = 0.01 + i/lines*100;
|
| 54 |
-
var z = Math.max(1-(1-alpha)/trail*(100-start) , alpha);
|
| 55 |
-
var prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase();
|
| 56 |
-
var pre = prefix && '-'+prefix+'-' || '';
|
| 57 |
-
|
| 58 |
-
if (!animations[name]) {
|
| 59 |
-
sheet.insertRule(
|
| 60 |
-
'@' + pre + 'keyframes ' + name + '{' +
|
| 61 |
-
'0%{opacity:'+z+'}' +
|
| 62 |
-
start + '%{opacity:'+ alpha + '}' +
|
| 63 |
-
(start+0.01) + '%{opacity:1}' +
|
| 64 |
-
(start+trail)%100 + '%{opacity:'+ alpha + '}' +
|
| 65 |
-
'100%{opacity:'+ z + '}' +
|
| 66 |
-
'}', 0);
|
| 67 |
-
animations[name] = 1;
|
| 68 |
-
}
|
| 69 |
-
return name;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
/**
|
| 73 |
-
* Tries various vendor prefixes and returns the first supported property.
|
| 74 |
-
**/
|
| 75 |
-
function vendor(el, prop) {
|
| 76 |
-
var s = el.style;
|
| 77 |
-
var pp;
|
| 78 |
-
var i;
|
| 79 |
-
|
| 80 |
-
if(s[prop] !== undefined) return prop;
|
| 81 |
-
prop = prop.charAt(0).toUpperCase() + prop.slice(1);
|
| 82 |
-
for(i=0; i<prefixes.length; i++) {
|
| 83 |
-
pp = prefixes[i]+prop;
|
| 84 |
-
if(s[pp] !== undefined) return pp;
|
| 85 |
-
}
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
/**
|
| 89 |
-
* Sets multiple style properties at once.
|
| 90 |
-
*/
|
| 91 |
-
function css(el, prop) {
|
| 92 |
-
for (var n in prop) {
|
| 93 |
-
el.style[vendor(el, n)||n] = prop[n];
|
| 94 |
-
}
|
| 95 |
-
return el;
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
/**
|
| 99 |
-
* Fills in default values.
|
| 100 |
-
*/
|
| 101 |
-
function merge(obj) {
|
| 102 |
-
for (var i=1; i < arguments.length; i++) {
|
| 103 |
-
var def = arguments[i];
|
| 104 |
-
for (var n in def) {
|
| 105 |
-
if (obj[n] === undefined) obj[n] = def[n];
|
| 106 |
-
}
|
| 107 |
-
}
|
| 108 |
-
return obj;
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
/**
|
| 112 |
-
* Returns the absolute page-offset of the given element.
|
| 113 |
-
*/
|
| 114 |
-
function pos(el) {
|
| 115 |
-
var o = {x:el.offsetLeft, y:el.offsetTop};
|
| 116 |
-
while((el = el.offsetParent)) {
|
| 117 |
-
o.x+=el.offsetLeft;
|
| 118 |
-
o.y+=el.offsetTop;
|
| 119 |
-
}
|
| 120 |
-
return o;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
var defaults = {
|
| 124 |
-
lines: 12, // The number of lines to draw
|
| 125 |
-
length: 7, // The length of each line
|
| 126 |
-
width: 5, // The line thickness
|
| 127 |
-
radius: 10, // The radius of the inner circle
|
| 128 |
-
color: '#000', // #rgb or #rrggbb
|
| 129 |
-
speed: 1, // Rounds per second
|
| 130 |
-
trail: 100, // Afterglow percentage
|
| 131 |
-
opacity: 1/4, // Opacity of the lines
|
| 132 |
-
fps: 20, // Frames per second when using setTimeout()
|
| 133 |
-
zIndex: 2e9, // Use a high z-index by default
|
| 134 |
-
className: 'spinner', // CSS class to assign to the element
|
| 135 |
-
top: 'auto', // center vertically
|
| 136 |
-
left: 'auto' // center horizontally
|
| 137 |
-
};
|
| 138 |
-
|
| 139 |
-
/** The constructor */
|
| 140 |
-
var Spinner = function Spinner(o) {
|
| 141 |
-
if (!this.spin) return new Spinner(o);
|
| 142 |
-
this.opts = merge(o || {}, Spinner.defaults, defaults);
|
| 143 |
-
};
|
| 144 |
-
|
| 145 |
-
Spinner.defaults = {};
|
| 146 |
-
Spinner.prototype = {
|
| 147 |
-
spin: function(target) {
|
| 148 |
-
this.stop();
|
| 149 |
-
var self = this;
|
| 150 |
-
var o = self.opts;
|
| 151 |
-
var el = self.el = css(createEl(0, {className: o.className}), {position: 'relative', zIndex: o.zIndex});
|
| 152 |
-
var mid = o.radius+o.length+o.width;
|
| 153 |
-
var ep; // element position
|
| 154 |
-
var tp; // target position
|
| 155 |
-
|
| 156 |
-
if (target) {
|
| 157 |
-
target.insertBefore(el, target.firstChild||null);
|
| 158 |
-
tp = pos(target);
|
| 159 |
-
ep = pos(el);
|
| 160 |
-
css(el, {
|
| 161 |
-
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : o.left+mid) + 'px',
|
| 162 |
-
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : o.top+mid) + 'px'
|
| 163 |
-
});
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
el.setAttribute('aria-role', 'progressbar');
|
| 167 |
-
self.lines(el, self.opts);
|
| 168 |
-
|
| 169 |
-
if (!useCssAnimations) {
|
| 170 |
-
// No CSS animation support, use setTimeout() instead
|
| 171 |
-
var i = 0;
|
| 172 |
-
var fps = o.fps;
|
| 173 |
-
var f = fps/o.speed;
|
| 174 |
-
var ostep = (1-o.opacity)/(f*o.trail / 100);
|
| 175 |
-
var astep = f/o.lines;
|
| 176 |
-
|
| 177 |
-
!function anim() {
|
| 178 |
-
i++;
|
| 179 |
-
for (var s=o.lines; s; s--) {
|
| 180 |
-
var alpha = Math.max(1-(i+s*astep)%f * ostep, o.opacity);
|
| 181 |
-
self.opacity(el, o.lines-s, alpha, o);
|
| 182 |
-
}
|
| 183 |
-
self.timeout = self.el && setTimeout(anim, ~~(1000/fps));
|
| 184 |
-
}();
|
| 185 |
-
}
|
| 186 |
-
return self;
|
| 187 |
-
},
|
| 188 |
-
stop: function() {
|
| 189 |
-
var el = this.el;
|
| 190 |
-
if (el) {
|
| 191 |
-
clearTimeout(this.timeout);
|
| 192 |
-
if (el.parentNode) el.parentNode.removeChild(el);
|
| 193 |
-
this.el = undefined;
|
| 194 |
-
}
|
| 195 |
-
return this;
|
| 196 |
-
},
|
| 197 |
-
lines: function(el, o) {
|
| 198 |
-
var i = 0;
|
| 199 |
-
var seg;
|
| 200 |
-
|
| 201 |
-
function fill(color, shadow) {
|
| 202 |
-
return css(createEl(), {
|
| 203 |
-
position: 'absolute',
|
| 204 |
-
width: (o.length+o.width) + 'px',
|
| 205 |
-
height: o.width + 'px',
|
| 206 |
-
background: color,
|
| 207 |
-
boxShadow: shadow,
|
| 208 |
-
transformOrigin: 'left',
|
| 209 |
-
transform: 'rotate(' + ~~(360/o.lines*i) + 'deg) translate(' + o.radius+'px' +',0)',
|
| 210 |
-
borderRadius: (o.width>>1) + 'px'
|
| 211 |
-
});
|
| 212 |
-
}
|
| 213 |
-
for (; i < o.lines; i++) {
|
| 214 |
-
seg = css(createEl(), {
|
| 215 |
-
position: 'absolute',
|
| 216 |
-
top: 1+~(o.width/2) + 'px',
|
| 217 |
-
transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
|
| 218 |
-
opacity: o.opacity,
|
| 219 |
-
animation: useCssAnimations && addAnimation(o.opacity, o.trail, i, o.lines) + ' ' + 1/o.speed + 's linear infinite'
|
| 220 |
-
});
|
| 221 |
-
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}));
|
| 222 |
-
ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')));
|
| 223 |
-
}
|
| 224 |
-
return el;
|
| 225 |
-
},
|
| 226 |
-
opacity: function(el, i, val) {
|
| 227 |
-
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val;
|
| 228 |
-
}
|
| 229 |
-
};
|
| 230 |
-
|
| 231 |
-
/////////////////////////////////////////////////////////////////////////
|
| 232 |
-
// VML rendering for IE
|
| 233 |
-
/////////////////////////////////////////////////////////////////////////
|
| 234 |
-
|
| 235 |
-
/**
|
| 236 |
-
* Check and init VML support
|
| 237 |
-
*/
|
| 238 |
-
!function() {
|
| 239 |
-
var s = css(createEl('group'), {behavior: 'url(#default#VML)'});
|
| 240 |
-
var i;
|
| 241 |
-
|
| 242 |
-
if (!vendor(s, 'transform') && s.adj) {
|
| 243 |
-
|
| 244 |
-
// VML support detected. Insert CSS rules ...
|
| 245 |
-
for (i=4; i--;) sheet.addRule(['group', 'roundrect', 'fill', 'stroke'][i], 'behavior:url(#default#VML)');
|
| 246 |
-
|
| 247 |
-
Spinner.prototype.lines = function(el, o) {
|
| 248 |
-
var r = o.length+o.width;
|
| 249 |
-
var s = 2*r;
|
| 250 |
-
|
| 251 |
-
function grp() {
|
| 252 |
-
return css(createEl('group', {coordsize: s +' '+s, coordorigin: -r +' '+-r}), {width: s, height: s});
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
var margin = -(o.width+o.length)*2+'px';
|
| 256 |
-
var g = css(grp(), {position: 'absolute', top: margin, left: margin});
|
| 257 |
-
|
| 258 |
-
var i;
|
| 259 |
-
|
| 260 |
-
function seg(i, dx, filter) {
|
| 261 |
-
ins(g,
|
| 262 |
-
ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
|
| 263 |
-
ins(css(createEl('roundrect', {arcsize: 1}), {
|
| 264 |
-
width: r,
|
| 265 |
-
height: o.width,
|
| 266 |
-
left: o.radius,
|
| 267 |
-
top: -o.width>>1,
|
| 268 |
-
filter: filter
|
| 269 |
-
}),
|
| 270 |
-
createEl('fill', {color: o.color, opacity: o.opacity}),
|
| 271 |
-
createEl('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
|
| 272 |
-
)
|
| 273 |
-
)
|
| 274 |
-
);
|
| 275 |
-
}
|
| 276 |
-
|
| 277 |
-
if (o.shadow) {
|
| 278 |
-
for (i = 1; i <= o.lines; i++) {
|
| 279 |
-
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)');
|
| 280 |
-
}
|
| 281 |
-
}
|
| 282 |
-
for (i = 1; i <= o.lines; i++) seg(i);
|
| 283 |
-
return ins(el, g);
|
| 284 |
-
};
|
| 285 |
-
Spinner.prototype.opacity = function(el, i, val, o) {
|
| 286 |
-
var c = el.firstChild;
|
| 287 |
-
o = o.shadow && o.lines || 0;
|
| 288 |
-
if (c && i+o < c.childNodes.length) {
|
| 289 |
-
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild;
|
| 290 |
-
if (c) c.opacity = val;
|
| 291 |
-
}
|
| 292 |
-
};
|
| 293 |
-
}
|
| 294 |
-
else {
|
| 295 |
-
useCssAnimations = vendor(s, 'animation');
|
| 296 |
-
}
|
| 297 |
-
}();
|
| 298 |
-
|
| 299 |
-
window.Spinner = Spinner;
|
| 300 |
-
|
| 301 |
-
})(window, document);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
