AO3: just my languages

Reduce language options to your preferences

< AO3: just my languagesについてのフィードバック

レート:可 - スクリプトは動作するがバグがある

§
投稿日: 2025/06/14

hi. I noticed a couple of bugs on the New Work page :)

I have this config for testing:

    const dropdownLanguages = ['en', 'de', 'es', 'fr', 'qmd']
    const boldedLanguages = ['en']
    const languagesForMultilingualSearch = ['en', 'de']

    const modifyFilterDropdown = false
    const autofillSearch = 2
    const defaultLanguage = 'es'

    // new work / new imported work / edit work
    const modifyEditorDropdown = true
    const defaultWritingLanguage = 'en' // OPTIONAL: add a language to autofill on new works

first, modifyEditorDropdown gets ignored. the if in line #84 uses the wrong config variable:

if (modifyFilterDropdown) {reduceDropdownLangs(); boldDropdownLangs()}

instead of

if (modifyEditorDropdown) {reduceDropdownLangs(); boldDropdownLangs()}

so in my config the New Work page should have a filtered dropdown, but doesn't.


second, defaultWritingLanguage also is ignored. although the function call is

if (pageURL.includes('/works/new')) {autofillBlankDropdown(defaultWritingLanguage)}

the function itself has a typo. the [lang=""] selector uses the defaultLanguage config, instead of the function parameter defaultLang:

    // Autofill the dropdown if it is empty and the user selected a default language
    function autofillBlankDropdown(defaultLang) {
        if (!defaultLang || dropdown.val()) {return}
        dropdown.children(`[lang="${defaultLanguage}"]`).attr('selected','selected')
    }

therefore it ends up always setting Spanish instead of English in my config.

返信を投稿

返信を投稿するにはログインしてください