Loading README.txt +11 Changes for README.txt: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -109,6 +109,17 @@ You may use the Client-side adaptive image formatter within other types of entities as well, but the path to the formatter's settings will vary. -- RETINA SUPPORT -- If you wish an image style to be served with it's retina display variant just create a new style with the name '--retina' in the end. This module will automatically detect if a retina variant is available and will use that image-style. Exmaple: If the name of your image style is: "news-thumbnail" The name of the retina image style has to be: "news-thumbnail--retina" -- SIMILAR PROJECTS -- Loading cs_adaptive_image.js +5 Changes for cs_adaptive_image.js: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,11 @@ if (document.documentElement.clientWidth <= Number(breakpoint) && (selected_breakpoint == 'max' || Number(breakpoint) < Number(selected_breakpoint))) { selected_breakpoint = breakpoint; } // check for retina availability if ( typeof(window.devicePixelRatio) != 'undefined' && window.devicePixelRatio > 1 && $(element).attr('data-adaptive-image-' + selected_breakpoint + '-retina-img')) { selected_breakpoint = selected_breakpoint + '-retina'; } }); } if (selected_breakpoint != excluded_breakpoint) { Loading cs_adaptive_image.module +12 −1 Changes for cs_adaptive_image.module: 12 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -237,6 +237,8 @@ function theme_cs_adaptive_image_formatter($variables) { // Output fallback image that will work without JavaScript. $image_output = _cs_adaptive_image_view_image($image, $variables['fallback_style']); $styles = image_styles(); // Prepare attributes that will be picked up by our JavaScript code // to serve an adapted image. Some browsers cannot access the // children of a <noscript> element, thus all the data needs to be Loading @@ -246,11 +248,20 @@ function theme_cs_adaptive_image_formatter($variables) { if (isset($variables['breakpoint_styles'])) { foreach ($variables['breakpoint_styles'] as $breakpoint => $style_name) { $image['attributes']['data-adaptive-image-breakpoint'] = $breakpoint; $attributes['data-adaptive-image-breakpoints'][] = $breakpoint; // Append to list of breakpoints. // Append to list of breakpoints. $attributes['data-adaptive-image-breakpoints'][] = $breakpoint; $attributes['data-adaptive-image-' . $breakpoint . '-img'] = _cs_adaptive_image_view_image($image, $style_name); // Check if this image has a retina equivalent. if (in_array($style_name . '--retina', array_keys($styles))) { $attributes['data-adaptive-image-' . $breakpoint . '-retina-img'] = _cs_adaptive_image_view_image($image, $style_name . '--retina'); } } } $image['attributes']['data-adaptive-image-breakpoint'] = 'max'; if (in_array($variables['max_style'] . '--retina', array_keys($styles))) { $attributes['data-adaptive-image-max-retina-img'] = _cs_adaptive_image_view_image($image, $variables['max_style'] . '--retina'); } $attributes['data-adaptive-image-max-img'] = _cs_adaptive_image_view_image($image, $variables['max_style']); // Output the <noscript> element with its data attributes. Loading Loading
README.txt +11 Changes for README.txt: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -109,6 +109,17 @@ You may use the Client-side adaptive image formatter within other types of entities as well, but the path to the formatter's settings will vary. -- RETINA SUPPORT -- If you wish an image style to be served with it's retina display variant just create a new style with the name '--retina' in the end. This module will automatically detect if a retina variant is available and will use that image-style. Exmaple: If the name of your image style is: "news-thumbnail" The name of the retina image style has to be: "news-thumbnail--retina" -- SIMILAR PROJECTS -- Loading
cs_adaptive_image.js +5 Changes for cs_adaptive_image.js: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -19,6 +19,11 @@ if (document.documentElement.clientWidth <= Number(breakpoint) && (selected_breakpoint == 'max' || Number(breakpoint) < Number(selected_breakpoint))) { selected_breakpoint = breakpoint; } // check for retina availability if ( typeof(window.devicePixelRatio) != 'undefined' && window.devicePixelRatio > 1 && $(element).attr('data-adaptive-image-' + selected_breakpoint + '-retina-img')) { selected_breakpoint = selected_breakpoint + '-retina'; } }); } if (selected_breakpoint != excluded_breakpoint) { Loading
cs_adaptive_image.module +12 −1 Changes for cs_adaptive_image.module: 12 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -237,6 +237,8 @@ function theme_cs_adaptive_image_formatter($variables) { // Output fallback image that will work without JavaScript. $image_output = _cs_adaptive_image_view_image($image, $variables['fallback_style']); $styles = image_styles(); // Prepare attributes that will be picked up by our JavaScript code // to serve an adapted image. Some browsers cannot access the // children of a <noscript> element, thus all the data needs to be Loading @@ -246,11 +248,20 @@ function theme_cs_adaptive_image_formatter($variables) { if (isset($variables['breakpoint_styles'])) { foreach ($variables['breakpoint_styles'] as $breakpoint => $style_name) { $image['attributes']['data-adaptive-image-breakpoint'] = $breakpoint; $attributes['data-adaptive-image-breakpoints'][] = $breakpoint; // Append to list of breakpoints. // Append to list of breakpoints. $attributes['data-adaptive-image-breakpoints'][] = $breakpoint; $attributes['data-adaptive-image-' . $breakpoint . '-img'] = _cs_adaptive_image_view_image($image, $style_name); // Check if this image has a retina equivalent. if (in_array($style_name . '--retina', array_keys($styles))) { $attributes['data-adaptive-image-' . $breakpoint . '-retina-img'] = _cs_adaptive_image_view_image($image, $style_name . '--retina'); } } } $image['attributes']['data-adaptive-image-breakpoint'] = 'max'; if (in_array($variables['max_style'] . '--retina', array_keys($styles))) { $attributes['data-adaptive-image-max-retina-img'] = _cs_adaptive_image_view_image($image, $variables['max_style'] . '--retina'); } $attributes['data-adaptive-image-max-img'] = _cs_adaptive_image_view_image($image, $variables['max_style']); // Output the <noscript> element with its data attributes. Loading