Alicorn comments on Luminosity (Twilight fanfic) discussion thread - Less Wrong
You are viewing a comment permalink. View the original post to see all comments and the full post content.
You are viewing a comment permalink. View the original post to see all comments and the full post content.
Comments (435)
I'll do a little testing and see if I can make it take file includes there. Pasting would leave the problem that the feed would require separate correction if I fix a typo or something.
Edit: I just tried a test of this and it didn't work. If anyone knows how to make RSS feeds accept file includes, please let me know (it'd be useful for Elcenia, too! HTHT already sends the new comic page through the feed, but that's just an image.)
The best solution would be to put some Javascript links on the page that change the text and background colors when you clicked on them. The downside to this would be that it would revert to default every time you went to a different chapter, though.
That Javascript is something I could reasonably write in ten minutes after I get home from work tonight. I'll do so and post it here unless someone produces a better solution before then.
Well they're all on the same domain, so it should be easy enough to cookie it up.
Thanks! I have, just barely, the coding skills to do this myself, and it was the solution I was planning to use when I got around to it - but it'd take me way more than ten minutes.
This should do it. Put a copy of jquery-1.4.2.min.js in the same directory (jQuery is a Javascript library for keeping browser compatibility bugs at bay).
This stores the color scheme in a cookie, so it's preserved when you move between chapters. The setCookie and getCookie functions came from here. Given the example, this should be pretty easy to extend for things like changing text size and margins, if you are so inclined.
This appears to work perfectly! However, it looks like the default color scheme is black on white, and I'd like it to be the other way around - what do I change to make the black background default?
Also, is there any way for changing the color scheme to bring a different set of navigation buttons in? I made some white ones (not a complete set yet) which would look much nicer than the existing ones on the white background.
That's odd - if I'm understanding it correctly it'll leave the page unchanged unless you click one of the links or have a cookie set. But it's not handling the default case explicitly, so try replacing the $(document).ready section in the code above with this:
To see what first-time visitors would see, clear your cookies. Otherwise it should remember what color it was last time.
Thanks again! :D
Yes. First, move the determination of which images to use into CSS, by making each navigation a div with its own CSS class, and making a style like
Add "class=blackBackground" to the <body> tag. Make CSS classes like this for each of the buttons and each of the background colors. Then in setColorScheme, use
And the reverse, to change the class on the body tag.
Is there a way to make this happen without having to change how the nav buttons are coded in to the body of each page? I'm doing all the styling with file includes, but the "first/prior/next/last" buttons are hardcoded into each page because the numbers change. Messing with all of them would be a medium-sized deal.
I just looked at the site, and it's failing to find jquery-1.4.2.min.js because it's looking in /chapters rather than /. Add a ../ to the <script src=...> tag or copy it into /chapters. That appears to have broken the color-changing and the default color.
You can edit images in Javascript without having classes or IDs to refer to them, using an attribute selector, like this:
This finds every image whose src attribute contains "nextBlack.png" as a substring, and changes it to ../images/nextWhite.png. Adjust URLs according to the particular names and locations of the images you're using, and put this in setColorScheme.
I just added the slash.
I am afraid I do not understand the rest of your instructions.
This comment has an entirely different meaning when you can see it's in a fanfic thread, but can only see the first few words. ;)
Good! Now your fic is artistically complete as well.
Ok, so the goal is to change the src attribute of the <img> tags in setColorScheme, when those <img> tags don't have classes or IDs to refer to them by. So the first thing to do is to add a class to them so we can refer to them by something other than the thing we're changing. We'll do that with calls to the markImagesWithClass function in the $(document).ready function. Then in setColorScheme, find all the images with a particular class, and change their src attribute to point to the right version of the image.
Replace the existing $(document).ready and setColorScheme functions with these. Adjust the file names to match the actual names and paths of your images, and add calls to markImagesWithClass and changeImage for any other images you want to change.
In case anyone else is having this problem, I've posted one solution on my blog: Using SSI in XML for RSS