Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dic-global-dev
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Manzar Hussain
dic-global-dev
Commits
5c4d3001
Commit
5c4d3001
authored
Jan 29, 2021
by
Manzar Hussain
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-theme' into 'develop'
add javascript See merge request manzarH/dic-global-dev!609
parents
042e28ab
158ba920
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
2 deletions
+107
-2
html.html.twig
themes/custom/envigo/templates/layout/html.html.twig
+107
-2
No files found.
themes/custom/envigo/templates/layout/html.html.twig
View file @
5c4d3001
...
...
@@ -95,7 +95,7 @@
</li>
<li>
<div
class=
"h_mod_button"
>
<a
href=
"https://www.sunchemical.com/"
"
target=
"_blank"
><span>
Sun Chemical
</span><i
class=
"fa fa-angle-right"
aria-hidden=
"true"
></i></a>
<a
href=
"https://www.sunchemical.com/"
target=
"_blank"
><span>
Sun Chemical
</span><i
class=
"fa fa-angle-right"
aria-hidden=
"true"
></i></a>
</div>
</li>
</ul>
...
...
@@ -109,6 +109,111 @@
{{
page
}}
{{
page_bottom
}}
<js-bottom-placeholder
token=
"
{{
placeholder_token
}}
"
>
<script
type=
"text/javascript"
>
(
function
(
$
)
{
const
settings
=
{
"async"
:
true
,
"crossDomain"
:
true
,
"url"
:
"https://apidojo-yahoo-finance-v1.p.rapidapi.com/stock/v2/get-financials?symbol=DICIND.BO®ion=IN"
,
"method"
:
"GET"
,
"headers"
:
{
"x-rapidapi-key"
:
"71595d71fdmsh59db2218deaaf67p15e9e8jsnca220a779910"
,
"x-rapidapi-host"
:
"apidojo-yahoo-finance-v1.p.rapidapi.com"
}
};
$
.
ajax
(
settings
).
done
(
function
(
response
)
{
$
(
'#bse'
).
text
(
"BSE:"
+
response
.
price
.
regularMarketPrice
.
fmt
);
var
regularMarketChange
=
response
.
price
.
regularMarketChange
.
fmt
;
var
regularMarketChangePercent
=
response
.
price
.
regularMarketChangePercent
.
fmt
;
let
unix_timestamp
=
response
.
price
.
regularMarketTime
;
// Create a new JavaScript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds.
var
date
=
new
Date
(
unix_timestamp
*
1000
);
// Hours part from the timestamp
var
hours
=
date
.
getHours
();
// Minutes part from the timestamp
var
minutes
=
"0"
+
date
.
getMinutes
();
// Seconds part from the timestamp
var
seconds
=
"0"
+
date
.
getSeconds
();
// Will display time in 10:30:23 format
var
formattedTime
=
hours
+
':'
+
minutes
.
substr
(
-
2
)
+
':'
+
seconds
.
substr
(
-
2
);
$
(
'#bse_time_stock'
).
text
(
formattedTime
+
" IST "
+
regularMarketChange
+
" "
+
regularMarketChangePercent
)
if
(
regularMarketChangePercent
.
substring
(
0
,
1
)
==
'-'
)
{
$
(
'#bse'
).
parent
(
'li'
).
addClass
(
'down'
);
}
else
{
$
(
'#bse'
).
parent
(
'li'
).
removeClass
(
'down'
);
}
});
const
settings1
=
{
"async"
:
true
,
"crossDomain"
:
true
,
"url"
:
"https://apidojo-yahoo-finance-v1.p.rapidapi.com/stock/v2/get-financials?symbol=DICIND.NS®ion=IN"
,
"method"
:
"GET"
,
"headers"
:
{
"x-rapidapi-key"
:
"71595d71fdmsh59db2218deaaf67p15e9e8jsnca220a779910"
,
"x-rapidapi-host"
:
"apidojo-yahoo-finance-v1.p.rapidapi.com"
}
};
$
.
ajax
(
settings1
).
done
(
function
(
response
)
{
$
(
'#nse'
).
text
(
"NSE:"
+
response
.
price
.
regularMarketPrice
.
fmt
);
var
regularMarketChange
=
response
.
price
.
regularMarketChange
.
fmt
;
var
regularMarketChangePercent
=
response
.
price
.
regularMarketChangePercent
.
fmt
;
let
unix_timestamp
=
response
.
price
.
regularMarketTime
;
// Create a new JavaScript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds.
var
date
=
new
Date
(
unix_timestamp
*
1000
);
// Hours part from the timestamp
var
hours
=
date
.
getHours
();
// Minutes part from the timestamp
var
minutes
=
"0"
+
date
.
getMinutes
();
// Seconds part from the timestamp
var
seconds
=
"0"
+
date
.
getSeconds
();
// Will display time in 10:30:23 format
var
formattedTime
=
hours
+
':'
+
minutes
.
substr
(
-
2
)
+
':'
+
seconds
.
substr
(
-
2
);
$
(
'#nse_time_stock'
).
text
(
formattedTime
+
" IST "
+
regularMarketChange
+
" "
+
regularMarketChangePercent
)
if
(
regularMarketChangePercent
.
substring
(
0
,
1
)
==
'-'
)
{
$
(
'#nse'
).
parent
(
'li'
).
addClass
(
'down'
);
}
else
{
$
(
'#nse'
).
parent
(
'li'
).
removeClass
(
'down'
);
}
let
unix_date_timestamp
=
unix_timestamp
;
// Create a new JavaScript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds.
var
date1
=
new
Date
(
unix_date_timestamp
*
1000
);
var
date
=
date1
.
getDate
();
var
months
=
[
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
];
var
month
=
date1
.
getMonth
();
var
year
=
date1
.
getFullYear
();
var
full_year
=
date
+
" "
+
months
[
month
]
+
" "
+
year
;
$
(
'#latest_update'
).
text
(
"Latest updated on "
+
full_year
);
$
(
".outer-loader"
).
fadeOut
(
"slow"
);
});
})(
jQuery
);
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment