Widget:Mybutton: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Geen bewerkingssamenvatting |
Geen bewerkingssamenvatting |
||
Regel 8: | Regel 8: | ||
id= | id= | ||
text= | |||
Issues: | Issues: | ||
Regel 17: | Regel 18: | ||
== Copy to your site == | == Copy to your site == | ||
To use this widget on your site, just install [https://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy the [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as page '''{{FULLPAGENAME}}'''. | To use this widget on your site, just install [https://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy the [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as page '''{{FULLPAGENAME}}'''. | ||
</noinclude><includeonly>< | </noinclude><includeonly><button id="mybutton-$id">$text</button> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
function button_$id_handler() { | function button_$id_handler(evt) { | ||
evt.stopPropagation(); | |||
$.get("http://www.example.com", (res) => {console.log(res);}); | $.get("http://www.example.com", (res) => {console.log(res);}); | ||
} | } | ||
document.getElementById("mybutton-$id").onclick = button_$id_handler; | document.getElementById("mybutton-$id").onclick = button_$id_handler; | ||
</script> | </script> | ||
<noscript>Please enable JavaScript. </noscript></includeonly> | <noscript>Please enable JavaScript. </noscript></includeonly> |
Versie van 23 dec 2019 20:11
This widget allows you to embed a button on your wiki page.
Created by User:Eelco
Using this widget
For information on how to use this widget, see ???
id= text=
Issues:
- multiple buttons per page are allowed;
- each button on a page must have a unique name (id);
Copy to your site
To use this widget on your site, just install MediaWiki Widgets extension and copy the full source code of this page to your wiki as page Widget:Mybutton.