From 09fcbc24ffc8708de2285bca984fd2de832da0d2 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:46:27 +0900 Subject: [PATCH 01/22] Update index.html --- index.html | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/index.html b/index.html index 7e4638d..32bdb13 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,30 @@ padding: 0 15px; } + + @@ -50,6 +74,18 @@

Gist HTML Preview

Fork me on GitHub + + + + From 672b7bf5e8e3ad5492efa5b8203bf0556e50fd61 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:47:55 +0900 Subject: [PATCH 02/22] Update index.html --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 32bdb13..5aa4406 100644 --- a/index.html +++ b/index.html @@ -83,7 +83,8 @@

Gist HTML Preview

width="100%" height="100%" scrolling="auto" - class="hide"> + class="hide" + id="full_iframe"> From 595add40f3b5903b4814b58debbe7c9f6a3b81e5 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:48:51 +0900 Subject: [PATCH 03/22] Update main.js --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 13e9a1b..840eae3 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ (function () { function showMainPage () { - document.getElementById('main').className = 'container'; // remove class 'hide' + document.getElementById('full_iframe').className = 'container'; // remove class 'hide' document.getElementById('loading').className += ' hide'; // add class 'hide' } @@ -69,7 +69,7 @@ // 5. write data var content = info.files[fileName].content; - document.write(content); + document.getElementById('full_iframe').contentWindow.document.write(content); }) .catch(function (err) { showMainPage(); From 685eeab219aee756a1c8a271f75873516e00d779 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:51:20 +0900 Subject: [PATCH 04/22] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 5aa4406..aac0c1a 100644 --- a/index.html +++ b/index.html @@ -76,7 +76,7 @@

Gist HTML Preview

- From 4add05a4370b3db04756cdf6cc21765168426280 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:56:39 +0900 Subject: [PATCH 06/22] Update main.js --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 840eae3..d05d9e2 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ (function () { function showMainPage () { - document.getElementById('full_iframe').className = 'container'; // remove class 'hide' + document.getElementById('main').className = 'container'; // remove class 'hide' document.getElementById('loading').className += ' hide'; // add class 'hide' } From 45256e7e8c8cb853437ef744457a61676d58ac45 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:58:23 +0900 Subject: [PATCH 07/22] Update main.js --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index d05d9e2..9cc710b 100644 --- a/main.js +++ b/main.js @@ -70,6 +70,7 @@ // 5. write data var content = info.files[fileName].content; document.getElementById('full_iframe').contentWindow.document.write(content); + document.getElementById('loading').className += ' hide'; }) .catch(function (err) { showMainPage(); From 0ad6ee73988b58a7434c5740c701d53875351c8c Mon Sep 17 00:00:00 2001 From: Matts966 Date: Sat, 15 Aug 2020 01:07:12 +0900 Subject: [PATCH 08/22] Revert "Update main.js" This reverts commit 45256e7e8c8cb853437ef744457a61676d58ac45. --- main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/main.js b/main.js index 9cc710b..d05d9e2 100644 --- a/main.js +++ b/main.js @@ -70,7 +70,6 @@ // 5. write data var content = info.files[fileName].content; document.getElementById('full_iframe').contentWindow.document.write(content); - document.getElementById('loading').className += ' hide'; }) .catch(function (err) { showMainPage(); From 691f287c7349b4b610ef8acf2ac21bfbcbed0ebd Mon Sep 17 00:00:00 2001 From: Matts966 Date: Sat, 15 Aug 2020 01:07:17 +0900 Subject: [PATCH 09/22] Revert "Update main.js" This reverts commit 4add05a4370b3db04756cdf6cc21765168426280. --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index d05d9e2..840eae3 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ (function () { function showMainPage () { - document.getElementById('main').className = 'container'; // remove class 'hide' + document.getElementById('full_iframe').className = 'container'; // remove class 'hide' document.getElementById('loading').className += ' hide'; // add class 'hide' } From 9f35f3bb877a421df6b2948188c5ff6c789b0b77 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Sat, 15 Aug 2020 01:07:27 +0900 Subject: [PATCH 10/22] Revert "Update index.html" This reverts commit 94afb4f4e67e93b466cc6f8209a99fb12fd618b7. --- index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/index.html b/index.html index 3ac35f8..aac0c1a 100644 --- a/index.html +++ b/index.html @@ -83,6 +83,7 @@

Gist HTML Preview

width="100%" height="100%" scrolling="auto" + class="hide" id="full_iframe"> From 0920ab4bf6147f581295a813a8099fca2ecf42e1 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Sat, 15 Aug 2020 01:07:33 +0900 Subject: [PATCH 11/22] Revert "Update index.html" This reverts commit 685eeab219aee756a1c8a271f75873516e00d779. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index aac0c1a..5aa4406 100644 --- a/index.html +++ b/index.html @@ -76,7 +76,7 @@

Gist HTML Preview

- From ce9f048e90975c084bcb1372ab94ef515b446574 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Sat, 15 Aug 2020 01:07:51 +0900 Subject: [PATCH 14/22] Revert "Update index.html" This reverts commit 09fcbc24ffc8708de2285bca984fd2de832da0d2. --- index.html | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/index.html b/index.html index 32bdb13..7e4638d 100644 --- a/index.html +++ b/index.html @@ -24,30 +24,6 @@ padding: 0 15px; } - - @@ -74,18 +50,6 @@

Gist HTML Preview

Fork me on GitHub - - - - From 8223304aad0b65eeed8f41f5422aa29e0a4f7d8c Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 01:13:10 +0900 Subject: [PATCH 15/22] Update index.html --- index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/index.html b/index.html index 7e4638d..a00fd94 100644 --- a/index.html +++ b/index.html @@ -53,7 +53,6 @@

Gist HTML Preview

- From ac8c90d48b3c52a438bc188eb570eaeaac23de24 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 01:20:51 +0900 Subject: [PATCH 16/22] Update main.js --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index 13e9a1b..577da35 100644 --- a/main.js +++ b/main.js @@ -68,6 +68,7 @@ } // 5. write data + document.domain = "https://gist.github.com/"; var content = info.files[fileName].content; document.write(content); }) From 6eb1049e251864b9b5667e976ef0bffd473ded7a Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 01:21:44 +0900 Subject: [PATCH 17/22] Update main.js --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 577da35..5cb2a5a 100644 --- a/main.js +++ b/main.js @@ -68,7 +68,7 @@ } // 5. write data - document.domain = "https://gist.github.com/"; + document.domain = "gist.github.com"; var content = info.files[fileName].content; document.write(content); }) From 22fd9cd4f918f38480e58b362c31ce98b9c3abc8 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 01:30:55 +0900 Subject: [PATCH 18/22] Update main.js --- main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/main.js b/main.js index 5cb2a5a..13e9a1b 100644 --- a/main.js +++ b/main.js @@ -68,7 +68,6 @@ } // 5. write data - document.domain = "gist.github.com"; var content = info.files[fileName].content; document.write(content); }) From dcd2cb2fadb143b4f6e6ea244fb443d601adfabd Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 03:04:50 +0900 Subject: [PATCH 19/22] Update main.js --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 13e9a1b..bc6f29e 100644 --- a/main.js +++ b/main.js @@ -34,7 +34,7 @@ } // 2. get gist id and file name - query = query.split('/'); + query = query.split('/').split('&'); var gistId = query[0]; var fileName = decodeURIComponent(query[1] || ''); From 3be7a0eb5000efdebc8f8026a3a2a46814774989 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 03:06:57 +0900 Subject: [PATCH 20/22] Update main.js --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index bc6f29e..12a4006 100644 --- a/main.js +++ b/main.js @@ -34,7 +34,7 @@ } // 2. get gist id and file name - query = query.split('/').split('&'); + query = query.split(/[\/&]+/); var gistId = query[0]; var fileName = decodeURIComponent(query[1] || ''); From d19e987205aa1946a55d0636df43b45e05c3a4fb Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 03:14:56 +0900 Subject: [PATCH 21/22] Update main.js --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 12a4006..c90cc3f 100644 --- a/main.js +++ b/main.js @@ -13,10 +13,10 @@ } function submit () { - var query = document.getElementById('gist_id').value; + var query = "q=" + document.getElementById('gist_id').value; var fileName = document.getElementById('file_name').value; if (fileName) { - query += '/' + fileName; + query += '&f=' + fileName; } location.search = query; // page will be refreshed } @@ -27,16 +27,16 @@ } // 1. check query string - var query = location.search.substring(1); + const urlParams = new URLSearchParams(window.location.search); + const query = urlParams.get('q'); if (query.length === 0) { showMainPage(); return; } // 2. get gist id and file name - query = query.split(/[\/&]+/); - var gistId = query[0]; - var fileName = decodeURIComponent(query[1] || ''); + const gistId = query; + var fileName = decodeURIComponent(urlParams.get('f') || ''); // 3. write data to blank document.getElementById('gist_id').value = gistId; From 48a2f2e509a213a3e747a959e4a1334dc0e9dbc2 Mon Sep 17 00:00:00 2001 From: Matts966 <28551465+Matts966@users.noreply.github.com> Date: Sat, 15 Aug 2020 03:21:14 +0900 Subject: [PATCH 22/22] Update main.js --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index c90cc3f..0b0600a 100644 --- a/main.js +++ b/main.js @@ -29,7 +29,7 @@ // 1. check query string const urlParams = new URLSearchParams(window.location.search); const query = urlParams.get('q'); - if (query.length === 0) { + if (!query) { showMainPage(); return; }