import { behavior, scroll, scrollStep } from './utils'

export function scrollDown (event) {
  scroll(event.repeat, scrollStep, 'scrollTop')
}

export function scrollUp (event) {
  scroll(event.repeat, -scrollStep, 'scrollTop')
}

export function scrollLeft (event) {
  scroll(event.repeat, -scrollStep, 'scrollLeft')
}

export function scrollRight (event) {
  scroll(event.repeat, scrollStep, 'scrollLeft')
}

export function scrollPageDown () {
  scrollBy({
    top: innerHeight * 0.9,
    behavior
  })
}

export function scrollPageUp () {
  scrollBy({
    top: -innerHeight * 0.9,
    behavior
  })
}

export function scrollHalfPageDown () {
  scrollTo({
    top: window.pageYOffset + window.innerHeight / 2,
    left: 0,
    behavior: behavior
  })
}

export function scrollHalfPageUp () {
  scrollTo({
    top: window.pageYOffset - window.innerHeight / 2,
    left: 0,
    behavior: behavior
  })
}

export function scrollToBottom () {
  scrollTo({
    top: document.documentElement.scrollHeight,
    behavior
  })
}

export function scrollToTop () {
  scrollTo({
    top: 0,
    behavior
  })
}

export function scrollToLeft () {
  scrollTo({
    left: 0,
    behavior
  })
}

export function scrollToRight () {
  scrollTo({
    left: document.documentElement.scrollWidth,
    behavior
  })
}

import { behavior, scroll, scrollStep } from './utils'

export function scrollDown (event) {
  scroll(event.repeat, scrollStep, 'scrollTop')
}

export function scrollUp (event) {
  scroll(event.repeat, -scrollStep, 'scrollTop')
}

export function scrollLeft (event) {
  scroll(event.repeat, -scrollStep, 'scrollLeft')
}

export function scrollRight (event) {
  scroll(event.repeat, scrollStep, 'scrollLeft')
}

export function scrollPageDown () {
  scrollBy({
    top: innerHeight * 0.9,
    behavior
  })
}

export function scrollPageUp () {
  scrollBy({
    top: -innerHeight * 0.9,
    behavior
  })
}

export function scrollHalfPageDown () {
  scrollTo({
    top: window.pageYOffset + window.innerHeight / 2,
    behavior: behavior
  })
}

export function scrollHalfPageUp () {
  scrollTo({
    top: window.pageYOffset - window.innerHeight / 2,
    behavior: behavior
  })
}

export function scrollToBottom () {
  scrollTo({
    top: document.documentElement.scrollHeight,
    behavior
  })
}

export function scrollToTop () {
  scrollTo({
    top: 0,
    behavior
  })
}

export function scrollToLeft () {
  scrollTo({
    left: 0,
    behavior
  })
}

export function scrollToRight () {
  scrollTo({
    left: document.documentElement.scrollWidth,
    behavior
  })
}

Remove scrolling to left 0 on half page up or down