(function() { if (!window.FAE) { window.FAE = new Object(); } FAE.maintenance = false; FAE.cp_rev = '1.4.1'; FAE.raw = 'https://raw.githubusercontent.com/SethClydesdale/forumactif-edge/master/'; FAE.eGIF = 'https://illiweb.com/fa/empty.gif'; FAE.delay = 1000; FAE.cp_lang = {}; // check for [type="color"] support FAE.colorSupport = document.createElement('INPUT'); try { FAE.colorSupport.type = 'color'; FAE.colorSupport = true; } catch (error) { FAE.colorSupport.type = false; } // language list FAE.lang_list = ''; // encode form data to send over AJAX for non-utf8 forums FAE.UTF8 = /UTF-8/i.test(document.characterSet); FAE.Encode = function (object) { if (!FAE.UTF8) { var data = '', val = ['edit_code', 'content', 'template'], match = false, j = val.length, i, k; for (k in object) { match = false; // find and encode the necessary values for (i = 0; i < j; i++) { if (k == val[i]) { object[k] = encodeURIComponent(escape(object[k]).replace(/%u[A-F0-9]{4}/g, function(match) { return '&#' + parseInt(match.substr(2), 16) + ';' })).replace(/%25/g, '%'); match = true; break; } } data += encodeURIComponent(k) + '=' + (match ? object[k] : encodeURIComponent(object[k])) + '&'; } return data.slice(0, data.length - 1); } else { return object; } }; // parse variables in strings for translations FAE.parse_vars = function(str, o) { var i; for (i in o) { str = str.replace(new RegExp(i, 'gm'), o[i]); } return str; }; // function to execute when the DOC is ready FAE.ready = function (fn) { try { var initialized = false, documentReady = function () { if (!initialized && /interactive|complete/.test(document.readyState)) { fn(); initialized = true; } }; documentReady(); if (!initialized) { document.onreadystatechange = documentReady; } } catch (error) { $(fn); } }; // log messages to the logger so the user knows what's going on FAE.logger = document.getElementById('fae_log'); FAE.log = function(str, css) { FAE.logger.insertAdjacentHTML('beforeend', '
' + str + '
'); FAE.logger.scrollTop = 99999; }; // increase size of progress bar FAE.bar = document.getElementById('fae_progress'); FAE.progress = function() { var percent = (FAE.index / FAE.quota * 100).toFixed(2); FAE.bar.innerHTML = '
' + (percent == 100 ? (FAE.cp_lang.fae_install_complete || 'COMPLETE!') : percent + '%') + ''; }; // util for performing manual translations via console using two files FAE.update_translation = function (o) { FAE.log('Getting old translation file...') $.get(o.old_file, function(d) { FAE.script(d.replace('FAE.lang', 'FAE.lang_current')); FAE.log('Getting new translation file...') $.get(o.new_file, function(d) { FAE.log(FAE.cp_lang.fae_translate_loaded || 'Language data has been loaded. The translation process will now begin, please do not close this tab.'); FAE.script(d.replace('FAE.lang', 'FAE.lang_new')); $.get(FAE.raw + 'lang/translate.js', function(d) { FAE.script(d); FAE.next(); }); }); }); }; // get update files and combine their steps into one array for consecutive execution FAE.getUpdates = function() { if (++FAE.update_index >= FAE.update_quota) { FAE.log(FAE.cp_lang.fae_update_start || 'Updates are about to begin, please do not close this tab.'); // get the update utilities and begin the update process $.get(FAE.raw + 'updates/utils.js', function(d) { FAE.script(d); FAE.next(); }); } else { FAE.log(FAE.cp_lang.fae_update_fetch ? FAE.parse_vars(FAE.cp_lang.fae_update_fetch, { '{VERSION_STRING}' : FAE.update_queue[FAE.update_index], '{UPDATE_MIN}' : FAE.update_index + 1, '{UPDATE_MAX}' : FAE.update_queue.length }) : 'Getting update instructions for version ' + FAE.update_queue[FAE.update_index] + '... (' + (FAE.update_index + 1) + '/' + FAE.update_queue.length + ')'); $.get(FAE.raw + 'updates/' + FAE.update_queue[FAE.update_index] + '.js', function(d) { FAE.script(d); FAE.log(FAE.cp_lang.fae_update_notes ? FAE.parse_vars(FAE.cp_lang.fae_update_notes, { '{RELEASE_TAG}' : FAE.update_tag, '{VERSION_STRING}' : FAE.update_queue[FAE.update_index] }) : 'Please Click here to view the changes made in version ' + FAE.update_queue[FAE.update_index] + '.'); FAE.step = FAE.step.concat(FAE.update_step); FAE.getUpdates(); }).error(function() { FAE.log(FAE.cp_lang.fae_update_error ? FAE.parse_vars(FAE.cp_lang.fae_update_error, { '{VERSION_STRING}' : FAE.update_queue[FAE.update_index] }) : 'Update instructions for version ' + FAE.update_queue[FAE.update_index] + ' could not be found. Please open a new issue and provide this information for further assistance.', 'color:#E53;font-weight:bold;'); FAE.getUpdates(); }); } }; // create and execute script FAE.script = function(content) { var script = document.createElement('SCRIPT'); script.type = 'text/javascript'; script.text = content; document.body.appendChild(script); }; // extra cp stylesheet $('head').append( '' ); // stuff that needs to be executed when the doc is ready FAE.ready(function() { var admin = $('a[href^="/admin/"]').not('.mainmenu')[0], // get the AP link so we can fetch the TID founder = _userdata.user_id == 1, installed = document.getElementById('fa_edge'); // only allow the founder to install the theme if (admin && !/page_html\?mode=preview/.test(window.location.href)) { FAE.tid = admin.href.replace(/.*?(&tid=.*)/, '$1'); // cache the tid if (founder) { document.getElementById('fae_actions').style.display = 'block'; // Installation initialization document.getElementById('fae_install').onclick = function() { if (confirm( (FAE.cp_lang.fae_install_warning ? FAE.parse_vars(FAE.cp_lang.fae_install_warning, { '{INSTALL}' : installed ? FAE.cp_lang.fae_reinstall : FAE.cp_lang.fae_install }) : 'Are you sure you want to ' + ( installed ? 're' : '' ) + 'install Forumactif Edge? This will overwrite your current theme and delete your current JavaScripts. \\\n\\\nPlease make sure to backup all your personal content files such as CSS, Templates, and JavaScripts before proceeding. Click "Cancel" if you\'re not ready to install Forumactif Edge.').replace(/\\/g, '') )) { var lang = document.getElementById('fae_install_lang') ? document.getElementById('fae_install_lang').value : FAE.board_lang ? FAE.board_lang : 'English', install = function () { $.get(FAE.raw + 'javascripts/install.js', function(d) { FAE.script(d); FAE.next(); }); }; if (lang != 'English') { FAE.log('Getting English.js...'); $.get(FAE.raw + 'lang/English.js', function(d) { FAE.script(d.replace('FAE.lang', 'FAE.lang_current')); FAE.log('Getting ' + lang + '.js...'); $.get(FAE.raw + 'lang/' + lang + '.js', function(d) { FAE.log('Language data has been loaded. The installation process will now begin.'); FAE.script(d.replace('FAE.lang', 'FAE.lang_new')); FAE.translate = function(o, str) { var i; for (i in o.from) { str = str.replace(new RegExp(o.from[i].replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), 'gm'), o.to[i]); } return str; }; install(); }); }); } else { install(); } document.getElementById('fae_options').style.display = 'none'; } }; } else if (installed) { document.getElementById('fae_actions').style.display = 'block'; } // to prevent errors, make sure that the administration panel is accessible before proceeding. // this check is mainly for forums that have the security option "Confirm password to administration access" enabled $.get('/admin/', function(d) { if (!$('#page-body > #tabs', d)[0]) { FAE.log('Error : You have not logged into your administration panel. Please log in so that you can use the FAE Control Panel. (What is this?)', 'color:#E53;font-weight:bold;'); document.getElementById('fae_options').style.display = 'none'; } }); // extra actions for when the theme is installed. if (installed) { var uninstall = document.getElementById('fae_uninstall'), update = document.getElementById('fae_update'); document.getElementById('fae_install').value = FAE.cp_lang.reinstall || 'Reinstall'; if (founder) { $([uninstall, update]).show(); } // Uninstallation initialization uninstall.onclick = function() { if (confirm( (FAE.cp_lang.fae_uninstall_warning || 'Are you sure you want to uninstall Forumactif Edge? All CSS, JavaScript, and Template changes will be deleted ; The forum will be reverted to the default phpbb3 theme. \\\n\\\nPlease make sure to backup all your personal content files such as CSS, Templates, and JavaScripts before proceeding. Click "Cancel" if you don\'t want to uninstall Forumactif Edge yet.').replace(/\\/g, '') )) { $.get(FAE.raw + 'javascripts/uninstall.js', function(d) { FAE.script(d); FAE.next(); }); document.getElementById('fae_options').style.display = 'none'; } }; // Check for updates update.onclick = function() { FAE.log(FAE.cp_lang.fae_update_check || 'Checking for updates on Github...'); document.getElementById('fae_options').style.display = 'none'; $.get(FAE.raw + 'javascripts/version-data.js', function(d) { FAE.script(d.replace(/forumactif_edge_version_data/, 'fae_github_version_data')); FAE.version_string = d; // save version data for later so we can update the forum version info if (forumactif_edge_version_data.length < fae_github_version_data.length) { FAE.update_queue = fae_github_version_data.slice(forumactif_edge_version_data.length, fae_github_version_data.length); FAE.update_index = -1; FAE.update_quota = FAE.update_queue.length; FAE.log(FAE.update_queue.length + ' update' + ( i == 1 ? '' : 's' ) + ' found.'); FAE.log(FAE.cp_lang.fae_update_prepare || 'Preparing to fetch update instructions, please do not close this tab...'); FAE.step = []; FAE.getUpdates(); } else { FAE.log(FAE.cp_lang.fae_update_good || 'Forumactif Edge is up to date!', 'color:#8B5;font-weight:bold;'); document.getElementById('fae_options').style.display = 'block'; } }); }; // create and insert translation button if (!FAE.board_lang) { FAE.board_lang = 'English'; // set the board lang to English if it is undefined } var opts = document.getElementById('fae_options'), actdiv = $('
'); $('#fae_install, #fae_uninstall, #fae_update').appendTo(actdiv); $(opts).prepend(actdiv); // create and insert the translation action $(opts).append( '
'+ FAE.lang_list+ ''+ '
' ); document.getElementById('fae_selected_language').onchange = function () { var button = document.getElementById('fae_translate'); if (this.value == 'ADD') { button.dataset.original = button.value; button.value = FAE.cp_lang.fae_translate_submit || 'Submit'; } else if (button.dataset.original && button.value != button.dataset.original) { button.value = button.dataset.original; } }; // set the selected translation for (var a = document.getElementById('fae_selected_language').options, i = 0, j = a.length; i < j; i++) { if (FAE.board_lang == a[i].innerHTML) { a[i].selected = true; a[i].id = 'fae_current_language'; a[i].parentNode.insertBefore(a[i], a[0]); a[0].insertAdjacentHTML('afterend', ''); break; } } // function to be executed when the translation button is clicked document.getElementById('fae_translate').onclick = function() { var select = document.getElementById('fae_selected_language'), current = document.getElementById('fae_current_language'), selected = select.options[select.selectedIndex]; if (select.value == 'ADD') { if (confirm(FAE.cp_lang.fae_translate_submit_confirm || 'You have chosen to submit a new translation. If this is correct, please click "OK" and proceed to the translation page, otherwise click "cancel" and choose another language.')) { window.location.href = 'https://github.com/SethClydesdale/forumactif-edge/wiki/Translating#why-isnt-x-language-available-'; } return; } if (FAE.board_lang == selected.innerHTML) { return alert(FAE.cp_lang.fae_translate_same ? FAE.parse_vars(FAE.cp_lang.fae_translate_same, { '{LANG}' : selected.innerHTML }) : 'Forumactif Edge is already in ' + selected.innerHTML + '. Please choose another language.'); } if (confirm(FAE.cp_lang.fae_translate_warning ? FAE.parse_vars(FAE.cp_lang.fae_translate_warning, { '{LANG}' : selected.innerHTML }) : 'Are you sure you want to change the language of Forumactif Edge to ' + selected.innerHTML + ' ?')) { FAE.log(FAE.cp_lang.fae_translate_start || 'Translation of Forumactif Edge will commence shortly. Please wait..'); FAE.log(FAE.cp_lang.fae_translate_get ? FAE.parse_vars(FAE.cp_lang.fae_translate_get, { '{LANG}' : current.innerHTML }) : 'Getting ' + current.innerHTML + ' language data...'); $.get(FAE.raw + 'lang/' + current.value + '.js', function(d) { FAE.log(FAE.cp_lang.fae_translate_get ? FAE.parse_vars(FAE.cp_lang.fae_translate_get, { '{LANG}' : selected.innerHTML }) : 'Getting ' + selected.innerHTML + ' language data...'); FAE.script(d.replace('FAE.lang', 'FAE.lang_current')); $.get(FAE.raw + 'lang/' + selected.value + '.js', function(d) { FAE.log(FAE.cp_lang.fae_translate_loaded || 'Language data has been loaded. The translation process will now begin, please do not close this tab.'); FAE.script(d.replace('FAE.lang', 'FAE.lang_new')); $.get(FAE.raw + 'lang/translate.js', function(d) { FAE.script(d); FAE.next(); }); }); }); document.getElementById('fae_options').style.display = 'none'; } }; // hide actions for non-founders if (!founder) { $('#fae_actions .fae_cp_title, #fae_install, #fae_translation_block').hide(); } // insert category toggle bar $(opts).append( '
Configuration
'+ '

Clicking the buttons below will take you to different sections of the control panel, which allow you to manage the Configuration of Forumactif Edge. Go ahead and explore each of these sections, so you can get started on personalizing your theme. If you need more information, click here to view the control panel guide.

'+ '
'+ ''+ ''+ ''+ ''+ '
' ); $('#fae_cp_navbar input').click(function() { document.querySelector('#fae_options [id^="category-"][style*="block"]').style.display = 'none'; document.querySelector('#fae_cp_navbar [style*="background-color"]').style.backgroundColor = ''; document.getElementById(this.dataset.tab).style.display = 'block'; this.style.backgroundColor = '#8B5'; return false; }); // create and insert general settings $(opts).append('
'+ '
General Settings
'+ '

This section allows you to manage the general settings of Forumactif Edge.

'+ '
'+ '?'+ 'Drag the slider to adjust the width of the forum.'+ ''+ 'Forum width : '+ ' 100%'+ '
'+ '
'+ '?'+ 'Position of the navbar links.'+ ''+ 'Navbar position : '+ ''+ ''+ ''+ '
'+ '
'+ '?'+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ '
'+ '?'+ 'Position of the post profile in topics.'+ ''+ 'Profile position : '+ ''+ ''+ ''+ '
'+ '
'+ ''+ '
'+ '
'); // update the percentage counter document.getElementById('fae_forum_width')[/trident/i.test(window.navigator.userAgent) ? 'onchange' : 'oninput'] = function() { document.getElementById('fae_fw_percent').innerHTML = this.value + '%'; }; // get existing settings from the stylesheet $.get('/admin/?mode=colors&part=themes&sub=logos&tid=' + FAE.tid, function(d) { var form = $('form[method="post"]', d)[0], width, dir; if (form && form.edit_code) { // page width if (/\/\*!FAE_WIDTH\*\/#page-body\{width:\d+%;.*?\}/.test(form.edit_code.value)) { width = form.edit_code.value.match(/\/\*!FAE_WIDTH\*\/#page-body\{width:(\d+)%;.*?\}/)[1]; document.getElementById('fae_forum_width').value = width; document.getElementById('fae_fw_percent').innerHTML = width + '%'; } else { document.getElementById('fae_forum_width').value = 100; document.getElementById('fae_fw_percent').innerHTML = '100%'; } // navbar position if (/\/\*!FAE_NAV_DIR\*\/#navbar\{text-align:.*?\}/.test(form.edit_code.value)) { dir = form.edit_code.value.match(/\/\*!FAE_NAV_DIR\*\/#navbar\{text-align:(.*?)\}/)[1]; document.getElementById('fae_nav_dir-' + dir.toLowerCase()).checked = true; } // logo position if (/\/\*!FAE_LOGO_DIR\*\/#logo-desc\{text-align:.*?\}#logo\{float:.*?\}/.test(form.edit_code.value)) { dir = form.edit_code.value.match(/\/\*!FAE_LOGO_DIR\*\/#logo-desc\{text-align:(.*?)\}#logo\{float:.*?\}/)[1]; document.getElementById('fae_logo_dir-' + dir.toLowerCase()).checked = true; } // profile position if (/\/\*!FAE_PROFIL_DIR\*\/\.postprofile\{float:.*?;.*?\}\.post-inner\{.*?\}/.test(form.edit_code.value)) { dir = form.edit_code.value.match(/\/\*!FAE_PROFIL_DIR\*\/\.postprofile\{float:(.*?);.*?\}\.post-inner\{.*?\}/)[1]; document.getElementById('fae_profil_dir-' + dir.toLowerCase()).checked = true; } else if (/\/\*!FAE_PROFIL_DIR\*\/\.post-inner\{margin:0!important\}/.test(form.edit_code.value)) { document.getElementById('fae_profil_dir-center').checked = true; } } else { FAE.log('CRITICAL ERROR : CSS STYLESHEET NOT FOUND', 'color:#E53;font-weight:bold;'); } }); // update the general settings document.getElementById('fae_update_general').onclick = function() { FAE.log(FAE.cp_lang.general_settings ? FAE.cp_lang.general_settings.fae_gen_updating : 'Updating general settings..'); FAE.quota = 2; FAE.index = 0; FAE.progress(); var width = +document.getElementById('fae_forum_width').value, nav_dir = document.getElementById('fae_nav_dir-left').checked ? 'left' : document.getElementById('fae_nav_dir-center').checked ? 'center' : document.getElementById('fae_nav_dir-right').checked ? 'right' : 'left', logo_dir = document.getElementById('fae_logo_dir-left').checked ? 'left' : document.getElementById('fae_logo_dir-center').checked ? 'center' : document.getElementById('fae_logo_dir-right').checked ? 'right' : 'left', profil_dir = document.getElementById('fae_profil_dir-left').checked ? 'left' : document.getElementById('fae_profil_dir-center').checked ? 'center' : document.getElementById('fae_profil_dir-right').checked ? 'right' : 'left', profil_dir2 = profil_dir == 'left' ? 'right' : 'left', val, form; // assign style rules to variables width = '/*!FAE_WIDTH*/#page-body{width:' + ( width >= 100 ? 'auto;' : width + '%;margin:0 auto;' ) + '}'; nav_dir = '/*!FAE_NAV_DIR*/#navbar{text-align:' + nav_dir + '}'; logo_dir = '/*!FAE_LOGO_DIR*/#logo-desc{text-align:' + logo_dir + '}#logo{float:' + ( logo_dir == 'center' ? 'none' : logo_dir ) + '}'; profil_dir = '/*!FAE_PROFIL_DIR*/' + ( profil_dir == 'center' ? '.post-inner{margin:0!important}.postprofile{width:100%;margin:-10px 0 10px!important;float:none!important}.postprofile dl{width:100%;border:none;border-bottom:1px solid rgba(0,0,0,.2);padding-top:3px}.field-info,.postprofile dt{width:auto}.postprofile dt,.user-avatar{float:left;white-space:nowrap}.postprofile .username{display:inline-block;padding-top:8px}.field-info{float:right;text-align:left}.profile-field .label,.profile-field .value{display:inline}.contact-info{text-align:left;clear:both}.profile-field,.user-avatar{margin:0 3px}.user-avatar img{max-height:100px;max-width:100px}' : '.postprofile{float:' + profil_dir + ';margin-' + profil_dir + ':-300px;margin-' + profil_dir2 + ':0px}.post-inner{margin-' + profil_dir2 + ':0;margin-' + profil_dir + ':300px}' ) + '/*!END_FAE_PROFIL_DIR*/'; // get the stylesheet $.get('/admin/?mode=colors&part=themes&sub=logos&tid=' + FAE.tid, function(d) { form = $('form[method="post"]', d)[0]; FAE.index = 1; FAE.progress(); if (form && form.edit_code) { val = form.edit_code.value; // update stylesheet with new FORUM WIDTH rule if (/\/\*!FAE_WIDTH\*\/#page-body\{.*?\}/.test(form.edit_code.value)) { val = val.replace(/\/\*!FAE_WIDTH\*\/#page-body\{.*?\}/, width); } else { val += '\n' + width; } // update stylesheet with new NAVBAR POSITION rule if (/\/\*!FAE_NAV_DIR\*\/#navbar\{text-align:.*?\}/.test(form.edit_code.value)) { val = val.replace(/\/\*!FAE_NAV_DIR\*\/#navbar\{text-align:.*?\}/, nav_dir); } else { val += '\n' + nav_dir; } // update stylesheet with new LOGO POSITION rule if (/\/\*!FAE_LOGO_DIR\*\/#logo-desc\{text-align:.*?\}#logo\{float:.*?\}/.test(form.edit_code.value)) { val = val.replace(/\/\*!FAE_LOGO_DIR\*\/#logo-desc\{text-align:.*?\}#logo\{float:.*?\}/, logo_dir); } else { val += '\n' + logo_dir; } // update stylesheet with new PROFILE POSITION rule if (/\/\*!FAE_PROFIL_DIR\*\/\.postprofile\{float:.*?;.*?\}\.post-inner\{.*?\}|\/\*!FAE_PROFIL_DIR\*\/.*?\/\*!END_FAE_PROFIL_DIR\*\//.test(form.edit_code.value)) { val = val.replace(/\/\*!FAE_PROFIL_DIR\*\/\.postprofile\{float:.*?;.*?\}\.post-inner\{.*?\}|\/\*!FAE_PROFIL_DIR\*\/.*?\/\*!END_FAE_PROFIL_DIR\*\//, profil_dir); } else { val += '\n' + profil_dir; } // update the stylesheet $.post('/admin/?part=themes&sub=logos&mode=css&extended_admin=1&tid=' + FAE.tid, FAE.Encode({ edit_code : val, submit : 'Save' }), function(d) { FAE.index = 2; FAE.progress(); FAE.log(FAE.cp_lang.general_settings ? FAE.cp_lang.general_settings.fae_gen_updated : 'General settings have been updated successfully !', 'font-weight:bold;color:#8B5;'); FAE.log(FAE.cp_lang.reload_page || 'Please click here to reload the page.'); }); } else { FAE.log('CRITICAL ERROR : CSS STYLESHEET NOT FOUND', 'color:#E53;font-weight:bold;'); } }); document.getElementById('fae_options').style.display = 'none'; }; // create and insert the theme switcher $(opts).append(''); var selector = document.getElementById('fae_selected_color'), picker = document.createElement('INPUT'); picker.id = 'fae_custom_color'; try { picker.type = 'color'; } catch (error) { picker.type = 'text'; } picker.value = '#6699CC'; picker.style.display = 'none'; FAE.custom_color = ['#7AD', '#69C', '#58B', '#369', '#345']; picker.onchange = function () { var val = this.value.toUpperCase(); FAE.custom_color = [ fae_editColor(val, +1), val, fae_editColor(val, -1), fae_editColor(val, -3), fae_editColor(val, 'darken') ]; }; selector.parentNode.appendChild(picker); selector.onchange = function () { var picker = document.getElementById('fae_custom_color'); if (this.value == 'Custom') { picker.style.display = ''; } else { picker.style.display = 'none'; } }; document.getElementById('fae_import_theme').onclick = function() { var select = document.getElementById('fae_selected_theme'), selected = select.options[select.selectedIndex], stylesheet = selected.value + ( document.getElementById('fae_theme_dir_rtl').checked ? '-rtl' : '' ) + ( document.getElementById('fae_theme_min_yes').checked ? '.min' : '' ) + '.css'; if (confirm( (FAE.cp_lang.theme_management ? FAE.parse_vars(FAE.cp_lang.theme_management.fae_import_confirm, { '{THEME_NAME}' : selected.innerHTML }) : 'Are you sure you want to import the theme "' + selected.innerHTML + '" ?\\\n\\\nPlease make sure to back up your current stylesheet if you want to keep it, because it will be overwritten when this new theme is imported. Choose "Cancel" if you\'re not ready to import a new theme.').replace(/\\/g, '') )) { // reset dark mode cookies and clear sessionStorage my_setcookie('fae_light-switch', '', true); my_setcookie('fae_light-switch-mode', '', true); if (window.sessionStorage) { window.sessionStorage.faeLightSwitch = ''; } // theme settings FAE.theme = { name : selected.innerHTML, stylesheet : stylesheet, color : document.getElementById('fae_selected_color').value, dark : /-dark/i.test(stylesheet), rtl : /-rtl/i.test(stylesheet) }; $.get(FAE.raw + 'javascripts/change-theme.js', function(d) { FAE.script(d); FAE.color_palette['Custom'] = FAE.custom_color; FAE.next(); }); document.getElementById('fae_options').style.display = 'none'; } }; // create and insert colors manager $(opts).append(''); // helper function to build our CSS string function fae_compileColors () { // primary colors var p1 = document.getElementById('fae_color-p1').value, p2 = document.getElementById('fae_color-p2').value, p3 = document.getElementById('fae_color-p3').value, p4 = document.getElementById('fae_color-p4').value, p5 = document.getElementById('fae_color-p5').value, // font config f0 = document.getElementById('fae_color-f0').value, f1 = [document.getElementById('fae_color-f1').value], f2 = document.getElementById('fae_color-f2').value, f3 = document.getElementById('fae_color-f3').value, f4 = document.getElementById('fae_color-f4').value, f5 = document.getElementById('fae_color-f5').value, f6 = document.getElementById('fae_color-f6').value, f7 = document.getElementById('fae_color-f7').value, f8 = document.getElementById('fae_color-f8').value, // background colors bg1 = document.getElementById('fae_color-bg1').value, bg2 = document.getElementById('fae_color-bg2').value, bg3 = document.getElementById('fae_color-bg3').value, bg4 = document.getElementById('fae_color-bg4').value, bg5 = document.getElementById('fae_color-bg5').value, bg6 = document.getElementById('fae_color-bg6').value, // misc m1 = document.getElementById('fae_color-m1').value, m2 = document.getElementById('fae_color-m2').value, empty = 'transparent', int; bg1 = bg1 == '#' ? empty : bg1; p1 = p1 == '#' ? empty : p1; p2 = p2 == '#' ? empty : p2; p3 = p3 == '#' ? empty : p3; p4 = p4 == '#' ? empty : p4; m1 = m1 == '#' ? empty : m1; m2 = m2 == '#' ? empty : m2; f1[1] = f1[0].replace(/.*?(\d+).*/, '$1'); f1[2] = f1[0].replace(/.*?([^0-9\.]+).*/, '$1'); return '/*!FAE_COLORS*/\n'+ // primary colors '.color-primary, .title, h2.u, .h3, .inner h1.page-title, .mainmenu:after, .forumline tbody .catHead, form.search-form input.search-keywords, input.search-button, .pagination span a, a.button1, a.button2, button.button2, input.button1, input.button2, input.button, #profile-advanced-add a, img[src*="?poll"], .fa_pseudo_radio:after, #tabs, body div.sceditor-dropdown .button, .codebox dt, blockquote cite, .sceditor-container .sceditor-toolbar, body #fa_toolbar, body #fa_toolbar_hidden, body #fa_toolbar #fa_right #notif_list li.see_all, #fae_sticky_nav_panel a:after, img[src*="color=primary"], .table1 thead th, .breadcrumbs, input[type="button"], input[type="submit"], input[type="reset"], input[type="file"], .forumbg li.header, #chatbox_header, body #chatbox_footer { background-color:/*!FAE_P1*/' + p1 + '/*FAE_P1!*/; }'+ '#cp-main h1:not(.title) { background-color:' + p1 + '; }'+ '.pagination span a:hover, a.button1:hover, a.button2:hover, button.button2:hover, input.button1:hover, input.button2:hover, input.button:hover, #profile-advanced-add a:hover, input.search-button:hover, body div.sceditor-dropdown .button:hover, img[src*="color=primary"]:hover, input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover, input[type="file"]:hover { background-color:/*!FAE_P3*/' + p3 + '/*FAE_P3!*/; }'+ '.pagination span a:active, .pagination span a:focus, .pagination span strong, a.button1:active, a.button2:active, button.button2:active, input.button1:active, input.button2:active, input.button:active, input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]:active, a.button1:focus, a.button2:focus, button.button2:focus, input.button1:focus, input.button2:focus, input.button:focus, input.search-button:focus, #tabs a:after, body div.sceditor-dropdown .button:active, body div.sceditor-dropdown .button:focus, body #fa_search #fa_textarea, body #fa_search #fa_magnifier, img[src*="color=primary"]:active, input[type="button"]:focus, input[type="submit"]:focus, input[type="reset"]:focus, input[type="file"]:focus { background-color:/*!FAE_P4*/' + p4 + '/*FAE_P4!*/; }'+ '.fa_pseudo_checkbox:after, h2.post-content, h3.post-content, h4.post-content, .codebox .fae_copy-code:before { color:' + p1 + '; }'+ 'img[src*="?poll"], .sceditor-container .sceditor-toolbar, .sceditor-container .sceditor-group, body #fa_toolbar, body #fa_toolbar_hidden { border-color:' + p3 + '; }'+ '.color-secondary, .forum-status[style*="locked=true"], img[src*="color=secondary"] { background-color:/*!FAE_P5*/' + ( p5 == '#' ? empty : p5 ) + '/*FAE_P5!*/; }'+ '.forum-status[style*="state=new"] { background-color:/*!FAE_P2*/' + p2 + '/*FAE_P2!*/; }'+ 'form.search-form { background-color:' + p3 + '; }'+ 'form.search-form input.search-keywords, input.search-button { border-color:' + p2 + '!important; }'+ 'input[type="text"]:hover, input.post:hover, input.inputbox:hover, textarea:hover, select:hover, input[type="text"]:focus, input.post:focus, input.inputbox:focus, textarea:focus, select:focus, body div.sceditor-dropdown input:focus, body div.sceditor-dropdown textarea:focus, .fa_pseudo_checkbox:hover, .fa_pseudo_radio:hover, .sceditor-container, h2.post-content, h3.post-content, h4.post-content, .lastpost-avatar, #wio_new_avatar, .avatar-mini img, .avatar, #chatbox, #chatbox_members, #chatbox_members > h4.away, #chatbox_members > ul.away-users, body #chatbox .cb-avatar { border-color:' + p1 + ' !important; }'+ '::selection { background-color:' + p1 + '; } ::-moz-selection { background-color:' + p1 + '; }'+ '::-webkit-scrollbar-thumb, ::-webkit-scrollbar-button:single-button { background-color:' + p1 + '; }'+ '::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-button:single-button:hover { background-color:' + p3 + '; }'+ '::-webkit-scrollbar-thumb:active, ::-webkit-scrollbar-button:single-button:active { background-color:' + p4 + '; }'+ // font config '.color-tertiary, .content-block, .panel, .module, .lor_maintitle, .lor_subtitle, .lor_maindesc, .lor_subdesc, .forum-block, .addthis_button:after, .pagination a[href$="mark=topics"]:after, .pagination a[href$="watch=forum"]:after, input[type="text"], input.inputbox, input.post, textarea, select, body div.sceditor-dropdown input, body div.sceditor-dropdown textarea, body .sceditor-container textarea, html body.chatbox { color:/*!FAE_F0*/' + ( f0 == '#' ? empty : f0 ) + '/*FAE_F0!*/; }'+ 'fieldset dt label, fieldset dt span, fieldset dt { color:' + ( f0 == '#' ? empty : f0 ) + '!important; }'+ 'fieldset dl:hover dt label, fieldset dl:hover dt span, fieldset dl:hover dt { color:' + ( f0 == '#' ? empty : fae_editColor(f0, -3) ) + '!important; }'+ 'a { color:/*!FAE_F5*/' + ( f5 == '#' ? empty : f5 ) + '/*FAE_F5!*/; }'+ 'a:visited { color:/*!FAE_F6*/' + ( f6 == '#' ? empty : f6 ) + '/*FAE_F6!*/; }'+ 'a:hover { color:/*!FAE_F7*/' + ( f7 == '#' ? empty : f7 ) + '/*FAE_F7!*/; }'+ 'a:active { color:/*!FAE_F8*/' + ( f8 == '#' ? empty : f8 ) + '/*FAE_F8!*/; }'+ 'body, #navbar .mainmenu, #tabs a, .forum-category .title, .traffic-exchange .title, .profile-field .label, .profile-field .value, .addthis_button, a[href="javascript:showhide(document.getElementById(\'plus_menu\'))"], #plus_menu, .pagination a[href$="mark=topics"], .pagination a[href$="watch=forum"], a[href="javascript:Pagination();"], .breadcrumbs a { font-size:/*!FAE_F1*/' + f1[0] + '/*FAE_F1!*/; }'+ // 12px '.lor_maintitle, .lor_subtitle { font-size:' + ( f1[1] * 3 + f1[2] ) + '; }'+ // 36px '#site-title, #site-title h1 { font-size:' + ( f1[1] * 2 + f1[2] ) + '; }'+ // 24px '.wio_value strong { font-size:' + ( f1[1] * 1.835 + f1[2] ) + '; }'+ // 22px '.post .post-number, .post .title h2 { font-size:' + ( f1[1] * 1.75 + f1[2] ) + '; }'+ // 21px '.lor_subtitle { font-size:' + ( f1[1] * 1.67 + f1[2] ) + '; }'+ // 20px '.vote .vote-button-plus, .vote .vote-button-minus, .breadcrumbs a:after { font-size:' + ( f1[1] * 1.5 + f1[2] ) + '; }'+ // 18px '.pagination span a, .pagination span strong { font-size:' + ( f1[1] * 1.42 + f1[2] ) + '; }'+ // 17px '.forum-stats .number, input.search-button, .breadcrumbs a:first-child:before, #chatbox_members:after { font-size:' + ( f1[1] * 1.335 + f1[2] ) + '; }'+ // 16px '.forum-category .title:after, .traffic-exchange .title:after, .topic-info .pagination a, form.search-form input.search-keywords { font-size:' + ( f1[1] * 1.25 + f1[2] ) + '; }'+ // 15px '#privmsgs-menu, .codebox dt, blockquote cite, .attachbox > dt, #wio_newest_inner:before, #wio_newest_user strong, #wio_groups a, .pwd_img, .vote_num, a.forumtitle, a.topictitle, .lor_maindesc, .lor_subdesc, #fae_sticky_nav_panel a, .title, h2.u, .h3, .inner h1.page-title, #cp-main h1:not(.title) { font-size:' + ( f1[1] * 1.17 + f1[2] ) + '; }'+ // 14px '.post .content, .wio_stats:after, a.button1, a.button2, button.button2, input.button1, input.button2, input.button, #profile-advanced-add a, body div.sceditor-dropdown .button, input[type="button"], input[type="submit"], input[type="reset"], input[type="file"] { font-size:' + ( f1[1] * 1.085 + f1[2] ) + '; }'+ // 13px 'body, body #fa_toolbar { font-family:/*!FAE_F2*/' + f2 + '/*FAE_F2!*/; }'+ 'h2.post-content, h3.post-content, h4.post-content, #navbar .mainmenu, #tabs a, .title, h2.u, .h3, .inner h1.page-title, #cp-main h1:not(.title) { font-family:/*!FAE_F3*/' + f3 + '/*FAE_F3!*/; }'+ '.codebox code { font-family:/*!FAE_F4*/' + f4 + '/*FAE_F4!*/; }'+ // background colors '.color-tertiary, html body.chatbox, .lor_panel, .jqmWindow, .gallery, .postprofile dl, .module #calendar .table1 td:not([class*="row"]), input[type="text"], input.inputbox, input.post, textarea, select, body div.sceditor-dropdown input, body div.sceditor-dropdown textarea, .fa_pseudo_checkbox, .fa_pseudo_radio, #profile-advanced-details .panel > .inner > ol > li, .lastpost-avatar, .avatar-mini img, .avatar, #wio_new_avatar, body .sceditor-container textarea, .codebox, blockquote, .attachbox, body #chatbox_contextmenu, body #chatbox .cb-avatar, body #chatbox_contextmenu, .info-gallery { background-color:/*!FAE_BG1*/' + bg1 + '/*FAE_BG1!*/; }'+ '.content-block, .panel, .module, .forum-block-inner, #plus_menu, .table1, .forumline { background-color:/*!FAE_BG2*/' + ( bg2 == '#' ? empty : bg2 ) + '/*FAE_BG2!*/; }'+ '.vote .vote-bar, .vote .vote-no-bar, .fa_pseudo_radio:before { background-color:/*!FAE_BG3*/' + ( bg3 == '#' ? empty : bg3 ) + '/*FAE_BG3!*/; }'+ '.forum-status, .forum-status[style*="state=old"], .postprofile dl:before { background-color:/*!FAE_BG4*/' + ( bg4 == '#' ? empty : bg4 ) + '/*FAE_BG4!*/; }'+ '.online .postprofile dl:before, .thanked-post .thanked-message { background-color:/*!FAE_BG5*/' + ( bg5 == '#' ? empty : bg5 ) + '/*FAE_BG5!*/!important; }'+ '.forum-block:hover .forum-block-inner { background-color:/*!FAE_BG6*//*HEX:' + bg6 + '*/' + ( bg6 == '#' ? empty : 'rgba(' + ( [(int = parseInt(bg6.slice(1), 16)) >> 16 & 255, int >> 8 & 255, int & 255].join() ) + ',0.8)' ) + '/*FAE_BG6!*/; }'+ // misc '.content-block, .panel, .module, .lor_panel, .jqmWindow, .gallery, .info-gallery, .postprofile dl, hr, #plus_menu, .forumline, .ucp-main .table1, .forum-block, .table1 tbody td, .forumline tbody td, .forumline tbody th, .module #calendar .table1, .module #calendar .table1 th, input[type="text"], input.inputbox, input.post, textarea, select, body div.sceditor-dropdown input, body div.sceditor-dropdown textarea, .fa_pseudo_checkbox, .fa_pseudo_radio, .codebox, blockquote, .attachbox, #profile-advanced-details .panel > .inner > ol > li, body #fa_menulist, body #fa_toolbar #fa_right #notif_list { border-color:/*!FAE_M1*/' + m1 + '/*FAE_M1!*/; }'+ '#fa_menulist:before, #notif_list:before { border-bottom-color:' + m1 + '; }'+ '::-webkit-scrollbar-track { background-color:/*!FAE_M2*/' + m2 + '/*FAE_M2!*/; }'+ '::-webkit-scrollbar-thumb { border-color:' + m2 + '; }'+ // responsive rules '@media (min-width:0px) and (max-width:768px) {'+ '.postprofile dl { border-bottom:1px solid ' + m1 + '; }'+ '.postbody .profile-icons { background:' + bg1 + '; border-top:1px solid ' + m1 + '; }'+ '}'+ '\n/*FAE_COLORS!*/'; }; // helper function to update preview frame function fae_colorPreview () { var frame = document.getElementById('fae_colors_preview'), head; try { head = $('head', frame.contentDocument || frame.contentWindow.document); $('#fae_stylesheet_preview', head).remove(); head.append(''); } catch (error) { console.log(error); } }; // bind events to color and text inputs for (var a = document.querySelectorAll('.fae_colors input'), i = 0, j = a.length; i < j; i++) { switch (a[i].type) { case 'color' : a[i].onchange = function () { this.nextSibling.value = this.value.toUpperCase(); fae_colorPreview(); }; break; case 'text' : a[i].oninput = function () { if (!this.dataset.ignore) { if (this.value == 0) { this.value = '#'; } this.previousSibling.value = this.value; } fae_colorPreview(); }; break; case 'checkbox' : a[i].onchange = function () { var prev = this.previousSibling; if (!this.checked) { prev.disabled = true; prev.previousSibling.disabled = true; } else { prev.disabled = false; prev.previousSibling.disabled = false; } fae_colorPreview(); }; break; } } // reapply preview when the frame is reloaded document.getElementById('fae_colors_preview').onload = fae_colorPreview; // get existing settings from the stylesheet $.get('/admin/?mode=colors&part=themes&sub=logos&tid=' + FAE.tid, function(d) { var css = $('form[method="post"]', d)[0]; if (css) { css = css.edit_code.value; for (var a = document.querySelectorAll('[id^="fae_color-"]'), i = 0, j = a.length, id, color, input; i < j; i++) { try { id = a[i].id.replace(/fae_color-/, ''); input = document.getElementById('fae_color-' + id); color = css.match(new RegExp('/\\*!FAE_' + id.toUpperCase() + '\\*/([\\s\\S]+)/\\*FAE_' + id.toUpperCase() + '!\\*/'))[1]; input.value = color == 'transparent' ? '#' : color.replace(/\/\*HEX:(.*?)\*\/rgba.*/, '$1'); input.previousSibling.value = input.value; } catch (e) {} } } }); // update the forum's colors $('#fae_save_colors, #fae_default_colors').click(function() { var save = this.id == 'fae_save_colors'; if (save || confirm((FAE.cp_lang.colors && FAE.cp_lang.colors.confirm_update) || 'Are you sure you want to delete your custom color settings, and revert back to the default forum colors?')) { FAE.log(save ? ((FAE.cp_lang.colors && FAE.cp_lang.colors.updating) || 'Updating the forum colors..') : ((FAE.cp_lang.colors && FAE.cp_lang.colors.reverting) || 'Reverting back to default color settings..')); FAE.quota = 2; FAE.index = 0; FAE.progress(); // reset dark mode cookies and clear sessionStorage my_setcookie('fae_light-switch', '', true); my_setcookie('fae_light-switch-mode', '', true); if (window.sessionStorage) { window.sessionStorage.faeLightSwitch = ''; } // get the stylesheet $.get('/admin/?mode=colors&part=themes&sub=logos&tid=' + FAE.tid, function(d) { var form = $('form[method="post"]', d)[0], val, regex; FAE.index = 1; FAE.progress(); if (form && form.edit_code) { val = form.edit_code.value; regex = /\/\*!FAE_COLORS\*\/[\s\S]+\/\*FAE_COLORS!\*\//; if (regex.test(val)) { val = val.replace(regex, ''); } // update the stylesheet $.post('/admin/?part=themes&sub=logos&mode=css&extended_admin=1&tid=' + FAE.tid, FAE.Encode({ edit_code : val + (save ? '\n' + fae_compileColors() : ''), submit : 'Save' }), function(d) { FAE.index = 2; FAE.progress(); FAE.log(save ? ((FAE.cp_lang.colors && FAE.cp_lang.colors.updated) || 'Forum colors have been updated successfully !') : ((FAE.cp_lang.colors && FAE.cp_lang.colors.reverted) || 'Forum colors have been changed back to their default settings !'), 'font-weight:bold;color:#8B5;'); FAE.log(FAE.cp_lang.reload_page || 'Please click here to reload the page.'); }); } else { FAE.log('CRITICAL ERROR : CSS STYLESHEET NOT FOUND', 'color:#E53;font-weight:bold;'); } }); document.getElementById('fae_options').style.display = 'none'; } }); // create and insert the plugin manager $(opts).append(''); // get existing settings from ALL.JS $.get('/admin/?mode=js&part=modules&sub=html&tid=' + FAE.tid, function (d) { for (var row = $('#listJs tr', d), i = 0, j = row.length, regex = /\[FA EDGE\] ALL\.JS/, all; i < j; i++) { if (regex.test(row[i].innerHTML)) { all = $('a', row[i])[1].href; break; } } if (all) { $.get(all, function (d) { var form = $('#formenvoi', d)[0], js; if (form) { js = form.content.value; document.getElementById('fae_qnp_' + (/position : 'right'/.test(js) ? 'right' : 'left')).checked = true; document.getElementById('fae_qns_' + (/alwaysVisible : true,/.test(js) ? 'yes' : 'no')).checked = true; } }); } }); // build theme color manager function fae_compileThemes (msg, obj, init) { var opts = document.getElementById('fae_theme_options'), html = '', k, c; opts.innerHTML = msg; if (init) { window.fae_themeList = ''; } for (k in obj) { if (obj[k].length == 5 && k != FAE.cp_custom_theme) { c = obj[k][1]; html += '
'; } else if (init) { fae_themeList += '"' + k + '" : [' + ( obj[k].length == 5 ? "cc ? fae_editColor(cc, +1) : '#77AADD', cc || '#6699CC', cc ? fae_editColor(cc, -1) : '#5588BB', cc ? fae_editColor(cc, -3) : '#336699', cc ? fae_editColor(cc, 'darken') : '#334455'" : '' ) + '],\n'; } } opts.innerHTML = html; }; // add a new random theme document.getElementById('fae_themer_add').onclick = function () { var hex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'], opts = document.getElementById('fae_theme_options'), i = 0, color = '#'; while (i < 6) { color += hex[Math.floor(Math.random() * hex.length)]; i++ } opts.insertAdjacentHTML('beforeend', '
'); opts.scrollTop = opts.lastChild.offsetTop - 16; }; // theme option events $(document).on('click', '.theme_opt .fa', function (e) { var that = e.target, opts = document.getElementById('fae_theme_options'), next; switch (that.className) { case 'fa fa-times' : opts.removeChild(that.parentNode); break; case 'fa fa-sort-up' : opts.insertBefore(that.parentNode, that.parentNode.previousSibling); break; case 'fa fa-sort-desc' : next = that.parentNode.nextSibling.nextSibling; next ? opts.insertBefore(that.parentNode, next) : opts.appendChild(that.parentNode); break; } if (that && that.parentNode) { opts.scrollTop = that.parentNode.offsetTop - 16; } }); // import default themes document.getElementById('fae_themer_import').onclick = function () { if (confirm((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_import_confirm) || 'Do you want to import the default theme list from Github ?')) { var that = this; that.disabled = true; document.getElementById('fae_theme_options').innerHTML = (FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_importing) || 'Contacting Github, please wait...'; $.get(FAE.raw + 'javascripts/in-all-the-pages/all.js', function(d) { FAE.script( 'fae_default_themes = {' + d.match(/palette : {[\s\S]*?'.*?' : \[\],[\s\S]*?'.*?' : \[\],([\s\S]*?)}/)[1] + '}' ); fae_compileThemes((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_import_compiling) || 'Compiling themes, please wait...', fae_default_themes); }); window.setTimeout(function() { that.disabled = false; }, 10000); } }; // submit plugin settings on click document.getElementById('fae_save_plugins').onclick = function () { var qnp = document.getElementById('fae_qnp_right').checked ? 'right' : 'left', qns = document.getElementById('fae_qns_yes').checked ? true : false; FAE.log((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_finding_plugins) || 'Locating [FA EDGE] ALL.JS...'); FAE.quota = 3; FAE.index = 0; FAE.progress(); $.get('/admin/?mode=js&part=modules&sub=html&tid=' + FAE.tid, function (d) { for (var row = $('#listJs tr', d), i = 0, j = row.length, regex = /\[FA EDGE\] ALL\.JS/, all; i < j; i++) { if (regex.test(row[i].innerHTML)) { all = $('a', row[i])[1].href; break; } } if (all) { FAE.log((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_plugins_found) || '[FA EDGE] ALL.JS found !'); FAE.log((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_getting_plugins) || 'Getting [FA EDGE] ALL.JS...'); FAE.index = 1; FAE.progress(); $.get(all, function (d) { var form = $('#formenvoi', d)[0]; if (form) { FAE.log((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_updating_plugins) || 'Updating your plugins...'); FAE.index = 2; FAE.progress(); for (var a = document.querySelectorAll('.theme_opt'), i = 0, j = a.length, input, val; i < j; i ++) { input = a[i].getElementsByTagName('INPUT'); val = input[0].value; fae_themeList += '"' + input[1].value + '" : ["' + ( fae_editColor(val, +1) + '", "' + val + '", "' + fae_editColor(val, -1) + '", "' + fae_editColor(val, -3) + '", "' + fae_editColor(val, 'darken') ) + '"]' + (i + 1 == j ? '' : ',') + '\n'; } $.post(form.action, FAE.Encode({ title : '[FA EDGE] ALL.JS', 'js_placement[]' : 'allpages', content : form.content.value .replace(/position : '.*?'/, "position : '" + qnp + "'") // quick nav position .replace(/alwaysVisible : .*?,/, "alwaysVisible : " + qns + ",") // quick nav visibility .replace(/palette : {[\s\S]*?}/, 'palette : {\n' + fae_themeList + '\n}'), // theme selector mode : 'save', page : form.page.value, submit : 'Submit' }), function (d) { FAE.log((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_plugins_updated) || 'Plugins have been updated successfully !', 'font-weight:bold;color:#8B5;'); FAE.log(FAE.cp_lang.reload_page || 'Please click here to reload the page.'); FAE.index = 3; FAE.progress(); }); } }); } }); document.getElementById('fae_options').style.display = 'none'; }; // setup and begin translation of control panel $.get(FAE.raw + 'lang/' + document.getElementById('fae_selected_language').value + '.js', function(d) { FAE.script(d.replace('FAE.lang', 'FAE.cp_lang')); FAE.cp_custom_theme = FAE.cp_lang.javascripts['[FA EDGE] ALL.JS'].custom_theme || 'Custom theme'; fae_compileThemes((FAE.cp_lang.plugin_management && FAE.cp_lang.plugin_management.fae_import_compiling) || 'Compiling themes, please wait...', window.fa_theme_color ? fa_theme_color.palette : {}, true); FAE.cp_lang = FAE.cp_lang.fae_cp; var cp = document.getElementById('fae_cp'), title = $('.fae_cp_title', cp), a, i, j; // WELCOME MESSAGES FAE.log(FAE.cp_lang.welcome_message || 'Welcome to the FAE Control Panel! The FAE CP will allow you to install, update, translate, and customize Forumactif Edge. To learn more about using the FAE CP, it is recommended that you read over the Control Panel Guide on the Github wiki.'); if (!founder && !installed) { FAE.log(FAE.cp_lang.fae_err_not_founder || 'Only the founder can access the installation action. Please contact them for assistance for installing Forumactif Edge.', 'color:#E53;font-weight:bold;'); } else if (!founder) { FAE.log(FAE.cp_lang.co_admin || 'Only the founder can access the installation, update, and translation actions. Since Forumactif Edge is installed, you can still access some core features for personalizing your forum via the "Configuration" section below.', 'color:#C93;font-weight:bold;'); } // AUTOMATIC VERSION CHECK $.get(FAE.raw + 'javascripts/version-data.js', function (d) { try { var local = 'v' + forumactif_edge_version_data[forumactif_edge_version_data.length - 1], github = 'v' + d.replace(/[\s\S]*?'(.*?)'[^,][\s\S]*/, '$1'), equal = local == github; FAE.log('
'); // add separation // log local version FAE.log(FAE.cp_lang.auto_version_local ? FAE.parse_vars(FAE.cp_lang.auto_version_local, { '{VERSION_STRING}' : local }) : 'Your installed version of Forumactif Edge is ' + local + '.'); // log latest github version FAE.log(FAE.cp_lang.auto_version_github ? FAE.parse_vars(FAE.cp_lang.auto_version_github, { '{VERSION_STRING}' : github }) : 'The current release of Forumactif Edge on Github is ' + github + '.'); // log version status FAE.log( equal ? (FAE.cp_lang.fae_update_good || 'Forumactif Edge is up to date!') : (FAE.cp_lang.update_waiting || 'There are updates available for Foruactif Edge. Check out the wiki for more information about updating.'), 'color:' + ( equal ? '#8B5' : '#C93' ) + ';font-weight:bold;' ); // log release list FAE.log(FAE.cp_lang.release_list || 'Click here to see the full list of releases for Forumactif Edge.'); FAE.log('
'); // add separation // in the event the version data cannot be found } catch (error) { FAE.log('
'); FAE.log(error, 'color:#E53;font-weight:bold;'); FAE.log('An error has occurred while trying to retrieve Forumactif Edge\'s version data. Please make sure JS Codes Management is enabled. If it is please open a new issue and provide this information for further assistance.', 'color:#E53;font-weight:bold;'); // hide tools to prevent further errors document.getElementById('fae_actions').style.display = 'none'; } }); // MAIN CP TRANSLATION document.getElementById('fae_cp_main_title').innerHTML = FAE.cp_lang.fae_cp_main_title; document.getElementById('fae_cp_desc').innerHTML = FAE.cp_lang.fae_cp_desc; document.getElementById('fae_cp_help').innerHTML = FAE.cp_lang.help; document.getElementById('fae_install').value = installed ? FAE.cp_lang.fae_reinstall : FAE.cp_lang.fae_install; document.getElementById('fae_uninstall').value = FAE.cp_lang.fae_uninstall; document.getElementById('fae_update').value = FAE.cp_lang.fae_update; document.getElementById('fae_translate').value = FAE.cp_lang.fae_translate; document.getElementById('translate_submit_option').innerHTML = FAE.cp_lang.fae_translate_submit_option || 'Submit a New Translation'; if (FAE.cp_lang.configuration_title && FAE.cp_lang.configuration_desc) { document.getElementById('fae_title-configuration').innerHTML = FAE.cp_lang.configuration_title; document.getElementById('fae_nav_desc').innerHTML = FAE.cp_lang.configuration_desc; } // TITLES AND TABS title[0].innerHTML = FAE.cp_lang.fae_log; title[1].innerHTML = FAE.cp_lang.fae_actions; var general = document.getElementById('fae_title-general_settings'), theme = document.getElementById('fae_title-theme_management'), colors = document.getElementById('fae_title-colors'), plugin = document.getElementById('fae_title-plugin_management'); general.innerHTML = FAE.cp_lang.general_settings.title || 'General Settings'; document.getElementById('faetab-general-settings').value = general.innerHTML; theme.innerHTML = FAE.cp_lang.theme_management.title || 'Theme Management'; document.getElementById('faetab-theme-management').value = theme.innerHTML; if (FAE.cp_lang.colors) { colors.innerHTML = FAE.cp_lang.colors.title || 'Colors'; document.getElementById('faetab-colors').value = colors.innerHTML; } if (FAE.cp_lang.plugin_management) { plugin.innerHTML = FAE.cp_lang.plugin_management.title || 'Plugin Management'; document.getElementById('faetab-plugin-management').value = plugin.innerHTML; } // LABELS for (a = $('label', cp), i = 0, j = a.length; i < j; i++) { a[i].innerHTML = a[i].innerHTML.replace(/\s\w+$/, FAE.cp_lang[$(a[i]).text().toLowerCase().slice(1)]); } // GENERAL SETTINGS for (i in FAE.cp_lang.general_settings) { a = document.getElementById(i); if (a) { a[a.tagName == 'INPUT' ? 'value' : 'innerHTML'] = FAE.cp_lang.general_settings[i]; } } // COLORS if (FAE.cp_lang.colors) { for (i in FAE.cp_lang.colors) { a = document.getElementById(i); if (a) { a[a.tagName == 'INPUT' ? 'value' : 'innerHTML'] = FAE.cp_lang.colors[i]; } } } // THEME MANAGEMENT for (i in FAE.cp_lang.theme_management) { a = document.getElementById(i); if (a) { a[a.tagName == 'INPUT' ? 'value' : 'innerHTML'] = FAE.cp_lang.theme_management[i]; } } // PLUGIN MANAGEMENT if (FAE.cp_lang.plugin_management) { for (i in FAE.cp_lang.plugin_management) { a = document.getElementById(i); if (a) { a[a.tagName == 'INPUT' ? 'value' : 'innerHTML'] = FAE.cp_lang.plugin_management[i]; } } } }); // Adjusts the CP styles to reflect the selected theme try { var css = document.querySelector('#main-content > style').sheet; css.cssRules[2].style.background = ''; css.cssRules[3].style.background = ''; css.cssRules[3].style.border = ''; css.cssRules[3].style.color = ''; css.cssRules[5].style.background = ''; css.cssRules[5].style.border = ''; css.cssRules[6].style.background = 'rgba(0, 0, 0, 0.2)'; css.cssRules[7].style.background = ''; css.deleteRule(4); css = document.getElementById('fae_cp_css').sheet; css.cssRules[2].style.background = ''; css.cssRules[7].style.background = 'rgba(0, 0, 0, 0.04)'; css.cssRules[7].style.border = ''; css.cssRules[7].style.color = ''; css.cssRules[19].style.border = ''; css.cssRules[22].style.background = ''; css.cssRules[22].style.border = ''; css.cssRules[22].style.color = ''; css.deleteRule(21); css.deleteRule(9); document.getElementById('fae_cp').className = 'content-block'; document.getElementById('fae_log').className = 'content-block'; document.getElementById('fae_progress').className = 'content-block'; document.getElementById('fae_theme_options').className = 'content-block'; for (var a = document.querySelectorAll('.fae_cp_title, .fae_help_me'), i = 0, j = a.length; i < j; i++) { a[i].className += ' color-primary'; } } catch (e) {} // add installation options if not installed } else { $('#fae_options').append( '
Install Options
'+ '

Use the options below to configure the installation of Forumactif Edge.

'+ '
'+ '?'+ 'The install lanugage of Forumactif Edge. This can be changed at anytime after installation.'+ ''+ 'Language : '+ FAE.lang_list .replace(/id=".*?"/, 'id="fae_install_lang"') .replace('value="English"', 'value="English" selected') .replace('', '')+ '
' ); } } else if (/page_html\?mode=preview/.test(window.location.href)) { FAE.log(FAE.cp_lang.fae_err_no_preview || 'The Forumactif Edge Control Panel cannot be used in preview mode. Please go to Admin Panel > Modules > HTML pages management and click the magnifying glass () for this page once you\'ve saved it.', 'color:#E53;font-weight:bold;'); } }); // help link and version $('#fae_cp').append( '
'+ 'faecp-v' + FAE.cp_rev + ''+ 'Help!'+ '
'+ '
' ); // maintenance message if (FAE.maintenance) { $('#fae_cp').prepend('
Maintenance is currently being performed on the Control Panel. Don\'t worry if you notice anything strange, we\'ll get things back to normal shortly. For more information, please read about "Maintenance" on our wiki.
'); } // warning when leaving a page during an operation window.onbeforeunload = function () { var progress = document.getElementById('fae_prog_bar'); if (progress && !/100/.test(progress.style.width)) { return 'Are you sure you want to leave the page? Your changes may be lost.'; } } }()); function fae_editColor (str, op) { var letter = { 'F' : 15, 'E' : 14, 'D' : 13, 'C' : 12, 'B' : 11, 'A' : 10 }, hex = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'], neg = [0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6]; str = str.toUpperCase().split(''); for (var i = 1; i < 7; i++) { if (letter[str[i]]) { str[i] = letter[str[i]]; } else { str[i] = +str[i]; } if (op == 'darken') { str[i] = neg[str[i]]; } else { str[i] += op; } if (str[i] > 15) { str[i] = 15; } else if (str[i] < 0) { str[i] = 0; } str[i] = hex[str[i]]; } return str.join(''); };