PageSourceSearch

https://mycan.ceramicartsnetwork.org/resource/1781601522000/nc__Resources/Lockable.js

js ceramicartsnetwork.org collected 2026-10-02 04:02:41 UTC 1,327 bytes, 40 lines download raw bytes

1var LOCKABLE_CLASS = '.s-lockable';
2var CLICK_EVENT = 'click';
3var ORIGINAL_ONCLICK_ATTR = 'data-original-onclick';
4var ONCLICK_ATTR = 'onclick';
5
6var lockedHandler = function(event) {
7    event.preventDefault();
8}
9
10/**
11  * @description Locks all page elements with a class of 's-lockable' while an AJAX request is still loading, preventing
12  *              double submissions of the same content.
13  */
14function clickLockStart() {
15    jQuery(LOCKABLE_CLASS).on(CLICK_EVENT, lockedHandler);
16
17    var onClick = jQuery(LOCKABLE_CLASS).attr(ONCLICK_ATTR);
18
19    jQuery(LOCKABLE_CLASS).attr(ORIGINAL_ONCLICK_ATTR, onClick);
20    jQuery(LOCKABLE_CLASS).attr(ONCLICK_ATTR, null);
21}
22
23/**
24  * @description Unlocks all page elements with a class of 's-lockable' allowing them to be clicked again.
25  */
26function clickLockStop() {
27    jQuery(LOCKABLE_CLASS).off(CLICK_EVENT, lockedHandler);
28
29    var originalOnclick = jQuery(LOCKABLE_CLASS).attr(ORIGINAL_ONCLICK_ATTR);
30
31    jQuery(LOCKABLE_CLASS).attr(ORIGINAL_ONCLICK_ATTR, null);
32    jQuery(LOCKABLE_CLASS).attr(ONCLICK_ATTR, originalOnclick);
33}
34
35/**
36 * @description Determines if a given element's (usually a submit button) form will validate.
37 */
38function canLockForm(element) {
39    return (element.form == null || element.form.checkValidity());
40}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.