Developing a šŸ”Œ browser plugin for SuttaCentral?

I think we need to distinguish between the (1) content of texts and the (2) organization of texts. These are two different things. What Iā€™ve been criticizingā€”and for the third and final time, it is a quibbleā€”is (2), not (1). There are legitimate grounds for criticizing (2) as evidenced by the perennial question of newcomers to the suttas asking where in the world they should start.


Iā€™ve posted on Buddhist forums for the past 12 years, with many thousands of posts, and this is the first time someone has impliedā€”though perhaps accused would be a more appropriate wordā€”that I have disrespect for any Buddhist text (sutta, sutra, commentary, etc.) from any Buddhist school, let alone the texts that are the source of the Dhamma I follow. Sometimes Iā€™m reminded of why I read and post on forums far less frequently than I used to. This is one of those times.

OK. Please forgive me for being uncharitable in my response.

Have you tried using the built in search on the site? Please see my explaination in the ā€œNOTE!ā€ section of this thread: Experimental Searchbar extension šŸ§° for browsers.

On Suttacentral.net itself (not the above plugin) just press s and start typing like you would in google. Either a citation or sutta name. Then you can click on the sutta in the results right then and there.

I think this is even an improvement over using Google the way you are. For suggestions on the built in SC search, please start a new thread in the Feedback category. The search is still in development and we love to hear about peopleā€™s experience with it. However a plugin isnā€™t going to be able to change anything about the search, so no point in discussing it here.


Iā€™m not sure if you are talking about those on SC or in general. We have indeed added some awesome keyboard shortcuts. If you donā€™t know about them, please look here: Experimental Hotkeys

That process is still in progress, so if there are other commands that have broad appeal they can probably be added directly into the site. Otherwise if it is an edge case, a plugin feature might work. My hope for the plugin, as stated in my OP, would be to permit customizing the trigger key for folks who donā€™t use Latin keyboards.


They are clearly not helpful to you, but we have to be very careful assuming what will be helpful to others.

When I speak to Sri Lankan monks who arenā€™t dedicated to English translations, they will usually tell me which vagga to look. The 1 to 152 scheme (as in the MN) is completely unheard of in non-English Asian Buddhist communities. And the numbering of suttas used there follows the vagga pattern that is represented on SuttaCentral. So for them that is the only way they would be finding something on the site. For example SN56.11 would there be SN5.12.2.1

Looking at the html, it doesnā€™t seem that the vaggas in the breadcrumb (which I think are the levels you dislike) have any special class added to them, therefore hiding them with a plugin would be tricky if not impossible.

This is the great downfall of web design. :blush: We all think most users are like us.

And to reiterate so everyone in the conversation is clear: This is not a discussion about changing SuttaCentral. Itā€™s about a plugin that could enhance/modify the site for plugin users.

So a list of all suttas in the AN does exist: suttacentral.net/an. So itā€™s no problem to link to that in an alternate design scheme. It might even be possible to modify the AN link in the breadcrum to go there instead of suttacentral.net/pitaka/sutta/numbered/an.

Honestly I think that a page with 1k+ text on it is kind of useless, but it might be useful for you.

Yeah, if the previous change could work, so could this.

And in fact the navigation menu that Ven. @Pasanna is suggesting would make use of these.

As I mentioned above I donā€™t think this is possible but perhaps someone could figure it out.


Iā€™m happy to hear other ideas you have.

In general for everyone, I recommend not assuming that the way you think the site should work is how everyone (or even most people!) think it should work. Instead please explain what would be helpful for you in an much detail as possible so we can together see if it is something that could be done through an extension/plugin. Even if itā€™s helpful for a handful of people itā€™s possible to add it in as long as it is technically feasible.

2 Likes

Thanks for explaining why people might want to see the vaggas.
I, like mkoll donā€™t find any use in them and have had people make similar comments, saying how they find them confusing. I propose we could have a vagga-less option in the plugin.

Not too tricky. nth-child in css might work. Or we can split the liā€™s into an array and tell it to keep say the first three, drop everything else or drop where the li contains the word vagga? Iā€™m just thinking about this off the top of my head. I would have to look at the data further. Years ago I tinkered data in this way in js or jquery (I donā€™t remember).

1 Like

I have never examined the levels in this regard, but you would need to look at all the various permutations, meaning all the books. Or if not then somehow only limit to the ones you do.

And just as an aside, in the AN especially there are topical groupings at the vagga level despite people only ever claiming that the AN is organized purely by number. And all of these groupings are maintained in the Wisdom editions.

That said, if a plugin can improve peopleā€™s experience Iā€™m all for it.

In the interest of making the navigation friendly for all; would it be useful to be able to toggle this alternate sutta numbering system in the navigation?
Iā€™ve added in some sample vagga titles which people can turn off and on in a yet to be designed setting.
So, where the grey numbers are, this could toggle with PTS or the Sri Lankan numbering system or whatever other system exists.

1 Like

Iā€™d be more inclined to say make it perfect for your own needs and then if someone wants a different kind then they can design that. Especially since there is already the vagga-wise system as the default SC navigation.

BTW, what you have so far looks great.

1 Like

toggle-vagga-etc

vaggas and alternative numberings arenā€™t that hard to toggle, itā€™s just a case of having the data in the first place.

Iā€™m hoping this is the kind of thing people will find useful.

Iā€™m a bit lost with what we have classified as Other languages and other text but slowly bumbling my way through.

I have decided to add sanskrit to the list of root languages. Iā€™m not sure if this is a useful approach. Convince me either way!

2 Likes

So, for folks who like to experiment, Here is something to play around with. Pick the right one for your browser. Chrome should work for all Chromium base browsers (Brave, Edge, etc)

To install them you will have to unzip and then follow the instructions in this video

This plugin does a few things:

  • changes the theme to ā€œShamrock Shakeā€
  • on all pages l will copy a link to the current page in a nice markdown format suitable for pasting on this forum, e.g. [DN 1 Brahmajālasutta](https://suttacentral.net/dn1/en/sujato)
  • on text pages c will copy the heading and body of the text (aka sutta) to the clipboard. If the root is visible it will copy that too. If notes are turned on (even on asterisks) that will get copied too.
  • There is a new hamburger menu on the top right that has just a few links. This is just a proof of concept until Ven. Pasanna finishes the real version.
1 Like

OK, Here is an updated version. It includes the feature that I published separately here. Go there for instructions/screenshots.

To install them you will have to unzip and then follow the instructions in this video

You can click on the pinned icon to see the current features:

The big addition is the ability on all websites to hover over a link to SuttaCentral and get the blurb. For example:

The new menu is just a mockup. Most links donā€™t work. Eventually all of these features will have a setting to turn them on and off. Obviously not every will love the green theme as much as I do. :green_heart:

Also, the feature to show the site language will likely have no use for most people. But for development work it can be handy to have it there in the open:
image

2 Likes

OK, had a productive day.

This release is ā€œGrimace.ā€ It adds two new features (in addition to the Grimace theme)

  • adds button for random sutta on the home page
  • press q to get a popup with a QR code for current url. If you want a QR code for a segment, just click that segment first and then press q.

1 Like

Another day, another release. This one is O.B. Mack

Three new features (in addition to the theme):

Root first

Now the root language is either on the left or on top:


I believe this was something you wanted @srkris. Could you test out and let me know if it works for you?

This is not done through CSS. Iā€™m not sure if itā€™s really possible that way. And if they are switched using css, I donā€™t think copy/past would work.

Alerts for more translations

If more translations exist in your chosen site language there will be a notification.


This feature is really hinky. I would greatly appreciate bug reports if you find any. Because of the nature of how SC is built, there may at times be a flash of the old notification for a previous page.

Context menu searches

There are now 5 context menu options when selecting text on a page of any website.

They all require you to select a bit of text

  1. Searches on SuttaCentral.net
  2. Searches on discourse.SuttaCentral.net
  3. Expects a ā€œmodernā€ citation like SN56.11 and will try to get a suttaplex card. Spaces are ignored.
  4. Expects a ā€œmodernā€ citation like SN56.11 and will try to go directly to a translation of the text. Spaces are ignored.
  5. Expects a PTS citation and will do a search on SuttaCentral.net prepended with volpage:

@stu This seems like something you might use, so testing would be much appreciated.


If you are able I would greatly appreciate having people test them out. Once we get a working version of Ven. Pasannaā€™s alternate menu scheme I will publish to the respective app stores so you wonā€™t have to deal with unzipping and side loading.

To install them you will have to unzip and then follow the instructions in this video. The chrome version should work for Brave, Edge, etc. Safari will have to wait a bit since they require an additional step to create and an Apple ID to publish.

I welcome all kinds of feedback.

PS: You can easily pin the extension icon to the toolbar. Then clicking on the icon will give you all the features:

If anyone likes to build a settings UI Iā€™m open to help.

3 Likes

Wow Venerable,
thatā€™s a lot of goodness in one update!

3 Likes

Thanks!

I just tested changing the hotkeys to non-latin letters and it seems to work. If anyone needs that Iā€™d love to setup a real use test for that.

1 Like

this is wonderful!

any chance we can get the root text in black and the translation in grey as an option, currently my focus is on the Pali and I want that to be what my eye is drawn to.

also my nav is not working for SN AN and KN?

Absolutely. That was my first thought after implementing. However until a settings/options interface is built, every new feature is mandatory; so I didnā€™t want to force that on everyone.

I highly, highly recommend installing the browser extension Stylus. It lets you override css/styling. Once you start using it you will likely find all sorts of cool ways to customize the sites you use most often. If you canā€™t figure it out drop me a DM.

You are seeing an ever newer version, but itā€™s still just a proof of concept. I think Ven. P has been busy lately. But as a non-Pali user they might like to hear your ideas about just how it could end up working. Feel free to discuss here.

PS: Thanks for testing it out! Iā€™m happy to entertain feature suggestions.

2 Likes

Itā€™s already amazing @Snowbird ! just love being able to cut and paste with the pali on top.

Yeah, the reason you can do that is because the script actually swaps the two ā€œphysicallyā€, instead of just using css.

The down side is that doing a sutta like DN16 made it hang for a bit. Itā€™s supposed to do it in chunks so that doesnā€™t happen. Please report back any problems.

And if anyone is interested, you can see all the scripts in this folder:

1 Like

Remember if you need a whole sutta you can use c.

1 Like

Really cool. Thanks so much Bhante @Snowbird

PTS:

The PTS bit works nicely. Iā€™m sure ā€˜enhancementsā€™ will become apparent when I use it in a real situation. It would be cool if when the settings get implemented, I could set it so itā€™s the top level rather than having to go into SCEE sub menu:

So at the same level as ā€˜Save selection to Keepā€™ in my menu

Pop up blurb:

I have links to SC like this:

image

It is made up of this:

<a href="https://suttacentral.net/dn16/"><img>DN 16<span class="nomobile"> on SuttaCentral</span></a>

It works on the main anchor text (i.e. ā€˜DN 16ā€™) and it works on the ::after (i.e. the little box with the arrow to the right). But it doesnā€™t work on the img or span (i.e.SC icon and ā€˜on SuttaCentralā€™)