Skip to content

Commit

Permalink
* adjust print of breakshot
Browse files Browse the repository at this point in the history
  • Loading branch information
victorferraz committed Apr 25, 2015
1 parent f461237 commit bcdfbb6
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "BreakShot",
"description": "",
"description": "break-shot",
"version": "0.1.0",
"devDependencies": {
"node-webkit-builder": "^1.0.11"
}
Expand Down
4 changes: 4 additions & 0 deletions public/app/scripts/client/vendor/jquery.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public/app/scripts/process/TakePrintScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ TakePrintScreen.prototype.takePics = function (mediaArray, data) {
};


TakePrintScreen.prototype.getPath = function (args) {
TakePrintScreen.prototype.getPath = function () {
var path = '';
this.btSave.val('');
if ( this.data.from === 'from-url' ){
path = this.data.url;
path = path.replace('http://', '');
} else {
path = 'file://' + args.html;
path = this.data.origin;
}
return path;
};
Expand Down Expand Up @@ -68,7 +68,7 @@ TakePrintScreen.prototype.take = function (sizes) {
var arrayWidth = this.getWidth(sizes);
var path;
this.index++;
path = this.getPath(this.data.origin);
path = this.getPath();
console.log(path);
var pgeres = new pageres({delay: 5})
.src(path, arrayWidth, {'filename': this.data.fileName + '<%= url %>-<%= size %>', 'format': this.data.extension })
Expand Down
5 changes: 2 additions & 3 deletions public/app/scripts/process/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ Controller.prototype.go = function (data) {
}).then( function(urlMain) {
console.log(urlMain);
var media = '';
media = MediaQuerieRotine.getBreakPoints(urlMain, settings);
if (data.size === 'auto-sizing') {
// media = DefaultSizes.getCommomScreens(settings);
media = MediaQuerieRotine.getBreakPoints(urlMain, settings);
} else {
// media = CustomSize.getSizes(settings);
media = CustomSize.getSizes(settings);
}
return media;
}).then( function(mediaQueries) {
Expand Down
1 change: 1 addition & 0 deletions public/app/scripts/process/getcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GetCss.prototype.getCss = function (file) {
for(var index=0; index < style.length; index++){
array = [];
array.css = path + style[index].attribs.href;
array.path = path;
array.html = file[i].html;
link.push(array);
}
Expand Down
13 changes: 5 additions & 8 deletions public/app/scripts/process/mediaQuerieRotine.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ MediaQuerieRotine.prototype.readCss = function (style) {
};

MediaQuerieRotine.prototype.readArrayFiles = function (file) {
console.log(file);
var array = [];
var deferred = Q.defer();
fs.readFile(file.css, 'utf8', function(err, result){
Expand Down Expand Up @@ -117,19 +116,17 @@ MediaQuerieRotine.prototype.getMedia = function (cssFile) {
this.urlHtml = cssFile.html;
res = this.findAdBanner(tree.rules);
if (res !== null && res !== undefined){
console.log(res);
arrayBanner.push(res);
}

}
}
if ( arrayBanner.length >0 ) {
console.log(arrayBanner.length);
arrayMedia = media.concat(arrayBanner);
arrayMedia = arrayBanner;
} else {
console.log(media);
arrayMedia = media;
}
console.log(arrayMedia);

return arrayMedia;
};
Expand All @@ -140,7 +137,7 @@ MediaQuerieRotine.prototype.findAdBanner = function (tree) {
var res = null;
for(var i=0; i < tree.length; i++){
if (tree[i].selectors !== undefined) {
item = this.findKey(tree[i], '#background');
item = this.findKey(tree[i], '#breakshot');
if (item !== undefined){
res = item;
}
Expand All @@ -167,10 +164,10 @@ MediaQuerieRotine.prototype.findProperties = function (obj){
var items = [];
for(var i=0; i < obj.declarations.length; i++) {
if (obj.declarations[i].name === 'width'){
items.size = obj.declarations[i].value + 'x';
items.size = obj.declarations[i].value.replace( /\D/g, '') + 'x';
}
if (obj.declarations[i].name === 'height') {
items.size = items.size + obj.declarations[i].value;
items.size = items.size + obj.declarations[i].value.replace( /\D/g, '');
}
}
if('height' in items && 'width'in items) {
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ <h2>Preview &amp; Save</h2>
</div>
</aside>
</main>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="app/scripts/client/vendor/jquery.js"></script>
<script src="app/scripts/client/main.js"></script>
</body>
</html>
12 changes: 5 additions & 7 deletions public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@
},
"dependencies": {
"async": "^0.9.0",
"cheerio": "^0.19.0",
"fs-tools": "^0.2.11",
"gulp": "^3.8.10",
"mensch": "^0.3.1",
"needle": "^0.7.10",
"webshot": "^0.15.3"
"needle": "^0.7.11",
"nwglobal": "0.0.2",
"q": "^1.2.0",
"request": "^2.55.0"
},
"devDependencies": {
"gaze": "^0.6.4",
"q": "^1.0.1",
"unzip": "^0.1.9",
"webshot": "^0.15.3"
}
}

0 comments on commit bcdfbb6

Please sign in to comment.