Tweak drawing.js to have a better default margin that never truncates image ids on the left in small widths. Tweak the screenshot generator to use the smallest possible width. Remove tabs from several files. Add the browser-chrome plugin to wrap phantomjs screenshots with browser chrome. Add some repository descriptions to the dataset generator. Switch to using our own screenshots vs those hosted on blogger.
This commit is contained in:
parent
04b8a009da
commit
4040bb37c6
15 changed files with 391 additions and 155 deletions
39
static/lib/browser-chrome.js
Normal file
39
static/lib/browser-chrome.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
(function(browserchrome, $) {
|
||||
var htmlTemplate = '<div class="browser-chrome-container"><div class="browser-chrome-header"><i class="icon-remove-sign"></i> <i class="icon-minus-sign"></i> <i class="icon-plus-sign"></i><div class="browser-chrome-tab"><div class="browser-chrome-tab-wrapper"><div class="browser-chrome-tab-content"><i class="icon-file-alt icon-large"></i> <span class="tab-title">Tab Title</span></div></div></div><div class="user-icon-container"><i class="icon-user icon-2x"></i></div></div><div class="browser-chrome-url-bar"><div class="left-controls"><i class="icon-arrow-left icon-large"></i> <i class="icon-arrow-right icon-large"></i> <i class="icon-rotate-right icon-large"></i> </div><div class="right-controls"> <i class="icon-reorder icon-large"></i></div><div class="browser-chrome-url"><span class="protocol-https" style="display: none"><i class="icon-lock"></i>https</span><span class="protocol-http"><i class="icon-file-alt"></i>http</span><span class="url-text">://google.com/</span></div></div></div>'
|
||||
|
||||
browserchrome.update = function() {
|
||||
$('[data-screenshot-url]').each(function(index, element) {
|
||||
var elem = $(element);
|
||||
if (!elem.data('has-chrome')) {
|
||||
// Create chrome
|
||||
var createdHtml = $(htmlTemplate);
|
||||
|
||||
// Add the new chrome to the page where the image was
|
||||
elem.replaceWith(createdHtml);
|
||||
|
||||
// Add the image to the new browser chrome html
|
||||
createdHtml.append(elem);
|
||||
|
||||
// Set the tab title
|
||||
var tabTitle = elem.attr('title') || elem.data('tab-title');
|
||||
createdHtml.find('.tab-title').text(tabTitle);
|
||||
|
||||
// Pick the protocol and set the url
|
||||
var url = elem.data('screenshot-url');
|
||||
if (url.substring(0, 6) === 'https:') {
|
||||
createdHtml.find('.protocol-http').hide();
|
||||
createdHtml.find('.protocol-https').show();
|
||||
url = url.substring(5);
|
||||
} else {
|
||||
createdHtml.find('.protocol-http').hide();
|
||||
createdHtml.find('.protocol-https').show();
|
||||
url = url.substring(4);
|
||||
}
|
||||
console.log('setting url to: ' + url);
|
||||
createdHtml.find('.url-text').text(url);
|
||||
|
||||
elem.data('has-chrome', 'true');
|
||||
}
|
||||
});
|
||||
};
|
||||
}(window.browserchrome = window.browserchrome || {}, window.jQuery));
|
Reference in a new issue