diff options
Diffstat (limited to 'web/dom.js')
-rw-r--r-- | web/dom.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/web/dom.js b/web/dom.js new file mode 100644 index 0000000..44f8491 --- /dev/null +++ b/web/dom.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2012-2014 Kaarle Ritvanen + * See LICENSE file for license details + */ + +define(["jquery", "jquery-bbq"], function($) { + function href() { + return $("<a>").attr({href: "javascript:void(0);"}); + } + + return { + href: href, + + objectRef: function(value, el) { + el = el || href(); + if (value) { + el.click(function() { + $.bbq.pushState("#" + value); + }).text("Show"); + } + return el; + }, + + makeRow: function(el) { + if (el.is("td")) return $("<tr>").html(el); + return el; + }, + + setStatus: function(el, status) { el.prop("class", status); } + }; +}); |