-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlearn.js
123 lines (123 loc) · 6.95 KB
/
learn.js
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
jQuery(document).ready(function() {
jQuery(".post-type-archive-learn .learnPosts").each(function() {
var categoryClasses = [];
jQuery(this).find(".categories a").each(function() {
strClass = jQuery(this).text();
strClass = strClass.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
if (jQuery(this).hasClass('selcountry')) {
strClass = 'country_' + strClass;
}
categoryClasses.push(strClass);
});
jQuery(this).addClass(categoryClasses.join(' '));
});
//display results or hide results
function noResultDisplay() {
visLearn = jQuery(".post-type-archive-learn .learnPosts:visible").size();
if (visLearn > 0) {
jQuery(".post-type-archive-learn #noResults").css("display", "none")
} else {
jQuery(".post-type-archive-learn #noResults").css("display", "block")
}
}
jQuery('select').prop('selectedIndex', 0);
jQuery(".post-type-archive-learn #country").change(function() {
jQuery('.post-type-archive-learn #implementation_partner').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #project_type').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #technology').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #publication_type').prop('selectedIndex', 0);
var strSelect = "";
strSelect = jQuery(".post-type-archive-learn #country option:selected").text();
strSelect = strSelect.replace(/[^a-z0-9\s]/gi, '').replace(/[\s]/g, '_');
if (strSelect == "Country") {
jQuery(".post-type-archive-learn .learnPosts").show("slow");
} else {
strSelectClass = ".country_" + strSelect;
jQuery(".post-type-archive-learn .learnPosts").hide();
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .selcountry").hide();
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .zpt").hide()
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .selcountry" + strSelectClass).each(function() {
jQuery(this).show();
parentClasses = jQuery(this).parent().parent().parent().parent().attr('class');
jQuery(this).parent().parent().parent().parent().show();
});
}
noResultDisplay();
});
jQuery(".post-type-archive-learn #implementation_partner").change(function() {
jQuery('.post-type-archive-learn #country').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #project_type').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #technology').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #publication_type').prop('selectedIndex', 0);
var strSelect = "";
strSelect = jQuery(".post-type-archive-learn #implementation_partner option:selected").text();
strSelect = strSelect.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .selcountry").show();
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .zpt").show();
if (strSelect == "Organization") {
jQuery(".post-type-archive-learn .learnPosts").show("slow");
} else {
strSelectClass = "." + strSelect;
jQuery(".post-type-archive-learn .learnPosts").hide();
jQuery(strSelectClass).show("slow");
}
noResultDisplay();
});
jQuery(".post-type-archive-learn #project_type").change(function() {
jQuery('.post-type-archive-learn #country').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #implementation_partner').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #technology').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #publication_type').prop('selectedIndex', 0);
var strSelect = "";
strSelect = jQuery(".post-type-archive-learn #project_type option:selected").text();
strSelect = strSelect.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .selcountry").show();
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .zpt").show();
if (strSelect == "Topic") {
jQuery(".post-type-archive-learn .learnPosts").show("slow");
} else {
strSelectClass = "." + strSelect;
jQuery(".post-type-archive-learn .learnPosts").hide();
jQuery(strSelectClass).show("slow");
}
noResultDisplay();
});
jQuery(".post-type-archive-learn #technology").change(function() {
jQuery('.post-type-archive-learn #country').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #project_type').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #implementation_partner').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #publication_type').prop('selectedIndex', 0);
var strSelect = "";
strSelect = jQuery(".post-type-archive-learn #technology option:selected").text();
strSelect = strSelect.replace(/[^a-zA-Z0-9]/g, '')
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .selcountry").show();
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .zpt").show();
if (strSelect == "Technology") {
jQuery(".post-type-archive-learn .learnPosts").show("slow");
} else {
strSelectClass = "." + strSelect;
jQuery(".post-type-archive-learn .learnPosts").hide();
jQuery(strSelectClass).show("slow");
}
noResultDisplay();
});
jQuery(".post-type-archive-learn #publication_type").change(function() {
jQuery('.post-type-archive-learn #country').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #project_type').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #implementation_partner').prop('selectedIndex', 0);
jQuery('.post-type-archive-learn #technology').prop('selectedIndex', 0);
var strSelect = "";
strSelect = jQuery(".post-type-archive-learn #publication_type option:selected").text();
strSelect = strSelect.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .selcountry").show();
jQuery(".post-type-archive-learn .learnPosts .tag-cloud .categories.countries .zpt").show();
if (strSelect == "PublicationType") {
jQuery(".post-type-archive-learn .learnPosts").show("slow");
} else {
strSelectClass = "." + strSelect;
jQuery(".post-type-archive-learn .learnPosts").hide();
jQuery(strSelectClass).show("slow");
}
noResultDisplay();
});
});