New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

REQ for styling: Add an attr Title="NameOfDict" in top span

General discussion

REQ for styling: Add an attr Title="NameOfDict" in top span

Postby FluxTorpedoe » Mon Apr 02, 2012 12:53 pm

Hi', and congratulations on this very useful soft!

I would like to humbly suggest a small feature that would be a huge help to everyone who style with style-article.css.

Right now, styling a tag (e.g. "span class='dsl_ex'") changes the display of all the dictionaries using this tag - even if they use it in a different way (eg. dsl_ex used as a definition). The only way to prevent this and allow specific formatting for specific dictionaries, is to be able to identify each dictionary (like with the current 'gdfrom' id), but in a permanent way.
GoldenDict already retrieves the name of the current dictionary (e.g. 'The Great Dictionary'), which it writes inside the "div class='gddictname'". So here is my question-suggestion:
Would it be possible to add to the topmost "span" container an attribute "title", which would also contain the name of the dictionary (e.g. "span class='gdarticle' title='The Great Dictionary'")?
This way it would be possible (and a lot easier) to create nice layouts and formatting for every dictionary!

E.G.
Code: Select all
.dsl_ex { /* For All dictionaries */
   font-style: italic;
   font-weight: normal;
}

span[title="The Great Dictionary"] .dsl_ex { /* For a specific dictionary */
   font-style: normal;
   font-weight: bold;
}

And even long or problematic names could still be accesed by a part of their name:
Code: Select all
span[title*="Great"]

Well, it's just a suggestion, but I think it would be a terrific tool for styling! :)

Anyway, thanks for reading me, and kudos again!!!

Flux
FluxTorpedoe
 
Posts: 2
Joined: Mon Apr 02, 2012 12:27 pm

Re: REQ for styling: Add an attr Title="NameOfDict" in top s

Postby chulai » Mon Apr 02, 2012 9:53 pm

You already suggest the solution: 'gdfrom' id. I'm not sure what do you mean with but in a permanent way. Ids are permanent. They don't change with every run of the program.

Just use the span that wraps each dictionary definition. Each dictionary has a span with a unique id such as "gdfrom-3546b9b3cfce9648130e6710f2e5a773"

Code: Select all
<span class="gdarticle gdactivearticle" id="gdfrom-3546b9b3cfce9648130e6710f2e5a773" ...>
<div class="gddictname"><span class="gddicticon">...<span class="gdfromprefix">From </span>ENGLISH IDIOMS 2.EDITION</div>

<span class="gdarticlebody gdlangfrom-en" lang="en">
<h3>hi</h3>
<div>hello, howdy Hi, Kelly. How are you?</div>

</span>


Code: Select all
span#gdfrom-3546b9b3cfce9648130e6710f2e5a773 .gdarticlebody { /* For a specific dictionary */
   font-style: normal;
   font-weight: bold;
}
chulai
 
Posts: 464
Joined: Sat Jan 08, 2011 10:11 pm

Re: REQ for styling: Add an attr Title="NameOfDict" in top s

Postby FluxTorpedoe » Tue Apr 03, 2012 8:59 am

Hi', and thanks a lot for such a quick answer! :)

I had already tried the "id" solution some times ago, but dropped it after seeing them change, and I didn't look further then.
So after reading your post, I was perplexed and I just made several tests to check the 'permanent' status of the "id" (GoldenDict portable under Windows), and I guess I found out the culprits:
- in fact, you're right in that the "id" is permanent,
- but only as long as the folder names and structure inside the "content" dir isn't changed.

It seems that for any given dictionary, a new "id" is re-generated (after a refresh of the "config") when:
- the location of a dictionary is changed (e.g. from "content\The Great Dictionary" to "content\Essentials\The Great Dictionary")
- the name of the folder containing a dictionary (or any parent folder inside "content") is changed. (e.g. from "content\The Great Dictionary" to "content\The Great Dictionary 2nd Ed")

That's why I had come up with the idea of an extra "title" attribute, which would be a more permanent identifier suited to CSS styling (since it would depend on the information stored inside the dictionaries).

But well, as for now, we just have to create a folder structure with clear names, consider them definitive, and keep a report (for the cases of reinstall, updates, mods...). This way the "id" approach would be working, so it's not a big deal - I guess there are much more important priorities ;) .
FluxTorpedoe
 
Posts: 2
Joined: Mon Apr 02, 2012 12:27 pm


Return to General

Who is online

Users browsing this forum: No registered users and 38 guests