Skip to content

Commit 4e8c5c1

Browse files
committed
Merge pull request #28 from peterdotjs/dev
Dev
2 parents 2974c8e + 935c349 commit 4e8c5c1

17 files changed

+1453
-165
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Gruntfile.js

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
module.exports = function(grunt) {
2+
grunt.initConfig({
3+
pkg: grunt.file.readJSON('package.json'),
4+
concat: {
5+
basic: {
6+
src: [
7+
'js/tracking.js',
8+
'js/resize.js',
9+
'js/main_view.js',
10+
'js/custom_view.js',
11+
'js/options.js',
12+
'js/layout.js',
13+
'js/utility.js',
14+
'js/display.js',
15+
'js/main.js'
16+
],
17+
dest: 'public/<%= pkg.name %>.js'
18+
},
19+
extras: {
20+
src: [
21+
'js/background.js'
22+
],
23+
dest: 'public/<%= pkg.name %>_background.js'
24+
}
25+
},
26+
jshint: {
27+
beforeconcat: [
28+
'js/tracking.js',
29+
'js/resize.js',
30+
'js/main_view.js',
31+
'js/custom_view.js',
32+
'js/options.js',
33+
'js/layout.js',
34+
'js/utility.js',
35+
'js/display.js',
36+
'js/main.js',
37+
'js/background.js'
38+
],
39+
afterconcat: [
40+
'public/<%= pkg.name %>.js',
41+
'public/<%= pkg.name %>_background.js'
42+
]
43+
},
44+
uglify: {
45+
my_target: {
46+
files: {
47+
'public/<%= pkg.name %>.min.js': ['public/<%= pkg.name %>.js'],
48+
'public/<%= pkg.name %>_background.min.js': ['public/<%= pkg.name %>_background.js']
49+
}
50+
}
51+
},
52+
less: {
53+
production: {
54+
options: {
55+
cleancss: true
56+
},
57+
files: {
58+
"public/style.css": "css/index.less"
59+
}
60+
}
61+
}
62+
});
63+
64+
['grunt-contrib-concat', 'grunt-contrib-jshint', 'grunt-contrib-uglify', 'grunt-contrib-less'].forEach(grunt.loadNpmTasks);
65+
66+
grunt.registerTask('default', ['concat', 'jshint', 'uglify', 'less']);
67+
};

css/index.css

-124
This file was deleted.

css/style.less

+3-3
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ button.disabled {
634634
display: none;
635635
z-index: 5;
636636
.modal-body {
637-
width: 450px;
637+
width: 550px;
638638
height: 400px;
639639

640640
.header-title-wrap {
@@ -667,7 +667,7 @@ button.disabled {
667667
li.update-entry {
668668
list-style: disc;
669669
margin-bottom: 10px;
670-
line-height: 16px;
670+
line-height: 18px;
671671
}
672672
}
673673

@@ -915,7 +915,7 @@ body {
915915
}
916916

917917
.modal-body {
918-
height: 300px;
918+
height: 350px;
919919
}
920920
}
921921

index.html

+6-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@
22
<html>
33
<head>
44
<title>Resize</title>
5-
<link rel="stylesheet" href="css/index.css" type="text/css">
6-
<script type="text/javascript" src="js/tracking.js"></script>
5+
<link rel="stylesheet" href="public/style.css" type="text/css">
76
<script type="text/javascript" src="js/lib/jquery.min.js"></script>
8-
<script type="text/javascript" src="js/resize.js"></script>
9-
<script type="text/javascript" src="js/main_view.js"></script>
10-
<script type="text/javascript" src="js/custom_view.js"></script>
11-
<script type="text/javascript" src="js/options.js"></script>
12-
<script type="text/javascript" src="js/layout.js"></script>
13-
<script type="text/javascript" src="js/utility.js"></script>
14-
<script type="text/javascript" src="js/display.js"></script>
15-
<script type="text/javascript" src="js/main.js"></script>
7+
<script type="text/javascript" src="public/tabResize.min.js"></script>
168
</head>
179
<body>
1810
<div class="main-view">
@@ -125,7 +117,7 @@
125117
<div class="header-title-wrap">
126118
<div class="icon-48"></div>
127119
<div class="header-title">
128-
Tab Resize 2.1 Updates
120+
Tab Resize 2.1.1 Updates
129121
</div>
130122
</div>
131123
<div class="update-list-header">What's New:</div>
@@ -142,6 +134,9 @@
142134
<li class="update-entry latest">
143135
<strong>Drag and drop for sorting layouts</strong> - Click and hold on any layout and drag to rearange order to your liking
144136
</li>
137+
<li class="update-entry latest">
138+
<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>
139+
</li>
145140
</ul>
146141
<div class="update-list-footer bold">
147142
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.

js/background.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if(!localStorage.getItem('updateBadge')){
77
}
88

99
if(!localStorage.getItem('version')){
10-
localStorage.setItem('version','2.1');
10+
localStorage.setItem('version','2.1.1');
1111
}
1212

1313
var util = {

js/display.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@
5555
$el.append(template);
5656
}
5757
//need to start building the dom display
58-
resize.currentWindowTabs = windowInfo.tabs;
59-
resize.layout.processTabInfo();
60-
58+
chrome.tabs.query({currentWindow: true, highlighted: true},
59+
function (tabs) {
60+
if(tabs.length > 1){
61+
resize.currentWindowTabs = tabs;
62+
} else {
63+
resize.currentWindowTabs = windowInfo.tabs;
64+
}
65+
resize.layout.processTabInfo();
66+
});
6167
});
6268
});
63-
6469
//event handling for selecting the display
65-
//
6670
}
6771
};
6872

@@ -122,7 +126,7 @@
122126
return {
123127
width: defaultWidth,
124128
height: defaultHeight
125-
}
129+
};
126130
}
127131

128132
function setDisplayHeight(scale,height){

js/main_view.js

+22-15
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@
8787
}
8888

8989
var curVersion = localStorage.getItem('version') || '',
90-
isOldVersion = (curVersion === '2.0');
90+
isOldVersion = (curVersion < '2.1.1' && curVersion !== '');
91+
92+
var $body = $('body');
93+
9194
//user has never seen update
9295
if(!localStorage.getItem('update-seen') || isOldVersion){
93-
var $body = $('body');
9496
$body.addClass('update');
9597
if(isOldVersion){
9698
localStorage.removeItem('update-seen');
@@ -102,7 +104,6 @@
102104
}
103105

104106
if(localStorage.getItem('update-seen') && updateCount === resize.badgeLimit && !localStorage.getItem('promo-seen')){
105-
var $body = $('body');
106107
$body.addClass('promo');
107108
resize.options.showPromoModal();
108109
}
@@ -183,20 +184,26 @@
183184
window.chrome.tabs.query({currentWindow: true},
184185
function (tabs) {
185186
resize.tabsArray = tabs;
186-
window.chrome.tabs.query({currentWindow: true, active: true},
187-
function (tab) {
188-
resize.currentTab = tab[0];
189-
var cb = function(){
190-
return backJs.util.processTabs(resize, resize.tabsArray, resize.currentTab.index, resize.currentTab.windowId, resize.singleTab, resize.currentTab.incognito);
191-
};
192-
if(resize.singleTab){
193-
backJs.util.setUndoStorage(resize,resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(resize.currentTab.index,resize.currentTab.index + 1), cb);
194-
} else {
195-
backJs.util.setUndoStorage(resize, resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(resize.currentTab.index), cb);
196-
}
187+
window.chrome.tabs.query({currentWindow: true, highlighted: true},
188+
function (tab) {
189+
resize.currentTab = tab[0];
190+
var index = resize.currentTab.index;
191+
if(tab.length > 1){
192+
resize.tabsArray = tab;
193+
index = 0;
194+
}
197195

196+
var cb = function(){
197+
return backJs.util.processTabs(resize, resize.tabsArray, index, resize.currentTab.windowId, resize.singleTab, resize.currentTab.incognito);
198+
};
199+
if(resize.singleTab){
200+
backJs.util.setUndoStorage(resize,resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(index,index + 1), cb);
201+
} else {
202+
backJs.util.setUndoStorage(resize,resize.currentTab.index,resize.currentTab.windowId, resize.tabsArray.slice(index), cb);
198203
}
199-
);
204+
205+
}
206+
);
200207
}
201208
);
202209
}

js/options.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
$('body').removeClass('update');
171171
$('.main-view').removeClass('inactive');
172172
localStorage.setItem('update-seen',true);
173-
localStorage.setItem('version','2.1');
173+
localStorage.setItem('version','2.1.1');
174174
},
175175

176176
/**

js/tracking.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ function sendTracking(category, label) {
99
if(!deferTracking && ga) {
1010
ga('send','event', category, 'clicked', label || "na");
1111
}
12-
};
12+
}
1313

1414
if(!deferTracking) {
1515
// Standard Google Universal Analytics code
16+
/* jshint ignore:start */
1617
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1718
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
1819
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
1920
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); // Note: https protocol here
20-
21+
/* jshint ignore:end */
2122
ga('create', 'UA-34217520-2', 'auto');
2223
ga('set', 'checkProtocolTask', function(){}); // Removes failing protocol check. @see: http://stackoverflow.com/a/22152353/1958200
2324
ga('require', 'displayfeatures');

manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Tab Resize - split screen layouts",
33
"short_name": "Tab Resize",
4-
"version": "2.1",
4+
"version": "2.1.1",
55
"manifest_version": 2,
66
"description": "Split Screen made easy. Resize the CURRENT tab and tabs to the RIGHT into layouts on separate windows. w/ Multi Monitor Support.",
77
"browser_action": {
@@ -14,7 +14,7 @@
1414
"128": "images/icons/icon128.png" },
1515
"permissions": ["tabs", "system.display"],
1616
"background": {
17-
"scripts": ["js/lib/jquery.min.js","js/background.js"]
17+
"scripts": ["js/lib/jquery.min.js","public/tabResize_background.min.js"]
1818
},
1919
"offline_enabled": true,
2020
"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'",

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "tabResize",
3+
"version": "0.2.1",
4+
"devDependencies": {
5+
"grunt": "~0.4.5",
6+
"grunt-contrib-concat": "~0.5.0",
7+
"grunt-contrib-uglify": "~0.5.1",
8+
"grunt-contrib-less":"~0.11.4",
9+
"grunt-contrib-jshint":"~0.10.0"
10+
}
11+
}

public/style.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)