File tree Expand file tree Collapse file tree 5 files changed +60
-2
lines changed
Expand file tree Collapse file tree 5 files changed +60
-2
lines changed Original file line number Diff line number Diff line change 122122}
123123
124124.feature input {
125- color : var (--color );
125+ color : var (--primary- color );
126126 background-color : var (--feature-input-bg );
127127 padding-left : 1rem !important ;
128128}
233233 border-radius : 1rem ;
234234 outline : none;
235235 border : 0px ;
236- color : white ;
236+ color : var ( --primary-color ) ;
237237 background-color : var (--feature-input-bg );
238238}
239239
Original file line number Diff line number Diff line change @@ -769,6 +769,7 @@ async function getFeatures() {
769769 ] ;
770770 input . value = optionData || "" ;
771771 input . placeholder = `Enter ${ input . type } ` ;
772+ input . dataset . validators = JSON . stringify ( option . validators || { } )
772773 var optionDiv = document . createElement ( "div" ) ;
773774 optionDiv . className = "option" ;
774775 var label = document . createElement ( "label" ) ;
@@ -799,6 +800,7 @@ async function getFeatures() {
799800 var validation = JSON . parse ( atob ( this . dataset . validation ) ) ;
800801 var ready = true ;
801802 var input = this ;
803+ let validators = JSON . parse ( this . dataset . validators )
802804 validation . forEach ( function ( validate ) {
803805 if ( ready ) {
804806 input . style . outline = "none" ;
@@ -822,6 +824,16 @@ async function getFeatures() {
822824 }
823825 } ) ;
824826 if ( ready ) {
827+ if ( validators . min ) {
828+ if ( this . value < validators . min ) {
829+ this . value = validators . min
830+ }
831+ }
832+ if ( validators . max ) {
833+ if ( this . value > validators . max ) {
834+ this . value = validators . max
835+ }
836+ }
825837 if ( this . type !== "checkbox" ) {
826838 finalValue = this . value ;
827839 } else {
Original file line number Diff line number Diff line change 1+ {
2+ "title" : " Custom Monitor Opacity" ,
3+ "description" : " Set the opacity of variables and lists on the stage to a custom number." ,
4+ "credits" : [
5+ { "username" : " rgantzos" , "url" : " https://scratch.mit.edu/users/rgantzos/" }
6+ ],
7+ "tags" : [],
8+ "scripts" : [{ "file" : " script.js" , "runOn" : " /projects/*" }],
9+ "dynamic" : true ,
10+ "options" : [
11+ {
12+ "id" : " monitor-opacity" ,
13+ "name" : " Monitor Opacity (0% - 100%)" ,
14+ "type" : 2 ,
15+ "validators" : {
16+ "min" : 0 ,
17+ "max" : 100
18+ }
19+ }
20+ ],
21+ "type" : [" Website" , " Editor" ]
22+ }
Original file line number Diff line number Diff line change 1+ export default async function ( { feature, console } ) {
2+ let MONITORS = [ ]
3+
4+ feature . page . waitForElements ( "div.monitor-overlay[class*='monitor-list_monitor-list_']" , function ( monitors ) {
5+ MONITORS . push ( monitors )
6+
7+ monitors . style . opacity = feature . self . enabled ? ( ( ( feature . settings . get ( "monitor-opacity" ) ) || 0 ) / 100 ) . toString ( ) : "100%"
8+ } )
9+
10+ function updateMonitors ( opacity ) {
11+ for ( var i in MONITORS ) {
12+ MONITORS [ i ] . style . opacity = feature . self . enabled ? ( ( ( feature . settings . get ( "monitor-opacity" ) ) || 0 ) / 100 ) . toString ( ) : "100%"
13+ }
14+ }
15+
16+ feature . addEventListener ( "enabled" , updateMonitors )
17+ feature . addEventListener ( "disabled" , updateMonitors )
18+ feature . settings . addEventListener ( "changed" , updateMonitors )
19+ }
Original file line number Diff line number Diff line change 11[
2+ {
3+ "version" : 2 ,
4+ "id" : " change-monitor-opacity" ,
5+ "versionAdded" : " v4.0.0"
6+ },
27 {
38 "version" : 2 ,
49 "id" : " custom-explore" ,
You can’t perform that action at this time.
0 commit comments