Re: Remove "Restart Story" from Jonah and remove titles but not rewind to here

739 views
Skip to first unread message

HarmlessTrouble

unread,
Feb 26, 2013, 4:22:54 AM2/26/13
to twee...@googlegroups.com
1) If your ok with editing a little html you could delete or replace the Restart Story link in the Jonah header.html file or the Output specifically.

replace
<p><a href="javascript:state.restart()">Restart Story</a></p>
with 
<p><a href="javascript:window.location='';">Restart Story</a></p>

or use a diffrent version
The latest Twine alpha's Jonah has a working restart() that preserves bookmark position. 

2) I tried a few things with styles and came to the conclusion that this part of the DOM tree could just be changed.  Here's an override passage for the render function.

::Jonah render Override [script]
Passage.prototype.render = function(){
var E=insertElement(null,'div','passage'+this.title,'passage');
E.style.visibility='hidden';
if(this.tags != null && this.tags.length > 0) E.setAttribute('data-tags', this.tags.join(' '));
var F=insertElement(E,'div','','title');
/*var G = insertElement(F,'span','','',this.title);*/
var D = insertElement(F,'span','','toolbar');
for(var B=0;B<Passage.toolbarItems.length;B++) {
var C=insertElement(D,'a');
insertText(C,Passage.toolbarItems[B].label(E));
C.passage=this;
if(Passage.toolbarItems[B].href){
C.href=Passage.toolbarItems[B].href(E)
} else {
C.href='javascript:void(0)';
}
C.title=Passage.toolbarItems[B].tooltip(E);
C.onclick=Passage.toolbarItems[B].activate
}
var A=insertElement(E,'div','','body');
new Wikifier(A, this.text);
E.onmouseover = function() { E.className += ' selected'; };
E.onmouseout = function(){ E.className = E.className.replace(' selected', ''); };
return E
};

Un-comment  /* */ the title line starting with "var G =" to re-enable the title in Jonah.

Nicholas Jenkins

unread,
Feb 28, 2013, 8:14:02 AM2/28/13
to twee...@googlegroups.com
Now I would just need to know how to actually use what you just told me. All I can seem to do on my own is remove the footer but only that by itself. I'm not sure where I'm supposed to read how to learn how to do all of this things because I've been over the help page and still have nothing. If you wouldn't mind, could you tell me how to put this into Twine?

HarmlessTrouble

unread,
Feb 28, 2013, 9:21:57 AM2/28/13
to twee...@googlegroups.com
 
2) I tried a few things with styles and came to the conclusion that this part of the DOM tree could just be changed.  Here's an override passage for the render function.

::Jonah render Override [script]
Passage.prototype.render = function(){
var E=insertElement(null,'div','passage'+this.title,'passage');
E.style.visibility='hidden';
if(this.tags != null && this.tags.length > 0) E.setAttribute('data-tags', this.tags.join(' '));
var F=insertElement(E,'div','','title');
/*var G = insertElement(F,'span','','',this.title);*/
var D = insertElement(F,'span','','toolbar');
for(var B=0;B<Passage.toolbarItems.length;B++) {
var C=insertElement(D,'a');
insertText(C,Passage.toolbarItems[B].label(E));
C.passage=this;
if(Passage.toolbarItems[B].href){
C.href=Passage.toolbarItems[B].href(E)
} else {
C.href='javascript:void(0)';
}
C.title=Passage.toolbarItems[B].tooltip(E);
C.onclick=Passage.toolbarItems[B].activate
}
var A=insertElement(E,'div','','body');
new Wikifier(A, this.text);
E.onmouseover = function() { E.className += ' selected'; };
E.onmouseout = function(){ E.className = E.className.replace(' selected', ''); };
return E
};
 
  1. Create a Passage and name it "Jonah render override" (or what ever you want) 
  2. Add [script] without the brackets to the tag field.
  3. Paste in the code block above into the passage.
  4. When you run the story the passage title should be gone.  
Probably not the most elegant way of doing this, 20 some lines just to get Jonah to NOT render one thing is just not efficient. 

- Henry

Nicholas Jenkins

unread,
Mar 1, 2013, 8:34:53 AM3/1/13
to twee...@googlegroups.com
I got them both to work, thanks for the help.

HarmlessTrouble

unread,
Mar 2, 2013, 4:46:25 AM3/2/13
to twee...@googlegroups.com
The way Jonah is currently structured, the toolbar is inside the .title div.  Hiding it hides the toolbar too.  Which is not what Nicholas was shooting for. 

- Henry

Andy Lin

unread,
Mar 2, 2013, 10:16:54 AM3/2/13
to twee...@googlegroups.com
Oh right, I completely misunderstood his intent. Thanks for the code; I'd been wondering how to change parts of the output routine.

-Andy

Neil

unread,
Jan 23, 2015, 1:31:59 PM1/23/15
to twee...@googlegroups.com

I know I'm replying to a two-year-old post, but I'm hoping someone will still be around who can answer.  I am currently trying to do the exact same thing that Nicholas previously asked about.  I tried putting this code in a Script Passage exactly as you described, but it doesn't work.  Instead, when I try to build the story and run it, my browser throws up a window that says the "story's code has got itself in a mess," and it won't run at all. 

I'm sure I'm creating the script passage correctly, because I have successfully done that with other scripts.  Is there any chance this code is not compatible with Twine version 1.4.2?  Is there some other way to achieve the same effect?

Thanks!
Neil
Reply all
Reply to author
Forward
0 new messages