[Jifty-commit] r3395 - in jifty/branches/js-refactor: . lib/Jifty lib/Jifty/Plugin lib/Jifty/Web/Form share/plugins/Jifty/Plugin/JSAN share/plugins/Jifty/Plugin/JSAN/web share/plugins/Jifty/Plugin/JSAN/web/static share/plugins/Jifty/Plugin/JSAN/web/static/js share/web/static/js share/web/static/js/jsan

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Jun 8 00:26:23 EDT 2007


Author: trs
Date: Fri Jun  8 00:26:15 2007
New Revision: 3395

Added:
   jifty/branches/js-refactor/lib/Jifty/Plugin/JSAN.pm
   jifty/branches/js-refactor/share/plugins/Jifty/Plugin/JSAN/
   jifty/branches/js-refactor/share/plugins/Jifty/Plugin/JSAN/web/
   jifty/branches/js-refactor/share/plugins/Jifty/Plugin/JSAN/web/static/
   jifty/branches/js-refactor/share/plugins/Jifty/Plugin/JSAN/web/static/js/
   jifty/branches/js-refactor/share/plugins/Jifty/Plugin/JSAN/web/static/js/jsan/
      - copied from r3375, /jifty/branches/js-refactor/share/web/static/js/jsan/
Removed:
   jifty/branches/js-refactor/share/web/static/js/jsan/
Modified:
   jifty/branches/js-refactor/   (props changed)
   jifty/branches/js-refactor/lib/Jifty/Config.pm
   jifty/branches/js-refactor/lib/Jifty/Web.pm
   jifty/branches/js-refactor/lib/Jifty/Web/Form/Field.pm
   jifty/branches/js-refactor/share/web/static/js/behaviour.js
   jifty/branches/js-refactor/share/web/static/js/bps_util.js
   jifty/branches/js-refactor/share/web/static/js/calendar.js
   jifty/branches/js-refactor/share/web/static/js/context_menu.js
   jifty/branches/js-refactor/share/web/static/js/jifty.js
   jifty/branches/js-refactor/share/web/static/js/key_bindings.js

Log:
 r21849 at zot:  tom | 2007-06-08 00:26:03 -0400
 Extract JSAN (DOM.Events -> YAHOO.util.Event)


Modified: jifty/branches/js-refactor/lib/Jifty/Config.pm
==============================================================================
--- jifty/branches/js-refactor/lib/Jifty/Config.pm	(original)
+++ jifty/branches/js-refactor/lib/Jifty/Config.pm	Fri Jun  8 00:26:15 2007
@@ -342,6 +342,7 @@
             # JS libs which are now turning into plugins
             { CSSBrowserSelectorJS  => {}, }
             { FormatDateJS          => {}, }
+            { JSAN                  => {}, }
         );
     }
 

Added: jifty/branches/js-refactor/lib/Jifty/Plugin/JSAN.pm
==============================================================================
--- (empty file)
+++ jifty/branches/js-refactor/lib/Jifty/Plugin/JSAN.pm	Fri Jun  8 00:26:15 2007
@@ -0,0 +1,28 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::JSAN;
+use base qw/Jifty::Plugin/;
+
+=head1 NAME
+
+Jifty::Plugin::JSAN
+
+=head1 DESCRIPTION
+
+This plugin provides the base of the JSAN JavaScript library.
+
+See L<http://openjsan.org> for more information.
+
+=cut
+
+sub init {
+    Jifty->web->add_javascript(qw(
+        jsan/JSAN.js
+        setup_jsan.js
+        jsan/Upgrade/Array/push.js
+        jsan/DOM/Events.js
+    ));
+}
+
+1;

Modified: jifty/branches/js-refactor/lib/Jifty/Web.pm
==============================================================================
--- jifty/branches/js-refactor/lib/Jifty/Web.pm	(original)
+++ jifty/branches/js-refactor/lib/Jifty/Web.pm	Fri Jun  8 00:26:15 2007
@@ -30,11 +30,6 @@
            cached_javascript cached_javascript_digest cached_javascript_time javascript_libs);
 
 __PACKAGE__->javascript_libs([qw(
-    jsan/JSAN.js
-    jsan/Push.js
-    setup_jsan.js
-    jsan/Upgrade/Array/push.js
-    jsan/DOM/Events.js
     json.js
     prototype.js
     cssquery/cssQuery.js
@@ -45,7 +40,6 @@
     scriptaculous/builder.js
     scriptaculous/effects.js
     scriptaculous/controls.js
-    formatDate.js
     jifty.js
     jifty_utils.js
     jifty_subs.js

Modified: jifty/branches/js-refactor/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/branches/js-refactor/lib/Jifty/Web/Form/Field.pm	(original)
+++ jifty/branches/js-refactor/lib/Jifty/Web/Form/Field.pm	Fri Jun  8 00:26:15 2007
@@ -635,7 +635,7 @@
     return undef;
     if($self->focus) {
         return qq{document.getElementById("@{[$self->element_id]}").focus()};
-        return qq{DOM.Events.addListener( window, "load", function(){document.getElementById("@{[$self->element_id]}").focus()})};
+        return qq{YAHOO.util.Event.addListener( window, "load", function(){document.getElementById("@{[$self->element_id]}").focus()})};
     }
 }
 

Modified: jifty/branches/js-refactor/share/web/static/js/behaviour.js
==============================================================================
--- jifty/branches/js-refactor/share/web/static/js/behaviour.js	(original)
+++ jifty/branches/js-refactor/share/web/static/js/behaviour.js	Fri Jun  8 00:26:15 2007
@@ -1,6 +1,5 @@
 /*
-   Modified to fix some bugs, use a different css query engine, and to
-   to use JSAN classes.
+   Modified to fix some bugs and use a different css query engine.
    
    Based on Behaviour v1.1 by Ben Nolan, June 2005, which was based
    largely on the work of Simon Willison.
@@ -27,9 +26,6 @@
 
 */   
 
-JSAN.use("DOM.Events");
-JSAN.use("Upgrade.Array.push");
-
 var Behaviour = {
     list: [],
     
@@ -56,4 +52,4 @@
     }
 }    
 
-DOM.Events.addListener( window, "load", function() { Behaviour.apply() } );
+YAHOO.util.Event.addListener( window, "load", function() { Behaviour.apply() } );

Modified: jifty/branches/js-refactor/share/web/static/js/bps_util.js
==============================================================================
--- jifty/branches/js-refactor/share/web/static/js/bps_util.js	(original)
+++ jifty/branches/js-refactor/share/web/static/js/bps_util.js	Fri Jun  8 00:26:15 2007
@@ -16,8 +16,6 @@
     return Jifty.Calendar.registerDateWidget( id );
 }
 
-JSAN.use("DOM.Events");
-
 function buttonToLink(e) {
     var link = document.createElement("a");
     link.setAttribute("href","#");
@@ -31,7 +29,7 @@
        and the form submitted normally (without any Ajax-ness)
     */
     if ( !onclick ) {
-        DOM.Events.addListener( link, "click", function(ev) {
+        YAHOO.util.Event.addListener( link, "click", function(ev) {
             var a = ev.target;
             var hidden = document.createElement("input");
             hidden.setAttribute("type", "hidden");

Modified: jifty/branches/js-refactor/share/web/static/js/calendar.js
==============================================================================
--- jifty/branches/js-refactor/share/web/static/js/calendar.js	(original)
+++ jifty/branches/js-refactor/share/web/static/js/calendar.js	Fri Jun  8 00:26:15 2007
@@ -1,5 +1,3 @@
-JSAN.use("DOM.Events");
-
 if ( typeof Jifty == "undefined" ) Jifty = { };
 
 Jifty.Calendar = {
@@ -8,8 +6,8 @@
         
         if ( !input ) return false;
 
-        DOM.Events.addListener( input, "focus", Jifty.Calendar.toggleCalendar );
-        DOM.Events.addListener( input, "blur", Jifty.Calendar.doBlur );
+        YAHOO.util.Event.addListener( input, "focus", Jifty.Calendar.toggleCalendar );
+        YAHOO.util.Event.addListener( input, "blur", Jifty.Calendar.doBlur );
         return true;
     },
 
@@ -136,5 +134,5 @@
     }
 };
 
-/*DOM.Events.addListener( window, "click", Jifty.Calendar.hideOpenCalendar );*/
+/*YAHOO.util.Event.addListener( window, "click", Jifty.Calendar.hideOpenCalendar );*/
 

Modified: jifty/branches/js-refactor/share/web/static/js/context_menu.js
==============================================================================
--- jifty/branches/js-refactor/share/web/static/js/context_menu.js	(original)
+++ jifty/branches/js-refactor/share/web/static/js/context_menu.js	Fri Jun  8 00:26:15 2007
@@ -1,5 +1,3 @@
-JSAN.use("DOM.Events");
-
 if (typeof Jifty == "undefined") Jifty = { };
 
 function prepExpandButton(e) {
@@ -107,6 +105,6 @@
     }
 };
 
-DOM.Events.addListener( document, "click", Jifty.ContextMenu.hideOpenMenu );
+YAHOO.util.Event.addListener( document, "click", Jifty.ContextMenu.hideOpenMenu );
 Behaviour.register( Jifty.ContextMenu.behaviourRules );
 

Modified: jifty/branches/js-refactor/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/js-refactor/share/web/static/js/jifty.js	(original)
+++ jifty/branches/js-refactor/share/web/static/js/jifty.js	Fri Jun  8 00:26:15 2007
@@ -427,14 +427,12 @@
              && !event.metaKey && !event.altKey && !event.ctrlKey )
         {
             if ( Form.Element.clickDefaultButton( event.target ) )
-                event.preventDefault();
+                YAHOO.util.Event.preventDefault( event );
         }
     }
 
 });
 
-JSAN.use("DOM.Events");
-
 
 // Form elements should focus if the CSS says so.
 Behaviour.register( { ".focus": function(e) {
@@ -449,7 +447,7 @@
 // Form elements should AJAX validate if the CSS says so
 Behaviour.register({
     'input.ajaxvalidation, textarea.ajaxvalidation, input.ajaxcanonicalization, textarea.ajaxcanonicalization': function(elt) {
-        DOM.Events.addListener(elt, "blur", function () {
+        YAHOO.util.Event.addListener(elt, "blur", function () {
                 Form.Element.validate(elt);
             });
     },
@@ -471,7 +469,7 @@
             && !Element.hasClassName( e, "ajaxautocompletes" ) )
         {
             /* Do not use keydown as the event, it will not work as expected in Safari */
-            DOM.Events.addListener( e, "keypress", Form.Element.handleEnter );
+            YAHOO.util.Event.addListener( e, "keypress", Form.Element.handleEnter );
             Element.addClassName( e, "jifty_enter_handler_attached" );
         }
     },

Modified: jifty/branches/js-refactor/share/web/static/js/key_bindings.js
==============================================================================
--- jifty/branches/js-refactor/share/web/static/js/key_bindings.js	(original)
+++ jifty/branches/js-refactor/share/web/static/js/key_bindings.js	Fri Jun  8 00:26:15 2007
@@ -1,8 +1,6 @@
 // Copyright 2004-2006, Best Practical Solutions, LLC
 // This Library is licensed to you under the same terms as Perl 5.x
 
-JSAN.use("DOM.Events");
-
 if ( typeof Jifty == "undefined" ) Jifty = {};
 
 Jifty.KeyBindings = {
@@ -13,7 +11,7 @@
         if ( Jifty.KeyBindings.listener )
             return;
         
-        Jifty.KeyBindings.listener = DOM.Events.addListener(
+        Jifty.KeyBindings.listener = YAHOO.util.Event.addListener(
                                         document,
                                         "keydown",
                                         Jifty.KeyBindings.doClick
@@ -21,7 +19,7 @@
     },
 
     deactivate: function() {
-        DOM.Events.removeListener(Jifty.KeyBindings.listener);
+        YAHOO.util.Event.removeListener(Jifty.KeyBindings.listener);
     },
 
     doClick: function(e) {
@@ -38,7 +36,7 @@
             var binding = Jifty.KeyBindings.get(code);
             
             if (binding) {
-                e.preventDefault();
+                YAHOO.util.Event.preventDefault( e );
                 
                 if (binding["action"] == "goto") {
                     document.location = (binding["data"]);


More information about the Jifty-commit mailing list