-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuto Scale Chart.user.js
More file actions
34 lines (28 loc) · 980 Bytes
/
Copy pathAuto Scale Chart.user.js
File metadata and controls
34 lines (28 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name Auto Scale Chart
// @version 0.1
// @match *://*.tradingview.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
document.addEventListener('click', function(e) {
// Prevent the default action if needed
// e.preventDefault();
// Find the active chart container
let activeChart = document.querySelector('.chart-widget');
if (activeChart) {
// Find the "Auto (fits data to screen)" button within the active chart
let autoButton = activeChart.querySelector('button[data-tooltip="Auto (fits data to screen)"]');
if (autoButton) {
// Click the "Auto" button
autoButton.click();
} else {
console.log('Auto button not found in the active chart');
}
} else {
console.log('No active chart found');
}
});
})();