361361// @compatible qq
362362// @compatible via
363363// @compatible brave
364- // @version 2025.6.4 .1
364+ // @version 2025.8.26 .1
365365// @grant GM_setValue
366366// @grant GM_getValue
367367// @grant GM_registerMenuCommand
368+ // @grant GM_unregisterMenuCommand
368369// @downloadURL https://raw.githubusercontent.com/ChinaGodMan/UserScripts/main/greasyfork-unupdated-script/greasyfork-unupdated-script.user.js
369370// @updateURL https://raw.githubusercontent.com/ChinaGodMan/UserScripts/main/greasyfork-unupdated-script/greasyfork-unupdated-script.user.js
370371// ==/UserScript==
371372
373+ /**
374+ * File: greasyfork-unupdated-script.user.js
375+ * Project: UserScripts
376+ * File Created: 2025/06/04,Wednesday 09:23:41
377+ * Author: 人民的勤务员@ChinaGodMan (china.qinwuyuan@gmail.com)
378+ * -----
379+ * Last Modified: 2025/08/26,Tuesday 22:47:48
380+ * Modified By: 人民的勤务员@ChinaGodMan (china.qinwuyuan@gmail.com)
381+ * -----
382+ * License: MIT License
383+ * Copyright © 2024 - 2025 ChinaGodMan,Inc
384+ */
385+
372386const Days = GM_getValue ( 'days' , 30 ) // 默认30天
373387const threshold = Days * 24 * 60 * 60 * 1000
374- GM_registerMenuCommand ( 'Settings ' , ( ) => {
388+ GM_registerMenuCommand ( 'Days ' , ( ) => {
375389 const userInput = prompt ( 'Enter the number of days:' , Days )
376390 if ( userInput !== null ) {
377391 const parsedInput = parseInt ( userInput , 10 )
@@ -382,14 +396,41 @@ GM_registerMenuCommand('Settings', () => {
382396 }
383397 }
384398} )
385- document . querySelectorAll ( 'dd.script-list-updated-date' ) . forEach ( function ( dd ) {
386- const relativeTime = dd . querySelector ( 'relative-time' )
387- if ( relativeTime ) {
388- const time1 = new Date ( relativeTime . getAttribute ( 'datetime' ) )
389- const time2 = new Date ( )
390- if ( time2 . getTime ( ) - time1 . getTime ( ) > threshold ) {
391- relativeTime . style . color = 'red'
392- dd . closest ( 'li' ) . style . background = '#ff000008'
399+ let menuId
400+ function Toggle ( ) {
401+ if ( menuId ) { GM_unregisterMenuCommand ( menuId ) }
402+ let HideScript = GM_getValue ( 'HideScript' , false )
403+ menuId = GM_registerMenuCommand (
404+ ( HideScript ? '✅ ' : '❌ ' ) + 'HideScript' ,
405+ ( ) => {
406+ HideScript = ! HideScript
407+ GM_setValue ( 'HideScript' , HideScript )
408+ Toggle ( )
409+ if ( ! HideScript ) {
410+ document . querySelectorAll ( 'dd.script-list-updated-date' ) . forEach ( function ( dd ) {
411+ const li = dd . closest ( 'li' )
412+ if ( li ) { li . style . display = 'list-item' }
413+ } )
414+ } else {
415+ GO ( )
416+ }
393417 }
394- }
395- } )
418+ )
419+ }
420+
421+ Toggle ( )
422+ GO ( )
423+ function GO ( ) {
424+ document . querySelectorAll ( 'dd.script-list-updated-date' ) . forEach ( function ( dd ) {
425+ const relativeTime = dd . querySelector ( 'relative-time' )
426+ if ( relativeTime ) {
427+ const time1 = new Date ( relativeTime . getAttribute ( 'datetime' ) )
428+ const time2 = new Date ( )
429+ if ( time2 . getTime ( ) - time1 . getTime ( ) > threshold ) {
430+ relativeTime . style . color = 'red'
431+ dd . closest ( 'li' ) . style . background = '#ff000008'
432+ if ( GM_getValue ( 'HideScript' , false ) ) { dd . closest ( 'li' ) . style . display = 'none' }
433+ }
434+ }
435+ } )
436+ }
0 commit comments