HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<p class="sombre">theme sombre détécté et appliqué</p>
<p class="clair">theme clair détécté et appliqué</p>
<p> Cliquez n'importe ou ! Dans le menu, vous pourrez utiliser les fleches du clavier !</p>
<p id="action"></p>
<div class="context_menu" data-navtype="mouse">
<!--CONTEXT MENU ITEM-->
<div class="menu item" id="deplacer">
<div class="item-content have-sous-menu">
<div class="icon"></div>
<a href="#">Déplacer vers l'onglet</a>
<span class="span-more">►</span>
</div>
<!--CONTEXT SOUS MENU ITEM-->
<div class="sous-menu context_menu">
<div class="item">
<div class="item-content">
<div class="icon"></div>
<a href="#">Sous item 1</a>
</div>
</div>
<div class="item">
<div class="item-content">
<div class="icon"></div>
<a href="#">Sous item 2</a>
</div>
</div>
</div>
<!--/ CONTEXT SOUS MENU ITEM-->
</div>
<!--/ CONTEXT MENU ITEM-->
<div class="item_hr"></div>
<div class="menu item" id="repondre">
<div class="item-content">
<div class="icon"></div>
<a href="#">Répondre</a>
</div>
</div>
<div class="menu item" id="repondreatous">
<div class="item-content">
<div class="icon"></div>
<a href="#">Répondre à tous</a>
</div>
</div>
<div class="menu item" id="transferer">
<div class="item-content">
<div class="icon"></div>
<a href="#">Transférer</a>
</div>
</div>
<div class="menu item" id="transfererpj">
<div class="item-content">
<div class="icon"></div>
<a href="#">Transférer en tant que pièce jointe</a>
</div>
</div>
<div class="item_hr"></div>
<div class="menu item" id="archiver">
<div class="item-content">
<div class="icon"></div>
<a href="#">Archiver</a>
</div>
</div>
<div class="menu lock item" id="placerbr">
<div class="item-content">
<div class="icon"></div>
<a href="#">Placer dans la boîte de réception</a>
</div>
</div>
<div class="menu lock item" id="nonspam">
<div class="item-content">
<div class="icon"></div>
<a href="#">Non-spam</a>
</div>
</div>
<div class="menu item" id="supprimer">
<div class="item-content">
<div class="icon"></div>
<a href="#">Supprimer</a>
</div>
</div>
<div class="menu lock item" id="supprimerdef">
<div class="item-content">
<div class="icon"></div>
<a href="#">Supprimer définitivement</a>
</div>
</div>
<div class="menu lock item" id="supprimerbrouillon">
<div class="item-content">
<div class="icon"></div>
<a href="#">Supprimer les brouillons</a>
</div>
</div>
<div class="menu item" id="marquercommelu">
<div class="item-content">
<div class="icon"></div>
<a href="#">Marquer comme lu</a>
</div>
</div>
<div class="menu lock item" id="marquercommenonlu">
<div class="item-content">
<div class="icon"></div>
<a href="#">Marquer comme non lu</a>
</div>
</div>
<div class="menu lock item" id="mettreenattente">
<div class="item-content">
<div class="icon"></div>
<a href="#">Mettre en attente</a>
</div>
</div>
<div class="item_hr"></div>
<div class="menu item" id="deplacervers">
<div class="item-content have-sous-menu">
<div class="icon"></div>
<a href="#">Déplacer vers</a>
<span class="span-more">►</span>
</div>
<div class="sous-menu context_menu">
<div class="item">
<div class="item-content">
<div class="icon"></div>
<a href="#">Sous item 1</a>
<div class="sous-menu"></div>
</div>
</div>
<div class="item">
<div class="item-content">
<div class="icon"></div>
<a href="#">Sous item 2</a>
<div class="sous-menu"></div>
</div>
</div>
</div>
</div>
<div class="menu item" id="ajouterlelibelle">
<div class="item-content have-sous-menu">
<div class="icon"></div>
<a href="#">Ajouter le libellé</a>
<span class="span-more">►</span>
</div>
<div class="sous-menu context_menu">
<div class="item">
<div class="item-content">
<div class="icon"></div>
<a href="#">Sous item 1</a>
</div>
</div>
<div class="item">
<div class="item-content">
<div class="icon"></div>
<a href="#">Sous item 2</a>
</div>
</div>
</div>
</div>
<div class="menu item" id="ignoreconversation">
<div class="item-content">
<div class="icon"></div>
<a href="#">Ignorer la conversation</a>
</div>
</div>
<div class="menu lock item" id="reactiverconv">
<div class="item-content">
<div class="icon"></div>
<a href="#">Réactiver la conversation</a>
</div>
</div>
<div class="item_hr"></div>
<div class="menu item" id="recherche">
<div class="item-content">
<div class="icon"></div>
<a href="#">Rech. e-mails de xxxxx xxxx</a>
</div>
</div>
<div class="menu item" id="rechercheobjet">
<div class="item-content">
<div class="icon"></div>
<a href="#">Rech. e-mails ayant cet objet</a>
</div>
</div>
<div class="item_hr"></div>
<div class="menu item" id="ouvrirnouvellefenetre">
<div class="item-content">
<div class="icon"></div>
<a href="#">Ouvrir dans une nouvelle fenêtre</a>
</div>
</div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Roboto");
p {
color: white;
font: 14px Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
}
/*body{
height: 350vh;
width:120vw;
}
*/
.context_menu {
transform: scale(0.8);
display: none;
bottom: 0px;
box-shadow: rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
rgba(0, 0, 0, 0.12) 0px 3px 14px 2px, rgba(0, 0, 0, 0.2) 0px 5px 5px -3px;
caret-color: rgb(32, 33, 36);
color: rgb(32, 33, 36);
column-rule-color: rgb(32, 33, 36);
cursor: default;
height: min-content;
left: 10px;
letter-spacing: 0.2px;
position: absolute;
right: 10px;
text-decoration: none solid rgb(32, 33, 36);
text-emphasis-color: rgb(32, 33, 36);
top: 10px;
transform-origin: 0px 0px;
user-select: none;
width: min-content;
z-index: 7;
background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box
border-box;
border-radius: 4px 4px 4px 4px;
font: 14px / 20px Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
outline: rgb(32, 33, 36) none 0px;
overflow: visible;
padding: 6px 0px;
}
.context_menu .context_menu {
transform: scale(1);
position: absolute;
left: 100%;
top: -6px;
box-shadow: rgb(0 0 0 / 8%) 5px 2px 20px 0, rgb(0 0 0 / 10%) 0px 5px 11px;
}
.item {
padding: 6px 48px;
position: relative;
transition: background-color ease 125ms;
}
/* [data-navtype="keyboard"] [data-navtype="mouse"] */
.context_menu[data-navtype="mouse"] .item:hover,
.item:focus-within,
.context_menu[data-navtype="keyboard"] .item.selected {
background-color: #eee;
}
.item .sous-menu {
display: none;
width: 100%;
}
.context_menu[data-navtype="mouse"] .item:hover .sous-menu,
.item:focus-within .sous-menu,
.context_menu[data-navtype="keyboard"] .item.selected .sous-menu {
display: block;
}
.item-content {
align-items: center;
caret-color: rgb(32, 33, 36);
color: rgb(32, 33, 36);
column-rule-color: rgb(32, 33, 36);
cursor: pointer;
display: flex;
height: 20px;
justify-content: space-between;
left: 0px;
letter-spacing: 0.2px;
position: relative;
right: 0px;
text-decoration: none solid rgb(32, 33, 36);
text-emphasis-color: rgb(32, 33, 36);
top: 0px;
transform-origin: 115px 10px;
user-select: none;
white-space: nowrap;
border: 0px none rgb(32, 33, 36);
font: 14px / 20px Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
}
.icon {
background-position: 50% 50%;
bottom: 0px;
caret-color: rgb(32, 33, 36);
color: rgb(32, 33, 36);
column-rule-color: rgb(32, 33, 36);
cursor: pointer;
height: 20px;
left: -32px;
letter-spacing: 0.2px;
opacity: 0.55;
perspective-origin: 10px 10px;
position: absolute;
right: 232px;
text-decoration: none solid rgb(32, 33, 36);
text-emphasis-color: rgb(32, 33, 36);
top: 0px;
transform-origin: 10px 10px;
user-select: none;
vertical-align: middle;
white-space: nowrap;
width: 20px;
background-color: rgba(0, 0, 0, 0);
background-repeat: no-repeat;
background-attachment: scroll;
background-size: 50% 50% / 20px;
background-clip: padding-box border-box;
font: 14px / 20px Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
list-style: outside none none;
margin: 0px 12px 0px 0px;
}
.span-more {
background-position: 50% 50%;
block-size: 20px;
caret-color: rgba(0, 0, 0, 0);
color: rgba(0, 0, 0, 0);
column-rule-color: rgba(0, 0, 0, 0);
cursor: pointer;
display: block;
height: 20px;
letter-spacing: 0.2px;
min-height: auto;
min-width: auto;
opacity: 0.5;
perspective-origin: 10px 10px;
right: 10px;
text-align: right;
transform-origin: 10px 10px;
user-select: none;
white-space: nowrap;
width: 20px;
background: rgba(0, 0, 0, 0)
url("https://www.gstatic.com/images/icons/material/system/1x/arrow_right_black_20dp.png")
no-repeat scroll 50% 50% / 20px padding-box border-box;
font: 0px / 20px Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
list-style: outside none none;
margin: 0px -24px 0px 0px;
transition: all 125ms ease 0s;
}
.lock .item-content {
caret-color: rgb(204, 204, 204);
color: rgb(204, 204, 204);
column-rule-color: rgb(204, 204, 204);
}
.lock .icon {
opacity: 0.15;
}
.item_hr {
border-top: 1px solid rgb(235, 235, 235);
margin-top: 5px;
margin-bottom: 5px;
}
.context_menu.isleft .context_menu {
left: -100%;
}
.context_menu a {
text-decoration: none;
color: inherit;
pointer-events: none;
}
.context_menu .lock a {
cursor: default;
}
/****************** THEME SOMBRE ******************/
p.sombre {
display: none;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #1c1c1c;
}
p.sombre {
display: block;
color: white;
}
p.clair {
display: none;
}
.context_menu {
filter: invert(0.95);
}
.sous-menu {
filter: invert(0);
}
.context_menu,
.context_menu .context_menu {
box-shadow: none;
}
}
/****************** ICONES ******************/
#deplacer .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/drive_file_move_black_20dp.png");
}
#repondre .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/reply_black_20dp.png");
}
#repondreatous .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/reply_all_black_20dp.png");
}
#transferer .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/forward_black_20dp.png");
}
#transfererpj .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/attachment_black_20dp.png");
}
#archiver .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/archive_black_20dp.png");
}
#placerbr .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/move_to_inbox_black_20dp.png");
}
#nonspam .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/report_off_black_20dp.png");
}
#supprimer .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/delete_black_20dp.png");
}
#supprimerdef .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/delete_black_20dp.png");
}
#supprimerbrouillon .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/delete_black_20dp.png");
}
#marquercommelu .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/drafts_black_20dp.png");
}
#marquercommenonlu .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/mark_as_unread_black_20dp.png");
}
#mettreenattente .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/watch_later_black_20dp.png");
}
#deplacervers .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/drive_file_move_black_20dp.png");
}
#ajouterlelibelle .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/label_black_20dp.png");
}
#ignoreconversation .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/volume_off_black_20dp.png");
}
#reactiverconv .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/volume_up_black_20dp.png");
}
#recherche .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/search_black_20dp.png");
}
#rechercheobjet .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/search_black_20dp.png");
}
#ouvrirnouvellefenetre .icon {
background-image: url("https://www.gstatic.com/images/icons/material/system/1x/open_in_new_black_20dp.png");
}
function update_lock_state(id, lock) {
if (id == "*") {
all_item_element.forEach(function (item, index) {
var parent_item = item.parentElement.parentElement;
if (lock) {
parent_item.classList.add("lock");
} else {
parent_item.classList.remove("lock");
}
});
} else {
let element = document.getElementById(id);
if (lock) {
element.classList.add("lock");
} else {
element.classList.remove("lock");
}
}
}
//Ajout des évents Listener
window.addEventListener("click", hide_context_menu);
window.addEventListener("visibilitychange", hide_context_menu);
window.addEventListener("blur", hide_context_menu);
window.addEventListener("scroll", hide_context_menu);
window.addEventListener("keydown", keydown);
window.addEventListener("contextmenu", show_context_menu);
// init variables globales
var tab_index = -1;
var all_item_element = document.querySelectorAll(
".context_menu .item .item-content:not(.have-sous-menu) a"
);
//init fonction
//si la souris bouge sur l'un des item du context menu, alors on passe en mode souris et on enregistre sa position
document.querySelectorAll(".context_menu .item").forEach((element) =>
element.addEventListener("mousemove", function (event) {
get_context_menu_element().setAttribute("data-navtype", "mouse");
var temp_tab_index = parseInt(
event.target.closest(".item").getAttribute("data-selectable-id")
);
if (Number.isInteger(temp_tab_index) == true) {
tab_index = temp_tab_index;
} else {
//have-sous-menu
if (event.target.classList.contains("have-sous-menu")) {
temp_tab_index = parseInt(
event.target.parentElement
.querySelector(".item[data-selectable-id]")
.getAttribute("data-selectable-id")
);
if (Number.isInteger(temp_tab_index) == true) {
tab_index = temp_tab_index;
}
}
}
unselect_all();
event.target.classList.add("selected");
})
);
//on enregistre l'event de click sur chaque items et on leur ajoute un index
all_item_element.forEach(function (item, index) {
var parent_item = item.parentElement.parentElement;
parent_item.addEventListener("click", function (event) {
event.preventDefault();
item_context_menu_clicked(event.target);
});
parent_item.setAttribute("data-selectable-id", index);
});
function get_context_menu_element() {
var context_menu = document.querySelector(".context_menu");
return context_menu;
}
function context_menu_arrow_navigation(direction) {
//fonction navigation au clavier
do {
// tant que l'item selectionné est lock alors on recommence
if (
get_context_menu_element().querySelectorAll(
".context_menu :not(.sous-menu) .item:not(.lock) .item-content:not(.have-sous-menu) a"
).length > 0
) {
context_menu_arrow_navigation_main(direction);
} else {
return;
}
} while (
all_item_element[tab_index].parentElement.parentElement.classList.contains(
"lock"
)
);
//main fonction
function context_menu_arrow_navigation_main(direction) {
//on defini le mode de navigation (pour gerer apres avec le CSS)
if (get_context_menu_element().getAttribute("data-navtype") != "keyboard") {
get_context_menu_element().setAttribute("data-navtype", "keyboard");
if (tab_index != -1) {
let curent_item_tab_index = get_context_menu_element().querySelector(
'.item[data-selectable-id="' + tab_index + '"]'
);
if (
curent_item_tab_index.parentElement.classList.contains("sous-menu") ==
false
) {
curent_item_tab_index.classList.add("selected");
}
}
}
if (Number.isInteger(tab_index) != true) {
//si tab_index n'est pas un integer, alors on le redefini à sa valeur de base
tab_index = -1;
}
if (tab_index != -1) {
//si tab index n'as pas sa valeur par défaut alors :
if (direction == "down") {
if (
all_item_element[tab_index]
.closest(".item")
.classList.contains("selected")
) {
//si la direction est vers le bas alors on incrémente tab index
tab_index = tab_index + 1;
//si tab index depasse le nombre d'item alors on reboucle à 0
if (tab_index > all_item_element.length - 1) {
tab_index = 0;
}
}
} else if (direction == "up") {
if (
all_item_element[tab_index]
.closest(".item")
.classList.contains("selected")
) {
//si la direction est vers le haut alors on décrémente tab index
tab_index = tab_index - 1;
//si tab index depasse 0 alors on reboucle à à la fin
if (tab_index < 0) {
tab_index = all_item_element.length - 1;
}
}
}
} else {
//on defini tab index si il n'avait pas encore de valeur
tab_index = 0;
}
unselect_all();
var item_selected = all_item_element[tab_index].closest(".item");
item_selected.classList.add("selected");
if (item_selected.parentElement.classList.contains("sous-menu")) {
item_selected.parentElement.parentElement.classList.add("selected");
}
all_item_element[tab_index].focus();
}
}
function unselect_all() {
//on retire à tout les items le tag séléctionné
document.querySelectorAll(".selected").forEach(function (selected_items) {
selected_items.classList.remove("selected");
});
}
function keydown(e) {
//event en cas d'appuis de touches
//on check si le context menu est affiché
if (get_context_menu_element().style.display == "block") {
//si echap alors on masque
if (e.type == "keydown" && e.key === "Escape") {
hide_context_menu(e);
}
//si fleche vers le bas alors on change l'item selectionné
if (e.which === 40) {
context_menu_arrow_navigation("down");
}
//si fleche vers le haut alors on change l'item selectionné
if (e.which === 38) {
context_menu_arrow_navigation("up");
}
//si tabulation alors on masque le context menu
if (e.which === 9) {
// Tabulation
e.preventDefault();
hide_context_menu(e);
}
//si enter, on valide la selection
if (e.which === 13) {
//Enter
if (tab_index != -1) {
e.preventDefault();
item_context_menu_clicked(all_item_element[tab_index]);
}
}
}
}
var x;
function hide_context_menu(e) {
x = e;
if (e !== null && e.type == "click") {
//en cas de click droit et que ce n'est pas sur le menu lui-meme alors on le masque
if (get_context_menu_element().contains(e.target)) {
return false;
}
}
//toute les exceptions on été traité, si la fonction est toujours ok alors on masque
get_context_menu_element().style.display = "none";
}
var event;
function show_context_menu(e) {
//on signale que l'event est traité par nous
e.preventDefault();
if (e.type == "contextmenu") {
//en cas de click droit et que ce n'est pas sur le menu lui-meme alors on le masque
if (get_context_menu_element().contains(e.target)) {
return false;
}
}
tab_index = -1;
unselect_all();
// on affiche le menu à ce niveau la pour pouvoir calculer ses dimensions
var context_menu = get_context_menu_element();
context_menu.style.display = "block";
//recupération des éléments pour calculer la position du context menu
var page_left_padding = 0;
var page_bottom_padding = 0;
function getScrollbarWidth() {
// Creating invisible container
const outer = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.overflow = "scroll";
document.body.appendChild(outer);
const inner = document.createElement("div");
outer.appendChild(inner);
page_left_padding = outer.offsetWidth - inner.offsetWidth;
page_bottom_padding = outer.offsetHeight - inner.offsetHeight;
outer.parentNode.removeChild(outer);
}
var page_width = window.innerWidth + window.pageXOffset - page_left_padding;
var page_height =
window.innerHeight + window.pageYOffset - page_bottom_padding;
var menu_width = context_menu.getBoundingClientRect().width;
var menu_height = context_menu.getBoundingClientRect().height;
var click_position_left = e.pageX;
var click_position_top = e.pageY;
var menu_distance_right_border =
page_width - (click_position_left + menu_width);
var menu_distance_bottom_border =
page_height - (click_position_top + menu_height);
var final_menu_x = click_position_left;
var final_menu_y = click_position_top;
//si le context menu n'as pas la place de s'ouvrir, alors on décale sa position finale d'autant
if (menu_distance_right_border < 0) {
final_menu_x = final_menu_x + menu_distance_right_border;
}
if (menu_distance_bottom_border < 0) {
final_menu_y = final_menu_y + menu_distance_bottom_border;
}
//on applique les coordonnées finales au style
context_menu.style.left = final_menu_x + "px";
context_menu.style.top = final_menu_y + "px";
//on regarde si il y a la place pour ouvrir les sous-menu également
var sous_menu_distance_right_border =
page_width - (final_menu_x + menu_width * 2);
if (sous_menu_distance_right_border < 0) {
context_menu.classList.add("isleft");
context_menu.classList.remove("isright");
} else {
context_menu.classList.add("isright");
context_menu.classList.remove("isleft");
}
}
function item_context_menu_clicked(item) {
//si item lock, alors on ne le considère pas
if (!item.closest(".item").classList.contains("lock")) {
//on lance l'action
let txt =
"Vous avez cliqué sur : " +
item.closest(".item").querySelector("a").innerText;
console.log(txt);
document.getElementById("action").innerText = txt;
hide_context_menu(null);
}
}
//update_lock_state("*", true);
Also see: Tab Triggers