Extension talk:Popups/2018

Latest comment: 5 years ago by Thiemo Kreuz (WMDE) in topic Issues when used with Extension:Tabber
edit

Hi,

Is there a way to get Popups to work with interwiki links?

One site is a specialized dictionary and the other is text based dokuments.

(I control both sites and interwiki links are working, but without Popups)

Thanks :) Pretor~nowiki (talk) 17:08, 15 January 2018 (UTC)Reply

Not currently, but that feature-request is tracked at phab:T67117. :-) Quiddity (WMF) (talk) 17:30, 15 January 2018 (UTC)Reply

How to avoid the popups to be shifted when there is a margin

edit

Wikis that use some CSS rules to set margins to the site layout (for example with this code) will experience a problem : the popups are shifted according to the margin, and then there the popups appears far from the link.

To solve this issue, you need to edit the file extensions/Popups/src/renderer.js

In line 18, add $body = $('body');

In line 490, change to link.offset().left) - ($window.width() - $body.width())/2;

Then you have to build the extension and the following files are changed : extensions/Popups/resources/dist/index.js and index.js.map Varlin (talk) 21:29, 15 February 2018 (UTC)Reply

In this context, what does it mean to “build the extension”? Theodore (talk) 07:13, 24 September 2019 (UTC)Reply
Is there an update for these code changes? 207.62.238.123 (talk) 20:25, 24 September 2019 (UTC)Reply
To compile the extension you need to run this command : npm run build Varlin (talk) 14:09, 1 October 2019 (UTC)Reply
Thanks. Do you know we would change the Popups code for MW 1.33.0? Theodore (talk) 23:12, 4 October 2019 (UTC)Reply
hmm, is there a way to fix this on the front end? I'm making a custom css theme for Wikipedia, so I don't think I can modify the javascript source code on the backend of Wikipedia. You can find the custom css here: github.com/Krasjet/wikipedia.rehash Krasjet (talk) 18:51, 7 October 2019 (UTC)Reply
I managed to solve the problem using a custom script. There is probably a more elegant solution but this one does the job.
let body = document.getElementsByTagName("body")[0];</code> let callback = function(mutList, _obs) { for (let mut of mutList) { let mutNode = mut.addedNodes; if (mutNode.length !== 0 && mutNode[0].classList.contains("mwe-popups")) { let eleLeft = mutNode[0].style.left; let marginLeft = window.getComputedStyle(body).getPropertyValue("margin-left"); mutNode[0].style.left = "calc("+ eleLeft + " - "+ marginLeft + ")"; } } }; let observer = new MutationObserver(callback); observer.observe(body, { childList: true }); Krasjet (talk) 20:52, 7 October 2019 (UTC)Reply
Sorry for the bad formatting, nowiki tags didn't work as I intended. Krasjet (talk) 20:54, 7 October 2019 (UTC)Reply
After messing around for a bit, this is what you need if you want to use the script above in a mediawiki userscript file:
$(document).ready(function () {</code> var body = document.getElementsByTagName("body")[0]; var callback = function(mutList, _obs) { var mut = mutList[0]; var mutNode = mut.addedNodes; if (mutNode.length !== 0 && mutNode[0].classList.contains("mwe-popups")) { var eleLeft = mutNode[0].style.left; var marginLeft = window.getComputedStyle(body).getPropertyValue("margin-left"); // subtract the left margin from the computed value mutNode[0].style.left = "calc("+ eleLeft + " - "+ marginLeft + ")"; } }; var observer = new MutationObserver(callback); observer.observe(body, { childList: true }); }); Krasjet (talk) 21:49, 7 October 2019 (UTC)Reply
With this code, I found that I had other offsets issues, so I used another way. Varlin (talk) 19:24, 16 October 2019 (UTC)Reply

I'm unable to to render the Popups

edit

Does anyone have a working example to know how to enable this popups? I 've already installed all the required extension that this extension uses 148.241.128.34 (talk) 03:20, 3 March 2018 (UTC)Reply

Hello,
If you've configured the extension well locally, then the popups are already there. What you should try doing is create a page say: Page1, put some content in it, then create another page say: Page2, and for the content of Page2, it should be a wiki link to page one. Then save and hover one the link to see the popups.
One thing to note is that, if you're on localhost, popups show on articles/pages that are created on localhost and not those that are referenced from online! Hope this help? Let me know if you need more help, thanks! X-Savitar (talk) 08:33, 3 March 2018 (UTC)Reply
wfLoadExtension( 'TextExtracts' );
wfLoadExtension( 'PageImages' );
wfLoadExtension( 'Popups' );
$wgPopupsBetaFeature = false;
$wgPopupsExperiment = false;
$wgPopupsHideOptInOnPreferencesPage = true;
$wgPopupsOptInDefaultState = '1';
this worked for me 62.12.224.11 (talk) 19:32, 6 June 2018 (UTC)Reply
If i use mediawiki version above 1.4, i have try to use code
require_once "$IP/extensions/Popups/Popups.php";
require_once "$IP/extensions/PageImages/PageImages.php";
require_once "$IP/extensions/TextExtracts/TextExtracts.php";
$wgPopupsBetaFeature = true;
$wgPopupsOptInDefaultState = '1';
but this code cannot run, what should i do? :-( 36.66.111.35 (talk) 00:40, 7 June 2018 (UTC)Reply

Content removing does not work

edit

Hello. We tryed to remove the content of w:ru:Template:Интерактивная схема Московского метрополитена from the page previews. The w:ru:Special:Diff/91373981 does not work. The w:ru:Special:diff/91378052 does not work. What should we do? Thank you. IKhitron (talk) 19:15, 7 March 2018 (UTC)Reply

Can you give an example page that uses this template for which you are seeing the table and image show up in the summary?
Thank you! Jdlrobson (talk) 21:43, 7 March 2018 (UTC)Reply
Please, see w:ru:Медведково (станция метро), the first link of preambula, to w:ru:Московский метрополитен. I saw the image only. Thank you. IKhitron (talk) 22:01, 7 March 2018 (UTC)Reply
The behaviour of noexcerpt is defined here:Extension:Popups#FAQ. It's purpose is to remove content from the text that appears on hover.
The selection of the image used for the preview here: Extension:PageImages#Image choice. "noexcerpt" class will have no impact on that.
Could you be clearer about what you are seeing and what you are expecting to see?
I'm not sure if the problem you are reporting is one of the following or multiple things:
1) The image you are seeing is not the image you want to see.
2) The summary text is not appearing as you expect it to appear (if so could you point out what you are seeing or not seeing that you'd expect?)
3) A page preview is showing on a link where you don't expect it to appear because you've attempted to disable it altogether some how.
This is what I see when I hover over that link:
https://imgur.com/a/ULuJF
Please help me understand what's not meeting your expectations.
I think the problem you are reporting is just "#1" ? In which case MediaWiki:Pageimages-blacklist would be your only option (although this was not intended for this purpose). I suspect the issue with the blacklist is the format is not well documented. I'll need to investigate how that behaves before giving you a better idea of why that's not working.
Thanks! Jdlrobson (talk) 23:50, 7 March 2018 (UTC)Reply
Thank you for your help. It seems like after the creation of Pageimages-blacklist we also needed to run the nulledit script on all the pages that include the image. It works now. IKhitron (talk) 11:21, 8 March 2018 (UTC)Reply
Thanks for working this out. Is there any way we can improve the documentation for this? Jdlrobson (talk) 16:28, 8 March 2018 (UTC)Reply
For example:
Yes! There is a blacklist on every wiki that administrators can edit, at MediaWiki:Pageimages-blacklist (example). Any images that appear here will not be page images for any article. The new item in the list will disappear after performing a nulledit on all pages that include this image. IKhitron (talk) 16:39, 8 March 2018 (UTC)Reply

Only see popups when I logged in

edit
Hi,
i want use the popups for every user who visit the site. but the popups are only works when I logged in. all the others don't see popups on links
I have installed the extensions Popups, PageImages and TextExtracts.
In the LocalSettingsg I set:
wfLoadExtension( 'Popups' );
wfLoadExtension( 'PageImages' );
wfLoadExtension( 'TextExtracts' );
$wgPopupsBetaFeature = false;
$wgPopupsOptInDefaultState = '1';
What is wrong? 80.255.7.105 (talk) 14:30, 8 May 2018 (UTC)Reply
@Jdlrobson do you have an idea of what's going on here? CKoerner (WMF) (talk) 16:24, 9 May 2018 (UTC)Reply
I (the author of Popups extension) now have checked it. It works even if I am not logged in (at my site https://withoutvowels.org such as https://withoutvowels.org/wiki/Tanakh:Genesis_1:1 page). VictorPorton (talk) 19:09, 8 May 2018 (UTC)Reply
Excuse me, I am the author of another extension, not Popups. Sorry for the confusion. VictorPorton (talk) 19:11, 8 May 2018 (UTC)Reply
wfLoadExtension( 'TextExtracts' );
wfLoadExtension( 'PageImages' );
wfLoadExtension( 'Popups' );
$wgPopupsBetaFeature = false;
$wgPopupsExperiment = false;
$wgPopupsHideOptInOnPreferencesPage = true;
$wgPopupsOptInDefaultState = '1';
this worked for me 62.12.224.11 (talk) 19:33, 6 June 2018 (UTC)Reply

FANDOM installation

edit

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I want to use this for my FANDOM (Wikia owned) wiki. How can I do so? 2407:7000:817C:1775:A0CA:100E:849F:D703 (talk) 08:02, 15 May 2018 (UTC)Reply

Most probably you cannot. You will have to ask Wikia support to do this for you if at all. [[kgh]] (talk) 08:05, 15 May 2018 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Popups always requests 2 sentences?

edit

Hi together.

As the description of the Popups extension tells us, it will always request 2 sentences from the article. In most cases that's fine. However, in German language there exist a lot of abbreviations that are written with a period, e.g. the doctors degree = "Dr."

So, if the article starts with "Dr. Dr. John Doe was a friendly man", the popup will show: "Dr. Dr."

Is there any way to override this behaviour? Regards, A. AnonymusGdpr (talk) 13:07, 13 June 2018 (UTC)Reply

Are you seeing this on a local wiki or a Wikimedia site?
It looks like Extension:Popups#Text was out of date, so I've updated that. Sorry about that!
We use the https://www.mediawiki.org/wiki/Page_Content_Service#Summary endpoint in Wikimedia production sites, which solves the issue with sentences and was one of the motivations for moving away from the use of TextExtracts given its many documented problems.
We recommend using REST base with Popups. Jdlrobson (talk) 21:25, 26 June 2018 (UTC)Reply
Ouch ... Me I'm just a dumb amateur sysadmin of a small local wiki. I can luckily manage mediawiki versions and install/update extensions, my highest degree of understanding is writing a private 50-lines-of-code extension. I'm afraid the RESTBase and REST API is far beyond my small amount of knowledge, as it is not part of the standard mediwiki distribution.
Thank you anyway for your answer, and for the update which makes things clearer! As there are only a few articles concerned, I'll try using the "noexcerpt" in those cases. AnonymusGdpr (talk) 08:02, 27 June 2018 (UTC)Reply
It works with the "noexcerpt" class. Does snot look very elegant but as I mentiones, there are only a few number of articles that we'll have to deal with. AnonymusGdpr (talk) 08:25, 27 June 2018 (UTC)Reply
Sorry to hear that :( but glad you can work around the problem. It's a little frustrating for me not to be able to find a way to help you better. Jdlrobson (talk) 19:42, 27 June 2018 (UTC)Reply

Namespaces

edit

Another maybe silly question. The extension works well with hyperlinks of articles from the main namespace. Is there a way to activate it for other namespaces? AnonymusGdpr (talk) 11:16, 24 June 2018 (UTC)Reply

Hey @Alzi24 could you tell me more about how this might benefit you? Currently there are no plans to increase the availability in other namespaces, but uses cases would help to build an argument. :) CKoerner (WMF) (talk) 20:48, 26 June 2018 (UTC)Reply
On our wiki, most of the biggest content pages are also category pages.
So for instance, our page on the German toymaker '''Märklin'''
https://www.brightontoymuseum.co.uk/index/Category:Märklin
gives the background to the company, but also serves as a central category page for listing all the museum's relevant exhibits, and also all the images we've collected/edited/created.
We have comparatively few category pages that aren't also significant content pages. ~ ErkDemon (talk) 11:44, 14 July 2018 (UTC)Reply
Would be useful for us since we use Talk pages and subpages to document context and conflicts that don't belong in the content namespace, but would be more useful if we could expose them through Popups. Expanding the content namespace to add Talk pages is likewise not a workaround. PFWOz (talk) 02:12, 5 January 2019 (UTC)Reply
In our local wiki, there'd be two use cases.
1. Templates: Viewing the help page with an overview of our templates, one could see the content of the template page within the popup. In our very special case the content of the template is not only the template itself, it's preceded by a short "noinclude" description of the template.
2. "Source" namespace: Besides the main namespace, we maintain a source namespace. All pages within the source namespace are simple redirects to the regarding source (which is, simplified, the description of a book). Articles of the main namespace now contain references to the sources not by directly linking to the book but instead by using the "Source:series-episode" (which is easier & usually shorter).
Don't know if any of these matters for any other wiki, so it is only a secondary proposal. AnonymusGdpr (talk) 07:32, 27 June 2018 (UTC)Reply
Example from Alzi24's wiki: https://perrypedia.proc.org/wiki/GREYHOUND (examples always help!)
I agree that it would be a very useful configuration option for the extension. 3rd-party wikis could utilize it immediately as a site-wide configuration. Wikimedia wikis could potentially utilize it as a power-editor setting, either individually configurable now, or in the future as part of the previously discussed advanced-popups (for editors) version idea. –Quiddity (talk) 20:46, 28 June 2018 (UTC)Reply
Thanks both, those are helpful examples. I've created a phabricator task to have folks evaluate and discuss. CKoerner (WMF) (talk) 16:11, 2 July 2018 (UTC)Reply
You can already configure this. Right now page previews will show for links to anything in your content namespace.
Configuring Manual:$wgContentNamespaces will show previews for other namespaces.
The downside of this, is that these namespaces are also tied to various other special pages.
In the mean time, you can experiment on a user level using the following in your user js:
```
mw.config.set('wgContentNamespaces', [0,2]);
``` Jdlrobson (talk) 00:27, 3 July 2018 (UTC)Reply
Thanks, Jdlrobson, that fixes the toy museum's issue! IMO this is a really cool feature. ~ ErkDemon (talk) 11:53, 14 July 2018 (UTC)Reply
Your first proposal seems to be too risky. I won't bother for some seldom used special pages, but I guess the articles count would be compromised. So I tried the user.js, which will work ... nearly fine with some constraints.
USER namespace: the popup is shown perfectly well.
TEMPLATE: the result depends of the complexity of the template, Popups are shown if it is a simple template, but not if there is some html code in, like div, span, ... (the reason might be we still use TextExtracts, not RESTbase)
Our own private "Source" namespace: unfortunately not. Maybe because it is always a redirect, back to a main namespace.
(In case of a main namespace redirect to another main namespace article, however, the popup shows the target article.)
Doesn't matter, not worth a headache. AnonymusGdpr (talk) 21:08, 6 July 2018 (UTC)Reply

How to install that plugin on mediawiki version 2.6?

edit

require_once "$IP/extensions/Popups/Popups.php";

require_once "$IP/extensions/PageImages/PageImages.php";

require_once "$IP/extensions/TextExtracts/TextExtracts.php";

$wgPopupsBetaFeature = false;

$wgPopupsHideOptInOnPreferencesPage = true;

$wgPopupsOptInDefaultState = 1;

but its just not work for me? 125.160.115.93 (talk) 03:01, 4 July 2018 (UTC)Reply

Where are the limits of the popups stored?

edit

Where can I find the code to change the text limits that are in the popups? I have a wiki where in the introduction I have a small paragraph of text in English, and then the text translated into another language. I would like to be able to display both in the Popup. Actually, I would like to be able to display whatever is in the introduction into the popup with limited html. I just need to know which files I should be looking at, and what functions/constants are limiting this. I tried to comment out exsentences and exchars, but that does not seem to fix the problem. Also, how do I clear the cache for the popup extract? I tried to purge the original page and I tried to purge the page where the link is, but it does not seem to work. I am using version 1.27. Zzmonty (talk) 11:06, 7 September 2018 (UTC)Reply

Regarding caching (with the same MW 1.27 version), I noticed I had to perform an empty edit to trigger a change (especially for images). If necessary, you can use one script like this: https://github.com/SimilisTools/mediawiki-maintenance/blob/master/refreshEdit.php Toniher (talk) 21:04, 25 October 2018 (UTC)Reply

Check Version

edit

There are some situations where the versions must match precisely. For example in MW V 1.31 I had a problem with a newer version of the extension which I could solve by installing an older one. 217.95.168.88 (talk) 14:40, 31 October 2018 (UTC)Reply

Issues when used with Extension:Tabber

edit

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I am having issues when clicking on a tab from Extension:Tabber, it does not change, only if you hold the click or click several times. When deactivating Popups, tabber works normally. Pwrest (talk) 20:52, 4 November 2018 (UTC)Reply

I wasn't aware of the Tabber extension and don't know what it does. But when I look at the code I see it creates elements like <a href="#" title="…">. The Popups extension can't know these are not links to an other article, and tries to display a Popup when clicking them.
One of the solutions I would like to propose is to change the Tabber extension and not let it create "fake" links with dysfunctional href="#", but <span> instead. An even simpler fix is to remove the redundant title="…". It looks like these title aren't doing anything but repeating what the links already say. Without a title, Popups will skip these links, and they should work as intended by Tabber. Thiemo Kreuz (WMDE) 14:01, 13 December 2019 (UTC)Reply
thanks for the answer, that was the hint I needed.
I just excluded <.attr('href', '#')> from the tabber.js (line12) and it worked, both the Tabber and the Popups. Xaase (talk) 11:11, 17 December 2019 (UTC)Reply
Oh yes, that's an even simpler fix. In HTML5 an <a> is valid without any href. I'm glad this was resolved so quickly. Thiemo Kreuz (WMDE) 11:28, 17 December 2019 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Stripped parentheticals?

edit

Hello there. The last paragraph of the page "Why are parenthetical stripped?" states that parts of the text are stripped when included in paired parentheses. Has this behaviour been changed recently?

We've upgraded to MW 1.31 now. Text within parentheses is visible, e.g. https://www.perrypedia.proc.org/wiki/Netzspürer, place the mouse over "Natürlichen Psionischen Netzes", you'll see: "Das Psionische Netz (vereinzelt auch: Psinetz (PR 1304) oder Enerpsinetz (PR 1340)) " ...

Or is this a matter of the TextExtracts extension that we are still using? AnonymusGdpr (talk) 19:18, 26 December 2018 (UTC)Reply

To give the answer myself. Yes, this extension has been changed from 1.30 to 1.31 to make things worse, unfortunately. I have installed Popups (for 1.30 from ExtensionDistributor) on our 1.31 wiki now and thankfully it behaves just as it did for years. Some parts of the text are stripped, e.g. text included between parentheses or annotations that are in italics and indented. That fits perfectly well for our needs.
With Popups for 1.31, behaviour changes to showing all original text unchanged.
Maybe there were special needs for changing it, complaints of some users or something else. I wonder why basic functions are changed without having an option ... I'd like to suggest there should be a setting (parameter for LocalSettings) so that one can choose between plain text and stripped text.
BTW also strange: In both cases, Version information shows "– (7da6cff) 23:05, 19. Sep. 2017" ... but quite certain there must be a difference. AnonymusGdpr (talk) 19:47, 5 February 2019 (UTC)Reply
> BTW also strange: In both cases, Version information shows "– (7da6cff) 23:05, 19. Sep. 2017" ... but quite certain there must be a difference.
Could it be that TextExtracts version is different? Ankostis (talk) 22:31, 23 February 2019 (UTC)Reply
The problem description is complete and clear so far, your question isn't. Which could be different from what? AnonymusGdpr (talk) 14:04, 24 February 2019 (UTC)Reply
Point taken, amended my comment. Ankostis (talk) 09:16, 25 February 2019 (UTC)Reply
Oh, now I can see ... sorry, I've been wrong and you're right! There is indeed:
– (7da6cff) 23:05, 19. Sep. 2017 -> taken from 1.30 from ExtensionDistributor -> works as expected, text within parentheses stripped
– (f1678d9) 16:26, 17. Apr. 2018 -> taken from 1.31 from ExtensionDistributor -> leaves text within parentheses included in the popup
My mistake, don't know where I looked at 3 weeks ago. AnonymusGdpr (talk) 19:22, 25 February 2019 (UTC)Reply
Once again I'd like to request that this extension (which once has been useful) being modified in a way that provides a setting "strip text between parentheses yes/no". I still do not understand why the manner of retrieving the text from an article has been changed heavily without necessity. Working with an older version of the extension is just a workaround, cannot be the final solution. AnonymusGdpr (talk) 09:33, 5 March 2019 (UTC)Reply
The problem here is Extension:TextExtracts which you are using for the source of your summaries is not being actively maintained and will unlikely be updated to fix this problem.
We recommend and maintain Page Content Service for Popups or that you use a be spoke solution specific to your wiki - making summaries from user generated content is a hard problem to solve generically.
See also: https://m.mediawiki.org/wiki/Extension:Popups#API
I'll try and write something more practical in the FAQ section as soon as I have the time. Jdlrobson (talk) 21:47, 6 March 2019 (UTC)Reply
What would be the bespoke solutions for a private wiki? Ankostis (talk) 09:05, 7 March 2019 (UTC)Reply
@Jdlrobson: Yes, I see and understand the problem described here https://www.mediawiki.org/wiki/Page_Previews/API_Specification#Background_&_Motivation
Unfortunately the current documentation for the Page Content Service is far beyond my mediawiki knowledge. If you have practical hints for implementing PCS, I'd appreciate hearing from you. AnonymusGdpr (talk) 14:51, 10 March 2019 (UTC)Reply
Return to "Popups/2018" page.