Best Python code snippet using avocado_python
admin.js
Source:admin.js
...28 var sandboxmode = 'sandbox';29 } else {30 var sandboxmode = 'production';31 }32 $('.std,.api,.live,.sandbox,.sandbox_warning, .accelerated_onboarding').parents('.control-group').hide();33 $('.get_sandbox_credentials').hide();34 $('.get_paypal_credentials').hide();35 // $('.authentication').hide();36 $('.authentication').parents('.control-group').hide();37 if (paypalproduct == 'std' && sandboxmode == 'production') {38 $('.std.live').parents('.control-group').show();39 $('.get_paypal_credentials').show();40 $('#params_paypal_merchant_email').addClass("required");41 } else if (paypalproduct == 'std' && sandboxmode == 'sandbox') {42 $('.std.sandbox').parents('.control-group').show();43 $('.get_sandbox_credentials').show();44 $('#params_sandbox_merchant_email').addClass("required");45 } else if (paypalproduct == 'api' && sandboxmode == 'production') {46 $('.api.live').parents('.control-group').show();47 $('.get_paypal_credentials').show();48 $('#params_paypal_merchant_email').removeClass("required");49 } else if (paypalproduct == 'api' && sandboxmode == 'sandbox') {50 $('.api.sandbox').parents('.control-group').show();51 $('.get_sandbox_credentials').show();52 $('#params_sandbox_merchant_email').removeClass("required");53 } else if (paypalproduct == 'exp' && sandboxmode == 'production') {54 $('.api.live').parents('.control-group').show();55 $('.exp.live').parents('.control-group').show();56 $('.accelerated_onboarding').parents('.control-group').show();57 $('.get_paypal_credentials').show();58 $('#params_paypal_merchant_email').removeClass("required");59 //$('.authentication.live.certificate').parents('.control-group').show();60 } else if (paypalproduct == 'exp' && sandboxmode == 'sandbox') {61 $('.api.sandbox').parents('.control-group').show();62 $('.exp.sandbox').parents('.control-group').show();63 $('.accelerated_onboarding').parents('.control-group').show();64 $('.get_sandbox_credentials').show();65 $('#params_sandbox_merchant_email').removeClass("required");66 // $('.sandbox.authentication').show();67 } else if (paypalproduct == 'hosted' && sandboxmode == 'production') {68 $('.api.live').parents('.control-group').show();69 $('.hosted.live').parents('.control-group').show();70 $('.get_paypal_credentials').show();71 $('#params_paypal_merchant_email').removeClass("required");72 } else if (paypalproduct == 'hosted' && sandboxmode == 'sandbox') {73 $('.api.sandbox').parents('.control-group').show();74 $('.hosted.sandbox').parents('.control-group').show();75 $('.get_sandbox_credentials').show();76 $('#params_sandbox_merchant_email').removeClass("required");77 }78 if (sandboxmode == 'sandbox') {79 $('.sandbox_warning').parents('.control-group').show();80 }81 }82 handlePaymentType = function () {83 var paypalproduct = $('#params_paypalproduct').val();84 var currentval = $('#params_payment_type').val();85 $('.payment_type').parents('.control-group').hide();86 $('.check_ips').parents('.control-group').hide();87 if (paypalproduct == 'std') {88 $('.payment_type').parents('.control-group').show();89 }90 if (paypalproduct == 'std' || paypalproduct == 'hosted') {91 $('.check_ips').parents('.control-group').show();92 }93 if (paypalproduct == 'exp' || paypalproduct == 'api' || paypalproduct == 'hosted') {94 $('#params_payment_type option[value=_cart]').attr('disabled', '');95 $('#params_payment_type option[value=_oe-gift-certificate]').attr('disabled', '');96 $('#params_payment_type option[value=_donations]').attr('disabled', '');97 $('#params_payment_type option[value=_xclick-auto-billing]').attr('disabled', '');98 if (currentval == '_cart' || currentval == '_oe-gift-certificate' || currentval == '_donations' || currentval == '_xclick-auto-billing') {99 $('#params_payment_type').val('_xclick');100 }101 } else {102 $('#params_payment_type option[value=_cart]').removeAttr('disabled');103 $('#params_payment_type option[value=_oe-gift-certificate]').removeAttr('disabled');104 $('#params_payment_type option[value=_donations]').removeAttr('disabled');105 $('#params_payment_type option[value=_xclick-auto-billing]').removeAttr('disabled');106 }107 $('#params_payment_type').trigger("liszt:updated");108 }109 handleCreditCard = function () {110 var paypalproduct = $('#params_paypalproduct').val();111 $('.creditcard').parents('.control-group').hide();112 $('.cvv_required').parents('.control-group').hide();113 if (paypalproduct == 'api') {114 $('.creditcard').parents('.control-group').show();115 $('.cvv_required').parents('.control-group').show();116 }117 }118 handleRefundOnCancel = function () {119 var paypalproduct = $('#params_paypalproduct').val();120 $('.paypal_vm').parents('.control-group').show();121 if (paypalproduct == 'std') {122 $('.paypal_vm').parents('.control-group').hide();123 }124 }125 handleCapturePayment = function () {126 var paypalproduct = $('#params_paypalproduct').val();127 var payment_action = $('#params_payment_action').val();128 $('.capture').parents('.control-group').hide();129 if (paypalproduct == 'hosted' && payment_action == 'Authorization') {130 $('.capture').parents('.control-group').show();131 }132 }133 handleTemplate = function () {134 var paypalproduct = $('#params_paypalproduct').val();135 $('.paypaltemplate').parents('.control-group').hide();136 if (paypalproduct == 'hosted') {137 $('.paypaltemplate').parents('.control-group').show();138 }139 }140 handleTemplateParams = function () {141 var paypaltemplate = $('#params_template').val();142 var paypalproduct = $('#params_paypalproduct').val();143 $('.hosted.templateA,.hosted.templateB,.hosted.templateC,.hosted.template_warning').parents('.control-group').hide();144 if (paypalproduct == 'hosted' && paypaltemplate == 'templateA') {145 $('.hosted.templateA,.hosted.template_warning').parents('.control-group').show();146 }147 if (paypalproduct == 'hosted' && paypaltemplate == 'templateB') {148 $('.hosted.templateB,.hosted.template_warning').parents('.control-group').show();149 }150 if (paypalproduct == 'hosted' && paypaltemplate == 'templateC') {151 $('.hosted.templateC,.hosted.template_warning').parents('.control-group').show();152 }153 }154 handlePaymentAction = function () {155 var paymenttype = $('#params_payment_type').val();156 //var currentval = $('#params_payment_action').val();157 if (paymenttype == '_xclick-subscriptions' || paymenttype == '_xclick-payment-plan' || paymenttype == '_xclick-auto-billing') {158 $('#params_payment_action').val('Sale');159 $('#params_payment_action').parents('.control-group').hide();160 $('#params_payment_action').trigger("liszt:updated");161 } else {162 $('#params_payment_action').parents('.control-group').show();163 }164 }165 handleLayout = function () {166 var paypalproduct = $('#params_paypalproduct').val();167 $('.paypallayout').parents('.control-group').hide();168 $('.stdlayout').parents('.control-group').hide();169 $('.explayout').parents('.control-group').hide();170 // $('.hosted.paypallayout').parents('.control-group').hide();171 if (paypalproduct == 'std' || paypalproduct == 'exp' || paypalproduct == 'hosted') {172 $('.paypallayout').parents('.control-group').show();173 }174 if (paypalproduct == 'std') {175 $('.stdlayout').parents('.control-group').show();176 }177 if (paypalproduct == 'exp') {178 $('.explayout').parents('.control-group').show();179 }180 }181 handleAuthentication = function () {182 var paypalAuthentication = $('#params_authentication').val();183 var sandbox = $("input[name='params[sandbox]']:checked").val();184 if (sandbox == 1) {185 var sandboxmode = 'sandbox';186 } else {187 var sandboxmode = 'production';188 }189 var paypalproduct = $('#params_paypalproduct').val();190 $('.authentication').parents('.control-group').hide();191 if (paypalproduct != 'std') {192 if (sandboxmode == 'sandbox') {193 $('.authentication.sandbox.select').parents('.control-group').show();194 if (paypalAuthentication == 'certificate') {195 $('.authentication.sandbox.certificate').parents('.control-group').show();196 } else {197 $('.authentication.sandbox.signature').parents('.control-group').show();198 }199 }200 else if (sandboxmode == 'production') {201 // $('.authentication.live.certificate').parents('.control-group').show();202 $('.authentication.live.select').parents('.control-group').show();203 if (paypalAuthentication == 'certificate') {204 $('.authentication.live.certificate').parents('.control-group').show();205 } else {206 $('.authentication.live.signature').parents('.control-group').show();207 }208 }209 }210 }211 handleExpectedMaxAmount = function () {212 var paypalproduct = $('#params_paypalproduct').val();213 $('.expected_maxamount').parents('.control-group').hide();214 if (paypalproduct == 'exp') {215 $('.expected_maxamount').parents('.control-group').show();216 }217 }218 handleWarningAuthorizeStd = function () {219 var paypalproduct = $('#params_paypalproduct').val();220 var payment_action = $('#params_payment_action').val();221 $('.warning_std_authorize').parents('.control-group').hide();222 if (paypalproduct == 'std' && payment_action == 'Authorization') {223 $('.warning_std_authorize').parents('.control-group').show();224 }225 }226 handleWarningHeaderImage = function () {227 var headerimage = $('#paramheaderimg').val();228 $('.warning_headerimg').parents('.control-group').hide();229 if (headerimage != '-1') {230 $('.warning_headerimg').parents('.control-group').show();231 }232 }233 handlePaymentTypeDetails = function () {234 var selectedMode = $('#params_payment_type').val();235 $('.xclick').parents('.control-group').hide();236 $('.cart').parents('.control-group').hide();237 $('.subscribe').parents('.control-group').hide();238 $('.plan').parents('.control-group').hide();239 $('.billing').parents('.control-group').hide();240 var paypalproduct = $('#params_paypalproduct').val();241 if (paypalproduct == 'std') {242 switch (selectedMode) {243 case '_xclick':244 $('.xclick').parents('.control-group').show();245 $('.cart').parents('.control-group').hide();246 $('.subscribe').parents('.control-group').hide();247 $('.plan').parents('.control-group').hide();248 $('.billing').parents('.control-group').hide();249 break;250 case '_cart':251 $('.xclick').parents('.control-group').hide();252 $('.cart').parents('.control-group').show();253 $('.subscribe').parents('.control-group').hide();254 $('.plan').parents('.control-group').hide();255 $('.billing').parents('.control-group').hide();256 break;257 case '_oe-gift-certificate':258 $('.cart').parents('.control-group').hide();259 $('.subscribe').parents('.control-group').hide();260 $('.plan').parents('.control-group').hide();261 $('.billing').parents('.control-group').hide();262 break;263 case '_xclick-subscriptions':264 $('.cart').parents('.control-group').hide();265 $('.subscribe').parents('.control-group').show();266 $('.plan').parents('.control-group').hide();267 $('#params_subcription_trials').trigger('change');268 $('.billing').parents('.control-group').hide();269 handleSubscriptionTrials();270 break;271 case '_xclick-auto-billing':272 $('.cart').parents('.control-group').hide();273 $('.subscribe').parents('.control-group').hide();274 $('.plan').parents('.control-group').hide();275 $('.billing').parents('.control-group').show();276 handleMaxAmountType();277 break;278 case '_xclick-payment-plan':279 $('.cart').parents('.control-group').hide();280 $('.subscribe').parents('.control-group').hide();281 $('.plan').parents('.control-group').show();282 $('.billing').parents('.control-group').hide();283 handlePaymentPlanDefer();284 break;285 case '_donations':286 $('.cart').parents('.control-group').hide();287 $('.subscribe').parents('.control-group').hide();288 $('.plan').parents('.control-group').hide();289 $('.billing').parents('.control-group').hide();290 break;291 }292 }293 }294 handleSubscriptionTrials = function () {295 var nbTrials = $('#params_subcription_trials').val();296 switch (nbTrials) {297 case '0':298 $('.trial1').parents('.control-group').hide();299 //$('.trial2').parents('.control-group').hide();300 break;301 case '1':302 $('.trial1').parents('.control-group').show();303 //$('.trial2').parents('.control-group').hide();304 break;305 //case '2':306 // $('.trial1').parents('.control-group').show();307 // $('.trial2').parents('.control-group').show();308 // break;309 }310 }311 handlePaymentPlanDefer = function () {312 var doDefer = $('#params_payment_plan_defer').val();313 var paypalproduct = $('#params_paypalproduct').val();314 $('.defer').parents('.control-group').hide();315 if (doDefer == 1) {316 if (paypalproduct == 'std') {317 $('.defer_std').parents('.control-group').show();318 } else {319 $('.defer_api').parents('.control-group').show();320 }321 }322 }323 handleMaxAmountType = function () {324 var max_amount_type = $('#params_billing_max_amount_type').val();325 switch (max_amount_type) {326 case 'cart':327 case 'cust':328 $('.billing_max_amount').parents('.control-group').hide();329 break;330 case 'value':331 case 'perc':332 $('.billing_max_amount').parents('.control-group').show();333 break;334 }335 }336 handlePaymentFeesWarning = function () {337 var paypalproduct = $('#params_paypalproduct').val();338 var selectedMode = $('#params_payment_type').val();339 if ((paypalproduct == 'api' || paypalproduct == 'exp') && (selectedMode == '_xclick-subscriptions' || selectedMode == '_xclick-payment-plan')) {340 $('.warning_transaction_cost').parents('.control-group').show();341 } else {342 $('.warning_transaction_cost').parents('.control-group').hide();343 }344 }345 handleProductPricesApi = function () {346 var paypalproduct = $('#params_paypalproduct').val();347 var add_prices_api = $('#params_add_prices_api').val();348 if (paypalproduct == 'api' || paypalproduct == 'exp') {349 $('.add_prices_api').parents('.control-group').show();350 } else {351 $('.add_prices_api').parents('.control-group').hide();352 }353 }354 /**********/355 /* Events */356 /**********/357 $("input[name='params[sandbox]']").change(function () {358 handleCredentials();359 handleAuthentication();360 });361 $('#params_paypalproduct').change(function () {362 handleCredentials();363 handleAuthentication();364 handleExpectedMaxAmount();365 handleTemplateParams();...
cmsmasters-theme-settings-toggle.js
Source:cmsmasters-theme-settings-toggle.js
...11 "use strict";12 13 /* General 'General' Tab Fields Load */14 if ($('input[id^="' + cmsmasters_settings.shortname + '_logo_type"]:checked').val() === 'image') {15 $('#' + cmsmasters_settings.shortname + '_logo_title').parents('tr').hide();16 $('#' + cmsmasters_settings.shortname + '_logo_subtitle').parents('tr').hide();17 $('#' + cmsmasters_settings.shortname + '_logo_custom_color').parents('tr').hide();18 $('#' + cmsmasters_settings.shortname + '_logo_title_color').parents('tr').hide();19 $('#' + cmsmasters_settings.shortname + '_logo_subtitle_color').parents('tr').hide();20 } else if ($('input[id^="' + cmsmasters_settings.shortname + '_logo_type"]:checked').val() === 'text') {21 $('#' + cmsmasters_settings.shortname + '_logo_url').parents('tr').hide();22 $('#' + cmsmasters_settings.shortname + '_logo_url_retina').parents('tr').hide();23 24 if ($('#' + cmsmasters_settings.shortname + '_logo_custom_color').is(':not(:checked)')) {25 $('#' + cmsmasters_settings.shortname + '_logo_title_color').parents('tr').hide();26 $('#' + cmsmasters_settings.shortname + '_logo_subtitle_color').parents('tr').hide();27 }28 }29 30 /* General 'General' Tab 'Logo Type' Field Change */31 $('input[id^="' + cmsmasters_settings.shortname + '_logo_type"]').on('change', function () { 32 if ($(this).is(':checked') && $(this).val() === 'image') {33 $('#' + cmsmasters_settings.shortname + '_logo_url').parents('tr').show();34 $('#' + cmsmasters_settings.shortname + '_logo_url_retina').parents('tr').show();35 36 $('#' + cmsmasters_settings.shortname + '_logo_title').parents('tr').hide();37 $('#' + cmsmasters_settings.shortname + '_logo_subtitle').parents('tr').hide();38 $('#' + cmsmasters_settings.shortname + '_logo_custom_color').parents('tr').hide();39 $('#' + cmsmasters_settings.shortname + '_logo_title_color').parents('tr').hide();40 $('#' + cmsmasters_settings.shortname + '_logo_subtitle_color').parents('tr').hide();41 } else if ($(this).is(':checked') && $(this).val() === 'text') {42 $('#' + cmsmasters_settings.shortname + '_logo_title').parents('tr').show();43 $('#' + cmsmasters_settings.shortname + '_logo_subtitle').parents('tr').show();44 $('#' + cmsmasters_settings.shortname + '_logo_custom_color').parents('tr').show();45 46 if ($('#' + cmsmasters_settings.shortname + '_logo_custom_color').is(':checked')) {47 $('#' + cmsmasters_settings.shortname + '_logo_title_color').parents('tr').show();48 $('#' + cmsmasters_settings.shortname + '_logo_subtitle_color').parents('tr').show();49 }50 51 $('#' + cmsmasters_settings.shortname + '_logo_url').parents('tr').hide();52 $('#' + cmsmasters_settings.shortname + '_logo_url_retina').parents('tr').hide();53 }54 } );55 56 /* General 'General' Tab 'Custom Text Colors' Field Change */57 $('#' + cmsmasters_settings.shortname + '_logo_custom_color').on('change', function () { 58 if ($(this).is(':checked')) {59 $('#' + cmsmasters_settings.shortname + '_logo_title_color').parents('tr').show();60 $('#' + cmsmasters_settings.shortname + '_logo_subtitle_color').parents('tr').show();61 } else {62 $('#' + cmsmasters_settings.shortname + '_logo_title_color').parents('tr').hide();63 $('#' + cmsmasters_settings.shortname + '_logo_subtitle_color').parents('tr').hide();64 }65 } );66 67 68 69 /* General 'Background' Tab Fields Load */70 if ($('#' + cmsmasters_settings.shortname + '_bg_img_enable').is(':not(:checked)')) {71 $('#' + cmsmasters_settings.shortname + '_bg_img').parents('tr').hide();72 $('label[for="' + cmsmasters_settings.shortname + '_bg_rep"]').parents('tr').hide();73 $('label[for="' + cmsmasters_settings.shortname + '_bg_pos"]').parents('tr').hide();74 $('label[for="' + cmsmasters_settings.shortname + '_bg_att"]').parents('tr').hide();75 $('label[for="' + cmsmasters_settings.shortname + '_bg_size"]').parents('tr').hide();76 }77 78 /* General 'Background' Tab Fields Change */79 $('#' + cmsmasters_settings.shortname + '_bg_img_enable').on('change', function () { 80 if ($('#' + cmsmasters_settings.shortname + '_bg_img_enable').is(':checked')) {81 $('#' + cmsmasters_settings.shortname + '_bg_img').parents('tr').show();82 $('label[for="' + cmsmasters_settings.shortname + '_bg_rep"]').parents('tr').show();83 $('label[for="' + cmsmasters_settings.shortname + '_bg_pos"]').parents('tr').show();84 $('label[for="' + cmsmasters_settings.shortname + '_bg_att"]').parents('tr').show();85 $('label[for="' + cmsmasters_settings.shortname + '_bg_size"]').parents('tr').show();86 } else {87 $('#' + cmsmasters_settings.shortname + '_bg_img').parents('tr').hide();88 $('label[for="' + cmsmasters_settings.shortname + '_bg_rep"]').parents('tr').hide();89 $('label[for="' + cmsmasters_settings.shortname + '_bg_pos"]').parents('tr').hide();90 $('label[for="' + cmsmasters_settings.shortname + '_bg_att"]').parents('tr').hide();91 $('label[for="' + cmsmasters_settings.shortname + '_bg_size"]').parents('tr').hide();92 }93 } );94 95 96 97 /* General 'Header' Tab Fields Load */98 if ($('#' + cmsmasters_settings.shortname + '_header_top_line').is(':not(:checked)')) {99 $('#' + cmsmasters_settings.shortname + '_header_top_scheme').parents('tr').hide();100 $('#' + cmsmasters_settings.shortname + '_header_top_height').parents('tr').hide();101 $('#' + cmsmasters_settings.shortname + '_header_top_line_short_info').parents('tr').hide();102 $('input[name*="' + cmsmasters_settings.shortname + '_header_top_line_add_cont"]').parents('tr').hide();103 }104 105 106 if ($('input[name*="' + cmsmasters_settings.shortname + '_header_styles"]:checked').val() === 'default') {107 $('#' + cmsmasters_settings.shortname + '_header_bot_height').parents('tr').hide();108 $('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]').parents('tr').hide();109 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').hide();110 }111 112 if ($('input[name*="' + cmsmasters_settings.shortname + '_header_styles"]:checked').val() === 'c_nav') {113 $('#' + cmsmasters_settings.shortname + '_header_search').parents('tr').hide();114 $('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]').parents('tr').hide();115 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').hide();116 }117 118 if ($('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]:checked').val() !== 'cust_html') {119 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').hide();120 }121 122 123 /* General 'Header' Tab Fields Change */124 $('#' + cmsmasters_settings.shortname + '_header_top_line').on('change', function () { 125 if ($('#' + cmsmasters_settings.shortname + '_header_top_line').is(':checked')) {126 $('#' + cmsmasters_settings.shortname + '_header_top_scheme').parents('tr').show();127 $('#' + cmsmasters_settings.shortname + '_header_top_height').parents('tr').show();128 $('#' + cmsmasters_settings.shortname + '_header_top_line_short_info').parents('tr').show();129 $('input[name*="' + cmsmasters_settings.shortname + '_header_top_line_add_cont"]').parents('tr').show();130 } else {131 $('#' + cmsmasters_settings.shortname + '_header_top_scheme').parents('tr').hide();132 $('#' + cmsmasters_settings.shortname + '_header_top_height').parents('tr').hide();133 $('#' + cmsmasters_settings.shortname + '_header_top_line_short_info').parents('tr').hide();134 $('input[name*="' + cmsmasters_settings.shortname + '_header_top_line_add_cont"]').parents('tr').hide();135 }136 } );137 138 139 $('input[name*="' + cmsmasters_settings.shortname + '_header_styles"]').on('change', function () { 140 if ($('input[name*="' + cmsmasters_settings.shortname + '_header_styles"]:checked').val() === 'default') {141 $('#' + cmsmasters_settings.shortname + '_header_bot_height').parents('tr').hide();142 $('#' + cmsmasters_settings.shortname + '_header_search').parents('tr').show();143 $('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]').parents('tr').hide();144 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').hide();145 } else if ($('input[name*="' + cmsmasters_settings.shortname + '_header_styles"]:checked').val() === 'c_nav') {146 $('#' + cmsmasters_settings.shortname + '_header_bot_height').parents('tr').show();147 $('#' + cmsmasters_settings.shortname + '_header_search').parents('tr').hide();148 $('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]').parents('tr').hide();149 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').hide();150 } else {151 $('#' + cmsmasters_settings.shortname + '_header_bot_height').parents('tr').show();152 $('#' + cmsmasters_settings.shortname + '_header_search').parents('tr').show();153 $('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]').parents('tr').show();154 155 if ($('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]:checked').val() === 'cust_html') {156 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').show();157 }158 }159 } );160 161 $('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]').on('change', function () { 162 if ($('input[name*="' + cmsmasters_settings.shortname + '_header_add_cont"]:checked').val() === 'cust_html') {163 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').show();164 } else {165 $('#' + cmsmasters_settings.shortname + '_header_add_cont_cust_html').parents('tr').hide();166 }167 } );168 169 170 171 /* General 'Content' Tab Fields Load */172 if ($('#' + cmsmasters_settings.shortname + '_heading_bg_image_enable').is(':not(:checked)')) {173 $('#' + cmsmasters_settings.shortname + '_heading_bg_image').parents('tr').hide();174 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_repeat"]').parents('tr').hide();175 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_attachment"]').parents('tr').hide();176 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_size"]').parents('tr').hide();177 }178 179 /* General 'Content' Tab Fields Change */180 $('#' + cmsmasters_settings.shortname + '_heading_bg_image_enable').on('change', function () { 181 if ($('#' + cmsmasters_settings.shortname + '_heading_bg_image_enable').is(':checked')) {182 $('#' + cmsmasters_settings.shortname + '_heading_bg_image').parents('tr').show();183 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_repeat"]').parents('tr').show();184 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_attachment"]').parents('tr').show();185 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_size"]').parents('tr').show();186 } else {187 $('#' + cmsmasters_settings.shortname + '_heading_bg_image').parents('tr').hide();188 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_repeat"]').parents('tr').hide();189 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_attachment"]').parents('tr').hide();190 $('label[for="' + cmsmasters_settings.shortname + '_heading_bg_size"]').parents('tr').hide();191 }192 } );193 194 195 196 /* General 'Footer' Tab Fields Load */197 if ($('input[name*="' + cmsmasters_settings.shortname + '_footer_type"]:checked').val() !== 'small') {198 $('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]').parents('tr').hide();199 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').show();200 $('#' + cmsmasters_settings.shortname + '_footer_logo').parents('tr').show();201 202 203 if ($('#' + cmsmasters_settings.shortname + '_footer_logo').is(':not(:checked)')) {204 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').hide();205 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();206 }207 } else {208 $('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]').parents('tr').show();209 210 $('#' + cmsmasters_settings.shortname + '_footer_logo').parents('tr').hide();211 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').hide();212 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();213 $('#' + cmsmasters_settings.shortname + '_footer_nav').parents('tr').hide();214 $('#' + cmsmasters_settings.shortname + '_footer_social').parents('tr').hide();215 216 if ($('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]:checked').val() !== 'text') {217 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').hide();218 }219 }220 221 222 /* General 'Footer' Tab Fields Change */223 $('input[name*="' + cmsmasters_settings.shortname + '_footer_type"]').on('change', function () { 224 if ($('input[name*="' + cmsmasters_settings.shortname + '_footer_type"]:checked').val() === 'small') {225 $('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]').parents('tr').show();226 227 $('#' + cmsmasters_settings.shortname + '_footer_logo').parents('tr').hide();228 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').hide();229 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();230 $('#' + cmsmasters_settings.shortname + '_footer_nav').parents('tr').hide();231 $('#' + cmsmasters_settings.shortname + '_footer_social').parents('tr').hide();232 233 234 if ($('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]:checked').val() === 'text') {235 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').show();236 } else {237 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').hide();238 }239 } else {240 $('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]').parents('tr').hide();241 242 $('#' + cmsmasters_settings.shortname + '_footer_logo').parents('tr').show();243 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').show();244 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').show();245 $('#' + cmsmasters_settings.shortname + '_footer_nav').parents('tr').show();246 $('#' + cmsmasters_settings.shortname + '_footer_social').parents('tr').show();247 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').show();248 249 250 if ($('#' + cmsmasters_settings.shortname + '_footer_logo').is(':not(:checked)')) {251 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').hide();252 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();253 }254 }255 } );256 257 258 /* General 'Footer' Tab 'Footer Logo' Field Change */259 $('#' + cmsmasters_settings.shortname + '_footer_logo').on('change', function () { 260 if ($(this).is(':checked')) {261 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').show();262 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').show();263 } else if ($(this).is(':not(:checked)')) {264 $('#' + cmsmasters_settings.shortname + '_footer_logo_url').parents('tr').hide();265 $('#' + cmsmasters_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();266 }267 } );268 269 270 /* General 'Footer' Tab 'Additional Content' Change */271 $('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]').on('change', function () { 272 if ($('input[name*="' + cmsmasters_settings.shortname + '_footer_type"]:checked').val() === 'small') {273 if ($('input[name*="' + cmsmasters_settings.shortname + '_footer_additional_content"]:checked').val() === 'text') {274 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').show();275 } else {276 $('#' + cmsmasters_settings.shortname + '_footer_html').parents('tr').hide();277 }278 }279 } );280 281 282 283 /* Elements '404' Tab Fields Load */284 if ($('#' + cmsmasters_settings.shortname + '_error_sitemap_button').is(':not(:checked)')) {285 $('#' + cmsmasters_settings.shortname + '_error_sitemap_link').parents('tr').hide();286 }287 288 if ($('#' + cmsmasters_settings.shortname + '_error_bg_img_enable').is(':not(:checked)')) {289 $('#' + cmsmasters_settings.shortname + '_error_bg_image').parents('tr').hide();290 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_rep"]').parents('tr').hide();291 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_pos"]').parents('tr').hide();292 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_att"]').parents('tr').hide();293 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_size"]').parents('tr').hide();294 }295 296 /* Elements '404' Tab Fields Change */297 $('#' + cmsmasters_settings.shortname + '_error_sitemap_button').on('change', function () { 298 if ($(this).is(':checked')) {299 $('#' + cmsmasters_settings.shortname + '_error_sitemap_link').parents('tr').show();300 } else {301 $('#' + cmsmasters_settings.shortname + '_error_sitemap_link').parents('tr').hide();302 }303 } );304 305 $('#' + cmsmasters_settings.shortname + '_error_bg_img_enable').on('change', function () { 306 if ($('#' + cmsmasters_settings.shortname + '_error_bg_img_enable').is(':checked')) {307 $('#' + cmsmasters_settings.shortname + '_error_bg_image').parents('tr').show();308 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_rep"]').parents('tr').show();309 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_pos"]').parents('tr').show();310 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_att"]').parents('tr').show();311 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_size"]').parents('tr').show();312 } else {313 $('#' + cmsmasters_settings.shortname + '_error_bg_image').parents('tr').hide();314 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_rep"]').parents('tr').hide();315 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_pos"]').parents('tr').hide();316 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_att"]').parents('tr').hide();317 $('label[for="' + cmsmasters_settings.shortname + '_error_bg_size"]').parents('tr').hide();318 }319 } );320 321 322 323 /* Single Posts 'Project' Tab Fields Load */324 if ($('#' + cmsmasters_settings.shortname + '_portfolio_project_link').is(':not(:checked)')) {325 $('#' + cmsmasters_settings.shortname + '_portfolio_project_link_text').parents('tr').hide();326 }327 328 /* Single Posts 'Project' Tab 'Project Link' Field Change */329 $('#' + cmsmasters_settings.shortname + '_portfolio_project_link').on('change', function () { 330 if ($(this).is(':checked')) {331 $('#' + cmsmasters_settings.shortname + '_portfolio_project_link_text').parents('tr').show();332 } else {333 $('#' + cmsmasters_settings.shortname + '_portfolio_project_link_text').parents('tr').hide();334 }335 } );...
cmsms-theme-settings-toggle.js
Source:cmsms-theme-settings-toggle.js
...9 */10(function ($) { 11 /* General 'General' Tab Fields Load */12 if ($('#' + cmsms_settings.shortname + '_preload').is(':not(:checked)')) {13 $('#' + cmsms_settings.shortname + '_preload_bg').parents('tr').hide();14 $('#' + cmsms_settings.shortname + '_preload_color').parents('tr').hide();15 $('#' + cmsms_settings.shortname + '_preload_effect').parents('tr').hide();16 $('#' + cmsms_settings.shortname + '_preload_percentage').parents('tr').hide();17 }18 19 if ($('#' + cmsms_settings.shortname + '_preload_effect').val() !== 'grow' && $('#' + cmsms_settings.shortname + '_preload_effect').val() !== 'fade') {20 $('#' + cmsms_settings.shortname + '_preload_percentage').parents('tr').hide();21 }22 23 /* General 'General' Tab Fields Change */24 $('#' + cmsms_settings.shortname + '_preload').bind('change', function () { 25 if ($(this).is(':checked')) {26 $('#' + cmsms_settings.shortname + '_preload_bg').parents('tr').show();27 $('#' + cmsms_settings.shortname + '_preload_color').parents('tr').show();28 $('#' + cmsms_settings.shortname + '_preload_effect').parents('tr').show();29 30 if ($('#' + cmsms_settings.shortname + '_preload_effect').val() === 'grow' || $('#' + cmsms_settings.shortname + '_preload_effect').val() === 'fade') {31 $('#' + cmsms_settings.shortname + '_preload_percentage').parents('tr').show();32 }33 } else {34 $('#' + cmsms_settings.shortname + '_preload_bg').parents('tr').hide();35 $('#' + cmsms_settings.shortname + '_preload_color').parents('tr').hide();36 $('#' + cmsms_settings.shortname + '_preload_effect').parents('tr').hide();37 $('#' + cmsms_settings.shortname + '_preload_percentage').parents('tr').hide();38 }39 } );40 41 $('#' + cmsms_settings.shortname + '_preload_effect').bind('change', function () { 42 if ($(this).val() === 'grow' || $(this).val() === 'fade') {43 $('#' + cmsms_settings.shortname + '_preload_percentage').parents('tr').show();44 } else {45 $('#' + cmsms_settings.shortname + '_preload_percentage').parents('tr').hide();46 }47 } );48 49 50 51 /* General '404' Tab Fields Load */52 if ($('#' + cmsms_settings.shortname + '_error_sitemap_button').is(':not(:checked)')) {53 $('#' + cmsms_settings.shortname + '_error_sitemap_link').parents('tr').hide();54 }55 56 /* General '404' Tab Fields Change */57 $('#' + cmsms_settings.shortname + '_error_sitemap_button').bind('change', function () { 58 if ($(this).is(':checked')) {59 $('#' + cmsms_settings.shortname + '_error_sitemap_link').parents('tr').show();60 } else {61 $('#' + cmsms_settings.shortname + '_error_sitemap_link').parents('tr').hide();62 }63 } );64 65 66 67 /* Appearance 'Logo' Tab Fields Load */68 if ($('input[id^="' + cmsms_settings.shortname + '_logo_type"]:checked').val() === 'image') {69 $('#' + cmsms_settings.shortname + '_logo_title').parents('tr').hide();70 $('#' + cmsms_settings.shortname + '_logo_subtitle').parents('tr').hide();71 $('#' + cmsms_settings.shortname + '_logo_custom_color').parents('tr').hide();72 $('#' + cmsms_settings.shortname + '_logo_title_color').parents('tr').hide();73 $('#' + cmsms_settings.shortname + '_logo_subtitle_color').parents('tr').hide();74 } else if ($('input[id^="' + cmsms_settings.shortname + '_logo_type"]:checked').val() === 'text') {75 $('#' + cmsms_settings.shortname + '_logo_url').parents('tr').hide();76 $('#' + cmsms_settings.shortname + '_logo_url_retina').parents('tr').hide();77 $('#' + cmsms_settings.shortname + '_logo_resp_url').parents('tr').hide();78 $('#' + cmsms_settings.shortname + '_logo_resp_url_retina').parents('tr').hide();79 80 if ($('#' + cmsms_settings.shortname + '_logo_custom_color').is(':not(:checked)')) {81 $('#' + cmsms_settings.shortname + '_logo_title_color').parents('tr').hide();82 $('#' + cmsms_settings.shortname + '_logo_subtitle_color').parents('tr').hide();83 }84 }85 86 /* Appearance 'Logo' Tab 'Logo Type' Field Change */87 $('input[id^="' + cmsms_settings.shortname + '_logo_type"]').bind('change', function () { 88 if ($(this).is(':checked') && $(this).val() === 'image') {89 $('#' + cmsms_settings.shortname + '_logo_url').parents('tr').show();90 $('#' + cmsms_settings.shortname + '_logo_url_retina').parents('tr').show();91 $('#' + cmsms_settings.shortname + '_logo_resp_url').parents('tr').show();92 $('#' + cmsms_settings.shortname + '_logo_resp_url_retina').parents('tr').show();93 94 $('#' + cmsms_settings.shortname + '_logo_title').parents('tr').hide();95 $('#' + cmsms_settings.shortname + '_logo_subtitle').parents('tr').hide();96 $('#' + cmsms_settings.shortname + '_logo_custom_color').parents('tr').hide();97 $('#' + cmsms_settings.shortname + '_logo_title_color').parents('tr').hide();98 $('#' + cmsms_settings.shortname + '_logo_subtitle_color').parents('tr').hide();99 } else if ($(this).is(':checked') && $(this).val() === 'text') {100 $('#' + cmsms_settings.shortname + '_logo_title').parents('tr').show();101 $('#' + cmsms_settings.shortname + '_logo_subtitle').parents('tr').show();102 $('#' + cmsms_settings.shortname + '_logo_custom_color').parents('tr').show();103 104 if ($('#' + cmsms_settings.shortname + '_logo_custom_color').is(':checked')) {105 $('#' + cmsms_settings.shortname + '_logo_title_color').parents('tr').show();106 $('#' + cmsms_settings.shortname + '_logo_subtitle_color').parents('tr').show();107 }108 109 $('#' + cmsms_settings.shortname + '_logo_url').parents('tr').hide();110 $('#' + cmsms_settings.shortname + '_logo_url_retina').parents('tr').hide();111 $('#' + cmsms_settings.shortname + '_logo_resp_url').parents('tr').hide();112 $('#' + cmsms_settings.shortname + '_logo_resp_url_retina').parents('tr').hide();113 }114 } );115 116 /* Appearance 'Logo' Tab 'Custom Text Colors' Field Change */117 $('#' + cmsms_settings.shortname + '_logo_custom_color').bind('change', function () { 118 if ($(this).is(':checked')) {119 $('#' + cmsms_settings.shortname + '_logo_title_color').parents('tr').show();120 $('#' + cmsms_settings.shortname + '_logo_subtitle_color').parents('tr').show();121 } else {122 $('#' + cmsms_settings.shortname + '_logo_title_color').parents('tr').hide();123 $('#' + cmsms_settings.shortname + '_logo_subtitle_color').parents('tr').hide();124 }125 } );126 127 /* Appearance 'Favicon' Tab Fields Load */128 if ($('#' + cmsms_settings.shortname + '_favicon').is(':not(:checked)')) {129 $('#' + cmsms_settings.shortname + '_favicon_url').parents('tr').hide();130 }131 132 /* Appearance 'Favicon' Tab Fields Change */133 $('#' + cmsms_settings.shortname + '_favicon').bind('change', function () { 134 if ($(this).is(':checked')) {135 $('#' + cmsms_settings.shortname + '_favicon_url').parents('tr').show();136 } else {137 $('#' + cmsms_settings.shortname + '_favicon_url').parents('tr').hide();138 }139 } );140 141 142 143 /* Appearance 'Background' Tab Fields Load */144 if ($('#' + cmsms_settings.shortname + '_bg_img_enable').is(':not(:checked)')) {145 $('#' + cmsms_settings.shortname + '_bg_img').parents('tr').hide();146 $('label[for="' + cmsms_settings.shortname + '_bg_rep"]').parents('tr').hide();147 $('label[for="' + cmsms_settings.shortname + '_bg_pos"]').parents('tr').hide();148 $('label[for="' + cmsms_settings.shortname + '_bg_att"]').parents('tr').hide();149 $('label[for="' + cmsms_settings.shortname + '_bg_size"]').parents('tr').hide();150 }151 152 /* Appearance 'Background' Tab Fields Change */153 $('#' + cmsms_settings.shortname + '_bg_img_enable').bind('change', function () { 154 if ($('#' + cmsms_settings.shortname + '_bg_img_enable').is(':checked')) {155 $('#' + cmsms_settings.shortname + '_bg_img').parents('tr').show();156 $('label[for="' + cmsms_settings.shortname + '_bg_rep"]').parents('tr').show();157 $('label[for="' + cmsms_settings.shortname + '_bg_pos"]').parents('tr').show();158 $('label[for="' + cmsms_settings.shortname + '_bg_att"]').parents('tr').show();159 $('label[for="' + cmsms_settings.shortname + '_bg_size"]').parents('tr').show();160 } else {161 $('#' + cmsms_settings.shortname + '_bg_img').parents('tr').hide();162 $('label[for="' + cmsms_settings.shortname + '_bg_rep"]').parents('tr').hide();163 $('label[for="' + cmsms_settings.shortname + '_bg_pos"]').parents('tr').hide();164 $('label[for="' + cmsms_settings.shortname + '_bg_att"]').parents('tr').hide();165 $('label[for="' + cmsms_settings.shortname + '_bg_size"]').parents('tr').hide();166 }167 } );168 169 170 171 /* Appearance 'Header' Tab Fields Load */172 if ($('#' + cmsms_settings.shortname + '_header_top_line').is(':not(:checked)')) {173 $('#' + cmsms_settings.shortname + '_header_top_scheme').parents('tr').hide();174 $('#' + cmsms_settings.shortname + '_header_top_height').parents('tr').hide();175 $('#' + cmsms_settings.shortname + '_header_top_line_short_info').parents('tr').hide();176 $('input[name*="' + cmsms_settings.shortname + '_header_top_line_add_cont"]').parents('tr').hide();177 }178 179 180 /* Appearance 'Header' Tab Fields Change */181 $('#' + cmsms_settings.shortname + '_header_top_line').bind('change', function () { 182 if ($('#' + cmsms_settings.shortname + '_header_top_line').is(':checked')) {183 $('#' + cmsms_settings.shortname + '_header_top_scheme').parents('tr').show();184 $('#' + cmsms_settings.shortname + '_header_top_height').parents('tr').show();185 $('#' + cmsms_settings.shortname + '_header_top_line_short_info').parents('tr').show();186 $('input[name*="' + cmsms_settings.shortname + '_header_top_line_add_cont"]').parents('tr').show();187 } else {188 $('#' + cmsms_settings.shortname + '_header_top_scheme').parents('tr').hide();189 $('#' + cmsms_settings.shortname + '_header_top_height').parents('tr').hide();190 $('#' + cmsms_settings.shortname + '_header_top_line_short_info').parents('tr').hide();191 $('input[name*="' + cmsms_settings.shortname + '_header_top_line_add_cont"]').parents('tr').hide();192 }193 } );194 195 196 /* Appearance 'Content' Tab Fields Load */197 if ($('#' + cmsms_settings.shortname + '_heading_bg_image_enable').is(':not(:checked)')) {198 $('#' + cmsms_settings.shortname + '_heading_bg_image').parents('tr').hide();199 $('label[for="' + cmsms_settings.shortname + '_heading_bg_repeat"]').parents('tr').hide();200 $('label[for="' + cmsms_settings.shortname + '_heading_bg_attachment"]').parents('tr').hide();201 $('label[for="' + cmsms_settings.shortname + '_heading_bg_size"]').parents('tr').hide();202 }203 204 /* Appearance 'Content' Tab Fields Change */205 $('#' + cmsms_settings.shortname + '_heading_bg_image_enable').bind('change', function () { 206 if ($('#' + cmsms_settings.shortname + '_heading_bg_image_enable').is(':checked')) {207 $('#' + cmsms_settings.shortname + '_heading_bg_image').parents('tr').show();208 $('label[for="' + cmsms_settings.shortname + '_heading_bg_repeat"]').parents('tr').show();209 $('label[for="' + cmsms_settings.shortname + '_heading_bg_attachment"]').parents('tr').show();210 $('label[for="' + cmsms_settings.shortname + '_heading_bg_size"]').parents('tr').show();211 } else {212 $('#' + cmsms_settings.shortname + '_heading_bg_image').parents('tr').hide();213 $('label[for="' + cmsms_settings.shortname + '_heading_bg_repeat"]').parents('tr').hide();214 $('label[for="' + cmsms_settings.shortname + '_heading_bg_attachment"]').parents('tr').hide();215 $('label[for="' + cmsms_settings.shortname + '_heading_bg_size"]').parents('tr').hide();216 }217 } );218 219 220 221 /* Appearance 'Footer' Tab Fields Load */222 if ($('input[name*="' + cmsms_settings.shortname + '_footer_type"]:checked').val() === 'default') {223 $('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]').parents('tr').hide();224 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').show();225 } else {226 $('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]').parents('tr').show();227 228 $('#' + cmsms_settings.shortname + '_fixed_footer').parents('tr').hide();229 $('#' + cmsms_settings.shortname + '_footer_height').parents('tr').hide();230 $('#' + cmsms_settings.shortname + '_footer_logo').parents('tr').hide();231 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').hide();232 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();233 $('#' + cmsms_settings.shortname + '_footer_nav').parents('tr').hide();234 $('#' + cmsms_settings.shortname + '_footer_social').parents('tr').hide();235 }236 237 /* Appearance 'Footer' Tab Fields Change */238 $('input[name*="' + cmsms_settings.shortname + '_footer_type"]').bind('change', function () { 239 if ($('input[name*="' + cmsms_settings.shortname + '_footer_type"]:checked').val() === 'small') {240 $('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]').parents('tr').show();241 242 $('#' + cmsms_settings.shortname + '_fixed_footer').parents('tr').hide();243 $('#' + cmsms_settings.shortname + '_footer_height').parents('tr').hide();244 $('#' + cmsms_settings.shortname + '_footer_logo').parents('tr').hide();245 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').hide();246 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();247 $('#' + cmsms_settings.shortname + '_footer_nav').parents('tr').hide();248 $('#' + cmsms_settings.shortname + '_footer_social').parents('tr').hide();249 250 251 if ($('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]:checked').val() === 'text') {252 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').show();253 } else {254 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').hide();255 }256 } else {257 $('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]').parents('tr').hide();258 259 $('#' + cmsms_settings.shortname + '_fixed_footer').parents('tr').show();260 $('#' + cmsms_settings.shortname + '_footer_height').parents('tr').show();261 $('#' + cmsms_settings.shortname + '_footer_logo').parents('tr').show();262 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').show();263 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').show();264 $('#' + cmsms_settings.shortname + '_footer_nav').parents('tr').show();265 $('#' + cmsms_settings.shortname + '_footer_social').parents('tr').show();266 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').show();267 }268 } );269 270 271 /* Appearance 'Footer' Tab 'Additional Content' Load */272 if ($('input[name*="' + cmsms_settings.shortname + '_footer_type"]:checked').val() === 'small') {273 if ($('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]:checked').val() !== 'text') {274 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').hide();275 } else {276 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').show();277 }278 }279 280 /* Appearance 'Footer' Tab 'Additional Content' Change */281 $('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]').bind('change', function () { 282 if ($('input[name*="' + cmsms_settings.shortname + '_footer_type"]:checked').val() === 'small') {283 if ($('input[name*="' + cmsms_settings.shortname + '_footer_additional_content"]:checked').val() === 'text') {284 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').show();285 } else {286 $('#' + cmsms_settings.shortname + '_footer_html').parents('tr').hide();287 }288 }289 } );290 291 292 /* Appearance 'Footer' Tab 'Footer Logo' Field Load */293 if ($('input[name*="' + cmsms_settings.shortname + '_footer_type"]:checked').val() === 'default') {294 if ($('#' + cmsms_settings.shortname + '_footer_logo').is(':not(:checked)')) {295 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').hide();296 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();297 } else {298 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').show();299 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').show();300 }301 }302 303 /* Appearance 'Footer' Tab 'Footer Logo' Field Change */304 $('#' + cmsms_settings.shortname + '_footer_logo').bind('change', function () { 305 if ($(this).is(':checked')) {306 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').show();307 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').show();308 } else if ($(this).is(':not(:checked)')) {309 $('#' + cmsms_settings.shortname + '_footer_logo_url').parents('tr').hide();310 $('#' + cmsms_settings.shortname + '_footer_logo_url_retina').parents('tr').hide();311 }312 } );313 314 315 /* Single Posts 'Project' Tab Fields Load */316 if ($('#' + cmsms_settings.shortname + '_portfolio_project_link').is(':not(:checked)')) {317 $('#' + cmsms_settings.shortname + '_portfolio_project_link_text').parents('tr').hide();318 }319 320 /* Single Posts 'Project' Tab 'Project Link' Field Change */321 $('#' + cmsms_settings.shortname + '_portfolio_project_link').bind('change', function () { 322 if ($(this).is(':checked')) {323 $('#' + cmsms_settings.shortname + '_portfolio_project_link_text').parents('tr').show();324 } else {325 $('#' + cmsms_settings.shortname + '_portfolio_project_link_text').parents('tr').hide();326 }327 } );...
index.js
Source:index.js
1/* */ 2'use strict';3var acorn = require('acorn');4var walk = require('acorn/dist/walk');5function isScope(node) {6 return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'ArrowFunctionExpression' || node.type === 'Program';7}8function isBlockScope(node) {9 return node.type === 'BlockStatement' || isScope(node);10}11function declaresArguments(node) {12 return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';13}14function declaresThis(node) {15 return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration';16}17function reallyParse(source) {18 try {19 return acorn.parse(source, {20 ecmaVersion: 6,21 allowReturnOutsideFunction: true,22 allowImportExportEverywhere: true,23 allowHashBang: true24 });25 } catch (ex) {26 return acorn.parse(source, {27 ecmaVersion: 5,28 allowReturnOutsideFunction: true,29 allowImportExportEverywhere: true,30 allowHashBang: true31 });32 }33}34module.exports = findGlobals;35module.exports.parse = reallyParse;36function findGlobals(source) {37 var globals = [];38 var ast;39 // istanbul ignore else40 if (typeof source === 'string') {41 ast = reallyParse(source);42 } else {43 ast = source;44 }45 // istanbul ignore if46 if (!(ast && typeof ast === 'object' && ast.type === 'Program')) {47 throw new TypeError('Source must be either a string of JavaScript or an acorn AST');48 }49 var declareFunction = function (node) {50 var fn = node;51 fn.locals = fn.locals || {};52 node.params.forEach(function (node) {53 declarePattern(node, fn);54 });55 if (node.id) {56 fn.locals[node.id.name] = true;57 }58 }59 var declarePattern = function (node, parent) {60 switch (node.type) {61 case 'Identifier':62 parent.locals[node.name] = true;63 break;64 case 'ObjectPattern':65 node.properties.forEach(function (node) {66 declarePattern(node.value, parent);67 });68 break;69 case 'ArrayPattern':70 node.elements.forEach(function (node) {71 if (node) declarePattern(node, parent);72 });73 break;74 case 'RestElement':75 declarePattern(node.argument, parent);76 break;77 case 'AssignmentPattern':78 declarePattern(node.left, parent);79 break;80 // istanbul ignore next81 default:82 throw new Error('Unrecognized pattern type: ' + node.type);83 }84 }85 var declareModuleSpecifier = function (node, parents) {86 ast.locals = ast.locals || {};87 ast.locals[node.local.name] = true;88 }89 walk.ancestor(ast, {90 'VariableDeclaration': function (node, parents) {91 var parent = null;92 for (var i = parents.length - 1; i >= 0 && parent === null; i--) {93 if (node.kind === 'var' ? isScope(parents[i]) : isBlockScope(parents[i])) {94 parent = parents[i];95 }96 }97 parent.locals = parent.locals || {};98 node.declarations.forEach(function (declaration) {99 declarePattern(declaration.id, parent);100 });101 },102 'FunctionDeclaration': function (node, parents) {103 var parent = null;104 for (var i = parents.length - 2; i >= 0 && parent === null; i--) {105 if (isScope(parents[i])) {106 parent = parents[i];107 }108 }109 parent.locals = parent.locals || {};110 parent.locals[node.id.name] = true;111 declareFunction(node);112 },113 'Function': declareFunction,114 'ClassDeclaration': function (node, parents) {115 var parent = null;116 for (var i = parents.length - 2; i >= 0 && parent === null; i--) {117 if (isScope(parents[i])) {118 parent = parents[i];119 }120 }121 parent.locals = parent.locals || {};122 parent.locals[node.id.name] = true;123 },124 'TryStatement': function (node) {125 if (node.handler === null) return;126 node.handler.body.locals = node.handler.body.locals || {};127 node.handler.body.locals[node.handler.param.name] = true;128 },129 'ImportDefaultSpecifier': declareModuleSpecifier,130 'ImportSpecifier': declareModuleSpecifier,131 'ImportNamespaceSpecifier': declareModuleSpecifier132 });133 function identifier(node, parents) {134 var name = node.name;135 if (name === 'undefined') return;136 for (var i = 0; i < parents.length; i++) {137 if (name === 'arguments' && declaresArguments(parents[i])) {138 return;139 }140 if (parents[i].locals && name in parents[i].locals) {141 return;142 }143 }144 if (145 parents[parents.length - 2] &&146 parents[parents.length - 2].type === 'TryStatement' &&147 parents[parents.length - 2].handler &&148 node === parents[parents.length - 2].handler.param149 ) {150 return;151 }152 node.parents = parents;153 globals.push(node);154 }155 walk.ancestor(ast, {156 'VariablePattern': identifier,157 'Identifier': identifier,158 'ThisExpression': function (node, parents) {159 for (var i = 0; i < parents.length; i++) {160 if (declaresThis(parents[i])) {161 return;162 }163 }164 node.parents = parents;165 globals.push(node);166 }167 });168 var groupedGlobals = {};169 globals.forEach(function (node) {170 groupedGlobals[node.name] = (groupedGlobals[node.name] || []);171 groupedGlobals[node.name].push(node);172 });173 return Object.keys(groupedGlobals).sort().map(function (name) {174 return {name: name, nodes: groupedGlobals[name]};175 });...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!