No usecase has been provided, and additionally the hooks
are not documented. Bartosz also points out that
mw.hook calls are asynchronous and memorized.
This reverts commit 9d3561afaf.
Change-Id: If735b46996fab3def835a54223412ef6d3105395
Adds two new hooks to allow extensions to tie into the notification
loading process. Between these two hooks and the new isInitialized()
method any extension can run code whenever a notification is displayed.
Change-Id: If351835be5f65ca098e2d235ea8c8e4dc40ae2b4
General code cleanup as reported by the PHPStorm static code
analysis. I hope it's not a problem that I made a lot of very
different (but all very tiny) changes in a single patch. If you
want to merge this but you think it's better to split it into
several patches first, please tell me.
Change-Id: I2e2c4bb47f8d20e038d28e236e2ff813b30504af
Tested with latest Firefox and Chrome as well as Opera 12.
See bug 57327 for full description, please.
Bug: 57327
Change-Id: Ibf6e7d590754402f4cfafa3a3db55bb0c6aa525e
The badge is always close to the top of the window (if it's visible), so
this is not necessary. Also, this behavior is definitely not desired
for the upcoming fixed header beta feature (the badge will always be
visible as a part of the fixed header).
Change-Id: I66e8a50b1139f7bcd005cfb3c3576578efe6a653
Provide users a better user experience by catching and logging
errors with Echo notifications.
Bug: 60906
Change-Id: Iee93a05c6eed468af8bbfa60249df0819c49c45b
Changed the font size of notifications which was earlier too small
and also the accessibility was also too low
Bug: 60239
Change-Id: I20be3cd2277e865ee694070f119999b7b170547c
If the echo-overlay-title-overflow text is too long, it's wrapped into multiple lines now.
Bug: 55919
Change-Id: Ib1d252ab26be7d73cbf71c6fb19d84b80d8d30c8
Apparently three wrongs make a right: hiding the overlay still worked.
* '#pt-notifications a' click event handler was not correctly checking
for events comig from inside the overlay due to a missing dot before
class name
* But if it were correctly checking, it would not be hiding the
overlay pokey (just its body) due to a copy-paste error
* Instead the clicks were handled by the 'body' click event handler,
which did not correctly check for events coming from
'#pt-notifications a'
I made things right again. The user-facing behavior is the same.
Change-Id: I02aba0e25ba4d81b234b327f120e0e2ff13d117c
Otherwise a new copy will be created every time the user opens and closes
the popup, and jQuery will hold on to each one forever (because it has
events bound), leaking a minuscule amount of memory.
Change-Id: I70c713be839f826fc27d07b04260c166f9052020
Core styles for Monobook include high-specificity background: transparent;
rule for #p-personal li a, we need to match it to set our background.
Also change hover behavior: switch to a deeper orange instead of
default white, similarly to how the badge already behaves.
Partially reverts I682182fe.
Bug: 56214
Change-Id: I9f343264c395ecf09c1e34e03d208ec2119fb622
Follows-up 383a818.
* There is no need for the additional element ("a") or
descendant ("#pt-mytalk") selector.
It isn't overrriding anything, only hardcodes details that make
it harder to maintain or extend this stylesheet. For example,
there is a gadget that makes user messages green instead of
orange, it now was required to hardcode the "#pt-mytalk a" part
of the selector eventhough those are subject to change.
Separation of concerns.
* Cache/reuse the jQuery object instead of executing the same
query to the document, again. It also avoids a potential bug
where the second query matches different elements (e.g. after
appending alertMessage, there could potentially be an additional
nested anchor link; there isn't now though, as the message is
plain text).
* Add comment about weird echoNewMsgAlertDisplayed variable.
Change-Id: I682182fe15a868969f25fa5bfe2412e2a6f3dddf
* In some languages like persian, the number 0 is represented as '.', we can't compare
'.' with either 0 or '0' to detect the no-notification status of the badge
* The markread API doesn't respect uselang param, it would return 0 instead of . in a url with uselang=fa
Note: we need to provide raw and formatted count in the API since client side javascript
doesn't provide fancy function like $wgLang->formatNum()
bug: 54575
Change-Id: I0a49828253ec346ed27c5b9a976f8bdff4e1fa90
Removing unused functions and declaring correct dependencies.
Targetting to desktop and mobile so it can be used by both.
Also removing dismiss-related code from the formatter.
Change-Id: Icccce64cfb3c564ab468a93ccdba9c5a61687fd5
Also making sure that footer has some amount of separation from
the notification title even if there is no payload.
Change-Id: I85a1a7989539044a0b0b53e76e70ddee9bb7165c
The space after colon on this line is actually a non-breaking space
( ), which is not allowed in this place according to CSS syntax.
Therefore all browsers ignored this rule (logging an error like
"Invalid CSS property value") and the shadow was never shown.
We could fix the rule instead, but I'm pretty sure users are used to
this by now, and in my opinion it looks better without shadow.
Bug: 53490
Change-Id: I1fd508d2059bec5cd79a6dcdce8dc9be6e6d4229
We want the notifications in the flyout to behave just like links,
including standard middle-click and Ctrl-click behavior. The simplest
way to do that would be to actually make them links - but the area can
contain a few other links, so we can't do that and have to resort to
ugly hacks.
Or do we?
Turns out that while browsers won't accept HTML containing nested <a>
tags[1], such a structure is valid XHTML, and it's possible to create
such structure in HTML mode using DOM manipulation. It works like one
would expect: the entire thing is clickable, but inner <a> tags' hrefs
override outer ones.
Firefox even had a request to make that work[2] which was happily
fulfilled.
Tested the basic case [see below] on Firefox 22, Opera 12, Opera 15
(which uses the Blink engine like Chrome), IE 8 and IE 6 and it works
the same on all of them. Tested the XHTML variant [see below] on all
of the above except for the IEs which don't grok XHTML and it exhibits
the same behavior.
[1] Simple test: $('<div>1<a>2<a>3</a>4</a>5</div>').html() is
"1<a>2</a><a>3</a>45", not actually "1<a>2<a>3</a>4</a>5" like one
might expect.
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=331959
----
The test cases used are below. When trying out the XHTML one make sure
that the browser uses application/xhtml+xml MIME type; saving the file
with .xhtml extension should be enough.
XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div>1<a href="http://google.com/">2<a href="http://example.com/">3</a>4</a>5</div>
</body>
</html>
HTML:
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var div = document.createElement('div');
var a1 = document.createElement('a');
a1.href = "http://google.com/";
var a2 = document.createElement('a');
a2.href = "http://example.com/";
div.appendChild( document.createTextNode('1') );
div.appendChild( a1 );
a1.appendChild( document.createTextNode('2') );
a1.appendChild( a2 );
a2.appendChild( document.createTextNode('3') );
a1.appendChild( document.createTextNode('4') );
div.appendChild( document.createTextNode('5') );
document.body.appendChild(div);
</script>
</body>
</html>
----
Bug: 52319
Change-Id: I311eca70f025ce92129c828cd88f96686b7cff72
Out of the default MW skins these only seem to affect CologneBlue.
* Reset padding and list-style-image on ul#mw-echo-special-container
ourselves, do not rely on the skin doing it
* Use transparent background on .mw-echo-notification (and
semi-transparent black on hover) instead of solid white and
light grey to accomodate colored skin backgrounds
Change-Id: I2c178627e4dbe889c4958afc41e4969aaa45a717
wgUserNewMsgRevisionId is null with only one revision and that revision is
not viewed, this makes it not reliable for determining if there is new
message. We just switch to check against $user->getNewtalk() instead.
We can still use wgUserNewMsgRevisionId to generate diff links if desired
Change-Id: I4cf50a944aada03151bd17f3610bd59b3bfb2bf2
separate into multiple ul elements with headings dividing them
This removes need for unnecessary styling rules in mobile web
Change-Id: I8acaef726ea0cc639054cf36d6c3649c7ab25bee
* Add missing spaces after 'function'
* Remove underscores from identifiers
* Don't use typeof for undefined with local variables and object properties
* API ok/err is deprecated since MediaWiki 1.20 (< 1.22-alpha), use .done and .fail
Change-Id: I5ca3403ee263a0c3e6709618e48e896340952337
When I changed mw.echo.special.initialize to be called as a
callback from $( document ).ready(), rather than being called
explicitly from the closure, it changed the context, which got
assigned to _this. This broke some of the function calls.
Change-Id: I602a58a82ee91646901d0ab1c8b7bb4b22b3437a
If link underlining is on, then the number in the badge
will be underlined. This is probably never needed, even
if the user wants to underline regular links.
Set text-decoration to none in all cases.
Change-Id: Ifaca38a8f0a6a3c8df39502a3da582f639ec6333
This provides some rudimentary styling support to make Echo usable
with the Modern skin.
It also fixes the Notifications special page so it is styled
correctly in Modern, CologneBlue, or with Javascript turned off.
Also some more tweaks for Monobook skin.
Retiring the 'feedback' link from the special page, per PM.
Bug: 47932
Change-Id: I633a93a78f5a78d0642a3a059fa6f7208f99cec4
Brought up by Krinkle in Icebfe86b (PS4):
* 'ok' and 'err' properties of Api are deprecated, use promise interface
* Use 'api' instead of 'Api'
* $( '<a>' ) instead of $( '<a/>' )
* Expected space after 'function' keyword
Change-Id: I0199db902174551bcf9269edafb1fef1df118b13
With this change we will no longer be relying on JS for the badge
functionality. This will prevent the flash of unstyled content,
and allow wikis to locally override the styling (since the unread
class is now applied immediately).
I also went ahead and made the badge styling more closely match the
talk page message alert styling per Vibha.
Also removed the old full link optional behavior since we weren't
using it, and it would have been a pain to maintain.
Bug: 48165
Bug: 48001
Change-Id: Ie85d66afd5181d487d0bb2776ae14b121ea50d88
* Icon can be defined using a path or a URL
* Extensions don't need custom CSS, but add icon through BeforeCreateEchoEvent
* Sites set their notification icon in LocalSettings.php or equivalent
Bug: 46585
Change-Id: Ifc02b653d07de19229dfb2604305e32f3bd595fe
Making monobook's text-transform not apply to notification flyout.
Unfortunately, 2 overrides are needed since the monobook selector
is applied weakly to the overlay in general (as an inherited style)
and strongly to the notifications themselves (since they're in a ul)
Bug: 47652
Change-Id: I2600b5836ea7bca59d9089d8bb7e69a6aaeca6a4