-
-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathlisting.html
More file actions
177 lines (142 loc) · 5.22 KB
/
listing.html
File metadata and controls
177 lines (142 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<html>
<head>
<title>{{ page.title }} | Creative Commons Resource Archive</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
{% if page.title == "All" %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-2010376-29', 'auto');
ga('send', 'pageview');
/*
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;
}
/*
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`);
else {
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) {
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
return url;
}
}
document.write("<style>.thumbnailbox { display: none; }</style>");
const RemoveQueryString = (param1) => {
const quer = param1
location.href=location.href.replace(/&?quer=([^&]$|[^&]*)/i, "");
}
const topic = getUrlVars()["topic"];
const language = getUrlVars()["language"];
const medium = getUrlVars()["medium"];
if (topic === undefined && medium === undefined && language === undefined) {
document.write("<style>.thumbnailbox { display: block; }</style>") ;
}
else {
document.write("<style>");
if (topic != undefined) {document.write("."+topic)};
if (medium != undefined) {document.write("."+medium)};
if (language != undefined) {document.write("."+language)};
document.write("{ display: block; }</style>");
}
document.write(`<style> ${topic ? " .resourcenavtopicknown" : " .resourcenavtopicunknown"}
${medium ? ", .resourcenavmediumknown" : ", .resourcenavmediumunknown"}
${language ? ", .resourcenavlanguageknown" : ", .resourcenavlanguageunknown"}
{ display: block; }
</style>`);
</script>
{% endif %}
</head>
<body>
{% include header.html %}
<h1>
{% unless page.title == 'Home' %}
<a href="/">
{% endunless %}
Creative Commons Resource Archive
{% unless page.title == 'Home' %}
</a>
{% endunless %}
</h1>
{{content}}
<div id="thumbnaillist">
{% for i in (1..16) %}
{% for page in site.pages %}
{% if page.layout == 'resource' %}
{% if page.featured == i %}
{% if page.topic contains topicfilter or topicfilter == null %}
{% if page.medium contains mediumfilter or mediumfilter == null %}
{% if page.language contains languagefilter or languagefilter == null %}
<div class="thumbnailbox {{ page.topic }} {{ page.medium }} {{page.language}}">
<a href="{{ page.permalink }}">
<div class="thumbnailtitle"><h3>{{ page.title }}</h3></div>
<div class="thumbnail" style="background-image: url('{{ page.image-thumb }}'); "></div>
</a>
<div class="thumbnailblurb">{{ page.blurb }}</div>
</div>
{% endif %}{% endif %}{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% unless page.title == 'Home' %}
{% for i in (1..4) %}
{% for page in site.pages %}
{% if page.layout == 'resource' %}
{% if page.weight == i %}
{% unless page.featured %}
{% if page.paramfilter == page.paramvalue %}
{% if page.topic contains topicfilter or topicfilter == null %}
{% if page.medium contains mediumfilter or mediumfilter == null %}
{% if page.language contains languagefilter or languagefilter == null %}
<div class="thumbnailbox {{ page.topic }} {{ page.medium }} {{page.language}}">
<a href="{{ page.permalink }}">
<div class="thumbnailtitle"><h3>{{ page.title }}</h3></div>
<div class="thumbnail" style="background-image: url('{{ page.image-thumb }}'); "></div>
</a>
<div class="thumbnailblurb">{{ page.blurb }}</div>
</div>
{% endif %}{% endif %}{% endif %}
{% endif %}
{% endunless %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endunless %}
</div>
</body>
</html>