Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure what's specifically causing the problem, as I couldn't reproduce it, but I see loads of issues with this code. I can't remember how MozRepl works, but this improved code should give you a nice org-mode friendly tab output. I hope this helps you, or whoever stumbles across this thread.</p> <pre class="lang-js prettyprint-override"><code>var bullet = "*"; // Org-mode bullet // two helper function to get title and url of tab function getTitle(tab) { var brower = gBrowser.getBrowserForTab(tab); var url = brower.currentURI.spec; var title = brower.contentTitle; return title; } function getUrl(tab) { var brower = gBrowser.getBrowserForTab(tab); var url = brower.currentURI.spec; var title = brower.contentTitle; return ":PROPERTIES:\n:URL:"+url+"\n:END:\n"; } // NOTE: we factor these string-generation functions out, // to make things a bit more clear function makeParentNodeOutput(tab, level) { return (Array(level+1).join(bullet) + " [+] " + getTitle(tab) + "\n" + getUrl(tab)); } function makeLeafNodeOutput(tab, level) { return (Array(level+1).join(bullet) + " " + getTitle(tab) + "\n" + getUrl(tab)); } // NOTE: we only need to handle parsing a collection of tabs // in once place, and we have a function for it here. function parseTabCollection(tabs, level) { var currentTab; var outputString = ""; for(var i = 0; i &lt; tabs.length; i++){ currentTab = tabs[i]; // For a parent node, we output the node and its children if(TreeStyleTabService.hasChildTabs(currentTab)){ outputString += makeParentNodeOutput(currentTab, level); outputString += parseTabCollection( TreeStyleTabService.getChildTabs(currentTab), level + 1 ); } else { outputString += makeLeafNodeOutput(currentTab, level); } } return outputString; } if ('TreeStyleTabService' in window){ //NOTE: Start with the rootTabs only. The old version started with // *all* tabs, which isn't what we want var orgModeOutput = parseTabCollection(TreeStyleTabService.rootTabs, 1); alert(orgModeOutput); } </code></pre> <p>I hope this helps somehow.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload