Skip to content

Commit

Permalink
Merge pull request peterdotjs#28 from peterdotjs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
peterdotjs committed Sep 13, 2014
2 parents 2974c8e + 935c349 commit 4e8c5c1
Show file tree
Hide file tree
Showing 17 changed files with 1,453 additions and 165 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
67 changes: 67 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
basic: {
src: [
'js/tracking.js',
'js/resize.js',
'js/main_view.js',
'js/custom_view.js',
'js/options.js',
'js/layout.js',
'js/utility.js',
'js/display.js',
'js/main.js'
],
dest: 'public/<%= pkg.name %>.js'
},
extras: {
src: [
'js/background.js'
],
dest: 'public/<%= pkg.name %>_background.js'
}
},
jshint: {
beforeconcat: [
'js/tracking.js',
'js/resize.js',
'js/main_view.js',
'js/custom_view.js',
'js/options.js',
'js/layout.js',
'js/utility.js',
'js/display.js',
'js/main.js',
'js/background.js'
],
afterconcat: [
'public/<%= pkg.name %>.js',
'public/<%= pkg.name %>_background.js'
]
},
uglify: {
my_target: {
files: {
'public/<%= pkg.name %>.min.js': ['public/<%= pkg.name %>.js'],
'public/<%= pkg.name %>_background.min.js': ['public/<%= pkg.name %>_background.js']
}
}
},
less: {
production: {
options: {
cleancss: true
},
files: {
"public/style.css": "css/index.less"
}
}
}
});

['grunt-contrib-concat', 'grunt-contrib-jshint', 'grunt-contrib-uglify', 'grunt-contrib-less'].forEach(grunt.loadNpmTasks);

grunt.registerTask('default', ['concat', 'jshint', 'uglify', 'less']);
};
124 changes: 0 additions & 124 deletions css/index.css

This file was deleted.

6 changes: 3 additions & 3 deletions css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ button.disabled {
display: none;
z-index: 5;
.modal-body {
width: 450px;
width: 550px;
height: 400px;

.header-title-wrap {
Expand Down Expand Up @@ -667,7 +667,7 @@ button.disabled {
li.update-entry {
list-style: disc;
margin-bottom: 10px;
line-height: 16px;
line-height: 18px;
}
}

Expand Down Expand Up @@ -915,7 +915,7 @@ body {
}

.modal-body {
height: 300px;
height: 350px;
}
}

Expand Down
17 changes: 6 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@
<html>
<head>
<title>Resize</title>
<link rel="stylesheet" href="css/index.css" type="text/css">
<script type="text/javascript" src="js/tracking.js"></script>
<link rel="stylesheet" href="public/style.css" type="text/css">
<script type="text/javascript" src="js/lib/jquery.min.js"></script>
<script type="text/javascript" src="js/resize.js"></script>
<script type="text/javascript" src="js/main_view.js"></script>
<script type="text/javascript" src="js/custom_view.js"></script>
<script type="text/javascript" src="js/options.js"></script>
<script type="text/javascript" src="js/layout.js"></script>
<script type="text/javascript" src="js/utility.js"></script>
<script type="text/javascript" src="js/display.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="public/tabResize.min.js"></script>
</head>
<body>
<div class="main-view">
Expand Down Expand Up @@ -125,7 +117,7 @@
<div class="header-title-wrap">
<div class="icon-48"></div>
<div class="header-title">
Tab Resize 2.1 Updates
Tab Resize 2.1.1 Updates
</div>
</div>
<div class="update-list-header">What's New:</div>
Expand All @@ -142,6 +134,9 @@
<li class="update-entry latest">
<strong>Drag and drop for sorting layouts</strong> - Click and hold on any layout and drag to rearange order to your liking
</li>
<li class="update-entry latest">
<strong>Highlighted tabs now can be resized</strong> - when 2 or more tabs are highlighted, only these tabs will be considered for resize. Credit goes to F.C. for the idea. <a target="_blank" href="http://www.cnet.com/how-to/how-to-manipulate-multiple-tabs-in-chrome-or-firefox/" title="In Chrome, you can select multiple tabs by clicking on tabs while holding down the Ctrl (Command for Mac) key or select a range of tabs by holding down the Shift key and clicking. http://www.cnet.com/how-to/how-to-manipulate-multiple-tabs-in-chrome-or-firefox/">Hover for more info.</a>
</li>
</ul>
<div class="update-list-footer bold">
You can checkout the <a target="_blank" href="https://www.youtube.com/watch?v=GFHl98nAV04" title="https://www.youtube.com/watch?v=GFHl98nAV04">video demo</a> for a more detailed description.
Expand Down
2 changes: 1 addition & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(!localStorage.getItem('updateBadge')){
}

if(!localStorage.getItem('version')){
localStorage.setItem('version','2.1');
localStorage.setItem('version','2.1.1');
}

var util = {
Expand Down
16 changes: 10 additions & 6 deletions js/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@
$el.append(template);
}
//need to start building the dom display
resize.currentWindowTabs = windowInfo.tabs;
resize.layout.processTabInfo();

chrome.tabs.query({currentWindow: true, highlighted: true},
function (tabs) {
if(tabs.length > 1){
resize.currentWindowTabs = tabs;
} else {
resize.currentWindowTabs = windowInfo.tabs;
}
resize.layout.processTabInfo();
});
});
});

//event handling for selecting the display
//
}
};

Expand Down Expand Up @@ -122,7 +126,7 @@
return {
width: defaultWidth,
height: defaultHeight
}
};
}

function setDisplayHeight(scale,height){
Expand Down
37 changes: 22 additions & 15 deletions js/main_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@
}

var curVersion = localStorage.getItem('version') || '',
isOldVersion = (curVersion === '2.0');
isOldVersion = (curVersion < '2.1.1' && curVersion !== '');

var $body = $('body');

//user has never seen update
if(!localStorage.getItem('update-seen') || isOldVersion){
var $body = $('body');
$body.addClass('update');
if(isOldVersion){
localStorage.removeItem('update-seen');
Expand All @@ -102,7 +104,6 @@
}

if(localStorage.getItem('update-seen') && updateCount === resize.badgeLimit && !localStorage.getItem('promo-seen')){
var $body = $('body');
$body.addClass('promo');
resize.options.showPromoModal();
}
Expand Down Expand Up @@ -183,20 +184,26 @@
window.chrome.tabs.query({currentWindow: true},
function (tabs) {
resize.tabsArray = tabs;
window.chrome.tabs.query({currentWindow: true, active: true},
function (tab) {
resize.currentTab = tab[0];
var cb = function(){
return backJs.util.processTabs(resize, resize.tabsArray, resize.currentTab.index, resize.currentTab.windowId, resize.singleTab, resize.currentTab.incognito);
};
if(resize.singleTab){
backJs.util.setUndoStorage(resize,resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(resize.currentTab.index,resize.currentTab.index + 1), cb);
} else {
backJs.util.setUndoStorage(resize, resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(resize.currentTab.index), cb);
}
window.chrome.tabs.query({currentWindow: true, highlighted: true},
function (tab) {
resize.currentTab = tab[0];
var index = resize.currentTab.index;
if(tab.length > 1){
resize.tabsArray = tab;
index = 0;
}

var cb = function(){
return backJs.util.processTabs(resize, resize.tabsArray, index, resize.currentTab.windowId, resize.singleTab, resize.currentTab.incognito);
};
if(resize.singleTab){
backJs.util.setUndoStorage(resize,resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(index,index + 1), cb);
} else {
backJs.util.setUndoStorage(resize,resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(index), cb);
}
);

}
);
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
$('body').removeClass('update');
$('.main-view').removeClass('inactive');
localStorage.setItem('update-seen',true);
localStorage.setItem('version','2.1');
localStorage.setItem('version','2.1.1');
},

/**
Expand Down
5 changes: 3 additions & 2 deletions js/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ function sendTracking(category, label) {
if(!deferTracking && ga) {
ga('send','event', category, 'clicked', label || "na");
}
};
}

if(!deferTracking) {
// Standard Google Universal Analytics code
/* jshint ignore:start */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); // Note: https protocol here

/* jshint ignore:end */
ga('create', 'UA-34217520-2', 'auto');
ga('set', 'checkProtocolTask', function(){}); // Removes failing protocol check. @see: http://stackoverflow.com/a/22152353/1958200
ga('require', 'displayfeatures');
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Tab Resize - split screen layouts",
"short_name": "Tab Resize",
"version": "2.1",
"version": "2.1.1",
"manifest_version": 2,
"description": "Split Screen made easy. Resize the CURRENT tab and tabs to the RIGHT into layouts on separate windows. w/ Multi Monitor Support.",
"browser_action": {
Expand All @@ -14,7 +14,7 @@
"128": "images/icons/icon128.png" },
"permissions": ["tabs", "system.display"],
"background": {
"scripts": ["js/lib/jquery.min.js","js/background.js"]
"scripts": ["js/lib/jquery.min.js","public/tabResize_background.min.js"]
},
"offline_enabled": true,
"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'",
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "tabResize",
"version": "0.2.1",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-less":"~0.11.4",
"grunt-contrib-jshint":"~0.10.0"
}
}
1 change: 1 addition & 0 deletions public/style.css

Large diffs are not rendered by default.

Loading

0 comments on commit 4e8c5c1

Please sign in to comment.