background preloader

Javascript 1

Facebook Twitter

Java

Nginx. JSMIN, The JavaScript Minifier. The JavaScript Minifier Douglas Crockfordwww.crockford.com JSMin is a filter which removes comments and unnecessary whitespace from JavaScript files. It typically reduces filesize by half, resulting in faster downloads. It also encourages a more expressive programming style because it eliminates the download cost of clean, literate self-documentation. What JSMin Does JSMin is a filter that omits or modifies some characters. JSMin first replaces carriage returns ('\r') with linefeeds ('\n'). It omits spaces except when a space is preceded and followed by a non-ASCII character or by an ASCII letter or digit, or by one of these characters: It is more conservative in omitting linefeeds, because linefeeds are sometimes treated as semicolons. And if it follows a non-ASCII character or an ASCII letter or digit or one of these characters: No other characters are omitted or modified. JSMin knows to not modify quoted strings and regular expression literals.

JSMin does not obfuscate, but it does uglify. JSIntegration 主页. Javascript Diff Algorithm. Using an idea grabbed from a mailing list post , I implemented the diff algorithm discussed in the following paper (free registration required): P. Heckel, A technique for isolating differences between files Comm. ACM, 21, (4), 264--268 (1978). The implementation, itself, has two functions, one of which is recommended for use: This method takes two strings and calculates the differences in each.

The final result is the 'newFile' marked up with HTML (to signify both deletions from the oldFile and additions to the newFile). document. body . innerHTML = diffString ( "The red brown fox jumped over the rolling log "The brown spotted fox leaped over the rolling log" The red brown spotted fox jumped leaped over the rolling log. Projects Using this Code: Wikipedia Animate AniWiki Downloads jsdiff.js This work is licensed under a Creative Commons Attribution 2.5 License .

Comments are automatically turned off two weeks after the original post. JsJava is not Java but an excellent Javascript classes library. &#039;anchor()&#039; Example : anchor : Javascript Methods : Jav. TinyMCE:Index - Moxiecode Documentation Wiki. FCKeditor - FCKeditor Wiki. 生活点滴Enjoy Life - 如何解决js在FireFox下不能复制文字到剪贴板的问题. 昨天注册了Bloggerwave,在后台操作的时候,发现他的js脚本复制到剪贴板居然在FireFox下有效,这可是我第一次发现复制到剪贴板这样的代码在FF下有效,当然IE就不用说了,js在IE下操作剪贴板还是很容易的。 后来我就查看了他的源代码,发现人家采用了一个巧妙的方法,那就是利用flash作为跳板来完成此功能,具体代码如下: <script type=”text/javascript”>// <!

[CDATA[ function CopyText(id) //copyToClipboard(document.getElementById(id).value); copy(document.getElementById(id).value); function copy(text2copy) { if (window.clipboardData) { window.clipboardData.setData("Text",text2copy); } else { var flashcopier = 'flashcopier'; if(! Var divholder = document.createElement('div'); divholder.id = flashcopier; document.body.appendChild(divholder); document.getElementById(flashcopier).innerHTML = ''; var divinfo = '<span src="_clipboard.swf" mce_src="_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></span>';//这里是关键 document.getElementById(flashcopier).innerHTML = divinfo; alert('Text copied'); function copyToClipboard(meintext) if (window.clipboardData) alert("ie"); // the IE-manier if (!

Alert(“mozilla”); Instant.js (now with IE 6/7 support) <form name="lst" id="lst" method="post" action=".. instant.js 2.4 allows you to add an instant picture effect (including tilt) to images on your webpages (alternatively: slided.js or filmed.js). It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it'll degrade and your visitors won't notice a thing.CVI-lab: Get a fast impression of the effects and their illustration qualities. Shows some of the things instant.js does.

First image with class = "instant itiltleft icolorFFFCE9 ishadow40 historical", next image with class = "instant nocorner itxtalt" and next two images with class = "instant itxtalt". All other images with class = "instant" only... Images used are copyrighted and are used for demonstration only. Download instant.js and include it into your webpage. // only if you want to use the annotation feature...

Javascript LRU Cache. Keystone Websites: Making AdSense work with XHTML. ECMAScript 基础 - Flyingis. Prototype.js 1.4版开发者手册(强烈推荐) - 谭振林. Last update: March 30th 2006 中文版:THIN 最后更新:2006-3-31 看到一个很好的东西在国内没有被很多人使用起来,实在是不爽,所以花了很大功夫把这个手册翻译成中文,由于这篇文章很长,所以,翻译的工作量很大而且有些地方英文版也没有说清楚,虽得查看源代码,好在不是坚持做完了,大家鼓励下啊! ^o^ prototype.js是一个非常优雅的javascript基础类库,对javascript做了大量的扩展,而且很好的支持Ajax,国外有多个基于此类库实现的效果库,也做得很棒。 有朋友说prototye已经有人翻译过了,呵呵,是对的,说明你以前关注过它,不过原来翻译的是1.3版的文档,1.4版有很多重要的扩展,而且pre_1.5版现在也出来,不地改动不大。 Prototype.js是什么? 万一你没有使用过大名鼎鼎的prototype.js,那么让我来告诉你,prototype.js是由Sam Stephenson写的一个javascript类库。 如果你最近尝试使用它,你大概了解到文档并不是作者的一个强项。 同时,在本文中,我也将提供一个关于这个类库提供的objects,classes,functions,extensions这对东东的非官方参考 在阅读这个文档时,熟悉Ruby的开发者将会注意到Ruby的一些内建类和本类库扩展实现之间非常相似。 相关文章 Advanced JavaScript guide. 一些实用的函数 这个类库带有很多预定义的对象和实用函数,这些东东的目的显然是把你从一些重复的打字中解放出来 。

使用$()方法 $() 方法是在DOM中使用过于频繁的 document.getElementById() 方法的一个便利的简写,就像这个DOM方法一样,这个方法返回参数传入的id的那个元素。 比起DOM中的方法,这个更胜一筹。 另外一个好处是,这个函数能传入用string表示的对象ID,也可以传入对象本身,这样,在建立其它能传两种类型的参数的函数时非常有用。 使用$F()函数 $F()函数是另一个大收欢迎的“快捷键”,它能用于返回任何表单输入控件的值,比如text box,drop-down list。 使用$A()函数 $A()函数能把它接收到的单个的参数转换成一个Array对象。 使用 $H() 函数 使用$R()函数 使用Try.these()函数 <?

Log4javascript - a JavaScript logging framework. Optimizing Page Load Time - die.net. However, for many sites that reference dozens of external objects, the majority of the page load time is spent in separate HTTP requests for images, javascript, and stylesheets. AJAX probably could help, but speeding up or eliminating these separate HTTP requests might help more, yet there isn't a common body of knowledge about how to do so. While working on optimizing page load times for a high-profile AJAX application, I had a chance to investigate how much I could reduce latency due to external objects. Specifically, I looked into how the HTTP client implementation in common browsers and characteristics of common Internet connections affect page load time for pages with many small objects.

I found a few things to be interesting: IE, Firefox, and Safari ship with HTTP pipelining disabled by default; Opera is the only browser I know of that enables it. No pipelining means each request has to be answered and its connection freed up before the next request can be sent. -- Aaron Hopkins. jQuery: New Wave Javascript. Visual jQuery 1.0 (Automated) Services. Jasob JavaScript Obfuscator - The ultimate solution for JavaScri. IEBlog : IE + JavaScript Performance Recommendations - Part 1. Hello again, this is Peter Gurevich, Performance PM (among other things) for IE7.

We have heard a lot of requests to improve our Jscript engine, especially now that AJAX sites are becoming more prevalent on the web. I want you all to know that we have been listening and have recently made some great fixes to our engine to improve the garbage collection routine and to reduce unbounded memory growth. You should see noticeable improvements on AJAX sites in the Release Candidate we shipped last week. I want you also to know that performance of the object model and JavaScript engine will be an area that we focus on strongly in future releases. While investigating the performance issues on script heavy sites we noticed several design patterns that resulted in less than optimal script performance.

Changing these design patterns on the site end often resulted in huge performance wins (4x to 10x increase) to the user, so I wanted to share these recommendations with everyone. Thanks, Visual jQuery 1.0 (Automated) Dojo, the Javascript Toolkit: brought to you by the Dojo Foundat. JavaScript Date Object. 蓝色理想 - JavaScript实用的一些技巧. Ntent with Style: Fixing the Back Button and Enabling Bookmarkin. 用函数式编程技术编写优美的 JavaScript - emu in blogjava. 转子 。 大部分内容适合介绍给初学者,只有最后的sequence算是一个可以借鉴的设计模式了。 级别: 初级 Shantanu Bhattacharya (shantanu@justawordaway.com), 首席顾问, Siemens Information Systems Limited 2006 年 7 月 20 日 函数式或声明性编程是非常强大的编程方法,正逐渐在软件行业流行起来。 这篇文章将介绍一些相关的函数式编程概念,并提供有效使用这些概念的示例。 作者将解释如何使用 JavaScript(TM)™(JavaScript 能导入函数式编程的构造和特性)编写优美的代码。 简介 函数式编程语言在学术领域已经存在相当长一段时间了,但是从历史上看,它们没有丰富的工具和库可供使用。 因为函数式编程采用了完全不同的组织程序的方式,所以那些习惯于采用命令式范例的程序员可能会发现函数式编程有点难学。

函数式编程概念,包括匿名函数、调用函数的不同方法,以及将函数作为参数传递给其他函数的方式。 函数式编程概念 在那些通过描述 “如何做” 指定解决问题的方法的语言中,许多开发人员都知道如何进行编码。 清单 1. 这类语言也叫做过程性 编程语言,因为它们定义了解决问题的过程。 清单 2. 第二个语句指明要得到从 1 开始的前 n 个数字的列表(take n [1..]) 从历史上看,函数式编程语言不太流行有各种原因。 我现在要讨论 JavaScript 中的函数式构造的各种美妙之处,以及在日常编码和工作中使用它们的方式。 匿名函数 在 JavaScript 中,可以编写匿名函数或没有名称的函数。 然后对应的匿名函数看起来应当如下所示: 清单 4. 要使用它,则需要编写以下代码: 清单 5. 使用函数作为值 也可以将函数作为值使用。 在上面 清单 6 的示例中,为变量 sum 赋的值是函数定义本身。 调用函数的不同方法 JavaScript 允许用两种方式调用函数,如清单 7 和 8 所示。 清单 7. 或 清单 8. 所以也可以编写以下代码: 清单 9. 可以在括号中编写函数表达式,然后传递给参数,对参数进行运算。 将函数作为参数传递给其他函数 也可以将函数作为参数传递给其他函数。 清单 10. 结束语. JavaScript就这么回事1-5(转的一个不错的JavaScript基础教程) - 性情男人 - FreshBlog.com. OpenWebWare - DHTML JavaScript Components WYSIWYG Editor Content. Creating A Client-Side Web Service Broker :: Johnvey. June 20, 2005 Initially, I had planned on using the XmlHTTPRequest object to create a client-side application that integrated various web services like Google suggest, del.icio.us, Flickr, Yahoo developer network, etc.

Unfortunately, the browser security restrictions severely limit the capabilities of a client-side application, essentially eliminating any cross-domain integration services. However, single-domain services can still be implemented by using the Javascript bootloading technique. Same-Origin Policy The most frustrating part of creating any client-side application is the security model that applies to just about all executable objects that can be accessed by the browser. Designed the prevent cross-site scripting attacks (XSS), the same-origin policy effectively prohibits a page served from www.mydomain.org to access any document served from a different domain, via XmlHTTPRequest, IFRAME's, or similar DOM methods.

Using the Javascript Bootloader Resetting the Page. Frame / motion animated menus using CSS and Javascript. Providing users with relatively accessible menus with animated backgrounds Using classes and non-obtrusive code to compensate for no-javascript environments updated on 16.05.2006: Feature fix created on 22.04.2006 I've had some nice feedback for my Javascript animation tutorial which has also been featured on Dom scripting task force website. Being the layman I am, this made me quite proud! Top Samples The moral of the story is not turning to flash animation just to show your users a little eye-candy, and eye-candy can be fed to users while still having an accessible, search-indexable, copy-pastable, nicely printable content. For frame based animation, we will stack our animation frames vertically, and some sizes related to height should be defined in pixels, that's not condsidered good in terms of accessibility indeed as Internet Explorer users cannot change the sizes of fonts defined in pixels, but we need it for the simplicity of the tutorial.

In this example, each frame is 210*30px. VrH. JavaScript speed test. JSConfusion By Lion. Javascript开发包汇总. 开发者在线. JavaScript教程 @ ▒ 网络编程 ▒ Demos in scriptaculous wiki. Script.aculo.us is a set of JavaScript libraries to enhance the user interface of web sites. It provides an visual effects engine, a drag and drop library (including sortable lists), a couple of controls (Ajax-based autocompletion, in-place editing, sliders) and more. Be sure to have a look at the demos! API Documentation and Reference This wiki details Version 1.8.1 of the library, which is the most current version of the 1.x trunk of script.aculo.us. Core Effects: Effect.Highlight, Effect.Morph, Effect.Move, Effect.Opacity, Effect.Scale, Effect.Parallel,Effect Queues Combination Effects: Effect.Appear, Effect.BlindDown, Effect.BlindUp, Effect.DropOut, Effect.Fade, Effect.Fold, Effect.Grow, Effect.Puff, Effect.Pulsate, Effect.Shake, Effect.Shrink, Effect.SlideDown, Effect.SlideUp, Effect.Squish, Effect.SwitchOff, Effect.ScrollTo Effect helpers: Effect.Transitions, Effect.Methods, Effect.tagifyText, Effect.multiple, Effect.toggle script.aculo.us is open source.

Quick start 1. 2. Next steps. Script.aculo.us - web 2.0 javascript. MochiKit – A lightweight Javascript library. Continuing Intermittent Incoherency » What else is burried down. So the new GTalk interface in GMail is pretty rad. Congrats to Dan and the rest of the team that made it “go”. The talk feature is cool not just from a UI perspective as the code is also chock full of little gems. I’m kind of a dork about low-latency data transport to the browser. HTTP wasn’t meant to be used this way…so of course I’m interested!

When a page (or an iframe it hosts) is loading content, your browser usually shows some sort of “I’m working” indicator. But couldn’t you do something with XMLHTTP? Which Google has. How? // we were served from child.example.com but // have already set document.domain to example.com var currentDomain = " var dataStreamUrl = currentDomain+"path/to/server.cgi"; var transferDoc = new ActiveXObject("htmlfile"); // !?! This is the kind of fundamental technique that is critical to making the next generation of interactive experiences a reality.

JavaScript: DHTML Library, Drag &amp; Drop for Images and Layers.