Clothcache Filter

Plugin for Clothcache to filter imports for jobs on the minimap

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           Clothcache Filter
// @name:de        Clothcache Filter
// @name:en        Clothcache Filter
// @author         sawyaz
// @namespace      sawyaz
// @description    Plugin for Clothcache to filter imports for jobs on the minimap
// @description:de Plugin fuer Clothcache um imports in der minimap zu filtern
// @include https://*.the-west.*/game.php*
// @include https://*.tw.innogames.*/game.php*
// @grant GM.xmlHttpRequest
// @connect support.innogames.com
// @license MIT-2.0
// @version     v0.0.2
// ==/UserScript==

TWDS.minimap.filter = function () {
    TWDS.minimap.loadconfig();
    const config = TWDS.minimap.config || {};
  
    const container = $('<div />').css({
      width: '400px',
      minHeight: '100px',
      maxHeight: '400px',
      overflowY: 'auto'
    });
    JobList.getSortedJobs("level", null, "desc").forEach(job => {
      const checkboxId = `job-checkbox-${job.name.replace(/\s+/g, '-')}`;
      const checkbox = $('<input />', {
        type: 'checkbox',
        id: checkboxId,
        checked: config[job.name] || false
      });
      const label = $('<label />', {
        for: checkboxId,
        text: job.name
      });
      container.append(checkbox).append(label).append('<br>');
    });
  
    const saveConfig = function () {
      JobList.getSortedJobs("level", null, "desc").forEach(job => {
        const checkboxId = `job-checkbox-${job.name.replace(/\s+/g, '-')}`;
        config[job.name] = $(`#${checkboxId}`).is(':checked');
      });
      TWDS.minimap.config = config;
      TWDS.minimap.saveconfig();
    };
  
    (new west.gui.Dialog('Job Filter', container)).addButton('ok', saveConfig).addButton('cancel').show();
  };