Skip to content

Commit 908161f

Browse files
committed
Add hooks fired when finished processing compact language links
Bug: T145755 Change-Id: I921191c2cd32d55161b32bad2b2e0d98228cf230
1 parent 475c8a8 commit 908161f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

hooks.md

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ The hook names are prefixed with mw.uls as a convention.
55

66
# List of hooks
77

8+
## mw.uls.compactlinks.initialized
9+
10+
Fired when the rendering of compact language links and
11+
the corresponding button is completed.
12+
Sends a boolean true argument if the list was actually compacted
13+
and the trigger was rendered, and false otherwise.
14+
815
## mw.uls.font.change
916

1017
Fired when the user changes a webfont.

resources/js/ext.uls.compactlinks.js

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575

7676
if ( this.listSize <= max ) {
7777
// Not enough languages to compact the list
78+
mw.hook( 'mw.uls.compactlinks.initialized' ).fire( false );
79+
7880
return;
7981
}
8082

@@ -98,6 +100,8 @@
98100
}
99101

100102
this.addTrigger();
103+
104+
mw.hook( 'mw.uls.compactlinks.initialized' ).fire( true );
101105
};
102106

103107
/**

0 commit comments

Comments
 (0)