fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-28 12:32 pm

[dw-free] Old JS libraries don't play nice with other libraries on the page

[commit: http://hg.dwscoalition.org/dw-free/rev/f28611519cb3]

http://bugs.dwscoalition.org/show_bug.cgi?id=3531

Use updated signatures for (what used to be) Object.extend, Object.override,
Object.init, Object.destroy.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Widget.pm
  • htdocs/js/directorysearch.js
  • htdocs/js/directorysearchconstraints.js
  • htdocs/js/directorysearchresults.js
  • htdocs/js/esnmanager.js
  • htdocs/js/lj_ippu.js
  • htdocs/js/ljprogressbar.js
  • htdocs/js/ljwidget.js
  • htdocs/js/ljwidget_ippu.js
  • htdocs/js/userpicselect.js
  • htdocs/js/widget_ippu/settingprod.js
--------------------------------------------------------------------------------
diff -r 4e3f8c8ccf16 -r f28611519cb3 cgi-bin/LJ/Widget.pm
--- a/cgi-bin/LJ/Widget.pm	Mon Feb 28 20:27:30 2011 +0800
+++ b/cgi-bin/LJ/Widget.pm	Mon Feb 28 20:31:11 2011 +0800
@@ -394,7 +394,7 @@ sub wrapped_js {
         <script>
             $widgetvar = new LJWidget("$widgetid", "$widgetclass", "$authtoken");
             $widget_js_obj
-            $widgetvar.extend({$js});
+            OBJ.extend($widgetvar, {$js});
             LiveJournal.register_hook("page_load", function () { $widgetvar.initWidget() });
         </script>
     };
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/directorysearch.js
--- a/htdocs/js/directorysearch.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/directorysearch.js	Mon Feb 28 20:31:11 2011 +0800
@@ -11,7 +11,8 @@ DirectorySearchView = new Class(View, {
     */
     init: function (viewElement, opts) {
         // create a view with the constraints
-        DirectorySearchView.superClass.init.apply(this, [{view: viewElement}]);
+        if( DirectorySearchView.superClass.init )
+            DirectorySearchView.superClass.init.apply(this, [{view: viewElement}]);
         var searchConstraints = document.createElement("div");
         this.searchConstraintsView = new DirectorySearchConstraintsView({view: searchConstraints});
 
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/directorysearchconstraints.js
--- a/htdocs/js/directorysearchconstraints.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/directorysearchconstraints.js	Mon Feb 28 20:31:11 2011 +0800
@@ -2,7 +2,8 @@ var DirectorySearchConstraintsView = new
 var DirectorySearchConstraintsView = new Class(View, {
 
   init: function (opts) {
-    DirectorySearchConstraintsView.superClass.init.apply(this, arguments);
+    if ( DirectorySearchConstraintsView.superClass.init )
+        DirectorySearchConstraintsView.superClass.init.apply(this, arguments);
     this.constraints = [];
     this.typeMenus = [];
 
@@ -258,10 +259,10 @@ var DirectorySearchConstraint = new Clas
     this.fields = {};
 
     // reset this prototype to the base class
-    this.override(DirectorySearchConstraint.prototype);
+    OBJ.override(this,DirectorySearchConstraint.prototype);
 
     // override this with the subclass prototype
-    this.override(DirectorySearchConstraintPrototypes[this.type]);
+    OBJ.override(this,DirectorySearchConstraintPrototypes[this.type]);
 
     this.extraFields.innerHTML = "";
 
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/directorysearchresults.js
--- a/htdocs/js/directorysearchresults.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/directorysearchresults.js	Mon Feb 28 20:31:11 2011 +0800
@@ -1,6 +1,7 @@ DirectorySearchResults = new Class(Objec
 DirectorySearchResults = new Class(Object, {
     init: function (results, opts) {
-        DirectorySearchResults.superClass.init.apply(this, []);
+        if ( DirectorySearchResults.superClass.init )
+            DirectorySearchResults.superClass.init.apply(this, []);
 
         if (! opts || ! opts.resultsView) {
             var ippu = new LJ_IPPU('Search Results');
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/esnmanager.js
--- a/htdocs/js/esnmanager.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/esnmanager.js	Mon Feb 28 20:31:11 2011 +0800
@@ -3,7 +3,8 @@
 
 ESNManager = new Class(Object, {
   init: function (etypeids) {
-    ESNManager.superClass.init.apply(this, arguments);
+    if ( ESNManager.superClass.init )
+        ESNManager.superClass.init.apply(this, arguments);
 
     if (!etypeids)
       etypeids = [];
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/lj_ippu.js
--- a/htdocs/js/lj_ippu.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/lj_ippu.js	Mon Feb 28 20:31:11 2011 +0800
@@ -3,7 +3,8 @@ LJ_IPPU = new Class ( IPPU, {
     if (!title)
       title = "";
 
-    LJ_IPPU.superClass.init.apply(this, []);
+    if ( LJ_IPPU.superClass.init )
+        LJ_IPPU.superClass.init.apply(this, []);
 
     this.uniqId = this.generateUniqId();
     this.cancelThisFunc = this.cancel.bind(this);
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/ljprogressbar.js
--- a/htdocs/js/ljprogressbar.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/ljprogressbar.js	Mon Feb 28 20:31:11 2011 +0800
@@ -1,6 +1,7 @@ LJProgressBar = new Class(ProgressBar, {
 LJProgressBar = new Class(ProgressBar, {
   init: function () {
-    LJProgressBar.superClass.init.apply(this, arguments);
+    if ( LJProgressBar.superClass.init )
+        LJProgressBar.superClass.init.apply(this, arguments);
 
     this.containerClassName = "lj_progresscontainer";
     this.indefiniteClassName = "lj_progressindefinite";
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/ljwidget.js
--- a/htdocs/js/ljwidget.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/ljwidget.js	Mon Feb 28 20:31:11 2011 +0800
@@ -71,7 +71,8 @@ LJWidget = new Class(Object, {
     ///////////////// PRIVATE METHODS ////////////////////
 
     init: function (id, widgetClass, authToken) {
-        LJWidget.superClass.init.apply(this, arguments);
+        if ( LJWidget.superClass.init )
+            LJWidget.superClass.init.apply(this, arguments);
         this.widgetId = id;
         this.widgetClass = widgetClass;
         this.authToken = authToken;
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/ljwidget_ippu.js
--- a/htdocs/js/ljwidget_ippu.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/ljwidget_ippu.js	Mon Feb 28 20:31:11 2011 +0800
@@ -46,7 +46,8 @@ LJWidgetIPPU = new Class(LJWidget, {
 
         // id, widgetClass, authToken
         var widgetArgs = [c.id, widgetClass, authToken]
-        LJWidgetIPPU.superClass.init.apply(this, widgetArgs);
+        if ( LJWidgetIPPU.superClass.init )
+            LJWidgetIPPU.superClass.init.apply(this, widgetArgs);
 
         if (!widgetClass)
             return null;
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/userpicselect.js
--- a/htdocs/js/userpicselect.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/userpicselect.js	Mon Feb 28 20:31:11 2011 +0800
@@ -1,6 +1,7 @@ UserpicSelect = new Class (LJ_IPPU, {
 UserpicSelect = new Class (LJ_IPPU, {
   init: function () {
-    UserpicSelect.superClass.init.apply(this, ["Choose Icon"]);
+    if ( UserpicSelect.superClass.init )
+        UserpicSelect.superClass.init.apply(this, ["Choose Icon"]);
 
     this.setDimensions("560px", "441px");
 
diff -r 4e3f8c8ccf16 -r f28611519cb3 htdocs/js/widget_ippu/settingprod.js
--- a/htdocs/js/widget_ippu/settingprod.js	Mon Feb 28 20:27:30 2011 +0800
+++ b/htdocs/js/widget_ippu/settingprod.js	Mon Feb 28 20:31:11 2011 +0800
@@ -6,7 +6,8 @@ LJWidgetIPPU_SettingProd = new Class(LJW
     this.setting = params.setting;
     this.field = params.field;
     opts.overlay = true;
-    LJWidgetIPPU_SettingProd.superClass.init.apply(this, arguments);
+    if ( LJWidgetIPPU_SettingProd.superClass.init )
+        LJWidgetIPPU_SettingProd.superClass.init.apply(this, arguments);
   },
 
   updatesettings: function (evt, form) {
--------------------------------------------------------------------------------