first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
(function ($) {
'use strict';
$(function () {
var $body = $( 'body' ),
sweep = function($node) {
var $row = $node.parents( 'tr' );
// Add Active
$body.addClass( 'sweep-active' );
// Add Disabled
$node.prop( 'disabled', true ).text( wp_sweep.text_sweeping );
return $.get(ajaxurl, { action: $node.data( 'action' ), sweep_name: $node.data( 'sweep_name' ), sweep_type: $node.data( 'sweep_type' ), '_wpnonce': $node.data( 'nonce' ) }, function(data) {
if (data.success) {
var count = parseInt( data.data.count, 10 );
// Count Col
$( '.sweep-count', $row ).text( count.toLocaleString() );
// % Of Col
$( '.sweep-percentage', $row ).text( data.data.percentage );
// Action Col
if (count === 0) {
$node.parent( 'td' ).html( wp_sweep.text_na );
}
// Stats
$.each(data.data.stats, function(key, value) {
$( '.sweep-count-type-' + key ).text( parseInt( value, 10 ).toLocaleString() );
});
// Message
$row.parents( '.table-sweep' ).prev( '.sweep-message' ).html( '<div class="updated"><p>' + data.data.sweep + '</p></div>' );
// Hide Sweep Details
$( '.sweep-details', $row ).html( '' ).hide();
// Remove Active
$body.removeClass( 'sweep-active' );
// Remove Disabled
$node.prop( 'disabled', false ).text( wp_sweep.text_sweep );
}
});
};
$( '.btn-sweep' ).click(function(evt) {
evt.preventDefault();
sweep( $( this ) );
});
$( '.btn-sweep-details' ).click(function(evt) {
evt.preventDefault();
var $node = $( this );
$.get(ajaxurl, { action: $node.data( 'action' ), sweep_name: $node.data( 'sweep_name' ), sweep_type: $node.data( 'sweep_type' ), '_wpnonce': $node.data( 'nonce' ) }, function(data) {
if (data.success) {
if (data.data.length > 0) {
var html = '';
$.each(data.data, function(i, n) {
html += '<li>' + n + '</li>';
});
$( '.sweep-details', $node.parents( 'tr' ) ).html( '<ol>' + html + '</ol>' ).show();
}
}
});
});
$( '.btn-sweep-all' ).click(function(evt) {
evt.preventDefault();
var $node = $( this ), $btn_sweep = $( '.btn-sweep' ), sweep_all;
$node.prop( 'disabled', true ).text( wp_sweep.text_sweeping );
sweep_all = $btn_sweep.toArray().reduce(function(current, next) {
return current.then(function() {
return sweep( $( next ) );
});
}, $().promise());
sweep_all.done(function() {
// Remove Active
$body.removeClass( 'sweep-active' );
// Remove Disabled
$node.prop( 'disabled', false ).text( wp_sweep.text_sweep_all );
});
});
/*
Page closing confirmation
https://developer.mozilla.org/en-US/docs/DOM/Mozilla_event_reference/beforeunload
*/
$( window ).on('beforeunload', function (e) {
if ($body.hasClass( 'sweep-active' )) {
(e || window.event).returnValue = wp_sweep.text_close_warning; // Gecko and Trident
return wp_sweep.text_close_warning; // Gecko and WebKit
}
});
});
})(jQuery);

View File

@@ -0,0 +1,4 @@
(function(b){b(function(){var f=b("body"),g=function(a){var c=a.parents("tr");f.addClass("sweep-active");a.prop("disabled",!0).text(wp_sweep.text_sweeping);return b.get(ajaxurl,{action:a.data("action"),sweep_name:a.data("sweep_name"),sweep_type:a.data("sweep_type"),_wpnonce:a.data("nonce")},function(e){if(e.success){var d=parseInt(e.data.count,10);b(".sweep-count",c).text(d.toLocaleString());b(".sweep-percentage",c).text(e.data.percentage);0===d&&a.parent("td").html(wp_sweep.text_na);b.each(e.data.stats,
function(a,c){b(".sweep-count-type-"+a).text(parseInt(c,10).toLocaleString())});c.parents(".table-sweep").prev(".sweep-message").html('<div class="updated"><p>'+e.data.sweep+"</p></div>");b(".sweep-details",c).html("").hide();f.removeClass("sweep-active");a.prop("disabled",!1).text(wp_sweep.text_sweep)}})};b(".btn-sweep").click(function(a){a.preventDefault();g(b(this))});b(".btn-sweep-details").click(function(a){a.preventDefault();var c=b(this);b.get(ajaxurl,{action:c.data("action"),sweep_name:c.data("sweep_name"),
sweep_type:c.data("sweep_type"),_wpnonce:c.data("nonce")},function(a){if(a.success&&0<a.data.length){var d="";b.each(a.data,function(a,b){d+="<li>"+b+"</li>"});b(".sweep-details",c.parents("tr")).html("<ol>"+d+"</ol>").show()}})});b(".btn-sweep-all").click(function(a){a.preventDefault();var c=b(this);a=b(".btn-sweep");c.prop("disabled",!0).text(wp_sweep.text_sweeping);a.toArray().reduce(function(a,c){return a.then(function(){return g(b(c))})},b().promise()).done(function(){f.removeClass("sweep-active");
c.prop("disabled",!1).text(wp_sweep.text_sweep_all)})});b(window).on("beforeunload",function(a){if(f.hasClass("sweep-active"))return(a||window.event).returnValue=wp_sweep.text_close_warning})})})(jQuery);