Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
[WIP] OpenPureTab - An open source extension for Chrome-based browsers that allows customization of the new-tab page.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="griimnak" data-source="post: 434006" data-attributes="member: 35695"><p><span style="font-size: 26px"><strong>Committed</strong></span></p><p></p><p><span style="font-size: 18px"><strong>Added favicons to topsites display & fixed css bugs</strong></span></p><p>[CODE=php]</p><p><img src="https://www.google.com/s2/favicons?domain=${url}" /></p><p>[/CODE]</p><p></p><p><span style="font-size: 18px"><strong>Added another style</strong></span></p><p>"Ball" style</p><p>[CODE=php]</p><p>function drawBallStyle() {</p><p> function appendBallStyle(title, url, inner) {</p><p> var html = `</p><p> <a href="${url}" class="tile"></p><p> <img src="https://www.google.com/s2/favicons?domain=${url}" /></p><p> </a></p><p> `;</p><p></p><p> document.getElementById("topsites-ball").innerHTML += html;</p><p> }</p><p></p><p> var inner = `</p><p> <div class="topsites-ball"></p><p> <div id="topsites-ball" style="margin:0 auto;padding-left:5px;"></p><p></p><p> </div></p><p> </div></p><p> `;</p><p></p><p> content.innerHTML += inner;</p><p> for(var i=0;i<data.length;i++) {</p><p> appendBallStyle(data[i].title, data[i].url);</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p></p><p><span style="font-size: 18px"><strong>More settings (defaults displayed below)</strong></span></p><p>[CODE=php]</p><p> var keys =</p><p> {</p><p> "name": name,</p><p> "location": location,</p><p> "theme": theme,</p><p> "background":{"type":"default","value":"default"},</p><p> "widget_clock":"enabled_style1",</p><p> "widget_ctext": {</p><p> "enabled": "false",</p><p> "value": ""</p><p> },</p><p> "widget_topsites": "enabled_ball"</p><p> };</p><p>[/CODE]</p><p></p><ul> <li data-xf-list-type="ul">Added ability to disable / enable clock</li> <li data-xf-list-type="ul">Added ability to set custom text in place of clock</li> </ul><p></p><p><img src="https://image.prntscr.com/image/JFegmvXbTTGOfaZQJ9k8jA.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p></p><p>Just customization and aesthetics for newtab without Indian garbage <img src="/styles/default/xenforo/smilies/emojione/tongue.png" class="smilie" loading="lazy" alt=":p" title="Stick Out Tongue :p" data-shortname=":p" /></p><p></p><p></p><p>Ooh that looks pretty nice. At the moment i only have intentions of supporting chrome, but I will definitely look into that if i decide otherwise.</p><p>[doublepost=1526431570,1526191892][/doublepost]<strong><span style="font-size: 26px">Committed</span></strong></p><p></p><p><span style="font-size: 22px"><strong>Thumbnail generator finished</strong></span></p><p><img src="https://image.prntscr.com/image/9gB3YU-5QaWLZbc-oU9i8A.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><img src="https://image.prntscr.com/image/KmB2G53hSICXV5qYPZAHEw.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p>[CODE=php]</p><p>/*</p><p></p><p> Tab Query - Applies topSites thumbnails</p><p></p><p> Compares current tab URL with data[z].url (Topsite urls)</p><p> If data[z].url (Topsite urls) has an entry equal to active (current tab),</p><p> Check for http vs https and match if found</p><p> If active (current tab) exists in local storage, do nothing, otherwise</p><p> take screenshot of matched tab and insert into local storage</p><p></p><p>*/</p><p>function queryTab(active, active_id) {</p><p> var clean = active.replace(/^https:\/\//i, 'http://');</p><p> for(var z = 0; z < data.length; z++) {</p><p> if (data[z].url === active) {</p><p> match(active, active_id);</p><p> } else if (data[z].url === clean) {</p><p> match(clean, active_id);</p><p> }</p><p> }</p><p></p><p> function match(url, active_id) {</p><p> chrome.storage.local.get(null, function(resp) {</p><p> var toWork = resp.thumbs;</p><p></p><p> var found = false;</p><p> var i = 0;</p><p> for (i in toWork) {</p><p> if(toWork[i].url === url) {</p><p> found = true;</p><p> }</p><p> }</p><p></p><p> if (found == false) {</p><p> found = true;</p><p> captureAndSave();</p><p> }</p><p> });</p><p></p><p> function captureAndSave() {</p><p> chrome.storage.local.get(null, function(resp) {</p><p> var parse_obj = resp;</p><p></p><p> chrome.tabs.captureVisibleTab(function(dataUrl) {</p><p> parse_obj['thumbs'].push({"url": url, "image": dataUrl});</p><p></p><p> chrome.storage.local.set(parse_obj, function() {</p><p> return true;</p><p> });</p><p> });</p><p> });</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p></p><p><strong><span style="font-size: 22px">Created background daemon</span></strong></p><p>I'm eventually going to push message flashing here</p><p></p><p>[CODE=php]</p><p>/*</p><p></p><p> Initialize OPT Daemon</p><p></p><p>*/</p><p>var data;</p><p>// Retreive topsites on extension load / browser restart</p><p>chrome.topSites.get(function(response) {</p><p> data = response;</p><p>});</p><p></p><p>// Listen for tab updates</p><p>chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {</p><p> if(changeInfo.status == "complete") {</p><p> // Query tab when it is finished loading</p><p> queryTab(tab.url, tabId);</p><p> }</p><p>});</p><p></p><p>[/CODE]</p><p></p><p><strong><span style="font-size: 22px">Message flashing re-write</span></strong></p><p>[CODE=php]</p><p>/*</p><p></p><p> Global message flashing</p><p></p><p>*/</p><p>function flash(message) {</p><p> if (!chrome.storage.local) {</p><p> alert("Local storage is not accessible :(");</p><p> }</p><p></p><p> function isEmpty(obj) {</p><p> for(var key in obj) {</p><p> if(obj.hasOwnProperty(key)) {</p><p> return false;</p><p> }</p><p> }</p><p> return true;</p><p> }</p><p></p><p></p><p> // Set flash message</p><p> chrome.storage.local.set({"flashed_msg":message}, function() {</p><p> chrome.storage.local.get({"flashed_msg":message}, function(data) {</p><p> if (!isEmpty(data.flashed_msg)) {</p><p> console.log('==> flash();');</p><p> var html = `<div class="flash fadeInLoad">${data.flashed_msg}</div>`;</p><p> document.getElementById("flashes").innerHTML = html;</p><p></p><p> chrome.storage.local.set({"flashed_msg":""});</p><p> }</p><p> });</p><p> });</p><p>}</p><p></p><p>[/CODE]</p><p></p><p>Feel free to test out the thumbnail generator, could really use the help finding bugs, i'm sure there's going to be a few. I still suck at JSON key iteration</p><p>[doublepost=1526454001][/doublepost]<strong><span style="font-size: 26px">Committed</span></strong></p><p></p><p><strong><span style="font-size: 22px">Support for google doodles</span></strong></p><p><img src="https://image.prntscr.com/image/rjN0juBgSQGLXDCotI8yaA.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </p><p></p><p><span style="font-size: 22px"><strong>Improved Ball style, chrome style and added Tiny style</strong></span></p><p><img src="https://image.prntscr.com/image/ygUTt2zWRJW3Ft9Wc1zn_Q.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </p><p></p><p><img src="https://image.prntscr.com/image/LT9N4x1TTdGM5LdbYc_O7Q.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </p><p><img src="https://image.prntscr.com/image/Cd5q8FYiSzaThuNh-bM0bg.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p></blockquote><p></p>
[QUOTE="griimnak, post: 434006, member: 35695"] [SIZE=7][B]Committed[/B][/SIZE] [SIZE=5][B]Added favicons to topsites display & fixed css bugs[/B][/SIZE] [CODE=php] <img src="https://www.google.com/s2/favicons?domain=${url}" /> [/CODE] [SIZE=5][B]Added another style[/B][/SIZE] "Ball" style [CODE=php] function drawBallStyle() { function appendBallStyle(title, url, inner) { var html = ` <a href="${url}" class="tile"> <img src="https://www.google.com/s2/favicons?domain=${url}" /> </a> `; document.getElementById("topsites-ball").innerHTML += html; } var inner = ` <div class="topsites-ball"> <div id="topsites-ball" style="margin:0 auto;padding-left:5px;"> </div> </div> `; content.innerHTML += inner; for(var i=0;i<data.length;i++) { appendBallStyle(data[i].title, data[i].url); } } [/CODE] [SIZE=5][B]More settings (defaults displayed below)[/B][/SIZE] [CODE=php] var keys = { "name": name, "location": location, "theme": theme, "background":{"type":"default","value":"default"}, "widget_clock":"enabled_style1", "widget_ctext": { "enabled": "false", "value": "" }, "widget_topsites": "enabled_ball" }; [/CODE] [LIST] [*]Added ability to disable / enable clock [*]Added ability to set custom text in place of clock [/LIST] [IMG]https://image.prntscr.com/image/JFegmvXbTTGOfaZQJ9k8jA.png[/IMG] Just customization and aesthetics for newtab without Indian garbage :p Ooh that looks pretty nice. At the moment i only have intentions of supporting chrome, but I will definitely look into that if i decide otherwise. [doublepost=1526431570,1526191892][/doublepost][B][SIZE=7]Committed[/SIZE][/B] [SIZE=6][B]Thumbnail generator finished[/B][/SIZE] [IMG]https://image.prntscr.com/image/9gB3YU-5QaWLZbc-oU9i8A.png[/IMG] [IMG]https://image.prntscr.com/image/KmB2G53hSICXV5qYPZAHEw.png[/IMG] [CODE=php] /* Tab Query - Applies topSites thumbnails Compares current tab URL with data[z].url (Topsite urls) If data[z].url (Topsite urls) has an entry equal to active (current tab), Check for http vs https and match if found If active (current tab) exists in local storage, do nothing, otherwise take screenshot of matched tab and insert into local storage */ function queryTab(active, active_id) { var clean = active.replace(/^https:\/\//i, 'http://'); for(var z = 0; z < data.length; z++) { if (data[z].url === active) { match(active, active_id); } else if (data[z].url === clean) { match(clean, active_id); } } function match(url, active_id) { chrome.storage.local.get(null, function(resp) { var toWork = resp.thumbs; var found = false; var i = 0; for (i in toWork) { if(toWork[i].url === url) { found = true; } } if (found == false) { found = true; captureAndSave(); } }); function captureAndSave() { chrome.storage.local.get(null, function(resp) { var parse_obj = resp; chrome.tabs.captureVisibleTab(function(dataUrl) { parse_obj['thumbs'].push({"url": url, "image": dataUrl}); chrome.storage.local.set(parse_obj, function() { return true; }); }); }); } } } [/CODE] [B][SIZE=6]Created background daemon[/SIZE][/B] I'm eventually going to push message flashing here [CODE=php] /* Initialize OPT Daemon */ var data; // Retreive topsites on extension load / browser restart chrome.topSites.get(function(response) { data = response; }); // Listen for tab updates chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { if(changeInfo.status == "complete") { // Query tab when it is finished loading queryTab(tab.url, tabId); } }); [/CODE] [B][SIZE=6]Message flashing re-write[/SIZE][/B] [CODE=php] /* Global message flashing */ function flash(message) { if (!chrome.storage.local) { alert("Local storage is not accessible :("); } function isEmpty(obj) { for(var key in obj) { if(obj.hasOwnProperty(key)) { return false; } } return true; } // Set flash message chrome.storage.local.set({"flashed_msg":message}, function() { chrome.storage.local.get({"flashed_msg":message}, function(data) { if (!isEmpty(data.flashed_msg)) { console.log('==> flash();'); var html = `<div class="flash fadeInLoad">${data.flashed_msg}</div>`; document.getElementById("flashes").innerHTML = html; chrome.storage.local.set({"flashed_msg":""}); } }); }); } [/CODE] Feel free to test out the thumbnail generator, could really use the help finding bugs, i'm sure there's going to be a few. I still suck at JSON key iteration [doublepost=1526454001][/doublepost][B][SIZE=7]Committed[/SIZE][/B] [B][SIZE=6]Support for google doodles[/SIZE][/B] [IMG]https://image.prntscr.com/image/rjN0juBgSQGLXDCotI8yaA.png[/IMG] [SIZE=6][B]Improved Ball style, chrome style and added Tiny style[/B][/SIZE] [IMG]https://image.prntscr.com/image/ygUTt2zWRJW3Ft9Wc1zn_Q.png[/IMG] [IMG]https://image.prntscr.com/image/LT9N4x1TTdGM5LdbYc_O7Q.png[/IMG] [IMG]https://image.prntscr.com/image/Cd5q8FYiSzaThuNh-bM0bg.png[/IMG] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
[WIP] OpenPureTab - An open source extension for Chrome-based browsers that allows customization of the new-tab page.
Top