DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:toolbox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revision
plugin:toolbox [2010-04-08 21:21]
71.142.80.55
plugin:toolbox [2021-01-21 09:37]
michaelsy [Toolbox Plugin] +tag "replace"
Line 1: Line 1:
-====== toolbox plugin ======+====== Toolbox Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 5: Line 5:
 author     : Andreas Gohr  author     : Andreas Gohr 
 email      : andi@splitbrain.org  email      : andi@splitbrain.org 
-type       :  +type       : Action 
-lastupdate : 2010-02-24 +lastupdate : 2017-03-18 
-compatible : 2009-12-25++compatible : Frusterick Manners, Greebo, Hogfather
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : javascript, toolbar, sort, indent, wordcount, list, tables+tags       : javascript, toolbar, sort, indent, wordcount, list, findandreplace, toolbox, replace
  
-downloadurl: http://github.com/splitbrain/dokuwiki-plugin-toolbox/zipball/master +downloadurl: https://github.com/splitbrain/dokuwiki-plugin-toolbox/zipball/master 
-bugtracker : http://github.com/splitbrain/dokuwiki-plugin-toolbox/issues +bugtracker : https://github.com/splitbrain/dokuwiki-plugin-toolbox/issues 
-sourcerepo : http://github.com/splitbrain/dokuwiki-plugin-toolbox/+sourcerepo : https://github.com/splitbrain/dokuwiki-plugin-toolbox/
 donationurl: http://donate.dokuwiki.org/Toolbox donationurl: http://donate.dokuwiki.org/Toolbox
 +
 +screenshot_img: http://i.imgur.com/1Rc5tZi.png
 ---- ----
  
-~~INFO:actionplugins~~ 
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download and install the plugin using the [[plugin:plugin|Plugin Manager]] using the URL given above. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually
 + 
 +==== Browser Extensions ==== 
 + 
 +If you want to use this plugin on a wiki that does not have it installed (eg. on dokuwiki.org or a wiki where you have no administrative control) you can also install it as a browser extension((It's a [[https://developer.mozilla.org/en-US/Add-ons/WebExtensions|WebExtension]] suitable for multiple browsers)). 
 + 
 +The browser extension will automatically inject the appropriate JavaScript when you edit a DokuWiki page. It will look and feel exactly as if the plugin was installed for all users in that wiki. 
 + 
 +  * [[https://addons.mozilla.org/en-US/firefox/addon/dokuwiki-toolbox/|Firefox Addon]] 
 +  * [[https://chrome.google.com/webstore/detail/dokuwiki-toolbox/ipfidnedfockcnklpkmbcinjfpfgbbin|Chrome Extension]] 
 + 
 +Theoretically it should be possible to install the same extension in Microsoft Edge as well, but it seems their store is not open for developers, yet.
  
 ==== Changes ==== ==== Changes ====
  
-{{rss>http://github.com/feeds/splitbrain/commits/dokuwiki-plugin-toolbox/master}}+{{rss>https://github.com/splitbrain/dokuwiki-plugin-toolbox/commits/master.atom date}}
  
 ===== Usage ===== ===== Usage =====
Line 54: Line 66:
 Might not always be 100% correct, but should be good enough. Might not always be 100% correct, but should be good enough.
  
-===== More features =====+{{https://i.imgur.com/adbrSq8.png}}
  
-Might come some day. Earlier if you send patches. Here are a few ideas:+==== Find and Replace ====
  
-  * Search and Replace +This opens a Find and Replace dialog. It allows you to search the text in the editor and do replacements.
-  * [[tips:bookmarklets|Table Cell prettification]]+
  
 +{{http://i.imgur.com/woe7p0s.png}}
  
-==== Added codebutton plugin ==== 
-I integrated the [[plugin:codebutton]] plugin into the toolbox plugin, also modified the plugin to show all the buttons in the toolbar 
  
-<code> +===== More features =====
-if(window.toolbar!=undefined){ +
- toolbar[toolbar.length] +
- "type":  "format", +
-                "title": LANG.plugins.toolbox.insertcode, +
-                "icon":  DOKU_BASE+"lib/plugins/toolbox/pix/code.png", +
- "open": "<file>\n", +
- "close": "\n</file>", +
-            }; +
- toolbar[toolbar.length] +
-                "type":  "toolbox_sort", +
-                "title": LANG.plugins.toolbox.sortasc, +
-                "icon":  DOKU_BASE+"lib/plugins/toolbox/pix/sort_ascending.png", +
-                "key":   "", +
-                "reverse":+
-            }; +
- toolbar[toolbar.length] =+
-                "type":  "toolbox_sort", +
-                "title": LANG.plugins.toolbox.sortdesc, +
-                "icon":  DOKU_BASE+"lib/plugins/toolbox/pix/sort_descending.png", +
-                "key":   "", +
-                "reverse":+
-            }; +
- toolbar[toolbar.length] =+
-                "type":  "toolbox_indent", +
-                "title": LANG.plugins.toolbox.outdent, +
-                "icon":  DOKU_BASE+"lib/plugins/toolbox/pix/text_indent_remove.png", +
-                "key":   "", +
-                "reverse":+
-            }; +
- toolbar[toolbar.length] =+
-                "type":  "toolbox_indent", +
-                "title": LANG.plugins.toolbox.indent, +
-                "icon":  DOKU_BASE+"lib/plugins/toolbox/pix/text_indent.png", +
-                "key":   "", +
-                "reverse":+
-            }; +
- toolbar[toolbar.length] =+
-                "type":  "toolbox_counter", +
-                "title": LANG.plugins.toolbox.counter, +
-                "icon":  DOKU_BASE+"lib/plugins/toolbox/pix/application_view_list.png", +
-                "key":   "", +
- }; +
-}+
  
-/** +Might come some day. Earlier if you send patchesHere are a few ideas:
- * Sort the selected text +
- */ +
-function tb_toolbox_sort(btn, opts, edid){ +
-    var selection = getSelection($(edid)); +
-    if(!selection.getLength()){ +
-        alert(LANG.plugins.toolbox.notext); +
-        return; +
-    }+
  
-    var text = selection.getText(); +  * [[tips:bookmarklets|Table Cell prettification]]
-    text = text.split("\n"); +
-    text.sort(); +
-    if(opts['reverse']) text.reverse(); +
-    text = text.join("\n"); +
- +
-    pasteText(selection,text,{}); +
-    pickerClose(); +
-+
- +
-/*+
- * Indent the selected text +
- */ +
-function tb_toolbox_indent(btn, opts, edid){ +
-    var selection = getSelection($(edid)); +
-    if(!selection.getLength()){ +
-        alert(LANG.plugins.toolbox.notext); +
-        return; +
-    } +
- +
-    var text = selection.getText(); +
-    text = text.split("\n"); +
-    for(var i=0; i<text.length; i++){ +
-        if(opts['reverse']){ +
-            text[i] = text[i].replace(/ ?/,''); +
-        }else{ +
-            text[i] = '  '+text[i]; +
-        } +
-    } +
-    text = text.join("\n"); +
- +
-    pasteText(selection,text,{}); +
-    pickerClose(); +
-+
- +
-/** +
- * Count words and characters +
- * +
- * @link http://www.dokuwiki.org/tips:wordcounter +
- */ +
-function tb_toolbox_counter(btn, opts, edid){ +
- +
-    function charcounter(text){ +
-        var list = text.split(/[^\w\-_]+/); +
-        var len  = text.length; +
-        if(list[len-1] == '') len--; +
-        if(list[0] == '') len--; +
-        if(len < 0) len=0; +
-        return len; +
-    } +
- +
-    function wordcounter(text){ +
-        var list = text.split(/[^\w\-_]+/); +
-        var len  = list.length; +
-        if(list[len-1] == '') len--; +
-        if(list[0] == '') len--; +
-        if(len < 0) len=0; +
-        return len; +
-    } +
- +
- +
-    var obj  = $(edid); +
-    var call = 0; +
-    var wall = 0; +
-    var csec = charcounter(obj.value); +
-    var wsec = wordcounter(obj.value); +
- +
-    if(obj.form.elements.prefix && obj.form.elements.prefix.value){ +
-        call += charcounter(obj.form.elements.prefix.value); +
-        wall += wordcounter(obj.form.elements.prefix.value); +
-    } +
-    if(obj.form.elements.suffix && obj.form.elements.suffix.value){ +
-        call += charcounter(obj.form.elements.suffix.value); +
-        wall += wordcounter(obj.form.elements.suffix.value); +
-    } +
- +
-    var out = ''; +
- +
-    if(call){ +
-        out += LANG.plugins.toolbox.total; +
-        out += "  "+LANG.plugins.toolbox.chars.replace('%d',(call + csec)); +
-        out += "  "+LANG.plugins.toolbox.words.replace('%d',(wall + wsec))+"\n"; +
- +
-        out += LANG.plugins.toolbox.section; +
-    }else{ +
-        out += LANG.plugins.toolbox.total; +
-    } +
-    out += "  "+LANG.plugins.toolbox.chars.replace('%d',csec); +
-    out += "  "+LANG.plugins.toolbox.words.replace('%d',wsec)+"\n"; +
- +
-    var selection = getSelection($(edid)); +
-    if(selection.getLength()){ +
-        var text = selection.getText(); +
- +
-        out += LANG.plugins.toolbox.selection; +
-        out += "  "+LANG.plugins.toolbox.chars.replace('%d',charcounter(text)); +
-        out += "  "+LANG.plugins.toolbox.words.replace('%d',wordcounter(text))+"\n"; +
-    } +
- +
-    pickerClose(); +
-    alert(out); +
-+
-</code> +
- +
-Perhaps someone could use it. +
- +
-Note: I also added this tot the lang.php:  +
-<code> +
-$lang['js']['insertcode'= 'Insert Code'; +
-</code>+
  
-And the image (code.png) of the [[plugin:codebutton]] plugin to the pix map. 
  
-//Theo// 
plugin/toolbox.txt · Last modified: 2021-01-21 09:59 by michaelsy