I have been using tools like OptiPng for a long time and am wondering if there is any equivalent, that runs in JavaScript only inside the browser.
Just curious if a framework/plugin exists to optimize images in JavaScript?
I found pixtastic project. Not sure about performance but this sounds possible. http://www.pixastic.com/
Some thorough search later:
This SO question has all the necessary links. There is an imageMagick version in Javascript (found here).
Also, in theory it's possible to port to Javascript using emscriptem (see here)
ProcessingJS also provides a resize method.
Enough to get started.
Related
This question already has answers here:
How do I hide javascript code in a webpage?
(12 answers)
Closed 8 years ago.
I have a site whereby I can currently use firebug to look at all the angularjs files.
Is there anyway I can hide these so people cannot use tools to view them?
No you can't, the browsers need to see the code to execute it.
No. JavaScript files will always be accessible from client tools like IE dev tools or Chrome or just about any other browser's dev tools. You can take steps to make the js harder to read, but it will still be accissible
Yes, but the way is to stop people from accessing your site, which is probably worse. The way JavaScript works on most sites ( other than ones built on Node ) is that it is run in the browser and to do that it must be sent to the browser.
The reason it doesn't matter is that nobody wants to steal your code.
You need to remember that nothing you want to be kept secret should be in that JavaScript- run that on the server and pass the results out to front end - and for production you should probably be minimising your code anyway which provides a lot of obfuscation, but in general it is not worth worrying about.
You cant. But you can minify them using for example Google's closure compiler or Microsoft Ajax Minifier. Minifying not only makes your javascript less in size, but also gives an obfuscation to your code, so it is much more harder to understand
Is there any "mainstream" library used for this purpose? Commonly spread, well maintained, documented etc.
I found these (using flash):
Uploadify - not many releases, latest 12/2010, no documentation (!)
SWFUpload - latest release 03/2010, documentation
fancyupload - looks buggy.
phpfileuploader - looks heavyweight, and looks commercial (?) I cannot read the licence (you can download it but are you allowed to use it forever without paying?)
plupload
New version of pure javascript (no flash) Valums' ajax upload claims to handle file size limit and progress bar, which is quite suspicious to me: these features require to guess the file size before the upload, which seems impossible in javascript (look also here). Or can it work?
Check jQuery-File-Upload. It's quite alright. (Also handles file size. Thats what you mean?)
A new contender seems to be FileAPI, it uses HTML5 APIs, with flash as a fallback:
https://github.com/mailru/FileAPI
Here is an article about it on Smashing magazine: http://coding.smashingmagazine.com/2013/10/11/we-wanted-to-build-a-file-uploader/
Plupload and Uploadify look best up to my current research point...
I tried swfupload, it looked fine at the first sight but as I tried to use it, it started to be more and more cluttered, many of the features you see in the demo are unexpectedly not standard parts of the library, you have to get the example code and hack it a lot, it's not configurable (e.g. queue timeouts) etc... Refrained from using it.
What am I asking for is the ability to download a rendered / processed page via Google Chrome or Firefox I think.
For example, I don't want:
hendry#x201 ~$ w3m -dump http://hello.dabase.com
FAIL
I want:
$ $answer http://hello.dabase.com
Hello World
You should be able to do it using PhantomJS. It is running WebKit without the visuals, but you get the same fast and native supports for JavaScript, HTML/DOM, CSS, SVG, Canvas, and many others.
Disclaimer: I started PhantomJS.
Probably too early, but someone ported V8 to Go-lang, so now you could write your own client that makes use of this powerful combo:
http://bravenewmethod.wordpress.com/2011/03/30/embedding-v8-javascript-engine-and-go/
Looks quite straightforward, doesn't require an ugly Java/Rhino stack and adopts the next big programming language.
It looks similar to the problem http://simile.mit.edu/wiki/Crowbar is trying to solve.
You could use jsdom:- https://github.com/tmpvar/jsdom
I'd build a node driver for it, but it's supposed to work with Rhino etc.
I'd take a look at Rhino.
I'd use the excellent env.js library in conjunction with Rhino to simulate the browser environment as much as is technically possible. Once you've implemented some web spider bootstrap code you should be able to obtain the result you want above.
I'd be interested in other solutions to this though.
How to identify the javascript canvas library used by a certain website? (e.g. processingjs or ...)
Well, install firebug. On the net tab, and js subtab, you will find all the library loaded. And also install library-detector add-on to determine which library is used.
And make sure, net is enabled.
View source or use firebug to view the included scripts. If you see 'processing.js', for example, it may be used. If you don't see it, well, it still may be used.
You have to dig into the included scripts to be sure.
EDIT:
Loos like IXL uses YUI to for general javascript utilities/DOM help/namespacing. As far as I can tell, no canvas library was used -- basic shapes aren't that hard to draw with canvas.
This question already has answers here:
Why is jQuery not integrated within the browser
(7 answers)
Closed 4 years ago.
It seems like a good idea to me. or add the additional features to Javascript itself?
Because it's just one library of many. It may be popular but it's far from being the only choice. And it would also cause it to freeze at a particular version and make improvements much slower.
Plus there is little advantage anyway. It's fairly small and you can set it to be cachable indefinably by the brower so it will only be downloaded once anyway - if you have a new version it will have a new filename, so there is no harm in making it never expire.
I think this question should be a bigger discussion, but these answers are all bogus.
This is also 2 years later of course.
"it's just one library of many" - include the top 11 then.
"couldn't agree on common standard" - Kind of making jQuery a standard of it's own at this point.
"updated more often than browsers" or "make improvements slower" - So the browser won't have jQuery-1.9.x until next browser update, just don't put it in your project yet.
"Cache anyway" - Sure, it's still a transfer that doesn't have to happen, and there are a lot of people that haven't done a lot of surfing on their new device that you still want your site fast for and so on.
The thing is it is totally doable and would be better for the internet load; by how much is debatable. I could really see chrome at least replacing any net transfer to their CDN with a local copy, but I'm sure there is some legal, security or net neutrality issues with that. Just like I'm sure the main reason has something more to do with such matters and not these lame technical excuses that are obviously not thought through.
This could benefit other libraries too if developers could rely on the speed and availability of a complete library of tools like dojo, and not have to pick and choose just to cut weight. And also as most libraries have adopted the AMD or requireJS approach to package their projects, I believe there is a good argument for the enabling the browser to at least be informed of it's dependencies.
jQuery exists just because they (browser makers) couldn't agree on common standard.
You can consider jQuery to be a JavaScript plug-in. And browsers do not ship with plug-ins, otherwise the purpose of plug-ins would be irrelevant.
Plugins get updated more often than browsers - within a week the browser version of jQuery would be out of date :)
There's also the issue of versioning. Certain sites and extensions of jQuery require a certain version of jQuery. Right now it's up to the application to decide which version to use.
Probably because browsers are hard to update. Some freature of JQuery may eventually make their way into javascript, and I believe some of it has just recently. (well the idea's anyways) It takes years to add a feature to something like javascript, where the JQuery library can just release a new version.
There is actually a firebug or firefox plug in that allows you to inject JQuery into the page.. but thats just a development tool
Adding jQuery [type] functionality to the browser's in-built JS implementation (or making it a 1st-class plug-in) would overcome one basic problem:
As many have said, jQuery is a JS library - meaning, in case the penny didn't drop - that it is written in JS and has to be interpreted at run-time.
Embedding it would mean that it could be written in native code for the OS, making it much more performant.