Skip to content

Commit

Permalink
added jquery back
Browse files Browse the repository at this point in the history
i think it makes some pretty poor choices but
oquery needs some lovin to fix a few of the
edge cases
  • Loading branch information
tj committed Jul 5, 2011
1 parent 05ae604 commit 58e766a
Show file tree
Hide file tree
Showing 6 changed files with 8,420 additions and 757 deletions.
4 changes: 2 additions & 2 deletions lib/http/public/javascripts/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Job.prototype.render = function(isNew){
el.find('.log').hide();

// populate title and id
el.id('job-' + id);
el.attr('id', 'job-' + id);
el.find('h2').text(id);

// remove button
Expand Down Expand Up @@ -196,7 +196,7 @@ Job.prototype.renderUpdate = function(){

// logs
if (this.showDetails) {
request('GET', '/job/' + this.id + '/log', function(res, log){
request('GET', '/job/' + this.id + '/log', function(log){
var ul = el.find('.log').show().find('ul');
ul.find('li').remove();
log.forEach(function(line){
Expand Down
28 changes: 28 additions & 0 deletions lib/http/public/javascripts/jquery.ext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

// proxy to allow formatting
// and because $ is ugly

var o = function(val){
var args = arguments
, options = args[1]
, i = 0;

if ('string' != typeof val) return $(val);
if (!~val.indexOf('<')) return $(val);

val = val.replace(/%([sd])/g, function(_, specifier){
var arg = args[++i];
switch (specifier) {
case 's': return String(arg)
case 'd': return arg | 0;
}
});

val = val.replace(/\{(\w+)\}/g, function(_, name){
return options[name];
});

return $(val);
};

for (var key in $) o[key] = $[key];
Loading

0 comments on commit 58e766a

Please sign in to comment.