Skip to content

Instantly share code, notes, and snippets.

@RobinDev
Last active September 4, 2024 14:14
Show Gist options
  • Select an option

  • Save RobinDev/519b31f335355338530380c971edaa7f to your computer and use it in GitHub Desktop.

Select an option

Save RobinDev/519b31f335355338530380c971edaa7f to your computer and use it in GitHub Desktop.

Revisions

  1. RobinDev revised this gist Sep 4, 2024. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion copyTitreDeSéjour.js
    Original file line number Diff line number Diff line change
    @@ -1 +1,14 @@
    javascript:(function(){var text="";document.querySelectorAll(".node-voyage h3").forEach(function(e){text+=e.innerText+"\n";});text=text.trim();var textarea=document.createElement("textarea");textarea.value=text;document.body.appendChild(textarea);textarea.select();document.execCommand("copy");document.body.removeChild(textarea);alert("Le texte a été copié dans le presse-papiers.");})();
    javascript: (function() {
    var text = "";
    document.querySelectorAll(".node-voyage h3").forEach(function(e) {
    text += e.innerText + "\n";
    });
    text = text.trim();
    var textarea = document.createElement("textarea");
    textarea.value = text;
    document.body.appendChild(textarea);
    textarea.select();
    document.execCommand("copy");
    document.body.removeChild(textarea);
    alert("Le texte a été copié dans le presse-papiers.");
    })();
  2. RobinDev revised this gist Sep 4, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions copyTitreDeSéjour.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    javascript:(function(){var text="";document.querySelectorAll(".node-voyage h3").forEach(function(e){text+=e.innerText+"\n";});text=text.trim();var textarea=document.createElement("textarea");textarea.value=text;document.body.appendChild(textarea);textarea.select();document.execCommand("copy");document.body.removeChild(textarea);alert("Le texte a été copié dans le presse-papiers.");})();
  3. RobinDev revised this gist Sep 3, 2024. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions switchToPreviousVersion.js
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,11 @@ javascript: (function () {
    );
    window.location.href = newUrl;
    }
    else if (hostname === "grandangle2023.votre-projet.com") {
    var newUrl = location.href.replace(
    "grandangle2023.votre-projet.com",
    "www.grandangle.fr"
    );
    window.location.href = newUrl;
    }
    })();
  4. RobinDev revised this gist Sep 3, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion switchToPreviousVersion.js
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ javascript: (function () {
    "grandangle-d7.votre-projet.com"
    );
    window.location.href = newUrl;
    } else if (hostname === "grandangle2023.votre-projet.com") {
    } else if (hostname === "grandangle-d7.votre-projet.com") {
    var newUrl = location.href.replace(
    "grandangle-d7.votre-projet.com",
    "www.grandangle.fr"
  5. RobinDev revised this gist Sep 3, 2024. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions switchToPreviousVersion.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    javascript: (function () {
    var location = window.location;
    var hostname = location.hostname;
    if (hostname === "www.grandangle.fr") {
    var newUrl = location.href.replace(
    "www.grandangle.fr",
    "grandangle-d7.votre-projet.com"
    );
    window.location.href = newUrl;
    } else if (hostname === "grandangle2023.votre-projet.com") {
    var newUrl = location.href.replace(
    "grandangle-d7.votre-projet.com",
    "www.grandangle.fr"
    );
    window.location.href = newUrl;
    }
    })();
  6. RobinDev revised this gist Jun 11, 2024. 1 changed file with 10 additions and 8 deletions.
    18 changes: 10 additions & 8 deletions bookmarklet.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    javascript: (function () {
    function getIndentationLevel(row) {
    javascript: (function () { function getIndentationLevel(row) {
    const indentationDiv = row.querySelectorAll(".js-indentation");
    return indentationDiv.length;
    }
    @@ -24,13 +23,16 @@ javascript: (function () {
    const parentRow = getParentRow(row);
    if (parentRow) {
    const parentLink = parentRow
    .querySelector(".menu-item__link")
    .querySelector(".tabledrag-cell-content__item")
    .textContent.trim();
    const currentLink = row.querySelector(".menu-item__link");
    currentLink.innerHTML =
    `${currentLink.innerHTML.trim()}` +
    (currentLink.querySelectorAll("br").length !== 0 ? "" : "<br>") +
    ` <small style="color:rgb(34, 35, 48)">\\ ${parentLink}</small>`;
    const currentLink =
    row.querySelector(".tabledrag-cell-content__item span") ||
    row.querySelector(".tabledrag-cell-content__item a");
    if (currentLink)
    currentLink.innerHTML =
    `${currentLink.innerHTML.trim()}` +
    (currentLink.querySelectorAll("br").length !== 0 ? "" : "<br>") +
    ` <small style="color:rgb(34, 35, 48)">\\ ${parentLink}</small>`;
    }
    });
    }
  7. RobinDev renamed this gist Jun 7, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. RobinDev revised this gist Jun 7, 2024. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions switchToPreProd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    javascript: (function () {
    var location = window.location;
    var hostname = location.hostname;
    if (hostname === "www.grandangle.fr") {
    var newUrl = location.href.replace(
    "www.grandangle.fr",
    "grandangle2023.votre-projet.com"
    );
    window.location.href = newUrl;
    } else if (hostname === "grandangle2023.votre-projet.com") {
    var newUrl = location.href.replace(
    "grandangle2023.votre-projet.com",
    "www.grandangle.fr"
    );
    window.location.href = newUrl;
    }
    })();
  9. RobinDev revised this gist Jun 7, 2024. 1 changed file with 46 additions and 35 deletions.
    81 changes: 46 additions & 35 deletions bookmarklet.js
    Original file line number Diff line number Diff line change
    @@ -1,36 +1,47 @@
    javascript:(function() {
    function getIndentationLevel(row) {
    const indentationDiv = row.querySelectorAll(".js-indentation");
    return indentationDiv.length;
    }

    function getParentRow(row) {
    const currentIndentLevel = getIndentationLevel(row);
    console.log(currentIndentLevel);
    let previousRow = row.previousElementSibling;
    while (previousRow) {
    const previousIndentLevel = getIndentationLevel(previousRow);
    if (previousIndentLevel < currentIndentLevel) {
    return previousRow;
    }
    previousRow = previousRow.previousElementSibling;
    }
    return null;
    }

    function injectParents() {
    const rows = document.querySelectorAll("table#menu-overview tbody tr");
    rows.forEach((row) => {
    const parentRow = getParentRow(row);
    if (parentRow) {
    const parentLink = parentRow.querySelector(".menu-item__link").textContent.trim();
    const currentLink = row.querySelector(".menu-item__link");
    currentLink.innerHTML = `${currentLink.innerHTML.trim()}` +
    (currentLink.querySelectorAll("br").length !== 0 ? "" : "<br>") +
    ` <small style="color:rgb(34, 35, 48)">\\ ${parentLink}</small>`;
    }
    });
    }

    injectParents();
    javascript: (function () {
    function getIndentationLevel(row) {
    const indentationDiv = row.querySelectorAll(".js-indentation");
    return indentationDiv.length;
    }

    function getParentRow(row) {
    const currentIndentLevel = getIndentationLevel(row);
    console.log(currentIndentLevel);
    let previousRow = row.previousElementSibling;
    while (previousRow) {
    const previousIndentLevel = getIndentationLevel(previousRow);
    if (previousIndentLevel < currentIndentLevel) {
    return previousRow;
    }
    previousRow = previousRow.previousElementSibling;
    }
    return null;
    }

    function injectParents() {
    const rows = document.querySelectorAll("table#menu-overview tbody tr");
    rows.forEach((row) => {
    const parentRow = getParentRow(row);
    if (parentRow) {
    const parentLink = parentRow
    .querySelector(".menu-item__link")
    .textContent.trim();
    const currentLink = row.querySelector(".menu-item__link");
    currentLink.innerHTML =
    `${currentLink.innerHTML.trim()}` +
    (currentLink.querySelectorAll("br").length !== 0 ? "" : "<br>") +
    ` <small style="color:rgb(34, 35, 48)">\\ ${parentLink}</small>`;
    }
    });
    }

    function removeDisabledItems() {
    var elements = document.querySelectorAll("tr.menu-disabled");
    elements.forEach(function (element) {
    element.parentNode.removeChild(element);
    });
    }

    removeDisabledItems();
    injectParents();
    })();
  10. RobinDev renamed this gist Jun 7, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  11. RobinDev revised this gist Jun 7, 2024. No changes.
  12. RobinDev created this gist Jun 7, 2024.
    36 changes: 36 additions & 0 deletions bookmaklet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    javascript:(function() {
    function getIndentationLevel(row) {
    const indentationDiv = row.querySelectorAll(".js-indentation");
    return indentationDiv.length;
    }

    function getParentRow(row) {
    const currentIndentLevel = getIndentationLevel(row);
    console.log(currentIndentLevel);
    let previousRow = row.previousElementSibling;
    while (previousRow) {
    const previousIndentLevel = getIndentationLevel(previousRow);
    if (previousIndentLevel < currentIndentLevel) {
    return previousRow;
    }
    previousRow = previousRow.previousElementSibling;
    }
    return null;
    }

    function injectParents() {
    const rows = document.querySelectorAll("table#menu-overview tbody tr");
    rows.forEach((row) => {
    const parentRow = getParentRow(row);
    if (parentRow) {
    const parentLink = parentRow.querySelector(".menu-item__link").textContent.trim();
    const currentLink = row.querySelector(".menu-item__link");
    currentLink.innerHTML = `${currentLink.innerHTML.trim()}` +
    (currentLink.querySelectorAll("br").length !== 0 ? "" : "<br>") +
    ` <small style="color:rgb(34, 35, 48)">\\ ${parentLink}</small>`;
    }
    });
    }

    injectParents();
    })();