Initial commit with Advoware proxy

This commit is contained in:
root
2025-10-19 14:57:07 +00:00
commit 273aa8b549
45771 changed files with 5534555 additions and 0 deletions

View File

@@ -0,0 +1 @@
node_modules

View File

@@ -0,0 +1,18 @@
# Toggle Selection
Simple module exposing function that deselects current browser selection and returns function that restores selection.
```
var deselect = require('toggle-selection');
var reselect = deselect(); // remove all selection
// …
// do something with current selection, text, etc;
// …
reselect(); // restore selection
```
All credits go to [@shvaikalesh](https://github.com/shvaikalesh).
# [Example](https://github.com/sudodoki/toggle-selection/blob/master/example)
![example recording](http://g.recordit.co/YPu6mHvcKe.gif)

View File

@@ -0,0 +1,16 @@
var selection = document.getSelection();
document.addEventListener('DOMContentLoaded', function(event) {
setTimeout(function() {
if (!selection.rangeCount) { // for demo purposes only
return;
}
reselect = module.exports();
setTimeout(function() {
reselect();
console.log('reselected');
}, 1000);
console.log('deselected');
}, 2000);
});

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Page</title>
<script src="../index.js"></script>
<script src="demo.js"></script>
</head>
<body>
<textarea cols="30" rows="10">Some random stuff.</textarea>
<textarea cols="30" rows="10">Some random stuff.</textarea>
<textarea cols="30" rows="10">Some random stuff.</textarea>
<div contentEditable>Some random stuff.</div>
<input value="Some random stuff.">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
Nullam dictum felis eu pede mollis pretium. Integer tincidunt.
</p>
</body>
</html>

View File

@@ -0,0 +1,39 @@
module.exports = function () {
var selection = document.getSelection();
if (!selection.rangeCount) {
return function () {};
}
var active = document.activeElement;
var ranges = [];
for (var i = 0; i < selection.rangeCount; i++) {
ranges.push(selection.getRangeAt(i));
}
switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML
case 'INPUT':
case 'TEXTAREA':
active.blur();
break;
default:
active = null;
break;
}
selection.removeAllRanges();
return function () {
selection.type === 'Caret' &&
selection.removeAllRanges();
if (!selection.rangeCount) {
ranges.forEach(function(range) {
selection.addRange(range);
});
}
active &&
active.focus();
};
};

View File

@@ -0,0 +1,27 @@
{
"name": "toggle-selection",
"version": "1.0.6",
"description": "Toggle current selected content in browser",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/sudodoki/toggle-selection"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"selection",
"toggle",
"browser",
"deselect"
],
"author": "sudodoki <smd.deluzion@gmail.com> (sudodoki.name)",
"license": "MIT",
"contributors": [
{
"name": "Aleksej Shvajka",
"url": "https://github.com/shvaikalesh"
}
]
}