code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
async getRepoFromPath(currentRepo, token, cb) {
if (!detect.shouldEnable()) {
return cb();
}
await this.getRepoData(currentRepo, token, cb);
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | getRepoFromPath | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
loadCodeTree(opts, cb) {
opts.encodedBranch = encodeURIComponent(decodeURIComponent(opts.repo.branch));
opts.path = (opts.node && (opts.node.sha || opts.encodedBranch)) || opts.encodedBranch + '?recursive=1';
this._loadCodeTreeInternal(opts, null, cb);
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | loadCodeTree | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
selectFile(path) {
window.location.href = path;
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | selectFile | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
getItemHref(repo, type, encodedPath, encodedBranch) {
return `/${repo.username}/${repo.reponame}/src/${encodedBranch}/${encodedPath}`;
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | getItemHref | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
getAccessToken() {
return window.extStore.get(window.STORE.GOGS_TOKEN);
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | getAccessToken | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
get isOnPRPage() {
// eslint-disable-next-line no-useless-escape
const match = window.location.pathname.match(/([^\/]+)\/([^\/]+)(?:\/([^\/]+))?(?:\/([^\/]+))?/);
if (!match) return false;
const type = match[3];
return type === 'pulls';
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | isOnPRPage | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
_getTree(path, opts, cb) {
this._get(`/git/trees/${path}`, opts, (err, res) => {
if (err) {
cb(err);
} else {
cb(null, res.tree);
}
});
} | Github renders the branch name in one of below structure depending on the length
of branch name. We're using this for default code page or tree/blob.
Option 1: when the length is short enough
<summary title="Switch branches or tags">
<span class="css-truncate-target">feature/1/2/3</span>
</summary>
Option 2: when t... | _getTree | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
_getPatch(opts, cb) {
const { pullNumber } = opts.repo;
this._get(`/pulls/${pullNumber}/files?per_page=300`, opts, (err, res) => {
if (err) {
cb(err);
} else {
const diffMap = {};
res.forEach((file, index) => {
// Record file patch info
diffMap[file.file... | Get files that were patched in Pull Request.
The diff map that is returned contains changed files, as well as the parents of the changed files.
This allows the tree to be filtered for only folders that contain files with diffs.
@param {Object} opts: {
path: the starting path to load the tree,
... | _getPatch | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
_getSubmodules(tree, opts, cb) {
const item = tree.filter(item => /^\.gitmodules$/i.test(item.path))[0];
if (!item) return cb();
this._get(`/git/blobs/${item.sha}`, opts, (err, res) => {
if (err) return cb(err);
const data = atob(res.content.replace(/\n/g, ''));
cb(null, parseGitmodules(d... | Get files that were patched in Pull Request.
The diff map that is returned contains changed files, as well as the parents of the changed files.
This allows the tree to be filtered for only folders that contain files with diffs.
@param {Object} opts: {
path: the starting path to load the tree,
... | _getSubmodules | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
async loadRepoData(path, isRepoMetaData = false) {
const token = await this.getAccessToken();
try {
const repo = await this.getRepoDataWrap(false, token);
if (repo) {
const data = await this.getContent(path, {
repo,
isRepoMetaData,
});
return {
... | Get files that were patched in Pull Request.
The diff map that is returned contains changed files, as well as the parents of the changed files.
This allows the tree to be filtered for only folders that contain files with diffs.
@param {Object} opts: {
path: the starting path to load the tree,
... | loadRepoData | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
getContentPath() {
let str = window.location.href;
let result = str.match(/.*[bt][lr][oe][be]\/[^//]+\/(.*)/); // blob/tree :D
return result && result.length && result[1];
} | Get files that were patched in Pull Request.
The diff map that is returned contains changed files, as well as the parents of the changed files.
This allows the tree to be filtered for only folders that contain files with diffs.
@param {Object} opts: {
path: the starting path to load the tree,
... | getContentPath | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
async getContent(path, opts) {
const host = window.location.protocol + '//' + (window.location.host + '/api/v1');
const url = `${host}/repos/${opts.repo.username}/${opts.repo.reponame}`;
const contentPath = path || this.getContentPath() || '';
let contentParams = '';
const branch = encodeURICompo... | Get files that were patched in Pull Request.
The diff map that is returned contains changed files, as well as the parents of the changed files.
This allows the tree to be filtered for only folders that contain files with diffs.
@param {Object} opts: {
path: the starting path to load the tree,
... | getContent | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
_get(path, opts, cb) {
let url;
if (path && path.startsWith('http')) {
url = path;
} else {
const host = window.location.protocol + '//' + (window.location.host + '/api/v1');
url = `${host}/repos/${opts.repo.username}/${opts.repo.reponame}${path || ''}`;
}
const cfg = {
url... | Get files that were patched in Pull Request.
The diff map that is returned contains changed files, as well as the parents of the changed files.
This allows the tree to be filtered for only folders that contain files with diffs.
@param {Object} opts: {
path: the starting path to load the tree,
... | _get | javascript | ineo6/git-master | src/common/adapters/gogs.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/gogs.js | MIT |
_handlePjaxEvent(event, gitmasterEventName, pjaxEventName) {
// Avoid re-entrance, which would blow the callstack. Because dispatchEvent() is synchronous, it's possible
// for badly implemented handler from another extension to prevent legit event handling if users navigate
// among files too quickly. Hopef... | Event handler of pjax events.
@api private | _handlePjaxEvent | javascript | ineo6/git-master | src/common/adapters/pjax.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/pjax.js | MIT |
_dispatchPjaxEventInDom(type) {
const pjaxContainer = $(this._pjaxContainerSel)[0];
if (pjaxContainer) {
pjaxContainer.dispatchEvent(
new Event(type, {
bubbles: true,
})
);
}
} | Dispatches a pjax event directly in the DOM.
GitHub's own pjax implementation dispatches its events directly in the DOM, while
the jQuery pjax library we use dispatches its events (during selectFile()) only
within its jQuery instance. Because some GitHub add-ons listen to certain pjax events
in the DOM it may be neces... | _dispatchPjaxEventInDom | javascript | ineo6/git-master | src/common/adapters/pjax.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/pjax.js | MIT |
_patchPjax() {
// The pjax plugin ($.pjax) is loaded in same time with Octotree (document ready event) and
// we don't know when $.pjax fully loaded, so we will do patching once in runtime
if (this._$pjaxPatched) return;
/**
* At this moment, when users are on Github Code page, Github sometime ref... | Dispatches a pjax event directly in the DOM.
GitHub's own pjax implementation dispatches its events directly in the DOM, while
the jQuery pjax library we use dispatches its events (during selectFile()) only
within its jQuery instance. Because some GitHub add-ons listen to certain pjax events
in the DOM it may be neces... | _patchPjax | javascript | ineo6/git-master | src/common/adapters/pjax.js | https://github.com/ineo6/git-master/blob/master/src/common/adapters/pjax.js | MIT |
function round(value) {
return Math.round(value * 10) / 10;
} | Given a number of seconds, returns a String representing that length
of time in a human-readable format.
@param {Number} seconds The number of seconds.
@return {String} A human-readable description of the duration specified. | round | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/admin-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/admin-ui.js | MIT |
function updateKeyboardSize() {
var currentSize = keyboard.getElement().offsetWidth;
if (last_keyboard_width != currentSize) {
keyboard.resize(currentSize);
last_keyboard_width = currentSize;
}
} | Event target. This is a hidden textarea element which will receive
key events.
@private | updateKeyboardSize | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function force_reconnect() {
if (!reconnect_forced) {
reconnect_forced = true;
window.clearInterval(reconnect_interval);
GuacUI.Client.connect();
}
} | Stops the reconnect countdown and forces a client reconnect. | force_reconnect | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function update_status() {
// Use appropriate description of time remaining
if (reconnect === 0)
countdown.textContent = "Reconnecting...";
if (reconnect === 1)
countdown.textContent = "Reconnecting in 1 second...";
else
c... | Stops the reconnect countdown and forces a client reconnect. | update_status | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function pinch_distance(e) {
var touch_a = e.touches[0];
var touch_b = e.touches[1];
var delta_x = touch_a.clientX - touch_b.clientX;
var delta_y = touch_a.clientY - touch_b.clientY;
return Math.sqrt(delta_x*delta_x + delta_y*delta_y);
} | Given a touch event, calculates the distance between the first two
touches in pixels.
@param {TouchEvent} e The touch event to use when performing distance
calculation.
@return {Number} The distance in pixels between the first two touches. | pinch_distance | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function pinch_center_x(e) {
var touch_a = e.touches[0];
var touch_b = e.touches[1];
return (touch_a.clientX + touch_b.clientX) / 2;
} | Given a touch event, calculates the center between the first two
touches in pixels, returning the X coordinate of this center.
@param {TouchEvent} e The touch event to use when performing center
calculation.
@return {Number} The X-coordinate of the center of the first two touches. | pinch_center_x | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function pinch_center_y(e) {
var touch_a = e.touches[0];
var touch_b = e.touches[1];
return (touch_a.clientY + touch_b.clientY) / 2;
} | Given a touch event, calculates the center between the first two
touches in pixels, returning the Y coordinate of this center.
@param {TouchEvent} e The touch event to use when performing center
calculation.
@return {Number} The Y-coordinate of the center of the first two touches. | pinch_center_y | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function __handle_mouse_state(mouseState) {
// Get client - do nothing if not attached
var guac = GuacUI.Client.attachedClient;
if (!guac) return;
// Determine mouse position within view
var guac_display = guac.getDisplay().getElement();
var mouse_view_x = mouseState... | Sets the mouse emulation mode to absolute or relative.
@param {Boolean} absolute Whether mouse emulation should use absolute
(touchscreen) mode. | __handle_mouse_state | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function __send_key(pressed, keysym) {
if (GuacUI.Client.isMenuShown() || !GuacUI.Client.text_input.enabled)
return true;
if(lastCtrl){
if(keysym !== 99 && keysym !== 118 && keysym !== 120){
GuacUI.Client.attachedClient.sendKeyEvent(1, lastCtrl);
... | Attaches a Guacamole.Client to the client UI, such that Guacamole events
affect the UI, and local events affect the Guacamole.Client. If a client
is already attached, it is replaced.
@param {Guacamole.Client} guac The Guacamole.Client to attach to the UI. | __send_key | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function __update_layout() {
// Only reflow if size or scroll have changed
if (document.body.scrollLeft !== last_scroll_left
|| document.body.scrollTop !== last_scroll_top
|| document.body.scrollWidth !== last_scroll_width
|| document.body.scrollHeight !== last_scroll_h... | Attaches a Guacamole.Client to the client UI, such that Guacamole events
affect the UI, and local events affect the Guacamole.Client. If a client
is already attached, it is replaced.
@param {Guacamole.Client} guac The Guacamole.Client to attach to the UI. | __update_layout | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function _ignore(e) {
e.preventDefault();
e.stopPropagation();
} | Ignores the given event.
@private
@param {Event} e The event to ignore. | _ignore | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function _get_base64(bytes) {
var data = "";
// Produce binary string from bytes in buffer
for (var i=0; i<bytes.byteLength; i++)
data += String.fromCharCode(bytes[i]);
// Convert to base64
return window.btoa(data);
} | Converts the given bytes to a base64-encoded string.
@private
@param {Uint8Array} bytes A Uint8Array which contains the data to be
encoded as base64.
@return {String} The base64-encoded string. | _get_base64 | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function _upload_file(file) {
// Construct reader for file
var reader = new FileReader();
reader.onloadend = function() {
// Add upload notification
var upload = new GuacUI.Upload(file.name);
upload.updateProgress(GuacUI.Client.getSizeString(0), 0);
... | Uploads the given file to the server.
@private
@param {File} file The file to upload. | _upload_file | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function keysym_from_codepoint(codepoint) {
// Keysyms for control characters
if (codepoint <= 0x1F || (codepoint >= 0x7F && codepoint <= 0x9F))
return 0xFF00 | codepoint;
// Keysyms for ASCII chars
if (codepoint >= 0x0000 && codepoint <= 0x00FF)
return codepoin... | Uploads the given file to the server.
@private
@param {File} file The file to upload. | keysym_from_codepoint | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function send_keysym(keysym) {
var guac = GuacUI.Client.attachedClient;
if (!guac)
return;
guac.sendKeyEvent(1, keysym);
guac.sendKeyEvent(0, keysym);
} | Presses and releases the key corresponding to the given keysym, as if
typed by the user.
@param {Number} keysym The keysym of the key to send. | send_keysym | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function send_codepoint(codepoint) {
if (codepoint === 10) {
send_keysym(0xFF0D);
release_sticky_keys();
return;
}
var keysym = keysym_from_codepoint(codepoint);
if (keysym) {
send_keysym(keysym);
release_sticky_keys();
... | Presses and releases the key having the keysym corresponding to the
Unicode codepoint given, as if typed by the user.
@param {Number} codepoint The Unicode codepoint of the key to send. | send_codepoint | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function send_string(content) {
var sent_text = "";
for (var i=0; i<content.length; i++) {
var codepoint = content.charCodeAt(i);
if (codepoint !== GuacUI.Client.TEXT_INPUT_PADDING_CODEPOINT) {
sent_text += String.fromCharCode(codepoint);
send_cod... | Translates each character within the given string to keysyms and sends
each, in order, as if typed by the user.
@param {String} content The string to send. | send_string | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function apply_key_behavior(key) {
function __update_key(e) {
var guac = GuacUI.Client.attachedClient;
if (!guac)
return;
e.preventDefault();
e.stopPropagation();
// Pull properties of key
var keysym = parseInt(key.getA... | Presses/releases the keysym defined by the "data-keysym" attribute on
the given element whenever the element is pressed. The "data-sticky"
attribute, if present and set to "true", causes the key to remain
pressed until text is sent.
@param {Element} key The element which will control its associated key. | apply_key_behavior | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function __update_key(e) {
var guac = GuacUI.Client.attachedClient;
if (!guac)
return;
e.preventDefault();
e.stopPropagation();
// Pull properties of key
var keysym = parseInt(key.getAttribute("data-keysym"));
var st... | Presses/releases the keysym defined by the "data-keysym" attribute on
the given element whenever the element is pressed. The "data-sticky"
attribute, if present and set to "true", causes the key to remain
pressed until text is sent.
@param {Element} key The element which will control its associated key. | __update_key | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function release_sticky_keys() {
var guac = GuacUI.Client.attachedClient;
if (!guac)
return;
// Release all active sticky keys
for (var keysym in active_sticky_keys) {
var key = active_sticky_keys[keysym];
GuacUI.removeClass(key, "pressed");
... | Releases all currently-held sticky keys within the text input UI. | release_sticky_keys | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function reset_text_input_target(padding) {
var padding_char = String.fromCharCode(GuacUI.Client.TEXT_INPUT_PADDING_CODEPOINT);
// Pad text area with an arbitrary, non-typable character (so there is something
// to delete with backspace or del), and position cursor in middle.
GuacUI.Cl... | Removes all content from the text input target, replacing it with the
given number of padding characters. Padding of the requested size is
added on both sides of the cursor, thus the overall number of characters
added will be twice the number specified.
@param {Number} padding The number of characters to pad the text ... | reset_text_input_target | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/client-ui.js | MIT |
function addGroupContents(group, appendChild) {
var i;
// Add all contained connections
if (show_connections) {
for (i=0; i<group.connections.length; i++)
addConnection(group.connections[i], appendChild);
}
// Add all contained groups
for (... | Adds the contents of the given group via the given appendChild()
function, but not the given group itself.
@param {GuacamoleService.ConnectionGroup} group The group whose contents
should be added.
@param {Function} appendChild A function which, given an element, will
... | addGroupContents | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | MIT |
function addConnection(connection, appendChild) {
// Do not add connection if filter says "no"
if (connection_filter && !connection_filter(connection))
return;
group_view.connections[connection.id] = connection;
// Add connection to connection list or parent group
... | Adds the given connection via the given appendChild() function.
@param {GuacamoleService.Connection} connection The connection to add.
@param {Function} appendChild A function which, given an element, will
add that element the the display as
desired. | addConnection | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | MIT |
function fire_connection_change(e) {
// Prevent click from affecting parent
e.stopPropagation();
// Fire event if handler defined
if (group_view.onconnectionchange)
group_view.onconnectionchange(connection, this.checked);
... | Adds the given connection via the given appendChild() function.
@param {GuacamoleService.Connection} connection The connection to add.
@param {Function} appendChild A function which, given an element, will
add that element the the display as
desired. | fire_connection_change | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | MIT |
function addGroup(group, appendChild) {
// Do not add group if filter says "no"
if (group_filter && !group_filter(group))
return;
// Add group to groups collection
group_view.groups[group.id] = group;
// Create element for group
var list_group = new GuacUI.... | Adds the given group via the given appendChild() function.
@param {GuacamoleService.ConnectionGroup} group The group to add.
@param {Function} appendChild A function which, given an element, will
add that element the the display as
desired. | addGroup | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | MIT |
function fire_group_change(e) {
// Prevent click from affecting parent
e.stopPropagation();
// Fire event if handler defined
if (group_view.ongroupchange)
group_view.ongroupchange(group, this.checked);
} | Adds the given group via the given appendChild() function.
@param {GuacamoleService.ConnectionGroup} group The group to add.
@param {Function} appendChild A function which, given an element, will
add that element the the display as
desired. | fire_group_change | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/guac-ui.js | MIT |
function truncate() {
// Build list of entries
var entries = [];
for (var old_id in history)
entries.push(history[old_id]);
// Avoid history growth beyond defined number of entries
if (entries.length > IDEAL_LENGTH) {
// Sort list
entries.so... | The maximum age of a history entry before it is removed, in
milliseconds. | truncate | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/history.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/history.js | MIT |
function hasEntry(object) {
for (var name in object)
return true;
return false;
} | Resets the interface such that the login UI is displayed if
the user is not authenticated (or authentication fails) and
the connection list UI (or the client for the only available
connection, if there is only one) is displayed if the user is
authenticated. | hasEntry | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/root-ui.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/root-ui.js | MIT |
function parseConnection(parent, element) {
var i;
var connection = new GuacamoleService.Connection(
element.getAttribute("protocol"),
element.getAttribute("id"),
element.getAttribute("name")
);
// Set parent
... | Parse the contents of the given connection element within XML,
returning a corresponding GuacamoleService.Connection.
@param {GuacamoleService.ConnectionGroup} The connection group
containing this connection.
@param {Element} element The element being parsed.
@return {Guacamol... | parseConnection | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/service.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/service.js | MIT |
function parseGroup(parent, element) {
var id = element.getAttribute("id");
var name = element.getAttribute("name");
var type_string = element.getAttribute("type");
// Translate type name
var type;
if (type_string === "organizational")
... | Recursively parse the contents of the given group element within XML,
returning a corresponding GuacamoleService.ConnectionGroup.
@param {GuacamoleService.ConnectionGroup} The connection group
containing this group.
@param {Element} element The element being parsed.
@return {G... | parseGroup | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/service.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/service.js | MIT |
function __notify_changed(name, value) {
for (var i=0; i<listeners.length; i++)
listeners[i](name, value);
} | Notifies all listeners that an item has changed.
@param {String} name The name of the item that changed.
@param value The new item value. | __notify_changed | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/session.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole/src/main/webapp/scripts/session.js | MIT |
function __send_blob(bytes) {
var binary = "";
// Produce binary string from bytes in buffer
for (var i=0; i<bytes.byteLength; i++)
binary += String.fromCharCode(bytes[i]);
// Send as base64
stream.sendBlob(window.btoa(binary));
} | Encodes the given data as base64, sending it as a blob. The data must
be small enough to fit into a single blob instruction.
@private
@param {Uint8Array} bytes The data to send. | __send_blob | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/ArrayBufferWriter.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/ArrayBufferWriter.js | MIT |
handleReady = function(buffer) {
readyBuffer = buffer;
} | Schedules this packet for playback at the given time.
@function
@param {Number} when The time this packet should be played, in
milliseconds. | handleReady | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/AudioChannel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/AudioChannel.js | MIT |
function playDelayed(buffer) {
source.buffer = buffer;
source.start(play_when / 1000);
} | Schedules this packet for playback at the given time.
@function
@param {Number} when The time this packet should be played, in
milliseconds. | playDelayed | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/AudioChannel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/AudioChannel.js | MIT |
function getLayer(index) {
// Get layer, create if necessary
var layer = layers[index];
if (!layer) {
// Create layer based on index
if (index === 0)
layer = display.getDefaultLayer();
else if (index > 0)
layer = display.creat... | Returns the layer with the given index, creating it if necessary.
Positive indices refer to visible layers, an index of zero refers to
the default layer, and negative indices refer to buffers.
@param {Number} index The index of the layer to retrieve.
@return {Guacamole.Display.VisibleLayer|Guacamole.Layer} The layer h... | getLayer | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Client.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Client.js | MIT |
function getParser(index) {
var parser = parsers[index];
// If parser not yet created, create it, and tie to the
// oninstruction handler of the tunnel.
if (parser == null) {
parser = parsers[index] = new Guacamole.Parser();
parser.oninstruction = tunnel.oninstr... | Returns the layer with the given index, creating it if necessary.
Positive indices refer to visible layers, an index of zero refers to
the default layer, and negative indices refer to buffers.
@param {Number} index The index of the layer to retrieve.
@return {Guacamole.Display.VisibleLayer|Guacamole.Layer} The layer h... | getParser | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Client.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Client.js | MIT |
function getAudioChannel(index) {
var audio_channel = audio_channels[index];
// If audio channel not yet created, create it
if (audio_channel == null)
audio_channel = audio_channels[index] = new Guacamole.AudioChannel();
return audio_channel;
} | Returns the layer with the given index, creating it if necessary.
Positive indices refer to visible layers, an index of zero refers to
the default layer, and negative indices refer to buffers.
@param {Number} index The index of the layer to retrieve.
@return {Guacamole.Display.VisibleLayer|Guacamole.Layer} The layer h... | getAudioChannel | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Client.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Client.js | MIT |
function Frame(callback, tasks) {
/**
* Returns whether this frame is ready to be rendered. This function
* returns true if and only if ALL underlying tasks are unblocked.
*
* @returns {Boolean} true if all underlying tasks are unblocked,
* false... | An ordered list of tasks which must be executed atomically. Once
executed, an associated (and optional) callback will be called.
@private
@constructor
@param {function} callback The function to call when this frame is
rendered.
@param {Task[]} tasks The set of tasks which must be executed to... | Frame | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | MIT |
function Task(taskHandler, blocked) {
var task = this;
/**
* Whether this Task is blocked.
*
* @type boolean
*/
this.blocked = blocked;
/**
* Unblocks this Task, allowing it to run.
*/
this.unblock = function... | A container for an task handler. Each operation which must be ordered
is associated with a Task that goes into a task queue. Tasks in this
queue are executed in order once their handlers are set, while Tasks
without handlers block themselves and any following Tasks from running.
@constructor
@private
@param {function... | Task | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | MIT |
function scheduleTask(handler, blocked) {
var task = new Task(handler, blocked);
tasks.push(task);
return task;
} | Schedules a task for future execution. The given handler will execute
immediately after all previous tasks upon frame flush, unless this
task is blocked. If any tasks is blocked, the entire frame will not
render (and no tasks within will execute) until all tasks are unblocked.
@private
@param {function} handler The fu... | scheduleTask | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | MIT |
function render_callback() {
layer.drawImage(0, 0, video);
if (!video.ended)
window.setTimeout(render_callback, 20);
} | Plays the video at the specified URL within this layer. The video
will be loaded automatically, and this and any future operations will
wait for the video to finish loading. Future operations will not be
executed until the video finishes playing.
@param {Guacamole.Layer} layer The layer to draw upon.
@param {String} m... | render_callback | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | MIT |
function get_children(layer) {
// Build array of children
var children = [];
for (var index in layer.children)
children.push(layer.children[index]);
// Sort
children.sort(function children_comparator(a, b) {
// Compare based ... | Returns a canvas element containing the entire display, with all child
layers composited within.
@return {HTMLCanvasElement} A new canvas element containing a copy of
the display. | get_children | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | MIT |
function draw_layer(layer, x, y) {
// Draw layer
if (layer.width > 0 && layer.height > 0) {
// Save and update alpha
var initial_alpha = context.globalAlpha;
context.globalAlpha *= layer.alpha / 255.0;
// Copy data
... | Returns a canvas element containing the entire display, with all child
layers composited within.
@return {HTMLCanvasElement} A new canvas element containing a copy of
the display. | draw_layer | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Display.js | MIT |
KeyEvent = function() {
/**
* Reference to this key event.
*/
var key_event = this;
/**
* An arbitrary timestamp in milliseconds, indicating this event's
* position in time relative to other events.
*
* @type Number
*/
this... | A key event having a corresponding timestamp. This event is non-specific.
Its subclasses should be used instead when recording specific key
events.
@private
@constructor | KeyEvent | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
KeydownEvent = function(keyCode, keyIdentifier, key, location) {
// We extend KeyEvent
KeyEvent.apply(this);
/**
* The JavaScript key code of the key pressed.
*
* @type Number
*/
this.keyCode = keyCode;
/**
* The legacy DOM3 "keyIde... | Information related to the pressing of a key, which need not be a key
associated with a printable character. The presence or absence of any
information within this object is browser-dependent.
@private
@constructor
@augments Guacamole.Keyboard.KeyEvent
@param {Number} keyCode The JavaScript key code of the key pressed... | KeydownEvent | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
KeypressEvent = function(charCode) {
// We extend KeyEvent
KeyEvent.apply(this);
/**
* The Unicode codepoint of the character that would be typed by the
* key pressed.
*
* @type Number
*/
this.charCode = charCode;
// Pull keysym fro... | Information related to the pressing of a key, which MUST be
associated with a printable character. The presence or absence of any
information within this object is browser-dependent.
@private
@constructor
@augments Guacamole.Keyboard.KeyEvent
@param {Number} charCode The Unicode codepoint of the character that
... | KeypressEvent | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
KeyupEvent = function(keyCode, keyIdentifier, key, location) {
// We extend KeyEvent
KeyEvent.apply(this);
/**
* The JavaScript key code of the key released.
*
* @type Number
*/
this.keyCode = keyCode;
/**
* The legacy DOM3 "keyIden... | Information related to the pressing of a key, which need not be a key
associated with a printable character. The presence or absence of any
information within this object is browser-dependent.
@private
@constructor
@augments Guacamole.Keyboard.KeyEvent
@param {Number} keyCode The JavaScript key code of the key release... | KeyupEvent | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function get_keysym(keysyms, location) {
if (!keysyms)
return null;
return keysyms[location] || keysyms[0];
} | Given an array of keysyms indexed by location, returns the keysym
for the given location, or the keysym for the standard location if
undefined.
@param {Array} keysyms An array of keysyms, where the index of the
keysym in the array is the location value.
@param {Number} location The location on t... | get_keysym | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function keysym_from_key_identifier(identifier, location, shifted) {
if (!identifier)
return null;
var typedCharacter;
// If identifier is U+xxxx, decode Unicode character
var unicodePrefixLocation = identifier.indexOf("U+");
if (unicodePrefixLocation >= 0) {
... | Given an array of keysyms indexed by location, returns the keysym
for the given location, or the keysym for the standard location if
undefined.
@param {Array} keysyms An array of keysyms, where the index of the
keysym in the array is the location value.
@param {Number} location The location on t... | keysym_from_key_identifier | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function isControlCharacter(codepoint) {
return codepoint <= 0x1F || (codepoint >= 0x7F && codepoint <= 0x9F);
} | Given an array of keysyms indexed by location, returns the keysym
for the given location, or the keysym for the standard location if
undefined.
@param {Array} keysyms An array of keysyms, where the index of the
keysym in the array is the location value.
@param {Number} location The location on t... | isControlCharacter | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function keysym_from_charcode(codepoint) {
// Keysyms for control characters
if (isControlCharacter(codepoint)) return 0xFF00 | codepoint;
// Keysyms for ASCII chars
if (codepoint >= 0x0000 && codepoint <= 0x00FF)
return codepoint;
// Keysyms for Unicode
if... | Given an array of keysyms indexed by location, returns the keysym
for the given location, or the keysym for the standard location if
undefined.
@param {Array} keysyms An array of keysyms, where the index of the
keysym in the array is the location value.
@param {Number} location The location on t... | keysym_from_charcode | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function keysym_from_keycode(keyCode, location) {
return get_keysym(keycodeKeysyms[keyCode], location);
} | Given an array of keysyms indexed by location, returns the keysym
for the given location, or the keysym for the standard location if
undefined.
@param {Array} keysyms An array of keysyms, where the index of the
keysym in the array is the location value.
@param {Number} location The location on t... | keysym_from_keycode | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function key_identifier_sane(keyCode, keyIdentifier) {
// Assume non-Unicode keyIdentifier values are sane
var unicodePrefixLocation = keyIdentifier.indexOf("U+");
if (unicodePrefixLocation === -1)
return true;
// If the Unicode codepoint isn't identical to the keyCode,
... | Heuristically detects if the legacy keyIdentifier property of
a keydown/keyup event looks incorrectly derived. Chrome, and
presumably others, will produce the keyIdentifier by assuming
the keyCode is the Unicode codepoint for that key. This is not
correct in all cases.
@param {Number} keyCode The keyCode from a browse... | key_identifier_sane | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function press_key(keysym) {
// Don't bother with pressing the key if the key is unknown
if (keysym === null) return;
// Only press if released
if (!guac_keyboard.pressed[keysym]) {
// Mark key as pressed
guac_keyboard.pressed[keysym] = true;
// Se... | Marks a key as pressed, firing the keydown event if registered. Key
repeat for the pressed key will start after a delay if that key is
not a modifier.
@private
@param keysym The keysym of the key to press.
@return {Boolean} true if event should NOT be canceled, false otherwise. | press_key | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function release_key(keysym) {
// Only release if pressed
if (guac_keyboard.pressed[keysym]) {
// Mark key as released
delete guac_keyboard.pressed[keysym];
// Stop repeat
window.clearTimeout(key_repeat_timeout);
window.clearInte... | Marks a key as released, firing the keyup event if registered.
@private
@param keysym The keysym of the key to release. | release_key | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function update_modifier_state(e) {
// Get state
var state = Guacamole.Keyboard.ModifierState.fromKeyboardEvent(e);
// Release alt if implicitly released
if (guac_keyboard.modifiers.alt && state.alt === false) {
release_key(0xFFE9); // Left alt
release_key(0xFFE... | Given a keyboard event, updates the local modifier state and remote
key state based on the modifier flags within the event. This function
pays no attention to keycodes.
@param {KeyboardEvent} e The keyboard event containing the flags to update. | update_modifier_state | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function interpret_events() {
// Do not prevent default if no event could be interpreted
var handled_event = interpret_event();
if (!handled_event)
return false;
// Interpret as much as possible
var last_event;
do {
last_event = handled_event;
... | Reads through the event log, removing events from the head of the log
when the corresponding true key presses are known (or as known as they
can be).
@return {Boolean} Whether the default action of the latest event should
be prevented. | interpret_events | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function indexof_keyup(keydown) {
var i;
// Search event log for keyup events having the given keysym
for (i=0; i<eventLog.length; i++) {
// Return index of key event if found
var event = eventLog[i];
if (event instanceof KeyupEvent && event.keyCode === key... | Searches the event log for a keyup event corresponding to the given
keydown event, returning its index within the log.
@param {KeydownEvent} keydown The keydown event whose corresponding keyup
event we are to search for.
@returns {Number} The index of the first keyup event in the event lo... | indexof_keyup | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function release_simulated_altgr(keysym) {
// Both Ctrl+Alt must be pressed if simulated AltGr is in use
if (!guac_keyboard.modifiers.ctrl || !guac_keyboard.modifiers.alt)
return;
// Assume [A-Z] never require AltGr
if (keysym >= 0x0041 && keysym <= 0x005A)
retu... | Releases Ctrl+Alt, if both are currently pressed and the given keysym
looks like a key that may require AltGr.
@param {Number} keysym The key that was just pressed. | release_simulated_altgr | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function interpret_event() {
// Peek at first event in log
var first = eventLog[0];
if (!first)
return null;
// Keydown event
if (first instanceof KeydownEvent) {
var keysym = null;
var accepted_events = [];
// If event itself i... | Reads through the event log, interpreting the first event, if possible,
and returning that event. If no events can be interpreted, due to a
total lack of events or the need for more events, null is returned. Any
interpreted events are automatically removed from the log.
@return {KeyEvent} The first key event in the lo... | interpret_event | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Keyboard.js | MIT |
function resize(newWidth, newHeight) {
// Only preserve old data if width/height are both non-zero
var oldData = null;
if (layer.width !== 0 && layer.height !== 0) {
// Create canvas and context for holding old data
oldData = document.createElement("canvas");
... | Resizes the canvas element backing this Layer without testing the
new size. This function should only be used internally.
@private
@param {Number} newWidth The new width to assign to this Layer.
@param {Number} newHeight The new height to assign to this Layer. | resize | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Layer.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Layer.js | MIT |
function fitRect(x, y, w, h) {
// Calculate bounds
var opBoundX = w + x;
var opBoundY = h + y;
// Determine max width
var resizeWidth;
if (opBoundX > layer.width)
resizeWidth = opBoundX;
else
resizeWidth = layer.width;
... | Given the X and Y coordinates of the upper-left corner of a rectangle
and the rectangle's width and height, resize the backing canvas element
as necessary to ensure that the rectangle fits within the canvas
element's coordinate space. This function will only make the canvas
larger. If the rectangle already fits within ... | fitRect | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Layer.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Layer.js | MIT |
function cancelEvent(e) {
e.stopPropagation();
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
} | Cumulative scroll delta amount. This value is accumulated through scroll
events and results in scroll button clicks if it exceeds a certain
threshold. | cancelEvent | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function mousewheel_handler(e) {
// Determine approximate scroll amount (in pixels)
var delta = e.deltaY || -e.wheelDeltaY || -e.wheelDelta;
// If successfully retrieved scroll amount, convert to pixels if not
// already in pixels
if (delta) {
// Convert to pixels ... | Cumulative scroll delta amount. This value is accumulated through scroll
events and results in scroll button clicks if it exceeds a certain
threshold. | mousewheel_handler | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function press_button(button) {
if (!guac_touchscreen.currentState[button]) {
guac_touchscreen.currentState[button] = true;
if (guac_touchscreen.onmousedown)
guac_touchscreen.onmousedown(guac_touchscreen.currentState);
}
} | Presses the given mouse button, if it isn't already pressed. Valid
button values are "left", "middle", "right", "up", and "down".
@private
@param {String} button The mouse button to press. | press_button | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function release_button(button) {
if (guac_touchscreen.currentState[button]) {
guac_touchscreen.currentState[button] = false;
if (guac_touchscreen.onmouseup)
guac_touchscreen.onmouseup(guac_touchscreen.currentState);
}
} | Releases the given mouse button, if it isn't already released. Valid
button values are "left", "middle", "right", "up", and "down".
@private
@param {String} button The mouse button to release. | release_button | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function click_button(button) {
press_button(button);
release_button(button);
} | Clicks (presses and releases) the given mouse button. Valid button
values are "left", "middle", "right", "up", and "down".
@private
@param {String} button The mouse button to click. | click_button | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function move_mouse(x, y) {
guac_touchscreen.currentState.fromClientPosition(element, x, y);
if (guac_touchscreen.onmousemove)
guac_touchscreen.onmousemove(guac_touchscreen.currentState);
} | Moves the mouse to the given coordinates. These coordinates must be
relative to the browser window, as they will be translated based on
the touch event target's location within the browser window.
@private
@param {Number} x The X coordinate of the mouse pointer.
@param {Number} y The Y coordinate of the mouse pointer. | move_mouse | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function finger_moved(e) {
var touch = e.touches[0] || e.changedTouches[0];
var delta_x = touch.clientX - gesture_start_x;
var delta_y = touch.clientY - gesture_start_y;
return Math.sqrt(delta_x*delta_x + delta_y*delta_y) >= guac_touchscreen.clickMoveThreshold;
} | Returns whether the given touch event exceeds the movement threshold for
clicking, based on where the touch gesture began.
@private
@param {TouchEvent} e The touch event to check.
@return {Boolean} true if the movement threshold is exceeded, false
otherwise. | finger_moved | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function begin_gesture(e) {
var touch = e.touches[0];
gesture_in_progress = true;
gesture_start_x = touch.clientX;
gesture_start_y = touch.clientY;
} | Begins a new gesture at the location of the first touch in the given
touch event.
@private
@param {TouchEvent} e The touch event beginning this new gesture. | begin_gesture | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function end_gesture() {
window.clearTimeout(click_release_timeout);
window.clearTimeout(long_press_timeout);
gesture_in_progress = false;
} | End the current gesture entirely. Wait for all touches to be done before
resuming gesture detection.
@private | end_gesture | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Mouse.js | MIT |
function __decode_utf8(buffer) {
var text = "";
var bytes = new Uint8Array(buffer);
for (var i=0; i<bytes.length; i++) {
// Get current byte
var value = bytes[i];
// Start new codepoint if nothing yet read
if (bytes_remaining === 0) {
... | Decodes the given UTF-8 data into a Unicode string. The data may end in
the middle of a multibyte character.
@private
@param {ArrayBuffer} buffer Arbitrary UTF-8 data.
@return {String} A decoded Unicode string. | __decode_utf8 | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringReader.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringReader.js | MIT |
function __expand(bytes) {
// Resize buffer if more space needed
if (length+bytes >= buffer.length) {
var new_buffer = new Uint8Array((length+bytes)*2);
new_buffer.set(buffer);
buffer = new_buffer;
}
length += bytes;
} | Expands the size of the underlying buffer by the given number of bytes,
updating the length appropriately.
@private
@param {Number} bytes The number of bytes to add to the underlying
buffer. | __expand | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringWriter.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringWriter.js | MIT |
function __append_utf8(codepoint) {
var mask;
var bytes;
// 1 byte
if (codepoint <= 0x7F) {
mask = 0x00;
bytes = 1;
}
// 2 byte
else if (codepoint <= 0x7FF) {
mask = 0xC0;
bytes = 2;
}
// 3 byte
... | Appends a single Unicode character to the current buffer, resizing the
buffer if necessary. The character will be encoded as UTF-8.
@private
@param {Number} codepoint The codepoint of the Unicode character to
append. | __append_utf8 | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringWriter.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringWriter.js | MIT |
function __encode_utf8(text) {
// Fill buffer with UTF-8
for (var i=0; i<text.length; i++) {
var codepoint = text.charCodeAt(i);
__append_utf8(codepoint);
}
// Flush buffer
if (length > 0) {
var out_buffer = buffer.subarray(0, length);
... | Encodes the given string as UTF-8, returning an ArrayBuffer containing
the resulting bytes.
@private
@param {String} text The string to encode as UTF-8.
@return {Uint8Array} The encoded UTF-8 data. | __encode_utf8 | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringWriter.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/StringWriter.js | MIT |
function reset_timeout() {
// Get rid of old timeout (if any)
window.clearTimeout(receive_timeout);
// Set new timeout
receive_timeout = window.setTimeout(function () {
close_tunnel(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
},... | Initiates a timeout which, if data is not received, causes the tunnel
to close with an error.
@private | reset_timeout | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function close_tunnel(status) {
// Ignore if already closed
if (tunnel.state === Guacamole.Tunnel.State.CLOSED)
return;
// If connection closed abnormally, signal error.
if (status.code !== Guacamole.Status.Code.SUCCESS && tunnel.onerror) {
// Ignore RESOURCE_N... | Closes this tunnel, signaling the given status and corresponding
message, which will be sent to the onerror handler if the status is
an error status.
@private
@param {Guacamole.Status} status The status causing the connection to
close; | close_tunnel | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function getElement(value) {
var string = new String(value);
return string.length + "." + string;
} | Converts the given value to a length/string pair for use as an
element in a Guacamole instruction.
@private
@param value The value to convert.
@return {String} The converted value. | getElement | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function sendPendingMessages() {
// Do not attempt to send messages if not connected
if (tunnel.state !== Guacamole.Tunnel.State.OPEN)
return;
if (outputMessageBuffer.length > 0) {
sendingMessages = true;
var message_xmlhttprequest = new XMLHttpRequest();
... | Converts the given value to a length/string pair for use as an
element in a Guacamole instruction.
@private
@param value The value to convert.
@return {String} The converted value. | sendPendingMessages | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function handleHTTPTunnelError(xmlhttprequest) {
var code = parseInt(xmlhttprequest.getResponseHeader("Guacamole-Status-Code"));
var message = xmlhttprequest.getResponseHeader("Guacamole-Error-Message");
close_tunnel(new Guacamole.Status(code, message));
} | Converts the given value to a length/string pair for use as an
element in a Guacamole instruction.
@private
@param value The value to convert.
@return {String} The converted value. | handleHTTPTunnelError | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function handleResponse(xmlhttprequest) {
var interval = null;
var nextRequest = null;
var dataUpdateEvents = 0;
// The location of the last element's terminator
var elementEnd = -1;
// Where to start the next length search or the next element
var startIndex =... | Converts the given value to a length/string pair for use as an
element in a Guacamole instruction.
@private
@param value The value to convert.
@return {String} The converted value. | handleResponse | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function parseResponse() {
// Do not handle responses if not connected
if (tunnel.state !== Guacamole.Tunnel.State.OPEN) {
// Clean up interval if polling
if (interval !== null)
clearInterval(interval);
... | Converts the given value to a length/string pair for use as an
element in a Guacamole instruction.
@private
@param value The value to convert.
@return {String} The converted value. | parseResponse | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function makeRequest() {
// Make request, increment request ID
var xmlhttprequest = new XMLHttpRequest();
xmlhttprequest.open("GET", TUNNEL_READ + tunnel_uuid + ":" + (request_id++));
xmlhttprequest.send(null);
return xmlhttprequest;
} | Arbitrary integer, unique for each tunnel read request.
@private | makeRequest | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
function reset_timeout() {
// Get rid of old timeout (if any)
window.clearTimeout(receive_timeout);
// Set new timeout
receive_timeout = window.setTimeout(function () {
close_tunnel(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
},... | Initiates a timeout which, if data is not received, causes the tunnel
to close with an error.
@private | reset_timeout | javascript | alibaba/f2etest | f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | https://github.com/alibaba/f2etest/blob/master/f2etest-guacamole/guacamole-client-0.9.3/guacamole-common-js/src/main/webapp/modules/Tunnel.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.