MCPcopy
hub / github.com/amark/gun / add

Function add

test/ptsd/ptsd.js:71–100  ·  view source on GitHub ↗
(title, code)

Source from the content-addressed store, hash-verified

69
70//wat;
71function add(title, code) {
72 var html = '<td><button class="remove" tabindex="-1">Remove</button></td><td class="inputs"><input type="text" class="title input" placeholder="Label"><textarea rows="6" class="case input" placeholder="Code"></textarea></td><td class="result"></td>'
73 var s = $('#suite');
74 var tr = $('<tr>');
75 tr.html(html);
76 tr.find('.remove')[0].onclick = (function (tr) {
77 return function () {
78 tr.remove();
79 clear();
80 };
81 })(tr);
82
83 var inputs = tr.find('.input').each(function(){
84 this.onkeydown = function () {
85 abort();
86 var shareResult = $('#share-result').text('');
87 shareResult.attr('href', '');
88 }
89 });
90 if(code){
91 code = stool.text(code);
92 tr.find('.title').val(title);
93 tr.find('.case').val(code);
94 }
95 s.append(tr);
96
97 clear();
98
99 return code? stool : tr;
100}
101stool.add = add;
102
103function setup(code){

Callers 2

parseFunction · 0.70
ptsd.jsFile · 0.70

Calls 2

clearFunction · 0.85
abortFunction · 0.70

Tested by

no test coverage detected