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.

§
发布于:2025-06-26

Many thanks for the detailed write-up! Sorry it took me a while to get back to you, the heat's been horrendous and doesn't lend itself to debugging. There were a couple of extra bugs complicating matters: the "new" page actually has a second, hidden language dropdown for "inspired by" / "parent" works, which the code couldn't handle, and I also managed to break the CSS for that one page, so nothing was being hidden.

All bugs are now fixed (I hope) and the page should work as expected. Note that I renamed the config variables for clarity, so you'll need to paste in your saved variables for each one.

§
发布于:2025-07-05

awesome, thank you!! <3 especially filtering down the language list to a few entries makes my life so much easier.

§
发布于:2025-07-06

:D

Made a new script by the way, take a look: https://gf.qytechs.cn/en/scripts/541375-ao3-prioritise-my-faves

发布留言

登录(不可用)以发布留言。

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址