77 "use strict" ;
88 const w = "undefined" === typeof unsafeWindow ? window : unsafeWindow ;
99 const sessvarMiss = "warnBase" ;
10+ const enableEventDebug = true ;
1011
1112 // const mainContentSelector = "app-wayfarer > div > mat-sidenav-container > mat-sidenav-content";
1213 const profileImageSelector = "app-root > app-wayfarer > div > wf-header > div > a" ;
247248 w . addEventListener ( "OPRSettingsLoaded" , removeInfobox ) ;
248249
249250 /* ================ Events mitloggen ======================= */
250- /*
251- const notificationCounter = 0;
252- const originalDispatchEvent = EventTarget.prototype.dispatchEvent;
253-
254- EventTarget.prototype.dispatchEvent = function(event) {
255- try {
256- const name = event.type;
257- const target = this;
258-
259- // Farbcode nach Event-Typ wählen (optional)
260- let color = "color: gray";
261- if (name.startsWith("OPR")) {color = "color: #ff08ff; font-weight: bold";} else if (name.startsWith("click")) {color = "color: #00aa00";} else if (name.startsWith("keydown") || name.startsWith("keyup")) {color = "color: #aa00aa";} else if (name.startsWith("input")) {color = "color: #ff8800";}
262-
263- // Konsolenausgabe
264- console.log(
265- `%c[Event]%c ${name}%c → %o`,
266- "color: #888; font-weight: bold",
267- color,
268- "color: #666",
269- target
270- );
271-
272- if (name.startsWith("OPR")) {
273- const jetzt = new Date().toLocaleTimeString("de-DE");
274- w.rhs.f.createNotification(jetzt + " #" + ++notificationCounter + " " + event.type, "fuchsia", {autoclose: 30});
275- }
251+ if ( enableEventDebug ) {
252+ let notificationCounter = 0 ;
253+ const originalDispatchEvent = EventTarget . prototype . dispatchEvent ;
254+
255+ EventTarget . prototype . dispatchEvent = function ( event ) {
256+ try {
257+ const name = event . type ;
258+ const target = this ;
259+
260+ // Farbcode nach Event-Typ wählen (optional)
261+ let color = "color: gray" ;
262+ if ( name . startsWith ( "OPR" ) ) { color = "color: #ff08ff; font-weight: bold" ; } else if ( name . startsWith ( "click" ) ) { color = "color: #00aa00" ; } else if ( name . startsWith ( "keydown" ) || name . startsWith ( "keyup" ) ) { color = "color: #aa00aa" ; } else if ( name . startsWith ( "input" ) ) { color = "color: #ff8800" ; }
263+
264+ // Konsolenausgabe
265+ console . log (
266+ `%c[Event]%c ${ name } %c → %o` ,
267+ "color: #888; font-weight: bold" ,
268+ color ,
269+ "color: #666" ,
270+ target
271+ ) ;
272+
273+ if ( name . startsWith ( "OPR" ) ) {
274+ const jetzt = new Date ( ) . toLocaleTimeString ( "de-DE" ) ;
275+ w . rhs . f . createNotification ( jetzt + " #" + ++ notificationCounter + " " + event . type , "fuchsia" , { autoclose : 30 } ) ;
276+ }
276277
277- } catch (err) {
278- console.error("Fehler im dispatchEvent-Hook:", err);
279- }
278+ } catch ( err ) {
279+ console . error ( "Fehler im dispatchEvent-Hook:" , err ) ;
280+ }
280281
281- // Original-Dispatch ausführen
282- return originalDispatchEvent.call(this, event);
283- };
282+ // Original-Dispatch ausführen
283+ return originalDispatchEvent . call ( this , event ) ;
284+ } ;
284285
285- const originalDispatch = w.dispatchEvent;
286- w.dispatchEvent = function(event) {
287- return originalDispatch.call(this, event);
288- };
289- */
286+ const originalDispatch = w . dispatchEvent ;
287+ w . dispatchEvent = function ( event ) {
288+ return originalDispatch . call ( this , event ) ;
289+ } ;
290+ }
290291 /* ================ Events mitloggen ======================= */
291292
292293 // === no changes needed below this line ======================
300301
301302 /* we are done :-) */
302303 console . log ( "Script loaded:" , GM_info . script . name , "v" + GM_info . script . version ) ;
304+ console . log ( "W = " , w ) ;
305+ console . dir ( w ) ;
303306
304- } ) ( ) ;
307+ } ) ( ) ;
0 commit comments