gotem_content_moderation-1.1.6-alpha1/js/flagged-items.js

js/flagged-items.js
(function ($, Drupal) {
  Drupal.behaviors.flaggedItems = {
    attach: function (context, settings) {
      console.log('flaggedItems');
      $('.percentage-circle', context).once('flaggedItems').each(function () {
        var $circle = $(this).find('.progress-circle');
        var percentage = parseFloat($(this).data('percentage'));
        var category = $(this).data('category');
        var offset = 283 - (283 * percentage) / 100; // 2 * PI * R = ~283

        // Define a mapping of categories to colors.
        var categoryColors = {
          'Sexual': '#f44336', // Red
          'Hate': '#9c27b0',   // Purple
          'Harassment': '#ff9800', // Orange
          'Self-harm': '#e91e63',  // Pink
          'Violence': '#f44336'     // Red
          // Add more categories and colors as needed.
        };

        // Assign color based on category.
        var color = categoryColors[category] || '#007bff'; // Default color.

        // Apply the stroke color.
        $circle.css('stroke', color);

        // Animate the stroke-dashoffset.
        setTimeout(function () {
          $circle.css('stroke-dashoffset', offset);
        }, 500); // Delay to allow page to render before animation.
      });
    }
  };
})(jQuery, Drupal);

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc