Commit 158ba920 by Manzar Hussain

add javascript

parent 7d76c8a0
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
</li> </li>
<li> <li>
<div class="h_mod_button"> <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> </div>
</li> </li>
</ul> </ul>
...@@ -109,6 +109,111 @@ ...@@ -109,6 +109,111 @@
{{ page }} {{ page }}
{{ page_bottom }} {{ page_bottom }}
<js-bottom-placeholder token="{{ placeholder_token }}"> <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&region=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&region=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> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment