Skip to content

Instantly share code, notes, and snippets.

@rominf
Forked from gwash/tabcloseduplicates.penta
Last active August 29, 2015 14:12
Show Gist options
  • Save rominf/45073d424da3d388ccd2 to your computer and use it in GitHub Desktop.
Save rominf/45073d424da3d388ccd2 to your computer and use it in GitHub Desktop.
pentadactyl command to close duplicate tabs + anchors
com -d "Delete duplicate tabs" tabcloseduplicates,tabclosed -js let seen={},vtabs=tabs.visibleTabs,i=vtabs.length;while(i--){let loc=vtabs[i].linkedBrowser.contentDocument.location.href||"";if(Object.prototype.hasOwnProperty.call(seen, loc)){config.tabbrowser.removeTab(vtabs[i]);}else{seen[loc]=true;}}
com -d "Delete duplicate tabs (including tabs with different view of the same page, i.e. pages with anchors)" tabcloseduplicatesanchors,tabcloseda -js let seen={},vtabs=tabs.visibleTabs,i=vtabs.length;while(i--){let loc=vtabs[i].linkedBrowser.contentDocument.location.href.replace(/#[^#]*$/, '')||"";if(Object.prototype.hasOwnProperty.call(seen, loc)){config.tabbrowser.removeTab(vtabs[i]);}else{seen[loc]=true;}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment