Page MenuHomePhabricator

Source code of user JS/CSS pages should be shown in preview as source code not wikitext.
Closed, ResolvedPublic

Description

Author: gangleri

Description:
Hallo!

If I click on "Preview" nothing shows up.

You may copy the content of this page and paste it at your own "monobook.js".

Please change "OS" and "Hardware" if you experience this behaviour at other
operating systems and / or hardware. Thanks in advance!

best regards reinhardt [[user:gangleri]]

The url relates to
Bug 1229: Balance diff display more evenly


Version: unspecified
Severity: minor
URL: http://yi.wiktionary.org/w/index.php?title=user:Spacebirdy/monobook.js&action=edit

Details

Reference
bz4801

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 9:03 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz4801.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Jan 30 2006, 9:39 PM

spacebirdy wrote:

Halló! I had the same problem.
W2K, Firefox 1.5

greetings Elisabeth Anderl

gangleri wrote:

*addendum* / *note*

"Show changes" fails. Please make the tests at commons:, meta, b:, n:, s:, q:,
wikt; w:.

Thanks in advance!

best regards reinhardt [[user:gangleri]]

gangleri wrote:

Hi Ilmari!

Could you please investigate what happens here / what happens with "Preview" and
"Show changes"?

Thanks in advance!

best regards reinhardt [[user:gangleri]]

robchur wrote:

As far as I can remember; it's not possible for users to preview other users'
custom CSS or JavaScript sub pages; this would be a feature, not a bug.

brion added a comment.May 16 2007, 8:07 PM

Removing bogus dependency

The preview button is still doing nothing when we edit our javascript pages and click in it.

The expected behaviour is to have the code rendered above the edit box, as in any other pages.

Additionally, it should be rendered with syntax highlight, as if there was a <source lang="javascript">...</source> tag around the script code.

The recent breakage of user JS preview on the MonoBook skin appears to be a regression caused by r53282: specifically, the function setupSkinUserJs() that's supposed to add the scripts to the page is never actually called. As for the Vector skin, it looks like the feature was never there to begin with. As for the other skins... I've no idea. The whole skin system is a total mess anyway. :(

Anyway, it actually still works on my local wiki's custom skin, which I forked from MonoBook back in February 2008. So most of the code is clearly still working, it's just the skin-specific parts that are broken.

Oh, and the "expected behaviour" suggested by Helder above is actually a feature request, or perhaps a request to _remove_ a feature. The intended behavior when previewing user JS/CSS files is to embed the script or stylesheet on the preview page, in effect previewing its effects rather than its source code (which can be seen in the edit box anyway). That said, it might indeed be a good idea to make it do both (or perhaps even to separate the functions, introducing a new submit button labeled something like "Test script" or "Test stylesheet").

I'd do it if I didn't have a headache already.

(In reply to comment #7)

Anyway, it actually still works on my local wiki's custom skin, which I forked
from MonoBook back in February 2008. So most of the code is clearly still
working, it's just the skin-specific parts that are broken.
Oh, and the "expected behaviour" suggested by Helder above is actually a
feature request, or perhaps a request to _remove_ a feature. The intended
behavior when previewing user JS/CSS files is to embed the script or stylesheet
on the preview page, in effect previewing its effects rather than its source
code (which can be seen in the edit box anyway). That said, it might indeed be
a good idea to make it do both (or perhaps even to separate the functions,
introducing a new submit button labeled something like "Test script" or "Test
stylesheet").
I'd do it if I didn't have a headache already.

Hello!

Well, I thought it was expected both things, because many of the Common.js files currently have

<source lang="JavaScript">

at the beginning, and this is used because some time ago the code was shown above the edit box. For example, at en.wp, the code is there since 7 May 2008:
http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=prev&oldid=210884538

So, if the code is to be shown above the edit box, the feature request would be just to have the automatic highlighting, without the need of using the <source> tag... (should I open a new bug for this?)

If the code shouldn't be above the edit box, then I think the preview button should be renamed when viewing css/js pages, as suggested by Ilmari Karonen...

Helder

demon added a comment.Sep 22 2009, 7:02 PM

Duping up, yes I know...but 20631 was marked fixed.

  • This bug has been marked as a duplicate of bug 20631 ***

This is not a duplicate of the bug 20631, because that is about the "preview of the effect" of the code, and I though this one was about the "rendering of the page"... (but I can be wrong)

It's a bit confusing, and I apologize for contributing to the confusion. I agree with Helder above: let's have this bug be about the display of the CS/JSS _source code_ on preview (which I think would be a good idea, with or without a separate "test" button).

Hey!

Does anybody knows why the preview of, for example, [[b:pt:MediaWiki:Common.js]] shows the source code above the edit box, but the same still doesn't happens with user js like [[b:pt:Special:MyPage/vector.js]]?

I think the behaviour should at least be consistent:

  • Shows the code in both cases; or
  • Doesn't shows the code in both cases.

In my opinion, the currently behaviour is confusing...

Helder

(In reply to comment #11)

It's a bit confusing, and I apologize for contributing to the confusion. I
agree with Helder above: let's have this bug be about the display of the CS/JSS
_source code_ on preview (which I think would be a good idea, with or without a
separate "test" button).

Indeed. Changing summary again and marking as fixed.

As of 1.17 previewing pages like MediaWiki:Common.js output in <pre> instead of render like Wikitext, so there's no need to start witih /* <pre> */ or /* <nowiki> */ anymore.

I can't find the exact revision this was implemented though.
It's live on the 1.17wmf1 wikis.(In reply to comment #12)

Does anybody knows why the preview of, for example,
[[b:pt:MediaWiki:Common.js]] shows the source code above the edit box, but the
same still doesn't happens with user js like [[b:pt:Special:MyPage/vector.js]]?

The behavour is consistent:

  • If you modify pages that are 'yours' they are executed and now shown
  • If you modify other pages (ie. when you're a sysop and edit other people's vector.js or when one alters MediaWiki:Common.js) the code is not executed but shown.

If you would like to see this behaviour different, please open a seperate bug.