<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Custom JavaScript Discussions Discussions on Obsidian Portal Community Forums</title>
      <link>https://forums.obsidianportal.com/categories/custom-javascript-discussions/feed.rss</link>
      <pubDate>Sat, 10 Oct 2026 23:35:17 +0000</pubDate>
         <description>Custom JavaScript Discussions Discussions on Obsidian Portal Community Forums</description>
   <language>en-CA</language>
   <atom:link href="https://forums.obsidianportal.com/categories/custom-javascript-discussions/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Grouped characters</title>
      <link>https://forums.obsidianportal.com/discussion/6929/grouped-characters</link>
      <pubDate>Sat, 03 Jan 2026 15:56:40 +0000</pubDate>
      <dc:creator>NimrodYanai</dc:creator>
      <guid isPermaLink="false">6929@/discussions</guid>
      <description><![CDATA[<p>I remember seeing a campaign where the DM managed to split the characters to more group types than PCs and NPCs.<br /><br />Does anyone have a simple script to do that? My campaign is starting to have too many characters and I want to be able to group them together.</p>
<p>Edit: Nevermind. I just now saw there is a built-in custom way to do this.</p>
]]></description>
   </item>
   <item>
      <title>So... I keep doing new dumb stuff</title>
      <link>https://forums.obsidianportal.com/discussion/6816/so-i-keep-doing-new-dumb-stuff</link>
      <pubDate>Tue, 06 Aug 2024 01:32:31 +0000</pubDate>
      <dc:creator>nuadaria</dc:creator>
      <guid isPermaLink="false">6816@/discussions</guid>
      <description><![CDATA[<p>This isn&#39;t javascript at all, but I wasn&#39;t sure where else to put this... I sort of took off with an idea from the discord cause I was bored and started a python based project to export character data to store in a standardized format that could be used to either back up or import into external systems like a VTT.<br /><br /><br /><br />This is still SUPER early days but since it now has a repo I thought I&#39;d share in case anyone wants to take a look/help out with the collosal&nbsp;effort of the mappings. In principle the main logic is set though I have a few nagging concerns and I&#39;m sure others will have ideas and suggestions since I&#39;m not a py programmer in the slightest bit at all.</p>
<p>The <a rel="nofollow" href="https://github.com/nuadaria/OP_Export" target="_blank">git repo</a>&nbsp;houses all the code to run, the structure of the associated mapping files and a link in the readme to the google sheet I am using to stub out the mapping files.</p>
]]></description>
   </item>
   <item>
      <title>Nested Accordions</title>
      <link>https://forums.obsidianportal.com/discussion/6558/nested-accordions</link>
      <pubDate>Fri, 12 May 2023 01:54:53 +0000</pubDate>
      <dc:creator>nuadaria</dc:creator>
      <guid isPermaLink="false">6558@/discussions</guid>
      <description><![CDATA[<p>For nested accordions on OP, feel free to use these two gists.</p>
<p><a href="https://gist.github.com/nuadaria/b09e6ee941b2dae25978975c1147a038" rel="noreferrer noopener nofollow" tabindex="0" target="_blank" title="https://gist.github.com/nuadaria/b09e6ee941b2dae25978975c1147a038">https://gist.github.com/nuadaria/b09e6ee941b2dae25978975c1147a038</a> <a href="https://gist.github.com/nuadaria/2dc07e3ad753bee47c48f246e09025ec" rel="noreferrer noopener nofollow" tabindex="0" target="_blank" title="https://gist.github.com/nuadaria/2dc07e3ad753bee47c48f246e09025ec">https://gist.github.com/nuadaria/2dc07e3ad753bee47c48f246e09025ec</a></p>
<p>&nbsp;</p>
<p>I linked these in discord as well a few others but I realized soem folks only visit the forums.</p>
]]></description>
   </item>
   <item>
      <title>How to Use the New Javascript</title>
      <link>https://forums.obsidianportal.com/discussion/6110/how-to-use-the-new-javascript</link>
      <pubDate>Thu, 24 Mar 2022 00:56:17 +0000</pubDate>
      <dc:creator>Keryth987</dc:creator>
      <guid isPermaLink="false">6110@/discussions</guid>
      <description><![CDATA[<p>So, cna someone please explain how to use this new capability? What goes in the JavaScript Box and what goes on the webpage?</p>
]]></description>
   </item>
   <item>
      <title>Discussion on Discord as well</title>
      <link>https://forums.obsidianportal.com/discussion/6111/discussion-on-discord-as-well</link>
      <pubDate>Thu, 24 Mar 2022 00:57:00 +0000</pubDate>
      <dc:creator>Keryth987</dc:creator>
      <guid isPermaLink="false">6111@/discussions</guid>
      <description><![CDATA[<p>Like these forums there is now a channel on the Discord to discuss the new Javascript capabilities</p>
]]></description>
   </item>
   <item>
      <title>Sortable tables script</title>
      <link>https://forums.obsidianportal.com/discussion/6202/sortable-tables-script</link>
      <pubDate>Tue, 24 May 2022 20:32:42 +0000</pubDate>
      <dc:creator>jodie</dc:creator>
      <guid isPermaLink="false">6202@/discussions</guid>
      <description><![CDATA[<p>(Yoinked from stack overflow mostly) - here&#39;s some stuff to make sortable tables:</p>
<p>In the template:</p>
<blockquote>
<p>&lt;div class=&quot;sortableTable&quot;&gt;</p>
<p>| *Name* | *Dangerousness* | *Description* |<br /><br />| Biscuit | 7 | a person who resembles a biscuit |<br /><br />| Ryder | 2 | a small child on a tiny quadbike |</p>
<p>&lt;/div&gt;</p>
</blockquote>
<p>In the CSS:<br /><br />&nbsp;</p>
<blockquote>
<p>div.sortableTable tr:first-child td {<br /><br />&nbsp; &nbsp;cursor: pointer;<br /><br />}</p>
</blockquote>
<p>In the javascript:</p>
<blockquote>
<p>const getCellValue = (tr, idx) =&gt; tr.children[idx].innerText || tr.children[idx].textContent;</p>
<p>const comparer = (idx, asc) =&gt; (a, b) =&gt; ((v1, v2) =&gt;&nbsp;<br /><br />&nbsp; &nbsp; v1 !== &#39;&#39; &amp;&amp; v2 !== &#39;&#39; &amp;&amp; !isNaN(v1) &amp;&amp; !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)<br /><br />&nbsp; &nbsp; )(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx));</p>
<p>// do the work...<br /><br />document.querySelectorAll(&#39;div.sortableTable tr:first-child td&#39;).forEach(th =&gt; th.addEventListener(&#39;click&#39;, (() =&gt; {<br /><br />&nbsp; &nbsp; const table = th.closest(&#39;table&#39;);<br /><br />&nbsp; &nbsp; Array.from(table.querySelectorAll(&#39;tr:nth-child(n+2)&#39;))<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; .sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc))<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; .forEach(tr =&gt; table.appendChild(tr) );<br /><br />})));</p>
</blockquote>
]]></description>
   </item>
   </channel>
</rss>