Last modified: 2010-05-15 15:48:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 9134 - sorttable.js fails to init for sortable table
sorttable.js fails to init for sortable table
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.9.x
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://codex.gallery2.org/Gallery2:Te...
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-28 19:56 UTC by Alan Harder
Modified: 2010-05-15 15:48 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Alan Harder 2007-02-28 19:56:35 UTC
I see a couple other bug reports/feature requests about sortable tables, so
clearly it works for some people.. however, on codex.gallery2.org we got errors
about undefined variables (at least with firefox2).  For some reason,
sorttable.js couldn't see any vars/funcs from outside when document.write was
used in wikibits.js to include sorttable.js.  I changed this to use DOM to
include the script and this was fixed.  Then sorttable.js uses hookEvent to
initialize.. but the file isn't included until another hook event is being
processed.. seems like this is too late to register a new hook event.  I changed
this to just call the init function.  Seems to work now.

Patch below (revision 941 is our own local svn, you can ignore that.. it's
mediawiki 1.9.3).

Index: skins/common/wikibits.js
===================================================================
--- skins/common/wikibits.js    (revision 941)
+++ skins/common/wikibits.js    (working copy)
@@ -853,7 +853,9 @@

 function sortableTables() {
        if (getElementsByClassName(document, "table", "sortable").length != 0) {
-               document.write('<script type="text/javascript"
src="'+stylepath+'/common/sorttable.js?1"></script>');
+// Use XHTML to include js.. with document.write sorttable.js doesn't see
vars/funcs from outside
+//             document.write('<script type="text/javascript"
src="'+stylepath+'/common/sorttable.js?1"></script>');
+var e = document.createElement('script');
e.src=stylepath+'/common/sorttable.js?1';
document.getElementsByTagName('body')[0].appendChild(e);
        }
 }

Index: skins/common/sorttable.js
===================================================================
--- skins/common/sorttable.js   (revision 941)
+++ skins/common/sorttable.js   (working copy)
@@ -19,7 +19,10 @@
 var alternate_row_colors = true;


-hookEvent( "load", sortables_init);
+//This js file is included from an onload handler, adding a handler now won't
get it invoked.
+//hookEvent( "load", sortables_init);
+//Just call the function:
+sortables_init();

 var SORT_COLUMN_INDEX;
 var thead = false;
Comment 1 Alan Harder 2007-02-28 20:47:06 UTC
Oops, just looked at current svn and see this is obsolete.. table sorting stuff
is now all in wikibits.js.  Closing.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links