Dashboard
PHP:
8.0.30
OS:
Linux
User:
hoozgot
/
/
home
/
hoozgot
/
www
/
hoozgot
/
wp-content
/
plugins
/
hoozgot
📤 Upload
📝 New File
📁 New Folder
Close
Editing: jQuery.functions.php
<!--begin jQuery--> <script type="text/javascript"> jQuery(document).ready(function() { //function function toUpper(obj) { var mystring = obj.value; var sp = mystring.split(' '); var wl=0; var f ,r; var word = new Array(); for (i = 0 ; i < sp.length ; i ++ ) { f = sp[i].substring(0,1).toUpperCase(); r = sp[i].substring(1).toLowerCase(); word[i] = f+r; } newstring = word.join(' '); obj.value = newstring; return true; } function nl2brStr(input_string){ return input_string.replace(/(\r\n|\r|\n)/g, '<br />'); } // ARRAYS tablearray = [<?php echo getArrayContent($table_names); ?>]; //tables refArray = new Array(); refArray[0] = new Array(<?php echo getTableContents($table_names[0],'type_name'); ?>); refArray[1] = new Array(<?php echo getTableContents($table_names[1],'subtype_name'); ?>); refArray[2] = new Array(<?php echo getTableContents($table_names[2],'brand_name'); ?>); refArray[3] = new Array(<?php echo getTableContents($table_names[3],'model_name'); ?>); refArray[4] = new Array(<?php echo getTableContents($table_names[4],'year_name'); ?>); refArray[5] = new Array(<?php echo getTableContents($table_names[5],'color_name'); ?>); // jQuery.each(tablearray, function(index, value) { // select lists jQuery('#select-' + value).change(function() { jQuery("#select-" + value +" option:selected").each(function () { str = jQuery(this).text(); }); if(str == "<?php _e('> Other ?'); ?>"){ jQuery("#new-" + value).fadeIn('slow', function() {}); jQuery("#div-" + tablearray[index+1]).fadeOut('slow', function() {}); jQuery("#new-" + value+" .newInput").val(""); // insert empty field jQuery("#no").hide(10, function() {}); jQuery("#yes").hide(10, function() {}); for(indexi=0;indexi<10;indexi++){ if(indexi>index){ jQuery("#div-" + tablearray[indexi]).fadeOut('slow', function() {}); jQuery("#select-" + tablearray[indexi]).val('<?php _e('Choose from list'); ?>'); } } } else if(str != "<?php _e('Choose from list'); ?>"){ jQuery("#div-" + tablearray[index+1]).fadeIn('slow', function() {}); jQuery("#new-" + value).fadeOut('slow', function() {}); jQuery("#error-" + value).fadeOut('slow', function() {}); } else { jQuery("#new-" + value).fadeOut('slow', function() {}); for(indexi=0;indexi<10;indexi++){ if(indexi>index){ jQuery("#div-" + tablearray[indexi]).fadeOut('slow', function() {}); jQuery("#select-" + tablearray[indexi]).val('<?php _e('Choose from list'); ?>'); } } } }); jQuery('#select-' + value).change(); // text boxes jQuery('#text-' + value).change(function() { jQuery("#div-" + tablearray[index+1]).fadeIn('slow', function() {}); }); // add new jQuery('#new-'+ value +' .newInput').keyup(function() { toBchecked = jQuery('#new-'+ value +' .newInput').val(); checkArray = refArray[index]; checkOK = jQuery.inArray(toBchecked, checkArray); if(checkOK >= 0 && toBchecked !=''){ jQuery('.submitContinue-'+value).hide(10, function() {}); jQuery('#error-'+value).text("<?php _e('Name already in database.'); ?>"); jQuery("#no-"+value).show(10, function() {}); jQuery("#yes-"+value).hide(10, function() {}); jQuery("#"+value+"-submittedByUser").val(''); } else { returnval = toUpper(this); jQuery('#error-'+value).text(""); jQuery('.submitContinue-'+value).show(10, function() {}); jQuery("#yes-"+value).show(10, function() {}); jQuery("#no-"+value).hide(10, function() {}); submittedByUser = '<?php echo $current_user->ID; ?>'; jQuery("#"+value+"-submittedByUser").val(submittedByUser); } });// end add new //submit & continue /*jQuery('.submitContinue-'+value).click(function() { jQuery.post("<?php echo plugins_url(); ?>/gear/gear.submit.newname.php", { table: value, name: toBchecked }, function(data){ jQuery('#error-'+value ).html( data ); jQuery('#select-' + value).replaceWith(<?php listNames($tName); ?> ); } ); });*/ jQuery('.submitContinue-'+value).hover(function() { jQuery(this).addClass("hilite"); }, function () { jQuery(this).removeClass("hilite"); }); });// end each //type jQuery('#select-<?php echo $table_names[0]; ?>').change(function() { }); // subtype jQuery('#select-<?php echo $table_names[1]; ?>').change(function() { jQuery("#select-<?php echo $table_names[1]; ?> option:selected").each(function () { str = jQuery(this).text(); }); if(str == "<?php _e('> Other ?'); ?>"){ type_id = jQuery('#select-<?php echo $table_names[0]; ?> option:selected').val(); } else { type_id = ''; } jQuery("#<?php echo $table_names[1]; ?>-type_id").val(type_id); }); // brand jQuery('#select-<?php echo $table_names[2]; ?>').change(function() { jQuery("#select-<?php echo $table_names[2]; ?> option:selected").each(function () { str = jQuery(this).text(); }); if(str == "<?php _e('> Other ?'); ?>"){ type_id = jQuery('#select-<?php echo $table_names[0]; ?> option:selected').val(); subtype_id = jQuery('#select-<?php echo $table_names[1]; ?> option:selected').val(); } else { type_id = subtype_id = ''; } jQuery("#<?php echo $table_names[2]; ?>-type_id").val(type_id); jQuery("#<?php echo $table_names[2]; ?>-subtype_id").val(subtype_id); }); // model jQuery('#select-<?php echo $table_names[3]; ?>').change(function() { jQuery("#select-<?php echo $table_names[3]; ?> option:selected").each(function () { str = jQuery(this).text(); }); if(str == "<?php _e('> Other ?'); ?>"){ type_id = jQuery('#select-<?php echo $table_names[0]; ?> option:selected').val(); subtype_id = jQuery('#select-<?php echo $table_names[1]; ?> option:selected').val(); brand_id = jQuery('#select-<?php echo $table_names[2]; ?> option:selected').val(); } else { type_id = subtype_id = brand_id = ''; } jQuery("#<?php echo $table_names[3]; ?>-type_id").val(type_id); jQuery("#<?php echo $table_names[3]; ?>-subtype_id").val(subtype_id); jQuery("#<?php echo $table_names[3]; ?>-brand_id").val(brand_id); }); // color jQuery('#select-<?php echo $table_names[5]; ?>').change(function() { jQuery("#select-<?php echo $table_names[5]; ?> option:selected").each(function () { str = jQuery(this).text(); }); if(str == "<?php _e('> Other ?'); ?>"){ type_id = jQuery('#select-<?php echo $table_names[0]; ?> option:selected').val(); subtype_id = jQuery('#select-<?php echo $table_names[1]; ?> option:selected').val(); brand_id = jQuery('#select-<?php echo $table_names[2]; ?> option:selected').val(); } else { type_id = subtype_id = brand_id = ''; } jQuery("#<?php echo $table_names[5]; ?>-type_id").val(type_id); jQuery("#<?php echo $table_names[5]; ?>-subtype_id").val(subtype_id); jQuery("#<?php echo $table_names[5]; ?>-brand_id").val(brand_id); }); // gear jQuery('#text-<?php echo $table_names[6]; ?>').keyup(function() { type_id = jQuery('#select-<?php echo $table_names[0]; ?> option:selected').val(); subtype_id = jQuery('#select-<?php echo $table_names[1]; ?> option:selected').val(); brand_id = jQuery('#select-<?php echo $table_names[2]; ?> option:selected').val(); model_id = jQuery('#select-<?php echo $table_names[3]; ?> option:selected').val(); year_id = jQuery('#select-<?php echo $table_names[5]; ?> option:selected').val(); color_id = jQuery('#select-<?php echo $table_names[4]; ?> option:selected').val(); creation_date = ''; jQuery("#<?php echo $table_names[6]; ?>-type_id").val(type_id); jQuery("#<?php echo $table_names[6]; ?>-subtype_id").val(subtype_id); jQuery("#<?php echo $table_names[6]; ?>-brand_id").val(brand_id); jQuery("#<?php echo $table_names[6]; ?>-model_id").val(model_id); jQuery("#<?php echo $table_names[6]; ?>-color_id").val(color_id); jQuery("#<?php echo $table_names[6]; ?>-year_id").val(year_id); jQuery("#<?php echo $table_names[6]; ?>-creation_date").val(creation_date); submittedByUser = '<?php echo $current_user->ID; ?>'; jQuery("#<?php echo $table_names[6]; ?>-submittedByUser").val(submittedByUser); }); });// end doc ready </script> <!--end jQuery-->
Save
Cancel