Skip to content

Commit

Permalink
Update grunt config to match BD (#53)
Browse files Browse the repository at this point in the history
This is to only maintain one config. It will need a bit more updating for the main plugin files
Update a couple jQuery deprecations
  • Loading branch information
stephywells authored Feb 6, 2024
1 parent 3a4a1ea commit 60ef911
Show file tree
Hide file tree
Showing 14 changed files with 1,011 additions and 6,872 deletions.
554 changes: 257 additions & 297 deletions Gruntfile.js

Large diffs are not rendered by default.

7,279 changes: 730 additions & 6,549 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
"author": "Strategy11",
"license": "GPL-2.0",
"devDependencies": {
"grunt": "^1.5.3",
"grunt-contrib-clean": "~1",
"grunt-contrib-compress": "^1.6.0",
"grunt-contrib-concat": "~1",
"grunt-contrib-jshint": "^1",
"grunt-contrib-less": "~1",
"grunt-contrib-uglify": "^1",
"grunt-contrib-watch": "~1",
"grunt-potomo": "~3.5",
"grunt-text-replace": "^0.4.0",
"grunt-wp-i18n": "^1.0.3",
"underscore": "^1.12.0"
"grunt": "^1.6.1",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-compress": "^2.0.0",
"grunt-contrib-less": "^3.0.0",
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-potomo": "^3.5.0",
"grunt-text-replace": "^0.4.0",
"grunt-wp-i18n": "^1.0.3",
"underscore": "^1.13.6"
}
}
2 changes: 1 addition & 1 deletion resources/js/admin-general.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if (typeof jQuery !== 'undefined') {
var $notice = $button.closest( '.awpcp-notice' );

$.post( ajaxurl, $.extend(
$.parseJSON( $button.attr( 'data-action-params' ) ),
JSON.parse( $button.attr( 'data-action-params' ) ),
{ action: $button.attr( 'data-action' ) }
) );

Expand Down
2 changes: 1 addition & 1 deletion resources/js/awpcp-admin.min.js

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

4 changes: 2 additions & 2 deletions resources/js/awpcp.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function( $, CategoriesSelectorHelper ) {
var self = this,
fullName;

if ( $.trim( params.term ) === '' ) {
if ( params.term.trim() === '' ) {
return item;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/media-uploader/media-uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function( $, settings) {
},

onFileUploaded: function( uploader, file, data ) {
var response = $.parseJSON( data.response );
var response = JSON.parse( data.response );

if ( response.status === 'ok' && response.file ) {
$.publish( '/file/uploaded', [ file, response.file ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function( $, settings ) {
},

_isPaymentTermAvailableForCategories: function( paymentTerm ) {
var paymentTermCategories = $.parseJSON( paymentTerm.attr( 'data-categories' ) );
var paymentTermCategories = JSON.parse( paymentTerm.attr( 'data-categories' ) );
var numberOfCategoriesAllowed = parseInt( paymentTerm.attr( 'data-number-of-categories-allowed' ), 10 );

if ( this.state.selectedCategories.length > numberOfCategoriesAllowed ) {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/settings-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ AWPCP.define( 'awpcp/settings-validator', [
form.find( '[awpcp-setting]' ).each( function() {
var field = $(this),
fieldName = field.attr( 'name' ),
setting = $.parseJSON( field.attr( 'awpcp-setting' ) );
setting = JSON.parse( field.attr( 'awpcp-setting' ) );

if ( setting && setting.validation && setting.validation.messages ) {
options.messages[ fieldName ] = setting.validation.messages;
Expand Down
4 changes: 2 additions & 2 deletions resources/js/page-place-ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ AWPCP.run('awpcp/page-place-ads', [
if ( self.categories === null && settings.get( 'hide-all-payment-terms-if-no-category-is-selected' ) ) {
return true;
} else if ( self.categories ) {
categories = $.parseJSON(term.attr('data-categories'));
categories = JSON.parse(term.attr('data-categories'));

if ($.isArray(categories)) {
categories = $.map(categories, function(category) {
Expand All @@ -106,7 +106,7 @@ AWPCP.run('awpcp/page-place-ads', [

_broadcastCategoriesMatrix: function _broadcastCategoriesMatrix() {
var termsCategories = this.terms.map(function() {
return { categories: $.parseJSON( $(this).attr( 'data-categories' ) ) };
return { categories: JSON.parse( $(this).attr( 'data-categories' ) ) };
});

var matrix = {}, newEntries, previousEntries;
Expand Down
4 changes: 2 additions & 2 deletions resources/js/users-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ AWPCP.define( 'awpcp/users-dropdown', [ 'jquery' ], function( $ ) {
getSelectedUser: function() {
var user_information = this.field.find(':selected').attr('data-user-information');

if (user_information && $.parseJSON) {
return $.parseJSON(user_information);
if (user_information && JSON.parse) {
return JSON.parse(user_information);
} else if (user_information) {
return eval('(' + user_information + ')');
} else {
Expand Down
2 changes: 1 addition & 1 deletion resources/vendors/breakpoints.js/breakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Reusables.Breakpoints = (function ($) {
Breakpoints.register = function($element) {
var builder = Reusables.Breakpoints.on($element);
var prefix = $element.attr('data-breakpoints-class-prefix') || 'breakpoint';
var breakpoints = $.parseJSON($element.attr('data-breakpoints'));
var breakpoints = JSON.parse($element.attr('data-breakpoints'));

if (!$.isPlainObject(breakpoints)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion resources/vendors/breakpoints.js/breakpoints.min.js

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

0 comments on commit 60ef911

Please sign in to comment.