VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/keeview_app/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/keeview_app/html/jscache.js
'use strict'
const jscache = Object.freeze(function () {
    var core = {
        strictMode: false
    };

    core.indexedDB = window.indexedDB
        || window.mozIndexedDB
        || window.webkitIndexedDB
        || window.msIndexedDB;

    core.IDBTransaction = window.IDBTransaction
        || window.webkitIDBTransaction
        || window.msIDBTransaction;

    core.IDBKeyRange = window.IDBKeyRange
        || window.webkitIDBKeyRange
        || window.msIDBKeyRange;

    core.open = function (dbname, version, callbackfunc) {
        dbname = EncodingClass.string.substr(dbname);
        if (core.indexedDB === undefined) {
            try {
                callbackfunc(false, {
                    type: "unsupported",
                    message: "indexedDB is not supported"
                });
            }
            catch (e) {
                callbackfunc(false, e);
            }
            return;
        }
        var request;
        if (version !== undefined) {
            request = core.indexedDB.open(dbname, version);
        }
        else {
            request = core.indexedDB.open(dbname);
        }
        request.onerror = function (event) {
            callbackfunc(false, {
                type: "unsupported",
                message: event
            });
        };
        request.onsuccess = function (event) {
            var db = event.target.result;
            callbackfunc(true, db);
        };
        request.onupgradeneeded = function (dbname) {
            return function (event) {
                var db = event.target.result;
                if (db.objectStoreNames.contains(dbname)) {
                    db.deleteObjectStore(dbname);
                }
                var objectStore = db.createObjectStore(dbname, { autoIncrement: false });
            }
        } (dbname);
    }

    core.getTransaction = function (host, callbackfunc) {
        var transaction;
        try {
            if (core.strictMode) {
                transaction = host.db.transaction([host.dbname], "readwrite", { durability: 'strict' });
            }
            else {
                transaction = host.db.transaction([host.dbname], "readwrite");
            }
        }
        catch (e) {
            core.open(host.dbname, host.version, function (success, content) {
                if (success) {
                    host.db = content;
                    Thread.setTimeout({
                        func: core.getTransaction,
                        args: [host, callbackfunc]
                    });
                    return;
                }
                else {
                    throw [e, content];
                }
            });
        }
        callbackfunc(transaction);
    }

    core.getAllData = function (host, type, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var retval;
            if (type == "assoc") {
                retval = {};
            }
            else {
                retval = [];
            }
            var hcursor = objectStore.openCursor();
            hcursor.onsuccess = function (event) {
                var cursor = event.target.result;
                if (cursor) {
                    if (type == "assoc") {
                        retval[cursor.key] = cursor.value;
                    }
                    else {
                        retval.push({
                            key: cursor.key,
                            value: cursor.value
                        });
                    }
                    cursor.continue();
                }
                else {
                    delete hcursor.onsuccess;
                    callbackfunc(retval);
                }
            }
        });
    };

    core.getKeys = function (host, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var request = objectStore.getAllKeys();
            request.onsuccess = function (retval, callbackfunc) {
                return function () {
                    delete request.onsuccess;
                    callbackfunc(request.result);
                };
            } (retval, callbackfunc);
        });
    };

    core.getKeys2 = function (host, keyRange, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var request = objectStore.getAllKeys(keyRange);
            request.onsuccess = function (retval, callbackfunc) {
                return function () {
                    delete request.onsuccess;
                    callbackfunc(request.result);
                };
            } (retval, callbackfunc);
        });
    };

    core.read = function (host, key, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var objectStoreRequest = objectStore.get(key);
            transaction.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
            objectStoreRequest.onsuccess = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                if (objectStoreRequest.result === undefined) {
                    callbackfunc(false);
                }
                else {
                    callbackfunc(true, objectStoreRequest.result);
                }
            };
            objectStoreRequest.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
        });
    };

    core.readthread = function (task) {
        var key;
        if (task.keys.length == 0) {
            task.callbackfunc(task.retval);
            return;
        }
        key = task.keys.shift();
        core.read(task.host, key, function (success, value) {
            if (success) {
                task.retval.push({
                    key: key,
                    value: value
                });
            };
            Thread.setTimeout({
                func: core.readthread,
                args: [task]
            });
        });
    };

    core.read2 = function (host, keys, callbackfunc) {
        var task, xkeys;
        var i;
        if (keys.length < 128) {
            xkeys = [];
            for (i = 0; i < keys.length; i++) {
                xkeys.push(keys[i]);
            }
            task = {
                host: host,
                callbackfunc: callbackfunc,
                keys: xkeys,
                retval: []
            };
            core.readthread(task);
            return;
        }
        for (i = 0; i < keys.length; i++) {
            xkeys[keys[i]] = {
                isready: false,
                index: i
            };
        }
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var hcursor = objectStore.openCursor();
            hcursor.onsuccess = function (event) {
                var cursor = event.target.result;
                var keys, retval, i;
                if (cursor) {
                    if (xkeys[cursor.key] !== undefined) {
                        xkeys[cursor.key].isready = true;
                        xkeys[cursor.key].value = cursor.value;
                    }
                    cursor.continue();
                }
                else {
                    keys = Object.keys(xkeys);
                    retval = {};
                    for (i = 0; i < keys.length; i++) {
                        if (xkeys[keys[i]].isready) {
                            retval[keys[i]] = xkeys[keys[i]].value;
                        }
                    }
                    delete hcursor.onsuccess;
                    callbackfunc(retval);
                }
            };
        });
    };

    core.write = function (host, key, value, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var objectStoreRequest = objectStore.put(value, key);
            transaction.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
            objectStoreRequest.onsuccess = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(true);
            };
            objectStoreRequest.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
        });
    };

    core.clear = function (host, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var objectStoreRequest = objectStore.clear();
            transaction.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
            objectStoreRequest.onsuccess = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(true);
            };
            objectStoreRequest.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
        });
    };

    core.delete = function (host, key, callbackfunc) {
        core.deleteRange2(host, IDBKeyRange.only(key), callbackfunc);
    };

    core.deleteRange = function (host, startkey, endkey, callbackfunc) {
        core.deleteRange2(host, IDBKeyRange.bound(startkey, endkey, false, true), callbackfunc);
    };

    core.deleteRange2 = function (host, keyRange, callbackfunc) {
        core.getTransaction(host, function (transaction) {
            var objectStore = transaction.objectStore(host.dbname);
            var objectStoreRequest = objectStore.delete(keyRange);
            transaction.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
            objectStoreRequest.onsuccess = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(true);
            };
            objectStoreRequest.onerror = function (event) {
                delete transaction.onerror;
                delete objectStoreRequest.onsuccess;
                delete objectStoreRequest.onerror;
                callbackfunc(false);
            };
        });
    };

    core.writethread = function (task) {
        var content;
        if (task.contents.length == 0) {
            task.callbackfunc();
            return;
        }
        content = task.contents.shift();
        core.write(task.host, content.key, content.value, function (success) {
            Thread.setTimeout({
                func: core.writethread,
                args: [task]
            });
        });
    };

    core.write2 = function (thost, contents, callbackfunc) {
        core.getTransaction(thost, function (transaction) {
            var objectStore = transaction.objectStore(thost.dbname);
            var objectStoreRequest;
            var host = {
                retval: [],
                count: 0,
                total: contents.length
            };
            var i;
            if (contents.length == 0) {
                Thread.setTimeout({
                    func: callbackfunc,
                    args: [[]]
                });
                return;
            }
            for (i = 0; i < contents.length; i++) {
                host.retval.push(undefined);
            }
            var requests = [];
            transaction.onerror = function (event) {
                var i;
                delete transaction.onerror;
                for (i = 0; i < requests.length; i++) {
                    delete requests[i].onsuccess;
                    delete requests[i].onerror;
                }
                requests = null;
                callbackfunc(host.retval);
            };
            for (i = 0; i < contents.length; i++) {
                objectStoreRequest = objectStore.put(contents[i].value, contents[i].key);
                requests.push(objectStoreRequest);
                objectStoreRequest.onsuccess = function (index) {
                    return function (event) {
                        var i;
                        host.retval[index] = true;
                        host.count++;
                        if (host.count == host.total) {
                            delete transaction.onerror;
                            for (i = 0; i < requests.length; i++) {
                                delete requests[i].onsuccess;
                                delete requests[i].onerror;
                            }
                            requests = null;
                            Thread.setTimeout({
                                func: callbackfunc,
                                args: [[]]
                            });
                        }
                    };
                } (i);
                objectStoreRequest.onerror = function (index) {
                    return function (event) {
                        host.retval[index] = false;
                        host.count++;
                        if (host.count == host.total) {
                            delete transaction.onerror;
                            for (i = 0; i < requests.length; i++) {
                                delete requests[i].onsuccess;
                                delete requests[i].onerror;
                            }
                            requests = null;
                            Thread.setTimeout({
                                func: callbackfunc,
                                args: [[]]
                            });
                        }
                    };
                } (i);
            }
        });
    };

    core.fastwrite2 = function (host, contents, callbackfunc) {
        core.getTransaction(thost, function (transaction) {
            var objectStore = transaction.objectStore(thost.dbname);
            var objectStoreRequest;
            var host = {
                retval: true,
                count: 0,
                total: contents.length
            };
            var i;
            if (contents.length == 0) {
                setTimeout(function (func) {
                    return function () {
                        func(true);
                    }
                } (callbackfunc), 0);
                return;
            }
            var requests = [];
            transaction.onerror = function (event) {
                var i;
                for (i = 0; i < requests.length; i++) {
                    delete requests[i].onerror;
                }
                delete objectStoreRequest.onsuccess;
                delete transaction.onerror;
                host.retval = false;
                callbackfunc(host.retval);
            };
            for (i = 0; i < contents.length; i++) {
                objectStoreRequest = objectStore.put(contents[i].value, contents[i].key);
                requests.push(objectStoreRequest);
                if (i == contents.length - 1) {
                    objectStoreRequest.onsuccess = function (event) {
                        var i;
                        for (i = 0; i < requests.length; i++) {
                            delete requests[i].onerror;
                        }
                        delete objectStoreRequest.onsuccess;
                        delete transaction.onerror;
                        requests = null;
                        Thread.setTimeout({
                            func: callbackfunc,
                            args: [host.retval]
                        });
                    };
                }
                objectStoreRequest.onerror = function (func, index) {
                    return function (event) {
                        var i;
                        host.retval = false;
                        if (index == host.total) {
                            for (i = 0; i < requests.length; i++) {
                                delete requests[i].onerror;
                            }
                            delete objectStoreRequest.onsuccess;
                            delete transaction.onerror;
                            requests = null;
                            Thread.setTimeout({
                                func: callbackfunc,
                                args: [host.retval]
                            });
                        }
                    };
                } (callbackfunc, i);
            }
        });
    };

    core.createInstanceH = function (host) {
        var retval = {
            all: function (type, callbackfunc) {
                core.getAllData(host, type, callbackfunc);
            },
            keys: function (callbackfunc) {
                core.getKeys(host, callbackfunc);
            },
            keys2: function (keyRange, callbackfunc) {
                core.getKeys2(host, keyRange, callbackfunc);
            },
            read: function (key, callbackfunc) {
                core.read(host, key, callbackfunc);
            },
            read2: function (keys, callbackfunc) {
                core.read2(host, keys, callbackfunc);
            },
            write: function (key, value, callbackfunc) {
                core.write(host, key, value, callbackfunc);
            },
            write2: function (contents, callbackfunc) {
                core.write2(host, contents, callbackfunc);
            },
            fastwrite2: function (contents, callbackfunc) {
                core.fastwrite2(host, contents, callbackfunc);
            },
            delete: function (key, callbackfunc) {
                core.delete(host, key, callbackfunc);
            },
            deleteRange: function (startkey, endkey, callbackfunc) {
                core.deleteRange(host, startkey, endkey, callbackfunc);
            },
            deleteRange2: function (keyRange, callbackfunc) {
                core.deleteRange2(host, keyRange, callbackfunc);
            },
            clear: function (callbackfunc) {
                core.clear(host, callbackfunc);
            },
            setStrictMode: function (value) {
                if (value === true) {
                    core.strictMode = true;
                }
                else if (value === false) {
                    core.strictMode = false;
                }
            }
        };
        return Object.freeze(retval);
    }

    core.createInstance = function (db, dbname, version) {
        return core.createInstanceH({
            db: db,
            dbname: dbname,
            version: version
        });
    }

    var retval = {};
    retval.open = function (dbname, callbackfunc, version) {
        core.open(dbname, version, function (success, content) {
            var rv;
            if (!success) {
                callbackfunc(false, content);
                return;
            }
            rv = core.createInstance(content, dbname, version);
            callbackfunc(true, rv);
        });
    };

    retval.nextKey = function (key) {
        var i, ch;
        if (key === undefined) key = "undefined";
        if (key === null) key = "null";
        if (!EncodingClass.type.isString(key)) {
            if (key.toString !== undefined) {
                key = key.toString();
            }
            else {
                key = "null";
            }
        }
        for (i = key.length - 1; i >= 0; i--) {
            ch = key.charCodeAt(i);
            if (ch < 65535) {
                return EncodingClass.string.merge([
                    key.substr(0, i),
                    String.fromCharCode(ch + 1)
                ]);
            }
        }
        return null;
    }
    return retval;
} ());

VaKeR 2022