summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
38cd189)
* Use event.preventDefault() instead of just return false
* remove superfluous returns
* Add <a href='#'/> around commands for usability
function addForm(elem, x) {
var form = $("<form/>");
function addForm(elem, x) {
var form = $("<form/>");
- form.submit(function(){return false;});
+ form.submit(function(event){event.preventDefault();});
var fieldset = $("<fieldset/>");
form.append(fieldset);
if ($(x).find("title").length > 0)
var fieldset = $("<fieldset/>");
form.append(fieldset);
if ($(x).find("title").length > 0)
+function runCommand(event) {
cmdNode = $(this).attr("id"); // Save node of executed command (in global var)
var execIQ = $iq({ type: "set", to: queryJID, id: connection.getUniqueId() })
.c("command", { xmlns: Strophe.NS.ADHOC, node: cmdNode, action: "execute" });
cmdNode = $(this).attr("id"); // Save node of executed command (in global var)
var execIQ = $iq({ type: "set", to: queryJID, id: connection.getUniqueId() })
.c("command", { xmlns: Strophe.NS.ADHOC, node: cmdNode, action: "execute" });
sessionid = $(result).find("command").attr("sessionid");
displayResult(result);
});
sessionid = $(result).find("command").attr("sessionid");
displayResult(result);
});
+ event.preventDefault();
}
function getCommandNodes() {
}
function getCommandNodes() {
connection.sendIQ(nodesIQ, function(result) {
$('#output').append("<ul id='items'></ul>");
$(result).find("item").each(function(index, e) {
connection.sendIQ(nodesIQ, function(result) {
$('#output').append("<ul id='items'></ul>");
$(result).find("item").each(function(index, e) {
- item = $("<li id='" + $(e).attr("node") + "'>" + $(e).attr("name") + "</li>").bind("click", runCommand);
+ link = $("<a href='#' id='" + $(e).attr("node") + "'>" + $(e).attr("name") + "</a>").click(runCommand)
+ item = $("<li></li>").append(link);
$("#items").append(item);
});
});
$("#items").append(item);
});
});
jid.show();
$('label').show();
$('#output').empty();
jid.show();
$('label').show();
$('#output').empty();
}
function showDisconnect() {
}
function showDisconnect() {
pass.hide();
jid.hide();
$('#cred label').hide();
pass.hide();
jid.hide();
$('#cred label').hide();
}
$(document).ready(function () {
}
$(document).ready(function () {
- $('#cred').bind('submit', function () {
+ $('#cred').bind('submit', function (event) {
var button = $('#connect').get(0);
var jid = $('#jid');
var pass = $('#pass');
var button = $('#connect').get(0);
var jid = $('#jid');
var pass = $('#pass');
} else {
connection.disconnect();
}
} else {
connection.disconnect();
}
+ event.preventDefault();
- $('#queryForm').bind('submit', function () {
+ $('#queryForm').bind('submit', function (event) {
queryJID = $('#queryJID').val();
checkFeatures();
queryJID = $('#queryJID').val();
checkFeatures();
+ event.preventDefault();