File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[
2+ {
3+ "version" : 2 ,
4+ "id" : " hide-project-tags" ,
5+ "versionAdded" : " v3.9.0"
6+ },
27 {
38 "version" : 2 ,
49 "id" : " snap-to-grid" ,
517522 "tags" : [" New" , " Recommended" ],
518523 "dynamic" : true
519524 },
520- {
521- "title" : " Hide Project Tags" ,
522- "description" : " Hides all linked tags in the Instructions/Notes and Credits of projects." ,
523- "credits" : [" rgantzos" ],
524- "urls" : [" https://scratch.mit.edu/users/rgantzos/" ],
525- "file" : " hide-project-tags" ,
526- "type" : [" Website" ],
527- "tags" : [" New" ],
528- "dynamic" : true
529- },
530525 {
531526 "title" : " Search Assets" ,
532527 "description" : " Search through costume and sound assets in the editor." ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ {
2+ "title" : " Hide Project Tags" ,
3+ "description" : " Hides all linked tags in the Instructions/Notes and Credits of projects." ,
4+ "credits" : [
5+ {
6+ "username" : " MaterArc" ,
7+ "url" : " https://scratch.mit.edu/users/MaterArc/"
8+ },
9+ {
10+ "username" : " rgantzos" ,
11+ "url" : " https://scratch.mit.edu/users/rgantzos/"
12+ }
13+ ],
14+ "type" : [
15+ " Website"
16+ ],
17+ "tags" : [
18+ " New" ,
19+ " Featured"
20+ ],
21+ "scripts" : [
22+ {
23+ "file" : " script.js" ,
24+ "runOn" : " /projects/*"
25+ }
26+ ],
27+ "dynamic" : true ,
28+ "options" : [{ "id" : " remove-dupes" , "name" : " Hide Duplicate Tags" , "type" : 1 }]
29+ }
Original file line number Diff line number Diff line change 1+ export default async function ( { feature, console } ) {
2+ let ALL_TAGS = [ ]
3+
4+ ScratchTools . waitForElements ( '.project-description a[href*="/search/projects?q="]:not(.scratchtoolsTag)' , function ( tag ) {
5+ if ( tag . textContent ?. startsWith ( "#" ) ) {
6+ ALL_TAGS . push ( {
7+ tag,
8+ content : tag . textContent . toLowerCase ( ) ,
9+ } )
10+
11+ update ( )
12+ }
13+ } )
14+
15+ function update ( ) {
16+ if ( feature . self . enabled ) {
17+ let dupesOnly = feature . settings . get ( "remove-dupes" )
18+
19+ if ( dupesOnly ) {
20+ for ( var i in ALL_TAGS ) {
21+ if ( ALL_TAGS . filter ( ( tag ) => tag . content === ALL_TAGS [ i ] . content ) [ 0 ] . tag === ALL_TAGS [ i ] . tag ) {
22+ if ( ALL_TAGS [ i ] . tag ?. style ) {
23+ ALL_TAGS [ i ] . tag . style . display = null
24+ }
25+ } else {
26+ if ( ALL_TAGS [ i ] . tag ?. style ) {
27+ ALL_TAGS [ i ] . tag . style . display = "none"
28+ }
29+ }
30+ }
31+ } else {
32+ for ( var i in ALL_TAGS ) {
33+ if ( ALL_TAGS [ i ] . tag ?. style ) {
34+ ALL_TAGS [ i ] . tag . style . display = "none"
35+ }
36+ }
37+ }
38+ } else {
39+ for ( var i in ALL_TAGS ) {
40+ if ( ALL_TAGS [ i ] . tag ?. style ) {
41+ ALL_TAGS [ i ] . tag . style . display = null
42+ }
43+ }
44+ }
45+ }
46+
47+ feature . settings . addEventListener ( "changed" , update )
48+ feature . addEventListener ( "disabled" , update )
49+ feature . addEventListener ( "enabled" , update )
50+ }
You can’t perform that action at this time.
0 commit comments