Mediawiki create a template for external linking - wiki

Some mediawikis are using a template or something like that to create twitter links in articles without the external link icon.
For instance in http://www.minecraftwiki.net/wiki/Mojang_AB each employee has a twitter link, this is not just an external link to twitter.com, but like [twitter:notch|#notch] in the source.
Does anyone know how I can add this feature to my mediawiki?

If you just want to remove the external link icon, you can wrap the link in <span class="plainlinks">, like this:
<span class="plainlinks">http://stackoverflow.com/</span>
or even
<span class="plainlinks">[http://stackoverflow.com Stack Overflow]</span>
A template for creating links to Twitter user pages might look something like this:
<includeonly><span class="plainlinks twitterlink">[https://twitter.com/{{{1}}} #{{{1}}}]</span></includeonly>
or, with the extension StringFunctions installed (to allow for input both with and without the # sign):
<includeonly><span class="plainlinks twitterlink">[https://twitter.com/{{#replace:{{{1}}}|#|}} #{{#replace:{{{1}}}|#|}}]</span></includeonly>

Those links are called Interwiki links and you can add them to your wiki by inserting into the interwiki table.

You might find these sites interesting:
http://www.mediawiki.org/wiki/Extension:Twitter4wiki
http://www.mediawiki.org/wiki/Extension:TwitterFeed

Related

How to link to html page at specific ID bookmark?

Using Diagrams.net (draw.io), I would like to link specific elements to web pages. This is easily accomplished currently by creating a link for the element (say a rectangle).
However, I would like to navigate directly to a specific id bookmark in the HTML page. I cannot seem to get that to work.
For example, if I try to use this syntax (which works in the browser location bar):
https://en.wikipedia.org/wiki/Canada#Geography
I will be taken to the main page:
https://en.wikipedia.org/wiki/Canada
However, the goal is to go to the "Geography" section of this page.
I have also tried the json syntax without any success:
data:action/json,{"actions":[{"open":"https://en.wikipedia.org/wiki/Canada#Geography"}]}
I have also played with different action syntax such as:
data:action/json,{"actions":[{"open":"https://en.wikipedia.org/wiki/Canada"},{"scroll":{"tags":["Geography"]}}]}
Note: I'm using the diagrams.net desktop version 14.1.8.
Thank you for taking the time to read this question.
Paul
On Windows this only seems to work if the browser isn't already open. There is not much we can do to fix this as we're passing the link to the OS.

How to add external URLs to icCube's application?

The icCube's application structure allows to add several extra items, such as a JS Action. Is it possible to use this JS Action (or another item) to link to an external HTML, to - for example - show a help file/ quick reference card?
For opening a new page simply add the following to the body of your JS Action:
window.open( 'http://www.google.com', '_blank' );
is going to open Google.
Hope that helps.

How to see where an item is used on Sharepoint Site?

I have many files (images etc.) in different libraries and I'm not sure which of them I am using / are linked within my Sharepoint site.
Like for example I imagine something like this:
example.jpg - used in: /SitePages/page1.html, /SitePages/page2.html
example.docx - used in: /MyList/
example2.jpg - used in: -
example3.jpg - used in: -
I know that for example hyperlinks change automatically when renaming a page. So there seems to be information about the links within the site...
Is there something similar to see if an item is linked/used on the site like in the example above?
Thanks.
There isn't anything in the api that will automatically tell you where a file is being referenced. Something like that would require code that checks for the item that you're looking for which would be easier in a list but a challenge if it appears in the markup or a content editor webpart.

How to include javascript script links to pyrocms page?

I'm using pyrocms to develop a system.
I know that, to include style links in header tag ''
in a page is by using $this->template->set_metadata().
But how can I include javascript links like that?
Any answer is appreciated.
Alternatively, if this is for a theme and the script is housed within your actual theme/js folder, it becomes:
{{ theme:js file="file.js" }}
Using just the {js} function would send it to the actual system's embedded js files.
$this->template->append_metadata(js('foo.js)) will work, or you can dump it into the view as others have suggested.
If you are creating a template you can do it like this:
{js('file.js', 'modulename')}
See the Pyro documentation.
If this is not the answer you are looking for, please explain more clearly what you want. E.g. in which file exactly do you want to include your javascript?

What does <a href="#" class="view"> mean?

In my html page, I see a link whose 'view source' code is as below :
<a href="#" class="view">
I see a valid link when I hover my mouse on it and when I click it, it works. But I am not able to find where and how this URL gets generated. I found the class a.view being defined in one of the CSS, but couldn't find the URL in the page source.. Can somebody help me out on whr i can find this URL ?
I felt like replying as well, explaining the same thing as the others a bit differently. I am sure you know most of this, but it might help someone else.
<a href="#" class="view">
The
href="#"
part is a commonly used way to make sure the link doesn't lead anywhere on it's own. the #-attribute is used to create a link to some other section in the same document. For example clicking a link of this kind:
Go to news
will take you to wherever you have the
<a name="news"></a>
code. So if you specify # without any name like in your case, the link leads nowhere.
The
class="view"
part gives it an identifier that CSS or javascript can use. Inside the CSS-files (if you have any) you will find specific styling procedures on all the elements tagged with the "view"-class.
To find out where the URL is specified I would look in the javascript code. It is either written directly in the same document or included from another file.
Search your source code for something like:
<script type="text/javascript"> bla bla bla </script>
or
<script> bla bla bla </script>
and then search for any reference to your "view"-class. An included javascript file can look something like this:
<script type="text/javascript" src="include/javascript.js"></script>
In that case, open javascript.js under the "include" folder and search in that file. Most commonly the includes are placed between <head> and </head> or close to the </body>-tag.
A faster way to find the link is to search for the actual link it goes to. For example, if you are directed to http://www.google.com/search?q=html when you click it, search for "google.com" or something in all the files you have in your web project, just remember the included files.
In many text editors you can open all the files at once, and then search in them all for something.
The href is probably generated in a javascript function. For example with jQuery:
$(function() {
$('a.view').attr('href', 'http://www.google.com');
});
Javascript may be hooking up to the click-event of the anchor, rather than injecting any href.
For example, jQuery:
$('a.view').click(function() { Alert('anchor without a href was clicked');});
Of course, the javascript can do anything it wants with the click event--such as navigate to some other page (in which case the href is never set, but the anchor still behaves as though it were)
Don't forget to look at the Javascript as well. My guess is that there is custom Javascript code getting executed when you click on the link and it's that Javascript that is generating the URL and navigating to it.
It probably works with Javascript. When you click the link, nothing happens because it points to the current site. The javascript will then load a window or an url. It's used a lot in AJAX web apps.