Clear Radio Button

When clicking on a selected radio button, this script will clear it

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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.

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

// Clear Radio Button
// version 0.1 BETA!
// 2006-11-28
// by Jim Biancolo
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Show Cell Headers", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          Clear Radio Button
// @version       0.1
// @namespace     http://www.biancolo.com
// @description   When clicking on a selected radio button, this script will clear it
// @include       *
// ==/UserScript==

(function() {

  var currRadioRef = null;
  var currRadioVal = null;

  function clearRadio(event) {
    var t = event.target;

    if (isRadio(t)) {
      if ((currRadioRef==t) && currRadioVal) {
        t.checked = false;
        currRadioRef = null;
      }
    }
  }

  function getRadioState(event) {
    var t = event.target;
    
    if (isRadio(t)) {
      currRadioRef = t;
      currRadioVal = t.checked;
    }
  }

  function isRadio(ctrl) {
    return (ctrl.tagName.toUpperCase() == "INPUT" && ctrl.type == "radio");
  }

  document.documentElement.addEventListener("mousedown", getRadioState, true);
  document.documentElement.addEventListener("click", clearRadio, true);

})();