Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dpup/surface
base: 8d904ee8b1
...
head fork: dpup/surface
compare: 909e36b387
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 18 additions and 10 deletions.
  1. +15 −9 app.js
  2. +3 −1 regexpscreenfactory.js
View
24 app.js
@@ -386,16 +386,22 @@ surf.App.prototype.handleDocClick_ = function(e) {
if (el) {
var path = el.pathname + el.search;
- surf.log('Link path:', path, '; Base path:', this.basePath_);
- if (goog.string.startsWith(path, this.basePath_)) {
- path = path.substr(this.basePath_.length);
- var navigateFailed = false;
- this.navigate(path).addErrback(function(err) { navigateFailed = true; });
- // If the navigation failed synchronously then we don't prevent default and let the browser
- // handle the click. This would happen for URLs that aren't meant to be managed by the App.
- if (!navigateFailed) {
- e.preventDefault();
+ if (el.hostname == window.location.hostname) {
+ if (goog.string.startsWith(path, this.basePath_)) {
+ surf.log('Link path:', path, '; Base path:', this.basePath_);
+ path = path.substr(this.basePath_.length);
+ var navigateFailed = false;
+ this.navigate(path).addErrback(function(err) { navigateFailed = true; });
+ // If the navigation failed synchronously then we don't prevent default and let the browser
+ // handle the click. This would happen for URLs that aren't meant to be managed by the App.
+ if (!navigateFailed) {
+ e.preventDefault();
+ }
+ } else {
+ surf.log('Link clicked outside app\'s base path')
}
+ } else {
+ surf.log('Offsite link clicked');
}
}
};
View
4 regexpscreenfactory.js
@@ -50,5 +50,7 @@ surf.RegExpScreenFactory.prototype.matchesPath = function(path) {
/** @return {!surf.Screen} */
surf.RegExpScreenFactory.prototype.create = function(path) {
- return new this.screenCtor_(this.re_.exec(path));
+ var matches = this.re_.exec(path);
+ surf.log('Creating screen for', matches);
+ return new this.screenCtor_(matches);
};

No commit comments for this range

Something went wrong with that request. Please try again.