File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11[
22 {
33 "version" : 2 ,
4- "id" : " consolidate -project-tags" ,
5- "versionAdded" : " v3.5 .0"
4+ "id" : " hide -project-tags" ,
5+ "versionAdded" : " v3.9 .0"
66 },
77 {
88 "version" : 2 ,
427427 "tags" : [" New" , " Recommended" ],
428428 "dynamic" : true
429429 },
430- {
431- "title" : " Hide Project Tags" ,
432- "description" : " Hides all linked tags in the Instructions/Notes and Credits of projects." ,
433- "credits" : [" rgantzos" ],
434- "urls" : [" https://scratch.mit.edu/users/rgantzos/" ],
435- "file" : " hide-project-tags" ,
436- "type" : [" Website" ],
437- "tags" : [" New" ],
438- "dynamic" : true
439- },
440430 {
441431 "title" : " Search Assets" ,
442432 "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