1. 10 Sep, 2022 2 commits
    • Lucas Werkmeister's avatar
      Simplify GitLab URL · 8df38d8f
      Lucas Werkmeister authored
    • Lucas Werkmeister's avatar
      Move to toolforge-repos/ namespace in GitLab · ec75eef0
      Lucas Werkmeister authored
      I already moved the repository manually from Diffusion to Wikimedia
      GitLab, under my personal namespace (commit 15ade382), but now all
      Diffusion tool repos were moved to the toolforge-repos/ namespace
      instead. Use that for consistency with other tools; I’ll see if I can
      set up the lucaswerkmeister/ version to mirror toolforge-repos/,
      otherwise I’ll delete it.
  2. 27 Jul, 2022 1 commit
  3. 24 Jul, 2022 3 commits
  4. 26 May, 2022 3 commits
    • Lucas Werkmeister's avatar
      Simplify a selector · e878def7
      Lucas Werkmeister authored
      I think :not() has broad enough browser support that we can do this.
      (Some more selectors could be combined or simplified using :is(), but I
      don’t think that’s sufficiently widely supported yet.)
    • Lucas Werkmeister's avatar
      Disable underline for depicted links · 3b94e65e
      Lucas Werkmeister authored
      Bootstrap 5 underlines links by default even if not hovered; for the
      depicted links, this is too much, since the underline can obscure other
      depicteds or the underlying image. Disable the underline unless the link
      is hovered or focused; MediaWiki core’s elements.less (shared by most if
      not all skins, I assume) uses the same pseudo-classes.
      Put this style in image.css, not depicted.css, as it doesn’t make sense
      on-wiki; but add pointers between the two files.
    • Simon04's avatar
  5. 22 May, 2022 15 commits
    • Lucas Werkmeister's avatar
      Refactor colors in depicted.css · a846c4f7
      Lucas Werkmeister authored
      Someone suggested to use a semi-transparent background instead of an
      outline (I’m not sure if they’d want to be named here or not ^^). I’m
      not convinced by it, but this changed organization of the CSS (with no
      effect) at least makes it easier to try out. Users can add the
      background, and potentially remove the outline, in their user CSS, if
      they want. (That includes browser extensions like Stylish, or also, for
      the user script [1], their common.css on Wikimedia Commons.)
      [1]: https://www.wikidata.org/wiki/User:Lucas_Werkmeister/Wikidata_Image_Positions#User_script
    • Lucas Werkmeister's avatar
      Move from Diffusion to Wikimedia GitLab · 15ade382
      Lucas Werkmeister authored
      Apparently Wikimedia GitLab is considered stable enough for personal
      projects like this by now, and getting rid of Diffusion is always a good
      thing. Note that we stay on GitHub for CI purposes, at least until
      global job runners are available (T297426).
      The list of contribution methods in the README can perhaps be removed or
      at least abridged later; the main point of the old list was
      “Differential is terrible and I prefer literally anything else”, and
      with Diffusion gone, that’s no longer a concern, so it’s probably enough
      to just let people choose between pull requests on either platform for
      themselves (or use the email workflow if they really want to).
    • Lucas Werkmeister's avatar
      Rebuild requirements.txt on Toolforge Python 3.9 · 2264a649
      Lucas Werkmeister authored
      Apparently the dependencies vary by Python version; with the
      requirements.txt built on Python 3.10, the tests failed on Toolforge
      after pip-sync removed importlib_metadata (though they still pass in CI?
      no idea why).
    • Lucas Werkmeister's avatar
      pip-compile --upgrade · d6fdb0b0
      Lucas Werkmeister authored
    • Lucas Werkmeister's avatar
      Merge branch 'flake8' · 4df5c4ae
      Lucas Werkmeister authored
      Add a code style linter and fix some issues it pointed out. A handful of
      rules remain ignored for the time being.
    • Lucas Werkmeister's avatar
      Add whitespace around arithmetic operators · 68959cf1
      Lucas Werkmeister authored
      Not really happy with the [i:i + 50] (the more associative operator has
      spaces, that’s not nice), but not worth fighting Flake8 over.
    • Lucas Werkmeister's avatar
      Reformat one flask.url_for() call · f4c9dd8e
      Lucas Werkmeister authored
      Flake8 pointed out the indentation wasn’t consistent.
    • Lucas Werkmeister's avatar
      Add space after comma in list · fdf5d4b8
      Lucas Werkmeister authored
      The previous style was nicely compact, but not worth the Flake8 warning
      (or ignore), I’d say.
    • Lucas Werkmeister's avatar
      Put two spaces before inline comments · 58c1551b
      Lucas Werkmeister authored
    • Lucas Werkmeister's avatar
      Make regex pattern raw strings · b650d5a6
      Lucas Werkmeister authored
      Flake8 pointed out that the \. was previously an invalid escape
      sequence. (It seems to have produced the equivalent of \\., which is
      what we wanted, so that’s good.)
    • Lucas Werkmeister's avatar
      Don’t use import * · 4f4a6182
      Lucas Werkmeister authored
      Flake8 doesn’t like it, and I can see the reasoning behind it.
    • Lucas Werkmeister's avatar
      Remove unused import · c07f27c7
      Lucas Werkmeister authored
      Became unused in commit 233eec74.
    • Lucas Werkmeister's avatar
      Add flake8 to make check · 387b21a6
      Lucas Werkmeister authored
      With all current errors ignored in .flake8. I’ll fix and unignore some
      of them in separate commits.
    • Lucas Werkmeister's avatar
      Slightly rephrase abort message · 4630899d
      Lucas Werkmeister authored
      The bad data isn’t necessarily on Wikidata, it might also be on Commons.
      Follows-up #5.
    • Lucas Werkmeister's avatar
      Abort on invalid IIIF region · 2bb7a08f
      Lucas Werkmeister authored
      This is just slightly nicer than crashing, but still an improvement. I
      don’t think more sophisticated support for invalid regions is worth the
      development effort. (Treating such qualifiers as if they didn’t exist at
      all would be bad, in my opinion, so the “correct” solution should really
      show these bad qualifiers to the user and replace them on edit…)
      Fixes #5.
  6. 20 May, 2022 11 commits
    • Lucas Werkmeister's avatar
      Space buttons using margin instead of text nodes · eeb434ac
      Lucas Werkmeister authored
      This is easier to do and avoids the problem of adding the text node
    • Lucas Werkmeister's avatar
      Add cancel buttons as alternative to pressing Esc · b4e420ae
      Lucas Werkmeister authored
      This is more discoverable and also more mobile-friendly.
    • Lucas Werkmeister's avatar
      Remove dead code from saveCropper() calls · 31b551a5
      Lucas Werkmeister authored
      The ability for the user to decline to save only existed in
      QuickStatements mode, and the corresponding depicted.remove() call was
      removed with the rest of QuickStatements mode in ac82f704.
    • Lucas Werkmeister's avatar
      Refactor Esc handling JS code · 206c1fce
      Lucas Werkmeister authored
      I want to add “cancel” buttons, so the code apart from checking whether
      the keypress was Escape or not will be needed for that too. Extract the
      onEscape() handler so we can keep it out of the handler functions.
      Also, this made me realize that we’re generally failing to remove the
      event handler after successfully editing; fix that.
    • Lucas Werkmeister's avatar
      Remove unused function in image.js · 7abe262b
      Lucas Werkmeister authored
      Some work in progress that I forgot to remove :D
    • Lucas Werkmeister's avatar
      Support MediaInfo IDs and URLs as image title inputs · f039f87a
      Lucas Werkmeister authored
      In addition to the previous commit (file URL as input), also support
      MediaInfo entity IDs and their URIs in the image title input.
      Resolves #3.
    • Lucas Werkmeister's avatar
      Support URLs as image title inputs · 233eec74
      Lucas Werkmeister authored
      Similar as in the previous commit, allow users to paste various URLs
      into the image title input and try to parse the ID out of them, for
      convenience. This doesn’t support entity ID-based URLs yet, though.
      File:Vegetarian Pizza.jpg is an arbitrary featured image with a
      reasonably simple title (while still containing a space).
    • Lucas Werkmeister's avatar
      Support URLs as item ID inputs · adf950d2
      Lucas Werkmeister authored
      Allow users to paste various URLs into the item ID input and try to
      parse the ID out of them, for convenience.
      The parsed URL behavior of picking the *last* title from the URL
      (query.get('title', [''])[-1]) is meant to match MediaWiki, since that
      seems to do the same: www.wikidata.org/w/index.php?title=Q1&title=Q2
      shows Q2, not Q1.
      “Item ID” is really a misnomer here, because we also support properties,
      lexemes, senses and forms (as shown by the previous pattern in the
      HTML). However, I don’t have a good alternative term to use here (it
      can’t be “entity” because it should not include MediaInfo entities,
      which we handle differently), so we leave it at “item” for now. I
      suspect, but haven’t thoroughly checked, that most if not all other uses
      of the term “item” in the tool also really mean “non-MediaInfo entity”.
    • Lucas Werkmeister's avatar
      Make image height less than full viewport height · 010a68ca
      Lucas Werkmeister authored
      Leave a bit of space around the image, so that parts of the user
      interface can be visible at the same time: roughly enough space for the
      scale slider above and a few depicteds without region below. But on very
      small screens, make sure this doesn’t make the max-height negative.
    • Lucas Werkmeister's avatar
      Refactor CSS image size calculations · a275e4ee
      Lucas Werkmeister authored
      Move the calculation of the wrapper size to the wrapper element’s own
      CSS, and inherit it in the img CSS as a variable. This shouldn’t have
      any effect yet, but paves the way for tweaking the wrapper size in the
      next commit.
    • Lucas Werkmeister's avatar
      Scroll only image when scaling up · 2fc87dbc
      Lucas Werkmeister authored
      Put the image inside a wrapper, and scroll only that wrapper if the
      image overflows it, rather than scrolling the whole page. This keeps the
      rest of the user interface more accessible.
      The CSS needs to be tweaked a little due to the extra element; to make
      the hidden buttons work, the wrapper needs to be tagged with the
      --active class as well (though we still keep it on the image too).
  7. 17 May, 2022 2 commits
    • Lucas Werkmeister's avatar
      Add info message when users cannot edit · 803f7f1f
      Lucas Werkmeister authored
      While this tool initially started as a *viewer* of “relative position
      within image” qualifiers, it quickly became an *editor* of this data,
      and this may in fact be its primary use now. As such, we should let
      users know when they can’t edit, whether that’s because they’re not
      logged in and/or because JavaScript is disabled.
      The notice is styled like an alert, but doesn’t have role="alert", since
      it’s not information that requires the user’s immediate attention (if
      users are not interested in editing, they might be okay with seeing this
      message on every page view) – I just like Bootstrap’s alert styles
      better than the card styles (which would be one alternative).
      Note that authentication_area() in app.py takes care to not add a
      useless login link when the app doesn’t have OAuth configured, but we
      don’t repeat this complexity in the edit_info(); I’m just not very
      interested in local development of this tool without OAuth anymore.
    • Lucas Werkmeister's avatar
      Add missing class prefix to iiif_region.html · da574855
      Lucas Werkmeister authored
      I missed this one in ceb0b0cf.
  8. 15 May, 2022 3 commits
    • Lucas Werkmeister's avatar
      Limit srcset to widths below the image width · b2fea901
      Lucas Werkmeister authored
      Now that we know the width, remove sizes wider than the actual image
      width from the srcset, to keep it shorter and avoid requesting the same
      file by different names. Also, if the image width (entry added in the
      previous commit) is exactly one of the pre-defined widths (for which see
      mainly commit 3fce0034), don’t repeat it, by adding the unique filter.
    • Lucas Werkmeister's avatar
      Add full-width URL to srcset · f394cb09
      Lucas Werkmeister authored
      Now that we have the width (and height) of the file, add it as another
      source to the srcset; without this, the full-resolution src doesn’t
      always seem to be loaded. (It’s illegal to mix x and w sources in the
      same srcset, so specifying just the URL on its own without a width,
      which is the same as 1x, would not have been allowed.)
      Note that we still use Special:FilePath instead of {{ image_url }} here,
      because the srcset must contain PNG or JPEG thumbnails (compare the
      comment of ensureImageCroppable() in image.js), whereas the image_url
      may use more exotic formats like TIFF.
      In practice, I’m not completely happy with what the desktop browsers
      I’ve tested (Firefox and Chromium) do with this srcset, but it seems to
      be better than before, at least.
    • Lucas Werkmeister's avatar
      Make the image at most as high as the viewport · ec0407e3
      Lucas Werkmeister authored
      Add an additional restriction on the max size of the image: it should
      not only be no wider than the page (minus padding), but also no higher
      (no padding to be considered on this axis). The scale still applies.
      Because calc() can only divide by numbers, i.e. we can’t divide the
      var(--width) / var(--height) and have the px cancel each other out, we
      need another variable with the numeric ratio. (Could also be two
      separate variables, but then the naming of the variables with vs.
      without px would become more confusing.) Use this opportunity to also
      add another comment listing the available variables more explicitly.
      Closes #1.