Last active
February 8, 2026 21:31
-
-
Save simurq/ae3c9b6ac09dc9f8813e68ff6bacc32f to your computer and use it in GitHub Desktop.
Modified lookup.js for Calibre 9.0+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* vim:fileencoding=utf-8 | |
| * | |
| * Combined Lookup Script for Calibre E-Reader | |
| * Supported Dictionaries: | |
| - Al-Maany (Arabic to/from multiple languages) | |
| - Cambridge | |
| - Dictionary.com | |
| - Etymological Dictionary of English | |
| - Kartaslov.ru (Russian Thesaurus) | |
| - Longman | |
| - Merriam-Webster | |
| - Multitran (Russian to/from multiple languages) | |
| - Nişanyan Sözlük (Turkish Thesaurus) | |
| - TurEng (Turkish to/from multiple languages) | |
| - Wikiwand (Wikipedia re-styled) | |
| * Author: Victor Quebec | |
| * Date: Feb 08, 2026 | |
| * Version: 1.0 | |
| * Supported Calibre version: 9.* and above | |
| */ | |
| (function() { | |
| "use strict"; | |
| // Inject global CSS variables | |
| function inject_root_vars() { | |
| if (document.getElementById('calibre-root-vars')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-root-vars'; | |
| /* For the details of global CSS variables used in this script, please check: | |
| https://lumetrium.com/definer/wiki/css/#css-variables-theming-system */ | |
| style.textContent = ` | |
| :root { | |
| --accent-rgb: 255,248,225; | |
| --anchor-rgb: 166,215,255; | |
| --border-radius-left-bottom: 4px; | |
| --border-radius-left-top: 4px; | |
| --border-radius-right-bottom: 4px; | |
| --border-radius-right-top: 4px; | |
| --border-radius: 4px; | |
| --contrast-rgb: 255,255,255; | |
| --error-rgb: 244,67,54; | |
| --font-family: "Roboto", sans-serif; | |
| --font-size: 16px; | |
| --font-weight: normal; | |
| --ground-rgb: 52,58,64; | |
| --info-rgb: 84,110,122; | |
| --primary-rgb: 163,102,0; | |
| --ptext-rgb: 255,160,0; | |
| --secondary-rgb: 69,90,100; | |
| --success-rgb: 76,175,80; | |
| --text-rgb: 255,255,255; | |
| --v-accent-base: #fff8e1; | |
| --v-anchor-base: #a6d7ff; | |
| --v-border-base: rgba(255,255,255,0.12); | |
| --v-border-darken1: rgba(255,255,255,0.25); | |
| --v-border-darken2: rgba(255,255,255,0.4); | |
| --v-contrast-base: #ffffff; | |
| --v-error-base: #f44336; | |
| --v-ground-base: #343a40; | |
| --v-info-base: #546e7a; | |
| --v-ptext-base: #ffa000; | |
| --v-secondary-base: #455a64; | |
| --v-success-base: #4caf50; | |
| --v-text-base: #ffffff; | |
| --v-warning-base: #ff5722; | |
| --warning-rgb: 255,87,34; | |
| } | |
| `; | |
| (document.head || document.documentElement).appendChild(style); | |
| } | |
| if (document.head || document.documentElement) { | |
| inject_root_vars(); | |
| } else { | |
| document.addEventListener('DOMContentLoaded', inject_root_vars); | |
| } | |
| // --- GOOGLE SPECIFIC VARIABLES --- | |
| var google_num_tries = 0; | |
| var google_style_id = 'a' + Math.random().toString(36).slice(2); | |
| // --- GOOGLE CLEANUP --- | |
| function fix_google_markup() { | |
| try { | |
| var cc = document.getElementById('center_col'); | |
| if (!cc) { | |
| if (++google_num_tries > 10) return; | |
| return setTimeout(fix_google_markup, 100); | |
| } | |
| // Figure out if they actually got a dictionary card | |
| var is_dictionary_result = !!document.querySelector('.lr_container, .lr_dct_ent'); | |
| if (is_dictionary_result) { | |
| // Only add styles once to prevent duplication | |
| if (!document.getElementById(google_style_id)) { | |
| var style = document.createElement('style'); | |
| style.id = google_style_id; | |
| style.textContent = ` | |
| * { | |
| column-gap: 0!important; | |
| -webkit-column-gap: 0!important; | |
| } | |
| #center_col { | |
| position: absolute !important; | |
| top: 1px !important; | |
| left: 0 !important; | |
| z-index: 100; | |
| } | |
| #cnt { | |
| position: relative; | |
| min-height: 100vh; | |
| } | |
| /* Clear the space where search form was */ | |
| #searchform, #appbar, #before-appbar { | |
| display: none !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } | |
| var maxW = 'calc(100vw - 25px)'; | |
| cc.style.maxWidth = maxW; | |
| cc.style.marginLeft = '0'; | |
| ['rcnt', 'cnt', 'search'].forEach(function(id) { | |
| var e = document.getElementById(id); | |
| if (e) { | |
| if (id === 'search') e.style.maxWidth = maxW; | |
| else if (id === 'cnt') e.style.paddingTop = '0'; | |
| else e.style.marginLeft = '0'; | |
| } | |
| }); | |
| cc.style.paddingLeft = '0'; | |
| cc.style.paddingRight = '6px'; | |
| // Constrain define text | |
| document.querySelectorAll('[data-topic]') | |
| .forEach(e => e.style.maxWidth = maxW); | |
| // Ensure footer stays at bottom | |
| var cnt = document.getElementById('cnt'); | |
| if (cnt) cnt.style.minHeight = '100vh'; | |
| } | |
| // Hide bunch of useful UI elements | |
| ['sfcnt', 'top_nav', 'easter-egg', 'topstuff', 'searchform', 'appbar', 'before-appbar'] | |
| .forEach(function(id) { | |
| var e = document.getElementById(id); | |
| if (e && e.style) e.style.display = 'none'; | |
| }); | |
| // Remove promo sidebar | |
| var promo = document.getElementById('promos'); | |
| if (promo) promo.remove(); | |
| document.querySelectorAll('[data-ved]') | |
| .forEach(e => e.style.maxWidth = '100%'); | |
| document.querySelectorAll('cite') | |
| .forEach(c => { | |
| var wrap = c.closest('div'); | |
| if (wrap) wrap.style.position = 'static'; | |
| }); | |
| } catch (e) { | |
| console.error("fix_google_markup() failed with error:", e); | |
| } | |
| } | |
| // --- ALMAANY.COM CLEANUP --- | |
| function fix_almaany_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-almaany-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-almaany-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| /* Declutter the webpage */ | |
| header, | |
| footer, | |
| #search-block, | |
| #search-home, | |
| #sticky-header, | |
| #word-idx, | |
| .ad, | |
| .breadcrumb, | |
| .sidebar-column { | |
| display: none !important; | |
| } | |
| .mainbar-column { | |
| float: none !important; | |
| width: 100% !important; | |
| } | |
| body, .mainbar-column, | |
| .pagination, .panel, .panel-body, | |
| .panel-heading, .panel-lightblue, td | |
| { | |
| background-color: #343a40 !important; | |
| color: #f8f8f2 !important; | |
| } | |
| /* Buttons */ | |
| .next, .dropdown button { | |
| background-color: var(--v-ground-base) !important; | |
| border-color: #337ab7 !important; | |
| color: #f8f8f2 !important; | |
| } | |
| /* Remove Google ads block */ | |
| iframe[id^="google"] { | |
| display: none !important; | |
| } | |
| /* Increase Arabic font size on: */ | |
| /* main translation block */ | |
| p.text-right { | |
| font-size: 22px !important; | |
| } | |
| /* 'Words and Phrases' table */ | |
| td[id^="m"] { | |
| font-size: 22px !important; | |
| } | |
| /* 'Contextual Examples' block */ | |
| .col-md-6.text-right { | |
| font-size: 22px !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_almaany_markup() failed with error:", e); | |
| } | |
| } | |
| // --- CAMBRIDGE.ORG CLEANUP --- | |
| function fix_cambridge_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-cambridge-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-cambridge-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| #onetrust-consent-sdk, #header, #rightcol-above-sticky, #footer, .pr.x.lbb.lb-cm, h1.ti, .am-default_moreslots, .am-default, .ex-opinion, .hfr-s.lt2s.lmt-10, .topslot-container, .dwl.hax, body #stickyslot_placeholder, div[class^="csr-"], #stickyslot_container, .pb-inline-sense, #pbSurveyContainer { | |
| display: none !important; | |
| } | |
| body, .page, .def-body, .sense-body, .dphrase-block, .daccord, .bw, .drunon, #translations { | |
| background: var(--v-ground-base) !important; | |
| color: var(--v-text-base) !important; | |
| } | |
| .h1, .h2, .h3, .dpos-h_hw, .tc-bd, .dsense_h { | |
| color: var(--v-ptext-base) !important; | |
| } | |
| a, .ibd, .iw, .i, .tc-bb { | |
| color: var(--v-anchor-base) !important; | |
| } | |
| .cb i, .cb i:before, .cb i:after { | |
| background: var(--v-anchor-base) !important; | |
| } | |
| .habg:hover, .bo { | |
| background: var(--v-secondary-base) !important; | |
| color: var(--v-text-base) !important; | |
| } | |
| .dwla, .bb { | |
| background: var(--v-primary-base) !important; | |
| color: var(--v-contrast-base) !important; | |
| } | |
| .bh, .bhb { | |
| background: var(--v-ground-darken1) !important; | |
| color: var(--v-text-base) !important; | |
| } | |
| .i-amphtml-notbuilt { | |
| color: var(--v-text-base) !important; | |
| } | |
| .lb, #translations { | |
| border: 1px solid var(--v-primary-base) !important; | |
| } | |
| .cc { | |
| padding-top: 0 !important; | |
| } | |
| #page-content { | |
| margin-top: 0 !important; | |
| } | |
| .dsense-noh, .dsense { | |
| border-color: rgba(var(--text-rgb), 0.12) !important; | |
| } | |
| .def-body > *, .def-head > * { | |
| font-size: var(--font-size) !important; | |
| } | |
| .dthesButton { | |
| color: black; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_cambridge_markup() failed with error:", e); | |
| } | |
| } | |
| // --- DICTIONARY.COM CLEANUP --- | |
| function fix_dictionary_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-dict-com-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-dict-com-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| /* Declutter the webpage */ | |
| aside, nav, [class*="sidebar"], [class*="nav"], | |
| header, hr, footer, video, | |
| .acw, .box-additional, .box-content-top, .cmasAdRoot, .copyright-txt, | |
| .grecaptcha-badge, .grecaptcha-logo, .wrapper-site-hdr, | |
| [data-type="browse-module"], | |
| [data-type="common-quiz-module"], | |
| [data-type="dictionary-carambola-ad"], | |
| [data-type="dictionary-page-navigation-module"], | |
| [data-type="view-definitions-or-synonyms-for"], | |
| [data-type="words-nearby-module"], | |
| [data-type="xotd-module"] | |
| { | |
| display: none !important; | |
| } | |
| /* Links' colour */ | |
| a { | |
| color: #0059d1 !important; | |
| } | |
| /* Webpage colour */ | |
| [data-type="page"] { | |
| background-color: #343a40 !important; | |
| color: #f8f8f2 !important; | |
| } | |
| /* Decrease the margin of main container */ | |
| .wrapper-site-main { | |
| margin-top: 1em !important; | |
| } | |
| /* 'Discover More' text colour */ | |
| #example-sentences, | |
| #idioms-and-phrases, | |
| #other-words-from, | |
| #related-words, | |
| #synonym-study, | |
| #word-history-and-origins { | |
| color: #343a40 !important; | |
| } | |
| /* Ensure the lookup word section remains visible */ | |
| .dictionary-entry, [class*="primary-definition"], .part-of-speech { | |
| display: block !important; | |
| margin: 0 auto !important; | |
| width: 100% !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_dictionary_markup() failed with error:", e); | |
| } | |
| } | |
| // --- ETYMONLINE.COM CLEANUP --- | |
| function fix_etymonline_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-etymonline-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-etymonline-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| /* Declutter the webpage */ | |
| footer, | |
| .backdrop-blur-md, | |
| .border-divider, | |
| .hidden.md\:block.container.py-4, | |
| .mt-0, | |
| .pb-4, | |
| .relative.bg-secondary\/50.w-100\%.relative.left-1\/2.-translate-x-1\/2, | |
| .space-y-2.w-full, | |
| .space-y-8, | |
| .sticky, | |
| [role="separator"], | |
| .top-0 { | |
| display: none !important; | |
| } | |
| /* Main block positioning */ | |
| .container.flex-1.py-4 { | |
| padding: 15px !important; | |
| margin: 0 !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_etymonline_markup() failed with error:", e); | |
| } | |
| } | |
| // --- KARTASLOV.RU CLEANUP --- | |
| function fix_kartaslov_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-kartaslov-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-kartaslov-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| img, | |
| .col-lg-2, | |
| .footer, | |
| .navbar, | |
| .v4-breadcrumbs-bar, | |
| #bottom-bar, | |
| #searchForm, | |
| [class*="yandex"], | |
| [id*="lampobot"], | |
| [id*="lx"], | |
| [id*="yandex"]{ | |
| display: none !important; | |
| } | |
| .container { | |
| padding: 5 0 !important; | |
| margin: 0 0 !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_kartaslov_markup() failed with error:", e); | |
| } | |
| } | |
| // --- LONGMAN CLEANUP --- | |
| function fix_longman_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-longman-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-longman-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| /* Declutter the webpage */ | |
| .am-dictionary, | |
| .column-left, | |
| .footer, | |
| .header, | |
| .parallax-container, | |
| .right_col, | |
| [aria-label="Cookie banner"] { | |
| display: none !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_longman_markup() failed with error:", e); | |
| } | |
| } | |
| // --- MERRIAM-WEBSTER CLEANUP --- | |
| function fix_mw_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-mw-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-mw-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| #mw-sidebar-nav-container, #main-banner-ad-container, #subscribe-unabridged, #definition-right-rail, .right-rail, .additional-content-area, .top-header, .header-placeholder, .global-footer, #related-articles, #social-links, .read-more-content-hint-toggler, .read-more-content-hint-container:after, .disclaimer, #unabridged-promo, #gdpr-consent-tool-wrapper, .adthrive-ad, #anchor-seporator, body div#cmpwrapper.cmpwrapper:empty { | |
| display: none !important; | |
| } | |
| p, .vg-sseq-entry-item-label, .letter, .num, .sub-num, .vg-ins, .content-section-sub-header, .function-label-header, .function-label, .example_sentences, .mw_t_sp, .ex-sent, .badge, .word-history, .word-syllables-entry, .left-content span.mw.no-badge, #citations label, .thread-anchor-content, .card p, .form-select, .entry-header .word-syllables-prons-header-content .play-pron-v2:hover, .left-content .vg a.play-pron-v2, .word-syllables-prons-header-content, .et_snote, h1, .headword-row .vrs, .prons-entry-list-item .l, .error_cont .words_fail_us_cont li, #citations select, .body-500-normal, .prt-a .mw, .redesign-container { | |
| color: var(--v-text-base) !important; | |
| } | |
| .hword { | |
| font-size: 32px !important; | |
| } | |
| .redesign-container, .entry-attr, .ex-sent, .redesign-container a, .redesign-container .left-content p { | |
| font-size: var(--font-size) !important; | |
| } | |
| .widget { | |
| padding-bottom: 15px; | |
| padding-top: 10px; | |
| } | |
| .vg .vg-sseq-entry-item .sb .sb-entry { | |
| padding-bottom: 4px !important; | |
| } | |
| .outer-container { | |
| top: 0 !important; | |
| } | |
| .long-headword .syl, .card-box { | |
| background-color: transparent !important; | |
| } | |
| html, #left-content, .bg-white { | |
| background: var(--v-ground-base) !important; | |
| --bs-body-bg: var(--v-ground-base) !important; | |
| --bs-body-color: var(--v-text-base) !important; | |
| } | |
| .content-section-header, .badge, .card-body, .form-select, .redesign-container .il.il-badge, .error_cont .words_fail_us_cont { | |
| background-color: var(--v-secondary-base) !important; | |
| } | |
| .btn { | |
| background: var(--v-primary-base) !important; | |
| color: var(--v-contrast-base) !important; | |
| border: none; | |
| } | |
| body .entry-header .word-syllables-prons-header-content .play-pron-v2:active { | |
| background: rgba(var(--secondary-rgb), 0.6) !important; | |
| } | |
| path[fill="#303336"] { | |
| fill: var(--v-text-base) !important; | |
| } | |
| a, .important-blue-link, .sense .thes-relevance-meter .meter div:first-child, .mw-grid-table-list ul li a span { | |
| color: var(--v-anchor-base) !important; | |
| } | |
| .example_sentences, .ex-sent, .mw_t_sp, .word-syllables-entry, .mw.no-badge, .et_snote, .prons-entry-list-item .l, #citations select, .body-500-normal, .prt-a .mw { | |
| opacity: 0.9; | |
| } | |
| .example_sentences .auth { | |
| color: rgba(var(--text-rgb), 0.7) !important; | |
| } | |
| .ure, h2 { | |
| -webkit-text-fill-color: var(--v-text-base) !important; | |
| text-fill-color: var(--v-text-base) !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_mw_markup() failed with error:", e); | |
| } | |
| } | |
| // --- MULTITRAN.COM CLEANUP --- | |
| function fix_multitran_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-multitran-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-multitran-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| .banner_top, #translation, .middle_mobile, #__ap_gfc_consent_box_btn__, .adp_interactive_ad, #start > table:first-child, .offset1, .mclass160_120 .menu1, .mclass160_120 .menu, lclass160, rclass300, .menu, .menu1, .empty5, .adfinity-body { | |
| display: none !important; | |
| } | |
| a { | |
| color: var(--v-anchor-base) !important; | |
| } | |
| html, body, .left_col_mobile { | |
| background: var(--v-ground-base) !important; | |
| color: var(--v-text-base) !important; | |
| } | |
| .orig11, .grayline { | |
| background: rgba(var(--text-rgb), 0.08) !important; | |
| color: var(--v-text-base) !important; | |
| } | |
| td { | |
| color: var(--v-text-base) !important; | |
| } | |
| span[style="color:gray"] { | |
| color: rgba(var(--text-rgb), 0.7) !important; | |
| } | |
| .mclass160_120, .mclass160_300 { | |
| padding: 0 1em; | |
| } | |
| td.phras_cnt { | |
| padding-right: 0.2em !important; | |
| } | |
| .container { | |
| margin: 0 0.5em; | |
| } | |
| .mclass160_10 { | |
| padding-left: 0; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_multitran_markup() failed with error:", e); | |
| } | |
| } | |
| // --- NİŞANYANSÖZLÜK CLEANUP --- | |
| function fix_ns_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-ns-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-ns-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| .z-10.w-full.py-2\.5, | |
| .justify-start.px-2.gap-1.grid-flow-col.grid, | |
| .pb-safe-offset-1.pt-2.justify-self-center.self-center.w-full.mt-auto.z-50, | |
| .md\:mb-0.justify-end.mb-1.px-2.gap-1.grid-flow-col.grid { | |
| display: none !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_ns_markup() failed with error:", e); | |
| } | |
| } | |
| // --- TURENG.COM CLEANUP --- | |
| function fix_tureng_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-tureng-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-tureng-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| footer, | |
| .affix-top, | |
| .nts-ad, | |
| .termresults-ad-tr, | |
| .tureng-navbar, | |
| .tureng-searchform-container-container, | |
| .tureng-searchresults-col-left.col-md-8.col-lg-8 > div > .nts-ad-h280.nts-ad { | |
| display: none !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_tureng_markup() failed with error:", e); | |
| } | |
| } | |
| // --- WIKIWAND CLEANUP --- | |
| function fix_wikiwand_markup() { | |
| try { | |
| // Check if styles are already injected to avoid duplication | |
| if (document.getElementById('calibre-wikiwand-styles')) return; | |
| var style = document.createElement('style'); | |
| style.id = 'calibre-wikiwand-styles'; | |
| // Injected CSS string | |
| style.textContent = ` | |
| #navbar, | |
| [class*="extensions_wrapper"], | |
| [class*="footer_wrapper"], | |
| [class*="navbar_wrapper"], | |
| [class*="sidebar_wrapper"], | |
| [class*="wrapper_incontent"], | |
| [class*="wrapper_wrapper"] { | |
| display: none !important; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| } catch (e) { | |
| console.error("fix_wikiwand_markup() failed with error:", e); | |
| } | |
| } | |
| // --- INITIALIZATION --- | |
| var host = location.hostname; | |
| if (host.indexOf('google.com') !== -1) { | |
| window.addEventListener('DOMContentLoaded', fix_google_markup); | |
| // Re-run on resize to handle Google's dynamic layout changes | |
| window.addEventListener('resize', function() { | |
| google_num_tries = 0; | |
| fix_google_markup(); | |
| }); | |
| } else if (host.indexOf('almaany.com') !== -1) { | |
| // Inject styles immediately if DOM is ready, otherwise wait | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_almaany_markup); | |
| } else { | |
| fix_almaany_markup(); | |
| } | |
| } else if (host.indexOf('dictionary.cambridge.org') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_cambridge_markup); | |
| } else { | |
| fix_cambridge_markup(); | |
| } | |
| } else if (host.indexOf('dictionary.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_dictionary_markup); | |
| } else { | |
| fix_dictionary_markup(); | |
| } | |
| } else if (host.indexOf('etymonline.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_etymonline_markup); | |
| } else { | |
| fix_etymonline_markup(); | |
| } | |
| } else if (host.indexOf('kartaslov.ru') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_kartaslov_markup); | |
| } else { | |
| fix_kartaslov_markup(); | |
| } | |
| } else if (host.indexOf('ldoceonline.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_longman_markup); | |
| } else { | |
| fix_longman_markup(); | |
| } | |
| } else if (host.indexOf('merriam-webster.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_mw_markup); | |
| } else { | |
| fix_mw_markup(); | |
| } | |
| } else if (host.indexOf('multitran.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_multitran_markup); | |
| } else { | |
| fix_multitran_markup(); | |
| } | |
| } else if (host.indexOf('nisanyansozluk.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_ns_markup); | |
| } else { | |
| fix_ns_markup(); | |
| } | |
| } else if (host.indexOf('tureng.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_tureng_markup); | |
| } else { | |
| fix_tureng_markup(); | |
| } | |
| } else if (host.indexOf('wikiwand.com') !== -1) { | |
| if (document.readyState === 'loading') { | |
| window.addEventListener('DOMContentLoaded', fix_wikiwand_markup); | |
| } else { | |
| fix_wikiwand_markup(); | |
| } | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment