Javascript.RU

Создать новую тему Ответ
 
Опции темы Искать в теме
  #1 (permalink)  
Старый 25.01.2024, 10:42
Новичок на форуме
Отправить личное сообщение для SkromnayaTatarochka Посмотреть профиль Найти все сообщения от SkromnayaTatarochka
 
Регистрация: 26.06.2023
Сообщений: 2

Найти переменную из script в HTML из файла js
Доброго времени суток! Подскажите пожалуйста, у меня есть скрипт в HTML, где находиться переменная с JSON элементами. Надо найти эту переменную и вытащить оттуда JSON из файла js.
Скрипт выглядит так :

Код:
<script  type='text/javascript'>var json_i18n={"theme": "Theme","dark_gray": "Dark Gray","bright": "Bright","dark_blue": "Dark Blue","dark_purple": "Dark Purple","panels": "Panels","items_per_page": "Items per Page","tables": "Tables","display_tables": "Display Tables","ah_small": "Auto-Hide on Small Devices","ah_small_title": "Automatically hide tables on small screen devices","layout": "Layout","horizontal": "Horizontal","vertical": "Vertical","file_opts": "File Options","export_json": "Export as JSON","panel_opts": "Panel Options","previous": "Previous","next": "Next","first": "First","last": "Last","chart_opts": "Chart Options","chart": "Chart","type": "Type","area_spline": "Area Spline","bar": "Bar","plot_metric": "Plot Metric","table_columns": "Table Columns","thead": "Overall Analyzed Requests","version": "1.3",};var html_prefs={};var user_interface={"general": {"head": "Overall Analyzed Requests","desc": "","items": {"total_requests": {"className": "black","dataType": "numeric","label": "Total Requests"},"valid_requests": {"className": "green","dataType": "numeric","label": "Valid Requests"},"failed_requests": {"className": "red","dataType": "numeric","label": "Failed Requests"},"generation_time": {"className": "gray","dataType": "secs","label": "Init. Proc. Time"},"unique_visitors": {"className": "blue","dataType": "numeric","label": "Unique Visitors"},"unique_files": {"dataType": "numeric","label": "Requested Files"},"excluded_hits": {"dataType": "numeric","label": "Excl. IP Hits"},"unique_referrers": {"dataType": "numeric","label": "Referrers"},"unique_not_found": {"dataType": "numeric","label": "Not Found"},"unique_static_files": {"dataType": "numeric","label": "Static Files"},"log_size": {"dataType": "bytes","label": "Log Size"},"bandwidth": {"dataType": "bytes","label": "Tx. Amount"}}},"visitors": {"head": "Unique visitors per day - Including spiders","desc": "Hits having the same IP, date and agent are a unique visit.","id": "visitors","table": 1,"sort": {"field": "data","order": "DESC"},"plot": [{"className": "hits-visitors","label": "Hits/Visitors","chartType": "area-spline","chartReverse": 1,"redrawOnExpand": 1,"d3": {"y0": {"key": "hits","label": "Hits"},"y1": {"key": "visitors","label": "Visitors"}}},{"className": "bandwidth","label": "Tx. Amount","chartType": "area-spline","chartReverse": 1,"redrawOnExpand": 1,"d3": {"y0": {"key": "bytes","label": "Tx. Amount","format": "bytes"}}}],"items": [{"colWidth": "12%","meta": "count","dataType": "numeric","key": "hits","label": "Hits"},{"colWidth": "12%","meta": "count","dataType": "numeric","key": "visitors","label": "Visitors"},{"colWidth": "12%","meta": "count","dataType": "bytes","key": "bytes","label": "Tx. Amount"},{"className": "trunc","colWidth": "100%","meta": "unique","metaType": "numeric","metaLabel": "Total","dataType": "date","key": "data","label": "Data"}]},"requests": {"head": "Requested Files (URLs)","desc": "Top requests sorted by hits [, avgts, cumts, maxts, mthd, proto]","id": "requests","table": 1,"sort": {"field": "hits","order": "DESC"},"plot": [{"className": "hits-visitors","label": "Hits/Visitors","chartType": "bar","chartReverse": 0,"redrawOnExpand": 0,"d3": {"x": {"key": ["method", "data", "protocol"]},"y0": {"key": "hits","label": "Hits"},"y1": {"key": "visitors","label": "Visitors"}}},{"className": "bandwidth","label": "Tx. Amount","chartType": "bar","chartReverse": 0,"redrawOnExpand": 0,"d3": {"x": {"key": ["method", "protocol", "data"]},"y0": {"key": "bytes","label": "Tx. Amount","format": "bytes"}}}],"items": [{"colWidth": "12%","meta": "count","dataType": "numeric","key": "hits","label": "Hits"},{"colWidth": "12%","meta": "count","dataType": "numeric","key": "visitors","label": "Visitors"},{"colWidth": "12%","meta": "count","dataType": "bytes","key": "bytes","label": "Tx. Amount"},{"colWidth": "6%","dataType": "string","key": "method","label": "Method"},{"colWidth": "7%","dataType": "string","key": "protocol","label": "Protocol"},{"className": "trunc","colWidth": "100%","meta": "unique","metaType": "numeric","metaLabel": "Total","dataType": "string","key": "data","label": "Data"}]},"static_requests": {"head": "Static Requests","desc": "Top static requests sorted by hits [, avgts, cumts, maxts, mthd, proto]","id": "static_requests","table": 1,"sort": {"field": "hits","order": "DESC"},"plot": [{"className": "hits-visitors","label": "Hits/Visitors","chartType": "bar","chartReverse": 0,"redrawOnExpand": 0,"d3": {"x": {"key": ["method", "data", "protocol"]},"y0": {"key": "hits","label": "Hits"},"y1": {"key": "visitors","label": "Visitors"}}},{"className": "bandwidth","label": "Tx. Amount","chartType": "bar","chartReverse": 0,"redrawOnExpand": 0,"d3": {"x": {"key": ["method", "protocol", "data"]},"y0": {"key": "bytes","label": "Tx. Amount","format": "bytes"}}}],"items": [{"colWidth": "12%","meta": "count","dataType": "numeric","key": "hits","label": "Hits"},{"colWidth": "12%","meta": "count","dataType": "numeric","key": "visitors","label": "Visitors"},{"colWidth": "12%","meta": "count","dataType": "bytes","key": "bytes","label": "Tx. Amount"},{"colWidth": "6%","dataType": "string","key": "method","label": "Method"},{"colWidth": "7%","dataType": "string","key": "protocol","label": "Protocol"},{"className": "trunc","colWidth": "100%","meta": "unique","metaType": "numeric","metaLabel": "Total","dataType": "string","key": "data","label": "Data"}]},"not_found": {"head": "Not Found URLs (404s)","desc": "Top not found URLs sorted by hits [, avgts, cumts, maxts, mthd, proto]","id": "not_found","table": 1,"sort": {"field": "hits","order": "DESC"},"plot": [{"className": "hits-visitors","label": "Hits/Visitors","chartType": "bar","chartReverse": 0,"redrawOnExpand": 0,"d3": {"x": {"key": ["method", "data", "protocol"]},"y0": {"key": "hits","label": "Hits"},"y1": {"key": "visitors","label": "Visitors"}}},{"className": "bandwidth","label": "Tx. Amount","chartType": "bar","chartReverse": 0,"redrawOnExpand": 0,"d3": {"x": {"key": ["method", "protocol", "data"]},"y0": {"key": "bytes","label": "Tx. Amount","format": "bytes"}}}],"items": [{"colWidth": "12%","meta": "count","dataType": "numeric","key": "hits","label": "Hits"},{"colWidth": "12%","meta": "count","dataType": "numeric","key": "visitors","label": "Visitors"},{"colWidth": "12%","meta": "count","dataType": "bytes","key": "bytes","label": "Tx. Amount"},{"colWidth": "6%","dataType": "string","key": "method","label": "Method"},{"colWidth": "7%","dataType": "string","key": "protocol","label": "Protocol"},{"className": "trunc","colWidth": "100%","meta": "unique","metaType": "numeric","metaLabel": ...........</script>
Ответить с цитированием
  #2 (permalink)  
Старый 25.01.2024, 11:17
Аватар для ksa
ksa ksa вне форума
CacheVar
Отправить личное сообщение для ksa Посмотреть профиль Найти все сообщения от ksa
 
Регистрация: 19.08.2010
Сообщений: 14,123

Сообщение от SkromnayaTatarochka
var json_i18n={...}
Вот какая-то переменная...
Только это уже не JSON, это уже обычный объект JS.
Ответить с цитированием
Ответ



Опции темы Искать в теме
Искать в теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Трудности с подключение модуля к html и js файлу одновременно Pavel_Hi Node.JS 11 07.08.2019 12:17
передача значений перемнных из js в html Vladtru Общие вопросы Javascript 1 15.10.2018 09:01
Передать переменную из файла js в файл js. Timofey_Menetil Общие вопросы Javascript 4 05.08.2018 05:15
как из js передать параметр в html wins Общие вопросы Javascript 6 22.12.2013 15:56
Html метки + div + JS boltayka Events/DOM/Window 1 07.09.2009 17:21