It looks like you're new here. If you want to get involved, click one of these buttons!
function highlight() { vuexStore.state.story.stories.forEach(function (story) { if (story.name == document.title) { story.passages.forEach(function (passage) { passage.tags.forEach(function (tag) { if (tagColors.hasOwnProperty(tag)) { [].forEach.call(document.getElementsByClassName("passage"), function (el) { if (el.getElementsByClassName( "title")[0].getElementsByClassName( "text")[0].innerText == passage.name) { el.style.color = tagColors[tag]; } } ); } }); }); } }); } var tagColors = { "Default":"", "Setup":"red", "Event":"cyan"}; window.setInterval(highlight, 1000);
tagColors["Forest"] = "green";Then anything tagged "Forest" will be highlighted in green.
Comments
Here's a more sane version. Also it does coloured shadows, instead of title color.
http://i.imgur.com/yhC2dUp.png
NOTE: The following is a set of more detailed instructions on how to install this hack for those wishing to, they should not be taken as either an encouragement or an endorsement for people to do so. I leave that decision up to the individual.
1. Run the Twine 2 application and open a story you wish to test either the Passage Title Colouring or Passage Frame Colouring technique on.
2. Open the application's built-in (Chrome) Developer Tools window by pressing the F12 function key on your keyboard.
3. There should be a panel labelled Console in the lower left corner of the Tools window, if there isn't then select the Console tab on the menu bar across the top of the Tools window.
note: The last instruction was written from a Windows user's point-of-view, the may need translating for people using another operating system but the point of them is to obtain access to the Javascript Console built into the Developer Tools.
4. Choose which of the two colouring techniques you want to try then click on the relevant pastebin link below.
a. Passage Title Colouring or b. Passage Frame Colouring
note: The code contained in both of the above pastebins is the same as the code supplied by @kelpsie but it has had all the white-space and line-breaks removed to make it easier to enter into the Console.
5. Highlight the contents of the RAW Paste Data section of the relevant pastbin page and copy the highlighted code into your clipboard.
note: How you do that depends on which operating system you are using, I will assume you know how to do this.
6. Paste that code into the active/last line within the Tools Console, then press the ENTER key on your keyboard. You have now created a temporary function named highlight which will persist within the Twine 2 application unto you close the application down.
7. Enter a set of tag colours pairs into the Tools Console.
These will be used later by the highlight function to colour the relevant part of each passage shown in the Story/Passage Map. Each pair is made up of:
a. The name of the passage tag you wish to use to mark a set of passages.
b. The CSS color value you want the marked set of passages to have.
The following is a copy of the relevant section of @kelpsie's example. It assigns no colour as a default, it associates red to passages tagged with Setup, and it associates cyan to passages tagged with Event.
You can replace both the Tag Names and the Color Values with your own values. ... remember to press the ENTER key after you have finished typing/cut-n-pasting your tag colour pairs in.
8. Activate the highlight function.
The following code creates a timer event which will continuously call the highlight function every second until you close down the Twine 2 application. This code needs to also be entered into the Tools Console.
note: The 1000 value is the number of milliseconds (1000th of a second) between each invocation of the highlight function, you can increase this value if you wish to. ... remember to press the ENTER key after you have finished typing/cut-n-pasting the above activation code into the console.
WARNING: You will need to do all of the above steps each time you run the Twine 2 application, as this hack is not permanent.