mirror of
https://github.com/discourse/discourse.git
synced 2025-05-10 06:43:07 +08:00
FIX: Linking to relative hash URLs was reloading the app.
This commit is contained in:
parent
f44bd4ec28
commit
2cf6f65660
@ -57,6 +57,17 @@ Discourse.URL = Em.Object.createWithMixins({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scroll to the same page, differnt anchor
|
||||||
|
if (path.indexOf('#') === 0) {
|
||||||
|
var $elem = $(path);
|
||||||
|
if ($elem.length > 0) {
|
||||||
|
Em.run.schedule('afterRender', function() {
|
||||||
|
$('html,body').scrollTop($elem.offset().top - $('header').height() - 15);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var oldPath = window.location.pathname;
|
var oldPath = window.location.pathname;
|
||||||
path = path.replace(/(https?\:)?\/\/[^\/]+/, '');
|
path = path.replace(/(https?\:)?\/\/[^\/]+/, '');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user