Jump to content

User talk:Datumizer/Sandbox/wikibits 4

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

What does this do?

[edit]

I cannot see what difference this makes. I added

importScript('User:SharkD/Sandbox/wikibits 4');

to my monobook.js, pressed Ctrl-Shift-R to refresh and then I looked at this page:

User:SharkD/Sandbox/Sortable tables 2

Column Cents sorts as normal, but Ratio Factors, Ratio and Name(s) sort strangely. For example Ratio Factor appears to sort lexically while Ratio appears muddled. In column Name(s) Ragisma and Schisma are always out of order. The behaviour is the same when I switch to a Classic skin, and it is the same when I am not logged in and when I use Netscape (to simulate Firefox 2 behaviour).

What am I missing?

I am using Firefox 3.0.1 on Vista- -84user (talk) 10:35, 30 August 2008 (UTC)[reply]

First of all, I'm not sure if you can use the importScript function, since the code is surrounded by SOURCE tags which may interfere with the script working. Try copying and pasting the code manually into your monobook.js file. You can tell it's working if you see a javascript message pop up every time a page loads. You could also try importing my own monobook.js (link: User:SharkD/monobook.js), but I don't know if it will work.
Secondly, the Ratio columns in User:SharkD/Sandbox/Sortable tables 2 have always sorted in a weird way. It's too complicated to be worth fixing, IMO. I know that in User:Alex Smotrov/mw/sortable I said I added support for sorting fractions/ratios, but it only works in the simplest expressions (i.e. ones where there is only a single number for a numerator and a denominator, with no other operations). Also, it's disabled by default in the script, so you wouldn't be able to notice it anyway.
The main changes are:
  1. Columns can be sorted in reverse by default. I believe you can only see this in action on User:SharkD/Sandbox/Sortable tables 1. Notice how the last eight columns sort in descending order by default (i.e., the blank cells are sorted last).
  2. The ALT text for the clickable icons is more verbose. I wasn't able to notice this in Firefox, but was in IE (not sure why).
  3. The date sorting routine detects many more dates. Before, only three types of date formatting were detected. Now there are about two dozen. You can see this in the first column in both of the last two tables in User:SharkD/Sandbox/Sortable tables 2. Both should sort properly, instead of just one. It will also do away with the need for templates like {{dts}} in most cases.
  4. The cells should look different. The clickable icon was changed to be centered vertically and fixed to the right instead of being treated as an inline character. This means the icon will always remain in a fixed place and won't break onto new lines.
  5. The rest of the changes are minor and have no effect upon how the scripts functions (i.e., they're meant to speed up the scripts or decrease the file size).
Finally, the last proposal in User:Alex Smotrov/mw/sortable (the one about changing class names to attributes, and adding a few more of them) has not been implemented yet. I just put that up there for discussion. SharkD (talk) 10:59, 30 August 2008 (UTC)[reply]

Results

[edit]

Thank you for explaining the intended action SharkD. I managed to verify some of the behaviour as follows.

I copied all the code from User:SharkD/Sandbox/wikibits 4, minus the top comments and source tags and pasted it into my monobook.js, and refreshed the cache as usual.

I used three browsers on Windows Vista:

  • Netscape 9.0.0.6 for Windows
  • Firefox 3.0.1
  • Opera 9.52 build 10108

1. Columns can be sorted in reverse by default. => when not logged in the columns initially sort in ascending order when clicked; but when logged in, those columns that have class="sortreverse" indeed do sort in descending order the first time

2. ALT text => varied, logged out all browsers showed a down arrow glyph "↓", while logged in both Netscape and Opera has "Sort in descending order." Firefox 3.0.1 shows the down arrow glyph "↓" regardless.

3. The date sorting routine => logged out, all browsers sort dates alphabetically for that second (last) table, while logged in all browsers sort dates in date-order

4. The cells should look different. => Yes, for all browsers.

So, apart from Firefox 3.0.1's ALT text, the code does what is claimed.

I am unsure if this affects wikibits but all browsers report CSS errors with all wikipedia pages, whether I am logged in or not. For example, Opera reports

CSS - http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=2678400&action=raw&maxage=2678400&ts=20080830172148
Linked-in stylesheet
-moz-column-count is an unknown property
Line 51:
     -moz-column-count: 2;
CSS - http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=2678400&action=raw&maxage=2678400&ts=20080830172148
Linked-in stylesheet
-webkit-column-count is an unknown property
Line 52:
     -webkit-column-count: 2;

and then complains about undefined column-count and word-wrap. Netscape and Firefox give similar warnings. And in the Sortable tables page they all complain about the width property, for example Opera points to the end of the line in "float:right;text-align:right;width:*;" - I mention this in case it has any relevancy. -84user (talk) 17:46, 30 August 2008 (UTC)[reply]

Thanks for testing the code!
"Firefox 3.0.1 shows the down arrow glyph "↓" regardless." This shouldn't happen, as no instances of the glyph exist in the modified code (i.e., it shouldn't display something that doesn't exist).
I have no idea regarding those errors. I haven't modified "common.css" in any way. In fact, I didn't even know that browsers report CSS errors. Where/how can I view them?
Thanks again! SharkD (talk) 18:03, 31 August 2008 (UTC)[reply]

Forget my "Firefox 3.0.1 shows the down arrow glyph "↓" regardless." - it works now. Maybe I forgot to properly refresh when I changed from logged out to logged in, or I simply made a mistake.

As to the CSS problems they are due to wikipedia's generated code, nothing to do with you or me. To see the errors:

  • Firefox : click Tools / Error Console then refresh a web page
  • Netscape : same as Firefox
  • Opera : click Tools / Advanced / Error Console then refresh ...
  • Third-party site: CSS Validation Service

The reason I mention it is because I use the Error Console when testing scripts in order to catch syntax errors and so on. -84user (talk) 18:44, 31 August 2008 (UTC)[reply]

Allowing negative numbers and scientific notation

[edit]

Please fix what is currently perhaps the most serious limitation: a negative number is not recognized as number.

numbers
-7
-77
-8

In addition, please allow spaces, "+", "e" and "E".

numbers
1e3
12
300

See m:MediaWiki:Common.js (and its edit history for brief explanations, in particular [1] and [2]) and the corresponding description m:Help:Sorting.--Patrick (talk) 06:44, 1 September 2008 (UTC)[reply]

Thanks! Good catch. As a result, I made a proposal for it, here. SharkD (talk) 16:16, 1 September 2008 (UTC)[reply]
Thanks!--Patrick (talk) 00:08, 2 September 2008 (UTC)[reply]

I forgot to add the spaces. What exactly are they used for? SharkD (talk) 08:29, 3 September 2008 (UTC)[reply]

Sometimes a space is used as thousands separator: 300 000.--Patrick (talk) 23:31, 3 September 2008 (UTC)[reply]