Thank you Surya! It would great if other people also update their post when a solution is found! This is quite helpful for future reference.
Mohammad On Monday, October 7, 2019 at 9:01:28 PM UTC+3:30, Surya wrote: > > Hi, > > I made a Button to toggle two Stylesheets by adding/removing the tag " > $:/tags/Stylesheet". > It is located on the RightMenu (not on my test-wiki) and contains: > <$details summary="D/m"> > D:<$fieldmangler tiddler="Seiten und Tiddler Style Desktop"> > <$button message="tm-add-tag" > param="$:/tags/Stylesheet">D</$button></$fieldmangler> > +<$fieldmangler tiddler="Seiten und Tiddler Style mobil"> > <$button message="tm-remove-tag" param="$:/tags/Stylesheet">D</$button> > </$fieldmangler> > <br/><br/><br/> > > m: > <$fieldmangler tiddler="Seiten und Tiddler Style mobil"> > <$button message="tm-add-tag" > param="$:/tags/Stylesheet">m</$button></$fieldmangler> > +<$fieldmangler tiddler="Seiten und Tiddler Style Desktop"> > <$button message="tm-remove-tag" param="$:/tags/Stylesheet">m</$button> > </$fieldmangler> > </$details> > > When I click on it, it expands and shows 4 Buttons: 2 for Desktop (adding > "$:/tags/Stylesheet" to the Stylesheet "Desktop" and removing that tag > from the Stylesheet "mobil") and 2 for mobile (doing the same the other way > round). > > That works, but I would like to have only *one Button*. First Clicking on > this Button would add "$:/tags/Stylesheet" to the Stylesheet "Desktop" > and removing that tag from the Stylesheet "mobil". And the second click > would do the same the other way round. > > Maybe it could be possible with the Cycle tags?: > D<$tiddler tiddler="Seiten und Tiddler Style Desktop"> > <<cycletags "foo bar">> > m<$tiddler tiddler="Seiten und Tiddler Style mobil"> > <<cycletags "bar foo">> > </$tiddler> > > > or maybe with $:/plugins/matabele/mangletags?- but I couldn't bring it to > work, not at all. > > > You can test and play with it at http://suryas-testwiki.tiddlyspot.com/ > > Thanks for your help! > Surya > > > *Update: It is solved :-) With this:* > > My toggle-button - solution now is only one tiddler. Code: > \define SwapActiveStyle(style1,style2) > <$fieldmangler tiddler="$style1$"> > <$action-sendmessage $message="tm-add-tag" $param="$:/tags/Stylesheet"/> > </$fieldmangler> > <$fieldmangler tiddler="$style2$"> > <$action-sendmessage $message="tm-remove-tag" $param="$:/tags/Stylesheet > "/> > </$fieldmangler> > \end > > \define swapper(style1,style2) > <$vars sheet="$:/tags/Stylesheet"> > <$list filter="[[$style1$]tag<sheet>]"> > <$button><$text text="""<m"""/> > <<SwapActiveStyle """$style2$""" """$style1$""">> > </$button> > </$list> > <$list filter="[[$style2$]tag<sheet>]"> > <$button><$text text=""">D"""/> > <<SwapActiveStyle """$style1$""" """$style2$""">> > </$button> > </$list> > </$vars> > \end > > <<swapper DesktopStyle mobilStyle>> > > The tiddler "DesktopStyle" is for optimized view & handling on the Laptop. > And the tiddler "mobilStyle" for optimized view & handling on my tablet. > And Birthes code lets the sidebar to behave like expected: > <<if-no-sidebar " > > .tc-story-river { > width: calc(100% - {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}}); > } > > .tc-tiddler-frame { > width: 100%; > } > ">> > > Maybe, these codes helps other people too... > Surya > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c5627be1-95df-423b-b0f1-cb547ab6a675%40googlegroups.com.

