Skip to content

Commit

Permalink
Merge pull request #38 from Stvad/chromium
Browse files Browse the repository at this point in the history
Chromium support
  • Loading branch information
fuddl authored Jan 23, 2022
2 parents 3885a1d + 120cd20 commit 33c94e0
Show file tree
Hide file tree
Showing 34 changed files with 996 additions and 464 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["@emotion/babel-plugin"]
}
4 changes: 3 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ env:
browser: true
webextensions: true
es6: true
extends:
- plugin:react-hooks/recommended
rules:
quotes: 0
no-trailing-spaces: 0
Expand All @@ -16,4 +18,4 @@ rules:
- tab
- SwitchCase: 1
parserOptions:
ecmaVersion: 2020
ecmaVersion: 2020
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Wikidata for Firefox
# Wikidata browser extension

[Get this Extension for 🦊 Firefox!](https://addons.mozilla.org/en-US/firefox/addon/wikidata/)
Get this Extension for [🦊 Firefox](https://addons.mozilla.org/en-US/firefox/addon/wikidata/),
[Chrome](https://chrome.google.com/webstore/detail/wikidata/iijkiilckldlddidhaomggfadfafpdfd)

![ Douglas Adams on Wikipedia with Wikidata for Firefox ](https://upload.wikimedia.org/wikipedia/commons/3/36/Douglas_Adams_on_Wikipedia_with_Wikidata_for_Firefox.png)

## Features

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

## Development-Setup
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@
"extends": "stylelint-config-xo"
},
"dependencies": {
"@emotion/react": "^11.7.1",
"react": "^17.0.2",
"react-burger-menu": "^3.0.6",
"react-dom": "^17.0.2",
"webextension-polyfill": "^0.8.0",
"wikidata-sdk": "^7.14.2"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.7.1",
"@parcel/config-webextension": "^2.0.0-rc.0",
"@parcel/transformer-image": "^2.0.0-rc.0",
"@parcel/transformer-yaml": "^2.0.1",
"@types/react": "^17.0.37",
"@types/react-burger-menu": "^2.8.2",
"@types/react-dom": "^17.0.11",
"@types/webextension-polyfill": "^0.8.2",
"eslint-plugin-react-hooks": "^4.3.0",
"npm-run-all": "^4.1.5",
"parcel": "^2.0.0-rc.0",
"stylelint": "^13.13.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { sparqlQuery } from "../sqarql-query.js"
import { getTokens } from '../sidebar/wd-get-token.js';
import { wikidataGetEntity } from '../wd-get-entity.js';
import { resolvers } from '../content/resolver.js';
import { pushEnitiyToSidebar } from "./push-enitiy-to-sidebar.js"
import { updateStatus } from "../update-status.js"
import {getTokens} from '../sidebar/wd-get-token.js'
import {wikidataGetEntity} from '../wd-get-entity.js'
import {resolvers} from '../content/resolver.js'
import {pushEnitiyToSidebar} from "./push-enitiy-to-sidebar.js"
import {updateStatus} from "../update-status.js"
import browser from 'webextension-polyfill'


function groupJobs(jobs) {
let groupedJobs = {};
Expand Down Expand Up @@ -106,8 +107,9 @@ async function processJobs(jobsUngrouped) {
}

if (lastEdit) {
if (lastEdit.job.fromTab) {
pushEnitiyToSidebar(lastEdit.id, lastEdit.job.fromTab, true, true);
const tabId = lastEdit.job.fromTab
if (tabId) {
await pushEnitiyToSidebar(lastEdit.id, tabId, true, true);
}

if (lastEdit.job.fromUrl) {
Expand Down
8 changes: 8 additions & 0 deletions src/background/command-listener.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as browser from 'webextension-polyfill'
import {Browser} from "../core/browser"

export const setupCommandListener = () => {
// For now just redirect to current tab, as that's where we want to handle shortcuts
browser.commands.onCommand.addListener(
async command => Browser.sendMessageToActiveTab({type: command}))
}
Loading

0 comments on commit 33c94e0

Please sign in to comment.