Waze Reporting Tool: remove required flag for subcategory

Because Waze is requiring you to fill in a disabled field, it is not possible to submit alerts for types without subcategories. This script should fix that.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Waze Reporting Tool: remove required flag for subcategory
// @author       Tom 'Glodenox' Puttemans
// @namespace    http://www.tomputtemans.com/
// @version      0.2
// @description  Because Waze is requiring you to fill in a disabled field, it is not possible to submit alerts for types without subcategories. This script should fix that.
// @match        https://www.waze.com/reporting*
// @grant        none
// ==/UserScript==

var container = document.querySelector('.leaflet-fullscreen');
var changeListener = new MutationObserver(function() {
  var subcategory = container.querySelector('.rep-alert-view__subtype');
  if (subcategory) {
    subcategory.required = false;
  }
});
changeListener.observe(container, {
  childList: true
});