Add-on for Submitting File from Clipboard - firefox-addon

Is There A Browser-Add-on That Can Create A Temporary Txt File From My Clipboard And Populate The File Submit Dialog?

Guide for firefox:
Get the data from your clipboard with this: paste data from clipboard using document.execCommand("paste"); within firefox extension
Now you can either create a temporary file with something like OS.File: https://developer.mozilla.org/en-US/docs/JavaScript_OS.File/OS.File_for_the_main_thread
Or create a object with something like window.createObjectUrl.
Then assuming the file submit dialog is prompted by a html5 uploader, then you should just set value of that html5 dialog box there are other ways though too, like mozSetDataAt, mozSetFileArray etc, search github for these keywords shows excellent examples:
https://github.com/search?l=javascript&q=mozSetDataAt&type=Code&utf8=%E2%9C%93
https://github.com/search?l=javascript&q=mozSetFileArray&ref=searchresults&type=Code&utf8=%E2%9C%93
You might need to use the mimeType of application/x-moz-file not sure. Definitely experiement with it and share your solution, and ask for help along the way. This is fun stuff.
There are probably other smarter ways to attach into a input type=file, i was trying to do it the other week. I would also be interested if someone else could share some solutions to actually trick the file input element to think the native file dialog was actually used, maybe using XPCOM.

Related

Editing a PDF in UIDocumentInteractionController and saving..?

I've got an 'interactive PDF' that I need to be able to edit and save in an iOS app and I'm looking at how to achieve it. It's got text boxes and radio buttons which I can interact with in the UIDocumentInteractionController preview (or QLPreviewController) but there doesn't seem to be a way to save those changes to the file that was loaded and if I share the live and edited file to my mac via AirDrop it doesn't send the changes, rather it seems just the original file.
I don't really know anything about interactive PDFs so not sure how added text would normally be saved. I've found that the 'Files' app (added in iOS 11) actually saves the edits you make, so that's basically what I want to be able to do.
At the end of the day I just need a way to be able to interact with a PDF in my app and save the changes. Do I maybe need to use a custom PDF viewer rather than trying to piggy back off the standard iOS file previewer functionality?
Looks like this library solves my problem: https://github.com/derekblair/ILPDFKit
It lets you edit a PDF, access and set individual fields and save out as a static PDF.

Code that can look at open browser tabs and store the urls?

I am attempting to write a program that looks at the current browser you have open, goes through each tab, and copies and pastes each page's url into a notepad file.
I have no issue with writing the file; my main concern is that I can't find anything in any language that can look at the browser, sift through the tabs, and scrape the url.
Does anyone know if this would be possible, any code that might be able to help (in any language), or if something like this exists? I would appreciate anyone pointing me in the right direction.
The software I was looking for did not exist, so I created it. It's a chrome extension called Raincheck

Accept pasted image in Rails

I'd like my users to be able to upload an image by pasting it into a form.
Is this possible somehow with Rails?
I'd like to do this safely and limit to a single picture upload, not a completely open textarea.
UPDATE:
I'm looking for something like http://pasteboard.co/ that I can add into a form in a Rails app.
Also, with a paperclip hook like https://github.com/galetahub/ckeditor would be nice
Although I don't have a specific answer (copy & paste), I do have an answer regarding how to implement the uploading within the DOM:
JQuery
If you use something like jquery-file-upload, you'll be able to incorporate a GUI-based upload process to Rails
I think your question can be answered by taking this technology & applying to the specific element where you'd like to "copy & paste" the image
You can drag & drop images from your system into the example above. This is very similar to the copy & paste functionality you're seeking. I would personally look at this technology, and then apply it to the copy & paste procedure
WYSIWYG
You've referenced GMail as a great example of this -- but you have to remember they're allowing you to paste into a WYSIWYG editor
This is very important, as the upload image element will be handled through the WYSIWYG. You may be able to use this resource to help:
Wysiwyg with image copy/paste

Delphi: Set Browsers Homepage

I want my application to be able to set IE, Firefox, Chrome & Operas homepages when a button is pressed. I understand IEs homepage is set in the registry, which I understand how to change, but can anyone give me any help with the others? Thanks
Chrome stores the homepage in a file called 'Preferences'. On Windows XP, this is located at;
C:\Documents and Settings\USERNAME\Local Settings\Application
Data\Google\Chrome\User Data\Default
On Vista+, it's located at;
C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data\Default
This file is JSON format, and so it can be opened and viewed as plain text. In order to change the homepage, you'd need to load the JSON from this file, and change the homepage field value. You may also need to change the homepage_changed field value in order for it to stick. Using something like SuperObject to change the field would be an easy solution (if I get time, I'll write up some example code later).
Firefox uses a pref.js file to store it's settings, and realistically, a way of changing this would be to load this file, find the something that's along the lines of;
user_pref("browser.startup.homepage", "[URL]");
...and edit it as appropriate before saving the file. This should be a simple task using some simple find-and-replace code. I'd strongly advise that you use a pos() function though, as it could be that the end-user has already got their own custom homepage set and so searching for a preset string (e.g. [URL]) may not work, and certainly wouldn't be reliable.
A quick search hasn't given me enough information about Opera to provide a solution, but I'll keep looking and respond if I do find such a way.
Note that none of these methods have been tested and are merely provided based upon some very quick research.

Pdf modification on iOS

I am looking to be able to open a pdf file (done) and then be able to use the touch screen to sign the pdf and then save it with the modification. From what i have read this is no easy task, and i have no idea where to begin. Any of you know any tutorials or frameworks that will help me with this ?
Also if possible being able to modify fields of a pdf file, on the desktop the pdf can have fields you can click on then type in to fill out the form, without the need to ever print. If this is possible as well that would be perfect.
Thanks.
Maybe libHaru (http://libharu.org/wiki/Main_Page) does what you want, it's worth a try.
Does your starting point have to be a PDF? steipete's suggestion of using a system to create the PDF would work if your app workflow could create the PDF (sans signature) and display it, the user "signs" it in your app, and you create the PDF again this time with the signature embedded. It depends on whether this flow is an option for your app. Often it seems easier if you treat PDF as a final document and produce the PDF in it's final form each time (final meaning that you're not going to try modifying it).

Resources