Skip to content

Commit

Permalink
Implement v2.3.0 features:
Browse files Browse the repository at this point in the history
- Add identification and labeling of 'float' / 'double' variable type
- Add results counter. Shown next to the 'Results' heading.
- Added modal window for sponsorship
- Added upgrade to PRO version.
  • Loading branch information
qriouslad committed Apr 24, 2023
1 parent cb5276b commit bccf214
Show file tree
Hide file tree
Showing 20 changed files with 587 additions and 77 deletions.
Binary file added .wordpress-org/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
233 changes: 194 additions & 39 deletions admin/class-variable-inspector-admin.php

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/css/jBox.all.min.css

Large diffs are not rendered by default.

273 changes: 245 additions & 28 deletions admin/css/variable-inspector-admin.css

Large diffs are not rendered by default.

Binary file added admin/img/pro/sample-variables-vi-inspector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/img/undraw_Developer_activity_re_39tg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/img/undraw_Programming_re_kg9v.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions admin/js/jBox.all.min.js

Large diffs are not rendered by default.

152 changes: 144 additions & 8 deletions admin/js/variable-inspector-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
// Return jQuery object for method chaining
return this;
}

// Count results in view

function updateResultsCount() {
var resultCount = $('.inspection-result:not(.result-is-hidden)').length;
if ( resultCount == 0 ) {
$('#results-count').html('');
} else {
$('#results-count').html(resultCount);
}
}

// Set viewer for all results

Expand All @@ -68,6 +79,45 @@



}

function maybeHideColorFilter() {
var greenVarsCount = $('.inspection-result[data-color=green]').length;
var orangeVarsCount = $('.inspection-result[data-color=orange]').length;
var redVarsCount = $('.inspection-result[data-color=red]').length;
var purpleVarsCount = $('.inspection-result[data-color=purple]').length;
var blueVarsCount = $('.inspection-result[data-color=blue]').length;

if ( greenVarsCount > 0 ) {
$('#green-filter').show();
} else {
$('#green-filter').hide();
}
if ( orangeVarsCount > 0 ) {
$('#orange-filter').show();
} else {
$('#orange-filter').hide();
}
if ( redVarsCount > 0 ) {
$('#red-filter').show();
} else {
$('#red-filter').hide();
}
if ( purpleVarsCount > 0 ) {
$('#purple-filter').show();
} else {
$('#purple-filter').hide();
}
if ( blueVarsCount > 0 ) {
$('#blue-filter').show();
} else {
$('#blue-filter').hide();
}
if ( greenVarsCount > 0 || orangeVarsCount > 0 || redVarsCount > 0 || purpleVarsCount > 0 || blueVarsCount > 0 ) {
$('#gray-filter').show();
} else {
$('#gray-filter').hide();
}
}

$(document).ready( function() {
Expand All @@ -80,6 +130,8 @@
stopper: '', // Id, class, or number value
stickyClass: 'vi-sticky' // Class applied to element when it's stuck. Class name or false.
})

updateResultsCount();

// Expand or collapse all individual results

Expand All @@ -102,6 +154,8 @@
} else {}
});



// Set the viewer from WP options via get_option -> wp_localize_script

var viewer = viVars.viewer;
Expand Down Expand Up @@ -138,7 +192,7 @@

// Generate sample results

$('.generate-sample-results').click( function( eventObject ) {
$('#generate-sample-results').click( function( eventObject ) {

eventObject.preventDefault();

Expand All @@ -165,6 +219,7 @@
setTimeout(function() {
setViewer( viewer );
$('#results-spinner').hide();
updateResultsCount();
}, 2500);

}
Expand All @@ -177,28 +232,33 @@

});



// Refresh results

$('.refresh-results').click( function( eventObject ) {
$('#refresh-results').click( function( eventObject ) {

eventObject.preventDefault();

$('#results-count').html('');
$('#results-spinner').show();

AjaxManual('#inspection-results');

viewer = $('#results_viewer').find("option:selected").attr('value');

setTimeout(function() {
maybeHideColorFilter();
updateResultsCount();
setViewer( viewer );
$('#results-spinner').hide();
}, 2500);
}, 3000);

});

// Clear inspection results

$('.clear-results').click( function( eventObject ) {
$('#clear-results').click( function( eventObject ) {

eventObject.preventDefault();

Expand All @@ -216,11 +276,13 @@
response = JSON.parse(response)

if ( response.success == true ) {

$('#inspection-results').empty();
$('#inspection-results').prepend('<div class="no-results">There is no data in the inspection log.</div>');
$('#results-spinner').hide();

$('.color-filters').removeClass('color-chosen');
$('.color-filter').removeClass('color-active');
maybeHideColorFilter();
updateResultsCount();
}

},
Expand Down Expand Up @@ -248,6 +310,81 @@
$(".ui.accordion").accordion();



// Modal for sponsoring plugin dev and maintenance: https://stephanwagner.me/jBox

var upgradeModal = new jBox('Modal', {
attach: '#plugin-sponsor',
trigger: 'click', // or 'mouseenter'
// content: 'Test'
content: $('#vi-sponsor'),
width: 740, // pixels
closeButton: 'box',
addClass: 'plugin-sponsor-modal',
overlayClass: 'plugin-sponsor-modal-overlay',
target: '#wpwrap', // where to anchor the modal
position: {
x: 'center',
y: 'top'
},
// fade: 1000,
animation: {
open: 'slide:top',
close: 'slide:top'
}
});

// Invoke tracking of link clicks to track how man times the "Sponsor" button is clicked

$('#plugin-sponsor').click( function() {
$.ajax({
url: 'https://bowo.io/vi-sp-btn',
method: 'GET',
dataType: 'jsonp',
crossDomain: true
// success: function(response) {
// console.log(response);
// }
});
});

// Modal for PRO version upgrade: https://stephanwagner.me/jBox

var upgradeModal = new jBox('Modal', {
attach: '#plugin-upgrade',
trigger: 'click', // or 'mouseenter'
// content: 'Test'
content: $('#vi-upgrade'),
width: 740, // pixels
closeButton: 'box',
addClass: 'plugin-upgrade-modal',
overlayClass: 'plugin-upgrade-modal-overlay',
target: '#wpwrap', // where to anchor the modal
position: {
x: 'center',
y: 'top'
},
// fade: 1000,
animation: {
open: 'slide:top',
close: 'slide:top'
}
});

// Invoke tracking of link clicks to track how man times the "Upgrade" button is clicked

$('#plugin-sponsor').click( function() {
$.ajax({
url: 'https://bowo.io/vi-up-btn',
method: 'GET',
dataType: 'jsonp',
crossDomain: true
// success: function(response) {
// console.log(response);
// }
});
});

});

})( jQuery );
Expand All @@ -268,7 +405,7 @@ function AjaxAutoLoad(selector){(function($){
type: "GET",
url: window.location.href
}).done(function(res){
$(selector).html( $(res).find(selector) );
$(selector).html( $(res).find(selector).html() );

$(".accordion__control").click(function() {
$("#auto_load").prop( "checked", false );
Expand All @@ -278,7 +415,6 @@ function AjaxAutoLoad(selector){(function($){

$(selector).removeAttr("style");
});
// console.log(count++);
})(jQuery);}

// Toggle inspection result accordion
Expand Down
4 changes: 2 additions & 2 deletions includes/freemius-custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function bwvi_fs_custom_connect_header( $header_html )
function bwvi_fs_custom_connect_message( $message, $user_first_name, $product_title, $user_login, $site_link, $freemius_link )
{
return sprintf(
'%1$s, you can help us make the plugin more compatible with your site and better at doing what you need it to by opting to share some basic WordPress environment info. <br /><br />If you skip this, that\'s okay! %2$s will still work just fine.',
'%1$s, you can help us make the plugin more compatible with your site and better at doing what you need it to by opting to share some basic WordPress environment info. You\'ll receive an email to verify your consent. <br /><br />If you skip this, that\'s okay! %2$s will still work just fine.',
$user_first_name,
$product_title
);
Expand All @@ -53,7 +53,7 @@ function bwvi_fs_custom_connect_message( $message, $user_first_name, $product_ti
function bwvi_fs_custom_connect_message_on_update( $message, $user_first_name, $product_title, $user_login, $site_link, $freemius_link )
{
return sprintf(
'%1$s, you can help us make the plugin more compatible with your site and better at doing what you need it to by opting to share some basic WordPress environment info. <br /><br />If you skip this, that\'s okay! %2$s will still work just fine.',
'%1$s, you can help us make the plugin more compatible with your site and better at doing what you need it to by opting to share some basic WordPress environment info. You\'ll receive an email to verify your consent. <br /><br />If you skip this, that\'s okay! %2$s will still work just fine.',
$user_first_name,
$product_title
);
Expand Down

0 comments on commit bccf214

Please sign in to comment.