Javascript to move selected web text to MS Word - javascript

Im annoyed that this doesn't seem possible, but i wanted to check with the community to see if someone has developed a working version of something similar.
I'm a graduate student and spend a LOT of time online researching, and when I find that sweet paragraph that makes just the argument I've been searching for, I've gotta copy and paste it out of chrome (on mac os x) and into word (2011). I've built a "strip all formatting" macro that works well enough, but what i would like is a pipe from chrome into my open word document that gives me 1 key "send selection to word document" (like ~).
I've got the js working to get selected text and move it around, but i cannot seem to open the document i want to move the text into. Ideally, this would work as a chrome plugin (I've built them before), but I've seen no documentation about JS => Word on other platforms (obviously activeX controls dont work for me).
Any suggestions?

You can use an automator service to do this. Open Applications > Automator, and then create a service, which receives selected text (one of the built in defaults). This works in any app, and is accessible via the Services menu when you right click.
You can do this easily with TextEdit for example using these two actions:
Service receives selected text
New Textedit Document.
I've just tried it to confirm it. It can also copy rich text etc (including links) if you want. I imagine something similar is possible with word, and there is a built in service already to do the same if you have installed TextWrangler (another word processor).

JavaScript is contained within the browser for security reasons, so you will not be able to do it with JavaScript.
The best thing that i can come up with is to write a 'bot' kinda thing that just coppy pastes, so not for in an extention.

Related

Firefox add-on: Display a pop-up while hovering over an highlighted text on the page

I'm new around here, but I'm eager to learn and develop new things. As most of you guys are already pro`, I would love to be assisted if someone has time.
Here is the deal. I've started to play a bit with the Firefox Add-On SDK, and I want to develop a specific add-on / Firefox extension.
Case 1:
I want to develop an add-on that creates a new icon in the toolbar (This is not a big deal.)
I want to develop an add-on that highlights on a page some specific text (This will variable according to the domain) and when hovering it, to display a small pop-up with different info about the specific text.
Case 2:
I want to develop an add-on that creates a new icon in the toolbar (This is not a big deal.)
I want to develop an add-on that implements a new context element (a new option when right clicking) to search info about the selected text and display it by the same pop-up referred in Case 1.
Do you think that at least 1 of these 2 cases can be developed using Firefox Add-On SDK using modules as context-menu, widget, panel? I'm asking these because after looking over those modules I've seen some different results than the ones that I was expected.
While waiting for some tips I'm gonna try harder to get it done. :)
Thank you very much and I would really appreciate if someone can help me.
Kind regards,
Marius
I want to develop an add-on that creates a new icon in the toolbar (This is not a big deal.)
See the ui module in particular ActionButton.
I want to develop an add-on that highlights on a page some specific text (This will variable according to the domain) and when hovering it, to display a small pop-up with different info about the specific text.
Read up on Content Scripts.
In a content script, you'd then use DOM manipulation to insert highlights. SO has a bunch of question on how to find text in a DOM node or how to do popups in HTML.
You can use jQuery in content scripts, if you like (although I personally prefer not to... Why take the performance penalty of loading a library to deal with cross-browser compatibility issues when you're not developing cross-browser?)
I want to develop an add-on that implements a new context element (a new option when right clicking) to search info about the selected text and display it by the same pop-up referred in Case 1.
Use the context-menu module to add new menu items, and the DOM manipulation.

Hover Translation Tool

I apologize in advance if this question violates any forum rules.
I have tried many google searches but have been unable to come up with the results I am looking for.
Basically, I would like a hover translation tool to be developed for Burmese -> English. I know there are many tools available, but I have not encountered one specifically for this pair. I have found a tool which I like, and after which I would like to model this one. It is called Rikaichan, and is available at http://www.polarcloud.com/rikaichan as an add-on for Firefox and Chrome.
I have a beginner/intermediate knowledge of html, css, javascript, jQuery, and PHP. I have a dictionary on my computer that can be searched in either language.
My question is this: How does one develop a hover translation tool?
I am not looking for all the code, but just for some help getting started. Based on my limited knowledge, I would guess something like this. The tool has to only attempt to translate if it is Burmese. There are a variety of Burmese fonts, and not all of them are Unicode. So, I don't know if it would have to be developed separately for the different fonts or not. So, let's pretend they are all Unicode. So, when a user hovers over some text, using a javascript/jquery mouseover event, a search is triggered. The search term is the word hovered and it searches in the dictionary file. When encountered, the text pops up and shows the user the possible words.
But, I'm just kind of stuck. Any help?

InDesign "Data Source" - to simple IPad/Android app

Ok,
I will not get full answer to this question, but perhaps somebody can give me a few tips, or tell me if it is feasable at all. The current situation is:
A printed out document created from a InDesign file.
No great structure in the data beside the visual markup.
The document is used as a GUIDE/CHECKLIST style.
So kind of "read some stuff" - "if yes page 20" - "if no page 34"
A little bit like these early TXT only adventures.
The client now want to "put this on a tablet" - the obvious approach is to take all the data, format it in some nice XML, write an app to render the data and provide the extra features.
Now, on the other hand, they are already close to their final product, a simple PDF rendering of the document looks nice on a tablet. There are some features missing, however, like "navigate back links" (you click, go to page 23, click there on "back" and are where you started).
I though I could do this with JS in PDF, but this does not work on Android. He just ignores the javascript (calculator example).
So now, before suggesting to implement your own solution, I am looking for something still close to the source. E.g. InDesign PLUS CODE.
I hope you get my drift. Perhaps another example: What you cant do with a simple Word Dokument, you do with VBA inside word.
What I cant do with a simple PDF I do with ??? + ???? on IPad/Android (we would not need both versions, one is enough, its a closed system, we control the device and the source file. Perfect for a standalone app, but overkill for step 1, I think).
Chris
You should consider going with iBooks for this. The format works really well with tools like In Design and you can use HTML5 tools to embed links, navigation, video, etc. You don't go the App Store route, but instead go with the iBookStore which can give just as good of a revenue option. The new iBooks Author will be a great tool, but even older tutorials will still work. Here is a good starting place

creating "text selection" functionality (as seen in touchscreen browsers) using JavaScript

I need to create following functionality in javascript:
User should be able to get into text selection mode (by long pressing a word or clicking a dedicated button, how user goes into text selection mode is not important)
Once in text selection mode, two handles should appear on the start and end of selection which will allow user to extend the selection (users will be able to drag the handle images to extend the selection)
Selected text would appear in highlighted mode
Following is an example of the same functionality in Android 3.0 browser:
I need to create the same functionality using Javascript. I tried to searhc "javascript text select" but could not finad anything useful. Can someone suggest me how to do this or point me to any existing work? Thanks much.
What you are stating is a very broad user interface problem and you cannot solve it with few lines of Javascript code. I am pretty well aware of existing mobile Javascript libraries and I have not yet come across a productized solution, because the problem in fact is really difficult.
You need to have zoom/follow finger feature which applies complex heurestics to where the cursor actually should go
Moving markers alongside in arbitary HTML text is troublesome - you need to have a way to split HTML to smaller pieces
Thus, I suggest you either
Write a cross-platform faux text selection library (this is not a programming question, but a daily job for a person who knows HTML5 and mobile very, very, well)
Post this a freelancher bounty job <-- a suggestion
From a technical point you
can disable native text selection of devices (-webkit- special CSS styles)
probably cannot interact with native clipboard through Javascript on mobile
older Android devices lack proper Javascript events for the complex touch interaction in the first place

gmail type filechooser for firefox

I have a simple requirement:
One browse button opens multiple file choosers.
When file is chosen, its filename gets added to an order list.
This works just fine in IE, because i can programatically click on hidden file inputs, but firefox does not let the click event open the file choose dialog.
Question:
What options do i have? I noticed that gmail uses a piece of flash to make this happen, this isnt really an option for me, i need to stick to an html/javascript solution if possible.
Thanks.
There's a reason GMail uses a piece of Flash: it is the best least-worst option. Some other sites I've seen use Java applets or their own browser add-on or Active-X component, which I find much more intrusive to the user than Flash.
If it were possible with HTML/javascript, you wouldn't see so many sites (like GMail) going out of their way to use flash or Java.
If you're stuck to HTML/Javasctipt, the next best thing you can do is the way GMail used to do it: put an "attach another file" link below the file selection input field, when the user clicks it another file selection input field is added to the page with javascript, so that they can add an unlimited number of files without navigating away from the page, but they still have to pick them one at a time.
There is not much you can do aside from Flash because the file input fields have been locked down for security over the past few years. If you want, there are several freely available Flash uploaders that will do the trick you want.
impossible Based on your data (users not having Flash) this is not possible with just HTML and Javascript. has alway been a huge debate whether to improve it or not. It doesn't even support too much CSS styling.
Multiple file uploads are able only via plugins. Either Flash, Java or Silverlight nowadays.

Categories