{"id":479,"date":"2013-03-22T03:47:52","date_gmt":"2013-03-22T03:47:52","guid":{"rendered":"http:\/\/tregner.com\/flare-blog\/?p=479"},"modified":"2013-03-22T03:50:57","modified_gmt":"2013-03-22T03:50:57","slug":"hide-some-flare-html5-output-glossary-tab-entries","status":"publish","type":"post","link":"https:\/\/tregner.com\/flare-blog\/hide-some-flare-html5-output-glossary-tab-entries\/","title":{"rendered":"Hide Some Flare HTML5 Output Glossary Tab Entries"},"content":{"rendered":"<p>This example uses JavaScript, JSON, and jQuery.<\/p>\n<p>In a response to a forum post, I suggested a rules-based approach to removing plural terms from the Glossary tab in Flare HTML5 output. The sample I provided tackled a few common English rules.<\/p>\n<p><a href=\"http:\/\/forums.madcapsoftware.com\/viewtopic.php?f=9&amp;t=16199&amp;p=86717&amp;hilit=plurals#p86885\" target=\"_blank\">Rules-based Example to Remove Glossary Tab Entries with JavaScript<\/a><\/p>\n<p>Rules are one way to approach the problem. Another way is to keep a list of items to remove or hide. What follows is another example which hides three terms on a Glossary tab when the function in the example fires. You can adjust the list of terms in the JSON object which holds the list of terms. You can also adjust when the function is called. In the example project, there is a toolbar button. But you can add an event listener to some other object to call the function if you do not want to be tied to the toolbar.<\/p>\n<p>The sample project is configured as follows. There is a glossary with three glossary terms consisting of a plural term and a singular term: Child\/Children, Apple\/Apples, and Goose\/Geese.<\/p>\n<p><a href=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryEditor.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-481\" alt=\"GlossaryEditor\" src=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryEditor.png\" width=\"591\" height=\"179\" srcset=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryEditor.png 591w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryEditor-300x90.png 300w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/a><\/p>\n<p>There is a JSON object and a JavaScript function in the Toolbar Javascript.<\/p>\n<p><a href=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/ToolbarJavaScript.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-483\" alt=\"ToolbarJavaScript\" src=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/ToolbarJavaScript.png\" width=\"614\" height=\"480\" srcset=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/ToolbarJavaScript.png 614w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/ToolbarJavaScript-300x234.png 300w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/a><\/p>\n<pre class=\"lang:js decode:true\">var jsonObjectForEntries = {\r\n    \"terms\": [\r\n        { \"term\": \"children\" },\r\n        { \"term\": \"apples\" },\r\n        { \"term\": \"geese\" }\r\n    ]\r\n};\r\n\r\nfunction hideEntries() {\r\n    $('.GlossaryPageEntry').filter(function (index) {\r\n        var labelText = $(this).find('a').text();\r\n        var found = false;\r\n\r\n        for (var i = 0; i &lt; jsonObjectForEntries.terms.length; i++) {\r\n            if (jsonObjectForEntries.terms[i].term.toLowerCase() == labelText.toLowerCase()) { found = true; }\r\n        }\r\n        return found;\r\n    }).hide();\r\n}<\/pre>\n<p>The skin has a custom toolbar button called HideEntries. When that button is clicked, hideEntries() from the Toolbar JavaScript is fired.<\/p>\n<p><a href=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorToolbar.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-485\" alt=\"HTML5SkinEditorToolbar\" src=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorToolbar.png\" width=\"985\" height=\"568\" srcset=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorToolbar.png 985w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorToolbar-300x172.png 300w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorToolbar-624x359.png 624w\" sizes=\"(max-width: 985px) 100vw, 985px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorStyles.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-486\" alt=\"HTML5SkinEditorStyles\" src=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorStyles.png\" width=\"985\" height=\"568\" srcset=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorStyles.png 985w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorStyles-300x172.png 300w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/HTML5SkinEditorStyles-624x359.png 624w\" sizes=\"(max-width: 985px) 100vw, 985px\" \/><\/a><\/p>\n<p>The Glossary tab appears this way when initially viewed:<\/p>\n<p><a href=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabBefore.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-488\" alt=\"GlossaryTabBefore\" src=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabBefore.png\" width=\"559\" height=\"506\" srcset=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabBefore.png 559w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabBefore-300x271.png 300w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/a><\/p>\n<p>After the HideEntries toolbar button (the blank one) is clicked, the three terms in the JSON object are removed from the list.<\/p>\n<p><a href=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabAfter.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-489\" alt=\"GlossaryTabAfter\" src=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabAfter.png\" width=\"559\" height=\"506\" srcset=\"https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabAfter.png 559w, https:\/\/tregner.com\/flare-blog\/wp-content\/uploads\/2013\/03\/GlossaryTabAfter-300x271.png 300w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/a><\/p>\n<p>A sample project is here: <a href=\"http:\/\/tregner.com\/example-projects\/HideTerms.flprjzip\" target=\"_blank\">HideTerms.flprjzip<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This example uses JavaScript, JSON, and jQuery. In a response to a forum post, I suggested a rules-based approach to removing plural terms from the Glossary tab in Flare HTML5 output. The sample I provided tackled a few common English rules. Rules-based Example to Remove Glossary Tab Entries with JavaScript Rules are one way to&hellip; <a class=\"more-link\" href=\"https:\/\/tregner.com\/flare-blog\/hide-some-flare-html5-output-glossary-tab-entries\/\">Continue reading <span class=\"screen-reader-text\">Hide Some Flare HTML5 Output Glossary Tab Entries<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[63,49,61,60,5,62,64],"_links":{"self":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts\/479"}],"collection":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/comments?post=479"}],"version-history":[{"count":9,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts\/479\/revisions"}],"predecessor-version":[{"id":494,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/posts\/479\/revisions\/494"}],"wp:attachment":[{"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/media?parent=479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/categories?post=479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tregner.com\/flare-blog\/wp-json\/wp\/v2\/tags?post=479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}