diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0dc1645 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ + +# Created by https://www.gitignore.io/api/macos + +### macOS ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# End of https://www.gitignore.io/api/macos diff --git a/Icon.sketch b/Icon.sketch new file mode 100644 index 0000000..e99fd00 Binary files /dev/null and b/Icon.sketch differ diff --git a/icon.png b/icon.png index 27284c6..d6a5d22 100644 Binary files a/icon.png and b/icon.png differ diff --git a/options.js b/options.js index 788cff0..65d9621 100644 --- a/options.js +++ b/options.js @@ -1,10 +1,21 @@ // Saves options to localStorage. function saveOptions(event) { event.preventDefault(); + + function adjustHostname(hostname) { + var adjustedHostname = hostname.replace(/\s+/g, '-'); + if (!adjustedHostname.endsWith(".local")) { + adjustedHostname += ".local"; + } + return adjustedHostname; + } - localStorage["hostname"] = document.getElementById("hostname").value; + var adjustedHostname = adjustHostname(document.getElementById("hostname").value); + localStorage["hostname"] = adjustedHostname; localStorage["play-position"] = document.getElementById("play-position-current").checked ? "current" : "0"; + document.getElementById("hostname").value = localStorage["hostname"]; + chrome.extension.getBackgroundPage().window.location.reload(); // Show status to let user know options were saved.