fixed jshint complaints

This commit is contained in:
juliandescottes 2012-09-11 00:52:09 +02:00
parent 5666733f98
commit a8394d22b1
7 changed files with 216 additions and 226 deletions

View File

@ -1,2 +1,2 @@
test: test:
jshint js/*.js --config js/.jshintrc jshint js/*.js

View File

@ -21,7 +21,7 @@ pskl.LocalStorageService = (function() {
var persistToLocalStorageRequest_ = function() { var persistToLocalStorageRequest_ = function() {
// Persist to localStorage when drawing. We throttle localStorage accesses // Persist to localStorage when drawing. We throttle localStorage accesses
// for high frequency drawing (eg mousemove). // for high frequency drawing (eg mousemove).
if(localStorageThrottler_ != null) { if(localStorageThrottler_ !== null) {
window.clearTimeout(localStorageThrottler_); window.clearTimeout(localStorageThrottler_);
} }
localStorageThrottler_ = window.setTimeout(function() { localStorageThrottler_ = window.setTimeout(function() {
@ -34,30 +34,30 @@ pskl.LocalStorageService = (function() {
* @private * @private
*/ */
var persistToLocalStorage_ = function() { var persistToLocalStorage_ = function() {
console.log('[LocalStorage service]: Snapshot stored') console.log('[LocalStorage service]: Snapshot stored');
window.localStorage['snapShot'] = frameSheet_.serialize(); window.localStorage.snapShot = frameSheet_.serialize();
}; };
/** /**
* @private * @private
*/ */
var restoreFromLocalStorage_ = function() { var restoreFromLocalStorage_ = function() {
frameSheet_.deserialize(window.localStorage['snapShot']); frameSheet_.deserialize(window.localStorage.snapShot);
}; };
/** /**
* @private * @private
*/ */
var cleanLocalStorage_ = function() { var cleanLocalStorage_ = function() {
console.log('[LocalStorage service]: Snapshot removed') console.log('[LocalStorage service]: Snapshot removed');
delete window.localStorage['snapShot']; delete window.localStorage.snapShot;
}; };
return { return {
init: function(frameSheet) { init: function(frameSheet) {
if(frameSheet == undefined) { if(frameSheet === undefined) {
throw "Bad LocalStorageService initialization: <undefined frameSheet>" throw "Bad LocalStorageService initialization: <undefined frameSheet>";
} }
frameSheet_ = frameSheet; frameSheet_ = frameSheet;

View File

@ -77,7 +77,7 @@ pskl.Palette = (function() {
} else { } else {
colorPicker[0].color.fromString(color); colorPicker[0].color.fromString(color);
} }
} };
return { return {
init: function(framesheet) { init: function(framesheet) {

View File

@ -20,16 +20,6 @@ pskl.ToolSelector = (function() {
var currentSelectedTool = toolInstances.simplePen; var currentSelectedTool = toolInstances.simplePen;
var previousSelectedTool = toolInstances.simplePen; var previousSelectedTool = toolInstances.simplePen;
var selectTool_ = function(tool) {
var maincontainer = $("body");
var previousSelectedToolClass = maincontainer.data("selected-tool-class");
if(previousSelectedToolClass) {
maincontainer.removeClass(previousSelectedToolClass);
}
maincontainer.addClass(toolBehavior.toolId);
$("#drawing-canvas-container").data("selected-tool-class", toolBehavior.toolId);
};
var activateToolOnStage_ = function(tool) { var activateToolOnStage_ = function(tool) {
var stage = $("body"); var stage = $("body");
var previousSelectedToolClass = stage.data("selected-tool-class"); var previousSelectedToolClass = stage.data("selected-tool-class");
@ -56,7 +46,7 @@ pskl.ToolSelector = (function() {
if(clickedTool.length) { if(clickedTool.length) {
for(var tool in toolInstances) { for(var tool in toolInstances) {
if (toolInstances[tool].toolId == clickedTool.data()["toolId"]) { if (toolInstances[tool].toolId == clickedTool.data().toolId) {
selectTool_(toolInstances[tool]); selectTool_(toolInstances[tool]);
// Show tool as selected: // Show tool as selected:

View File

@ -16,7 +16,7 @@ jQuery.namespace = function() {
* *
* @require Constants * @require Constants
*/ */
(function(ns) { // namespace: pskl.utils (function() { // namespace: pskl.utils
var ns = $.namespace("pskl.utils"); var ns = $.namespace("pskl.utils");
@ -35,5 +35,5 @@ jQuery.namespace = function() {
//prototypeskl.ToolBehavior.Eraser.prototype.constructor = pskl.ToolBehavior.Eraser; //prototypeskl.ToolBehavior.Eraser.prototype.constructor = pskl.ToolBehavior.Eraser;
}; };
})() })();