From 62d38e6706d5f35a42574ff778fc4b86f7667272 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 24 Sep 2019 18:16:18 +0530 Subject: [PATCH] Use a single class for blue links --- src/pyj/book_list/book_details.pyj | 10 ++++------ src/pyj/book_list/router.pyj | 2 +- src/pyj/book_list/theme.pyj | 1 + src/pyj/book_list/views.pyj | 2 +- src/pyj/file_uploads.pyj | 3 +-- src/pyj/read_book/prefs/font_size.pyj | 4 ++-- src/pyj/read_book/prefs/user_stylesheet.pyj | 2 +- src/pyj/widgets.pyj | 2 ++ 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 0c690c7015..31cfba1fea 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -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') diff --git a/src/pyj/book_list/router.pyj b/src/pyj/book_list/router.pyj index bf9ea6b64f..61087bda0d 100644 --- a/src/pyj/book_list/router.pyj +++ b/src/pyj/book_list/router.pyj @@ -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'))) ), ) diff --git a/src/pyj/book_list/theme.pyj b/src/pyj/book_list/theme.pyj index 8a4437234e..394ae3ceac 100644 --- a/src/pyj/book_list/theme.pyj +++ b/src/pyj/book_list/theme.pyj @@ -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, diff --git a/src/pyj/book_list/views.pyj b/src/pyj/book_list/views.pyj index 48e8a365e5..9d1c4dd177 100644 --- a/src/pyj/book_list/views.pyj +++ b/src/pyj/book_list/views.pyj @@ -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 diff --git a/src/pyj/file_uploads.pyj b/src/pyj/file_uploads.pyj index 492d9686db..d74104b952 100644 --- a/src/pyj/file_uploads.pyj +++ b/src/pyj/file_uploads.pyj @@ -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) diff --git a/src/pyj/read_book/prefs/font_size.pyj b/src/pyj/read_book/prefs/font_size.pyj index 6dd9becc3e..bf3a0b5891 100644 --- a/src/pyj/read_book/prefs/font_size.pyj +++ b/src/pyj/read_book/prefs/font_size.pyj @@ -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', diff --git a/src/pyj/read_book/prefs/user_stylesheet.pyj b/src/pyj/read_book/prefs/user_stylesheet.pyj index 2ae54b30db..3e85a17c66 100644 --- a/src/pyj/read_book/prefs/user_stylesheet.pyj +++ b/src/pyj/read_book/prefs/user_stylesheet.pyj @@ -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')) ), diff --git a/src/pyj/widgets.pyj b/src/pyj/widgets.pyj index 3b62641caf..132ac6d5f4 100644 --- a/src/pyj/widgets.pyj +++ b/src/pyj/widgets.pyj @@ -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'