121 Comments
- onixxino, on 10/12/2007, -8/+55I'm sick of all of these "...snipplets you can't live without". As a matter of fact, I CAN live without them. While some of these summaries are useful, the most are just blog spams.
It seems like people just try to find the coolest/newest/silckest snippets and somehow stuck them into their website. No, this is not how software design works. The proper way is: 1) Design your system and figure out what features you need, 2) Look on the Internet packages (snipplets) that might fit or 3) write one your own. - fkr3, on 10/12/2007, -6/+44Digg doesn't use JavaScript in a smart way. Digg cut & pasted several bulky libraries in so it could do the most with the least amount of their effort. As a result a pageview includes 100's of kilobytes of JavaScript.
If digg used JavaScript the "smart" way they'd write their own that does only and exactly what they do at a fraction of the bandwidth cost and a significantly faster load time for everyone who views the site. 3 versions later it's obvious they care more about transitioning from a news site to a funny links site.
It's a bit of a stretch to consider 100's of kilobytes "unobtrusive" too. - NanoStuff, on 10/12/2007, -1/+35mr1337,
You manually approve every script that runs? So what happens when you come upon a script you've never seen before? You examine the source code to ensure there are no vulnerabilities? I'd imagine that would get old after the first three thousand scripts. - UO07, on 10/12/2007, -6/+30You must hate digg then, most of the stuff you see on the site is done via Javascript.
- fkr3, on 10/12/2007, -2/+19/js/7/digg.js - 14,077 bytes
/js/7/label.js - 3,082 bytes
/js/7/prototype.js - 46,817 bytes
/js/7/scriptaculous.js - 2,370
/js/7/comments.js - 7,257
/js/7/spellChecker.js - 8,261
Total: 81,861kb
It looks like they've trimmed it down significantly some time in the last month or two. Regardless, for what boils down to sliding divs in/out, changing css class names, fading a number in/out and ajax requests that's a ridiculous amount of JavaScript.
Google Maps appears to function on 1/3 that volume of JavaScript (36,391 bytes). - fkr3, on 10/12/2007, -6/+21Your buddy didn't get compromised because of JavaScript, he got compromised because he was on ***** sites that exploit idiots. What was he "buying" while downloading "cracks"?
- DarknessGP, on 10/12/2007, -0/+12I agree with onixxino. Hell, the last "top 10 firefox extensions you can't live without" ended up being like an RSS reader, a plugin for adding to your blog, etc. And honestly, I never used any of the plugins it said I couldn't live without. Actually, that list didn't even include Adblock Plus or Fasterfox (set to Optimized) Two plugins I'd consider that I couldn't live without...
Anyways, back to the task at hand. A little info up front, I'm a software/web developer at a small/medium company. We host around 100 or so web sites with everything ranging from Classic ASP VBScript to Coldfusion to PHP to ASP .NET and I looked over the list, and honestly I have never had a need or a desire to have any of these functions. Perhaps for a personal site, I might see the benefit of a handful that are on the list, but as a tech professional, I can confidently say that this list is definitely not something you "can't live without" - wingnut21, on 10/12/2007, -4/+12"You either love Javascript or you hate it."
Why would someone hate (properly used) javascript?! - TexanPsycho, on 10/12/2007, -0/+8Future news: "10 Lists You Can Live Without"
- Hamsterpotpies, on 10/12/2007, -1/+9I lived without them till now. I'm still living without them. I looked, noticed the uselessness of them, then closed the tab.
- ggidster, on 10/12/2007, -7/+15Some useful snippets there. Just be careful to keep half a mind on accessibility. Many browsers (sometimes because of corporate policy) have JS switched off, so some kind of alternative option if the user doesn't have JS is recommended........
- vann, on 10/12/2007, -1/+8Yes, but it is deliciously evil. Mmmmm...
- NanoStuff, on 10/12/2007, -2/+9soapdish,
If you're incapable of finding uses for a computer beyond music and e-mail, you should be concerned about the processing capabilities of that little prune inside your head rather than trying to justify your technological incompetence. - UO07, on 10/12/2007, -15/+22You just lost 10 'cool' points for saying "snippet".
- GrahamStw, on 10/12/2007, -2/+8@fkr3
> Total: 81,861kb
The js scripts are served up as gzip compressed (presumably via mod_gzip or mod_deflate).
You can check this by using a tool like http://www.port80software.com/products/httpzip/compresscheck
So actually the downloaded sizes break down as:
/js/7/digg.js - 4,707 bytes
/js/7/label.js - 3,059 bytes (uncompressed)
/js/7/prototype.js - 12,330 bytes
/js/7/scriptaculous.js - 1,254 bytes
/js/7/comments.js - 2,018 bytes
/js/7/spellChecker.js - 1,993 bytes
Total: 25,361 bytes
Also the scripts are served with "Cache-Control" and "Expires" HTTP headers set for 10 years - so they should only be downloaded the first time you visit digg and then be cached by the browser for all subsequent pages.
So "a pageview includes 100's of kilobytes of JavaScript" should really read "the first page view includes 25KiB of JavaScript". - Sonic_Molson, on 10/12/2007, -2/+8http://duggmirror.com/programming/15_Javascript_Snippets_You_Can_t_Live_Without/
- IEatHamburgers, on 10/12/2007, -2/+7@fkr3:
80MB of Javascript? Holy ***** is Digg screwed up! - resplence, on 10/12/2007, -0/+5I knew this was going to be weak when it said "And it doesn't have to affect usability".
The words of someone who's been trying to 'catch up with all this web 2.0 stuff', overheard "javascript" and "usability" being used in the same context but is not exactly sure how to reproduce it. - drmangrum, on 10/12/2007, -1/+5What is strange or awkward about the syntax? It's nearly identical to Java/C/C++? Unless you've been using nothing but VB, perl, and php, it's a very standard syntax model.
- vann, on 10/12/2007, -0/+4Eh, this seems like something that was written just to get dugg. It's mostly a list of JavaScript library demos from around the web, not quite what I'd call "snippets." Even so, JavaScript is a language that gets snippited to death, in my opinion. What I mean is that there are basically two attitudes about JavaScript: one, it's an easy way to manipulate the DOM with little snippets of code; two, it's a hacky language, less powerful than "real" languages like C++, Python, or whatever.
Both parties miss a lot, though, because JavaScript is actually a very expressive language. The snippeters don't use the full expressiveness of the language and the more hardcore programmers see the snippets and conclude that JavaScript is hackish. People see JavaScript as somehow being Java lite or C++ lite, but it has a very strong functional aspect.
For the CS geeks out there, it is possible to write a one-line Y combinator in JavaScript.
http://digg.com/programming/The_Philosophy_of_JavaScript is a pretty good article that touches on some of the object-oriented aspects of JavaScript, in the vein of Douglas Crockford. - LavaIce, on 10/12/2007, -0/+4There is nothing wrong with JavaScript, just with how some people use it. I recommend reading "DOM Scripting: Web Design with JavaScript and the Document Object Model" by Jeremy Keith. JavaScript can be used as another layer to web to add additional functionality while degrading cleanly and allowing users without it access, and this just does not cover corporate policy that has it disabled but also mobile browsers, and screen readers. Additionally, with modern scripting techniques you don't ever have to include JavaScript inline you can treat it much the same as you do CSS and have it reside in an external file. Also, Jeremy outlines in his book that you no longer need to do browser detection you only need to test for the particular features before you use them to allow degrading to base functionality.
- Eloom123, on 10/12/2007, -1/+5@NanoStuff
NoScript is a great extension, I use it all the time and believe that controlling what scripts are running on your system is essential in order to surf the web safely. NoScript will stop all scripts from running, and will prompt you to allow each site to run scripts individually, it does not work on a script by script basis as you imply. So once you allow a site, if that site changes the script it is running, you don't have to allow it again.
It is quite common to browse to a site whose scripts you want to allow, but you don't want externally hosted scripts to be running, such as the scripts of their advertisers. It also allows you to browse to sites which you know have malicious scripts safely. Yes it can be annoying, but that's a price you pay to be secure. - howdesign, on 10/12/2007, -0/+4Here's a clever javascript for zoomable photos and other elements. First saw the technique on Freep.com.
http://vikjavev.no/highslide/ - nofxjunkee, on 10/12/2007, -1/+4@wingnut21 (#5890218)
The more I learn about JS the more I like about the language. Some of the syntax is awkward or strange but the language itself is pretty pleasant (especially with a stdlib-type library such as prototype or dojo). - Gizza, on 10/12/2007, -2/+5The worst is when they use it for images. So you cant open the image up in a new FF tab. I HATE that.
- tybris, on 10/12/2007, -1/+4Always up for a challenge....
....
nope..still alive. - picto, on 10/12/2007, -0/+3Alright...so the problem I have is that some kid is gonna see this and go "Wow! Javascript windows inside the browser!" and then go to town using it just because he can. Javascript is a great tool...but oftentimes is considerably overused. If you're trying to put together an application/blog/website where you want to maximize the number of users you've got to say "This site requires javascript to be enabled" as an absolute last resort. This is not to say that you have to try to do everything without javascript (i.e. some features would be disabled), but it shouldn't be the key component of your application/blog/website.
- rompom7, on 10/12/2007, -0/+2@onixxino: This is a case of a bad digg title.. If you read, the actual article the title is:
15 Javascript Snippets (You Probably CAN Live Without)
EDIT: It appears I'm looking at a lo-fi version, I checked the cache and it did indeed state the aforementioned hyperbole. Never mind my retardedness. - Zipp425, on 10/12/2007, -1/+3It makes me sad when things like this reach the frontpage.
- picto, on 10/12/2007, -2/+4Alright, so let me rephrase: it's the actual interaction of the UI. I'm talking about what the javascript does on a basis of usability, rather than how efficient the javascript is. Yes, I agree that the physical implementation is bulky, obtrusive and smart from an efficiency standpoint but regardless of the efficiency concerns, the interaction it provides to the interface in a usability sense is done in a smart way (i.e. hiding things you may not want to see).
I should've made that clear from the start...but hey, I'm a usability guy so I was quick to assume. - foamcow, on 10/12/2007, -0/+2To be fair there are a couple of useful things in there.
The resize detection is handy and non-intrusive (assuming it's the ALA one - can't check, site's down)
Can't recall what else was there now. - rmaxrocks, on 10/12/2007, -1/+3An end user doesn't wanna know how it works.. If he's curious enough then he'll find out anyway. I think the whole point in implementing javascript and AJAX is to please the end-user. Thats what digg does - please and ease. If digg was like a BB forum, it wouldnt get this much attraction.
- erikpols, on 10/12/2007, -0/+2"without the overhead of Scriptaculous"...
You mean there is a library that does what your code does and more? Please, can I have the link!
/irony
Yea I can live without those lists as well.If I need something simple I'll make it myself. If not, I'll use (indeed) Scriptaculous. - GotMex, on 10/12/2007, -0/+2The calendar looked cool for a bit... until a realized that the license I would need to use it in my sites would cost me $499 dollars. I can get Photoshop for that kind of money... Rip-off
- MrSarcasm, on 10/12/2007, -0/+2because 11-year-old have used too much blinking and pop-ups designing "websites" few years ago :|
- thesimo, on 10/12/2007, -0/+1this is very nice thanks mr fritzthingy :)
- nofxjunkee, on 10/12/2007, -0/+1@drmangrum (#5892950)
The C-like syntax is just fine. Like you said every programmer will be familiar with it. It's writing OO code that I find strange sometimes what with the prototype-based inheritance and such. - daonlyfreez, on 10/12/2007, -0/+1I love JavaScript for quick browsing automation.
Here is a simple JavaScript I use as a bookmark/favelet to trigger any "Next" link in a webpage, works in Google and Digg.
javascript:ae=document.getElementsByTagName("a"); for (var i = 0; i < ae.length; i++) if (ae[i].innerHTML.indexOf("Next") >= 0) window.location.href = ae[i].href;
Very nice as a "button" in your personal bar in Opera for example. Could be easily adapted to accept more links (like lower-case "next" etcet.) - thailand1972, on 10/12/2007, -4/+5More like "15 Javascript Snippets To Make Your Website Inaccessible".
Drag and drop shopping baskets? Draggable Windows? How to do without a mouse?
Also, no mention on the page about the importance of degrading these tools (i.e. have an alternative without javascript).
I don't "love or hate javascript" - I use where appropriate. - PatrickB, on 10/12/2007, -1/+2Sorry, I could live without these scripts!
- smackhero, on 10/12/2007, -0/+1get a programming book and learn how to write your own applications if you're gonna be a web developer. this isn't the 90's where web design/development meant taking an intro class at a junior college and having good connections. skilled web developers who are worth the kind of pay that draws people to web development are in pretty good supply. if you don't want to learn how to program, then it's time to find a different profession.
- GrahamStw, on 10/12/2007, -0/+1@GotMex:
"The DHTML / JavaScript Calendar - Best and open-source
This program is available under the terms of the GNU Lesser General Public License version 2.1 or above."
It's only the Zapatec version that costs. - SquireToad, on 10/12/2007, -0/+1Too bad more of them couldn't have been free. Pointers to overpriced trialware leave me cold. Buried.
- kevmaster, on 05/28/2009, -0/+1Be sure to checkout 400+ PHP functions ported to JavaScript
http://phpjs.org/functions/index - jasg, on 10/12/2007, -0/+1@wingnut21
Because they are morons ?..you do know that they exist ?
please digg this http://digg.com/programming/Top_10_Myths_about_JavaScript
and enlighten all. - Dustin00, on 10/12/2007, -0/+1"Drag & Drop Shopping Cart"
UG! If I run into this on a site, I'm gone. A simple click is all that is needed and is far more accessable for people with disabilities. - quick5pnt0cobra, on 10/12/2007, -0/+1I'd be willing to be I can live without them.
- daonlyfreez, on 10/12/2007, -0/+1Err, I cannot change the html of a site I don't own. I know what you mean, yet the javascript works on all sites with the specific linkname, and on all browsers (I think), not only in Opera.
This way, I can use a trigger (bookmarklet or scripting the pasting into address bar of browser and pressing enter) to go to any page's "Next" without having to point my mouse at anything. - locnguyen, on 10/12/2007, -0/+1Is there a free version of the dynamic tables anywhere?
- Vindstille, on 10/12/2007, -0/+1daonlyfreez: What about setting a in your html-document. Then people can use the dobble arrows in Opera to switch back and forward.
-
Show 51 - 100 of 115 discussions



What is Digg?
Digg is coming to a city (and computer) near you! Check out all the details on our