How to code a "button" on html page to activate foxreplace
I have created html page in which an empty textbox is loaded. I paste my text to be converted in this textbox, and then I press Shift-f9 (or rightclick menu select) and the text in textbox is converted.
Code is given below.
I want it to be done be click on a button, mentioned below. on clicking the button it shoud activate an script named Convert1()
<input type="button" id="converter" name="converter" value="Convert>>" onClick="Convert1();" accesskey="Shift+F9"
Could you or any user suggest what to code in [onClick="Convert1();" ] so that clicking the button would activate fr? Is there any master procedure/ script name for entire foxreplace code that can be accessed by name in javascript?
second part: currently fr replaces the existing text at existing place, so we are at a loss to figure out how long it is converting and when has it finished. I need a clear-cut indication that it has finished conversion. So I have put two text boxes, first one will have the input text, and I want fr NOT to disturb text in the input box, rather put the converted text in second text box of ConvertedText. How to do it?
The same code is in enclosed file, just change the extension from txt to html as the site is not allowing to upload html file.
`
It's not possible to directly call an extension function from a webpage, although it looks like it's possible to communicate: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts. So, if FoxReplace listened it could receive a specific message to apply the substitution list, although it would apply to the whole page, as always. If you want to replace only the text in the textbox, it's currently not implemented, but I want to implement it in the future.
The second part would require more work, but it is also theoretically doable with the messaging API: the page should send a specific message (e.g. some key and the text content of the input text box), and then FoxReplace would respond with another message with the replaced text, and the webpage script would put that text in the other text box.
Thanks for reply and your views.
You should realize one thing, that your add-on has now traveled far-far beyond what you might have thought about its projected usage when you had conceived it initially.
I think you had conceived it for changing content of websites, that is why on load automatic conversion, periodic conversion, reloading conversion tables, features have been coded in such detail.
But I have never never used fr for changing any web content.
I use it for changing my offline contents.
I translate text from English to Hindi and vice-versa, and when I pre-translate using google or bing, that is having several obvious repetitive "wrong translations", so I have made a database of such mistakes and use fr to "automatically" correct whatever repeated errors google or bing are throwing.
That reduces my work by some 30-40%. And I am tonnes of thankful to you.
And this is entire off-line conversion, as I copy from google/bing, paste to an empty window (as in the html file I sent) and then run fr on that.
I am sure several users are extensively using fr for such work which is different from webpage conversion.
And the surprise is - I find that your add-on is working perfectly well, I never found it "not" doing my work well. It is perfect in its existing state.
But if you consider this "other" use, you might think of various features that would make us "other"-usage persons life even more easier.
You might even develop a version of fr for such offline usage which will have different features.
It is like when you and your wife gave birth to a baby, you think that you will nurture the baby to become a doctor or engineer, but the baby grows, gets different inputs from the surroundings and becomes something else altogether different, like a film director or a player or a writer/poet. It is still your baby. You are still its proud father. but "then/ now" you should do what is good for the growth of "a film director or a player or a writer/poet", not what was good for "a doctor or engineer".
I can't work for a single day without using fr at least 3-4 times for real life situation. I have some 10 conversion tables, totalling about 20000 fr conversions. And I often feel that fr should have some other features that would make my handling simpler and should not have some existing features that I have never used.
Thanks.
Rawat
On 7/26/2017 10:42 PM, Marc Ruiz wrote:
It's not possible to directly call an extension function from a webpage, although it looks like it's possible to communicate: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts. So, if FoxReplace listened it could receive a specific message to apply the substitution list, although it would apply to the whole page, as always. If you want to replace only the text in the textbox, it's currently not implemented, but I want to implement it in the future.
The second part would require more work, but it is also theoretically doable with the messaging API: the page should send a specific message (e.g. some key and the text content of the input text box), and then FoxReplace would respond with another message with the replaced text, and the webpage script would put that text in the other text box.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Woundorf/foxreplace/issues/216#issuecomment-318120638, or mute the thread https://github.com/notifications/unsubscribe-auth/AISGl85K8y1r6yHApcIrLbSGoF2mLb6hks5sR3NogaJpZM4OkMzJ.
Ok, I can implement the messaging protocol for you, but only after FoxReplace is fully converted into a WebExtension, so it will be low priority for now.