Gebruikershulpmiddelen

Site-hulpmiddelen


bridge:trumpsuits-dokuwiki-plugin

Verschillen

Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.

Link naar deze vergelijking

Beide kanten vorige revisieVorige revisie
Volgende revisie
Vorige revisie
bridge:trumpsuits-dokuwiki-plugin [2020/12/19 16:37] – oude revisie hersteld (2020/08/26 22:08) 77.83.87.171bridge:trumpsuits-dokuwiki-plugin [2024/03/08 19:45] (huidige) – [Notes] Pieter van der Meulen
Regel 1: Regel 1:
 ====== Trump suits plugin for DokuWiki ====== ====== Trump suits plugin for DokuWiki ======
  
-This may not be the most spectacular DokuWiki plugin available, but it suits my own needs just fine. The plugin renders the diamond and heart card suit symbols in red (♦/♥), and the clubs and spade card suit symbols in black (♣/♠). It also adds four buttons to the editor toolbar for quick access to the trump suit symbols.+This may not be the most spectacular DokuWiki plugin available, but it suits my own needs just fine. The plugin renders (FIXME will render in the near future) the diamond and heart card suit symbols in red, and the clubs and spade card suit symbols in black. It also adds four buttons to the editor toolbar for quick access to the trump suit symbols.
  
-Due to my very limited knowledge of PHP and javascript I can't guarantee this won't set fire to your DokuWiki server. Mine seems to have survived thus far, so there is hope yet. Suggestions for improvement are very welcome.+Due to my very limited knowledge of PHP and javascript I can't guarantee this won't set fire to your DokuWiki server. Mine seems to have survived this far though, so there is hope yet. Suggestions for improvement are very welcome.
  
 ===== Syntax ===== ===== Syntax =====
  
 No special syntax. Just use standard UTF card suit symbols (optionally inserted by using the toolbar buttons). No special syntax. Just use standard UTF card suit symbols (optionally inserted by using the toolbar buttons).
- 
-===== Versions ===== 
- 
-  ;2010-09-03 
-  :Fixed javascript that was broken in DokuWiki version 2009-12-25, “Lemming”. 
-  ;2009-11-05 
-  :Initial version 
-   
- 
- 
  
 ===== Installation ===== ===== Installation =====
- 
  
  
Regel 26: Regel 15:
  
  
-Point your plug-in manager at [[/downloads/trumpsuits-dokuwiki-plugin.tar.gz]] or [[/downloads/trumpsuits-dokuwiki-plugin.zip]]. +Point your plug-in manager at [[/downloads/trumpsuits-dokuwiki-plugin.tar.gz]] or [[/downloads/trumpsuits-dokuwiki-plugin.zip]]. FIXME
  
 ==== Manual ==== ==== Manual ====
Regel 33: Regel 21:
 Create the folder ''lib/plugins/trumpsuits'' in your DokuWiki folder. Create ''syntax.php'' and ''scrips.js'' as given below. Create the folder lib/plugins/trumpsuits/images and place the images in this table in there. Create the folder ''lib/plugins/trumpsuits'' in your DokuWiki folder. Create ''syntax.php'' and ''scrips.js'' as given below. Create the folder lib/plugins/trumpsuits/images and place the images in this table in there.
  
-^ Suit      ^  Unicode, hexadecimal  ^^ Filename      ^  Image                                                 ^ +^ Suit      ^  Filename      ^  Image                                                 ^ 
-| Clubs     |  2663  |  2667  |  clubs.png      {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/clubs.png}}     | +| Clubs      clubs.png      {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/clubs.png}}     | 
-| Diamonds   2666  |  2662   diamonds.png  |  {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/diamonds.png}} +| Diamonds  |  diamonds.png  |  {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/diamonds.png}} 
-| Hearts    |  2665  |  2661  |  hearts.png    |  {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/hearts.png}}    | +| Hearts    |  hearts.png    |  {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/hearts.png}}    | 
-| Spades    |  2660  |  2664  |  spades.png    |  {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/spades.png}}    |+| Spades    |  spades.png    |  {{http://www.vdmeulen.net/wiki/lib/plugins/trumpsuits/images/spades.png}}    | 
  
 === syntax.php === === syntax.php ===
Regel 188: Regel 177:
  
 </code> </code>
- 
  
  
Regel 196: Regel 184:
  
 <code javascript> <code javascript>
-if(window.toolbar!=undefined){ +//create a single toolbutton with desired properties 
-    var icobase = DOKU_BASE + "lib/plugins/trumpsuits/images/"; +function plugin_trumpsuits_createToolbutton (id, tooltipText, imgFile, insText, accKey) { 
-    toolbar[toolbar.length] = { +    var ico = document.createElement("img"); 
-        "type": "insert", +    ico.src = DOKU_BASE + "lib/plugins/trumpsuits/images/" + imgFile
-        "title": "Spades", +    var btn = document.createElement("button"); 
-        "icon": "spades.png"+    btn.id = "syntax__plugin_trumpsuits_+ id
-        "insert": "♠", +    btn.className = "toolbutton"; 
-        "icobase": icobase}+    btn.appendChild(ico)
-    toolbar[toolbar.length] +    btn.title tooltipText;     
-        "type": "insert", +    btn.accessKey = accKey
-        "title": "Hearts", +    eval('btn.onclick function(){insertAtCarret("wiki__text", "' + insText + '"); return false;}'); 
-        "icon": "hearts.png", +    return(btn);
-        "insert":  "♥", +
-        "icobase": icobase}+
-    toolbar[toolbar.length] { +
-        "type": "insert", +
-        "title": "Diamonds", +
-        "icon": "diamonds.png", +
-        "insert": "♦", +
-        "icobase": icobase}+
-    toolbar[toolbar.length] = { +
-        "type": "insert", +
-        "title": "Clubs", +
-        "icon": "clubs.png", +
-        "insert": "♣", +
-        "icobase": icobase};+
 } }
-</code> 
- 
- 
- 
  
 +//if this is an "edit" page, add toolbuttons
 +function plugin_trumpsuits_toolbar_additions() {
 +    var toolbar = $("tool__bar");
 +    if(!toolbar) {return;}
 +    if(!$("edbtn__save")) {return; //We must be able to save the page
 +    var tbtn = plugin_trumpsuits_createToolbutton("spades", "Spades", "spades.png", "â™ ", 'S');
 +    if (tbtn) {toolbar.appendChild(tbtn);}
 +    tbtn = plugin_trumpsigns_createToolbutton("hearts", "Hearts", "hearts.png", "♥", 'H');
 +    if (tbtn) {toolbar.appendChild(tbtn);}
 +    tbtn = plugin_trumpsigns_createToolbutton("diamonds", "Diamonds", "diamonds.png", "♦", 'D');
 +    if (tbtn) {toolbar.appendChild(tbtn);}
 +    tbtn = plugin_trumpsigns_createToolbutton("clubs", "Clubs", "clubs.png", "♣", 'C');
 +    if (tbtn) {toolbar.appendChild(tbtn);}
 +}
  
 +addInitEvent(plugin_trumpsuits_toolbar_additions);
 +</code>
 +===== Notes =====
  
 +Notes on javasript in plugins: http://wiki.splitbrain.org/wiki:devel:javascript. For debugging, first turn CSS en javascript compression off in your DokuWiki config. Then debug path/to/wiki/lib/exe/js.php. I use the Firefox javascript debugger plugin. User manual: http://devedge-temp.mozilla.org/viewsource/2002/venkman/01/index_en.html.
  
-===== Wishlist =====+Browser an OS dependent CSS selectors: https://rafael.adm.br/css_browser_selector/
  
-  *Configuration options for trump suit symbol replacement 
-  *Language options. Can one use language conf in javascript? 
  
bridge/trumpsuits-dokuwiki-plugin.1608392231.txt.gz · Laatst gewijzigd: (Externe bewerking)