Skip to content

Commit

Permalink
Merge pull request #17 from J4mez/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
J4mez authored Jan 23, 2024
2 parents a252405 + a10bd24 commit 3840537
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</head>
<style>
body {
max-width: 400px;
max-width: 350px;
min-width: 300px;
}
</style>
Expand All @@ -28,7 +28,7 @@
</div>
<div class="text-center mb-5">
<h1 class="mb-4">Share this URL!</h1>
<div id="currentUrl" class="text-center text-wrap">URL not found</div>
<div id="currentUrl" class="text-center text-wrap text-break fs-6">URL not found</div>
<button id="shareButton" class="btn btn-primary mt-3">
Share URL
</button>
Expand Down
4 changes: 2 additions & 2 deletions src/popup/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ <h1 class="text-center mb-3">Options</h1>
<label for="tags">Tags (comma separated):</label>
<input type="text" id="tags" name="tags" class="form-control" />
</div>
<div class="form-group mt-3">
<!-- <div class="form-group mt-3">
<label for="title">Title:</label>
<input
type="text"
id="title"
name="title"
class="form-control"
/>
</div>
</div> -->
<div class="form-group mt-3">
<label for="domain">Domain:</label>
<input
Expand Down
10 changes: 5 additions & 5 deletions src/popup/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ if (localStorage.getItem("apiKey")) {
document.getElementById("apiKeyInput").value = apiKey;
}

if (localStorage.getItem("userTitle")) {
/* if (localStorage.getItem("userTitle")) {
userTitle = localStorage.getItem("userTitle");
document.getElementById("title").value = userTitle;
}
} */

if (localStorage.getItem("userTags")) {
userTags = JSON.parse(localStorage.getItem("userTags"));
Expand All @@ -37,20 +37,20 @@ form.addEventListener("submit", function (event) {

// Get the values from the form
userSlug = document.getElementById("customSlug").value;
userTitle = document.getElementById("title").value;
//userTitle = document.getElementById("title").value;
userTags = document.getElementById("tags").value.split(/[\s,]+/); // This regular expression splits the string by comma and/or space
apiKey = document.getElementById("apiKeyInput").value;
domain = document.getElementById("domain").value;

// Store the values in localStorage
localStorage.setItem("userSlug", userSlug);
localStorage.setItem("userTitle", userTitle);
//localStorage.setItem("userTitle", userTitle);
localStorage.setItem("userTags", JSON.stringify(userTags));
localStorage.setItem("apiKey", apiKey);
localStorage.setItem("domain", domain);

// Log the values (for testing purposes)
console.log(userSlug, userTitle, userTags, apiKey, domain);
console.log(userSlug, userTags, apiKey, domain);

showSuccess("Settings saved successfully!");
});
12 changes: 6 additions & 6 deletions src/popup/share.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
</head>
<style>
body {
overflow-x: auto;
max-width: 400px;

max-width: 350px;
min-width: 300px;
}
</style>
<body>
<div class="container mt-5">
<div class="container mt-5 text-center">
<h1 class="text-center">Share this URL!</h1>
<div class="text-center text-wrap mb-5">
<div id="currentUrl" class="text-center text-wrap">
<div class="text-center mb-5">
<div id="currentUrl" class="text-center text-wrap text-break mb-3 fs-6">
URL not found
</div>
<div id="shortUrlPreview" class="text-center text-wrap">
<div id="shortUrlPreview" class="text-center text-wrap text-break fs-6">
URL Preview:
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/popup/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function generateShortURL(options) {
tags: options.userTags,
customSlug: options.customSlug,
forwardQuery: options.forwardQuery,
title: options.userTitle,
//title: options.userTitle,
domain: options.domain,
});

Expand Down Expand Up @@ -108,7 +108,7 @@ inputSlugField.addEventListener("input", handleInput);
function defineOptions() {
// Load the values from localStorage if they exist
var userSlug = localStorage.getItem("userSlug");
var userTitle = localStorage.getItem("userTitle");
//var userTitle = localStorage.getItem("userTitle");
var domain = localStorage.getItem("domain");
var userTags = localStorage.getItem("userTags")
? JSON.parse(localStorage.getItem("userTags"))
Expand All @@ -117,8 +117,8 @@ function defineOptions() {
// Check if the values are undefined or empty, if so, set them to null
userSlug =
typeof userSlug !== "undefined" && userSlug !== "" ? userSlug : null;
userTitle =
typeof userTitle !== "undefined" && userTitle !== "" ? userTitle : null;
/* userTitle =
typeof userTitle !== "undefined" && userTitle !== "" ? userTitle : null; */

// Check if the tags are undefined or empty, if so, set them to null
if (typeof userTags === "undefined" || userTags == null || userTags == "") {
Expand All @@ -138,7 +138,7 @@ function defineOptions() {
apiEndpoint: localStorage.getItem("apiEndpoint") || "short.morge.news", //late the API Endpoint will be configurable, atm it defaults to short.morge.news
userTags: userTags, // Use the value from localStorage
customSlug: userSlug, // Use the value from localStorage
userTitle: userTitle, // Use the value from localStorage
//userTitle: userTitle, // Use the value from localStorage
domain: domain, // Use the value from localStorage
forwardQuery: true,
};
Expand Down

0 comments on commit 3840537

Please sign in to comment.