Greasemonkey can do some interesting tricks on a webpage.
Greasemonkey scripts (Javascript) can alter web page elements, add a div or box to the page, trigger button click events and others.
For example, here is a script that adds a checkbox before the link tag for ever <li> element:
// ==UserScript==
// @name script name
// @namespace http://my.homepage/
// @version 0.1
// @description add marking checkbox.
// @match http://matched_website.com
// @match https://matched_website.com
// ==/UserScript==
function changhandler(event) {
if (event.target.checked) {
localStorage[event.target.name] = true;
} else {
localStorage.removeItem(event.target.name);
}
}
[].forEach.call(
document.getElementById('main').getElementsByTagName('li'),
function(e) {
var checkBox = document.createElement('input');
checkBox.type = 'checkbox';
checkBox.name = e.getElementsByTagName('a')[0].innerHTML;
checkBox.checked = localStorage[e.getElementsByTagName('a')[0].innerHTML];
checkBox.addEventListener('change', changhandler, false);
oj.insertBefore(checkBox, null);
}
);
[1] http://en.wikipedia.org/wiki/Greasemonkey
Showing posts with label Greasemonkey. Show all posts
Showing posts with label Greasemonkey. Show all posts
Tuesday, April 21, 2015
Subscribe to:
Posts (Atom)
Blog Archive
-
▼
2026
(36)
-
▼
June
(19)
- C10K to C10M: from thread-per-connection model to ...
- Benchmark server performance
- Application server for php, python, java, node.js,...
- Application server for C++, Go and Rust
- Nginx as reverse proxy and load balancer
- Infrastructure running: nginx, apache, php, python...
- Flow chart of nginx+apache+uvcorn infrastructure
- Flow chart of apache+uvcorn infrastructure
- Uvicorn and Gunicorn
- What's deadsnakes PPA
- What's the optional lsb-core package
- Codex known logging bug
- Daemonsize a service
- Train text to image model, to generate images of c...
- Train a model based on OpenAI API
- Open port 8080 for WebSocket
- Add websocket support on Bluehost Ubuntu VPS for D...
- Install Claude Code on ubuntu VPS of Bluehost
- Install PostgreSQL on Mac
-
▼
June
(19)