// ==UserScript== // @name WME Invalidated Camera Mass Eraser // @namespace @UCME_Myriades // @description Allow delete visible, unvalidated and in your managed area all speed camera in 1 click! // @include https://www.waze.com/editor/* // @include https://www.waze.com/*/editor/* // @icon // @version 0.4.4 // @grant WME_GB_Myriades // @downloadURL none // ==/UserScript== var wme_ucme_script_name = 'WME Unvalidated Camera Mass Eraser'; wme_ucme_version = GM_info.script.version; var wme_ucme_script_url = 'https://greasyfork.org/scripts/2377-wme-invalidated-camera-mass-eraser'; /* bootstrap, will call initialiseHighlights() */ function UCME_bootstrap(){ UCME_addLog('init'); if (typeof(unsafeWindow) === "undefined"){ unsafeWindow = ( function () { var dummyElem = document.createElement('p'); dummyElem.setAttribute('onclick', 'return window;'); return dummyElem.onclick(); }) (); } /* begin running the code! */ window.setTimeout(UCME_init, 500); } /* helper function */ function getId(node) { return document.getElementById(node); } function UCME_addLog(UCME_text){ console.log('WME_UCME_' + wme_ucme_version + ' : ' + UCME_text); } function UCME_del_cams(){ UCME_addLog('del cams called'); if(UCME_waze_Map.camerasLayer.visibility === false)return; UCME_addLog('cam layer ok'); if(UCME_waze_controler.zoom < 1)return; UCME_addLog('zoom ok'); var delCams = 0; for(var cams in UCME_waze_cameras.objects){ var the_cam = UCME_waze_cameras.objects[cams]; if(!the_cam.onScreen(the_cam)){ UCME_addLog('Cam n° : ' + cams + ' not on screen -> not deleted'); continue; } if(the_cam.attributes.validated === true){ UCME_addLog('Cam n° : ' + cams + ' already validated -> not deleted'); continue; } if(the_cam.state == 'Delete'){ UCME_addLog('Cam n° : ' + cams + ' already deleted -> do not delete again'); continue; } if(the_cam.attributes.permissions == -1){ UCME_addLog('Cam n° : ' + cams + ' is in editable area -> OK deleted'); delCams++; UCME_waze_model.actionManager.add(new UCME_Waze.Action.DeleteObject(UCME_waze_cameras.objects[cams])); } else UCME_addLog('Cam n° : ' + cams + ' is NOT in editable area -> not deleted'); } UCME_addLog('Deleted cams : ' + delCams); } function UCME_html(){ WME_UCME_addon = document.createElement('div'); WME_UCME_addon.id = 'UCME_btn'; WME_UCME_addon.innerHTML = '