From 2bb42138c96c8db25b74eaf78916291ee3d0ea0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Petrnou=C5=A1ek?= Date: Wed, 18 Feb 2015 16:57:33 +0100 Subject: [PATCH 1/4] Added responsive design for editor Fixes #28 It's not perfect, but it should work well. Suggestions welcome. --- edit.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/edit.html b/edit.html index ebfadde4..d641c316 100644 --- a/edit.html +++ b/edit.html @@ -85,6 +85,18 @@ .applies-to img { vertical-align: bottom; } + + @media(max-width:570px) { + #header { + height: auto; + position: inherit; + width: 100%; + } + + #sections { + padding-left: 0px; + } + } From ffe689ef72b7e5abd057cbdaadb3af06365e09ca Mon Sep 17 00:00:00 2001 From: hideheader Date: Wed, 18 Feb 2015 16:55:40 -0500 Subject: [PATCH 2/4] Sanitize `file:` URLs in "Find more styles" Remove the path from `file:` URLs in "Find more files" to avoid leaking users' file system structure to network. Userstyles will currently redirect to https://userstyles.org/styles/browse?search_terms=file%3A --- popup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/popup.js b/popup.js index dd182e7a..51d5cea2 100644 --- a/popup.js +++ b/popup.js @@ -5,7 +5,7 @@ var writeStyleTemplate = document.createElement("a"); writeStyleTemplate.className = "write-style-link"; chrome.tabs.getSelected(null, function(tab) { - var urlWillWork = /^(file|http|https|chrome\-extension):.*/.test(tab.url); + var urlWillWork = /^(file|http|https|chrome\-extension):.*/.exec(tab.url); if (!urlWillWork) { ["installed", "find-styles", "write-style"].forEach(function(id) { @@ -16,7 +16,7 @@ chrome.tabs.getSelected(null, function(tab) { } chrome.extension.sendMessage({method: "getStyles", matchUrl: tab.url}, showStyles); - document.querySelector("#find-styles a").href = "https://userstyles.org/styles/browse/all/" + encodeURIComponent(tab.url); + document.querySelector("#find-styles a").href = "https://userstyles.org/styles/browse/all/" + encodeURIComponent("file" === urlWillWork[1] ? "file:" : tab.url); // Write new style links var writeStyleLinks = [] From b2b6c855b5d15ef2281546c9f75c10fddfb577b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Petrnou=C5=A1ek?= Date: Thu, 19 Feb 2015 18:29:57 +0100 Subject: [PATCH 3/4] Updated responsive design Fixed everything that wasn't lined up properly and shrinked some paddings to make more space for the editor. It also cuts off earlier now. Not sure what to do with the section borders, they seem alright to me. --- edit.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/edit.html b/edit.html index d641c316..dac0c3a3 100644 --- a/edit.html +++ b/edit.html @@ -86,16 +86,25 @@ vertical-align: bottom; } - @media(max-width:570px) { + @media(max-width:737px) { #header { height: auto; position: inherit; - width: 100%; + width: auto; + border-right: none; } - + #sections { padding-left: 0px; } + + #sections-heading { + padding-left: 8px; + } + + body > section > *:not(h2) { + padding-left: 8px; + } } From 20d32fc3af92d8a2780992d69646a0d2d6fa9b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Petrnou=C5=A1ek?= Date: Thu, 19 Feb 2015 18:42:34 +0100 Subject: [PATCH 4/4] Made the CodeMirror area wider, more fixes Sorry, forgot some things. Now it should be right. --- edit.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/edit.html b/edit.html index dac0c3a3..227920b4 100644 --- a/edit.html +++ b/edit.html @@ -92,16 +92,21 @@ position: inherit; width: auto; border-right: none; + padding-left: 8px; } - + #sections { padding-left: 0px; } - + + #sections > div { + padding: 0px; + } + #sections-heading { padding-left: 8px; } - + body > section > *:not(h2) { padding-left: 8px; }