DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sectiontoggle

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
plugin:sectiontoggle [2019-07-28 15:50] – [Examples/Usage] turnermmplugin:sectiontoggle [2023-12-31 18:13] (current) – [sectiontoggle Plugin] 24.78.8.122
Line 3: Line 3:
 ---- plugin ---- ---- plugin ----
 description: Toggle sections open and closed by clicking on section headers; change templates where needed for phones and tablets description: Toggle sections open and closed by clicking on section headers; change templates where needed for phones and tablets
-author     : Myron Turner +author     : Myron Turner, Elbie M 
-email      : turnermm02@shaw.ca +email      : emoonga1993@gmail.com 
-type       : syntax +type       : action,syntax 
-lastupdate : 2019-07-22 +lastupdate : 2023-12-27 
-compatible : 2012-10-13 "Adora Belle", 2013-05-10a "Weatherwax", 2014-09-29b "Hrun", Detritus, Eleonor Of Tsort, Frusterick Manners, Greebo+compatible : 2012-10-13 "Adora Belle", 2013-05-10a "Weatherwax", 2014-09-29b "Hrun", Detritus, Eleonor Of Tsort, Frusterick Manners, Greebo, Hogfather,Igor
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : mobile, tablet, phone, collapsible, hide, section, template tags       : mobile, tablet, phone, collapsible, hide, section, template
  
-downloadurl: https://github.com/turnermm/sectiontoggle/archive/master.zip+downloadurl: https://github.com/Elbie-em/sectiontoggle/archive/refs/heads/master.zip
 bugtracker : https://github.com/turnermm/sectiontoggle/issues bugtracker : https://github.com/turnermm/sectiontoggle/issues
 sourcerepo : https://github.com/turnermm/sectiontoggle sourcerepo : https://github.com/turnermm/sectiontoggle
Line 23: Line 23:
 ===== Installation ===== ===== Installation =====
  
-:!: **Requirements:** This plugin requires jQuery and was originally designed for use with the [[template:dokuwiki|DokuWiki Template]]. In its current form, it should work with any template. 
  
 Search and install the plugin using the [[plugin:extension|Extension Manager]]. 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.
Line 30: Line 29:
 ===== Examples/Usage ===== ===== Examples/Usage =====
  
-This plugin converts DokuWiki headers into toggles which open and close the sections immediately below them. The plugin has undergone a number of revisions and in its current form, it will work out of the box with any template without any need for configuration. However, configuring the plugin as described in the sections below __may__ be useful for efficiency.((The emphasis here is on may, i.e. possibly if you have large pages with many headers.))  Over twenty templates come pre-configured in the file [[#templatesinipreconfigured_templates|templates.ini]], or you can configure using the [[#configuration|Configuration Manager]].  +This plugin converts DokuWiki headers into toggles which open and close the sections immediately below them.  
 +==== To Configure or Not to Configure ====
  
 +The plugin will work out of the box with any template without any need for configuration. However, configuring the plugin as described in the section on [[#configuring_for_mobile_devices|Configuring for Mobile Devices]]  __may__ be useful for efficiency.((The emphasis here is on may, i.e. possibly if you have large pages with many headers.))  A group of the most suitable templates for phones come pre-configured in the file [[#templatesinipreconfigured_templates|templates.ini]]. You can also configure using the [[#configuration|Configuration Manager]].  
  
-When installed, the sections will initially be closed. Clicking on a header will open the section immediately below the header. Clicking on it again will close the section. Using the two buttons described [[#syntax|below]], the user can open and close all the sections with a single click.  Headers without any content below them will not be active and will not show the right arrow icon. +==== To Toggle or Not to Toggle ==== 
 +=== Toggling ===
  
-{{  https://i.imgur.com/c8AHmEh.png }}+When installed, the sections will initially be closed, except as described below under #Auto-TogglingClicking on a header will open the section immediately below the headerClicking on it again will close the section. Using the two buttons described [[#syntax|below]], the user can open and close all the sections with a single click.
  
 +=== Auto Toggling ===
 +There are two situations where a toggled section will remain open __when a page loads__. This enables you to link to a section of a page and that section will be open when the page loads. 
 +  - When the url accessing the page contains a hash element referencing a page section.  For instance: ''%%[[wiki:dokuwiki#read_more]]%%.'' This link will go to the ''read more section'' of the page and the section will be open and ready for reading.  
 +  - When the ''h_ini_open'' option is set.  For instance: \\ ''Welcome to your new DokuWiki;;DokuWiki Intro;;Read More''. \\  With this setting, when ''wiki:dokuwiki'' loads, two sections will remain open: **DokuWiki Intro** and ** Read More ** and when ''wiki:welcome'' loads the topmost ** Welcome to your new DokuWiki ** will be open.
  
-===== Syntax =====+The Dokuwiki table of contents also benefits from auto toggling.  That is, when you click on a heading in the table of contents, not only will the page be directed to the heading, but the section will toggle open. 
 +=== Disabling Toggles ==
 + 
 +Headers without any text content below them will not be active and will not show the right arrow icon. They will simply be standard headers and not toggles. In addition, in the Configuration Manager, you can choose to prevent selected headers from being toggled, as in the sample page below. There the **End of Page** header is an ''h5'', which is excluded from being toggled by the ''headers'' configuration option. 
 + 
 + 
 +{{ https://i.imgur.com/1iniJSO.png }} 
 + 
 +===== Using the Action Menu Button ===== 
 + 
 +As an alternative to the traditional sidebar syntax for open and close buttons, this plugin now offers a more convenient option. Users can opt to use a toggle button located directly in the action menu of the page.  
 + 
 +This feature enhances user experience by providing a streamlined and accessible way to control section visibility without the need for additional syntax. 
 + 
 +To enable the action menu button: 
 + 
 +  - Navigate to the plugin configuration settings. 
 +  - Locate the option labeled **"Show Section Toggle Button"**. 
 +  - Enable this option to display the toggle button in the action menu. 
 + 
 +Note: Enabling this feature will replace the need for sidebar syntax for opening and closing sections. Users can still use the traditional method if preferred. 
 + 
 +===== Using Syntax =====
 ==== Toggle Buttons ==== ==== Toggle Buttons ====
  
Line 45: Line 73:
   ~~stoggle_buttons~~   ~~stoggle_buttons~~
  
-These buttons will be hidden if toggling is disabled, as described below under Configuration.+These buttons will be hidden if toggling is disabled using the ''suspend'' option, as described below under Configuration.
  
-==== Override ==== +==== Limiting toggles to a section of the page ==== 
-This feature enables you to create a container ''div'' for the page, in which case it is not necessary to set the **name** option for identifying the div which holds the wiki contentHowever, you must set the **type** option either to ''id'' or to ''class''  +The following two macros will mark the start and end of an enclosing ''DIV'' within which headers will be converted to toggles Headers elsewhere on the page will not have toggles attached to them
-<code> +    ~~stoggle_openDIV~~ 
-~~stoggle_openDIV~~ +    ~~stoggle_closeDIV~~ 
-~~stoggle_closeDIV~~ +These should not cross ''DIV'' boundariesI.E 
-</code> +    DIV 1 
-You place the ''openDIV'' at the top of your wiki page and the ''closeDIV'' at the bottom This will create a div with a ''section%%__%%toggle'' id The entire wiki page will then be enclosed within this divIn all but the simplest of pages, these macros must be at the very top and the very bottom of your page. +    DIV section__toggle 
- +    Div 1 closed 
 +    DIV section__toggle closed    
  
 ===== Configuration ===== ===== Configuration =====
  
-This plugin was originally written for the DokuWiki template and it defaults to settings for the dokuwiki templateIf you are using the DokuWiki template, it will work right out of the box and will convert all headers from h1-h4 into toggles.+^  option        ^  options            default  ^  description                                                                                                                                                                        ^ 
 +| platform       | all, mobile, none  | mobile    | Selects the platform(s) on which to implement section toggling.                                                                                                                     | 
 +| type           | none,id,class      | none      | Indicates whether the div which encloses the affected headers is identified by a class or an id                                                                                   | 
 +| name                              |           | Name of the class or id which identifies the enclosing div.                                                                                                                         | 
 +| headers        | h1-h6              | h4        | Smallest header to activate as toggle. All headers between h1 and this setting will be toggles.                                                                                     | 
 +| suspend        | 1,0                | 0         | If set to true the plugin will be inactivated and no toggles will be set.                                                                                                           | 
 +| xcl_headers    |                    |           | Checkboxes to select headers which should not be set as toggles                                                                                                                     | 
 +| mobile_alt                        |           | An alternate template installed for phones, in case your preferred template does not support phones.                                                                                | 
 +| tablet_alt     | 1,0                | 0         | Use the alternate template for tablets                                                                                                                                              | 
 +| tablet_toggle  | 1,0                | 0         | Use toggles on tablets as well as phones                                                                                                                                            | 
 +| xcl_ns                            |           | Comma separated list of namespaces to be excluded from toggles, without initial or final colons (i.e.  name:space , not :name:space: )                                              | 
 +| xcl_pg                            |           | Comma separated list of page ids to be excluded from toggles (without initial colons, i.e  page:id, not :page:id )                                                                  | 
 +| incl_ns        |                    |           | Comma separated list of namespace ids where toggles should appear (without initial colons). Takes precedence over ''xcl_ns'', ''xcl_pg'', and ''incl_pg''                         | 
 +| incl_pg        |                    |           | Comma separated list of page ids where toggles should appear (without initial colons). Takes precedence over ''xcl_ns'' and ''xcl_pg''                                            | 
 +| h_ini_open                        |           | List of header texts, separated by double semi-colons, where toggles should stay open when the page loads, i.e. \\ ** header-text;;header-text;;. . .**                             | 
 +| toc_toggle     | true/false         | false     | When true, clicking on an entry in the TOC will not toggle the selected header but will, as in the default Douwiki configuration, direct the cursor to the header's page location. 
 +| start_open     | true/false         | false     | Load page into browser with all toggles open (they can then be closed and opened as usual)                                                                                                                                          | 
 +==== Notes on the Options ====
  
- 
-^  option      ^  options            default                                                                    description                                                                                          ^ 
-| platform     | all, mobile, none  | all                                                                        | Selects the platform(s) on which to implement section toggling.                                       | 
-| type         | none,id,class      | none                                                                       | Indicates whether the div which encloses the affected headers is identified by a class or an id.      | 
-| name                            |   | Name of the class or id which identifies the enclosing div.                                           | 
-| headers      | h1-h6              | h4                                                                         | Smallest header to activate as toggle. All headers between h1 and this setting will be toggles.       | 
-| suspend      | 1,0                | 0                                                                          | If set to true the plugin will be inactivated and no toggles will be set.                             | 
-| xcl_headers  |                    |                                                                            | Checkboxes to select headers which should not be set as toggles                                       | 
-| mobile_alt                      |                                                                | An alternate template installed for phones, in case your preferred template does not support phones.  | 
-| tablet_alt   | 1,0                | 0                                                                           | Use the alternate template for tablets   
-|tablet_toggle| 1,0                |0              |Use toggles on tablets as well as phones|                                                               
- 
-**Notes on the Options **  
  
     * **Platform **     * **Platform **
Line 79: Line 112:
       * ''none''  : toggling is disabled on all platforms.       * ''none''  : toggling is disabled on all platforms.
     * **Name and Type**     * **Name and Type**
-      * The name is either an id or a class attribute of the div which governs the DokuWiki headers. If you are using the DokuWiki template, you can ignore these options: the plugin automatically detects the template and will use the appropriate settings.  For auto-configurationssee [[#templatesinipreconfigured_templates|Preconfigured Templates]]+      * The ''type'' is either an id or a class, and the ''name'' is the id or class name of the divs which govern the headers. If you are using the DokuWiki template or one of the templates listed in [[#templatesinipreconfigured_templates|templates.ini]], the plugin automatically detects the template and will use the appropriate settings. In the case of the ''templates.ini'' file''type'' must be set to ''none'' or the file will be ignored.
     * **Headers and xcl_headers**     * **Headers and xcl_headers**
-      * The headers option selects the smallest header to be converted to a toggle. If you choose h6, all headers between h1 and h6 will be converted to toggles. You can, however, use the xcl_headers setting to omit selected headers from being converted to toggles.+      * The headers option selects the smallest header to be converted to a toggle. If you choose h6, all headers between h1 and h6 will be converted to toggles. You can, however, use the ''xcl_headers'' setting to omit selected headers from being converted to toggles. In this case, the section below the header will remain permanently visible
     * **mobile_alt**     * **mobile_alt**
-      * When ''platform'' is set to ''all'' or ''mobile'', this option enables you to switch to an alternate template that supports phones, in the event that your preferred template does not.  If your preferred template does support phones, then set this option to blank. A check is made to insure that that  alternate template is correctly installed, and if not the main template is used. +      * When ''platform'' is set to ''all'' or ''mobile'', this option enables you to switch to an alternate template that supports phones, in the event that your preferred template does not.  If your preferred template does support phones, then set this option to blank. A check is made to insure that that  alternate template is correctly installed, and if not the main template is used.  
     * **tablet_alt**     * **tablet_alt**
       * If set to true the ''mobile_alt'' template will be used for tablets.       * If set to true the ''mobile_alt'' template will be used for tablets.
 +    * **start_open**
 +      * This option will not apply to mobile devices or to logged in users without edit permission.
    
-  
- 
  
 When the toggle buttons are included on a page, they will not display if the platform is excluded from section toggling. So, if you want toggling only on mobile devices, you can still include these buttons on your page but they will not display on standard desktop systems. When the toggle buttons are included on a page, they will not display if the platform is excluded from section toggling. So, if you want toggling only on mobile devices, you can still include these buttons on your page but they will not display on standard desktop systems.
Line 122: Line 155:
 === Preconfigured Templates === === Preconfigured Templates ===
  
-  - 20cones +  - [[template:20cones]] 
-  - adoradark +  - [[template:adoradark]] 
-  - arctic +  - [[template:arctictut]] 
-  - arctictut +  - [[template:bootstrap3]] 
-  - bootstrap3 +  - [[template:dokucms]] 
-  - codowik  +  - [[template:flat]] 
-  - dokucms +  - [[template:greensteel]]  
-  - doogiestpl +  - [[template:kajukkk]] 
-  - flat +  - [[template:minima]] 
-  - greensteel  +  - [[template:monochrome]] 
-  - kajukkk +  - [[template:prsnl10]] 
-  - material +  - [[template:sprintdoc]] 
-  - minima +  - [[template:twentyfifteen]]  
-  - monochrome +  - [[template:wallpaper]] 
-  - prsnl10 +  - [[template:white]] 
-  - sprintdoc +  - [[template:writr]]
-  - twentyfifteen +
-  - vector +
-  - wallpaper +
-  - white +
-  - writr+
  
  
plugin/sectiontoggle.1564321815.txt.gz · Last modified: 2019-07-28 15:50 by turnermm

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki