PageSourceSearch

https://ferra.ag/charting_library/charting_library.js

js ferra.ag collected 2026-10-07 02:41:25 UTC 17,753 bytes, 495 lines download raw bytes

1!(function (e, t) {
2  "object" == typeof exports && "undefined" != typeof module
3    ? t(exports)
4    : "function" == typeof define && define.amd
5    ? define(["exports"], t)
6    : t(((e = "undefined" != typeof globalThis ? globalThis : e || self).TradingView = {}));
7})(this, function (e) {
8  "use strict";
9  function t(e, i) {
10    const n = { ...e };
11    for (const o in i)
12      "object" != typeof e[o] || null === e[o] || Array.isArray(e[o])
13        ? void 0 !== i[o] && (n[o] = i[o])
14        : (n[o] = t(e[o], i[o]));
15    return n;
16  }
17  const i = {
18      mobile: {
19        disabled_features: [
20          "left_toolbar",
21          "header_widget",
22          "timeframes_toolbar",
23          "edit_buttons_in_legend",
24          "context_menus",
25          "control_bar",
26          "border_around_the_chart",
27        ],
28        enabled_features: [],
29      },
30    },
31    n = {
32      width: 800,
33      height: 500,
34      interval: "1D",
35      timezone: "Etc/UTC",
36      container: "",
37      library_path: "",
38      locale: "en",
39      widgetbar: { details: !1, watchlist: !1, watchlist_settings: { default_symbols: [] } },
40      overrides: { "mainSeriesProperties.showCountdown": !1 },
41      studies_overrides: {},
42      trading_customization: { position: {}, order: {} },
43      brokerConfig: { configFlags: {} },
44      fullscreen: !1,
45      autosize: !1,
46      disabled_features: [],
47      enabled_features: [],
48      debug: !1,
49      logo: {},
50      time_frames: [
51        { text: "5y", resolution: "1W" },
52        { text: "1y", resolution: "1W" },
53        { text: "6m", resolution: "120" },
54        { text: "3m", resolution: "60" },
55        { text: "1m", resolution: "30" },
56        { text: "5d", resolution: "5" },
57        { text: "1d", resolution: "1" },
58      ],
59      client_id: "0",
60      user_id: "0",
61      charts_storage_api_version: "1.0",
62      favorites: { intervals: [], chartTypes: [] },
63    };
64  let o = !1;
65  function s() {
66    return "CL v22.032 (internal id e2a841ff @ 2022-07-06T11:53:07.702Z)";
67  }
68  const r = class {
69    constructor(e) {
70      if (
71        ((this._id = `tradingview_${((1048576 * (1 + Math.random())) | 0).toString(16).substring(1)}`),
72        (this._ready = !1),
73        (this._readyHandlers = []),
74        (this._onWindowResize = this._autoResizeChart.bind(this)),
75        !e.datafeed)
76      )
77        throw new Error("Datafeed is not defined");
78      if (((this._options = t(n, e)), e.preset)) {
79        const t = i[e.preset];
80        t
81          ? (void 0 !== this._options.disabled_features
82              ? (this._options.disabled_features = this._options.disabled_features.concat(t.disabled_features))
83              : (this._options.disabled_features = t.disabled_features),
84            void 0 !== this._options.enabled_features
85              ? (this._options.enabled_features = this._options.enabled_features.concat(t.enabled_features))
86              : (this._options.enabled_features = t.enabled_features))
87          : console.warn("Unknown preset: `" + e.preset + "`");
88      }
89      "Dark" === this._options.theme &&
90        void 0 === this._options.loading_screen &&
91        (this._options.loading_screen = { backgroundColor: "#18191B" }),
92        this._options.debug &&
93          (o || ((o = !0), console.log("Using CL v22.032 (internal id e2a841ff @ 2022-07-06T11:53:07.702Z)"))),
94        this._create();
95    }
96    onChartReady(e) {
97      this._ready ? e.call(this) : this._readyHandlers.push(e);
98    }
99    headerReady() {
100      return this._innerWindowLoaded.then(() => this._innerWindow().headerReady());
101    }
102    onGrayedObjectClicked(e) {
103      this._doWhenInnerApiLoaded((t) => {
104        t.onGrayedObjectClicked(e);
105      });
106    }
107    onShortcut(e, t) {
108      this._doWhenInnerWindowLoaded((i) => {
109        i.createShortcutAction(e, t);
110      });
111    }
112    subscribe(e, t) {
113      this._doWhenInnerApiLoaded((i) => {
114        i.subscribe(e, t);
115      });
116    }
117    unsubscribe(e, t) {
118      this._doWhenInnerApiLoaded((i) => {
119        i.unsubscribe(e, t);
120      });
121    }
122    chart(e) {
123      return this._innerAPI().chart(e);
124    }
125    getLanguage() {
126      return this._options.locale;
127    }
128    setSymbol(e, t, i) {
129      this._innerAPI().changeSymbol(e, t, i);
130    }
131    remove() {
132      window.removeEventListener("resize", this._onWindowResize),
133        this._readyHandlers.splice(0, this._readyHandlers.length),
134        delete window[this._id],
135        this._iFrame.parentNode && this._iFrame.parentNode.removeChild(this._iFrame);
136    }
137    closePopupsAndDialogs() {
138      this._doWhenInnerApiLoaded((e) => {
139        e.closePopupsAndDialogs();
140      });
141    }
142    selectLineTool(e) {
143      this._innerAPI().selectLineTool(e);
144    }
145    selectedLineTool() {
146      return this._innerAPI().selectedLineTool();
147    }
148    save(e) {
149      this._innerAPI().saveChart(e);
150    }
151    load(e, t) {
152      this._innerAPI().loadChart({ json: e, extendedData: t });
153    }
154    getSavedCharts(e) {
155      this._innerAPI().getSavedCharts(e);
156    }
157    loadChartFromServer(e) {
158      this._innerAPI().loadChartFromServer(e);
159    }
160    saveChartToServer(e, t, i) {
161      this._innerAPI().saveChartToServer(e, t, i);
162    }
163    removeChartFromServer(e, t) {
164      this._innerAPI().removeChartFromServer(e, t);
165    }
166    onContextMenu(e) {
167      this._doWhenInnerApiLoaded((t) => {
168        t.onContextMenu(e);
169      });
170    }
171    createButton(e) {
172      return this._innerWindow().createButton(e);
173    }
174    createDropdown(e) {
175      return this._innerWindow().createDropdown(e);
176    }
177    showNoticeDialog(e) {
178      this._doWhenInnerApiLoaded((t) => {
179        t.showNoticeDialog(e);
180      });
181    }
182    showConfirmDialog(e) {
183      this._doWhenInnerApiLoaded((t) => {
184        t.showConfirmDialog(e);
185      });
186    }
187    showLoadChartDialog() {
188      this._innerAPI().showLoadChartDialog();
189    }
190    showSaveAsChartDialog() {
191      this._innerAPI().showSaveAsChartDialog();
192    }
193    symbolInterval() {
194      return this._innerAPI().getSymbolInterval();
195    }
196    mainSeriesPriceFormatter() {
197      return this._innerAPI().mainSeriesPriceFormatter();
198    }
199    getIntervals() {
200      return this._innerAPI().getIntervals();
201    }
202    getStudiesList() {
203      return this._innerAPI().getStudiesList();
204    }
205    getStudyInputs(e) {
206      return this._innerAPI().getStudyInputs(e);
207    }
208    addCustomCSSFile(e) {
209      this._innerWindow().addCustomCSSFile(e);
210    }
211    applyOverrides(e) {
212      (this._options = t(this._options, { overrides: e })),
213        this._doWhenInnerWindowLoaded((t) => {
214          t.applyOverrides(e);
215        });
216    }
217    applyStudiesOverrides(e) {
218      this._doWhenInnerWindowLoaded((t) => {
219        t.applyStudiesOverrides(e);
220      });
221    }
222    watchList() {
223      return this._innerAPI().watchlist();
224    }
225    news() {
226      return this._innerAPI().news();
227    }
228    widgetbar() {
229      return this._innerAPI().widgetbar();
230    }
231    activeChart() {
232      return this._innerAPI().activeChart();
233    }
234    chartsCount() {
235      return this._innerAPI().chartsCount();
236    }
237    layout() {
238      return this._innerAPI().layout();
239    }
240    setLayout(e) {
241      this._innerAPI().setLayout(e);
242    }
243    layoutName() {
244      return this._innerAPI().layoutName();
245    }
246    changeTheme(e, t) {
247      return this._innerWindow().changeTheme(e, t);
248    }
249    getTheme() {
250      return this._innerWindow().getTheme();
251    }
252    takeScreenshot() {
253      this._doWhenInnerApiLoaded((e) => {
254        e.takeScreenshot();
255      });
256    }
257    lockAllDrawingTools() {
258      return this._innerAPI().lockAllDrawingTools();
259    }
260    hideAllDrawingTools() {
261      return this._innerAPI().hideAllDrawingTools();
262    }
263    drawOnAllCharts(e) {
264      this._innerAPI().drawOnAllCharts(e);
265    }
266    magnetEnabled() {
267      return this._innerAPI().magnetEnabled();
268    }
269    magnetMode() {
270      return this._innerAPI().magnetMode();
271    }
272    undoRedoState() {
273      return this._innerAPI().undoRedoState();
274    }
275    setIntervalLinkingEnabled(e) {
276      this._innerAPI().setIntervalLinkingEnabled(e);
277    }
278    setTimeFrame(e) {
279      this._innerAPI().setTimeFrame(e);
280    }
281    symbolSync() {
282      return this._innerAPI().symbolSync();
283    }
284    intervalSync() {
285      return this._innerAPI().intervalSync();
286    }
287    crosshairSync() {
288      return this._innerAPI().crosshairSync();
289    }
290    timeSync() {
291      return this._innerAPI().timeSync();
292    }
293    getAllFeatures() {
294      return this._innerWindow().getAllFeatures();
295    }
296    clearUndoHistory() {
297      return this._innerAPI().clearUndoHistory();
298    }
299    undo() {
300      return this._innerAPI().undo();
301    }
302    redo() {
303      return this._innerAPI().redo();
304    }
305    startFullscreen() {
306      this._innerAPI().startFullscreen();
307    }
308    exitFullscreen() {
309      this._innerAPI().exitFullscreen();
310    }
311    takeClientScreenshot(e) {
312      return this._innerAPI().takeClientScreenshot(e);
313    }
314    navigationButtonsVisibility() {
315      return this._innerWindow().getNavigationButtonsVisibility();
316    }
317    paneButtonsVisibility() {
318      return this._innerWindow().getPaneButtonsVisibility();
319    }
320    dateFormat() {
321      return this._innerWindow().getDateFormat();
322    }
323    _innerAPI() {
324      return this._innerWindow().tradingViewApi;
325    }
326    _innerWindow() {
327      return this._iFrame.contentWindow;
328    }
329    _doWhenInnerWindowLoaded(e) {
330      this._ready
331        ? e(this._innerWindow())
332        : this._innerWindowLoaded.then(() => {
333            e(this._innerWindow());
334          });
335    }
336    _doWhenInnerApiLoaded(e) {
337      this._doWhenInnerWindowLoaded((t) => {
338        t.doWhenApiIsReady(() => e(this._innerAPI()));
339      });
340    }
341    _autoResizeChart() {
342      this._options.fullscreen && (this._iFrame.style.height = window.innerHeight + "px");
343    }
344    _create() {
345      const e = this._render();
346      this._options.container_id &&
347        console.warn(
348          "`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`."
349        );
350      const t = this._options.container_id || this._options.container,
351        i = "string" == typeof t ? document.getElementById(t) : t;
352      if (null === i) throw new Error(`There is no such element - #${this._options.container}`);
353      (i.innerHTML = e), (this._iFrame = i.querySelector(`#${this._id}`));
354      const n = this._iFrame;
355      (this._options.autosize || this._options.fullscreen) &&
356        ((n.style.width = "100%"), this._options.fullscreen || (n.style.height = "100%")),
357        window.addEventListener("resize", this._onWindowResize),
358        this._onWindowResize(),
359        (this._innerWindowLoaded = new Promise((e) => {
360          const t = () => {
361            n.removeEventListener("load", t, !1), e();
362          };
363          n.addEventListener("load", t, !1);
364        })),
365        this._innerWindowLoaded.then(() => {
366          this._innerWindow().widgetReady(() => {
367            this._ready = !0;
368            for (const e of this._readyHandlers)
369              try {
370                e.call(this);
371              } catch (e) {
372                console.error(e);
373              }
374            this._innerWindow().initializationFinished();
375          });
376        });
377    }
378    _render() {
379      const e = window;
380      if (
381        ((e[this._id] = {
382          datafeed: this._options.datafeed,
383          customFormatters: this._options.custom_formatters || this._options.customFormatters,
384          brokerFactory: this._options.broker_factory || this._options.brokerFactory,
385          overrides: this._options.overrides,
386          studiesOverrides: this._options.studies_overrides,
387          tradingCustomization: this._options.trading_customization,
388          disabledFeatures: this._options.disabled_features,
389          enabledFeatures: this._options.enabled_features,
390          brokerConfig: this._options.broker_config || this._options.brokerConfig,
391          restConfig: this._options.restConfig,
392          favorites: this._options.favorites,
393          logo: this._options.logo,
394          numeric_formatting: this._options.numeric_formatting,
395          rss_news_feed: this._options.rss_news_feed,
396          newsProvider: this._options.news_provider,
397          loadLastChart: this._options.load_last_chart,
398          saveLoadAdapter: this._options.save_load_adapter,
399          loading_screen: this._options.loading_screen,
400          settingsAdapter: this._options.settings_adapter,
401          getCustomIndicators: this._options.custom_indicators_getter,
402          additionalSymbolInfoFields: this._options.additional_symbol_info_fields,
403          headerWidgetButtonsMode: this._options.header_widget_buttons_mode,
404          customTranslateFunction: this._options.custom_translate_function,
405          symbolSearchComplete: this._options.symbol_search_complete,
406          contextMenu: this._options.context_menu,
407          settingsOverrides: this._options.settings_overrides,
408        }),
409        this._options.saved_data)
410      )
411        (e[this._id].chartContent = { json: this._options.saved_data }),
412          this._options.saved_data_meta_info &&
413            (e[this._id].chartContentExtendedData = this._options.saved_data_meta_info);
414      else if (!this._options.load_last_chart && !this._options.symbol)
415        throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");
416      const t =
417        (this._options.library_path || "") +
418        `${encodeURIComponent(this._options.locale)}-tv-chart.e2a841ff.html#symbol=` +
419        encodeURIComponent(this._options.symbol || "") +
420        "&interval=" +
421        encodeURIComponent(this._options.interval) +
422        (this._options.timeframe ? "&timeframe=" + encodeURIComponent(this._options.timeframe) : "") +
423        (this._options.toolbar_bg
424          ? "&toolbarbg=" + encodeURIComponent(this._options.toolbar_bg.replace("#", ""))
425          : "") +
426        (this._options.studies_access
427          ? "&studiesAccess=" + encodeURIComponent(JSON.stringify(this._options.studies_access))
428          : "") +
429        "&widgetbar=" +
430        encodeURIComponent(JSON.stringify(this._options.widgetbar)) +
431        (this._options.drawings_access
432          ? "&drawingsAccess=" + encodeURIComponent(JSON.stringify(this._options.drawings_access))
433          : "") +
434        "&timeFrames=" +
435        encodeURIComponent(JSON.stringify(this._options.time_frames)) +
436        "&locale=" +
437        encodeURIComponent(this._options.locale) +
438        "&uid=" +
439        encodeURIComponent(this._id) +
440        "&clientId=" +
441        encodeURIComponent(String(this._options.client_id)) +
442        "&userId=" +
443        encodeURIComponent(String(this._options.user_id)) +
444        (this._options.charts_storage_url
445          ? "&chartsStorageUrl=" + encodeURIComponent(this._options.charts_storage_url)
446          : "") +
447        (this._options.charts_storage_api_version
448          ? "&chartsStorageVer=" + encodeURIComponent(this._options.charts_storage_api_version)
449          : "") +
450        (this._options.custom_css_url ? "&customCSS=" + encodeURIComponent(this._options.custom_css_url) : "") +
451        (this._options.custom_font_family
452          ? "&customFontFamily=" + encodeURIComponent(this._options.custom_font_family)
453          : "") +
454        (this._options.auto_save_delay
455          ? "&autoSaveDelay=" + encodeURIComponent(String(this._options.auto_save_delay))
456          : "") +
457        "&debug=" +
458        encodeURIComponent(String(this._options.debug)) +
459        (this._options.snapshot_url ? "&snapshotUrl=" + encodeURIComponent(this._options.snapshot_url) : "") +
460        (this._options.timezone ? "&timezone=" + encodeURIComponent(this._options.timezone) : "") +
461        (this._options.study_count_limit
462          ? "&studyCountLimit=" + encodeURIComponent(String(this._options.study_count_limit))
463          : "") +
464        (this._options.symbol_search_request_delay
465          ? "&ssreqdelay=" + encodeURIComponent(String(this._options.symbol_search_request_delay))
466          : "") +
467        (this._options.compare_symbols
468          ? "&compareSymbols=" + encodeURIComponent(JSON.stringify(this._options.compare_symbols))
469          : "") +
470        (this._options.theme ? "&theme=" + encodeURIComponent(String(this._options.theme)) : "") +
471        (this._options.header_widget_buttons_mode
472          ? "&header_widget_buttons_mode=" + encodeURIComponent(String(this._options.header_widget_buttons_mode))
473          : "") +
474        (this._options.time_scale ? "&time_scale=" + encodeURIComponent(JSON.stringify(this._options.time_scale)) : "");
475      return (
476        '<iframe id="' +
477        this._id +
478        '" name="' +
479        this._id +
480        '"  src="' +
481        t +
482        '"' +
483        (this._options.autosize || this._options.fullscreen
484          ? ""
485          : ' width="' + this._options.width + '" height="' + this._options.height + '"') +
486        ' title="Financial Chart" frameborder="0" allowTransparency="true" scrolling="no" allowfullscreen style="display:block;"></iframe>'
487      );
488    }
489  };
490  (window.TradingView = window.TradingView || {}),
491    (window.TradingView.version = s),
492    (e.version = s),
493    (e.widget = r),
494    Object.defineProperty(e, "__esModule", { value: !0 });
495});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.