js in template
parent
652d069c35
commit
82c48e12d4
@ -1,15 +1,110 @@
|
|||||||
x<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="{{ staticpath }}/static/archive.css"/>
|
<link rel="stylesheet" href="{{ staticpath }}/static/archive.css"/>
|
||||||
<script type="text/javascript" src="{{ staticpath }}/static/archive.js"></script>
|
<link rel="stylesheet" href="{{ staticpath }}/static/index.css"/>
|
||||||
|
<!-- <script type="text/javascript" src="{{ staticpath }}/static/index.js"></script> -->
|
||||||
<title>{{ page.name }}</title>
|
<title>{{ page.name }}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="myBtnContainer">
|
||||||
<h1>{{ page.name }}</h1>
|
<h2><span class="mw-headline" id="Filters">Topics</span></h2>
|
||||||
|
<button class="btn active" onclick="filterSelection('All')">~All</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Arts and Culture')">~Arts and Culture</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Civil Rights')">~Civil Rights</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Clergy / Religion')">~Clergy / Religion</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Economics')">~Economics</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Education')">~Education</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Elections')">~Elections</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Food Production / Nutrition / Food')">Food Production / Nutrition / Food</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Healthcare')">Healthcare</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Imprisonment')">Imprisonment</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Infrastructure')">Infrastructure</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Internal Affairs')">Internal Affairs</button>
|
||||||
|
<button class="btn" onclick="filterSelection('International Affairs')">International Affairs</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Key Political Figures')">Key Political Figures</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Martial Law')">Martial Law</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Military Abuse')">Military Abuse</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Military Resources')">Military Resources</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Natural Phenomena')">Natural Phenomena</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Political Ideologies')">Political Ideologies</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Resistance Tactics')">Resistance Tactics</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Social Policies')">Social Policies</button>
|
||||||
|
<button class="btn" onclick="filterSelection('US Foreign Policy')">US Foreign Policy</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Workers Rights')">Workers Rights</button>
|
||||||
|
<h2><span class="mw-headline" id="Filters">Formats</span></h2>
|
||||||
|
<button class="btn" onclick="filterSelection('Agenda')">Agenda</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Article')">Article</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Bulletin')">Bulletin</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Comic')">Comic</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Editorial')">Editorial</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Handbook')">Handbook</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Interview')">Interview</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Invitation')">Invitation</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Legal Document')">Legal Document</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Letter')">Letter</button>
|
||||||
|
<button class="btn" onclick="filterSelection('List')">List</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Manifesto')">Manifesto</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Manual')">Manual</button>
|
||||||
|
<button class="btn" onclick="filterSelection('News')">News</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Notes')">Notes</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Pamphlet')">Pamphlet</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Paper')">Paper</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Poem')">Poem</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Reader')">Reader</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Report')">Report</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Song')">Song</button>
|
||||||
|
<button class="btn" onclick="filterSelection('Statement')">Statement</button>
|
||||||
|
</div>
|
||||||
|
<ul id="menu">
|
||||||
<div id="body">{{ body|safe }}</div>
|
<div id="body">{{ body|safe }}</div>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
filterSelection("All")
|
||||||
|
function filterSelection(c) {
|
||||||
|
var x, i;
|
||||||
|
x = document.getElementsByClassName("filter");
|
||||||
|
if (c == "All") c = "";
|
||||||
|
for (i = 0; i < x.length; i++) {
|
||||||
|
w3RemoveClass(x[i], "show");
|
||||||
|
if (x[i].className.indexOf(c) > -1) w3AddClass(x[i], "show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function w3AddClass(element, name) {
|
||||||
|
var i, arr1, arr2;
|
||||||
|
arr1 = element.className.split(" ");
|
||||||
|
arr2 = name.split(" ");
|
||||||
|
for (i = 0; i < arr2.length; i++) {
|
||||||
|
if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function w3RemoveClass(element, name) {
|
||||||
|
var i, arr1, arr2;
|
||||||
|
arr1 = element.className.split(" ");
|
||||||
|
arr2 = name.split(" ");
|
||||||
|
for (i = 0; i < arr2.length; i++) {
|
||||||
|
while (arr1.indexOf(arr2[i]) > -1) {
|
||||||
|
arr1.splice(arr1.indexOf(arr2[i]), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element.className = arr1.join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add active class to the current button (highlight it)
|
||||||
|
var btnContainer = document.getElementById("myBtnContainer");
|
||||||
|
var btns = btnContainer.getElementsByClassName("btn");
|
||||||
|
for (var i = 0; i < btns.length; i++) {
|
||||||
|
btns[i].addEventListener("click", function(){
|
||||||
|
var current = document.getElementsByClassName("active");
|
||||||
|
current[0].className = current[0].className.replace(" active", "");
|
||||||
|
this.className += " active";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
Loading…
Reference in New Issue