Permalink
Browse files

Karma. Swapping slides preserves their identifiers and my media type

hack was based off the id counter.

Now, I'm invoking a JavaScript function to hide/show the note divs by
their index w/in the list of divs (since the slides are reordered in
the Keynote file, even though their ids stay the same on a swap).
  • Loading branch information...
1 parent 2dcb2f1 commit e3f9a0640402f8c743a9e93ca9974d26b00f2e58 @tjw tjw committed Sep 22, 2009
Showing with 34 additions and 45 deletions.
  1. +11 −3 SpeakerNotes.xib
  2. +8 −8 SpeakerNotesWindowController.m
  3. BIN blitz-example.key
  4. +15 −34 presenter-notes.xsl
View
@@ -23,7 +23,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="7"/>
+ <integer value="4"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -259,7 +259,7 @@
<boolean value="NO"/>
<boolean value="NO"/>
<boolean value="NO"/>
- <boolean value="NO"/>
+ <boolean value="YES"/>
<boolean value="NO"/>
<string>Helvetica</string>
</object>
@@ -400,6 +400,14 @@
</object>
<int key="connectionID">35</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">frameLoadDelegate</string>
+ <reference key="source" ref="655178903"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">36</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -618,7 +626,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">35</int>
+ <int key="maxID">36</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -39,8 +39,7 @@ - (void)dealloc;
- (void)windowDidLoad;
{
[super windowDidLoad];
-
- self.pageIndex = 0; // set the first media style and load the results
+ [[_webView mainFrame] loadData:_htmlData MIMEType:@"text/html" textEncodingName:@"utf-8" baseURL:nil];
}
- (void)setDocument:(NSDocument *)document;
@@ -63,16 +62,17 @@ - (void)setDocument:(NSDocument *)document;
#pragma mark -
#pragma mark KVC
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)webFrame;
+{
+ // show the first set of speaker notes once we are fully loaded.
+ self.pageIndex = 0;
+}
+
@synthesize pageIndex = _pageIndex;
- (void)setPageIndex:(NSUInteger)pageIndex;
{
_pageIndex = pageIndex;
- //NSLog(@"speaker pageIndex = %lu", pageIndex);
-
- // Horrifying but easy!
- NSString *mediaStyle = [NSString stringWithFormat:@"mBGSlide%lu", _pageIndex];
- [_webView setMediaStyle:mediaStyle];
- [[_webView mainFrame] loadData:_htmlData MIMEType:@"text/html" textEncodingName:@"utf-8" baseURL:nil];
+ [[_webView windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"displayNotesForSlide(%lu);", pageIndex]];
}
#pragma mark -
View
Binary file not shown.
View
@@ -24,51 +24,32 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <!-- default all the speaker notes to hidden and positioned atop each other -->
<style type="text/css">
div.slide {
position:absolute;
display:none;
}
- /* wow, this is terrible */
- @media mBGSlide0 { #BGSlide0 { display: block; }}
- @media mBGSlide1 { #BGSlide1 { display: block; }}
- @media mBGSlide2 { #BGSlide2 { display: block; }}
- @media mBGSlide3 { #BGSlide3 { display: block; }}
- @media mBGSlide4 { #BGSlide4 { display: block; }}
- @media mBGSlide5 { #BGSlide5 { display: block; }}
- @media mBGSlide6 { #BGSlide6 { display: block; }}
- @media mBGSlide7 { #BGSlide7 { display: block; }}
- @media mBGSlide8 { #BGSlide8 { display: block; }}
- @media mBGSlide9 { #BGSlide9 { display: block; }}
- @media mBGSlide10 { #BGSlide10 { display: block; }}
- @media mBGSlide11 { #BGSlide11 { display: block; }}
- @media mBGSlide12 { #BGSlide12 { display: block; }}
- @media mBGSlide13 { #BGSlide13 { display: block; }}
- @media mBGSlide14 { #BGSlide14 { display: block; }}
- @media mBGSlide15 { #BGSlide15 { display: block; }}
- @media mBGSlide16 { #BGSlide16 { display: block; }}
- @media mBGSlide17 { #BGSlide17 { display: block; }}
- @media mBGSlide18 { #BGSlide18 { display: block; }}
- @media mBGSlide19 { #BGSlide19 { display: block; }}
- /* wolf said 20 slides dammit! */
- @media mBGSlide20 { #BGSlide20 { display: block; }}
- @media mBGSlide21 { #BGSlide21 { display: block; }}
- @media mBGSlide22 { #BGSlide22 { display: block; }}
- @media mBGSlide23 { #BGSlide23 { display: block; }}
- @media mBGSlide24 { #BGSlide24 { display: block; }}
- /* seriously, aren't you talking too fast (like I'm one to talk...) */
- @media mBGSlide25 { #BGSlide25 { display: block; }}
- @media mBGSlide26 { #BGSlide26 { display: block; }}
- @media mBGSlide27 { #BGSlide27 { display: block; }}
- @media mBGSlide28 { #BGSlide28 { display: block; }}
- @media mBGSlide29 { #BGSlide29 { display: block; }}
</style>
+ <script type="text/javascript">
+ function displayNotesForSlide(visibleIndex) {
+ slideNotes = document.body.getElementsByClassName("slide")
+ for (slideIndex = 0; slideNotes[slideIndex]; slideIndex++) {
+ slide = slideNotes[slideIndex]
+ if (slideIndex == visibleIndex) {
+ slide.style.display = 'block'
+ } else {
+ slide.style.display = 'none'
+ }
+ }
+ return slideNotes
+ }
+ </script>
</head>
<body>
<xsl:for-each select="key:slide-list/key:slide">
<div class="slide">
- <xsl:attribute name="id"><xsl:value-of select="str:replace(@sfa:ID, '-', '')"/></xsl:attribute>
<xsl:for-each select="key:notes/sf:text-storage/sf:text-body/sf:p">
<p><xsl:value-of select="text()"/></p>
</xsl:for-each>

0 comments on commit e3f9a06

Please sign in to comment.