{
"name": "My extension",
...
"content_scripts": [
{
"matches": ["http://*.nytimes.com/*"],
"css": ["myStyles.css"],
"js": ["contentScript.js"]
}
],
...
}
select
case
when c1 = 0 then ''
else rtrim(to_char (c1, 'FM9999999999999999D99'), '.')
end result
from newtable
$(function(){
$("button").click(function(){
var lastInput = $('input[type="datetime-local"]:last');
var type = lastInput.attr("type");
var min = lastInput.attr("min") == undefined ? "" : lastInput.attr("min");
var name = lastInput.attr("name");
var num = parseInt(name.replace("date",""));
if (num < 20) {
$("#container").append('<input type="'+type+'" min="'+min+'" name="date'+(num+1)+'"/>');
}
if (num >= 19) {
$("button").hide();
}
})
})
SELECT
CONCAT(
'{"',`session`,'":{',
GROUP_CONCAT('"PRODUCT ', @i:=@i+1, '":{"PRODUCT ID":',product_id,',"PRICE":',price,',"QUANTITY":',quantity,'}' separator ','),
'}}') AS value
FROM carts, (SELECT @i:=0) X
WHERE `session` = 222145
GROUP BY `session`
$session_id = 222145;
$sql = 'SELECT
CONCAT(
\'{"\',`session`,\'":{\',
GROUP_CONCAT(\'"PRODUCT \', @i:=@i+1, \'":{"PRODUCT ID":\',product_id,\',"PRICE":\',price,\',"QUANTITY":\',quantity,\'}\' separator \',\'),
\'}}\') AS value
FROM carts, (SELECT @i:=0) X
WHERE `session` = %s
GROUP BY `session`';
$arr = json_decode(mysql_result(mysql_query(sprintf($sql, $session_id)),0), true);
var_dump( $arr );
INSERT INTO tmp_goods (name, article, price)
VALUES ('NAME_1', 'ARTICLE_1', PRICE 1),
.......
('NAME_N', 'ARTICLE_N', PRICE_N)
;
UPDATE goods g
INNER JOIN tmp_goods t ON t.article = g.article
SET g.price = t.price
WHERE g.price != t.price
;
UPDATE goods
SET price = CASE article
WHEN ARTICLE_1 THEN PRICE_1
WHEN ARTICLE_2 THEN PRICE_2
....
ELSE price END
UPDATE goods g
INNER JOIN (
SELECT 'ARTICLE-1' AS article, PRICE_1 AS price UNION
SELECT 'ARTICLE-2', PRICE_2 UNION
SELECT 'ARTICLE-3', PRICE_3 UNION
...
SELECT 'ARTICLE-N', PRICE_N
) t ON t.article = g.article
SET g.price = t.price
WHERE g.price != t.price
;
document.querySelector("button").addEventListener("click", e => {
const items = document.querySelectorAll(".item");
const first = items[0].textContent;
[...items].map((el, i) => {
el.textContent = (i < items.length - 1) ? items[i+1].textContent : first;
});
})
Но когда показывается последний элемент, то смена контента должна прекратиться, аналогично и с первым.
Нужно переносить контент, в идеале с автокоррекцией по заданному шаблону.
SELECT m.*, u.* FROM messages m
INNER JOIN users u ON m.receiver = u.id
INNER JOIN (
SELECT receiver, sender, max(date) as date
FROM messages
GROUP BY receiver, sender
) m2 ON m.receiver = m2.receiver
AND m.sender = m2.sender
AND m.date = m2.date
WHERE u.id = 1
ORDER BY m.date DESC
SELECT m.*, u.* FROM messages m
INNER JOIN users u ON m.sender = u.id
INNER JOIN (
SELECT receiver, sender, max(date) as date
FROM messages
GROUP BY receiver, sender
) m2 ON m.receiver = m2.receiver
AND m.sender = m2.sender
AND m.date = m2.date
WHERE m.receiver = 1
ORDER BY m.date DESC
document.querySelector(".works__more__btn").addEventListener("click", function() {
var elem = document.createElement("div");
elem.setAttribute("class", "works__content__smallRow");
elem.innerHTML = `
<img src="https://www.placehold.it/375x327/25" class="works__content__smallRow__item">
<img src="https://www.placehold.it/375x327/50" class="works__content__smallRow__item">
<img src="https://www.placehold.it/375x327/75" class="works__content__smallRow__item">
<img src="https://www.placehold.it/375x327/100" class="works__content__smallRow__item">
`;
document.querySelector(".works__content").appendChild(elem);
document.querySelector(".works__more").style.display = "none";
});
document.querySelector(".works__more__btn").addEventListener("click", function() {
document.querySelector(".works__content").appendChild(document.querySelector(".works__content").cloneNode(true));
document.querySelector(".works__more").style.display = "none";
});
if ($('#name').val().length >= 3) {
$(this).find('#name').css("border", "1px solid rgb(169, 169, 169)");
} else if ($('#email').val().length > 10 && $('#email').val().search(pattern) == 0) {
$(this).find('#email').css("border", "1px solid rgb(169, 169, 169)");
}
if ($('#name').val().length >= 3) {
$(this).find('#name').css("border", "1px solid rgb(169, 169, 169)");
}
if ($('#email').val().length > 10 && $('#email').val().search(pattern) == 0) {
$(this).find('#email').css("border", "1px solid rgb(169, 169, 169)");
}