From a0cca416b4eb755cc02238f579c794f6518ffdf9 Mon Sep 17 00:00:00 2001
From: Samuel Wanjohi
Date: Fri, 24 Jan 2025 15:03:14 +0300
Subject: [PATCH 1/6] Add 'Click to Copy response'
---
.../understand-odata-in-6-steps.html | 73 ++++++++++++++++++-
public/css/site.css | 16 ++++
2 files changed, 88 insertions(+), 1 deletion(-)
diff --git a/pages/getting-started/understand-odata-in-6-steps.html b/pages/getting-started/understand-odata-in-6-steps.html
index 127155f..746f5ba 100644
--- a/pages/getting-started/understand-odata-in-6-steps.html
+++ b/pages/getting-started/understand-odata-in-6-steps.html
@@ -247,7 +247,9 @@ Response
{% endhighlight %}
@@ -296,7 +298,9 @@ Response
{% endhighlight %}
@@ -336,7 +340,9 @@ Response
{% endhighlight %}
@@ -359,7 +365,9 @@ Response
{% endhighlight %}
@@ -378,7 +386,9 @@ Response
{% endhighlight %}
@@ -453,7 +463,9 @@ Response
{% endhighlight %}
@@ -1360,7 +1372,7 @@ Contribute to "Understanding OData in 6 steps"
diff --git a/public/css/site.css b/public/css/site.css
index fcc0df4..fcbbe2a 100644
--- a/public/css/site.css
+++ b/public/css/site.css
@@ -65,6 +65,16 @@ a.carousel-control.left:focus, a.carousel-control.right:focus {
background-color: #d23714;
border-color: #d23714;
}
+.btn-secondary {
+ padding: 10px 20px;
+ color: #ffffff;
+ background-color: #6c757d;
+ border-color: #6c757d;
+ cursor: pointer;
+}
+.btn-secondary:hover {
+ background-color: #272b2e;
+}
.label-success{
background-color: #277a33;
}
@@ -433,3 +443,9 @@ td {
.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
border-top-color: #737373;
}
+
+#feedback {
+ margin: 10px;
+ font-weight: bold;
+ color: green;
+}
\ No newline at end of file
From f54f3cef6a3586f311d28e7edd587e6c013c66ab Mon Sep 17 00:00:00 2001
From: Samuel Wanjohi
Date: Fri, 24 Jan 2025 16:02:31 +0300
Subject: [PATCH 2/6] Refactor to work with Ctrl+Shift+A
---
.../understand-odata-in-6-steps.html | 50 +++++++++----------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/pages/getting-started/understand-odata-in-6-steps.html b/pages/getting-started/understand-odata-in-6-steps.html
index 746f5ba..33bf50a 100644
--- a/pages/getting-started/understand-odata-in-6-steps.html
+++ b/pages/getting-started/understand-odata-in-6-steps.html
@@ -298,7 +298,7 @@ Response
{% endhighlight %}
@@ -340,7 +340,7 @@ Response
{% endhighlight %}
@@ -365,7 +365,7 @@ Response
{% endhighlight %}
@@ -386,7 +386,7 @@ Response
{% endhighlight %}
@@ -463,7 +463,7 @@ Response
{% endhighlight %}
@@ -1436,34 +1436,34 @@ Contribute to "Understanding OData in 6 steps"
// Select all text in a modal when Ctrl+A is pressed
$(document).keydown(function(e) {
- console.log(e);
- if (e.ctrlKey && e.key === 'a') {
- // This script listens for a keydown event and checks if the 'Ctrl' key and the 'a' key are pressed simultaneously.
- // If the condition is met, it prevents the default action and selects the contents of any visible modal's body.
- if (e.ctrlKey && e.key === 'a') {
- $('.modal:visible .modal-body').each(function() {
- e.preventDefault();
+ e.preventDefault();
+
+ // This script listens for a keydown event and checks if the 'Ctrl' key and the 'a' key are pressed simultaneously.
+ // If the condition is met, it prevents the default action and selects the contents of any visible modal's body.
+ // Check if the modal is open
+ if (e.ctrlKey && (e.key === 'a' || e.key === 'A') && $('.modal:visible .modal-body').length) {
+ $('.modal:visible .modal-body').each(function() {
+ var modalBody = $('.modal:visible .modal-body');
+ modalBody.focus();
- // Create a range to select the content within the modal body
- var range = document.createRange();
- range.selectNodeContents(this);
+ // Create a range to select the content within the modal body
+ var range = document.createRange();
+ range.selectNodeContents(modalBody[0]);
- // Get the current selection and remove any existing ranges
- var selection = window.getSelection();
- selection.removeAllRanges();
+ // Get the current selection and remove any existing ranges
+ var selection = window.getSelection();
+ selection.removeAllRanges();
- // Add the new range to the selection
- selection.addRange(range);
- });
- }
+ // Add the new range to the selection
+ selection.addRange(range);
+ });
}
});
// Copy code to clipboard
function copyCode() {
- var modals = document.querySelectorAll('.modal');
// Loop through each modal
- modals.forEach(function(modal) {
+ document.querySelectorAll('.modal').forEach(function(modal) {
// Check if the modal is currently open
if (modal.style.display === 'block') {
var body = modal.querySelector('.modal-body');
@@ -1480,7 +1480,7 @@ Contribute to "Understanding OData in 6 steps"
// Provide feedback to the user
- $('#feedback').text('Content copied to clipboard.').show();
+ $('#feedback').text('Response code copied to clipboard.').show();
// Hide the feedback after 3 seconds
setTimeout(function() {
From 675512782b0149e17c38f19960e94e91649981fb Mon Sep 17 00:00:00 2001
From: Samuel Wanjohi
Date: Fri, 24 Jan 2025 16:33:28 +0300
Subject: [PATCH 3/6] Refactor
---
.../understand-odata-in-6-steps.html | 29 +++++++++----------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/pages/getting-started/understand-odata-in-6-steps.html b/pages/getting-started/understand-odata-in-6-steps.html
index 33bf50a..4710e74 100644
--- a/pages/getting-started/understand-odata-in-6-steps.html
+++ b/pages/getting-started/understand-odata-in-6-steps.html
@@ -1436,27 +1436,24 @@ Contribute to "Understanding OData in 6 steps"
// Select all text in a modal when Ctrl+A is pressed
$(document).keydown(function(e) {
- e.preventDefault();
-
- // This script listens for a keydown event and checks if the 'Ctrl' key and the 'a' key are pressed simultaneously.
+ // If the 'Ctrl + a' or 'Ctrl + Shift + a' for Narrator key are pressed simultaneously.
// If the condition is met, it prevents the default action and selects the contents of any visible modal's body.
// Check if the modal is open
- if (e.ctrlKey && (e.key === 'a' || e.key === 'A') && $('.modal:visible .modal-body').length) {
- $('.modal:visible .modal-body').each(function() {
- var modalBody = $('.modal:visible .modal-body');
- modalBody.focus();
+ if ($('.modal:visible .modal-body').length && e.ctrlKey && (e.key === 'a' || e.key === 'A')) {
+ e.preventDefault();
+ var modalBody = $('.modal:visible .modal-body');
+ modalBody.focus();
- // Create a range to select the content within the modal body
- var range = document.createRange();
- range.selectNodeContents(modalBody[0]);
+ // Create a range to select the content within the modal body
+ var range = document.createRange();
+ range.selectNodeContents(modalBody[0]);
- // Get the current selection and remove any existing ranges
- var selection = window.getSelection();
- selection.removeAllRanges();
+ // Get the current selection and remove any existing ranges
+ var selection = window.getSelection();
+ selection.removeAllRanges();
- // Add the new range to the selection
- selection.addRange(range);
- });
+ // Add the new range to the selection
+ selection.addRange(range);
}
});
From 98b1fd6e7f0ba2643be676e4c9cb41f01e20b158 Mon Sep 17 00:00:00 2001
From: Samuel Wanjohi
Date: Mon, 3 Feb 2025 12:06:33 +0300
Subject: [PATCH 4/6] Refactor button names and alert message
---
.../understand-odata-in-6-steps.html | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/pages/getting-started/understand-odata-in-6-steps.html b/pages/getting-started/understand-odata-in-6-steps.html
index 4710e74..2e399b6 100644
--- a/pages/getting-started/understand-odata-in-6-steps.html
+++ b/pages/getting-started/understand-odata-in-6-steps.html
@@ -247,7 +247,7 @@ Response
{% endhighlight %}
@@ -298,7 +298,7 @@ Response
{% endhighlight %}
@@ -340,7 +340,7 @@ Response
{% endhighlight %}
@@ -365,7 +365,7 @@ Response
{% endhighlight %}
@@ -386,7 +386,7 @@ Response
{% endhighlight %}
@@ -463,7 +463,7 @@ Response
{% endhighlight %}
@@ -1477,7 +1477,7 @@ Contribute to "Understanding OData in 6 steps"
// Provide feedback to the user
- $('#feedback').text('Response code copied to clipboard.').show();
+ $('#feedback').text('Payload copied to clipboard.').show();
// Hide the feedback after 3 seconds
setTimeout(function() {
From 2702f1e350485a446f87504502c3f76761bf4b93 Mon Sep 17 00:00:00 2001
From: Samuel Wanjohi
Date: Tue, 4 Feb 2025 10:47:33 +0300
Subject: [PATCH 5/6] Update
pages/getting-started/understand-odata-in-6-steps.html
Co-authored-by: John Gathogo
---
pages/getting-started/understand-odata-in-6-steps.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pages/getting-started/understand-odata-in-6-steps.html b/pages/getting-started/understand-odata-in-6-steps.html
index 2e399b6..6b56ef9 100644
--- a/pages/getting-started/understand-odata-in-6-steps.html
+++ b/pages/getting-started/understand-odata-in-6-steps.html
@@ -1477,7 +1477,7 @@ Contribute to "Understanding OData in 6 steps"
// Provide feedback to the user
- $('#feedback').text('Payload copied to clipboard.').show();
+ $('#feedback').text('Payload copied to the clipboard.').show();
// Hide the feedback after 3 seconds
setTimeout(function() {
From e54deb673429e171120804486a4ca64913c8ec2b Mon Sep 17 00:00:00 2001
From: Samuel Wanjohi
Date: Wed, 5 Feb 2025 15:07:03 +0300
Subject: [PATCH 6/6] nit
---
pages/getting-started/understand-odata-in-6-steps.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pages/getting-started/understand-odata-in-6-steps.html b/pages/getting-started/understand-odata-in-6-steps.html
index 2e399b6..6b56ef9 100644
--- a/pages/getting-started/understand-odata-in-6-steps.html
+++ b/pages/getting-started/understand-odata-in-6-steps.html
@@ -1477,7 +1477,7 @@ Contribute to "Understanding OData in 6 steps"
// Provide feedback to the user
- $('#feedback').text('Payload copied to clipboard.').show();
+ $('#feedback').text('Payload copied to the clipboard.').show();
// Hide the feedback after 3 seconds
setTimeout(function() {