[
  {
    "path": "LICENSE_MIT.txt",
    "content": "Copyright (c) 2012 Isaiah Billingsley\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n\"Software\"), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
  },
  {
    "path": "README.md",
    "content": "Humble New Tab Page\r\n===================\r\n\r\nRedesigned new tab page featuring your bookmarks, apps, most visited, and recently closed in a custom layout.\r\n\r\n![](media/shot.1.png)\r\n\r\n### Features\r\n\r\n- Simple, clean design\r\n- Highly customizable\r\n- Fast loading and lightweight\r\n\r\n[Download for Chrome](https://chrome.google.com/webstore/detail/mfgdmpfihlmdekaclngibpjhdebndhdj)\r\n\r\n[Download for Firefox](https://addons.mozilla.org/firefox/addon/humble-new-tab/)\r\n\r\nThis extension replaces the default new tab page. Drag and drop folders to create new columns or reorder them. The font, colors, spacing, and more can be customized from the options menu.\r\n\r\n\r\nScreenshots\r\n-----------\r\n![](media/shot.2.png)\r\n![](media/shot.3.png)\r\n![](media/shot.4.png)\r\n![](media/shot.5.png)\r\n\r\n\r\nLicense\r\n-------\r\n\r\nThis project is licensed under the **MIT License**, see [LICENSE_MIT.txt](LICENSE_MIT.txt) for details.\r\n\r\n\r\nChangelog\r\n---------\r\n\r\n### Version 1.26.2 - April 9, 2025\r\n\r\n- (Firefox) Removed Favicon Kit and Qwant favicon providers, added Ecosia and Icon Horse\r\n\r\n### Version 1.26.1 - October 15, 2023\r\n\r\n- (Chrome) Fixed navigating to file:/// URLs (enable \"Allow access to file URLs\" in Manage Extensions > Details)\r\n- (Vivaldi) Hide bookmark separators\r\n\r\n### Version 1.26 - July 2, 2023\r\n\r\n- Added font-weight option\r\n- (Chrome) Replaced Apps folder with a link to chrome://apps\r\n- (Firefox) Set home page to new tab page (change in Firefox settings)\r\n- (Firefox) Updated Google favicon provider\r\n\r\n### Version 1.25 - March 11, 2023\r\n\r\n- Manifest V3\r\n- Updated favicon\r\n- (Firefox) Added Qwant and Yandex favicon providers\r\n\r\n### Version 1.24.2 - February 21, 2020\r\n\r\n- (Firefox) Added DuckDuckGo favicon provider\r\n\r\n### Version 1.24.1 - May 14, 2019\r\n\r\n- (Firefox) Set addon ID for consistent page URL\r\n\r\n### Version 1.24 - February 10, 2019\r\n\r\n- Temporarily disabled weather feature\r\n- Improved keyboard navigation\r\n- Fixed bug opening options\r\n- (Firefox) Changed extension name to HNTP\r\n- (Firefox) Fixed broken favicons\r\n- (Firefox) Fixed context menu not opening\r\n\r\n### Version 1.23.3 - December 3, 2018\r\n\r\n- (Firefox) Fixed folder closing animation\r\n\r\n### Version 1.23.1 - December 2, 2018\r\n\r\n- (Firefox) Removed unused \"management\" permission\r\n\r\n### Version 1.23 - December 2, 2018\r\n\r\n- Added tooltips for truncated text\r\n- Added option to remember open folders\r\n- (Firefox) Added option for favicon provider\r\n\r\n### Version 1.22 - October 15, 2017\r\n\r\n- Firefox support\r\n\r\n### Version 1.21 - November 20, 2016\r\n\r\n- Added HiDPI icons\r\n- Fixed export settings not selectable\r\n\r\n### Version 1.20 - June 1, 2016\r\n\r\n- Added import/export settings\r\n- Fixed recently closed max items\r\n\r\n### Version 1.19 - April 14, 2016\r\n\r\n- Fixed weather not updating\r\n\r\n### Version 1.18 - April 3, 2016\r\n\r\n- Removed geolocation\r\n- Fixed weather error\r\n\r\n### Version 1.17 - January 24, 2016\r\n\r\n- Fixed weather error\r\n\r\n### Version 1.16 - August 29, 2014\r\n\r\n- Added other devices folder\r\n- Recently closed tabs preserve history\r\n- Removed background process\r\n- Chrome version 37 or later required\r\n\r\n### Version 1.15 - July 6, 2014\r\n\r\n- Fixed freezing issues\r\n\r\n### Version 1.14 - May 11, 2014\r\n\r\n- Reduced memory usage\r\n- Added option to set number of items for recently closed, recent bookmarks, and most visited\r\n- Added option for background image size\r\n- Added link to bookmark manager in folder context menu\r\n\r\n### Version 1.12 - August 18, 2013\r\n\r\n- Reorder apps via drag and drop\r\n\r\n### Version 1.11 - August 3, 2013\r\n\r\n- Fixed launching packaged apps (Google Keep)\r\n- Fixed launching file:/// and chrome:// URLs\r\n- Fixed Mobile Bookmarks folder not being removable\r\n- Disable weather if geolocation is denied\r\n- Default layout changed to 2 columns\r\n- Uninstall apps from the context menu\r\n- Hide Google Wallet Service from apps\r\n\r\n### Version 1.9 - December 30, 2012\r\n\r\n- Uses geolocation for weather by default\r\n- Fixed bug with drag and drop\r\n- Added Chrome Web Store to apps\r\n\r\n### Version 1.8 - November 9, 2012\r\n\r\n- Redesigned options panel\r\n- Added several new settings\r\n- Performance tweaks\r\n- Source code released under the MIT license\r\n\r\n### Version 1.7 - September 8, 2012\r\n\r\n- Added custom CSS field for advanced users\r\n- Added option to hide Bookmarks bar and Other bookmarks\r\n\r\n### Version 1.6 - August 30, 2012\r\n\r\n- Added option to open links in new tabs\r\n- Support local file for background image\r\n- Weather errors fixed\r\n\r\n### Version 1.5 - August 29, 2012\r\n\r\n- Weather forecast now uses Yahoo\r\n- System font list enabled on supported versions\r\n\r\n### Version 1.4 - August 10, 2012\r\n\r\n- Added option to disable the weather and other special folders\r\n- Minor bug fixes\r\n\r\n### Version 1.3 - August 9, 2012\r\n\r\n- Fixed error on old Chrome versions\r\n\r\n### Version 1.2 - August 8, 2012\r\n\r\n- Added apps, most visited, recently closed, and weather\r\n- More flexible layout with unlimited columns\r\n- Open all links in folder from context menu\r\n- Color themes and new default style\r\n- Added smooth animation and highlight shadow\r\n- Drag and drop to reorder folders and columns\r\n- Background image support\r\n- Bug fixes\r\n- New name (formerly New Tab + Bookmark Tree)\r\n\r\n### Version 1.1 - July 20, 2011\r\n\r\n- Added options menu\r\n\r\n### Version 1.0 - July 17, 2011\r\n\r\n- Initial release\r\n"
  },
  {
    "path": "icons/LICENSE_chromium_BSD.txt",
    "content": "Copyright (c) 2012 The Chromium Authors. All rights reserved.\r\n\r\nRedistribution and use in source and binary forms, with or without\r\nmodification, are permitted provided that the following conditions are\r\nmet:\r\n\r\n* Redistributions of source code must retain the above copyright\r\nnotice, this list of conditions and the following disclaimer.\r\n* Redistributions in binary form must reproduce the above\r\ncopyright notice, this list of conditions and the following disclaimer\r\nin the documentation and/or other materials provided with the\r\ndistribution.\r\n* Neither the name of Google Inc. nor the names of its\r\ncontributors may be used to endorse or promote products derived from\r\nthis software without specific prior written permission.\r\n\r\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  },
  {
    "path": "manifest.json",
    "content": "{\r\n\t\"name\": \"Humble New Tab Page\",\r\n\t\"short_name\": \"HNTP\",\r\n\t\"version\": \"1.26.2\",\r\n\t\"minimum_chrome_version\": \"104\",\r\n\t\"manifest_version\": 3,\r\n\t\"description\": \"Redesigned new tab page featuring your bookmarks, apps, most visited, and recently closed in a custom layout.\",\r\n\t\"icons\": {\r\n\t\t\"128\": \"icons/icon_128.png\",\r\n\t\t\"48\": \"icons/icon_48.png\",\r\n\t\t\"16\": \"icons/icon_16.png\"\r\n\t},\r\n\t\"permissions\": [\r\n\t\t\"bookmarks\",\r\n\t\t\"favicon\",\r\n\t\t\"topSites\",\r\n\t\t\"tabs\",\r\n\t\t\"fontSettings\",\r\n\t\t\"sessions\"\r\n\t],\r\n\t\"optional_host_permissions\": [\r\n\t\t\"file:///\"\r\n\t],\r\n\t\"chrome_url_overrides\": {\r\n\t\t\"newtab\": \"newtab.html\"\r\n\t},\r\n\t\"options_ui\": {\r\n\t\t\"page\": \"newtab.html?options\",\r\n\t\t\"open_in_tab\": true\r\n\t}\r\n}\r\n"
  },
  {
    "path": "newtab.css",
    "content": "body {\r\n\tbackground-color: #FFF;\r\n\tbackground-attachment: fixed;\r\n\tbackground-position: left top;\r\n\twidth: 100vw;\r\n\tmargin: 0 auto;\r\n\toverflow-x: hidden;\r\n\tfont-family: sans-serif;\r\n\tfont-size: 62.5%;\r\n\tline-height: 1;\r\n}\r\n#main {\r\n\twidth: 80%;\r\n\tmargin: 5% auto 0;\r\n\tposition: relative;\r\n\tmax-width: 100%;\r\n\twhite-space: nowrap;\r\n\tuser-select: none;\r\n}\r\n#main ul, .menu {\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\tlist-style: none;\r\n}\r\n#main a + ul, #main a + div {\r\n\tpadding-left: 24px;\r\n}\r\n#main a {\r\n\tbox-sizing: border-box;\r\n\tmax-width: 100%;\r\n\tdisplay: inline-block;\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n\tfont-size: 1.6em;\r\n\tline-height: 2;\r\n\ttext-decoration: none;\r\n\tcolor: #555;\r\n\tpadding: 0 .8em;\r\n\tborder-radius: .2em;\r\n\tcursor: pointer;\r\n\ttransition-property: color, background-color, box-shadow, opacity;\r\n\ttransition-duration: 0.2s;\r\n\ttransition-timing-function: ease-out;\r\n}\r\n#main a:hover {\r\n\tcolor: #000;\r\n\tbackground-color: #E4F4FF;\r\n\tbox-shadow: 0 0 7px #57B0FF;\r\n}\r\n.icon {\r\n\tdisplay: inline-block;\r\n\twidth: 16px;\r\n\theight: 16px;\r\n\tmargin: -3px .4em 0 0;\r\n\tbackground-size: 100% 100%;\r\n\tvertical-align: middle;\r\n}\r\n#main a:after {\r\n\t/* workaround Chromium issue 142154 */\r\n\tcontent: '';\r\n\tdisplay: inline-block;\r\n\twidth: 2px;\r\n\tmargin-left: -2px;\r\n}\r\n.wrap {\r\n\ttransition-property: height, opacity;\r\n\ttransition-duration: 0.2s;\r\n\ttransition-timing-function: ease-out;\r\n}\r\n.column {\r\n\tdisplay: inline-block;\r\n\tvertical-align: top;\r\n\tbox-sizing: border-box;\r\n\tpadding: 10px 0 20px 0;\r\n\tmin-height: 300px;\r\n}\r\n#main .empty {\r\n\topacity: 0.5;\r\n}\r\n.menu {\r\n\tposition: absolute;\r\n\twhite-space: nowrap;\r\n\tfont-size: 1.2em;\r\n\tline-height: 2;\r\n\tbackground-color: #FAFAFA;\r\n\tborder: solid 1px #999;\r\n\tborder-radius: 3px;\r\n\tbox-shadow: 1px 2px 3px rgba(0, 0, 0, 0.3);\r\n}\r\n.menu a {\r\n\tdisplay: block;\r\n\ttext-decoration: none;\r\n\tcolor: #000;\r\n\tpadding: 0 2em;\r\n\tcursor: default;\r\n}\r\n.menu a:hover {\r\n\tbackground-color: #E4F4FF;\r\n\tborder: solid 1px #57B0FF;\r\n\tmargin: -1px;\r\n\tposition: relative;\r\n}\r\n.menu li:first-child a {\r\n\tborder-top-left-radius: 3px;\r\n\tborder-top-right-radius: 3px;\r\n}\r\n.menu li:last-child a {\r\n\tborder-bottom-left-radius: 3px;\r\n\tborder-bottom-right-radius: 3px;\r\n}\r\n.menu hr {\r\n\tmargin: 0;\r\n\tborder: solid #CCC;\r\n\tborder-width: 1px 0 0 0;\r\n}\r\n.dragstart {\r\n\topacity: 0.5;\r\n}\r\n.hide-focus :focus {\r\n\toutline: none;\r\n}\r\n#options, #options_button {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tright: 0;\r\n}\r\n#options {\r\n\tdisplay: none;\r\n\tfont-size: 1.4em;\r\n\tcolor: #000;\r\n\tborder: solid #999;\r\n\tborder-width: 0 0 1px 1px;\r\n\tborder-bottom-left-radius: 3px;\r\n\tbox-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);\r\n\tmin-width: 32em;\r\n\tmin-height: 10em;\r\n}\r\n#options_nav {\r\n\tposition: absolute;\r\n\twidth: 10em;\r\n\ttop: -1px;\r\n\tbottom: 0;\r\n\tbackground-color: #EEE;\r\n\tlist-style: none;\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\tborder-right: solid 1px #ccc;\r\n}\r\n#options_nav a {\r\n\tdisplay: block;\r\n\tpadding: 1em 2em;\r\n\ttext-decoration: none;\r\n\tcolor: inherit;\r\n\tborder: solid transparent;\r\n\tborder-width: 1px 0;\r\n\tcursor: pointer;\r\n}\r\n#options_nav a:hover {\r\n\tbackground-color: #E4F4FF;\r\n\toutline: solid thin #57B0FF;\r\n}\r\n#options_nav a.current {\r\n\tcolor: #000;\r\n\tbackground-color: #FAFAFA;\r\n\tborder-color: #CCC;\r\n\tmargin-right: -1px;\r\n\toutline: none;\r\n}\r\n#options .section {\r\n\tmargin-left: 10em;\r\n\tmargin-top: -1px;\r\n\tpadding: 1px 0;\r\n\tbackground-color: #FAFAFA;\r\n\tdisplay: none;\r\n}\r\n#options .section.current {\r\n\tdisplay: block;\r\n}\r\n#options_button {\r\n\tbackground: transparent no-repeat center center;\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\topacity: 0.6;\r\n\tcursor: pointer;\r\n}\r\n#options_button:hover {\r\n\topacity: 1;\r\n}\r\n#options_close_button {\r\n\tcolor: #000;\r\n\ttext-align: center;\r\n\ttext-decoration: none;\r\n\tfont-size: 1.4em;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tdisplay: block;\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tline-height: 32px;\r\n\tcursor: pointer;\r\n}\r\nlegend {\r\n\tcolor: #888;\r\n}\r\nfieldset {\r\n\tborder: none;\r\n\tmargin: 1em .5em 1em 2em;\r\n\tpadding: .5em 0 0;\r\n}\r\nlabel {\r\n\tdisplay: block;\r\n\tfont-size: 0.85em;\r\n\ttext-align: right;\r\n\tmargin: 0 0 .1em 1.4em;\r\n\tclear: left;\r\n}\r\nlabel span {\r\n\tfloat: left;\r\n\ttext-align: left;\r\n\tline-height: 1.9;\r\n}\r\ninput, select, textarea, .revert {\r\n\twidth: 9em;\r\n\tmargin: 0 0 0 .5em;\r\n\tbox-sizing: border-box;\r\n\tvertical-align: middle;\r\n}\r\ntextarea {\r\n\twidth: 20em;\r\n\theight: 16em;\r\n\tfont-size: 1.1em;\r\n\tfont-family: monospace;\r\n\tvertical-align: top;\r\n\tfloat: left;\r\n}\r\ninput.color {\r\n\twidth: 6em;\r\n\tfont-family: monospace;\r\n}\r\ninput[type=\"checkbox\"] {\r\n\twidth: 1.2em;\r\n}\r\ninput[type=color] {\r\n\twidth: 3em;\r\n\tmargin: 0;\r\n}\r\ninput[type=\"color\"]::-webkit-color-swatch-wrapper {\r\n\tpadding: 0 1px;\r\n}\r\ninput[type=\"file\"]::-webkit-file-upload-button {\r\n\twidth: 100%;\r\n}\r\n.subopt {\r\n\tmargin: 0 0 .8em 2.5em;\r\n}\r\n.subopt input {\r\n\twidth: 4em;\r\n}\r\n.revert {\r\n\tdisplay: inline-block;\r\n\twidth: 18px;\r\n\theight: 16px;\r\n\topacity: .5;\r\n\tbackground-image: -webkit-image-set(url(\"icons/revert.png\") 1x, url(\"icons/revert@2x.png\") 2x);\r\n\tbackground-size: 100%;\r\n\tcursor: pointer;\r\n}\r\n.revert:hover {\r\n\topacity: 1;\r\n}\r\n.folder .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/folder.png\") 1x, url(\"icons/folder@2x.png\") 2x);\r\n}\r\n.open .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/folder_open.png\") 1x, url(\"icons/folder_open@2x.png\") 2x);\r\n}\r\n.empty .icon {\r\n\tdisplay: none;\r\n}\r\n/* The following icons are copyright (c) 2012 The Chromium Authors.\r\n   see LICENSE_chromium_BSD.txt */\r\n.recent .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/recent.png\") 1x, url(\"icons/recent@2x.png\") 2x);\r\n}\r\n.top .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/top.png\") 1x, url(\"icons/top@2x.png\") 2x);\r\n}\r\n.closed .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/closed.png\") 1x, url(\"icons/closed@2x.png\") 2x);\r\n}\r\n.window .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/window.png\") 1x, url(\"icons/window@2x.png\") 2x);\r\n}\r\n.devices .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/phone.png\") 1x, url(\"icons/phone@2x.png\") 2x);\r\n}\r\n.error .icon {\r\n\tbackground-image: -webkit-image-set(url(\"icons/error.png\") 1x, url(\"icons/error@2x.png\") 2x);\r\n}\r\n#options_button {\r\n\tbackground-image: -webkit-image-set(url(\"icons/options.png\") 1x, url(\"icons/options@2x.png\") 2x);\r\n}\r\n"
  },
  {
    "path": "newtab.html",
    "content": "<!doctype html>\r\n<html>\r\n<head>\r\n<meta charset=\"utf-8\" />\r\n<title>New Tab</title>\r\n<link rel=\"stylesheet\" href=\"newtab.css\">\r\n<link rel=\"icon\" href=\"icons/icon_16.png\">\r\n</head>\r\n<body>\r\n<div id=\"main\">\r\n</div>\r\n<a id=\"options_button\" title=\"Options\" tabindex=\"0\"></a>\r\n<div id=\"options\">\r\n\t<a id=\"options_close_button\" title=\"Close\" tabindex=\"0\">&times;</a>\r\n\t<ul id=\"options_nav\">\r\n\t\t<li><a class=\"current\" tabindex=\"0\">Settings</a></li>\r\n\t\t<li><a tabindex=\"0\">Appearance</a></li>\r\n\t\t<li><a tabindex=\"0\">Import/Export</a></li>\r\n\t\t<li><a tabindex=\"0\">Advanced</a></li>\r\n\t</ul>\r\n\t<div class=\"section current\">\r\n\t<fieldset>\r\n\t\t<legend>Settings</legend>\r\n\t\t<label><span>Open links in</span><select id=\"options_newtab\">\r\n\t\t\t<option value=\"0\">Current tab</option>\r\n\t\t\t<option value=\"1\">New tab</option>\r\n\t\t\t<option value=\"2\">New tab (background)</option>\r\n\t\t</select></label>\r\n\t\t<label><span>Lock columns</span><input id=\"options_lock\" type=\"checkbox\"/></label>\r\n\t\t<label><span>Remember open folders</span><input id=\"options_remember_open\" type=\"checkbox\"/></label>\r\n\t\t<label><span>Auto-close folders</span><input id=\"options_auto_close\" type=\"checkbox\"/></label>\r\n\t\t<label><span>Show top-level folders</span><input id=\"options_show_root\" type=\"checkbox\"/></label>\r\n\t\t<label><span>Hide options button</span><input id=\"options_hide_options\" type=\"checkbox\"/></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Content</legend>\r\n\t\t<label><span>Apps</span><input id=\"options_show_apps\" type=\"checkbox\"/></label>\r\n\t\t<div id=\"options_show_bookmarks\"></div>\r\n\t\t<label><span>Most visited</span><input id=\"options_show_top\" type=\"checkbox\"/></label>\r\n\t\t<label class=\"subopt\"><span>Number of items</span><input id=\"options_number_top\" type=\"number\" min=\"1\" max=\"10\"/></label>\r\n\t\t<label><span>Recent bookmarks</span><input id=\"options_show_recent\" type=\"checkbox\"/></label>\r\n\t\t<label class=\"subopt\"><span>Number of items</span><input id=\"options_number_recent\" type=\"number\" min=\"1\" max=\"1000\"/></label>\r\n\t\t<label><span>Recently closed</span><input id=\"options_show_closed\" type=\"checkbox\"/></label>\r\n\t\t<label class=\"subopt\"><span>Number of items</span><input id=\"options_number_closed\" type=\"number\" min=\"1\" max=\"25\"/></label>\r\n\t\t<label><span>Other devices</span><input id=\"options_show_devices\" type=\"checkbox\"/></label>\r\n\t</fieldset>\r\n\t</div><div class=\"section\">\r\n\t<fieldset>\r\n\t\t<legend>Font</legend>\r\n\t\t<label><span>Font</span><input id=\"options_font\" type=\"text\"/></label>\r\n\t\t<label><span>Size</span><input id=\"options_font_size\" type=\"number\" min=\"6\" max=\"100\"/></label>\r\n\t\t<label><span>Weight</span><select id=\"options_font_weight\">\r\n\t\t\t<option value=\"100\">Thin</option>\r\n\t\t\t<option value=\"200\">Extra Light</option>\r\n\t\t\t<option value=\"300\">Light</option>\r\n\t\t\t<option value=\"400\">Regular</option>\r\n\t\t\t<option value=\"500\">Medium</option>\r\n\t\t\t<option value=\"600\">Semi Bold</option>\r\n\t\t\t<option value=\"700\">Bold</option>\r\n\t\t\t<option value=\"800\">Extra Bold</option>\r\n\t\t\t<option value=\"900\">Heavy</option>\r\n\t\t</select></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Colors</legend>\r\n\t\t<label><span>Theme</span><select id=\"options_theme\"></select></label>\r\n\t\t<label><span>Text</span><input id=\"options_font_color\" type=\"color\"/></label>\r\n\t\t<label><span>Background</span><input id=\"options_background_color\" type=\"color\"/></label>\r\n\t\t<label><span>Highlight</span><input id=\"options_highlight_color\" type=\"color\"/></label>\r\n\t\t<label><span>Highlight text</span><input id=\"options_highlight_font_color\" type=\"color\"/></label>\r\n\t\t<label><span>Shadow</span><input id=\"options_shadow_color\" type=\"color\"/></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Layout</legend>\r\n\t\t<label><span>Item spacing</span><input id=\"options_spacing\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t\t<label><span>Top margin</span><input id=\"options_v_margin\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t\t<label><span>Column width</span><input id=\"options_width\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t\t<label><span>Align</span><input id=\"options_h_pos\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t\t<label><span>Scale with window size</span><input id=\"options_auto_scale\" type=\"checkbox\"/></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Highlight</legend>\r\n\t\t<label><span>Shadow size</span><input id=\"options_shadow_blur\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t\t<label><span>Corner roundness</span><input id=\"options_highlight_round\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Animation</legend>\r\n\t\t<label><span>Highlight fade time</span><input id=\"options_fade\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t\t<label><span>Folder open time</span><input id=\"options_slide\" type=\"range\" min=\"0\" max=\"2\" step=\"0.001\"/></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Background image</legend>\r\n\t\t<label><span>URL</span><input id=\"options_background_image\" type=\"url\" placeholder=\"http://\"/></label>\r\n\t\t<label><span>Local file</span><input id=\"options_background_image_file\" type=\"file\" accept=\"image/*\"/></label>\r\n\t\t<label><span>Size</span><select id=\"options_background_size\">\r\n\t\t\t<option value=\"auto\">Original</option>\r\n\t\t\t<option value=\"cover\">Full</option>\r\n\t\t\t<option value=\"contain\">Best fit</option>\r\n\t\t</select></label>\r\n\t\t<label><span>Align</span><select id=\"options_background_align\">\r\n\t\t\t<option value=\"left top\">Top left</option>\r\n\t\t\t<option value=\"top\">Top</option>\r\n\t\t\t<option value=\"right top\">Top right</option>\r\n\t\t\t<option value=\"left\">Left</option>\r\n\t\t\t<option value=\"center\">Center</option>\r\n\t\t\t<option value=\"right\">Right</option>\r\n\t\t\t<option value=\"left bottom\">Bottom left</option>\r\n\t\t\t<option value=\"bottom\">Bottom</option>\r\n\t\t\t<option value=\"right bottom\">Bottom right</option>\r\n\t\t</select></label>\r\n\t\t<label><span>Tiling</span><select id=\"options_background_repeat\">\r\n\t\t\t<option value=\"repeat\">Tile</option>\r\n\t\t\t<option value=\"repeat-x\">Horizontal</option>\r\n\t\t\t<option value=\"repeat-y\">Vertical</option>\r\n\t\t\t<option value=\"no-repeat\">None</option>\r\n\t\t</select></label>\r\n\t</fieldset>\r\n\t</div><div class=\"section\">\r\n\t<fieldset>\r\n\t\t<legend>Export Settings</legend>\r\n\t\t<label><textarea id=\"options_export\" readonly></textarea></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Import Settings</legend>\r\n\t\t<label><textarea id=\"options_import\"></textarea></label>\r\n\t</fieldset>\r\n\t</div><div class=\"section\">\r\n\t<fieldset>\r\n\t\t<legend>Generated CSS</legend>\r\n\t\t<label><textarea id=\"all_css\" readonly></textarea></label>\r\n\t</fieldset>\r\n\t<fieldset>\r\n\t\t<legend>Custom CSS</legend>\r\n\t\t<label><textarea id=\"options_css\"></textarea></label>\r\n\t</fieldset>\r\n\t</div>\r\n</div>\r\n<script src=\"newtab.js\"></script>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "newtab.js",
    "content": "'use strict';\r\n\r\n// render a single bookmark node\r\nfunction render(node, target) {\r\n\tif (node.description == 'separator') return;\r\n\r\n\tvar li = document.createElement('li');\r\n\tvar a = document.createElement('a');\r\n\r\n\tvar url = node.url;\r\n\tif (url)\r\n\t\ta.href = url;\r\n\telse\r\n\t\ta.tabIndex = 0;\r\n\r\n\tvar text = node.title || node.name || '';\r\n\tif (!text && node.title === null) text = node.url || '';\r\n\ta.innerText = text;\r\n\r\n\tif (node.tooltip) a.title = node.tooltip;\r\n\tsetClass(a, node);\r\n\r\n\ta.insertBefore(getIcon(node), a.firstChild);\r\n\r\n\tif (node.action) {\r\n\t\ta.onclick = function(event) {\r\n\t\t\treturn node.action(event);\r\n\t\t};\r\n\t} else if (url) {\r\n\t\tvar newtab = getConfig('newtab');\r\n\t\tif (newtab == 1) {\r\n\t\t\t// new foreground tab\r\n\t\t\ta.target = '_blank';\r\n\t\t} else if (newtab == 2) {\r\n\t\t\t// new background tab\r\n\t\t\ta.onclick = function(e) {\r\n\t\t\t\topenLink(node, newtab);\r\n\t\t\t\treturn false;\r\n\t\t\t};\r\n\t\t}\r\n\t\t// fix opening chrome:// and file:/// urls\r\n\t\tvar urlStart = url.substring(0, 6);\r\n\t\tif (urlStart === 'chrome' || urlStart === 'file:/'){\r\n\t\t\ta.onclick = function(e) {\r\n\t\t\t\topenLink(node, newtab || (e.ctrlKey ? 2 : 0));\r\n\t\t\t\treturn false;\r\n\t\t\t};\r\n\t\t\ta.onauxclick = function(e) {\r\n\t\t\t\tif (e.button == 1) {\r\n\t\t\t\t\topenLink(node, 2);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (!node.children)\r\n\t\ta.style.pointerEvents = 'none';\r\n\r\n\tli.appendChild(a);\r\n\r\n\t// folder\r\n\tif (node.children) {\r\n\t\t// render children\r\n\t\tif (a.open || getConfig('remember_open') && localStorage.getItem('open.' + node.id)) {\r\n\t\t\tsetClass(a, node, true);\r\n\t\t\ta.open = true;\r\n\t\t\tgetChildrenFunction(node)(function(result) {\r\n\t\t\t\trenderAll(result, li);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// click handlers\r\n\t\taddFolderHandlers(node, a);\r\n\t\tenableDragFolder(node, a);\r\n\r\n\t} else if (node.id == 'apps')\r\n\t\tenableDragFolder(node, a);\r\n\r\n\ttarget.appendChild(li);\r\n\treturn li;\r\n}\r\n\r\n// render an array of bookmark nodes\r\nfunction renderAll(nodes, target, toplevel) {\r\n\tvar ul = document.createElement('ul');\r\n\tfor (var i = 0; i < nodes.length; i++) {\r\n\t\tvar node = nodes[i];\r\n\t\t// skip extensions and duplicated child folders\r\n\t\tif (toplevel || !coords[node.id])\r\n\t\t\trender(node, ul);\r\n\t}\r\n\tif (ul.childNodes.length === 0)\r\n\t\trender({ id: 'empty', title: '< Empty >' }, ul);\r\n\tif (toplevel)\r\n\t\ttarget.appendChild(ul);\r\n\telse {\r\n\t\t// wrap child ul for animation\r\n\t\tvar wrap = document.createElement('div');\r\n\t\twrap.appendChild(ul);\r\n\t\ttarget.appendChild(wrap);\r\n\t}\r\n\tupdateTooltips();\r\n\treturn ul;\r\n}\r\n\r\n// render column with given index\r\nfunction renderColumn(index, target) {\r\n\tvar ids = columns[index];\r\n\tif (ids.length == 1 && !getConfig('show_root'))\r\n\t\tgetChildrenFunction({id: ids[0]})(function(result) {\r\n\t\t\trenderAll(result, target);\r\n\t\t\taddColumnHandlers(index, target);\r\n\t\t});\r\n\telse if (ids.length > 0) {\r\n\t\tvar i = 0;\r\n\t\tvar nodes = [];\r\n\t\t// get all nodes for column\r\n\t\tvar callback = function(result) {\r\n\t\t\tfor (var j = 0; j < result.length; j++)\r\n\t\t\t\tnodes.push(result[j]);\r\n\t\t\ti++;\r\n\t\t\tif (i < ids.length)\r\n\t\t\t\tgetSubTree(ids[i], callback);\r\n\t\t\telse {\r\n\t\t\t\t// render node list\r\n\t\t\t\trenderAll(nodes, target, true);\r\n\t\t\t\taddColumnHandlers(index, target);\r\n\t\t\t}\r\n\t\t};\r\n\t\tgetSubTree(ids[i], callback);\r\n\t}\r\n}\r\n\r\n// render all columns to main div\r\nfunction renderColumns() {\r\n\t// clear main div\r\n\tvar target = document.getElementById('main');\r\n\twhile (target.hasChildNodes())\r\n\t\ttarget.removeChild(target.lastChild);\r\n\r\n\t// render columns\r\n\tfor (var i = 0; i < columns.length; i++) {\r\n\t\tvar column = document.createElement('div');\r\n\t\tcolumn.className = 'column';\r\n\t\tcolumn.style.width = (1 / columns.length) * 100 + '%';\r\n\r\n\t\t// enable drag and drop\r\n\t\tenableDragColumn(i, column);\r\n\r\n\t\ttarget.appendChild(column);\r\n\t\trenderColumn(i, column);\r\n\t}\r\n\r\n\tenableDragDrop();\r\n}\r\n\r\n// enables click and context menu for given folder\r\nfunction addFolderHandlers(node, a) {\r\n\t// click handler\r\n\ta.onclick = function() {\r\n\t\ttoggle(node, a, getChildrenFunction(node));\r\n\t\treturn false;\r\n\t};\r\n\r\n\t// context menu handler\r\n\tvar items = getMenuItems(node);\r\n\r\n\t// column layout items\r\n\tif (!getConfig('lock')) {\r\n\t\titems.push(null);// spacer\r\n\t\titems.push({\r\n\t\t\tlabel: 'Create new column',\r\n\t\t\taction: function() {\r\n\t\t\t\taddColumn([node.id]);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (coords[node.id]) {\r\n\t\t\tvar pos = coords[node.id];\r\n\t\t\tif (pos.y > 0)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Move folder up',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\taddRow(node.id, pos.x, pos.y - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\tif (pos.y < columns[pos.x].length - 1)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Move folder down',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\taddRow(node.id, pos.x, pos.y + 2);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\tif (pos.x > 0)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Move folder left',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\taddRow(node.id, pos.x - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\tif (pos.x < columns.length - 1)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Move folder right',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\taddRow(node.id, pos.x + 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\tif (root.indexOf(node.id) < 0)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Remove folder',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\tremoveRow(pos.x, pos.y);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\ta.oncontextmenu = function(event) {\r\n\t\trenderMenu(items, event.pageX, event.pageY);\r\n\t\treturn false;\r\n\t};\r\n}\r\n\r\n// enables context menu for given column\r\nfunction addColumnHandlers(index, ul) {\r\n\tvar items = [];\r\n\tvar ids = columns[index];\r\n\r\n\t// single folder items\r\n\tif (ids.length == 1)\r\n\t\titems = getMenuItems({id: ids[0]});\r\n\r\n\t// column layout items\r\n\tif (!getConfig('lock') && columns.length > 1) {\r\n\t\titems.push(null);// spacer\r\n\t\tif (index > 0)\r\n\t\t\titems.push({\r\n\t\t\t\tlabel: 'Move column left',\r\n\t\t\t\taction: function() {\r\n\t\t\t\t\taddColumn(ids, index - 1);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\tif (index < columns.length - 1)\r\n\t\t\titems.push({\r\n\t\t\t\tlabel: 'Move column right',\r\n\t\t\t\taction: function() {\r\n\t\t\t\t\taddColumn(ids, index + 2);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\titems.push({\r\n\t\t\tlabel: 'Remove column',\r\n\t\t\taction: function() {\r\n\t\t\t\tremoveColumn(index);\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (ids.length == 1) {\r\n\t\t\tif (index > 0)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Move folder left',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\taddRow(ids[0], index - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\tif (index < columns.length - 1)\r\n\t\t\t\titems.push({\r\n\t\t\t\t\tlabel: 'Move folder right',\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\taddRow(ids[0], index + 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tif (items.length > 0)\r\n\t\tul.oncontextmenu = function(event) {\r\n\t\t\tif (event.target.tagName == 'A' || event.target.parentNode.tagName == 'A')\r\n\t\t\t\treturn true;\r\n\t\t\trenderMenu(items, event.pageX, event.pageY);\r\n\t\t\treturn false;\r\n\t\t};\r\n}\r\n\r\n// gets context menu items for given node\r\nfunction getMenuItems(node) {\r\n\tvar items = [];\r\n\t\titems.push({\r\n\t\t\tlabel: 'Open all links in folder',\r\n\t\t\taction: function() {\r\n\t\t\t\topenLinks(node);\r\n\t\t\t}\r\n\t\t});\r\n\tif (node.id == 'closed')\r\n\t\titems.push({\r\n\t\t\tlabel: 'Clear browsing data',\r\n\t\t\taction: function() {\r\n\t\t\t\topenLink({ url: 'chrome://settings/clearBrowserData' }, 1);\r\n\t\t\t}\r\n\t\t});\r\n\tif (node.id == 'devices')\r\n\t\titems.push({\r\n\t\t\tlabel: 'History',\r\n\t\t\taction: function() {\r\n\t\t\t\topenLink({ url: 'chrome://history' }, 1);\r\n\t\t\t}\r\n\t\t});\r\n\tif (Number(node.id))\r\n\t\titems.push({\r\n\t\t\tlabel: 'Edit bookmarks',\r\n\t\t\taction: function() {\r\n\t\t\t\topenLink({ url: 'chrome://bookmarks/?id=' + node.id }, 1);\r\n\t\t\t}\r\n\t\t});\r\n\treturn items;\r\n}\r\n\r\n// wraps click handler for menu items\r\nfunction onMenuClick(item) {\r\n\treturn function() {\r\n\t\titem.action();\r\n\t\treturn false;\r\n\t};\r\n}\r\n\r\n// renders a popup menu at given coordinates\r\nfunction renderMenu(items, x, y) {\r\n\tvar ul = document.createElement('ul');\r\n\tul.className = 'menu';\r\n\tfor (var i = 0; i < items.length; i++) {\r\n\t\tvar li = document.createElement('li');\r\n\t\tif (items[i]) {\r\n\t\t\tvar a = document.createElement('a');\r\n\t\t\ta.innerText = items[i].label;\r\n\t\t\ta.tabIndex = 0;\r\n\t\t\ta.onclick = onMenuClick(items[i]);\r\n\r\n\t\t\tli.appendChild(a);\r\n\t\t} else if (i > 0 && i < items.length - 1)\r\n\t\t\tli.appendChild(document.createElement('hr'));\r\n\t\telse\r\n\t\t\tcontinue;\r\n\r\n\t\tul.appendChild(li);\r\n\t}\r\n\tdocument.body.appendChild(ul);\r\n\tul.style.left = Math.max(Math.min(x, window.innerWidth + window.scrollX - ul.clientWidth), 0) + 'px';\r\n\tul.style.top = Math.max(Math.min(y, window.innerHeight + window.scrollY - ul.clientHeight), 0) + 'px';\r\n\tul.onmousedown = function(event) {\r\n\t\tevent.stopPropagation();\r\n\t\treturn true;\r\n\t};\r\n\r\n\tsetTimeout(function() {\r\n\t\tdocument.onclick = function() {\r\n\t\t\tcloseMenu(ul);\r\n\t\t\treturn true;\r\n\t\t};\r\n\t\tdocument.onmousedown = function() {\r\n\t\t\tcloseMenu(ul);\r\n\t\t\treturn true;\r\n\t\t};\r\n\t\tdocument.oncontextmenu = function() {\r\n\t\t\tcloseMenu(ul);\r\n\t\t\treturn true;\r\n\t\t};\r\n\t\tdocument.onkeydown = function(event) {\r\n\t\t\tif (event.keyCode == 27)\r\n\t\t\t\tcloseMenu(ul);\r\n\t\t\treturn true;\r\n\t\t};\r\n\t}, 20);\r\n\treturn ul;\r\n}\r\n\r\n// removes the given popup menu\r\nfunction closeMenu(ul) {\r\n\tdocument.body.removeChild(ul);\r\n\tdocument.onclick = null;\r\n\tdocument.onmousedown = null;\r\n\tdocument.oncontextmenu = null;\r\n\tdocument.onkeydown = null;\r\n}\r\n\r\nvar dragIds;\r\n\r\n// enable drag and drop of column\r\nfunction enableDragColumn(id, column) {\r\n\tif (getConfig('lock'))\r\n\t\treturn;\r\n\r\n\tcolumn.draggable = true;\r\n\r\n\tcolumn.ondragstart = function(event) {\r\n\t\tdragIds = columns[id];\r\n\t\tevent.dataTransfer.effectAllowed = 'move';\r\n\t\tthis.classList.add('dragstart');\r\n\t};\r\n\tcolumn.ondragend = function(event) {\r\n\t\tdragIds = null;\r\n\t\tthis.classList.remove('dragstart');\r\n\t\tclearDropTarget();\r\n\t};\r\n}\r\n\r\nvar dropTarget;\r\n\r\n// enable drag and drop of folder\r\nfunction enableDragFolder(node, a) {\r\n\tif (getConfig('lock'))\r\n\t\treturn;\r\n\r\n\ta.draggable = true;\r\n\ta.ondragstart = function(event) {\r\n\t\tdragIds = [node.id];\r\n\t\tevent.stopPropagation();\r\n\t\tevent.dataTransfer.effectAllowed = 'move copy';\r\n\t\tthis.classList.add('dragstart');\r\n\t};\r\n\ta.ondragend = function(event) {\r\n\t\tdragIds = null;\r\n\t\tthis.classList.remove('dragstart');\r\n\t\tclearDropTarget();\r\n\t};\r\n}\r\n\r\n// init drag and drop handlers\r\nfunction enableDragDrop() {\r\n\tvar main = document.getElementById('main');\r\n\r\n\tif (getConfig('lock')) {\r\n\t\tmain.ondragover = null;\r\n\t\tmain.ondragleave = null;\r\n\t\tmain.ondrop = null;\r\n\t\treturn;\r\n\t}\r\n\r\n\tmain.ondragover = function(event) {\r\n\t\tevent.preventDefault();\r\n\t\tevent.dataTransfer.dropEffect = 'move';\r\n\t\t// highlight drop target\r\n\t\tvar target = getDropTarget(event);\r\n\t\tif (target) {\r\n\t\t\tclearDropTarget();\r\n\t\t\tdropTarget = target;\r\n\t\t\tvar bordercss = 'solid 2px ' + getConfig('font_color');\r\n\t\t\tif (target.tagName == 'LI' || target.tagName == 'UL') {\r\n\t\t\t\tif (isAbove(event.pageY, target)) {\r\n\t\t\t\t\ttarget.style.borderBottom = bordercss;\r\n\t\t\t\t\ttarget.style.margin = '0 0 -2px 0';\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget.style.borderTop = bordercss;\r\n\t\t\t\t\ttarget.style.margin = '-2px 0 0 0';\r\n\t\t\t\t}\r\n\t\t\t} else if (target.className == 'column') {\r\n\t\t\t\tif (event.pageX - target.offsetLeft > target.clientWidth / 2) {\r\n\t\t\t\t\ttarget.style.borderRight = bordercss;\r\n\t\t\t\t\ttarget.style.margin = '0';\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget.style.borderLeft = bordercss;\r\n\t\t\t\t\ttarget.style.margin = '0 2px 0 -2px';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\r\n\tmain.ondragleave = function(event) {\r\n\t\tclearDropTarget();\r\n\t};\r\n\r\n\tmain.ondrop = function(event) {\r\n\t\tevent.stopPropagation();\r\n\r\n\t\tvar target = getDropTarget(event);\r\n\t\tif (!target)\r\n\t\t\treturn false;\r\n\r\n\t\t// calculate drop coordinates\r\n\t\tvar x = getDropX(target, event);\r\n\t\tvar y = getDropY(target, event);\r\n\r\n\t\tif (dragIds.length == 1 && y != null)\r\n\t\t\taddRow(dragIds[0], x, y);\r\n\t\telse {\r\n\t\t\tif (event.pageX - target.offsetLeft > target.clientWidth / 2)\r\n\t\t\t\tx++;\r\n\t\t\taddColumn(dragIds, x);\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t};\r\n}\r\n\r\n// gets proper drop target element\r\nfunction getDropTarget(event) {\r\n\tif (!dragIds)\r\n\t\treturn null;\r\n\tvar target = event.target;\r\n\tif (target && (target.tagName == 'A' || target.parentNode.tagName == 'A') && dragIds.length == 1) {\r\n\t\t// get parent folder until toplevel\r\n\t\twhile (target &&\r\n\t\t\ttarget.parentNode.parentNode &&\r\n\t\t\ttarget.parentNode.parentNode.className != 'column') {\r\n\t\t\t// target should be LI\r\n\t\t\ttarget = target.parentNode;\r\n\t\t}\r\n\t\t// if single-folder column, get the UL\r\n\t\tif (target && target.tagName == 'LI' &&\r\n\t\t\tcolumns[getDropX(target, event)].length == 1)\r\n\t\t\ttarget = target.parentNode;\r\n\t\t// target should be LI or UL by here...\r\n\t} else\r\n\t\twhile (target && target.className != 'column')\r\n\t\t\ttarget = target.parentNode;// target column\r\n\r\n\treturn target;\r\n}\r\n\r\n// gets x coordinate of drop target\r\nfunction getDropX(target, event) {\r\n\tvar x = null;\r\n\twhile (target && target.className != 'column')\r\n\t\ttarget = target.parentNode;\r\n\tif (target) {\r\n\t\tx = 0;\r\n\t\tfor (; target.previousSibling; x++)\r\n\t\t\ttarget = target.previousSibling;\r\n\t}\r\n\treturn x;\r\n}\r\n\r\n// gets y coordinate of drop target\r\nfunction getDropY(target, event) {\r\n\tvar y = null;\r\n\tif (target.tagName == 'LI') {\r\n\t\ty = 0;\r\n\t\tif (isAbove(event.pageY, target))\r\n\t\t\ty++;\r\n\t\tfor (; target.previousSibling; y++)\r\n\t\t\ttarget = target.previousSibling;\r\n\t} else if (target.tagName == 'UL') {\r\n\t\ty = 0;\r\n\t\tif (isAbove(event.pageY, target))\r\n\t\t\ty++;\r\n\t}\r\n\treturn y;\r\n}\r\n\r\n// returns true if y position is above target element midpoint\r\nfunction isAbove(pageY, target) {\r\n\treturn pageY - window.scrollY - target.getBoundingClientRect().top > target.clientHeight / 2;\r\n}\r\n\r\n// clears droptarget styles\r\nfunction clearDropTarget() {\r\n\tif (dropTarget) {\r\n\t\tdropTarget.style.border = null;\r\n\t\tdropTarget.style.margin = null;\r\n\t}\r\n\tdropTarget = null;\r\n}\r\n\r\nvar tooltipTimeout = null;\r\n// adds tootlips to truncated text\r\nfunction updateTooltips() {\r\n\tif (tooltipTimeout) clearTimeout(tooltipTimeout);\r\n\r\n\ttooltipTimeout = setTimeout(function() {\r\n\t\ttooltipTimeout = null;\r\n\t\tvar elements = document.querySelectorAll('#main li a');\r\n\t\tfor (var i = 0; i < elements.length; i++) {\r\n\t\t\tvar element = elements[i];\r\n\t\t\tif (element.clientWidth + 1 < element.scrollWidth) {\r\n\t\t\t\telement.title = element.title || element.textContent;\r\n\t\t\t} else if (element.title === element.textContent) {\r\n\t\t\t\telement.title = '';\r\n\t\t\t}\r\n\t\t}\r\n\t}, 100);\r\n}\r\n\r\n// gets function that returns children of node\r\nfunction getChildrenFunction(node) {\r\n\tswitch(node.id) {\r\n\t\tcase 'top':\r\n\t\t\treturn function(callback) {\r\n\t\t\t\tif (chrome.topSites)\r\n\t\t\t\t\tchrome.topSites.get(function(result) {\r\n\t\t\t\t\t\tcallback(result.slice(0, getConfig('number_top')));\r\n\t\t\t\t\t});\r\n\t\t\t\telse\r\n\t\t\t\t\tcallback([]);\r\n\t\t\t};\r\n\t\tcase 'recent':\r\n\t\t\treturn function(callback) {\r\n\t\t\t\tchrome.bookmarks.getRecent(getConfig('number_recent'), function(result) {\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\t});\r\n\t\t\t};\r\n\t\tcase 'closed':\r\n\t\t\treturn function(callback) {\r\n\t\t\t\tgetClosed(function(result) {\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\t});\r\n\t\t\t};\r\n\t\tcase 'devices':\r\n\t\t\treturn function(callback) {\r\n\t\t\t\tgetDevices(function(result) {\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\t});\r\n\t\t\t};\r\n\t\tdefault:\r\n\t\t\tif (node.children)\r\n\t\t\t\treturn function(callback) {\r\n\t\t\t\t\tcallback(node.children);\r\n\t\t\t\t};\r\n\t\t\telse\r\n\t\t\t\treturn function(callback) {\r\n\t\t\t\t\tchrome.bookmarks.getSubTree(node.id, function(result) {\r\n\t\t\t\t\t\tif (result)\r\n\t\t\t\t\t\t\tcallback(result[0].children);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// remove missing bookmark locations\r\n\t\t\t\t\t\t\tif (coords[node.id])\r\n\t\t\t\t\t\t\t\tremoveRow(coords[node.id].x, coords[node.id].y);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t};\r\n\t}\r\n}\r\n\r\n// gets the subtree for given id\r\nfunction getSubTree(id, callback) {\r\n\tswitch(id) {\r\n\t\tcase 'top':\r\n\t\t\tcallback([{ title: 'Most visited', id: 'top', children: true}]);\r\n\t\t\tbreak;\r\n\t\tcase 'apps':\r\n\t\t\tcallback([{ title: 'Apps', id: 'apps', url: 'chrome://apps' }]);\r\n\t\t\tbreak;\r\n\t\tcase 'recent':\r\n\t\t\tcallback([{ title: 'Recent bookmarks', id: 'recent', children: true }]);\r\n\t\t\tbreak;\r\n\t\tcase 'closed':\r\n\t\t\tcallback([{ title: 'Recently closed', id: 'closed', children: true }]);\r\n\t\t\tbreak;\r\n\t\tcase 'devices':\r\n\t\t\tcallback([{ title: 'Other devices', id: 'devices', children: true }]);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tchrome.bookmarks.getSubTree(id, function(result) {\r\n\t\t\t\tif (result)\r\n\t\t\t\t\tcallback(result);\r\n\t\t\t\telse {\r\n\t\t\t\t\t// remove missing bookmark locations\r\n\t\t\t\t\tif (coords[id])\r\n\t\t\t\t\t\tremoveRow(coords[id].x, coords[id].y);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t}\r\n}\r\n\r\n// sets css classes for node\r\nfunction setClass(target, node, isopen) {\r\n\tif (node.className)\r\n\t\ttarget.classList.add(node.className);\r\n\tif (node.children)\r\n\t\ttarget.classList.add('folder');\r\n\tif (isopen)\r\n\t\ttarget.classList.add('open');\r\n\telse\r\n\t\ttarget.classList.remove('open');\r\n\r\n\tswitch(node.id) {\r\n\t\tcase 'top':\r\n\t\tcase 'apps':\r\n\t\tcase 'recent':\r\n\t\tcase 'closed':\r\n\t\tcase 'devices':\r\n\t\tcase 'empty':\r\n\t\t\ttarget.classList.add(node.id);\r\n\t}\r\n}\r\n\r\n// gets best icon for a node\r\nfunction getIcon(node) {\r\n\tvar url = null,\r\n\t\turl2x = null;\r\n\tif (node.icons) {\r\n\t\tvar size;\r\n\t\tfor (var i in node.icons) {\r\n\t\t\tvar iconInfo = node.icons[i];\r\n\t\t\tif (iconInfo.url && (!size || (iconInfo.size < size && iconInfo.size > 15))) {\r\n\t\t\t\turl = iconInfo.url;\r\n\t\t\t\tif (iconInfo.size > 31) url2x = iconInfo.url;\r\n\t\t\t\tsize = iconInfo.size;\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (node.icon) {\r\n\t\turl = node.icon;\r\n\t} else if (node.url) {\r\n\t\turl = `/_favicon/?pageUrl=${encodeURIComponent(node.url)}&size=16`;\r\n\t\turl2x = `/_favicon/?pageUrl=${encodeURIComponent(node.url)}&size=32`;\r\n\t}\r\n\r\n\tvar icon = document.createElement(url ? 'img' : 'div');\r\n\ticon.className = 'icon';\r\n\ticon.src = url;\r\n\tif (url2x) icon.srcset = url2x + ' 2x';\r\n\ticon.alt = ' ';\r\n\treturn icon;\r\n}\r\n\r\n// toggle folder open state\r\nfunction toggle(node, a) {\r\n\tvar isopen = a.open;\r\n\tsetClass(a, node, !isopen);\r\n\ta.open = !isopen;\r\n\tif (isopen) {\r\n\t\t// close folder\r\n\t\tlocalStorage.removeItem('open.' + node.id);\r\n\t\tif (a.nextSibling){\r\n\t\t\t// auto-close child folders\r\n\t\t\tif (getConfig('auto_close')) {\r\n\t\t\t\tvar children = (a.nextSibling.tagName == 'DIV' ? a.nextSibling.firstChild : a.nextSibling).children;\r\n\t\t\t\tfor (var i=0; i<children.length; i++) {\r\n\t\t\t\t\tvar child = children[i].firstChild;\r\n\t\t\t\t\tif (child.open)\r\n\t\t\t\t\t\tchild.onclick();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// close folder\r\n\t\t\tanimate(node, a, isopen);\r\n\t\t}\r\n\t} else {\r\n\t\t// open folder\r\n\t\tlocalStorage.setItem('open.' + node.id, true);\r\n\t\t// auto-close sibling folders\r\n\t\tif (getConfig('auto_close')) {\r\n\t\t\tvar siblings = a.parentNode.parentNode.children;\r\n\t\t\tfor (var i=0; i<siblings.length; i++) {\r\n\t\t\t\tvar sibling = siblings[i].firstChild;\r\n\t\t\t\tif (sibling != a && sibling.open)\r\n\t\t\t\t\tsibling.onclick();\r\n\t\t\t}\r\n\t\t}\r\n\t\t// open folder\r\n\t\tif (a.nextSibling)\r\n\t\t\tanimate(node, a, isopen);\r\n\t\telse\r\n\t\t\tgetChildrenFunction(node)(function(result) {\r\n\t\t\t\tif (!a.nextSibling && a.open) {\r\n\t\t\t\t\trenderAll(result, a.parentNode);\r\n\t\t\t\t\tanimate(node, a, isopen);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t}\r\n}\r\n\r\n// smoothly open or close folder\r\nfunction animate(node, a, isopen) {\r\n\t// TODO: fix nested animations\r\n\t// wrapper needed for inner height value\r\n\tvar wrap = a.nextSibling;\r\n\tif (a.animationHandle) {\r\n\t\t// clear last animation\r\n\t\tclearTimeout(a.animationHandle);\r\n\t\ta.animationHandle = null;\r\n\t} else {\r\n\t\t// start animation\r\n\t\twrap.style.height = isopen ? wrap.firstChild.clientHeight + 'px' : 0;\r\n\t\twrap.style.opacity = isopen ? 1 : 0;\r\n\t}\r\n\t// requestAnimationFrame twice to ensure at least one frame has passed\r\n\trequestAnimationFrame(function() {\r\n\t\trequestAnimationFrame(function() {\r\n\t\t\tif (wrap) {\r\n\t\t\t\twrap.className = 'wrap';\r\n\t\t\t\twrap.style.height = isopen ? 0 : wrap.firstChild.clientHeight + 'px';\r\n\t\t\t\twrap.style.opacity = isopen ? 0 : 1;\r\n\t\t\t\twrap.style.pointerEvents = isopen ? 'none' : null;\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\tvar duration = scale(getConfig('slide'), .2, 1) * 1000;\r\n\ta.animationHandle = setTimeout(function() {\r\n\t\ta.animationHandle = null;\r\n\t\tif (isopen)\r\n\t\t\ta.parentNode.removeChild(wrap);\r\n\t\telse {\r\n\t\t\twrap.className = null;\r\n\t\t\twrap.removeAttribute('style');\r\n\t\t}\r\n\t\twrap = null;\r\n\t}, duration);\r\n}\r\n\r\n// opens immediate children of given node in new tabs\r\nfunction openLinks(node) {\r\n\tchrome.tabs.getCurrent(function(tab) {\r\n\t\tgetChildrenFunction(node)(function(result) {\r\n\t\t\tfor (var i = 0; i < result.length; i++)\r\n\t\t\t\topenLink(result[i], 2);\r\n\t\t});\r\n\t});\r\n}\r\n\r\n// opens given node\r\nfunction openLink(node, newtab) {\r\n\tvar url = node.url;\r\n\tif (url) {\r\n\t\tchrome.tabs.getCurrent(function(tab) {\r\n\t\t\tif (newtab)\r\n\t\t\t\tchrome.tabs.create({url: url, active: (newtab == 1), openerTabId: tab.id});\r\n\t\t\telse\r\n\t\t\t\tchrome.tabs.update(tab.id, {url: url});\r\n\t\t});\r\n\t}\r\n}\r\n\r\nvar columns; // columns[x][y] = id\r\nvar root; // root[] = id\r\nvar coords; // coords[id] = {x:x, y:y}\r\nvar special = ['apps', 'top', 'recent', 'closed', 'devices'];\r\n\r\n// ensure root folders are included\r\nfunction verifyColumns() {\r\n\t// default layout\r\n\tif (columns.length === 0) {\r\n\t\tcolumns.push([]);\r\n\t\tcolumns.push(special.filter(function(a) {\r\n\t\t\treturn getConfig('show_' + a) != false;\r\n\t\t}));\r\n\t}\r\n\r\n\t// find missing root items\r\n\tvar missing = root.slice(0);\r\n\tfor (var x = 0; x < columns.length; x++) {\r\n\t\tfor (var y = 0; y < columns[x].length; y++) {\r\n\t\t\tvar i = missing.indexOf(columns[x][y]);\r\n\t\t\tif (i > -1)\r\n\t\t\t\tmissing.splice(i, 1);\r\n\t\t}\r\n\t}\r\n\r\n\t// add missing root items\r\n\tvar column = columns[0];\r\n\tfor (var i = 0; i < missing.length; i++) {\r\n\t\tif (getConfig('show_' + missing[i]) != false)\r\n\t\t\tcolumn.push(missing[i]);\r\n\t}\r\n\r\n\t// populate coordinate map\r\n\tcoords = {};\r\n\tfor (var x = 0; x < columns.length; x++) {\r\n\t\tfor (var y = 0; y < columns[x].length; y++) {\r\n\t\t\tcoords[columns[x][y]] = { x: x, y: y};\r\n\t\t}\r\n\t\tif (columns[x].length === 0) {\r\n\t\t\tcolumns.splice(x, 1);\r\n\t\t\tx--;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// load columns from storage or default\r\nfunction loadColumns() {\r\n\tcolumns = [];\r\n\tfor (var x = 0; ; x++) {\r\n\t\tvar row = [];\r\n\t\tfor (var y = 0; ; y++) {\r\n\t\t\tvar id = localStorage.getItem('column.' + x + '.' + y);\r\n\t\t\tif (id) row.push(id); else break;\r\n\t\t}\r\n\t\tif (row.length > 0) columns.push(row); else break;\r\n\t}\r\n\r\n\tif (root) {\r\n\t\tverifyColumns();\r\n\t\trenderColumns();\r\n\t} else {\r\n\t\tchrome.bookmarks.getTree(function(result) {\r\n\t\t\t// init root nodes\r\n\t\t\tvar nodes = result[0].children;\r\n\t\t\troot = special.slice(0);\r\n\r\n\t\t\tfor (var i = 0; i < nodes.length; i++)\r\n\t\t\t\troot.push(nodes[i].id);\r\n\r\n\t\t\tverifyColumns();\r\n\t\t\trenderColumns();\r\n\t\t});\r\n\t}\r\n}\r\n\r\n// saves current column configuration to storage\r\nfunction saveColumns() {\r\n\t// clear previous config\r\n\tfor (var x = 0; ; x++) {\r\n\t\tfor (var y = 0; ; y++) {\r\n\t\t\tvar id = localStorage.getItem('column.' + x + '.' + y);\r\n\t\t\tif (id)\r\n\t\t\t\tlocalStorage.removeItem('column.' + x + '.' + y);\r\n\t\t\telse\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (y === 0)\r\n\t\t\tbreak;\r\n\t}\r\n\tverifyColumns();\r\n\t// save new config\r\n\tfor (var x = 0; x < columns.length; x++) {\r\n\t\tfor (var y = 0; y < columns[x].length; y++) {\r\n\t\t\tlocalStorage.setItem('column.' + x +'.' + y, columns[x][y]);\r\n\t\t}\r\n\t}\r\n\t// refresh\r\n\tloadColumns();\r\n}\r\n\r\n// creates and saves a new column\r\nfunction addColumn(ids, index) {\r\n\tvar column = ids.slice(0);\r\n\t// remove previous locations\r\n\tfor (var x = 0; x < columns.length; x++) {\r\n\t\tfor (var y = 0; y < columns[x].length; y++ ) {\r\n\t\t\tif (ids.indexOf(columns[x][y]) > -1) {\r\n\t\t\t\tcolumns[x].splice(y, 1);\r\n\t\t\t\ty--;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// insert new id\r\n\tif (index == null)\r\n\t\tindex = columns.length;\r\n\tcolumns.splice(Math.min(index, columns.length), 0, column);\r\n\r\n\t// save\r\n\tsaveColumns();\r\n}\r\n\r\n// removes given column\r\nfunction removeColumn(index) {\r\n\tcolumns.splice(index, 1);\r\n\tsaveColumns();\r\n}\r\n\r\n// creates and saves a new row\r\nfunction addRow(id, xpos, ypos) {\r\n\tif (ypos == null)\r\n\t\typos = columns[xpos].length;\r\n\r\n\t// remove previous locations\r\n\tfor (var x = 0; x < columns.length; x++) {\r\n\t\tvar i = columns[x].indexOf(id);\r\n\t\tif (i > -1) {\r\n\t\t\tcolumns[x].splice(i, 1);\r\n\t\t\tif (x == xpos && ypos > i)\r\n\t\t\t\typos--;\r\n\t\t}\r\n\t\tif (columns[x].length === 0) {\r\n\t\t\tcolumns.splice(x, 1);\r\n\t\t\tx--;\r\n\t\t\tif (xpos > x)\r\n\t\t\t\txpos--;\r\n\t\t}\r\n\t}\r\n\t// insert new id\r\n\tcolumns[xpos].splice(Math.min(ypos, columns[xpos].length), 0, id);\r\n\r\n\t// save\r\n\tsaveColumns();\r\n}\r\n\r\n// removes given row\r\nfunction removeRow(xpos, ypos) {\r\n\tcolumns[xpos].splice(ypos, 1);\r\n\tsaveColumns();\r\n}\r\n\r\n// get recently closed tabs\r\nfunction getClosed(callback) {\r\n\tvar maxResults = getConfig('number_closed');\r\n\tchrome.sessions.getRecentlyClosed({ maxResults: maxResults }, function(sessions) {\r\n\t\tvar nodes = [];\r\n\t\tfor (var i = 0; i < sessions.length && i < maxResults; i++) {\r\n\t\t\t(function(session) {\r\n\t\t\t\tif (session.window && session.window.tabs.length == 1)\r\n\t\t\t\t\tsession.tab = session.window.tabs[0];\r\n\r\n\t\t\t\tnodes.push({\r\n\t\t\t\t\ttitle: session.tab ? session.tab.title : session.window.tabs.length + ' Tabs',\r\n\t\t\t\t\turl: session.tab ? session.tab.url : null,\r\n\t\t\t\t\tclassName: session.window ? 'window' : null,\r\n\t\t\t\t\taction: function() {\r\n\t\t\t\t\t\tchrome.sessions.restore(session.window ? session.window.sessionId : session.tab.sessionId, function(session) {\r\n\t\t\t\t\t\t\trefreshClosed();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t})(sessions[i]);\r\n\t\t}\r\n\t\tcallback(nodes);\r\n\t});\r\n}\r\n\r\nfunction getDevices(callback) {\r\n\tchrome.sessions.getDevices({ maxResults: getConfig('number_closed') }, function(devices) {\r\n\t\tvar nodes = [];\r\n\t\tfor (var i = 0; i < devices.length; i++) {\r\n\t\t\t(function(device) {\r\n\t\t\t\tvar children = [];\r\n\t\t\t\tfor (var j = 0; j < device.sessions.length; j++) {\r\n\t\t\t\t\tvar session = device.sessions[j];\r\n\t\t\t\t\tvar tabs = session.window ? session.window.tabs : [session.tab];\r\n\t\t\t\t\tfor (var k = 0; k < tabs.length; k++) {\r\n\t\t\t\t\t\tchildren.push({\r\n\t\t\t\t\t\t\ttitle: tabs[k].title,\r\n\t\t\t\t\t\t\turl: tabs[k].url\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tnodes.push({\r\n\t\t\t\t\tid: 'device.' + device.deviceName,\r\n\t\t\t\t\ttitle: device.deviceName,\r\n\t\t\t\t\tchildren: children\r\n\t\t\t\t});\r\n\t\t\t})(devices[i]);\r\n\t\t}\r\n\t\tcallback(nodes);\r\n\t});\r\n}\r\n\r\n// refresh recently closed tab lists\r\nfunction refreshClosed() {\r\n\tvar targets = [];\r\n\tvar folders = document.getElementsByClassName('closed');\r\n\tfor (var i = 0; i < folders.length; i++) {\r\n\t\tvar a = folders[i];\r\n\t\tif (a.nextSibling) {\r\n\t\t\ta.parentNode.removeChild(a.nextSibling);\r\n\t\t\ttargets.push(a.parentNode);\r\n\t\t}\r\n\t}\r\n\tif (folders.length === 0 && coords['closed']) {\r\n\t\tvar target = document.getElementsByClassName('column')[coords['closed'].x];\r\n\t\ttarget.removeChild(target.firstChild);\r\n\t\ttargets.push(target);\r\n\t}\r\n\r\n\tgetChildrenFunction({id: 'closed'})(function(result) {\r\n\t\tfor (var i = 0; i < targets.length; i++)\r\n\t\t\trenderAll(result, targets[i]);\r\n\t});\r\n}\r\n\r\n// options : default values\r\nvar config = {\r\n\tfont: 'Sans-serif',\r\n\tfont_size: 16,\r\n\tfont_weight: 400,\r\n\ttheme: 'Default',\r\n\tfont_color: '#555555',\r\n\tbackground_color: '#ffffff',\r\n\thighlight_color: '#e4f4ff',\r\n\thighlight_font_color: '#000000',\r\n\tshadow_color: '#57b0ff',\r\n\tbackground_image_file: '',\r\n\tbackground_image: '',\r\n\tbackground_align: 'left top',\r\n\tbackground_repeat: 'repeat',\r\n\tbackground_size: 'auto',\r\n\tshadow_blur: 1,\r\n\thighlight_round: 1,\r\n\tfade: 1,\r\n\tspacing: 1,\r\n\twidth: 1,\r\n\th_pos: 1,\r\n\tv_margin: 1,\r\n\tslide: 1,\r\n\thide_options: 0,\r\n\tlock: 0,\r\n\tshow_top: 1,\r\n\tshow_apps: 1,\r\n\tshow_recent: 1,\r\n\tshow_closed: 1,\r\n\tshow_devices: 1,\r\n\tshow_root: 0,\r\n\tnewtab: 0,\r\n\tremember_open: 1,\r\n\tauto_close: 0,\r\n\tauto_scale: 1,\r\n\tcss: '',\r\n\tnumber_top: 10,\r\n\tnumber_closed: 10,\r\n\tnumber_recent: 10\r\n};\r\n\r\n// color theme values\r\nvar themes = {\r\n\tDefault: {},\r\n\tClassic: {\r\n\t\tfont_color: '#000000',\r\n\t\tbackground_color: '#ffffff',\r\n\t\thighlight_color: '#3399ff',\r\n\t\thighlight_font_color: '#ffffff',\r\n\t\tshadow_color: '#97cbff'\r\n\t},\r\n\tDusk: {\r\n\t\tfont_color: '#c8b9be',\r\n\t\tbackground_color: '#56546b',\r\n\t\thighlight_color: '#494d5a',\r\n\t\thighlight_font_color: '#ffd275',\r\n\t\tshadow_color: '#000000'\r\n\t},\r\n\tElegant: {\r\n\t\tfont_color: '#888888',\r\n\t\tbackground_color: '#f6f6f6',\r\n\t\thighlight_color: '#ffffff',\r\n\t\thighlight_font_color: '#000000',\r\n\t\tshadow_color: '#aaaaaa'\r\n\t},\r\n\tFrosty: {\r\n\t\tfont_color: '#3e5e82',\r\n\t\tbackground_color: '#e4eef3',\r\n\t\thighlight_color: '#0080c0',\r\n\t\thighlight_font_color: '#ffffff',\r\n\t\tshadow_color: '#8080ff'\r\n\t},\r\n\tHacker: {\r\n\t\tfont_color: '#00ff00',\r\n\t\tbackground_color: '#000000',\r\n\t\thighlight_color: '#00ff00',\r\n\t\thighlight_font_color: '#000000',\r\n\t\tshadow_color: '#ff0000'\r\n\t},\r\n\tMelon: {\r\n\t\tfont_color: '#594526',\r\n\t\tbackground_color: '#f8ffe1',\r\n\t\thighlight_color: '#ff8000',\r\n\t\thighlight_font_color: '#ffff80',\r\n\t\tshadow_color: '#ff80c0'\r\n\t},\r\n\tMidnight: {\r\n\t\tfont_color: '#bfdfff',\r\n\t\tbackground_color: '#101827',\r\n\t\thighlight_color: '#000000',\r\n\t\thighlight_font_color: '#80ecff',\r\n\t\tshadow_color: '#0080ff'\r\n\t},\r\n\tSlate: {\r\n\t\tfont_color: '#555555',\r\n\t\tbackground_color: '#b7babf',\r\n\t\thighlight_color: '#aaaaaa',\r\n\t\thighlight_font_color: '#000000',\r\n\t\tshadow_color: '#2a2a2a'\r\n\t},\r\n\tTrees: {\r\n\t\tfont_color: '#cdd088',\r\n\t\tbackground_color: '#566157',\r\n\t\thighlight_color: '#4d674b',\r\n\t\thighlight_font_color: '#ffff80',\r\n\t\tshadow_color: '#183010'\r\n\t},\r\n\tValentine: {\r\n\t\tfont_color: '#895fc2',\r\n\t\tbackground_color: '#eae1ff',\r\n\t\thighlight_color: '#ffb7f0',\r\n\t\thighlight_font_color: '#f00000',\r\n\t\tshadow_color: '#ffffff'\r\n\t},\r\n\tWarm: {\r\n\t\tfont_color: '#824100',\r\n\t\tbackground_color: '#ffeedd',\r\n\t\thighlight_color: '#fffae8',\r\n\t\thighlight_font_color: '#800000',\r\n\t\tshadow_color: '#d98764'\r\n\t}\r\n};\r\nvar theme = {};\r\n\r\n// get config value or default\r\nfunction getConfig(key) {\r\n\tvar value = localStorage.getItem('options.' + key);\r\n\tif (value != null)\r\n\t\treturn typeof config[key] === 'number' ? Number(value) : value;\r\n\telse\r\n\t\treturn (theme.hasOwnProperty(key) ? theme[key] : config[key]);\r\n}\r\n\r\n// set config value\r\nfunction setConfig(key, value) {\r\n\tif (value != null)\r\n\t\tlocalStorage.setItem('options.' + key, typeof config[key] === 'number' ? Number(value) : value);\r\n\telse {\r\n\t\tlocalStorage.removeItem('options.' + key);\r\n\t\tvalue = (theme.hasOwnProperty(key) ? theme[key] : config[key]);\r\n\t}\r\n\t// special case settings\r\n\tif (key == 'lock' || key == 'newtab' || key == 'show_root' || key.substring(0,6) == 'number')\r\n\t\tloadColumns();\r\n\telse if (key == 'theme') {\r\n\t\ttheme = themes[value];\r\n\t\tfor (var i in config) {\r\n\t\t\tif (i != key) {\r\n\t\t\t\tonChange(i);\r\n\t\t\t\tshowConfig(i);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (key.substring(0,4) == 'show') {\r\n\t\tvar id = key.substring(5);\r\n\t\tif (!value) {\r\n\t\t\tif (coords[id])\r\n\t\t\t\tremoveRow(coords[id].x, coords[id].y);\r\n\t\t\tsaveColumns();\r\n\t\t} else {\r\n\t\t\tsaveColumns();\r\n\t\t}\r\n\t}\r\n\tonChange(key, value);\r\n\treturn value;\r\n}\r\n\r\n// map config keys to styles\r\nvar styles = {};\r\n\r\nfunction getStyle(key, value) {\r\n\tswitch(key) {\r\n\t\tcase 'font':\r\n\t\t\treturn '#main a { font-family: \"' + value + '\"; }';\r\n\t\tcase 'font_size':\r\n\t\t\treturn '#main a { font-size: ' + (value / 10) + 'em; }';\r\n\t\tcase 'font_weight':\r\n\t\t\treturn '#main a { font-weight: ' + value + '; }';\r\n\t\tcase 'font_color':\r\n\t\t\treturn '#main a { color: ' + value + '; }';\r\n\t\tcase 'background_color':\r\n\t\t\treturn 'body { background-color: ' + value + '; }';\r\n\t\tcase 'background_image':\r\n\t\t\treturn 'body { background-image: url(' + value + '); }';\r\n\t\tcase 'background_image_file':\r\n\t\t\treturn 'body { background-image: url(' + value + '); }';\r\n\t\tcase 'background_align':\r\n\t\t\treturn 'body { background-position: ' + value + '; }';\r\n\t\tcase 'background_repeat':\r\n\t\t\treturn 'body { background-repeat: ' + value + '; }';\r\n\t\tcase 'background_size':\r\n\t\t\treturn 'body { background-size: ' + value + '; }';\r\n\t\tcase 'highlight_font_color':\r\n\t\t\treturn '#main a:hover { color: ' + value + '; }';\r\n\t\tcase 'highlight_color':\r\n\t\t\treturn '#main a:hover { background-color: ' + value + '; }';\r\n\t\tcase 'shadow_color':\r\n\t\t\treturn '#main a:hover { box-shadow: 0 0 ' + scale(getConfig('shadow_blur'), 7, 100) + 'px ' + value + '; }';\r\n\t\tcase 'shadow_blur':\r\n\t\t\treturn '#main a:hover { box-shadow: 0 0 ' + scale(value, 7, 100) + 'px ' + getConfig('shadow_color') + '; }';\r\n\t\tcase 'highlight_round':\r\n\t\t\treturn '#main a { border-radius: ' + scale(value, .2, 1.5) + 'em; }';\r\n\t\tcase 'fade':\r\n\t\t\treturn '#main a { transition-duration: ' + scale(value, .2, 1) + 's; }';\r\n\t\tcase 'slide':\r\n\t\t\treturn '.wrap { transition-duration: ' + scale(value, .2, 1) + 's; }';\r\n\t\tcase 'spacing':\r\n\t\t\treturn '#main a { line-height: ' + scale(value, 2, 5.6, .8) + '; ' +\r\n\t\t\t\t\t\t\t'padding-left: ' + scale(value, .8, 2, .4) + 'em; ' +\r\n\t\t\t\t\t\t\t'padding-right: ' + scale(value, .8, 2, .4) + 'em; }';\r\n\t\tcase 'width':\r\n\t\t\treturn '#main { width: ' + (getConfig('auto_scale') ?\r\n\t\t\t\tscale(value, 80, 100, 20) + '%' :\r\n\t\t\t\tscale(value, 1000, 3000, 400) + 'px') + '; }';\r\n\t\tcase 'h_pos':\r\n\t\t\tvar margin = 100 - scale(getConfig('width'), 80, 100, 20);\r\n\t\t\treturn '#main { left: ' + scale(value, 0, margin/2, -margin/2) + '%; }';\r\n\t\tcase 'v_margin':\r\n\t\t\treturn '#main { margin-top: ' + (getConfig('auto_scale') ?\r\n\t\t\t\tscale(value, 5, 20) + '%' :\r\n\t\t\t\tscale(value, 80, 600) + 'px') + '; }';\r\n\t\tcase 'hide_options':\r\n\t\t\treturn '#options_button { opacity: 0; }';\r\n\t\tcase 'css':\r\n\t\t\treturn value;\r\n\t\tcase 'auto_scale':\r\n\t\t\treturn value ? null : '#main { margin-top: 80px; width: 1000px; }';\r\n\t\tdefault:\r\n\t\t\treturn null;\r\n\t}\r\n}\r\n\r\n// scales input value from [0,1,2] to [min,mid,max]\r\nfunction scale(value, mid, max, min) {\r\n\tmin = min || 0;\r\n\treturn value > 1 ?\r\n\t\tmid + (value - 1) * (max - mid) :\r\n\t\tmin + value * (mid - min);\r\n}\r\n\r\n// gets rgb representation of hex color\r\nfunction hexToRgb(hex) {\r\n\thex = /[a-f\\d]{6}/i.exec(hex);\r\n\tvar bigint = parseInt(hex, 16);\r\n\tvar r = (bigint >> 16) & 255;\r\n\tvar g = (bigint >> 8) & 255;\r\n\tvar b = bigint & 255;\r\n\treturn r + \",\" + g + \",\" + b;\r\n}\r\n\r\n// apply config value change\r\nfunction onChange(key, value) {\r\n\tif (value == null)\r\n\t\tvalue = getConfig(key);\r\n\r\n\tif (value != config[key]) {\r\n\t\tvar css = getStyle(key, value);\r\n\t\tif (css) {\r\n\t\t\tvar style;\r\n\t\t\tif (styles.hasOwnProperty(key))\r\n\t\t\t\tstyle = styles[key];\r\n\t\t\telse {\r\n\t\t\t\tstyle = document.createElement('style');\r\n\t\t\t\tstyles[key] = style;\r\n\t\t\t}\r\n\t\t\tdocument.head.appendChild(style);\r\n\r\n\t\t\t// add style rules\r\n\t\t\tstyle.innerText = css;\r\n\t\t}\r\n\t} else if (styles.hasOwnProperty(key)) {\r\n\t\t// remove rules\r\n\t\tstyles[key].parentNode.removeChild(styles[key]);\r\n\t\tdelete styles[key];\r\n\t}\r\n\t// refresh dependent values\r\n\tif (key == 'width')\r\n\t\tonChange('h_pos');\r\n\telse if (key == 'shadow_blur')\r\n\t\tonChange('shadow_color');\r\n\telse if (key == 'auto_scale') {\r\n\t\tonChange('width');\r\n\t\tonChange('v_margin');\r\n\t}\r\n\r\n\t// update options panel\r\n\tif (!settingsInitialized)\r\n\t\treturn;\r\n\r\n\t// show/hide default button\r\n\tvar input = document.getElementById('options_' + key);\r\n\tif (input) {\r\n\t\tvar isDefault = value == (theme.hasOwnProperty(key) ? theme[key] : config[key]);\r\n\t\tinput.reset.style.visibility = (isDefault ? 'hidden' : null);\r\n\t\tif (input.swatch)\r\n\t\t\tinput.swatch.value = value;\r\n\t}\r\n}\r\n\r\n// loads config settings\r\nfunction loadSettings() {\r\n\t// load theme\r\n\ttheme = themes[getConfig('theme')] || {};\r\n\t// load settings\r\n\tfor (var key in config)\r\n\t\tif (key === 'background_image_file')\r\n\t\t\tsetTimeout(function() { onChange('background_image_file'); }, 0);\r\n\t\telse\r\n\t\t\tonChange(key);\r\n}\r\n\r\n// apply config values to input controls\r\nfunction showConfig(key) {\r\n\tvar input = document.getElementById('options_' + key);\r\n\tif (!input || input.type === 'file')\r\n\t\treturn;\r\n\r\n\tinput[input.type === 'checkbox' ? 'checked' : 'value'] = getConfig(key);\r\n}\r\n\r\n// initialize config settings\r\nfunction initConfig(key) {\r\n\tvar input = document.getElementById('options_' + key);\r\n\tif (!input)\r\n\t\treturn;\r\n\r\n\tif (input.type == 'color') {\r\n\t\tinput.type = 'text';\r\n\t\tinput.className = 'color';\r\n\t\tvar swatch = document.createElement('input');\r\n\t\tswatch.type = 'color';\r\n\t\tswatch.value = input.value;\r\n\t\tswatch.oninput = function(event) {\r\n\t\t\tinput.value = this.value;\r\n\t\t\treturn input.onchange(event);\r\n\t\t};\r\n\t\tinput.swatch = swatch;\r\n\t\tinput.parentNode.appendChild(swatch);\r\n\t}\r\n\tinput.onchange = function(event) {\r\n\t\tif (input.type == 'file') {\r\n\t\t\t// load file\r\n\t\t\tif (event.target.files.length == 1) {\r\n\t\t\t\tvar file = event.target.files[0];\r\n\t\t\t\tif (file.size > 2097152) {\r\n\t\t\t\t\tinput.value = null;\r\n\t\t\t\t\talert('Image must be less than 2 MB.');\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tvar reader = new FileReader();\r\n\t\t\t\treader.onload = function(f) {\r\n\t\t\t\t\tif (f.target.result)\r\n\t\t\t\t\t\tsetConfig(key, f.target.result);\r\n\t\t\t\t};\r\n\t\t\t\treader.readAsDataURL(file);\r\n\t\t\t}\r\n\t\t} else\r\n\t\t\tsetConfig(key, input.type == 'checkbox' ? Number(input.checked) : input.value);\r\n\t};\r\n\r\n\tvar reset = document.createElement('a');\r\n\treset.className = 'revert';\r\n\treset.title = 'Reset to default';\r\n\treset.tabIndex = 0;\r\n\treset.onclick = function() {\r\n\t\tsetConfig(key, null);\r\n\t\tshowConfig(key);\r\n\t\treturn false;\r\n\t};\r\n\r\n\tinput.reset = reset;\r\n\tinput.parentNode.appendChild(reset);\r\n\tshowConfig(key);\r\n}\r\n\r\nvar settingsInitialized = false;\r\n\r\n// initialize options panel\r\nfunction initSettings() {\r\n\tsettingsInitialized = true;\r\n\r\n\t// options close button\r\n\tdocument.getElementById('options_close_button').onclick = function() {\r\n\t\tshowOptions(false);\r\n\t\treturn false;\r\n\t};\r\n\r\n\t// options submenu navigation\r\n\tvar options = document.getElementById('options');\r\n\tvar nav = document.getElementById('options_nav');\r\n\tvar index = 0;\r\n\tfor (var i=0; i<nav.children.length; i++) {\r\n\t\tvar a = nav.children[i].firstChild;\r\n\t\ta.onclick = function(e) {\r\n\t\t\t// clear current style\r\n\t\t\tnav.children[index].firstChild.classList.remove('current');\r\n\t\t\toptions.getElementsByClassName('section')[index].classList.remove('current');\r\n\t\t\t// apply new current style\r\n\t\t\tindex = Array.prototype.indexOf.call(nav.children, this.parentNode);\r\n\t\t\tnav.children[index].firstChild.classList.add('current');\r\n\t\t\toptions.getElementsByClassName('section')[index].classList.add('current');\r\n\t\t\t// show custom css on advanced tab\r\n\t\t\tif (index === nav.children.length-1) {\r\n\t\t\t\tvar allcss = document.getElementById('all_css');\r\n\t\t\t\tallcss.value = '';\r\n\t\t\t\tfor (var key in config) {\r\n\t\t\t\t\tvar css = (getStyle(key, getConfig(key)));\r\n\t\t\t\t\tif (css && css.length < 1000 && key != 'css')\r\n\t\t\t\t\t\tallcss.value += css + '\\n';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// import/export\r\n\t\t\tif (index === nav.children.length-2) {\r\n\t\t\t\tvar exports = document.getElementById('options_export');\r\n\t\t\t\tvar imports = document.getElementById('options_import');\r\n\t\t\t\tvar replacer = function(key, value) {\r\n\t\t\t\t\tif (key == 'options.background_image_file' || key == 'weather.cache') {\r\n\t\t\t\t\t\treturn undefined;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn value;\r\n\t\t\t\t};\r\n\t\t\t\texports.value = JSON.stringify(localStorage, replacer);\r\n\t\t\t\timports.value = '';\r\n\t\t\t\timports.placeholder = 'Paste exported settings here';\r\n\t\t\t\timports.onchange = function() {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tvar imported = JSON.parse(imports.value);\r\n\t\t\t\t\t\tfor(var key in imported) {\r\n\t\t\t\t\t\t\tlocalStorage.setItem(key, imported[key]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\timports.value = '';\r\n\t\t\t\t\t\timports.placeholder = 'Import successful!';\r\n\t\t\t\t\t\texports.value = JSON.stringify(localStorage, replacer);\r\n\t\t\t\t\t\tloadSettings();\r\n\t\t\t\t\t\tloadColumns();\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\timports.value = '';\r\n\t\t\t\t\t\timports.placeholder = 'Import error! Please check if your settings are valid JSON.';\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t}\r\n\r\n\t// add options to hide bookmark folders\r\n\tchrome.bookmarks.getTree(function(result) {\r\n\t\tvar placeholder = document.getElementById('options_show_bookmarks');\r\n\t\tvar nodes = result[0].children;\r\n\t\tfor (var i = 0; i < nodes.length; i++) {\r\n\t\t\tvar key = 'show_' + nodes[i].id;\r\n\t\t\tconfig[key] = 1;\r\n\r\n\t\t\tvar span = document.createElement('span');\r\n\t\t\tspan.innerText = nodes[i].title;\r\n\r\n\t\t\tvar input = document.createElement('input');\r\n\t\t\tinput.type = 'checkbox';\r\n\t\t\tinput.id = 'options_' + key;\r\n\r\n\t\t\tvar label = document.createElement('label');\r\n\t\t\tlabel.appendChild(span);\r\n\t\t\tlabel.appendChild(input);\r\n\t\t\tplaceholder.appendChild(label);\r\n\t\t}\r\n\r\n\t\t// replace text input with system font list\r\n\t\tif (chrome.fontSettings) {\r\n\t\t\tvar input = document.getElementById('options_font');\r\n\t\t\tvar select = document.createElement('select');\r\n\t\t\tinput.parentNode.replaceChild(select, input);\r\n\t\t\tselect.id = input.id;\r\n\t\t}\r\n\r\n\t\t// show settings\r\n\t\tfor (var key in config)\r\n\t\t\tinitConfig(key);\r\n\r\n\t\tloadSettings();\r\n\r\n\t\t// load themes\r\n\t\tvar select = document.getElementById('options_theme');\r\n\t\tif (select.childNodes.length === 0) {\r\n\t\t\tfor (var i in themes) {\r\n\t\t\t\tvar option = document.createElement('option');\r\n\t\t\t\toption.innerText = i;\r\n\t\t\t\tif (i == getConfig('theme'))\r\n\t\t\t\t\toption.selected = 'selected';\r\n\t\t\t\tselect.appendChild(option);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// load font list\r\n\t\tif (chrome.fontSettings) {\r\n\t\t\tchrome.fontSettings.getFontList(function(fonts) {\r\n\t\t\t\tvar select = document.getElementById('options_font');\r\n\t\t\t\tif (select.childNodes.length > 0)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tfonts.unshift({ fontId: 'Sans-serif' });\r\n\t\t\t\tfor (var i = 0; i < fonts.length; i++) {\r\n\t\t\t\t\tvar font = fonts[i].fontId;\r\n\t\t\t\t\tvar option = document.createElement('option');\r\n\t\t\t\t\toption.innerText = font;\r\n\t\t\t\t\tif (font == getConfig('font'))\r\n\t\t\t\t\t\toption.selected = 'selected';\r\n\t\t\t\t\tselect.appendChild(option);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n\r\n// show options panel\r\nfunction showOptions(show) {\r\n\tdocument.getElementById('options').style.display = show ? 'block' : 'none';\r\n\tif (show) {\r\n\t\tif (!settingsInitialized)\r\n\t\t\tinitSettings();\r\n\t\tfor (var key in config)\r\n\t\t\tshowConfig(key);\r\n\t}\r\n}\r\n\r\n// initialize page\r\nloadSettings();\r\nloadColumns();\r\n\r\n// keyboard shortcuts\r\ndocument.addEventListener('keypress', function(event) {\r\n\tif (event.keyCode == 13 && event.target && event.target.onclick && event.target.tagName == 'A') {\r\n\t\tevent.target.dispatchEvent(new MouseEvent('click'));\r\n\t\tevent.preventDefault();\r\n\t}\r\n});\r\ndocument.addEventListener('mousedown', function(event) {\r\n\tdocument.body.classList.add('hide-focus');\r\n});\r\ndocument.addEventListener('keydown', function(event) {\r\n\tdocument.body.classList.remove('hide-focus');\r\n});\r\n\r\nwindow.onresize = function(event) {\r\n\tupdateTooltips();\r\n};\r\n\r\n// load options panel\r\ndocument.getElementById('options_button').onclick = function() {\r\n\tshowOptions(true);\r\n\treturn false;\r\n};\r\nif (location.search === '?options')\r\n\tshowOptions(true);\r\n\r\n// refresh recently closed\r\nif (chrome.sessions)\r\n\tchrome.sessions.onChanged.addListener(refreshClosed);\r\n"
  },
  {
    "path": "privacy.md",
    "content": "# Privacy Policy\n\nHumble New Tab Page does not collect, store, or share any user data or personal information, with the following exception:\n\n- (Firefox only) To display website icons, the domain names of websites shown may be shared with the user selected third party: [DuckDuckGo](https://duckduckgo.com/privacy), [Qwant](https://about.qwant.com/legal/privacy/), [Google](https://policies.google.com/privacy), [Favicon Kit](https://faviconkit.com/), or [Yandex](https://yandex.com/legal/confidential/). This is configurable in the options.\n"
  }
]