mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
This reverts commit 3eebf8be733065996ff172adbcad85c254048274.
This commit is contained in:
@ -77,7 +77,9 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
|
||||
}
|
||||
);
|
||||
|
||||
this.appEvents.on("post:highlight", this, "_highlightPost");
|
||||
this.appEvents.on("post:highlight", postNumber => {
|
||||
Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
|
||||
});
|
||||
|
||||
this.appEvents.on("header:update-topic", topic => {
|
||||
if (topic === null) {
|
||||
@ -97,29 +99,23 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
|
||||
});
|
||||
// setup mobile scroll logo
|
||||
if (this.site.mobileView) {
|
||||
this.appEvents.on("topic:scrolled", this, "mobileScrollGuard");
|
||||
this.appEvents.on("topic:scrolled", offset =>
|
||||
this.mobileScrollGaurd(offset)
|
||||
);
|
||||
// used to animate header contents on scroll
|
||||
this.appEvents.on("header:show-topic", this, "_showTopic");
|
||||
this.appEvents.on("header:hide-topic", this, "_hideTopic");
|
||||
this.appEvents.on("header:show-topic", () => {
|
||||
$("header.d-header")
|
||||
.removeClass("scroll-up")
|
||||
.addClass("scroll-down");
|
||||
});
|
||||
this.appEvents.on("header:hide-topic", () => {
|
||||
$("header.d-header")
|
||||
.removeClass("scroll-down")
|
||||
.addClass("scroll-up");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_showTopic() {
|
||||
$("header.d-header")
|
||||
.removeClass("scroll-up")
|
||||
.addClass("scroll-down");
|
||||
},
|
||||
|
||||
_hideTopic() {
|
||||
$("header.d-header")
|
||||
.removeClass("scroll-down")
|
||||
.addClass("scroll-up");
|
||||
},
|
||||
|
||||
_highlightPost(postNumber) {
|
||||
Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
this.unbindScrolling("topic-view");
|
||||
@ -132,10 +128,10 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
|
||||
|
||||
// this happens after route exit, stuff could have trickled in
|
||||
this.appEvents.trigger("header:hide-topic");
|
||||
this.appEvents.off("post:highlight", this, "_highlightPost");
|
||||
this.appEvents.off("post:highlight");
|
||||
// mobile scroll logo clean up.
|
||||
if (this.site.mobileView) {
|
||||
this.appEvents.off("topic:scrolled", this, "mobileScrollGuard");
|
||||
this.appEvents.off("topic:scrolled");
|
||||
$("header.d-header").removeClass("scroll-down scroll-up");
|
||||
}
|
||||
},
|
||||
@ -203,7 +199,7 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
|
||||
|
||||
// determines scroll direction, triggers header topic info on mobile
|
||||
// and ensures that the switch happens only once per scroll direction change
|
||||
mobileScrollGuard(offset) {
|
||||
mobileScrollGaurd(offset) {
|
||||
// user hasn't scrolled past topic title.
|
||||
if (offset < this.dockAt) return;
|
||||
|
||||
|
Reference in New Issue
Block a user