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

View File

@ -109,6 +109,6 @@ def report_a_load_failure(container, msg, error_html):
err, err,
E.div( E.div(
style='margin-top: 1em; border-top: solid 1px currentColor; padding-top: 1ex;', 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-foreground': DARK,
'window-error-foreground': 'red', 'window-error-foreground': 'red',
'window-hover-foreground': 'red', 'window-hover-foreground': 'red',
'link-foreground': 'blue',
# Top bar specific colors # Top bar specific colors
'bar-background': DARK, 'bar-background': DARK,

View File

@ -314,7 +314,7 @@ def check_for_books_loaded():
err, err,
E.div( E.div(
style='margin-top: 1em; border-top: solid 1px currentColor; padding-top: 1ex;', 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 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) safe_set_inner_html(c.firstChild, msg)
a = c.getElementsByTagName('a')[0] a = c.getElementsByTagName('a')[0]
a.setAttribute('href', 'javascript: void(0)') a.setAttribute('href', 'javascript: void(0)')
a.classList.add('simple-link') a.classList.add('blue-link')
a.style.color = 'blue'
a.addEventListener('click', def(): a.addEventListener('click', def():
document.getElementById(container_id).querySelector('input[type=file]').click() document.getElementById(container_id).querySelector('input[type=file]').click()
, False) , 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')) display='inline-block', font_size=sz + 'px', padding='5px', cursor='pointer', border_radius='2px'))
container.appendChild(E.div( container.appendChild(E.div(
E.a(_('Custom size'), href='javascript:void', onclick=show_custom_size, style='cursor:pointer'), E.a(_('Custom size'), class_='blue-link', href='javascript:void', onclick=show_custom_size, style='cursor:pointer'),
style='text-align: right; color: blue; font-size: smaller; margin-top: 2ex' style='text-align: right; font-size: smaller; margin-top: 2ex'
)) ))
container.appendChild(E.div(style='display:none', 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', style='flex-grow: 10; display: flex; flex-flow: column',
E.div( E.div(
_('A CSS style sheet that can be used to control the look and feel of books. For examples, click'), ' ', _('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'), target=('_self' if runtime.is_standalone_viewer else '_blank'),
href='https://www.mobileread.com/forums/showthread.php?t=51500', _('here')) 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(): add_extra_css(def():
ans = 'a, button:focus { outline: none }; a, button::-moz-focus-inner { border: 0 }\n' 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 += '.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_button.style + '\n'
ans += create_spinner.style + '\n' ans += create_spinner.style + '\n'
ans += Breadcrumbs.STYLE_RULES + '\n' ans += Breadcrumbs.STYLE_RULES + '\n'