Manually Start an Infinite Scroll on a browser without using a plugin

Recently, we needed to perform an infinite scroll on a website so that it would load all of its resources (both text and images). As the website was too long and it would take hours to manually scroll little by little, we used the Firefox console and JavaScript to perform the scroll without any additional plugins.

To do so we followed these steps: First we pressed the F12 button to enable the build-in console of Firefox.

Then, we typed allow pasting in the console to enable the ability to paste code directly into the console editor. Once we did that, we deleted the text allow pasting as it would create a problem once we run our code later on.

Following, we pasted the following code which both defines the function that performs the infinite scroll and the call that starts it.

//To avoid naming conflicts, give a non common names to the function and variable
var bytefreaksTimeout;

function bytefreaksScroll() {
    window.scrollBy(0,1);
    bytefreaksTimeout = setTimeout(bytefreaksScroll,10);
}

bytefreaksScroll();

As you will see in the following video, the scrolling was working flawlessly, once the scrolling reached the place we needed it to we used the following line in the console to stop the scrolling.

clearTimeout(bytefreaksTimeout);

Images, that are not visible initially, don’t show with Customizr Pro theme

Recently we were investigating an issue on a live website at which some images were not loading. After some testing we saw that only pictures that were visible while loading the page were being loaded as well. Checking the console we found the following JS error:

Uncaught TypeError: a.browser is undefined    jQuery 2
jquery.fancybox-1.3.4.min.js:1:205
NOK => browserDetect::addBrowserClassToBody => TypeError: t.browser is undefined tc-scripts.min.js:1:81903

We did not want to waste time on debugging this so we disabled the Load images on scroll option to get the site live asap. To do so, first we clicked on the Customize button on the admin bar:

Once the menu loaded, we clicked on the Advanced Options button:

From there, we clicked on Website Performances :

And got the following options

As seen in the image below, we disabled (among other changes) the option Load images on scroll

After pressing the Publish button, we reloaded the site, the JavaScript error was still there but the images were loading as expected.


Latex / Beamer: Automatically split the content of a frame to multiple slides

Did you ever wrote too much content for a frame?

Did that content spill out of the slide?

Were you too bored to create a new slide and split the content between them?

If the answer is yes, which most probably is, you will love the allowframebreaks parameter for the \begin{frame} directive.

\begin{frame}[allowframebreaks]{Bibliography}
	%Include a working bibliography of key texts that inform your study and methodology.
	%Your appendices may include Experiment Diagrams, Permissions for Human Subject Testing, etc.
	%Both bibliographies and required appendices tend to be discipline specific: know what the requirements are.
	\bibliography{bibliography}{}
	\bibliographystyle{IEEEtran}
\end{frame}

The \begin{frame}[allowframebreaks]{Bibliography} directive creates a new frame name Bibliography, if the contents of the frame exceed the size of the slide, it will automatically create new ones to accommodate the requirements.

Note: Using the allowframebreaks parameter automatically appends to the title of the slide Latin numbering (e.g. the first slide will be Bibliography I).


Latex / Beamer: Table of contents that shows other subsections only for current section

The following snippet will create a table of contents which will show the titles of all sections but it will include the subsections that belong to the current section only. This way, we can copy paste this slide in different parts of the presentation and have a custom table of contents per section.

\section{Introduction}

\begin{frame}{Outline for \secname}
	\tableofcontents[currentsection, hideothersubsections, sectionstyle=show/show]
\end{frame}