FireFox


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);

Safari: ‘a.getTime’ is undefined

Recently, we were working with Google Charts at which we were presenting data from a timeline with some processing.
Our JavaScript code was formatted as follows to create Date objects:

$value = "2020-03-19 23:45:00";
var dateStrFormat = new Date($value);

The above code worked fine on Firefox and Chrome but it failed on Safari with the error:
a.getTime is not a function. (In 'a.getTime()', 'a.getTime' is undefined)
After some investigation we found that Safari does not support a Date() constructor that contains time as well so we had to change the code to the following block:

var dateStr = "2020-03-19";
var dateStrFormat = new Date(dateStr);
var hourStr = "23";
var minutesStr = "45";
dateStrFormat.setHours(hourStr, minutesStr);

The above works on all browsers!


How to install icecat on gnewsense 2.3

I tried installing icecat-17.0.1 on gnewsense 2.3 Delta-H following the instructions found here: http://www.gnewsense.org/Documentation/IceCat.

At the make step I got the following error:
c++ -o MediaManager.o -c -I../../dist/stl_wrappers -I../../dist/system_wrappers -include ../../config/gcc_hidden.h -D_IMPL_NS_LAYOUT -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES -DSTATIC_EXPORTABLE_JS_API -I../../dom/base -I../../dom/battery -I../../dom/file -I../../dom/power -I../../dom/media -I../../dom/network/src -I../../dom/settings -I../../dom/sms/src -I../../dom/contacts -I../../dom/alarm -I../../dom/src/events -I../../dom/src/storage -I../../dom/src/offline -I../../dom/src/geolocation -I../../dom/src/notification -I../../dom/workers -I../../content/xbl/src -I../../content/xul/document/src -I../../content/events/src -I../../content/base/src -I../../content/html/content/src -I../../content/html/document/src -I../../content/svg/content/src -I../../layout/generic -I../../layout/style -I../../layout/xul/base/src -I../../layout/xul/base/src/tree/src -I../../dom/camera -I../../media/webrtc/trunk/src -I../../dom/media -I. -I../../dist/include -I~/icecat-17.0.1/dist/include/nspr -I~/icecat-17.0.1/dist/include/nss -fPIC -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wcast-align -Wno-long-long -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -g -pipe -O3 -fomit-frame-pointer -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MF .deps/MediaManager.o.pp ~/icecat-17.0.1/dom/media/MediaManager.cpp
In file included from ../../dom/base/nsGlobalWindow.h:61,
from ~/icecat-17.0.1/dom/media/MediaManager.h:9,
from ~/icecat-17.0.1/dom/media/MediaManager.cpp:5:
../../content/base/src/nsFrameMessageManager.h:278:7: warning: no newline at end of file
In file included from ../../media/webrtc/trunk/src/voice_engine/main/interface/voe_base.h:38,
from ../../dist/include/MediaEngineWebRTC.h:31,
from ~/icecat-17.0.1/dom/media/MediaManager.cpp:19:
../../media/webrtc/trunk/src/common_types.h:350: error: comma at end of enumerator list
../../media/webrtc/trunk/src/common_types.h:375: error: comma at end of enumerator list
../../media/webrtc/trunk/src/common_types.h:424: error: comma at end of enumerator list
../../media/webrtc/trunk/src/common_types.h:436: error: comma at end of enumerator list
../../media/webrtc/trunk/src/common_types.h:450: error: comma at end of enumerator list
make[4]: *** [MediaManager.o] Error 1

The fix is really simple! 🙂

Just open the file icecat-17.0.1/media/webrtc/trunk/src/common_types.h in an editor, got to the lines mentioned in the error and remove the commas on the last items of the enumerator list.

Example:

Lines 342-351
enum NsModes // type of Noise Suppression
{
kNsUnchanged = 0, // previously set mode
kNsDefault, // platform default
kNsConference, // conferencing default
kNsLowSuppression, // lowest suppression
kNsModerateSuppression,
kNsHighSuppression,
kNsVeryHighSuppression, // highest suppression
};
must become

enum NsModes // type of Noise Suppression
{
kNsUnchanged = 0, // previously set mode
kNsDefault, // platform default
kNsConference, // conferencing default
kNsLowSuppression, // lowest suppression
kNsModerateSuppression,
kNsHighSuppression,
kNsVeryHighSuppression // highest suppression
};


to view “like me” posts

About those annoying websites that will not allow you to view their content unless you click “like” on every article they have. Like me, you might not want to do that, because you might find out later that they do not really have the information you need, yet you already shared it.

A guide to avoid this situation (for a few sites at least, do the following for FireFox:

  1. view the source code (Ctrl+U)  of the page
  2. find something like $(‘#hide-me’).show();
  3. Type ctrl+shift+k and paste it there, then press enter
  4. Voila!

I hope it helps 🙂