adding in share button in html

This commit is contained in:
Roy Yang 2012-06-22 13:15:31 -07:00
parent f84bd87d62
commit b1bf359c3a
5 changed files with 179 additions and 54 deletions

View file

@ -146,8 +146,8 @@
sharingHtmlString = [NSString stringWithFormat:@
"<div class='NB-share-header'></div>"
"<div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'>"
"<a class='NB-share-button' href='share://share'><span class='NB-share-icon'></span>Share this story</a>"
"<a class='NB-save-button' href='save://save'><span class='NB-save-icon'></span>Save this story</a>"
"<a class='NB-share-button' href='nb-share://share-link'><span class='NB-share-icon'></span>Share this story</a>"
// "<a class='NB-save-button' href='save://save'><span class='NB-save-icon'></span>Save this story</a>"
"</div></div>"];
NSString *story_author = @"";
if ([appDelegate.activeStory objectForKey:@"story_authors"]) {
@ -182,12 +182,12 @@
[appDelegate.activeStory objectForKey:@"story_title"],
story_author,
story_tags];
NSString *htmlString = [NSString stringWithFormat:@"<html><head>%@ %@</head><body onload='init()'>%@<div class=\"NB-story\">%@ </div></body></html>",
NSString *htmlString = [NSString stringWithFormat:@"<html><head>%@ %@</head><body onload='init()'>%@<div class=\"NB-story\">%@ </div>%@</body></html>",
universalImgCssString,
customImgCssString,
storyHeader,
[appDelegate.activeStory objectForKey:@"story_content"]//,
//sharingHtmlString
[appDelegate.activeStory objectForKey:@"story_content"],
sharingHtmlString
];
NSLog(@"\n\n\n\nstory content\n\n\n%@<div class=\"NB-story\">%@</div>\n\n\n", storyHeader, [appDelegate.activeStory objectForKey:@"story_content"]);
@ -260,10 +260,14 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *url = [request URL];
[appDelegate showOriginalStory:url];
return NO;
if ([[url absoluteString] isEqualToString: @"nb-share://share-link"]) {
[appDelegate showShareView];
return NO;
} else {
[appDelegate showOriginalStory:url];
return NO;
}
}
return YES;
}

View file

@ -1467,6 +1467,7 @@
<string>moveSiteViewController</string>
<string>navigationController</string>
<string>originalStoryViewController</string>
<string>shareViewController</string>
<string>splitStoryController</string>
<string>splitStoryDetailNavigationController</string>
<string>splitStoryDetailViewController</string>
@ -1487,6 +1488,7 @@
<string>MoveSiteViewController</string>
<string>UINavigationController</string>
<string>OriginalStoryViewController</string>
<string>ShareViewController</string>
<string>UISplitViewController</string>
<string>UINavigationController</string>
<string>SplitStoryDetailViewController</string>
@ -1510,6 +1512,7 @@
<string>moveSiteViewController</string>
<string>navigationController</string>
<string>originalStoryViewController</string>
<string>shareViewController</string>
<string>splitStoryController</string>
<string>splitStoryDetailNavigationController</string>
<string>splitStoryDetailViewController</string>
@ -1566,6 +1569,10 @@
<string key="name">originalStoryViewController</string>
<string key="candidateClassName">OriginalStoryViewController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">shareViewController</string>
<string key="candidateClassName">ShareViewController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">splitStoryController</string>
<string key="candidateClassName">UISplitViewController</string>
@ -1863,6 +1870,85 @@
<string key="minorKey">./Classes/OriginalStoryViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">ShareViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>doCancelButton:</string>
<string>doShareThisStory:</string>
<string>doToggleButton:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>doCancelButton:</string>
<string>doShareThisStory:</string>
<string>doToggleButton:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">doCancelButton:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">doShareThisStory:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">doToggleButton:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>appDelegate</string>
<string>commentField</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NewsBlurAppDelegate</string>
<string>UITextView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>appDelegate</string>
<string>commentField</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">commentField</string>
<string key="candidateClassName">UITextView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ShareViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SplitStoryDetailViewController</string>
<string key="superclassName">UIViewController</string>
@ -1891,6 +1977,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>doNextUnreadStory</string>
<string>doPreviousStory</string>
<string>doShareButton:</string>
<string>toggleFontSize:</string>
</object>
<object class="NSArray" key="dict.values">
@ -1898,6 +1985,7 @@
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@ -1906,6 +1994,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>doNextUnreadStory</string>
<string>doPreviousStory</string>
<string>doShareButton:</string>
<string>toggleFontSize:</string>
</object>
<object class="NSArray" key="dict.values">
@ -1918,6 +2007,10 @@
<string key="name">doPreviousStory</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">doShareButton:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">toggleFontSize:</string>
<string key="candidateClassName">id</string>

View file

@ -4461,7 +4461,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string key="NSFrame">{{356, 17}, {56, 11}}</string>
<reference key="NSSuperview" ref="155973878"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<float key="IBUIProgress">0.5</float>
@ -4508,18 +4507,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<float key="IBUIWidth">20</float>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
<object class="IBUIBarButtonItem" id="834837557">
<string key="IBUITitle">Share</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIStyle">1</int>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
<object class="IBUIBarButtonItem" id="728960711">
<string key="IBUITitle">A</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIStyle">1</int>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
<object class="IBUIBarButtonItem" id="1065495688">
<string key="IBUITitle">Next unread</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@ -4637,22 +4624,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
</object>
<int key="connectionID">58</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">toggleFontSize:</string>
<reference key="source" ref="728960711"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">73</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">doShareButton:</string>
<reference key="source" ref="834837557"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">75</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -4697,8 +4668,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<reference ref="812131495"/>
<reference ref="284060761"/>
<reference ref="672699755"/>
<reference ref="728960711"/>
<reference ref="834837557"/>
</object>
<reference key="parent" ref="191373211"/>
</object>
@ -4746,16 +4715,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<reference key="object" ref="506862915"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">72</int>
<reference key="object" ref="728960711"/>
<reference key="parent" ref="155973878"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">74</int>
<reference key="object" ref="834837557"/>
<reference key="parent" ref="155973878"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -4777,8 +4736,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>47.IBPluginDependency</string>
<string>48.IBPluginDependency</string>
<string>63.IBPluginDependency</string>
<string>72.IBPluginDependency</string>
<string>74.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -4800,8 +4757,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@ -6276,6 +6231,77 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<object class="IBPartialClassDescription">
<string key="className">ShareViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>doCancelButton:</string>
<string>doShareThisStory:</string>
<string>doToggleButton:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>doCancelButton:</string>
<string>doShareThisStory:</string>
<string>doToggleButton:</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">doCancelButton:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">doShareThisStory:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">doToggleButton:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>appDelegate</string>
<string>commentField</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NewsBlurAppDelegate</string>
<string>UITextView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>appDelegate</string>
<string>commentField</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">commentField</string>
<string key="candidateClassName">UITextView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ShareViewController.h</string>

View file

@ -1,3 +1,6 @@
/* Disable certain interactions on touch devices */
body { -webkit-touch-callout: none; -webkit-text-size-adjust: none; -webkit-user-select: none; -webkit-highlight: none; -webkit-tap-highlight-color: rgba(0,0,0,0); }
body {
line-height: 1.6;
font-size: 17px;

View file

@ -1,5 +1,4 @@
Zepto(function($) {
$('img').each(function() {
setImage(this);
});