Permalink
Browse files

tweak to recent contribution

  • Loading branch information...
1 parent fcbbd43 commit 4840eb2e719f7a47bfe421b9740c9e72649971bf @WardCunningham committed Jan 27, 2013
Showing with 17 additions and 12 deletions.
  1. +1 −1 client/plugins/factory/factory.coffee
  2. +16 −11 client/plugins/factory/factory.js
@@ -101,7 +101,7 @@ window.plugins.factory =
dropEvent.preventDefault()
if (dt = dropEvent.originalEvent.dataTransfer)?
- if dt.types? and ('text/uri-list' in dt.types or 'text/x-moz-url' in dt.types) and not 'Files' in dt.types
+ if dt.types? and ('text/uri-list' in dt.types or 'text/x-moz-url' in dt.types) and not ('Files' in dt.types)
url = dt.getData 'URL'
if found = url.match /^http:\/\/([a-zA-Z0-9:.-]+)(\/([a-zA-Z0-9:.-]+)\/([a-z0-9-]+(_rev\d+)?))+$/
wiki.log 'factory drop url', found
@@ -1,13 +1,14 @@
+// Generated by CoffeeScript 1.4.0
(function() {
var arrayToJson, csvToArray,
- __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
window.plugins.factory = {
emit: function(div, item) {
var showMenu, showPrompt;
div.append('<p>Double-Click to Edit<br>Drop Text or Image to Insert</p>');
showMenu = function() {
- var info, menu, menuItem, name, _i, _len, _ref, _ref2;
+ var info, menu, menuItem, name, _i, _len, _ref, _ref1;
menu = div.find('p').append("<br>Or Choose a Plugin");
menuItem = function(title, name) {
return menu.append("<li>\n <a class=\"menu\" href=\"#\" title=\"" + title + "\">\n " + name + "\n </a>\n</li>");
@@ -19,9 +20,9 @@
menuItem(info.title, info.name);
}
} else {
- _ref2 = window.catalog;
- for (name in _ref2) {
- info = _ref2[name];
+ _ref1 = window.catalog;
+ for (name in _ref1) {
+ info = _ref1[name];
menuItem(info.menu, name);
}
}
@@ -81,7 +82,7 @@
return evt.preventDefault();
});
return div.bind("drop", function(dropEvent) {
- var dt, found, ignore, origin, punt, readFile, url, _ref;
+ var dt, found, ignore, origin, punt, readFile, url;
punt = function(data) {
wiki.log('factory punt', dropEvent);
item.type = 'data';
@@ -134,7 +135,7 @@
};
dropEvent.preventDefault();
if ((dt = dropEvent.originalEvent.dataTransfer) != null) {
- if ((dt.types != null) && (__indexOf.call(dt.types, 'text/uri-list') >= 0 || __indexOf.call(dt.types, 'text/x-moz-url') >= 0) && (_ref = !'Files', __indexOf.call(dt.types, _ref) >= 0)) {
+ if ((dt.types != null) && (__indexOf.call(dt.types, 'text/uri-list') >= 0 || __indexOf.call(dt.types, 'text/x-moz-url') >= 0) && !(__indexOf.call(dt.types, 'Files') >= 0)) {
url = dt.getData('URL');
if (found = url.match(/^http:\/\/([a-zA-Z0-9:.-]+)(\/([a-zA-Z0-9:.-]+)\/([a-z0-9-]+(_rev\d+)?))+$/)) {
wiki.log('factory drop url', found);
@@ -148,7 +149,9 @@
item.title = remote.title || item.slug;
item.text = wiki.createSynopsis(remote);
syncEditAction();
- if (item.site != null) return wiki.registerNeighbor(item.site);
+ if (item.site != null) {
+ return wiki.registerNeighbor(item.site);
+ }
});
} else {
return punt({
@@ -200,12 +203,14 @@
var cols, row, rowToObject, _i, _len, _results;
cols = array.shift();
rowToObject = function(row) {
- var k, obj, v, _i, _len, _ref, _ref2;
+ var k, obj, v, _i, _len, _ref, _ref1;
obj = {};
_ref = _.zip(cols, row);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- _ref2 = _ref[_i], k = _ref2[0], v = _ref2[1];
- if ((v != null) && (v.match(/\S/)) && v !== 'NULL') obj[k] = v;
+ _ref1 = _ref[_i], k = _ref1[0], v = _ref1[1];
+ if ((v != null) && (v.match(/\S/)) && v !== 'NULL') {
+ obj[k] = v;
+ }
}
return obj;
};

2 comments on commit 4840eb2

@rynomad

neat, my first accepted pull request. Thanks! I was actually just browsing the federation and found your page on 'It works' and the notion of neverending cycles of bugfixes leading to more bugs and fixes and so on, so I'm still pondering a more holistic approach to coding for browser compatibility. I'll let you know what I come up with.

@WardCunningham
Owner

Consider joining us for our video chat on Wednesday mornings, 10am pacific time. http://bit.ly/SFWhangout.

Please sign in to comment.