Usage

This template makes the rollover tooltip text display the specified text.

Full Capability Usage: {{User:Ajl772/link-title|url=|text=|title=|wiki=(0(default)|1(yes))}}

Explanation

This template is supposed to make the following code compatible with Wikipedia. <a href="http://en.wikipedia.org/wiki/WP:POL" title="Wikipedia policies and guidelines">WP:POL</a>

  • It will work for internal links if I input {{plainlink|http://en.wikipedia.org/wiki/WP:POL <span title="Wikipedia policies and guidelines">[WP:POL]</span>}}
  • It will work for external links if I input {{plainlink|http://www.google.com/ <span title="Google Search Engine">Google</span>}}

But the above is a little tedious so this template is supposed to make this process eaiser.

For example: If I were to paste this code into some .html file, it works properly and makes the popup-text (usually a little yellow box) say "Wikipedia policies and guidelines". See image:

 

Javascript process in non-wiki space

The following script works in non-wiki space to produce the desired results.

<script language="javascript">
function iif(condition,truepart,falsepart) {
  if(condition) {
    return truepart;
  }
  else
  {
    return falsepart;
  }
}

function linktitle(url,text,title,wiki) {
  var t1 = 0;
  var t2 = 0;
  var t3 = 0;
  var t4 = 0;
  if (title) {
    t3 = 1;
  }
  if (text) {
    t2 = 1;
  }
  if (wiki) {
    t4 = 1;
  }
  document.writeln("<span class='plainlinks'>["+iif(t4,"[<span title='"+title+"'>"
+iif(t2,text,url)+"</span>]",url+iif(t3," <span title='"+title+"'>"
+iif(t2,text,url)+"</span>",iif(t2," "+text,"")))+"]</span><br>"); } linktitle("http://www.google.com/","","",0); </script>

See also