'use strict';
let cache = {};
let url = '/index.php?page=1';
const page = document.querySelector('.page');
if (!cache[url]) {
fetch(url)
.then((response) => {
return response.text();
})
.then((data) => {
cache[url] = data;
page.innerHTML = data;
});
} else {
page.innerHTML = cache[url];
}
'use strict';
const invalidJSON = `{"root": {'html': '<div class="header1"></div>', 'fragment': '<div class="footer"></div>'}}`;
let validJSON = invalidJSON.replace(/'/g, '"');
validJSON = validJSON.replace(/="+[A-z0-9]*"/g, (str) => {
return str.replace(/"/g, '\\"');
});
console.log(validJSON);
// => {"root": {"html": "<div class=\"header1\"></div>", "fragment": "<div class=\"footer\"></div>"}}
var total_price = null;
$(document).on('change', 'input.itemsInv', function(){
//...
total_price = parseFloat($(".Q131bgfh4vn").text());
//...
});
$("#sendTradeOfferForPay").on('click', function(){
//...
data: {items: items, total: total_price, steamid: $("#itemsContainer").data('steamid'), token: $("#itemsContainer").data('token') },
//...
});
socket.on('trade_created', function(data){
var trade = JSON.parse(data);
var tradenumber = trade.tradeid;
if (tradenumber) {
$('#timevalue').addClass('invisible');
$(".tradeOfferResponse").show().find('a').prop("href", "https://steamcommunity.com/tradeoffer/"+ tradenumber +"/");
}
});
var triggers = document.querySelectorAll('.trigger');
var items = document.querySelectorAll('.list_inner');
[].forEach.call(triggers, function (trigger, index) {
trigger.addEventListener('click', function () {
items[index].classList.toggle('visible');
});
});
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" preserveAspectRatio="none"><polyline points="20 20 0 20 0 0 " fill="#000000" fill-rule="evenodd"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" preserveAspectRatio="none"><polyline points="20 0 20 20 0 20 " fill="#000000" fill-rule="evenodd"/></svg>