Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: New tab page #153

Merged
merged 3 commits into from
Jul 4, 2017
Merged

feature: New tab page #153

merged 3 commits into from
Jul 4, 2017

Conversation

dnarcese
Copy link
Collaborator

No description provided.

@dnarcese dnarcese requested review from bwinton and ericawright May 30, 2017 18:31
Copy link
Owner

@bwinton bwinton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works pretty nicely, but there are a few things I'd like to see changed before we merge it. 😄

<div id="newtab-vertical-margin">
<div id="newtab-margin-top"></div>
<div>
<iframe src="https://duckduckgo.com/search.html?prefill=Search DuckDuckGo&focus=yes" style="display: block;overflow:hidden;margin: auto;padding:0;width:551px;height:40px;" frameborder="0"></iframe>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the & should probably be an &amp; for historical reasons…

bundle.js Outdated
@@ -0,0 +1,2164 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did this come from? It seems kinda big…

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

browserify created that

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer we included something in a package.json file, and ran browserify as part of a build script.

browser.topSites.get().then((topSitesArray) => {
var grid = document.querySelector("#newtab-grid");
grid.innerHTML = "";
for (let topSite of topSitesArray) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, on first run, I only see seven or eight top sites, and they're centered which looks kind of odd… Could we maybe use a grid layout to make things line up better? (I think grid-auto-columns and grid-auto-rows will help with this…)

grid.innerHTML +=
"<div class='newtab-cell'><div class='newtab-site' draggable='true' type='history'>"+
"<a class='newtab-link' title="+topSite.title+" href="+topSite.url+">"+
"<span class='newtab-thumbnail thumbnail' style='background-size: cover; background-image: ;'></span>"+
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really also add a contextmenu item to let people copy the thumbnail url. (It was one of our most requested features!)

}, onError);
}
function initialize(){
fetch(url).then(function(response){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is the second place we have code like this, if I remember correctly. Can we extract it into a utility function in another file?


var placeholders = [];
var url = 'https://bwinton.github.io/whimsy/thumbnail-gifs.txt';
var getting = browser.storage.sync.get('newtab');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's save this into a pref, like in the PR I submitted a couple of days ago…

//set default thumbnail
var href = link.href;
link.querySelectorAll(".thumbnail").forEach(function(img){
//set gifs
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a lot of code, let's pull it out into a function.

setThumbnail();
//refresh open new tab pages
var querying = browser.tabs.query({title: "New Tab"});
querying.then((tabs) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only reload the tabs if they're about:newtab (or whatever our moz-extension newtab url is)?

@dnarcese
Copy link
Collaborator Author

dnarcese commented Jun 1, 2017

Some changes are taking too long, will come back to them at a later time.

Issue #154

@dnarcese dnarcese force-pushed the newtab-page branch 2 times, most recently from da7cf72 to 7bde978 Compare July 4, 2017 17:18
var tippyTopSites = require('tippy-top-sites');
var pref = null;

// initialize('https://bwinton.github.io/whimsy/thumbnail-gifs.txt')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove commented code

}
}, onError)
.then(initialize('https://bwinton.github.io/whimsy/thumbnail-gifs.txt', setThumbnail))
//.then(setThumbnail(placeholders));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

@ericawright ericawright merged commit dfa0ea1 into webextension Jul 4, 2017
@dnarcese dnarcese deleted the newtab-page branch July 4, 2017 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants