Forgive me in advance if I seem to be rambling, I have several questions today, but I think they are all tied together.
I stumbled upon tw5gray, a 2-3 -year-old TW (5.0.5 beta) the other day and was intrigued by the author's method of setting colors, etc through the use of (transcluding? (I've still not wrapped my head around that whole area of TW, yet)) values into other, individual tiddlers. I've since discovered that this is apparently the common practice that Jeremy uses to change some of the settings through the stock Control Panel (but it still looks like Black Magic to me :) ). (As an aside, the thought occurred to me that this might be the ideal way to construct a Theme Constructor (for lack of a better name), whereby all the little nit-picking aspects of the interface could be displayed and changed?)
The author has several $:/themes/grayeul/etch/??? tiddlers, each with values for different parts of the interface, base, colourmappings, colours, settings and tooltips. I took just the colours tiddler and recreated it in my TW for testing:
{
"primary": "#000000",
"background": "#fff",
"foreground": "#333",
"pagebackground": "#ececec",
"medium": "#bbb",
"hoverbut": "blue"
}
The changes are made through a $:/ControlPanel/ThemeTweaks
tiddler which contains what looked to be very simple <edit-text> entries:
! Base Colours
* Primary colour: <$edit-text
tiddler="$:/themes/grayeul/etch/colours"
index="primary"
type="color"
default=""
tag="input"/>
* Background colour: <$edit-text
tiddler="$:/themes/grayeul/etch/colours"
index="background"
type="color"
default=""
tag="input"/>
* Foreground colour: <$edit-text
tiddler="$:/themes/grayeul/etch/colours"
index="foreground"
type="color"
default=""
tag="input"/>
* Page background colour: <$edit-text
tiddler="$:/themes/grayeul/etch/colours"
index="pagebackground"
type="color"
default=""
tag="input"/>
* Medium contrast color: <$edit-text
tiddler="$:/themes/grayeul/etch/colours"
index="medium"
type="color"
default=""
tag="input"/>I went back and looked at the structure of the $:/themes/grayeul/etch/colours file and saw that items were enclosed in quotation marks, denoting some sort of a structured index, but try as I might, I cannot decipher it enough to add my own values, especially the one I'm most interested in right now, the background property.
If I leave it intact as the author created it, it seems to work fine, allowing me to change any/all of the six entries that are in it. I just cannot add any of my own.
This is for a movie database of sorts that I'm working on. Each tiddler is a different movie, with synopsis, screenshots, posters/dvd covers, etc. Today I would like to accomplish two things:
Please tell me that there is a way to 'inject' the background image declaration into either the Stylesheet tiddler, or if worst comes to worst, I can create stylesheet-tagged tiddlers –one for each screenshot that I want to use as a page background– with a link to the external screenshot, as long as they will override whatever background might have been on the page before.
I stumbled upon tw5gray, a 2-3 -year-old TW (5.0.5 beta) the other day
This is for a movie database of sorts that I'm working on. Each tiddler is a different movie, with synopsis, screenshots, posters/dvd covers, etc. Today I would like to accomplish two things:
- Have a pre-selected screenshot come up as the background image for the page whenever the tiddler is opened;
- Also have a drop-down list available (perhaps in the SideBar) with links to external graphics (the pre-selected screenshots from all/most of the movies, listed as the movie's title) that the user can choose from and it will immediately become the background image of the page.
Please tell me that there is a way to 'inject' the background image declaration into either the Stylesheet tiddler, or if worst comes to worst, I can create stylesheet-tagged tiddlers –one for each screenshot that I want to use as a page background– with a link to the external screenshot, as long as they will override whatever background might have been on the page before.
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/44e455b8-e868-42d1-845e-7037391f733c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Zaphod
This is for a movie database of sorts that I'm working on. Each tiddler is a different movie, with synopsis, screenshots, posters/dvd covers, etc. Today I would like to accomplish two things:
- Have a pre-selected screenshot come up as the background image for the page whenever the tiddler is opened;
This is a complicated requirement, and not easy to achieve. There’s nowhere else in the core or elsewhere that we have a similar technique of making a global style change in response to a particular tiddler being opened.The approach I would suggest would be to use the current tiddler field of the $:/HistoryList tiddler to transclude an image tiddler. You’d have to arrange the titles of the image tiddlers to be related to the titles of the tiddlers you’re viewing (eg adding `-image` on the end).
- Also have a drop-down list available (perhaps in the SideBar) with links to external graphics (the pre-selected screenshots from all/most of the movies, listed as the movie's title) that the user can choose from and it will immediately become the background image of the page.
That’s a good deal easier - you can see something very similar in the Theme Tweaks tab of Control Panel. You can copy the code from there and just modify the filter of images to limit it to your screenshot tiddlers.
Sorry in advance if my questions sound dense, but I've seen some amazing things accomplished by your wonderful creation, and find it hard to believe that this simple 'feat' is this hard to overcome.
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/0eb6255a-18b6-4504-9919-2afeafa5cc79%40googlegroups.com.
Hi Zaphod
I’ll pick up the end of your comments first:Sorry in advance if my questions sound dense, but I've seen some amazing things accomplished by your wonderful creation, and find it hard to believe that this simple 'feat' is this hard to overcome.First, it’s positively encouraged to ask questions here. It’s when people engage in back and forth discussion that knowledge and techniques get teased out, here in the open where anyone can join in. There’s a good chance that while I’m typing this somebody else will dive in with ready-to-use code for the needs you describe.Secondly, addressing why this apparently simple feat is hard to achieve. There’s a double whammy here: what you want to do is not directly supported by the core, which means that there is no ready-to-use mechanism. The second part is that what you want to do is in the domain of CSS. The trouble here is that understanding CSS requires an understanding of HTML, and both are quite complex. TiddlyWiki does a little to ease writing CSS, but it doesn’t really attempt to hide the true, horrific nature of CSS.
So, as a beginner you’ve got the complexities of CSS/HTML and TiddlyWiki multiplied together, and therefore quite a mountain to climb to implement relatively complex new features.
As I said at the beginning, there’s a good chance that someone else in the community can help with your immediate needs, as they have in other threads. But the best response to the situation may be to keep on digging into TiddlyWiki, and learn as much as you can by example :)Anyhow, in particular, you’ll need to understand transclusion, and the way that it is used in stylesheets to fully implement the solution. But a key part is that the CSS syntax for using an external image as a background is different;background-image: url(http://www.example.com/bck.png);So, if you’ve got the image URL readily accessible, it’s pretty easy to set the background colour for an element.
Best wishesJeremy
Hi Zaphod,In my opinion, you will be better off using external images - meaning that you serve your own copy of the images you want, but alongside the tiddlywiki, not inside it.
I think this is better becasue a) it's a bit rude to load other people's resources routinely (I know this isn't a huge concern these days)
c) it makes what you're trying to do easy instead of difficult.
Externalising your images using the Node configuration is really easy and the instructions are on Tiddlywiki.com but I also wrote a tool, which I will post to the group soon that lets you manage external images from inside the single-file app. They behave like regular tiddlers but the payload is external and so doesn't weigh down your file.
BTW, 20-50kb per tiddler sounds a bit excessive - you should consider having only the basics inside each record tiddler and then using template tiddlers to add the fancy ui.
<html>
<div class="SearchTerms"></div>
<div class="Post">
<div class="Container">
<div class="CoverLeft"><img width="40" src="http://i.imgur.com/bFw3goc.jpg" title="Genuine Zaphod-Rip" alt="Genuine Zaphod-Rip"> <img src="http://i.imgur.com/2Fj0Cnj.png" alt="Warner Archive Collection" title="Warner Archive Collection"> <img width="50" src="http://i.imgur.com/tbvCWGe.png" alt="20th Century Fox Cinema Archives" title="20th Century Fox Cinema Archives"> <img width="40" src="http://i.imgur.com/EhU4tBM.png" alt="Disney DVD" title="Disney DVD"> <img width="50" src="http://i.imgur.com/sSOU3JI.png" alt="Alpha Video" title="Alpha Video"> <img width="40" src="http://i.imgur.com/RBmDcu1.png" alt="Feature Films for Families" title="Feature Films for Families"> <img width="40" src="http://i.imgur.com/qMR8dGs.png" alt="Children's Film and Television Foundation (CFF)" title="Children's Film and Television Foundation (CFF)"> <img width="50" src="http://i.imgur.com/VPNuLyZ.jpg" alt="MGM Limited Edition Collection" title="MGM Limited Edition Collection"><p></p><br><p></p><br><p></p><span id="Contrib">This Item Courtesy of<p></p><span id="ContBord">CONTRIBUTOR</span><p></p>Thank You! </span>,,<img src="http://i.imgur.com/WgjjEap.gif">,,<p></p></div><!-- CoverLeft -->
<div class="CoverMiddle"><a href="FULLSIZE" target="_blank"><img alt="Cover Art" title="Cover Art" src="THUMBNAIL"></a></div><!-- CoverMiddle -->
<div class="CoverRight"><a href="FULLSIZE" target="_blank"><img alt="Cover Art" title="Cover Art" src="THUMBNAIL"></a><p></p><br><p></p><br><p></p><span id="BoldGreen">aka or Original Title<br>""</span></div><!-- CoverRight -->
</div><!-- Container -->
<div class="FloatClear"></div>
<div class="IMDb"><a href="IMDb URL" target="_blank"><img width="100" alt="IMDb Logo" title="IMDb Logo" src="http://i.imgur.com/sI6cPld.png"></a></div><!-- IMDb -->
<p></p>
<div class="Container">
<div class="Tagline">TAGLINE</div><!-- Tagline -->
</div><!-- Container -->
<p></p>
<div class="Container">
<div class="Synopsis"><span class="FirstWord">FIRSTWORD</span> </div><!-- Synopsis -->
<div class="Extras">
<span id="HeaderRed">DVD Extras:</span><br>
<ul>
<li> <span style="font-weight: normal;">()</span></li>
<li> <span style="font-weight: normal;">()</span></li>
<li> <span style="font-weight: normal;">()</span></li>
<li> <span style="font-weight: normal;">()</span></li>
<li> <span style="font-weight: normal;">()</span></li>
</ul>
</div><!-- Extras -->
</div><!-- Container -->
<div class="FloatClear"></div>
<p></p>
<div class="QuoteBox1"><span id="HeaderBlue">HEADER:</span> </div><!-- QuoteBox1 -->
<p></p>
<div class="TechWrapper">
<div class="TechTable">
<div class="row header red">
<div class="cell"><span class="skew">Origin</span></div>
<div class="cell"><span class="skew">Filesize</span></div>
<div class="cell"><span class="skew">Format</span></div>
<div class="cell"><span class="skew">Dimensions</span></div>
<div class="cell"><span class="skew">Audio</span></div>
<div class="cell"><span class="skew">Subtitles</span></div>
</div><!-- row header red -->
<div class="row">
<div class="cell">ORIGIN</div>
<div class="cell"> Bytes</div>
<div class="cell">screen</div>
<div class="cell"> x </div>
<div class="cell">English</div>
<div class="cell">NONE</div>
</div><!-- row -->
</div><!-- table -->
<div class="Container">
<div class="SSButton"><$reveal type="nomatch" state="$:/SampleRevealState3" text="show">
<!-- ============ SPACE ============ -->
<$button class="SSB1" set="$:/SampleRevealState3" setTo="show"><img src="LEFT GRAPHIC"> Screenshots <img src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
</$reveal>
<$reveal type="match" state="$:/SampleRevealState3" text="show">
<!-- ============ SPACE ============ -->
<$button class="SSB2" set="$:/SampleRevealState3" setTo="hide"><img src="LEFT GRAPHIC"> Close <img src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
<div class="SSButtonInner">
<span id="MSD">Menu Screens</span>
<p></p>
SCREENSHOTS GO HERE
</div><!-- SSButtonInner -->
</$reveal>
</div><!-- SSButton -->
</div><!-- Container -->
<div style="Container">
<div class="BAButton"><$reveal type="nomatch" state="$:/SampleRevealState1" text="show">
<!-- ============ SPACE ============ -->
<$button class="BAB1" set="$:/SampleRevealState1" setTo="show"><img height="50" src="LEFT GRAPHIC"> Actor(s) <img height="50" src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
</$reveal>
<$reveal type="match" state="$:/SampleRevealState1" text="show">
<!-- ============ SPACE ============ -->
<$button class="BAB2" set="$:/SampleRevealState1" setTo="hide"><img height="50" src="LEFT GRAPHIC"> Close <img height="50" src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
<div class="BAButtonInner">
<div class="BATable">
<div class="BARow"><div class="BALink"><a href="">ACTOR</a></div><div class="BAEllipsis"> …… </div><div class="BAName">ROLE</div></div>
<div class="BARow"><div class="BALink"><a href="">ACTOR</a></div><div class="BAEllipsis"> …… </div><div class="BAName">ROLE</div></div>
<div class="BARow"><div class="BALink"><a href="">ACTOR</a></div><div class="BAEllipsis"> …… </div><div class="BAName">ROLE</div></div>
<div class="BARow"><div class="BALink"><a href="">ACTOR</a></div><div class="BAEllipsis"> …… </div><div class="BAName">ROLE</div></div>
<div class="BARow"><div class="BALink"><a href="">ACTOR</a></div><div class="BAEllipsis"> …… </div><div class="BAName">ROLE</div></div>
<br>
</div><!-- BATable -->
ADDENDUM<br>
</div><!-- BAButtonInner -->
<!-- ============ SPACE ============ -->
</$reveal>
</div><!-- BAButton -->
<!-- =============================================== -->
<div class="DLButton"><$reveal type="nomatch" state="$:/SampleRevealState2" text="show">
<!-- ============ SPACE ============ -->
<$button class="DLB1" set="$:/SampleRevealState2" setTo="show"><img height="50" src="LEFT GRAPHIC"> Download Links <img height="50" src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
</$reveal>
<$reveal type="match" state="$:/SampleRevealState2" text="show">
<!-- ============ SPACE ============ -->
<$button class="DLB2" set="$:/SampleRevealState2" setTo="hide"><img height="50" src="LEFT GRAPHIC"> Close <img height="50" src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
<div class="DLButtonInner">
<p></p>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<a href="" target="_blank"></a><br>
<p></p>
</div><!-- DLButtonInner -->
</$reveal>
</div><!-- DLButton -->
</div><!-- TechWrapper -->
<div class="FloatClear"></div>
<div class="Container">
<div class="EPButton"><$reveal type="nomatch" state="$:/SampleRevealState4" text="show">
<!-- ============ SPACE ============ -->
<$button class="EPB1" set="$:/SampleRevealState4" setTo="show"><img src="LEFT GRAPHIC"> Ephemera <img src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
</$reveal>
<$reveal type="match" state="$:/SampleRevealState4" text="show">
<!-- ============ SPACE ============ -->
<$button class="EPB2" set="$:/SampleRevealState4" setTo="hide"><img src="LEFT GRAPHIC"> Close <img src="RIGHT GRAPHIC"></$button>
<!-- ============ SPACE ============ -->
<div class="EPButtonInner">
<div class="EPWrapper">
<div class="EPHeader"><img src="http://i.imgur.com/A7NvL35.png"></div>
<div class="EPContent">POSTER</div>
<div class="EPContent">POSTER</div>
<div class="EPContent">POSTER</div>
</div><!-- EPWrapper -->
<hr id="hrthick">
<div class="EPWrapper">
<div class="EPHeader"><img src="http://i.imgur.com/ZJiFNlg.png"></div>
<div class="EPContent">LOBBY CARD</div>
<div class="EPContent">LOBBY CARD</div>
<div class="EPContent">LOBBY CARD</div>
</div><!-- EPWrapper -->
<hr id="hrthick">
<div class="EPWrapper">
<div class="EPHeader"><img src="http://i.imgur.com/v9r2fN8.jpg"></div>
<div class="EPContent">DVD COVER</div>
<div class="EPContent">DVD COVER</div>
<div class="EPContent">DVD COVER</div>
</div><!-- EPWrapper -->
<hr id="hrthick">
<div class="EPWrapper">
<div class="EPHeader"><img src="http://i.imgur.com/oaTM0xH.png"></div>
<div class="EPContent">MISC</div>
<div class="EPContent">MISC</div>
<div class="EPContent">MISC</div>
</div><!-- EPWrapper -->
</div><!-- EPButtonInner -->
</$reveal>
</div><!-- EPButton -->
</div><!-- Container -->
</div><!-- Container -->
</div><!-- Post -->
</html>
I have an arbitrary field on several tiddlers, called bgimage. It references a background image.
In ViewTemplate, I have defined a macro (immediately after where frame-classes is defined):
\define bgstyle()
background-image:url(<$transclude field='bgimage'/>);
\end
If I call <<bgstyle>> (again, in ViewTemplate) as content of my tiddler, it works like I'd expect. It pulls the value from the bgimage field and writes it in.
!!<span style="font-weight: bold; color: #FF0000;">Some Descriptive Title or Text of Your Choosing</span>
<hr>
<$linkcatcher to="$:/themes/tiddlywiki/vanilla/settings/backgroundimage">
<div style="border: 2px solid silver; border-radius: 10px; height: 355px; overflow: auto;"><$list filter="[tag[Background]sort[title]]">
<$macrocall $name="linkimg" tiddler=<<currentTiddler>> image=<<currentTiddler>> tooltip=<<currentTiddler>> width="115"/>
</$list>
</div>
<hr>
<$link to="">
<$button>Blank Background</$button>
</$link>
</$linkcatcher>!!<span style="font-weight: bold; color: #FF0000;">Some Descriptive Title or Text of Your Choosing</span>
<hr>
<$linkcatcher to="$:/themes/tiddlywiki/vanilla/settings/backgroundimage">
o $:/themes/tiddlywiki/vanilla/settings/backgroundimage, which is the tiddler responsible for displaying the background of the TW.
<div style="border: 2px solid silver; border-radius: 10px; height: 355px; overflow: auto;">
Next, we're creating an auto-scrolling div that's 355 pixels high (the height of three rows of background images, whose widths are set at 115 pixels by the linkimg macro) (this works out just right for me on a 1920 x 1024 display, with my SideBar resized to 435 pixels wide - You'll have to adjust the numbers to obtain the 'perfect' layout for your screen resolution and TW), and has a 2-pixel solid silver border, with a rounded ratio of 10 pixels.<$list filter="[tag[Background]sort[title]]"><$macrocall $name="linkimg" tiddler=<<currentTiddler>> image=<<currentTiddler>> tooltip=<<currentTiddler>> width="115"/></$list></div><hr><$link to="">
<$button>Blank Background</$button>
</$link>
</$linkcatcher>