Skip to content

Commit

Permalink
Merge pull request #14 from oceanwp/rc-2.2.0
Browse files Browse the repository at this point in the history
Rc 2.2.0
  • Loading branch information
eramits authored Oct 16, 2024
2 parents 7458859 + 315999b commit 7f46106
Show file tree
Hide file tree
Showing 13 changed files with 12,400 additions and 5,344 deletions.
46 changes: 32 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,35 @@ module.exports = function ( grunt ) {
require( 'time-grunt' )( grunt );

// Load all Grunt tasks
require( 'jit-grunt' )( grunt, {} );
require( 'jit-grunt' )( grunt, {
browserify: "grunt-browserify",
} );

grunt.initConfig( {

pkg: grunt.file.readJSON( 'package.json' ),

browserify: {
prod: {
files: {
'assets/js/social.min.js': 'assets/js/social.js',
'assets/js/customizer.min.js': 'assets/js/customizer.js'
},
options: {
transform: [["babelify", { presets: ["@babel/preset-env"] }]],
},
},
dev: {
files: {
'assets/js/social.min.js': 'assets/js/social.min.js',
'assets/js/customizer.min.js': 'assets/js/customizer.min.js'
},
options: {
transform: [["babelify", { presets: ["@babel/preset-env"] }]],
},
},
},

// Concat and Minify our js.
uglify: {
prod: {
Expand All @@ -32,7 +55,6 @@ module.exports = function ( grunt ) {
},
files: {
'assets/css/style.css': 'assets/css/style.scss',
'assets/css/pluginUpdateMessage.css': 'assets/css/pluginUpdateMessage.scss',
}
},
prod: {
Expand All @@ -41,10 +63,7 @@ module.exports = function ( grunt ) {
outputStyle: 'compressed',
sourceMap: false
},
files: {
'assets/css/style.min.css': 'assets/css/style.scss',
'assets/css/pluginUpdateMessage.min.css': 'assets/css/pluginUpdateMessage.scss',
}
files: {}
}
},

Expand All @@ -59,8 +78,6 @@ module.exports = function ( grunt ) {
files: {
'assets/css/style.css': 'assets/css/style.css',
'assets/css/style.min.css': 'assets/css/style.min.css',
'assets/css/pluginUpdateMessage.css': 'assets/css/pluginUpdateMessage.css',
'assets/css/pluginUpdateMessage.min.css': 'assets/css/pluginUpdateMessage.min.css',
}
}
},
Expand All @@ -73,7 +90,6 @@ module.exports = function ( grunt ) {
main: {
files: {
'assets/css/style.css': [ 'assets/css/style.css' ],
'assets/css/pluginUpdateMessage.css': [ 'assets/css/pluginUpdateMessage.css' ],
}
}
},
Expand Down Expand Up @@ -156,11 +172,13 @@ module.exports = function ( grunt ) {

// Dev task
grunt.registerTask( 'default', [
'sass:dev',
'newer:uglify:prod',
'sass:prod',
'autoprefixer:main',
'csscomb:main',
"browserify:dev",
"browserify:prod",
"uglify:prod",
"sass:dev",
"sass:prod",
"autoprefixer:main",
'csscomb:main'
] );

// Production task
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Ocean Social Sharing [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)

**Contributors:** Nick
**Contributors:** Nick, [Amit Singh](https://profiles.wordpress.org/apprimit/)
**Requires at least:** WordPress 5.6
**Tested up to:** WordPress 6.6.2
**Stable tag:** 2.0.8
**Tested up to:** WordPress 6.6
**Stable tag:** 2.2.0
**License:** GPLv2 or later
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html

Expand Down
167 changes: 71 additions & 96 deletions assets/js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,100 +4,75 @@
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/

( function( $ ) {
var style = [
'minimal',
'colored',
'dark'
],
headerPosition = [
'side',
'top'
];
var api = wp.customize,
style = [
'minimal',
'colored',
'dark'
],
headerPosition = [
'side',
'top'
];

wp.customize( 'oss_social_share_name', function( value ) {
value.bind( function( newval ) {
var socialWrap = $( '.entry-share' );
if ( true == newval ) {
socialWrap.addClass( 'has-name' );
} else {
socialWrap.removeClass( 'has-name' );
}
} );
} );
wp.customize('oss_social_share_heading', function( value ) {
var heading = $( '.social-share-title span.text' );
if ( heading.length ) {
var ogheading = heading.html();
value.bind( function( newval ) {
if ( newval ) {
heading.html( newval );
} else {
heading.html( ogheading );
}
});
}
} );
wp.customize( 'oss_social_share_heading_position', function( value ) {
value.bind( function( newval ) {
var socialWrap = $( '.entry-share' );
if ( socialWrap.length ) {
$.each( headerPosition, function( i, v ) {
socialWrap.removeClass( v );
});
socialWrap.addClass( newval );
}
} );
} );
wp.customize( 'oss_social_share_style', function( value ) {
value.bind( function( newval ) {
var socialWrap = $( '.entry-share' );
if ( socialWrap.length ) {
$.each( style, function( i, v ) {
socialWrap.removeClass( v );
});
socialWrap.addClass( newval );
}
} );
} );
wp.customize( 'oss_social_share_style_border_radius', function( value ) {
value.bind( function( to ) {
var $child = $( '.customizer-oss_social_share_style_border_radius' );
if ( to ) {
var img = '<style class="customizer-oss_social_share_style_border_radius">.entry-share ul li a { border-radius: ' + to + '; }</style>';
if ( $child.length ) {
$child.replaceWith( img );
} else {
$( 'head' ).append( img );
}
} else {
$child.remove();
}
} );
} );
wp.customize( 'oss_sharing_borders_color', function( value ) {
value.bind( function( to ) {
$( '.entry-share.minimal ul li a' ).css( 'border-color', to );
} );
} );
wp.customize( 'oss_sharing_icons_bg', function( value ) {
value.bind( function( to ) {
$( '.entry-share.minimal ul li a' ).css( 'background-color', to );
} );
} );
wp.customize( 'oss_sharing_icons_color', function( value ) {
value.bind( function( to ) {
var $child = $( '.customizer-oss_sharing_icons_color' );
if ( to ) {
var img = '<style class="customizer-oss_sharing_icons_color">.entry-share.minimal ul li a { color: ' + to + '; }.entry-share.minimal ul li a .oss-icon { fill: ' + to + '; }</style>';
if ( $child.length ) {
$child.replaceWith( img );
} else {
$( 'head' ).append( img );
}
} else {
$child.remove();
}
} );
} );
} )( jQuery );
api('oss_social_share_name', function(value) {
value.bind(function(newVal) {
var socialWraps = document.querySelectorAll('.entry-share');
if (socialWraps.length) {
socialWraps.forEach(function(element) {
if (newVal === true) {
element.classList.add('has-name');
} else {
element.classList.remove('has-name');
}
});
}
});
});

api('oss_social_share_heading', function(value) {
var headings = document.querySelectorAll('.social-share-title span.text');
if (headings.length) {
var originalHeadings = Array.from(headings).map(function(heading) {
return heading.innerHTML;
});

value.bind(function(newval) {
headings.forEach(function(heading, index) {
if (newval) {
heading.innerHTML = newval;
} else {
heading.innerHTML = originalHeadings[index];
}
});
});
}
});

api('oss_social_share_heading_position', function(value) {
value.bind(function(newval) {
var socialWraps = document.querySelectorAll('.entry-share');
if (socialWraps.length) {
socialWraps.forEach(function(socialWrap) {
headerPosition.forEach(function(position) {
socialWrap.classList.remove(position);
});
socialWrap.classList.add(newval);
});
}
});
});

api('oss_social_share_style', function(value) {
value.bind(function(newval) {
var socialWraps = document.querySelectorAll('.entry-share');
if (socialWraps.length) {
socialWraps.forEach(function(socialWrap) {
style.forEach(function(styleClass) {
socialWrap.classList.remove(styleClass);
});
socialWrap.classList.add(newval);
});
}
});
});
2 changes: 1 addition & 1 deletion assets/js/customizer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
== Changelog ==

= 2.2.0 - OCT 16 2024 =
- NEW: Customizer: Library upgraded to default WordPress ReactJS.
- NEW: Customizer: Customizer Controls.
- NEW: Customizer: User Interface.
- NEW: Customizer: Reorganized settings for improved user experience.
- Fixed: Special Character decode of title for X, LinkedIn and Reddit.
- Removed: Customizer: Legacy PHP Controls.

= 2.0.8 - OCT 11 2024 =
- Added: Conditional checks for future updates.
- Updated: Compatibility: WordPress version number.
Expand Down
4 changes: 4 additions & 0 deletions includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ function oss_social_share_sites() {
// Get socials from Customizer
$socials = get_theme_mod( 'oss_social_share_sites', $socials );

if (is_string($socials)) {
$socials = json_decode($socials, true);
}

// Turn into array if string
if ( $socials && ! is_array( $socials ) ) {
$socials = explode( ',', $socials );
Expand Down
Loading

0 comments on commit 7f46106

Please sign in to comment.