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