Posts

CSS position fixed bug

Image
A 'div' with 'position: fixed' was not visible when I forgot to give a 'top' or 'left' and other content filled the screen.  The 'div' is visible and below the other content if this content only partly fills the screen. If I say 'position: absolute' then the 'div' is at the bottom of the other content even if this content fills the screen. 

URL encoding SVG

Image
 The 'encodeURI' function on my old browser does not give the right output for a data URL for a background image of an SVG. So I use the free online URL encoder at:     https://yoksel.github.io/url-encoder/ My browser's 'encodeURIComponent' function does not give the right output either. Chromes's 'encodeURIComponent' function does not give the right output either. I tried changing all double quotes in the SVG to single quotes, but this did not give the right output either

setTimeout continues in hidden Chrome tab

Image
 I used 'setTimeout' to run a 20 second animation again two minutes after it first starts. But if I change tabs in Chrome after a a few seconds and come back to the original tab after a few minutes, then the first and second animations run together. It seems the hidden tab freezes but 'setTimeout' still counts down the seconds. 

Bug using 'xlink:href' with SVG

Image
 I had a bug where using 'setAttributeNS' and "xlink:href" on a 'use' tag of an SVG would not override the plain 'href' set in the HTML. It seems I should always use plain 'href's as 'xlink:href' is not used now.

Adding SVG icons next to buttons

Image
 Putting SVG's of animals near buttons draws the eye to the buttons. The SVG's also look nice and are fun which is OK as my main page is a game. But some SVG's do not look clear at the small size needed to sit next to a button. The idea came from GIMP where the walrus mascot appears in the icons.  Also my old KDE desktop has a green dragon sitting above the letters 'KDE'.

Minifying SVG's myself

Image
 I remove unused 'id' attributes from SVG's I get from 'openclipart.org'. I say: '%s:id="[^"]*"::gc' in 'vim'. I leave in the id's for gradients and filters used within the SVG. I add a unique prefix to these id's so they do not clash with other inline SVG's.  I also remove 'label' attributes. I also remove 'inkscape' and 'sodipodi' attributes, and 'metadata' which is usually about the 'author' and license. I remove nearly all namespaces from the 'svg' tag. It seems these are not needed for my inline SVG's. But sometimes the 'xmlns' and 'xlink' namescapes are needed by the 'svgomg' online minifier if an 'xlink:href' is used later in the SVG, maybe to reference a color gradient. I also remove the version as apparently browsers do not use it. My 'svg' tag now usually only has the 'id' and 'viewBox'. I tried removing the...

Facebook login to hosting provider not work

Image
 I could not login into my hosting provider, Hostinger, with my Facebook login. Facebook gave the message: 'Facebook Login is currently unavailable for this app'. It seems this is because Facebook needs to verify Hostinger as a business. Codepen.io and Pinterest also stopped offering Facebook logins. When I created my acoount on Hostinger, I used a Facebook login because I had previously created an account with Hostinger using just my email address. I got around this problem by resetting the password for my email address on Hostinger. When I logged in, I could manage the website I had created with the Facebook login. Unfortunately, now when I login, Hostinger says this is a suspicious login and wants a verification code sent to my email address.   Instead I set up a login using my Google account.I used Hostinger's settings to set this up.