Browse Source

Replace cdn.rawgit.com with rawcdn.githack.com

pull/243/head
Jerome Wu 6 years ago
parent
commit
5841c6bbfd
  1. 10
      README.md
  2. 10
      dist/tesseract.js
  3. 1246
      package-lock.json
  4. 8
      src/browser/index.js
  5. 4
      src/node/index.js

10
README.md

@ -30,7 +30,7 @@ Tesseract.js works with a `<script>` tag via local copy or CDN, with webpack and @@ -30,7 +30,7 @@ Tesseract.js works with a `<script>` tag via local copy or CDN, with webpack and
You can simply include Tesseract.js with a CDN like this:
```html
<script src='https://cdnjs.cloudflare.com/ajax/libs/tesseract.js/1.0.10/tesseract.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/tesseract.js/1.0.11/tesseract.min.js'></script>
```
After including your scripts, the `Tesseract` variable will be defined globally!
@ -251,19 +251,19 @@ Because of this we recommend loading `tesseract.js` from a CDN. But if you reall @@ -251,19 +251,19 @@ Because of this we recommend loading `tesseract.js` from a CDN. But if you reall
```javascript
window.Tesseract = Tesseract.create({
workerPath: '/path/to/worker.js',
langPath: 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/',
corePath: 'https://cdn.rawgit.com/naptha/tesseract.js-core/0.1.0/index.js',
langPath: 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/',
corePath: 'https://rawcdn.githack.com/naptha/tesseract.js-core/0.1.0/index.js',
})
```
### corePath
A string specifying the location of the [tesseract.js-core library](https://github.com/naptha/tesseract.js-core), with default value 'https://cdn.rawgit.com/naptha/tesseract.js-core/master/index.js'. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use a different file.
A string specifying the location of the [tesseract.js-core library](https://github.com/naptha/tesseract.js-core), with default value 'https://rawcdn.githack.com/naptha/tesseract.js-core/master/index.js'. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use a different file.
### workerPath
A string specifying the location of the [worker.js](./dist/worker.js) file. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use a different file.
### langPath
A string specifying the location of the tesseract language files, with default value 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/'. Language file URLs are calculated according to the formula `langPath + langCode + '.traineddata.gz'`. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use different language files.
A string specifying the location of the tesseract language files, with default value 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/'. Language file URLs are calculated according to the formula `langPath + langCode + '.traineddata.gz'`. Set this string before calling `Tesseract.recognize` and `Tesseract.detect` if you want Tesseract.js to use different language files.
## Contributing

10
dist/tesseract.js vendored

@ -207,12 +207,12 @@ module.exports={ @@ -207,12 +207,12 @@ module.exports={
"browserify": "^13.1.0",
"envify": "^3.4.1",
"http-server": "^0.9.0",
"isomorphic-fetch": "^2.2.1",
"pako": "^1.0.3",
"watchify": "^3.7.0"
},
"dependencies": {
"file-type": "^3.8.0",
"isomorphic-fetch": "^2.2.1",
"is-url": "^1.2.2",
"jpeg-js": "^0.2.0",
"level-js": "^2.2.4",
@ -236,9 +236,9 @@ module.exports={ @@ -236,9 +236,9 @@ module.exports={
'use strict';
var defaultOptions = {
// workerPath: 'https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/worker.js',
corePath: 'https://cdn.rawgit.com/naptha/tesseract.js-core/0.1.0/index.js',
langPath: 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/'
// workerPath: 'https://rawcdn.githack.com/naptha/tesseract.js/0.2.0/dist/worker.js',
corePath: 'https://cdnjs.cloudflare.com/naptha/tesseract.js-core/0.1.0/index.js',
langPath: 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/'
};
if (process.env.NODE_ENV === "development") {
@ -246,7 +246,7 @@ if (process.env.NODE_ENV === "development") { @@ -246,7 +246,7 @@ if (process.env.NODE_ENV === "development") {
defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js?nocache=' + Math.random().toString(36).slice(3);
} else {
var version = require('../../package.json').version;
defaultOptions.workerPath = 'https://cdn.rawgit.com/naptha/tesseract.js/' + version + '/dist/worker.js';
defaultOptions.workerPath = 'https://rawcdn.githack.com/naptha/tesseract.js/' + version + '/dist/worker.js';
}
exports.defaultOptions = defaultOptions;

1246
package-lock.json generated

File diff suppressed because it is too large Load Diff

8
src/browser/index.js

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
var defaultOptions = {
// workerPath: 'https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/worker.js',
corePath: 'https://cdn.rawgit.com/naptha/tesseract.js-core/0.1.0/index.js',
langPath: 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/',
// workerPath: 'https://rawcdn.githack.com/naptha/tesseract.js/0.2.0/dist/worker.js',
corePath: 'https://rawcdn.githack.com/naptha/tesseract.js-core/0.1.0/index.js',
langPath: 'https://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/',
}
if (process.env.NODE_ENV === "development") {
@ -9,7 +9,7 @@ if (process.env.NODE_ENV === "development") { @@ -9,7 +9,7 @@ if (process.env.NODE_ENV === "development") {
defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js?nocache=' + Math.random().toString(36).slice(3)
}else{
var version = require('../../package.json').version;
defaultOptions.workerPath = 'https://cdn.rawgit.com/naptha/tesseract.js/' + version + '/dist/worker.js'
defaultOptions.workerPath = 'https://rawcdn.githack.com/naptha/tesseract.js/' + version + '/dist/worker.js'
}
exports.defaultOptions = defaultOptions;

4
src/node/index.js

@ -5,7 +5,7 @@ const fetch = require('isomorphic-fetch'), @@ -5,7 +5,7 @@ const fetch = require('isomorphic-fetch'),
exports.defaultOptions = {
workerPath: require('path').join(__dirname, 'worker.js'),
langPath: 'http://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/',
langPath: 'http://rawcdn.githack.com/naptha/tessdata/gh-pages/3.02/',
}
exports.spawnWorker = function spawnWorker(instance, workerOptions){
@ -86,4 +86,4 @@ function loadImage(image, cb){ @@ -86,4 +86,4 @@ function loadImage(image, cb){
return loadImage(image, cb)
}
cb(image);
}
}

Loading…
Cancel
Save