| @@ -3,10 +3,8 @@ | ||
| 3 | 3 | /* global alert */ |
| 4 | 4 | |
| 5 | 5 | (function ($) { |
| 6 | 6 | $(document).ready(function () { |
| 7 | - init_permissions(); | |
| 8 | - | |
| 9 | 7 | $('.type-radio').change(function () { |
| 10 | 8 | $('.type-label-selected').removeClass('type-label-selected'); |
| 11 | 9 | $(this).parent().addClass('type-label-selected'); |
| 12 | 10 | }); |
| @@ -12,11 +10,10 @@ | ||
| 12 | 10 | }); |
| 13 | 11 | |
| 14 | 12 | $('#vz-chart-settings h2').click(function () { |
| 15 | 13 | $("#vz-chart-source").hide(); |
| 16 | - $("#vz-chart-permissions").removeClass('open').addClass('bottom-fixed'); | |
| 17 | 14 | $(this).parent().removeClass('bottom-fixed').addClass('open'); |
| 18 | - $("#vz-chart-permissions .viz-group-header").hide(); | |
| 15 | + | |
| 19 | 16 | return false; |
| 20 | 17 | }); |
| 21 | 18 | $('#vz-chart-settings .customize-section-back').click(function () { |
| 22 | 19 | $("#vz-chart-source").show(); |
| @@ -23,15 +20,15 @@ | ||
| 23 | 20 | $(this).parent().parent().removeClass('open').addClass('bottom-fixed'); |
| 24 | 21 | |
| 25 | 22 | return false; |
| 26 | 23 | }); |
| 27 | - $('.viz-group-title').click(function () { | |
| 24 | + $('.group-title').click(function () { | |
| 28 | 25 | var parent = $(this).parent(); |
| 29 | 26 | |
| 30 | 27 | if (parent.hasClass('open')) { |
| 31 | 28 | parent.removeClass('open'); |
| 32 | 29 | } else { |
| 33 | - parent.parent().find('.viz-group.open').removeClass('open'); | |
| 30 | + parent.parent().find('.group.open').removeClass('open'); | |
| 34 | 31 | parent.addClass('open'); |
| 35 | 32 | } |
| 36 | 33 | }); |
| 37 | 34 | $('#view-remote-file').click(function () { |
| @@ -62,94 +59,18 @@ | ||
| 62 | 59 | $('#thehole').load(function () { |
| 63 | 60 | $('#canvas').unlock(); |
| 64 | 61 | }); |
| 65 | 62 | |
| 66 | - $('.viz-section-title').click(function () { | |
| 67 | - $(this).toggleClass('open').parent().find('.viz-section-items').toggle(); | |
| 63 | + $('.section-title').click(function () { | |
| 64 | + $(this).toggleClass('open').parent().find('.section-items').toggle(); | |
| 68 | 65 | }); |
| 69 | 66 | |
| 70 | 67 | $('.more-info').click(function () { |
| 71 | - $(this).parent().find('.viz-section-description:first').toggle(); | |
| 68 | + $(this).parent().find('.section-description:first').toggle(); | |
| 72 | 69 | return false; |
| 73 | 70 | }); |
| 74 | 71 | |
| 75 | 72 | }); |
| 76 | - | |
| 77 | - function init_permissions(){ | |
| 78 | - $('#vz-chart-permissions h2').click(function () { | |
| 79 | - $("#vz-chart-source").hide(); | |
| 80 | - $("#vz-chart-permissions .viz-group-header").show(); | |
| 81 | - $("#vz-chart-settings").removeClass('open').addClass('bottom-fixed'); | |
| 82 | - | |
| 83 | - $('#settings-button').click(function(e) { | |
| 84 | - e.preventDefault(); | |
| 85 | - $('#permissions-form').submit(); | |
| 86 | - $('#settings-form').submit(); | |
| 87 | - }); | |
| 88 | - | |
| 89 | - $(this).parent().removeClass('bottom-fixed').addClass('open'); | |
| 90 | - | |
| 91 | - return false; | |
| 92 | - }); | |
| 93 | - $('#vz-chart-permissions .customize-section-back').click(function () { | |
| 94 | - $("#vz-chart-source").show(); | |
| 95 | - | |
| 96 | - $("#vz-chart-permissions .viz-group-header").hide(); | |
| 97 | - $('#settings-button').click(function(e) { | |
| 98 | - e.preventDefault(); | |
| 99 | - $('#settings-form').submit(); | |
| 100 | - }); | |
| 101 | - | |
| 102 | - $(this).parent().parent().removeClass('open').addClass('bottom-fixed'); | |
| 103 | - | |
| 104 | - return false; | |
| 105 | - }); | |
| 106 | - | |
| 107 | - $('.visualizer-permission').chosen({ | |
| 108 | - width : '50%', | |
| 109 | - search_contains : true | |
| 110 | - }); | |
| 111 | - | |
| 112 | - $('.visualizer-permission-type').each(function(x, y){ | |
| 113 | - var type = $(y).attr('data-visualizer-permission-type'); | |
| 114 | - var child = $('.visualizer-permission-' + type + '-specific'); | |
| 115 | - if($(y).val() === 'all'){ | |
| 116 | - child.next('div.chosen-container').hide(); | |
| 117 | - return; | |
| 118 | - } | |
| 119 | - }); | |
| 120 | - | |
| 121 | - $('.visualizer-permission-type').on('change', function(evt, params) { | |
| 122 | - var type = $(this).attr('data-visualizer-permission-type'); | |
| 123 | - var child = $('.visualizer-permission-' + type + '-specific'); | |
| 124 | - child.empty(); | |
| 125 | - if(params.selected === 'all'){ | |
| 126 | - child.next('div.chosen-container').hide(); | |
| 127 | - return; | |
| 128 | - } else { | |
| 129 | - child.next('div.chosen-container').show(); | |
| 130 | - } | |
| 131 | - child.append('<option value="">' + visualizer.l10n['loading'] + '</option>').trigger('chosen:updated'); | |
| 132 | - $.ajax({ | |
| 133 | - url : visualizer.ajax['url'], | |
| 134 | - method : 'post', | |
| 135 | - data : { | |
| 136 | - 'action' : visualizer.ajax['actions']['permissions'], | |
| 137 | - 'nonce' : visualizer.ajax['nonces']['permissions'], | |
| 138 | - 'type' : params.selected | |
| 139 | - }, | |
| 140 | - success : function(d, textStatus, XMLHttpRequest){ | |
| 141 | - if(d.success) { | |
| 142 | - child.empty(); | |
| 143 | - $.each(d.data, function(k, v){ | |
| 144 | - child.append('<option value="' + k + '">' + v + '</option>'); | |
| 145 | - }); | |
| 146 | - child.trigger('chosen:updated'); | |
| 147 | - } | |
| 148 | - } | |
| 149 | - }); | |
| 150 | - }); | |
| 151 | - } | |
| 152 | 73 | })(jQuery); |
| 153 | 74 | |
| 154 | 75 | (function ($) { |
| 155 | 76 | $.fn.lock = function () { |