Page MenuHomePhabricator

Google OCR button gadget on English Wikisource sometimes does not work (and looks weird)
Closed, DeclinedPublic

Description

@Hrishikes recently showed me how to install custom Javascript to enable the Google OCR button in my English Wikisource user interface. When it works, it generally works well. But about half the time, it yields no result at all. No spinning wheel, and no new results in the text window. It seems there is a 100% correlation to times that the button appears as it does in the attached screenshot, as opposed to being wider (like the regular OCR button).

2018-08-05 (1).png (768×1 px, 318 KB)

Event Timeline

It may be that it works in Chrome, and does not work in Firefox. I *think* it has worked for me in Firefox in the past, but I can't be sure -- I use a variety of browsers. But I've tried it on Firefox under Windows 10 and Ubuntu Mate 18.04 today, and it's not currently working in either. However, I am not currently having trouble under Chrome on Windows 10.

I'm not able to replicate this problem, but I have a possible solution. Could you try with the following script, and let me know if it's any better?

mw.loader.load('//wikisource.org/w/index.php?title=User:Samwilson/GoogleOCR_sandbox.js&action=raw&ctype=text/javascript');

@Samwilson Thanks -- results are mixed. In Firefox on Ubuntu Mate (on a new but bargain-basement, slow laptop), it worked on the first page I tried it on, but failed on the second one. The button size is still correlating with success/failure.

Do you get any errors in the Javascript console?

Hmm, I don't see a Javascript console, but I see a Browser Console -- is that what you mean? There's all kinds of stuff in there, but now the OCR button has decided to work for the last few pages. I'll let you know what it says when I get another problem. (But, I'm not sure how far back to go, it doesn't appear to indicate in any obvious way when it's talking about a new page...?)

Yep, browser console I meant. :)

And there's a "Persist Logs" checkbox there somewhere that will clear the console every time you load the page. Can make it easier to see what's new.

Oh, and make sure you don't have the new Google OCR gadget turned on on enwikisource; that'd conflict with my sandbox script.

OK, here we go -- it failed again. (yay!) (And FWI, I've never turned on the new gadget, so that has not been interfering.)

Here's the error codes, this is all just upon loading the page -- I have not tried clicking the button yet. (That will be in my next message.)


JQMIGRATE: Migrate is installed with logging active, version 3.0.1 load.php:139:615
This page is using the deprecated ResourceLoader module "jquery.ui.widget". load.php:51:942
This page is using the deprecated ResourceLoader module "jquery.ui.core".
Please use OOUI instead. load.php:1:80
This page is using the deprecated ResourceLoader module "mediawiki.api.options".
Use "mediawiki.api" instead. load.php:588:298
Use of "mw.toolbar" is deprecated.
load.php:77:733
JQMIGRATE: jQuery.fn.load() is deprecated load.php:140:200
Use of "mw.toolbar" is deprecated. load.php:77:733
This page is using the deprecated ResourceLoader module "mediawiki.api.messages".
Use "mediawiki.api" instead. load.php:1:88
Use of "mw.toolbar" is deprecated.
load.php:77:733
JQMIGRATE: jQuery.fn.bind() is deprecated load.php:140:200
Use of "mw.toolbar" is deprecated. load.php:77:733
Use of "mw.toolbar" is deprecated. load.php:77:733
Use of "wgNamespaceNumber" is deprecated. Use mw.config instead.
load.php:77:733

When I click the (small/compressed) button, I get this:


This page is using the deprecated ResourceLoader module "mediawiki.api.parse".
Use "mediawiki.api" instead.

Can you try again? I've changed one other thing, and added some debugging output. Please paste the console output here again. Thanks!

Oh, and can you try with the "enhanced" toolbar? (change in preferences)

Aklapper renamed this task from Google OCR button sometimes does not work (and looks weird) to Google OCR button gadget on English Wikisource sometimes does not work (and looks weird).Aug 6 2018, 7:04 AM

@Samwilson : When I turn on the "enhanced toolbar" I don't know where to look to find the Google OCR button. I see the regular OCR button, but not Google OCR.

@Aklapper : Thanks for the link. I will try turning off everything else, and report back.

When I turn on the "enhanced toolbar" I don't know where to look to find the Google OCR button. I see the regular OCR button, but not Google OCR.

Hm, that is interesting. It should be displaying just as a normal button near the other OCR button. Could you turn off the regular OCR gadget and see if that changes anything?

And did you see anything saying 'adding button' in the console output?

@Samwilson : I'm still getting inconsistent results -- sometimes the Google OCR button shows up, other times it doesn't. Here's the console output from the last time it *did* show up (after turning off the regular OCR button, and using the enhanced toolbar).

JQMIGRATE: Migrate is installed with logging active, version 3.0.1 load.php:139:615
This page is using the deprecated ResourceLoader module "jquery.ui.widget". load.php:51:942
This page is using the deprecated ResourceLoader module "jquery.ui.core".
Please use OOUI instead. load.php:1:80
This page is using the deprecated ResourceLoader module "mediawiki.api.options".
Use "mediawiki.api" instead. load.php:588:298
JQMIGRATE: jQuery.fn.load() is deprecated load.php:140:200
JQMIGRATE: jQuery.fn.bind() is deprecated load.php:140:200
This page is using the deprecated ResourceLoader module "jquery.ui.position". load.php:27:88
This page is using the deprecated ResourceLoader module "mediawiki.api.messages".
Use "mediawiki.api" instead. load.php:1:88
Use of "wgNamespaceNumber" is deprecated. Use mw.config instead.
load.php:77:733
[Show/hide message details.] Error: Another textSelection API was already registered load.php:461:865
JQMIGRATE: Migrate is installed with logging active, version 3.0.1 load.php:139:615
This page is using the deprecated ResourceLoader module "jquery.ui.widget". load.php:51:942
This page is using the deprecated ResourceLoader module "jquery.ui.core".
Please use OOUI instead. load.php:1:80
This page is using the deprecated ResourceLoader module "mediawiki.api.options".
Use "mediawiki.api" instead. load.php:588:298
JQMIGRATE: jQuery.fn.load() is deprecated load.php:140:200
JQMIGRATE: jQuery.fn.bind() is deprecated load.php:140:200
This page is using the deprecated ResourceLoader module "jquery.ui.position". load.php:27:88
This page is using the deprecated ResourceLoader module "mediawiki.api.messages".
Use "mediawiki.api" instead. load.php:1:88
Use of "wgNamespaceNumber" is deprecated. Use mw.config instead.
load.php:77:733
[Show/hide message details.] Error: Another textSelection API was already registered load.php:461:865
[NoScript] apply
title="MSG_Reveal"
log.js:9:39
[NoScript] Including /ui/ui.css log.js:9:39
[NoScript] Including /lib/punycode.js log.js:9:39
[NoScript] Including /lib/tld.js log.js:9:39
[NoScript] Including /common/Policy.js log.js:9:39
[Show/hide message details.] NotFoundError: Node was not found load.php:311
JQMIGRATE: Migrate is installed with logging active, version 3.0.1 load.php:139:615
This page is using the deprecated ResourceLoader module "jquery.ui.widget". load.php:51:942
This page is using the deprecated ResourceLoader module "jquery.ui.core".
Please use OOUI instead. load.php:1:80
This page is using the deprecated ResourceLoader module "mediawiki.api.options".
Use "mediawiki.api" instead. load.php:588:298
JQMIGRATE: jQuery.fn.load() is deprecated load.php:140:200
JQMIGRATE: jQuery.fn.bind() is deprecated load.php:140:200
This page is using the deprecated ResourceLoader module "jquery.ui.position". load.php:27:88
This page is using the deprecated ResourceLoader module "mediawiki.api.messages".
Use "mediawiki.api" instead. load.php:1:88
adding button index.php:60:5
Use of "wgNamespaceNumber" is deprecated. Use mw.config instead.
load.php:77:733

I think there might be some sort of clash going on with another gadget or script. :( Sorry this is being so tricky to fix! Thanks for your patience.

Could you post the console output of a page load when the OCR button fails to work correctly?

It seems likely that it's a load-order problem, with another script. I'm not sure what though.

So far, I haven't been able to reproduce either. Pete, could you also try commenting out everything at https://en.wikisource.org/wiki/User:Peteforsyth/common.js except for the OCR script? That should reduce the number of variables.

I assume whatever was causing this has been resolved long ago?

Anyway, the new OCR button is much more reliable than the old gadget, and should be used instead.