PageSourceSearch

https://bookmarkos.com/blog/assets/js/mediumish.js

js bookmarkos.com collected 2026-10-01 11:45:29 UTC 4,122 bytes, 129 lines download raw bytes

1jQuery(document).ready(function($){
2
3    //fix for stupid ie object cover
4    if (document.documentMode || /Edge/.test(navigator.userAgent)) {
5      jQuery('.featured-box-img-cover').each(function(){
6          var t = jQuery(this),
7              s = 'url(' + t.attr('src') + ')',
8              p = t.parent(),
9              d = jQuery('<div></div>');
10  
11          p.append(d);
12          d.css({
13              'height'                : '290',
14              'background-size'       : 'cover',
15              'background-repeat'     : 'no-repeat',
16              'background-position'   : '50% 20%',
17              'background-image'      : s
18          });
19          t.hide();
20      });
21    }
22
23    // alertbar later
24    $(document).scroll(function () {
25        var y = $(this).scrollTop();
26        if (y > 280) {
27            $('.alertbar').fadeIn();
28        } else {
29            $('.alertbar').fadeOut();
30        }
31    });
32
33
34    // Smooth on external page
35    $(function() {
36      setTimeout(function() {
37        if (location.hash) {
38          /* we need to scroll to the top of the window first, because the browser will always jump to the anchor first before JavaScript is ready, thanks Stack Overflow: http://stackoverflow.com/a/3659116 */
39          window.scrollTo(0, 0);
40          target = location.hash.split('#');
41          smoothScrollTo($('#'+target[1]));
42        }
43      }, 1);
44
45      // taken from: https://css-tricks.com/snippets/jquery/smooth-scrolling/
46      $('a[href*=\\#]:not([href=\\#])').click(function() {
47        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
48          smoothScrollTo($(this.hash));
49          return false;
50        }
51      });
52
53      function smoothScrollTo(target) {
54        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
55
56        if (target.length) {
57          $('html,body').animate({
58            scrollTop: target.offset().top
59          }, 1000);
60        }
61      }
62    });
63    
64    
65    // Hide Header on on scroll down
66    var didScroll;
67    var lastScrollTop = 0;
68    var delta = 5;
69    var navbarHeight = $('nav').outerHeight();
70
71    $(window).scroll(function(event){
72        didScroll = true;
73    });
74
75    setInterval(function() {
76        if (didScroll) {
77            hasScrolled();
78            didScroll = false;
79        }
80    }, 250);
81
82    function hasScrolled() {
83        var st = $(this).scrollTop();
84        
85        // Make sure they scroll more than delta
86        if(Math.abs(lastScrollTop - st) <= delta)
87            return;
88
89        // If they scrolled down and are past the navbar, add class .nav-up.
90        // This is necessary so you never see what is "behind" the navbar.
91        if (st > lastScrollTop && st > navbarHeight){
92            // Scroll Down            
93            $('nav').removeClass('nav-down').addClass('nav-up'); 
94            $('.nav-up').css('top', - $('nav').outerHeight() + 'px');
95           
96        } else {
97            // Scroll Up
98            if(st + $(window).height() < $(document).height()) {               
99                $('nav').removeClass('nav-up').addClass('nav-down');
100                $('.nav-up, .nav-down').css('top', '0px');             
101            }
102        }
103
104        lastScrollTop = st;
105    }
106        
107    $('.site-content').css('margin-top', $('header').outerHeight() + 'px');  
108    
109    // spoilers
110     $(document).on('click', '.spoiler', function() {
111        $(this).removeClass('spoiler');
112     });
113    
114 });   
115
116// deferred style loading
117var loadDeferredStyles = function () {
118	var addStylesNode = document.getElementById("deferred-styles");
119	var replacement = document.createElement("div");
120	replacement.innerHTML = addStylesNode.textContent;
121	document.body.appendChild(replacement);
122	addStylesNode.parentElement.removeChild(addStylesNode);
123};
124var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
125	window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
126if (raf) raf(function () {
127	window.setTimeout(loadDeferredStyles, 0);
128});
129else window.addEventListener('load', loadDeferredStyles);

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.