Last active
July 1, 2022 12:36
-
-
Save brrd/8d1b63a11e6b678b4d2a1bdc71a5e57b to your computer and use it in GitHub Desktop.
Lodel Backoffice Hotkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Lodel Backoffice | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Accès au backoffice Lodel avec CTRL + SHIFT + L | |
// @author brrd | |
// @match https://*.edinum.org/* | |
// @match https://*.openedition.org/* | |
// @icon https://www.edinum.org/img/edinum-logo.png | |
// @grant GM_log | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
function handler(e) { | |
if (e.keyCode == 76 && e.ctrlKey && e.shiftKey) { | |
var location = window.location; | |
var path = location.pathname.split("/").filter(function(part) { | |
return part !== ""; | |
}); | |
var query = location.search; | |
var site = path[0]; | |
var id = path.length > 1 ? path[1] : (/id=([0-9]+)/.exec(query) || [])[1]; | |
var url = location.protocol + "//" + location.host + "/" + site + "/lodel/admin/login.php?url_retour=%2F" + site + (id ? "%2F" + id : ""); | |
window.location = url; | |
} | |
} | |
document.addEventListener("keyup", handler, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment