Suggestion: Select one language on side-by-side view

When using English and Pāli side by side, selecting the text results in selecting both. For example:

If it is possible to make it so it selects only one language, that would be very helpful. Right now I have to switch views to do so, or edit out one of the languages when I want to quote a longer passage.

Perhaps the following can be used?

I’m using Windows 11 Chrome and Firefox.

I’m not the only one with this problem:

4 Likes

Why wouldn’t you want it to select both sides?

That is a great aide in learning what the English was translated from.

This is more something you want to do with a browser extension. For example there are Chrome extensions where it is possible to select specific parts of a text, like this:

When I want to quote a sutta on this forum, for example. I never find the need to copy both the Pāli and English, and I can’t imagine most people having this need.

But maybe they do.

Thanks for that. I can’t seem to find something similar for Firefox, though, which I mainly use. (It has a feature to copy only certain columns of a table with the CTRL button, but since it doesn’t work, I suppose the site isn’t coded as tables.)

I have this same problem all the time. One workaround would be to give us a keyboard shortcut to hide and display the root text, which would have other benefits.

You got me thinking, though, and I did find something that works for me.

There is a plugin called Stylus. It allows you to have custom CSS for individual websites. After installing you can create custom CSS for suttacentral that includes this:

.root{
    display:none
}

Then simply toggle the custom style sheet:

So you get this:

Normally you wouldn’t want that blank space on the right. However having it means that the screen doesn’t re-position, so you don’t loose your place. As well, you can actually select everything you want, including the Pali you don’t, then toggle the CSS. When you copy what you have selected, the Pali is not copied.

No, it’s not. The paragraphs are just <p> tags as they probably should be. Then segments are just within <span> tags.

I doubt there is anything that can be done to the site itself to let you select only the English. But who knows! There are also plugins that allow you to inject custom Javascript into a page and something like that might be able to rebuild the page as a table.

The fact that everything is in p tags leads to other problems when copying verses. Each line is just a span within a paragraph, so even when copying a single verse in English, it all runs together. I built a secret feature in my SC Light app so if you press Alt q when the page is loaded and then re-click the “Go” button, it will reload the sutta with actual breaks between the lines so you can get what you see once you paste.

That’s not really what you are asking about, but it stems from the same issue you are having. The text is all run together and only presented separately because of the CSS.

1 Like

I’m happy I’m not alone in this struggle :wink: . The Stylus plugin works decently, thanks for that. Although not displaying the root text still moves the content on the page if the Pāli is longer than the English, which is often the case.

I changed it to hiding, which solves this (although it looks bad):

.root { visibility: hidden; }
.comment { display: none; }

I also removed the comments, because another rather annoying thing (I find) is that if you have comments enabled, they get copied along with the sutta text, even if you don’t have your mouse on them.

2 Likes

Oh, yes, those are great improvements.

1 Like

Thanks for the suggestion and the cool ideas for plugins.

If anyone has time, maybe make a detailed proposal on Github of exactly the behavior you want and we’ll look into it. Not sure exactly how we’d go about it, but I have the same problem.

1 Like

This works even better for the CSS plugin:

@-moz-document domain(“suttacentral.net”) {
.root { user-select: none; }
.comment { display: none; }
}

Still no permanent solution, because you still can’t select the Pali or see the comments until you turn the stylesheet off. But at least you don’t need to keep turning on and off just to select the English.

Can you @Snowbird, make that github proposal Bhante Sujato asked for? Github is too confusing for me. :smiling_face:

But that would only work then on Firefox? I’m actually not familiar with that.

That shouldn’t be necessary since the plugin determines which sites the style sheet is for, no?

OK, I’ve worked out another hack, but you need to install a different plugin, Tampermonkey.

Then for SuttaCentral.net you need to add this script:

// ==UserScript==
// @name         block selecting
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://suttacentral.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=suttacentral.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const roots=document.getElementsByClassName("root")

    document.onkeydown=(e)=>{
        if (e.key=="Alt"){
            for (let i=0;i<roots.length;i++){
                roots[i].style.userSelect="none"
                roots[i].style.color="rgb(211, 209, 208)"
            }
        }
    }

    document.onkeyup=(e)=>{
        if (e.key=="Alt"){
            for (let i=0;i<roots.length;i++){
                roots[i].style.userSelect="inherit"
                roots[i].style.color="inherit"
            }
        }
    }


})();

Once that is running, while Alt is pressed, all the root segments will be unselectable. For me, in FireFox, it even works using the shift key to continue the selection further down the page.

Sure. Creating github issues is not that much harder than creating a forum post here. Even uses markdown.

I don’t know how detailed it is, but it’s something:

Perhaps @Sunyo you could make comments or suggestions there?

1 Like

Oh, the CSS plugin added all that stuff automatically. I just copied it along.

I’ll give that a shot later, thanks!

1 Like

I updated the script to include changing the root text colour to gray so there is a visual indicator of what is happening.

selecting

5 Likes