<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://javascriptcompressor.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Great Javascript Frameworks</title><link>http://javascriptcompressor.com/forums/7.aspx</link><description>Which Javascript Framework is the best? Which one(s) do you use and why?</description><dc:language>en</dc:language><generator>CommunityServer 2008 (Build: 30417.1769)</generator><item><title>JUNE Framework</title><link>http://javascriptcompressor.com/forums/thread/9.aspx</link><pubDate>Tue, 01 Jul 2008 07:55:40 GMT</pubDate><guid isPermaLink="false">46e44164-0b03-4ad8-8ee9-19568eb0413f:9</guid><dc:creator>Costin Trifan</dc:creator><slash:comments>0</slash:comments><comments>http://javascriptcompressor.com/forums/thread/9.aspx</comments><wfw:commentRss>http://javascriptcompressor.com/forums/commentrss.aspx?SectionID=7&amp;PostID=9</wfw:commentRss><description>&lt;p&gt;&lt;span style="font-family:verdana,geneva;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:verdana,geneva;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;JUNE is a lightweight, cross-browser, modular, flexible and namespaced JavaScript library.&lt;/p&gt;
&lt;p&gt;JUNE has been built on top of&amp;nbsp;&lt;a target="_blank" href="http://www.sitepoint.com/blogs/2007/08/29/simply-javascript-the-core-library/" class="null"&gt;Core library&lt;/a&gt; and it can either be used as a standalone library or alongside other libraries like JQuery. Only one main namespace is used throughout this framework: &lt;strong&gt;JUNE&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It was designed using the&amp;nbsp;&lt;a target="_blank" href="http://yuiblog.com/blog/2007/06/12/module-pattern/" class="null"&gt;Module Pattern&lt;/a&gt;, which confers it protection for its internal variables.&lt;/p&gt;
&lt;p&gt;JUNE was especially created for the small to medium-sized websites, blogs, wikis and any other websites that don&amp;#39;t require features like drag-and-drop or animations, and for newcomers to the JavaScript language.&lt;/p&gt;
&lt;p&gt;The existent methods of this framework have been grouped by their functionality in namespaces like Browser, Cookie, DOM, Form, and the functions&amp;#39; names are intuitive and easy to remember.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Design&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The following design guidelines have been used throughout JUNE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;member variables are written using camelCasing,&lt;/li&gt;
&lt;li&gt;functions&amp;#39; parameters are written using camelCasing,&lt;/li&gt;
&lt;li&gt;local variables are written using camelCasing,&lt;/li&gt;
&lt;li&gt;namespaces are written using PascalCasing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;Extended Objects&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Only two native JavaScript objects are extended: String and Array.&lt;/p&gt;
&lt;p&gt;The methods added to the String object:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Trim&lt;/li&gt;
&lt;li&gt;IsLongerThan&lt;/li&gt;
&lt;li&gt;CutTextAt&lt;/li&gt;
&lt;li&gt;CalculateWords&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The methods added to the Array object:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ForEach&lt;/li&gt;
&lt;li&gt;Filter&lt;/li&gt;
&lt;li&gt;Every&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;strong&gt;Browser Compatibility&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;JUNE has been tested(on a Windows platform) in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Internet Explorer 6, 7, 8&lt;/li&gt;
&lt;li&gt;Mozilla Firefox 2+, 3+&lt;/li&gt;
&lt;li&gt;Opera 9+&lt;/li&gt;
&lt;li&gt;Safari 2+, 3+&lt;/li&gt;
&lt;li&gt;Maxthon 1+, 2+&lt;/li&gt;
&lt;li&gt;Flock 1+&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Structure&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;june.js: is the library&amp;#39;s main file;&lt;/li&gt;
&lt;li&gt;juneWeb.js: the methods contained in this file are wrapped in the JUNE.WEB namespace and they can be used for AJAX requests;&lt;/li&gt;
&lt;li&gt;juneWidget.js: this file contains a set of 8(at this moment) of the most used widgets on the web, wrappped in the JUNE.Widget namespace.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DOM element selections,&lt;/li&gt;
&lt;li&gt;AJAX,&lt;/li&gt;
&lt;li&gt;Widgets,&lt;/li&gt;
&lt;li&gt;Flexibility,&lt;/li&gt;
&lt;li&gt;Modularity.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Widgets&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Accordion&lt;/li&gt;
&lt;li&gt;TabControl&lt;/li&gt;
&lt;li&gt;TreeView(beta)&lt;/li&gt;
&lt;li&gt;PageClock&lt;/li&gt;
&lt;li&gt;BannerRotator&lt;/li&gt;
&lt;li&gt;RandomQuote&lt;/li&gt;
&lt;li&gt;ModalWindow&lt;/li&gt;
&lt;li&gt;FeedReader&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;JUNE is a modular framework. Because of that, functionality can be added on the fly by just including the desired script file:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;script src=&amp;quot;June_1_1.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src=&amp;quot;JuneWeb_1_1.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;...adds the AJAX functionality, while the:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;script src=&amp;quot;June_1_1.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src=&amp;quot;JuneWidget_1_1.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;...adds the Widget functionality.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Execute a method after the page has finished loading:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;head&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;script src=&amp;quot;June_1_1.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;alert(&amp;#39;The page has loaded.&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;/head&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;body&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;/body&amp;gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;JUNE is using the Object Literal notation and because of that, when used for in-line scripting, the code must be wrapped in an Object having an init function.&lt;/p&gt;
&lt;p&gt;The init function will be automatically executed after the page loads.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Events&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;JUNE offers 6 methods for Event handling.&lt;/p&gt;
&lt;p&gt;Adding an event handler to an element:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var targetElement = JUNE.DOM.getById(&amp;#39;LinkID&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.addEventListener(targetElement, &amp;#39;click&amp;#39;, MyScript.targetElement_OnClick);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;},&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;targetElement_OnClick : function(event) {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;alert(&amp;#39;You clicked me!&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;// Prevent navigation&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.preventDefault(event);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;DOM&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The JUNE.DOM namespace includes many methods to use for element selection/manipulation.&lt;/p&gt;
&lt;p&gt;Select all elements that have the class &amp;quot;red&amp;quot;:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var targetElements = JUNE.DOM.getElementsByClass(&amp;#39;red&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Toggle the css class of an element:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var targetElement = JUNE.DOM.getById(&amp;#39;ElementID&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.addEventListener(targetElement, &amp;#39;click&amp;#39;, function(event) {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.DOM.toggleCssClass(this, &amp;#39;red&amp;#39;, &amp;#39;green&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;});&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;Helper Functions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;the $ function is an alias of JUNE.DOM.getById method,&lt;/p&gt;
&lt;p&gt;the $F function is an alias of JUNE.Form.getForm method,&lt;/p&gt;
&lt;p&gt;the $byTags is a method which can be used to select DOM elements by their tag either from a specified parent element or from the document object. The returned result is an Array of all elements found.&lt;/p&gt;
&lt;p&gt;the $byClass is a method which can be used to select DOM elements by their class attribute by specifying an Array of classes.&lt;/p&gt;
&lt;p&gt;Select all paragraphs and span elements from a specified parent element:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var parentElement = JUNE.$(&amp;#39;Div1&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var paragraphs = JUNE.$byTags([&amp;#39;p&amp;#39;, &amp;#39;span&amp;#39;], parentElement);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Select all elements that either have &amp;quot;red&amp;quot;, &amp;quot;green&amp;quot; or &amp;quot;blue&amp;quot; as their class:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var elements = JUNE.$byClass([&amp;#39;red&amp;#39;, &amp;#39;green&amp;#39;, &amp;#39;blue&amp;#39;]);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;AJAX&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The JUNE.WEB namespace contains methods like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;customRequest - this method returns a cross-browser [[XMLHttpRequest]] object which can be used to create a custom AJAX function,&lt;/li&gt;
&lt;li&gt;getData,&lt;/li&gt;
&lt;li&gt;getHeaders,&lt;/li&gt;
&lt;li&gt;getJsonData,&lt;/li&gt;
&lt;li&gt;postData.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Create an AJAX request:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var container = JUNE.$(&amp;#39;Div1&amp;#39;),&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;fileUrl = &amp;#39;robots.txt&amp;#39;,&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;onCompleted = function(req) {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;return container.innerHTML = req.responseText;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;},&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;onFailure = function(req) {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;return container.innerHTML = &amp;quot;An error occurred while processing your request. Server error:&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;+ req.statusText;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;},&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;timeout = 5;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.WEB.getData(fileUrl, onCompleted, onFailure, timeout);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;Widgets&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Accordion, TabControl, TreeView and ModalWindow widgets are built from markup so their own html template must be used in order to include one of these widgets in a web page. This way they are unobtrusive and if a visitor doesn&amp;#39;t have the JavaScript enabled in his browser these widgets will be displayed fully expanded(all their content will become visible).&lt;/p&gt;
&lt;p&gt;Insert an Accordion widget in a page:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var MyScript = {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;init : function() {&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;var module = JUNE.$(&amp;#39;Accordion&amp;#39;);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.Widget.Accordion(module);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;};&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;JUNE.start(MyScript);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>