-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwp_movie_ratings.js
35 lines (31 loc) · 1.08 KB
/
wp_movie_ratings.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
// Ask the user before submiting the form
function delete_confirmation() {
if (confirm('You are about to delete this movie rating (including review).\n\nThis cannot be undone. Are you sure?')) return true;
else return false;
}
// Toggle display of movie reviews in page mode
function toggle_review(id) {
var review = document.getElementById(id)
var expand = review.parentNode.querySelector('.expand')
var collapse = review.parentNode.querySelector('.collapse')
if (review && expand && collapse) {
// Show the review
if (review.style.display == 'none') {
if (review.style.setProperty) {
review.style.setProperty('display', 'block', 'important')
} else {
review.style.display = 'block'
}
expand.style.display = 'none'
collapse.style.display = 'block'
} else { // Hide the review
if (review.style.setProperty) {
review.style.setProperty('display', 'none', 'important')
} else {
review.style.display = 'none'
}
collapse.style.display = 'none'
expand.style.display = 'block'
}
}
}