Last modified: 2011-05-01 19:20:57 UTC
Created attachment 8258 [details] Enhanced version Sometimes it is needed to create local links in a wiki and with the current implementation of mw.util.wikiGetlink, the url includes the server name. Consequently, the CSS matched by div#content a[href ^="https://"] {...} will add the lock icon[1] on links whose href is defined by the function (for an example, see the above url). It would be useful to be able to specify whether the link should be local or not. In the attached file there is an example of how this could be done. [1] https://secure.wikimedia.org/skins-1.17/vector/images/lock-icon.png
Some browsers (IE if I recall correctly) internally interpret href attributes absolutely. Meaning (atleast with javascript selectors) that href^="http" would match internal links as well. I don't know if this is the case for real CSS as well, should be easy to test. However, what about removing wgServer prefix all together ? Do we need it ?
Created attachment 8477 [details] Patch by mybugs.mail@gmail.com make patch from attachment
Created attachment 8478 [details] Remove the check and the wgServer prefix from mw.util.wikiGetlink The check is not needed, if wgArticlePath is undefined there's probably a much bigger issue. The wgServer doesn't need to be prefixed to the link (if someone really needs it (ie. external tools using the script and somehow defining wgServer in mw.config) they can surely prefix wgServer themselfs. In most if not all cases this is used to create anchor tags, which are interprated by browsers relatively to the current window location and in some browsers it even auto-prefixes the current environment when setting the href/src attribute.
Fixed in r87208.