├── .eslintignore
├── .eslintrc.json
├── .github
└── workflows
│ └── release.yml
├── .gitignore
├── .gitmodules
├── .travis.yml
├── README.md
├── chrome.manifest
├── content
├── overlay.xul
├── preferences.xul
└── zotero-auto-index.ts
├── defaults
└── preferences
│ ├── defaults.coffee
│ └── defaults.js.map
├── esbuild.js
├── locale
└── en-US
│ ├── zotero-auto-index.dtd
│ └── zotero-auto-index.properties
├── package-lock.json
├── package.json
├── skin
└── default
│ ├── auto-index.svg
│ └── overlay.css
├── tsconfig.json
└── zotero-plugin.ini
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.d.ts
3 | generator-temp
4 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "env": {
4 | "browser": true,
5 | "es6": true,
6 | "node": true
7 | },
8 | "extends": [
9 | "eslint:recommended",
10 | "plugin:@typescript-eslint/recommended",
11 | "plugin:@typescript-eslint/eslint-recommended",
12 | "plugin:@typescript-eslint/recommended-requiring-type-checking"
13 | ],
14 | "parser": "@typescript-eslint/parser",
15 | "parserOptions": {
16 | "project": "tsconfig.json",
17 | "sourceType": "module"
18 | },
19 | "plugins": [
20 | "eslint-plugin-import",
21 | "eslint-plugin-prefer-arrow",
22 | "@typescript-eslint",
23 | "@typescript-eslint/eslint-plugin"
24 | ],
25 | "rules": {
26 | "@typescript-eslint/adjacent-overload-signatures": "error",
27 | "@typescript-eslint/array-type": [
28 | "error",
29 | {
30 | "default": "array"
31 | }
32 | ],
33 | "@typescript-eslint/await-thenable": "error",
34 | "@typescript-eslint/ban-ts-comment": "warn",
35 | "@typescript-eslint/ban-types": [
36 | "warn",
37 | {
38 | "types": {
39 | "Object": {
40 | "message": "Avoid using the `Object` type. Did you mean `object`?"
41 | },
42 | "Function": {
43 | "message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
44 | },
45 | "Boolean": {
46 | "message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
47 | },
48 | "Number": {
49 | "message": "Avoid using the `Number` type. Did you mean `number`?"
50 | },
51 | "String": {
52 | "message": "Avoid using the `String` type. Did you mean `string`?"
53 | },
54 | "Symbol": {
55 | "message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
56 | }
57 | }
58 | }
59 | ],
60 | "@typescript-eslint/consistent-type-assertions": "error",
61 | "@typescript-eslint/dot-notation": "error",
62 | "@typescript-eslint/explicit-module-boundary-types": "warn",
63 | "@typescript-eslint/indent": [
64 | "error",
65 | 2
66 | ],
67 | "@typescript-eslint/member-delimiter-style": [
68 | "error",
69 | {
70 | "multiline": {
71 | "delimiter": "none",
72 | "requireLast": false
73 | },
74 | "singleline": {
75 | "delimiter": "comma",
76 | "requireLast": false
77 | }
78 | }
79 | ],
80 | "@typescript-eslint/member-ordering": "off",
81 | "@typescript-eslint/naming-convention": "off",
82 | "@typescript-eslint/no-array-constructor": "error",
83 | "@typescript-eslint/no-empty-function": "error",
84 | "@typescript-eslint/no-empty-interface": "error",
85 | "@typescript-eslint/no-explicit-any": "off",
86 | "@typescript-eslint/no-extra-non-null-assertion": "error",
87 | "@typescript-eslint/no-extra-semi": "error",
88 | "@typescript-eslint/no-floating-promises": "error",
89 | "@typescript-eslint/no-for-in-array": "error",
90 | "@typescript-eslint/no-implied-eval": "off",
91 | "@typescript-eslint/no-inferrable-types": "error",
92 | "@typescript-eslint/no-misused-new": "error",
93 | "@typescript-eslint/no-misused-promises": "error",
94 | "@typescript-eslint/no-namespace": "error",
95 | "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
96 | "@typescript-eslint/no-non-null-assertion": "warn",
97 | "@typescript-eslint/no-parameter-properties": "off",
98 | "@typescript-eslint/no-shadow": [
99 | "error",
100 | {
101 | "hoist": "all"
102 | }
103 | ],
104 | "@typescript-eslint/no-this-alias": "error",
105 | "@typescript-eslint/no-unnecessary-type-assertion": "error",
106 | "@typescript-eslint/no-unsafe-assignment": "off",
107 | "@typescript-eslint/no-unsafe-call": "off",
108 | "@typescript-eslint/no-unsafe-member-access": "off",
109 | "@typescript-eslint/no-unsafe-return": "error",
110 | "@typescript-eslint/no-unused-expressions": "error",
111 | "@typescript-eslint/no-unused-vars": [
112 | "error",
113 | {
114 | "argsIgnorePattern": "^_"
115 | }
116 | ],
117 | "@typescript-eslint/no-use-before-define": "off",
118 | "@typescript-eslint/no-var-requires": "off",
119 | "@typescript-eslint/prefer-as-const": "error",
120 | "@typescript-eslint/prefer-for-of": "error",
121 | "@typescript-eslint/prefer-function-type": "error",
122 | "@typescript-eslint/prefer-namespace-keyword": "error",
123 | "@typescript-eslint/prefer-regexp-exec": "off",
124 | "@typescript-eslint/quotes": [
125 | "error",
126 | "single",
127 | {
128 | "avoidEscape": true
129 | }
130 | ],
131 | "@typescript-eslint/require-await": "error",
132 | "@typescript-eslint/restrict-plus-operands": "error",
133 | "@typescript-eslint/restrict-template-expressions": "off",
134 | "@typescript-eslint/semi": [
135 | "error",
136 | "never"
137 | ],
138 | "@typescript-eslint/triple-slash-reference": [
139 | "error",
140 | {
141 | "path": "always",
142 | "types": "prefer-import",
143 | "lib": "always"
144 | }
145 | ],
146 | "@typescript-eslint/unbound-method": "error",
147 | "@typescript-eslint/unified-signatures": "error",
148 | "arrow-body-style": "error",
149 | "arrow-parens": [
150 | "error",
151 | "as-needed"
152 | ],
153 | "brace-style": [
154 | "error",
155 | "stroustrup",
156 | {
157 | "allowSingleLine": true
158 | }
159 | ],
160 | "comma-dangle": [
161 | "error",
162 | {
163 | "objects": "always-multiline",
164 | "arrays": "always-multiline",
165 | "functions": "never"
166 | }
167 | ],
168 | "complexity": "off",
169 | "constructor-super": "error",
170 | "curly": [
171 | "error",
172 | "multi-line"
173 | ],
174 | "eol-last": "error",
175 | "eqeqeq": [
176 | "error",
177 | "smart"
178 | ],
179 | "guard-for-in": "error",
180 | "id-blacklist": [
181 | "error",
182 | "any",
183 | "Number",
184 | "number",
185 | "String",
186 | "string",
187 | "Boolean",
188 | "boolean",
189 | "Undefined",
190 | "undefined"
191 | ],
192 | "id-match": "error",
193 | "import/order": "off",
194 | "linebreak-style": [
195 | "error",
196 | "unix"
197 | ],
198 | "max-classes-per-file": "off",
199 | "max-len": [
200 | "warn",
201 | {
202 | "code": 240
203 | }
204 | ],
205 | "new-parens": "off",
206 | "no-array-constructor": "off",
207 | "no-bitwise": "error",
208 | "no-caller": "error",
209 | "no-cond-assign": "off",
210 | "no-console": "error",
211 | "no-debugger": "error",
212 | "no-empty": [
213 | "error",
214 | {
215 | "allowEmptyCatch": true
216 | }
217 | ],
218 | "no-empty-function": "off",
219 | "no-eval": "error",
220 | "no-extra-semi": "off",
221 | "no-fallthrough": "off",
222 | "no-implied-eval": "off",
223 | "no-invalid-this": "off",
224 | "no-irregular-whitespace": "error",
225 | "no-magic-numbers": "off",
226 | "@typescript-eslint/no-magic-numbers": [ "error", {
227 | "ignore": [ -1, 0, 1, 2 ],
228 | "ignoreEnums": true
229 | }],
230 | "no-new-wrappers": "error",
231 | "no-redeclare": "error",
232 | "no-throw-literal": "error",
233 | "no-trailing-spaces": "error",
234 | "no-undef-init": "error",
235 | "no-underscore-dangle": [
236 | "error",
237 | {
238 | "allowAfterThis": true
239 | }
240 | ],
241 | "no-unsafe-finally": "error",
242 | "no-unused-labels": "error",
243 | "no-unused-vars": "off",
244 | "no-var": "error",
245 | "object-shorthand": "error",
246 | "one-var": [
247 | "off",
248 | "never"
249 | ],
250 | "prefer-arrow/prefer-arrow-functions": [
251 | "error",
252 | {
253 | "allowStandaloneDeclarations": true
254 | }
255 | ],
256 | "prefer-const": [
257 | "error",
258 | {
259 | "destructuring": "all"
260 | }
261 | ],
262 | "prefer-object-spread": "error",
263 | "prefer-template": "error",
264 | "quote-props": [
265 | "error",
266 | "as-needed"
267 | ],
268 | "radix": "off",
269 | "require-await": "off",
270 | "space-before-function-paren": [
271 | "error",
272 | {
273 | "anonymous": "never",
274 | "named": "never",
275 | "asyncArrow": "always"
276 | }
277 | ],
278 | "spaced-comment": [
279 | "error",
280 | "always",
281 | {
282 | "markers": [
283 | "/"
284 | ]
285 | }
286 | ],
287 | "use-isnan": "error",
288 | "valid-typeof": "off",
289 | "yoda": "error",
290 | "@typescript-eslint/consistent-type-definitions": "off",
291 | "no-new-func": "off"
292 | },
293 | "ignorePatterns": [
294 | "webpack.config.ts",
295 | "util/*.ts",
296 | "minitests/*.ts",
297 | "content/minitests/*.ts"
298 | ]
299 | }
300 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: release
2 |
3 | on:
4 | push: null
5 |
6 | jobs:
7 | release:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v2
11 | - name: install node
12 | uses: actions/setup-node@v1
13 | with:
14 | node-version: 14.x
15 | - name: Cache node dependencies
16 | uses: actions/cache@v2
17 | env:
18 | cache-name: cache-dependencies
19 | with:
20 | path: |
21 | ~/.npm
22 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
23 | - name: install node dependencies
24 | run: npm install
25 | - name: build
26 | run: |
27 | npm run build
28 | ls xpi
29 | - name: release
30 | run: |
31 | ls xpi
32 | npm run release
33 | env:
34 | GITHUB_TOKEN: ${{ github.token }}
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .eslintcache
2 | .DS_Store
3 | wiki
4 | gen
5 | build
6 | *~
7 | *.swp
8 | *.debug
9 | *.cache
10 | *.status
11 | *.js.map
12 | *.tmp
13 | *.xpi
14 | node_modules
15 | .env
16 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/retorquere/zotero-auto-index/73603df1010b94a952ae6232f7a901ed8b7528a9/.gitmodules
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "8"
4 | cache: npm
5 | install:
6 | - npm install
7 | script:
8 | - npm run build
9 | - npm run release
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | zotero-auto-index
2 | =================
3 |
4 | Now compatible with Zotero 5. Install by downloading the [latest version](https://github.com/retorquere/zotero-auto-index/releases/latest)
5 |
6 | Automatically keeps your attachments indexed. Preferences can be tweaked in the Zotero `Search` settings.
7 |
8 | # Support - read carefully
9 |
10 | My time is extremely limited for a number of very great reasons (you shall have to trust me on this). Because of this, I
11 | cannot accept bug reports
12 | or support requests on anything but the latest version. If you submit an issue report,
13 | please include the version that you are on. By the time I get to your issue, the latest version might have bumped up
14 | already, and you
15 | will have to upgrade (you might have auto-upgraded already however) and re-verify that your issue still exists.
16 | Apologies for the inconvenience, but such
17 | are the breaks.
18 |
19 |
--------------------------------------------------------------------------------
/chrome.manifest:
--------------------------------------------------------------------------------
1 | content zotero-auto-index content/
2 | locale zotero-auto-index en-US locale/en-US/
3 | skin zotero-auto-index default skin/
4 |
5 | overlay chrome://zotero/content/zoteroPane.xul chrome://zotero-auto-index/content/overlay.xul
6 |
--------------------------------------------------------------------------------
/content/overlay.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/content/preferences.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/content/zotero-auto-index.ts:
--------------------------------------------------------------------------------
1 | declare const Zotero: any
2 | declare const Components: any
3 |
4 | export const AutoIndex = Zotero.AutoIndex = Zotero.AutoIndex || new class { // tslint:disable-line:variable-name
5 | public idle = false
6 |
7 | private idleService = Components.classes['@mozilla.org/widget/idleservice;1'].getService(Components.interfaces.nsIIdleService)
8 | private initialized = false
9 |
10 | constructor() {
11 | window.addEventListener('load', _event => {
12 | this.init()
13 | }, false)
14 | }
15 |
16 | public observe(subject, topic, _data) {
17 | switch (topic) {
18 | case 'idle':
19 | Zotero.debug('[auto-index]: idle')
20 | this.idle = true
21 | Zotero.Fulltext.rebuildIndex(true)
22 | break
23 |
24 | case 'back':
25 | case 'active':
26 | Zotero.debug('[auto-index]: busy')
27 | this.idle = false
28 | break
29 | }
30 | }
31 |
32 | private init() {
33 | if (this.initialized) return
34 | this.initialized = true
35 |
36 | this.idleService.addIdleObserver(this, Zotero.Prefs.get('auto-index.delay'))
37 |
38 | Zotero.Prefs.registerObserver('fulltext.textMaxLength', this.clearIndex.bind(this))
39 | Zotero.Prefs.registerObserver('fulltext.pdfMaxPages', this.clearIndex.bind(this))
40 | }
41 |
42 | private clearIndex() {
43 | if (Zotero.Prefs.get('auto-index.reindexOnPrefChange')) Zotero.Fulltext.clearIndex(true)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/defaults/preferences/defaults.coffee:
--------------------------------------------------------------------------------
1 | pref("extensions.zotero.auto-index.delay", 60)
2 | pref("extensions.zotero.auto-index.index-pdfs", true)
3 | pref("extensions.zotero.auto-index.extract-annotations", true)
4 | pref("extensions.zotero.auto-index.index.batch", 50)
5 | pref("extensions.zotero.auto-index.zotfile.batch", 10)
6 | pref("extensions.zotero.auto-index.debug", true)
7 | pref("extensions.zotero.auto-index.reindexOnPrefChange", false)
8 |
--------------------------------------------------------------------------------
/defaults/preferences/defaults.js.map:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "file": "defaults.js",
4 | "sourceRoot": "../..",
5 | "sources": [
6 | "defaults/preferences/defaults.coffee"
7 | ],
8 | "names": [],
9 | "mappings": ";AAAA,IAAA,CAAK,oCAAL,EAA2C,EAA3C;;AACA,IAAA,CAAK,yCAAL,EAAgD,IAAhD;;AACA,IAAA,CAAK,kDAAL,EAAyD,IAAzD;;AACA,IAAA,CAAK,0CAAL,EAAiD,EAAjD;;AACA,IAAA,CAAK,4CAAL,EAAmD,EAAnD;;AACA,IAAA,CAAK,oCAAL,EAA2C,IAA3C;;AACA,IAAA,CAAK,kDAAL,EAAyD,KAAzD"
10 | }
--------------------------------------------------------------------------------
/esbuild.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const fs = require('fs')
3 | const esbuild = require('esbuild')
4 |
5 | const rmrf = require('rimraf')
6 | rmrf.sync('gen')
7 |
8 | require('zotero-plugin/copy-assets')
9 | require('zotero-plugin/rdf')
10 | require('zotero-plugin/version')
11 |
12 | async function build() {
13 | await esbuild.build({
14 | bundle: true,
15 | format: 'iife',
16 | target: ['firefox60'],
17 | entryPoints: [ 'content/zotero-auto-index.ts' ],
18 | outdir: 'build/content',
19 | })
20 | }
21 |
22 | build().catch(err => {
23 | console.log(err)
24 | process.exit(1)
25 | })
26 |
--------------------------------------------------------------------------------
/locale/en-US/zotero-auto-index.dtd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/locale/en-US/zotero-auto-index.properties:
--------------------------------------------------------------------------------
1 | notification.itemAdded = The following item was added
2 | notification.itemsAdded = The following %s items were added
3 | notification.itemModified = The following item was modified
4 | notification.itemsModified = The following %s items were modified
5 | notification.itemDeleted = 1 item was deleted
6 | notification.itemsDeleted = %s items were deleted
7 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "zotero-auto-index",
3 | "version": "5.0.9",
4 | "description": "Zotero Auto Index",
5 | "main": "index.js",
6 | "scripts": {
7 | "lint": "eslint . --ext .ts --cache --cache-location .eslintcache/",
8 | "build": "parallel --ungroup ::: 'npm run lint' 'node esbuild.js' 'tsc --noEmit'",
9 | "postbuild": "zotero-plugin-zipup build zotero-auto-index",
10 | "release": "zotero-plugin-release",
11 | "postversion": "git push --follow-tags",
12 | "start": "zotero-start"
13 | },
14 | "repository": {
15 | "type": "git",
16 | "url": "git+https://github.com/retorquere/zotero-auto-index.git"
17 | },
18 | "author": {
19 | "name": "Emiliano Heyns",
20 | "email": "Emiliano.Heyns@iris-advies.com"
21 | },
22 | "license": "ISC",
23 | "bugs": {
24 | "url": "https://github.com/retorquere/zotero-auto-index/issues"
25 | },
26 | "homepage": "https://github.com/retorquere/zotero-auto-index#readme",
27 | "dependencies": {
28 | "@types/mocha": "^9.1.0",
29 | "@typescript-eslint/eslint-plugin": "^5.16.0",
30 | "@typescript-eslint/parser": "^5.16.0",
31 | "esbuild": "^0.14.27",
32 | "eslint": "^8.11.0",
33 | "eslint-plugin-import": "^2.25.4",
34 | "eslint-plugin-jsdoc": "^38.0.6",
35 | "eslint-plugin-prefer-arrow": "^1.2.3",
36 | "jszip": "^3.7.1",
37 | "mkdirp": "^1.0.4",
38 | "rimraf": "^3.0.2",
39 | "ts-node": "^10.7.0",
40 | "typescript": "^4.6.3",
41 | "zotero-plugin": "^1.2.3"
42 | },
43 | "xpi": {
44 | "name": "Zotero AutoIndex",
45 | "updateLink": "https://github.com/retorquere/zotero-auto-index/releases/download/v{version}/zotero-auto-index-{version}.xpi",
46 | "releaseURL": "https://github.com/retorquere/zotero-auto-index/releases/download/release/"
47 | },
48 | "devDependencies": {
49 | "webpack-cli": "^4.9.2"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/skin/default/auto-index.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
328 |
--------------------------------------------------------------------------------
/skin/default/overlay.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/retorquere/zotero-auto-index/73603df1010b94a952ae6232f7a901ed8b7528a9/skin/default/overlay.css
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "importHelpers": true,
4 | "target": "es2017",
5 | "disableSizeLimit": true,
6 | "module": "commonjs",
7 | "noImplicitAny": false,
8 | "removeComments": false,
9 | "preserveConstEnums": false,
10 | "sourceMap": false,
11 | "downlevelIteration": true,
12 | "lib": [ "es2017", "dom" ],
13 | "typeRoots": [
14 | "./typings",
15 | "./gen/typings",
16 | "./node_modules/@types"
17 | ]
18 | },
19 | "include": [
20 | "bin",
21 | "loader",
22 | "plugin",
23 | "script",
24 | "webpack",
25 | "content/**/*",
26 | "resource/**/*",
27 | "zotero-webpack/**/*",
28 | "setup/**/*",
29 | "*.ts"
30 | ],
31 | "exclude": [
32 | "node_modules",
33 | "**/*.spec.ts",
34 | "typings"
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/zotero-plugin.ini:
--------------------------------------------------------------------------------
1 | [profile]
2 | name = BBTZ5TEST
3 | path = ~/.BBTZ5TEST
4 |
5 | [zotero]
6 | log = ~/.BBTZ5TEST.log
7 | # db = zotero.sqlite
8 |
9 | # [preferences]
10 | # extensions.zotero.prosec-linker.doi = true
11 | # extensions.zotero.prosec-linker.doi.url.1 = http://doi-orl/DOI
12 | # extensions.zotero.prosec-linker.doi.name.1 = doi-url
13 | # extensions.zotero.prosec-linker.doi.delete.1 = true
14 | # # extensions.zotero.prosec-linker.doi.url.2
15 | # # extensions.zotero.prosec-linker.doi.name.2
16 | # # extensions.zotero.prosec-linker.doi.delete.2
17 | #
18 | # extensions.zotero.prosec-linker.title = true
19 | # extensions.zotero.prosec-linker.title.url.1 http://title-url/TITLE
20 | # extensions.zotero.prosec-linker.title.name.1 = title-url
21 | # extensions.zotero.prosec-linker.title.delete.1 = false
22 | # # extensions.zotero.prosec-linker.title.url.2
23 | # # extensions.zotero.prosec-linker.title.name.2
24 | # # extensions.zotero.prosec-linker.title.delete.2
25 | #
26 | # extensions.zotero.prosec-linker.pdf = false
27 | # # extensions.zotero.prosec-linker.pdf.url.1
28 | # # extensions.zotero.prosec-linker.pdf.name.1
29 | # # extensions.zotero.prosec-linker.pdf.delete.1
30 |
--------------------------------------------------------------------------------