PageSourceSearch

https://somethingpositive.net/wp-content/themes/ruffie/assets/js/functions.js?m=1744096449

js somethingpositive.net collected 2026-10-02 06:16:19 UTC 1,708 bytes, 45 lines download raw bytes

1( function( window, document ) {
2
3  const html         = document.querySelector( 'html' )
4  const scrollToTop  = html.querySelector( '#scroll-to-top' )
5  const radioButtons = html.querySelectorAll( '.entry-content input[type="radio"], .widget input[type="radio"], #wp-comment-cookies-consent' )
6  const checkBoxes   = html.querySelectorAll( '.entry-content input[type="checkbox"], .widget input[type="checkbox"]' )
7  const alignfull   = html.querySelectorAll( '.alignfull' )
8
9  // Replace no-js class with js on html element
10  html.classList.remove( 'no-js' )
11  html.classList.add( 'js' )
12
13  function addLabel( input, i ) {
14    const label = document.createElement( 'label' )
15
16    if ( !input.id ) input.id = `ruffie-labeler-${input.type}-${i}`
17
18    input.classList.add( 'ruffie-labeler' )
19    label.setAttribute( 'for', input.id )
20    label.classList.add( `ruffie-labeler-${input.type}-label` )
21
22    input.parentNode.insertBefore(label, input.nextSibling)
23  }
24
25  radioButtons.forEach(addLabel)
26  checkBoxes.forEach(addLabel)
27
28  // Full alignment
29  const scrollBarWidth = window.innerWidth - document.body.clientWidth
30  for ( const element of alignfull ) {
31    element.style.width      = `calc(100vw - ${scrollBarWidth}px)`
32    element.style.marginLeft = `calc(50% - 50vw + ${scrollBarWidth / 2}px)`
33  }
34
35  // Scroll to top
36  window.addEventListener( 'scroll', function() {
37    scrollToTop.style.bottom = window.scrollY > 500 ? '1em' : '-2000px'
38  } )
39
40  scrollToTop.addEventListener( 'click', function(event) {
41    event.preventDefault()
42    window.scrollTo( { top: 0, behavior: 'smooth' } )
43  } )
44
45} ) ( typeof window != 'undefined' ? window : this, document )

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.