Cleanup project root

This commit is contained in:
jdescottes 2014-03-16 21:15:34 +01:00
parent 50e7d05764
commit 87574a2b30
204 changed files with 29 additions and 245 deletions

9
.gitignore vendored
View File

@ -13,10 +13,11 @@ npm-debug.log
*.stackdump
# builds
build
build/*.js
build/*.css
# Closure compiler generated JS binary.
build/closure/closure_compiled_binary.js
# marked as private
*.private.*
# Closure compiler generated JS binary.
closure_compiled_binary.js

View File

@ -10,15 +10,20 @@
* If you run this task locally, it may require some env set up first.
*/
var SOURCE_FOLDER = "src";
module.exports = function(grunt) {
var piskelScripts = require('./piskel-script-list.js').scripts;
var piskelStyles = require('./piskel-style-list.js').styles;
var mapToSrcFolder = function (path) {return [SOURCE_FOLDER, path].join('/');};
var piskelScripts = require('./src/piskel-script-list.js').scripts.map(mapToSrcFolder);
var piskelStyles = require('./src/piskel-style-list.js').styles.map(mapToSrcFolder);
var getGhostConfig = function (delay) {
return {
filesSrc : ['tests/integration/casperjs/*_test.js'],
filesSrc : ['test/integration/casperjs/*_test.js'],
options : {
args : {
baseUrl : 'http://localhost:' + '<%= connect.test.options.port %>/',
baseUrl : 'http://localhost:' + '<%= connect.test.options.port %>/src/',
mode : '?debug',
delay : delay
},
@ -45,8 +50,8 @@ module.exports = function(grunt) {
files: [
'Gruntfile.js',
'package.json',
'js/**/*.js',
'!js/lib/**/*.js' // Exclude lib folder (note the leading !)
'src/js/**/*.js',
'!src/js/lib/**/*.js' // Exclude lib folder (note the leading !)
]
},
connect : {
@ -94,7 +99,7 @@ module.exports = function(grunt) {
closureCompiler: {
options: {
// [REQUIRED] Path to closure compiler
compilerFile: 'closure_compiler_20130823.jar',
compilerFile: 'build/closure/closure_compiler_20130823.jar',
// [OPTIONAL] set to true if you want to check if files were modified
// before starting compilation (can save some time in large sourcebases)
@ -109,7 +114,7 @@ module.exports = function(grunt) {
*/
//compilation_level: 'ADVANCED_OPTIMIZATIONS',
compilation_level: 'SIMPLE_OPTIMIZATIONS',
externs: ['piskel-closure-externs.js'],
externs: ['build/closure/piskel-closure-externs.js'],
// Inject some constants in JS code, could we use that for appengine wiring ?
//define: ["'goog.DEBUG=false'"],
warning_level: 'verbose',
@ -133,27 +138,27 @@ module.exports = function(grunt) {
TEMPcompilerOpts: {
},
src: [
'js/**/*.js',
'piskel-boot.js',
'piskel-script-list.js',
'!js/lib/bootstrap/**/*.js',
'!js/lib/gif/**/*.js',
'!js/lib/jquery-1.8.0.js',
'!js/lib/jsColor_1_4_0/**/*.js'
'src/js/**/*.js',
'src/piskel-boot.js',
'src/piskel-script-list.js',
'!src/js/lib/**/*.js'
],
// This generated JS binary is currently not used and even excluded from source control using .gitignore.
dest: 'closure_compiled_binary.js'
dest: 'build/closure/closure_compiled_binary.js'
}
}
});
grunt.config.set('leadingIndent.indentation', 'spaces');
grunt.config.set('leadingIndent.jsFiles', {
src: ['js/**/*.js','!js/lib/**/*.js']
src: [
'src/js/**/*.js',
'!src/js/lib/**/*.js'
]
});
grunt.config.set('leadingIndent.cssFiles', {
src: ['css/**/*.css']
src: ['src/css/**/*.css']
});
grunt.loadNpmTasks('grunt-contrib-connect');

222
diff.txt
View File

@ -1,222 +0,0 @@
diff --git a/css/settings.css b/css/settings.css
index 829a727..32dd7df 100644
--- a/css/settings.css
+++ b/css/settings.css
@@ -161,7 +161,8 @@
border: gold 1px solid;
}
-/* Gif Export Setting panel*/
+/* Gif/Png Export Setting panel*/
+/*******************************/
.gif-upload-button,
.gif-render-button {
/*float : right;*/
@@ -173,12 +174,26 @@
margin:10px 0;
}
-.gif-export-preview {
+.gif-export-preview,
+.png-export-preview {
margin-top:20px;
max-width:240px;
position:relative;
}
+.png-export-preview {
+ margin:10px 0;
+ overflow: hidden;
+}
+
+.png-export-preview img {
+ float: left;
+}
+
+.png-upload-status {
+ margin : 10px 0;
+}
+
.preview-upload-ongoing:before{
content: "Upload ongoing ...";
position: absolute;
diff --git a/css/style.css b/css/style.css
index a61879a..fe9405b 100644
--- a/css/style.css
+++ b/css/style.css
@@ -300,3 +300,7 @@ body {
.user-message .close:hover {
color: black;
}
+
+.image-link {
+ color : gold;
+}
\ No newline at end of file
diff --git a/index.html b/index.html
index 05d758b..36cb01c 100644
--- a/index.html
+++ b/index.html
@@ -51,12 +51,13 @@
<iframe src="templates/settings.html" onload="iframeloader.onLoad(event)" data-iframe-loader="display"></iframe>
<div class="drawer vertical-centerer">
<div class="drawer-content" id="drawer-container">
+ <iframe src="templates/settings/save.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
<iframe src="templates/settings/application.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
<iframe src="templates/settings/resize.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
- <iframe src="templates/settings/export-gif.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
<iframe src="templates/settings/import.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
<iframe src="templates/settings/localstorage.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
- <iframe src="templates/settings/save.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
+ <iframe src="templates/settings/export-gif.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
+ <iframe src="templates/settings/export-png.html" onload="iframeloader.onLoad(event)" data-iframe-loader="store"></iframe>
</div>
</div>
</div>
diff --git a/js/Constants.js b/js/Constants.js
index 71a12bc..67be116 100644
--- a/js/Constants.js
+++ b/js/Constants.js
@@ -44,8 +44,8 @@ var Constants = {
SAVE : 'save'
}
},
- IMAGE_SERVICE_UPLOAD_URL : 'http://screenletstore.appspot.com/__/upload',
- IMAGE_SERVICE_GET_URL : 'http://screenletstore.appspot.com/img/',
+ IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-a.appspot.com/__/upload',
+ IMAGE_SERVICE_GET_URL : 'http://piskel-imgstore-a.appspot.com/img/',
GRID_STROKE_WIDTH: 1,
ZOOMED_OUT_BACKGROUND_COLOR : '#A0A0A0',
diff --git a/js/controller/settings/GifExportController.js b/js/controller/settings/GifExportController.js
index ac7602e..9a5bd75 100644
--- a/js/controller/settings/GifExportController.js
+++ b/js/controller/settings/GifExportController.js
@@ -1,6 +1,8 @@
(function () {
var ns = $.namespace("pskl.controller.settings");
+ var URL_MAX_LENGTH = 60;
+
ns.GifExportController = function (piskelController) {
this.piskelController = piskelController;
};
@@ -26,6 +28,8 @@
ns.GifExportController.prototype.init = function () {
this.radioTemplate_ = pskl.utils.Template.get("gif-export-radio-template");
+ this.uploadStatusContainerEl = document.querySelectorAll(".gif-upload-status")[0];
+
this.previewContainerEl = document.querySelectorAll(".gif-export-preview")[0];
this.radioGroupEl = document.querySelectorAll(".gif-export-radio-group")[0];
@@ -52,7 +56,9 @@
ns.GifExportController.prototype.onImageUploadCompleted_ = function (imageUrl) {
this.updatePreview_(imageUrl);
+ this.updateStatus_(imageUrl);
this.previewContainerEl.classList.remove("preview-upload-ongoing");
+
};
ns.GifExportController.prototype.updatePreview_ = function (src) {
@@ -127,4 +133,27 @@
gif.render();
};
+
+ // FIXME : HORRIBLE COPY/PASTA
+
+ ns.GifExportController.prototype.updateStatus_ = function (imageUrl, error) {
+ if (imageUrl) {
+ var linkTpl = "<a class='image-link' href='{{link}}' target='_blank'>{{shortLink}}</a>";
+ var linkHtml = pskl.utils.Template.replace(linkTpl, {
+ link : imageUrl,
+ shortLink : this.shorten_(imageUrl, URL_MAX_LENGTH, '...')
+ });
+ this.uploadStatusContainerEl.innerHTML = 'Your image is now available at : ' + linkHtml;
+ } else {
+ // FIXME : Should display error message instead
+ }
+ };
+
+ ns.GifExportController.prototype.shorten_ = function (url, maxLength, suffix) {
+ if (url.length > maxLength) {
+ url = url.substring(0, maxLength);
+ url += suffix;
+ }
+ return url;
+ };
})();
\ No newline at end of file
diff --git a/js/controller/settings/SettingsController.js b/js/controller/settings/SettingsController.js
index de4a0bd..dc20b2d 100644
--- a/js/controller/settings/SettingsController.js
+++ b/js/controller/settings/SettingsController.js
@@ -14,6 +14,10 @@
template : 'templates/settings/export-gif.html',
controller : ns.GifExportController
},
+ 'png' : {
+ template : 'templates/settings/export-png.html',
+ controller : ns.PngExportController
+ },
'import' : {
template : 'templates/settings/import.html',
controller : ns.ImportController
diff --git a/js/drawingtools/BaseTool.js b/js/drawingtools/BaseTool.js
index 1d2dfd4..a78d5cf 100644
--- a/js/drawingtools/BaseTool.js
+++ b/js/drawingtools/BaseTool.js
@@ -33,7 +33,11 @@
ns.BaseTool.prototype.hideHighlightedPixel = function(overlay) {
if (this.highlightedPixelRow !== null && this.highlightedPixelCol !== null) {
- overlay.setPixel(this.highlightedPixelCol, this.highlightedPixelRow, Constants.TRANSPARENT_COLOR);
+ try {
+ overlay.setPixel(this.highlightedPixelCol, this.highlightedPixelRow, Constants.TRANSPARENT_COLOR);
+ } catch (e) {
+ console.warn('ns.BaseTool.prototype.hideHighlightedPixel failed');
+ }
this.highlightedPixelRow = null;
this.highlightedPixelCol = null;
}
diff --git a/piskel-script-list.js b/piskel-script-list.js
index 65247a7..6048fa7 100644
--- a/piskel-script-list.js
+++ b/piskel-script-list.js
@@ -72,6 +72,7 @@ exports.scripts = [
"js/controller/settings/ApplicationSettingsController.js",
"js/controller/settings/ResizeController.js",
"js/controller/settings/GifExportController.js",
+ "js/controller/settings/PngExportController.js",
"js/controller/settings/LocalStorageController.js",
"js/controller/settings/SaveController.js",
"js/controller/settings/ImportController.js",
diff --git a/templates/settings.html b/templates/settings.html
index bb12a43..22b9a43 100644
--- a/templates/settings.html
+++ b/templates/settings.html
@@ -43,9 +43,9 @@
</div>
<div
+ data-setting="png"
class="tool-icon upload-cloud-icon"
title="Upload as a spritesheet PNG"
- onclick="pskl.app.uploadAsSpritesheetPNG()"
rel="tooltip" data-placement="left">
<span class="label">PNG</span>
</div>
diff --git a/templates/settings/export-gif.html b/templates/settings/export-gif.html
index b2c9576..97feaf3 100644
--- a/templates/settings/export-gif.html
+++ b/templates/settings/export-gif.html
@@ -13,5 +13,6 @@
<input type="submit" class="button button-primary gif-upload-button" value="Upload" />
</form>
<div class="gif-export-preview"></div>
+ <div class="gif-upload-status"></div>
</div>
</div>
\ No newline at end of file

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 803 B

View File

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 574 B

View File

Before

Width:  |  Height:  |  Size: 973 B

After

Width:  |  Height:  |  Size: 973 B

View File

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 431 B

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View File

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 594 B

View File

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View File

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 634 B

View File

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 789 B

View File

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

View File

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 209 B

View File

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 543 B

View File

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 656 B

View File

Before

Width:  |  Height:  |  Size: 672 B

After

Width:  |  Height:  |  Size: 672 B

View File

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 557 B

View File

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 707 B

View File

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 450 B

View File

Before

Width:  |  Height:  |  Size: 660 B

After

Width:  |  Height:  |  Size: 660 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 450 B

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

View File

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 570 B

View File

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 720 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

View File

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

View File

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 395 B

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 909 B

After

Width:  |  Height:  |  Size: 909 B

View File

Before

Width:  |  Height:  |  Size: 1010 B

After

Width:  |  Height:  |  Size: 1010 B

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

View File

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

View File

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

View File

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show More