Permalink
Browse files

catching up with javascript

  • Loading branch information...
1 parent a0e9cc8 commit 388013574eddd1cd76ea45c9ebde09a4ac2314cd @WardCunningham committed Nov 27, 2012
Showing with 18 additions and 12 deletions.
  1. +3 −0 client/client.js
  2. +6 −6 client/plugins/efficiency/efficiency.js
  3. +9 −6 client/test/testclient.js
View
@@ -1652,6 +1652,9 @@ require.define("/lib/refresh.coffee",function(require,module,exports,__dirname,_
initAddButton = function(pageElement) {
return pageElement.find(".add-factory").live("click", function(evt) {
+ if (pageElement.hasClass('ghost')) {
+ return;
+ }
evt.preventDefault();
return createFactory(pageElement);
});
@@ -28,16 +28,16 @@
return div.find('p:first').text("" + (value.toFixed(1)) + "%");
};
getImageData = function(div) {
- var can, ctx, h, imageData, img, w;
+ var c, d, h, imageData, img, w;
img = new Image;
img.src = $(div).data('item').url;
w = img.width;
h = img.height;
- can = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
- ctx = can.get(0).getContext("2d");
- ctx.drawImage(img, 0, 0);
- wiki.log('efficiency img w, h', w, h, 'canvas w, h ', can.width(), can.height());
- imageData = ctx.getImageData(0, 0, w, h);
+ c = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
+ d = c.get(0).getContext("2d");
+ d.drawImage(img, 0, 0);
+ wiki.log('efficiency img w, h', w, h, 'c w, h ', c.width(), c.height());
+ imageData = d.getImageData(0, 0, w, h);
return imageData.data;
};
calculatePercentage = function(data) {
@@ -1383,6 +1383,9 @@ require.define("/lib/refresh.coffee",function(require,module,exports,__dirname,_
initAddButton = function(pageElement) {
return pageElement.find(".add-factory").live("click", function(evt) {
+ if (pageElement.hasClass('ghost')) {
+ return;
+ }
evt.preventDefault();
return createFactory(pageElement);
});
@@ -2512,16 +2515,16 @@ require.define("/plugins/efficiency/efficiency.js",function(require,module,expor
return div.find('p:first').text("" + (value.toFixed(1)) + "%");
};
getImageData = function(div) {
- var can, ctx, h, imageData, img, w;
+ var c, d, h, imageData, img, w;
img = new Image;
img.src = $(div).data('item').url;
w = img.width;
h = img.height;
- can = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
- ctx = can.get(0).getContext("2d");
- ctx.drawImage(img, 0, 0);
- wiki.log('efficiency img w, h', w, h, 'c w, h ', can.width(), can.height());
- imageData = ctx.getImageData(0, 0, w, h);
+ c = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
+ d = c.get(0).getContext("2d");
+ d.drawImage(img, 0, 0);
+ wiki.log('efficiency img w, h', w, h, 'c w, h ', c.width(), c.height());
+ imageData = d.getImageData(0, 0, w, h);
return imageData.data;
};
calculatePercentage = function(data) {

0 comments on commit 3880135

Please sign in to comment.