Skip to content
Snippets Groups Projects
Commit e5b0442e authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

feat: use different storage keys for shortcuts

parent ebdeaa22
No related branches found
No related tags found
No related merge requests found
......@@ -108,7 +108,9 @@
</div>
</body>
{%- include scripts.html -%}
<script>
window.is_internal = false;
</script>
<script src="{{ "assets/js/landing.js" | relative_url }}"></script>
</html>
window.cards_limit = 6;
var storage_key = "pinnedCards";
if (window.is_internal) {
storage_key += "Internal"
} else {
storage_key += "External"
}
let $left_inner_container = document.getElementById("left-inner-container");
let $right_inner_container = document.getElementById("right-inner-container");
let $drop_to_add = document.getElementById("drop-to-add");
// ============= DATA ========================================
let pinned_cards_store = localStorage.getItem("pinnedCards");
let pinned_cards_store = localStorage.getItem(storage_key);
window.pinned_cards = [
];
// ============= DOM functions ========================================
......@@ -128,7 +134,7 @@ window.cardDrop = function(event) {
}
if (!list_contains(window.pinned_cards, card, "title")) {
window.pinned_cards.push(card);
localStorage.setItem("pinnedCards", JSON.stringify(pinned_cards));
localStorage.setItem(storage_key, JSON.stringify(pinned_cards));
window.cards = window.cards.filter(function(el) { return el['title'] != card['title'];});
rebuild_pinned_cards();
rebuild_cards();
......@@ -142,7 +148,7 @@ window.cardDropDiscard = function(event) {
return;
if (list_contains(window.pinned_cards, card, "title")) {
remove_from_list(window.pinned_cards, card, "title");
localStorage.setItem("pinnedCards", JSON.stringify(pinned_cards));
localStorage.setItem(storage_key, JSON.stringify(pinned_cards));
cards.push(card);
rebuild_pinned_cards();
rebuild_cards();
......@@ -181,7 +187,7 @@ window.clear_pinned = function() {
cards.push(card);
}
pinned_cards = [];
localStorage.setItem("pinnedCards", JSON.stringify(pinned_cards));
localStorage.setItem(storage_key, JSON.stringify(pinned_cards));
rebuild_pinned_cards();
rebuild_cards();
refresh_drop_to_add_button();
......@@ -189,7 +195,7 @@ window.clear_pinned = function() {
window.start_cards = function() {
// ============= Initialization ========================================
if (pinned_cards_store == null) {
localStorage.setItem("pinnedCards", JSON.stringify(pinned_cards));
localStorage.setItem(storage_key, JSON.stringify(pinned_cards));
} else {
pinned_cards = JSON.parse(pinned_cards_store);
// Sort alphabetically
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment