[Jifty-commit] jifty branch, js-refactor, updated. 034ea91d49db3a079f4d7791266e64141bd7c71b

Jifty commits jifty-commit at lists.jifty.org
Thu Jan 14 20:16:45 EST 2010


The branch, js-refactor has been updated
       via  034ea91d49db3a079f4d7791266e64141bd7c71b (commit)
       via  5a47db20ccff2ad4b279474b703785ad6424ed70 (commit)
       via  8ba7bc45b37f8705a190763542c245ca024461e0 (commit)
      from  bae815253fbc4c1483c142fc637a74d335bcb461 (commit)

Summary of changes:
 doc/js-refactor                                    |   14 +-
 lib/Jifty/View/Static/Handler.pm                   |    4 -
 lib/Jifty/Web.pm                                   |    5 -
 share/web/static/js/jifty_subs.js                  |    2 +-
 share/web/static/js/jsan/DOM/Events.js             |  262 -----------------
 share/web/static/js/jsan/JSAN.js                   |  303 --------------------
 share/web/static/js/jsan/Push.js                   |   76 -----
 share/web/static/js/jsan/Upgrade.js                |  121 --------
 share/web/static/js/jsan/Upgrade/Array/push.js     |   14 -
 share/web/static/js/jsan/Upgrade/Function/apply.js |   19 --
 share/web/static/js/key_bindings.js                |   16 +-
 share/web/static/js/setup_jsan.js                  |   13 -
 12 files changed, 20 insertions(+), 829 deletions(-)
 delete mode 100644 share/web/static/js/jsan/DOM/Events.js
 delete mode 100644 share/web/static/js/jsan/JSAN.js
 delete mode 100644 share/web/static/js/jsan/Push.js
 delete mode 100644 share/web/static/js/jsan/Upgrade.js
 delete mode 100644 share/web/static/js/jsan/Upgrade/Array/push.js
 delete mode 100644 share/web/static/js/jsan/Upgrade/Function/apply.js
 delete mode 100644 share/web/static/js/setup_jsan.js

- Log -----------------------------------------------------------------
commit 8ba7bc45b37f8705a190763542c245ca024461e0
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 14 19:28:35 2010 -0500

    Update js refactor docs

diff --git a/doc/js-refactor b/doc/js-refactor
index 956a74c..080e7b8 100644
--- a/doc/js-refactor
+++ b/doc/js-refactor
@@ -12,10 +12,14 @@ formatDate not used in the last 3 years
 === What's left?
 
 grep 'XXX TODO JS'
+
 use DatePicker from jQuery UI instead of YUI
     removes YUI calendar
     most (all?) of our calendar handler JS
 
+Jifty.Utils has a bunch of methods probably redundant with those in jQuery, but
+we need to check compat with what uses them
+
 update libraries
     jQuery
     iAutocompleter (and iUtil)

commit 5a47db20ccff2ad4b279474b703785ad6424ed70
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 14 19:41:37 2010 -0500

    Remove JSAN usage from key bindings JS

diff --git a/share/web/static/js/key_bindings.js b/share/web/static/js/key_bindings.js
index 0c62c53..7f5e199 100644
--- a/share/web/static/js/key_bindings.js
+++ b/share/web/static/js/key_bindings.js
@@ -1,27 +1,23 @@
-// Copyright 2004-2006, Best Practical Solutions, LLC
+// Copyright 2004-2010, 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 = {
     bindings: new Array(),
-    listener: null,
+    listener: false,
 
     activate: function() {
         if ( Jifty.KeyBindings.listener )
             return;
         
-        Jifty.KeyBindings.listener = DOM.Events.addListener(
-                                        document,
-                                        "keydown",
-                                        Jifty.KeyBindings.doClick
-                                     );
+        jQuery(document).keydown( Jifty.KeyBindings.doClick );
+        Jifty.KeyBindings.listener = true;
     },
 
     deactivate: function() {
-        DOM.Events.removeListener(Jifty.KeyBindings.listener);
+        jQuery(document).unbind( "keydown", Jifty.KeyBindings.doClick );
+        Jifty.KeyBindings.listener = false;
     },
 
     reset: function() {

commit 034ea91d49db3a079f4d7791266e64141bd7c71b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jan 14 20:15:52 2010 -0500

    Remove JSAN core and now-unused libs

diff --git a/doc/js-refactor b/doc/js-refactor
index 080e7b8..fd1e23e 100644
--- a/doc/js-refactor
+++ b/doc/js-refactor
@@ -4,11 +4,11 @@ bps_util.js
     buttonToLink, updateParentField, createCalendarLink, createDateTimeLink moved to Jifty.Utils
 
 removing JSAN usage wherever I can
+removing JSAN core and now-unused libraries
 
 formatDate not used in the last 3 years
 
 
-
 === What's left?
 
 grep 'XXX TODO JS'
@@ -27,3 +27,11 @@ update libraries
 jQuery 1.4
     http://jquery14.com/day-01/jquery-14#backwards
     we can replace css_browser_selector and our own browser stuff with jQuery.browser now
+
+
+=== Unused (but still useful??)
+
+DUBIOUS - rico.js - not even the full library, just corner rounding, and
+                    hacked ones at that
+
+UNCLEAR - jsTrace.js
diff --git a/lib/Jifty/View/Static/Handler.pm b/lib/Jifty/View/Static/Handler.pm
index 8023737..a590de1 100644
--- a/lib/Jifty/View/Static/Handler.pm
+++ b/lib/Jifty/View/Static/Handler.pm
@@ -184,10 +184,6 @@ sub mime_type {
 
     # The key is the file extension, the value is the MIME type to send.
     my %type_override = (
-        # MIME::Types returns application/javascript for .js, but Opera
-        # chokes on ajax-fetched JS that has a type other than the one below
-        # JSAN.js fetches JS via Ajax when it loads JSAN modules
-        'js'   => 'application/x-javascript',
         'json' => 'application/json; charset=UTF-8',
         'htc'  => 'text/x-component',
     );
diff --git a/lib/Jifty/Web.pm b/lib/Jifty/Web.pm
index 5c25a8d..bcbed54 100644
--- a/lib/Jifty/Web.pm
+++ b/lib/Jifty/Web.pm
@@ -32,11 +32,6 @@ __PACKAGE__->css_files([qw( main.css )]);
 __PACKAGE__->external_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
     jquery-1.2.6.js
     iutil.js
diff --git a/share/web/static/js/jifty_subs.js b/share/web/static/js/jifty_subs.js
index 1e06fce..ca92657 100644
--- a/share/web/static/js/jifty_subs.js
+++ b/share/web/static/js/jifty_subs.js
@@ -37,7 +37,7 @@ if (typeof Jifty == "undefined") Jifty = { };
 
     
     /* This function constructs a new Jifty.Subs object and sets
-    up a callback with HTTP.Push to run our onPushHandler each time
+    up a callback with jQuery.ajax to run our onPushHandler each time
     a new element is added to the hidden iframe's body.
 
     We could instead say "sets up our transport. every time the
diff --git a/share/web/static/js/jsan/DOM/Events.js b/share/web/static/js/jsan/DOM/Events.js
deleted file mode 100644
index a0324eb..0000000
--- a/share/web/static/js/jsan/DOM/Events.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
-
-=head1 NAME
-
-DOM.Events - Event registration abstraction layer
-
-=head1 SYNOPSIS
-
-  JSAN.use("DOM.Events");
-
-  function handleClick(e) {
-      e.currentTarget.style.backgroundColor = "#68b";
-  }
-
-  DOM.Events.addListener(window, "load", function () {
-      alert("The page is loaded.");
-  });
-
-  DOM.Events.addListener(window, "load", function () {
-      // this listener won't interfere with the first one
-      var divs = document.getElementsByTagName("div");
-      for(var i=0; i<divs.length; i++) {
-          DOM.Events.addListener(divs[i], "click", handleClick);
-      }
-  });
-
-=head1 DESCRIPTION
-
-This library lets you use a single interface to listen for and handle all DOM events
-to reduce browser-specific code branching.  It also helps in dealing with Internet
-Explorer's memory leak problem by automatically unsetting all event listeners when
-the page is unloaded (for IE only).
-
-=cut
-
-*/
-
-(function () {
-	if(typeof DOM == "undefined") DOM = {};
-	DOM.Events = {};
-	
-    DOM.Events.VERSION = "0.02";
-	DOM.Events.EXPORT = [];
-	DOM.Events.EXPORT_OK = ["addListener", "removeListener"];
-	DOM.Events.EXPORT_TAGS = {
-		":common": DOM.Events.EXPORT,
-		":all": [].concat(DOM.Events.EXPORT, DOM.Events.EXPORT_OK)
-	};
-	
-	// list of event listeners set by addListener
-	// offset 0 is null to prevent 0 from being used as a listener identifier
-	var listenerList = [null];
-	
-/**
-
-=head2 Functions
-
-All functions are kept inside the namespace C<DOM.Events> and aren't exported
-automatically.
-
-=head3 addListener( S<I<HTMLElement> element,> S<I<string> eventType,>
-S<I<Function> handler> S<[, I<boolean> makeCompatible = true] )>
-
-Registers an event listener/handler on an element.  The C<eventType> string should
-I<not> be prefixed with "on" (e.g. "mouseover" not "onmouseover"). If C<makeCompatible>
-is C<true> (the default), the handler is put inside a wrapper that lets you handle the
-events using parts of the DOM Level 2 Events model, even in Internet Explorer (and
-behave-alikes). Specifically:
-
-=over
-
-=item *
-
-The event object is passed as the first argument to the event handler, so you don't
-have to access it through C<window.event>.
-
-=item *
-
-The event object has the properties C<target>, C<currentTarget>, and C<relatedTarget>
-and the methods C<preventDefault()> and C<stopPropagation()> that behave as described
-in the DOM Level 2 Events specification (for the most part).
-
-=item *
-
-If possible, the event object for mouse events will have the properties C<pageX> and
-C<pageY> that contain the mouse's position relative to the document at the time the
-event occurred.
-
-=item *
-
-If you attempt to set a duplicate event handler on an element, the duplicate will
-still be added (this is different from the DOM2 Events model, where duplicates are
-discarded).
-
-=back
-
-If C<makeCompatible> is C<false>, the arguments are simply passed to the browser's
-native event registering facilities, which means you'll have to deal with event
-incompatibilities yourself. However, if you don't need to access the event information,
-doing it this way can be slightly faster and it gives you the option of unsetting the
-handler with a different syntax (see below).
-
-The return value is a positive integer identifier for the listener that can be used to
-unregister it later on in your script.
-
-=cut
-
-*/
-    
-	DOM.Events.addListener = function(elt, ev, func, makeCompatible) {
-		var usedFunc = func;
-        var id = listenerList.length;
-		if(makeCompatible == true || makeCompatible == undefined) {
-			usedFunc = makeCompatibilityWrapper(elt, ev, func);
-		}
-		if(elt.addEventListener) {
-			elt.addEventListener(ev, usedFunc, false);
-			listenerList[id] = [elt, ev, usedFunc];
-			return id;
-		}
-		else if(elt.attachEvent) {
-			elt.attachEvent("on" + ev, usedFunc);
-			listenerList[id] = [elt, ev, usedFunc];
-			return id;
-		}
-		else return false;
-	};
-	
-/**
-
-=head3 removeListener( S<I<integer> identifier> )
-
-Unregisters the event listener associated with the given identifier so that it will
-no longer be called when the event fires.
-
-  var listener = DOM.Events.addListener(myElement, "mousedown", myHandler);
-  // later on ...
-  DOM.Events.removeListener(listener);
-
-=head3 removeListener( S<I<HTMLElement> element,> S<I<string> eventType,> S<I<Function> handler )>
-
-This alternative syntax can be also be used to unset an event listener, but it can only
-be used if C<makeCompatible> was C<false> when it was set.
-
-=cut
-
-*/
-
-	DOM.Events.removeListener = function() {
-		var elt, ev, func;
-		if(arguments.length == 1 && listenerList[arguments[0]]) {
-			elt  = listenerList[arguments[0]][0];
-			ev   = listenerList[arguments[0]][1];
-			func = listenerList[arguments[0]][2];
-			delete listenerList[arguments[0]];
-		}
-		else if(arguments.length == 3) {
-			elt  = arguments[0];
-			ev   = arguments[1];
-			func = arguments[2];
-		}
-		else return;
-		
-		if(elt.removeEventListener) {
-			elt.removeEventListener(ev, func, false);
-		}
-		else if(elt.detachEvent) {
-			elt.detachEvent("on" + ev, func);
-		}
-	};
-	
-    var rval;
-    
-    function makeCompatibilityWrapper(elt, ev, func) {
-        return function (e) {
-            rval = true;
-            if(e == undefined && window.event != undefined)
-                e = window.event;
-            if(e.target == undefined && e.srcElement != undefined)
-                e.target = e.srcElement;
-            if(e.currentTarget == undefined)
-                e.currentTarget = elt;
-            if(e.relatedTarget == undefined) {
-                if(ev == "mouseover" && e.fromElement != undefined)
-                    e.relatedTarget = e.fromElement;
-                else if(ev == "mouseout" && e.toElement != undefined)
-                    e.relatedTarget = e.toElement;
-            }
-            if(e.pageX == undefined) {
-                if(document.body.scrollTop != undefined) {
-                    e.pageX = e.clientX + document.body.scrollLeft;
-                    e.pageY = e.clientY + document.body.scrollTop;
-                }
-                if(document.documentElement != undefined
-                && document.documentElement.scrollTop != undefined) {
-                    if(document.documentElement.scrollTop > 0
-                    || document.documentElement.scrollLeft > 0) {
-                        e.pageX = e.clientX + document.documentElement.scrollLeft;
-                        e.pageY = e.clientY + document.documentElement.scrollTop;
-                    }
-                }
-            }
-            if(e.stopPropagation == undefined)
-                e.stopPropagation = IEStopPropagation;
-            if(e.preventDefault == undefined)
-                e.preventDefault = IEPreventDefault;
-            if(e.cancelable == undefined) e.cancelable = true;
-            func(e);
-            return rval;
-        };
-    }
-    
-    function IEStopPropagation() {
-        if(window.event) window.event.cancelBubble = true;
-    }
-    
-    function IEPreventDefault() {
-        rval = false;
-    }
-
-	function cleanUpIE () {
-		for(var i=0; i<listenerList.length; i++) {
-			var listener = listenerList[i];
-			if(listener) {
-				var elt = listener[0];
-                var ev = listener[1];
-                var func = listener[2];
-				elt.detachEvent("on" + ev, func);
-			}
-		}
-        listenerList = null;
-	}
-
-	if(!window.addEventListener && window.attachEvent) {
-		window.attachEvent("onunload", cleanUpIE);
-	}
-
-})();
-
-/**
-
-=head1 SEE ALSO
-
-DOM Level 2 Events Specification,
-L<http://www.w3.org/TR/DOM-Level-2-Events/>
-
-Understanding and Solving Internet Explorer Leak Patterns,
-L<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp>
-
-=head1 AUTHOR
-
-Justin Constantino, <F<goflyapig at gmail.com>>.
-
-=head1 COPYRIGHT
-
-  Copyright (c) 2005 Justin Constantino.  All rights reserved.
-  This module is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public Licence.
-
-=cut
-
-*/
\ No newline at end of file
diff --git a/share/web/static/js/jsan/JSAN.js b/share/web/static/js/jsan/JSAN.js
deleted file mode 100644
index 4b6c0bd..0000000
--- a/share/web/static/js/jsan/JSAN.js
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * This is not a stock JSAN.js.  To increase browser compatibility,
- * s/'/"/g has been applied to the file and the range of valid response
- * codes for JSAN.Request has been expanded (lifted from Prototype, in
- * fact).
- */
-
-/*
-
-*/
-
-var JSAN = function () { JSAN.addRepository(arguments) };
-
-JSAN.VERSION = "0.10-jifty2";
-
-/*
-
-*/
-
-JSAN.globalScope   = self;
-JSAN.includePath   = [".", "lib"];
-JSAN.errorLevel    = "none";
-JSAN.errorMessage  = "";
-JSAN.loaded        = {};
-
-/*
-
-*/
-
-JSAN.use = function () {
-    var classdef = JSAN.require(arguments[0]);
-    if (!classdef) return null;
-
-    var importList = JSAN._parseUseArgs.apply(JSAN, arguments).importList;
-    JSAN.exporter(classdef, importList);
-
-    return classdef;
-}
-
-/*
-
-*/
-
-JSAN.require = function (pkg) {
-    var path = JSAN._convertPackageToPath(pkg);
-    if (JSAN.loaded[path]) {
-        return JSAN.loaded[path];
-    }
-
-    try {
-        var classdef = eval(pkg);
-        if (typeof classdef != "undefined") return classdef;
-    } catch (e) { /* nice try, eh? */ }
-
-
-    for (var i = 0; i < JSAN.includePath.length; i++) {
-        var js;
-        try{
-            var url = JSAN._convertPathToUrl(path, JSAN.includePath[i]);
-                js  = JSAN._loadJSFromUrl(url);
-        } catch (e) {
-            if (i == JSAN.includePath.length - 1) throw e;
-        }
-        if (js != null) {
-            var classdef = JSAN._createScript(js, pkg);
-            JSAN.loaded[path] = classdef;
-            return classdef;
-        }
-    }
-    return false;
-
-}
-
-/*
-
-*/
-
-JSAN.exporter = function () {
-    JSAN._exportItems.apply(JSAN, arguments);
-}
-
-/*
-
-*/
-
-JSAN.addRepository = function () {
-    var temp = JSAN._flatten( arguments );
-    // Need to go in reverse to do something as simple as unshift( @foo, @_ );
-    for ( var i = temp.length - 1; i >= 0; i-- )
-        JSAN.includePath.unshift(temp[i]);
-    return JSAN;
-}
-
-JSAN._flatten = function( list1 ) {
-    var list2 = new Array();
-    for ( var i = 0; i < list1.length; i++ ) {
-        if ( typeof list1[i] == "object" ) {
-            list2 = JSAN._flatten( list1[i], list2 );
-        }
-        else {
-            list2.push( list1[i] );
-        }
-    }
-    return list2;
-};
-
-JSAN._findMyPath = function () {
-    if (document) {
-        var scripts = document.getElementsByTagName("script");
-        for ( var i = 0; i < scripts.length; i++ ) {
-            var src = scripts[i].getAttribute("src");
-            if (src) {
-                var inc = src.match(/^(.*?)\/?JSAN.js/);
-                if (inc && inc[1]) {
-                    var repo = inc[1];
-                    for (var j = 0; j < JSAN.includePath.length; j++) {
-                        if (JSAN.includePath[j] == repo) {
-                            return;
-                        }
-                    }
-                    JSAN.addRepository(repo);
-                }
-            }
-        }
-    }
-}
-JSAN._findMyPath();
-
-JSAN._convertPathToUrl = function (path, repository) {
-    return repository.concat("/" + path);
-};
-    
-
-JSAN._convertPackageToPath = function (pkg) {
-    var path = pkg.replace(/\./g, "/");
-        path = path.concat(".js");
-    return path;
-}
-
-JSAN._parseUseArgs = function () {
-    var pkg        = arguments[0];
-    var importList = [];
-
-    for (var i = 1; i < arguments.length; i++)
-        importList.push(arguments[i]);
-
-    return {
-        pkg:        pkg,
-        importList: importList
-    }
-}
-
-JSAN._loadJSFromUrl = function (url) {
-    return new JSAN.Request().getText(url);
-}
-
-JSAN._findExportInList = function (list, request) {
-    if (list == null) return false;
-    for (var i = 0; i < list.length; i++)
-        if (list[i] == request)
-            return true;
-    return false;
-}
-
-JSAN._findExportInTag = function (tags, request) {
-    if (tags == null) return [];
-    for (var i in tags)
-        if (i == request)
-            return tags[i];
-    return [];
-}
-
-JSAN._exportItems = function (classdef, importList) {
-    var exportList  = new Array();
-    var EXPORT      = classdef.EXPORT;
-    var EXPORT_OK   = classdef.EXPORT_OK;
-    var EXPORT_TAGS = classdef.EXPORT_TAGS;
-    
-    if (importList.length > 0) {
-       importList = JSAN._flatten( importList );
-
-       for (var i = 0; i < importList.length; i++) {
-            var request = importList[i];
-            if (   JSAN._findExportInList(EXPORT,    request)
-                || JSAN._findExportInList(EXPORT_OK, request)) {
-                exportList.push(request);
-                continue;
-            }
-            var list = JSAN._findExportInTag(EXPORT_TAGS, request);
-            for (var i = 0; i < list.length; i++) {
-                exportList.push(list[i]);
-            }
-        }
-    } else {
-        exportList = EXPORT;
-    }
-    JSAN._exportList(classdef, exportList);
-}
-
-JSAN._exportList = function (classdef, exportList) {
-    if (typeof(exportList) != "object") return null;
-    for (var i = 0; i < exportList.length; i++) {
-        var name = exportList[i];
-
-        if (JSAN.globalScope[name] == null)
-            JSAN.globalScope[name] = classdef[name];
-    }
-}
-
-JSAN._makeNamespace = function(js, pkg) {
-    var spaces = pkg.split(".");
-    var parent = JSAN.globalScope;
-    eval(js);
-    var classdef = eval(pkg);
-    for (var i = 0; i < spaces.length; i++) {
-        var name = spaces[i];
-        if (i == spaces.length - 1) {
-            if (typeof parent[name] == "undefined") {
-                parent[name] = classdef;
-                if ( typeof classdef["prototype"] != "undefined" ) {
-                    parent[name].prototype = classdef.prototype;
-                }
-            }
-        } else {
-            if (parent[name] == undefined) {
-                parent[name] = {};
-            }
-        }
-
-        parent = parent[name];
-    }
-    return classdef;
-}
-
-JSAN._handleError = function (msg, level) {
-    if (!level) level = JSAN.errorLevel;
-    JSAN.errorMessage = msg;
-
-    switch (level) {
-        case "none":
-            break;
-        case "warn":
-            alert(msg);
-            break;
-        case "die":
-        default:
-            throw new Error(msg);
-            break;
-    }
-}
-
-JSAN._createScript = function (js, pkg) {
-    try {
-        return JSAN._makeNamespace(js, pkg);
-    } catch (e) {
-        JSAN._handleError("Could not create namespace[" + pkg + "]: " + e);
-    }
-    return null;
-}
-
-
-JSAN.prototype = {
-    use: function () { JSAN.use.apply(JSAN, arguments) }
-};
-
-
-// Low-Level HTTP Request
-JSAN.Request = function (jsan) {
-    if (JSAN.globalScope.XMLHttpRequest) {
-        this._req = new XMLHttpRequest();
-    } else {
-        this._req = new ActiveXObject("Microsoft.XMLHTTP");
-    }
-}
-
-JSAN.Request.prototype = {
-    _req:  null,
-    
-    getText: function (url) {
-        this._req.open("GET", url, false);
-        try {
-            this._req.send(null);
-            if ( this.responseIsSuccess() )
-                return this._req.responseText;
-        } catch (e) {
-            JSAN._handleError("File not found: " + url);
-            return null;
-        };
-
-        JSAN._handleError("File not found: " + url);
-        return null;
-    },
-
-    responseIsSuccess: function() {
-        return this._req.status == undefined
-            || this._req.status == 0
-            || (this._req.status >= 200 && this._req.status < 300);
-    }
-};
-
-/*
-
-*/
diff --git a/share/web/static/js/jsan/Push.js b/share/web/static/js/jsan/Push.js
deleted file mode 100644
index 6bfdc59..0000000
--- a/share/web/static/js/jsan/Push.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-
-*/
-
-if (typeof(HTTP) == "undefined") { HTTP = {}; }
-
-HTTP.Push = {};
-HTTP.Push.VERSION = '0.04';
-
-/*
-
-*/
-
-HTTP.Push = function(args) {
-  if (args == undefined) { throw "Push must be passed an argument hash!"; }
-  if (args.uri == undefined) { throw "Must specify push URI!"; }
-  if (args.onPush == undefined) { throw "Must specify onPush handler!"; }
-  if (args.interval == undefined) { args.interval = 100; }
-
-
-  var body = document.getElementsByTagName("body")[0];
-  var iframe = document.createElement("iframe");
-  iframe.style.border = "0px";
-  iframe.style.height = "0px";
-  iframe.style.width = "0px";
-  iframe.src = args.uri;
-
-  var interval = undefined;
-
-/*
-
-*/
-
-  this.start = function() {
-    body.appendChild(iframe);
-    interval = setInterval(function() { flushIframe(); }, args.interval);
-  }
-
-
-// TODO: make the stop function work in IE
-//   this.stop = function() {
-//     body.removeChild(iframe);
-//     clearInterval(interval);
-//   }
-
-
-  function flushIframe() {
-    var doc;
-    if (iframe.contentDocument) {          // For NS6
-      doc = iframe.contentDocument;
-    } else if (iframe.contentWindow) {     // For IE5.5 and IE6
-      doc = iframe.contentWindow.document;
-    } else if (iframe.document) {          // For IE5
-      doc = iframe.document;
-    } else {
-      return;
-    }
-  
-    var body = doc.body;
-  
-    while (body && body.hasChildNodes()) {
-      var node = body.firstChild;
-      try {
-         args.onPush(node);
-      }
-      catch (e) { };
-      body.removeChild(node);
-    }
-  }
-
-  return this;
-}
-
-/*
-
-*/
diff --git a/share/web/static/js/jsan/Upgrade.js b/share/web/static/js/jsan/Upgrade.js
deleted file mode 100644
index 7474555..0000000
--- a/share/web/static/js/jsan/Upgrade.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Keep package scanners happy
-Upgrade.VERSION = 0.04;
-*/
-
-/*
-
-=head1 NAME
-
-Upgrade - Upgrade older JavaScript implementations to support newer features
-
-=head1 SYNOPSIS
-
-  // Upgrade Array.push if the client does not have it
-  JSAN.use("Upgrade.Array.push");
-
-=head1 DESCRIPTION
-
-Many many different JavaScript toolkits start with something like the following:
-
-  // Provides Array.push for implementations that don't have it
-  if ( ! Array.prototype.push ) {
-      Array.prototype.push = function () {
-          var l = this.length;
-          for ( var i = 0; i < arguments.length; i++ ) {
-              this[l+i] = arguments[i];
-          }
-          return this.length;
-      }
-  }
-
-These provide implementations of expected or required functions/classes
-for older JavaScript implementations that do not provide them natively,
-in effect "upgrading" the client at run-time.
-
-In fact, due to its flexibility JavaScript is a language ideally suited
-to this sort of behaviour.
-
-C<Upgrade> is a JSAN package that provides standard implementations for
-many of these standard functions. If your code relies on a particular
-function that you later find to be not as common as you might have
-initially thought, you can simply add a dependency on that function within
-the C<Upgrade> namespace, and if an implementation exists the standard code
-to implement it will be added it the current environment (when it doesn't
-already have it).
-
-Rather than one huge file that provides a "compatibility layer" and upgrades
-verything all at once, C<Upgrade> is broken down into a large number of
-maller .js files, each implementing one function or class.
-
-Generally these functions are ones defined in the ECMA standard, and those
-that aren't, such as C<HTMLHttpRequest> are not provided by Upgrade (as much
-as we would like to) :)
-
-=head1 USING UPGRADE
-
-The C<Upgrade> namespace acts as a parallel root to the global namespace.
-For any function you want to upgrade, you can then simply prepend
-C<"Upgrade"> to it.
-
-For example, to do the very common upgrade for the C<Array.push> function,
-you simply add C<JSAN.use("Upgrade.Array.push") to your module (or manually
-load the C<Upgrade/Array/push.js> file).
-
-One advantage of using these standard implementations rather than your own
-is that when a number of modules with C<Upgrade> depedencies are merged
-together by C<JSAN::Concat> or another package merger it results in only
-a single copy of the upgrading code at the appropriate place in the code.
-
-=head1 UPGRADABLE FUNCTIONS
-
-While implementations are provided seperately, rather than document them
-this way we will instead defined all functions available in the C<Upgrade>
-package here.
-
-=head2 Upgrade.Array.push
-
-This provides the same standard implementation of the instance method
-C<Array.push> (located at Array.prototype.push) as used by all of the
-major frameworks.
-
-=head2 Upgrade.Function.apply
-
-This provides a version of the instance method C<Function.apply>
-(located at C<Function.prototype.apply>) adapted from an implementation
-found in the L<Prototype> framework, which was itself adapted from an
-implementation found on L<http://www.youngpup.net/>.
-
-=head1 METHODS
-
-The C<Upgrade> module itself does not at this time provide any
-functionality, and only acts as a source of documentation.
-
-Likewise, nothing is ever actually created at or beneath the C<Upgrade>
-namespace, but serves as an address mechanism for determining which
-.js files to load. Each of these files only inserts functions into the
-core tree and do not create any additional useless namespace variables.
-
-=head1 SUPPORT
-
-Until the JSAN RT gains package-specific queues, bugs or new functions
-to add to Upgrade should be reported to the jsan-authors mailing list.
-
-For B<non-support> issues or questions, contact the author.
-
-=head1 AUTHOR
-
-Adam Kennedy <jsan at ali.as>, L<http://ali.as/>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2005 Adam Kennedy. All rights reserved.
-This program is free software; you can redistribute it and/or modify
-it under the the terms of the Perl dual GPL/Artistic license.
-
-The full text of the license can be found in the
-LICENSE file included with this package
-
-=cut
-
-*/
diff --git a/share/web/static/js/jsan/Upgrade/Array/push.js b/share/web/static/js/jsan/Upgrade/Array/push.js
deleted file mode 100644
index bd93c6f..0000000
--- a/share/web/static/js/jsan/Upgrade/Array/push.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-Upgrade.Array.push.VERSION = 0.04;
-*/
-
-// Provides Array.push for implementations that don't have it
-if ( ! Array.prototype.push ) {
-	Array.prototype.push = function () {
-		var l = this.length;
-		for ( var i = 0; i < arguments.length; i++ ) {
-			this[l+i] = arguments[i];
-		}
-		return this.length;
-	}
-}
diff --git a/share/web/static/js/jsan/Upgrade/Function/apply.js b/share/web/static/js/jsan/Upgrade/Function/apply.js
deleted file mode 100644
index 8d41590..0000000
--- a/share/web/static/js/jsan/Upgrade/Function/apply.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Upgrade.Function.Apply.VERSION = 0.04;
-*/
-// Adapted from a Prototype adaptation of code
-// originally from http://www.youngpup.net/
-if ( ! Function.prototype.apply ) {
-	Function.prototype.apply = function(o, p) {
-		var pstr = new Array();
-		if ( ! o ) o = window;
-		if ( ! p ) p = new Array();
-		for ( var i = 0; i < p.length; i++ ) {
-			pstr[i] = 'p[' + i + ']';
-		}
-    		o.__apply__ = this;
-		var rv = eval('o.__apply__(' + pstr[i].join(', ') + ')' );
-		o.__apply__ = null;
-		return rv;
-	}
-}
diff --git a/share/web/static/js/setup_jsan.js b/share/web/static/js/setup_jsan.js
deleted file mode 100644
index 08c0aa0..0000000
--- a/share/web/static/js/setup_jsan.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Setup JSAN for Jifty defaults */
-JSAN.includePath = [ "/static/js/jsan" ];
-JSAN.errorLevel  = "none";
-
-/*
- * Stub out JSAN.use to avoid Ajax loading of JSAN libs if they've
- * already been loaded by a <script> tag
- */
-JSAN._use = JSAN.use;
-JSAN.use  = function() {
-    if ( !arguments[0] ) JSAN._use(arguments);
-};
-

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list