");
}
counter++;
}else if(jQuery(this).attr('id') =="collapse-menu"){
jQuery(this).remove();
}
});
//console.log(checkboxes.replace('<-TOP->','')+"|"+textboxes.replace('<-TOP->',''));
prettyEditMenuPage();
}
function showHideSection(text) {
switch(text)
{
case 'Admin Bar':
jQuery('#section_admin_bar').show();
jQuery('#section_admin_bar .section_title').trigger('focus');
break;
case 'Admin Footer':
jQuery('#section_admin_footer').show();
jQuery('#section_admin_footer .section_title').trigger('focus');
break;
case 'Dashboard Page':
jQuery('#section_dashboard_page').show();
jQuery('#section_dashboard_page .section_title').trigger('focus');
break;
case 'Login Page':
jQuery('#section_login_page').show();
jQuery('#section_login_page .section_title').trigger('focus');
break;
case 'Admin Menu':
jQuery('#section_admin_menu').show();
jQuery('#section_admin_menu .section_title').trigger('focus');
break;
case 'Colorizer':
jQuery('#section_ag_colorizer_settings').show();
jQuery('#section_ag_colorizer_settings .section_title').trigger('focus');
break;
case 'Advanced':
jQuery('#section_advanced').show();
jQuery('#section_advanced .section_title').trigger('focus');
break;
default:
jQuery('#section_admin_bar').show();
jQuery('#section_admin_bar .section_title').trigger('focus');
}
}
function saveCustomScripts(){
var cssValue = jQuery('#agca_script_css').val();
if(cssValue == "")cssValue = " ";
jQuery.ajax({
url: agca_ajax_url,
data: {
data: cssValue,
action: "savecss"
},
type: "POST",
cache: false,
success: function (html) {
var jsValue = jQuery('#agca_script_js').val();
if(jsValue == "")jsValue = " ";
jQuery.ajax({
url: agca_ajax_url,
data: {
data: jsValue,
action: "savejs"
},
type: "POST",
cache: false,
success: function (html) {
savedCustomScripts = true;
jQuery('#agca_form').submit();
}
});
}
});
}
function hideAllSections(){
jQuery('#ag_main_menu li').each(function(){
jQuery(this).attr("class","normal");
});
jQuery('.ag_section').each(function(){
jQuery(this).hide();
});
}
function reloadRemoveButtonEvents(){
}
function createTargetCombo(target,clas){
var combo = ""
combo+= "";
return combo;
}
function exportSettings(){
jQuery('#agca_form').attr('action','tools.php?page=ag-custom-admin/plugin.php');
jQuery('#agca_form #_agca_import_settings').val("false");
jQuery('#agca_form #_agca_export_settings').val("true");
jQuery('#agca_form').submit();
}
function importSettings(){
if(jQuery('#settings_import_file').css("display") == "none"){
jQuery('#settings_import_file').show("slide");
}else{
jQuery('#agca_form').attr('action','tools.php?page=ag-custom-admin/plugin.php');
if(jQuery('#settings_import_file').val() !=""){
jQuery('#agca_form #_agca_import_settings').val("true");
jQuery('#agca_form #_agca_export_settings').val("false");
jQuery('#agca_form').attr('enctype','multipart/form-data');
jQuery('#agca_form').submit();
}else{
alert("File for import is not selected!");
}
}
}
function savePluginSettings(){
jQuery('#import_file_area').remove();
jQuery('#agca_form').submit();
}
jQuery(document).ready(function(){
if(typeof isSettingsImport !== 'undefined'){
if(isSettingsImport){
saveCustomScripts();
//jQuery('#agca_form').submit();
// alert('Settings imported successfuly!');
}
}
jQuery('a.button_remove').live("click", function(){
jQuery(this).parent().parent().remove();
});
jQuery('a.button_edit').live("click", function(){
if(editingButtonNow == false){
var name = jQuery(this).parent().find('button').text();
var url = jQuery(this).parent().find('button').attr('title');
var target = jQuery(this).parent().find('button').attr('target');
//console.log(target);
editingButtonNow = name;
jQuery(this).parent().append('
name:url:' + createTargetCombo(target,"edit")+ '
');
reloadRemoveButtonEvents();
}
});/*Save editing changes*/
jQuery('#ag_add_adminmenu_button_edit').live("click", function(){
//alert(jQuery(this).parent().html());
var name = jQuery('#ag_add_adminmenu_name_edit').val();
var url = jQuery('#ag_add_adminmenu_url_edit').val();
var target = jQuery('select.editTarget').val();
//var target = jQuery(this).parent().find('button').attr('target');
name = name.replace(/["']{1}/gi,"");
url = url.replace(/["']{1}/gi,"");
jQuery('#temporary_button_edit').remove();
var element = 0;
jQuery('#ag_add_adminmenu :button').each(function(){
//dont use first button for adding new buttons
if(element > 0){
if(jQuery(this).html() == editingButtonNow){
jQuery(this).attr('title',url);
jQuery(this).attr('target',target);
jQuery(this).html(name);
}
}
element++;
});
editingButtonNow = false;
});
setTimeout(function(){
jQuery('#agca_advertising').show(),700
});
});
jQuery(document).ready(function(){
/*Add click handler on main buttons*/
jQuery('#ag_main_menu a, #ag_main_menu li').bind('click',function(){
hideAllSections();
var text = jQuery(this).text();
jQuery(this).attr("class","selected");
showHideSection(text);
});
/*Admin Menu Reset all setings button*/
jQuery('#ag_edit_adminmenu_reset_button').click(function(){
afterFormClickCreateJson = false;
jQuery('#agca_form').submit();
});
/*Add new menu item button - creates new HTMl button elements*/
jQuery('#ag_add_adminmenu_button').click(function(){
var name = jQuery('#ag_add_adminmenu_name').val();
var url = jQuery('#ag_add_adminmenu_url').val();
var target = jQuery('#ag_add_adminmenu_target').val();
name = name.replace(/["']{1}/gi,"");
url = url.replace(/["']{1}/gi,"");
jQuery('#ag_add_adminmenu_name').val("");
jQuery('#ag_add_adminmenu_url').val("");
jQuery('#ag_add_adminmenu_target').val("_none");
jQuery('#ag_add_adminmenu').append('