Giter VIP home page Giter VIP logo

wd's Introduction

Wikidata browser extension

Get this Extension for 🦊 Firefox, Chrome

 Douglas Adams on Wikipedia with Wikidata for Firefox

Features

  • Display wikidata-Items while browsing the web.
  • Add missing IDs/items to Wikidata
  • Extract information from websites to wikidata

Development-Setup

Build locally

  1. Checkout the repository to your local machine eg. with git clone [email protected]:fuddl/wd.git
  2. run yarn to install all required dependencies
  3. run yarn build

The build step will create the distribution folder, this folder will contain the generated extension.

Run the extension

Using web-ext is recommened for automatic reloading and running in a dedicated browser instance. Alternatively you can load the extension manually (see below).

  1. run yarn watch to watch for file changes and build continuously
  2. run npm install --global web-ext (only only for the first time)
  3. in another terminal, run web-ext run --start-url https://www.wikidata.org/wiki/Q16276 for Firefox or web-ext run -t chromium

Note: Firefox will automatically reload content scripts when the extension is updated, Chrome requires you to reload the page to reload the content scripts.

Manually

You can also load the extension manually in Chrome or Firefox.

wd's People

Contributors

fuddl avatar stvad avatar dependabot[bot] avatar bradfora avatar camelcasenick avatar egonw avatar loominade avatar

Stargazers

Moonrise avatar  avatar Matthias Winkelmann avatar Sanqui avatar Jason Zhang avatar Avindra Goolcharan avatar Neil Carmichael avatar Pierre-Marie Allard avatar  avatar  avatar Magnus Sälgö avatar nicolas avatar  avatar Louis Royer avatar Stuart P. Bentley avatar Raymond Berger avatar Waldir Pimenta avatar  avatar  avatar Daniel Mietchen avatar Timo Tijhof avatar  avatar  avatar Pedro Reyes Alejandre avatar Jonathan Brier avatar Florian Cuny avatar Connor Shea avatar  avatar Nizo Priskorn avatar  avatar Daniel Erenrich avatar João Cavalcante avatar  avatar Michael F. Schönitzer avatar  avatar  avatar

Watchers

Daniel Erenrich avatar  avatar Avindra Goolcharan avatar  avatar Pierre-Marie Allard avatar  avatar Neil Carmichael avatar  avatar Rck-fd avatar

wd's Issues

Migrate from manual dom manipulation to React to make future development & contributions easier

more motivation?

#38 sets up initial usage for sidebar managment

Strategy

Questions

  • Is there a need for state-management (redux-style) ?

Anonymous edits occur on Wikidata without warning even when logged into Wikidata in another tab

Environment:
Firefox v84.0.1 on Linux.
This extension v0.132.
No other extensions enabled.

Steps to reproduce:

  1. Close all instances of Firefox and start a new instance (Firefox starts with this extension side bar closed).
  2. Login to Wikidata.
  3. Open this extension side bar.
  4. Open a new tab and navigate to an item on an external site e.g. IMDB.
  5. Add a missing external ID to an existing Wikidata object using this extension side bar.
  6. Note in Wikidata that the edit was done anonymously with the IP address showing, instead of being made with the Wikidata account logged into under step (2).

Would it be possible to warn users that the edit they're about to make would be done anonymously, and then provide information on what would need to be done to login to Wikidata?

Make external links within the sidebar open in a new tab

It probably makes sense to do internal navigation for wikidata items/etc directly in sidebar.
But I think most of the external links should be opened in a new tab, this is especially relevant for an iframe version, as many sites balk at being rendered in an iframe =\

This extension causes edit links to disappear

List of steps to reproduce (step by step, including full links if applicable):

  1. Load https://en.wikipedia.org/wiki/South_Pole_Telescope
  2. Select 'The South Pole region' in the 'Microwave and millimeter-wave observations at the South Pole' section
  3. Try to edit that section

What happens?:

  • The edit link for the section disappears when you select the text

What should have happened instead?:

  • The edit link should still remain visible

I originally reported this at https://phabricator.wikimedia.org/T303108 since I thought it was a MediaWiki issue, but it seems to only happen when using this extension. I'm using extension version 0.224 in Firefox 97.0.1 on Mac OS 12.2.1.

Links on Twitter don't work

I've tried using Twitter search to add Discord invite IDs (P9078) for people with verified Twitter accounts. For example, this tweet would be usable as a reference. However, both on the search page and on the page for the tweet itself, I wasn't able to add a P9078 statement to Jonathan Mann (Q6273813).

(Even if I had been able to do this, I would have had to add qualifiers separately to avoid constraint violations.)

Hide certain qualifiers

currently statements are only visible when they have a preferred rank or when they have a normal rank and no statement with a preferred rank is present. Subsequently, there is no need to display the qualifier reason for preferred rank

outsource regular expressions to wikidata

resolver__regex.js currently contains a list of regular expressions the extract external-id from urls that contain them:

P345:  /^https:\/\/(?:www|m)\.imdb\.com\/(?:(?:search\/)?title(?:\?companies=|\/)|name\/|event\/|news\/)(\w{2}\d{7})/,
P8013: /^https:\/\/trakt\.tv\/(people\/[^\/]+|movies\/[^\/]+|shows\/[^\/]+\/seasons\/\d+\/episodes\/\d+)/,
P2002: /^https:\/\/(?:(?:mobile\.)?twitter\.com\/(?:intent\/user\?screen_name\=)?(?!hashtag)([0-9A-Za-z_]{1,15})|tools\.wmflabs\.org\/scholia\/twitter\/([0-9A-Za-z_]{1,15}))/,
P434:  /^https:\/\/(?:musicbrainz\.org\/artist\/|www\.bbc\.co\.uk\/music\/artists\/)([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/,
P436:  /^https:\/\/musicbrainz\.org\/release-group\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/,
P724:  /^https:\/\/archive\.org\/details\/([0-9A-Za-z@\._-]+)/,
P2969: /^https:\/\/www\.goodreads\.com\/book\/show\/(\d+)/,
P6327: /^https:\/\/www\.goodreads\.com\/characters\/(\d+)/,
P1651: /^https:\/\/www\.youtube\.com\/watch\?v=([-_0-9A-Za-z]{11})/,
P1821: /^https:\/\/\w+\.openfoodfacts\.org\/category\/((?:[a-z]{2,3}:)?[a-z-]+)/,
P5930: /^https:\/\/\w+\.openfoodfacts\.org\/ingredient\/((?:[a-z]{2,3}:)?[a-z-]+)/,
P2397: /^https:\/\/\w+\.youtube\.com\/channel\/(UC[-_0-9A-Za-z]{21}[AQgw])/,
P4198: /^https:\/\/play\.google\.com\/(?:store\/music\/artist\?id=|music\/listen\#\/(?:wst\/)?artist\/)(([A-Z]|[a-z]|[0-9]){27})/,
P4300: /^https:\/\/(?:music|www)\.youtube\.com\/playlist\?list=((?:PL|OLAK|RDCLAK)[-_0-9A-Za-z]+)/,
P5327: /^https:\/\/www\.fernsehserien\.de\/([^?#]+)/,
P3984: /^https:\/\/www\.reddit\.com\/r\/([^\/?#]+)\//,
P1733: /^https:\/\/(?:store\.)?steam(?:community|powered)\.com\/app\/(\d+)/,
P2725: /^https:\/\/www\.gog\.com\/([^#?]+)/,
P4477: /^https:\/\/www\.humblebundle\.com\/store\/([^#\?\/]+)/,
P1933: /^https:\/\/www\.mobygames\.com\/game\/([^#\?\/]+)/,

ideally these regular expressions should be provided by the wikidata community.

links (income edges) view links only to links view

The links view for what links to an item is a sink regarding linking between views, e.g., you cannot get back to the entity (outgoing edges) view. Additionally, the links view only links to the links view of the properties and items displayed on it. This can lead to confusion: When a selected item has an incoming link from an item with no incoming links, clicking on this item in the links view results in an empty screen. I would have expected to get to the entity view anytime I click on an entity.

User testing?

I just tried to use the extension. I failed to add a single statement. I tried opening the Qid on wikidata.org and failed. I tried leaving feedback directly in the extension and failed.
In the end I went to wikidata and searched for "wikidata firefox" and found my way here to report.

I wonder. Have you done any user testing? Do you have a prototype in figma.com or similar tool that you used during development?

Cheers

add a readme file

  • what is it?
  • features?
  • call for participation

Notes

  • screenshot should not contain copyrighed material
  • screenshots should not be included into the package

The relationship direction switcher (⬆/⬇) is not intuitive

Hi there,

I found the grey arrow in the UI not quite intuitive.

It would be great to amend the arrow with its meaning, either textual or graphical.

Cheers! Robert

Context

clicking the arrow currently flips the direction of the statement:

Before clicking the arrow After clicking the arrow
no-flipped flipped

add reference statements to claim adding tool

  • Reference URL (P854) of the current page
    • preferably with an ?oldid= parameter if the source is a mediawiki
    • preferably with a #hash of the section that contained the link
  • section, verse, paragraph, or clause (P958) of the section that contained the link
  • retrieved (section, verse, paragraph, or clause) with the current date
  • title (P1476) of the page that contained the link

[UX] Show incremental progress in the "improve" view

Right now the improve view will show you the current source extension is processing to discover the additional data, but it's not clear if it's found anything so far.

When working on #34 I accidentally disabled overlay and it allowed me to see that extension incrementally collects and shows fields found so far, which I believe provides a better UX (better in the moment feedback and ability to terminate early if you are happy with the results already found)

Just disabling overlay looks weird when nothing is found, but I imagine this can be done like:

  • start with current overlay
  • when first result is found transition into showing underlying "add fields" view with fields found so far
    • continue showing indication of the ongoing search on sidelines

[BUG] Adding duration claim with wrong format

Example: https://www.wikidata.org/w/index.php?title=Q110138137&oldid=1544732821#P2047

The addon adds episode durations accurate to the second, but the duration of an episode should be accurate to the minute. Take a look at the interface of trakt.tv, where the information is from. Even if they save it accurate to the second, the duration is always a round minute.

Expected behaviour: Check whether the duration is divisible by 60, if so, save the minute duration. In combination with 4806506 the example above would ideally lead to only one claim with 24 minutes and two references.

Speed up "improve" process by making link processing async

Right now each source is processed sequentially, but most of the time is probably spent on asynch operation like fetching data from APIs, so this can likely be significantly faster if we were to switch to doing it async for all the sources at the same time

extension 'forgets' what it just connected as soon as the url changes

Steps to reproduce

  1. open a thing not yet connected to wikidata and connect it
    Screen Shot 2020-12-31 at 12 18 10
  2. immediately after that, open a site, that should be connected to the same wikidata entity (i.e. on imdb open the Cast and Credts section)
    Screen Shot 2020-12-31 at 12 18 42

Expected result

The extension should remember that the thing we have just connected since the website we have open now, also has the same id in its url:
Screen Shot 2020-12-31 at 12 22 56

Actual result

The extension has never seen that url before and thus does not know which Wikidata entity is associated to it, and the Wikidata api does not distribute that information yet.
Screen Shot 2020-12-31 at 12 18 47

Possible Solution

Add an additional layer of caching that does not only consider the current url but also the extracted id of the current url.

Extension crashes on pdf pages in Chrome

I'm positively surprised by the fact that it loads in a first place :p, it crashes though, as the PDF document has a different dom structure (does it even have a dom?) and so when we try retrieve title/etc findApplicable fails

extension breaks the browser back-button

Steps to reproduce

  1. enable the application
  2. open any website that does not resolve to a wikidata object; e.g. https://www.urbandictionary.com/define.php?term=foo
  3. click any link in that site; e.g. homie
  4. click the browser back button

Expected result

browser should return to https://www.urbandictionary.com/define.php?term=foo

Actual result

nothing happens.

when clicked again, the back button will navigate to the correct site.

Environment

Firefox 96.0.3, macOS 12.1 (21C52)

Extract resolvers into a separate package so they can be used in other applications

Example use-case: https://twitter.com/VladyslavSitalo/status/1462908339860430855

Depends on #34

Tasks

  • Remove dependency on browser api so it can be used outside the context of the extension
  • Potentially have several layers of resolvers (node compatible, browser compatible)

Considesations:

  • can keep code in the same repo (making this a monorepo) potentially simplifying code management initially but potentially making future contributions harder
    • Or extract into a separate repo
  • License: using a more permissive license (MIT, Apache, etc) is IMO a better approach for the library
  • It'd be nice to have a single interface for accessing the resolvers (e.g. a set of functions) (vs current situation where users have to iterate through all resolvers)

When extension can make a good guess about what entity current web object maps to it should indicate/display that

The current behaviour is for it to suggest creating a new entity, and the in the connection dialog show some potential matches (which are often accurate).
Which on one hand encourages adding missing information (good), but provides less immediate utility value (bad?)

So maybe one option would be to display guesses more prominently, while clearly indicating that it's a guess and that you can "connect" the page to solidify the match

Improve UX for adding new fields from the page

Right now it's quite cumbersome. Some things that I think can improve the experience:

  • Merge add view into the display view
    • Basically allow people to click a plus button in the bottom and add an arbitrary field (repeatedly)
    • Do the on-the-page entities discovery fully async
  • Allow connecting entities that are not found from the page (via direct id entry, and via search)
  • Don't push the buttons out of screen view (esp when there is enough space)
  • (current add view) Add a signifier that indicates that it's possible to change the field type you're adding

Issues to fix:

  • If none of the links resolve to anything the add view is forever stuck in the "waiting" state

Add a reference for imported statements

At minimum the URL of the page and retrieval time should be added. If the statement already exists then instead of duplicating it add this as a new reference.

A more sophisticated approach would be to let the user indicate where on the page the statement is claimed and link to that section direccly

Big code reformat

@fuddl you mentioned potentially running reformat on the whole codebase after #38 is merged. This is to coordinate on the config/which rules should it enforce.

or

Let's not have unnecessary semicolons & other questions of taste 😛

[Feature Req] Google/Bing search data extraction

Thoughts on adding a feature which captures google search / bing knowledge panels as identifiers?

For example:

  • Google/Bing search "NEA" (national education association)
  • Google shows a knowledge panels on the right
  • This extension identifies that the current page is "about" Q3111510 via the knowledge graph identifiers on page
  • Allows me to add properties from the page e.g. their twitter

This would require special handling for these URLs since they don't properly embed the graph id on this page.

I would be willing to code this feature if it's deemed acceptable.

Handle Case Insensitive Identifiers

Twitter usernames (for example) are case insensitive. If I tell the plugin to link a twitter handle to an item and the same handle is already present (but in a different case) it should not add the redundant case. You can detect whether a property is sensitive to case by checking for "has quality" "case insensitivity".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.