From 4b4a86f186c1b8fd152d127b326f04462590db91 Mon Sep 17 00:00:00 2001 From: keerthivardhan1 Date: Wed, 22 Mar 2023 12:29:10 +0530 Subject: [PATCH 1/7] Fix all the html errors --- docs/_layouts/resource.html | 145 +++++++++++++++++------------------ docs/cc-licenses-poster.html | 2 +- docs/style.css | 2 +- 3 files changed, 73 insertions(+), 76 deletions(-) diff --git a/docs/_layouts/resource.html b/docs/_layouts/resource.html index e59773ca..d1fc467d 100644 --- a/docs/_layouts/resource.html +++ b/docs/_layouts/resource.html @@ -1,108 +1,105 @@ - - -{{ page.title }} | Creative Commons + + + {{ page.title }} | Creative Commons - + - - {% if page.downloadurl %} + + {% if page.downloadurl %} {% if page.repourl %} - + {% else %} - + {% endif %} - {% elsif page.repourl %} + {% elsif page.repourl %} - {% endif %} + {% endif %} - {% if page.repourl contains 'layervault.com' %} + {% if page.repourl contains 'layervault.com' %} - {% endif %} - - {% if page.repourl contains 'github.com' %} + {% endif %} + + {% if page.repourl contains 'github.com' %} - {% endif %} + {% endif %} - - + + -{% include header.html %} + {% include header.html %} -

Creative Commons Resource Archive

+

Creative Commons Resource Archive

-

{{ page.title }}

+

{{ page.title }}

- {% if page.embed %} -
{{ page.embed }}
- {% else %} - {% if page.downloadurl %} - - {% endif %} + {% if page.embed %} +
{{ page.embed }}
+ {% else %} + {% if page.downloadurl %} +
+ {% endif %} - {% if page.image-full %} -
- {% else %} -
- {% endif %} + {% if page.image-full %} +
+ {% else %} +
+ {% endif %} - {% if page.downloadurl %} + {% if page.downloadurl %} - {% endif %} - {% endif %} - {% if page.downloadurl or page.repourl %} -
- {% endif %} - - {% if page.downloadurl %} - -
- {% if page.medium == "website" or page.medium == "course" %} -

Visit

- {% else %} -

Download

{% endif %} + {% endif %} + {% if page.downloadurl or page.repourl %} +
- - {% endif %} + {% endif %} +
- {% if page.downloadurl or page.repourl %} +
+ {{content}}
- {% endif %} - -
-
-{{content}} -
- - {% if page.license %} - - + {% if page.license %} {% if page.license == 'CC0' %} -

CC0 -
- To the extent possible under law, {{ page.author }} has waived all copyright and related or neighboring rights to {{ page.title }}.

- +

CC0
+ To the extent possible under law, {{ page.author }} has waived all copyright and related or neighboring rights to {{ page.title }}. +

{% else %} - -

Creative Commons License
-{% if page.downloadurl %}{% endif %}{{ page.title }}{% if page.downloadurl %}{% endif %}{% if page.author %} by {{ page.author }}{% endif %} is licensed under {{ page.license }}.

+

Creative Commons License
+ {% if page.downloadurl %}{% endif %}{{ page.title }}{% if page.downloadurl %}{% endif %}{% if page.author %} by {{ page.author }}{% endif %} is licensed under {{ page.license }}. +

{% endif %} - {% endif %} + {% endif %} - + diff --git a/docs/cc-licenses-poster.html b/docs/cc-licenses-poster.html index fefa7c98..a5eadcf2 100644 --- a/docs/cc-licenses-poster.html +++ b/docs/cc-licenses-poster.html @@ -20,6 +20,6 @@ Poster outlining what each CC license allows users to do. Available in PDF and SVG formats. diff --git a/docs/style.css b/docs/style.css index 93f58543..57e11429 100644 --- a/docs/style.css +++ b/docs/style.css @@ -18,7 +18,7 @@ margin-left: auto; margin-right: auto; } -#preview { +.preview { width: 500px; height: 375px; margin-left: auto; From 3dbf35962d525bd3e30700a7dffbaa3f39ee9250 Mon Sep 17 00:00:00 2001 From: keerthivardhan1 Date: Wed, 22 Mar 2023 13:00:06 +0530 Subject: [PATCH 2/7] Fix's indentation. --- docs/all.html | 72 ++++++++++++++++++++++---------------------- docs/submission.html | 16 +++++----- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/docs/all.html b/docs/all.html index 091c35fc..6438c09b 100644 --- a/docs/all.html +++ b/docs/all.html @@ -6,45 +6,45 @@
-
-

Topic

-

[x]

-
+
+

Topic

+

[x]

+
-
-

Topic

- -
+
+

Topic

+ +
-
-

Medium

-

[x]

-

-
+
+

Medium

+

[x]

+

+
-
-

Medium

- -
+
+

Medium

+ +
-
-

Language

-

[x]

-
+
+

Language

+

[x]

+
-
-

Language

-

- {% for language in site.data.languages %} - {{ language.string | upcase }} - {% endfor %} -

+
+

Language

+

+ {% for language in site.data.languages %} + {{ language.string | upcase }} + {% endfor %} +

diff --git a/docs/submission.html b/docs/submission.html index bc5bff13..ddbae30c 100644 --- a/docs/submission.html +++ b/docs/submission.html @@ -23,19 +23,19 @@ -
+
-
-

Creative Commons Resource Archive

+
+

Creative Commons Resource Archive

-

Submit a Resource

-

Come across an interesting, useful resource about CC?

-

Use the form below to submit information about a CC resource you have seen in the wild.

+

Submit a Resource

+

Come across an interesting, useful resource about CC?

+

Use the form below to submit information about a CC resource you have seen in the wild.

- + -
+
From 5b82d4f742633ba9b20854f4fce467f095eb7566 Mon Sep 17 00:00:00 2001 From: keerthivardhan1 Date: Tue, 4 Apr 2023 01:09:00 +0530 Subject: [PATCH 3/7] Optimize JavaScript code using ES6 Concepts --- docs/_layouts/listing.html | 93 ++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/docs/_layouts/listing.html b/docs/_layouts/listing.html index 4b808696..82ac5163 100644 --- a/docs/_layouts/listing.html +++ b/docs/_layouts/listing.html @@ -16,42 +16,51 @@ ga('create', 'UA-2010376-29', 'auto'); ga('send', 'pageview'); - -function getUrlVars() -{ - var vars = [], hash; - var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); - for(var i = 0; i < hashes.length; i++) - { - hash = hashes[i].split('='); - vars.push(hash[0]); - vars[hash[0]] = hash[1]; - } - return vars; +/* + getUrlVars :- + + This function extracts the parameters from the URL of the current web page and returns them as an object with key-value pairs. + +*/ + +const getUrlVars = () =>{ + const vars= {}; + const hashes= window.location.href.slice(window.location.href.indexOf('?')+ 1).split('&'); + for(const hash of hashes){ + const [key , value]= hash.split('='); + vars[key]=value; + } + return vars; } -function UpdateQueryString(key, value, url) { - if (!url) url = window.location.href; - var re = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"); +/* + UpdateQueryString :- + + The purpose of this function is to update the query string of a given URL. + The function then returns the updated URL. If no changes are made to the URL, the original URL is returned. + +*/ +const UpdateQueryString = (key, value, url = window.location.href) => { + const re = new RegExp(`([?|&])${key}=.*?(&|#|$)(.*)`, 'gi'); if (re.test(url)) { if (typeof value !== 'undefined' && value !== null) - return url.replace(re, '$1' + key + "=" + value + '$2$3'); + return url.replace(re, `$1${key}=${value}$2$3`); else { - var hash = url.split('#'); - url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); - if (typeof hash[1] !== 'undefined' && hash[1] !== null) - url += '#' + hash[1]; + const [baseUrl , hash] = url.split('#'); + url = baseUrl.replace(re, '$1$3').replace(/(&|\?)$/, ''); + if ( hash !== 'undefined' && hash !== null) + url += `#${hash}`; return url; } } else { if (typeof value !== 'undefined' && value !== null) { - var separator = url.indexOf('?') !== -1 ? '&' : '?', - hash = url.split('#'); - url = hash[0] + separator + key + '=' + value; - if (typeof hash[1] !== 'undefined' && hash[1] !== null) - url += '#' + hash[1]; + const separator = url.indexOf('?') !== -1 ? '&' : '?'; + const [baseUrl , hash] = url.split('#'); + url = `${baseUrl}${separator}${key}=${value}` ; + if ( hash !== 'undefined' && hash !== null) + url += `#${hash}`; return url; } else @@ -61,34 +70,32 @@ document.write(""); -function RemoveQueryString(param1) { - var quer = param1 +const RemoveQueryString = (param1) => { + const quer = param1 location.href=location.href.replace(/&?quer=([^&]$|[^&]*)/i, ""); - } +} -var topic = getUrlVars()["topic"]; -var language = getUrlVars()["language"]; -var medium = getUrlVars()["medium"]; +const topic = getUrlVars()["topic"]; +const language = getUrlVars()["language"]; +const medium = getUrlVars()["medium"]; if (topic === undefined && medium === undefined && language === undefined) { -document.write(""); + document.write("") ; } else { document.write(""); - }; - -document.write(""); + document.write("{ display: block; }"); +} + +document.write(``); + {% endif %} From 60185424ff40779c35d2f0f0c9ffdc0fc3e61f70 Mon Sep 17 00:00:00 2001 From: keerthivardhan1 Date: Tue, 4 Apr 2023 13:40:27 +0530 Subject: [PATCH 4/7] Document Google Analytics --- docs/_layouts/listing.html | 6 ++++++ docs/_layouts/resource.html | 6 ++++++ docs/submission.html | 15 +++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/docs/_layouts/listing.html b/docs/_layouts/listing.html index 82ac5163..b48af965 100644 --- a/docs/_layouts/listing.html +++ b/docs/_layouts/listing.html @@ -8,6 +8,12 @@