|
@@ -14,8 +14,13 @@ $(document).ready(function () {
|
14
|
14
|
var radiobutton = parent.find('input');
|
15
|
15
|
radiobutton.prop('checked', true);
|
16
|
16
|
$('select#stylesheet').val(radiobutton.attr('value'));
|
|
17
|
+ $('select#stylesheet').change();
|
17
|
18
|
$('input#styleurl').val('');
|
18
|
19
|
})
|
|
20
|
+ // Passthrough image click to radio button
|
|
21
|
+ $('.preview_image').click(function(e) {
|
|
22
|
+ e.currentTarget.children[1].children[0].children[0].click()
|
|
23
|
+ })
|
19
|
24
|
// If the drop-down is changed, select the appropriate item in gallery, clear the custom CSS field
|
20
|
25
|
$('select#stylesheet').change(function() {
|
21
|
26
|
var radiobutton = $('input[name="stylesheet_gallery"][value="' + $(this).val() + '"]');
|
|
@@ -44,4 +49,30 @@ $(document).ready(function () {
|
44
|
49
|
$('#toggle_css_gallery').text($(this).is(':visible') ? 'Hide gallery' : 'Show gallery');
|
45
|
50
|
});
|
46
|
51
|
});
|
|
52
|
+ document.querySelectorAll('[name=style_additions\\[\\]]').forEach(function(el) {
|
|
53
|
+ el.addEventListener('change', function(e) {
|
|
54
|
+ if (e.target.checked) {
|
|
55
|
+ document.body.classList.add('style_'+e.target.value)
|
|
56
|
+ } else {
|
|
57
|
+ document.body.classList.remove('style_'+e.target.value)
|
|
58
|
+ }
|
|
59
|
+ })
|
|
60
|
+ })
|
|
61
|
+ var userstyle = $('link[rel=stylesheet][title]')[0]
|
|
62
|
+ $('select#stylesheet').on('change', function(e) {
|
|
63
|
+ var changetext = e.target.options[e.target.selectedIndex].text.toLowerCase()
|
|
64
|
+ userstyle.href = userstyle.href.replace(/\/[^\/]+?\/style.css/, '/'+changetext+'/style.css')
|
|
65
|
+ $('.style_addition').each(function(i, el){
|
|
66
|
+ if (el.id == 'style_addition_'+changetext) {
|
|
67
|
+ if (el.children.length) {
|
|
68
|
+ el.classList.remove('hidden')
|
|
69
|
+ $('#style_additions_tr')[0].classList.remove('hidden')
|
|
70
|
+ } else {
|
|
71
|
+ $('#style_additions_tr')[0].classList.add('hidden')
|
|
72
|
+ }
|
|
73
|
+ } else {
|
|
74
|
+ el.classList.add('hidden')
|
|
75
|
+ }
|
|
76
|
+ })
|
|
77
|
+ })
|
47
|
78
|
});
|