You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UserHighlighterSimple/modules/UserHighlighterSimple.js
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -133,13 +133,7 @@ export class UserHighlighterSimple {
133
133
134
134
url=this.addDomainIfMissing(url);
135
135
136
-
// mw.Uri(url) throws an error if it doesn't like the URL. An example of a URL it doesn't like is https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2022/Larger_suggestions#1%, which has a section link to a section titled 1% (one percent).
@@ -148,11 +142,11 @@ export class UserHighlighterSimple {
148
142
}
149
143
150
144
// Even if it is a link to a userpage, skip URLs that have any parameters except title=User, action=edit, and redlink=. We don't want links to diff pages, section editing pages, etc. to be highlighted.
@@ -174,6 +168,16 @@ export class UserHighlighterSimple {
174
168
returntrue;
175
169
}
176
170
171
+
getObjectWithUriParamsFromQueryString(url){
172
+
constparams={};
173
+
constqueryString=url.search;
174
+
consturlParams=newURLSearchParams(queryString);
175
+
for(const[key,value]ofurlParams.entries()){
176
+
params[key]=value;
177
+
}
178
+
returnparams;
179
+
}
180
+
177
181
hasHref(url){
178
182
returnBoolean(url);
179
183
}
@@ -189,7 +193,7 @@ export class UserHighlighterSimple {
189
193
}
190
194
191
195
/**
192
-
* mw.Uri(url) expects a complete URL. If we get something like /wiki/User:Test, convert it to https://en.wikipedia.org/wiki/User:Test. Without this, UserHighlighterSimple doesn't work on metawiki.
196
+
* URL( url) expects a complete URL. If we get something like /wiki/User:Test, convert it to https://en.wikipedia.org/wiki/User:Test. Without this, UserHighlighterSimple doesn't work on metawiki.
193
197
*
194
198
* @param {string} url
195
199
* @return {string} url
@@ -205,21 +209,19 @@ export class UserHighlighterSimple {
205
209
* Figure out the wikipedia article title of the link
206
210
*
207
211
* @param {string} url
208
-
* @param {mw.Uri} urlHelper
209
212
* @return {string}
210
213
*/
211
214
getTitle(url){
212
-
consturlHelper=newthis.mw.Uri(url);
213
-
214
215
// for links in the format /w/index.php?title=Blah
0 commit comments