This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/views/static.js.es6
2014-07-11 17:32:29 +10:00

23 lines
616 B
JavaScript

export default Discourse.View.extend({
didInsertElement: function() {
var path = this.get('controller.model.path');
if(path === "faq" || path === "guidelines"){
var $window = $(window);
$window.on('scroll.faq', function(){
if($window.scrollTop() + $window.height() > $(document).height() - 10) {
if(!this._notifiedBottom){
this._notifiedBottom = true;
Discourse.ajax("/users/read-faq", {
method: "POST"
});
}
}
});
}
},
willDestroyElement: function(){
$(window).off('scroll.faq');
}
});