!window.FAM && (function() {
'use strict';
window.FAM = {
// General Configuration of Forumactif Messenger
// See : https://github.com/SethClydesdale/forumactif-messenger/wiki/Config
config : {
chat_page : '',
chat_permission : 'all',
main_title : 'Select a Group',
embed : '',
update_channel : 'production',
tabs : true,
initial_tabs : [],
refresh : 7500,
timeout : 10*60*1000,
flood_control : 5000,
max_attachments : 10,
ignore_announcements : false,
ignore_firstpost : true,
hide_menu_avatar : false,
sound_notif_auto_enabled : false,
sound_notif_file : 'http://illiweb.com/fa/fdf/zelda.mono.mp3',
no_avatar : 'https://illiweb.com/fa/invision/pp-blank-thumb.png',
no_name : 'Anonymous',
lang : {
loading : 'Loading...',
idle : 'Forumactif Messenger has fallen asleep due to inactivity. Click here to start chatting again.',
message_notif_singular : '$N new message',
message_notif_plural : '$N new messages',
new_messages : 'New Messages',
new_topic : 'New topic',
start_topic : 'Start topic',
msg_placeholder : 'Enter message',
title_placeholder : 'Topic title',
not_found : 'No forums or topics could be found.',
not_found_offline : 'You may need to login or register to view this forum.',
load_older : 'Load older messages',
delete_message : 'Are you sure you want to delete this message?',
actions_error : 'An error occurred while retreiving the message.',
topic_no_subject : 'You must specify a subject for your topic.',
topic_no_message : 'You must enter a message when submitting a new topic.',
no_tabs_title : 'Open a new tab',
no_tabs : 'Uh-oh! You have no tabs opened! Click here to open a new one.',
no_tabs_initial : 'Would you like to open the initial startup tabs?',
login_username : 'Username',
login_password : 'Password',
login_auto : 'Log in automatically : ',
login_sign_in : 'Sign in',
login_forgot : 'I forgot my password.',
login_error : 'You have specified an invalid username or password.',
login_logged_in : 'You are already logged into an account on this forum. Click here to view your profile or click here to return to the index.',
profile_posts : 'Posts : ',
profile_PMs : 'PMs : ',
profile_reputation : 'Reputation : ',
profile_sign_out : 'Sign out',
profile_confirm_sign_out : 'Are you sure you want to sign out?',
profile_logged_out : 'You must be logged in to view your profile. Click here to log in or click here to return to the index.',
profile_my_topics : 'View your topics',
profile_my_posts : 'View your posts',
profile_mark_read : 'Mark all forums read',
profile_confirm_mark_read : 'This will mark all the forums and their topics read. Do you want to continue?',
profile_forums_marked : 'All the forums and topics have successfully been marked read.',
profile_delete_cookies : 'Delete the forum cookies',
profile_confirm_delete_cookies : 'This will delete all the cookies for the forum and log you out. Do you want to continue?',
profile_cookies_deleted : 'All cookies for the forum have been deleted.',
about_releases : 'Releases',
about_latest : 'Latest Release',
about_sync : 'Sync',
about_update : 'Update',
about_updated : 'Forumactif Messenger is up to date!',
about_new_update : 'A new version of Forumactif Messenger is available!',
about_update_info : 'Replace your current Forumactif Messenger script with the one below.
It should be applied in Admin Panel > Modules > JavaScript codes management.',
about_help : 'How to Update',
about_bug : 'Report Bug',
settings_fullscreen : 'Full Screen : ',
settings_width : 'Window Width : ',
settings_height : 'Window Height : ',
settings_color : 'Theme Color : ',
settings_color_reset : 'This will reset the primary color to the theme\'s default. Do you want to continue?',
settings_theme : 'Theme : ',
settings_theme_default : 'Messenger Light (Default)',
settings_theme_dark : 'Messenger Dark',
settings_sound_notif : 'Sound Notification : ',
settings_default : 'Reset Default Settings',
settings_default_confirm : 'Are you sure you want to restore Forumactif Messenger\'s default settings? Your personal settings will be lost.',
settings_guide : 'View Settings Guide',
settings_admin : 'Admin Configuration',
settings_title_window : 'Window Settings',
settings_title_themes : 'Theme Settings',
settings_title_notifications : 'Notification Settings',
config_title_general : 'General',
config_title_tabs : 'Tabs',
config_title_limits : 'Limitations',
config_title_exclude : 'Exclusion',
config_title_notifications : 'Notifications',
config_title_placeholders : 'Placeholders',
config_title_lang : 'Language',
config_chat_page : 'Chat Page : ',
config_chat_permission : 'Chat Permission : ',
config_permission_all : 'all',
config_permission_member : 'member',
config_permission_staff : 'staff',
config_main_title : 'Main Title : ',
config_embed : 'Embed Container : ',
config_update_channel : 'Update Channel : ',
config_channel_production : 'production (stable)',
config_channel_developer : 'developer (beta)',
config_tabs : 'Enable Tabs : ',
config_initial_tabs : 'Initial Tabs : ',
config_remove_tab : 'You are about to delete this tab. Do you want to continue?',
config_refresh : 'Refresh Rate : ',
config_timeout : 'Chat Timeout : ',
config_flood_control : 'Flood Control : ',
config_max_attachments : 'Max Attachments : ',
config_ignore_announcements : 'Exclude Announcements : ',
config_ignore_firstpost : 'Exclude First Post : ',
config_hide_menu_avatar : 'Hide Menu Avatar : ',
config_sound_notif_auto_enabled : 'Auto-Enable Sound Notification : ',
config_sound_notif_file : 'Sound Notification File : ',
config_no_avatar : 'No Avatar Placeholder : ',
config_no_name : 'No Name Placeholder : ',
config_update : 'Update Configuration',
config_toggle_lang : 'Toggle Language Data',
config_import_lang : 'Import Language : ',
config_import_lang_select : 'Select a Language Pack',
config_import_lang_confirm : 'You are about to import the $LANG language pack for Forumactif Messenger. Do you want to continue?',
config_import_lang_success : 'The $LANG language pack has been imported successfully.',
config_export_lang : 'Export Language Data',
config_export_lang_success : 'Your language data for Forumactif Messenger has been exported successfully. Copy the contents below to share or save it.',
search_view : 'View all results',
search_searching : 'Searching...',
search_no_results : 'No results were found.',
search_tip : 'Use the search bar above to find a topic.',
search_help : 'View Search Guide',
search_last_visit : 'View posts since last visit',
search_active : 'View today\'s active topics',
search_my_posts : 'View your posts',
search_unanswered : 'View unanswered posts',
attach_image : 'Add an Image',
attach_gif : 'Add a GIF',
attach_video : 'Add a Video',
attach_remove : 'Manage Attachments',
attach_upload : 'Upload',
attach_uploading : 'The image uploader is already open.',
attach_searchYT : 'Search YouTube',
attach_searchingYT : 'Youtube is already open.',
attach_max : 'You have reached the maximum number of attachments for this message.',
attach_success : 'Attachment Added!',
attach_none : 'There are no attachments',
giphy_search : 'Search for a GIF...',
giphy_searching : 'Searching...',
giphy_not_found : 'No results found.',
tooltip_openFAM : 'Forumactif Messenger',
tooltip_back : 'Click to go back',
tooltip_menu : 'Open menu',
tooltip_home : 'Home',
tooltip_login : 'Log in',
tooltip_profile : 'Profile',
tooltip_search : 'Search',
tooltip_settings : 'Settings',
tooltip_config : 'Forumactif Messenger Configuration',
tooltip_about : 'About',
tooltip_attachments : 'Add attachment',
tooltip_emoji : 'Add emoticon',
tooltip_send : 'Send message',
tooltip_msg_quote : 'Quote',
tooltip_msg_edit : 'Edit',
tooltip_msg_delete : 'Delete',
error_sending : 'An error occurred that prevented your message from being sent. Do you want to resend it?',
error_resend : 'Resend',
error_delete : 'Delete',
error_report : 'Report',
guest : 'Guest',
yes : 'Yes',
no : 'No',
send : 'Send',
cancel : 'Cancel',
reset : 'Reset'
}
}, // config_end
// toggles Forumactif Messenger
toggle : function () {
if (FAM.cache.chat.dataset.hidden == 'true') {
FAM.cache.chat.dataset.hidden = false;
if (!FAM.history.restore()) {
FAM.tab.initial();
FAM.tab.loaded = true;
}
if (FAM.fullscreen) {
document.body.style.overflow = 'hidden';
}
} else {
FAM.cache.chat.dataset.hidden = true;
if (FAM.fullscreen) {
document.body.style.overflow = '';
}
}
},
// encode strings for sending over AJAX
encode : function (string) {
return /UTF-8/i.test(document.characterSet) ?
encodeURIComponent(string) :
// URI encoding for NON-UTF8 forums
encodeURIComponent(escape(string).replace(/%u[A-F0-9]{4}/g, function(match) {
return '' + parseInt(match.substr(2), 16) + ';'
})).replace(/%25/g, '%')
},
// updates userdata and lang values using page data received via AJAX
updateUserdata : function (data) {
var script = document.createElement('SCRIPT');
script.type = 'text/javascript';
script.text = data.replace(/[\s\S]*?(if\(typeof\(_userdata\) == "undefined"\)[\s\S]*?)if\(typeof\(_board\) == "undefined"\)[\s\S]*/, '$1');
document.body.appendChild(script);
},
// abort ongoing requests
clearRequest : function () {
if (FAM.request) {
if (!FAM.request.statusText) {
FAM.request.abort();
}
delete FAM.request;
}
// remove message notifications
if (FAM.cache.chat.querySelector('#FAM-new-msg-notif')) {
FAM.message.markRead(true, true);
}
},
// get the specified page and load the contents into FAM
get : function (url, title, noHistory) {
var type = /\/c\d+/.test(url) ? 'category' :
/\/f\d+/.test(url) ? 'forum' :
/\/t\d+/.test(url) ? 'topic' :
/\/search|\/st\/|\/sta\//.test(url) ? 'search' : 'category';
// push new entry to history
if (!noHistory) {
FAM.history.update({
url : url,
title : title
});
}
FAM.clearRequest(); // abort ongoing requests
FAM.message.listener.stop(); // stop listening for message changes
FAM.history.toggleBack(); // show / hide back button
FAM.tab.title(title); // update the main title
// display loading texts and change content class
FAM.cache.content.className = 'FAM-viewing-' + type;
FAM.cache.content.innerHTML =
'