Pull To Refresh Script - javascript

I've just downloaded jquery.mobile.pulltorefresh from here
I've uploaded it to my server to test and see if its the right one I want to use... However when you go to it:
quotesin.com
It doesn't work at all. Think I'm having a blonde day, if this is no good does anyone know of any lightweight versions I could use? Rather than Cubiq one?

your error is that you mention 3 files that there are not found or can't access
the files are:
1. jquery.mobile-1.0.js
2. jquery-1.6.4.min.js
3. jquery.mobile-1.0.css
you can test this by open your link on google chrome them right click on the page then click inspect element
after that choose resources tab, then expand the script link in the side tree view you can find that these file not found

Related

Acrobat JavaScript: Directory Contents and Hyperlinking Files

I've recently been looking into automating a few things in Acrobat through JavaScript and had a couple questions that came up. I'm wondering if anyone might have thoughts or tips on these, it would be appreciated!
Is it possible to either get the contents of a directory (so the list of documents can be stored as an array), or check for the existence of a file? From what I've gathered, this may not be something that JavaScript in Acrobat is able to accomplish due to lack of access to the file system.
Two tricks that I've seen suggested for checking to see if a file exists are to either import it as an attachment, or attempt to open the file and see what the result is. e.g. if (this.importDataObject("myFile", "/testfile.pdf/")) { This doesn't seem to work well for my situation as the files in question can be quite large, and importing or opening them can be slow.
Is there a best way to use JavaScript to set a hyperlink in a pdf to open a file? I've tried l.setAction("app.openDoc(\"testfile.pdf\")") which adds the quoted JavaScript to the hyperlink and uses it to open the file in a new window, but I'm wondering how this compares with the way Acrobat normally links to a file, or if there's another more optimal way to set this programmatically.
For question #1 - Short answer is "No". As you said, Acrobat JavaScript doesn't have access to the file system. Long answer is "Yes - depending on what you want to do". Acrobat has a way to run "Actions" that can process all the files in a given directory, a list of files, or all the files that are currently open. You can run JavaScript on each file in a directory using an action without that script needing to actually know the file name.
For Question #2. The only option you have to set a link action via JavaScript is to set the JavaScript action. If you create a link, you only get to set the mouse up action. However, you can add a button instead of a link where the background and border are transparent and there's no caption and you get something that visually looks like a link but you can set more actions like mouse up, down, and rollover (enter/exit).

Can't find images associated with Mozilla Ghostwriter demo

I have kind of a weird question. I want to get the following demo up and running, then modify it:
https://developer.mozilla.org/en-US/demos/detail/ghostwriter-art-studio/launch
However, the source code is apparently outdated. So I went back to the demo itself and used the "save as" command to save the files to my computer. However, no images are downloaded.
I can copy the images form the source download page - but they don't include eraser.png or eraser_shadow.png. So I checked the demo's CSS file. The path looks very simple...yet I can't find the image.
So that's my immediate question - where can I find the images eraser.png and eraser_shadow.png.
I searched the Demo page for support/contact information, but haven't yet figured out how Mozilla/GitHub work. It looks to me like this project may have been abandoned.
The project appears to be open-source with all the other images available. I'm assuming the author just forgot to include these 2 remaining images when he created the repository.
You can pull the images using the F12 developer tools:
https://developer.cdn.mozilla.net/media/uploads/demos/h/u/hunterloftis/1bb05943a07a6f68146f869ae2bb6b39/ghostwriter-art-stud_1305739973_demo_package/css/images/eraser.png
https://developer.cdn.mozilla.net/media/uploads/demos/h/u/hunterloftis/1bb05943a07a6f68146f869ae2bb6b39/ghostwriter-art-stud_1305739973_demo_package/css/images/shadow_eraser.png

Add a button dynamically to a WebPage from Firefox Addon.

I actually want to add a button to Gmail. When someone opens a email, he/she sees a button and when someone clicks on it, I add a function to it. I know one way but it's very intensive where I use setInterval() every 300 ms and run a function to check if it's Gmail or not and then add a button dynamically. I need something less intensive because I don't want people to have problems running my add on.
I want it all from my add on script so that I can easily communicate between other functions of my add on.
To add to pages it depends. Pages can do many tricky things (like GitHub using PJAX see this addon on how it was done).
Method 1 - addEventListener to window or gBrowser
But most usually you can catch a DOMContentLoaded or load event. Template HERE.
Method 2 - Observe http-on-examine-response and loadContext
If the URL of the nsIHTTPChannel matches your pattern then get the contentWindow from the loadContext and then manipulate. I need to make a clean template for this but you can see some messy ones: here and here
Method 3 - Add ProgressListener
ProgressListeners are nice because it helps you catch anchor changes, and usually when sites ajax and change page they change the url somehow but it doesnt really load a new page. I'm working on a template for this but it's not ready yet.
Info about addEventListener
If you add event listener in some situations it works for when 3rd parameter is true or when false. If you find one that works for your situation it will always work.
To figure out what combination works for you install this addon: event-listener-experiment-DOMC-and-load it's on GitHub so you can install straight from GitHub with this addon GitHub Extension Installer
Install that addon then navigate to your page, look in the browser console to see what feedback you're getting. It will tell you which works for you. If you need more help tell me the site and I will help you figure it out.
Here's a bootstrap template you can use once you figure out the combination:

How can I make an html file that lists files in its directory?

Here is the problem I am dealing with:
There are very few windows programs that display animated .gif images at the correct frame rate. Probably because they all use the windows libraries (probably .net) to do this, and anyone who has tried viewing an animated gif in I.E. and found that it was playing WAY TOO SLOW knows that Microsoft failed on this spectacularly.
The web browser Chrome is one of the few programs for windows that always plays animated gif's at the correct framerate, so my solution is to create a stand-alone html document to open in Chrome, that can be dropped into a directory and opened in Chrome to thereby display all images in that directory and/or its sub-directories in a picture-viewer style.
So far, my document (gif_view.html) opens an image based on a hard-coded path/file name, zooms this image in/out with the up/down keys, and switches to other hard-coded images with the left and right keys.
What I want is for these image file names to not be hard coded. gif_view.html should use a script to find out what images and sub-directories are in the directory I placed it in, and cycle back and forth through them with the arrow keys. It should also eventually create a list of sub-directories and let the viewer browse them.
Unfortunately, I can't get it to do either of these things on its own, since (for security reasons) JavaScript has no way of looking up the contents of a directory.
Does anyone know of a way to do this? Perhaps another scripting language to handle the left/right keys? Or is there a way to programmatically read the directory with JS that I missed? Or has Microsoft FINALLY released a patch or something to fix the frame-rate problem?
Please keep in mind: this should be a STAND ALONE DOCUMENT with NO external dependencies. A user should just be able to drop in into a folder, open it with a browser, and watch the magic happen. If your solution involves anything outside of the document itself (like say installing Apache and some server-side script to do the file reading) then it is not a solution. I've already tried stuff like that myself. Such external solutions work, but they are each very clumsy for their own reasons.
If anyone has ideas, I'd be grateful.
Using Chrome's directory upload feature, this is a breeze. Firstly, put a file select field in your file's HTML code:
<input type="file" id="file_input" webkitdirectory="" directory="">
and then, when the user selects a folder using it, you can read stuff like this:
document.getElementById('file_input').addEventListener('change',function(e){
var gifs=e.target.files;
[].forEach.call(gifs,function(curGif){
var elt=document.createElement('img');
elt.setAttribute('src',(webkitURL||URL).createObjectURL(curGif));
document.body.appendChild(elt);
});
},false);
this doesn't have all the fancy stuff with the arrows, but it works: http://jsfiddle.net/markasoftware/m65u7/1/

VBA Internet Explorer Download

First of all, I want to say that stackoverflow has helped me a GREAT deal with my current project, so thanks! But I have hit a point where I can no longer find help by skimming through previous questions. First, a little overview of what I'm doing.
At my job we have this extremely tedious process that we perform regularly, and I really want to automate it. The process is very basic, we go to a website, log-in, navigate to the appropriate page, copy and paste 6 values from excel into a form on the website, submit the form and download a specific output report. We repeat the process 60 times so this seemed like a prime candidate for Excel-Internet Explorer automation.
I built a pretty basic Excel Macro that can open up a new window with the appropriate URL, log-in, navigate to the correct page, fill in the form and submit the form, but I cannot figure out how to download the report. There is some added complexity to this, and I am just not familiar enough with Javascript, PHP ect. to figure out what is going on.
Problem: when I choose the correct report to generate, a new window pops-up with the generated report. This page is essentially empty when I click "View Source Document." There is a link to a Javascript page in the header, there is a little bit of CSS directly in the page, and like two tiny snippets of HTML. There is a download button on this page, but it doesn't look like it's being created in HTML.
QUESTION 1: Is this a Javascript application? Is there a way for me to simulate pressing the download button?
From what I understand, the complexity of my macro will increase substantially if I have to navigate between two IE windows, (not to mention there isn't an HTML link for me to click to download the spreadsheet) so I started to try and figure out a different way to do this. I looked at the URL of the new window with the generated report, and tried to analyze what was happening with Firefox's Developer tools (specifically Web Console). Here's where I get even more lost...
There are a series of "POSTS". These POSTS show up when the output is being created within the website:
POST https://www.website.com/somethingdb/quickframe/prod/#####/single_frame_results/correct_output.asp?THIS_KEY=370120c59da884dbdc375b1582a2142c1363533393a313335363032353737363a3646314a313937334a32353030303&bEmbedded=1
POST https://www.website.com/somethingdb/javascriptsource/prod/#####/website/forms/datagrid/DataGrid.html
POST https://www.website.com/qc?function=QuickFrameRmi
Then when I click the Download button, One POST and one GET show up:
POST https://www.website.com/qc?function=CorrectReport.generateExportFile
GET
GET https://www.website.com/somethingdb/quickframe/prod/#####/dlf/x6::370120c59da884dbdc375b1582a2142c1363533393a313335363032353737363a3646314a313937334a323530303031356026339.xls/sfn/RIGHTPAGE_scen_1_deal_cf.xls
The referrer for the GET looks like this:
https://www.website.com/somethingdb/quickframe/prod/#####/single_frame_results/correct_output.asp?THIS_KEY=370120c59da884dbdc375b1582a2142c1363533393a313335363032353737363a3646314a313937334a32353030303&sPagename=RIGHTPAGE&nScenarios=1&bShowExtendedFields=1&bShowAllCollats=0&ShowUnderlyingPage=0&sUnderlyingPage=&WebsitewrapDb=websitewrap&iSettleId=&bScrollbars=true&time=1356025839577
Like I said, my knowledge of these things is very limited but I do know that once I click on the download button, the GET from above is an actual file name that is stored on the website’s server. I can go into Excel, click on “Open” and put that file path in and it will download EXACTLY what I need.
So here is what I am thinking. If I could tell the website to simulate the download process, and log what that GET is, then I could just store that away, and when the Macro finishes generating all of the reports I need, it can just navigate back into Excel and set up a simple Loop to download all of them?? I have identified the portions of the GET that change:
x6::370120c59da884dbdc375b1582a2142c
63032353737363a3646314
6026339
This is my first post, so I apologize if I was too long winded in my back-story. Just wanted to be as clear as possible from the get go. I am wondering what is truly happening inside the website? Is what I am suggesting making sense? Is it possible? Is there a better way. Thanks in advance for any help.

Categories