The odyssey of finding a certain video

This is only a short rant about the stupidity of a bunch of search engines that basically all use the same search database.

I knew that I had once seen a video of Brendan Eich (more than a year ago) that dealt with classes in JavaScript, especially ES6 and I wanted to watch it again because I had some hunch that in that video he addressed a problem I have right now.

(Sometimes my brain works in weird ways – I usually don’t remember the things I have watched a long time ago, only that I have and roughly about where I have seen them)

I don’t keep a ginormous history in Vivaldi because I have noticed that too many history results might lead to a slow down of the browser under certain circumstances and especially because all kinds of C**P are stored in the history (e.g. search engine result pages from yesterday – which will definitely not give the same results today), so I had to find that video again. I still knew that I didn’t watch it on YouTube, but somewhere else, so I started a search at the usual non-Google-ish search engines first.

A standard search “classes in javascript ES6” gave almost exclusively YT results (yes, I forgot to add “Brendan Eich” – didn’t remember who gave the talk, could have been Douglas Crockford too, so what?) so I looked up the parameters of my favorite search engines and tried to exclude YT from the results pages by adding some.
(Yes I know that it was still a very unrefined search – but hey – I’ve got results πŸ˜‰ )

All links to the result pages open in a new tab.

DuckDuckGo:

startpage:

Ecosia:

bing:

And finally I added Google as a “control group”:

I leave the results open to interpretation by you, maybe you get different results, or maybe you can tell me what was wrong with my searches – but I found some search engines lacking.

How To add Search Engines that use POST to Vivaldi

There is a long standing problem with Vivaldi not adding every kind of search engines, e.g. the current implementation still does not add search engines like SearX

This happens because those engines use POST instead of GET in their search forms and Vivaldi does not (yet) check for that.

To mitigate the problem …

… you can use the following bookmarklet:

javascript:(function()%7Bvar%20x,i%3Bx%3Ddocument.forms%3Bfor(i%3D0%3Bi%3Cx.length%3B++i)x%5Bi%5D.method%3D%22get%22%3Balert(%22Changed%20%22%20+%20x.length%20+%20%22%20forms%20to%20use%20the%20GET%20method.%5Cn%5CnDON'T%20USE%20THE%20ALTERED%20PAGE%20NOW!%5Cn%5Cn%20-%20Right-click%20in%20the%20search%20field%5Cn%20-%20select%20%5C%22Add%20as%20search%20engine%5C%22%5Cn%20-%20Open%20%5C%22Settings%5C%22%20%3E%20%5C%22Search%5C%22%5Cn%20-%20Click%20the%20edit%20button%20for%20the%20new%20search%5Cn%20-%20Check%20%5C%22Use%20Post%5C%22%5Cn%5CnEnjoy!%22)%3B%7D)()%3B
  • Create a new bookmark in the panel and copy/paste the line above in the URL field of the Bookmarks panel.
  • Give it a name like e.g. “GET the POST search”.
  • Optional add a shortcut like “getit” too.

Now you can go to one of the search engine result pages 1), e.g. the one linked above and either click on the bookmarklet or type the shortcut in the URL bar and hit enter.

An alert-box with additional instructions will pop up. Follow the instructions.

Warning: The site will be altered by the bookmarklet. Don’t use it for a search before you have reloaded the page or else it might break!

1) It might not work if you try it on the start page of the search engine. In this case search for “test” and try applying the bookmarklet on the result page. Some search engine still might not work that way because they use other means and time based searches, but the majority should work just fine.

How it works

The bookmarklet changes all FORM elements on the page to use GET instead of POST. This allows right click > “Add as Search Engine” to detect it and enter the corresponding values it needs. Don’t forget to set the “Use POST Method” checkbox for the newly created search in “Vivaldi > Settings > Search”.

Here the decoded and unminified “source code”:


javascript: (function () {
var x, i;
x = document.forms;
for (i = 0; i < x.length; ++i) {
x[i].method = "get";
}
alert("Changed " + x.length + " forms to use the GET method.\n\nDON'T USE THE ALTERED PAGE NOW!\n\n - Right-click in the search field\n - select \"Add as search engine\"\n - Open \"Settings\" > \"Search\"\n - Click the edit button for the new search\n - Check \"Use Post Method\"\n\nEnjoy!");
})();

If the search engine does not use POST …

…but “Add as Search Engine …” entry still does not want to show up, see Adding Search Engines to the Vivaldi Browser (followup)

Doodling with Harmony Keymod

blue flowery stuff
blue flowery stuff

I am definitely no artist but some people liked this image – I wonder why, no joke.

The Original is about 4000*3000px and was created with “Harmony Keymod”, a heavy modified version of Mr.Doop’s Harmony, a procedural drawing tool, in less than 15 minutes.

I’ve put the tool online on my personal webspace, if you want to give it a spin – here you are:quhno.internetstrahlen.de archive.org
Site down, I’ve changed the link to point to the last online version on archive.org. You can download it and remove the stuff added by archive org from the source code.
you can open the resulting self contained HTML file completely local on your file system. It does not need nor dues it open any connections to the internet.

Try one of the “easy” brushes like “shaded” with the settings “offset-scale” 80, “brush-size” 30 first. (more…)

In the Name of Accessibility: Check Your Alt Attributes!

Occasionally I am browsing the net with images switched off because I am only interested in the text and don’t want to download gigantic amounts of decorative images – especially since several pages started to use HDPI images which are 4 times the size needed and thus HUGE downloads – and I noticed that seemingly some authors are not aware that they are missing an important accessibility feature, that exists since about the web was invented:

TheΒ altΒ attribute on images.

While people who don’t switch off image loading or can see well and don’t need to use assistive technologies like e.g. screen readers to get hold of the content, users who don’t or can’t display images for various reasons are at loss in such a situation, so please, dear web developers, check if all of your non-decorative images have those alt attributes.

An easy way is to temporarily overwrite the page styles with the following stylesheet:

html::before {
    content: "All visible images are either missing alt attributes or the alt attributes don't follow the specification!" !important;
    font-family: sans-serif !important;
    font-size: 20px !important;
    font-weight: bold !important;
    text-align: center !important;
    color: #F8F8F8 !important;
    background-color: #EE3333 !important;
    padding: 5px 0 !important;
    margin: 0 !important;
    border: none !important;
    width: 100% !important;
    float: none !important;
    position: static !important;
    display: inline-block !important;
}
html {
    color: #202020 !important;
    background-color: #F8F8F8 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    width: auto !important;
    max-width: none !important;
    display: block !important;
}
html * {
    visibility: hidden !important;
}
html area,
html img {
    visibility: visible !important;
}
html area[alt],
html img[alt] {
    visibility: hidden !important;
}
html area[alt="*"],
html area[alt=""],
html img[alt="*"],
html img[alt=""],
html img[alt^=" "] {
    outline: 4px solid rgb(51, 102, 204) !important;
    visibility: visible !important;
}

You might need to adapt it if you use a Styling Extension, this is written for direct use in Vivaldi.

In Vivaldi you can add this as page action. Just save it as Image_Alt_Debugger.css to [path to]\Application\#.#.###.##\resources\vivaldi\user_filesΒ and after the next browser restart you will see the Entry “Image Alt Debugger” in the list of page actions. (Hint: Underscores in the name get replaced by Spaces for display)

HTH πŸ™‚

PS: Sadly you have to do that for each and every update of Vivaldi because or some unknown reason they put this stuff into the Application directory instead of the User DataΒ directory.

Why Vivaldi’s Reader, and others too, sometimes don’t do what you expect

TL;DR

Vivaldi Read Mode was was never meant for pages like Twitter, Youtube comments, or Facebook chats but for articles

As general rule of thumb you can assume that everything that has a continuous or adjacent text chunk of more than 300 characters counts as content. It may be split in multiple adjacent paragraphs, but must look content-y enough (i.e. consist of sentences) and may not contain too many links, videos or images inside of the content area (outside is fine) and does not belong to one of the “stop” classes and IDs like e.g. “comment”, “footer”, “ad”-vertisement and many others.

/TL;DR

Still there?

History

The Vivaldi Read View is – like the read view in Mozilla Firefox and the Apple Safari – based on the Readability(TM) code that was released as a labs experiment by arc90 in about 2009 under an open source license (some versions under MIT, some under Apache license). Later arc90 changed it to a server supported version that was available at readability.com

The Intention Behind It

Readability was never meant to be an ad-blocker, but always as a on-demand reader view to switch on for *articles*, meaning: Longer passages of text (important!)

It was never intended to be used on pages like Facebook, with its gazillions of short text snippets, Youtube video comments, Twitter feeds and generally not on any page that does not contain a sizable longer chunk of text in one article.

It was meant to make reading of longer texts distraction free by removing e.g. advertisements, page navigation, comments and videos or images that don’t belong to the main article content, and to re-style it with readable fonts and colors to make reading more pleasurable. 

How?!

Of course the code is not really “intelligent” (it has to be fast and may not use up too many resources), so it has to trust on some kind of heuristics to detect where the main content might be. While generally it works quite well, it may fail on some pages, especially “if the HTML is totally hosed” (not my words, that was a comment of one of the original arc90 developers)

A (simplified and not complete) Explanation:

First steps:

  • Remove all scripts.
  • Remove all styles.
  • Ignore HTML block level elements like paragraphs and divisions with less than 25 characters completely.
  • Remove HTML block level elements that have “stop” classes or IDs or tags that indicate that they are definitely not content but something else like e.g navigation, footers, comments or advertisements etc.pp.

After that the reader loops through all paragraphs, and

  • calculates the over-all score for text length by the following formula: 
    rounded-down((pure-Text character count of a page element)/100)
    and adds it to the parent element (you might see it as a container). This means: A paragraph with less than 100 characters of text does not get any bonus at all.
  • adds a base score of 1 for each remaining paragraph to the parent element 
  • assigns a score to them based on how content-y they look. This score gets added to their parent node.
  • adds additional scores that are is determined by things like number of commas (+), class names and IDs (+/-), image and link density (More than 25% of the text is links? Too many images per paragraph? Punish it!) etc.
  • punishes List, Headline, Forms and Address and some other Elements with negative scores because they are normally not part of articles, and if they are, they are usually in the same parent container as the paragraphs in a real article, so the combined score of the parent element is still high enough to count.
  • adds half of the resulting score to the grandparent elements.

When that all is done and the parent or grandparent has a high enough score, it is seen as content and gets displayed, everything else gets removed.

Probably you can imagine now, how many pitfalls are there in which content detection may fall, so please take a break if you see it fail and think about what might have caused it this time.

Personal side note (strong language warning)

All in all content detection is a bΡ–tch and can definitely fail on some pages, especially if the “Webmasters” (I call them Crapmasters) don’t know what a HTML validator is and have never heard about structured pages and accessibility. I am speaking out of experience: Back in 2009 I started with a userscript and later made an made an extension (cleanPages, see the old my.opera page on archive org) based the full original arc90 code and fine tuned it for Opera Presto (and ported it later for the new Opera thing). It had over 250k installs and while it was fun to tweak for better results, it was a hell of a lot of work. I wrote more than 200 versions with generic fixes for “just another couple of new pages that fail” but in the end I gave in and called it a day  – there are too many broken pages out there where the webmasters seemingly do not want people to read the content. Their wish is my command πŸ˜‰

So please be gentle with the Vivaldi developers – yes, there is still some fine-tuning to be done, but that is really time consuming. It will probably have to wait because there are some other, more difficult and bigger things in the pipe (hint, hint πŸ˜€ )

Thank You!

Disclaimer: While I am a “Soprano” (aka external tester for internal builds), all the views in this text are my private views and do not necessarily reflect the views or opinions of Vivaldi (the company) or any of it’s owners or employees.

Always ask for the download location (hack)

Deprecated – is now built in.

Several users, one of them me, prefer Vivaldi to ask for the download locationΒ forΒ every download. Sadly unchecking the option Settings > Downloads: “always save to default download location” does not work for some types of downloads, especially downloads with generated files or downloads initiated with Javascript.

It is possible to do that with a little hack, but it comes with aΒ caveat:

It breaks the “open” button behavior of the download dialog –Β so you have to open it manually after download.

 

Having said that, here it is:

  • look for the user profile directory of your Vivaldi in vivaldi://about Β (V-Button > Help > About) and open that in your file manager.
  • close Vivaldi
  • open the file namedΒ preferences with a decent editor (You should backup that file before, just in case, you know …)
  • search for:
    "download":{
    (including the quotation marks etc.)
  • look for theΒ } that follows immediately after that
  • before theΒ } add the following:
    ,"prompt_for_download":true
    (including the comma and the quotation marks etc.)
  • Save the file.

 

Done. From now on Vivaldi should ask before every download – but be aware of the caveat!

 

 

 

How to get the data of the SmartRSS Extension from Opera 15++ to Vivaldi

Open Vivaldi and Opera 15+

 

In Vivaldi:

  • go to https://addons.opera.com/en/extensions/details/smart-rss/?display=en 
  • click “Add to Opera” 
  • on the popup thingy click on “get it anyway”
  • save to a place where you can find it again. 
  • open vivaldi://plugins
  • drag and drop the extension file from your file manager to the vivaldi://plugins tab

 

In Opera 15+:

  • right click on the extension’s button
  • on the popup click “Options”
  • in the options tab click on one of the “Export” buttons. I personally prefer “smart” because I want the contents of the feeds too, otherwise OPML, which works for some other readers too  
  • click on the new link that shows after you pressed the export button
  • save it in a location where you can find it again

You can close Opera now.

 

In Vivaldi:

  • open the smart RSS tab by clicking on the extension’s icon
  • click on the wrench icon
  • in the popup click on “Options”
  • in the options tab click on appropriate the import button (depending to which format you exported)
  • select previously exported file
  • wait until the import is finished successfully (there is some status information showing next to the button)

 

After those steps all feeds should be imported to Vivaldi.

 

HTH πŸ™‚

Followup on styling Vivaldi with CSS

Outdated. No longer needed! We have Themes now πŸ™‚

Following up the postΒ https://quhno.vivaldi.net/2015/07/02/some-quick-vivaldi-panels-css-hacks-for-better-readability-or-accessibility/

I’ve made some smallish changes that take care of some minor things I don’t like with the UI. They can be applied the same way as in the previous blog post.

This time I move the notes editor scrollbar to the right, make the speed dial navigation a little bit less high so that it aligns with the header of the web-panels, moved the speed dial items a bit upwards and colored the panel scrollbars for the dark UI.

Bookmarks suck – Extrensions are great – Extensions inhibit progress

Sounds provocative?
Fine. It was planned to sound like that.

While we all go conform that it is impossible to cover everyΒ  need of a user with one software alone and that we therefore need a way to extend it, sometimes extensions can be a blocking stone for other development.
(more…)

Broken CSS? Lint it!

While looking for something completely different I stumbled upon CSS LINT.

Quote:

Will hurt your feelings*

(And help you code better)

http://csslint.net/

Not the usual beautifier but does what it says: It tells you what you can and should improve in a similar rigorous way as JSLint does for JavaScript. Be prepared for a long list of Errors or Warnings πŸ˜‰

 

While it did not hurt my feelings (Sticks and stones …) it gave me several valuable hints how to improve my CSS-Fu …