From 897d80170f039183fa4f930511f35f33caab2128 Mon Sep 17 00:00:00 2001 From: winkidney Date: Wed, 20 Mar 2019 18:26:07 +0800 Subject: [PATCH] Refactor: Make getDocumentScrollTop a standalone function --- pinry/static/js/helpers.js | 5 +++++ pinry/static/js/vue/main.js | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pinry/static/js/helpers.js b/pinry/static/js/helpers.js index 0841f3f..91998d6 100644 --- a/pinry/static/js/helpers.js +++ b/pinry/static/js/helpers.js @@ -81,3 +81,8 @@ function postPinData(data) { function getUrlParameter(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null; } + +function getDocumentScrollTop() { + var doc = document.documentElement; + return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); +} diff --git a/pinry/static/js/vue/main.js b/pinry/static/js/vue/main.js index 000c0f3..0111934 100644 --- a/pinry/static/js/vue/main.js +++ b/pinry/static/js/vue/main.js @@ -348,11 +348,6 @@ Vue.component('pin-container', { bindScrollHandler: function () { var self = this; - function getDocumentScrollTop() { - var doc = document.documentElement; - return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - } - scrollHandler = function() { if (self.status.loading || !self.status.hasNext) { return