Permalink
Browse files

predict header while fetching json

  • Loading branch information...
1 parent 9ae0b9a commit fb227dc0ea57a4a93f462084939f2f57469d585f @WardCunningham committed Apr 22, 2013
Showing with 36 additions and 20 deletions.
  1. +13 −7 client/client.js
  2. +5 −6 client/lib/legacy.coffee
  3. +11 −4 client/lib/wiki.coffee
  4. +7 −3 client/test/testclient.js
View
@@ -461,11 +461,15 @@ require.define("/lib/wiki.coffee",function(require,module,exports,__dirname,__fi
};
wiki.createPage = function(name, loc) {
+ var $page, site;
if (loc && loc !== 'view') {
- return $("<div/>").attr('id', name).attr('data-site', loc).addClass("page");
- } else {
- return $("<div/>").attr('id', name).addClass("page");
+ site = loc;
+ }
+ $page = $("<div class=\"page\" id=\"" + name + "\">\n <div class=\"twins\"> <p> </p> </div>\n <div class=\"header\">\n <h1> <img class=\"favicon\" src=\"" + (site ? "//" + site : "") + "/favicon.png\" height=\"32px\"> " + name + " </h1>\n </div>\n</div>");
+ if (site) {
+ $page.find('.page').attr('data-site', site);
}
+ return $page;
};
wiki.getItem = function(element) {
@@ -874,14 +878,16 @@ require.define("/lib/legacy.coffee",function(require,module,exports,__dirname,__
$("footer input:first").val($(this).attr('data-provider'));
return $("footer form").submit();
});
- state.first();
- $('.page').each(refresh);
- active.set($('.page').last());
- return $('body').on('new-neighbor-done', function(e, neighbor) {
+ $('body').on('new-neighbor-done', function(e, neighbor) {
return $('.page').each(function(index, element) {
return wiki.emitTwins($(element));
});
});
+ return $(function() {
+ state.first();
+ $('.page').each(refresh);
+ return active.set($('.page').last());
+ });
});
}).call(this);
View
@@ -282,13 +282,12 @@ $ ->
$("footer input:first").val $(this).attr('data-provider')
$("footer form").submit()
- # CODE that gets the web page application started
- state.first()
-
- $('.page').each refresh
- active.set($('.page').last())
-
$('body').on 'new-neighbor-done', (e, neighbor) ->
$('.page').each (index, element) ->
wiki.emitTwins $(element)
+ $ ->
+ state.first()
+ $('.page').each refresh
+ active.set($('.page').last())
+
View
@@ -40,10 +40,17 @@ wiki.getDataNodes = (vis) ->
$(who)
wiki.createPage = (name, loc) ->
- if loc and loc isnt 'view'
- $("<div/>").attr('id', name).attr('data-site', loc).addClass("page")
- else
- $("<div/>").attr('id', name).addClass("page")
+ site = loc if loc and loc isnt 'view'
+ $page = $ """
+ <div class="page" id="#{name}">
+ <div class="twins"> <p> </p> </div>
+ <div class="header">
+ <h1> <img class="favicon" src="#{ if site then "//#{site}" else "" }/favicon.png" height="32px"> #{name} </h1>
+ </div>
+ </div>
+ """
+ $page.find('.page').attr('data-site', site) if site
+ $page
wiki.getItem = (element) ->
$(element).data("item") or $(element).data('staticItem') if $(element).length > 0
View
@@ -461,11 +461,15 @@ require.define("/lib/wiki.coffee",function(require,module,exports,__dirname,__fi
};
wiki.createPage = function(name, loc) {
+ var $page, site;
if (loc && loc !== 'view') {
- return $("<div/>").attr('id', name).attr('data-site', loc).addClass("page");
- } else {
- return $("<div/>").attr('id', name).addClass("page");
+ site = loc;
+ }
+ $page = $("<div class=\"page\" id=\"" + name + "\">\n <div class=\"twins\"> <p> </p> </div>\n <div class=\"header\">\n <h1> <img class=\"favicon\" src=\"" + (site ? "//" + site : "") + "/favicon.png\" height=\"32px\"> " + name + " </h1>\n </div>\n</div>");
+ if (site) {
+ $page.find('.page').attr('data-site', site);
}
+ return $page;
};
wiki.getItem = function(element) {

0 comments on commit fb227dc

Please sign in to comment.