diff --git a/_layouts/landing.html b/_layouts/landing.html index b474bbd67a86a1d4c68ed55e0e1d2a8b2f199bd5..00d14969a105a36922452464a89776c65b053b82 100644 --- a/_layouts/landing.html +++ b/_layouts/landing.html @@ -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> diff --git a/assets/js/landing.js b/assets/js/landing.js index b4a02ece12a7e96da97b8da098dac8245ef28f3e..9f7b74f5bb1bc5fcd0839b65bf25bcc79c5b59b4 100644 --- a/assets/js/landing.js +++ b/assets/js/landing.js @@ -1,9 +1,15 @@ 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