blob: 84f4e02e358eb6468889428a50dd5f433b7b559a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Changes a given hyperlink into a "Cancel" hyperlink (cancelswitcher.js)
HashOver.prototype.cancelSwitcher = function (form, link, wrapper, permalink)
{
// Initial state properties of hyperlink
var reset = {
textContent: link.textContent,
title: link.title,
onclick: link.onclick
};
function linkOnClick ()
{
// Remove fields from form wrapper
wrapper.textContent = '';
// Reset button
link.textContent = reset.textContent;
link.title = reset.title;
link.onclick = reset.onclick;
return false;
}
// Change hyperlink to "Cancel" hyperlink
link.textContent = this.locale['cancel'];
link.title = this.locale['cancel'];
// This resets the "Cancel" hyperlink to initial state onClick
link.onclick = linkOnClick;
// Check if cancel buttons are enabled
if (this.setup['uses-cancel-buttons'] !== false) {
// If so, get "Cancel" button
var cancelButtonId = form + '-cancel-' + permalink;
var cancelButton = this.elements.get (cancelButtonId, true);
// Attach event listeners to "Cancel" button
cancelButton.onclick = linkOnClick;
}
};
|