Brion VIBBER has submitted this change and it was merged.
Change subject: Re-enable references panel.
..
Re-enable references panel.
Change-Id: I03519019e62b32625cbd4dd4d0384d9020c6d66d
---
M wikipedia/View Controllers/References/ReferenceVC.m
M wikipedia/View Controllers/WebView/WebViewController.m
M wikipedia/assets/bundle.js
M www/js/listeners.js
4 files changed, 24 insertions(+), 10 deletions(-)
Approvals:
Brion VIBBER: Verified; Looks good to me, approved
diff --git a/wikipedia/View Controllers/References/ReferenceVC.m
b/wikipedia/View Controllers/References/ReferenceVC.m
index c8c435c..660bc5e 100644
--- a/wikipedia/View Controllers/References/ReferenceVC.m
+++ b/wikipedia/View Controllers/References/ReferenceVC.m
@@ -136,7 +136,7 @@
[self.referenceWebView loadHTMLString:html baseURL:[NSURL
URLWithString:@""]];
-CGFloat topInset = 32;
+CGFloat topInset = 35;
CGFloat bottomInset = (NSFoundationVersionNumber >
NSFoundationVersionNumber_iOS_6_1) ? 0 : topInset;
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m
b/wikipedia/View Controllers/WebView/WebViewController.m
index 18f5e7d..c178b5c 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -2126,6 +2126,17 @@
[self updateReferencesHeightAndBottomConstraints];
}
+-(BOOL)didFindReferencesInPayload:(NSDictionary *)payload
+{
+NSArray *refs = payload[@"refs"];
+if (!refs || (refs.count == 0)) return NO;
+if (refs.count == 1) {
+NSString *firstRef = refs[0];
+if ([firstRef isEqualToString:@""]) return NO;
+}
+return YES;
+}
+
-(void)referencesShow:(NSDictionary *)payload
{
if (!self.referencesHidden){
@@ -2134,6 +2145,15 @@
return;
}
+// Don't show refs panel if reference data has yet to be retrieved. The
+// reference parsing javascript can't parse until the reference section
html has
+// been retrieved. If user taps a reference link while the non-lead
sections are
+// still being retrieved we need to just not show the panel rather than
showing a
+// useless blank panel.
+if (![self didFindReferencesInPayload:payload]) {
+return;
+}
+
self.referencesVC = [self.navigationController.storyboard
instantiateViewControllerWithIdentifier:@"ReferencesVC"];
self.referencesVC.webVC = self;
diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js
index 990bb7a..0d5d71a 100644
--- a/wikipedia/assets/bundle.js
+++ b/wikipedia/assets/bundle.js
@@ -242,13 +242,10 @@
if ( anchorTarget && (anchorTarget.tagName === "A") ) {
var href = anchorTarget.getAttribute( "href" );
-/*
if ( refs.isReference( href ) ) {
// Handle reference links with a popup view instead of scrolling
about!
refs.sendNearbyReferences( anchorTarget );
-} else
-*/
-if ( href[0] === "#" ) {
+} else if ( href[0] === "#" ) {
// If it is a link to an anchor in the current page, just scroll
to it
document.getElementById( href.substring( 1 ) ).scrollIntoView();
} else {
@@ -576,4 +573,4 @@
}
}
-},{}]},{},[1,2,3,4,5,6,7,8])
+},{}]},{},[1,2,3,4,5,6,7,8])
\ No newline at end of file
diff --git a/www/js/listeners.js b/www/js/listeners.js
index aaec41f..be833bf 100644
--- a/www/js/listeners.js
+++ b/www/js/listeners.js
@@ -146,13 +146,10 @@
if ( anchorTarget && (anchorTarget.tagName === "A") ) {
var href = anchorTarget.getAttribute( "href" );
-/*
if ( refs.isReference( href ) ) {
// Handle reference links with a popup view instead of scrolling
about!
refs.sendNearbyReferences( anchorTarget );
-} else
-*/
-if ( href[0] === "#" ) {
+} else if ( href[0] === "#" ) {
// If it is a link to an anchor in the current page, just scroll
to it
document.getElementById( href.substring( 1 ) ).scrollIntoView();
} else {
--
To view, visit https://gerrit.wikimedia.org/r/152091
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I03519019e62b32625cbd4dd4d0384d9020c6d66d
Gerrit-PatchSet: 3
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mhurd
Gerrit-Reviewer: Brion VIBBER
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits