Widget:Mybutton: verschil tussen versies

Uit basis
Naar navigatie springen Naar zoeken springen
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Regel 7: Regel 7:
For information on how to use this widget, see ???
For information on how to use this widget, see ???


id=
text=
text=
kind= (string/identifier)


Issues:
Issues:


* multiple buttons per page are allowed;
* multiple buttons per page are allowed, but only one of the same kind per page
* each button on a page must have a unique name (id);
* (multiple buttons of the same kind are not useful, anyway)
*  
*  


== 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><button id="mybutton-<!--{$id}-->"><!--{$text}--></button>
</noinclude><includeonly><button id="mybutton-<!--{$kind}-->"><!--{$text}--></button>
<script type="text/javascript">
<script type="text/javascript">
     function button_<!--{$id}-->_handler(evt) {
     function button_<!--{$kind}-->_handler(evt) {
       evt.stopPropagation();
       evt.stopPropagation();
       console.log("Button - Username: " + mw.config.get("wgUserName"));
       console.log("Button - Username: " + mw.config.get("wgUserName"));
       data = {};
       data = {};
       data.kind = 0; // start
       data.kind = <!--{$kind}-->; // start
       data.userid = mw.config.get("wgUserId");
       data.userid = mw.config.get("wgUserId");
       data.pageid = mw.config.get("wgArticleId");
       data.pageid = mw.config.get("wgArticleId");
Regel 31: Regel 31:
     }
     }


     document.getElementById("mybutton-<!--{$id}-->").onclick = button_<!--{$id}-->_handler;
     document.getElementById("mybutton-<!--{$kind}-->").onclick = button_<!--{$kind}-->_handler;
</script>
</script>
<noscript>Please enable JavaScript. </noscript></includeonly>
<noscript>Please enable JavaScript. </noscript></includeonly>

Versie van 29 dec 2019 18:17

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 ???

text= kind= (string/identifier)

Issues:

  • multiple buttons per page are allowed, but only one of the same kind per page
  • (multiple buttons of the same kind are not useful, anyway)

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.