AoPS.hasOwnProperty("Community")||(AoPS.Community={}),AoPS.Community.Constants={base_url:"https://"+location.hostname,community_main_color:"#009fad",community_secondary_color:"#dae7f6",privates_main_color:"#009fad",privates_secondary_color:"#dae7f6",time_limits:{watched_times_short:3600,watched_times_long:21600},max_times_to_watch:{watched_times_short:1e3,watched_times_long:1500},very_large_time:6e9,old_topic_age_in_seconds:43200,intervals:{current:{new_item_check_interval:12e4,new_item_check_interval_long:24e4,topic_update_interval:6e4,topic_update_interval_long:3e5,reported_posts_interval:2e4,watchers_updates_check_interval:3e5,fetch_forum_users_interval:3e5,put_community_to_sleep_limit:12e5},active:{new_item_check_interval:12e4,new_item_check_interval_long:24e4,topic_update_interval:6e4,topic_update_interval_long:3e5,reported_posts_interval:2e4,watchers_updates_check_interval:3e5,fetch_forum_users_interval:3e5,put_community_to_sleep_limit:12e5},slow:{new_item_check_interval:24e4,new_item_check_interval_long:48e4,topic_update_interval:12e4,topic_update_interval_long:6e5,reported_posts_interval:12e4,watchers_updates_check_interval:6e5,fetch_forum_users_interval:6e5,put_community_to_sleep_limit:9e5},disabled:{new_item_check_interval:2147483647,topic_update_interval:2147483647,topic_update_interval_long:2147483647,reported_posts_interval:2147483647,watchers_updates_check_interval:2147483647,fetch_forum_users_interval:2147483647}},idle_monitor_interval:1e3,fetch_office_hours_interval:3e4,moment_offset:0,base_delay_internet_issue:10,time_limit_for_calendar_style:172800,time_limit_edit_own:1209600,time_limit_delete_own:1209600,watched_times_short_interval:59800,watched_times_long_interval:1200137,UNUSED_new_item_check_interval:60103,UNUSED_new_item_check_interval_short:60103,UNUSED_new_item_check_interval_long:240103,UNUSED_topic_update_interval:38741,UNUSED_topic_update_interval_long:218741,UNUSED_reported_posts_interval:20341,UNUSED_watchers_updates_check_interval:195091,UNUSED_fetch_forum_users_interval:81137,phone_mode_max_width:768,min_preview_height:320,min_draggable_reply_height:290,min_posts_window_height:50,min_stupid_view_reply_textarea:50,max_conversation_participants:10,max_forums_user_update:50,min_topic_list_initial_length:6,max_num_shown_topics:78,num_topics_to_hide:20,num_topics_to_reveal:10,master_category_id:2,portal_category_id:89,private_messages_id:1,aops_forums_id:11,other_forums_id:9,olympiad_forum_id:6,college_math_forum_id:7,recycle_bin_id:22,blog_recycle_bin_id:104,aops_videos_id:64,aops_wiki_id:65,aops_blogroll_id:88,halp_user_id:10,unsearchable_fora:[50,63],essential_tags_olympiad:["algebra","geometry","combinatorics","number theory","inequalities","imo"],essential_tags_college:["calculus","real analysis","linear algebra","superior algebra","complex analysis","advanced fields","probability and stats","number theory","topology","putnam","college contests"],private_archive_url:"/my-messages-archive/",reply_jump_to_bottom_window:100,move_topic_quick_links:{3:[4,5,6,7],4:[3,5,6,7],5:[3,4,6,7],6:[3,4,5,7],7:[3,4,5,6]},min_topic_title_length:8,max_topic_title_length:80,max_tags_per_topic:7,min_poll_question_length:8,max_poll_question_length:255,min_post_length:8,max_post_length:4e4,max_source_length:128,posting_ajax_timeout:6e4,posting_warn_limit:20,time_hack_nudge:2e4,new_topic_modal_delay:1200,new_reply_modal_delay:1200,message_readability_delay:1200,message_readability_delay_short:1200,num_posts_to_fetch:20,topic_move_length_limit:250,user_path:"/community/user/",max_shout_length:255,itembox_input_width:150,max_categories_to_load:10,category_autocomplete_width:275,tag_autocomplete_width:250,num_users_whois_online:120,profile_field_length_limit:120,min_password_length:4,max_password_length:128,max_avatar_file_size:24,max_attachment_size:512,max_attachments_per_post:3,default_avatar:"//avatar.artofproblemsolving.com/no-avatar.png",attachment_path:AoPS.bootstrap_data.cmty_attachment_path,max_length_feed_list_read_check:100,view_post_max_label_len:12,view_post_max_hide_label_len:255,can_oneclick_ban:[1163,29411,225249,267794],max_category_name_length:50,min_category_name_length:3,max_category_description_length:240,max_blog_comments_text_length:40,cat_admin_save_input_delay:1e3,categories_with_private_roles:["forum","forum_class","blog"],monitor_tags:[{item_id:6,item_text:"/not_monitored"},{item_id:5,item_text:"/closed"},{item_id:4,item_text:"/open"}],monitoring_tag_id_array:[4,5,6],monitored_topic_tag_ids:{open:4,closed:5,not_monitored:6},phone_more_topics_sensitivity:150,phone_more_posts_sensitivity:150,bbCode:{smileys:[[":D","icon_mrgreen.gif"],[":blush:","redface_anim.gif"],[":maybe:","unsure.gif"],[":-D","biggrin.gif"],[":)","smile.gif"],[":(","sad.gif"],[":o","ohmy.gif"],[":mad:","mad.gif"],[":P","tongue.gif"],[":oops:","blush.gif"],[":roll:","rolleyes.gif"],[";)","wink.gif"],[":!:","exclaim.gif"],[":idea:","idea.gif"],[":arrow:","icon2.gif"],[":|","mellow.gif"],[":rotfl:","rotfl.gif"],[":huh:","huh.gif"],[":ninja:","ph34r.gif"],[":no:","sleep.gif"],[":love:","wub.gif"],[":wacko:","wacko.gif"],[":what?:","blink.gif"],[":alien:","alien_grn.gif"],[":cool:","cool.gif"],[":first:","first.gif"],[":dry:","dry.gif"],[":laugh:","laugh.gif"],[":coolspeak:","coolspeak.gif"],[":oops_sign:","oops.gif"],[":whistling:","whistling.gif"],[":yinyang:","yinyang.gif"],[":w00t:","w00t.gif"],[":pilot:","plane.gif"],[":play_ball:","play_ball.gif"],[":police:","police.gif"],[":read:","read.gif"],[":showoff:","showoff.gif"],[":sleep2:","sleep2.gif"],[":sleeping:","sleeping.gif"],[":spam:","spam.gif"],[":spidy:","spidy.gif"],[":starwars:","starwars.gif"],[":stink:","stink.gif"],[":stretcher:","stretcher.gif"],[":cleaning:","suck_kr.gif"],[":surf:","surfing.gif"],[":surrender:","surrender.gif"],[":thumbup:","thumbup.gif"],[":trampoline:","trampoline.gif"],[":w00tb:","w00tbrows.gif"],[":wallbash:","wallbash.gif"],[":wallbash_red:","wallbash_red.gif"],[":weightlift:","weightlift.gif"],[":welcome:","welcome.gif"],[":welcomeani:","welcomeani.gif"],[":winner_first:","winner_first_h4h.gif"],[":winner_second:","winner_second_h4h.gif"],[":winner_third:","winner_third_h4h.gif"],[":wow:","wow.gif"],[":huuh:","wtf.gif"],[":yankchain:","yankchain.gif"],[":yup:","yes3.gif"],[":10:","10.gif"],[":heli:","heli.gif"],[":agent:","agent.gif"],[":bomb:","bomb.gif"],[":bruce:","bruce_h4h.gif"],[":bye:","byebye.gif"],[":censored:","censored.gif"],[":chief:","chieftain.gif"],[":clap:","clap.gif"],[":clap2:","clap2.gif"],[":coool:","cool1.gif"],[":ddr:","ddr.gif"],[":diablo:","diablo.gif"],[":evilgrin:","evilgrin.gif"],[":ewpu:","ewpu.gif"],[":flex:","flex.gif"],[":fool:","fool.gif"],[":football:","football.gif"],[":furious:","furious.gif"],[":gathering:","gathering.gif"],[":gleam:","gleam.gif"],[":harhar:","harhar.gif"],[":help:","helpsmilie.gif"],[":icecream:","icecream.gif"],[":juggle:","juggle[1].gif"],[":jump:","jump.gif"],[":moose:","mf_moose.gif"],[":nhl:","nhl.gif"],[":noo:","no.gif"],[":omighty:","notworthy.gif"],[":yoda:","yoda.gif"]],font_colors:["#f00","#ff9a00","#ff0","#0f0","#0ff","#00f","#9a00ff","#f0f","#600","#783F04","#7f6000","#274E13","#0C343D","#073763","#20124D","#4C1130","#960000","#B45F06","#BF9000","#38761D","#134F5C","#0B5394","#351C75","#741B47","#c00","#E69138","#F1C232","#6AA84F","#45818E","#3D85C6","#674EA7","#A64D79","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6FA8DC","#8E7CC3","#C27BA0","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#9FC5E8","#B4A7D6","#D5A6BD","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#CFE2F3","#D9D2E9","#EAD1DC","#000","#222","#444","#666","#888","#aaa","#ccc","#eee"]},special_collections_id:12,office_hours_ids:[433798],BIG:1e8}; ;AoPS.Community.Lang={"Add-Note":"Add Note",Admin:"Admin",Administrators:"Administrators",At:"At","Back-to":"Back to",Banned:"Banned",blog:"blog",Bookmarks:"Bookmarks",Build:"Build",by:"by",By:"By",cancel:"cancel",Cancel:"Cancel",collection:"collection","command-click":"command-click",Community:"Community",Contributors:"Contributors","control-click":"control-click",Conversations:"Conversations",create:"create",Create:"Create",Custom:"Custom","data-saved":"Data saved!","data-saved-reload":"Data saved! You will see your changes when you reload the community",Delete:"Delete",Email:"Email","Enter-username":"Enter username",FAQ:"Help",Flyout:"Flyout",forum:"forum",Forum:"Forum",Full:"Full",in:"in",Info:"Info",information:"information",IP:"IP","logged-out":"You have been signed out. Please sign back in and try again.","Login/Join":"Login / Join",Message:"Message",Messages:"Messages",Mod:"Mod",Modal:"Modal",Moderators:"Moderators",MyAoPS:"My AoPS",no:"No",No:"No",NO:"NO",None:"None",Note:"Note",Notes:"Notes","permanent-link":"Permanent Link",Popup:"Pop-up",Private:"Private","Private-Messages":"Private Messages","Private-Message-Search":"Private Message Search",Profile:"Profile",Public:"Public",Readers:"Readers",Reason:"Reason",Reset:"Reset",Save:"Save",saved:"saved","saving-blocker":"Saving data... Back soon.",SEARCH:"SEARCH","search-no-match":"Nothing matches your input.",Search:"Search","Search-Results":"Search Results",Short:"Short",Submit:"Submit",Subscribe:"Subscribe",Tag:"Tag",Tall:"Tall","unexpected-error-code":"There has been an unexpected error. Please contact tech-support@aops.com and tell them exactly\t\t what you were doing to trigger this, and include this magic code: ","unexpected-logout":"You have been signed out\t\t\t\t\tby nefarious computer gremlins. If you are in the middle\t\t\t\t\tof entering text, you should copy your work before logging back in.",Users:"Users",Unsubscribe:"Unsubscribe",Username:"Username",views:"views",viewing:"viewing",view:"view",Welcome:"Welcome",yes:"Yes",Yes:"Yes",YES:"YES","month-01":"January","month-02":"February","month-03":"March","month-04":"April","month-05":"May","month-06":"June","month-07":"July","month-08":"August","month-09":"September","month-10":"October","month-11":"November","month-12":"December","admin-validation":'
Enter magic admin phrase
',"admin-validate-failed":"Validation failed","ajax-error-delay":"Error talking to the server. Check your internet connection. We'll try again in {0} seconds.","ajax-error-E_AJAX_UNKNOWN":"An error has occurred that is preventing your computer from connecting to the \t\tAoPS site. Please check your internet connection and then refresh the page. If you are working on something, please save your work \t\tbefore refreshing.","user-item-online":'Online',"invalid-user":"The username {0} is not a valid username.","tag-tooltip-forum":"In forum: ","error-timeout":"The server has timed out while working on your request. Please\t\trefresh the page to see if it finished what it was supposed to do before so\t\tignominiously giving up.","err-no-such-session":"Sorry, your session appears to have changed, so you must refresh \t\tyour browser before continuing to use the site. This can happen when you \t\tare logged in to Art of Problem Solving on multiple tabs of the same browser, and then \t\tsign out on one of those tabs. Please refresh your browser after saving any work you have \t\tin progress.","err-dropzone-fallback":"Sorry, attaching documents in our community is not supported by your browser. Please choose another browser.","err-unknown":"Unknown error occurred. Here's the code they gave me: {0}.","err-no-permission":"Sorry, you do not have permission to perform this action.","editable-length-limit-exceeded-on-paste":"You pasted too much! I'm cutting some out.","user-list-validation-blocker":"Validating username...","err-bookmark-limit-reached":"Bookmark limit reached. This item was not bookmarked.","err-community-disabled":AoPS.bootstrap_data.hasOwnProperty("community_inactive_message")?AoPS.bootstrap_data.community_inactive_message:"Sorry, but the community is currently disabled. Please try again later.","category-deleted":"The page you are viewing has just been deleted. Sorry about that. \t\tI'm going to take you back to the front of the community.","please-wait":"Hold on a sec while I take care of this.","private-search-results":"Private Message Search Results","unwatch-success":"Unwatch successful. You will no longer receive email notifications regarding this {0}. It will miss you. This {0} is \t\tstill bookmarked, but you won't receive email notifications any more.","cmty-itembox-loader":"Loading more...","my-profile-home":"My AoPS","initial-fetch-err-E_SEARCH_SERVER_INACTIVE":"Sorry, the search server is down right now. We're working on it.","initial-fetch-err-E_BAD_SEARCH_QUERY":'Sorry, you sent the search server something that it cannot parse. Please try something different. \t\tClick here to go to the Advanced Search page. ',"initial-fetch-err-E_DONT_KNOW_CHARACTERS":'Sorry, your search term only includes special characters that our search engine ignores. \t\tClick here to go to the Advanced Search page.',"initial-fetch-blog-err-E_SEARCH_SERVER_INACTIVE":"Sorry, the search server is down right now. We're working on it.","initial-fetch-blog-err-E_BAD_SEARCH_QUERY":'Sorry, you sent the search server something that it cannot parse. Please try something different. \t\tClick here to go back to the blog. ',"initial-fetch-blog-err-E_DONT_KNOW_CHARACTERS":'Sorry, your search term only includes special characters that our search engine ignores. \t\tClick here to go back to the blog.',"initial-fetch-blog-err-E_AJAX_TIMEOUT":"Sorry, your request for blog posts is taking too long. Please try again in a bit.","topic-fetch-err-E_SEARCH_SERVER_INACTIVE":"Sorry, the search server is down right now. We're working on it.","initial-fetch-err-E_AJAX_TIMEOUT":"Sorry, your request for community topics is taking too long. Please try again in a bit.","topic-fetch-err-E_AJAX_TIMEOUT":"Sorry, your request for more topics is taking too long. Please try again in a bit.","topic-fetch-err-E_WRONG_TYPE":"Invalid type provided. Must be positive integer.","community-asleep":"The AoPS Community has gone to sleep due to inactivity. \t\tIf you are in the middle of working on something, \t\tthen we recommend that you close this message and save your work on your own computer before \t\trefreshing the page to reactivate the Community.","community-asleep-reminder":"The AoPS Community has gone to sleep due to prior inactivity. Please \t\trefresh the page to reactivate the community.","community-asleep-save":"The AoPS Community has gone to sleep due to inactivity. \t\tIf you are in the middle of working on something, \t\tthen we recommend that you close this message and save your work on your own computer before \t\trefreshing the page to reactivate the Community.","community-asleep-session":"The AoPS Community has gone to sleep due to a session error. \t\tIf you are in the middle of working on something, \t\tthen we recommend that you close this message and save your work on your own computer before \t\trefreshing the page to reactivate the Community.","community-asleep-reminder-session":"The AoPS Community has gone to sleep due to a session error. Please \t\trefresh the page to reactivate the community.","community-asleep-save-session":"The AoPS Community has gone to sleep due to a session error. \t\tIf you are in the middle of working on something, \t\tthen we recommend that you close this message and save your work on your own computer before \t\trefreshing the page to reactivate the Community.","view-pdf-tooltip":"View as PDF","router-err-topic-deleted":"You have requested a topic that has been deleted. I am not into dumpster-diving, so I can't get the topic for you.","router-err-no-topic":"You have requested a topic that does not exist. Perhaps it never existed. Perhaps it was deleted. Perhaps I'm just tired and don't feel like looking for it. These AoPS people work me like a dog.","router-err-no-perms-logged-in":"You have requested a top secret page for which you have not received security clearance. Sorry about that. Perhaps if you do 10 push-ups, I will let you in.","router-err-no-perms-logged-out":'You have requested a top secret page for which you have not received security clearance. Or maybe you have clearance, but you are not signed in. Click here to sign in.',"router-err-no-such-category":"I looked and looked, and looked some more. I'm afraid that the page you requested does not exist.","router-err-no-such-user":"I looked and looked, and looked some more. I'm afraid that the user you requested does not exist.","router-err-no-perms":"You do not have permission to view this page."+(AoPS.session.logged_in?"":' This may be because you are not signed in! Click here to sign in.'),"router-err-no-post":"You have requested a post that does not exist. Maybe it was deleted. Maybe it never existed in the first place. At any rate, I cannot find it. Sorry about that.","router-err-not-logged-in":'You are not signed in to AoPS. You cannot access this page unless you are logged in. Click here to sign in.',"router-err-cat-admin-no-create-type":"You cannot create a category of type ","router-err-not-participant":"You are not a participant of this private conversation.","router-err-unwatch-E_NO_HASH_FOUND":"Sorry, this link has expired. That makes me sad, too.","router-edit-profile-crumb":"Edit Profile and Account","router-edit-settings-crumb":"Edit Community Settings","breadcrumbs-reported-posts":"Reported Posts","breadcrumbs-tag-info":"Tags","breadcrumbs-terms":"Terms->Tags Map","breadcrumbs-tagmap":"Tags->Terms Map","breadcrumbs-log":"Log: Be careful, yo","master-other-forums":"Other Forums and Collections ","master-whois-title":"Who is online?","master-whois-FAQ-link":"Help","master-statistics-title":"Statistics:","master-statistics-data":"Total posts: {0} | Total topics: {1} | Total members: {2}","master-whois-dataline":"There are {0} users online, including the {1} registered members listed below and {2} other hidden registered users.","master-registered-online":"Registered users online: ","master-collections-modal-title":"What Are Collections and Other Forums?","master-whois-memberlist-link":"View Memberlist","master-featured-content":"Featured Content ","portal-featured-help-title":"Feature Olympiad Content","portal-extra-content":"Other Forums and Collections ","portal-extra-help-title":"Other Forums and Collections","portal-extra-note":"","portal-extra-logged-in":' Click here to visit your \t\tCommunity settings page, where you can set your default Community homepage view.',"folder-empty-bookmark_forums":"You have no forums bookmarked. Bookmarked forums will appear on this page.","folder-empty-bookmark_users":"You have no users bookmarked.","folder-empty-folder":"Nothing here yet!","folder-empty-folder_forums":"Nothing here yet!","folder-empty-folder_collections":"Nothing here yet!","folder-empty-blogroll":"No blogs here yet!","folder-empty-my_forums":"No forums here... Yet!","folder-empty-my_blogs":"No blogs here... Yet!","folder-empty-my_collections":"No collections here... Yet!","folder-empty-view_posts":"No posts here yet!","cat-cell-no-perm-start-topic":"You do not have permission to start a topic in this forum.","cat-cell-no-perm-limited-user":'You have a limited account, so you cannot post new topics or replies. \t\tYou can upgrade your account for free here.',"cat-cell-new-topic":"New Topic","cat-cell-new-message":"New Message","cat-cell-mark-read":"Mark All Read","cat-cell-topic":"topic","cat-cell-topics":"topics","cat-cell-post":"post","cat-cell-posts":"posts","cat-cell-user":"user","cat-cell-users":"users","cat-cell-num-user-title":"Number of users viewing a topic in this\n forum in the last five minutes.","cat-cell-no-tag-match":"No tags match your search","cat-cell-filter-placeholder":"Filter by tag","cat-cell-mark-read-title":"Mark all topics in this forum read","cat-cell-bookmark-title":"Bookmark this ","cat-cell-new-topic-title":"Post a new topic to this forum","cat-cell-new-pm-title":"Write a new private message","cat-cell-more-options-title":"More options","cat-cell-create-collection":"Create Collection","cat-cell-help-title":"Learn more about this page","cat-cell-no-tags-yet":" No tags here yet!","cat-cell-no-posts-yet":" No posts here yet!","cat-cell-no-items-yet":" Nothing here yet!","cat-cell-search-forum":"Search this forum","cat-cell-search-pm":"Search private messages","cat-cell-forum-locked-title":"This forum is locked.","cat-cell-forum-locked-title-mod":"This forum is locked, but you can post here because you are special.","cat-cell-Locked":"Locked","cat-cell-locked-modal":"This forum is currently locked, so you cannot post new topics here right now.","cat-cell-tag-view-topics":"Topics with these tags","cat-cell-forum-view-topics":"Topics in these forums","cat-cell-forum-topics":"Topics in this forum","cat-cell-tags-title":"Tags in this forum","cat-cell-items-title-tag-view":"Tags in this collection","cat-cell-items-title-tag-bookmark":"Tags that I have bookmarked","cat-cell-items-title-forum-view":"Forums in this collection","cat-cell-items-title-forum-bookmark":"Forums that I have bookmarked","cat-cell-no-users-bookmarked":"You have no users bookmarked yet!","cat-cell-view_tags-help-title":"About Tag Collections","cat-cell-view_topics-help-title":"About Topic Collections","main-crumb-search-placeholder":"Search Community","main-crumb-advanced-search":"Advanced search","cat-search-placeholder-9":"Search Forums","cat-search-placeholder-12":"Search Collections","tagbox-not-logged-in":"You must be signed in to edit a topic's tags.","tagbox-no-permission":"You do not have permission to edit tags of topics in this forum.","tagbox-new-user":"Once you have been a member of the AoPS Community for at least two weeks, you will be able \t\tto edit the tags of existing topics.","bookmark-not-logged-in":"When you are signed in to AoPS, you will be able to bookmark topics, tags, forums, and users.","bookmark-remove":"Remove","bookmark-follow":"Bookmark","bookmark-limited-user":'You have a limited account, so you cannot bookmark items on the site. \t\tYou can upgrade your account for free here, and then you \t\twill be able to bookmark items.',"bookmark-modal-topic":', you are bookmarking the topic "{0}" in the forum {1}. ',"bookmark-modal-tag":', you are bookmarking the tag "{0}" in the forum {1}. ',"bookmark-modal-forum":", you are bookmarking the forum {0}. ","bookmark-remove-user-title":"Remove this user from Bookmarked Users","bookmark-user-title":"Add this user to Bookmarked Users","bookmark-modal-title":"Bookmark ","bookmark-modal-title-tag":"Bookmark Tag","bookmark-modal-title-topic":"Bookmark Topic","bookmark-modal-title-forum":"Bookmark Forum","bookmark-modal-info-text":"All of your bookmarks are available on your My AoPS page.\t\tYou may also choose to add bookmarked items to your feed and/or receive email notifications.","bookmark-modal-info-text-academy":" You may choose to add bookmarked items to your feed and/or receive email notifications.","bookmark-modal-feed":"Add this to my feed.","bookmark-modal-email":"Email me when this gets a new ","bookmark-modal-email-tag":"Email me when a new topic gets this tag.","bookmark-modal-email-topic":"Email me when this topic gets a new post.","bookmark-modal-email-forum":"Email me when there is a new post or topic in this forum.","bookmark-modal-cancel":"CANCEL","bookmark-modal-ok":"ADD BOOKMARK","bookmark-no-forums-bookmarked":"You have no forums bookmarked!","bookmark-no-tags-bookmarked":"You have no tags bookmarked!","bookmark-no-topics-bookmarked":"You have no topics bookmarked!","bookmark-tag-tooltip":"Bookmark this tag (subscribe)","remove-bookmarked-tag-tooltip":"Remove tag from bookmarks (unsubscribe)","mod-topic-title":"Moderate Topic","mod-topic-move":"Move Topic","mod-topic-unlock":"Unlock Topic","mod-topic-lock":"Lock Topic","mod-topic-delete":"Delete Topic","mod-topic-hard-delete":"Hard Delete Topic","mod-topic-announce":"Make Announcement","mod-topic-global":"Make Global Announcement","mod-topic-normal":"Make Normal Topic","mod-topic-add-target":"Add Target Url","mod-topic-replace-target":"Replace Target Url","mod-topic-remove-target":"Remove Target Url","mod-topic-add-hidden":"Add Hidden Tag","mod-topic-hidden-tags":"Hidden Tags","mod-topic-log":"View Log","mod-topic-lock-warning":"Are you really sure you want to lock this topic?","mod-topic-soft-delete-warning":"Are you really sure you want to delete this topic?","mod-topic-hard-delete-warning":"Are you really sure you want to hard delete this topic?\t\tThis will completely wipe out all posts. It is irreversible.","mod-topic-lock-title":"Lock Topic","mod-topic-soft-delete-title":"Delete Topic","mod-topic-hard-delete-title":"Hard Delete Topic","mod-topic-lock-pending":"Hold on a sec while I find the key.","mod-topic-delete-pending":"Hold on a sec while I take out the trash.","mod-topic-delete-err-E_NO_PERMISSION":"You do not have permission to delete this topic.","mod-topic-delete-err-E_NOT_LOGGED_IN":"Ack! You are no longer signed in. You'll have to sign in again to delete this topic.","mod-topic-delete-err-E_TOPIC_TOO_LONG":"You do not have permission to move long topics. \t\tIf you wish to move or delete this topic, use the Report Topic functionality to report the \t\ttopic to site admins.","mod-long-topic-admin-warning":"You should not move or delete long topics during class time or \t\twhen the site is very busy. Are you sure you want to move or delete this?","mod-long-topic-admin-OK":"YES I AM SURE","mod-long-topic-admin-no":"No - do nothing","mod-topic-set-announce-through":"Last date of announcement (leave blank for none):","mod-topic-move-title":"Move Topic","mod-topic-move-input-heading":"Move To: ","mod-topic-move-quick":"Quick move: ","mod-topic-move-in-progress":"Moving crew at work, hold on a minute.","mod-topic-move-err-E_NO_PERMISSION":"You do not have permission to move this topic.","mod-topic-move-err-E_NOT_LOGGED_IN":"Ack! You are no longer signed in. You'll have to sign in again to move this topic.","mod-topic-move-err-E_NO_MOVE_TO_LOCKED":"Your target forum is locked. The topic has not been moved.","mod-topic-move-err-E_ALREADY_MOVED":"Someone just beat you to it! They already moved this topic. I won't ruin the suspense and tell you where they moved it. Hit refresh to find out!","mod-topic-move-err-E_MAX_ANNOUNCEMENTS":"Sorry, your target forum already has the maximum number of announcements.","mod-topic-move-err-E_TOPIC_TOO_LONG":"You do not have permission to move or delete long topics. \t\tIf you wish to move or delete this topic, use the Report Topic functionality to report the \t\ttopic to site admins.","mod-topic-announce-err-E_NO_PERMISSION":"You do not have permission to change the announce status of this topic.","mod-topic-announce-err-E_MAX_ANNOUNCEMENTS":"Sorry, this forum already has the maximum number of announcements.","mod-topic-announce-err-E_NOT_LOGGED_IN":"Ack! You are no longer signed in. You'll have to sign in again to change the announcement status of this topic.","mod-topic-remove-target-confirm":"Are you sure you wish to remove the link between this topic \t\t and an object on the site? ","mod-topic-remove-target-extra":"This operation will also remove all hidden tags, so you will have to \t\t re-add any hidden tags you wish to keep.","mod-topic-remove-target-with-text":"Are you sure you wish to remove the link between this topic and {0}? ","mod-topic-remove-target-blocker":"Hold on while I take care of this target for you. Back in a sec.","mod-topic-edit-target-instructions":'Edit the target URL by entering the new target below. When a topic \t\talready has a target, I\'ll give you that URL as a hint. Please make sure you know what you \t\tare doing before using this. Richard will make you do 10 push-ups if you screw up here. Note: \t\ta restricted tag is one that has permissions attached. Think "discussions attached to solutions \t\tto homework problems." Entering a blank URL here will not delete the current target. \t\tThis operation will also remove all hidden tags, so you will have to \t\t re-add any hidden tags you wish to keep.',"mod-topic-edit-target-url":"New Target:","mod-topic-edit-target-text":"New Target Descriptor:","mod-topic-edit-target-is-restricted":"Check if target is restricted:","mod-topic-hidden-tag-instructions":"Enter text below. Make sure you know what you're doing \t\tbefore using this. Or maybe shortly after using this.","mod-topic-hidden-tag-text":"Tag text: ","mod-topic-hidden-tag-is-restricted":"Check if tag is restricted: ","mod-topic-hidden-tag-blocker":"Adding tag; back in a sec...","mod-topic-no-state-tags":"You cannot add state tags here.","mod-topic-announce-blocker":"Setting announcement status of this topic.","topics-list-no-more-items":"No more topics!","topics-list-no-items-at-all":"No topics here!","topics-list-no-more-items-office-hours-default":"","topics-list-no-more-items-office-hours":"No more topics!","topics-list-no-items-at-all-office-hours":"No topics here! Remember to click 'Done Halping' before leaving the page.","topics-list-no-more-privates":"No more private messages.","topics-list-no-privates":"No private messages here!","topics-list-nothing-bookmarked":"Nothing bookmarked!","topic-cell-moved-topic":"THIS TOPIC HAS MOVED; CLICK HERE TO GO TO ITS NEW LOCATION.","topic-cell-recycled-topic":"THIS TOPIC HAS BEED DELETED; CLICK HERE TO VIEW IN RECYCLE BIN.","topic-cell-reading-now":"Reading now: ","topic-cell-reply":"reply","topic-cell-replies":"replies","topic-cell-no-replies":"0 replies","topic-cell-title-close":"Close topic","topic-cell-title-settle":"Settle reports","topic-cell-title-jump-end":"Jump to end of topic","topic-cell-title-unread":"Jump to first unread","topic-cell-source":"Source","topic-cell-Posted-at":'Posted by {0} on',"topic-cell-1-reader":"{0} user reading this topic.","topic-cell-not-1-reader":"{0} users reading this topic.","topic-cell-visit-in-forum":"Visit this topic in its forum","topic-cell-view-user-profile":"View user profile","topic-full-bookmark-tooltip":"Bookmark this (subscribe)","topic-full-remove-bookmark-tooltip":"Remove from bookmarks (unsubscribe)","topic-full-locked-tooltip":"Topic locked","topic-full-locked-forum-tooltip":"Topic's forum is locked","topic-full-reply-tooltip":"Reply to this topic","topic-full-expand-tooltip":"Expand/collapse topic","topic-full-close-tooltip":"Close topic","topic-full-moderate-tooltip":"Moderate topic","topic-full-reply":"Reply","topic-full-locked":"Locked","topic-full-post-reply":"Quick Reply","topic-full-message-deleted":"The topic you are viewing has just been deleted.","topic-full-deleted-extra":" Since you are in the middle of writing a new post, I will give you \t\ta chance to copy your work from the textarea below. After you close this dialog box, the page will \t\treload and you will have to restart your new post.

","topic-full-deleted-loss-permission":"You do not have permission to view this topic anymore.","topic-full-deleted-not-logged-in":"You do not have permission to view this topic anymore. This may be because you are no longer signed in.","topic-full-just-locked":"Sorry! This topic has just been locked!","topic-full-undelete-title":"Undelete Post","topic-full-new-reply-blocker":"Sending reply... Back soon.","topic-full-reply-confirm":"Are you sure you want to quit your reply?","topic-full-reply-confirm-OK":"Yes","topic-full-reply-confirm-cancel":"No","topic-full-edit-confirm":"Are you sure you want to quit editing?","topic-full-edit-confirm-OK":"Yes","topic-full-delete-post-pending":"Hold on a sec while I take out this trash...","topic-full-undelete-message":"Are you sure you want to undelete this message?","topic-full-already-reported":"This post has already been reported. A community administrator will address the report soon.","topic-full-already-reported-title":"Post already reported.","topic-full-report-post-title":"Report post","topic-full-report-report-sent":"Your report has been filed; a moderator will take a look at it soon.","topic-full-report-item-spam":"Spam: Inappropriate conduct, advertising, or some other nonsense.","topic-full-report-item-warez":"Warez: Shares copyrighted content without permission.","topic-full-report-item-cheat":"Possible cheating: posted problem comes from an active contest, homework, etc.","topic-full-report-item-other":"Other: Please include reason below.","topic-full-settle-report-title":"Settle report","topic-full-unregistered-reply":"You must be signed in to make a reply to this topic.","topic-full-reply-to-locked":"Sorry, this topic has just been locked, so you cannot reply.","topic-full-reply-to-forum-locked":"Sorry, this topic's forum has just been locked, so you cannot reply.","topic-full-locked-tooltip-mod":"Topic locked, but you can reply\nby clicking here because you are special.","topic-full-locked-forum-tooltip-mod":"Topic's forum is locked, but you can reply\nby clicking here because you are special.","topic-full-not-logged-in-reply":"You must be signed in to reply to topics.","topic-full-title-tooltip":"Click to view topic in its own forum,\n","topic-full-post-with-target-url":'This topic is linked to {3}.',"topic-full-post-solution-thread":"Only students who have viewed the solution can see this topic.","topic-full-target-text-default":"an item on AoPS","topic-full-remove-target":"Click here to unlink this topic.","topic-full-source":"Source","topic-full-state-tooltip":"Click to Toggle\nCurrent topic state: ","topic-full-undelete-hard":"Yikes; someone already hard deleted that post.","topic-full-click-for-tags":"Reveal topic tags","topic-full-no-post-found":"Well, that's embarrassing. I can't find the post you were looking for. \t\tI suspect someone just deleted it, but you can still check out the rest of the topic.","topic-edit-locked":"Sorry, this topic has just been locked, so you cannot edit this post.","topic-edit-forum-locked":"Sorry, this topic's forum has just been locked, so you cannot edit this post.","snipe-option-never":"Never","snipe-option-close":"Close","snipe-option-flyout":"Flyout","snipe-option-not-this-time":"Not This Time","snipe-title":"You've Been Sniped!","snipe-warning-body":"Another user has just replied to this topic. Their\t\t\t\t\t\t\tcomment has been loaded in your browser; you might want to check it out\t\t\t\t\t\t\tbefore submitting your reply.

\t\t\t\t\t\t\t• Click Never to stop the warnings on all topics"+(AoPS.session.logged_in?". You can turn warnings back on in your profile. ":" during this visit. ")+"
\t\t\t\t\t\t\t• Click Flyout to change these warnings from pop-ups to flyouts.
\t\t\t\t\t\t\t• Click Not This Time to block warnings only for this topic, and only during this site visit.
\t\t\t\t\t\t\t• Click Close to close this window but keep the warnings coming.

\t\t\t\t\t\t\tScroll to the bottom of the topic to see the new posts.","snipe-warning-flyout":"Another user has just replied to this topic.","topic-full-edited-1":"This post has been edited ","topic-full-edited-2":" time","topic-full-edited-3":" times","topic-full-edited-4":". Last edited by ","topic-full-target-tooltip":"This topic is about an item on the AoPS site.\nClick here to visit that item.","topic-list-jump-top":"Jump to First Topic","post-direct-link":'The direct link to this post is:',"post-direct-click-ip":"Admin: Click For IP","post-direct-loading-ip":"Loading IP","post-number-title":"Get Post URL","post-attachments":"Attachments:","post-unread-tootip":"This post unread prior to this visit.","post-thanked-by":'Y by',"post-thank-this":"Give thumbs up","post-unthank-this":"Remove thumbs up","post-nothank-this":"Give thumbs down","post-unnothank-this":"Remove thumbs down","post-user-tooltip-admin":" is a site admin.\nClick to view user profile.","post-user-tooltip-forum-admin":" is an admin of this forum.\nClick to view user profile.","post-user-tooltip-mod":" is a moderator of this forum.\nClick to view user profile.","post-user-tooltip-regular":"\nClick to view user profile.","edit-post-reason-heading":"Edit Post Reason","edit-post-reason-info":"Enter your reason for editing the post here. This reason will\t\tbe displayed with the post.","edit-post-no-post":"Sorry, I can't find this post. Maybe someone just deleted it!","edit-post-no-permission":"You don't have permission to edit this post.","edit-post-nothing-changed":"I looked very closely, but nothing has changed!","edit-send-blocker":"Sending edits... Back shortly.","edit-post-no-links":"New users are not allowed to post links in the Community.","edit-post-no-images":"New users are not allowed to post images in the Community.","edit-post-logged-out-warning":"You have been signed out. To edit this post, \t\t\t\t\t\tyou should sign back in. Here is the edited text you submitted, so\t\t\t\t\t\tyou can copy/paste it: ","delete-post-no-permission":"You do not have permission to delete this post.","delete-post-not-last-post":"You can only delete your own post if it is the last post in the topic. \t\tSomeone has posted after you, so you cannot delete this post.","delete-post-sniped":"You cannot delete the first post of a topic once someone has responded. \t\tIf you don't see a reply to this post, refresh the browser. The reply probably just came in.","new-topic-subject":"Subject","new-topic-tags":"Tags","new-topic-to":"To","new-topic-preview":"PREVIEW","new-topic-close-preview":"CLOSE PREVIEW","new-topic-post-anon":"Post anonymously (instructors will still know who posted)","new-topic-refresh-preview":"REFRESH","new-topic-not-logged-in":"You must be signed in to AoPS in order to start a new topic.","new-topic-are-sure":"Are you sure you want to quit your new topic?","new-topic-confirm-cancel":"No!","new-topic-confirm-OK":"Yes! Close the window.","new-topic-title-too-short":"Your title is too short; it must be at least "+AoPS.Community.Constants.min_topic_title_length+" characters.","new-topic-title-too-long":"Your title is too long; it must be at most "+AoPS.Community.Constants.max_topic_title_length+" characters.","new-topic-post-too-short":"Your post is too short; it must be at least "+AoPS.Community.Constants.min_post_length+" characters.","new-topic-post-too-long-python":"Your post is too long. Unfortunately, rendering Python \t\tnicely requires adding a bunch of markup to your post; that extra markup is causing your \t\tpost to be too long. Try a shorter program.","new-topic-post-too-long":"Your post is too long; please trim it down a bit.","new-topic-remove-link-confirm":"If you remove this tag, then this topic will not \t\tbe linked to a particular item and will not appear in the page feed on any page. \t\t The topic will still be posted in the forum {0}. Is it still OK to delete the tag?","new-topic-send-blocker":"Sending new topic... Back shortly.","new-pm-send-blocker":"Sending private message. Back soon.","new-blog-post-send-blocker":"Sending new blog post. Back soon.","new-topic-post-as-sheriff":"PM as AoPS Sheriff","new-topic-banned-term":"You have used a banned term. Please edit and resubmit.","new-topic-no-links":"New users are not allowed to post links in the Community.","new-topic-no-images":"New users are not allowed to post images in the Community.","new-topic-invalid-character":"You have used a weird character that I don't understand.\t\tFor example, the AoPS people didn't teach me about those wacky Emoji symbols because \t\tsome browsers can't handle them.","new-topic-no-tags-message":"You have not added any tags to your new topic.\t\tTags help people find your post. Are you sure you want to post a new topic without tags?","new-topic-no-tags-confirm-yes":"Post without tags","new-topic-no-tags-confirm-no":"Add tags","new-topic-category-deleted":"Sorry, this forum has just been deleted!","new-topic-no-permission":"You do not have permission to post new topics in this forum.","new-pm-no-permission":"You do not have permission to send new private messages.","new-pm-no-permission-limited":'You have a limited account, so you cannot send private messages. \t\tYou can upgrade your account for free here.',"new-topic-timeout":"Sorry, the call to the server timed out. There's a good chance your post\t\twas saved before I gave up, though. So, here's what I recommend. Close this warning, then\t\tcopy your post. Then refresh the window and navigate to where you expect to see your post. \t\tIf the post is not there, then try posting again.","new-topic-err-E_NEW_USER_NEW_TOPIC_LIMITED":"New users may only post 3 new topics every 24 hours. \t\tThis restriction will be lifted after you have been a member of the AoPS Community for 2 weeks.","new-topic-err-E_NEW_VPN_USER_NEW_TOPIC_LIMITED":"New users registering from a VPN may only post 1 new topic every 24 hours. \t\tThis restriction will be lifted after you have been a member of the AoPS Community for 2 weeks.","new-topic-err-E_MAX_ANNOUNCEMENTS":"This forum already has the maximum number of \t\tallowed announcements. Either post this as a normal topic or remove one of the current \t\tannouncements before posting.","new-topic-no-category":"Uh-oh. Those AoPS programmers goofed again. \t\tContact tech-support@aops.com to let them know that they forgot to preload a category on this page. Give them\t\tthe URL of the page you are on, and tell them which button you clicked to get this message.","new-topic-source-placeholder":"Optional. If posting a problem from a book or contest, enter the source of the problem here","new-topic-pm-archived":"Message sent and archived","new-topic-forum-locked":"This forum has been locked. I'm leaving the new topic window open \t\tfor you to give you a chance to copy your post.","new-topic-preview-bar-attachments":"VIEW ATTACHMENTS","new-topic-college-tag-warning-title":"College Forum Tag Warning","new-topic-olympiad-tag-warning-title":"Olympiad Forum Tag Warning","new-topic-olympiad-tags-warning":"Many people use the tags below to navigate the High School Olympiads forum. \t\tWe strongly recommend that you add at least one of these tags to your topic. Click on a tag to add it to your topic.","new-topic-college-tags-warning":"Many people use the tags below to navigate the College Math forum. \t\tWe strongly recommend that you add at least one of these tags to your topic. Click on a tag to add it to your topic.","new-topic-blacklist-trigger":"Sorry, you can't post right now. If you continue having this \t\tproblem, please send a copy of this note to the site administrator.","new-topic-blacklist-text-trigger":"Sorry, you can't post right now. Perhaps there is something wrong with your \t\tpost. If you continue having this \t\tproblem with other posts, please send a copy of this note to the site administrator.","new-reply-logged-out-warning":"You have been signed out. To post a \t\t\t\t\t\t\treply, you should sign back in. Here is the text you submitted, so\t\t\t\t\t\t\tyou can copy/paste it: ","new-reply-no-permission":"You do not have permission to reply to this topic.","new-reply-no-permission-limited":'You have a limited account, so you cannot post new topics or replies. \t\tYou can upgrade your account for free here.',"new-reply-locked":"Sorry, the topic was locked right before you submitted your reply!","new-reply-timeout":"Sorry, the call to the server timed out. There's a good chance your post\t\twas saved before I gave up, though. So, here's what I recommend. Close this warning, then\t\tcopy your post. Then refresh the window. If your post was saved, you should see it when you\t\tgo to the end of the topic.","new-reply-err-E_NEW_USER_LIMITED":"Sorry, but new users may only post 6 times every 24 hours. \t\tThis restriction will be lifted after you have been a member of the AoPS Community for 2 weeks.","new-reply-err-E_NEW_VPN_USER_LIMITED":"Sorry, but new users registering from a VPN may only post 1 time every 24 hours. \t\tThis restriction will be lifted after you have been a member of the AoPS Community for 2 weeks.","new-reply-err-E_NO_LINK_POSTING":"New users are not allowed to post links in the Community.","new-reply-forum-locked":"This forum has just been locked, so you cannot reply to this topic.","posting-quote-depth":"You cannot nest more than three quotes.","posting-hide-depth":"You cannot nest more than three hides.","posting-latex-error":"You have a LaTeX error in your message. I have rendered it in red.","posting-asy-error":"You have an Asymptote error in your message. I have rendered it in red.","posting-youtube-error":"You have supplied an invalid YouTube URL.","posting-no-flooding-error":"You cannot post so soon after your last post. Take a break. Do some push-ups. Solve an interesting math problem.","error-latex-posting-confirm":"You have an error in your {0} code. I have rendered it in red. \t\tYou can POST WITH ERROR \t\tand hope someone will tell you how to fix it, or you can TRY TO FIX the error yourself.","error-latex-i-will-fix":"TRY TO FIX","error-latex-post-anyway":"POST WITH ERROR","generic-ajax-timeout":"Your request timed out.","polymath-new-topic-confirm":"You are trying to post a new topic in the forum for the MIT PRIMES/AoPS CrowdMath Project.","polymath-force-choice":"You must confirm you are a student and indicate that you have read the rules in order to proceed.","polymath-reply-confirm":"You are trying to reply to a topic in the forum for the MIT PRIMES/AoPS CrowdMath Project.","polymath-confirm-blocker":"Registering you for the Polymath Project. Please wait a moment.","polymath-confirm-unknown-error":"Sorry, there has been an error of some sort. If this issue persists, please contact tech-support@aops.com, and tell them you received the following code: {0}.","private-adding-user-blocker":"Adding user to this private message...","private-no-username":"You have not entered a username.","private-from-post":"This message is regarding [url={0}]this post[/url].\n","private-from-post-deleted":"This message is regarding the following post, which has been deleted.\n","private-add-user-confirm-OK":"Add","private-add-participant":"Add a user to this conversation","private-need-recipients-err":"You must specify some recipients. You want to be heard, don't you?","private-already-added-active":"The user {0} is already included on this private message.","private-already-added-self-removed":"The user {0} is already included on this private \t\tmessage, but has chosen not to follow the message anymore. You cannot re-add \t\t{0} to this discussion.","private-no-add-self":'You are automatically included in any\t\t\tprivate message you start. Leave the "To" line blank to talk just to yourself.',"private-validation-blocker":"Validating recipient...","private-unreachable-recipient":"Cannot send message to this recipient.","private-category-name":"My Private Messages","private-archived-category-name":"My Archived Private Messages","private-archive-title":"View archived messages","private-View-Archive-btn":"View Archived Messages","private-Archive-btn":"Archive","private-Unarchive-btn":"Unarchive","private-user-removed":"This user left the conversation and will not receive replies.","private-remove-me":"Remove me from this conversation. Forever. Please.","private-remove-from-archived":"Are you sure you wish to be removed from this conversation? You will\t\tnot be able to access this message in the future, and will receive no replies to the message.","private-remove-from-active":'Are you sure you wish to be removed from this conversation? You will\t\tnot be able to access this message in the future, and will receive no replies to the message.\t\tYou may instead choose to archive this message by first clicking "Cancel", then clicking\t\t"Archive" on the message. This will remove the message from your inbox and place it in your Archive.',"private-remove-me-ok":"Remove Me","private-remove-blocker":"Removing you from the conversation.","private-archive-topic":"Archive this conversation","private-unarchive-topic":"Unarchive this conversation","private-message-archived":"Message archived.","private-message-unarchived":"Message unarchived, moved to inbox.","private-reply-no-listeners":"Everyone else has left this conversation; no one will see your comment unless you add\t\tnew participants.","private-user-excluded":'The user {0} is not accepting new private messages, \t\tso cannot be added to this discussion. The user has been removed from your "To" list. \t\tYou must hit Submit again to send.',"private-user-sheriff":"AoPSSheriff is a system account used to send messages from many \t\tdifferent AoPS administrators. To contact AoPSSheriff about an issue, please email \t\tsheriff@aops.com.","private-user-extensions":"Extensions is a system account used to send messages from many \t\tdifferent AoPS administrators. To contact Extensions about an issue, please email \t\textensions@aops.com.","private-user-excluded-by-system":'The user {0} cannot receive private messages, \t\tso cannot be added to this discussion. The user has been removed from your "To" list. \t\tYou must hit Submit again to send.',"private-new-msg-too-many-participants":"You have listed too many recipients. A private message can have\t\tat most "+AoPS.Community.Constants.max_conversation_participants+" participants, including yourself.","private-cant-add-more":"You have reached the maximum number of message participants. \t\tA private message can have at most "+AoPS.Community.Constants.max_conversation_participants+" participants, including yourself.","pm-notify":"You have received a new private message, {1}, from {0}.","pm-notify-flyout":'You have received a new private message, {1}, from {0}. \t\tClick here to view',"pm-notify-title":"New Private Message","pm-notify-btn-OK":"VIEW MESSAGE","pm-notify-btn-cancel":"CLOSE","post-attachments-default":"Drag your files here, or click here to select files from your computer. Max three files per post.","post-attachments-title":"Attach Files","post-attachments-spoofed":"I don't trust a file you've attached, so you cannot upload it.","post-attachments-bad-file-type":"Sorry, but the file {0} has a file type that I don't like.","post-attachments-no-permission":"You do not have permission to post attachments on this site.","post-attachments-already-attached":"Existing Attachments","post-attachments-file-too-big":"This file is too large. The maximum file size is "+AoPS.Community.Constants.max_attachment_size+"KB.","post-attachments-done":"DONE","post-attachments-invalid-character":"Sorry, your file name has an invalid character. \t\tThe only characters that are allowed are letters, numbers, spaces, dashes, underscores, and periods.","page-title-my-aops":"My AoPS","page-title-reported-posts":"Reported Posts","page-title-search":"Search","user-profile-title":"User Profile","user-profile-browser-title":" User Profile","user-profile-activity":"Activity","user-profile-joined_at":"Joined","user-profile-email":"Email","user-profile-location":"Location","user-profile-status":"Status","user-profile-occupation":"Occupation","user-profile-school":"School","user-profile-goals":"Goals","user-profile-interests":"Interests","user-profile-signature":"Signature","user-profile-friends":"Friends","user-profile-last-visit":"Last Visited","user-profile-total-posts":"Total Posts","user-profile-blog":"Blog","user-profile-website":"Website","user-profile-INACTIVE":"INACTIVE","user-profile-BANNED":"BANNED","user-profile-LIMITED":"LIMITED","user-profile-add-note":"Adding note; page will reload when finished.","user-profile-COPPA":"COPPA","user-profile-thanks-given":'Y Given',"user-profile-thanks-received":'Y Received',"user-profile-no-such-user":"No such user! You asked for user {0}.","user-profile-friend-toggle-off":"Your friends are on your public profile. \nClick to hide them from your public profile.","user-profile-friend-toggle-on":"Your friends are not on your public profile. \nClick to show them on your public profile.","user-profile-add-friend":"Add Friend","user-profile-friend-request":"Has sent you a friend request.","user-profile-friend-ACCEPT":"ACCEPT","user-profile-friend-DECLINE":"DECLINE","user-profile-no-friends":"No AoPS friends yet.","user-profile-unfriend-confirm":"Are you sure you wish to cancel your friendship with {0}?","user-profile-add-friend-instructions":"Make a friend request by entering the username of your potential new\t\tfriend below, and then click OK.

Warning: All your friends can see your Alcumus profile, including your Alcumus statistics.","user-profile-new-friend":"New friend","user-profile-add-friend-modal-title":"Make Friend Request","user-profile-add-friend-title":"Add Friend","user-profile-no-friend-self":"No friending yourself! Choose someone else...","user-profile-add-friend-none-chosen":"Either choose a username or click CANCEL, please.","user-profile-request-sent":"Friend request sent to {0}.","user-profile-friend-request-pending":"Sending your friend request.","user-profile-err-no-perm-friend":"You do not have permission to make friend requests.","user-profile-err-already-friend":"You are already friends with {0}.","user-profile-err-they-asked-you":"The user {0} has already asked you to be friends, so I went ahead and made the\t\ttwo of you friends. You should see {0} among your friends if you refresh the page.","user-profile-err-already-asked":"You have already asked {0} to be your friend.","user-profile-err-not-taking-requests":"The user {0} has left the friends system and is therefore not receiving friend requests.","user-profile-send-request-check":"Send friend request to user {0}?

Warning: Your friends can access your Alcumus profile, including your Alcumus statistics.","user-profile-err-no-request-available":"Uh-oh, I couldn't find the friend request from {0}. That probably means that \t\t{0} just opted out of the friends system.","user-profile-friend-request-accepted":"Friend request from {0} accepted.","user-profile-friend-request-denied":"Friend request from {0} declined.","user-profile-no-my-forums":'My Forums consists of forums you have created, forums you moderate or administrate, or private forums you can access. \t\t\tYou currently have no such forums. Once you have some, you can manage the My Forums page by clicking \t\t\t3 again.',"user-profile-no-my-collections":'My Collections consists of collections you have created, collections you moderate or administrate, or private collections you can access. \t\t\tYou currently have no such collections. Once you have some, you can manage the My Collections page by clicking \t\t\t3 again.',"user-profile-no-my-blogs":'My Blogs consists of blogs you created or contribute to, or private blogs you can access. \t\t\tYou currently have no such blogs. Once you have some, you can manage the My Blogs page by clicking \t\t\t3 again.',"user-profile-click-for-posts":"Click to view posts","user-profile-no-count-note":"*Not included in total","user-profile-no-search-note":"**Forum not searchable","user-profile-pm-title":"Send a private message to this user","user-cell-visit-profile":"Visit user profile","user-bookmark-err-E_ITEM_NUM_LIMITED":"Sorry, you have reached the limit of the number of users that can be bookmarked.","user-bookmark-err-E_NOT_LOGGED_IN":"Sorry, you have been signed out. Please sign back in and try again.","friends-warning":'
Friend Requests
\t\tWarning: All your friends can view your Alcumus profile, including your Alcumus statistics.',"edit-profile-title":"Edit Profile And Account","edit-profile-profile-info":"Profile Information","edit-profile-edit-avatar":"Edit Avatar","edit-profile-delete-avatar":"Delete Avatar","edit-profile-delete-avatar-confirm":"Are you sure you want to delete {0} avatar?","edit-profile-your":"your","edit-profile-this-user":"this user's","edit-profile-new-user":"Your account is too new, so you cannot edit your profile. \t\tYou can only edit your email and password on this page. You will be able to add additional information to your \t\tprofile, such as a status, once your account is over two weeks old.","edit-profile-limited-user":'You currently have a limited account, so you cannot edit your profile. \t\tYou can only edit your password on this page. You will be able to edit your profile if \t\tyou upgrade your account. You can upgrade your account for free here.',"edit-profile-deleting-avatar":"Deleting avatar, back in a sec...","edit-profile-change-password":"Change Password","edit-profile-location-placeholder":"Enter your location.","edit-profile-school-placeholder":"Enter your school.","edit-profile-interests-placeholder":"Enter your interests.","edit-profile-website-placeholder":"Enter your website.","edit-profile-occupation-placeholder":"Enter your occupation.","edit-profile-email-placeholder":"You cannot leave this field blank!","edit-profile-goals-placeholder":"Enter your goals.","edit-profile-status-placeholder":"Enter your status.","edit-profile-inappropriate-term":"Inappropriate language used when setting {0}. \t\tThis field has been reset to its original value.","edit-profile-unknown-error":"Unknown error occurred when setting {0}. \t\tThe error code is {1}.","edit-profile-email-not-available":"The email address {0} is already attached to another\t\tusername. Each email address can be associated with only one user.","edit-profile-current-password":"Current Password","edit-profile-new-password":"New Password","edit-profile-retype-password":"Confirm Password","edit-profile-invalid-common-password":"Sorry, you have selected a new password that is too common. Please select a different one. Your password has not been reset yet.","edit-profile-retype-password-placeholder":"Enter your new password again.","edit-profile-new-password-placeholder":"Enter your desired new password.","edit-profile-current-password-placeholder":"Enter your current password.","edit-profile-passwords-dont-match":"Confirm password does not match new password.","edit-profile-enter-password":"You must enter your current password.","edit-profile-submit-new-password":"Validating new password...","edit-profile-invalid-password":"The current password you entered is not correct. Please try again.","edit-profile-password-changed":"Password changed!","edit-profile-password-too-short":"New password is too short. It must be at least "+AoPS.Community.Constants.min_password_length+" characters.","edit-profile-email-not-valid":"New email is not a valid email address. No change made.","edit-profile-email-not-changed":"New email is the same as the old one. No change needed.","edit-profile-new-email":"A confirmation email has been sent to your requested new address, {0}. \t\tUntil you confirm this new address, the email address associated with this account will remain {1}.","edit-profile-email-change-title":"Change Email","edit-profile-email-change=blocker":"Submitting new email address...","edit-profile-no-perm":"You do not have permission to edit your profile.","edit-profile-not-logged-in":"You are not signed in. You have to sign in to edit your profile.","new-user-my-forums":" New users may create new forums after being members of the AoPS Community for at least two weeks.","new-user-my-blogs":" New users may create new blogs after being members of the AoPS Community for at least two weeks.","new-user-my-collections":" New users may create new collections after being members of the AoPS Community for at least two weeks.","edit-avatar-file-too-big":"This file is too large. The maximum file size is "+AoPS.Community.Constants.max_avatar_file_size+"KB.","edit-avatar-default-message":"Drag your new avatar here, or click here to select a file on your computer.","edit-avatar-dimensions-too-big":"This image's dimensions are too big. The width and height must both be \t\tno more than 100px.","edit-avatar-bad-file-type":"Sorry, we only take JPG and PNG image files.","edit-avatar-bad-file-type-apng":"Sorry, we do not accept animated PNG image files.","edit-avatar-too-many":"Whoa! You should only send one file!!","edit-avatar-no-file":"Um, I think you forgot something. I didn't receive a file.","edit-avatar-no-permission":"You do not have permission to change this avatar.","edit-avatar-title":"Upload Avatar","search-page-title":"Advanced Community Search","search-page-private-title":"Private Message Search","search-results-title-with-text":"for {0}","search-results-edit":"Edit search settings","search-err-no-such-user":"Sorry, I don't know any user with the username {0}.","search-err-no-such-forum":"Sorry, we don't have a forum with the name {0}.","search-validation-blocker":"Validating search parameters...","user-search-posts-category-username":"Posts by {0}","user-search-posts-category-user-id":"Posts by the User with Id {0}","edit-settings-page-title":"Edit Community Settings","edit-settings-general-heading":"General Settings","edit-settings-friends-heading":"Friends","edit-settings-posting-heading":"Posting and Reading","edit-settings-feed-heading":"Feed","edit-settings-pm-heading":"Private Messages","edit-settings-hidden-label":"Hide my online status","edit-settings-hide_feed-label":"Hide the feed","edit-settings-show_tags_on_feed-label":"Show tags in the feed","edit-settings-global_feed_type-label":"Global Feed type","edit-settings-enable_advanced_hotkeys-label":'Enable Advanced Hotkeys',"edit-settings-friends_show_profile-label":"Show my friends on my public profile","edit-settings-friends_exclude-label":"Exclude me from the friends system (and delete all my existing friendships)","edit-settings-posting_subscribe_new_topic-label":"Email me upon replies to any topic I start","edit-settings-posting_subscribe_reply-label":"Email me upon replies to any topic I reply to","edit-settings-posting_fullscreen_reply-label":"Always use full reply (except in feed)","edit-settings-hide_avatars-label":"Hide user avatars on posts and topics","edit-settings-hide_tags_on_topic-label":"Hide the tags on topics","edit-settings-pm_email-label":"Email me whenever anyone sends me a private message","edit-settings-pm_archive_on_send-label":"Archive new private messages I send (not replies; only new topics)","edit-settings-pm_live_notify-label":"Notification method when I receive a private message when I am logged in to AoPS","edit-settings-pm_exclude_self-label":"Prevent users from sending me new private messages (Admins will still be able to send you messages, and users\t\tcan reply to existing messages)","edit-settings-warn_on_snipes-label":"Warning type when a new reply comes in for a topic while I'm typing a reply to topic.","edit-settings-forum_view-label":"Topic cell view style when browsing topics (page will reload on change)","edit-settings-turn_off_autotagging-label":"Turn off autotagging for new topics I post","edit-settings-archive-pm-btn":"Archive All","edit-settings-remove-from-pm-btn":"Remove All","edit-settings-archive-pm-label":"Archive all private messages","edit-settings-remove-from-pm-label":"Remove self from all existing private messages \t\t (you will not be able to access the messages again)","edit-settings-privates-archived":"All private messages archived","edit-settings-archive-confirm":"Are you sure you want to archive all of your private messages? \t\tYou will still be able to access them in your private messages archive.","edit-settings-remove-confirm":"Are you sure you want to remove yourself from all of your private \t\tmessages? This is irreversible; you will not be able to access the messages in the future, \t\tthough the other participants in each message will still be able to access them. You will \t\tbe removed from the messages in both your inbox and your private message archive.","edit-settings-privates-removed":"You have been removed from all of your private messages.","edit-settings-hotkeys-modal-title":"Advanced Hotkeys","edit-settings-no-friends-confirm":"Are you sure you want to remove yourself from the friends system? \t\tAll of your existing friendships will be deleted. They will be reinstated if you return to the friends system.","edit-settings-no-friends-confirm-title":"Leave Friends System?","edit-settings-main-base-view":"Main","edit-settings-portal-base-view":"Portal","edit-settings-base_view-label":'Home page for community (Main \t\tis the primary view of the community, and Portal is the Olympiad & College Portal.)',"edit-settings-please-wait-bkmk":"Hold on a sec... The page will reload when I'm finished \t\tcleaning your bookmarks.","edit-settings-bkmk-all-confirm":"Are you sure you want to delete all {0} from your bookmarks? This \t\twill remove all {0} from your feed and unsubscribe you from all {0}.","edit-settings-bkmk-feed-confirm":"Are you sure you want to delete all bookmarked {0} from your feed? \t\tThese {0} will still be in your bookmarks, and your email subscriptions will not be changed.","edit-settings-bkmk-email-confirm":"Are you sure you want to unsubscribe from all email notifications \t\tabout your currently bookmarked {0}? These {0} \t\twill still be in your bookmarks, and your bookmark feed will be unchanged.","edit-settings-bkmk-heading":"Bookmarked {0}","edit-settings-bkmk-link-all":"Delete All","edit-settings-bkmk-link-feed":"Empty Feed","edit-settings-bkmk-link-email":"Unsubscribe","edit-settings-bkmk-all-label":"Delete all {0} from your bookmarks.","edit-settings-bkmk-feed-label":"Remove all {0} from your feed.","edit-settings-bkmk-email-label":"Unsubscribe from all {0}. (End email notification.)","add-participant-instructions-start":"Enter a username below to add someone to this message.\t\t\tThe new participant will be able to read the entire\t\t\tthread, including posts that occurred before the new participant was\t\t\tadded to the discussion. Also, each private\t\t\tmessage can have no more than","add-participant-instructions-end":"participants.","add-participant":"Add participant","add-participant-add-user":"Add user:","add-participant-placeholder":"Enter username","add-participant-logged-out":"You have been signed out. You will have to sign\t\tback in and try again.","add-participant-no-permission":"You do not have permission to add a participant\t\tto this discussion.","add-participant-removed-user":"This user chose to leave this conversation and cannot\t\t be re-added.","add-participant-to-sheriff":"You cannot add a participant to a private message from the AoPS Sheriff.","add-participant-to-extensions":"You cannot add a participant to a private message from Extensions. If you have an \t\tissue regarding extensions, please email extensions@aops.com.","add-participant-too-late":"You waited too long! It is now past the time limit \t\tto add a user to this discussion.","add-participant-no-more":"Someone beat you to it! This private message now has \t\tthe maximum allowed number of participants.","add-participant-no-self":"You cannot add yourself to a private message!","add-participant-recipient-exclude-self":"The user {0} is not accepting new private messages, \t\tso cannot be added to this discussion.","add-participant-recipient-sheriff":"AoPSSheriff is a system account used to send messages from many \t\tdifferent AoPS administrators. You cannot add the AoPSSheriff to a private message. \t\tTo contact AoPSSheriff about an issue, please email sheriff@aops.com. ","add-participant-recipient-extensions":"Extensions is a system account used to send messages from many \t\tdifferent AoPS administrators. You cannot add Extensions to a private message. \t\tTo contact Extensions about an issue, please email extensions@aops.com. ","add-participant-recipient-exclude-system":"The user {0} cannot receive private messages, \t\tso cannot be added to this discussion.","poll-question":"Poll Question","poll-options":"Poll Options","poll-options-desc":"Place each option on a new line. Enter up to 20 options.","poll-options-per":"Options Per User","poll-length":"Poll Length","poll-unlimited":"Unlimited","poll-len-1-day":"1 day","poll-len-2-days":"2 days","poll-len-3-days":"3 days","poll-len-1-week":"1 week","poll-len-2-weeks":"2 weeks","poll-len-1-month":"1 month","poll-revoting":"Allow Revoting?","poll-cancel":"CANCEL POLL","poll-cancel-title":"Cancel Poll?","poll-cancel-confirm":"Are you sure that you want to cancel this poll?\t\tCanceling the poll only removes the poll options. It does not\t\tcancel the whole topic window.","poll-cancel-no":"DON'T CANCEL","poll-no-question-error":"You must include a Poll Question when posting a poll.","poll-no-inputs-error":"You must include some options for the voters to choose from in your poll.","poll-question-too-short":"Your poll question is not long enough. It must be at least "+AoPS.Community.Constants.min_poll_question_length+" characters.","poll-question-too-long":"Your poll question is too long. It must no more than "+AoPS.Community.Constants.max_poll_question_length+" characters.","poll-display-heading":"Poll:","poll-Vote":" Vote","poll-Votes":" Votes","poll-select-one":"Select {0} option.","poll-select-many":"Select up to {0} options.","poll-revote-btn":"CHANGE VOTE","poll-vote-btn":"VOTE","poll-hide-results":"Hide Results","poll-loading":"Loading poll details...","poll-show-results":"Show Results","poll-not-logged-in":"You must be signed in to vote.","poll-nothing-selected":"Work with me here. You have to choose something to vote!","poll-revote-directions":"You have already voted, but are allowed to change your vote. To change your\t\tvote, make a new selection and click CHANGE VOTE above.","poll-vote-processing":"Recording your vote and tabulating new results. Back in a sec!","poll-err-not-logged-in":"You are not signed in. You must be signed in to vote.","poll-err-closed":"Sorry, but the poll closed while you were voting!","new-item-too-short":"Your entry is too short; it must be at least 2 characters.","new-item-already-added":"You have already added ","new-item-too-many-1":"You can only have ","new-item-too-many-2":"s. You'll have to delete some to add new ones.","post-environ-extra-announce":"Make announcement","post-environ-global-announce":"Make global announcement","post-environ-announce-through":"Announce through:","post-environ-invalid-announce-date":"Invalid announcement end date. The date must be in yyyy-mm-dd format.","post-environ-announce-date-too-early":"The last date of the announcement cannot be in the past! Please try again.","post-environ-announce-date-too-late":"The last date of the announcement cannot be more than 2 years in the future. (Leave date field blank for permanent announcements.)","post-environ-image-error":"Sorry, there is something wrong with one of your img tags. You \t\tmay have entered in an invalid URL, or you might be using the tag incorrectly. Please \t\tread your post closely and try again.","post-environ-tip-error":"Sorry, there is something wrong with one of your tags. The \t\tcontent of tips cannot be empty.","bbcode-title-bold":"Bold text\n[b]text[/b]","bbcode-title-underline":"Underline text\n[u]text[/u]","bbcode-title-italic":"Italic text\n[i]text[/i]","bbcode-title-text-size":"Text size\n[size=NUMBER FROM 50 TO 200]text[/size]","bbcode-title-text-color":"Text color\n[color=#HEX COLOR CODE]text[/color]","bbcode-title-quote":"Quote text\n[quote]quoted text[/quote] -or-\n[quote=]quoted text[/quote]","bbcode-title-list":"List\n[list]Your list here, each item on its own line[/list]","bbcode-title-hide":"Hide text\n[hide]hidden text[/hide] -or-\n[hide=]hidden text[/hide]","bbcode-title-code":"Code formatting\n[code]code[/code] -or-\n[code=]code[/code]","bbcode-title-smiley":"Smileys!","bbcode-title-img":"Image\n[img]image url[/img]","bbcode-title-url":"Link\n[url][/url] -or-\n[url=]text for link[/url]","bbcode-title-attachment":"Add an attachment","bbcode-title-has-attachments":"Attachments:","bbcode-title-poll":"Start a poll","view-posts-click-hidden":"Click to reveal hidden content","post-report-admin-reported-by":"Reported by","post-report-admin-reported-date":"When","post-report-admin-details":"Details","post-report-admin-for":"For","post-report-admin-confirm":"Are you sure you want to resolve this post report?\t\tIf so, you can add notes about the report resolution below.","post-report-admin-confirm-title":"Resolve Post Report","post-report-admin-block":"Hold on a sec; sending your resolved post report to the database.","post-report-admin-page-title":"Reported Posts","post-report-admin-loading":"Hold on a sec, I'm going to see if there are any more reports\t\tfor you.","post-report-no-more":"No more reported posts.","post-report-admin-none":"No reported posts found.","post-report-admin-notes":"Notes","post-report-admin-no-permission":"You do not have permission to resolve this post report.","post-report-admin-page-text":"On this page are the reported posts in the forums\t\tyou moderate and the blogs you administrate. If you reached this page by clicking a report notification on a post or topic,\t\tbut you see no report here, then someone else has beaten you to it! When you return to the\t\ttopic, the notification for that post should no longer appear.","post-report-first-post-note":"Note: This post is the first post in its topic, so\t\tyou cannot simply delete this post. \t\tPlease visit the topic by clicking the topic title, to determine whether or not you\t\tshould delete the whole topic.","post-report-admin-pm":"PM","post-report-admin-pm-poster":"Poster","post-report-pm-subject":"Response to Report","post-report-pm-reporter-preamble":"This message is regarding your report of [url={0}]this post[/url].","post-report-admin-pm-reporter":"Reporter","post-report-pm-reporter":"You submitted the following details in your report:","poll-too-many-selected":"You have chosen too many options. You can only choose up to {0} options.","tag-edit-title":"Edit tags","autocomplete-new-tag":"No tags match.
Press Enter to create tag.","my-aops-Community-Settings":"Edit Community Settings","my-aops-Edit-Profile":"Edit Profile and Account","my-aops-MyForums":"My Forums","my-aops-MyCollections":"My Collections","my-aops-MyBlogs":"My Blogs","my-aops-MyBooks":"My Books","my-aops-MyClasses":"My Classes","my-aops-phone-PM":"PM","my-aops-phone-Bkmk":"Bkmk","my-aops-phone-Fora":"Fora","my-aops-phone-Coll":"Coll.","my-aops-phone-Blogs":"Blogs","cat-admin-general-info":"General Information","cat-admin-description-heading":"Description","cat-admin-in-global-feed":"In Global Feed","cat-admin-global-feed-help":'(See the Feeds section of Community Help for more information.)',"cat-admin-create-button":"CREATE","cat-admin-soft-delete":"Soft Delete","cat-admin-delete":"Delete","cat-admin-hard-delete":"Hard Delete","cat-admin-reported-posts":"Reported Posts","cat-admin-global-automatic":"(Class forums are always included in the Global Feed.)","cat-admin-global-err-E_ALL_GLOBAL_FORA_REMOVED":"You have removed all forums from \t\tyour global feed, so you will have your global feed reset to the default set of forums.","cat-admin-global-err-E_NOT_VALID_FORUM":"Sorry, this category is not a forum \t\tand cannot be added to the global feed.","cat-admin-global-err-E_CLASS_FORA_ALWAYS_IN_GLOBAL":"All class forums are automatically \t\tadded to the global feed.","cat-admin-global-err-E_NOT_LOGGED_IN":"You are no longer signed in. No change made.","cat-admin-global-err-E_GLOBAL_SET_TO_FULL":"Your global feed is currently set to \t\tthe full feed, so you cannot customize it. Edit your Community Settings in the \t\tMy AoPS page to switch to a custom global feed.","cat-admin-global-err-E_TOO_MANY_FEED_FORA":"Sorry, you have reached the limit \t\tof the number of forums you can have in your global feed. The limit is currently \t\t75 forums.","cat-admin-view-log":"View Category Log","cat-admin-delete-blocker":"Deleting now; you will be redirected to the Community homepage when I am finished.","cat-admin-soft-delete-confirm":"Do you really want to delete {0}? This action \t\tis not reversible!","cat-admin-delete-protected":"This is protected; it cannot be deleted.","cat-admin-delete-not-found":"Someone beat you to it. This has already been deleted.","cat-admin-delete-no-permission":"You do not have permission to delete this.","cat-admin-hard-delete-confirm":"Do you really want to HARD delete {0}? This action \t\tis impossible to revert, as it deletes entries from the database entirely.","cat-admin-cat-name-warning":'NOTE: Forum and collection names must be unique. If you choose a name that \t\tsite admins need later, such as "2023 IMO", then we\'ll ask you to change the name at that time.',"cat-admin-create-public-forum-warning":"You have marked this forum public. Any registered\t\tusers will be able to read, post, and reply in this forum. You cannot\t\tchange this forum to private once you have created it. Are you sure you want to create this\t\tforum as public?","cat-admin-create-private-forum-warning":"You have marked this forum private. Only users\t\twho are granted permission to access this forum, and AoPS administrators, will be able to\t\taccess this forum. You cannot\t\tchange this forum to public once you have created it. Are you sure you want to create this\t\tforum as private?","cat-admin-create-public-collection-warning":"You have marked this collection public. Any registered\t\tusers will be able to access this collection. You cannot\t\tchange this collection to private once you have created it. Are you sure you want to create this\t\tcollection as public?","cat-admin-create-private-collection-warning":"You have marked this collection private. Only\t\tyou and AoPS administrators will be able to\t\taccess this collection. You cannot\t\tchange this collection to public once you have created it. Are you sure you want to create this\t\tcollection as private?","cat-admin-create-public-blog-warning":"You have marked this blog public. Any registered\t\tusers will be able to read, shout, and reply in this blog. Are you sure you want to create this\t\tblog as public?","cat-admin-create-private-blog-warning":"You have marked this blog private. Only users\t\twho are granted permission to access this blog, and AoPS administrators, will be able to\t\taccess this blog. Are you sure you want to create this\t\tblog as private?","cat-admin-forum-name-too-short":"Your Forum Name is too short. It must have at least 3 characters.","cat-admin-blog-name-too-short":"Your Blog Name is too short. It must have at least 3 characters.","cat-admin-collection-name-too-short":"Your Collection Name is too short. It must have at least 3 characters.","cat-admin-create-category-blocker":"Hold on a sec while I build this!","cat-admin-back-to-class":"CLASS","cat-admin-back-to-cmty":"COMMUNITY","cat-admin-label-include_in_count":"Include in Post Count","cat-admin-label-include_in_thank_count":'Include in Y Count',"cat-admin-label-include_in_nothank_count":'Include in _ Count',"cat-admin-label-include_in_dynamic_collections":"Include in Dynamic Coll.","cat-admin-admin-item-warning":"Admin-only items; only edit these if you know what you are doing.","cat-admin-forum-name":"Forum Name","cat-admin-forum-name-placeholder":"Name your forum.","cat-admin-forum-desc-placeholder":"Enter a brief description of your forum.","cat-admin-blog-name":"Blog Name","cat-admin-blog-name-placeholder":"Name your blog.","cat-admin-blog-desc-placeholder":"Enter a brief description of your blog.","cat-admin-collection-name":"Collection Name","cat-admin-collection-name-placeholder":"Name your collection.","cat-admin-collection-desc-placeholder":"Enter a brief description of your collection.","cat-admin-permissions-title":"Permissions","cat-admin-permissions-header-forum":"You cannot change the Public/Private setting of a forum once the forum\t\thas been created, so make sure you set it correctly now."+(AoPS.session.a?' Any\t\tadministrators will have this forum added to their "My Forums" automatically.':""),"cat-admin-permissions-header-blog":AoPS.session.a?' Any\t\tadministrators will have this blog added to their "My Blogs" automatically.':"","cat-admin-permissions-header-collection":"You cannot change the Public/Private setting of a collection once the collection\t\thas been created, so make sure you set it correctly now. "+(AoPS.session.a?' Any\t\tadministrators will have this collection added to their "My Collections" automatically.':""),"cat-admin-permissions-public-heading":"Public/Private","cat-admin-permissions-is-locked":"Status","cat-admin-permissions-open":"Open","cat-admin-permissions-locked":"Locked","cat-admin-permissions-has-source":"Has Source","cat-admin-permissions-inherit-head":"Inherit Roles From","cat-admin-permissions-remove-self":"Are you sure you want to remove yourself from the {0} of {1}?","cat-admin-permissions-close-userlist-early":"I hate leaving things half-finished. You started entering\t\ta username, but stopped before you finished. Please either finish entering the username or delete\t\twhat you have entered.","cat-admin-perms-existing-user":"The user {0} is already among the {1}. ","cat-admin-set-role-inherit":"Setting role inheritance and assigning roles from parent...","cat-admin-set-inherit-no-perm":"You do not have permission to set role inheritance.","cat-admin-set-inherit-invalid-parent":"Sorry, you have chosen an invalid parent from which to inherit roles.","cat-admin-no-inherit-from-self":"Nice try. You can't set this to inherit from itself.","cat-admin-inheritance-info":"You can set this {0} to inherit roles from some forum or collection. Any user \t\tthat is given a role on the parent will have the same role here, and any user that loses a role \t\ton the parent will lose that role here.","cat-admin-perms-existing-user-3":"Click OK to switch the user to the list of","cat-admin-perms-help-title":"Permissions Help","cat-admin-is-public-confirm-warning":"Only site admins can toggle public/private status. This should be done very sparingly.","cat-admin-is-public-blocker":"Changing public/private status. Back shortly...","cat-admin-set-blog-public-warning":"Are you sure you want to make this blog public? \t\tAll users will be able to see all posts in your blog.","cat-admin-set-blog-private-warning":"Are you sure you want to make this blog private? \t\tOnly owners and contributors will be able to see the blog, and the blog will \t\tbe removed from all collections it is in.","cat-admin-no-add-admin-start":"The user ","cat-admin-no-add-admin-end":" is an AoPS administrator. The AoPS administrators have phenomenal powers, so they need not\t\tbe added to any of your user groups.","cat-admin-lock-blocker":"Calling the locksmith. Hold on for a minute.","cat-admin-permissions-forum-public-helper":"Any user can read this forum. Any registered user can post and edit tags.","cat-admin-permissions-forum-private-helper":"Only users who are given permission to access this forum can read, post, or edit tags.","cat-admin-permissions-forum-locked-helper":"No one can post in a locked forum.","cat-admin-permissions-forum-open-helper":"Forum is unlocked; anyone who can access can post.","cat-admin-permissions-forum-has-source-helper":"Topics have a source field.","cat-admin-permissions-forum-no-source-helper":"Topics do not have a source field.","cat-admin-permissions-blog-public-helper":"Any user can read this blog. Any registered user can reply to posts and shout.","cat-admin-permissions-blog-private-helper":"Only users who are given permission to access this blog can read posts and reply to them.","cat-admin-permissions-blog-locked-helper":"No one can reply to posts or shout; only owners can post.","cat-admin-permissions-blog-open-helper":"Blog is unlocked; anyone can reply or shout.","cat-admin-permissions-collection-public-helper":"Any user can read this collection.","cat-admin-permissions-collection-private-helper":"Only you can access this collection.","cat-admin-permissions-collection-locked-helper":"Only collection administrators and moderators can edit the contents of this collection.","cat-admin-permissions-collection-open-helper":"Experienced users can edit the contents of this collection.","cat-admin-user-types-forum-owner":"Administrators","cat-admin-user-types-forum-mod":"Moderators","cat-admin-user-types-forum-registered_user":"Users","cat-admin-user-types-forum-deny":"Banned","cat-admin-user-types-collection-owner":"Administrators","cat-admin-user-types-collection-mod":"Moderators","cat-admin-user-types-collection-deny":"Banned","cat-admin-user-types-blog-owner":"Administrators","cat-admin-user-types-blog-contributor":"Contributors","cat-admin-user-types-blog-deny":"Banned","cat-admin-user-types-blog-reader":"Readers","cat-admin-error-E_NOT_LOGGED_IN":"You are not currently signed in. You must be signed in to create a new ","cat-admin-error-E_NO_PERMISSION":"You no longer have permission to create a new ","cat-admin-error-E_PROTECTED":"This category is protected. Even with your admin superpowers, you cannot delete it or change its public/private status.","cat-admin-error-E_NAME_NOT_AVAILABLE":"The name you have chosen is not available.","cat-admin-error-E_NO_SUCH_CATEGORY_TYPE":"No such category type : ","cat-admin-error-E_NAUGHTY_TERM_USED":"You have a disallowed term in your name or description.","cat-admin-error-E_NAME_TOO_SHORT":"The name is too short. It must be at least "+AoPS.Community.Constants.min_category_name_length+" characters.","cat-admin-error-E_NAME_TOO_LONG":"The name is too long. It cannot be more than "+AoPS.Community.Constants.max_category_name_length+" characters.","cat-admin-error-E_DESCRIPTION_TOO_LONG":"The description is too long. It cannot be more than "+AoPS.Community.Constants.max_category_description_length+" characters.","cat-admin-gen-info-error-E_NO_PERMISSION":"You do not have permission to make these changes.","cat-admin-error-nothing-saved":"Nothing has been saved!","cat-admin-blog-settings-title":"Blog Settings","cat-admin-blog-label-show_profile_info":"Show Profile","cat-admin-blog-label-is_primary_blog":"Set As Blog In My Profile","cat-admin-blog-label-show_stats":"Show Stats","cat-admin-blog-label-show_shoutbox":"Show Shoutbox","cat-admin-blog-label-show_contributors":"Show Contributors","cat-admin-blog-label-show_tags":"Show Tags","cat-admin-blog-label-show_custom_block":"Show Custom Block","cat-admin-blog-label-blog_post_comment_text":"Post Comment Text","cat-admin-blog-label-blog_comments_text":"Comments Text","cat-admin-blog-label-blog_one_comment_text":"One Comment Text","cat-admin-blog-label-blog_no_comments_text":"No Comments Text","cat-admin-blog-settings-help-title":"Blog Settings Help","cat-admin-blog-css-title":"Blog Custom CSS","cat-admin-blog-css-new-info":"Once you have created a blog, you can edit its CSS here.","cat-admin-blog-css-existing-info":"Edit your blog's CSS in the textarea below.","cat-admin-blog-css-save-sure":"Are you sure you want to save this CSS? This will \t\toverwrite any old CSS you have.","cat-admin-blog-css-save-block":"Hold on a sec while I save this CSS for you...","cat-admin-blog-css-delete-sure":"Are you sure you want to delete this CSS? This blog will then \t\thave the default AoPS Blog CSS.","cat-admin-blog-css-delete-block":"Hold on a sec while I delete this blog's CSS for you...","cat-admin-blog-css-enter":"Enter CSS for this blog here.","cat-admin-blog-css-none":"This blog does not have any custom CSS.","cat-admin-blog-css-no-perm":"This blog's custom CSS is shown below.","cat-admin-blog-css-no-perm-err":"You do not have permission to edit this blog's CSS.","cat-admin-blog-css-help-title":"Blog CSS Help","cat-admin-blog-css-default-css":"/** This sets the background color of your blog posts. Try changing the color and see what happens! **/\ndiv .entrywrap, div .entrywrap-hover {\nbackground-color : #dedede;\n}","cat-admin-private-collection-perms":"This is a private collection; only you may access it.","cat-admin-location-title":"Location","cat-admin-location-add-to":"Add to","cat-admin-location-contained-in":"Contained in","cat-admin-delete-container-1":"Do you really want to remove this from the collection ","cat-admin-location-help-title":"Location Help","cat-admin-add-to-location-placeholder":"Enter collection name","cat-admin-location-exists":"This {0} has already been added to {1}.","cat-admin-no-description":"None","cat-admin-contents-title":"Contents","cat-admin-contents-title-editing":'Contents: Editing',"cat-admin-contents-help-tooltip":"View Contents Help","cat-admin-add-content-folder-placeholder":"Enter forum, collection, or blogroll name","cat-admin-add-content-my_collections-placeholder":"Enter collection or blogroll name","cat-admin-add-content-my_forums-placeholder":"Enter forum name","cat-admin-add-content-folder_forums-placeholder":"Enter forum name","cat-admin-add-content-bookmark_forums-placeholder":"Enter forum name","cat-admin-add-content-folder_collections-placeholder":"Enter collection or blogroll name","cat-admin-add-content-blogroll-placeholder":"Enter blog name","cat-admin-add-content-my_blogs-placeholder":"Enter blog name","cat-admin-add-content-topic-placeholder":"Enter topic url","cat-admin-contents-building-info":"After creating this collection, you will be redirected to \t\tthis page, and will be able to add items to your collection in this box.","cat-admin-contents-save-blocker":"Saving your changes; back shortly.","cat-admin-contents-save-error":"Sorry, something went wrong while I was trying to save. \t\tI tried to do as much as I could before hitting the error. After you hit OK, the page will \t\treload and you'll see what I finished before crashing.

","cat-admin-contents-unexpected-error":" The only additional detail I have is an error code: {0}.","cat-admin-contents-save-error-E_ITEM_NUM_LIMITED":"Error details: You have exceeded the number of items allowed in \t\tthis collection.","cat-admin-contents-save-error-E_NO_SUCH_POST":"Error details: You have added \t\ta post that no longer exists; perhaps it was just deleted.","cat-admin-contents-save-error-E_NO_PERMISSION":"Error details: You have attempted to \t\tadd a post that you do not have permission to view.","cat-admin-contents-save-error-E_ONLY_PUBLIC_POSTS_ALLOWED":"Error details: You have tried to add a non-public post to this collection. \t\tHowever, this collection is public, \t\tso you can only add public posts to this collection. ","cat-admin-contents-save-error-E_NON_FORUM_POST":"Error details: Only forum posts are allowed in \t\tthis collection. No private messages or blog material is permitted.","cat-admin-contents-no-adding-to-self":"You cannot add this to itself!!!","cat-admin-contents-already-holds":"{0} is already in this collection.","cat-admin-view_posts-already-holds":"Post ID {0}","cat-admin-contents-help-title":"Contents Help","cat-admin-contents-tag-placeholder":"Enter tag","cat-admin-contents-add-tag-error":"Something went wrong when I tried to add tag {0} of Forum {1}. You may\t\twant to refresh and try again.","cat-admin-contents-remove-tag-error":"Something went wrong when I tried to delete \t\t{0}. You may want to refresh and try again.","cat-admin-add-content-tag-forum-placeholder":"Enter forum whose tags you'd like to add","cat-admin-contents-added-tag-already":"The tag {0} of forum {1} has already\t\tbeen added to this collection.","cat-admin-contents-locked-error":"Sorry, this collection has just been locked, so\t\tyou can no longer edit its contents.","cat-admin-contents-add-category-error":"Something went wrong when I tried to add {0} to this collection. You may\t\twant to refresh and try again. Error code: {1}.","cat-admin-no-empty-collections":"You cannot create an empty collection; please add something to this collection.","cat-admin-contents-limit-exceeded":"Sorry, this collection cannot hold more than {0} items.","cat-admin-one-more-step":"After you click OK, I'll build this collection for you, then \t\tbring you right back to this page so you can add items to it.","cat-admin-contents-subscribe":"Receive email notifications if checked","cat-admin-contents-feed":"Appears in Bookmark Feed if checked","cmty-admin-delete-item":"Remove this item.","cat-admin-site-admins-are-admins":"AoPS site admins","cat-admin-no-users-with-this-role":"None","cat-admin-contents-desc-heading":"Contents Description","cat-admin-contents-desc-folder":"This collection can hold other collections and forums.","cat-admin-contents-desc-view_topics":"This collection can hold only forum topics.","cat-admin-contents-desc-view_posts":"This collection can hold posts and custom text.","cat-admin-contents-desc-blogroll":"This collection can hold only blogs.","cat-admin-contents-desc-view_tags":"This collection can hold only tags.","cat-admin-contents-desc-my_forums":"This collection can hold any forum you own or moderate, as well as \t\tany private forum to which you have access.","cat-admin-contents-desc-my_collections":"This collection can hold any collection you own or moderate, as well as \t\tany private collection to which you have access.","cat-admin-contents-desc-bookmark_forums":"This collection holds all the forums you have \t\tbookmarked.","cat-admin-contents-desc-bookmark_users":"This collection holds all the users you have \t\tbookmarked.","cat-admin-contents-desc-bookmark_tags":"This collection holds all the tags you have \t\tbookmarked.","cat-admin-contents-desc-bookmark_topics":"This collection holds all the topics you have \t\tbookmarked.","cat-admin-category-colors":[{label:"Community",color:"#356cb5"},{label:"School",color:"#009fad"},{label:"Games",color:"#c20078"},{label:"Books",color:"#008345"},{label:"Resources",color:"#1f3d7b"}],"cat-admin-contents-desc-my_blogs":"This collection can hold any blog you own or contribute to, as well as \t\tany private blog to which you have access.","cat-admin-contents-desc-folder_forums":"This collection can hold only forums.","cat-admin-contents-desc-folder_collections":"This collection can hold only collections.","cat-admin-contents-sort-heading":"Sorting","cat-admin-contents-current-state":"Current State","cat-admin-contents-edit-btn":"EDIT CONTENTS","cmty-cat-admin-edit-contents-fetch":"Preparing edit window...","cat-admin-contents-current-tab":"Current Contents","cat-admin-contents-available-tab":"Available Contents","cmty-admin-add-topic-error":"You must enter a valid topic id or a URL to a topic \t\tthat is in a forum.","cmty-admin-add-topic-err-not-forum":"You can only add forum topics to this collection.","cmty-admin-add-topic-err-private":"This collection is public, so you cannot topics in \t\tprivate forums.","cmty-admin-add-topic-err-no-topic":"Sorry, I cannot find this topic.","cmty-admin-add-topic-err-no-permission":"Sorry, you do not have permission to access this topic.","cmty-admin-add-topic-blocker":"Hold on while I fetch this topic for you...","cmty-admin-new-post-error-E_LABEL_TOO_LONG":"Your post label is too long; it cannot be more than "+AoPS.Community.Constants.view_post_max_label_len+" characters","cmty-admin-new-post-error-E_INVALID_POST_ID":"You must enter a valid post id or a URL to a forum \t\tpost. To find a post URL, click the post number indicator at the top right of a post. The post \t\tid is the integer following the p.","cmty-admin-new-post-error-E_HIDE_LABEL_TOO_LONG":'Your "Hide Link Text" is too long. It cannot be more than '+AoPS.Community.Constants.view_post_max_hide_label_len+" characters.","cmty-admin-new-post-error-E_NO_CUSTOM_TEXT_ENTERED":"To enter a row of custom text, you must \t\tenter some custom text!","cmty-admin-new-post-error-E_INVALID_POST_TYPE":"You have sent an invalid post type.","cmty-admin-new-post-error-E_BANNED_TERM":"You have submitted a banned term.","cmty-admin-new-post-error-E_NO_SUCH_POST":"Sorry, that post doesn't appear to exist.","cmty-admin-new-post-error-E_NON_FORUM_POST":"You can only add posts that are in forum topics. No \t\tblog posts, blog comments, or private messages are allowed.","cmty-admin-new-post-error-E_NO_PERMISSION":"You do not have permission to \t\taccess this post.","cmty-admin-new-post-error-E_ONLY_PUBLIC_POSTS_ALLOWED":"This collection is public, so you can \t\tonly add public posts to it.","cmty-admin-new-post-error-E_POST_IS_DELETED":"Sorry, that post has been deleted.","cmty-admin-new-post-error-E_LATEX_ERROR":"Sorry, your custom text has a LaTeX error; please fix it and re-submit.","cat-admin-post-construct-blocker":"Constructing post item for this collection.","cat-admin-sort-type-system-my_blogs":"Last blog post time","cat-admin-sort-type-system-view_topics":"Last post time","cat-admin-sort-type-system-bookmark_topics":"Last post time","cat-admin-sort-type-system-blogroll":"Last blog post time","cat-admin-sort-type-system-default":"Special","cat-admin-sort-type-manual":"Manual","cat-admin-sort-type-abc":"Alphabetical","cat-admin-sort-type-manual_then_abc":"Some manual, rest alphabetical","cat-admin-sort-type-yyyy":"By year (all items should start with a year)","cat-admin-sort-type-system-other_forums":"Recent Usage","cat-admin-add-heading-blogroll":"Add blog:","cat-admin-add-heading-view_tags":"Tag forum:","cat-admin-add-heading-my_blogs":"Add blog:","cat-admin-add-heading-topic":"Add topic:","cat-admin-add-heading-folder":"Add item:","cat-admin-add-heading-my_forums":"Add forum:","cat-admin-add-heading-folder_forums":"Add forum:","cat-admin-add-heading-folder_collections":"Add collection:","cat-admin-add-heading-my_collections":"Add collection:","cat-admin-troll-confirm":"This operation is very difficult to undo. Are you certain you want to ban this user as a troll?","cat-admin-thanks-reset":"This user's thanks have now been reset.","feed-topic-full-message-deleted":"The topic you are viewing in the feed has just been deleted.","feed-no-bookmark-options-checked":"Work with me here. If you aren't going to check any options, then I can't fetch you any topics.","feed-new-private-conversation":"Start new message","feed-close":"Close feed","feed-tab-global-title":"Global feed\nRecent topics in any forum\nSee Community Help to customize","feed-tab-global-custom-title":"Global feed\nRecent topics in select forums\nSee Community Help to customize","feed-tab-my-topics-title":"My Topics feed\nTopics I have posted in","feed-tab-private-title":"Private feed\nMy private messages","feed-tab-bookmark-title":"Bookmark feed\nTopics from bookmarked tags, forums, and topics","feed-tab-page-feed-title":"Page feed\n Topics about items on this page","feed-topic-title-tooltip":"Click to visit this topic in main window.","feed-forum-title-tooltip":"Click to visit this forum in main window.","feed-page-subfeed-header":"Page Feed","feed-bookmarks-subfeed-header":"My Bookmarks","feed-global-subfeed-header":"Global Feed","feed-ego-subfeed-header":"My Topics","feed-messages-subfeed-header":"My Messages","feed-no-forum":"Sorry, this object does not have a forum attached yet, so you cannot create a new topic.","feed-no-read-permission":"Sorry, you don't have permission to read this topic.","feed-no-topic":"Well, that's embarrassing. I can't find the topic attached to this object.","feed-community-disabled":"The community has been disabled.","feed-re-sort":"Re-sort this feed","feed-my-topics-onclick":"With {0} of a topic in your My Topics feed, you \t\tmay either open the topic in another tab or remove the topic from the \t\tMy Topics feed. If you remove the topic from the My Topics feed, it \t\twill reappear in the My Topics feed if you post in the topic again.","feed-my-topics-open-new":"Open in new tab","feed-my-topics-remove":"Remove from My Topics","blog-post-new-entry":"Post New Entry","blog-edit-post":"Edit","blog-delete-post":"Delete","blog-moderate-post":"Moderate","blog-report-post":"Report","blog-post-comment":"Comment","blog-shout":"shout","blog-shout-err-E_LATEX_ERROR":"Sorry, you have a LaTeX error in your message.","blog-shout-err-E_ASY_ERROR":"Sorry, you have an Asymptote error in your message.","blog-shouts":"shouts","blog-Tags":"Tags","blog-Comment":" Comment","blog-Comments":" Comments","blog-default-comments":"%s Comments","blog-default-one-comment":"One Comment","blog-default-no-comments":"No Comments","blog-default-post-comments":"(Post Your Comment)","blog-about-owner":"About Owner","blog-posts":"Posts:","blog-joined":"Joined:","blog-location":"Location:","blog-stats":"Blog Stats","blog-created":"Blog created:","blog-entries":"Total entries:","blog-visits":"Total visits:","blog-comments":"Total comments:","blog-archive-title":"Archives","blog-shoutbox-title":"Shouts","blog-one-char-left":"character left","blog-characters-left":"characters left","blog-no-shoutbox-spamming":"You must wait until someone else shouts to shout again!","blog-Entries":"Entries","blog-Entry":"Entry","blog-no-topics":"No posts in this blog. Yet!","blog-no-results":"No results found.","blog-shout-blocker":"Sending your shout. Back shortly....","blog-contributors-title":"Contributors","blog-search-heading":"Search Blog","blog-search-placeholder":"Enter term","blog-search-button":"Search","blog-search-advanced":"Advanced Search","blog-search-advanced-tooltip":"View advanced search options","blog-subscribed-notify":"You will now receive email notifications when this blog has new posts.","blog-unsubscribed-notify":"You will no longer receive email notifications when this blog has new posts.","blog-subscribe-tooltip":"Click to receive email notifications for new posts in this blog","blog-unsubscribe-tooltip":"Click to stop receiving email notifications for new posts in this blog","change-blog-err-E_NO_PERMISSION":"Sorry, you no longer have permission to change this setting. Your changes have not been saved.","blog-shout-no-permission":"You do not have permission to shout in this blog.","blog-shout-no-permission-limited":'You have a limited account, so you cannot shout in blogs. \t\tYou can upgrade your account for free here.',"cmty-tag-term-no-tags":"No tags found; press Enter to add as a new tag.","cmty-tag-info-no-match":"No matches found","cmty-tag-info-no-tag":"No tag found","cmty-tag-info-tag":"Tag: ","cmty-tag-mapper-enter-term":"Enter term to attach to tag (hit enter to add): ","cmty-tag-info-delete":"DELETE FROM ALL FORUMS","cmty-tag-info-delete-in-checked":"DELETE FROM CHECKED CATEGORIES","cmty-tag-info-delete-everywhere":"DELETE EVERYWHERE (RARE)","cmty-tag-edit-capitalization":"New capitalization of tag (enter to submit): ","cmty-tag-info-merge-prompt":"Merge to tag (hit enter to submit): ","cmty-term-add-edit":"Add/edit term","cmty-tag-add-edit":"Add/edit tag","cmty-tag-info-delete-all-fora-confirm":"This will delete the tag {0} \t\tin all forums. It will not delete the tag in private messages, nor in blogs. \t\tNOT EASILY REVERSIBLE, DO NOT SCREW THIS UP. Are you sure you want to \t\tdo this?","cmty-tag-info-recapitalization-fail":"The new tag text must be exactly the same as \t\tthe original text, but with different capitalization. No change will be made until you do it right.","cmty-tag-info-recapitalization-confirm":"Are you sure you want to re-capitalize all tags of the \t\tform {0} as {1} instead?","cmty-tag-info-recapitalization-blocker":"Being the Fed, back shortly.","cmty-tag-term-mapper-warning":"Warning: Changes will not take effect for you until reloading the community in your browser.","cmty-tag-info-delete-some-fora-confirm":"This will delete the tag {0} \t\tin the following categories: {1}.

\t\tNOT EASILY REVERSIBLE, DO NOT SCREW THIS UP. Are you sure you want to \t\tdo this?","cmty-tag-info-delete-everywhere-confirm":"YOU SHOULD ONLY DO THIS WITH A TAG YOU \t\tWANT TO PUT ON THE BLACKLIST. If you go ahead with this, this tag will be removed \t\tfrom everything, and you should immediately talk to a webmasterish person about putting \t\tthe term on the blacklist in CmtyTags.","cmty-tag-info-delete-blocker":"Deleting tag, back shortly...","cmty-tag-info-merge-tag-confirm":"Are you sure you want to merge the tag {0} into the tag \t\t{1}? This will only affect tags in forums.

THIS IS NOT REVERSIBLE, unless you \t\tgo through every single topic hand by hand. Have fun with that. Note: Tag counts for the merged-to \t\ttag will not be updated until another topic gets that tag in a forum. That's because I don't like \t\tcounting things.","cmty-tag-info-merge-tag-forums-confirm":"Are you sure you want to merge the tag {0} into the tag \t\t{1}? This will only affect tags in the following forums: {2}.

THIS IS NOT REVERSIBLE, unless you \t\tgo through every single topic hand by hand. Have fun with that. Note: Tag counts for the merged-to \t\ttag will not be updated until another topic gets that tag in a forum. That's because I don't like \t\tcounting things.","cmty-tag-info-merge-note":'Notes on merging: DO NOT USE THIS FOR RESTRICTED/HIDDEN TAGS. Also, \t\tthe system will only recompute tag counts if you manually select fora below, and there are fewer than 5 of them. Counting is hard, yo. \t\tOtherwise, tag counts won\'t get reset until something gets tagged with the merged-to tag. Most notably, if the \t\tmerged-to tag did not exist prior to merge, it will only appear in the box after merge if you manually choose few \t\tfora for merging.',"view-posts-view-topic":"view topic","embed-err-no-topic":"Sorry, the topic you seek is not in this forum anymore. Maybe it never was here...","embed-halper-no-topic":"This topic seems to be closed. Try finding it in its native forum.","memberlist-page-title":"Memberlist","memberlist-user-search":"User Search","memberlist-user-search-placeholder":"Enter a username. Use * as a wildcard.","memberlist-joined":"Joined","memberlist-last-visit":"Last Visit","memberlist-posts":"Posts","memberlist-thanks":"Y Received","memberlist-no-matches":"No users match your search, sorry!","memberlist-posts-tooltip":"Number of posts in the community. \nDoes not include posts in the \npink games-related forums.","memberlist-thanks-tooltip":"Number of times this user has received a thumbs-up.","userlist-edit":"Edit user list","my-bookmarks-long-desc":'Bookmarks allow you to collect content that you would like to access easily from your My AoPS page or your feed.
\t\tBookmark a forum, tag, topic, or user by clicking the BBookmark icon associated with the item.',"log-admin-confirm-revert":"Are you sure you want to revert these {0} action(s)? Make sure you \t\thave chosen the correct action(s) to revert; you can't easily reverse this...","log-admin-nothing-to-revert":"Um, you have to choose something to revert...","log-admin-blocker-revert":"Hold on while I clean up this mess.","log-admin-page-title":"Log Admin","log-admin-time":"The previous query took {0} milliseconds."},AoPS.Community.Constants.bbCode.font_sizes=[{size:50,text:"Too small"},{size:75,text:"Small"},{size:100,text:"Medium"},{size:150,text:"Large"},{size:200,text:"Too large"}],AoPS.isUserLimited()?AoPS.in_academy?AoPS.Community.Constants.bbCode.extra_options=[{property:"disable_bbcode",text:"Disable bbCode",class_id:"cmty-post-extra-disable-bbcode"},{property:"bookmark_feed",text:"Add topic to Bookmarks feed",class_id:"cmty-post-extra-add-feed"}]:AoPS.Community.Constants.bbCode.extra_options=[{property:"disable_bbcode",text:"Disable bbCode",class_id:"cmty-post-extra-disable-bbcode"}]:AoPS.Community.Constants.bbCode.extra_options=[{property:"disable_bbcode",text:"Disable bbCode",class_id:"cmty-post-extra-disable-bbcode"},{property:"notify_email",text:"Subscribe to this topic",class_id:"cmty-post-extra-email"},{property:"bookmark_feed",text:"Add topic to Bookmarks feed",class_id:"cmty-post-extra-add-feed"}]; ;function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}AoPS.hasOwnProperty("Community")||(AoPS.Community={}),AoPS.Community.is_active=AoPS.bootstrap_data.hasOwnProperty("is_community_active")&&AoPS.bootstrap_data.is_community_active,AoPS.Community.Utils={ajax_runner:new AoPS.Ajax.ScriptRunner("/m/community/ajax.php"),onclick_latex_activated:!1,activateLatexOnclick:function(){AoPS.Community.Utils.onclick_latex_activated||($(document).on("click","img.latex, img.latexcenter",(function(t){AoPS.bootstrap_data.is_sp2&&$(this).parents(".aops-transporter-main").length||t.metaKey||t.ctrlKey||$(this).attr("alt")&&0===$(this).closest(".aops-modal-body").length&&AoPS.Community.Utils.throwLaTeXOnModal({event:t,latex_image:this})})),$(document).on("click","img.asy-image",(function(t){AoPS.bootstrap_data.is_sp2&&$(this).parents(".aops-transporter-main").length||$(this).parents(".motor-homework-body").length||t.metaKey||t.ctrlKey||$(this).attr("alt")&&0===$(this).closest(".aops-modal-body").length&&AoPS.Community.Utils.throwAsyOnModal({event:t,asy_image:this})})),AoPS.Community.Utils.onclick_latex_activated=!0)},throwLaTeXOnModal:function(t){var e,o=t.latex_image.cloneNode(!1),r=$.trim(_.escape(t.latex_image.alt)).replace(/(?:\r\n|\r|\n)/g,"
");(e=$('
').append(o)).append('
\t\t\t\t\t\t\t
LaTeX code below
\t\t\t\t\t\t\t
'+r+"
\t\t\t\t\t\t
"),e.showModal&&e.showModal({frame_class:"latex-modal-wrapper",max_width:"500px",scrollable:!0})},formatUrl:function(t){return"http://"===t.substr(0,7)||"https://"===t.substr(0,8)?t:"http://"+t},idler_started:!1,is_cmty_asleep:!1,putCommunityToSleep:function(t){AoPS.Community.Utils.cmty_ajax.ajax_active=!1,AoPS.Community.Utils.is_cmty_asleep=!0,t&&"E_INVALID_SESSION_WRONG"===t.error_type&&(AoPS.Community.Lang["community-asleep"]=AoPS.Community.Lang["community-asleep-session"],AoPS.Community.Lang["community-asleep-save"]=AoPS.Community.Lang["community-asleep-save-session"],AoPS.Community.Lang["community-asleep-reminder"]=AoPS.Community.Lang["community-asleep-reminder-session"]),AoPS.Ui.Modal.showMessage(AoPS.Community.Lang["community-asleep"],{width:"450px"}),_.isUndefined(AoPS.Community.Utils.idle_monitor_interval)||(clearInterval(AoPS.Community.Utils.idle_monitor_interval),this.idler_started=!1),"object"===_typeof(AoPS.Community.MasterModel)&&AoPS.Community.MasterModel.set("cmty_status","disabled")},startIdleMonitor:function(){var t=Date.now();this.idler_started||($(document).on("mousemove touchmove click keypress",(function(e){t=Date.now()})),AoPS.Community.Utils.idle_monitor_interval=setInterval((function(){var e=Date.now(),o=AoPS.Community.Constants.intervals.current.put_community_to_sleep_limit;e-t>=o&&AoPS.Community.Utils.putCommunityToSleep()}),AoPS.Community.Constants.idle_monitor_interval))},throwAsyOnModal:function(t){var e,o=t.asy_image.cloneNode(!1),r=$.trim(_.escape(t.asy_image.alt)).replace(/(?:\r\n|\r|\n)/g,"
");(e=$('
').append(o)).append('
\t\t\t\t\t\t\t
Asymptote code below
\t\t\t\t\t\t\t
'+r+"
\t\t\t\t\t\t
"),e.showModal({frame_class:"latex-modal-wrapper",max_width:"500px",scrollable:!0})},extractValueFromUrl:function(t,e){var o;return _.isNull(e)?0:(o=e.match(new RegExp(t+"(\\d+)")),_.isNull(o)?0:parseInt(o[1]))},hexToRgb:function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},cmty_ajax:{queue:[],has_active_call:!1,time_profiling:!0,ajax_active:!0,fail_level:0,add:function(t){var e=_.extend({never_cancel:!1,source:"master",call_cancel_on_timeout:!1},t);this.ajax_active?this.has_active_call?(e.hasOwnProperty("queue_limit")&&this.queue.length>e.queue_limit&&this.queueLimit(e),t.hasOwnProperty("extra_ajax_runner_options")&&t.extra_ajax_runner_options.hasOwnProperty("queue_at_front")&&t.extra_ajax_runner_options.queue_at_front?this.queue.unshift(e):this.queue.push(e)):this.run(e):this.checkWarnCmtyAsleep()},clearCallsOfType:function(t){var e=[];_.each(this.queue,(function(o){o.a!==t&&e.push(o)})),this.queue=e},queueLimit:function(t){this.hasHandler(t,"onQueueLimit")&&t.extra_handlers.onQueueLimit()},onAjaxUnknown:function(t){var e,o=this,r=AoPS.Community.Lang;e=AoPS.Community.Constants.base_delay_internet_issue*Math.pow(2,this.fail_level),this.fail_level<4?(this.queue.unshift(this.active_call),AoPS.Ui.Flyout.display(AoPS.Community.Utils.formatString(r["ajax-error-delay"],[e]),{class:"flyout-atop-modal"}),setTimeout((function(){o.runNext()}),1e3*e),console.log("E_AJAX_UNKNOWN: Try again in "+e+" seconds."),this.fail_level++):(this.ajax_active=!1,AoPS.Community.Views.showErrorAtopAModal(r["ajax-error-E_AJAX_UNKNOWN"]))},prepare:function(t){var e,o=this;return e=function(e,r){if(e||"E_INVALID_SESSION_WRONG"!==r.error_code){if(t.main_handler(e,r),o.time_profiling&&AoPS.session.a&&r.hasOwnProperty("response")&&r.response.hasOwnProperty("time_in_script"),e)o.hasHandler(t,"onFinish")&&t.extra_handlers.onFinish(r.response),"string"==typeof r.response.cmty_status&&"object"===_typeof(AoPS.Community)&&"object"===_typeof(AoPS.Community.MasterModel)&&AoPS.Community.MasterModel.set("cmty_status",r.response.cmty_status);else{if("E_AJAX_TIMEOUT"===r.error_code&&t.call_cancel_on_timeout&&(r.error_code="E_AJAX_CANCEL"),"E_AJAX_UNKNOWN"===r.error_code||"E_AJAX_BADRETURN"===r.error_code)return o.onAjaxUnknown(),void(o.ajax_active||AoPS.Ui.Modal.applyKillPhrase("ajax-error-kill"));"E_AJAX_FILTERED"===r.error_code?(console.log("call filtered"),o.hasHandler(t,"onAjaxFilter")&&t.extra_handlers.onAjaxFilter()):(o.hasHandler(t,"onError")&&"E_COMMUNITY_DEACTIVATED"!==r.error_code&&t.extra_handlers.onError(r),"E_COMMUNITY_DEACTIVATED"===r.error_code&&o.hasHandler(t,"onDeactivated")&&t.extra_handlers.onDeactivated())}o.fail_level=0,o.runNext()}},{a:t.a,params:t.params,handler:e}},run:function(t){var e,o;this.ajax_active,e=this.prepare(t),o=t.hasOwnProperty("extra_ajax_runner_options")?t.extra_ajax_runner_options:{},this.ajax_active?(this.active_call=t,this.has_active_call=!0,AoPS.Community.Utils.ajax_runner.run(e.a,e.params,e.handler,o),this.current_ajax_runner_id=AoPS.Community.Utils.ajax_runner.getRunningQueueId()):this.checkWarnCmtyAsleep()},checkWarnCmtyAsleep:function(){AoPS.Community.Utils.is_cmty_asleep&&AoPS.Ui.Flyout.display(AoPS.Community.Lang["community-asleep-reminder"],{class:"flyout-atop-modal"})},runNext:function(){var t,e=this;if(AoPS.Community.is_active&&this.ajax_active)this.queue.length>0?(t=this.queue.shift(),setTimeout(_.bind((function(){this.run(t)}),this),400)):(this.current_ajax_runner_id=0,this.active_call=null,this.has_active_call=!1);else{var o=this.queue;this.queue=[],_.each(o,(function(t){e.prepare(t).handler(!1,{error_code:"E_COMMUNITY_DEACTIVATED"})}))}},hasHandler:function(t,e){return t.hasOwnProperty("extra_handlers")&&"function"==typeof t.extra_handlers[e]},cancelAll:function(t){var e=this,o=[];_.each(this.queue,(function(r){e.checkCancel(t,r)?e.hasHandler(r,"onError")&&r.extra_handlers.onError({error_code:"E_AJAX_CANCEL"}):o.push(r)})),this.has_active_call&&this.checkCancel(t,this.active_call)&&AoPS.Community.Utils.ajax_runner.cancelQueueId(this.current_ajax_runner_id),this.queue=o},checkCancel:function(t,e){return!e.never_cancel&&("all"===t.cancel_type||"feed"===t.cancel_type&&"feed"===e.source||"master"===t.cancel_type&&"master"===e.source)}},autotagger:function(){var t={};return t.dictionary=AoPS.Community.hasOwnProperty("term_tag_map")?AoPS.Community.term_tag_map:{},t.min_spellcheck_len=6,t.spellcheck=function(e){var o,r,a,n,s,i,l,c="abcdefghijklmnopqrstuvwxyz";for(o=0;o0&&(i=e.slice(0,o-1)+s+e.substr(o-1,1)+n,t.dictionary.hasOwnProperty(i)))return t.dictionary[i]}for(r=0;r<26;r++)if(i=e+c.substr(r,1),t.dictionary.hasOwnProperty(i))return t.dictionary[i];return[]},t.tag=function(e){return t.dictionary.hasOwnProperty(e)?t.dictionary[e]:e.length>=t.min_spellcheck_len?t.spellcheck(e):[]},t}(),buildUsernameAutocomplete:function(t,e){var o,r,a=function(){},n=function(){};r=(e=_.extend({has_search_icon:!1},e)).has_search_icon?"left-21 top+5":"left top+5";var s=_.extend({match_type:"from_start_then_any",ui_class:"cmty-username-autocomplete",delay:250,is_case_sensitive:!1,onOpen:function(){},source:function(o,r){var s=AoPS.Community.Utils.cmty_ajax;s.clearCallsOfType(e.ajax_call),s.add({a:e.ajax_call,params:_.extend({username_stub:o.term},e.hasOwnProperty("additional_ajax_settings")?e.additional_ajax_settings:{}),main_handler:function(e,s){var i,l=t.val().substr(0,t[0].selectionStart);o.term!==l&&r([]),e?(0===(i=_.map(s.response.usernames,(function(t){return _.defaults(t,{label:t.value})}))).length?n():a(),r(i)):r([])}})},_renderItem:function(t,e){var o=$("
  • "),r=$(""+e.label+"");return o.append(r),"1"===e.is_admin&&r.addClass("cmty-user-admin"),o.appendTo(t)},num_matches:10,position:{my:r}},e.autocomplete_settings);t.wrap($('
    ')),e.has_search_icon&&(t.before('M'),t.parent().addClass("cmty-search-with-icon")),t.aopsAutocomplete(s),e.hasOwnProperty("show_no_results_msg")&&e.show_no_results_msg&&(o=e.hasOwnProperty("$no_results")?e.$no_results:$('
    '+AoPS.Community.Lang["search-no-match"]+"
    "),t.before(o),t.on("blur remove",(function(){o.hide()})),a=function(){o.hide()},n=function(){o.show(),o.position({my:"left-1 top+1",at:"left bottom",of:t})})},buildCategoryAutocomplete:function(t,e){var o,r,a=function(){},n=function(){};r=(e=_.extend({include_wrapper:!0,has_search_icon:!1},e)).has_search_icon?"left-21 top+5":"left top+5";var s=_.extend({match_type:"from_start_then_any",delay:250,onOpen:function(){t.autocomplete("widget").width(AoPS.Community.Constants.category_autocomplete_width)},is_case_sensitive:!1,source:function(o,r){var s=AoPS.Community.Utils.cmty_ajax;s.clearCallsOfType(e.ajax_call),s.add({a:e.ajax_call,params:_.extend({category_stub:o.term},e.hasOwnProperty("additional_ajax_settings")?e.additional_ajax_settings:{}),main_handler:function(e,s){var i,l=t.val().substr(0,t[0].selectionStart);o.term!==l&&r([]),e?(0===(i=_.map(s.response.categories,(function(t){return _.defaults(t,{label:t.value})}))).length?n():a(),r(i)):r([])}})},_renderItem:function(t,e){var o=$("
  • ").addClass("cmty-category-autocomplete-item-"+e.category_type).css({color:e.main_color}),r=$('').text(e.label).css({color:e.main_color}).data({"main-color":e.main_color,"secondary-color":e.secondary_color});return o.append(r).appendTo(t)},onFocus:_.bind((function(t,e){this.hasOwnProperty("focus_element")&&!_.isNull(this.focus_element)&&this.focus_element.css({color:this.focus_element.data("main-color"),"background-color":""}),this.focus_element=$(t.originalEvent.target).find("a.ui-state-focus"),this.focus_element.css({color:this.focus_element.data("secondary-color"),"background-color":this.focus_element.data("main-color")})}),this),num_matches:10,position:{my:r},ui_class:"category-autocomplete"},e.autocomplete_settings);e.include_wrapper&&(t.wrap($('
    ')),e.has_search_icon&&(t.before('M'),t.parent().addClass("cmty-search-with-icon"))),t.aopsAutocomplete(s),e.hasOwnProperty("show_no_results_msg")&&e.show_no_results_msg&&(o=e.hasOwnProperty("$no_results")?e.$no_results:$('
    '+AoPS.Community.Lang["search-no-match"]+"
    "),t.before(o),t.on("blur remove",(function(){o.hide()})),a=function(){o.hide()},n=function(){o.show(),o.position({my:e.has_search_icon?"left-22 top+4":"left-1 top+1",at:"left bottom",of:t})})},fetchUsernameMatches:function(t){this.cmty_ajax.clearCallsOfType("fetch_username_matches"),this.cmty_ajax.add({a:"fetch_username_matches",params:{username_stub:t.request.term},main_handler:_.bind((function(e,o){var r;t.hasOwnProperty("checkSquelch")&&t.checkSquelch()?t.response([]):e?(r=_.map(o.response.usernames,(function(t){return _.defaults(t,{label:t.value})})),t.response(r)):t.response([])}),this)})},checkValidUsername:function(t){this.cmty_ajax.add({a:"check_valid_username",params:{username:t.username},main_handler:function(t,e){},extra_handlers:t})},capitalizeFirstLetter:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},displayCategoryType:function(t){return AoPS.Community.Lang[AoPS.Community.Utils.simplifyCategoryType(t)]},format_str_regexp:new RegExp("{-?[0-9]+}","g"),formatString:function(t,e){return t.replace(AoPS.Community.Utils.format_str_regexp,(function(t){var o=parseInt(t.substring(1,t.length-1));return o>=0?e[o]:-1===o?"{":-2===o?"}":""}))},lastRegexp:/(^Last\s)/,makePrettyTime:function(t){var e,o,r=parseInt(moment().format("X"))-t;return r0&&o<12e4&&(e=moment().subtract(2,"seconds")),e.fromNow()):(e=moment(String(t),"X").add("milliseconds",-AoPS.Community.Constants.moment_offset),r0&&o<12e4&&(e=moment().subtract(2,"seconds")),e.fromNow()):(e=moment(String(t),"X").add("milliseconds",-AoPS.Community.Constants.moment_offset),rThis message brought to you by the errors object near the top of the Community Router object."}},url_parameters:[{letter:"c",property:"category_id"},{letter:"x",property:"priv_id"},{letter:"u",property:"user_id"},{letter:"q",property:"search_id"},{letter:"t",property:"tag_id"},{letter:"f",property:"tag_forum_id"},{letter:"h",property:"topic_id"},{letter:"p",property:"post_id"},{letter:"s",property:"state"}],parsePreloadedData:function(){var t,e=AoPS.bootstrap_data.preload_cmty_data,o=s("category_id"),r=s("topic_id"),a=s("post_id"),n=s("user_id");function s(t){return e.hasOwnProperty(t)?e[t]:0}return e.hasOwnProperty("error")?(this.processError(e.error),!0):(e.hasOwnProperty("topic_data")&&(t=this.models.master.processPotentialNewTopic(e.topic_data),this.preloaded_topic_id=r,t.set("last_posts_update_time",e.topic_data.last_posts_update_time)),e.hasOwnProperty("user")&&this.models.master.get("users").add(new AoPS.Community.Models.User(e.user)),!(!e.hasOwnProperty("rewrite_url")||!e.rewrite_url)&&(this.rebuildPageFromStart({category_id:o,topic_id:r,post_id:a,priv_id:0,user_id:n,search_id:0,tag_id:0,tag_forum_id:0,state:0}),!0))},throwError:function(t){this.myPage.throwError({error_type:"custom",error_msg:t})},throwNoPermissions:function(){AoPS.session.logged_in?this.throwError(AoPS.Community.Lang["router-err-no-perms-logged-in"]):this.throwError(AoPS.Community.Lang["router-err-no-perms-logged-out"])},processError:function(t){switch(t){case"E_NO_SUCH_POST":this.throwError(AoPS.Community.Lang["router-err-no-post"]);break;case"E_NO_SUCH_TOPIC":this.throwError(AoPS.Community.Lang["router-err-no-topic"]);break;case"E_NOT_PARTICIPANT":this.throwError(AoPS.Community.Lang["router-err-not-participant"]);break;case"E_NO_PERMISSION":AoPS.session.logged_in?this.throwError(AoPS.Community.Lang["router-err-no-perms-logged-in"]):this.throwError(AoPS.Community.Lang["router-err-no-perms-logged-out"]);break;case"E_TOPIC_DELETED":this.throwError(AoPS.Community.Lang["router-err-topic-deleted"]);break;case"E_NO_SUCH_CATEGORIES":this.throwError(AoPS.Community.Lang["router-err-no-such-category"])}},rebuildUrl:function(t){var e="";return _.each(this.url_parameters,(function(o){var r,a;e+=(r=o.letter,a=o.property,0!=t[a]?r+t[a]:"")})),0===e.length?(Backbone.history.navigate(e,{trigger:!0,replace:!1}),!1):(Backbone.history.navigate(e,{trigger:!1,replace:!0}),!0)},rebuildPageFromStart:function(t){this.rebuildUrl(t)&&(this.myPage.showBreadcrumbs(),this.startConstructingPage(t))}}),simplifyCategoryType:function(t){switch(t){case"forum":case"forum_class":return"forum";case"blog":return"blog";default:return"collection"}},renderNumberWithCommas:function(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},mouseOverTip:function(t){var e=t.next(),o=e.next();e.toggle(),o.toggle(),t.toggleClass("cmty-tip-open"),t.addClass("first-time");var r,a=t.offset().top+t.height();e.offset({top:a,left:t.offset().left+t.outerWidth()/2-6});var n=t.offset().left-t.parent().offset().left,s=t.parent().outerWidth()-n-t.outerWidth(),i=o.outerWidth()>t.outerWidth()+2*s;r=i===o.outerWidth()>t.outerWidth()+2*n?t.offset().left+t.outerWidth()/2-o.outerWidth()/2:i?t.offset().left+t.outerWidth()+s-o.outerWidth():t.offset().left-n,o.offset({top:a+7.5,left:r})},mouseOutTip:function(t){t.next().toggle(),t.next().next().toggle(),t.toggleClass("cmty-tip-open")},clickMidlineHide:function(t){return t.next().next().toggle(),t.toggleClass("cmty-hide-open"),!1},clickHide:function(t){return t.next().toggle(),t.toggleClass("cmty-hide-open"),!1},onClickBan:function(t){AoPS.Community.MasterModel.banAsSpammer({user_id:t.currentTarget.getAttribute("user_id")}),$(t.currentTarget).hide()},onClickTroll:function(t){AoPS.Ui.Modal.showConfirm(AoPS.Community.Lang["cat-admin-troll-confirm"],(function(e){e?(AoPS.Community.MasterModel.banAsSpammer({user_id:t.currentTarget.getAttribute("user_id"),is_troll:!0}),$(t.currentTarget).hide(),AoPS.Ui.Modal.closeTopModal()):AoPS.Ui.Modal.closeTopModal()}),{close_on_button_click:!1})},onClickTempBan:function(t){var e=_.omit(t,"success"),o=AoPS.View.compileTemplate("#cmty-user-temp-ban-tpl"),r=$("
    ").append($.parseHTML($.trim(o&&o(e))));e.can_temp_ban&&e.can_access&&r.find(".yeet-box").after($("
    ").css("margin-bottom","15px").append($("

    ").text("Reason:")).append(AoPS.Community.Utils.getModerationInputsForType("mod")));var a=AoPS.Ui.Modal[e.can_temp_ban?"showConfirm":"showAlert"](r,(function(o){var n=r.find("input[name='action']:checked").val()||"",s=r.find("input[name='reason']:checked").val()||"";o&&e.can_temp_ban&&n&&AoPS.Community.MasterModel.handleTempBan({user_id:t.user_id,action:n,reason:s,success:t.success}),AoPS.Ui.Modal.removeModal(a)}),{close_on_button_click:!1})},getModerationReasonsForType:function(t){return(_.findWhere((AoPS.bd||{}).all_moderation_reasons||[],{type:t})||{}).reasons||[]},getModerationInputsForType:function(t){return _.reduce(AoPS.Community.Utils.getModerationReasonsForType(t),(function(t,e){return t.append($(""+t.link_text+""),o=t.hasOwnProperty("bold")&&t.bold;return i.on("click",(function(){t.action()})),e.append($('').append(i)),e.append($('")),e},t.buildEditableRow=function(t){var i,o,s,n,a=!t.hasOwnProperty("submit_on_enter")||t.submit_on_enter,r=AoPS.View.compileTemplate("#cmty-editable-row-tpl"),l=$('L'),c=t.hasOwnProperty("length_limit")?t.length_limit:0,d=t.hasOwnProperty("content")?t.content:"";return(i={is_active:!1,allow_ctrl_biu:!!t.hasOwnProperty("allow_ctrl_biu")&&t.allow_ctrl_biu,label:t.label,placeholder:t.hasOwnProperty("placeholder")?t.placeholder:"",contents:d,reset:function(){i.$input.text(i.contents),i.$input.append(l)},activate:function(){o.show(),i.$element.addClass("cmty-editable-active-row"),i.is_active=!0},deactivate:function(){o.hide(),i.$element.removeClass("cmty-editable-active-row"),i.is_active=!1},renderUneditable:function(){i.$input.attr("contenteditable",!1),l.detach()},onButtonClick:function(){i.$input.blur(),i.contents.length>0&&i.$input.append(l),i.deactivate()},save:function(){i.burnNewContent()&&t.hasOwnProperty("action")&&t.action(i.contents,i),i.onButtonClick()},burnNewContent:function(){var t=i.fetchInputLines(),e=t.join("\n");return i.$input.text(t.join("
    ")),e!==i.contents&&(i.contents=t.join("\n"),!0)},fetchInputLines:function(){var t=[],e=!1,o=!1;return i.$input.contents().each((function(){if("BR"===this.nodeName)return o=!1,e?void(a||t.push("")):void(e=!0);e=!1,3===this.nodeType?(o?t[t.length-1]=t[t.length-1]+this.textContent:t.push(this.textContent),o=!0):(o=!1,"
    "!==this.innerHTML?t.push(this.innerHTML):t.push(""))})),t}}).$element=$(r({label:t.label,placeholder:i.placeholder,content:d})),i.$input=i.$element.find('[contenteditable="true"]'),n=(o=i.$element.find(".cmty-editable-buttons")).find(".cmty-editable-cancel"),s=o.find(".cmty-editable-save"),(i.contents.length>0||0===i.placeholder.length)&&i.$input.append(l),n.on("click",(function(){i.$input.text(i.contents),i.onButtonClick()})),s.on("click",(function(){i.save()})),i.$input.on("focus",(function(){setTimeout((function(){l.detach()}),1)})),i.$input.on("paste",(function(t){var o,s=(t.originalEvent||t).clipboardData.getData("text/plain");t.preventDefault(),a&&(s=s.replace(/\r?\n|\r/g,"")),document.execCommand("insertText",!1,s),c>0&&(o=i.$input.text()).length>c&&(i.$input.text(o.substr(0,c)),AoPS.Ui.Flyout.display(e["editable-length-limit-exceeded-on-paste"]))})),i.$input.on("blur",(function(){!i.is_active&&i.contents.length>0&&i.$input.append(l)})),a&&i.$input.on("keydown",(function(t){13===(t.which||t.keyCode)&&(i.save(),t.preventDefault(),t.stopPropagation())})),c>0&&i.$input.on("keydown",(function(t){var e=t.which||t.keyCode,o=i.$input.text();8!==e&&o.length>c&&t.preventDefault()})),i.allow_ctrl_biu||i.$input.on("keydown",(function(t){var e=t.which||t.keyCode;(t.metaKey||t.ctrlKey)&&_.indexOf([66,73,85],e)>-1&&(t.stopPropagation(),t.preventDefault())})),i.$input.on("keyup",(function(){i.$input.text()!==i.contents?i.activate():i.deactivate()})),i},t.setFullReplyStyle=function(){$("body").addClass("full-reply")},t.removeFullReplyStyle=function(){$("body").removeClass("full-reply")},t.buildTagAutocomplete=function(i){var o;i.$input_box.wrap($('')),(i=_.defaults(i,{show_no_results_msg:!1,no_results_msg_hash:"cat-cell-no-tag-match",has_search_icon:!1})).category=i.model,i.processPostConstruction=t.EditableTagBox.prototype.processTagBoxDropdownArrowing,i.show_no_results_msg&&(o=$('
    '+e[i.no_results_msg_hash]+"
    "),i.$input_box.before(o),i.$input_box.on("blur",(function(){o.hide()})),i.$input_box.on("remove",(function(){o.remove()})),i.onMatch=function(){o.hide()},i.onNoMatch=function(){o.show()}),i.hasOwnProperty("has_search_icon")&&i.has_search_icon&&(i.$input_box.before('M'),i.$input_box.parent().addClass("cmty-search-with-icon")),i.constructAutocompleteArgs=t.EditableTagBox.prototype.constructAutocompleteArgs,i.getAutocompleteSource=t.EditableTagBox.prototype.getAutocompleteSource,i.constructAutocomplete=t.EditableTagBox.prototype.constructItemAutocomplete,i.constructAutocomplete()},t.buildTagTermTagAutocomplete=function(i){function n(n){if(0!=n.length){var a=i.tag_term_model.get("tags").findWhere({text_lc:n.toLowerCase()});_.isUndefined(a)?(t.throwBlockingMessage(e["please-wait"]),i.tag_term_model.fetchTagIdByText({tag_text:n,create_new:!!i.hasOwnProperty("create_new")&&i.create_new,suppress_clean:!!i.hasOwnProperty("suppress_clean")&&i.suppress_clean,onFinish:function(t){i.onFoundTag(t.tag)},onError:function(t){var i;if("E_NO_SUCH_TAG"===t.error_code)i=e["cmty-tag-info-no-tag"];else i=o.formatString(e["err-unknown"],[t.error_code]);s.showAlert(i,{onClose:function(){s.closeAllModals()}})}})):i.onFoundTag(a),t.buildTagTermTagAutocomplete(i)}}i.view.hasOwnProperty("$tag_input")&&i.view.$tag_input.parent().remove(),i.view.$tag_input=$(''),i.view.$tag_input.on("keydown",(function(e){t.validateTagCharacter(e)||(e.stopPropagation(),e.preventDefault())})),i.view.$tag_input.on("paste",(function(e){t.onTagPaste(e)})),i.$input_box_target.append(i.view.$tag_input),t.buildTagAutocomplete({model:i.tag_term_model,$input_box:i.view.$tag_input,show_no_results_msg:!0,no_results_msg_hash:"cmty-tag-info-no-match",additional_autocomplete_params:{type:"tag"},submitNewItem:function(e){var o;0!=e.item_id?(o=i.tag_term_model.findTagById(parseInt(e.item_id)),_.isUndefined(o)&&(o=new AoPS.Community.Models.Tag({tag_id:parseInt(e.item_id),tag_text:e.value}),i.tag_term_model.get("tags").add(o)),i.onFoundTag(o),t.buildTagTermTagAutocomplete(i)):n(e.label)}}),i.view.$tag_input.on("keyup",(function(t){13==(t.which||t.keyCode)&&n($.trim(i.view.$tag_input.val()))}))},t.validateTagCharacter=function(t){var e=t.which||t.keyCode;return e>=65&&e<=90||(e>=48&&e<=57?48==e||57==e||!t.shiftKey:37==e||39==e||(190==e||(189==e||(222==e||(8==e||9==e||46==e||32==e)))))},t.onTagPaste=function(t){var e=(t.originalEvent||t).clipboardData.getData("text/plain");e=e.replace(/[^a-zA-Z0-9 \._\(\)\-]/g,""),t.preventDefault(),document.execCommand("insertText",!1,e)},t.constructUsernameAutocompleteExtraArgs=function(){return{ui_class:"cmty-username-autocomplete",_renderItem:function(t,e){var i=$("
  • "),o=$(""+e.label+"");return i.append(o),"1"===e.is_admin&&o.addClass("cmty-user-admin"),i.appendTo(t)}}},t.showError=function(t){AoPS.Ui.Modal.showAlertQuick(t,{width:"400px",onClose:function(){s.closeAllModals()}})},t.showErrorAtopAModal=function(t){AoPS.Ui.Modal.showAlertQuick(t,{width:"400px"})},t.constructUrlFromFocus=function(t,e){var o,s,n=t.get("focus_category").get("category_id"),a=2===arguments.length?e:{},r=!a.hasOwnProperty("strip_topic")||!a.strip_topic,l=t.get("focus_topic");return o=n!==i.private_messages_id||!t.get("focus_category").get("is_archive")||r&&!_.isNull(l)?"/c"+n:i.private_archive_url,s=t.get("focus_tag"),_.isNull(s)||(o+="t"+s.tag_id+"f"+s.tag_forum_id),r&&(_.isNull(l)||(o+="h"+l.get("topic_id"))),o},t.leaveRouterOnClick=function(t,e){t.metaKey||t.ctrlKey?window.open("/community"+e,"_blank"):window.location.href="/community"+e,t.stopPropagation(),t.preventDefault()},t.followUrlOnClick=function(t,e){var i,o;arguments.length>2?(i=arguments[2],o=arguments[3]):(i="/community",o=""),t.metaKey||t.ctrlKey?window.open(i+o+e,"_blank"):Backbone.history.navigate(o+e,{trigger:!0}),t.stopPropagation(),t.preventDefault()},t.isStateTag=function(t){return"/open"===(t=t.toLowerCase())||"/closed"===t||"/not_monitored"===t},t.makeBookmark=function(t){return String.fromCharCode(67+(t.is_bookmarked?(t.in_feed?2:0)+(t.is_watched?1:0):-1))},t.convertToUrlFragment=function(t){return t?t.replace(/ /g,"_").replace(/\W/g,"").toLowerCase():""},t.makeLinkUrl=function(t){var e=2==arguments.length?arguments[1]:"/community";return e+t},t.makeBackboneClick=function(e,i){e.on("click.backbone",(function(e){t.followUrlOnClick(e,i)}))},t.throwBlockingMessage=function(t){AoPS.Ui.Modal.showMessageQuick(t,{closeX:!1,force_response:!0,kill_phrase:"ajax-error-kill",width:"400px"})},t.delayModalClearing=function(t){var e={};arguments.length>0&&(e=t),setTimeout((function(){s.closeAllModals(),e.hasOwnProperty("onClose")&&e.onClose()}),i.message_readability_delay)},t.replaceWithLoaderBlockingMessage=function(t){var e='
    '+t+"
    "+AoPS.Page.loader_html;AoPS.Ui.Modal.replaceTopModal({type:"message",body:e,closeX:!1,force_response:!0,kill_phrase:"ajax-error-kill",width:"450px",frame_class:"aops-modal-quick"})},t.throwLoaderBlockingMessage=function(t){var e='
    '+t+"
    "+AoPS.Page.loader_html;AoPS.Ui.Modal.showMessageQuick(e,{closeX:!1,force_response:!0,kill_phrase:"ajax-error-kill",width:"350px"})},t.applyItemColor=function(t,e){t.css({"background-color":e.main_color}).on("mouseenter",(function(i){t.css({"background-color":e.secondary_color,color:e.main_color})})).on("mouseleave",(function(i){t.css({"background-color":e.main_color,color:""})}))},t.$bookmarkModals={},t.constructBookmarkModal=function(i,o){var s="";t.in_academy?AoPS.isUserLimited()||(s=e["bookmark-modal-info-text-academy"]):s=e["bookmark-modal-info-text"];var n=$(AoPS.View.prototype.getTemplate("#cmty-bookmark-modal-tpl",{username:AoPS.session.username,description:o,limited_in_academy:t.in_academy&&AoPS.isUserLimited(),info_text:s,feed_text:e["bookmark-modal-feed"],email_text:e["bookmark-modal-email-"+i]}));return n.find(".cmty-cancel-button").on("click",(function(){})),n},t.fireBookmarkModal=function(i,o,s){var n;(n=t.constructBookmarkModal(i,o)).showModal({type:"confirm",title:e["bookmark-modal-title-"+i],force_response:!0,closeX:!1,confirm_button_cancel:e["bookmark-modal-cancel"],confirm_button_ok:e["bookmark-modal-ok"],width:"450px",onButtonClick:function(t){t&&s({is_bookmarked:!0,is_watched:n.find('input[name="bkmk-watch-me"]').is(":checked"),in_feed:n.find('input[name="bkmk-add-feed"]').is(":checked")}),AoPS.Ui.Modal.closeAllModals()}})},t.fetchTopicsListConstructor=function(e){switch(e){case"my_privates":return t.TopicsListPrivates;case"user_search_posts":case"search":return t.TopicsListSearchPosts;default:return t.TopicsList}},t.fetchCategoryCellConstructor=function(e){switch(e){case"forum":case"forum_class":return t.CategoryCell;case"my_privates":return t.CategoryCellMyPrivates;case"folder":case"folder_forums":case"folder_collections":case"my_forums":case"my_blogs":case"blogroll":case"my_collections":return t.CategoryCellFolder;case"my_books":return t.CategoryCellMyBooks;case"blog":return t.CategoryCellBlog;case"my_classes":return t.CategoryCellMyClasses;case"my_bookmarks":return t.CategoryCellMyBookmarks;case"view_topics":return t.CategoryCellTopicView;case"bookmark_topics":case"feed_topics":return t.CategoryCellTopicBookmarks;case"bookmark_users":return t.CategoryCellBookmarkUsers;case"view_forums":return t.CategoryCellForumView;case"bookmark_forums":return t.CategoryCellForumBookmarks;case"view_tags":return t.CategoryCellTagView;case"view_posts":return t.CategoryCellPostView;case"bookmark_tags":return t.CategoryCellTagBookmarks;case"user":return t.CategoryUserCell}return t.CategoryCell},t.fetchCategoryCellCategoryTopConstructor=function(e){switch(e){case"my_privates":return t.CategoryCellCategoryTopMyPrivates;case"bookmark_forums":case"view_forums":return t.CategoryCellCategoryTopViewForums;case"bookmark_topics":case"feed_topics":case"view_topics":return t.CategoryCellCategoryTopViewTopics;case"bookmark_tags":case"view_tags":return t.CategoryCellCategoryTopViewTags;case"user_search_posts":return t.CategoryCellCategoryTopUserSearchPosts;case"search":return t.CategoryCellCategoryTopSearch;default:return t.CategoryCellCategoryTop}},t.Post=AoPS.View.extend({template_id:"#cmty-post-tpl",className:"cmty-post",show_link_in_post_number_modal:!1,initialize:function(t){this.topic=t.topic,this.is_read=!0,this.watching_edit_time=!1,this.has_poll=this.topic.model.get("poll_id")>0&&1==this.model.get("post_number"),this.render(),this.listenTo(this.model,"change:show_from_start change:show_from_end",_.bind((function(){this.topic.setPostVisibility(this)}),this)),this.listenTo(this.model,"change:deleted",this.onChangeDeleted),this.listenTo(this.model,"change:thanks_received change:nothanks_received",this.renderThankCount),this.listenTo(this.model,"hard_delete",this.removePostFromTopic),this.listenTo(this.model,"change:attachment change:attachments",this.parseAttachments),this.listenTo(this.model,"change:post_rendered",this.render),this.listenTo(this.model,"change:date_rendered",_.bind((function(){this.$el.find(".cmty-post-date").html(this.model.get("date_rendered"))}),this)),this.listenTo(this.model,"change:last_edit_time_rendered",this.parseEditData)},render:function(){var t,i,o,s=this.constructReportTemplateData(),n=this.model.get("admin"),a=this.topic.model.getPermission("c_can_edit"),r=this,l=this.topic.model.get("has_thanks")&&this.topic.model.getPermission("c_can_thank")&&AoPS.session.user_id!=this.model.get("poster_id"),c=this.topic.model.get("has_nothanks")&&this.topic.model.getPermission("c_can_nothank")&&AoPS.session.user_id!=this.model.get("poster_id"),d=this.topic.model.getPermission("c_can_delete")&&this.model.get("post_number")>1,_=this.model.isDeletableByUser();_&&!d&&this.listenTo(this.topic.model,"change:last_post_id",(function(){r.$(".cmty-post-delete").toggle(r.topic.model.get("last_post_id")==r.model.get("post_id"))})),i=n?e["post-user-tooltip-admin"]:this.model.get("is_forum_admin")?e["post-user-tooltip-forum-admin"]:this.model.get("is_forum_mod")?e["post-user-tooltip-mod"]:e["post-user-tooltip-regular"],o={user_id:this.model.get("poster_id"),has_poll:this.has_poll,username:this.model.get("username"),date_rendered:this.model.get("date_rendered"),post_number:this.model.get("post_number"),post_number_title:e["post-number-title"],has_real:this.model.get("real_poster_id")>0&&this.model.get("real_poster_id")!=this.model.get("poster_id"),real_poster_id:this.model.get("real_poster_id"),real_username:this.model.get("real_poster_username"),is_reported:s.is_reported,highlight_report_button:s.highlight_report_button,post_rendered:this.model.get("post_rendered"),avatar:this.model.get("avatar"),user_tooltip_text:i,one_post:1==this.model.get("num_posts"),can_pm:AoPS.session.logged_in,is_admin:n,is_forum_admin:!n&&this.model.get("is_forum_admin"),is_forum_mod:!n&&this.model.get("is_forum_mod"),num_posts:this.model.get("num_posts"),rating:this.model.get("rating"),report_title:s.title,lang_post_unread:e["post-unread-tootip"],can_quote:!this.topic.model.get("locked")&&!this.topic.model.get("forum_locked"),can_report:s.can_report,thankers:this.model.get("thankers"),lang_thankers:e["post-thanked-by"],can_edit:this.topic.model.getPermission("c_can_edit_own_posts")&&(this.topic.model.getPermission("c_can_lock_category")&&a||!this.topic.model.get("locked")&&!this.topic.model.get("forum_locked")&&(a||this.model.get("editable"))),can_delete:d||_,can_undelete:this.topic.model.getPermission("c_can_undelete"),thanking_active:l,nothanking_active:c},this.$el.html(this.getTemplate(this.template_id,o)),l&&(this.$thanks=this.$(".cmty-post-thank"),this.setThanks(),this.listenTo(this.model,"change:is_thanked",this.setThanks)),c&&(this.$nothanks=this.$(".cmty-post-nothank"),this.setNothanks(),this.listenTo(this.model,"change:is_nothanked",this.setNothanks)),this.$post_html=this.$(".cmty-post-html"),this.setTargetBox(),this.model.get("can_target")&&this.listenTo(this.topic.model,"change:target_url change:target_text",this.setTargetBox),this.$attachments=this.$(".cmty-post-attachments"),this.parseAttachments(),this.parseEditData(),this.renderThankCount(),this.listenTo(this.model,"change:thankers",this.setThankersBox),this.setVisibility(),this.has_poll&&this.initializePoll(),s.can_settle_report&&this.listenTo(this.model,"change:reported",this.onReportedChange),this.topic.model.get("is_search_result")&&(t=this.topic.model.fetchSearchText("post_text")).length>0&&(this.$post_html.extendedHighlightText("cmty-highlight",t),this.model.get("post_id")===this.topic.model.get("focus_post").get("post_id")&&this.$(".cmty-hide-heading").trigger("click"))},setThankersBox:function(){this.$(".cmty-post-thankers").html(''+e["post-thanked-by"]+' '+this.model.get("thankers")+""),this.model.get("thanks_received")<=0&&this.$el.removeClass("cmty-post-show-thanks")},setThanks:function(){var t,i;this.model.get("is_thanked")?(t=e["post-unthank-this"],i="{"):(t=e["post-thank-this"],i="Y"),this.$thanks[0].title=t,this.$thanks.text(i)},setNothanks:function(){var t,i;this.model.get("is_nothanked")?(t=e["post-unnothank-this"],i="}"):(t=e["post-nothank-this"],i="_"),this.$nothanks[0].title=t,this.$nothanks.text(i)},setTargetBox:function(){var t,i,s;this.$(".cmty-post-target-note").remove(),this.model.checkShowTargetLink()&&(t=new RegExp(document.domain+"/"+AoPS.router_root),s=document.domain+this.topic.model.get("target_url"),i=o.formatString(e["topic-full-post-with-target-url"],[this.topic.model.get("target_url"),this.topic.model.get("topic_id"),t.test(s)?AoPS.pushState_attr:"",this.topic.model.get("target_text").length>0?this.topic.model.get("target_text"):e["topic-full-target-text-default"]]),this.topic.model.get("is_restricted_soln")&&(i=o.formatString(i+"
    "+e["topic-full-post-solution-thread"])),AoPS.session.user_id!==this.model.get("poster_id")&&AoPS.session.user_id!==this.model.get("real_poster_id")||(i+='"),this.$el.find(".cmty-post-body").prepend(this.getTemplate("#cmty-post-to-target-link-tpl",{target_note:i})))},initializePoll:function(){this.$poll=this.$(".cmty-post-poll"),this.listenTo(this.topic.model,"change:poll_data",this.constructPoll),this.$poll_loader=$('
    '+e["poll-loading"]+"
    "),this.topic.model.has("poll_data")&&!_.isEmpty(this.topic.model.get("poll_data"))?this.constructPoll():this.$poll.append(this.$poll_loader)},constructPoll:function(){var t,i,s,n,a=this;this.$poll_loader.detach(),this.topic.model.computeDerivedPollData(),t=this.topic.model.get("poll_data"),i=o.formatString(e[1==t.num_selections?"poll-select-one":"poll-select-many"],[t.num_selections]),n=t.num_votes+e[1===t.num_votes?"poll-Vote":"poll-Votes"],s=t.has_voted&&t.can_vote,this.$poll.html(this.getTemplate("#cmty-poll-display-tpl",{lang_heading:e["poll-display-heading"],question:t.question,options:t.options,lang_select_options:i,lang_votes:n,input_type:1==t.num_selections?"radio":"checkbox",can_vote:t.can_vote,has_toggle:!t.poll_closed&&!t.has_voted,lang_poll_vote:t.has_voted?e["poll-revote-btn"]:e["poll-vote-btn"],lang_hide_results:e["poll-hide-results"],lang_show_results:e["poll-show-results"],has_helper_text:!AoPS.session.logged_in||s,lang_helper:AoPS.session.logged_in?e["poll-revote-directions"]:e["poll-not-logged-in"]})),this.$poll.toggleClass("cmty-poll-show-results",t.poll_closed||t.has_voted),this.poll_selections=[],t.can_vote&&_.each(t.options,(function(t){t.selected&&a.poll_selections.push(t.id)}))},parseAttachments:function(){var t,o=[],s=[],n=this,a="";this.$el.toggleClass("post-has-attachment",this.model.get("attachment")),this.$attachments.html(""),this.model.get("attachment")&&(_.each(this.model.get("attachments"),(function(t){n.isAttachmentImage(t.mimetype)?o.push(t):s.push(t)})),this.$attachments.append('
    '+e["post-attachments"]+"
    "),o.length>0&&(t='
    ',_.each(o,(function(e){t+=''})),t+="
    ",this.$attachments.append(t)),s.length>0&&(_.each(s,(function(t){a+='
    '+t.name+" ("+t.size+"kb)
    "})),this.$attachments.append(a)))},isAttachmentImage:function(t){return"image"===t.substr(0,5)},markUnread:function(){this.$el.addClass("cmty-post-unread"),this.is_read=!1},markRead:function(){this.$el.removeClass("cmty-post-unread"),this.is_read=!0},constructReportTemplateData:function(){var t={can_report:this.topic.model.getPermission("c_can_report"),can_settle_report:this.topic.model.getPermission("c_can_settle_report"),is_reported:this.model.get("reported"),title:""};return t.can_report&&(t.is_reported?t.can_settle_report?t.title=e["topic-full-settle-report-title"]:t.title=e["topic-full-already-reported-title"]:t.title=e["topic-full-report-post-title"]),t.highlight_report_button=t.can_settle_report&&t.is_reported,t},onReportedChange:function(){this.topic.model.getPermission("c_can_settle_report")&&this.$el.find(".cmty-post-report").toggleClass("cmty-post-settle-report",this.model.get("reported"))},parseEditData:function(){var t,i=this.model.get("num_edits");this.$el.toggleClass("cmty-post-edited",i>0),i>0&&(this.model.get("edit_time_on_timer")&&!this.watching_edit_time&&(this.watching_edit_time=!0),t=e["topic-full-edited-1"]+i+(i>1?e["topic-full-edited-3"]:e["topic-full-edited-2"])+e["topic-full-edited-4"]+this.model.get("last_editor_username")+", "+this.model.get("last_edit_time_rendered"),this.model.get("last_edit_reason").length>0&&(t+="
    "+e.Reason+": "+this.model.get("last_edit_reason")),this.$el.find(".cmty-post-edit-info").html(t))},events:{"click .cmty-post-report":"onClickReport","click .cmty-post-settle-report":"onClickSettleReport","click .cmty-post-quote":"onClickQuote","click .cmty-post-delete":"onClickDelete","click .cmty-post-deleted-info":"onClickDeletedInfo","click .cmty-undelete-post":"onClickUndelete","click .cmty-post-thank":"onClickThanks","click .cmty-post-nothank":"onClickNothanks","click .cmty-post-edit":"onClickEdit","click .cmty-post-number":"onClickDirectLink","click .cmty-poll-results-toggle span":"onClickTogglePollResults","click .cmty-poll-vote-row .btn":"onClickPollVote","mousedown .cmty-post-middle":"onClickPostBody","click .cmty-remove-target":"onClickRemoveTarget","click .cmty-post-thank-count":"onClickThankCount","click .cmty-pm-from-post":"onClickMessage"},onClickMessage:function(i){var s,n;this.model.get("real_poster_id")>0?(s=this.model.get("real_poster_id"),n=this.model.get("real_poster_username")):(s=this.model.get("poster_id"),n=this.model.get("username"));var a=t.launchNewPrivateMessage({user_id:s,username:n,is_admin:this.model.get("admin")}),r="private-from-post";this.model.get("deleted")&&(r+="-deleted");var l=this.constructPostUrl(),c=this.topic.model.isPrivateMessage()?"":o.formatString(e[r],[l.url]);if(c+='[quote="'+this.model.get("username")+'"]'+this.model.get("post_canonical")+"[/quote]",a.addContent(c),!_.isUndefined(i))return i.stopPropagation(),i.preventDefault(),!1},onClickThankCount:function(){this.$el.toggleClass("cmty-post-show-thanks")},onClickRemoveTarget:function(){var i,n=this,a=this.model.get("topic");i=a.get("target_text").length>0?o.formatString(e["mod-topic-remove-target-with-text"],[a.get("target_text")]):e["mod-topic-remove-target-confirm"],s.showConfirm(i,(function(i){i?(t.replaceWithLoaderBlockingMessage(e["mod-topic-remove-target-blocker"]),n.model.get("topic").removeTarget({onFinish:function(){setTimeout((function(){s.closeAllModals()}),500)},onError:t.throwAjaxError})):s.closeAllModals()}),{width:"450px",close_on_button_click:!1})},onClickTogglePollResults:function(){this.$poll.toggleClass("cmty-poll-show-results")},onClickPostBody:function(t){t.stopPropagation()},onClickPollVote:function(){var t,s=this.topic.model.get("poll_data").num_selections,n=this;if(1===s){if(t=this.$poll.find('input:radio[name="poll-options"]:checked').val(),_.isUndefined(t))return void AoPS.Ui.Modal.showAlertQuick(e["poll-nothing-selected"]);t=[t]}else{if(t=[],_.each(this.$poll.find('input:checkbox[name="poll-options"]:checked'),(function(e){t.push(e.value)})),0==t.length)return void AoPS.Ui.Modal.showAlertQuick(e["poll-nothing-selected"]);if(t.length>s)return void AoPS.Ui.Modal.showAlertQuick(o.formatString(e["poll-too-many-selected"],[s]))}t.join()!==this.poll_selections.join()&&(AoPS.Community.Views.throwBlockingMessage(e["poll-vote-processing"]),this.topic.model.castVote({votes:t,onFinish:function(){setTimeout((function(){AoPS.Ui.Modal.closeAllModals()}),i.message_readability_delay_short)},onError:function(t){var i,o=t.error_code;"E_NOT_LOGGED_IN"===o?i=e["poll-err-not-logged-in"]:"E_POLL_CLOSED"===o?(n.topic.model.get("poll_data").poll_closed=!0,n.topic.model.trigger("change:poll_data"),i=e["poll-err-closed"]):i=e["unexpected-error-code"]+o,AoPS.Community.Views.showError(i)}}))},constructPostUrl:function(){var t="/community/c"+this.topic.model.get("category_id")+"h"+this.model.get("topic_id")+"p"+this.model.get("post_id");return{url_path:t,url:i.base_url+t}},onClickDirectLink:function(t){var i,s,n,a,r=this.constructPostUrl(),l=AoPS.Community.MasterModel.fetchStaffPermission("ip-lookup"),c=this;i=$('
    '+o.formatString(e["post-direct-link"],[r.url_path])+'

    \t\t\t\t\t
    '),l&&(s=$('"),n=$("
    "+e["post-direct-loading-ip"]+"
    "),i.append("

    ").append(s),s.on("click",(function(){s.hide(),i.append(n),c.model.fetchIP({onFinish:function(t){n.text(t.ip)},onError:function(t){n.text(t.error_code)}})}))),i.showModal({width:"400px"}),(a=i.find("input"))[0].setSelectionRange(0,a.val().length),t.stopPropagation(),t.preventDefault()},onClickEdit:function(t){var i,o=1===this.model.get("post_number")?"EditFirstPost":"EditPost";t.stopPropagation(),t.preventDefault(),!this.topic.model.get("forum_locked")||this.topic.model.getPermission("c_can_lock_category")?this.topic.model.getPermission("c_can_edit")||!this.topic.model.get("locked")?((i=new AoPS.Community.Views[o]({post_model:this.model,topic_id:this.model.get("topic_id"),category_id:this.topic.model.get("category_id"),topic:this.topic.model,master:this.topic.model.get("master"),input_text:this.model.get("post_canonical")})).$el.showModal({frame_class:"cmty-posting-modal",mask_fade_in_speed:200,scrollable:!1,max_width:"1000px",onClickMask:function(){return!1},onClickX:function(){return i.onClickCancel(),!1}}),i.setHeight()):s.showMessage(e["topic-edit-locked"]):s.showMessage(e["topic-edit-forum-locked"])},onClickThanks:function(t){var e=this.model.get("is_thanked")?0:1;this.model.setThankStatus({new_status:e})},onClickNothanks:function(t){var e=this.model.get("is_nothanked")?0:-1;this.model.setThankStatus({new_status:e})},onClickQuote:function(){AoPS.session.logged_in?this.topic.model.getPermission("c_can_reply")||this.topic.model.getPermission("c_undo_global_ban")||!AoPS.isUserLimited()?this.topic.model.get("locked")?s.showMessage(e["topic-full-reply-to-locked"]):this.topic.model.get("forum_locked")?s.showMessage(e["topic-full-reply-to-forum-locked"]):this.topic.appendToReply("[quote="+this.model.get("username")+"]"+$.trim(this.model.get("post_canonical"))+"[/quote]\n\n"):s.showMessage(e["new-reply-no-permission-limited"],{width:"450px"}):AoPS.Ui.buildLoginConfirm(e["topic-full-unregistered-reply"])},onClickReport:function(i){if(i.stopPropagation(),i.preventDefault(),this.model.get("reported"))return this.topic.model.getPermission("c_can_settle_report")?void 0:void AoPS.Ui.Modal.showMessage(e["topic-full-already-reported"]);new t.ReportPost({model:this.model}).$el.showPlainModal()},onClickSettleReport:function(e){t.inCmtyRouter()?t.followUrlOnClick(e,"/reported-posts/p"+this.model.get("post_id")):window.location.href="/community/reported-posts/p"+this.model.get("post_id"),e.stopPropagation(),e.preventDefault()},onClickDelete:function(e){var i;i=new t.DeletePost({model:this.model,topic:this.model.get("topic")}),AoPS.session.n&&(e.shiftKey||e.metaKey)?i.onFormSubmit(e,{force_soft:!0}):(i.$el.showPlainModal(),i.$el.find('[value="OK"]').focus()),e.stopPropagation(),e.preventDefault()},onClickDeletedInfo:function(){this.$el.toggleClass("cmty-post-deleted-open")},onClickUndelete:function(t){return AoPS.Ui.Modal.showMessage(e["topic-full-undelete-message"],{type:"confirm",title:e["topic-full-undelete-title"],confirm_button_ok:e.yes,confirm_button_cancel:e.no,onButtonClick:_.bind((function(t){t&&this.model.undelete({onError:function(t){"E_HARD_DELETE"===t.error_code&&n.display(e["topic-full-undelete-hard"])}}),AoPS.Ui.Modal.closeAllModals()}),this)}),t.stopPropagation(),t.preventDefault(),!1},onChangeDeleted:function(){this.model.get("deleted")&&!this.topic.model.getPermission("c_can_read_deleted")?this.removePostFromTopic():this.setVisibility()},removePostFromTopic:function(){"function"==typeof this.topic.removePost&&this.topic.removePost(this)},renderThankCount:function(){this.model.get("thanks_received")>0&&this.topic.model.get("has_thanks")?this.$el.find(".cmty-post-thank-count").html($.parseHTML(" • "+this.model.get("thanks_received")+' Y')):this.$el.find(".cmty-post-thank-count").html(""),this.model.get("nothanks_received")>0&&this.topic.model.get("has_nothanks")?this.$el.find(".cmty-post-nothank-count").html($.parseHTML(" • "+this.model.get("nothanks_received")+' _')):this.$el.find(".cmty-post-nothank-count").html("")},setVisibility:function(){this.$el.toggleClass("cmty-post-is-deleted",this.model.get("deleted"))}}),t.ModerateTopic=AoPS.View.extend({template_id:"#cmty-moderate-topic-tpl",initialize:function(o){var s,n=this.model.get("locked"),a=this,r=[],l="private"===this.model.get("topic_type"),c=this.model.get("announce_type");t.setRouteInfo(this,o),this.topic_category_at_initialization=o.topic_category_at_initialization,this.$el.html($(this.getTemplate(this.template_id,{title:this.model.get("topic_title"),username:this.model.get("first_poster_name")}))),this.$buttons_cell=this.$el.find(".cmty-moderate-topic-buttons"),l||(this.buildButton({permission:"c_can_move_topic_out",symbol:"N",text:e["mod-topic-move"],onClick:"onClickMoveTopic"}),this.buildButton({permission:"c_can_lock_topic",symbol:n?"l":"k",text:n?e["mod-topic-unlock"]:e["mod-topic-lock"],onClick:"onLockTopic"})),this.model.get("category_id")!=i.recycle_bin_id&&this.buildButton({permission:"c_can_delete",symbol:"J",text:e["mod-topic-delete"],onClick:"onSoftDeleteTopic"}),this.buildButton({permission:"c_can_hard_delete",symbol:"J",text:e["mod-topic-hard-delete"],onClick:"onHardDeleteTopic"}),l||("none"===c?(this.buildButton({permission:"c_can_announce",symbol:"i",text:e["mod-topic-announce"],onClick:"onMakeLocalAnnouncement"}),this.buildButton({permission:"c_can_global_announce",symbol:"a",text:e["mod-topic-global"],onClick:"onMakeGlobal"})):"local"===c?(this.buildButton({permission:"c_can_announce",symbol:"i",text:e["mod-topic-normal"],onClick:"onMakeNormal"}),this.buildButton({permission:"c_can_global_announce",symbol:"a",text:e["mod-topic-global"],onClick:"onMakeGlobal"})):"global"===c&&this.buildButton({permission:"c_can_global_announce",symbol:"a",text:e["mod-topic-normal"],onClick:"onMakeNormal"})),this.model.get("cat_can_target")&&(s=this.model.get("target_url").length>0,this.buildButton({permission:"c_can_add_target",symbol:"j",text:s?e["mod-topic-replace-target"]:e["mod-topic-add-target"],onClick:"onAddTarget"}),s&&this.buildButton({permission:"c_can_remove_target",symbol:"Jj",text:e["mod-topic-remove-target"],onClick:"onRemoveTarget"}),this.buildButton({permission:"c_can_add_target",symbol:"+",text:e["mod-topic-add-hidden"],onClick:"onAddHiddenTag"}),this.model.getPermission("c_can_remove_target")&&this.model.get("tags").length>0&&(r=this.findRemovableHiddenTags()).length>0&&(this.$el.append('
    '+e["mod-topic-hidden-tags"]+"
    "),_.each(r,(function(t){var e=$('
    J'+t.tag_text+"
    ");a.$el.append(e),e.find(".aops-font").on("click",(function(){a.model.removeTag(t.tag_id,t.tag_text),e.remove(),0==a.findRemovableHiddenTags().length&&a.$(".cmty-mod-topic-hidden-title").remove()}))})))),this.model.get("master").fetchPermission("can_access_log")&&this.buildButton({symbol:"h",text:e["mod-topic-log"],onClick:"onVisitLog"}),this.$el.showModal({title:e["mod-topic-title"],onClose:function(){a.destroy()}})},onVisitLog:function(e){t.leaveRouterOnClick(e,"/log/topic/"+this.model.get("topic_id"))},onAddTarget:function(){var i,o,n=this.model.get("target_url"),a=this,r=!1;n.length>0&&(o=_.findWhere(this.model.get("tags"),{tag_text:n}),r=!_.isUndefined(o)&&!o.is_public),(i=$(this.getTemplate("#cmty-mod-topic-add-target-tpl",{current_target:n,is_restricted:r,lang_edit_instructions:e["mod-topic-edit-target-instructions"],lang_tag_text:e["mod-topic-edit-target-url"],lang_target_text:e["mod-topic-edit-target-text"],current_target_text:this.model.get("target_text"),lang_restricted:e["mod-topic-edit-target-is-restricted"]}))).find('input[type="text"]').focus(),s.showConfirm(i,(function(o){var s,l,c;if(o){if(s=$.trim(i.find("input.cmty-mod-topic-target").val()),l=$.trim(i.find("input.cmty-mod-topic-target-text").val()),0==s.length)return void a.destroy();if(t.isStateTag(s))return void t.showErrorAtopAModal(e["mod-topic-no-state-tags"]);if(c=i.find('input[type="checkbox"]').is(":checked"),s.toLowerCase()===n.toLowerCase()&&c==r&&l===a.model.get("target_text"))return void a.destroy();t.replaceWithLoaderBlockingMessage(e["mod-topic-remove-target-blocker"]),a.model.changeTargetUrl({new_target:s,new_target_text:l,is_restricted:c,onFinish:function(){setTimeout((function(){a.destroy()}),500)},onError:t.throwAjaxError})}else a.destroy()}),{width:"450px",close_on_button_click:!1})},onAddHiddenTag:function(){var i,o=this;(i=$(this.getTemplate("#cmty-mod-topic-add-target-tpl",{lang_edit_instructions:e["mod-topic-hidden-tag-instructions"],lang_tag_text:e["mod-topic-hidden-tag-text"],lang_restricted:e["mod-topic-hidden-tag-is-restricted"],current_target:"",is_restricted:!1}))).find('input[type="text"]').focus(),s.showConfirm(i,(function(s){var n,a;if(s){if(0==(n=$.trim(i.find('input[type="text"]').val())).length)return void o.destroy();if(t.isStateTag(n))return void t.showErrorAtopAModal(e["mod-topic-no-state-tags"]);a=i.find('input[type="checkbox"]').is(":checked"),t.replaceWithLoaderBlockingMessage(e["mod-topic-hidden-tag-blocker"]),o.model.addHiddenTag({new_text:n,is_restricted:a,onFinish:function(){setTimeout((function(){o.destroy()}),500)},onError:t.throwAjaxError})}else o.destroy()}),{width:"450px",close_on_button_click:!1})},findRemovableHiddenTags:function(){var e=[],i=this;return _.each(this.model.get("tags"),(function(o){o.is_visible||o.tag_text===i.model.get("target_url")||t.isStateTag(o.tag_text)||e.push(o)})),e},onLockTopic:function(){if(this.model.get("locked"))this.model.unlock(),this.destroy();else if(this.model.get("first_poster_id")!==AoPS.session.user_id){var t=this,i=$("
    ").append($.parseHTML(e["mod-topic-lock-warning"])).append($("

    ").text("Reason:")).append(o.getModerationInputsForType("topic"));AoPS.Ui.Modal.showConfirm(i,(function(o){if(o){var s=i.find("input[name='reason']:checked").val()||"";AoPS.Community.Views.throwBlockingMessage(e["mod-topic-lock-pending"]),t.model.lock({reason:s}),t.destroy()}else AoPS.Ui.Modal.closeTopModal()}),{title:e["mod-topic-lock-title"],close_on_button_click:!1})}else this.model.lock(),this.destroy()},onRemoveTarget:function(){var i=this;s.showConfirm(e["mod-topic-remove-target-confirm"]+e["mod-topic-remove-target-extra"],(function(o){o?(t.replaceWithLoaderBlockingMessage(e["mod-topic-remove-target-blocker"]),i.model.removeTarget({onFinish:function(){setTimeout((function(){i.destroy()}),500)},onError:t.throwAjaxError})):i.destroy()}),{width:"450px",close_on_button_click:!1})},hasTopicMoved:function(){return this.topic_category_at_initialization!=this.model.get("category_id")&&(AoPS.Ui.Modal.showMessage(e["mod-topic-move-err-E_ALREADY_MOVED"]),!0)},onClickMoveTopic:function(){var t=this;this.checkTopicLength({onOK:function(){t.onMoveTopic()}})},onMoveTopic:function(){if(!this.hasTopicMoved()){var t,s=i.move_topic_quick_links,n=AoPS.session.logged_in&&s.hasOwnProperty(this.model.get("category_id").toString()),a=this.model.get("master").fetchCategory(this.model.get("category_id")),r=$(this.getTemplate("#cmty-mod-topic-move-tpl",{has_current_category:!_.isUndefined(a),topic_title:this.model.get("topic_title"),quick_link_title:e["mod-topic-move-quick"],first_poster_name:this.model.get("first_poster_name"),input_heading:e["mod-topic-move-input-heading"],has_quick_links:n})),l=this.model.get("topic_id"),c=this;_.isUndefined(a)||r.find(".cmty-item-forum").first().html(a.get("category_name")).css({color:a.get("main_color")}),n&&(t=r.find(".cmty-mod-topic-move-quick"),_.each(s[this.model.get("category_id").toString()],(function(i){var o,s=c.model.get("master").fetchCategory(i);_.isUndefined(s)||((o=$("
    ",{class:"cmty-item-forum",html:s.get("category_name")}).on("click",(function(){var t=s.get("category_id");AoPS.Community.Views.throwBlockingMessage(e["mod-topic-move-in-progress"]),c.model.move({new_category_id:t,onFinish:h(t,l),onError:d()})}))).css({color:s.get("main_color")}).on("mouseenter",(function(t){o.css({color:s.get("secondary_color"),"background-color":s.get("main_color")})})).on("mouseleave click",(function(t){o.css({color:s.get("main_color"),"background-color":"#fff"})})),t.append(o))}))),o.buildCategoryAutocomplete(r.find("input").first(),{ajax_call:"fetch_forum_autocomplete",autocomplete_settings:{onSelect:function(t,i){var o=parseInt(i.item.category_id);AoPS.Community.Views.throwBlockingMessage(e["mod-topic-move-in-progress"]),c.model.move({new_category_id:o,onFinish:h(o,l),onError:d()})},onOpen:function(){}}}),r.showModal({title:e["mod-topic-move-title"],frame_class:"cmty-move-topic-modal aops-modal-standard",scrollable:!1,max_width:"400px",onClose:function(){r.remove()}})}function d(){return function(t){var i,o=t.error_code;i=e.hasOwnProperty("mod-topic-move-err-"+o)?e["mod-topic-move-err-"+o]:e["unexpected-error-code"]+o,AoPS.Ui.Modal.showAlert(i,{onClose:function(){c.destroy()},width:"450px"})}}function h(t,e){return function(){var i="/c"+t+"h"+e;"/community"===c.url_router_base?(Backbone.trigger("close_feed_topic"),Backbone.history.navigate(i,{trigger:!0}),c.close()):window.location.href="/community"+i}}},onSoftDeleteTopic:function(){var t=this;this.checkTopicLength({onOK:function(){t.onDeleteTopic("soft")}})},onHardDeleteTopic:function(){var t=this;this.checkTopicLength({onOK:function(){t.onDeleteTopic("hard")}})},checkTopicLength:function(t){this.model.get("num_posts")>i.topic_move_length_limit?AoPS.Community.MasterModel.fetchStaffPermission("can-delete-long-topic")?(AoPS.Ui.Modal.showConfirm(e["mod-long-topic-admin-warning"],(function(e){AoPS.Ui.Modal.closeTopModal(),e&&t.onOK()}),{confirm_button_ok:e["mod-long-topic-admin-OK"],confirm_button_cancel:e["mod-long-topic-admin-no"],width:"450px",close_on_button_click:!1}),$(":focus").blur()):AoPS.Ui.Modal.showAlert(e["mod-topic-delete-err-E_TOPIC_TOO_LONG"],{onClose:function(){self.destroy()},width:"400px"}):t.onOK()},setAnnouncementType:function(t,i){var o=this;this.model.setAnnounceType({type:t,announce_through:i,onFinish:function(){var t;t=o.url_cmty_path+"/c"+o.model.get("category_id")+"h"+o.model.get("topic_id"),Backbone.history.fragment=null,Backbone.history.navigate(t,{trigger:!0}),o.destroy()},onError:function(t){var i,s=t.error_code;i=e.hasOwnProperty("mod-topic-announce-err-"+s)?e["mod-topic-announce-err-"+s]:e["unexpected-error-code"]+s,AoPS.Ui.Modal.showAlert(i,{onClose:function(){o.destroy()}})}})},onMakeNormal:function(){this.setAnnouncementType("none","")},onMakeLocalAnnouncement:function(){this.fetchAnnouncementDate("local")},onMakeGlobal:function(){this.fetchAnnouncementDate("global")},fetchAnnouncementDate:function(i){var o=$("
    "+e["mod-topic-set-announce-through"]+'
    '),n=o.find("input"),a=this;t.makeAnnounceDateInput(n),s.showConfirm(o,(function(o){o&&(t.replaceWithLoaderBlockingMessage(e["mod-topic-announce-blocker"]),setTimeout((function(){a.setAnnouncementType(i,n.val())}),500))}),{close_on_button_click:!1})},onDeleteTopic:function(t){var i=this,s=(this.model.get("topic_type"),$("
    ").append($.parseHTML(e["mod-topic-"+t+"-delete-warning"])));i.model.get("first_poster_id")!==AoPS.session.user_id&&s.append($("

    ").text("Reason:")).append(o.getModerationInputsForType("topic")),AoPS.Ui.Modal.showConfirm(s,(function(o){if(o){var n=s.find("input[name='reason']:checked").val()||"";AoPS.Community.Views.throwBlockingMessage(e["mod-topic-delete-pending"]),i.model.delete({delete_type:t,reason:n,onFinish:function(){Backbone.trigger("close_feed_topic"),i.destroy()},onError:function(t){var o,s;s=t.error_code,o=e.hasOwnProperty("mod-topic-delete-err-"+s)?e["mod-topic-delete-err-"+s]:e["unexpected-error-code"]+s,AoPS.Ui.Modal.showAlert(o,{onClose:function(){i.destroy()},width:"400px"})}})}else AoPS.Ui.Modal.closeTopModal()}),{title:e["mod-topic-"+t+"-delete-title"],close_on_button_click:!1})},destroy:function(){AoPS.Ui.Modal.closeAllModals(),this.close()},buildButton:function(t){var e=this;t.hasOwnProperty("permission")&&!this.model.getPermission(t.permission)||this.$buttons_cell.append($("

    ')),this.$el.append(this.$close_me)),this.counter=1,this.sending_to_rebuild=!1,this.constructInput(),this.suppress_autofocus=!1,this.$items=[],_.each(this.items,(function(t){e.putItemInBox(t)}))},events:{"click .cmty-delete-item":"onClickDeleteItem","click .cmty-editable-item-close":"onClickClose"},prepareAutocomplete:function(){this.constructItemAutocomplete()},getAutocompleteSource:function(){},getAutocompleteOnOpen:function(){return _.bind((function(t){}),this)},constructAutocompleteArgs:function(){return{}},constructItemAutocomplete:function(){var t=_.extend({match_type:"from_start_then_any",delay:250,is_case_sensitive:!1,source:this.getAutocompleteSource(),num_matches:this.num_matches,blockResponse:_.bind((function(){return this.item_submitted}),this),position:{my:"left top+5"},onSelect:_.bind((function(t,e){13===t.keyCode&&this.$input_box.val().toLowerCase()!==e.item.value.toLowerCase()&&(this.submitNewItem({label:this.$input_box.val(),item_id:0}),this.item_submitted=!0,this.item_selected=!0),this.item_submitted||(this.item_selected=!0,this.item_submitted=!0,this.submitNewItem(e.item),this.submitted_item=e.item.value),t.stopPropagation(),t.preventDefault()}),this)},this.constructAutocompleteArgs());this.$input_box.aopsAutocomplete(t),"function"==typeof this.onClose&&this.$input_box.blur(this.onClose),this.processPostConstruction()},onPaste:function(t){},processPostConstruction:function(){var t=this;this.$input_box.on("paste",(function(e){t.onPaste(e)})),this.$input_box.on("keydown",_.bind((function(t){var e,o=t.which||t.keyCode,s=this.$input_box.val();this.item_submitted=!1,13!==o&&188!==o&&9!==o||((188===o||9===o&&s.length>0)&&(t.preventDefault(),t.stopPropagation()),s.length>1&&this.submitted_item.toLowerCase()!==s.toLowerCase()&&!this.item_selected&&this.submit_on_special_keys&&this.submitNewItem({label:s,item_id:0})),0===s.length&&(8===o?this.$input_box.prev().hasClass(this.item_class)?this.tryToRemoveItem(this.$input_box.prev()):(e=this.$input_box.prevUntil("."+this.item_class).last().prev()).length>0&&this.tryToRemoveItem(e):46===o?this.tryToRemoveItem(this.$input_box.next()):this.$input_box.width(i.itembox_input_width),this.$input_box.focus()),this.item_selected=!1,this.validateCharacter(t)||(t.stopPropagation(),t.preventDefault())}),this)),this.$input_box.parent().on("click",(function(e){t.$input_box.focus(),e.stopPropagation()}))},validateCharacter:function(t){return!0},removeItem:function(t){var e,i;if(t instanceof jQuery)e=t,i=t.data("item");else if(i=t,e=_.find(this.$items,(function(t){return t.data("item")===i})),_.isUndefined(e))return;this.processRemovedItem(i),this.items=_.without(this.items,i),this.$items=_.without(this.$items,e),e.remove(),this.hasOwnProperty("onRemoveItem")&&this.onRemoveItem(i)},onClickDeleteItem:function(t){this.tryToRemoveItem($(t.target).parent())},tryToRemoveItem:function(t){this.removeItem(t)},processRemovedItem:function(t){},showError:function(t){AoPS.Ui.Modal.showAlert(t,{onClose:_.bind(this.resetInput,this)})},performCustomValidation:function(t){return!0},submitNewItem:function(t){return t.label=t.label.trim(),this.item_submitted=!0,this.countItems()>=this.item_limit?(this.showError(e["new-item-too-many-1"]+this.item_limit+" "+this.item_name+e["new-item-too-many-2"]),!1):t.label.length<2?(this.showError(e["new-item-too-short"]),!1):this.checkItemExists(t)?(this.showError(e["new-item-already-added"]+""+t.label+"."),!1):void(this.performCustomValidation(t)&&this.buildNewItem(t))},countItems:function(){return this.items.length},checkItemExists:function(t){return!_.isUndefined(_.find(this.items,(function(e){return e.label.toLowerCase()===t.label.toLowerCase()})))},buildNewItem:function(t){var e;t.hasOwnProperty("is_visible")||(t.is_visible=!0),this.items.push(t),this.processNewItem(t),e=this.putItemInBox(t),this.hasOwnProperty("onAddItem")&&this.onAddItem(t,e),this.resetInput()},applyCssToNewItem:function(t,e){},submitItemSilent:function(t){this.countItems()>=this.item_limit||this.checkItemExists(t)||(this.suppress_autofocus=!0,this.buildNewItem(t),this.suppress_autofocus=!1)},putItemInBox:function(t){var e;if(!t.hasOwnProperty("is_visible")||t.is_visible)return"string"!=typeof t.label&&"string"==typeof t.value&&(t.label=t.value),"string"!=typeof t.value&&"string"==typeof t.label&&(t.value=t.label),e=$($.parseHTML('
    '+t.label+' J
    ')),"boolean"==typeof t.is_special&&t.is_special&&e.addClass("cmty-special-item"),this.applyCssToNewItem(e,t),e.data("item",t),e.data("item_label",t.label),this.$items.push(e),this.$input_box.before(e),e},processNewItem:function(t){},resetInput:function(){var t=this;this.$input_box.val(""),this.counter+=1,this.$input_box.data("suppress_tab",!0),setTimeout(_.partial((function(e){t.rebuildInput(e)}),this.suppress_autofocus),10)},constructInput:function(){var t=this;this.$input_box=$($.parseHTML('')),this.$el.append(this.$input_box),"function"==typeof this.onInputBoxBlur&&this.$input_box.on("blur",(function(){t.onInputBoxBlur()})),this.prepareAutocomplete()},rebuildInput:function(t){this.$input_box.remove(),this.hasOwnProperty("$no_results")&&this.$no_results.hide(),this.constructInput(),0!=arguments.length&&t||this.$input_box.focus()},onClickClose:function(){this.$input_box.val().length>1&&this.submitNewItem({label:this.$input_box.val()}),this.close()}}),t.EditableTagBox=t.EditableItemList.extend({item_class:"cmty-item-tag",item_limit:i.max_tags_per_topic,has_search_icon:!1,item_name:"tag",num_matches:15,initialize:function(i){this.category=i.hasOwnProperty("category")?i.category:this.model.get("master").fetchCategory(this.model.get("category_id")),this.setTagColors(),t.EditableItemList.prototype.initialize.apply(this,[i]),this.$no_results=$('
    '+e["autocomplete-new-tag"]+"
    "),this.$input_box.before(this.$no_results),this.input_on_blur=i.hasOwnProperty("input_on_blur")&&i.input_on_blur},onInputBoxBlur:function(){t.clicking&&this.$input_box.val().length>0&&this.input_on_blur&&(this.suppress_autofocus=!0,this.submitNewItem({label:this.$input_box.val(),item_id:0}),this.suppress_autofocus=!1),this.$no_results.hide()},onMatch:function(t){this.$no_results.hide()},onNoMatch:function(t){t===this.counter&&(this.$no_results.show(),this.$no_results.position({my:"left-1 top+1",at:"left bottom",of:this.$input_box}))},countItems:function(){return _.where(this.items,{is_visible:!0}).length},setTagColors:function(){this.tag_colors={main_color:this.category.get("main_color"),secondary_color:this.category.get("secondary_color")}},getAutocompleteSource:function(){var t=this,e=this.counter,i=this.$input_box;if(!_.isUndefined(this.category))return _.bind((function(o,s){this.category.fetchItemAutocompleteMatches({request:o,response:s,checkSquelch:function(){return o.term!==i.val().substr(0,i[0].selectionStart)&&o.term!==i.val()},checkInputExists:function(){return t.counter===e},onMatch:function(){"function"==typeof t.onMatch&&t.onMatch(t.counter)},onNoMatch:function(){"function"==typeof t.onNoMatch&&t.onNoMatch(t.counter)},additional_params:t.hasOwnProperty("additional_autocomplete_params")?t.additional_autocomplete_params:{}})}),this)},getAutocompleteOnOpen:function(){return _.bind((function(t){$(t).data("ui-autocomplete").menu.element.find("a").css({"background-color":this.tag_colors.main_color}).addClass(this.item_class)}),this)},applyCssToNewItem:function(t,e){t.css({"background-color":this.tag_colors.main_color})},constructAutocompleteArgs:function(){var t;return t=this.has_search_icon?"left-21 top+5":"left-1 top+5",{onFocus:_.bind((function(t,e){this.hasOwnProperty("focus_element")&&!_.isNull(this.focus_element)&&this.focus_element.css({color:"white","background-color":this.focus_element.data("main-color")}),this.focus_element=$(t.originalEvent.target).find("a.ui-state-focus"),this.focus_element.css({color:this.focus_element.data("main-color"),"background-color":this.focus_element.data("secondary-color")})}),this),onOpen:_.bind((function(){this.$input_box.autocomplete("widget").width(i.tag_autocomplete_width)}),this),_renderItem:function(t,e){var i=$("").text(e.label).css({"background-color":e.main_color}).data({"main-color":e.main_color,"secondary-color":e.secondary_color});return $("
  • ").append(i).appendTo(t)},position:{my:t,at:"left bottom",of:this.$input_box}}},processPostConstruction:function(){t.EditableItemList.prototype.processPostConstruction.apply(this),this.processTagBoxDropdownArrowing()},onPaste:t.onTagPaste,validateCharacter:t.validateTagCharacter,processTagBoxDropdownArrowing:function(){this.$input_box.on("keydown.post_construction",_.bind((function(t){var e=t.keyCode||t.which;38!==e&&40!==e||0===this.$input_box.data("ui-autocomplete").menu.element.find(".ui-state-focus").length&&_.each(this.$input_box.data("ui-autocomplete").menu.element.find("a"),(function(t){$(t).css({"background-color":$(t).data("main-color"),color:"#fff"})}))}),this))}}),t.EditableUserList=t.EditableItemList.extend({item_class:"cmty-itemlist-username",item_limit:1e3,item_name:"user",initialize:function(e){this.is_checking_username=!1,t.EditableItemList.prototype.initialize.apply(this,[e])},getAutocompleteSource:function(){var t=this.$input_box;return _.bind((function(e,i){o.fetchUsernameMatches({request:e,response:i,checkSquelch:function(){return e.term!==t.val().substr(0,t[0].selectionStart)&&e.term!==t.val()}})}),this)},constructAutocompleteArgs:function(){return{ui_class:"cmty-username-autocomplete",_renderItem:function(t,e){var i=$("
  • "),o=$("
    "+e.label+"");return i.append(o),"1"===e.is_admin&&o.addClass("cmty-user-admin"),i.appendTo(t)}}},applyCssToNewItem:function(t,e){"1"!==e.is_admin&&1!==e.is_admin||t.addClass("cmty-user-admin")},processUsernameCheckDelay:function(t,e,o){var s=(new Date).getTime()-o,n=this;s>=i.message_readability_delay?this.processUsernameCheck(t,e):setTimeout((function(){n.processUsernameCheck(t,e)}),i.message_readability_delay-s)},processUsernameCheck:function(t,i){this.is_checking_username=!1,this.isUsernameOK(t,i)?(t.user_id=i.user_id,t.is_admin=i.is_admin,this.buildNewItem(t),AoPS.Ui.Modal.closeTopModal()):AoPS.Ui.Modal.replaceTopModal({type:"alert",body:o.formatString(e["invalid-user"],[t.label]),frame_class:"aops-modal-quick"})},isUsernameOK:function(t,e){return e.user_id>0}}),t.EditableUserListCategoryAdmin=t.EditableUserList.extend({has_close:!0,initialize:function(e){this.role=e.role,t.EditableUserList.prototype.initialize.apply(this,[e])},processNewItem:function(t){t.hasOwnProperty("suppress_add_to_model")?delete t.suppress_add_to_model:this.model.addUser({role:this.role,username:t.value,user_id:parseInt(t.user_id),is_admin:parseInt(t.is_admin)})},processRemovedItem:function(t){this.model.removeUser({user_id:parseInt(t.user_id)})},getAutocompleteSource:function(){var t=this.$input_box;return _.bind((function(e,i){o.fetchUsernameMatches({request:e,response:i,checkSquelch:function(){return e.term!==t.val().substr(0,t[0].selectionStart)&&e.term!==t.val()}})}),this)},performCustomValidation:function(i){var s,n,a,r=this;return!this.isNewUserAdmin(i)&&("none"!==(s=this.model.checkUserRole(i.label)).role?(this.is_checking_username=!0,n=o.formatString(e["cat-admin-perms-existing-user"],[i.label,e["cat-admin-user-types-"+this.model.getAdminLangType()+"-"+s.role]]),this.model.getPermission("c_can_edit_"+s.role)?AoPS.Ui.Modal.showConfirm(n+e["cat-admin-perms-existing-user-3"]+" "+e["cat-admin-user-types-"+this.model.getAdminLangType()+"-"+this.role]+".",(function(t){t&&(i.user_id=parseInt(s.user_id),i.suppress_add_to_model=!0,r.model.updateUserRole(i,r.role),r.buildNewItem(i)),r.reset()}),{width:"450px"}):AoPS.Ui.Modal.showAlert(n,{width:"450px",onClose:function(){r.reset()}}),!1):i.hasOwnProperty("user_id")?(i.item_id=parseInt(i.user_id),!0):(t.throwBlockingMessage(e["user-list-validation-blocker"]),a=(new Date).getTime(),this.is_checking_username=!0,this.model.checkAddedUsername({username:i.label,onFinish:function(t){r.processUsernameCheckDelay(i,t,a)}}),!1))},processUsernameCheck:function(t,i){var s=this;return 0===parseInt(i.user_id)?(AoPS.Ui.Modal.replaceTopModal({type:"alert",body:o.formatString(e["invalid-user"],[t.label]),frame_class:"aops-modal-quick",onClose:function(){s.resetInput(),s.is_checking_username=!1}}),!1):(t.user_id=i.user_id,t.label=i.username,t.value=i.username,t.is_admin=i.is_admin,!!this.performCustomValidation(t)&&(this.buildNewItem(t),AoPS.Ui.Modal.closeAllModals(),this.is_checking_username=!1,!0))},isNewUserAdmin:function(t){var i=this;return 1===parseInt(t.is_admin)&&("owner"!==this.role||AoPS.session.user_id!=t.user_id)&&(this.is_checking_username=!0,AoPS.Ui.Modal.showAlert(e["cat-admin-no-add-admin-start"]+t.label+e["cat-admin-no-add-admin-end"],{width:"450px",onClose:function(){i.reset()}}),!0)},reset:function(){AoPS.Ui.Modal.closeAllModals(),this.$input_box.focus(),this.is_checking_username=!1},onClickClose:function(){var i,o,s=this;this.$input_box.val().length>1?(this.is_checking_username=!0,o=this.$input_box.val(),i={label:o,value:o},t.throwBlockingMessage(e["user-list-validation-blocker"]),this.is_checking_username=!0,this.model.checkAddedUsername({username:i.label,onFinish:function(t){setTimeout((function(){s.processUsernameCheck(i,t,undefined)&&s.close()}),500)}})):this.close()}}),t.StaticUserList=AoPS.View.extend({className:"cmty-static-user-list",no_users_message:"",initialize:function(i){var o,s=this,n="function"==typeof i.onMatchLoggedInUser;i.hasOwnProperty("no_users_message")&&(this.no_users_message=i.no_users_message),i.user_list.length>0?_.each(i.user_list,(function(e){var o,a,r;a="cmty-itemlist-username"+(1===parseInt(e.is_admin)?" cmty-user-admin":""),o="/user/"+e.user_id,r=$(''+e.username+""),n&&e.user_id==AoPS.session.user_id&&i.onMatchLoggedInUser(r,e),s.$el.append(r),s.$el.append(" ")})):this.$el.append(this.no_users_message),i.is_editable&&(o=$('
    L
    '),this.$el.append(o))}}),t.ToggleableUserList=AoPS.View.extend({editableUserlistView:t.EditableUserList,staticUserlistView:t.StaticUserList,no_users_message:e.None,initialize:function(t){this.user_list=t.user_list,this.constructStaticUserlist()},events:{"click .cmty-edit-user-list":"toggleUserlist"},toggleUserlist:function(){this.is_static?(this.static_userlist.close(),this.constructEditableUserlist()):(location.reload(),this.editable_userlist.close(),this.constructStaticUserlist())},constructStaticUserlist:function(){this.static_userlist=new AoPS.Community.Views.StaticUserList({user_list:this.getUserList(),is_editable:!0,no_users_message:this.no_users_message}),this.is_static=!0,this.$el.html(this.static_userlist.$el)},constructEditableUserlist:function(){var t=this;this.editable_userlist=new this.editableUserlistView(_.extend({items:this.getEditableUserList(),model:this.model,onClose:function(){setTimeout((function(){t.editable_userlist.$el.find("input")[0]!==document.activeElement&&(t.is_static||t.editable_userlist.is_checking_username||t.toggleUserlist())}),200)}},this.getAdditionalEditableOptions())),this.is_static=!1,this.$el.html(this.editable_userlist.$el),this.editable_userlist.$input_box.focus()},onClose:function(){this.is_static?this.static_userlist.close():this.editable_userlist.close()},getAdditionalEditableOptions:function(){return{}},getUserList:function(){return this.user_list},getEditableUserList:function(){return this.user_list}}),t.ToggleableUserListCategoryAdmin=t.ToggleableUserList.extend({editableUserlistView:t.EditableUserListCategoryAdmin,initialize:function(t){this.user_list=_.filter(this.model.get("users"),(function(e){return e.role===t.role})),this.role=t.role,"owner"===t.role&&(this.no_users_message=e["cat-admin-site-admins-are-admins"]),this.constructStaticUserlist(),this.listenTo(this.model,"users_changed",this.onUsersChange)},onUsersChange:function(){this.is_static&&(this.static_userlist.close(),this.constructStaticUserlist())},getAdditionalEditableOptions:function(){return{role:this.role}},getUserList:function(){var t=this;return this.user_list=_.filter(this.model.get("users"),(function(e){return e.role===t.role})),this.user_list},getEditableUserList:function(){var t=this.getUserList();return _.map(t,(function(t){return{user_id:t.user_id,label:t.username,is_admin:t.is_admin}}))}}),t.EditableRecipientBox=t.EditableUserList.extend({performCustomValidation:function(i){var o,s=this;return this.is_checking_username=!0,i.label.toLowerCase()===AoPS.session.username.toLowerCase()?(this.showError(e["private-no-add-self"]),this.is_checking_username=!1,!1):this.items.length>=AoPS.Community.Constants.max_conversation_participants-1?(this.showError(e["private-cant-add-more"]),!1):(t.throwBlockingMessage(e["private-validation-blocker"]),o=(new Date).getTime(),setTimeout((function(){$(window).trigger("resize")}),0),this.model.checkValidPrivateRecipient({username:i.label,onFinish:function(t){t.is_unreachable?AoPS.Ui.Modal.replaceTopModal({type:"alert",body:e["private-unreachable-recipient"],frame_class:"aops-modal-quick",onClose:_.bind(s.resetInput,s)}):s.processUsernameCheckDelay(i,t,o)}}),!1)},isUsernameOK:function(t,e){return e.is_valid_recipient}}),t.EditableValidatedUserList=t.EditableUserList.extend({performCustomValidation:function(i){var s=this;if(!i.hasOwnProperty("user_id")){t.throwBlockingMessage(e["user-list-validation-blocker"]);var n=(new Date).getTime();return o.checkValidUsername({username:i.label,onFinish:function(t){s.processUsernameCheckDelay(i,t,n)}}),!1}return!0},isUsernameOK:function(t,e){return e.is_valid}}),t.EditableTagBoxExistingTopic=t.EditableTagBox.extend({has_close:!0,setTagColors:function(){this.tag_colors={main_color:this.model.get("category_main_color"),secondary_color:this.model.get("category_secondary_color")}},processNewItem:function(t){this.topic.addNewTag(t.tag_id,t.label)},processRemovedItem:function(t){this.topic.removeTag(t.tag_id,t.label)}}),t.EditableForumList=t.EditableItemList.extend({item_class:"cmty-item-forum",submit_on_special_keys:!1,initialize:function(i){this.ajax_call=i.hasOwnProperty("ajax_call")?i.ajax_call:"fetch_forum_autocomplete",this.$no_results=$('
    '+e["search-no-match"]+"
    "),t.EditableItemList.prototype.initialize.apply(this,[i]),this.$input_box.before(this.$no_results)},onInputBoxBlur:function(){this.$no_results.hide()},prepareAutocomplete:function(){var t=this;o.buildCategoryAutocomplete(this.$input_box,{ajax_call:this.ajax_call,autocomplete_settings:{blockResponse:_.bind((function(){return this.item_submitted}),this),onSelect:function(e,i){t.item_submitted||(t.item_selected=!0,t.item_submitted=!0,t.submitNewItem(i.item),t.submitted_item=i.item.value),e.stopPropagation(),e.preventDefault()}},$no_results:this.$no_results,include_wrapper:!1,show_no_results_msg:!0}),this.processPostConstruction()},applyCssToNewItem:function(t,e){t.css({color:e.main_color})}}),t.TopicFull=AoPS.View.extend({template_id:"#cmty-topic-full-tpl",viewing_source:"master",className:"cmty-topic-full",reply_open:!1,postView:t.Post,has_source:!1,staticTagboxView:t.TopicTagbox,editableTagboxView:t.EditableTagBoxExistingTopic,scrollbar_settings:{autosize_exclusions:[{min:841,max:1e5}]},initialize:function(e){t.setRouteInfo(this,e),this.reply_box=null,this.$loader=AoPS.Page.buildLoader(),this.spoofing_scrollbar=!1,this.reveal_type=e.reveal_type,this.waitInitialization(e)},waitInitialization:function(t){var e=this;this.model?e.continueInitialization(t):setTimeout((function(){e.waitInitialization(t)}),100)},continueInitialization:function(t){if(this.model){var e=this;this.topic_category_at_initialization=this.model.get("category_id"),this.topic_id=this.model.get("topic_id"),this.loaded_from_post_id=0,this.fullscreen_triggered_by_reply=!1,this.from_middle={init:!1},this.unread_posts=[],this.posts=[],this.mark_time_at_add=this.model.get("db_mark_time"),this.start_post_id=-1,this.is_initialized=!1,this.is_on_page=!1,this.is_full_reply=!1,0===this.model.get("posts").length||"show_from_start"!=this.reveal_type&&1===this.model.get("posts").length&&!this.model.get("all_posts_fetched")?(this.$el.append(this.$loader),this.fetchTopicInitialPosts((function(){e.completeInitialization(t)}))):this.completeInitialization(t),this.snipe_warning_open=!1,this.snipe_warning_type=this.model.get("master").get("current_user").get("warn_on_snipes"),this.listenTo(this.model.get("master").get("current_user"),"change:warn_on_snipes",(function(){e.snipe_warning_type=e.model.get("master").get("warn_on_snipes")})),this.listenTo(this.model,"change:deleted",this.onDelete),this.listenTo(this.model,"change:state",this.renderState),this.listenTo(this.model,"change:target_url",this.onChangeTargetUrl),this.listenTo(this.model,"office_hours_person_here",this.onOfficeHoursPersonHere)}},canModerate:function(){return this.model.getPermission("c_can_move_topic_out")||this.model.getPermission("c_can_delete")||this.model.getPermission("c_can_lock_topic")||this.model.getPermission("c_can_announce")||this.model.getPermission("c_can_hard_delete")},onChangeTargetUrl:function(){0==this.model.get("target_url").length&&this.$(".cmty-target-url").parent().remove()},checkIsPrivate:function(){return"private"===this.model.get("topic_type")&&("feed"===this.viewing_source||!_.isNull(this.master.get("focus_category"))&&!_.isUndefined(this.master.get("focus_category"))&&"priv"!==this.master.get("focus_category").get("category_type"))},completeInitialization:function(t){var i,o,s,n,a,r,l,c=this,d="",_=this.model.checkShowTargetLink(),h=this.canModerate();i=this.model.getPermission("c_can_monitor")&&"none"!==this.model.get("state"),this.master=this.model.get("master"),this.is_private=this.checkIsPrivate(),this.route_category_id=t.hasOwnProperty("route_category_id")?t.route_category_id:this.model.get("category_id"),this.model.get("target_url").length>0&&(o=new RegExp(document.domain+"/"+AoPS.router_root),s=document.domain+this.model.get("target_url"),d=o.test(s)?AoPS.pushState_attr:""),this.$el.html(this.getTemplate(this.template_id,{topic_title:this.model.get("topic_title"),category_name:this.model.get("category_name"),category_id:this.model.get("category_id"),topic_id:this.model.get("topic_id"),can_reply:!0,has_target_url:_,target_attr:d,target_url:this.model.get("target_url"),tooltip_target:e["topic-full-target-tooltip"],viewed_in_own_forum:this.route_category_id===this.model.get("category_id"),lang_topic_tooltip:e["topic-full-title-tooltip"],lang_tag_tooltip:e["tag-tooltip-forum"],can_moderate:!this.is_private&&h,has_participants:this.is_private,can_unlock:this.model.getPermission("c_can_lock_topic"),can_unlock_forum:this.model.getPermission("c_can_lock_category"),tooltip_expand:e["topic-full-expand-tooltip"],tooltip_close:e["topic-full-close-tooltip"],tooltip_moderate:e["topic-full-moderate-tooltip"],tooltip_locked:this.model.getPermission("c_can_lock_topic")?e["topic-full-locked-tooltip-mod"]:e["topic-full-locked-tooltip"],tooltip_forum_locked:this.model.getPermission("c_can_lock_category")?e["topic-full-locked-forum-tooltip-mod"]:e["topic-full-locked-forum-tooltip"],tooltip_reply:e["topic-full-reply-tooltip"],locked:e["topic-full-locked"],forum_locked:e["topic-full-locked"],reply:e["topic-full-reply"],lang_Mod:e.Mod,has_topic_state:i,tooltip_state:e["topic-full-state-tooltip"]+this.model.get("state"),topic_state:this.fetchStateSymbol(),tooltip_feed_topic_title:e["feed-topic-title-tooltip"],tooltip_feed_forum_title:e["feed-forum-title-tooltip"],lang_click_for_tags:e["topic-full-click-for-tags"]})),this.$top_panel=this.$el.find(".cmty-topic-full-top"),this.$top_panel_placeholder=this.$el.find(".cmty-topic-full-top-placeholder"),this.$bottom_panel=this.$el.find(".cmty-topic-full-bottom"),this.is_private&&(this.$participants=this.$el.find(".cmty-topic-participants"),this.addParticipants(),this.listenTo(this.model,"change:participants",this.addParticipants)),(_||i)&&this.$top_panel.addClass("too-many-icons"),this.$posts_box=$("
    ",{class:"cmty-postbox-inner-box"}),this.model.get("can_have_source")&&(this.has_source=!0,this.$source=$('
    '),this.renderSource(),this.$posts_box.append(this.$source),this.listenTo(this.model,"change:source",this.renderSource)),this.$who_is_typing=$('
    '),this.$quick_reply=$($.parseHTML('
    N '+e["topic-full-post-reply"]+"
    ")),this.parseLockedVisibility(),this.$posts_outer_wrapper=this.$el.find(".cmty-topic-posts-outer-wrapper"),this.$reply_window=this.$el.find(".cmty-reply-window"),this.$reply_divider=this.$(".cmty-reply-divider"),this.$drag_wrapper=this.$(".cmty-topic-full-drag-wrapper"),this.$reply_divider.draggable({axis:"y",containment:this.$drag_wrapper,start:function(t,e){a=c.$posts_outer_wrapper.height(),r=e.offset.top,l=c.$reply_window.find("textarea").height()},helper:"clone",drag:function(t,e){var i=e.offset.top-r;c.$(".ui-draggable-dragging").css({left:"0px"}),c.$reply_window.find("textarea").height(l-i),c.$posts_outer_wrapper.height(a+i)}}),this.$who_is_typing.css("background",this.model.get("category_secondary_color")),this.$bookmark=this.$el.find(".cmty-topic-bookmark"),"private"===this.model.get("topic_type")?this.setArchiveStatus():this.setBookmarkStatus(),this.$posts_outer_wrapper.prepend(AoPS.Community.Views.buildCommunityScrollbar(this.$posts_box,this.scrollbar_settings)),this.$scrollbar=this.$posts_outer_wrapper.find(".aops-scroll-bar"),this.$posts_inner_wrapper=this.$posts_box.parent(),this.$posts_inner_wrapper.parent().append(this.$el.find(".cmty-topic-jump")),this.setPostFilter(),this.model.get("posts").each((function(t){c.addPost(t)})),this.initializeTagbox(),this.doExtraInitialization(),this.listenTo(this.model,"goto_last_post",this.goToLastPost),this.listenTo(this.model.get("posts"),"add",this.addPostAfterPageConstruction),this.listenTo(this.model,"change:is_bookmarked change:in_feed change:is_watched",this.setBookmarkStatus),this.listenTo(this.model,"post_load_complete",this.removeLoader),this.listenTo(this.model,"tag_removed tag_added",this.setHeight),this.listenTo(this.model,"change:locked change:forum_locked",this.parseLockedVisibility),this.listenTo(this.model,"change:topic_title",this.onChangeTopicTitle),i&&this.master.get("monitoring_office_hours")&&this.listenTo(this.master,"reset_office_hours_topics",this.onResetOfficeHours),this.$posts_box.append(this.$who_is_typing),0===this.posts.length||this.$posts_box.append(this.$quick_reply),this.setHeight(),1!==this.model.get("posts").length||this.model.get("all_posts_fetched")?this.onEndInitialization():(this.$posts_box.append(this.$loader),this.fetchTopicInitialPosts((function(){c.onEndInitialization()}))),this.model.get("is_search_result")&&(n=this.model.fetchSearchText("title")).length>0&&this.$(".cmty-topic-subject").extendedHighlightText("cmty-highlight",n),this.model.get("num_posts")>3&&1===this.model.get("posts").length&&(this.$posts_inner_wrapper.parent().addClass("aops-spoof-scrollbar-visible"),this.spoofing_scrollbar=!0)},isFixedHeight:function(){return"feed"===this.viewing_source||$(window).width()>i.phone_mode_max_width},fetchStateSymbol:function(){switch(this.model.get("state")){case"open":return"O";case"closed":return"C";case"not_monitored":return"N";default:return""}},renderState:function(){var t=this.$(".cmty-topic-state");t.length>0&&(t.html(this.fetchStateSymbol()),t[0].title=e["topic-full-state-tooltip"]+this.model.get("state"))},onClickState:function(){var t;switch(this.model.get("state")){case"open":t="closed";break;case"closed":t="not_monitored";break;case"not_monitored":t="open";break;default:t=this.model.get("state")}this.model.setState({state:t})},renderSource:function(){if(this.model.get("source").length>0?(this.$source.html(''+e["topic-full-source"]+": "+this.model.get("source")),this.$source.css({display:"block"})):this.$source.css({display:"none"}),this.model.get("is_search_result")){var t=this.model.fetchSearchText("source");t.length>0&&this.$source.extendedHighlightText("cmty-highlight",t)}},onChangeTopicTitle:function(){this.$(".cmty-topic-subject").html(this.model.get("topic_title"))},fetchTopicInitialPosts:function(t){this.listenToOnce(this.model,"post_load_complete",(function(){t()}))},onEndInitialization:function(){this.is_initialized=!0,this.is_on_page&&this.finishOnAddToPage(this.add_to_page_settings)},addParticipants:function(){this.$participants.html(this.getTemplate("#cmty-private-participants-tpl",{participants:this.is_private?this.buildParticipants():[],lang_removed:e["private-user-removed"],lang_remove_me:e["private-remove-me"],lang_add_participant:e["private-add-participant"],can_add_more:!(!this.is_private||this.model.get("category_id")!=i.private_messages_id||!this.model.getPermission("p_can_add_participant"))&&this.model.get("participants").length'),this.$(".cmty-topic-bookmark").replaceWith(this.$archive_status)),"active"===this.model.get("status")?(this.$archive_status.append('('+e["private-Archive-btn"]),this.$archive_status[0].title=e["private-archive-topic"]):(this.$archive_status.append(')'+e["private-Unarchive-btn"]),this.$archive_status[0].title=e["private-unarchive-topic"])},onResetOfficeHours:function(){var t=this.model.get("is_feed_focus")?this.feed&&this.feed.get("focus_topic"):this.master&&this.master.get("focus_topic");t&&t.get("topic_id")===this.model.get("topic_id")&&(this.$who_is_typing.html(""),this.$el.removeClass("cmty-office-hours-person-here"),this.setHeight())},onOfficeHoursPersonHere:function(t){var e=this.model.get("category");if(!e||"my_privates"!==e.get("category_type")){var i=this.model.get("topic_id");if(i){var o=this.master.getFocusedTopicIds();if(i===o.master||i===o.feed){if(AoPS.session.user_id===parseInt(t.user_id)&&parseInt(t.is_typing)&&!this.reply_open&&(this.master.updateIsTyping(this.model,0),t.is_typing=!1),parseInt(t.is_typing))this.$who_is_typing.find('[data-user-id="'+t.user_id+'"]').length||this.$who_is_typing.append(this.getTemplate("#cmty-user-is-typing",t));AoPS.session.user_id!=t.user_id&&this.$el.addClass("cmty-office-hours-person-here"),this.setHeight();var s=this.$posts_outer_wrapper.find(".aops-scroll-inner"),n=s.prop("scrollHeight"),a=s.outerHeight(),r=!this.$posts_outer_wrapper.find(".aops-scroll-outer > .aops-scroll-fade-bottom").is(":visible");if(this.reply_open&&r){var l=n-a;s.scrollTop(l)}}}}},events:{"click .cmty-topic-mini-reply":"onClickReply","click .cmty-itembox .cmty-edit-tag":"toggleTagbox","click .cmty-topic-bookmark":"onClickBookmark","click .cmty-topic-jump-bottom":"goToLastPost","click .cmty-topic-jump-top":"goToFirstPost","click .cmty-topic-close":"onClickClose","click .cmty-add-participant":"onClickAddParticipant","click .cmty-full-screen":"onClickFullScreen","click .cmty-topic-moderate":"onClickModerate","click .cmty-topic-can-unlock, .cmty-topic-reply":"onClickFullReply","click .cmty-remove-me":"onClickRemoveMe","click .cmty-topic-archive":"onClickArchiveToggle","click .cmty-click-for-tags":"onClickForTags","click .cmty-topic-state":"onClickState"},onClickForTags:function(t){this.$el.removeClass("cmty-hide-topic-tags"),t.stopPropagation(),t.preventDefault()},onClickArchiveToggle:function(){var t=this.model.get("master");"active"===this.model.get("status")?(this.model.setMyStatus({status:"archived"}),"feed"!==this.viewing_source?t.get("my_privates").trigger("check_for_more_topics"):"feed"===this.model.get("master").get("fullscreen_mode")&&this.performFullScreenEvents(!1),this.completeParticipantStatusChange("/c"+i.private_messages_id),AoPS.Ui.Flyout.display(e["private-message-archived"])):(this.model.setMyStatus({status:"active"}),this.completeParticipantStatusChange("/h"+this.model.get("topic_id")),AoPS.Ui.Flyout.display(e["private-message-unarchived"]))},onClickFullScreen:function(t){this.performFullScreenEvents(!1)},onChangeFullscreenMode:function(){"feed"===this.model.get("master").get("fullscreen_mode")&&"master"===this.viewing_source&&(this.is_full_reply=!1)},performFullScreenEvents:function(t){var e=!1,o="none"===this.model.get("master").get("fullscreen_mode")?"master":"none";this.$posts_box.height()-this.$posts_inner_wrapper.scrollTop()-this.$posts_inner_wrapper.height()0)this.goToPostId(this.start_post_id);else if(o){var s=this.locateFirstUnreadPostBox();_.isUndefined(s)?this.goToLastPost():(e=Math.min(this.$posts_box.height()-this.$posts_inner_wrapper.height(),s.$el.position().top),this.$posts_inner_wrapper.scrollTop(e))}if("show_from_middle"===this.reveal_type||"show_unread"===this.reveal_type)if(this.reveal_type="show_from_middle",this.from_middle={init:!1},_.isUndefined(t.post_id)&&(t.post_id=0),this.model.get("read_since_loading")&&o){var n=this.locateFirstUnreadPostBox();this.reveal_type="show_from_end",this.setQuickReplyVisibility(),this.reveal_type="show_from_middle",e=Math.min(this.$posts_box.height()-this.$posts_inner_wrapper.height(),n.$el.position().top),this.$posts_inner_wrapper.scrollTop(e)}else 0!==t.post_id&&0!==this.loaded_from_post_id||(this.maskLoading(),this.fetchMorePosts("both"));this.model.set("is_read",!0),$(window).bind("resize.cmty-topic-"+this.cid,(function(){i.setHeight()})),this.setUpOnPageListeners(),this.model.get("read_since_loading")&&o||this.setQuickReplyVisibility(),this.model.set("read_since_loading",!0),this.loaded_from_post_id=t.post_id},setUpOnPageListeners:function(){this.listenTo(this.model,"topic_updated",this.setQuickReplyVisibility)},setFocusListener:function(){this.listenTo(this.model,"change:is_master_focus",this.onChangeFocusTopic)},maskLoading:function(){this.model.get("all_posts_fetched")||this.model.get("is_fetching_posts")||(this.setQuickReplyVisibility(),_.each(this.posts,(function(t){t.$el.hide()})))},onChangeFocusTopic:function(){this.fetchFocusTopic()!==this.model&&(this.$el.detach(),this.onRemoveFromPage())},fetchFocusTopic:function(){return this.model.get("master").get("focus_topic")},onDelete:function(){var t=this,i="topic-full-message-deleted",o=arguments.length>1&&arguments[2].hasOwnProperty("deleted_by_me")&&arguments[2].deleted_by_me,s=arguments.length>1&&arguments[2].hasOwnProperty("error_code")&&"E_NO_PERMISSION"===arguments[2].error_code;if(s&&(i=AoPS.session.logged_in?"topic-full-deleted-loss-permission":"topic-full-deleted-not-logged-in"),this.model.get("deleted")&&this.model.get("master").get("focus_topic")==this.model){if(!o){var n=$(".cmty-new-topic-popup"),a="";if(n.length>0){var r=n.first().find(".cmty-post-textarea").val();r.length>0&&(a+=e["topic-full-deleted-extra"]+"")}AoPS.Ui.Modal.showAlert(e[i]+a,{onClose:function(){t.navigateAfterDelete()},frame_class:a.length>0?"aops-modal-standard cmty-deleted-topic-w-extra":"aops-modal-standard"})}this.close(),o&&this.navigateAfterDelete()}},navigateAfterDelete:function(){var t,e,i=this.model.get("master");s.closeAllModals(),(t=i.get("focus_category")).get("is_post_search")?"user_search_posts"===t.get("category_type")?Backbone.history.navigate("/u"+t.get("user_id"),{trigger:!0}):Backbone.history.navigate("/q"+t.get("search_id"),{trigger:!0}):"priv"===t.get("category_type")?Backbone.history.navigate("/x"+t.get("user_id"),{trigger:!0}):(e=t.get("category_id"),Backbone.history.navigate(this.url_cmty_path+"/c"+e,{trigger:!0}))},parseLockedVisibility:function(){this.model.get("locked")||this.model.get("forum_locked")?(this.reply_open&&(this.$el.is(":visible")&&AoPS.Ui.Modal.showMessage(e["topic-full-just-locked"]),this.closeNewReply()),this.$quick_reply.hide(),this.$(".cmty-topic-reply").addClass("force-hidden"),this.$(this.model.get("forum_locked")?".cmty-topic-forum-locked":".cmty-topic-locked").removeClass("force-hidden"),this.$(this.model.get("forum_locked")?".cmty-topic-locked":".cmty-topic-forum-locked").addClass("force-hidden")):(this.setQuickReplyVisibility(),this.$(".cmty-topic-locked").addClass("force-hidden"),this.$(".cmty-topic-forum-locked").addClass("force-hidden"),this.$(".cmty-topic-reply").removeClass("force-hidden"))},setHeight:function(){var t,e,o,s,n,a,r,l,c=0;if(this.hasOwnProperty("$top_panel")&&this.hasOwnProperty("$posts_outer_wrapper")){if(this.is_full_reply&&this.reply_open&&this.reply_box.is_previewing&&(this.removeFullReplyStyle(),this.setFullReplyStyle()),t=this.$top_panel.outerHeight(),this.$top_panel_placeholder.outerHeight(t),this.reply_open&&(a=this.$(".cmty-topic-full-drag-wrapper"),r=t+i.min_posts_window_height,a.css({top:r}),this.isFixedHeight()?this.is_full_reply?a.height(this.$el.height()-r-100):a.css({height:""}):a.height(this.$posts_inner_wrapper.height())),this.isFixedHeight()){if(0===t)return;return e=this.$posts_outer_wrapper.parent().height()-t,this.$el.toggleClass("cmty-no-preview",eo&&this.$reply_window.find("textarea").outerHeight(Math.max(o,i.min_stupid_view_reply_textarea)),c=this.$bottom_panel.outerHeight()),void this.$posts_outer_wrapper.outerHeight(Math.max(e-c,i.min_posts_window_height))}this.$posts_outer_wrapper.height("")}},removeFocusListener:function(){this.stopListening(this.model.get("master"),"change:focus_topic")},onRemoveFromPage:function(){var t;this.removeListeners(),this.$el.removeClass("cmty-not-at-top"),this.is_full_reply&&this.removeFullReplyStyle(),$("body").removeClass("cmty-hide-header"),$(window).unbind("resize.cmty-topic-"+this.cid),this.stored_window_top=0,$("#community-all").removeClass("reply-focused"),$(window).unbind("scroll.topic_full_from_start-"+this.cid),$(window).unbind("scroll.topic_full_from_end-"+this.cid),$(window).unbind("touchmove.topic_full_from_start-"+this.cid),$(window).unbind("touchmove.topic_full_from_end-"+this.cid),this.snipe_warning_type=this.model.get("master").get("current_user").get("warn_on_snipes"),AoPS.session.logged_in&&(_.each(this.unread_posts,(function(t){t.markRead()})),this.unread_posts.length>0&&(t=this.unread_posts[this.unread_posts.length-1].model,this.model.set("db_mark_time",t.get("post_time"))),this.unread_posts=[]),this.is_on_page=!1,this.start_post_id=-1,this.endReplyTriggeredFullscreen()},removeListeners:function(){this.stopListening(this.model,"topic_updated"),this.removeFocusListener(),this.stopListening(this.model.get("master"),"change:fullscreen_mode")},constructStaticTagbox:function(){var t,e="feed"===this.viewing_source,i=this.hasOwnProperty("route_category_id")&&this.route_category_id!==this.model.get("route_category_id");this.tagbox=new this.staticTagboxView({render_titles:i,model:this.model,url_cmty_path:e?"":this.url_cmty_path,url_router_base:e?"/community":this.url_router_base,push_state_attribute:e?"data-cmty":this.push_state_attribute}),this.$el.find(".cmty-tags-itembox-wrapper").append(this.tagbox.$el),this.tagbox_state="static",this.model.get("is_search_result")&&(t=this.model.fetchSearchText("tags")).length>0&&this.tagbox.$el.extendedHighlightText("cmty-highlight",t)},constructEditableTagbox:function(){this.closing=!1,this.editable_tagbox=new this.editableTagboxView({topic:this.model,model:this.model,items:_.map(this.model.get("tags"),(function(t){return{label:t.tag_text,item_id:t.tag_id,is_visible:t.is_visible}})),onClose:_.bind((function(t){setTimeout(_.bind((function(){this.editable_tagbox.$el.find("input")[0]!==document.activeElement&&"static"!==this.tagbox_state&&this.toggleTagbox()}),this),200)}),this)}),this.$el.find(".cmty-tags-itembox-wrapper").append(this.editable_tagbox.$el),this.tagbox_state="editing",this.editable_tagbox.$input_box.focus()},toggleTagbox:function(){"static"===this.tagbox_state?(this.tagbox.close(),this.constructEditableTagbox()):(this.editable_tagbox.close(),this.constructStaticTagbox()),this.setHeight()},goToLastPost:function(){var t,e,i;this.reveal_type="show_from_end",this.setPostFilter(),this.applyPostFilter(),0!==this.posts.length&&(this.setHeight(),t=this.$posts_outer_wrapper.outerHeight(),e=this.$posts_box.height(),i=this.posts[this.posts.length-1].$el.position().top,t>e||(this.isFixedHeight()?this.$posts_inner_wrapper.scrollTop(Math.min(i,-t+e)):window.scrollTo(0,document.body.scrollHeight),this.setPageHeaderVisibility()))},goToFirstPost:function(){this.reveal_type="show_from_start",this.setPostFilter(),this.applyPostFilter(),this.$posts_inner_wrapper.scrollTop(0),this.isFixedHeight()||window.scrollTo(0,0),this.setPageHeaderVisibility()},goToPostId:function(t){var e;e=_.find(this.posts,(function(e){return e.model.get("post_id")===t})),_.isUndefined(e)?this.onNoPostFound():this.setPostsBox(e.$el,0,0)},goToPostNumber:function(t){var e;e=_.find(this.posts,(function(e){return e.model.get("post_number")===t})),_.isUndefined(e)?this.onNoPostFound():this.setPostsBox(e.$el,0,0)},onNoPostFound:function(){t.showError(e["topic-full-no-post-found"]),this.goToFirstPost()},setPostFilter:function(){var t=this;"show_from_start"===this.reveal_type||"show_from_end"===this.reveal_type?this.filterPost=_.bind((function(t){return t.get(this.reveal_type)}),this):this.filterPost=_.bind((function(t){var e=t.get("post_number");return e>=this.from_middle.first_shown_post_num&&e<=this.from_middle.last_shown_post_num}),this),this.$scrollbar.off("slider_at_start.topic_full"),this.$scrollbar.off("slider_at_end.topic_full"),"show_from_start"!==this.reveal_type&&"show_from_middle"!==this.reveal_type||(this.$scrollbar.on("slider_at_end.topic_full",_.bind((function(){this.fetchMorePosts("forwards")}),this)),"master"===this.viewing_source&&($(window).on("scroll.topic_full_from_start-"+this.cid+" touchmove.topic_full_from_start-"+this.cid,(function(){t.$el.is(":visible")&&!t.$scrollbar.is(":visible")&&document.documentElement.clientHeight+$(document).scrollTop()+i.phone_more_posts_sensitivity>=document.body.offsetHeight&&t.fetchMorePosts("forwards")})),$(window).unbind("scroll.topic_full_from_end-"+this.cid),$(window).unbind("touchmove.topic_full_from_end-"+this.cid))),"show_from_end"!==this.reveal_type&&"show_from_middle"!==this.reveal_type||(this.$scrollbar.on("slider_at_start.topic_full",_.bind((function(){this.fetchMorePosts("backwards")}),this)),"master"===this.viewing_source&&($(window).on("scroll.topic_full_from_end-"+this.cid+" touchmove.topic_full_from_end-"+this.cid,(function(){t.$el.is(":visible")&&!t.$scrollbar.is(":visible")&&$(document).scrollTop()<$("#header-wrapper").outerHeight()+parseInt($("#main-content").css("padding-top"))+$("#cmty-topic-view-top").height()&&t.fetchMorePosts("backwards")})),$(window).unbind("scroll.topic_full_from_start-"+this.cid),$(window).unbind("touchmove.topic_full_from_start-"+this.cid)))},setQuickReplyVisibility:function(){this.reply_open||this.model.get("locked")||this.model.get("forum_locked")||"show_from_end"!==this.reveal_type&&!this.model.get("all_posts_fetched")?this.$quick_reply.css({display:"none"}):this.$quick_reply.css({display:"block"})},applyPostFilter:function(){var t=this;this.setQuickReplyVisibility(),_.each(this.posts,(function(e){t.setPostVisibility(e)}))},setPostVisibility:function(t){t.$el.toggle(this.filterPost(t.model))},setPostsBox:function(t,e,i){_.isUndefined(t)||_.isNull(t)||(this.isFixedHeight()?this.$posts_inner_wrapper.scrollTop(-(e-t.position().top+this.$posts_box.position().top-i)):window.scrollTo(0,t.position().top),this.setPageHeaderVisibility())},setPageHeaderVisibility:function(){!this.is_on_page||this.isFixedHeight()||1!==this.posts[0].model.get("post_number")||this.posts[0].$el.is(":visible")?$("body").removeClass("cmty-hide-header"):$("body").addClass("cmty-hide-header"),$(window).trigger("resize")},fetchMorePosts:function(t){var e,i,o,s,n,a,r,l="append",c=this.posts.length,d=this;if(!this.model.get("all_posts_fetched")&&!this.model.get("is_fetching_posts")&&($(document).trigger("mouseup"),this.is_initialized)){switch(this.reveal_type){case"show_from_start":r={onFinish:_.bind((function(){this.applyPostFilter()}),this),start_post_num:_.last(_.filter(this.posts,_.bind((function(t){return this.filterPost(t.model)}),this))).model.get("post_number")};break;case"show_from_end":r={start_post_num:_.find(this.posts,_.bind((function(t){return this.filterPost(t.model)}),this)).model.get("post_number"),onFinish:_.bind((function(){this.setPostsBox(s,n,a),this.applyPostFilter()}),this)};break;case"show_from_middle":(r=this.from_middle.init?{start_post_num:"forwards"===t?this.from_middle.last_shown_post_num:this.from_middle.first_shown_post_num}:{start_post_id:this.start_post_id,show_from_time:this.mark_time_at_add}).onFinish=_.bind((function(e){var i=-1;(!this.from_middle.init||e.low_numthis.from_middle.last_shown_post_num)&&(this.from_middle.last_shown_post_num=e.high_num),this.from_middle.init||(i=e.hasOwnProperty("target_post_number")&&!_.isNull(e.target_post_number)?e.target_post_number:-1),this.from_middle.init=!0,this.model.get("posts").findWhere({post_number:e.low_num}).get("show_from_start")&&(this.model.get("posts").each((function(t){t.get("post_number")<=d.from_middle.last_shown_post_num&&t.set("show_from_start",!0)})),this.reveal_type="show_from_start"),this.model.get("posts").findWhere({post_number:e.high_num}).get("show_from_end")&&(this.model.get("posts").each((function(t){t.get("post_number")>=d.from_middle.first_shown_post_num&&t.set("show_from_end",!0)})),this.reveal_type="show_from_end"),this.setPostFilter(),this.applyPostFilter(),"backwards"===t&&this.setPostsBox(s,n,a),i>-1&&this.goToPostNumber(i)}),this);break;default:console.log("Uhoh. fetchMorePosts called without reveal_type set properly")}if(r.direction=t,r.show_from_setting=this.reveal_type,"backwards"===t&&(l="prepend"),this.$posts_box[l](this.$loader),"backwards"===t)for(a=-this.$posts_inner_wrapper.scrollTop(),e=0;e0&&(s=i,n=o+a,e=c));"forwards"===t&&this.$posts_inner_wrapper.scrollTop(this.$posts_box.height()-this.$posts_inner_wrapper.height()),"backwards"===t&&this.$posts_inner_wrapper.scrollTop(0),r.onError=function(t){"E_AJAX_CANCEL"===t.error_code&&d.$loader.detach()},r.source=this.viewing_source,this.model.fetchMorePosts(r)}},removeLoader:function(){this.$loader.detach()},addPost:function(t){var e,i,o=new this.postView({model:t,topic:this}),s=t.get("post_number"),n=this,a=this.posts.length,r=!1;for(this.spoofing_scrollbar&&(this.spoofing_scrollbar=!1,setTimeout((function(){n.$posts_inner_wrapper.parent().removeClass("aops-spoof-scrollbar-visible")}),330)),o.$el.css({display:"none"}),e=a-1;e>=0;e--)(i=this.posts[e]).model.get("post_number")this.mark_time_at_add&&o.model.get("poster_id")!==AoPS.session.user_id&&(o.markUnread(),this.unread_posts.push(o))},removePost:function(t){this.posts=_.without(this.posts,t),t.close()},locateFirstUnreadPostBox:function(){var t=this.posts.length;if(this.posts[t-1].is_read)return this.posts[t-1];for(var e=t-2;e>0;e--)if(this.posts[e].is_read)return this.posts[e+1];return this.posts[0]},addPostAfterPageConstruction:function(t){this.addPost(t),!this.model.get("is_fetching_past_posts")&&this.$el.is(":visible")&&(AoPS.session.a&&"feed"!==this.viewing_source&&(t.get("poster_id")!==AoPS.session.user_id?document.title="(new) "+_.unescape(this.model.get("topic_title")):document.title=_.unescape(this.model.get("topic_title"))),!this.reply_open||_.isNull(this.reply_box)||this.reply_box.sending_to_database||"none"===this.snipe_warning_type||this.max_post_num_at_reply_start1,l="none"!==this.model.get("can_add_type")&&this.model.get("master").fetchPermission("can_create_category"),c=this.model.getPermission("c_can_lock_category"),d=l?e.Create+" new "+this.model.get("can_add_type"):"";(s.hasOwnProperty("default_to_topics")&&s.default_to_topics||!this.force_to_tags&&this.model.has("active_topics")&&(this.model.get("all_topics_loaded")||this.model.get("active_topics").length>3))&&(this.default_to_tags=!1),t.setRouteInfo(this,s),this.constructUrls(r),n={has_small_header:this.has_small_header,category_name:this.model.get("category_name"),short_description:this.model.get("short_description"),long_description:this.model.get("short_description"),url:AoPS.Community.Views.makeLinkUrl(this.url,this.url_router_base+this.url_cmty_path),push_state_stay:this.push_state_attribute,can_post:this.model.get("can_start_topic")&&!this.model.get("is_locked"),is_locked:this.model.get("can_own_topics")&&this.model.get("is_locked"),lang_category_locked_title:c?e["cat-cell-forum-locked-title-mod"]:e["cat-cell-forum-locked-title"],Locked:e["cat-cell-Locked"],can_unlock:c,can_add:l,can_add_title:d,hide_desc_phone:this.model.get("hide_desc_on_phone"),has_numbers:this.has_numbers,has_items:this.has_items,has_jump_to_top:this.has_jump_to_top,show_description:!(this.has_numbers||this.has_topics)||this.show_description,has_bottom:this.has_bottom,can_bookmark:this.can_bookmark,mark_read:e["cat-cell-mark-read"],new_post:this.model.get("is_private")?e["cat-cell-new-message"]:e["cat-cell-new-topic"],category_id:this.model.get("category_id"),can_mark_all_read:AoPS.session.logged_in&&this.model.get("can_mark_all_read"),has_info:r,has_search_link:this.has_search_link&&-1==_.indexOf(i.unsearchable_fora,this.model.get("category_id")),lang_search:this.model.get("is_private")?e["cat-cell-search-pm"]:e["cat-cell-search-forum"],lang_information:o.capitalizeFirstLetter(a)+" "+e.information,lang_mark_read_title:e["cat-cell-mark-read-title"],lang_bookmark_title:e["cat-cell-bookmark-title"]+a,lang_new_topic_title:this.model.get("is_private")?e["cat-cell-new-pm-title"]:e["cat-cell-new-topic-title"],lang_additional_options:e["cat-cell-more-options-title"],has_help:this.has_help,has_search:this.has_search,lang_help_title:e["cat-cell-help-title"]},this.$el.html(this.getTemplate(this.template_id,n)),this.forums_not_tags&&this.$el.addClass("cmty-forums-not-tags"),this.model.get("can_own_topics")&&this.listenTo(this.model,"change:is_locked",this.parseLockStatus),this.$category_heading=this.$el.find(".cmty-category-cell-heading"),this.$new_topic=this.$category_heading.find(".cmty-new-topic-button"),this.$locked=this.$category_heading.find(".cmty-category-locked-button"),this.$category_description=this.$el.find(".cmty-category-description"),this.$menu=this.$el.find(".cmty-cat-cell-menu"),(this.has_items||this.has_topics)&&(this.$itembox_container=this.$el.find(".cmty-category-itembox-wrapper")),this.has_items&&(this.$itembox_bar=this.$el.find(".cmty-category-cell-poptags"),this.$active_triangle=this.$el.find(".cmty-category-cell-sublink-triangle"),this.$itembox_bar.length>0&&(this.$itembox_bar[0].title=this.items_title),this.default_to_tags&&this.onClickPopularTags()),this.has_numbers&&(this.$num_topics=this.$el.find(".cmty-category-cell-num-topics"),this.$num_users=this.$el.find(".cmty-category-cell-num-users"),this.setNumTopics(),this.setNumUsers(),this.listenTo(this.model,"change:num_topics",this.onChangeNumTopics),this.listenTo(this.model,"change:num_posts",this.setNumPosts),this.listenTo(this.model,"change:num_users",this.onChangeNumUsers)),this.has_search&&this.buildCategorySearch(),this.applyColor(),this.has_topics&&(this.$topic_bar=this.$el.find(".cmty-category-cell-topics"),this.default_to_tags||this.onClickTopics(),this.$topic_bar.length>0&&(this.$topic_bar[0].title=this.topics_title)),this.model.get("can_mark_all_read")&&AoPS.session.logged_in&&(this.parseAllRead(),this.listenTo(this.model,"change:all_read",this.parseAllRead)),this.tags_topics_in_topbar&&(this.$(".cmty-category-cell-right").append(this.$topic_bar),this.$(".cmty-category-cell-right").append(this.$itembox_bar)),this.listenTo(this.model,"change:deleted",this.onDeleteCategory)},parseLockStatus:function(){this.model.get("can_own_topics")&&(this.$new_topic.toggleClass("force-hidden",this.model.get("is_locked")),this.$locked.toggleClass("force-hidden",!this.model.get("is_locked")))},constructUrls:function(e){this.url=this.has_own_url?this.own_url:"/c"+this.model.get("category_id")+"_"+t.convertToUrlFragment(this.model.get("category_name")),this.url_info=e?"/category-admin/"+this.model.get("category_id"):""},events:{"mouseenter .cmty-full-cell-link":"onHoverHeading","mouseleave .cmty-full-cell-link":"onUnhoverHeading","click .cmty-category-cell-poptags":"onClickPopularTags","click .cmty-category-cell-topics":"onClickTopics","click .cmty-new-topic-button":"launchNewTopic","click .cmty-category-cell-heading":"onClickHeading","click .cmty-mark-all-read":"onClickMarkAllRead","click .cmty-cat-cell-cat-info":"onClickInfo","click .cmty-add-new-category":"onClickAddNew","click .cmty-cat-admin-help-wrap":"onClickHelp","click .cmty-category-locked-button":"onClickLocked","click .cmty-cat-cell-search":"onClickSearch"},onDeleteCategory:function(){this.model.get("deleted")&&this.close()},onClickLocked:function(i){this.model.getPermission("c_can_lock_category")?this.launchNewTopic(i):(t.showError(e["cat-cell-locked-modal"]),i.stopPropagation(),i.preventDefault())},onClickAddNew:function(i){"forum"===this.model.get("can_add_type")&&t.followUrlOnClick(i,"/category-admin/forum"),"collection"===this.model.get("can_add_type")&&AoPS.Ui.Modal.showAlert(this.getTemplate("#cmty-create-collection-modal-body-tpl",{}),{title:e["cat-cell-create-collection"],alert_button_ok:e.Cancel,width:"600px"}),"blog"===this.model.get("can_add_type")&&t.followUrlOnClick(i,"/category-admin/blog"),i.preventDefault(),i.stopPropagation()},onClickSearch:function(e){var i=1==this.model.get("category_id")?"/search-private":"/search-forum/"+this.model.get("category_id");"/community"===this.url_router_base?t.followUrlOnClick(e,i):t.leaveRouterOnClick(e,i)},onClickInfo:function(e){"/community"===this.url_router_base?t.followUrlOnClick(e,this.url_info):t.leaveRouterOnClick(e,this.url_info)},onClickMarkAllRead:function(t){return this.model.markAllTopicsRead(),t.preventDefault(),t.stopPropagation(),!1},onClickHelp:function(t){var i=this.getTemplate(this.help_template,{is_logged_in:AoPS.session.logged_in});0===this.help_template.length&&console.log("oh no; there is a help box on a category with no help_template set."),AoPS.Ui.Modal.showAlert(i,{title:e[this.help_template_title_setting],width:"450px",scrollable:!0}),t.preventDefault(),t.stopPropagation()},onAddToPage:function(){this.hasOwnProperty("topic_box")&&(this.topic_box.on_page=!0,this.checkNeedLoadTopics())},onRemoveFromPage:function(){this.hasOwnProperty("topic_box")&&(this.topic_box.on_page=!1)},onHoverHeading:function(t){this.use_own_color&&this.$category_heading.find(".cmty-category-cell-left").css({color:"#fff"})},onUnhoverHeading:function(t){this.use_own_color&&this.$category_heading.find(".cmty-category-cell-left").css({color:this.model.get("secondary_color")})},onClickPopularTags:function(t){this.hasOwnProperty("itembox")||this.constructItembox(),this.itembox.$el.show(),this.topic_box_constructed&&this.topic_box.$el.hide(),this.topic_box_revealed=!1,this.setBars(this.$itembox_bar,this.$topic_bar),arguments.length>0&&t.stopPropagation()},onClickTopics:function(t){this.topic_box_constructed||this.constructTopicBox(),this.hasOwnProperty("itembox")&&this.itembox.$el.hide(),this.topic_box.$el.show(),this.topic_box.on_page=!0,this.topic_box_revealed=!0,this.checkNeedLoadTopics(),this.setBars(this.$topic_bar,this.$itembox_bar),arguments.length>0&&t.stopPropagation()},checkNeedLoadTopics:function(){this.topic_box_revealed&&0===this.topic_box.collection.length&&this.topic_box.checkMoreTopicsNeeded()},parseAllRead:function(){this.$el.toggleClass("cmty-all-read",this.model.get("all_read"))},buildCategorySearch:function(){var i=$('');o.buildCategoryAutocomplete(i,{ajax_call:this.category_search_autocomplete,has_search_icon:!0,autocomplete_settings:{onSelect:function(e,o){i.val(""),i.autocomplete("close"),Backbone.history.navigate("/c"+o.item.category_id+"_"+t.convertToUrlFragment(o.item.label),{trigger:!0}),e.stopPropagation(),e.preventDefault()}},show_no_results_msg:!0}),i.parent().on("click touchstart",(function(t){i.focus(),t.stopPropagation(),t.preventDefault()})),this.$el.find(".cmty-category-cell-right").append(i.parent())},onChangeNumTopics:function(){var t=this,e=this.$num_topics.find(".cmty-category-cell-number");e.fadeOut(300,(function(){t.setNumTopics(),e.show()}))},setNumTopics:function(){var t=this.model.has("num_topics")?o.renderNumberWithCommas(this.model.get("num_topics")):"1,729",i=1===t?e["cat-cell-topic"]:e["cat-cell-topics"];this.$num_topics.html(this.getTemplate("#cmty-category-cell-num-topics-tpl",{num_topics:t+" "+i,url:AoPS.Community.Views.makeLinkUrl(this.url)}));var s=this.$num_topics.find("a");s.length&&(s[0].style.color=this.model.get("main_color"))},setNumPosts:function(){var t=this.model.has("num_posts")?this.model.get("num_posts"):1030401,i=1===t?e["cat-cell-post"]:e["cat-cell-posts"];this.$num_topics[0].title=t+" "+i},onChangeNumUsers:function(){var t=this,e=this.$num_users.find(".cmty-category-cell-number");e.fadeOut(300,(function(){t.setNumUsers(),e.show()}))},setNumUsers:function(){var t=this.model.has("num_users")?this.model.get("num_users"):31,i=1===t?e["cat-cell-user"]:e["cat-cell-users"];this.$num_users.html(this.getTemplate("#cmty-category-cell-num-users-tpl",{num_users:t+" "+i})),this.$num_users[0]&&(this.$num_users[0].title=e["cat-cell-num-user-title"])},setBars:function(t,e){t.addClass("active-sublink").append(this.$active_triangle),_.isUndefined(e)||e.removeClass("active-sublink")},constructItembox:function(){this.itembox=new this.items_box_constructor({model:this.model,placeholder_text:this.placeholder_text,url_router_base:this.url_router_base,url_cmty_path:this.url_cmty_path,scrollbar_arguments:{autosize_exclusions:[{min:841,max:1e5}]},push_state_attribute:this.push_state_attribute}),this.$itembox_container.append(this.itembox.$el)},constructTopicBox:function(){var t=this.model.get("master").fetchFilteredTopicList({category:this.model,category_id:this.model.get("category_id"),tag_ids:[]});this.topic_box=new this.topics_box_constructor({collection:t,main_color:this.model.get("main_color"),secondary_color:this.model.get("secondary_color"),master:this.model.get("master"),category_id:this.model.get("category_id"),suppress_initial_fetch:!(this.default_to_tags||this.fetch_topics_immediately),use_topic_category:this.forums_not_tags}),this.$itembox_container.append(this.topic_box.$el),this.topic_box_constructed=!0,this.model.get("is_forum")&&this.model.has("num_topics")&&this.model.get("num_topics")<6&&this.$el.addClass("cmty-short-forum")},applyColor:function(){var t=this.model.get("main_color"),e=this.model.get("secondary_color");this.use_own_color&&(this.$category_heading.css({"background-color":t,color:e}),this.$el.find(".cmty-category-cell-numbers").css({color:t}))},onClose:function(){this.hasOwnProperty("itembox")&&this.itembox.close(),this.hasOwnProperty("topic_box")&&this.topic_box.close(),this.hasOwnProperty("tag_filter")&&this.tag_filter.close()},launchNewTopic:function(i){var o;return AoPS.session.logged_in?this.model.getPermission("c_can_start_topic")||this.model.getPermission("c_undo_global_ban")?(o={model:this.model,master:this.model.get("master"),url_cmty_path:this.url_cmty_path},arguments.length>1&&(o.tags=arguments[1].tags),_.isNull(this.model.get("master").get("focus_tag"))||(o.tags=[this.model.get("master").get("focus_tag").item_text]),new t.NewTopic(o)):AoPS.Ui.Modal.showMessage(e[AoPS.isUserLimited()?"cat-cell-no-perm-limited-user":"cat-cell-no-perm-start-topic"],{width:"450px"}):AoPS.Ui.buildLoginConfirm(e["new-topic-not-logged-in"]),i.preventDefault(),i.stopPropagation(),!1}}),t.CategoryCellBlog=t.CategoryCell.extend({className:t.CategoryCell.prototype.className+" cmty-category-cell-blog cmty-category-cell-folder ",template_id:"#cmty-category-cell-blog-tpl",has_items:!1,default_to_tags:!1,has_numbers:!1,use_own_color:!1,initialize:function(i){var o=this.model.get("num_topics"),s=o+" ";t.CategoryCell.prototype.initialize.apply(this,[i]),this.$(".cmty-blog-cell-avatar").append(''),s+=1===o?e["blog-Entry"]:e["blog-Entries"],this.$(".cmty-blog-cell-entry-count").html(s)}}),t.CategoryCellMyBooks=t.CategoryCell.extend({has_topics:!1,has_numbers:!1,placeholder_text:"BOOKS WILL BE HERE",can_bookmark:!1,has_own_url:!0,own_url:"MYBOOKSURL",onClickHeading:function(){}}),t.CategoryCellMyClasses=t.CategoryCell.extend({has_topics:!1,can_bookmark:!1,has_numbers:!1,placeholder_text:"CLASSES WILL BE HERE",has_own_url:!0,own_url:"MYCLASSESURL",onClickHeading:function(){}}),t.CategoryCellFolder=t.CategoryCell.extend({className:t.CategoryCell.prototype.className+" cmty-category-cell-folder cmty-category-cell-no-numrow",has_topics:!1,placeholder_text:e["cat-cell-no-items-yet"],can_bookmark:!1,has_numbers:!1,use_own_color:!1,applyColor:function(){var t=this.model.get("main_color");this.$category_heading.css({"border-top":"5px solid "+t}),this.$el.find(".cmty-category-cell-title").css({color:t})}}),t.CategoryCellBookmarkUsers=t.CategoryCellFolder.extend({placeholder_text:e["cat-cell-no-users-bookmarked"]}),t.CategoryCellMyBookmarks=t.CategoryCellFolder.extend({has_own_url:!0,has_numbers:!1,own_url:"/my-bookmarks",onClickHeading:function(e){t.followUrlOnClick(e,"/my-bookmarks")}}),t.CategoryCellForumView=t.CategoryCell.extend({className:t.CategoryCell.prototype.className+" cmty-category-cell-folder",can_bookmark:!1,has_numbers:!1,show_description:!1,use_own_color:!1,tags_topics_in_topbar:!0,topics_title:e["cat-cell-forum-view-topics"],items_title:e["cat-cell-items-title-forum-view"],forums_not_tags:!0}),t.CategoryCellForumBookmarks=t.CategoryCellForumView.extend({placeholder_text:e["bookmark-no-forums-bookmarked"],items_title:e["cat-cell-items-title-forum-bookmark"]}),t.CategoryCellTagView=t.CategoryCell.extend({className:t.CategoryCell.prototype.className+" cmty-category-cell-view-tags cmty-category-cell-folder",can_bookmark:!1,has_numbers:!1,show_description:!1,use_own_color:!1,topics_title:e["cat-cell-tag-view-topics"],items_title:e["cat-cell-items-title-tag-view"],tags_topics_in_topbar:!0,applyColor:t.CategoryCellFolder.prototype.applyColor}),t.CategoryCellPostView=t.CategoryCell.extend({className:t.CategoryCell.prototype.className+" cmty-category-cell-folder",can_bookmark:!1,placeholder_text:e["cat-cell-no-posts-yet"],has_numbers:!1,use_own_color:!1,has_topics:!1,items_box_constructor:t.ItemboxPosts,applyColor:function(){var t=this.model.get("main_color");this.$category_heading.css({"border-top":"5px solid "+t}),this.$el.find(".cmty-category-cell-title").css({color:t})}}),t.CategoryCellTagBookmarks=t.CategoryCellTagView.extend({placeholder_text:e["bookmark-no-tags-bookmarked"],items_title:e["cat-cell-items-title-tag-bookmark"]}),t.CategoryCellTopicView=t.CategoryCell.extend({can_bookmark:!1,className:t.CategoryCell.prototype.className+" cmty-category-cell-folder",has_items:!1,use_own_color:!1,has_numbers:!1,default_to_tags:!1,fetch_topics_immediately:!1}),t.CategoryCellTopicBookmarks=t.CategoryCellTopicView.extend({placeholder_text:e["bookmark-no-topics-bookmarked"]}),t.CategoryCellMyPrivates=t.CategoryCell.extend({can_bookmark:!1,default_to_tags:!1,has_numbers:!1,topics_box_constructor:t.CategoryCellPrivatesTopics,launchNewTopic:function(o){if(this.model.getPermission("c_can_start_topic")||this.model.getPermission("c_undo_global_ban")?new t.NewPrivateConversation({category_name:"",category_id:i.private_messages_id,model:this.model,master:this.model.get("master")}):AoPS.Ui.Modal.showMessage(e[AoPS.isUserLimited()?"new-pm-no-permission-limited":"new-pm-no-permission"],{width:"450px"}),!_.isUndefined(o))return o.stopPropagation(),o.preventDefault(),!1}}),t.CategoryCellOtherForums=t.CategoryCellFolder.extend({category_search_autocomplete:"fetch_forum_autocomplete",has_search:!0,className:t.CategoryCell.prototype.className+" cmty-category-cell-no-numrow cmty-category-cell-folder",help_template:"#cmty-other-forums-help-modal-tpl"}),t.CategoryCellSpecialCollections=t.CategoryCellFolder.extend({category_search_autocomplete:"fetch_folder_collections_contents_autocomplete",has_search:!0,className:t.CategoryCell.prototype.className+" cmty-category-cell-no-numrow cmty-category-cell-folder",help_template:"#cmty-special-collections-help-modal-tpl"}),t.category_cell_category_top_new_properties={num_matches:15,default_to_tags:!0,has_small_header:!0,force_to_tags:!0,has_jump_to_top:!0,initialize:function(e){this.model.get("is_forum")&&(this.model.get("is_private")||(this.can_bookmark=!0),this.has_search_link=!0),this.model.get("special_url").length>0&&(this.url=this.model.get("special_url"),this.constructUrls=function(){}),t.CategoryCell.prototype.initialize.apply(this,[e]),"forum"!==this.model.get("category_type")&&"my_privates"!==this.model.get("category_type")||this.$category_heading.find(".cmty-category-cell-left").css({color:"#fff"}),this.model.get("has_tag_filter")&&(this.tag_filter=new t.CategoryTagFilter(e),this.$itembox_container.before(this.tag_filter.$el)),this.can_bookmark&&(this.$bookmark=this.$el.find(".cmty-category-cell-bookmark"),this.setForumBookmarkStatus(),this.listenTo(this.model,"change:is_bookmarked change:is_watched change:in_feed",this.setForumBookmarkStatus)),this.model.get("is_private")&&!this.model.get("is_archive")&&this.setArchivedButton(),this.listenTo(this.model,"reset_tag_bookmark",this.setTagBookmarkStatus)},setArchivedButton:function(){this.$category_heading.find(".cmty-category-cell-right").prepend('(\t\t\t\t '+e["private-View-Archive-btn"]+" ")},events:_.extend({"click .cmty-category-cell-bookmark":"onClickForumBookmark","click .cmty-category-cell-archive":"onClickArchive"},t.CategoryCell.prototype.events),onAddToPage:function(){this.model.get("has_tag_filter")&&this.tag_filter.onAddToPage(),this.has_topics&&this.model.has("master")&&this.insertFocusTag()},onRemoveFromPage:function(){this.has_topics&&this.model.has("master")&&this.removeFocusTag()},insertFocusTag:function(){var t,e,i,o,s;if(!_.isNull(this.model.get("master").get("focus_tag"))){(s=_.clone(this.model.get("master").get("focus_tag"))).item_can_remove=!0;var n=(t=this.itembox.constructItem(s)).find(".cmty-item-tag");n.css({"background-color":s.item_secondary_color,color:s.item_main_color,border:"1px solid "+s.item_main_color}).on("mouseleave",(function(t){n.css({"background-color":s.item_secondary_color,color:s.item_main_color})})),t.addClass("cmty-cat-cell-focus-shadow cmty-tablet-inline"),this.itembox.$itembox.prepend(t),i=(e=t.attr("href")).match(/t\d+f\d+/),_.isNull(i)||(o=e.split(i)[0],t.attr("href",o)),this.$focus_tag=t}},removeFocusTag:function(){this.hasOwnProperty("$focus_tag")&&this.$focus_tag.remove()},onClickArchive:function(e){t.followUrlOnClick(e,"/my-messages-archive")},onClickForumBookmark:function(i){i.preventDefault(),i.stopPropagation(),AoPS.session.logged_in?!t.in_academy&&AoPS.isUserLimited()?s.showMessage(e["bookmark-limited-user"],{width:"450px"}):this.model.get("is_bookmarked")?this.model.setBookmarkState({is_bookmarked:!1}):t.fireBookmarkModal("forum",o.formatString(e["bookmark-modal-forum"],[this.model.get("category_name")]),_.bind(this.model.setBookmarkState,this.model)):AoPS.Ui.buildLoginConfirm(e["bookmark-not-logged-in"])},setForumBookmarkStatus:t.TopicFull.prototype.setBookmarkStatus,submitNewItem:function(t){var e=this;this.model.addItem({item_id:parseInt(t.item_id),item_type:"tag",item_forum_id:this.model.get("category_id"),item_text:t.value,item_main_color:t.main_color,item_secondary_color:t.secondary_color}),setTimeout((function(){e.$input_box.autocomplete("disable"),e.$input_box.autocomplete("enable"),Backbone.history.navigate(e.url_cmty_path+"/c"+e.model.get("category_id")+"t"+t.item_id+"f"+t.item_forum_id,{trigger:!0})}),100),this.$input_box.val("")},onUnhoverHeading:function(t){this.use_own_color&&this.$category_heading.find(".cmty-category-cell-left").css({color:"#fff"})},onHoverHeading:function(t){this.use_own_color&&this.$category_heading.find(".cmty-category-cell-left").css({color:this.model.get("secondary_color")})}},t.CategoryTagFilter=AoPS.View.extend({template_id:"#cmty-category-cell-focus-tpl",has_own_url:!1,className:"cmty-tag-filter",initialize:function(e){this.focus_tag=e.focus_tag,this.model.get("special_url").length>0?this.url=this.model.get("special_url"):this.url="/c"+this.model.get("category_id")+"_"+t.convertToUrlFragment(this.model.get("category_name")),t.setRouteInfo(this,e),this.render(),this.$focus_tag_line=this.$el.find(".cmty-focus-tag-line"),this.$focus_tag_box=this.$focus_tag_line.parent(),this.listenTo(this.model.get("master"),"change:focus_tag",this.onChangeFocusTag),this.listenTo(this.model,"tag_bookmarked",this.setTagBookmarkStatus)},render:function(){this.$el.html(this.getTemplate(this.template_id,{filter_placeholder:e["cat-cell-filter-placeholder"]}))},events:{"click .cmty-focus-tag-line .bkmk-icon":"onClickTagBookmark"},constructUrls:t.CategoryCell.prototype.constructUrls,onAddToPage:function(){this.buildInputAutocomplete(),this.setTagBookmarkStatus()},onChangeFocusTag:function(){this.model.get("master").get("focus_category")===this.model&&(this.focus_tag=this.model.get("master").get("focus_tag"),this.setFocusTag())},buildInputAutocomplete:function(){var t=$(''),i=this;this.hasOwnProperty("$input_box")?this.$input_box.parent().replaceWith(t):this.$focus_tag_box.append(t),this.$input_box=t,AoPS.Community.Views.buildTagAutocomplete({$input_box:this.$input_box,model:this.model,show_no_results_msg:!0,submitNewItem:function(t){i.submitNewItem(t)},has_search_icon:!0}),this.setFocusTag()},setTagBookmarkStatus:function(){var i;_.isNull(this.focus_tag)||this.model.get("is_private")||(this.tag_bookmark_state=this.model.get("master").fetchBookmarkStatus(this.focus_tag),(i=this.$focus_tag_line.find(".bkmk-icon")).html(t.makeBookmark(this.tag_bookmark_state)),i[0].title=this.tag_bookmark_state.is_bookmarked?e["remove-bookmarked-tag-tooltip"]:e["bookmark-tag-tooltip"])},onClickTagBookmark:function(){AoPS.session.logged_in?!t.in_academy&&AoPS.isUserLimited()?s.showMessage(e["bookmark-limited-user"],{width:"450px"}):this.tag_bookmark_state.is_bookmarked?(this.model.get("master").removeTagBookmark(_.defaults(this.tag_bookmark_state,this.focus_tag)),this.model.trigger("tag_bookmarked"),this.setTagBookmarkStatus()):t.fireBookmarkModal("tag",o.formatString(e["bookmark-modal-tag"],[this.focus_tag.item_text,this.model.get("category_name")]),_.bind((function(t){"forum"===this.model.get("category_type")&&(this.focus_tag.item_category_name=this.model.get("category_name")),this.model.get("master").addTagBookmark({item:_.defaults(t,this.focus_tag)}),this.model.trigger("tag_bookmarked")}),this)):AoPS.Ui.buildLoginConfirm(e["bookmark-not-logged-in"])},setFocusTag:function(){var e;this.$el.find(".cmty-focus-tag-line").empty(),null!=this.focus_tag?(this.tag_colors={main_color:this.focus_tag.item_main_color,secondary_color:this.focus_tag.item_secondary_color},e="
    '+this.focus_tag.item_text+'
    '):e="",this.$focus_tag_line.append($($.parseHTML(e))),this.setTagBookmarkStatus(),null!=this.focus_tag&&(this.$focus_tag_line.find(".cmty-item-tag").css({border:"1px solid "+this.tag_colors.main_color,"background-color":this.tag_colors.secondary_color,color:this.tag_colors.main_color}),this.$focus_tag_line.find(".bkmk-icon").css({color:this.tag_colors.main_color}))},submitNewItem:function(t){var e=this;this.model.addItem({item_id:parseInt(t.item_id),item_type:"tag",item_forum_id:this.model.get("category_id"),item_text:t.value,item_main_color:t.main_color,item_secondary_color:t.secondary_color}),setTimeout((function(){e.$input_box.autocomplete("disable"),e.$input_box.autocomplete("enable"),Backbone.history.navigate(e.url_cmty_path+"/c"+e.model.get("category_id")+"t"+t.item_id+"f"+t.item_forum_id,{trigger:!0})}),100),this.$input_box.val("")}}),t.category_cell_category_top_new_properties_view_forums=_.defaults({className:t.CategoryCellForumView.prototype.className+" cmty-view-folder-top cmty-category-cell-view-forums",use_own_color:!1,can_bookmark:!1},t.category_cell_category_top_new_properties),t.category_cell_category_top_new_properties_view_topics=_.defaults({has_bottom:!1,className:t.CategoryCell.prototype.className+" cmty-folder-top cmty-flat-top ",use_own_color:!1,has_help:!0,help_template:"#cmty-view_topics-help-tpl",help_template_title_setting:"cat-cell-view_topics-help-title",can_bookmark:!1,onAddToPage:function(){$("#community-all").addClass("cmty-view-topics-page")},onRemoveFromPage:function(){$("#community-all").removeClass("cmty-view-topics-page")}},t.category_cell_category_top_new_properties),t.category_cell_category_top_new_properties_view_tags=_.defaults({className:t.CategoryCell.prototype.className+" cmty-folder-top cmty-flat-top",help_template:"#cmty-view_tags-help-tpl",help_template_title_setting:"cat-cell-view_tags-help-title",has_help:!0,use_own_color:!1},t.category_cell_category_top_new_properties),t.CategoryCellCategoryTop=t.CategoryCell.extend(t.category_cell_category_top_new_properties),t.CategoryCellCategoryTopViewTags=t.CategoryCell.extend(t.category_cell_category_top_new_properties_view_tags),t.CategoryCellCategoryTopMyPrivates=t.CategoryCellMyPrivates.extend(t.category_cell_category_top_new_properties),t.CategoryCellCategoryTopViewForums=t.CategoryCell.extend(t.category_cell_category_top_new_properties_view_forums),t.CategoryCellCategoryTopViewTopics=t.CategoryCellTopicView.extend(t.category_cell_category_top_new_properties_view_topics),t.CategoryCellCategoryTopUserSearchPosts=AoPS.View.extend({template_id:"#cmty-user-search-posts-top-tpl",className:"cmty-folder-top",initialize:function(){this.$el.html(this.getTemplate(this.template_id,{category_name:this.model.get("category_name"),url:"/community/u"+this.model.get("user_id")}))}}),t.CategoryCellCategoryTopSearch=AoPS.View.extend({template_id:"#cmty-search-results-top-tpl",className:"cmty-folder-top cmty-search-results",initialize:function(){var t=this.model.get("search_settings").hasOwnProperty("search_text"),i=t?this.model.get("search_settings").search_text:"",s=t?encodeURIComponent(i):"",n=this.model.has("search_page_id"),a=n?"/community/edit-search/"+this.model.get("search_id"):"";this.$el.html(this.getTemplate(this.template_id,{category_name:this.model.get("category_name"),search_text:o.formatString(e["search-results-title-with-text"],[i]),has_search_text:t,url:"/community/q"+this.model.get("search_id"),encoded_search_text:s,can_edit:n,edit_url:a,lang_edit_search:e["search-results-edit"],lang_search_placeholder:e["main-crumb-search-placeholder"]}))},events:{"keydown input":"onKeyDownSearch","click .cmty-search-bar-icon":"onClickSearchIcon"},onClickSearchIcon:function(t){var e=$.trim(this.$("input").val());Backbone.history.navigate("/search/"+encodeURIComponent(e),{trigger:!0}),this.$("input").val("")},onKeyDownSearch:function(t){13===(t.which||t.keyCode)&&t.currentTarget.value.length>0&&(Backbone.history.navigate("/search/"+encodeURIComponent(t.currentTarget.value),{trigger:!0}),t.currentTarget.value="")}}),t.Folder=AoPS.View.extend({template_id:"#cmty-folder-top-tpl",className:"cmty-folder-top",has_header:!0,has_subheader:!1,own_url:"",has_own_url:!1,has_info:!0,initialize:function(){var i=this.model.get("category_id")>0,s="none"!==this.model.get("can_add_type")&&this.model.get("master").fetchPermission("can_create_category");this.url=this.has_own_url?this.own_url:"/c"+this.model.get("category_id")+"_"+t.convertToUrlFragment(this.model.get("category_name")),this.url_info=i?"/category-admin/"+this.model.get("category_id"):"",this.$nothing_here=$('
    '+e["folder-empty-"+this.model.get("category_type")]+"
    "),this.$el.html(this.getTemplate(this.template_id,{can_add:s,can_add_title:s?e.Create+" new "+this.model.get("can_add_type"):"",has_header:this.has_header,has_pdf:!1,lang_pdf:e["view-pdf-tooltip"],category_id:this.model.get("category_id"),has_subheader:this.has_subheader,url:t.makeLinkUrl(this.url),category_name:this.model.get("category_name"),short_description:this.model.get("short_description"),subheader:this.model.get("long_description"),long_description:this.model.get("long_description"),has_info:this.has_info,has_jump_to_top:!0,lang_information:o.capitalizeFirstLetter(e.information)})),this.$category_heading=this.$el.find(".cmty-category-cell-heading"),this.has_header&&this.applyColor(),this.cat_box_holder=this.$el.find(".cmty-folder-grid-container"),this.cat_boxes=[],this.start_item_index=0,this.$loader=AoPS.Page.buildLoader(),this.constructItems(),this.onFinishConstructingItems(),this.start_item_index<8&&!this.model.get("all_subcategories_loaded")&&this.fetchMoreCategories(),this.setScrollListener(),0===this.model.get("items").length&&this.$el.append(this.$nothing_here),this.listenTo(this.model,"item_removed",this.onRemoveItem),"bookmark_forums"===this.model.get("category_type")&&this.listenTo(this.model,"item_added",this.onAddItem)},events:{"click .cmty-cat-cell-cat-info":"onClickInfo","click .cmty-add-new-category":"onClickAddNew","click .cmty-cat-cell-jump-top":"onClickJumpTop","click .cmty-small-category-heading":"onClickHeading"},onClickJumpTop:function(t){window.scrollTo(0,0),t.stopPropagation(),t.preventDefault()},onClickHeading:function(t){$(window).width()<=i.phone_mode_max_width&&this.onClickJumpTop(t)},onClickAddNew:t.CategoryCell.prototype.onClickAddNew,setScrollListener:function(){var t=this;this.model.get("all_subcategories_loaded")||$(window).on("scroll."+this.model.cid+" touchmove."+this.model.cid,(function(e){window.innerHeight+window.pageYOffset+10>=document.body.offsetHeight&&(t.model.get("loading_subcategories")||t.model.get("all_subcategories_loaded")||t.fetchMoreCategories())}))},stopScrollListener:function(){$(window).off("scroll."+this.model.cid+" touchmove."+this.model.cid)},onRemoveItem:function(t){var e,i=null,o=this.cat_boxes.length;if(t.hasOwnProperty("category")){for(e=0;e0&&this.$nothing_here.detach(),t=this.start_item_index;t .cmty-my-aops-data-middle").text(this.model.get("current_user").get("location"))},markMessagesReadStatus:function(){this.$messages_btn.toggleClass("cmty-messages-btn-unread",!_.isUndefined(this.private_messages_topics.findWhere({is_read:!1})))}}),t.AoPSCollectionTop=AoPS.View.extend({template_id:"#cmty-header-box-logged-in-tpl",className:"header-box community-background-color",initialize:function(){this.$el.append(this.getTemplate(this.template_id,{username:AoPS.session.username,is_logged_in:AoPS.session.logged_in,avatar:this.model.get("my_avatar"),user_id:AoPS.session.user_id,lang_Community:e.Community,lang_Welcome:e.Welcome,lang_MyAoPS:e.MyAoPS,lang_Bookmarks:e.Bookmarks,lang_Conversations:e.Messages,lang_search_placeholder:e["main-crumb-search-placeholder"],lang_advanced_search:e["main-crumb-advanced-search"]}))},events:{"keydown input":"onKeyDownSearch","click .cmty-search-bar-icon":"onClickSearchIcon"},onClickSearchIcon:t.CategoryCellCategoryTopSearch.prototype.onClickSearchIcon,onKeyDownSearch:t.CategoryCellCategoryTopSearch.prototype.onKeyDownSearch}),t.LimitedUserMessage=AoPS.View.extend({initialize:function(){this.$el.html(this.getTemplate("#cmty-limited-user-msg-tpl",{username:AoPS.session.username}))}}),t.Announcement=AoPS.View.extend({className:"cmty-home-announce",initialize:function(t){this.$el.html(this.getTemplate("#cmty-announcement-tpl",{content:t.content}))}}),t.AoPSMasterCollection=t.HeadlessFolder.extend({has_extra_box:!0,on_page:!1,events:_.extend({"click .cmty-whois-user-toggle":"onClickUserEllipsis"},t.Folder.prototype.events),onAddToPage:function(){t.Folder.prototype.onAddToPage.apply(this),this.reset_whois&&this.fillWhoIsOnline(),this.on_page=!0},onRemoveFromPage:function(){t.Folder.prototype.onRemoveFromPage.apply(this),this.on_page=!1},constructItems:function(){var i,o,s,n,a=this.model.get("items"),r=AoPS.hasOwnProperty("preload_topics"),l=a.length,c=this;for(this.$extra_box=$('
    '),this.$extra_box.append('
    '+e["master-other-forums"]+'
    ?
    '),this.$el.find(".cmty-folder-grid").append(this.$extra_box),o=this.start_item_index;o
    '),this.$ad_banner.append(''),this.$el.find(".cmty-folder-grid").append(this.$ad_banner),this.$extra_box.find(".cmty-help").on("click",(function(){c.onClickExtraHelp()})),this.extra_help=this.getTemplate("#cmty-toplevel-extras-help-modal-tpl",{can_create_forums:this.model.get("master").fetchPermission("can_create_category")})},onFinishConstructingItems:function(){this.model.get("master").has("whois_data")&&(this.buildWhoIs(),AoPS.session.user_id>1&&this.listenTo(this.model.get("master").get("current_user"),"change:hidden",this.onChangeWhoisData))},buildWhoIs:function(){this.$whois_online=$('
    '),this.fillWhoIsOnline(),this.$el.find(".cmty-folder-grid").append(this.$whois_online),this.listenTo(this.model.get("master"),"change:whois_data",this.onChangeWhoisData),this.constructExtraNote()},constructExtraNote:function(){},onChangeWhoisData:function(){this.on_page?this.fillWhoIsOnline():this.reset_whois=!0},buildUser:function(t){var e="";return t.c%2==1&&(e="cmty-user-admin"),t.c>1&&(e+=" cmty-hidden-user"),e.length>0?''+t.a+"":''+t.a+""},fillWhoIsOnline:function(){var t,i,s,n,a=this.model.get("master").get("whois_data"),r=a.user_data.shown_users.length,l=!1,c=[];for(AoPS.session.logged_in&&(!this.model.get("master").get("current_user").get("hidden")||AoPS.session.a||AoPS.session.n)&&c.push(this.buildUser({a:AoPS.session.username,b:AoPS.session.user_id,c:(AoPS.session.a||AoPS.session.n?1:0)+(this.model.get("master").get("current_user").get("hidden")?2:0)})),i=0;i
    '),this.$extra_box.append("
    "),this.$el.find(".cmty-folder-grid").append(this.$extra_box),_.each(this.model.get("items"),(function(o){var s;o.hasOwnProperty("category")&&(s=o.category).getPermission("c_can_read")&&(e=new(t.fetchCategoryCellConstructor(s.get("category_type")))({model:s}),s.get("category_id")<=8?i.cat_box_holder.append(e.$el):i.$extra_box.append(e.$el),i.cat_boxes.push(e))}))}}),t.AoPSPortal=t.AoPSMasterCollection.extend({has_header:!0,has_info:!1,constructItems:function(){var i,o,s,n,a=this.model.get("items"),r=AoPS.hasOwnProperty("preload_topics"),l=a.length,c=this;for(this.$featured_content=$(''),this.$featured_content.append('
    '+e["master-featured-content"]+'
    ?
    '),this.$el.find(".cmty-folder-grid").append(this.$featured_content),this.$extra_box=$('
    '),this.$extra_box.append('
    '+e["portal-extra-content"]+'
    ?
    '),this.$el.find(".cmty-folder-grid").append(this.$extra_box),o=this.start_item_index;o'+e["portal-extra-note"]+(AoPS.session.logged_in?e["portal-extra-logged-in"]:"")+"

    ")}}),t.ViewPosts=AoPS.View.extend({template_id:"#cmty-folder-top-tpl",className:"cmty-folder-top",initialize:function(){var i=this,s=this.model.get("short_description").length>0;this.url=this.has_own_url?this.own_url:"/c"+this.model.get("category_id")+"_"+t.convertToUrlFragment(this.model.get("category_name")),this.has_label_column=this.hasLabel(),this.url_info="/category-admin/"+this.model.get("category_id"),this.$el.html(this.getTemplate(this.template_id,{has_header:!0,category_name:this.model.get("category_name"),can_add:!1,category_id:this.model.get("category_id"),has_info:!0,has_pdf:!0,lang_pdf:e["view-pdf-tooltip"],has_subheader:s,subheader:this.model.get("short_description"),url:t.makeLinkUrl(this.url),lang_information:o.capitalizeFirstLetter(e.information)})),this.item_views=[],this.$posts_box=this.$(".cmty-folder-grid-container"),_.each(this.model.get("items"),(function(t){i.addItem(t)})),0===this.model.get("items").length&&this.$el.append('
    '+e["folder-empty-view_posts"]+"
    "),this.applyColor()},events:{"click .cmty-cat-cell-cat-info":"onClickInfo"},applyColor:function(){var t=this.model.get("main_color");console.log(t),this.$el.find(".cmty-category-cell-heading").css({color:t}),this.$el.find(".cmty-category-cell-title").css({color:t})},onClickInfo:t.Folder.prototype.onClickInfo,addItem:function(t){var e=new AoPS.Community.Views.ViewPostsItem({item:t,model:this.model,has_label_column:this.has_label_column});this.item_views.push(e),this.$posts_box.append(e.$el)},hasLabel:function(){var t=_.find(this.model.get("items"),(function(t){return"post"===t.item_type&&t.item_text.length>0}));return!_.isUndefined(t)},onClose:function(){_.each(this.item_views,(function(t){t.close()}))}}),t.ViewPostsItem=AoPS.View.extend({template_id:"#cmty-view-posts-item-tpl",hidden_template_id:"#cmty-view-posts-item-hidden-tpl",className:"cmty-view-posts-item",initialize:function(t){var i=t.item,o="post_hidden"===i.item_type,s=o?this.hidden_template_id:this.template_id,n="view_posts_text"!==i.post_data.post_type,a=o&&t.has_label_column||i.item_text.length>0;o&&0===i.item_text.length&&(i.item_text=e["view-posts-click-hidden"]),this.url=n?"/c"+i.post_data.category_id+"h"+i.post_data.topic_id+"p"+i.item_id:"",this.$el.html(this.getTemplate(s,{has_label:a,label:i.item_text,has_poster:n,poster_avatar:i.post_data.poster_avatar,poster_username:i.post_data.username,post:i.post_data.post_rendered,view_topic_text:e["view-posts-view-topic"],url:this.url})),a&&!o&&this.$el.addClass("cmty-view-post-item-w-label"),o&&(this.$hidden_content=this.$(".cmty-post-item-hidden-content"),this.$(".cmty-hide-heading").remove(),this.$(".cmty-hide-content").css({display:"inline-block"}).removeClass("cmty-hide-content")),a?n?this.$el.addClass("cmty-vp-both"):this.$el.addClass("cmty-vp-left"):n&&this.$el.addClass("cmty-vp-right")},events:{"click .cmty-post-item-hidden-bar":"onClickHiddenBar","click .cmty-view-post-poster":"onClickPost"},onClickHiddenBar:function(){this.$el.toggleClass("cmty-view-posts-item-reveal")},onClickPost:function(e){this.url.length>0&&t.followUrlOnClick(e,this.url)}}),t.BasicCategoryTitleBar=AoPS.View.extend({template_id:"#cmty-category-basic-title-tpl",className:"cmty-category-cell",initialize:function(){var e=this.model.get("main_color");this.url=this.has_own_url?this.own_url:"/c"+this.model.get("category_id")+"_"+t.convertToUrlFragment(this.model.get("category_name")),this.$el.html(this.getTemplate(this.template_id,{category_name:this.model.get("category_name"),short_description:this.model.get("short_description"),url:AoPS.Community.Views.makeLinkUrl(this.url)})),this.$category_heading=this.$el.find(".cmty-category-cell-heading"),this.$category_heading.css({"background-color":e,color:"#fff"})},events:{"mouseenter .cmty-full-cell-link":"onHoverHeading","mouseleave .cmty-full-cell-link":"onUnhoverHeading","click .cmty-category-cell-heading":"onClickHeading"},onClickHeading:t.Folder.prototype.onClickHeading,onHoverHeading:t.category_cell_category_top_new_properties.onHoverHeading,onUnhoverHeading:t.category_cell_category_top_new_properties.onUnhoverHeading}),t.PostingEnviron=AoPS.View.extend({template_id:"#cmty-posting-frame-tpl",className:"cmty-posting-environ",has_bbcode_buttons:!0,is_new_pm:!1,has_email_subscribe:!0,has_add_to_feed:!0,sending_blocker:e["new-topic-send-blocker"],initialize:function(t){var e=this;this.settings=t,this.is_bbcode_enabled=!0,this.settings.hasOwnProperty("has_add_to_feed")&&(this.has_add_to_feed=this.settings.has_add_to_feed),this.settings.hasOwnProperty("has_email_subscribe")&&(this.has_email_subscribe=this.settings.has_email_subscribe),_.extend(this,{submenus:{},is_building_subwindow:!1,is_previewing:!1,is_preview_processing:!1,extra_options:{}}),this.has_poll=!1,this.attachments=[],this.render(),this.allow_latex_errors=!1,this.$posting_buttons=this.$el.find(".cmty-bbcode-buttons"),this.$post_box=this.$el.find(".cmty-post-textarea"),this.$title_box=this.$el.find(".cmty-subject-input"),this.$preview_box=this.$el.find(".cmty-post-preview"),this.$preview_text=this.$el.find(".cmty-post-preview-text"),this.$preview_button=this.$el.find(".cmty-preview-button"),this.$submit_button=this.$el.find(".cmty-submit-button"),this.$el.find(".cmty-post-preview").append(AoPS.Community.Views.buildCommunityScrollbar(this.$preview_text)),this.$loader=AoPS.Page.buildLoader(),this.has_bbcode_buttons&&(this.constructBbCodeButtons(),this.styleAttachmentsButton()),this.$active_submenu_button=null,this.$el.on("keydown",(function(t){13===(t.which||t.keyCode)&&(t.ctrlKey||t.metaKey)&&e.submitPost()})),this.settings.hasOwnProperty("preset_extra_options")&&_.each(_.keys(this.settings.preset_extra_options),(function(t){(e.has_email_subscribe||"notify_email"!==t)&&(e.has_add_to_feed||"bookmark_feed"!==t)&&(e.extra_options[t]=e.settings.preset_extra_options[t])})),this.setPreviewButton(),"string"==typeof t.content&&t.content.length>0&&this.addContent(t.content)},isLatexError:function(t){return"E_LATEX_ERROR"===t||"E_ASY_ERROR"===t},throwLatexErrorMessage:function(t){var i=this;s.showConfirm(o.formatString(e["error-latex-posting-confirm"],["E_LATEX_ERROR"===t?"LaTeX":"Asymptote"]),(function(t){t?(i.allow_latex_errors=!0,s.closeTopModal(),i.submitPost()):(s.closeTopModal(),s.closeTopModal(),i.$post_box.focus())}),{confirm_button_cancel:e["error-latex-i-will-fix"],confirm_button_ok:e["error-latex-post-anyway"],width:"450px",closeX:!1,force_response:!0,close_on_button_click:!1})},constructBbCodeButtons:function(){var t=this,i=[{button_class:"cmty-bbcode-other",onClick:function(e){t.showSubMenu(e,"extra_options")},is_bbcode:!1},{button_class:"cmty-bbcode-bold",title:e["bbcode-title-bold"],stub:"b"},{button_class:"cmty-bbcode-underline",stub:"u",title:e["bbcode-title-underline"]},{button_class:"cmty-bbcode-italic",stub:"i",title:e["bbcode-title-italic"]},{button_class:"cmty-bbcode-text-size",stub:"size",title:e["bbcode-title-text-size"],onClick:function(e){t.showSubMenu(e,"font_size")}},{button_class:"cmty-bbcode-text-color",stub:"color",title:e["bbcode-title-text-color"],onClick:function(e){t.showSubMenu(e,"font_color")}},{button_class:"cmty-bbcode-quote",title:e["bbcode-title-quote"],stub:"quote"},{button_class:"cmty-bbcode-hide",title:e["bbcode-title-hide"],stub:"hide"},{button_class:"cmty-bbcode-code",title:e["bbcode-title-code"],stub:"code"},{button_class:"cmty-bbcode-smiley",title:e["bbcode-title-smiley"],onClick:function(e){t.showSubMenu(e,"smiley")}},{has_permission:this.settings.master.fetchPermission("can_post_images"),button_class:"cmty-bbcode-img",title:e["bbcode-title-img"],stub:"img"},{button_class:"cmty-bbcode-url",title:e["bbcode-title-url"],stub:"url"},{has_permission:this.settings.master.fetchPermission("can_attach_files"),button_class:"cmty-bbcode-attachment",title:e["bbcode-title-attachment"],is_bbcode:!1,onClick:function(){t.openAttachmentPanel()}},{button_class:"cmty-bbcode-poll",title:e["bbcode-title-poll"],onClick:function(){t.togglePoll()},is_bbcode:!1}];_.each(i,(function(e){var i;e.hasOwnProperty("has_permission")&&!e.has_permission||(("boolean"!=typeof e.is_bbcode||e.is_bbcode)&&(e.button_class+=" cmty-is-bbcode"),(i=$("
    ",{class:e.button_class+" clickable cmty-bbcode-btn",title:e.hasOwnProperty("title")?e.title:""})).data("button_settings",e),i.on("click",(function(o){("boolean"==typeof e.is_bbcode&&!e.is_bbcode||t.is_bbcode_enabled)&&(e.hasOwnProperty("onClick")?e.onClick(i):e.hasOwnProperty("stub")&&t.applyBbCode(e))})),t.$posting_buttons.append(i))}))},events:{"click .cmty-posting-preview-bar":"previewPost","click .cmty-submit-button":"submitPost","keyup .cmty-post-textarea":"onPostKeypress","click .cmty-cancel-button,.cmty-cancel-posting-x":"onClickCancel","click .cmty-refresh-preview":"generatePreview",click:"onAnyClick","keydown .cmty-subject-input":"onSubjectKeypress",'change [name="cmty-post-extra-disable-bbcode"]':"onClickDisableBbCode","click .cmty-poll-cancel-btn":"onClickCancelPoll","click .cmty-preview-bar-attachments":"onClickPreviewBarAttachments"},onClickDisableBbCode:function(t){this.$el.toggleClass("cmty-bbcode-disabled",t.currentTarget.checked),this.is_bbcode_enabled=!t.currentTarget.checked},onAnyClick:function(){this.hasOwnProperty("$submenu")&&!this.is_building_subwindow&&(this.$submenu.detach(),this.$active_submenu_button=null),this.is_building_subwindow=!1},onSubjectKeypress:function(){},onPostKeypress:function(){},setPreviewButton:function(){this.$preview_button.toggle(this.$post_box.val().length>8)},onClickClosePreview:function(){this.settings.hasOwnProperty("onClosePreview")&&this.settings.onClosePreview(),this.setHeight()},onClickPreviewBarAttachments:function(t){t.stopPropagation(),t.preventDefault(),this.openAttachmentPanel()},openAttachmentPanel:function(){this.hasOwnProperty("attachments_view")||(this.attachments_view=new t.PostingAttachments({model:this.settings.master,parent_view:this})),this.attachments_view.show()},processAttachments:function(t){var e=t.dropzone,i=t.existing_attachments,o=this;this.attachments=[],_.each(i,(function(t){o.attachments.push({url:t.url,existing:1,name:t.name})})),_.each(e.files,(function(t){o.attachments.push({tmp_name:t.tmp_name,existing:0,name:t.name})})),this.styleAttachmentsButton()},styleAttachmentsButton:function(){var t,i=this.$(".cmty-bbcode-attachment");0!=i.length&&(0==this.attachments.length?(t=e["bbcode-title-attachment"],this.$el.removeClass("cmty-posting-with-attachments")):(t=e["bbcode-title-has-attachments"],this.$el.addClass("cmty-posting-with-attachments"),_.each(this.attachments,(function(e){t+="\n "+e.name}))),i[0].title=t)},setHeight:function(){},applyBbCode:function(t){var e,i,o;i=this.$post_box.scrollTop(),e="["+t.stub,t.hasOwnProperty("secondary")&&(e+="="+t.secondary),e+="]",o="[/"+t.stub+"]",this.wrapTextareaSelection(e,o),this.$post_box.scrollTop(i)},showSubMenu:function(t,e){var i=this.$post_box[0].selectionStart,o=this.$post_box[0].selectionEnd;this.is_building_subwindow=!1,this.$post_box[0].setSelectionRange(i,o),t!==this.$active_submenu_button?(this.onAnyClick(),this.is_building_subwindow=!0,this.submenus.hasOwnProperty(e)||(this.submenus[e]=this.createSubMenu(t,e)),this.$posting_buttons.append(this.submenus[e]),this.$submenu=this.submenus[e],this.$active_submenu_button=t):this.onAnyClick()},addContent:function(t){this.wrapTextareaSelection(t,"")},setTitle:function(t){this.$title_box.length&&this.$title_box.val(t)},createSubMenu:function(o,s){var n,a,r=$('
    '),l=o.position(),c=this,d=!1;switch(s){case"font_color":r.addClass("cmty-posting-submenu-font-color"),_.each(i.bbCode.font_colors,(function(t){var e;e=$('
    ').css({"background-color":t}).on("click",(function(){c.applyBbCode(_.extend(o.data("button_settings"),{secondary:t}))})),r.append(e)}));break;case"smiley":r.addClass("cmty-posting-submenu-smileys"),a=$('
    '),_.each(i.bbCode.smileys,(function(t){var e;(e=$(''+t[0]+'')).on("click",(function(){c.replaceTextareaSelection(" "+t[0]+" ")})),a.append(e)})),r.append(AoPS.Community.Views.buildCommunityScrollbar(a));break;case"font_size":r.addClass("cmty-posting-submenu-sizes"),_.each(i.bbCode.font_sizes,(function(t){var e=$('
    '+t.text+"
    ").on("click",(function(){c.applyBbCode(_.extend(o.data("button_settings"),{secondary:t.size}))}));r.append(e)}));break;case"extra_options":r.addClass("cmty-posting-submenu-extras"),n=i.bbCode.extra_options,this.canSetAnnounce()&&(n=n.concat([{property:"is_local_announcement",text:e["post-environ-extra-announce"],class_id:"cmty-post-extra-local-announce"}]),d=!0),this.canSetGlobalAnnounce()&&(n=n.concat([{property:"is_global_announcement",text:e["post-environ-global-announce"],class_id:"cmty-post-extra-global-announce"}]),d=!0),_.each(n,(function(t){var e;if((c.has_email_subscribe||"notify_email"!==t.property)&&(c.has_add_to_feed||"bookmark_feed"!==t.property)){e=c.extra_options.hasOwnProperty(t.property)&&c.extra_options[t.property];var i=$('
    ").on("click",(function(e){c.is_building_subwindow=!0,c.extra_options[t.property]=e.target.checked}));r.append(i)}})),d&&(this.$announce_through=$('
    '+e["post-environ-announce-through"]+'
    '),r.append(c.$announce_through),this.$announce_through.on("click",(function(t){t.stopPropagation()})),t.makeAnnounceDateInput(c.$announce_through.find("input")))}return r.css({left:l.left+parseInt(o.css("margin-left")),top:l.top+o.height()}),r},togglePoll:function(){this.has_poll?this.onClickCancelPoll():this.showPoll()},showPoll:function(){this.hasOwnProperty("$poll")||this.createPoll(),this.$el.addClass("cmty-posting-with-poll"),this.has_poll=!0,this.setHeight(),this.$poll_question.focus()},hidePoll:function(){this.$el.removeClass("cmty-posting-with-poll"),this.has_poll=!1,this.setHeight()},createPoll:function(){var t;t={lang_poll_question:e["poll-question"],lang_poll_options:e["poll-options"],lang_poll_options_desc:e["poll-options-desc"],lang_options_per:e["poll-options-per"],lang_poll_length:e["poll-length"],lang_len_unlimited:e["poll-unlimited"],lang_len_1_day:e["poll-len-1-day"],lang_len_2_days:e["poll-len-2-days"],lang_len_3_days:e["poll-len-3-days"],lang_len_1_week:e["poll-len-1-week"],lang_len_2_weeks:e["poll-len-2-weeks"],lang_len_1_month:e["poll-len-1-month"],lang_revoting:e["poll-revoting"],No:e.No,Yes:e.Yes,lang_cancel_poll:e["poll-cancel"]},this.$poll=$(this.getTemplate("#cmty-poll-build-tpl",t)),this.$poll_question=this.$poll.find("input.cmty-poll-question"),this.$poll_inputs=this.$poll.find("textarea.cmty-poll-inputs"),this.$el.find(".cmty-posting-box-container").before(this.$poll),this.has_poll_built=!0},onClickCancelPoll:function(){var t=this;this.$poll_question.val().length>0||this.$poll_inputs.val().length>0?AoPS.Ui.Modal.showConfirm(e["poll-cancel-confirm"],(function(e){e&&t.hidePoll()}),{title:e["poll-cancel-title"],confirm_button_ok:e["poll-cancel"],confirm_button_cancel:e["poll-cancel-no"],width:"450px"}):this.hidePoll()},canSetAnnounce:function(){return!1},canSetGlobalAnnounce:function(){return!1},wrapTextareaSelection:function(t,e){var i,o=this.$post_box.val(),s=this.$post_box[0].selectionStart,n=this.$post_box[0].selectionEnd;i=o.slice(0,s)+t+o.slice(s,n)+e+o.slice(n),this.$post_box.val(i),this.$post_box.focus(),this.$post_box[0].setSelectionRange(s+t.length,n+t.length)},replaceTextareaSelection:function(t){var e,i=this.$post_box.val(),o=this.$post_box[0].selectionStart,s=this.$post_box[0].selectionEnd;e=i.slice(0,o)+t+i.slice(s),this.$post_box.val(e),this.$post_box.focus(),this.$post_box[0].setSelectionRange(o+t.length,o+t.length)},previewPost:function(){if(!this.is_preview_processing){if(this.is_previewing)return this.$el.removeClass("cmty-posting-previewing"),this.is_previewing=!1,clearInterval(this.preview_interval),void this.onClickClosePreview();this.openPreviewWindow(),this.generatePreview()}},openPreviewWindow:function(){this.is_previewing=!0,this.$el.addClass("cmty-posting-previewing"),this.setHeight(),this.settings.hasOwnProperty("onPreview")&&this.settings.onPreview()},generatePreview:function(i){var s,n=this;arguments.length>0&&i.stopPropagation(),this.is_preview_processing||(o.cmty_ajax.ajax_active?(this.is_preview_processing=!0,0===this.$post_box.val().length||this.extra_options.hasOwnProperty("disable_bbcode")&&this.extra_options.disable_bbcode?this.revealPreview(this.$post_box.val().replace(/\r?\n/g,"
    ")):(s=this.$preview_text.html(),this.$preview_text.html(""),this.$preview_text.append(this.$loader),this.settings.master.parseBBCode({text:this.$post_box.val(),post_format:"bbcode",onFinish:function(t){n.revealPreview(t.rendered_text)},onAjaxFilter:function(){n.revealPreview(s)},onError:function(t){var e;e=n.checkCommonErrors(t.error_code),AoPS.Ui.Modal.showAlertQuick(e.message,{width:"400px"}),"close"===e.action?(n.revealPreview(""),n.onClickClosePreview()):"reveal_rendered"===e.action&&(n.revealPreview(t.response.error_data),n.onClickClosePreview())}}))):t.showErrorAtopAModal(o.is_cmty_asleep?e["community-asleep-save"]:e["ajax-error-E_AJAX_UNKNOWN"]))},checkCommonErrors:function(t){var i="",o="";switch(t){case"E_QUOTE_DEPTH":i=e["posting-quote-depth"],o="close";break;case"E_HIDE_DEPTH":i=e["posting-hide-depth"],o="close";break;case"E_NAUGHTY_TERM_USED":i=e["new-topic-banned-term"],o="close";break;case"E_NO_LINK_POSTING":i=e["new-topic-no-links"],o="close";break;case"E_NO_IMAGE_POSTING":i=e["new-topic-no-images"],o="close";break;case"E_INVALID_CHARACTER":i=e["new-topic-invalid-character"],o="close";break;case"E_LATEX_ERROR":i=e["posting-latex-error"],o="reveal_rendered";break;case"E_ASY_ERROR":i=e["posting-asy-error"],o="reveal_rendered";break;case"E_YOUTUBE_ERROR":i=e["posting-youtube-error"],o="close";break;case"E_POST_TOO_SHORT":i=e["new-topic-post-too-short"],o="close";break;case"E_POST_TOO_LONG":i=e["new-topic-post-too-long"],o="close";break;case"E_POST_TOO_LONG_PYTHON":i=e["new-topic-post-too-long-python"],o="close";break;case"E_TOPIC_TITLE_TOO_SHORT":i=e["new-topic-title-too-short"],o="close";break;case"E_TOPIC_TITLE_TOO_LONG":i=e["new-topic-title-too-long"],o="close";break;case"E_NO_FLOODING":i=e["posting-no-flooding-error"],o="close";break;case"E_NO_SUCH_CATEGORIES":i=e["new-topic-category-deleted"],o="close";break;case"E_BLACKLISTED":i=e["new-topic-blacklist-trigger"],o="close";break;case"E_NEW_USER_TEXT_BLACKLIST":i=e["new-topic-blacklist-text-trigger"],o="close";break;case"E_INVALID_ANNOUNCE_DATE":i=e["post-environ-invalid-announce-date"],o="close";break;case"E_IMG_ERROR":i=e["post-environ-image-error"],o="close";break;case"E_TIP_ERROR":i=e["post-environ-tip-error"],o="close";break;case"E_ANNOUNCE_DATE_IN_PAST":i=e["post-environ-announce-date-too-early"],o="close";break;case"E_NEW_USER_LIMITED":i=e["new-reply-err-E_NEW_USER_LIMITED"],o="close";break;case"E_NEW_VPN_USER_LIMITED":i=e["new-reply-err-E_NEW_VPN_USER_LIMITED"],o="close";break;case"E_AJAX_TIMEOUT":i=e["generic-ajax-timeout"],o="close";break;default:i="An unknown error occured.",o="no_error_match"}return{action:o,message:i}},revealPreview:function(t){if(this.$loader.detach(),this.$preview_text.html(t),this.setHeight(),this.is_preview_processing=!1,this.$preview_text.length>0&&"undefined"!=typeof Prism){Prism.plugins.autoloader.languages_path="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/";for(var e=this.$preview_text[0].querySelectorAll("pre code"),i=0;ii.max_post_length)return this.showError(e["new-topic-post-too-long"]),!1;if(this.has_poll&&(this.$poll_question.val().length>0||this.$poll_inputs.val().length>0)){if(0==(s=$.trim(this.$poll_question.val()).length))return this.showError(e["poll-no-question-error"]),!1;if(si.max_poll_question_length)return this.showError(e["poll-question-too-long"]),!1;if(0==$.trim(this.$poll_inputs.val()))return this.showError(e["poll-no-inputs-error"]),!1}return!0},showError:function(t){AoPS.Ui.Modal.showAlert(t)},checkTitle:function(){return!($.trim(this.$title_box.val()).length0,attachments:this.existing_attachments,lang_attach_done:e["post-attachments-done"],lang_already_attached:e["post-attachments-already-attached"]})),this.$post_attachments=this.$("#post-attachments"),this.$post_attachments.dropzone({url:"/m/community/ajax.php",maxFiles:i.max_attachments_per_post-this.existing_attachments.length,addRemoveLinks:!0,sending:function(t,e,i){i.append("a","upload_post_attachment"),i.append("aops_session_id",AoPS.session.id)},removedfile:function(t){var e;return n.parent_view.processAttachments(n),null!=(e=t.previewElement)&&e.parentNode.removeChild(t.previewElement),this._updateMaxFilesReachedClass()},accept:function(t,e){/[^a-zA-Z0-9\.\ \_\-]/.test(t.name)?e("err-invalid-character"):e()},fallback:function(){AoPS.Ui.Modal.showAlert(e["err-dropzone-fallback"],{width:"450px"}),setTimeout((function(){AoPS.Ui.Modal.closeTopModal()}),100)},maxFilesize:AoPS.Community.Constants.max_attachment_size/1e3,success:function(i,s){var a;if(s.hasOwnProperty("error_code")){switch(s.error_code){case"E_TOO_MANY_FILES":a=e["edit-avatar-too-many"];break;case"E_NO_FILE_SENT":a=e["edit-avatar-no-file"];break;case"E_FILE_TOO_LARGE":a=e["post-attachments-file-too-big"];break;case"E_NO_PERMISSION":a=e["post-attachments-no-permission"];break;case"E_BAD_FILE_TYPE":a=o.formatString(e["post-attachments-bad-file-type"],[i.name]);break;case"E_SPOOFED_FILE":a=e["post-attachments-spoofed"];break;default:a=e["unexpected-error-code"]+s.error_code}t.showErrorAtopAModal(a),this.removeFile(i)}else i.tmp_name=s.response.tmp_name,$(i.previewElement).addClass("dz-success"),n.parent_view.processAttachments(n)},error:function(i,s){"err-invalid-character"===s?t.showErrorAtopAModal(e["post-attachments-invalid-character"]):"File is too big"===s.substr(0,15)?t.showErrorAtopAModal(e["post-attachments-file-too-big"]):"You can't upload files of this type"===s.substr(0,35)&&t.showErrorAtopAModal(o.formatString(e["post-attachments-bad-file-type"],[i.name])),this.removeFile(i)}}),this.dropzone=this.$post_attachments[0].dropzone},events:{"click .post-attachment-existing-row .aops-font":"removeExistingAttachment","click .cmty-attach-done":"onClickDone"},removeExistingAttachment:function(t){var e,o,s=t.currentTarget;o=$(s.parentNode).find("input").val(),e=_.findWhere(this.existing_attachments,{url:o}),this.existing_attachments=_.without(this.existing_attachments,e),this.dropzone.options.maxFiles=i.max_attachments_per_post-this.existing_attachments.length,0==this.existing_attachments.length?this.$(".post-attachments-existing").remove():s.parentNode.parentNode.removeChild(s.parentNode),this.parent_view.processAttachments(this)},onClickDone:function(){s.closeTopModal()},show:function(){var t=this;this.$el.showModal({title:e["post-attachments-title"],width:"400px",frame_class:"aops-modal-standard cmty-upload-modal",onClose:function(){t.parent_view.$post_box.focus()}})}}),t.throwPolymathConfirm=function(i){var n;(n=new t.PolymathConfirmation(i)).$el.showModal({type:"confirm",width:"450px",close_on_button_click:!1,scrollable:!0,onButtonClick:function(a){a?n.$('input[name="agree"]')[0].checked&&(n.$('input[name="is_student"]')[0].checked||n.$('input[name="is_student"]')[1].checked)?(t.throwLoaderBlockingMessage(e["polymath-confirm-blocker"]),AoPS.Community.MasterModel.sendPolymathConfirm({category_id:i.category_id,student_type:n.$('input[name="is_student"]:checked').val(),onFinish:function(){s.closeTopModal(),s.closeTopModal()},onError:function(t){s.showAlert(o.formatString(e["polymath-confirm-unknown-error"],[t.error_code]),{width:"400px",onClose:function(){s.closeTopModal(),s.closeTopModal()}})}})):t.showErrorAtopAModal(e["polymath-force-choice"]):s.closeTopModal()},onClose:function(){n.close()}})},t.PolymathConfirmation=AoPS.View.extend({template_id:"#cmty-polymath-confirm-tpl",initialize:function(t){this.$el.html(this.getTemplate(this.template_id,{error_message:t.error}))}}),t.NewTopic=t.PostingEnviron.extend({className:t.PostingEnviron.prototype.className+" cmty-new-topic-popup",topic_type:"forum",render:function(){var t=this;this.model.get("master").get("current_user").get("posting_subscribe_new_topic")&&(this.extra_options.notify_email=!0,this.extra_options.bookmark_feed=!0),this.$el.append(this.getTemplate(this.template_id,{category_name:this.model.get("category_name"),has_subject:!0,has_forum:!0,has_halp:this.model.get("has_halp")&&this.model.get("master").fetchPermission("can_post_as_halp"),has_tags:!0,has_recipients:!1,is_new_pm:this.is_new_pm,lang_view_attachments:e["new-topic-preview-bar-attachments"],lang_subject:e["new-topic-subject"],lang_tags:e["new-topic-tags"],lang_recipients:e["new-topic-to"],lang_post_anonymous:e["new-topic-post-anon"],lang_preview:e["new-topic-preview"],lang_close_preview:e["new-topic-close-preview"],lang_refresh:e["new-topic-refresh-preview"],max_post_length:i.max_post_length,max_title_length:i.max_topic_title_length,has_source:this.model.get("has_source"),lang_source:e["topic-cell-source"],max_source_length:i.max_source_length,source_placeholder:e["new-topic-source-placeholder"]})),this.$source=this.$("input.cmty-source-input"),this.$el.find(".cmty-posting-forum-name").css({"background-color":this.model.get("main_color")}),this.in_autotag_delete=!1,this.removed_autotags=[],o.autotagger.dictionary=this.model.getTermTagDictionary(),this.model.get("allow_autotag")&&this.model.get("has_source")&&this.$source.on("keyup",(function(e){t.onSourceKeypress(e)})),this.tag_warning_issued=!1,this.finishRender(),this.autotagging_disabled=this.model.get("master").get("current_user").get("turn_off_autotagging")},finishRender:function(){var e=this;this.appendTagBox(),$(window).on("resize.new-topic-"+this.cid,(function(){e.setHeight()})),this.$el.showModal({frame_class:"cmty-posting-modal",mask_fade_in_speed:200,scrollable:!1,draggable:!0,draggable_options:{containment:"window"},max_width:"1000px",onClickMask:function(t){return!1},onClickX:function(){return e.onClickCancel(),!1}}),this.$el.find(".cmty-private-recipients")?this.$el.find(".cmty-private-recipients input").focus():this.$el.find(".cmty-subject-input").focus(),this.setHeight(),this.listenTo(Backbone,"community_disabled",this.onDeactivated),t.setTabTarget(this.$("textarea"),this.$(".cmty-submit-button")),t.setTabTarget(this.$(".cmty-cancel-button"),this.$(".cmty-subject-input")),t.setTabTarget(this.$(".cmty-submit-button"),this.$(".cmty-cancel-button")),t.setTabTarget(this.$('input[type="text"]').last(),this.$("textarea"))},onSubjectKeypress:function(t){var e=t.which||t.keyCode;this.model.get("allow_autotag")&&32===e&&this.processTextForAutotagging(t.currentTarget.value.substr(0,t.currentTarget.selectionStart))},onSourceKeypress:function(t){var e=t.which||t.keyCode;this.model.get("allow_autotag")&&32===e&&this.processTextForAutotagging(t.currentTarget.value.substr(0,t.currentTarget.selectionStart))},onPostKeypress:function(t){var e=t.which||t.keyCode,i=this.$post_box.val();this.model.get("allow_autotag")&&(32!==e&&13!==e||(i=i.substr(0,t.currentTarget.selectionStart),this.processTextForAutotagging(i)))},processTextForAutotagging:function(t){var e,i,s,n=[],a=this;this.autotagging_disabled||_.isUndefined(t)||0===t.length||(s=(e=_.last(t.replace(/(;|:|\.|,|\r\n|\n|\r)/gm," ").replace(/\s{2,}/g," ").trim().split(" "),3))[e.length-1].toLowerCase(),e.length>1&&(i=e[e.length-2].toLowerCase()+" "+s,n=n.concat(o.autotagger.tag(i)),3===e.length&&(n=n.concat(o.autotagger.tag(e[0].toLowerCase()+" "+i)))),n=n.concat(o.autotagger.tag(s)),_.each(n,(function(t){_.isUndefined(_.findWhere(a.removed_autotags,{item_id:t.id}))&&a.editable_tagbox.submitItemSilent({item_id:t.id,label:t.text,term_text:t.term_text,term_id:t.term_id,item_forum_id:a.model.get("category_id"),is_visible:!0,main_color:a.model.get("main_color"),secondary_color:a.model.get("secondary_color"),tag_source:"auto"})})))},removeAllAutoTags:function(){var t=this.editable_tagbox.$items,e=this;this.in_autotag_delete=!0,_.each(t,(function(t){t.data("item").hasOwnProperty("tag_source")&&"auto"===t.data("item").tag_source&&e.editable_tagbox.removeItem(t)})),this.in_autotag_delete=!1},onClickCancel:function(){this.fetchPostContent().length>i.posting_warn_limit?AoPS.Ui.Modal.showConfirm(e["new-topic-are-sure"],_.bind((function(t){t?(AoPS.Ui.Modal.closeAllModals(),this.close()):AoPS.Ui.Modal.closeTopModal()}),this),{confirm_button_cancel:e["new-topic-confirm-cancel"],confirm_button_ok:e["new-topic-confirm-OK"],close_on_button_click:!1}):AoPS.Ui.Modal.closeAllModals()},canSetAnnounce:function(){return this.model.getPermission("c_can_announce")},canSetGlobalAnnounce:function(){return this.model.getPermission("c_can_global_announce")},validatePost:function(t){t(this.checkPost()&&this.checkTitle())},parseSubmittedTags:function(){var t=this;return this.settings.hasOwnProperty("tags")?_.map(this.settings.tags,(function(e){return{item_id:0,value:e,item_forum_id:t.model.get("category_id"),main_color:t.model.get("main_color"),secondary_color:t.model.get("secondary_color"),label:e,is_visible:!0,is_special:t.settings.hasOwnProperty("special_item")&&t.settings.special_item.toLowerCase()===e.toLowerCase()}})):[]},appendTagBox:function(){var i=this.parseSubmittedTags(),n=this;this.editable_tagbox=new t.EditableTagBox({category:this.model,items:i,input_on_blur:!0,onAddItem:function(t,e){n.checkSpecialItem(t,e),n.setHeight()},tryToRemoveItem:function(t){var i,a=$(":focus"),r=a===n.editable_tagbox.$input_box;i=t instanceof jQuery?t.data("item"):t,n.fetchSpecialItemText().toLowerCase()===i.label.toLowerCase()?s.showConfirm(o.formatString(e["new-topic-remove-link-confirm"],[n.model.get("category_name")]),(function(e){e&&n.editable_tagbox.removeItem(t),r?n.editable_tagbox.$input_box.focus():a.focus()}),{width:"450px"}):n.editable_tagbox.removeItem(t)},onRemoveItem:function(t){!n.in_autotag_delete&&t.hasOwnProperty("tag_source")&&"auto"===t.tag_source&&n.removed_autotags.push(t),n.setHeight()}}),this.$el.find(".cmty-tags-line").append(this.editable_tagbox.$el)},checkSpecialItem:function(t,e){this.fetchSpecialItemText().toLowerCase()===t.label.toLowerCase()&&e.addClass("cmty-special-item")},fetchSpecialItemText:function(){return"string"==typeof this.settings.special_item?this.settings.special_item:""},setHeight:function(){var t=(this.has_poll?this.$poll.outerHeight():0)+this.$el.find(".cmty-posting-top").outerHeight()+this.$el.find(".cmty-posting-button-row").outerHeight()+this.$el.find(".cmty-posting-preview-bar").outerHeight(),e=this.$el.height();this.is_previewing?(this.$el.find(".cmty-posting-box-container").height((e-t)/2),this.$(".cmty-post-preview").height((e-t)/2)):this.$el.find(".cmty-posting-box-container").height(e-t)},submitPost:function(){var t,o,n,a,r=this,l=!1;this.validatePost((function(c){c&&(r.model.get("allow_autotag")&&(r.processTextForAutotagging(r.$title_box.val()),r.model.get("has_source")&&r.processTextForAutotagging(r.$source.val())),r.model.get("category_id")===i.olympiad_forum_id?r.tag_warning_issued||0!==r.editable_tagbox.items.length&&r.doesEssentialTagExist(i.essential_tags_olympiad)||(l=!0,t=e["new-topic-olympiad-tags-warning"],n=e["new-topic-olympiad-tag-warning-title"],o="#cmty-olympiad-tag-modal-tpl",r.tag_warning_issued=!0):r.model.get("category_id")===i.college_math_forum_id&&(r.tag_warning_issued||0!==r.editable_tagbox.items.length&&r.doesEssentialTagExist(i.essential_tags_college)||(l=!0,t=e["new-topic-college-tags-warning"],n=e["new-topic-college-tag-warning-title"],o="#cmty-college-tag-modal-tpl",r.tag_warning_issued=!0)),l?((a=$(r.getTemplate(o,{message:t}))).showModal({title:n,width:"460px"}),a.find(".cmty-item-tag").on("click",(function(t){var e=r.editable_tagbox.items.length;e===i.max_tags_per_topic&&r.editable_tagbox.removeItem(r.editable_tagbox.items[e-1]),r.editable_tagbox.buildNewItem({item_id:parseInt(t.currentTarget.getAttribute("tag_id")),value:t.currentTarget.innerHTML,item_forum_id:r.model.get("category_id"),main_color:r.model.get("main_color"),secondary_color:r.model.get("secondary_color"),label:t.currentTarget.innerHTML,is_special:!1}),s.closeTopModal()}))):0===r.editable_tagbox.items.length&&"forum"===r.topic_type?AoPS.Ui.Modal.showConfirm(e["new-topic-no-tags-message"],(function(t){t?r.finishSubmitPost(!0):AoPS.Ui.Modal.closeTopModal()}),{confirm_button_ok:e["new-topic-no-tags-confirm-yes"],confirm_button_cancel:e["new-topic-no-tags-confirm-no"],width:"400px",close_on_button_click:!1}):r.finishSubmitPost(!1))}))},doesEssentialTagExist:function(t){var e,i,o=t.length;for(e=_.map(this.editable_tagbox.items,(function(t){return t.value.toLowerCase()})),i=0;i-1)return!0;return!1},isPostingAsSheriff:function(){return this.is_new_pm&&this.model.get("master").fetchPermission("can_pm_as_sheriff")&&this.$(".cmty-posting-sheriff input")[0].checked},isPostingAsHalp:function(){return this.model.get("has_halp")&&this.model.get("master").fetchPermission("can_post_as_halp")&&this.$(".cmty-posting-halp input")[0].checked},finishSubmitPost:function(s){var n,a=this,r=this.$title_box.val();this.prepareToSubmitPost(s),(n=_.extend({category_id:this.model.get("category_id"),topic_type:this.topic_type,title:r,has_poll:0,allow_latex_errors:this.allow_latex_errors,target_url:this.settings.hasOwnProperty("target_url")?this.settings.target_url:"",target_text:this.settings.hasOwnProperty("target_text")?this.settings.target_text:"",post_text:this.fetchPostContent(),post_as_halp:this.isPostingAsHalp(),attachments:this.attachments,pm_as_sheriff:this.isPostingAsSheriff(),tags:this.editable_tagbox.items,linked_tag:"string"==typeof this.settings.special_item?this.settings.special_item:"",removed_autotags:this.hasOwnProperty("removed_autotags")?this.removed_autotags:[],hidden_tags:this.settings.hasOwnProperty("hidden_tags")?this.settings.hidden_tags:[],restricted_tags:this.settings.hasOwnProperty("restricted_tags")?this.settings.restricted_tags:[],source:_.isUndefined(this.$source)?"":this.$source.val(),onFinish:function(e){var i=e.topic_id;t.delayModalClearing({onClose:function(){a.onPostedNewTopic({topic:e.topic_model,topic_id:i,title:r}),a.close()}})},onDeactivated:function(){a.onDeactivated()},onError:function(s){var n,r;if("string"==typeof e["new-topic-err-"+s.error_code])n=e["new-topic-err-"+s.error_code];else if("E_TOPIC_FORUM_LOCKED"===s.error_code)n=e["new-topic-forum-locked"],a.model.setFrontEndLocked(!0);else if("E_NO_PERMISSION"===s.error_code)n=a.model.get("category_id")===i.private_messages_id?AoPS.isUserLimited()?e["new-pm-no-permission-limited"]:e["new-pm-no-permission"]:e["new-topic-no-permission"];else if("E_AJAX_TIMEOUT"===s.error_code)n=e["new-topic-timeout"];else if("E_USER_EXCLUDE_SELF"===s.error_code)r=a.removeParticipant(s.response.error_data),n=o.formatString(e["private-user-excluded"],[r]);else if("E_PM_SHERIFF"===s.error_code)r=a.removeParticipant(s.response.error_data),n=o.formatString(e["private-user-sheriff"],[r]);else if("E_PM_EXTENSIONS"===s.error_code)r=a.removeParticipant(s.response.error_data),n=o.formatString(e["private-user-extensions"],[r]);else if("E_USER_EXCLUDED_FROM_PM"===s.error_code)r=a.removeParticipant(s.response.error_data),n=o.formatString(e["private-user-excluded-by-system"],[r]);else if("E_TOO_MANY_PARTICIPANTS"===s.error_code)n=e["private-new-msg-too-many-participants"];else if("E_POLYMATH_NOT_OPTED_IN"===s.error_code);else{var l=a.checkCommonErrors(s.error_code);"reveal_rendered"===l.action&&(a.openPreviewWindow(),a.revealPreview(s.response.error_data)),n=l.message,"no_error_match"===l.action&&(n=e["unexpected-error-code"]+s.error_code)}"E_LATEX_ERROR"===s.error_code||"E_ASY_ERROR"===s.error_code?a.throwLatexErrorMessage(s.error_code):"E_POLYMATH_NOT_OPTED_IN"===s.error_code?(AoPS.Ui.Modal.closeTopModal(),t.throwPolymathConfirm({category_id:a.model.get("category_id"),error:e["polymath-new-topic-confirm"]})):AoPS.Ui.Modal.showAlertQuick(n,{width:"400px",onClose:function(){AoPS.Ui.Modal.closeTopModal()}})},recipients:this.hasOwnProperty("editable_recipient_box")?_.map(this.editable_recipient_box.items,(function(t){return t.user_id})):[]},this.extra_options)).announce_through=this.hasOwnProperty("$announce_through")?this.$announce_through.find("input").val():"",this.has_poll&&(n.has_poll=1,n.poll_data={question:this.$poll_question.val(),allow_revote:this.$poll.find('select[name="poll-revoting"]').val(),num_selections:this.$poll.find('select[name="poll-num-options"]').val(),options:this.$poll_inputs.val(),length:this.$poll.find('select[name="poll-length"]').val()}),this.settings.master.submitNewTopic(n)},onDeactivated:function(){s.closeAllModals(),this.close()},prepareToSubmitPost:function(e){this.title=this.$title_box.val(),e?t.replaceWithLoaderBlockingMessage(this.sending_blocker):t.throwLoaderBlockingMessage(this.sending_blocker),this.listenTo(this.settings.master.get("topics"),"add",this.checkAddedTopic)},onPostedNewTopic:function(e){var i=this.settings.hasOwnProperty("url_cmty_path")?this.settings.url_cmty_path:"";"private"===e.topic.get("topic_type")&&this.model.get("master").get("current_user").get("pm_archive_on_send")||(this.model.get("is_private")&&!t.onPMPage()||Backbone.history.navigate(i+"/c"+this.model.get("category_id")+"h"+e.topic_id+"_"+t.convertToUrlFragment(e.title),{trigger:!0}),"function"==typeof this.settings.onSuccess&&this.settings.onSuccess(e))},onClose:function(){this.editable_tagbox.close(),$(window).off("resize.new-topic-"+this.cid)}}),t.NewReply=t.PostingEnviron.extend({has_subject:!1,has_forum:!1,has_source:!1,no_permission_lang_property:"new-reply-no-permission",no_permission_limited_lang_property:"new-reply-no-permission-limited",render:function(){this.sending_to_database=!1,this.$el.append(this.getTemplate(this.template_id,_.defaults(this.settings,{has_subject:this.has_subject,has_forum:this.has_forum,category_name:this.has_forum&&this.settings.topic.get("category_name"),has_tags:!1,has_halp:!1,is_new_pm:this.is_new_pm,has_source:this.has_source,lang_view_attachments:e["new-topic-preview-bar-attachments"],lang_subject:e["new-topic-subject"],lang_preview:e["new-topic-preview"],lang_close_preview:e["new-topic-close-preview"],lang_refresh:e["new-topic-refresh-preview"],max_post_length:i.max_post_length,max_title_length:i.max_topic_title_length,lang_source:e["topic-cell-source"],max_source_length:i.max_source_length,source_placeholder:e["new-topic-source-placeholder"]}))),this.has_forum&&this.$el.find(".cmty-posting-forum-name").css({"background-color":this.settings.topic.get("category_main_color")}),t.setTabTarget(this.$("textarea"),this.$(".cmty-submit-button")),t.setTabTarget(this.$(".cmty-submit-button"),this.$("textarea"))},submitPost:function(){var i=this.$post_box.val(),o=this;return!!this.checkPost()&&("private"===this.settings.topic.get("topic_type")&&this.checkParticipants(),this.throwBlockingMessage(),this.sending_to_database=!0,this.settings.master.submitPost(_.extend({category_id:this.settings.category_id,post_text:i,topic_id:this.settings.topic_id,attachments:this.attachments,topic:this.settings.topic,allow_latex_errors:this.allow_latex_errors,onDeactivated:function(){s.closeAllModals()},onError:function(s){var n,a=s.error_code,r=s.response.error_data;if(o.sending_to_database=!1,"E_TOPIC_FORUM_LOCKED"===s.error_code)n=e["new-reply-forum-locked"],o.settings.master.setCategoryLockStatus(o.settings.topic.get("category_id"),!0);else if("E_NOT_LOGGED_IN"===a)n=e["new-reply-logged-out-warning"]+'
    \t\t\t\t\t\t\t";else if("E_NO_PERMISSION"===a)n=AoPS.isUserLimited()?e[o.no_permission_limited_lang_property]:e[o.no_permission_lang_property];else if("E_TOPIC_LOCKED"===a)n=e["new-reply-locked"];else if("E_NEW_USER_LIMITED"===a)n=e["new-reply-err-E_NEW_USER_LIMITED"];else if("E_NEW_VPN_USER_LIMITED"===a)n=e["new-reply-err-E_NEW_VPN_USER_LIMITED"];else if("E_AJAX_TIMEOUT"===a)n=e["new-reply-timeout"];else if("E_POLYMATH_NOT_OPTED_IN"===a);else{var l=o.checkCommonErrors(a);"no_error_match"===l.action?n=e["unexpected-error-code"]+a:("reveal_rendered"===l.action&&"function"==typeof o.openPreviewWindow&&(o.openPreviewWindow(),o.revealPreview(r)),n=l.message)}"E_LATEX_ERROR"===a||"E_ASY_ERROR"===a?o.throwLatexErrorMessage(a):"E_POLYMATH_NOT_OPTED_IN"===a?(AoPS.Ui.Modal.closeTopModal(),t.throwPolymathConfirm({category_id:o.settings.category_id,error:e["polymath-reply-confirm"]})):(AoPS.Ui.Modal.closeTopModal(),AoPS.Community.Views.showError(n))}},this.extra_options)),this.settings.hasOwnProperty("onSubmit")&&this.settings.onSubmit(),this.onFinishSubmit(),!1)},throwBlockingMessage:function(){t.throwLoaderBlockingMessage(e["topic-full-new-reply-blocker"])},checkParticipants:function(){var t=this.settings.topic;1!==t.get("participants").length&&1==_.filter(t.get("participants"),(function(t){return!t.removed})).length&&AoPS.Ui.Flyout.display(e["private-reply-no-listeners"])},onErrorInPosting:function(){},onFinishSubmit:function(){},onClickCancel:function(){this.fetchPostContent().length>i.posting_warn_limit?AoPS.Ui.Modal.showConfirm(e["topic-full-reply-confirm"],_.bind((function(t){t&&this.closeReply()}),this),{confirm_button_cancel:e["topic-full-reply-confirm-cancel"],confirm_button_ok:e["topic-full-reply-confirm-OK"]}):this.closeReply()},closeReply:function(){this.settings.hasOwnProperty("onCancel")&&this.settings.onCancel(),$("#community-all").removeClass("reply-focused"),$(window).trigger("resize"),this.close()}}),t.EditPost=t.PostingEnviron.extend({has_email_subscribe:!1,has_add_to_feed:!1,className:t.PostingEnviron.prototype.className+" cmty-new-topic-popup cmty-edit-post",render:function(){this.has_source=this.has_source&&this.settings.topic.get("can_have_source"),this.settings.post_model.get("attachment")&&(this.attachments=_.map(this.settings.post_model.get("attachments"),(function(t){return{href:t.href,existing:!0,name:t.name,url:t.url}}))),AoPS.Community.Views.NewReply.prototype.render.apply(this),"bbcode"!==this.settings.post_model.get("post_format")&&(this.extra_options.disable_bbcode=!0,this.is_bbcode_enabled=!1,this.$el.addClass("cmty-bbcode-disabled")),this.settings.hasOwnProperty("input_text")&&this.$el.find("textarea").val(this.settings.input_text),$(window).on("resize.edit-post-"+this.cid,_.bind((function(){this.setHeight()}),this)),this.has_source&&(this.$source=this.$("input.cmty-source-input"),this.$source.val(_.unescape(this.settings.topic.get("source")))),this.has_subject&&this.$(".cmty-subject-input").val(_.unescape(this.settings.topic.get("topic_title")))},setHeight:t.NewTopic.prototype.setHeight,submitPost:function(){return!!this.checkPost()&&(!(this.has_subject&&!this.checkTitle())&&void this.requestReason())},requestReason:function(){var t=this,i=$(this.getTemplate("#cmty-edit-post-reason-tpl",{lang_instructions:e["edit-post-reason-info"]}));i.showAlert({title:e["edit-post-reason-heading"],width:"400px",focus_on_alert:!1,frame_class:"cmty-edit-reason-modal aops-modal-standard",onButtonClick:function(){var e=i.find("textarea").val().substr(0,255);t.sendEdit(e)},close_on_button_click:!1}),i.find("textarea").focus(),i.on("keydown",(function(e){13===(e.which||e.keyCode)&&(e.metaKey||e.ctrlKey)&&(t.sendEdit(i.find("textarea").val().substr(0,255)),e.stopPropagation(),e.preventDefault())}))},sendEdit:function(o){var s=this,n=this.$post_box.val();t.replaceWithLoaderBlockingMessage(e["edit-send-blocker"]),this.settings.post_model.edit(_.extend({edited_text:this.$post_box.val(),edit_reason:o,allow_latex_errors:this.allow_latex_errors,source:this.has_source?this.$source.val():"",attachments:this.attachments,topic_title:this.has_subject?this.$title_box.val():"",onError:function(t){var i,o=t.error_code;if("E_TOPIC_FORUM_LOCKED"===o)i=e["new-topic-forum-locked"],s.settings.topic.get("master").setCategoryLockStatus(s.settings.topic.get("category_id"),!0);else if("E_NOT_LOGGED_IN"===o)i=e["edit-post-logged-out-warning"]+'
    \t\t\t\t\t\t\t";else if("E_NO_PERMISSION"===o)i=e["edit-post-no-permission"];else if("E_NO_SUCH_POST"===o)i=e["edit-post-no-post"];else if("E_NO_LINK_POSTING"===o)i=e["edit-post-no-links"];else if("E_NO_IMAGE_POSTING"===o)i=e["edit-post-no-images"];else if("E_INVALID_CHARACTER"===o)i=e["new-topic-invalid-character"];else if("E_NO_EDIT_MADE"===o)i=e["edit-post-nothing-changed"];else if("E_AJAX_TIMEOUT"===o)i=e["error-timeout"];else{var a=s.checkCommonErrors(o);"reveal_rendered"===a.action&&(s.openPreviewWindow(),s.revealPreview(t.response.error_data)),i=a.message}"E_LATEX_ERROR"===o||"E_ASY_ERROR"===o?s.throwLatexErrorMessage(o):AoPS.Ui.Modal.showAlertQuick(i,{width:"400px",onClose:function(){AoPS.Ui.Modal.closeTopModal()}})},onFinish:function(){setTimeout((function(){s.close(),AoPS.Ui.Modal.closeAllModals()}),i.new_topic_modal_delay)}},this.extra_options))},onClickCancel:function(){AoPS.Ui.Modal.showConfirm(e["topic-full-edit-confirm"],_.bind((function(t){t&&(this.settings.hasOwnProperty("onCancel")&&this.settings.onCancel(),AoPS.Ui.Modal.closeAllModals(),this.close())}),this),{confirm_button_cancel:e["topic-full-reply-confirm-cancel"],confirm_button_ok:e["topic-full-edit-confirm-OK"]})},onClose:function(){$(window).off("resize.edit-post-"+this.cid)}}),t.EditFirstPost=t.EditPost.extend({has_subject:!0,has_forum:!0,has_source:!0}),t.NewPrivateConversation=t.NewTopic.extend({topic_type:"private",has_email_subscribe:!1,has_add_to_feed:!1,is_new_pm:!0,autotagging_disabled:!0,sending_blocker:e["new-pm-send-blocker"],render:function(){var o=[];this.$el.append(this.getTemplate(this.template_id,_.defaults(this.settings,{has_subject:!0,has_tags:!0,has_recipients:!0,has_halp:!1,is_private:this.is_new_pm,can_pm_as_sheriff:this.model.get("master").fetchPermission("can_pm_as_sheriff"),has_forum:!1,lang_post_as_sheriff:e["new-topic-post-as-sheriff"],lang_view_attachments:e["new-topic-preview-bar-attachments"],max_post_length:i.max_post_length,max_title_length:i.max_topic_title_length,lang_subject:e["new-topic-subject"],lang_tags:e["new-topic-tags"],lang_recipients:e["new-topic-to"],lang_preview:e["new-topic-preview"],lang_close_preview:e["new-topic-close-preview"],lang_refresh:e["new-topic-refresh-preview"],has_source:!1}))),this.$el.addClass("cmty-new-private-conversation"),this.tag_warning_issued=!1,this.settings.hasOwnProperty("preset_recipients")&&(o=this.settings.preset_recipients),this.editable_recipient_box=new t.EditableRecipientBox({model:this.settings.master,items:o,onAddItem:_.bind((function(){this.setHeight()}),this),onRemoveItem:_.bind((function(){this.setHeight()}),this)}),this.$el.find(".cmty-private-recipients").append(this.editable_recipient_box.$el),this.finishRender()},checkRecipients:function(t){0!==this.editable_recipient_box.items.length||this.editable_recipient_box.$input_box.val()?this.editable_recipient_box.$input_box.val()?this.model.checkValidPrivateRecipient({username:this.editable_recipient_box.$input_box.val(),onFinish:function(i){if(i.is_unreachable){var o={type:"alert",body:e["private-unreachable-recipient"],frame_class:"aops-modal-quick"};AoPS.Ui.Modal.showMessage(this,o),t(!1)}else t(!0)}}):t(!0):(this.showError(e["private-need-recipients-err"]),t(!1))},removeParticipant:function(t){var e,i=_.find(this.editable_recipient_box.items,(function(e){return parseInt(e.user_id)===t}));return _.isUndefined(i)?"":(e="string"==typeof i.value?i.value:i.label,this.editable_recipient_box.removeItem(i),e)},validatePost:function(t){var e=this;this.checkRecipients((function(i){var o=e.checkPost()&&e.checkTitle()&&i;t(o)}))},canSetAnnounce:function(){return!1},canSetGlobalAnnounce:function(){return!1}}),t.ReportPost=AoPS.View.extend({template_id:"#cmty-report-post-tpl",className:"cmty-report-post cmty-modal-form aops-modal-standard",initialize:function(){this.$el.append(this.getTemplate(this.template_id,{username:this.model.get("username"),spam_text:e["topic-full-report-item-spam"],warez_text:e["topic-full-report-item-warez"],cheat_text:e["topic-full-report-item-cheat"],other_text:e["topic-full-report-item-other"]}))},events:{"submit form":"onFormSubmit","click input[type=button]":"onClickCancel"},onClickCancel:function(){AoPS.Ui.Modal.closeAllModals(),this.close()},onFormSubmit:function(t){var i=this.$el.find("select").val(),o=this.$el.find("textarea").val();return this.model.report(i,o),AoPS.Ui.Modal.showAlert(e["topic-full-report-report-sent"],{onClose:function(){AoPS.Ui.Modal.closeAllModals()}}),this.close(),t.preventDefault(),t.stopPropagation(),!1}}),t.DeletePost=AoPS.View.extend({template_id:"#cmty-delete-post-tpl",className:"cmty-delete-post cmty-modal-form aops-modal-standard",initialize:function(t){this.topic=t.topic,this.$el.append(this.getTemplate(this.template_id,{username:this.model.get("username"),can_hard_delete:this.topic.getPermission("c_can_hard_delete"),is_first_post:1===this.model.get("post_number")})),this.model.get("poster_id")!==AoPS.session.user_id&&this.$(".aops-modal-body").append($("

    ").text("Reason:")).append(o.getModerationInputsForType("topic"))},events:{"submit form":"onFormSubmit","click input[type=button]":"onClickCancel"},onClickCancel:function(){AoPS.Ui.Modal.closeAllModals(),this.close()},onFormSubmit:function(t,i){var o=!1,s=this,n=!_.isUndefined(i)&&!_.isUndefined(i.force_soft)&&i.force_soft,a=this.$("input[name='reason']:checked").val()||"";return!n&&this.topic.getPermission("c_can_hard_delete")&&(o="hard"===this.$("input[name=delete_option]:checked").val()),AoPS.Community.Views.throwBlockingMessage(e["topic-full-delete-post-pending"]),this.model.delete({hard_delete:o,reason:a,onFinish:function(t){t.hasOwnProperty("topic_deleted")&&t.topic_deleted||AoPS.Community.Views.delayModalClearing({onClose:function(){s.close()}})},onError:function(t){var i,o=t.error_code;i="E_NO_PERMISSION"===o?e["delete-post-no-permission"]:"E_NOT_LAST_POST"===o?e["delete-post-not-last-post"]:"E_HARD_DELETE"===o?e["topic-full-undelete-hard"]:"E_NO_DELETING_FIRST_POST"===o?e["delete-post-sniped"]:e["unexpected-error-code"]+o,AoPS.Community.Views.showError(i)}}),t.preventDefault(),t.stopPropagation(),!1}}),t.PostReports=AoPS.View.extend({template_id:"#cmty-post-reports-tpl",initialize:function(){this.listenTo(this.model.get("reported_posts"),"add",this.addReportedPost),this.listenTo(this.model.get("reported_posts"),"remove",this.onPostReportFetchFinished),this.reported_post_views=[],this.$loader=AoPS.Page.buildLoader(),this.$el.html(this.getTemplate(this.template_id,{page_title:e["post-report-admin-page-title"],top_text:e["post-report-admin-page-text"],loader:e["post-report-admin-loading"],none_found:e["post-report-admin-none"],is_admin:AoPS.session.a})),this.$initial_loading=this.$el.find(".cmty-post-reports-loader"),this.$none=this.$el.find(".cmty-post-reports-none-found"),this.$reported_posts=this.$el.find(".cmty-post-reports-container"),this.listenTo(this.model,"post_reports_fetched",this.onPostReportFetchFinished)},addReportedPost:function(e){if("unresolved"===e.get("status")){var i=new t.PostReport({model:e});this.reported_post_views.push(i),this.$reported_posts.append(i.$el)}},onAddToPage:function(t){var o=this;this.$initial_loading.show(),this.$none.hide(),this.focus=t,this.model.fetchReportedPosts(),this.goToFocus(),this.interval=setInterval((function(){o.model.fetchReportedPosts()}),i.intervals.current.reported_posts_interval),this.model.get("all_past_reported_posts_fetched")||$(window).on("scroll."+this.model.cid,(function(t){window.innerHeight+window.pageYOffset+10>=document.body.offsetHeight&&!o.model.get("loading_post_reports")&&o.model.get("reported_posts").length>0&&!o.model.get("all_past_reported_posts_fetched")&&(o.$el.append(o.$loader),o.model.fetchReportedPosts({fetch_before:o.model.get("reported_posts").last().get("inserted_at"),onFinish:function(){o.$loader.detach(),o.model.get("all_past_reported_posts_fetched")&&o.$el.append('
    '+e["post-report-no-more"]+"
    ")}}))}))},goToFocus:function(){var t,e;this.focus.hasOwnProperty("post_id")?(e=this.focus.post_id,t=_.find(this.reported_post_views,(function(t){return t.model.get("post_id")===e}))):this.focus.hasOwnProperty("topic_id")&&(e=this.focus.topic_id,t=_.find(this.reported_post_views,(function(t){return t.model.get("topic_id")===e}))),_.isUndefined(t)||this.goToTargetReport(t)},goToTargetReport:function(t){this.focus={},window.scrollTo(0,t.$el.offset().top)},onRemoveFromPage:function(){clearInterval(this.interval),$(window).off("scroll."+this.model.cid+" touchmove."+this.model.cid)},onPostReportFetchFinished:function(){this.$initial_loading.hide(),this.$none.toggle(_.isUndefined(this.model.get("reported_posts").findWhere({status:"unresolved"}))),this.goToFocus(),this.focus={}},onClose:function(){_.each(this.reported_post_views,(function(t){t.close()}))}}),t.PostReportPostWindow=t.Post.extend({removePostFromTopic:function(){}}),t.PostReport=AoPS.View.extend({template_id:"#cmty-post-report-tpl",className:"cmty-admin-post-report",initialize:function(){this.post_view=new t.PostReportPostWindow({model:this.model.get("post"),topic:{model:this.model.get("post").get("topic")}}),this.render(),this.listenTo(this.model,"change:status",this.onChangeStatus),this.listenTo(this.model.get("post"),"change:deleted",this.onPostDeleted),this.listenTo(this.model.get("post").get("topic"),"change:deleted",this.onTopicDeleted)},events:{"click .cmty-post-report-admin-btn .btn":"onClickResolved","click .cmty-pm-reporter":"onClickPMReporter","click .cmty-pm-poster":"onClickPMPoster"},render:function(){var t,s,n,a,r=this.model.get("post").get("topic");this.model.get("category_id")===i.private_messages_id?(t="/x"+this.model.get("post").get("poster_id"),s=this.model.get("post").get("username")+" "+e["Private-Messages"]):(t="/c"+this.model.get("category_id"),s=this.model.get("category_name")),a=t+"h"+r.get("topic_id"),n="blog"!=this.model.get("category_type"),this.$el.html(this.getTemplate(this.template_id,{category_name:s,category_url:AoPS.Community.Views.makeLinkUrl(t),mark_for_push_state:n,topic_title:r.get("topic_title"),topic_url:AoPS.Community.Views.makeLinkUrl(a),reported_by_text:e["post-report-admin-reported-by"],reported_date_text:e["post-report-admin-reported-date"],user_link:"/community/user/"+this.model.get("reporter_user_id"),details_text:e["post-report-admin-details"],details:this.model.get("details").length>0?this.model.get("details"):"None given",reported_by:this.model.get("username"),for_text:e["post-report-admin-for"],short_reason:e["topic-full-report-item-"+this.model.get("reason_short")],reported_date:o.makePrettyTime(this.model.get("inserted_at")),show_first_post_note:1===this.model.get("post").get("post_number"),first_post_note:e["post-report-first-post-note"],lang_pm_poster:e["post-report-admin-pm-poster"],lang_pm_reporter:e["post-report-admin-pm-reporter"],lang_send_pm:e["post-report-admin-pm"]})),this.$el.find(".feed-topic-forum").css({"background-color":this.model.get("main_color"),color:this.model.get("secondary_color")}),this.$el.find(".cmty-post-report-post").append(this.post_view.$el)},onClose:function(){this.post_view.close()},onClickPMReporter:function(s){var n=t.launchNewPrivateMessage({user_id:parseInt(this.model.get("reporter_user_id")),username:this.model.get("username"),is_admin:!1}),a=e["post-report-pm-subject"],r=o.formatString(e["post-report-pm-reporter-preamble"],[i.base_url+"/community/p"+this.model.get("post").get("post_id")]);this.model.get("details").length>0&&(r+=" "+e["post-report-pm-reporter"]+'[quote="'+this.model.get("username")+'"]'+this.model.get("details")+"[/quote]"),n.setTitle(a),n.addContent(r)},onClickPMPoster:function(e){var i,o,s=this.model.get("post_data");s.hasOwnProperty("real_poster_id")&&s.real_poster_id>0?(i=parseInt(s.real_poster_id),o=s.real_poster_username):(i=parseInt(s.poster_id),o=s.username),t.launchNewPrivateMessage({user_id:i,username:o,is_admin:this.model.get("post_data").admin})},onClickResolved:function(){var t=this;AoPS.Ui.Modal.showConfirm(this.getTemplate("#cmty-post-report-settle-confirm-tpl",{message:e["post-report-admin-confirm"],notes:e["post-report-admin-notes"]}),(function(i){i?(AoPS.Community.Views.throwBlockingMessage(e["post-report-admin-block"]),t.model.settle({onFinish:function(){AoPS.Community.Views.delayModalClearing()},notes:$(".cmty-post-report-settle-note").val(),onError:function(t){var i;"E_NOT_LOGGED_IN"===t.error_code?i=e["logged-out"]:"E_NO_PERMISSION"===t.error_code&&(i=e["post-report-admin-no-permission"]),AoPS.Community.Views.showError(i)}})):AoPS.Ui.Modal.closeAllModals()}),{title:e["post-report-admin-confirm-title"],close_on_button_click:!1,max_width:"400px"})},onChangeStatus:function(){"resolved"===this.model.get("status")&&this.$el.fadeTo(500,0,_.bind((function(){this.close()}),this))},onPostDeleted:function(){this.model.decrementNumReports(),this.model.set("status","resolved")},onTopicDeleted:function(){this.model.set("status","resolved")}}),t.SearchPage=AoPS.View.extend({template_id:"#cmty-search-page-tpl",className:"cmty-search-page",initialize:function(t){this.init_options=t,this.init_options.is_private=t.preset_settings.hasOwnProperty("is_private")&&t.preset_settings.is_private,this.render(),this.init_options.is_private&&this.$el.addClass("cmty-private-search")},render:function(){this.$el.html(this.getTemplate(this.template_id,{lang_Search_Page_Title:this.init_options.is_private?e["search-page-private-title"]:e["search-page-title"]})),this.search_form=new t.SearchForm(this.init_options),this.$(".form").append(this.search_form.$el)},onAddToPage:function(){this.search_form.$("input").first().focus()}}),t.SearchForm=AoPS.View.extend({template_id:"#cmty-search-form-tpl",className:"cmty-search-form",supported_presets:["forums"],initialize:function(t){var e=this;this.search_page_id=t.search_page_id,this.master=this.model,this.include_users=[],this.forums=[],this.is_private=t.hasOwnProperty("is_private")&&t.is_private,t.hasOwnProperty("preset_settings")&&_.each(this.supported_presets,(function(i){t.preset_settings.hasOwnProperty(i)&&(e[i]=t.preset_settings[i])})),this.search_expanded=!1,this.render()},render:function(){var e=this;this.$el.html(this.getTemplate(this.template_id,{})),this.$search_term=this.$('[name="search-term"]'),this.include_user_list=new t.EditableValidatedUserList({model:this.master,items:this.include_users}),this.forum_list=new t.EditableForumList({model:this.master,items:this.forums,ajax_call:"fetch_search_forum_autocomplete"}),this.$(".cmty-search-posters-include").append(this.include_user_list.$el),this.$(".cmty-search-forums-include").prepend(this.forum_list.$el),this.$dates_options=this.$(".cmty-search-dates-select > select"),this.$dates_range=this.$(".cmty-search-dates-range"),this.$dates_range_from=this.$dates_range.find("input.cmty-search-from"),this.$dates_range_to=this.$dates_range.find("input.cmty-search-to"),this.$dates_range_from.datepicker({defaultDate:"+1w",changeMonth:!0,changeYear:!0,numberOfMonths:1,yearRange:"2003:c",minDate:new Date(2003,0,1),maxDate:0,beforeShow:function(){$("#ui-datepicker-div").addClass("cmty-search-datepicker")},onClose:function(t){$("#ui-datepicker-div").removeClass("cmty-search-datepicker"),e.$dates_range_to.datepicker("option","minDate",t)}}),this.$dates_range_to.datepicker({defaultDate:"+1w",changeMonth:!0,changeYear:!0,numberOfMonths:1,yearRange:"2003:c",minDate:new Date(2003,0,1),maxDate:0,beforeShow:function(){$("#ui-datepicker-div").addClass("cmty-search-datepicker")},onClose:function(t){$("#ui-datepicker-div").removeClass("cmty-search-datepicker"),e.$dates_range_from.datepicker("option","maxDate",t)}}),this.$("input.enter-to-search").on("keydown",(function(t){13===(t.which||t.keyCode)&&e.onClickSearch()}))},events:{"click a.cmty-search-expand-link":"onClickTextToggle","click .cmty-search-clear":"onClickClear","click .cmty-search-go":"onClickSearch","change .cmty-search-dates-select > select":"onSelectDateOption"},onClickTextToggle:function(t){this.$el.toggleClass("cmty-search-expanded"),this.search_expanded=!this.search_expanded,t.stopPropagation(),t.preventDefault()},onClickClear:function(t){this.include_user_list.close(),this.forum_list.close(),this.include_users=[],this.forums=[],this.render()},onSelectDateOption:function(t){var e=parseInt(this.$dates_options.val());this.$dates_range.toggle(-1===e)},onClickSearch:function(t){var e,i,o,s,n,a,r={},l="";this.include_user_list.$input_box.val().length>0||this.forum_list.$input_box.val().length>0?this.validateInput():(this.search_expanded?((i=this.$('[name="title"]').val()).length>0&&(r.title=i),(i=this.$('[name="source"]').val()).length>0&&(r.source=i),(i=this.$('[name="post-text"]').val()).length>0&&(r.post_text=i),(i=this.$('[name="tags"]').val()).length>0&&(r.tags=i),r.first_post=this.$('[name="first-post"]').is(":checked")?1:0):(e=this.$search_term.val()).length>0&&(r.search_text=e,l="_"+encodeURIComponent(e)),this.include_user_list.items.length>0&&(r.include_users=_.pluck(this.include_user_list.items,"user_id")),this.forum_list.items.length>0&&(r.forums=_.pluck(this.forum_list.items,"category_id"),r.forums_action=this.$('input[name="forum_option"]:checked').val()),r.sort_by=this.$('input[name="sort_by"]:checked').val(),this.is_private&&(r.forums_action="include",r.forums=[1]),-1===(o=parseInt(this.$dates_options.val()))?(s=(s=moment(this.$dates_range_from.val())).isValid()?s.format("X"):0,n=(n=moment(this.$dates_range_to.val())).isValid()?n.add("days",1).format("X"):0):o>0&&(s=(n=moment().format("X"))-o),s>0&&(r.start_date=s),n>0&&(r.end_date=n),_.keys(r).length>0&&((a=this.master.buildSearchCategory(r)).set("search_page_id",this.search_page_id),Backbone.history.navigate("q"+a.get("search_id")+l,{trigger:!0,replace:!1})))},validateInput:function(){var i,s=this,n=this.include_user_list.$input_box.val(),a=this.forum_list.$input_box.val();t.throwBlockingMessage(e["search-validation-blocker"]),this.master.validateSearchInput({username:n,forum:a,onFinish:function(r){var l,c=!1;r.hasOwnProperty("user")&&(r.user.is_valid?(l={user_id:r.user.user_id,item_id:r.user.user_id,label:r.user.username,value:r.user.username,is_admin:r.user.is_admin},s.include_user_list.buildNewItem(l)):(c=!0,i=o.formatString(e["search-err-no-such-user"],[n]))),!c&&r.hasOwnProperty("forum_found")&&(r.forum_found?(r.forum_data.label=r.forum_data.value,s.forum_list.buildNewItem(r.forum_data)):(c=!0,i=o.formatString(e["search-err-no-such-forum"],[a]))),c?t.showError(i):setTimeout((function(){s.onClickSearch()}),500)},onError:function(t){}})}}),t.UserProfile=AoPS.View.extend({template_id:"#cmty-user-profile-tpl",className:"cmty-user-profile cmty-folder-top",location:"user_profile",friend_click_path:"/user/",router_base:"/community",main_profile_plain_settings:["joined_at","status","goals","interests","website","school","location","occupation"],activity_settings:[{attribute:"last_visit_pretty",title_lang_attr:"user-profile-last-visit",is_html:!0},{attribute:"num_posts",title_lang_attr:"user-profile-total-posts"},{attribute:"primary_blog_id",title_lang_attr:"user-profile-blog",nowrap:!0},{attribute:"thanks_given",title_lang_attr:"user-profile-thanks-given"},{attribute:"thanks_received",title_lang_attr:"user-profile-thanks-received"}],initialize:function(t){var i="",o=this;this.is_session_user=this.model.get("user_id")===AoPS.session.user_id,this.$no_friends=$('
    '+e["user-profile-no-friends"]+"
    "),this.compress_top_fora="boolean"==typeof t.compress_top_fora&&t.compress_top_fora,this.render(),this.is_session_user&&(_.each(this.main_profile_plain_settings,(function(t){i+=" change:"+t})),this.listenTo(this.model,i,this.fillMainProfile),this.listenTo(this.model,"change:friends_exclude",(function(){o.model.set("show_friends",!o.model.get("friends_exclude")),o.render()})))},events:{"click #about-num-posts":"onClickAboutNumPosts","click .cmty-user-profile-pm":"onClickMessage","click .cmty-user-add-new-friend":"onClickAddNewFriend","click .cmty-user-add-this-friend":"onClickAddThisFriend","click .cmty-toggle-user-bookmark":"onClickBookmark","click .cmty-user-add-note":"onClickAddNote","click .cmty-ban-link":"onClickBan","click .cmty-reset-thanks-link":"onClickResetThanks","click .cmty-troll-link":"onClickTroll","click .cmty-vpn-check":"onClickCheckVPN","click .cmty-temp-ban-link":"onClickTempBan"},render:function(){var i,o=this.model,s=this,n=this.model.get("master");i=o.get("show_friends")&&(this.is_session_user||o.get("friends").length>0);var a=!!n&&n.fetchPermission("can_edit_other_profiles");this.$el.html(this.getTemplate(this.template_id,{username:o.get("username"),user_id:o.get("user_id"),can_pm:o.get("can_pm"),is_admin:AoPS.session.a,is_national:AoPS.session.n,can_access_user_general:!!n&&n.fetchStaffPermission("user-general"),can_access_log:!!n&&n.fetchStaffPermission("can-access-log"),can_edit_cmty_perms:!!n&&n.fetchStaffPermission("perms-cmty"),can_oneclick_ban:!o.get("is_banned")&&!!n&&n.fetchStaffPermission("one-click-ban"),temp_ban:o.get("temp_ban"),is_this_user_admin:o.get("is_admin"),is_limited:AoPS.session.n&&o.get("is_limited"),is_session_user:this.is_session_user,is_inactive:AoPS.session.n&&!o.get("is_activated")&&!o.get("is_banned"),is_banned:AoPS.session.n&&o.get("is_banned"),is_coppa_blocked:AoPS.session.n&&o.get("is_coppa_blocked"),avatar:o.get("avatar"),is_bookmarked:o.get("is_bookmarked"),lang_Message:e.Message,has_notes:!this.is_session_user&&o.has("user_notes")&&o.get("user_notes").length>0,notes:o.has("user_notes")?o.get("user_notes"):[],can_add_notes:o.has("can_add_notes")&&o.get("can_add_notes"),lang_User_Profile:e["user-profile-title"],lang_INACTIVE:e["user-profile-INACTIVE"],lang_LIMITED:e["user-profile-LIMITED"],lang_BANNED:e["user-profile-BANNED"],lang_COPPA:e["user-profile-COPPA"],lang_Activity:e["user-profile-activity"],lang_Notes:e.Notes,lang_AddNote:e["Add-Note"],lang_By:e.By,lang_At:e.At,lang_Note:e.Note,show_friends:i,can_edit_other_profiles:a,can_edit:this.is_session_user||a,lang_edit_profile:e["edit-profile-title"],lang_Friends:e["user-profile-friends"],can_befriend:o.get("can_befriend"),lang_Add_Friend:e["user-profile-add-friend"],title_add_friend:e["user-profile-add-friend-title"],title_pm:e["user-profile-pm-title"],can_add_friends:this.is_session_user&&o.get("can_request_friend"),can_troll_ban:o.get("can_troll_ban")})),this.is_session_user&&AoPS.isUserLimited()&&(this.limited_user_note=new t.LimitedUserMessage({}),this.$(".cmty-category-cell-heading").after(this.limited_user_note.$el)),this.$main_profile=this.$(".cmty-user-profile-main-info"),this.$activity=this.$(".cmty-user-profile-activity > .cmty-user-profile-data"),this.fillMainProfile(),o.has("top_fora")?this.buildActivityBox():(this.$activity_loader=AoPS.Page.buildLoader(),o.fetchTopFora({onFinish:function(){s.$activity_loader.detach(),s.buildActivityBox()},onError:function(){s.$activity_loader.detach()}})),this.is_session_user&&!this.model.get("friends_exclude")&&(this.$friends_public_toggle=this.$(".cmty-user-profile-friends-toggle"),this.setFriendsPublicToggle(),this.listenTo(o,"change:friends_show_profile",this.setFriendsPublicToggle),this.$friends_public_toggle.on("click",(function(){o.set("friends_show_profile",!o.get("friends_show_profile")),o.setUserSetting({value:o.get("friends_show_profile")?1:0,field:"friends_show_profile"})}))),i&&(this.$friends_box=this.$(".cmty-friends-box"),this.$loader=AoPS.Page.buildLoader(),o.get("friends_initialized")?(this.buildFriends(),this.startListeners()):(this.$friends_box.append(this.$loader),o.fetchFriends({fetch_type:"initial",onFinish:function(t){s.buildFriends(),s.startListeners()}})));var r=this.$el.find(".cmty-user-profile-blocked-users-list");r.length&&(o.fetchBlockedUsers(),this.listenTo(o,"change:blocked_users",(function(){r.html(""),r.append(t.buildBlockedUsersWidget(o))})),this.$el.find(".cmty-user-profile-blocked-users-wrapper a").click(t.showBlockUserModal.bind(this,o)));this.setBookmark(),this.listenTo(this.model,"change:is_bookmarked",this.setBookmark)},setBookmark:function(){var t,i,o,s;this.is_session_user||(t=this.$(".cmty-toggle-user-bookmark"),this.model.get("is_bookmarked")?(i="C",s=e["bookmark-remove"],o=e["bookmark-remove-user-title"]):(i="B",s=e["bookmark-follow"],o=e["bookmark-user-title"]),t.find(".aops-font").text(i),t.find(".cmty-user-bookmark-tagline").text(s),t[0].title=o)},setFriendsPublicToggle:function(){var t=this.model.get("friends_show_profile");this.$friends_public_toggle.text(t?"h":"#"),this.$friends_public_toggle[0].title=e[t?"user-profile-friend-toggle-off":"user-profile-friend-toggle-on"]},onAddToPage:function(){this.startListeners()},onRemoveFromPage:function(){this.stopListeners()},buildActivityBox:function(){var t=this,i=this.model;_.each(this.activity_settings,(function(o){var s,n,a=o.attribute;if(("last_visit_pretty"!==o.attribute||i.get("show_last_visit"))&&i.has(a)&&("number"==typeof i.get(a)||i.get(a).length>0)){if("primary_blog_id"==a){if(!(i.get(a)>0))return;n={is_html:!0,nowrap:t.compress_top_fora,has_fora:!1,content:''+i.get("primary_blog_name")+""}}else if("num_posts"===a&&(i.get("num_posts")>0||i.has("top_fora")&&i.get("top_fora").length>0)){var r=i.has("top_fora")?i.get("top_fora"):[];s=!_.isUndefined(_.findWhere(r,{in_count:!1}));var l=!_.isUndefined(_.findWhere(r,{has_search:!1}));if(t.compress_top_fora){var c=7-(i.get("show_last_visit")?1:0)-(i.get("primary_blog_id")>0?1:0)-(s||l);r=_.first(r,c)}n={is_html:!0,content:i.get(a)+' ('+e["user-profile-click-for-posts"]+")",has_fora:!0,user_id:i.get("user_id"),top_fora:r,nowrap:!1,has_count_note:s,lang_count_note:e["user-profile-no-count-note"],has_search_note:l,lang_search_note:e["user-profile-no-search-note"]};var d=0;_.each(r,(function(t){var e=t.total.toString().length;e>d&&(d=e)})),d<5&&t.$el.addClass("cmty-profile-"+d+"-digits")}else n={is_html:"boolean"==typeof o.is_html&&o.is_html,has_fora:!1,nowarp:!1,content:i.get(a)};n.title=e[o.title_lang_attr],AoPS.session.a&&("thanks_given"===o.attribute&&i.has("nothanks_given")&&(n.is_html=!0,n.content+=" ("+i.get("nothanks_given")+' _)'),"thanks_received"===o.attribute&&i.has("nothanks_received")&&(n.is_html=!0,n.content+=" ("+i.get("nothanks_received")+' _)')),"num_posts"===a&&(n.title="? "+n.title),t.$activity.append(t.getTemplate("#cmty-user-profile-data-row-tpl",n))}}))},fillMainProfile:function(){var i=this,s=this.model;this.$main_profile.empty(),_.each(this.main_profile_plain_settings,(function(n){var a;if("status"===n&&i.is_session_user&&!s.get("is_new_user"))a=t.buildEditableRow(i.constructEditableRowSettings(n)),i.model.get("master").fetchPermission("can_edit_profile")||a.renderUneditable(),i.$main_profile.append(a.$element);else if("primary_blog_id"===n){if(!(s.get(n)>0))return;i.$main_profile.append(i.getTemplate("#cmty-user-profile-data-row-tpl",{is_html:!1,has_fora:!1,nowrap:!1,title:e["user-profile-blog"],content:''+s.get("primary_blog_name")+""}))}else s.has(n)&&s.get(n).length>0&&i.$main_profile.append(i.getTemplate("#cmty-user-profile-data-row-tpl",{is_url:"website"===n,is_html:!1,nowrap:!1,url:"website"===n?o.formatUrl(s.get(n)):"",content:s.get(n),title:e["user-profile-"+n]}))}))},constructEditableRowSettings:function(s){var n=this;return{label:e["user-profile-"+s],placeholder:e["edit-profile-"+s+"-placeholder"],submit_on_enter:!0,content:n.model.get(s),length_limit:i.profile_field_length_limit,action:_.partial((function(i,s,a){"email"===i&&t.throwLoaderBlockingMessage(e["edit-profile-email-change=blocker"]),n.model.setUserSetting({field:i,value:s,set_from:n.location,onFinish:function(t){"email"===i&&(a.contents=n.model.get(i),a.reset(),AoPS.Ui.Modal.showAlert(o.formatString(e["edit-profile-new-email"],[s,n.model.get("email")]),{title:e["edit-profile-email-change-title"],width:"450px",onClose:function(){AoPS.Ui.Modal.closeAllModals()}}))},onCancel:function(){},onError:function(t){var r,l="flyout";switch(t.error_code){case"E_NAUGHTY_TERM_USED":r=o.formatString(e["edit-profile-inappropriate-term"],[a.label]);break;case"E_NO_PERMISSION":r=e["edit-profile-no-perm"];break;case"E_NOT_LOGGED_IN":r=e["edit-profile-not-logged-in"];break;case"E_EMAIL_NOT_AVAILABLE":r=o.formatString(e["edit-profile-email-not-available"],[s]),l="modal";break;case"E_INVALID_EMAIL":r=o.formatString(e["edit-profile-email-not-valid"],[s]),l="modal";break;case"E_EMAIL_NOT_CHANGED":r=o.formatString(e["edit-profile-email-not-valid"],[s]);break;case"E_AJAX_CANCEL":return void("email"===i?(a.contents=n.model.get(i),a.reset()):n.model.set(i,s));default:r=o.formatString(e["edit-profile-unknown-error"],[a.label,t.error_code])}a.contents=n.model.get(i),a.reset(),"flyout"===l?AoPS.Ui.Flyout.display(r):AoPS.Ui.Modal.showAlertQuick(r,{width:"450px",onClose:function(){AoPS.Ui.Modal.closeAllModals()}})}})}),s)}},buildFriends:function(){var i=this.model,o=this;this.$loader.detach(),0===i.get("friends").length?this.$friends_box.append(this.$no_friends):_.each(i.get("friends"),(function(t){o.$friends_box.append(o.buildFriendBox(t,!1))})),this.is_session_user&&i.get("friend_requests").length>0&&(this.$friend_requests_box=$('
    '),this.$friend_requests_box.append('
    '+e["friends-warning"]+"
    "),this.$friend_requests_wrapper=t.buildCommunityScrollbar(this.$friend_requests_box),this.$friends_box.before(this.$friend_requests_wrapper),this.$friend_requests_wrapper.find(".aops-scroll-bar").on("slider_at_end",(function(){o.fetchMoreFriendRequests()})),_.each(i.get("friend_requests"),(function(t){o.$friend_requests_box.append(o.buildFriendBox(t,!0))})),this.setFriendRequestsStyle())},fetchMoreFriendRequests:function(){var t=this,e=this.model;e.get("loading_friends")||e.get("all_requests_loaded")||(t.$friend_requests_box.append(t.$loader),e.fetchFriends({fetch_type:"friend_requests",onFinish:function(i){t.$loader.detach(),_.each(i.friend_requests,(function(e){t.$friend_requests_box.append(t.buildFriendBox(e,!0))})),e.get("all_requests_loaded")&&t.$el.find(".aops-scroll-bar").off("slider_at_end")}}))},startListeners:function(){var t=this.model,e=this;!t.get("all_friends_loaded")&&t.get("friends").length>0&&$(window).on("scroll.user"+t.get("user_id")+" touchmove.user"+t.get("user_id"),(function(i){window.innerHeight+window.pageYOffset+50>=document.body.offsetHeight&&(t.get("loading_friends")||t.get("all_friends_loaded")||(e.$friends_box.append(e.$loader),t.fetchFriends({fetch_type:"friends",onFinish:function(i){e.$loader.detach(),_.each(i.loaded_friends,(function(t){e.$friends_box.append(e.buildFriendBox(t,!1))})),t.get("all_friends_loaded")&&$(window).off("scroll.user"+t.get("user_id")+" touchmove.user"+t.get("user_id"))}})))}))},stopListeners:function(){$(window).off("scroll.user"+this.model.get("user_id"))},buildFriendBox:function(i,o){var s=this,n=$(this.getTemplate("#cmty-friend-box-tpl",{avatar:i.avatar,username:i.username,is_admin:i.is_admin,is_request:o,message:o?e["user-profile-friend-request"]:i.status,lang_DECLINE:e["user-profile-friend-DECLINE"],lang_ACCEPT:e["user-profile-friend-ACCEPT"]}));return this.is_session_user&&!o&&n.find(".cmty-unfriend").on("click",(function(t){s.unFriend(i,n),t.stopPropagation()})),o&&(n.find(".cmty-friend-decline").on("click",(function(t){s.closeFriendRequest(i,n,"denied"),t.stopPropagation()})),n.find(".cmty-friend-accept").on("click",(function(t){s.closeFriendRequest(i,n,"accepted"),t.stopPropagation()}))),n.on("click.backbone",(function(e){t.followUrlOnClick(e,s.friend_click_path+i.user_id,s.router_base,"")})),n},closeFriendRequest:function(t,i,s){var a=this;this.model.closeFriendRequest({user_id:t.user_id,action:s,onFinish:function(i){"accepted"===s&&(a.$friends_box.prepend(a.buildFriendBox(i.new_friend_data,!1)),a.$no_friends.detach()),n.display(o.formatString(e["user-profile-friend-request-"+s],[t.username]))},onError:function(i){var s;s="E_NO_REQUEST_AVAILABLE"===i.error_code?o.formatString(e["user-profile-err-no-request-available"],[t.username]):o.formatString(e["err-unknown"],[i.error_code]),n.display(s)}}),i.fadeOut(500,(function(){i.remove()})),this.model.get("friend_requests").length<6&&!this.model.get("all_requests_loaded")&&this.fetchMoreFriendRequests(),this.setFriendRequestsStyle()},setFriendRequestsStyle:function(){var t=this.model.get("friend_requests").length;0===t&&this.model.get("all_requests_loaded")&&this.$friend_requests_wrapper.detach(),this.$friend_requests_wrapper.toggleClass("cmty-three-requests",3===t),this.$friend_requests_wrapper.toggleClass("cmty-many-requests",t>3)},onClickAboutNumPosts:function(t){alert("Only the user's top 8 forums are displayed. If one or more of this user's top forums is a private forum that you can't access, it will not be displayed to you.

    Only posts in select forums count towards the \"Total Posts\" count. If one of a user's top forums is a forum where posts don't count towards the total, that forum will be marked with an asterisk (*) here.")},onClickMessage:function(e){if(t.launchNewPrivateMessage({user_id:this.model.get("user_id"),username:this.model.get("username"),is_admin:this.model.get("is_admin")}),!_.isUndefined(e))return e.stopPropagation(),e.preventDefault(),!1},onClickBan:AoPS.Community.Utils.onClickBan,onClickTroll:AoPS.Community.Utils.onClickTroll,onClickTempBan:function(t){var e=this;AoPS.Community.Utils.onClickTempBan(_.extend({user_id:this.model.get("user_id"),username:this.model.get("username"),success:function(i){$(t.target).text(i.can_access?"TEMP RESTRICT":"UNRESTRICT"),e.model.set("temp_ban",i)}},this.model.get("temp_ban")))},onClickResetThanks:function(t){AoPS.Community.MasterModel.resetThanks(t)},onClickCheckVPN:function(t){var e=t.currentTarget.getAttribute("ip");AoPS.Community.MasterModel.checkVPN({ip:e}),$(t.currentTarget).hide()},onClickAddNote:function(){var t=this.$('textarea[name="cmty-user-note-input"]').val(),i=this;t.length<5||(AoPS.Community.Views.throwBlockingMessage(e["user-profile-add-note"]),setTimeout((function(){i.model.addNote({note_text:t,onFinish:function(){location.reload()}})}),1e3))},onClickAddNewFriend:function(){var t,i,s,n=0,a=this;t=$(this.getTemplate("#cmty-add-friend-tpl",{lang_instructions:e["user-profile-add-friend-instructions"],lang_new_friend:e["user-profile-new-friend"],placeholder:e["Enter-username"]})),s=t.find("input"),o.buildUsernameAutocomplete(s,{ajax_call:"fetch_username_matches",autocomplete_settings:{onSelect:function(o,a){var r=t.find(".cmty-chosen-new-friend");parseInt(a.item.user_id)===AoPS.session.user_id?AoPS.Ui.Modal.showAlertQuick(e["user-profile-no-friend-self"],{onButtonClick:function(){s.val(""),s.focus()}}):(n=a.item.user_id,i=a.item.label,s.hide(),r.html(a.item.label),1==parseInt(a.item.is_admin)&&r.addClass("cmty-user-admin")),o.stopPropagation(),o.preventDefault()}}}),t.showModal({type:"confirm",title:e["user-profile-add-friend-modal-title"],width:"450px",close_on_button_click:!1,force_response:!0,onButtonClick:function(t){if(t){if(0===n){if(0===(n=s.val()).length)return AoPS.Ui.Modal.showAlert(e["user-profile-add-friend-none-chosen"]),void(n=0);i=n}a.sendFriendRequest(n,i)}else AoPS.Ui.Modal.closeAllModals()}}),s.focus()},onClickAddThisFriend:function(){var t=this;AoPS.Ui.Modal.showConfirm(o.formatString(e["user-profile-send-request-check"],[this.model.get("username")]),(function(e){e?t.sendFriendRequest(t.model.get("user_id"),t.model.get("username")):AoPS.Ui.Modal.closeAllModals()}),{close_on_button_click:!1,force_response:!0})},onClickBookmark:function(t){t.preventDefault(),t.stopPropagation(),AoPS.session.logged_in?AoPS.isUserLimited()?s.showMessage(e["bookmark-limited-user"],{width:"450px"}):this.model.get("master").setUserBookmarkState({user:this.model,new_state:!this.model.get("is_bookmarked")}):AoPS.Ui.buildLoginConfirm(e["bookmark-not-logged-in"])},sendFriendRequest:function(t,s){var n=this;AoPS.Community.Views.throwBlockingMessage(e["user-profile-friend-request-pending"]),this.model.get("master").submitFriendRequest({new_friend:t,onFinish:function(t){setTimeout((function(){AoPS.Ui.Modal.closeAllModals(),n.$el.find(".cmty-user-add-this-friend").remove()}),i.message_readability_delay)},onError:function(t){var n;switch(t.error_code){case"E_NO_PERMISSION_TO_REQUEST_FRIEND":n=e["user-profile-err-no-perm-friend"];break;case"E_ALREADY_FRIENDS":n=o.formatString(e["user-profile-err-already-friend"],[s]);break;case"E_NO_FRIEND_SELF":n=e["user-profile-no-friend-self"];break;case"E_REQUEST_FROM_POTENTIAL_EXISTS":n=o.formatString(e["user-profile-err-they-asked-you"],[s]);break;case"E_YOU_ALREADY_REQUESTED":n=o.formatString(e["user-profile-err-already-asked"],[s]);break;case"E_NOT_TAKING_FRIEND_REQUESTS":n=o.formatString(e["user-profile-err-not-taking-requests"],[s]);break;default:n=o.formatString(e["err-unknown"],[t.error_code])}setTimeout((function(){AoPS.Ui.Modal.showAlert(n,{onClose:function(){AoPS.Ui.Modal.closeAllModals()},width:"450px"})}),i.message_readability_delay)}})},unFriend:function(t,i){var s=this.model,n=this;AoPS.Ui.Modal.showConfirm(o.formatString(e["user-profile-unfriend-confirm"],[t.username]),(function(e){e&&(s.unFriend({user_id:t.user_id}),i.fadeOut(400,(function(){i.remove()})),0===s.get("friends").length&&n.$friends_box.append(n.$no_friends)),AoPS.Ui.Modal.closeAllModals()}),{confirm_button_ok:e.YES,confirm_button_cancel:e.NO})},onClose:function(){this.hasOwnProperty("limited_user_note")&&this.limited_user_note.close()}}),t.CategoryUserCell=AoPS.View.extend({template_id:"#cmty-bookmarked-user-cell-tpl",className:"cmty-category-cell cmty-category-cell-user",initialize:function(){this.render()},render:function(){this.$el.html(this.getTemplate(this.template_id,{username:this.model.get("username"),user_id:this.model.get("user_id"),can_befriend:this.model.get("can_befriend"),user_tooltip:e["user-cell-visit-profile"],lang_Add_Friend:e["user-profile-add-friend"],title_add_friend:e["user-profile-add-friend-title"],title_pm:e["user-profile-pm-title"],lang_Message:e.Message,can_pm:this.model.get("can_pm"),status:this.model.get("status")})),this.user_profile=new t.UserProfile({model:this.model,compress_top_fora:!0}),this.$(".cmty-category-cell-bottom").append(this.user_profile.$el)},events:{"click .cmty-user-cell-pm":"onClickMessage","click .cmty-add-cell-friend":"onClickAddNewFriend"},onClickMessage:t.UserProfile.prototype.onClickMessage,onClickAddNewFriend:t.UserProfile.prototype.onClickAddNewFriend}),t.EditUserProfile=AoPS.View.extend({template_id:"#cmty-edit-profile-tpl",className:t.UserProfile.prototype.className,location:"edit_user_profile",profile_fields:["email"].concat(_.without(t.UserProfile.prototype.main_profile_plain_settings,"joined_at")),initialize:function(){this.is_current_user=this.model===this.model.get("master").get("current_user"),this.render(),this.listenTo(this.model,"status_changed",this.onStatusChange)},render:function(){var o,s,n,a=this,r=this.model.get("is_new_user"),l=this.profile_fields.length,c=[];if(s=this.is_current_user?this.model.get("master").fetchPermission("can_edit_profile"):this.model.get("master").fetchPermission("can_edit_other_profiles"),this.$el.html(this.getTemplate(this.template_id,{is_current_user:this.is_current_user,user_id:this.model.get("user_id"),username:this.model.get("username"),is_limited_user:AoPS.isUserLimited(),lang_limited_user:e["edit-profile-limited-user"],is_new_user:AoPS.isUserNew(),lang_new_user:e["edit-profile-new-user"],lang_Edit_Profile:e["edit-profile-title"],lang_Profile_Info:e["edit-profile-profile-info"],lang_Edit_Avatar:e["edit-profile-edit-avatar"],lang_Delete_Avatar:e["edit-profile-delete-avatar"],lang_Change_Password:e["edit-profile-change-password"],lang_Current_Password:e["edit-profile-current-password"],lang_New_Password:e["edit-profile-new-password"],lang_Retype_Password:e["edit-profile-retype-password"],can_add_avatar:this.model.get("master").fetchPermission(this.is_current_user?"can_add_avatar":"can_edit_other_profiles"),has_avatar:this.model.get("avatar")!==i.default_avatar,retype_password_placeholder:e["edit-profile-retype-password-placeholder"],new_password_placeholder:e["edit-profile-new-password-placeholder"],current_password_placeholder:e["edit-profile-current-password-placeholder"],avatar:this.model.get("avatar"),password_length:i.max_password_length,lang_SUBMIT:e.Submit.toUpperCase()})),this.$profile=this.$(".cmty-user-profile-main-info"),this.$current_password=this.$('input[name="current-password"]'),this.$new_password=this.$('input[name="new-password"]'),this.$confirm_password=this.$('input[name="confirm-password"]'),this.$password_buttons=this.$(".cmty-password-buttons"),this.$password_warning=this.$(".cmty-password-warning"),this.$(":password").on("input",(function(){a.checkPasswordFields()})).on("keydown",(function(t){13===(t.which||t.keyCode)&&a.onClickSubmitPassword()})),!AoPS.isUserLimited())for(o=0;o

    '),o.$el.append(i)),i.append(a),s++,_.each(n.settings,(function(i){var s,n,a,l;l=_.extend({type:"select",bold:!1,refresh_page:!1},i),a=i.hasOwnProperty("action")?function(t){i.action(t,o,n)}:function(t){o.model.setUserSetting({value:t,field:l.model_field,onFinish:function(){l.refresh_page&&location.reload()}}),o.flashRow(n)},"select"===l.type?(s=o.model.get(l.model_field),n=t.buildSelectRow({options:l.hasOwnProperty("options")?l.options:t.edit_community_yn_options,bold:l.bold,selected:"boolean"==typeof s?String(Number(s)):s,action:a,text:e["edit-settings-"+l.model_field+"-label"]})):"link_w_label"===l.type?n=t.buildLinkLabelRow({bold:l.bold,link_text:l.link_text,link_label:l.link_label,action:function(){l.action(o.model)}}):"blocked_users_list"===l.type&&(n=t.buildBlockedUsersWidget(o.model)),r.append(n)}))}))},events:{"click a.cmty-advanced-hotkeys":"onClickHotkeys"},onClickHotkeys:function(t){this.hasOwnProperty("hotkeys_modal")||(this.hotkeys_modal=this.getTemplate("#cmty-advanced-hotkeys-modal-tpl",{})),s.showMessage(this.hotkeys_modal,{title:e["edit-settings-hotkeys-modal-title"],width:"600px"}),t.stopPropagation(),t.preventDefault()},flashRow:function(t){t.addClass("cmty-select-row-flash").removeClass("cmty-select-row-flash",1e3)}}),t.buildBlockedUsersWidget=function(t){var e=t.get("blocked_users")||[];return $("").append(e.map((function(e){var i=$("").text(e.username),o=$("").click((function(){t.unblockUser({blocked_user_id:e.user_id,blocked_username:e.username}),s.hide()})),s=$("").append(i).append(o);return s})))},t.buildBlockUserForm=function(){var t=$(""),e=$("");return t.append($("

    Enter the user you would like to block. You will no longer see PMs from this user.

    ")).append($("

    If you are in any group PMs with this user, you will lose access to those PMs.

    ")).append($("Username: ")).append(e),o.buildUsernameAutocomplete(e,{ajax_call:"fetch_username_matches",autocomplete_settings:{onSelect:function(t,i){var o=i.item.user_id;e.attr("data-user-id",o)}}}),t},t.showBlockUserModal=function(e){var i=s.showButtonsQuick(t.buildBlockUserForm(),[{text:"Block",value:1},{text:"Cancel",value:0}],(function(t){if(t){var o=i.$obj.find(".cmty-user-profile-block-user-input").attr("data-user-id"),n=i.$obj.find(".cmty-user-profile-block-user-input").val();(o||n)&&e.blockUser({blocked_user_id:o,blocked_username:n,onError:function(t){var e="An error occurred while trying to block this user.";"E_CANNOT_BLOCK_SELF"===t.error_code?e="You cannot block yourself!":"E_CANNOT_BLOCK_STAFF"===t.error_code?e="You cannot block admins or staff.":"E_TOO_MANY_BLOCKS"===t.erro_code&&(e="You have reached the maximum number of blocked users."),s.showAlertQuick(e)}})}}),{title:"Block User"})},t.FAQ=AoPS.View.extend({className:"cmty-faq-panel",initialize:function(){this.$loader=AoPS.Page.buildLoader(),this.$el.append(this.$loader),this.render()},render:function(){var t=this;this.$el.cmtyLoadFromFile({filename:AoPS.bootstrap_data.datastore_path+"cms/community/lang_en/help.html",onFinish:function(){t.$loader.detach(),t.$(".grey-panel .header").add(".grey-panel .toggle").on("click",(function(t){$(this).parent().toggleClass("closed")}))}})}}),t.Memberlist=AoPS.View.extend({template_id:"#cmty-memberlist-master-tpl",className:"cmty-memberlist",initialize:function(t){this.render(),this.stub=t.stub,this.user_list=new AoPS.Community.Models.UserList({stub:this.stub}),this.all_users={},this.$loader=AoPS.Page.buildLoader(),this.$no_matches=$('
    '+e["memberlist-no-matches"]+"
    "),this.startMemberlist(),this.$input.val(this.stub),this.setArrows()},render:function(){var t=this,i=AoPS.Community.MasterModel.fetchStaffPermission("see-full-memberlist"),o=AoPS.Community.MasterModel.fetchPermission("can_temp_ban");this.$el.html(this.getTemplate(this.template_id,{lang_page_title:e["memberlist-page-title"],lang_user_search:e["memberlist-user-search"],lang_Username:e.Username,lang_placeholder:e["memberlist-user-search-placeholder"],lang_search_button:e.SEARCH,has_email:i||o,has_IP:i,has_VPN_check:i,lang_Joined:e["memberlist-joined"],lang_Last_Visit:e["memberlist-last-visit"],lang_Email:e.Email,lang_IP:e.IP,lang_Posts:e["memberlist-posts"],lang_Thanks:e["memberlist-thanks"],tooltip_posts:e["memberlist-posts-tooltip"],tooltip_thanks:e["memberlist-thanks-tooltip"]})),this.$input=this.$("input"),this.$table=this.$("table > tbody"),this.$input.on("keydown",(function(e){13===(e.which||e.keyCode)&&t.buildFromInput()}))},events:{"click .cmty-user-search-row .btn":"buildFromInput","click th.clickable":"onClickTableHead","click span.cmty-ban-link":"onClickBan","click span.cmty-troll-link":"onClickTroll","click span.cmty-temp-ban-link":"onClickTempBan","click .cmty-vpn-check":"onClickCheckVPN"},startMemberlist:function(){0===this.user_list.get("users").length?this.fetchMoreUsers():this.addUsers(this.user_list)},addUsers:function(t){var e=this,i=AoPS.Community.MasterModel.fetchStaffPermission("see-full-memberlist"),o=AoPS.Community.MasterModel.fetchPermission("can_temp_ban");_.each(t,(function(t){e.all_users[t.user_id]=t})),this.$table.append(this.getTemplate("#cmty-memberlist-rows-tpl",{users:t,has_email:i||o,has_IP:i,has_VPN_check:i}))},onAddToPage:function(){var t=this;this.$input.focus(),$(window).on("scroll",(function(){document.documentElement.clientHeight+$(document).scrollTop()>=document.body.offsetHeight-80&&t.fetchMoreUsers()}))},onRemoveFromPage:function(){$(window).off("scroll")},onClickTableHead:function(t){var e,i=t.currentTarget.getAttribute("sort-on");e=i!==this.user_list.get("sort_column")?this.getDefaultDirection(i):"ASC"===this.user_list.get("sort_direction")?"DESC":"ASC",this.rebuildList({sort_column:i,sort_direction:e})},getDefaultDirection:function(t){return"username"===t||"joined_at"===t?"ASC":"DESC"},fetchMoreUsers:function(){var t=this;this.user_list.get("all_fetched")||this.user_list.get("is_loading")||(this.$el.append(this.$loader),this.user_list.fetchMoreUsers({onFinish:function(e){t.$loader.detach(),e.hasOwnProperty("new_users")&&e.new_users.length>0&&t.addUsers(e.new_users),0==t.user_list.get("users").length&&t.$el.append(t.$no_matches)}}))},buildFromInput:function(){var t=this.user_list.get("sort_column");this.rebuildList({sort_column:t,sort_direction:this.user_list.get("sort_direction")})},rebuildList:function(t){t.stub=this.$input.val(),this.$no_matches.detach(),t.stub===this.user_list.get("stub")&&t.sort_direction===this.user_list.get("sort_direction")&&t.sort_column===this.user_list.get("sort_column")||(this.$table.empty(),this.user_list.destroy(),this.user_list=new AoPS.Community.Models.UserList(t),this.fetchMoreUsers(),this.setArrows())},setArrows:function(){var t=this.user_list.get("sort_direction"),e=this.user_list.get("sort_column");this.$table.parent().find("th .aops-font").remove(),this.$table.parent().find('[sort-on="'+e+'"]').append(''+("DESC"===t?" S":" T"))},onClickBan:AoPS.Community.Utils.onClickBan,onClickTroll:AoPS.Community.Utils.onClickTroll,onClickTempBan:function(t){var e=t.currentTarget.getAttribute("user_id"),i=this.all_users[e];i&&AoPS.Community.Utils.onClickTempBan(_.extend({user_id:i.user_id,username:i.username,success:function(e){$(t.target).text(e.can_access?"RESTRICT":"UNRESTRICT"),i.temp_ban=e}},i.temp_ban))},onClickCheckVPN:function(t){var e=t.currentTarget.getAttribute("ip");AoPS.Community.MasterModel.checkVPN({ip:e}),$(t.currentTarget).hide()}}),t.getCategoryAdminCatType=function(t){if("forum_class"===t)t="forum";return t},t.fetchCategoryAdminBlocks=function(t){var e=[];switch(t){case"forum":case"forum_class":e=["GeneralInfo","Permissions"];break;case"blog":e=["GeneralInfo","Permissions","BlogSettings","BlogCss"];break;case"view_tags":e=["GeneralInfo","Permissions","ContentsViewTags"];break;case"view_posts":e=["GeneralInfo","Permissions","ContentsViewPosts"];break;case"view_topics":e=["GeneralInfo","Permissions","ContentsViewTopics"];break;case"blogroll":e=["GeneralInfo","Permissions","ContentsBlogroll"];break;case"folder":e=["GeneralInfo","Permissions","ContentsFolder"];break;case"folder_forums":e=["GeneralInfo","Permissions","ContentsFolderForums"];break;case"folder_collections":e=["GeneralInfo","Permissions","ContentsFolderCollections"];break;case"my_forums":case"my_blogs":case"my_collections":e=["GeneralInfo","ContentsFolder"];break;case"bookmark_topics":e=["GeneralInfo","ContentsViewTopics"];break;case"bookmark_users":e=["GeneralInfo","ContentsBookmarkUsers"];break;case"bookmark_tags":e=["GeneralInfo","ContentsViewTags"];break;case"bookmark_forums":e=["GeneralInfo","ContentsFolderForums"]}return e=_.map(e,(function(t){return"CategoryAdminBlock"+t}))},t.CategoryAdmin=AoPS.View.extend({className:"cmty-category-admin",initialize:function(t){this.model.get("category_type"),this.is_building_new=0===this.model.get("category_id"),this.is_creating=!1,this.render()},render:function(){var i,o=this;this.constructTitle(),(i=t.fetchCategoryAdminBlocks(t.getCategoryAdminCatType(this.model.get("category_type")))).length,o.block_views=[],_.each(i,(function(e){var i=new t[e]({model:o.model});o.$el.append(i.$el),o.block_views.push(i)})),this.is_building_new&&this.$el.append('
    ")},events:{"click .cmty-create-category":"onClickCreate"},onClickCreate:function(){var t,i=this.block_views.length,o=this;if(!this.is_creating){for(this.is_creating=!0,t=0;t0?p=this.model.get("short_description"):n||(p=e["cat-admin-no-description"]),this.$el.html(this.getTemplate(this.template_id,{title:e["cat-admin-general-info"],description_heading:e["cat-admin-description-heading"],can_edit_core_data:n,lang_view_log:e["cat-admin-view-log"],category_id:this.model.get("category_id"),lang_name_warning:e["cat-admin-cat-name-warning"],category_name:this.model.get("category_name"),category_description:p,has_admin_row:d,can_settle_reports:l,lang_reported_posts:e["cat-admin-reported-posts"],can_soft_delete:a,lang_soft_delete:m,lang_hard_delete:e["cat-admin-hard-delete"],can_hard_delete:r,can_access_log:c,has_buttons:n&&!s,name_heading:e["cat-admin-"+o+"-name"],name_placeholder:e["cat-admin-"+o+"-name-placeholder"],description_placeholder:e["cat-admin-"+o+"-desc-placeholder"],max_name_length:i.max_category_name_length,max_description_length:i.max_category_description_length,Save:e.Save,Reset:e.Reset,can_edit_global_feed:t,global_feed_heading:e["cat-admin-in-global-feed"],lang_Yes:e.Yes,lang_No:e.No,is_class_forum:"forum_class"===this.model.get("category_type"),lang_automatically_included:e["cat-admin-global-automatic"],lang_see_faq:e["cat-admin-global-feed-help"],is_in_global_feed:t&&_.indexOf(this.model.get("master").get("feed").get("global_feed_fora"),this.model.get("category_id"))>-1})),n&&(this.$category_name=this.$el.find('input[name="collection-name"]'),this.$category_description=this.$el.find('input[name="collection-description"]'),s||(this.$footer=this.$el.find(".footer"),this.$category_name.add(this.$category_description).on("input",(function(){h.activateSaveButton()}))),this.cacheData()),!s&&this.model.get("is_forum")&&this.model.getPermission("c_can_edit_admin_items")&&(this.$el.append('
    '+e["cat-admin-admin-item-warning"]+"
    "),_.each(["include_in_count","include_in_thank_count","include_in_nothank_count","include_in_dynamic_collections"],(function(t){h.buildEditableBitSetting(t)})))},hasSystemColor:function(){var t=_.pluck(e["cat-admin-category-colors"],"color");return _.indexOf(t,this.model.get("main_color").toLowerCase())>-1},prepareColors:function(){var t=_.clone(e["cat-admin-category-colors"]),i=this.model.get("main_color").toLowerCase();return _.each(t,(function(t){t.checked=i===t.color})),t},buildSettingGroup:function(t){return $('
    ")},buildStaticSetting:function(t){var i=this.buildSettingGroup(t),o=this.model.get(t);"boolean"==typeof o&&(o=o?e.Yes:e.No),i.append("
    "+o+"
    "),this.$el.append(i)},buildEditableBitSetting:function(i){var o=this,s=this.buildSettingGroup(i),n=$(this.getTemplate("#yes-no-select-tpl",{value:this.model.get(i),Yes:e.Yes,No:e.No}));n.on("change",(function(e){t.EditCommunitySettings.prototype.flashRow(n.parent().parent()),o.updateBitSetting(i,e.target.options[e.target.selectedIndex].value)})),s.append($("
    ").append(n)),this.$el.append(s)},updateBitSetting:function(t,e){this.model.setAdminItemSetting({setting:t,value:parseInt(e)}),this.model.set(t,1==parseInt(e))},events:{"click .cmty-cat-admin-gen-save":"onClickSave","click .cmty-cat-admin-gen-reset":"onClickReset","click .cmty-soft-delete-cat":"onClickSoftDelete","click .cmty-hard-delete-cat":"onClickHardDelete",'change select[name="cmty-cat-admin-global-feed-setting"]':"onChangeGlobalFeedSetting"},onClickReset:function(){this.resetToCachedData(),this.$footer.hide()},onChangeGlobalFeedSetting:function(){var t;t=this.$('select[name="cmty-cat-admin-global-feed-setting"]').val(),this.model.updateGlobalFeedSetting({new_setting:t,onFinish:function(){location.reload()},onError:function(t){var i;i=e.hasOwnProperty("cat-admin-global-err-"+t.error_code)?e["cat-admin-global-err-"+t.error_code]:e["err-unknown"],AoPS.Ui.Modal.showAlert(i,{width:"450px",onClose:function(){location.reload()}})}})},onClickSoftDelete:function(){this.onClickDelete("soft")},onClickHardDelete:function(){this.onClickDelete("hard")},onClickDelete:function(i){var n=this;s.showConfirm(o.formatString(e["cat-admin-"+i+"-delete-confirm"],[this.model.get("category_name")]),(function(o){o?(t.throwLoaderBlockingMessage(e["cat-admin-delete-blocker"]),setTimeout((function(){n.model.delete({delete_type:i,onFinish:function(t){window.location.href="/community"},onError:function(i){var o;switch(i.error_code){case"E_PROTECTED":o=e["cat-admin-delete-protected"];break;case"E_CATEGORY_NOT_FOUND":o=e["cat-admin-delete-not-found"];break;case"E_NO_PERMISSION":o=e["cat-admin-delete-no-permission"];break;default:o=e["unexpected-error-code"]+i.error_code}t.showError(o)}})}),1e3)):s.closeAllModals()}),{width:"450px",close_on_button_click:!1})},cacheData:function(){this.cached_name=this.$category_name.val(),this.cached_description=this.$category_description.val()},resetToCachedData:function(){this.$category_name.val(this.cached_name),this.$category_description.val(this.cached_description)},activateSaveButton:function(){this.$footer.show()},onClickSave:function(){var o=this;this.validateNewCategorySettings()&&(t.throwLoaderBlockingMessage(e["saving-blocker"]),this.$footer.hide(),this.model.saveCoreDataToDb({onFinish:function(){setTimeout((function(){AoPS.Ui.Modal.closeAllModals(),o.cacheData(),AoPS.Ui.Flyout.display(e["data-saved-reload"])}),i.message_readability_delay_short)},onError:function(t){var i;i="E_NO_PERMISSION"===t.error_code?e["cat-admin-gen-info-error-E_NO_PERMISSION"]:e["cat-admin-error-"+t.error_code],i+="

    "+e["cat-admin-error-nothing-saved"],AoPS.Ui.Modal.showAlert(i,{width:"450px",onClose:function(){AoPS.Ui.Modal.closeAllModals(),o.activateSaveButton()}})}}))},validateNewCategorySettings:function(){return this.$category_name.val().length
    "+e["cat-admin-error-nothing-saved"],AoPS.Ui.Modal.showAlert(i,{width:"450px",onClose:function(){AoPS.Ui.Modal.closeAllModals(),o.resetIsPublic()}})}})):s.closeAllModals()}),{close_on_button_click:!1,width:"550px",onClose:function(){o.resetIsPublic()}})},constructRoleInheritance:function(){this.model.has("role_inheritance_parent")&&!_.isNull(this.model.get("role_inheritance_parent"))?this.renderInheritanceParent():this.renderInheritanceInput(),this.$role_inheritance.append('
    '+o.formatString(e["cat-admin-inheritance-info"],[o.simplifyCategoryType(this.model.getAdminLangType())])+"
    ")},check_can_remove:!0,can_remove_all:!1,url_cmty_path:"",push_state_attribute:"data-cmty",url_router_base:"/community",constructItem:t.Itembox.prototype.constructItem,renderInheritanceParent:function(){var t=$('J'),e=this;this.$role_inheritance.empty(),this.$role_inheritance.append(this.constructItem(this.model.get("role_inheritance_parent"))),this.$role_inheritance.prepend(t),t.on("click",(function(){e.removeInheritanceParent()})).css({color:this.model.get("role_inheritance_parent").item_main_color})},removeInheritanceParent:function(){this.model.set("role_inheritance_parent",null),this.model.get("category_id")>0&&this.model.removeInheritanceParent()},renderInheritanceInput:function(){var i=this;this.$role_inheritance.empty(),this.$role_inheritance_input=$(''),this.$role_inheritance.append(this.$role_inheritance_input),o.buildCategoryAutocomplete(this.$role_inheritance_input,{ajax_call:"fetch_inherits_from_autocomplete",additional_ajax_settings:{category_id:this.model.get("category_id"),category_type:this.model.get("category_type")},autocomplete_settings:{onSelect:function(o,s){0===i.model.get("category_id")?i.model.set("role_inheritance_parent",{item_id:s.item.category_id,item_text:s.item.label,item_type:s.item.category_type,item_forum_id:s.item.item_forum_id,item_main_color:s.item.main_color,item_secondary_color:s.item.secondary_color,item_can_remove:!1,item_subtitle:s.item.short_description}):(t.throwLoaderBlockingMessage(e["cat-admin-set-role-inherit"]),i.model.setRoleInheritanceParent({parent_id:s.item.category_id,onFinish:function(t){window.location.href="/community/category-admin/"+i.model.get("category_id")},onError:function(t){var i;switch(t.error_code){case"E_NO_PERMISSION":i=e["cat-admin-set-inherit-no-perm"];break;case"E_INVALID_PARENT_TYPE":i=e["cat-admin-set-inherit-invalid-parent"];break;case"E_CANT_INHERIT_FROM_SELF":i=e["cat-admin-no-inherit-from-self"];break;default:i=e["unexpected-error-code"]+t.error_code}AoPS.Community.Views.showError(i)}})),o.stopPropagation(),o.preventDefault()}},show_no_results_msg:!0})},resetIsPublic:function(){this.$('select[name="cmty-category-admin-is-public"]').val(this.model.get("is_public")?1:0)},onChangeIsLocked:function(){this.model.setLockedStatus({is_locked:1===parseInt(this.$is_locked.val())})},onChangeSource:function(){this.model.setHasSource({has_source:1===parseInt(this.$has_source.val())})},addUserBoxes:function(){var i=this,n=this.model.get("is_public"),a=this.$el.find(".cmty-category-admin-users");if(a.empty(),this.closeUserBoxes(),!n){if(this.is_new&&"folder"===this.model.get("category_type"))return;if(!this.is_new&&!AoPS.session.a&&_.indexOf(["folder","folder_forums","folder_collections"],this.model.get("category_type"))>-1)return}_.each(this.category_type_specific_settings.user_boxes,(function(r){var l=$('
    '),c=null;n&&r.show_if_category_public||!n&&r.show_if_category_private?(l.append("
    "),i.model.getPermission("c_can_edit_"+r.role)?c=new t.ToggleableUserListCategoryAdmin({role:r.role,model:i.model}):r.show_only_if_can_edit||(c=new t.StaticUserList({is_editable:!1,no_users_message:"owner"===r.role?e["cat-admin-site-admins-are-admins"]:e["cat-admin-no-users-with-this-role"],user_list:_.filter(i.model.get("users"),(function(t){return t.role===r.role})),onMatchLoggedInUser:function(n,a){var l;i.model.get("can_remove_self")&&(l=$(' J'),n.find("span").append(l),l.on("click",(function(n){s.showConfirm(o.formatString(e["cat-admin-permissions-remove-self"],[r.title,i.model.get("category_name")]),(function(o){o?(t.throwBlockingMessage(e["please-wait"]),i.model.removeUser({user_id:a.user_id,onFinish:function(){setTimeout((function(){location.reload()}),500)},onError:function(i){t.showError(e["unexpected-error-code"]+i.error_code)}})):s.closeAllModals()}),{width:"450px",close_on_button_click:!1}),n.stopPropagation(),n.preventDefault()})))}})),_.isNull(c)||(i.user_box_views.push(c),l.append(c.$el),a.append(l))):i.model.removeUsersByRole(r.role)})),this.isUserPermissionAvailable()?(this.$(".cmty-cat-admin-perm-is-locked").show(),this.$(".cmty-category-admin-users").show(),this.$(".cmty-cat-admin-perm-set-inheritance").show()):(this.$(".cmty-cat-admin-perm-is-locked").hide(),this.$(".cmty-category-admin-users").hide(),this.$(".cmty-cat-admin-perm-set-inheritance").hide())},isUserPermissionAvailable:function(){return this.model.get("is_public")||_.indexOf(i.categories_with_private_roles,this.model.get("category_type"))>-1},closeUserBoxes:function(){_.each(self.user_box_views,(function(t){t.close()}))},fetchRenderData:function(){var t={show_if_category_public:!0,show_if_category_private:!0,show_only_if_can_edit:!1};switch(this.model.get("category_type")){case"forum":case"forum_class":return{public_helper:e["cat-admin-permissions-forum-public-helper"],private_helper:e["cat-admin-permissions-forum-private-helper"],locked_helper:e["cat-admin-permissions-forum-locked-helper"],open_helper:e["cat-admin-permissions-forum-open-helper"],has_source_helper:e["cat-admin-permissions-forum-has-source-helper"],no_source_helper:e["cat-admin-permissions-forum-no-source-helper"],user_boxes:[_.defaults({title:e.Administrators,role:"owner",box_class:"cmty-cat-admin-administrators"},t),_.defaults({title:e.Moderators,role:"mod",box_class:"cmty-cat-admin-moderators"},t),_.defaults({title:e.Users,role:"registered_user",box_class:"cmty-cat-admin-users",show_if_category_public:!1},t),_.defaults({title:e.Banned,role:"deny",box_class:"cmty-cat-admin-banned-users",show_if_category_private:!1,show_only_if_can_edit:!0},t)],help_template_id:"#cmty-cat-admin-perm-forum-help-tpl"};case"blog":return{public_helper:e["cat-admin-permissions-blog-public-helper"],private_helper:e["cat-admin-permissions-blog-private-helper"],locked_helper:e["cat-admin-permissions-blog-locked-helper"],open_helper:e["cat-admin-permissions-blog-open-helper"],help_template_id:"#cmty-cat-admin-perm-blog-help-tpl",user_boxes:[_.defaults({title:e.Administrators,role:"owner",box_class:"cmty-cat-admin-administrators"},t),_.defaults({title:e.Contributors,role:"contributor",box_class:"cmty-cat-admin-contributors"},t),_.defaults({title:e.Readers,role:"reader",box_class:"cmty-cat-admin-readers",show_if_category_public:!1},t),_.defaults({title:e.Banned,role:"deny",box_class:"cmty-cat-admin-banned-users",show_if_category_private:!1,show_only_if_can_edit:!0},t)]};case"my_forums":case"my_collections":return{public_helper:e["cat-admin-permissions-collection-public-helper"],private_helper:e["cat-admin-permissions-collection-private-helper"],locked_helper:e["cat-admin-permissions-collection-locked-helper"],open_helper:e["cat-admin-permissions-collection-open-helper"],help_template_id:"#cmty-cat-admin-perm-collection-help-tpl",user_boxes:[_.defaults({title:e.Administrators,role:"owner",box_class:"cmty-cat-admin-administrators"},t)]};default:return{public_helper:e["cat-admin-permissions-collection-public-helper"],private_helper:e["cat-admin-permissions-collection-private-helper"],locked_helper:e["cat-admin-permissions-collection-locked-helper"],open_helper:e["cat-admin-permissions-collection-open-helper"],help_template_id:"#cmty-cat-admin-perm-collection-help-tpl",user_boxes:[_.defaults({title:e.Administrators,role:"owner",box_class:"cmty-cat-admin-administrators"},t),_.defaults({title:e.Moderators,role:"mod",box_class:"cmty-cat-admin-moderators"},t),_.defaults({title:e.Users,role:"registered_user",box_class:"cmty-cat-admin-users",show_if_category_public:!1},t),_.defaults({title:e.Banned,role:"deny",box_class:"cmty-cat-admin-banned-users",show_if_category_private:!1,show_only_if_can_edit:!0},t)]}}},setHelpers:function(){var t=this.model.get("is_public")?this.category_type_specific_settings.public_helper:this.category_type_specific_settings.private_helper,i=this.model.get("is_locked")?this.category_type_specific_settings.locked_helper:this.category_type_specific_settings.open_helper,o=this.model.get("is_locked")?"k":"2";this.$el.find(".cmty-category-admin-is-public-helper").html(t),this.$el.find(".cmty-category-admin-is-locked-helper").html(i),this.$el.find(".cmty-category-lock-status").html(o),this.$(".cmty-cat-admin-locked-label").html(this.model.get("is_locked")?e["cat-admin-permissions-locked"]:e["cat-admin-permissions-open"]),"forum"===this.model.get("category_type")&&this.$(".cmty-category-admin-has-source-helper").html(this.model.get("has_source")?this.category_type_specific_settings.has_source_helper:this.category_type_specific_settings.no_source_helper)},onClose:function(){this.closeUserBoxes()},validateNewCategorySettings:function(){return!0}}),t.CategoryAdminBlockContents=AoPS.View.extend({template_id:"#cmty-category-admin-contents-new-tpl",className:"aops-panel cmty-cat-admin-contents",can_additems_in_admin:!0,initialize:function(){_.indexOf(["bookmark_topics","bookmark_forums","bookmark_tags","my_forums","my_collections","my_blogs","view_posts","view_topics","view_tags"],this.model.get("category_type"))>-1?this.has_help=!0:this.has_help=!1,this.has_help&&(this.$help=$(this.getTemplate("#cmty-cat-admin-contents-"+this.model.get("category_type")+"-help-tpl",{}))),this.is_bookmark=this.model.get("is_bookmark_category"),0===this.model.get("category_id")?this.renderConstructingCollection():(this.$loader=AoPS.Page.buildLoader(),this.edit_window_created=!1,this.render()),this.listenTo(this.model,"item_added",this.onClickCancel)},renderConstructingCollection:function(){this.$el.html(this.getTemplate("#cmty-category-admin-contents-info-tpl",{title:e["cat-admin-contents-title"],info:e["cat-admin-contents-building-info"]}))},render:function(){var i=this.model.canAddItem(),o=this.model.canRemoveItem();this.$el.html(this.getTemplate(this.template_id,{can_edit_items:i||o,title:e["cat-admin-contents-title"],has_help:this.has_help,lang_help:e["cat-admin-contents-help-tooltip"],title_editing:e["cat-admin-contents-title-editing"],lang_description:e["cat-admin-contents-desc-heading"],lang_contents_desc:e["cat-admin-contents-desc-"+this.model.get("category_type")],show_sort_type:i||o,lang_current_state:e["cat-admin-contents-current-state"],lang_sort_heading:e["cat-admin-contents-sort-heading"],lang_sort_type:this.model.getSortDescription(this.model.get("item_sort_type")),lang_edit_contents:e["cat-admin-contents-edit-btn"]})),this.$contents=this.$(".cmty-cat-admin-contents-current-state"),this.$edit_contents=this.$(".cmty-cat-admin-edit-window"),this.cat_cell=new(t.fetchCategoryCellConstructor(this.model.get("category_type")))({model:this.model}),this.$contents.append(this.cat_cell.$el)},events:{"click .cmty-admin-edit-contents-btn":"onClickEdit","click .cmty-cat-admin-help":"onClickHelp","click .cmty-cat-admin-edit-cancel":"onClickCancel","click .cmty-cat-admin-edit-save":"onClickSave","click .cmty-cat-admin-available-tab":"onClickAvailableTab","click .cmty-cat-admin-edit-tab":"onClickEditTab"},onClickHelp:function(){this.$help.showModal({frame_class:"cmty-cat-admin-helper-modal aops-modal-standard",title:e["cat-admin-contents-help-title"],width:"600px",scrollable:!0})},onClickEdit:function(){this.edit_window_created||(t.throwBlockingMessage(e["cmty-cat-admin-edit-contents-fetch"]),this.constructEditContents()),this.$edit_contents.show(),this.$el.addClass("cmty-editing-contents"),this.setFocus()},setFocus:function(){var t=this.$('input[type="text"]');t.length>0&&t.first().focus()},onClickCancel:function(){this.hasOwnProperty("$edit_contents")&&(this.$edit_contents.empty(),this.$edit_contents.hide()),this.$el.removeClass("cmty-editing-contents"),this.model.unset("items_for_edit"),this.edit_window_created=!1},onClickSave:function(){var i=this.model.getPermission("c_can_change_sort_type"),s=this,n=this.getSortType();"manual"===n&&this.resortModelItemEdits(),t.throwLoaderBlockingMessage(e["cat-admin-contents-save-blocker"]),this.model.saveItemEdits({change_sort_type:i&&this.$sort_type.val()!==this.model.get("item_sort_type"),sort_type:n,onError:function(t){var i;if("E_CATEGORY_LOCKED"===t.error_code)return AoPS.Ui.Modal.showAlert(e["cat-admin-contents-locked-error"]),s.model.set("is_locked",!0),void s.onClickCancel();i=e["cat-admin-contents-save-error"],"string"==typeof e["cat-admin-contents-save-error-"+t.error_code]?i+=e["cat-admin-contents-save-error-"+t.error_code]:i+=o.formatString(e["cat-admin-contents-unexpected-error"],[t.error_code]),AoPS.Ui.Modal.showAlert(i,{width:"450px",onButtonClick:function(){}})},onFinish:function(){location.reload()}})},resortModelItemEdits:function(){var t=[];this.$edit_items.find(".cmty-admin-contents-edit-row").each((function(e){t.push($(this).data("row_obj").item)})),this.model.set("items_for_edit",t)},constructEditContents:function(){var t=this.model.canAddItem(),i=this;this.$edit_contents.html(this.getTemplate("#cmty-category-admin-edit-contents-tpl",{can_add_items:t,lang_sort_heading:e["cat-admin-contents-sort-heading"],can_change_sort:this.model.getPermission("c_can_change_sort_type"),lang_save:e.Save.toUpperCase(),lang_cancel:e.Cancel.toUpperCase(),category_title:this.model.get("category_name"),category_desc:this.model.get("short_description"),is_my_category:this.model.get("is_my_category"),lang_current_items:e["cat-admin-contents-current-tab"],lang_available_items:e["cat-admin-contents-available-tab"]})),this.model.getPermission("c_can_change_sort_type")&&(this.$sort_type=this.$edit_contents.find('select[name="cmty-item-sort-type"]'),_.each(this.model.get("allowed_item_sort_types"),(function(t){var e=i.model.getSortDescription(t),o='";i.$sort_type.append(o)})),this.$sort_type.on("change",(function(){i.onSortTypeChange()}))),this.$edit_items_header=this.$edit_contents.find(".cmty-cat-admin-content-items-header"),this.$edit_items=this.$edit_contents.find(".cmty-cat-admin-contents-edit-list"),this.edit_window_created=!0,this.model.get("is_my_category")&&t&&(this.$available_items=this.$edit_contents.find(".cmty-cat-admin-available-item-list")),this.constructEditableItems(),this.setSortableStatus(),this.can_additems_in_admin&&t&&!this.model.get("is_my_category")&&!this.is_bookmark&&(this.$items_input=this.$edit_contents.find(".cmty-cat-admin-add-item"),this.constructItemsInput())},onSortTypeChange:function(){this.sortRows(),this.setSortableStatus()},setSortableStatus:function(){"manual"===this.getSortType()?this.$edit_items.sortable():this.$edit_items.is(":ui-sortable")&&this.$edit_items.sortable("destroy")},getSortType:function(){return this.model.getPermission("c_can_change_sort_type")?this.$sort_type.val():this.model.get("item_sort_type")},sortRows:function(){var t=this.$edit_items.find(".cmty-admin-contents-edit-row"),e=this.getSortType(),i=this,o=function(t){return 0};"abc"===e?o=function(t){return $(t).data("row_obj").item.item_text.toLowerCase()}:"system"===e?o=function(t){return parseInt(-$(t).data("row_obj").item.item_score)}:"manual"===e&&(o=function(t){return parseInt(-$(t).data("row_obj").item.item_level)});var s=_.sortBy(t,o);_.each(s,(function(t){i.$edit_items.append($(t))}))},sortAvailableRows:function(){var t=this.$available_items.find(".cmty-admin-contents-edit-row"),e=this,i=_.sortBy(t,(function(t){return $(t).data("row_obj").item.item_text.toLowerCase()}));_.each(i,(function(t){e.$available_items.append($(t))}))},constructEditableItems:function(){var t=this;this.$edit_items.append(this.$loader),this.model.fetchItemsForEdit({onFinish:function(){t.$loader.detach(),t.renderItems(),$(window).scrollTop(t.$el.offset().top),setTimeout((function(){s.closeAllModals()}),700)},onError:function(){}})},constructAvailableItems:function(){var t=this;_.each(this.model.get("available_items"),(function(e){var i;i=t.constructAvailableRow(e),t.$available_items.append(i.$row)}))},onClickAvailableTab:function(){this.$edit_items.hide(),this.$available_items.show(),this.$edit_contents.find(".cmty-cat-admin-available-tab").addClass("active-tab"),this.$edit_contents.find(".cmty-cat-admin-edit-tab").removeClass("active-tab")},onClickEditTab:function(){this.$edit_items.show(),this.$available_items.hide(),this.$edit_contents.find(".cmty-cat-admin-edit-tab").addClass("active-tab"),this.$edit_contents.find(".cmty-cat-admin-available-tab").removeClass("active-tab")},renderItems:function(){var t=this;_.each(this.model.get("items_for_edit"),(function(e){var i;i=t.constructRow(e),t.$edit_items.append(i.$row)})),this.model.get("is_my_category")&&this.constructAvailableItems()},constructRow:function(t){var i,o,s,n=this.constructItem(t),a={item:t,$item:n},r=this;return a.$row=$('
    '),this.model.canRemoveItem()&&((i=$('
    J
    ')).on("click",(function(e){r.deleteItem(t)})),a.$row.append(i)),this.model.get("is_bookmark_category")&&((o=$('
    ')).find("input").on("change",(function(e){t.edit_state="edited",t.is_watched=this.checked?1:0})),(s=$('
    ')).find("input").on("change",(function(e){t.edit_state="edited",t.in_feed=this.checked?1:0})),a.$row.append(o),a.$row.append(s)),a.$row.data("row_obj",a),a.$row.append(a.$item),a},fetchRowByItem:function(t,e){var i,o,s=t.find(".cmty-admin-contents-edit-row"),n=s.length;for(i=0;i '+e.in+'
    '+t.item_category_name+"
    ")).css({color:t.item_main_color}),i.find("a").css({color:t.item_main_color}),i},constructItemsInput:function(){var t=this;this.$items_input.empty(),this.$items_input.append('
    '+e["cat-admin-add-heading-topic"]+'
    "),this.$items_input.find("input").on("keydown",(function(e){13==(e.which||e.keyCode)&&t.onSubmitTopic()})),this.$items_input.find("button").on("click",(function(e){t.onSubmitTopic()}))},onSubmitTopic:function(){var i,o=this.$items_input.find("input").val(),n=this,a=0;/^[1-9]\d*$/.test(o)?a=parseInt(o):(i=o.split("/"),o=(o=i[i.length-1]).match(/(?:h\d+)/),_.isNull(o)||(a=parseInt(o[0].substring(1)))),0===a?(this.$items_input.find("input").val(""),s.showAlert(e["cmty-admin-add-topic-error"],{width:"450px"})):(this.$items_input.find("input").val(""),t.throwLoaderBlockingMessage(e["cmty-admin-add-topic-blocker"]),this.model.fetchTopicEditItem({topic_id:a,onFinish:function(t){n.addItem(t.topic_item)&&s.closeAllModals()},onError:function(i){var o;switch(i.error_code){case"E_TOPIC_PRIVATE":o=e["cmty-admin-add-topic-err-private"];break;case"E_NOT_FORUM_TOPIC":o=e["cmty-admin-add-topic-err-not-forum"];break;case"E_NO_SUCH_TOPIC":o=e["cmty-admin-add-topic-err-no-topic"];break;case"E_NO_PERMISSION":o=e["cmty-admin-add-topic-err-no-permission"];break;default:o=e["unexpected-error-code"]+i.error_code}t.showError(o)}}))}}),t.CategoryAdminBlockContentsViewPosts=t.CategoryAdminBlockContents.extend({post_views:[],post_types:{forum_post:{has_label:!0,has_post:!0,has_hide:!1,has_custom:!1},forum_hidden_post:{has_label:!1,has_post:!0,has_hide:!0,has_custom:!1},custom_text:{has_label:!0,has_post:!1,has_hide:!1,has_custom:!0},custom_hidden_text:{has_label:!1,has_post:!1,has_hide:!0,has_custom:!0}},constructItem:function(e){var i,o=$('
    ');return i=t.ItemboxPosts.prototype.constructItem.apply(this,[e]),o.append(i),o},constructItemsInput:function(){var t,e=this;t=$(this.getTemplate("#cmty-category-admin-add-post-tpl",{max_label_length:i.view_post_max_label_len,max_hide_label_length:i.view_post_max_hide_label_len})),this.$items_input.empty(),this.$items_input.removeClass("cmty-cat-admin-edit-row"),this.$items_input.append(t),this.$items_input.find("select").on("change",(function(t){e.setupPostType(this.value)})),this.setupPostType("forum_post"),this.$items_input.find("button").on("click",(function(t){e.processItemInput()}))},setFocus:function(){this.setupPostType("forum_post")},setupPostType:function(t){var e=this.$(".cmty-admin-new-"+t);this.$(".cmty-admin-new-post-option").hide(),e.show(),e.find("input").first().focus()},processItemInput:function(){var o,n,a=this.$('select[name="cmty-cat-admin-post-type"]').val(),r=this.$(".cmty-admin-new-"+a),l=this,c="",d=0,h="",m="",p="",u=this.post_types[a];u.has_label&&(c=r.find('input[name="cmty-admin-new-contents-post-label"]').val()).length>i.view_post_max_label_len&&(p="E_LABEL_TOO_LONG"),u.has_post&&(o=r.find('input[name="cmty-admin-new-contents-post"]').val(),/^[1-9]\d*$/.test(o)?d=parseInt(o):(n=o.split("/"),o=(o=n[n.length-1]).match(/(?:p\d+)/),_.isNull(o)||(d=parseInt(o[0].substring(1))),0===d&&(p="E_INVALID_POST_ID"))),u.has_hide&&(h=r.find('input[name="cmty-admin-new-contents-hidden-text"]').val()).length>i.view_post_max_hide_label_len&&(p="E_HIDE_LABEL_TOO_LONG"),u.has_custom&&0===(m=r.find('textarea[name="cmty-admin-new-contents-custom-text"]').val()).length&&(p="E_NO_CUSTOM_TEXT_ENTERED"),""===p?(t.throwLoaderBlockingMessage(e["cat-admin-post-construct-blocker"]),this.model.createViewPostItem({post_type:a,post_label:c,post_id:d,hide_label:h,custom_text:m,onFinish:function(t){l.addItem(t.new_item)&&s.closeAllModals(),l.$('input[type="text"]').val(""),l.$("textarea").val("")},onError:function(t){l.processError(t.error_code)}})):this.processError(p)},processError:function(i){var o;o="string"==typeof e["cmty-admin-new-post-error-"+i]?e["cmty-admin-new-post-error-"+i]:e["unexpected-error-code"]+i,t.showError(o)}}),t.CategoryAdminBlockContentsViewTags=t.CategoryAdminBlockContents.extend({constructItem:function(i){this.category_id=i.item_forum_id;var o=t.Itembox.prototype.constructItem.apply(this,[i]),s=$('
    '+e.in+' '+i.item_category_name+"
    ");return s.css({color:i.item_main_color}),s.prepend(o),this.category_id=this.model.get("category_id"),s},constructItemsInput:function(){var t=this,i={};this.$items_input.empty(),this.$items_input.append('
    '+e["cat-admin-add-heading-"+this.model.get("category_type")]+'
    '),this.model.get("is_public")&&(i.is_public_setting=1),o.buildCategoryAutocomplete(this.$items_input.find("input"),{ajax_call:"fetch_forum_autocomplete",additional_ajax_settings:i,autocomplete_settings:{onSelect:function(e,i){t.buildTagInput({item_id:i.item.category_id,item_text:i.item.label,item_type:i.item.category_type,item_forum_id:i.item.item_forum_id,item_main_color:i.item.main_color,item_secondary_color:i.item.secondary_color,item_can_remove:i.item.can_remove,item_subtitle:i.item.short_description}),e.stopPropagation(),e.preventDefault()}},show_no_results_msg:!0})},buildTagInput:function(t){var i,o=this;this.$items_input.empty(),this.$items_input.html(this.getTemplate("#cmty-cat-admin-add-content-tags-tpl",{lang_Forum:e.Forum,lang_Tag:e.Tag,tag_placeholder:e["cat-admin-contents-tag-placeholder"]})),this.current_forum=t,this.category=this.model.get("master").fetchCategory(t.item_id),_.isUndefined(this.category)&&(this.category=this.model.get("master").constructTemporaryCategory({category_type:t.item_type,category_id:t.item_id,main_color:t.item_main_color,secondary_color:t.item_secondary_color,category_name:t.item_text})),i=AoPS.Community.Views.Itembox.prototype.constructItem.apply({push_state_attribute:"data-cmty",check_can_remove:!0,can_remove_all:!0,url_router_base:"/community",url_cmty_path:"",onClickDelete:function(){o.onClickCloseForum()}},[t]),this.$items_input.find(".cmty-cat-admin-contents-add-tag-forum").append(i),this.$input_box=this.$items_input.find("input"),AoPS.Community.Views.buildTagAutocomplete({$input_box:this.$input_box,show_no_results_msg:!0,model:this.category,submitNewItem:function(e){var i;if("/open"===e.label.substr(0,5)&&(e.label=t.item_text),e.item_id>0){var s={in_feed:0,is_watched:0,item_category_name:t.item_text,item_forum_id:parseInt(e.item_forum_id),item_id:parseInt(e.item_id),item_level:0,item_main_color:e.main_color,item_secondary_color:e.secondary_color,item_text:e.label,item_type:"tag"};o.addItem(s),o.buildTagInput(t)}else i=o.$input_box.val(),o.buildTagInput(t),o.$input_box.val(i)}}),this.$input_box.focus()},onClickCloseForum:function(t){this.constructItemsInput(),this.$items_input.find("input").focus()}}),t.CategoryAdminBlockContentsFolder=t.CategoryAdminBlockContents.extend({new_contents_autocomplete_ajax:"fetch_add_contents_categories_autocomplete",constructAvailableRow:function(t){var e,i=this.constructItem(t),o={item:t,$item:i},s=this;return o.$row=$('
    '),this.model.getPermission("c_can_add_item")&&((e=$('
    +
    ')).on("click",(function(e){s.addItem(t)})),o.$row.append(e)),o.$row.data("row_obj",o),o.$row.append(o.$item),o},constructItemsInput:function(){var t=this,i={};this.$items_input.append('
    '+e["cat-admin-add-heading-"+this.model.get("category_type")]+'
    '),this.$new_item_input=this.$items_input.find("input"),this.model.get("is_public")&&(i.is_public_setting=1),o.buildCategoryAutocomplete(this.$new_item_input,{ajax_call:this.new_contents_autocomplete_ajax,additional_ajax_settings:i,autocomplete_settings:{onSelect:function(e,i){t.parsePotentialNewContents({item_id:i.item.category_id,item_text:i.item.label,item_type:i.item.category_type,item_forum_id:i.item.item_forum_id,item_main_color:i.item.main_color,item_secondary_color:i.item.secondary_color,item_can_remove:i.item.can_remove,item_level:0,item_score:i.item.last_post_time,item_subtitle:i.item.short_description,item_is_public:i.item.is_public,edit_state:"added",id:0}),e.stopPropagation(),e.preventDefault()}},show_no_results_msg:!0})},parsePotentialNewContents:function(t){t.item_id===this.model.get("category_id")?AoPS.Ui.Modal.showAlertQuick(e["cat-admin-contents-no-adding-to-self"]):this.addItem(t),this.$new_item_input.val(""),this.$new_item_input.focus()},onAddItemError:function(t,i){"E_CATEGORY_LOCKED"===t.error_code?(AoPS.Ui.Modal.showAlert(e["cat-admin-contents-locked-error"]),this.model.set("is_locked",!0),this.render()):AoPS.Ui.Flyout.display(o.formatString(e["cat-admin-contents-add-category-error"],[i.item_text,t.error_code])),this.model.removeItem(i)},onClickDeleteItem:function(t){var i=this;this.model.removeItemDb({item:t,remove_from_client_immediately:!0,onError:function(s){"E_CATEGORY_LOCKED"===s.error_code?(AoPS.Ui.Modal.showAlert(e["cat-admin-contents-locked-error"]),i.model.addItem(t),i.model.set("is_locked",!0),i.render()):AoPS.Ui.Flyout.display(o.formatString(e["cat-admin-contents-remove-tag-error"],[t.item_text])),i.model.addItem(t)}})},addItemToExistingCategory:function(t){var e=this;this.model.addItemDb({item:t,add_to_client_immediately:!0,onError:function(i){e.onAddItemError(i,t)}})},onClose:function(){this.itembox_view&&this.itembox_view.close()}}),t.CategoryAdminBlockContentsBookmarkUsers=t.CategoryAdminBlockContentsFolder.extend({can_additems_in_admin:!1}),t.CategoryAdminBlockContentsBlogroll=t.CategoryAdminBlockContentsFolder.extend({new_contents_autocomplete_ajax:"fetch_blogs_autocomplete"}),t.CategoryAdminBlockContentsFolderForums=t.CategoryAdminBlockContentsFolder.extend({new_contents_autocomplete_ajax:"fetch_forum_autocomplete"}),t.CategoryAdminBlockContentsFolderCollections=t.CategoryAdminBlockContentsFolder.extend({new_contents_autocomplete_ajax:"fetch_folder_collections_contents_autocomplete"}),t.CategoryAdminBlockContentsFolderOld=AoPS.View.extend({template_id:"#cmty-category-admin-contents-tpl",className:"aops-panel cmty-cat-admin-contents",new_contents_autocomplete_ajax:"fetch_add_contents_categories_autocomplete",initialize:function(){this.$help=$(this.getTemplate("#cmty-cat-admin-contents-"+t.getCategoryAdminCatType(this.model.get("category_type"))+"-help-tpl",{})),this.render()},events:{"click .cmty-cat-admin-help":"onClickHelp"},onClickHelp:function(){this.$help.showModal({frame_class:"cmty-cat-admin-helper-modal aops-modal-standard",title:e["cat-admin-contents-help-title"],width:"600px",scrollable:!0})},render:function(){var i=this.model.canAddItem(),o=this.model.canRemoveItem(),s=this;this.$el.html(this.getTemplate(this.template_id,{can_add_item:i,title:e["cat-admin-contents-title"],lang_add:e["cat-admin-contents-add-item"],lang_contents:e["cat-admin-contents-items-header"]})),this.$contents=this.$el.find(".cmty-admin-location-containers"),this.itembox_view=new t.Itembox({model:this.model,check_can_remove:o,can_remove_all:!0,onDeleteItem:function(t){s.onClickDeleteItem(t)}}),this.$contents.append(this.itembox_view.$el),i&&(this.$content_add=this.$el.find(".cmty-cat-admin-content-add"),this.constructContentsInput())},onClickDeleteItem:function(t){var i=this;this.model.removeItemDb({item:t,remove_from_client_immediately:!0,onError:function(s){"E_CATEGORY_LOCKED"===s.error_code?(AoPS.Ui.Modal.showAlert(e["cat-admin-contents-locked-error"]),i.model.addItem(t),i.model.set("is_locked",!0),i.render()):AoPS.Ui.Flyout.display(o.formatString(e["cat-admin-contents-remove-tag-error"],[t.item_text])),i.model.addItem(t)}})},constructContentsInput:function(){var t=this,i={};this.$content_add.append(''),this.$new_item_input=this.$content_add.find("input"),this.model.get("is_public")&&(i.is_public_setting=1),o.buildCategoryAutocomplete(this.$new_item_input,{ajax_call:this.new_contents_autocomplete_ajax,additional_ajax_settings:i,autocomplete_settings:{onSelect:function(e,i){t.parsePotentialNewContents({item_id:i.item.category_id,item_text:i.item.label,item_type:i.item.category_type,item_forum_id:i.item.item_forum_id,item_main_color:i.item.main_color,item_secondary_color:i.item.secondary_color,item_can_remove:i.item.can_remove,item_subtitle:i.item.short_description}),e.stopPropagation(),e.preventDefault()}},show_no_results_msg:!0})},parsePotentialNewContents:function(t){t.item_id===this.model.get("category_id")?AoPS.Ui.Modal.showAlertQuick(e["cat-admin-contents-no-adding-to-self"]):_.isUndefined(this.model.fetchItem(t))?this.model.get("category_id")>0?this.addItemToExistingCategory(t):this.model.addItem(t):AoPS.Ui.Modal.showAlertQuick(o.formatString(e["cat-admin-contents-already-holds"],[t.item_text])),this.$new_item_input.val(""),this.$new_item_input.focus()},onAddItemError:function(t,i){"E_CATEGORY_LOCKED"===t.error_code?(AoPS.Ui.Modal.showAlert(e["cat-admin-contents-locked-error"]),this.model.removeItem(i),this.model.set("is_locked",!0),this.render()):AoPS.Ui.Flyout.display(o.formatString(e["cat-admin-contents-add-category-error"],[i.item_text,t.error_code])),this.model.removeItem(i)},addItemToExistingCategory:function(t){var e=this;this.model.addItemDb({item:t,add_to_client_immediately:!0,onError:function(i){e.onAddItemError(i,t)}})},onClose:function(){this.itembox_view.close()},validateNewCategorySettings:function(){return 0!==this.model.get("items").length||(AoPS.Ui.Modal.showAlertQuick(e["cat-admin-no-empty-collections"]),!1)}}),t.CategoryAdminBlockContentsBookmarkForums=t.CategoryAdminBlockContentsFolder.extend({new_contents_autocomplete_ajax:"fetch_forum_autocomplete",addItemToExistingCategory:function(e){var i=this;t.fireBookmarkModal("forum",_.bind((function(t){var o=_.defaults({state:t},e);this.model.get("master").addBookmarkForumViaAdmin({item:o,onError:function(t){i.onAddItemError(t,e)}})}),this))}}),t.CategoryAdminBlockContentsMyForums=t.CategoryAdminBlockContentsFolder.extend({new_contents_autocomplete_ajax:"fetch_add_contents_my_forums_autocomplete"}),t.CategoryAdminBlockContentsMyCollections=t.CategoryAdminBlockContentsFolder.extend({new_contents_autocomplete_ajax:"fetch_add_contents_my_collections_autocomplete"}),t.CategoryAdminBlockContentsViewTagsOld=t.CategoryAdminBlockContentsFolder.extend({onClickCloseForum:function(t){this.constructContentsInput(),this.$content_add.find("input").focus()},constructContentsInput:function(){var t=this;this.$content_add.empty(),this.$content_add.append(''),o.buildCategoryAutocomplete(this.$content_add.find("input"),{ajax_call:"fetch_forum_autocomplete",autocomplete_settings:{onSelect:function(e,i){t.buildTagInput({item_id:i.item.category_id,item_text:i.item.label,item_type:i.item.category_type,item_forum_id:i.item.item_forum_id,item_main_color:i.item.main_color,item_secondary_color:i.item.secondary_color,item_can_remove:i.item.can_remove,item_subtitle:i.item.short_description}),e.stopPropagation(),e.preventDefault()}},show_no_results_msg:!0})},buildTagInput:function(t){var i,o=this;this.$content_add.empty(),this.$content_add.html(this.getTemplate("#cmty-cat-admin-add-content-tags-tpl",{lang_Forum:e.Forum,lang_Tag:e.Tag,tag_placeholder:e["cat-admin-contents-tag-placeholder"]})),this.current_forum=t,this.category=this.model.get("master").fetchCategory(t.item_id),_.isUndefined(this.category)&&(this.category=this.model.get("master").constructTemporaryCategory({category_type:t.item_type,category_id:t.item_id,main_color:t.item_main_color,secondary_color:t.item_secondary_color,category_name:t.item_text})),i=AoPS.Community.Views.Itembox.prototype.constructItem.apply({push_state_attribute:"data-cmty",check_can_remove:!0,can_remove_all:!0,onClickDelete:function(){o.onClickCloseForum()}},[t]),this.$content_add.find(".cmty-cat-admin-contents-add-tag-forum").append(i),this.$input_box=this.$content_add.find("input"),AoPS.Community.Views.buildTagAutocomplete({$input_box:this.$input_box,show_no_results_msg:!0,model:this.category,submitNewItem:function(t){o.addItem(t)}}),this.$input_box.focus()},addItem:function(t){var i={item_id:parseInt(t.item_id),item_type:"tag",item_forum_id:parseInt(t.item_forum_id),item_text:t.value,item_main_color:t.main_color,item_secondary_color:t.secondary_color};_.isUndefined(this.model.fetchItem(i))?this.model.get("category_id")>0?this.addItemToExistingCategory(i):this.model.addItem(i):AoPS.Ui.Flyout.display(o.formatString(e["cat-admin-contents-added-tag-already"],[i.item_text,this.current_forum.item_text])),this.buildTagInput(this.current_forum)},addItemToExistingCategory:function(t){var i=this;this.model.addItemDb({item:t,add_to_client_immediately:!0,onError:function(s){"E_CATEGORY_LOCKED"===s.error_code?(AoPS.Ui.Modal.showAlert(e["cat-admin-contents-locked-error"]),i.model.removeItem(t),i.model.set("is_locked",!0),i.render()):AoPS.Ui.Flyout.display(o.formatString(e["cat-admin-contents-add-tag-error"],[t.item_text,i.current_forum.item_text])),i.model.removeItem(t)}})}}),t.CategoryAdminBlockContentsBookmarkTags=t.CategoryAdminBlockContentsViewTags.extend({addItemToExistingCategory:function(e){var i=this;t.fireBookmarkModal("tag",_.bind((function(t){this.model.get("master").addTagBookmark({item:_.defaults(t,e),onError:function(t){i.onAddItemError(t,e)}})}),this))}}),t.CategoryAdminBlockLocation=AoPS.View.extend({template_id:"#cmty-category-admin-location-tpl",className:"aops-panel cmty-cat-admin-location",initialize:function(){this.display_type=o.displayCategoryType(this.model.get("category_type")),this.render(),this.$help=$(this.getTemplate("#cmty-cat-admin-location-help-tpl",{type:this.display_type,lang_contained_in:e["cat-admin-location-contained-in"]}))},events:{"click .cmty-cat-admin-help":"onClickHelp"},buildHelper:function(){var t=this.category_type_specific_settings.help_template_id;this.$help=$(this.getTemplate(t,{}))},render:function(){var i=this;this.$el.html(this.getTemplate(this.template_id,{can_add_to_folders:AoPS.session.logged_in,placeholder:e["cat-admin-add-to-location-placeholder"],title:e["cat-admin-location-title"],lang_add_to:e["cat-admin-location-add-to"],lang_contained_in:e["cat-admin-location-contained-in"]})),this.$contained_in=this.$el.find(".cmty-admin-location-containers"),AoPS.session.logged_in&&(this.$input_box=this.$el.find("input"),o.buildCategoryAutocomplete(this.$input_box,{ajax_call:"fetch_containers_autocomplete",additional_ajax_settings:{item_type:this.model.get("category_type")},autocomplete_settings:{onSelect:function(t,e){i.parsePotentialNewContainer({item_id:e.item.category_id,item_text:e.item.label,item_type:"folder",item_forum_id:0,item_main_color:e.item.main_color,item_secondary_color:e.item.secondary_color,item_can_remove:e.item.can_remove,item_subtitle:e.item.short_description}),t.stopPropagation(),t.preventDefault()}},show_no_results_msg:!0})),this.itembox_view=new t.Itembox({model:this.model.get("container_model"),check_can_remove:!0,can_remove_all:!1,onDeleteItem:function(t){i.onClickDeleteContainer(t)}}),this.$contained_in.append(this.itembox_view.$el)},parsePotentialNewContainer:function(t){var i=this;t.item_id===this.model.get("category_id")?AoPS.Ui.Modal.showAlertQuick(e["cat-admin-contents-no-adding-to-self"]):this.model.get("container_model").addItem({item:t,onError:function(s){"E_ALREADY_ADDED"===s.error_code&&AoPS.Ui.Modal.showAlert(o.formatString(e["cat-admin-location-exists"],[i.display_type,t.item_text]))}}),this.$input_box.val(""),this.$input_box.focus()},onClickDeleteContainer:function(t){var i=this;this.model.get("category_id")>0?AoPS.Ui.Modal.showConfirm(e["cat-admin-delete-container-1"]+" "+t.item_text+"?",(function(e){e&&i.model.get("container_model").removeItem(t),AoPS.Ui.Modal.closeAllModals()}),{width:"450px"}):i.model.get("container_model").removeItem(t)},onClickHelp:function(){this.$help.showModal({frame_class:"cmty-cat-admin-helper-modal aops-modal-standard",title:e["cat-admin-location-help-title"],width:"600px",scrollable:!0})},validateNewCategorySettings:function(){return!0},onClose:function(){this.itembox_view.close()}}),t.CategoryAdminBlockBlogSettings=AoPS.View.extend({template_id:"#cmty-category-admin-blog-extras-tpl",className:"aops-panel",initialize:function(){var t=["show_profile_info","show_stats","show_shoutbox","show_contributors","show_tags"],i=this,o=this.model.getPermission("c_can_edit_core_data");o&&(t.push("is_primary_blog"),this.model.set("is_primary_blog",this.model.get("category_id")===this.model.get("master").get("current_user").get("primary_blog_id"))),this.$el.html(this.getTemplate(this.template_id,{title:e["cat-admin-blog-settings-title"]})),_.each(["blog_post_comment_text","blog_comments_text","blog_one_comment_text","blog_no_comments_text"],(function(t){o?i.buildEditableInputSetting(t):i.buildStaticSetting(t)})),this.intervals={},_.each(t,(function(t){o?i.buildEditableBitSetting(t):i.buildStaticSetting(t)})),this.$help=$(this.getTemplate("#cmty-cat-admin-blog-settings-help-tpl",{}))},events:{"click .cmty-cat-admin-help":"onClickHelp"},onClickHelp:function(){this.$help.showModal({frame_class:"cmty-cat-admin-helper-modal aops-modal-standard",title:e["cat-admin-blog-settings-help-title"],width:"600px",scrollable:!0})},buildSettingGroup:function(t){return $('
    ")},buildStaticSetting:t.CategoryAdminBlockGeneralInfo.prototype.buildStaticSetting,buildEditableBitSetting:t.CategoryAdminBlockGeneralInfo.prototype.buildEditableBitSetting,updateBitSetting:function(i,o){this.model.setBitBlogSetting({setting:i,value:1==parseInt(o),onError:function(i){_typeof(e["change-blog-err-"+i.error_code])&&t.showError(e["change-blog-err-"+i.error_code])}})},buildEditableInputSetting:function(t){var e=this,o=this.buildSettingGroup(t),s=$('');s.on("input",(function(i){e.prepareSaveInput(s,t)})),o.append($("
    ").append(s)),this.$el.append(o)},prepareSaveInput:function(t,e){var o=this,s=t.val();this.intervals.hasOwnProperty(e)&&clearTimeout(this.intervals[e]),this.intervals[e]=setTimeout((function(){o.saveInput(e,s)}),i.cat_admin_save_input_delay)},saveInput:function(i,o){this.model.setStringBlogSetting({setting:i,value:o,onFinish:function(t){AoPS.Ui.Flyout.close(),AoPS.Ui.Flyout.display(e["cat-admin-blog-label-"+i]+" "+e.saved+".")},onError:function(i){_typeof(e["change-blog-err-"+i.error_code])&&t.showError(e["change-blog-err-"+i.error_code])}})},validateNewCategorySettings:function(){return!0}}),t.CategoryAdminBlockBlogCss=AoPS.View.extend({template_id:"#cmty-cat-admin-blog-css-tpl",className:"aops-panel",initialize:function(){var t,i=this,o=this.model.get("category_id")>0,s=o&&this.model.getPermission("c_can_edit_core_data");t=o?s?e["cat-admin-blog-css-existing-info"]:this.model.has("css")&&this.model.get("css").length>0?e["cat-admin-blog-css-no-perm"]:"":e["cat-admin-blog-css-new-info"],this.$el.html(this.getTemplate(this.template_id,{title:e["cat-admin-blog-css-title"],blog_exists:o,blog_message:t,Save:e.Save,Reset:e.Reset,Delete:e.Delete,content:this.model.has("css")?this.model.get("css"):e["cat-admin-blog-css-default-css"],can_edit:s,placeholder:s?e["cat-admin-blog-css-enter"]:e["cat-admin-blog-css-none"]})),this.$css=this.$("textarea"),s&&(this.$css.on("keyup",(function(){i.onKeyPress()})),this.$save=this.$(".cmty-cat-admin-blog-css-save"),this.$reset=this.$(".cmty-cat-admin-blog-css-reset"),this.$delete=this.$(".cmty-cat-admin-blog-css-delete"),this.resetButtonVisibility()),this.$help=$(this.getTemplate("#cmty-cat-admin-blog-css-help-tpl",{}))},validateNewCategorySettings:function(){return!0},events:{"click .cmty-cat-admin-blog-css-save":"onClickSave","click .cmty-cat-admin-blog-css-reset":"onClickReset","click .cmty-cat-admin-blog-css-delete":"onClickDelete","click .cmty-cat-admin-help":"onClickHelp"},onClickHelp:function(){this.$help.showModal({frame_class:"cmty-cat-admin-helper-modal aops-modal-standard",title:e["cat-admin-blog-css-help-title"],width:"600px",scrollable:!0})},onKeyPress:function(){this.$save.show(),this.$reset.show()},resetButtonVisibility:function(){this.$reset.hide(),this.$save.hide(),this.$delete.toggle(this.model.has("css")&&this.model.get("css").length>0)},onClickReset:function(){var t=this.model.has("css")?this.model.get("css"):"";this.$css.val(t),this.resetButtonVisibility()},onClickSave:function(){var i=this,o=i.$css.val();s.showConfirm(e["cat-admin-blog-css-save-sure"],(function(n){n?(t.throwBlockingMessage(e["cat-admin-blog-css-save-block"]),i.model.setNewCss({new_css:i.$css.val(),onFinish:function(){i.model.set("css",o),i.resetButtonVisibility(),setTimeout((function(){s.closeAllModals()}),500)},onError:function(t){i.throwEditError(t)}})):s.closeAllModals()}),{close_on_button_click:!1,width:"450px"})},throwEditError:function(t){var i;i="E_NO_PERMISSION"===t.error_code?e["cat-admin-blog-css-no-perm-err"]:e["unexpected-error-code"]+t.error_code,AoPS.Community.Views.showError(i)},onClickDelete:function(){var i=this;s.showConfirm(e["cat-admin-blog-css-delete-sure"],(function(o){o?(t.throwBlockingMessage(e["cat-admin-blog-css-delete-block"]),i.model.deleteCss({onFinish:function(){i.$css.val(""),i.model.unset("css"),i.resetButtonVisibility(),setTimeout((function(){s.closeAllModals()}),500)},onError:function(t){i.throwEditError(t)}})):s.closeAllModals()}),{close_on_button_click:!1,width:"450px"})}}),t}(AoPS.Community.Views||{}); ;function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}AoPS.Feed=function(e){var t=AoPS.Community.Lang;return e.preloaded_topic=null,e.preload_feed_tag_id=0,e.preload_feed_tag_text="",e.constructFeed=function(){var e,t;if(AoPS.Community.is_active)return"object"===_typeof(this.community_master)||(AoPS.Community.hasOwnProperty("MasterModel")||(AoPS.Community.MasterModel=new AoPS.Community.Models.Master({in_community:!1})),this.community_master=AoPS.Community.MasterModel,this.feed_master=new AoPS.Community.Models.Feed({master:this.community_master}),this.feed_view=new AoPS.Feed.Views.FeedMaster({model:this.feed_master}),AoPS.Feed.Master=this.feed_master,AoPS.bootstrap_data.hasOwnProperty("preload_feed_focus_topic")&&(AoPS.Feed.preloaded_topic=this.community_master.processPotentialNewTopic(AoPS.bootstrap_data.preload_feed_focus_topic)),AoPS.bootstrap_data.hasOwnProperty("preload_feed_tag_id")&&(AoPS.Feed.preload_feed_tag_id=parseInt(AoPS.bootstrap_data.preload_feed_tag_id)),AoPS.bootstrap_data.hasOwnProperty("preload_feed_tag_text")&&(AoPS.Feed.preload_feed_tag_text=AoPS.bootstrap_data.preload_feed_tag_text),_.isNull(AoPS.Feed.preloaded_topic)||(e=AoPS.Feed.preloaded_topic.get("category_id"),this.feed_view.$el.addClass("feed-preloaded-topic")),$("body").append(this.feed_view.$el),_.isNull(AoPS.Feed.preloaded_topic)||(t="string"==typeof AoPS.bootstrap_data.page_feed_preload_title?AoPS.bootstrap_data.page_feed_preload_title:"Linked Item Topics",this.openPageFeed({category_id:e,tag_id:AoPS.Feed.preload_feed_tag_id,tag_text:AoPS.Feed.preload_feed_tag_text,subtitle:t}),this.feed_master.set("focus_topic",AoPS.Feed.preloaded_topic))),{community_master:this.community_master,feed_master:this.feed_master,feed_view:this.feed_view}},e.setPageFeedSubtitle=function(e){var t;AoPS.Community.is_active&&(t=this.feed_view.page_subfeed.view.$el.find(".feed-subtitle"),this.feed_master.get("page_subfeed_settings").subtitle=e,0===e.length?this.feed_view.page_subfeed.view.$el.find(".feed-subtitle").remove():t.length>0?t.html(e):(t='
    '+e+"
    ",this.feed_view.page_subfeed.view.$el.find(".feed-subfeed-header").after(t)))},e.setPageFeed=function(e){var t,o=!1;if(AoPS.Community.is_active){if(t=this.feed_master.get("page_subfeed_settings"),this.feed_view.$el.removeClass("feed-hide-page-feed"),"number"==typeof arguments[0]){if(0===e)return;e={category_id:arguments[0]},1===arguments.length?e.tag_id=0:("number"==typeof arguments[1]?e.tag_id=arguments[1]:e.tag_text=arguments[1],3===arguments.length&&(e.subtitle=arguments[2]))}else e=_.extend({tag_id:0,subtitle:""},e);return t.hasOwnProperty("category_id")&&e.hasOwnProperty("category_id")&&t.category_id===e.category_id?e.hasOwnProperty("tag_id")&&e.tag_id>0?t.hasOwnProperty("tag_id")&&parseInt(t.tag_id)===e.tag_id||(o=!0):e.hasOwnProperty("tag_text")&&e.tag_text.length>0?t.hasOwnProperty("tag_text")&&t.tag_text===e.tag_text||(o=!0):t.hasOwnProperty("tag_id")&&parseInt(t.tag_id)>0&&(o=!0):o=!0,o&&this.feed_master.set("page_subfeed_settings",e),o}},e.hidePageFeed=function(){AoPS.Community.is_active&&(this.feed_view.$el.addClass("feed-hide-page-feed"),this.feed_view.page_subfeed===this.feed_view.active_subfeed&&this.feed_view.closeFeed())},e.closePageFeed=function(){AoPS.Community.is_active&&this.feed_view.page_subfeed===this.feed_view.active_subfeed&&(AoPS.Feed.feed_master.set("focus_topic",null),this.feed_view.closeFeed())},e.openPageFeed=function(e){if(AoPS.Community.is_active){if("number"==typeof arguments[0]){if(0===e)return;e={category_id:arguments[0],subtitle:""},1===arguments.length?e.tag_id=0:"number"==typeof arguments[1]?e.tag_id=arguments[1]:(e.tag_id=0,e.tag_text=arguments[1]),3===arguments.length&&(e.subtitle=arguments[2])}else e=_.extend({tag_id:0},e);this.setPageFeed(e)||!AoPS.Feed.feed_view.isPageSubfeedOpen()||e.hasOwnProperty("force_open")&&e.force_open?this.activatePageSubfeed():this.closePageFeed()}else AoPS.Ui.Modal.showAlert(t["err-community-disabled"])},e.activatePageSubfeed=function(){this.feed_view.activatePageSubfeed(),this.feed_view.showFeed()},e.activateGlobalSubfeed=function(){"object"===_typeof(this.feed_view.global_subfeed)&&this.feed_view.openFeed(this.feed_view.global_subfeed,0)},e.startNewTopic=function(e){if(AoPS.Community.is_active)if(0!==e.category_id){var o=this.community_master.fetchCategory(e.category_id),i=_.extend({tags:[],target_url:"",target_text:"",subtitle:"",content:"",linked_tag:"",filter_tag:"",hidden_tags:[],restricted_tags:[],onSuccess:function(){}},e);AoPS.session.logged_in?AoPS.isUserLimited()&&!AoPS.in_academy?AoPS.Ui.Modal.showMessage(t["cat-cell-no-perm-limited-user"],{width:"450px"}):_.isUndefined(o)?AoPS.Ui.Modal.showMessage(t["new-topic-no-category"]):o.getPermission("c_can_start_topic")||o.getPermission("c_undo_global_ban")?(""!==i.linked_tag&&(i.tags=_.without(i.tags,i.linked_tag),i.tags.push(i.linked_tag)),i.special_item=i.linked_tag,delete i.linked_tag,i.model=o,i.filter_tag=i.filter_tag.length>0?i.filter_tag:i.target_url,i.master=this.community_master,new AoPS.Feed.Views.NewTopic(i)):AoPS.Ui.Modal.showMessage(t["cat-cell-no-perm-start-topic"]):AoPS.Ui.buildLoginConfirm(t["new-topic-not-logged-in"])}else AoPS.Community.Views.showError(t["feed-no-forum"]);else AoPS.Ui.Modal.showAlert(t["err-community-disabled"])},e.buildNewTopicButton=function(e){var t=$('
    V
    ');return this.activateNewTopicButton(_.extend({$button:t},e))},e.activateNewTopicButton=function(e){return e.$button.on("click",(function(){AoPS.Feed.startNewTopic(e)})),e.$button},e.buildOpenFeedButton=function(e){var t=$('
    t
    ');return this.activateOpenFeedButton(_.extend({$button:t},e))},e.activateOpenFeedButton=function(e){return e.$button.on("click",(function(){AoPS.Feed.openPageFeed(e)})),e.$button},e.onFeedRoute=function(t){_.isNull(t)&&(t=""),"/"===t.substr(0,1)&&(t=t.substr(1)),AoPS.Community.hasOwnProperty("MasterModel")||e.constructFeed(),Backbone.history.navigate(t,{trigger:!0,replace:!0});var o=AoPS.Community.MasterModel.get("focus_topic");_.isNull(o)||(AoPS.Feed.activatePageSubfeed(),AoPS.Feed.feed_master.set("focus_topic",o)),AoPS.Community.MasterModel.set("focus_topic",null)},e.openTopic=function(e){if(AoPS.Community.is_active){var t=AoPS.Community.MasterModel.fetchTopicById(e),o=this,i=AoPS.Feed.feed_master.get("focus_topic");(_.isNull(i)||e!==i.get("topic_id"))&&AoPS.Feed.feed_view.past_topic_id!==e||!AoPS.Feed.feed_view.isPageSubfeedOpen()?_.isNull(t)||_.isUndefined(t)?(AoPS.Feed.activatePageSubfeed(),this.feed_view.throwTopicBlocker(),t=AoPS.Community.MasterModel.fetchTopicFromDb({topic_id:e,onFinish:function(e){AoPS.Feed.feed_master.set("focus_topic",e.topic,{no_ajax_override:!0})},onError:function(e){o.onTopicError(e)}})):(AoPS.Feed.activatePageSubfeed(),AoPS.Feed.feed_master.set("focus_topic",t,{no_ajax_override:!0})):this.closePageFeed()}},e.onTopicError=function(e){var o;switch(e.error_code){case"E_NO_SUCH_TOPIC":o=t["feed-no-topic"];break;case"E_NO_PERMISSION":o=t["feed-no-read-permission"];break;default:o=AoPS.Community.Utils.formatString(t["err-unknown"],[e.error_code])}AoPS.Feed.feed_view.cleanTopicWindow(),AoPS.Community.Views.showError(o)},e.openTopicSetFeed=function(e){if(AoPS.Community.is_active)if($("body").width()<=700){var t=AoPS.bd.grid_data.class.forum_id,o=arguments[0];window.open("/community/c"+t+"h"+o,"_blank")}else{var i,d=arguments[0],a=!1,s=this,n=AoPS.Feed.feed_view.isPageSubfeedOpen(),r=Array.prototype.slice.apply(arguments).slice(1),c=AoPS.Feed.feed_master.get("focus_topic");i=this.setPageFeed.apply(this,r),(_.isNull(c)||c.get("topic_id")!==d)&&AoPS.Feed.feed_view.past_topic_id!==d||!n||i?(AoPS.Feed.feed_view.feed_open||(this.openPageFeed.apply(this,r),a=!0),this.activatePageSubfeed(),a?setTimeout((function(){s.openTopic(d)}),1.1*AoPS.Feed.feed_view.animate_speed):this.openTopic(d)):this.closePageFeed()}},e}(AoPS.Feed||{}); ;AoPS.Feed=AoPS.Feed||{},AoPS.Feed.Views=function(e){var t=AoPS.Community.Lang,i=AoPS.Community.Utils,s=AoPS.Ui.Flyout;return e.processFeedTopicIsReadChange=function(t){t.topic.get("is_read")&&t.$button.hasClass("feed-subfeed-new-topic")&&e.checkSubfeedUnread(t)},e.checkSubfeedUnread=function(e){if(!(e.list.length>AoPS.Community.Constants.max_length_feed_list_read_check)){var t=e.list.findWhere({is_read:!1});_.isUndefined(t)?e.$button.removeClass("feed-subfeed-new-topic"):e.list.length>0&&e.$button.addClass("feed-subfeed-new-topic")}},e.FeedMaster=AoPS.View.extend({template_id:"#feed-master-tpl",feed_open:!1,animate_speed:200,active_subfeed:null,active_topic_view:null,id:"feed-wrapper",topic_views:[],subfeeds:[],has_page_feed:!1,cached_page_subfeed_views:{},initialize:function(){var e=this;this.$el.html(this.getTemplate(this.template_id,{})),this.$tabs=this.$el.find("#feed-tabs"),this.$topics_list=this.$el.find("#feed-topic-list"),this.$topic=this.$el.find("#feed-topic"),this.$topic_loader=AoPS.Page.buildLoader(),this.$el.on("mousedown",(function(e){e.stopPropagation()})),e.past_topic_id=0,$("body").on("click.feed",(function(t){e.past_topic_id=0})),this.feed_animated=!1,this.community_master=this.model.get("master"),this.model=this.community_master.get("feed"),this.constructSubfeeds(),this.listenTo(this.model,"change:focus_topic",this.buildTopic),this.listenTo(this.community_master.get("current_user"),"change:show_tags_on_feed",this.processShowTags),this.processShowTags(),this.listenTo(this.model,"change:page_subfeed_settings",this.onNewPageSubfeed),this.listenTo(this.community_master,"change:fullscreen_mode",(function(t){"feed"===e.community_master.previous("fullscreen_mode")?e.offFullscreen():"feed"===e.community_master.get("fullscreen_mode")&&e.onFullscreen()})),this.setVisibility(),AoPS.session.logged_in&&this.listenTo(this.community_master.get("current_user"),"change:hide_feed",this.setVisibility),this.community_master.get("current_user").get("hide_avatars")&&this.$el.addClass("cmty-hide-avatars"),this.listenTo(this.community_master.get("current_user"),"change:hide_avatars",(function(){e.$el.toggleClass("cmty-hide-avatars",e.community_master.get("current_user"))})),this.listenTo(Backbone,"community_disabled",this.onCommunityDisabled),this.listenTo(Backbone,"close_feed_topic",this.onTriggerCloseFeedTopic),i.startIdleMonitor(),i.activateLatexOnclick()},events:{"click .feed-subfeed-header":"closeFeed","click .feed-resort":"onClickResort"},onCommunityDisabled:function(){s.display(t["feed-community-disabled"]),this.hideFeed()},onFullscreen:function(){this.$topic.left_css=this.$topic.is_dragged?this.$topic.css("left"):"",this.$topic.top_css=this.$topic.is_dragged?this.$topic.css("top"):"",this.$topic.css({left:"",top:""}),this.$topic.draggable("disable")},offFullscreen:function(){this.$topic.css({left:this.$topic.left_css,top:this.$topic.top_css}),this.$topic.draggable("enable")},setVisibility:function(){AoPS.session.logged_in&&1===Number(this.community_master.get("current_user").get("hide_feed"))?this.hideFeed():this.showFeed()},processShowTags:function(){this.$el.toggleClass("cmty-show-feed-tags",this.community_master.get("current_user").get("show_tags_on_feed"))},hideFeed:function(){this.$el.addClass("feed-hidden")},showFeed:function(){AoPS.Community.is_active&&this.$el.removeClass("feed-hidden")},onTriggerCloseFeedTopic:function(){this.model.set("focus_topic",null),"feed"===this.community_master.get("fullscreen_mode")&&(this.community_master.set("fullscreen_mode","none"),$(window).trigger("resize"))},constructSubfeeds:function(){var e,i,s,o=[];for(this.global_subfeed=this.addSubfeed({header_text:t["feed-global-subfeed-header"],id:"feed-global-tab",title:"full"===this.model.get("global_feed_type")?t["feed-tab-global-title"]:t["feed-tab-global-custom-title"],icon_letter:"a",category:new AoPS.Community.Models.CategoryGlobal({master:this.community_master})}),AoPS.session.logged_in&&(this.addSubfeed({header_text:t["feed-ego-subfeed-header"],id:"feed-egosearch-tab",title:t["feed-tab-my-topics-title"],icon_letter:"w",category:new AoPS.Community.Models.CategoryUsersTopics({master:this.community_master,user_id:AoPS.session.user_id})}),e=this.community_master.fetchCategory(1),this.addSubfeed({header_text:t["feed-messages-subfeed-header"],id:"feed-privates-tab",title:t["feed-tab-private-title"],icon_letter:"m",can_post:!0,can_post_title:t["feed-new-private-conversation"],category:e,onClickNewTopic:_.bind((function(){e.getPermission("c_can_start_topic")||e.getPermission("c_undo_global_ban")?this.launchNewPrivate():AoPS.Ui.Modal.showMessage(t[AoPS.isUserLimited()?"new-pm-no-permission-limited":"new-pm-no-permission"],{width:"450px"})}),this)}),this.constructBookmarksSubfeed()),s=0;s",{id:t.id,class:"feed-tab aops-font",text:t.icon_letter,title:t.title}),view:{}},s=this;return this.$tabs.append(i.$button),i.view=new e.Subfeed(_.defaults({model:t.category},t)),i.$button.on("click",(function(){s.onButtonClick(i)})),this.addSubfeedListeners(i),this.subfeeds.push(i),i},onButtonClick:function(e){this.model.get("initialized")&&(this.feed_animated||(this.feed_open?this.active_subfeed===e?this.closeFeed():(this.closeSubfeed(this.active_subfeed),this.activateSubfeed(e,0)):this.openFeed(e)))},closeSubfeed:function(e){e&&(this.stopListening(Backbone,"topic_cell_marked_for_deletion"),e.view.$el.detach(),e.view.hasOwnProperty("topics_list_view")&&("function"==typeof e.view.topics_list_view.processUpdatedTopicVisibility&&e.view.topics_list_view.processUpdatedTopicVisibility(),e.view.topics_list_view.on_page=!1),e.view.$(".feed-resort").hide(),this.model.set("focus_topic",null),_.isNull(this.active_topic_view)||(this.active_topic_view.onRemoveFromFeed(),this.active_topic_view=null),e.$button.removeClass("feed-subfeed-button-selected"))},activateSubfeed:function(e,t){if(e&&e!==this.active_subfeed){var i=this;_.isUndefined(e.view.topics_list_view)||_.isUndefined(e.view.topics_list_view.collection)||!_.isUndefined(e.view.topics_list_view.collection.topics_loading)&&e.view.topics_list_view.collection.topics_loading||AoPS.Community.Utils.cmty_ajax.cancelAll({cancel_type:"feed"}),this.revealSubfeedView(e),_.isNull(this.active_subfeed)?e.$button.addClass("feed-subfeed-button-selected"):this.active_subfeed.$button!==e.$button&&(this.active_subfeed.$button.removeClass("feed-subfeed-new-topic"),e.$button.addClass("feed-subfeed-button-selected")),this.active_subfeed=e,this.topic_cell_delete_listener=this.listenTo(Backbone,"topic_cell_marked_for_deletion",(function(e){i.active_subfeed.view.topics_list_view===e.topics_list&&i.active_subfeed.view.$(".feed-resort").show()}))}},revealSubfeedView:function(e){this.$topics_list.append(e.view.$el),e.view.hasOwnProperty("topics_list_view")&&"function"==typeof e.view.topics_list_view.onAddToFeed&&e.view.topics_list_view.onAddToFeed()},openFeed:function(e){var t=this;this.feed_animated||(this.activateSubfeed(e,this.animate_speed),this.feed_animated=!0,t.feed_open=!0,this.$el.addClass("feed-open",{duration:this.animate_speed,complete:function(){t.feed_animated=!1}}))},closeFeed:function(){var e=this;this.feed_animated||(AoPS.Community.Utils.cmty_ajax.cancelAll({cancel_type:"feed"}),_.isNull(this.active_subfeed)||this.active_subfeed.$button.removeClass("feed-subfeed-button-selected"),this.feed_animated=!0,this.$el.removeClass("feed-open",this.animate_speed,"swing",_.bind((function(){_.isNull(this.active_subfeed)||(this.closeSubfeed(this.active_subfeed),this.active_subfeed=null,e.feed_animated=!1)}),this)),this.model.set("focus_topic",null),this.feed_open=!1)},onClickResort:function(e){this.resortActiveSubfeed(),$(e.currentTarget).hide(),e.stopPropagation(),e.preventDefault()},resortActiveSubfeed:function(){_.isNull(this.active_subfeed)||(this.active_subfeed.view.topics_list_view.processUpdatedTopicVisibility(),this.active_subfeed.view.topics_list_view.setPopoutVisibility())},constructBookmarksSubfeed:function(){var i={$button:$("
    ",{id:"feed-bookmark-tab",text:"E",title:t["feed-tab-bookmark-title"],class:"feed-tab aops-font"}),name:"bookmarks",view:{}};i.view=new e.Bookmarks({model:this.model,feed_view:this,parent_subfeed_object:i}),this.$tabs.append(i.$button),i.$button.on("click",_.bind((function(){this.onButtonClick(i)}),this)),this.bookmark_subfeed=i},closeActiveTopicView:function(){this.active_topic_view.onRemoveFromFeed(),this.active_topic_view.$el.detach(),this.active_topic_view=null},cleanTopicWindow:function(){var e=!_.isNull(this.active_topic_view),t=this.model.get("focus_topic");this.$topic_loader.detach(),e&&this.closeActiveTopicView(),this.$topic.empty(),_.isNull(t)&&(this.$topic.hide(),$("body").off("mousedown.feed"))},throwTopicBlocker:function(){this.cleanTopicWindow(),this.openTopicWindow(),this.$topic.append(this.$topic_loader)},openTopicWindow:function(){var e=this;this.$topic.show(),this.$topic.data("draggable")||(this.$topic.is_dragged=!1,this.$topic.draggable({containment:"window",drag:function(){e.$topic.is_dragged=!0}}))},buildTopic:function(){var t,i,s=this,o=!1,c=!_.isNull(this.active_topic_view),n=this.model.get("focus_topic");this.cleanTopicWindow(),_.isNull(n)||(t=_.find(this.topic_views,(function(e){return e.model===n})),i={model:n,route_category_id:n.get("category_id"),reveal_type:this.model.get("focus_topic_show_from")},_.isUndefined(t)||t.route_category_id!==n.get("category_id")&&(this.topic_views=_.without(this.topic_views,t),t.close(),o=!0),(_.isUndefined(t)||o)&&(t=new e.TopicFull(i),this.topic_views.push(t)),this.active_topic_view=t,this.openTopicWindow(),c||$("body").on("mousedown.feed",(function(){AoPS.Ui.Modal.isModalVisible()||(_.isNull(s.model.get("focus_topic"))||(s.past_topic_id=s.model.get("focus_topic").get("topic_id")),s.model.set("focus_topic",null))})),this.$topic.append(this.active_topic_view.$el),this.active_topic_view.onAddToFeed(i))},onNewPageSubfeed:function(){this.has_page_feed||this.constructPageSubfeed(),this.setPageSubfeed(),this.page_subfeed.$button.removeClass("feed-subfeed-new-topic"),this.page_subfeed.view.hasOwnProperty("topics_list_view")&&(_.isUndefined(this.page_subfeed.view.topics_list_view.collection.findWhere({is_read:!1}))||this.page_subfeed.$button.addClass("feed-subfeed-new-topic"))},constructPageSubfeed:function(){var e=this;this.page_subfeed={$button:$("
    ",{id:"feed-page-tab",class:"feed-tab aops-font",text:"p",title:t["feed-tab-page-feed-title"]})},this.page_subfeed.$button.on("click",(function(){e.onButtonClick(e.page_subfeed)})),this.$tabs.find(".feed-tab").first().after(this.page_subfeed.$button),this.subfeeds.push(this.page_subfeed),this.page_subfeed_settings={category_id:0,tag_id:0,tag_text:""},this.page_subfeed_loader=this.constructPageSubfeedView(null,this.page_subfeed_settings),this.page_subfeed.view=this.page_subfeed_loader,this.has_page_feed=!0},constructPageSubfeedView:function(i,s){var o,c,n={header_text:t["feed-page-subfeed-header"],can_post:!1,can_post_title:"",re_sort_feed:t["feed-resort"],close_feed:t["feed-close"],has_settings:!1};return _.isNull(i)?((o=$('
    ').append(this.getTemplate("#feed-subfeed-header-tpl",n))).append(AoPS.Page.buildLoader()),c={$el:o,stopListening:function(){}}):((c=new e.Subfeed(_.defaults({model:i,tag_id:s.tag_id,subtitle:s.hasOwnProperty("subtitle")?s.subtitle:""},n))).filtered_list.topics_loading||0!==c.topics_list_view.collection.length||c.topics_list_view.fetchMoreTopics(),this.cachePageSubfeedView(c,s)),c},cachePageSubfeedView:function(e,t){var i=AoPS.Community.Views.convertToUrlFragment(t.tag_text);this.cached_page_subfeed_views[t.category_id+"-"+t.tag_id+"-"+i]=e,i.length>0&&t.tag_id>0&&(this.cached_page_subfeed_views[t.category_id+"-0-"+i]=e,this.cached_page_subfeed_views[t.category_id+t.tag_id+"-"]=e)},setPageSubfeed:function(){var e,t,i,s=this;this.isNewPageSubfeed()&&(this.removeSubfeedListeners(this.page_subfeed),this.page_subfeed.view.hasOwnProperty("$el")&&this.page_subfeed.view.$el.detach(),i=this.cleanPageSubfeedSettings(this.model.get("page_subfeed_settings")),t=this.fetchCachedPageSubfeed(i),_.isNull(t)?(e=this.community_master.fetchCategory(i.category_id),_.isUndefined(e)?(this.page_subfeed.view=this.page_subfeed_loader,i.tag_id>0||""===i.tag_text?this.community_master.buildCategory({category_id:i.category_id,onFinish:function(){s.setPageSubfeed()}}):this.community_master.buildCategoryAndTag({category_id:i.category_id,tag_text:i.tag_text,onFinish:function(e){i.tag_id=e.tag_id,s.model.set("page_subfeed_settings",i)}})):0===i.tag_id&&""!==i.tag_text?this.community_master.fetchTagId({tag_text:i.tag_text,onFinish:function(e){i.tag_id=e.tag_id,s.model.set("page_subfeed_settings",i)}}):this.page_subfeed.view=this.constructPageSubfeedView(e,i)):(this.page_subfeed.view=t,AoPS.Feed.setPageFeedSubtitle(i.hasOwnProperty("subtitle")?i.subtitle:"")),this.addSubfeedListeners(this.page_subfeed),this.active_subfeed===this.page_subfeed&&this.revealSubfeedView(this.page_subfeed))},isPageSubfeedOpen:function(){return this.feed_open&&this.isPageSubfeedActive()},isPageSubfeedActive:function(){return this.active_subfeed===this.page_subfeed},activatePageSubfeed:function(){this.feed_open?(this.isPageSubfeedActive()||_.isNull(this.active_subfeed)||this.closeSubfeed(this.active_subfeed),this.activateSubfeed(this.page_subfeed,0)):this.openFeed(this.page_subfeed)},isNewPageSubfeed:function(){var e=this.cleanPageSubfeedSettings(this.model.get("page_subfeed_settings")),t=this.cleanPageSubfeedSettings(this.page_subfeed_settings);return e.category_id!==t.category_id||(0===e.tag_id&&t.tag_id>0&&e.tag_text===t.tag_text&&(this.model.get("page_subfeed_settings").tag_id=t.tag_id),0===e.tag_id||t.tag_id?e.tag_text!==t.tag_text:e.tag_id!==t.tag_id)},cleanPageSubfeedSettings:function(e){return _.extend({category_id:0,tag_id:0,tag_text:""},e)},fetchCachedPageSubfeed:function(e){var t=AoPS.Community.Views.convertToUrlFragment(e.tag_text),i=e.category_id+"-"+e.tag_id+"-";if(0!==e.tag_id){if(this.cached_page_subfeed_views.hasOwnProperty(i))return this.cached_page_subfeed_views[i];if(i+=t,this.cached_page_subfeed_views.hasOwnProperty(i))return this.cached_page_subfeed_views[i]}return i=e.category_id+"-0-"+t,this.cached_page_subfeed_views.hasOwnProperty(i)?this.cached_page_subfeed_views[i]:null},onClose:function(){_.each(this.subfeeds,(function(e){e.view.close()})),_.each(_.properties(this.cached_page_subfeed_views),(function(e){e.close()}))}}),e.Subfeed=AoPS.View.extend({className:"cmty-subfeed",initialize:function(i){var s,o=i.hasOwnProperty("subtitle")&&i.subtitle.length>0,c=i.hasOwnProperty("tag_id")&&i.tag_id>0?[{tag_forum_id:this.model.get("category_id"),tag_id:i.tag_id}]:[];if(this.settings=i,this.community_master=this.model.get("master"),c.length>0){var n=(s=new AoPS.Community.Models.CategoryViewTags({category_id:0,master:this.community_master,permissions:this.model.get("permissions"),category_type:"view_tags",items:[{item_forum_id:c[0].tag_forum_id,item_id:c[0].tag_id}]})).get("active_topics");if(this.model.get("active_topics").each((function(e){e.hasTag(i.tag_id)&&n.add(e)})),AoPS.Feed.preload_feed_tag_id>0&&AoPS.Feed.preload_feed_tag_id===i.tag_id&&!_.isNull(AoPS.Feed.preloaded_topic)){var a=this.community_master.processPotentialNewTopics(AoPS.bootstrap_data.page_feed_preload_topics,!1);n.add(a),s.set("all_topics_loaded",AoPS.bootstrap_data.page_feed_all_topics_fetched)}this.filtered_list=this.community_master.fetchFilteredTopicList({category:s,category_id:0})}else this.filtered_list=this.community_master.fetchFilteredTopicList({category:this.model,category_id:this.model.get("category_id"),tag_ids:c});this.topics_list_view=new e.TopicsList({collection:this.filtered_list,main_color:this.model.get("main_color"),secondary_color:this.model.get("secondary_color"),category_id:0,master:this.community_master}),this.$el.append(this.getTemplate("#feed-subfeed-header-tpl",{header_text:i.header_text,can_post:!!i.hasOwnProperty("can_post")&&i.can_post,can_post_title:i.hasOwnProperty("can_post_title")?i.can_post_title:"",has_settings:!1,has_subtitle:o,close_feed:t["feed-close"],re_sort_feed:t["feed-re-sort"],subtitle:i.hasOwnProperty("subtitle")?i.subtitle:""})),o&&this.$el.addClass("cmty-subfeed-w-subtitle"),this.$el.append(this.topics_list_view.$el)},events:{"click .feed-new-topic":"onClickNewTopic"},onClickNewTopic:function(e){return this.settings.hasOwnProperty("onClickNewTopic")&&this.settings.onClickNewTopic(),e.stopPropagation(),e.preventDefault(),!1},onClose:function(){this.topics_list_view.close()}}),e.Bookmarks=AoPS.View.extend({subfeed_array:[],template_id:"#feed-bookmarks-tpl",className:"cmty-subfeed cmty-subfeed-w-subtitle",initialize:function(e){var i,s,o=this;for(this.parent_subfeed_object=e.parent_subfeed_object,this.feed_view=e.feed_view,this.feed_bookmark_categories=[],this.$el.html(this.getTemplate("#feed-subfeed-header-tpl",{header_text:t["feed-bookmarks-subfeed-header"],has_settings:!1})),this.$el.append(this.getTemplate(this.template_id,{forums_checked:1&this.model.get("feed_setting"),tags_checked:2&this.model.get("feed_setting"),topics_checked:4&this.model.get("feed_setting")})),this.$checkboxes=this.$el.find(":checkbox"),this.community_master=this.model.get("master"),this.feed_bookmark_categories[1]=this.buildFeedCategory("tag"),this.feed_bookmark_categories[2]=this.buildFeedCategory("topic"),this.feed_bookmark_categories[4]=this.buildFeedCategory("forum"),i=3;i<=7;i++)4!==i&&(s=[],_.each([1,2,4],(function(e){e&i&&s.push(o.feed_bookmark_categories[e])})),this.feed_bookmark_categories[i]=new AoPS.Community.Models.CategoryConglomeration({master:this.community_master,categories:s}));for(this.subfeed_array[0]={is_built:!0,topics_list_view:{$el:$('
    '+t["feed-no-bookmark-options-checked"]+"
    "),no_bookmarks_checked:!0}},i=1;i<=7;i++)this.subfeed_array[i]={is_built:!1};this.constructTopicsListView(this.model.get("feed_setting")),this.active_subfeed=this.subfeed_array[this.model.get("feed_setting")],this.$el.append(this.active_subfeed.topics_list_view.$el),this.topics_list_view=this.active_subfeed.topics_list_view,this.model.get("feed_setting")>0&&this.startListeningToActiveList()},constructTopicsListView:function(t){var i,s;s=this.community_master.constructTopicListFilter({category:this.feed_bookmark_categories[t]}),i=new AoPS.Community.Models.TopicList({category:this.feed_bookmark_categories[t],master:this.community_master,tag_ids:[],filter:s}),this.subfeed_array[t].filtered_list=i.get("filtered_topic_list"),this.subfeed_array[t].topics_list_view=new e.TopicsListBookmarks({collection:this.subfeed_array[t].filtered_list,main_color:this.feed_bookmark_categories[t].get("main_color"),secondary_color:this.feed_bookmark_categories[t].get("secondary_color"),category_id:0,master:this.community_master}),this.subfeed_array[t].is_built=!0},events:{"click :checkbox":"onCheckboxClick"},onCheckboxClick:function(e){for(var t=0,i=this.$checkboxes,s=0;s<=2;s++)i[s].checked&&(t+=parseInt(i[s].value));this.model.set("feed_setting",t),this.onBookmarkSettingChange()},onBookmarkSettingChange:function(){var e=this.model.get("feed_setting");this.$(".feed-resort").hide(),this.stopListening(this.active_subfeed.filtered_list),this.active_subfeed.topics_list_view.on_page=!1,this.active_subfeed.topics_list_view.$el.detach(),this.active_subfeed.topics_list_view.hasOwnProperty("no_bookmarks_checked")&&this.active_subfeed.topics_list_view.no_bookmarks_checked||(this.active_subfeed.topics_list_view.processUpdatedTopicVisibility(),this.model.set("focus_topic",null)),this.subfeed_array[e].is_built||this.constructTopicsListView(e),this.active_subfeed=this.subfeed_array[e],e>0&&(this.active_subfeed.filtered_list.category.hasItems()?this.active_subfeed.topics_list_view.onAddToFeed():(this.active_subfeed.topics_list_view.on_page=!0,this.active_subfeed.topics_list_view.appendNoMoreTopicsMessage())),this.$el.append(this.active_subfeed.topics_list_view.$el),this.topics_list_view=this.active_subfeed.topics_list_view,e>0&&this.startListeningToActiveList()},startListeningToActiveList:function(){var e=this;this.listenTo(this.active_subfeed.filtered_list,"add",(function(t){e.feed_view.active_subfeed!==e.parent_subfeed_object&&(t.get("is_read")||e.parent_subfeed_object.$button.addClass("feed-subfeed-new-topic"))})),this.listenTo(this.active_subfeed.filtered_list,"change:is_read",(function(t){AoPS.Feed.Views.processFeedTopicIsReadChange({topic:t,list:e.active_subfeed.filtered_list,$button:e.parent_subfeed_object.$button})}))},buildFeedCategory:function(e){var t,i,s=this.community_master.get("bookmarked_"+e+"_category");return i={category_type:"topic"===e?"feed_topics":"view_"+e+"s",items:_.filter(s.get("items"),(function(e){return e.hasOwnProperty("in_feed")&&1===e.in_feed}))},"topic"===e&&(i.bookmark_topic_category_id=this.community_master.get("bookmarked_topic_category").get("category_id")),(t=this.community_master.constructNewCategory(i)).listenTo(s,"item_added",_.bind((function(e){e.in_feed&&this.addItem(e)}),t)),t.listenTo(s,"item_removed",_.bind((function(e){e.in_feed&&this.removeItem(e)}),t)),t}}),e.TopicFull=AoPS.Community.Views.TopicFull.extend({template_id:"#feed-topic-full-tpl",viewing_source:"feed",scrollbar_settings:{autosize:!1},initialize:function(e){this.feed=this.model.get("master").get("feed"),AoPS.Community.Views.TopicFull.prototype.initialize.apply(this,[e])},onClickClose:function(e){this.feed.set("focus_topic",null),this.fullscreen_triggered_by_reply=!1,this.model.get("master").set("fullscreen_mode","none"),this.is_full_reply=!1,$(window).trigger("resize"),e.stopPropagation(),e.preventDefault()},onAddToFeed:function(e){this.onAddToPage(e)},onDelete:function(){var e=arguments.length>1&&arguments[2].hasOwnProperty("deleted_by_me")&&arguments[2].deleted_by_me;this.model.get("deleted")&&this.feed.get("focus_topic")===this.model&&(e?AoPS.Ui.Modal.closeAllModals():AoPS.Ui.Modal.showAlert(t["feed-topic-full-message-deleted"]),this.close(),this.feed.set("focus_topic",null))},onClickFullReply:function(){"feed"===this.model.get("master").get("fullscreen_mode")?this.completeReplyClick("full"):this.onClickReply()},onClickFullScreen:function(){this.performFullScreenEvents(!1)},performFullScreenEvents:function(e){var t="none"===this.model.get("master").get("fullscreen_mode")?"feed":"none";this.model.get("master").set("fullscreen_mode",t),"none"===this.model.get("master").get("fullscreen_mode")?(this.is_full_reply=!1,AoPS.Community.Views.removeFullReplyStyle()):(this.is_full_reply=!0,AoPS.Community.Views.setFullReplyStyle()),this.model.get("master").get("feed").trigger(undefined),$(window).trigger("resize")},doExtraInitialization:function(){this.$el.find(".feed-topic-forum").css({"background-color":this.model.get("category_main_color"),color:this.model.get("category_secondary_color")}),this.$category_top=this.$el.find(".feed-topic-forum"),this.listenTo(this.feed,"change:focus_topic_show_from change:focus_topic",this.parseFeedFocusChange)},parseFeedFocusChange:function(){this.model===this.feed.get("focus_topic")&&(this.reveal_type=this.feed.get("focus_topic_show_from"),this.setInitialPostBoxLocation())},setArchiveStatus:function(){this.hasOwnProperty(this.$archive_status)||(this.$archive_status=$(''),this.$(".cmty-topic-bookmark").replaceWith(this.$archive_status)),this.$archive_status.append('('),this.$archive_status[0].title=t["private-archive-topic"]},completeParticipantStatusChange:function(){var e=this.model.get("master");this.feed.set("focus_topic",null),e.get("my_privates").trigger("check_for_more_topics")},onRemoveFromFeed:function(){this.onRemoveFromPage()},removeFocusListener:function(){this.stopListening(this.feed,"change:focus_topic")},setFocusListener:function(){this.listenTo(this.feed,"change:focus_topic",this.onChangeFocusTopic)},fetchFocusTopic:function(){return this.feed.get("focus_topic")}}),e.TopicCell=AoPS.Community.Views.TopicCell.extend({full_topics_popup:!0,in_feed:!0,events:{click:"onClickTopic","click .cmty-topic-cell-jump-to-bottom":"onClickJumpToBottom","click .cmty-topic-cell-close-topic":"onClickClose","click .cmty-topic-cell-goto-unread":"onClickGoToUnread","click .cmty-topic-cell-post a":"onClickLinkInCell"},onClickTopic:function(e){if(e.ctrlKey||e.metaKey)return"user_search_topics"===this.topic_list.collection.category.get("category_type")?this.onClickMyTopicsCell(e):this.openInNewTab(),void e.stopPropagation();this.master.get("feed").set({focus_topic_show_from:"show_from_start",focus_topic:this.model}),e.stopPropagation()},onClickMyTopicsCell:function(e){var s,o=this;s=i.formatString(t["feed-my-topics-onclick"],[e.ctrlKey?t["control-click"]:t["command-click"]]),AoPS.Ui.Modal.showButtons(s,[{text:t["feed-my-topics-open-new"],value:1},{text:t["feed-my-topics-remove"],value:0}],(function(e){1===e?o.openInNewTab():(o.model.setMyStatus({status:"removed"}),o.topic_list.collection.remove(o.model))}),{width:"450px"}),e.stopPropagation()},openInNewTab:function(){var e="/c"+this.model.get("category_id")+"h"+this.model.get("topic_id");window.open("/community"+e,"_blank")},onClickLinkInCell:function(e){e.preventDefault()},onClickClose:function(e){return this.master.get("feed").set("focus_topic",null),e.stopPropagation(),!1},onClickJumpToBottom:function(e){this.master.get("feed").set({focus_topic_show_from:"show_from_end",focus_topic:this.model}),e.stopPropagation(),e.preventDefault()},onClickGoToUnread:function(e){this.master.get("feed").set({focus_topic_show_from:"show_unread",focus_topic:this.model}),e.stopPropagation(),e.preventDefault()},setFocusWatchBehavior:function(){this.listenTo(this.model,"change:is_feed_focus",this.checkFocusTopic),this.checkFocusTopic()},checkFocusTopic:function(){this.is_focus=this.model.get("is_feed_focus"),this.processFocusTopicStatusChange()}}),e.TopicCellPopout=e.TopicCell.extend({parent:e.TopicCell,buildTopic:AoPS.Community.Views.TopicCellPopout.prototype.buildTopic,createStuntDouble:function(){var e=this;AoPS.Community.Views.TopicCellPopout.prototype.createStuntDouble.apply(this),this.$stunt_double.find(".cmty-topic-cell-jump-to-bottom").on("click",(function(t){e.onClickJumpToBottom(t)})),this.$stunt_double.find(".cmty-topic-cell-close-topic").on("click",(function(t){e.onClickClose(t)})),this.$stunt_double.on("click",(function(t){e.onClickTopic(t)}))},constructWatchersLine:AoPS.Community.Views.TopicCellPopout.prototype.constructWatchersLine,onClose:function(){this.$stunt_double.remove()}}),e.TopicsList=AoPS.Community.Views.TopicsList.extend({fetch_topics_on_build:!1,list_location:"feed",topicView:e.TopicCell,popoutView:e.TopicCellPopout,onAddToFeed:function(){this.on_page=!0,this.checkQueuedUpTopicBoxes(),this.parseFocusTopic(),this.setFocusListener(),this.checkMoreTopicsNeeded(),this.checkIfEnoughCells()},setFocusListener:function(){this.listenTo(this.master.get("feed"),"change:focus_topic",this.parseFocusTopic)},processUpdatedTopicVisibility:AoPS.Community.Views.TopicsList.prototype.processUpdatedTopicVisibility,getFocusTopic:function(){return this.master.get("feed").get("focus_topic")}}),e.TopicsListBookmarks=e.TopicsList.extend({initialize:function(e){AoPS.Community.Views.TopicsList.prototype.initialize.apply(this,[e]),this.$nothing_bookmarked=$('
    '+t["topics-list-nothing-bookmarked"]+"
    ")},onCollectionReset:function(){this.$nothing_bookmarked.detach(),AoPS.Community.Views.TopicsList.prototype.onCollectionReset.apply(this)},appendNoMoreTopicsMessage:function(){this.$loader.detach(),this.collection.length>0?(this.$nothing_bookmarked.detach(),this.$topics_box.append(this.$no_more_topics)):(this.$no_more_topics.detach(),this.$topics_box.append(this.$nothing_bookmarked))}}),e.NewTopic=AoPS.Community.Views.NewTopic.extend({onPostedNewTopic:function(e){e.topic.has("linked_tag_removed")&&e.topic.get("linked_tag_removed")?(this.model.get("master").get("feed").set("focus_topic",e.topic),AoPS.Feed.activateGlobalSubfeed()):(AoPS.Feed.openPageFeed({category_id:this.model.get("category_id"),tag_text:this.settings.hasOwnProperty("filter_tag")?this.settings.filter_tag:this.settings.target_url,subtitle:this.settings.hasOwnProperty("subtitle")?this.settings.subtitle:"",force_open:!0}),this.model.get("master").get("feed").set("focus_topic",e.topic)),"function"==typeof this.settings.onSuccess&&this.settings.onSuccess(e)}}),e.NewPrivateConversation=AoPS.Community.Views.NewPrivateConversation.extend({onPostedNewTopic:function(e){var i=this.model.get("master");"private"===e.topic.get("topic_type")&&i.get("current_user").get("pm_archive_on_send")?s.display(t["new-topic-pm-archived"]):i.get("feed").set("focus_topic",e.topic)}}),e}(AoPS.Feed.Views||{}); ;//# sourceMappingURL=cmty_core.js.map