Use a single class for blue links

This commit is contained in:
Kovid Goyal 2019-09-24 18:16:18 +05:30
parent 15cb1aaccc
commit 62d38e6706
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
8 changed files with 13 additions and 13 deletions

View File

@ -170,7 +170,7 @@ def render_metadata(mi, table, book_id): # {{{
v += ''
if is_searchable:
table.lastChild.lastChild.appendChild(E.a(
title=_('Click to see books with {0}: {1}').format(name, v), href=href_for_search(is_searchable, v), v))
title=_('Click to see books with {0}: {1}').format(name, v), class_='blue-link', href=href_for_search(is_searchable, v), v))
else:
if v.appendChild:
table.lastChild.lastChild.appendChild(v)
@ -213,7 +213,7 @@ def render_metadata(mi, table, book_id): # {{{
for fmt in val:
fmt = fmt.toUpperCase()
td.appendChild(E.a(
fmt, class_='simple-link', href='javascript:void(0)',
fmt, class_='blue-link', href='javascript:void(0)',
title=_('Read or download this book in the {} format').format(fmt),
onclick=on_fmt_click.bind(v'[mi.title, mi.format_sizes[fmt] || 0]'),
data_format=fmt, data_book_id='' + book_id))
@ -239,7 +239,7 @@ def render_metadata(mi, table, book_id): # {{{
if x:
if td.childNodes.length:
td.appendChild(document.createTextNode(', '))
td.appendChild(E.a(title='{}:{}'.format(k, idval), target='_new', href=x[1], x[0]))
td.appendChild(E.a(class_='blue-link', title='{}:{}'.format(k, idval), target='_new', href=x[1], x[0]))
if td.childNodes.length:
table.appendChild(E.tr(E.td(name + ':'), td))
@ -253,6 +253,7 @@ def render_metadata(mi, table, book_id): # {{{
else:
lang = k
td.appendChild(E.a(lang,
class_='blue-link',
title=_('Click to see books with language: {}').format(lang),
href=href_for_search(field, k)
))
@ -381,9 +382,6 @@ def basic_table_rules(sel):
add_extra_css(def():
sel = '.' + CLASS_NAME + ' '
style = basic_table_rules(sel)
style += build_rule(sel + 'table.metadata a[href]', color='blue')
style += build_rule(sel + 'table.metadata a[href]:hover', color=get_color('window-hover-foreground'))
style += build_rule(sel + 'table.metadata a[href]:active', color=get_color('window-hover-foreground'), transform='scale(1.5)')
sel = '.' + SEARCH_INTERNET_CLASS
style += build_rule(sel, margin='1ex 1em')

View File

@ -109,6 +109,6 @@ def report_a_load_failure(container, msg, error_html):
err,
E.div(
style='margin-top: 1em; border-top: solid 1px currentColor; padding-top: 1ex;',
E.a(onclick=def(): home(replace=True);, href='javascript: void(0)', style='color: blue', _('Go back to the home page')))
E.a(onclick=def(): home(replace=True);, href='javascript: void(0)', class_='blue-link', _('Go back to the home page')))
),
)

View File

@ -14,6 +14,7 @@ DEFAULT_COLORS = {
'window-foreground': DARK,
'window-error-foreground': 'red',
'window-hover-foreground': 'red',
'link-foreground': 'blue',
# Top bar specific colors
'bar-background': DARK,

View File

@ -314,7 +314,7 @@ def check_for_books_loaded():
err,
E.div(
style='margin-top: 1em; border-top: solid 1px currentColor; padding-top: 1ex;',
E.a(onclick=def(): home(replace=True);, href='javascript: void(0)', style='color: blue', _('Go back to the home page')))
E.a(onclick=def(): home(replace=True);, href='javascript: void(0)', class_='blue-link', _('Go back to the home page')))
),
)
return

View File

@ -32,8 +32,7 @@ def upload_files_widget(container, proceed, msg, single_file=False, accept_exten
safe_set_inner_html(c.firstChild, msg)
a = c.getElementsByTagName('a')[0]
a.setAttribute('href', 'javascript: void(0)')
a.classList.add('simple-link')
a.style.color = 'blue'
a.classList.add('blue-link')
a.addEventListener('click', def():
document.getElementById(container_id).querySelector('input[type=file]').click()
, False)

View File

@ -65,8 +65,8 @@ def create_font_size_panel(container, close):
display='inline-block', font_size=sz + 'px', padding='5px', cursor='pointer', border_radius='2px'))
container.appendChild(E.div(
E.a(_('Custom size'), href='javascript:void', onclick=show_custom_size, style='cursor:pointer'),
style='text-align: right; color: blue; font-size: smaller; margin-top: 2ex'
E.a(_('Custom size'), class_='blue-link', href='javascript:void', onclick=show_custom_size, style='cursor:pointer'),
style='text-align: right; font-size: smaller; margin-top: 2ex'
))
container.appendChild(E.div(style='display:none',

View File

@ -18,7 +18,7 @@ def create_user_stylesheet_panel(container):
style='flex-grow: 10; display: flex; flex-flow: column',
E.div(
_('A CSS style sheet that can be used to control the look and feel of books. For examples, click'), ' ',
E.a(class_='simple-link', style='color: blue', title=_("Examples of user style sheets"),
E.a(class_='blue-link', title=_("Examples of user style sheets"),
target=('_self' if runtime.is_standalone_viewer else '_blank'),
href='https://www.mobileread.com/forums/showthread.php?t=51500', _('here'))
),

View File

@ -206,6 +206,8 @@ def scroll_tree_item_into_view(item):
add_extra_css(def():
ans = 'a, button:focus { outline: none }; a, button::-moz-focus-inner { border: 0 }\n'
ans += '.simple-link { cursor: pointer } .simple-link:hover { color: HC } .simple-link:active { transform: scale(1.5) }\n'.replace('HC', get_color('window-hover-foreground'))
ans += '.blue-link { cursor: pointer; color: COL } .blue-link:hover { color: HC } .blue-link:active { transform: scale(1.5) }\n'.replace('HC', get_color('window-hover-foreground')).replace('COL', get_color('link-foreground'))
ans += create_button.style + '\n'
ans += create_button.style + '\n'
ans += create_spinner.style + '\n'
ans += Breadcrumbs.STYLE_RULES + '\n'