wfMsg( $key ) );
}
- function makeExternalLink( $url, $text, $escape = true ) {
- $style = $this->getExternalLinkAttributes( $url, $text );
+ function makeExternalLink( $url, $text, $escape = true, $linktype = '' ) {
+ $style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
$url = htmlspecialchars( $url );
if( $escape ) {
$text = htmlspecialchars( $text );
}
- /**
- * @access public
- */
- function suppressUrlExpansion() {
- return false;
- }
-
}
?>
\ No newline at end of file
$dtrail = '';
+ # Set linktype for CSS - if URL==text, link is essentially free
+ $linktype = ($text == $url) ? 'free' : 'text';
+
# No link text, e.g. [http://domain.tld/some.link]
if ( $text == '' ) {
# Autonumber if allowed
if ( strpos( HTTP_PROTOCOLS, $protocol ) !== false ) {
$text = '[' . ++$this->mAutonumber . ']';
+ $linktype = 'autonumber';
} else {
# Otherwise just use the URL
$text = htmlspecialchars( $url );
+ $linktype = 'free';
}
} else {
# Have link text, e.g. [http://domain.tld/some.link text]s
}
}
- $encUrl = htmlspecialchars( $url );
- # Bit in parentheses showing the URL for the printable version
- if( $url == $text || preg_match( "!$protocol://" . preg_quote( $text, '/' ) . "/?$!", $url ) ) {
- $paren = '';
- } else {
- # Expand the URL for printable version
- if ( ! $sk->suppressUrlExpansion() ) {
- $paren = "<span class='urlexpansion'> (<i>" . htmlspecialchars ( $encUrl ) . "</i>)</span>";
- } else {
- $paren = '';
- }
- }
-
# Process the trail (i.e. everything after this link up until start of the next link),
# replacing any non-bracketed links
$trail = $this->replaceFreeExternalLinks( $trail );
# This means that users can paste URLs directly into the text
# Funny characters like ö aren't valid in URLs anyway
# This was changed in August 2004
- $s .= $sk->makeExternalLink( $url, $text, false ) . $dtrail. $paren . $trail;
+ $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail;
}
wfProfileOut( $fname );
$text = $this->maybeMakeImageLink( $url );
if ( $text === false ) {
# Not an image, make a link
- $text = $sk->makeExternalLink( $url, $url );
+ $text = $sk->makeExternalLink( $url, $url, true, 'free' );
}
$s .= $text . $trail;
} else {
margin-right:0.5em;
border-width: 0.5em 1.4em 0.8em 0;
}
-.urlexpansion,
+
.hiddenStructure {
display: none;
}
margin-right:0.5em;
border-width: 0.5em 1.4em 0.8em 0;
}
-.urlexpansion,
+
.hiddenStructure {
display: none;
}
i++;
}
}
+
+
+// Expand links for printing
+
+String.prototype.hasClass = function(classWanted)
+{
+ var classArr = this.split(/\s/);
+ for (var i=0; i<classArr.length; i++)
+ if (classArr[i].toLowerCase() == classWanted.toLowerCase()) return true;
+ return false;
+}
+
+var expandedURLs;
+
+onbeforeprint = function() {
+ expandedURLs = [];
+
+ var contentEl = document.getElementById("content");
+
+ if (contentEl)
+ {
+ var allLinks = contentEl.getElementsByTagName("a");
+
+ for (var i=0; i < allLinks.length; i++) {
+ if (allLinks[i].className.hasClass("external") && !allLinks[i].className.hasClass("free")) {
+ var expandedLink = document.createElement("span");
+ var expandedText = document.createTextNode(" (" + allLinks[i].href + ")");
+ expandedLink.appendChild(expandedText);
+ allLinks[i].parentNode.insertBefore(expandedLink, allLinks[i].nextSibling);
+ expandedURLs[i] = expandedLink;
+ }
+ }
+ }
+}
+
+onafterprint = function()
+{
+ for (var i=0; i < expandedURLs.length; i++)
+ if (expandedURLs[i])
+ expandedURLs[i].removeNode(true);
+}
\ No newline at end of file
/* Print-specific things to hide */
-.urlexpansion, .printfooter {
+.printfooter {
display: none;
}
background: transparent;
text-decoration: underline;
}
-/*
-#content a:link:after,
-#content a:visited:after {
- content: " ( " attr(href) " ) ";
-}*/
+
+#content a.external.text:after, #content a.external.autonumber:after {
+ /* Expand URLs for printing */
+ content: " (" attr(href) ") ";
+}
#globalWrapper {
width: 100% !important;
img.tex { vertical-align: middle; }
span.texhtml { font-family: serif; }
-/* Show some stuff */
-.urlexpansion {
- display: inline ! important;
-}
-
div.townBox {
position:relative;
float:right;
margin: inherit ! important;
}
-/* Show some stuff */
-.urlexpansion {
- display: inline ! important;
-}
-
.printfooter {
border-top: solid 1px black;
display: block ! important;
$this->skinname = 'chick';
$this->template = 'Chick';
}
- function suppressUrlExpansion() { return true; }
function printSource() { return ''; }
}
margin-right:0.5em;
border-width: 0.5em 1.4em 0.8em 0;
}
-.urlexpansion,
+
.hiddenStructure {
display: none;
}