From fcb4289c5b26df5f4f3229abe5263c27de0191f9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 13 Jun 2017 10:14:11 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=85=B3=E5=8D=A1=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E7=BC=96=E8=BE=91=E5=85=A5=E5=8F=A3=E8=AF=B7?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E4=B8=BA=E9=86=92=E7=9B=AE=E7=9A=84=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/show.html.erb | 3 ++- public/editormd/editormd.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/challenges/show.html.erb b/app/views/challenges/show.html.erb index 9541a0b60..92d1a2b01 100644 --- a/app/views/challenges/show.html.erb +++ b/app/views/challenges/show.html.erb @@ -27,7 +27,8 @@

第<%= @challenge.position %>关<%= @challenge.subject %>

- + + 编辑

diff --git a/public/editormd/editormd.js b/public/editormd/editormd.js index ffd7e8b73..d9c3443a2 100644 --- a/public/editormd/editormd.js +++ b/public/editormd/editormd.js @@ -1502,7 +1502,7 @@ var tex = $(this); editormd.$katex.render(tex.text(), tex[0]); - tex.find(".katex").css("font-size", "1.6em"); + tex.find(".katex").css("font-size", "1.0em"); }); return this; @@ -4015,7 +4015,7 @@ div.find("." + editormd.classNames.tex).each(function(){ var tex = $(this); katex.render(tex.html().replace(/</g, "<").replace(/>/g, ">"), tex[0]); - tex.find(".katex").css("font-size", "1.6em"); + tex.find(".katex").css("font-size", "1.0em"); }); }; From 841c334c33d77fa373014bdc5ec504f0423c703f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 13 Jun 2017 10:22:09 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84tab=E6=A0=B7=E5=BC=8F=E4=B8=8E=E2=80=9C=E6=88=91?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E8=AE=AD=E2=80=9D=E4=BF=9D=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_edu_user_watch_fan_list.html.erb | 4 ++-- app/views/users/show.html.erb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/users/_edu_user_watch_fan_list.html.erb b/app/views/users/_edu_user_watch_fan_list.html.erb index 9249dd3af..1fa49861a 100644 --- a/app/views/users/_edu_user_watch_fan_list.html.erb +++ b/app/views/users/_edu_user_watch_fan_list.html.erb @@ -4,12 +4,12 @@ <%= str %>的关注 <%= @user_watchlist_count %> - + <%= str %>的粉丝 <%= @user_fanlist_count %> - +

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index f58a167d8..ea2ee1b82 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -194,12 +194,12 @@

<% str = current_user ? '' : 'TA的' %> <% if @courses_count == 0 %> - 实训<%= @shixuns_count %> + 实训<%= @shixuns_count %> <% elsif @shixuns_count == 0 %> - 课堂<%= @courses_count %> + 课堂<%= @courses_count %> <% else %> - 课堂<%= @courses_count %> - 实训<%= @shixuns_count %> + 课堂<%= @courses_count %> + 实训<%= @shixuns_count %> <% end %>

From 7e8eb7eae529a334cca046ecc6f914a52387cc7a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 13 Jun 2017 14:45:11 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=88=91=E7=9A=84=E7=95=99=E8=A8=80?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8E=BB=E6=8E=89=E5=B7=A6=E4=BE=A7=E6=A0=8F?= =?UTF-8?q?=EF=BC=8C=E6=8A=8A=E7=95=99=E8=A8=80=E6=8F=90=E4=B8=8A=E6=9D=A5?= =?UTF-8?q?=EF=BC=8C1200=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/views/layouts/edu_new_base_user.html.erb | 139 +++++++ app/views/layouts/new_base_user.html.erb | 370 +++++++++--------- app/views/users/_message_replies.html.erb | 4 +- .../users/_user_journal_post_reply.html.erb | 6 +- .../users/_user_journalsformessage.html.erb | 10 +- app/views/users/_wide_reply_banner.html.erb | 32 ++ app/views/users/user_newfeedback.html.erb | 4 +- public/stylesheets/css/public.css | 1 + public/stylesheets/css/structure.css | 9 + 10 files changed, 380 insertions(+), 197 deletions(-) create mode 100644 app/views/layouts/edu_new_base_user.html.erb create mode 100644 app/views/users/_wide_reply_banner.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d7e4af7ab..ee6a276da 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1729,7 +1729,7 @@ class UsersController < ApplicationController # end # end @state = false - render :layout=>'new_base_user' + render :layout => 'edu_new_base_user' end #给某人留言 diff --git a/app/views/layouts/edu_new_base_user.html.erb b/app/views/layouts/edu_new_base_user.html.erb new file mode 100644 index 000000000..747eb70b4 --- /dev/null +++ b/app/views/layouts/edu_new_base_user.html.erb @@ -0,0 +1,139 @@ + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-popup','css/edu-common', "css/edu-public",'css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user','css/font-awesome', :media => 'all' %> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + + + + + + + +
+
+ <% is_current_user = User.current.logged? && User.current == @user %> + <% if User.current.logged? %> + <%= render :partial => 'layouts/logined_header' %> + <% else%> + <%= render :partial => 'layouts/unlogin_header' %> + <% end%> +
+ +
+
+
+
+ <%= yield %> +
+
+ +
+ <%= render :partial => 'layouts/footer' %> +
+ + + + +
+ + + \ No newline at end of file diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 91ca49038..1bd24ce86 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -77,198 +77,200 @@
-
-
-
- <% if User.current.logged? && User.current == @user %> + <% if params[:action] != "user_newfeedback" %> +
+
+
+ <% if User.current.logged? && User.current == @user %> <%= link_to image_tag(url_to_avatar(@user),width:"238", height: "200", :id => 'nh_source_tx'), my_clear_user_avatar_temp_path, :remote => true %> - <% else %> + <% else %> <%=image_tag(url_to_avatar(@user),width:"238", height: "200", :id=>'nh_source_tx') %> - <% end %> -
-
-

- <%= link_to @user.show_name, user_path(@user), :class => "mb5 fontGrey3" %> - <% if @user.user_extensions && @user.user_extensions.identity %> - (<%= get_user_roll @user %>) - <% end%> - <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> - - <% end %> -

-

<%= @user.login %>

-

- <% if !@user.user_extensions.school_id.blank? %> - <%= @user.user_extensions.school.name %> - <% end %> -

- -
    -
  • - 博客 - <%= @user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %> -
  • -
  • - 关注 - <%= User.watched_by(@user).count %> -
  • -
  • - 粉丝 - <%= @user.watcher_users.count %> -
  • -
-
- <% if User.current.logged?%> - <% if User.current == @user %> - <%= link_to '个人主页', homepage_user_path(@user), :class => "home-big-btn-grey", :target => '_blank' %> - <% else %> - <% if(@user.watched_by?(User.current)) %> - <%= link_to "取消关注", - watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id), - :class => "home-btn-grey fl mr12", - :method => "delete", - :remote => "true", - :title => "取消关注" %> - <% else %> - <%= link_to "添加关注", - watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id), - :class => "home-btn-grey fl mr12", - :method => "post", - :remote => "true", - :title => "添加关注" %> - <% end %> - <% if @user.base_homepage.nil? %> - TA的主页 - <% else %> - <%= link_to "TA的主页", homepage_user_path(@user.login), :class => 'home-btn-grey fl', :target => '_blank' %> - <% end %> - <% end %> <% end %>
-
- <% if is_current_user %> - <% if hidden_unproject_infos && user_course_count > 0 %> -
-

- <%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %> -

- <%# if hidden_unproject_infos %> -
    -
  • - <%= link_to user_course_count > 0 ? "课程#{user_course_count}".html_safe : "课程", - user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %> -
  • - <% if user_manage_homework_count > 0 %> -
  • - <%= link_to user_manage_homework_count > 0 ? "我发布的作业#{user_manage_homework_count}".html_safe : "我发布的作业", - user_manage_homeworks_user_path(@user), :target => "_blank" %> -
  • - <% end %> - <% if user_receive_homework_count > 0 %> -
  • - <%= link_to "我收到的作业#{user_receive_homework_count}".html_safe, - user_receive_homeworks_user_path(@user), :target => "_blank" %> -
  • - <% end %> -
  • - <%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %> -
  • -
  • - <%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank", :class => "fl", :style => "color:#666" %> -
  • -
- <%# end %> -
- <% end %> - <% if user_project_count > 0%> -
-

- <%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %> -

-
    -
  • - <%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目", - user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %> -
  • - <% if issues_author_is_self_count > 0 %> -
  • - <%= link_to issues_author_is_self_count > 0 ? "我发布的issue#{issues_author_is_self_count}".html_safe : "我发布的issue", - user_manage_issues_user_path(@user), :target => "_blank" %> -
  • - <% end %> - <% if issues_assigned_is_self_count > 0 %> -
  • - <%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue#{issues_assigned_is_self_count}".html_safe : "我收到的issue", - user_receive_issues_user_path(@user), :target => "_blank" %> -
  • - <% end %> -
-
- <% end %> - <% if hidden_unproject_infos && user_contest_count > 0 %> -
-

- <%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%> -

-
    -
  • - <%= link_to user_contest_count > 0 ? "竞赛#{user_contest_count}".html_safe : "竞赛", - user_contest_community_path(User.current), :id => "user_contest_list", :target => "_blank" %> -
  • -
- <%# end %> -
- <% end %> - <% else %> -
-

Ta在确实 - <%= time_tag(@user.created_on).html_safe %> -

-
    - <% if hidden_unproject_infos && user_course_count > 0 %> -
  • - <%= link_to user_course_count > 0 ? "课程#{user_course_count}".html_safe : "课程", - user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %> -
  • - <% end %> - <% if user_project_count > 0 %> -
  • - <%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目", - user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %> -
  • - <% end %> - <% if hidden_unproject_infos && user_contest_count > 0 %> -
  • - <%= link_to user_contest_count > 0 ? "竞赛#{user_contest_count}".html_safe : "竞赛", - user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %> -
  • - <% end %> -
+
+

+ <%= link_to @user.show_name, user_path(@user), :class => "mb5 fontGrey3" %> + <% if @user.user_extensions && @user.user_extensions.identity %> + (<%= get_user_roll @user %>) + <% end%> + <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> + + <% end %> +

+

<%= @user.login %>

+

+ <% if !@user.user_extensions.school_id.blank? %> + <%= @user.user_extensions.school.name %> + <% end %> +

+ +
    +
  • + 博客 + <%= @user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %> +
  • +
  • + 关注 + <%= User.watched_by(@user).count %> +
  • +
  • + 粉丝 + <%= @user.watcher_users.count %> +
  • +
+
+ <% if User.current.logged?%> + <% if User.current == @user %> + <%= link_to '个人主页', homepage_user_path(@user), :class => "home-big-btn-grey", :target => '_blank' %> + <% else %> + <% if(@user.watched_by?(User.current)) %> + <%= link_to "取消关注", + watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id), + :class => "home-btn-grey fl mr12", + :method => "delete", + :remote => "true", + :title => "取消关注" %> + <% else %> + <%= link_to "添加关注", + watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id), + :class => "home-btn-grey fl mr12", + :method => "post", + :remote => "true", + :title => "添加关注" %> + <% end %> + <% if @user.base_homepage.nil? %> + TA的主页 + <% else %> + <%= link_to "TA的主页", homepage_user_path(@user.login), :class => 'home-btn-grey fl', :target => '_blank' %> + <% end %> + <% end %> + <% end %>
- <% end %> -
-
    -
  • - <%= link_to "留言", feedback_path(@user, :host=> Setting.host_user)%> -
  • -
-
+
+ <% if is_current_user %> + <% if hidden_unproject_infos && user_course_count > 0 %> +
+

+ <%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %> +

+ <%# if hidden_unproject_infos %> +
    +
  • + <%= link_to user_course_count > 0 ? "课程#{user_course_count}".html_safe : "课程", + user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %> +
  • + <% if user_manage_homework_count > 0 %> +
  • + <%= link_to user_manage_homework_count > 0 ? "我发布的作业#{user_manage_homework_count}".html_safe : "我发布的作业", + user_manage_homeworks_user_path(@user), :target => "_blank" %> +
  • + <% end %> + <% if user_receive_homework_count > 0 %> +
  • + <%= link_to "我收到的作业#{user_receive_homework_count}".html_safe, + user_receive_homeworks_user_path(@user), :target => "_blank" %> +
  • + <% end %> +
  • + <%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %> +
  • +
  • + <%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank", :class => "fl", :style => "color:#666" %> +
  • +
+ <%# end %> +
+ <% end %> + <% if user_project_count > 0%> +
+

+ <%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %> +

+
    +
  • + <%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目", + user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %> +
  • + <% if issues_author_is_self_count > 0 %> +
  • + <%= link_to issues_author_is_self_count > 0 ? "我发布的issue#{issues_author_is_self_count}".html_safe : "我发布的issue", + user_manage_issues_user_path(@user), :target => "_blank" %> +
  • + <% end %> + <% if issues_assigned_is_self_count > 0 %> +
  • + <%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue#{issues_assigned_is_self_count}".html_safe : "我收到的issue", + user_receive_issues_user_path(@user), :target => "_blank" %> +
  • + <% end %> +
+
+ <% end %> + <% if hidden_unproject_infos && user_contest_count > 0 %> +
+

+ <%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%> +

+
    +
  • + <%= link_to user_contest_count > 0 ? "竞赛#{user_contest_count}".html_safe : "竞赛", + user_contest_community_path(User.current), :id => "user_contest_list", :target => "_blank" %> +
  • +
+ <%# end %> +
+ <% end %> + <% else %> +
+

Ta在确实 + <%= time_tag(@user.created_on).html_safe %> +

+
    + <% if hidden_unproject_infos && user_course_count > 0 %> +
  • + <%= link_to user_course_count > 0 ? "课程#{user_course_count}".html_safe : "课程", + user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %> +
  • + <% end %> + <% if user_project_count > 0 %> +
  • + <%= link_to user_project_count > 0 ? "项目#{user_project_count}".html_safe : "项目", + user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %> +
  • + <% end %> + <% if hidden_unproject_infos && user_contest_count > 0 %> +
  • + <%= link_to user_contest_count > 0 ? "竞赛#{user_contest_count}".html_safe : "竞赛", + user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %> +
  • + <% end %> +
+
+ <% end %> +
+
    +
  • + <%= link_to "留言", feedback_path(@user, :host=> Setting.host_user)%> +
  • +
+
- <%# 更新访问数,刷新的时候更新访问次数 %> - <% update_visiti_count @user %> -
-
    - <% unless @user.user_extensions.location.blank? %> -
  • - <%= @user.user_extensions.location %>-<%= @user.user_extensions.location_city %> -
  • - <% end %> -
  • <%= @user.created_on.strftime('%Y-%m-%d') %>开始使用
  • -
  • <%= @user.visits.to_i %>次访问(自2016年5月)
  • -
+ <%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @user %> +
+
    + <% unless @user.user_extensions.location.blank? %> +
  • + <%= @user.user_extensions.location %>-<%= @user.user_extensions.location_city %> +
  • + <% end %> +
  • <%= @user.created_on.strftime('%Y-%m-%d') %>开始使用
  • +
  • <%= @user.visits.to_i %>次访问(自2016年5月)
  • +
+
-
+<% end %>
<%= yield %>
diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb index 78f05a40e..56a962e1b 100644 --- a/app/views/users/_message_replies.html.erb +++ b/app/views/users/_message_replies.html.erb @@ -6,11 +6,11 @@ autoUrl('reply_content_<%= comment.id %>'); }); -
  • +
  • <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user) %>
    -
    +
    <%= render :partial => 'users/message_contents', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id}%> <% if !comment.content_detail.blank? %> diff --git a/app/views/users/_user_journal_post_reply.html.erb b/app/views/users/_user_journal_post_reply.html.erb index 07bfc9ad1..3484d75a8 100644 --- a/app/views/users/_user_journal_post_reply.html.erb +++ b/app/views/users/_user_journal_post_reply.html.erb @@ -1,7 +1,7 @@ <% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %> <% count = all_replies.count %> <% no_children_comments = get_no_children_comments all_replies %> -<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :expand_more =>no_children_comments[:three_more]} %> +<%= render :partial => 'users/wide_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :expand_more =>no_children_comments[:three_more]} %> <% if count > 0 %>
    @@ -9,9 +9,9 @@
    <% end %> -
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
    -
    +
    <% if User.current.logged? %>
    <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index e200a275d..a00601f81 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -1,10 +1,10 @@ -
    -
    +
    +
    <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
    -
    +
    <%= link_to activity.user.show_name, user_path(activity.user), :class => "newsBlue mr15" %> TO @@ -30,7 +30,7 @@ <% else %> <% content = activity.notes %> <% end %> - <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> + <%= render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
    @@ -63,7 +63,7 @@
    -
    +
    <%=render :partial => 'users/user_journal_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
    diff --git a/app/views/users/_wide_reply_banner.html.erb b/app/views/users/_wide_reply_banner.html.erb new file mode 100644 index 000000000..6cf13e118 --- /dev/null +++ b/app/views/users/_wide_reply_banner.html.erb @@ -0,0 +1,32 @@ +
    +
    + 回复 + ︿ + <%= count>0 ? "(#{count})" : "" %> + + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + +
    +
    <%#= format_date(activity.updated_on) %>
    + <%if expand_more %> +
    + <% if activity.class.to_s == 'HomeworkCommon' || activity.class.to_s == 'Work' %> + + 展开更多 + + <% elsif activity.class.to_s == 'Message' %> + + 展开更多 + + <% elsif activity.class.to_s == 'BlogComment' %> + + 展开更多 + + <% else %> + + 展开更多 + + <% end %> +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index f5f6bf382..77433df02 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,5 +1,5 @@
    -
    +
    留言
    • @@ -13,7 +13,7 @@
    -
    +
    <% unless is_current_user %>
    <%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %>
    diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 336213a08..0ead0403b 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -9,6 +9,7 @@ .wrap-big {width:980px; background:#fff; padding:10px; margin-bottom:10px;} /*资源库*/ .resources {width:973px; background-color:#ffffff; padding:15px; float: right;} +.eduResources {width:1200px; background-color:#ffffff; padding:15px; margin: 0 auto;} .resourcesBanner {width:730px; height:40px; background-color:#eaeaea; margin-bottom:10px;} .bannerName {background:#3b94d6; color:#ffffff; height:40px; line-height:40px; width:90px; text-align:center; font-weight:normal; vertical-align:middle; font-size: 16px; float:left;} .resourcesSelect {width:30px; height:24px; float:right; position:relative; margin-top:-6px;} diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 635a126e8..33f9dc178 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -182,8 +182,10 @@ a.homepageTypeUApply {background:url(/images/homepage_icon.png) -91px -582px no- a.postTypeGrey {color:#888888;} a.postTypeGrey:hover {color:#3b94d6;} .homepagePostBrief {width:965px; margin:0px auto; position:relative;} +.eduHomepagePostBrief {width:1200px; margin:0px auto; position:relative;} .homepagePostPortrait {float:left; width:50px;} .homepagePostDes {float:left; width:890px; margin-left:15px; } +.eduHomepagePostDes {float:left; width:92%; margin-left:15px; } .homepagePostTo {font-size:14px; color:#484848; margin-bottom:5px; margin-right: 20px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:5px; font-weight:bold;} .homepagePostSubmitContainer {height:25px; margin-top: 8px; margin-bottom: 5px;} @@ -198,13 +200,16 @@ a.postTypeGrey:hover {color:#3b94d6;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;} .homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;} .homepagePostReply {width:965px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} +.eduHomepagePostReply {width:1200px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} .homepagePostReplyBanner {width:963px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} +.eduhomepagePostReplyBanner {width: 99.8%; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} .borderBottomNone {border-bottom:none !important;} .topBorder {border-top: 1px solid #e4e4e4;} .homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:15px;} .homepagePostReplyBannerTime{width:85px; display:inline-block;} .homepagePostReplyBannerMore{width:315px; display:inline-block; text-align:right; float:right; padding-right:15px;} .homepagePostReplyInputContainer {width:880px; float:left;} +.eduHomepagePostReplyInputContainer {width:92%; float:left;} .homepagePostReplyInput {width:663px; height:45px; max-width:663px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:20px auto 10px auto;} .homepagePostReplyEmotion {background:url(../images/homepage_icon.png) -90px -88px no-repeat; width:50px; height:24px; float:left; padding-left:30px;} .homepagePostReplySubmit {float:right; width:45px; height:24px; text-align:center; line-height:24px; vertical-align:middle; font-size:12px; color:#ffffff; background-color:#3b94d6;} @@ -217,6 +222,7 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostReplyInputContainer2 {width:595px; margin:0px auto;} .homepagePostReplyInput2 {width:588px; height:45px; max-width:588px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:0px auto 10px auto;} .homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:930px; margin:0px auto; margin-top:15px; min-height:50px;} +.eduhomepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:98%; margin:0px auto; padding:10px; min-height:50px;} .homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} .homepagePostSetting ul li:hover ul {display:block;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} @@ -233,6 +239,7 @@ a.postOptionLink2:hover {color:#ffffff; background-color:#3b94d6;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:880px; margin-left:15px;} +.eduHomepagePostReplyDes {float:left; width: 92%; margin-left:15px;} .homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;} .homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family:"微软雅黑","宋体";} .homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 40px;} @@ -284,6 +291,7 @@ a:hover.qx_btn{color:#3b94d6;} .homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} .homepageLeft-new {width:240px; margin-bottom:10px;} .homepageRight {width:1010px; float:left; margin-top:10px; margin-bottom:10px;} +.eduHomepageRight {width:100%; margin-top:10px; margin-bottom:10px;} .homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;} .homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;} .homepagePortraitImage:hover {border:1px solid #3b94d6;} @@ -323,6 +331,7 @@ a.homepageMenuControl {float:left; width:180px;} .homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;} .homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;} .homepageRightBanner {width:975px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px;border-bottom:1px solid #eee; } +.eduhomepageRightBanner {width:1200px; margin:0px auto; height:30px; background-color: #ffffff; padding:10px 15px;border-bottom:1px solid #eee; } .homepagetopBanner {width:750px; height: 100px; margin:0px auto; float:right; background-color: #90C5EC; border:1px solid #dddddd;} .homepageRightBannerImg{width:1000px; margin:0px auto; height: 60px; margin-top: 10px; background:url(/images/TeachersDay.jpg)} a.homepageWhite {color:#ffffff;} From 5c071fe2362f24c4423b97bbdaf12e0c4dcd5b40 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 13 Jun 2017 17:22:42 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E6=90=9C=E7=B4=A2=E6=A1=86=E5=88=A0=E9=99=A4=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97=E5=90=8E=E7=82=B9=E5=87=BB=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8D=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 2 +- app/views/shixuns/search.js.erb | 2 +- public/javascripts/application.js | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index c36337ab7..75d96696a 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -160,7 +160,7 @@ <% end %>
  • - +
    <% if params[:action] == "edit" && @challenge_tags.count > 0 %> <% @challenge_tags.each do |tag| %> diff --git a/app/views/shixuns/search.js.erb b/app/views/shixuns/search.js.erb index 2d9ed58bc..96bf2c9ef 100644 --- a/app/views/shixuns/search.js.erb +++ b/app/views/shixuns/search.js.erb @@ -7,4 +7,4 @@ $("#shixuns_index_status_2").attr('href','<%= search_shixuns_path(:status => 2, $("#shixuns_index_status_3").attr('href','<%= search_shixuns_path(:status => 3, :language => @language, :search => @search, :order => @order) %>'); $("#shixuns_index_status_4").attr('href','<%= search_shixuns_path(:status => 4, :language => @language, :search => @search, :order => @order) %>'); $("#shixuns_index_status_5").attr('href','<%= search_shixuns_path(:status => 5, :language => @language, :search => @search, :order => @order) %>'); -$("#add_collaborators_form").attr('action','<%= search_shixuns_path(:status => @status, :language => @language, :search => @search, :order => @order) %>'); +$("#add_collaborators_form").attr('action','<%= search_shixuns_path(:status => @status, :language => @language, :order => @order) %>'); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 320f8626b..de92bd57f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1812,7 +1812,6 @@ function pop_box_new2(value, Width, Height){ }); $("#popupWrap input, #popupWrap textarea, #popupWrap ul, #popupWrap a").mousedown(function(event){ event.stopPropagation(); - new Drag("popupWrap"); }); } From bacaa8d4352b08a790737e8b74f0a499c8f1493f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 13 Jun 2017 17:30:28 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=A6=82=E4=BD=95=E6=8F=90=E4=BA=A4=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/shixun_show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/repositories/shixun_show.html.erb b/app/views/repositories/shixun_show.html.erb index 1fa1b14f6..220ad4dd9 100644 --- a/app/views/repositories/shixun_show.html.erb +++ b/app/views/repositories/shixun_show.html.erb @@ -38,9 +38,9 @@ <% end %> <% memo = Memo.where(:id => 1232).first %> - <% unless memo.nil? %> - <%=Setting.host_name %>/forums/1/memos/1232" class="linkBlue2" target="_blank">如何提交代码 - <% end %> + <%# unless memo.nil? %> + + <%# end %>
  • From d3a16e2cfc4ecbae085b699fe34a60ce92beaf29 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 13 Jun 2017 17:36:05 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=88=B0=E8=AF=84=E6=B5=8B=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E7=82=B9=E5=87=BB=E8=AF=84=E6=B5=8B=EF=BC=8C?= =?UTF-8?q?=E8=AF=84=E6=B5=8B=E4=BF=A1=E6=81=AF=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=AF=E6=B5=8B=E8=AF=95=E9=9B=86=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=B8=8D=E6=98=AF=E8=AF=84=E6=B5=8B=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E5=8E=9F=E6=9C=AC=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_code_actions.html.erb | 1 + app/views/games/_game_results.html.erb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/games/_code_actions.html.erb b/app/views/games/_code_actions.html.erb index 347a707ee..d65ce362f 100644 --- a/app/views/games/_code_actions.html.erb +++ b/app/views/games/_code_actions.html.erb @@ -116,6 +116,7 @@ latest_output: data.latest_output }); $("#game_test_set_results").html(html); + $("#blacktab_nav_1").trigger("click"); if(data.status == 2){ clearInterval(cm); clearInterval(intId); diff --git a/app/views/games/_game_results.html.erb b/app/views/games/_game_results.html.erb index 7141bcb29..90df28e23 100644 --- a/app/views/games/_game_results.html.erb +++ b/app/views/games/_game_results.html.erb @@ -115,6 +115,7 @@ } ); $("#game_test_set_results").html(html); + $("#blacktab_nav_1").trigger("click"); }); // 公开的测试集允许展开与隐藏 function toggle_test_case(t_case, id){ From 439b66212f6a7becaa23f7b1f8c085e34ce82347 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 14 Jun 2017 08:58:36 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E7=9A=84=E7=A4=BE=E5=8C=BA=E5=92=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=EF=BC=8C=E9=83=BD=E5=85=88=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_footer.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 93190e9b9..aeee200fc 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -3,8 +3,8 @@
    From 91d3bc04b5083536da3e6e977bdef8ba030a6226 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 14 Jun 2017 10:27:49 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E5=A0=82=E5=88=97=E8=A1=A8=E5=92=8C=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E5=88=97=E8=A1=A8=E5=BA=95=E9=83=A8=E7=9A=84=E2=80=9C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=9F=A5=E7=9C=8B=E5=85=A8=E9=83=A8=E2=80=9D?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=88=90=E6=8D=A2=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 11 +++++++- .../users/_my_homepage_courses_list.html.erb | 20 +++++++++++++++ .../users/_my_homepage_shixuns_list.html.erb | 18 +++++++++++++ app/views/users/show.html.erb | 25 ++----------------- app/views/users/show.js.erb | 13 ++++++---- public/javascripts/edu/user.js | 8 ++++++ 6 files changed, 66 insertions(+), 29 deletions(-) create mode 100644 app/views/users/_my_homepage_courses_list.html.erb create mode 100644 app/views/users/_my_homepage_shixuns_list.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ee6a276da..dc9b11aee 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2128,13 +2128,22 @@ class UsersController < ApplicationController @user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12); @courses = @user.courses.visible.not_deleted_not_end @courses_count = @courses.count - @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc").limit(8) + @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + @limit = 8 + @is_remote = true + @courses_pages = Paginator.new @courses_count, @limit, params['page'] || 1 + @offset ||= @courses_pages.offset + @courses = paginateHelper @courses, @limit + if @user == User.current @shixuns = @user.shixuns else @shixuns = @user.shixuns.where(:authentication => 1) end @shixuns_count = @shixuns.count + @shixuns_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1 + @offset ||= @shixuns_pages.offset + @shixuns = paginateHelper @shixuns, @limit # if User.current == @user # # 点击小铃铛,更新点击时间 # update_onclick_time if params[:click_user_message] == 'true' diff --git a/app/views/users/_my_homepage_courses_list.html.erb b/app/views/users/_my_homepage_courses_list.html.erb new file mode 100644 index 000000000..baa69db2a --- /dev/null +++ b/app/views/users/_my_homepage_courses_list.html.erb @@ -0,0 +1,20 @@ +<% @courses.each do |course| %> +

    + <%= course.name %> + <%= course.syllabus.title %> + <%= format_time course.updatetime %> + +

    +<% end %> +<%# if @courses_count > 8 %> + +<%# end %> +
    +
    +
    +
      + <%= pagination_links_full @courses_pages, @courses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/_my_homepage_shixuns_list.html.erb b/app/views/users/_my_homepage_shixuns_list.html.erb new file mode 100644 index 000000000..63c7c244a --- /dev/null +++ b/app/views/users/_my_homepage_shixuns_list.html.erb @@ -0,0 +1,18 @@ +<% @shixuns.each do |shixun| %> +

    + <%= shixun.name %> + 已解锁第<%= had_passed_changllenge_count(shixun) %>关/共<%= shixun.challenges.count %> + <%= format_time shixun.created_at %> + +

    +<% end %> + +
    +
    +
    +
      + <%= pagination_links_full @shixuns_pages, @shixuns_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index ea2ee1b82..826e0b408 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -204,31 +204,10 @@

    - <% @courses.limit(8).each do |course| %> -

    - <%= course.name %> - <%= course.syllabus.title %> - <%= format_time course.updatetime %> - -

    - <% end %> - <% if @courses_count > 8 %> - 点击查看全部 - <% end %> + <%= render :partial => "my_homepage_courses_list" %>
    -
    - <% @shixuns.limit(8).each do |shixun| %> -

    - <%= shixun.name %> - 已解锁第<%= had_passed_changllenge_count(shixun) %>关/共<%= shixun.challenges.count %> - <%= format_time shixun.created_at %> - -

    - <% end %> - <% if @shixuns_count > 8 %> - 点击查看全部 - <% end %> + <%#= render :partial => "my_homepage_shixuns_list" %>
    <% end %> diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb index 20e515859..bee4ccdfc 100644 --- a/app/views/users/show.js.erb +++ b/app/views/users/show.js.erb @@ -1,5 +1,8 @@ -<% if is_current_user %> - $("#user_homepage_message_list").html("<%= escape_javascript( render :partial => 'users/user_message_list') %>"); -<% else %> - $("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} )%>"); -<% end %> +<%# if is_current_user %> + // $("#user_homepage_message_list").html("<%#= escape_javascript( render :partial => 'users/user_message_list') %>"); +<%# else %> + // $("#show_more_activities").replaceWith("<%#= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} )%>"); +<%# end %> +$("#my_courses_list").html ("<%= j (render :partial => 'users/my_homepage_courses_list') %>"); +$("#my_shixuns_list").html ("<%= j (render :partial => 'users/my_homepage_shixuns_list') %>"); + diff --git a/public/javascripts/edu/user.js b/public/javascripts/edu/user.js index bfb75cf78..e6bd21179 100644 --- a/public/javascripts/edu/user.js +++ b/public/javascripts/edu/user.js @@ -29,6 +29,10 @@ $(function(){ /*---------------------- 课堂tab点击事件 -------------------------*/ nTabCourse.live('click', function(){ + $.ajax({ + url: '/users/' + $("#current_user_id").val(), + async: false + }) var nParent = nTabCourse.parent(); nParent.find(".bold").removeClass("bold"); nParent.find("i").hide(); @@ -40,6 +44,10 @@ $(function(){ /*---------------------- 实训tab点击事件 -------------------------*/ nTabShixun.live('click', function(){ + $.ajax({ + url: '/users/' + $("#current_user_id").val(), + async: false + }) var nParent = nTabShixun.parent(); nParent.find(".bold").removeClass("bold"); nParent.find("i").hide(); From 91c457486631fcf65bc0e8fc57ff9169b0c7d928 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 14 Jun 2017 17:16:47 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E6=88=91=E7=9A=84=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=B3=BB=E5=88=97=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/syllabuses/_courses_list.html.erb | 19 ++- .../syllabuses/_join_syllabuses.html.erb | 83 +++++----- app/views/syllabuses/_my_syllabuses.html.erb | 79 +++++----- app/views/syllabuses/index.html.erb | 144 +++++++----------- app/views/syllabuses/index.js.erb | 41 +---- 5 files changed, 159 insertions(+), 207 deletions(-) diff --git a/app/views/syllabuses/_courses_list.html.erb b/app/views/syllabuses/_courses_list.html.erb index 44cd7858d..77d74d500 100644 --- a/app/views/syllabuses/_courses_list.html.erb +++ b/app/views/syllabuses/_courses_list.html.erb @@ -1,15 +1,14 @@ <% if !courses.blank? %> <% courses.each_with_index do |course, i| %> <% allow_visit = course.is_delete == 0 && (User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1) %> -
  • - - " onclick="<%= allow_visit ? '' : 'notice_sure_box(\'你不是该私有班级的成员,不能访问\')' %>" class="fl mr5" target="<%= allow_visit ? '_blank' : "" %>"><%= course.name %> - <% if course.is_public == 0 %> - - <% end %> - - <%= course.teacher.show_name %> - <%= format_date Time.at(course.updatetime) %>更新 +
  • +
  • <% end %> -<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/syllabuses/_join_syllabuses.html.erb b/app/views/syllabuses/_join_syllabuses.html.erb index 103f366fc..40f557ca0 100644 --- a/app/views/syllabuses/_join_syllabuses.html.erb +++ b/app/views/syllabuses/_join_syllabuses.html.erb @@ -1,43 +1,52 @@ <% if @join_syllabuses.count > 0 %> - <% @join_syllabuses.each_with_index do |syllabus, index|%> - <% course_count = @status == 1 ? syllabus.courses.where("is_delete = 0 and is_end = 0").count : syllabus.courses.where("is_delete = 0 and is_end = 1").count %> - <% if !(@status == 2 && course_count == 0) %> -
    -
    - - - - - - <%= syllabus.title %> - <% if course_count > 0 %> - <%= course_count %> - <% end %> - - <%= syllabus.user.show_name %> - <%=format_date syllabus.updated_at %>更新 - -
      - <%= link_to "新建班级", new_course_path(:syllabus_id => syllabus.id), :target => '_blank', :title => "新建班级"%> - <%= link_to '查看课程', syllabus_path(syllabus.id), :target =>'_blank', :title => '查看课程' %> - + <% @join_syllabuses.each_with_index do |syllabus, index|%> + <% course_count = @status == 1 ? syllabus.courses.where("is_delete = 0 and is_end = 0").count : syllabus.courses.where("is_delete = 0 and is_end = 1").count %> + <% if !(@status == 2 && course_count == 0) %> +
      +
      + <%= syllabus.title %> + <%=format_date syllabus.updated_at %> 更新 +
      + +
      + +
        +
      • <%= link_to "新建班级", new_course_path(:syllabus_id => syllabus.id), :target => '_blank', :title => "新建班级"%>
      • +
      • <%= link_to '查看课程', syllabus_path(syllabus.id), :target =>'_blank', :title => '查看课程' %>
      • +
      • <% if User.current == syllabus.user || User.current.admin? %> - <%= link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :remote => 'true' %> + <%= link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :remote => 'true' %> <% end %> - +
      • +
      +
      +
      +
        + <% if @status == 1 %> + <% courses = syllabus.courses.where("is_delete = 0 and is_end = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> + <% else %> + <% courses = syllabus.courses.where("is_delete = 0 and is_end = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> + <% end %> + <%= render :partial => 'syllabuses/courses_list', :locals => { :courses => courses, :syllabus => syllabus} %>
      -
    -
      - <% if @status == 1 %> - <% courses = syllabus.courses.where("is_delete = 0 and is_end = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> - <% else %> - <% courses = syllabus.courses.where("is_delete = 0 and is_end = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> - <% end %> - <%= render :partial => 'syllabuses/courses_list', :locals => { :courses => courses, :syllabus => syllabus} %> -
    -
    + <% end %> <% end %> -<% end %> <% else %> -<%= render :partial => 'welcome/no_data' %> -<% end %> \ No newline at end of file + <%= render :partial => 'welcome/no_data' %> +<% end %> diff --git a/app/views/syllabuses/_my_syllabuses.html.erb b/app/views/syllabuses/_my_syllabuses.html.erb index 972f44dbe..004609fa3 100644 --- a/app/views/syllabuses/_my_syllabuses.html.erb +++ b/app/views/syllabuses/_my_syllabuses.html.erb @@ -1,43 +1,52 @@ <% if @my_syllabuses.count > 0 %> -<% @my_syllabuses.each_with_index do |syllabus, index|%> - <% course_count = @status == 1 ? syllabus.courses.where("is_delete = 0 and is_end = 0").count : syllabus.courses.where("is_delete = 0 and is_end = 1").count %> - <% if !(@status == 2 && course_count == 0) %> -
    -
    - - - - - - <%= syllabus.title %> - <% if course_count > 0 %> - <%= course_count %> - <% end %> - - <%= syllabus.user.show_name %> - <%=format_date syllabus.updated_at %>更新 - -
      - <%= link_to "新建班级", new_course_path(:syllabus_id => syllabus.id), :target => '_blank', :title => "新建班级"%> - <%= link_to '查看课程', syllabus_path(syllabus.id), :target =>'_blank', :title => '查看课程' %> - + <% @my_syllabuses.each_with_index do |syllabus, index|%> + <% course_count = @status == 1 ? syllabus.courses.where("is_delete = 0 and is_end = 0").count : syllabus.courses.where("is_delete = 0 and is_end = 1").count %> + <% if !(@status == 2 && course_count == 0) %> +
      +
      + <%= syllabus.title %> + <%=format_date syllabus.updated_at %> 更新 +
      + +
      + +
        +
      • <%= link_to "新建班级", new_course_path(:syllabus_id => syllabus.id), :target => '_blank', :title => "新建班级"%>
      • +
      • <%= link_to '查看课程', syllabus_path(syllabus.id), :target =>'_blank', :title => '查看课程' %>
      • +
      • <% if User.current == syllabus.user || User.current.admin? %> - <%= link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :remote => 'true' %> + <%= link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :remote => 'true' %> <% end %> - +
      • +
      +
      +
      +
        + <% if @status == 1 %> + <% courses = syllabus.courses.where("is_delete = 0 and is_end = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> + <% else %> + <% courses = syllabus.courses.where("is_delete = 0 and is_end = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> + <% end %> + <%= render :partial => 'syllabuses/courses_list', :locals => { :courses => courses, :syllabus => syllabus} %>
      -
    -
      - <% if @status == 1 %> - <% courses = syllabus.courses.where("is_delete = 0 and is_end = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> - <% else %> - <% courses = syllabus.courses.where("is_delete = 0 and is_end = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> - <% end %> - <%= render :partial => 'syllabuses/courses_list', :locals => { :courses => courses, :syllabus => syllabus} %> -
    -
    + <% end %> <% end %> -<% end %> <% else %> <%= render :partial => 'welcome/no_data' %> <% end %> \ No newline at end of file diff --git a/app/views/syllabuses/index.html.erb b/app/views/syllabuses/index.html.erb index 174371057..d66b9ed38 100644 --- a/app/views/syllabuses/index.html.erb +++ b/app/views/syllabuses/index.html.erb @@ -1,98 +1,64 @@ -
    -

    - - - <%= User.current.show_name %> > - 智能课堂> - 我的课堂 - - -

    +
    +

    胡莎莎 > 项目实训 > 我的实训

    +
    +
    +
    + +
    -
    - -

    - 正在进行 - 已结束 -

    -
    -
    - <%= render :partial => "syllabuses/my_syllabuses" %> -
    -
    - <%= render :partial => "syllabuses/join_syllabuses" %> +
    +
    +

    + 正在进行 + 已结束 +

    +
    + <%= render :partial => "syllabuses/my_syllabuses" %> +
    +
    +
    + +
    +

    + 正在进行 + 已结束 +

    +
    +
    + <%= render :partial => "syllabuses/join_syllabuses" %> +
    +
    +
    +
    diff --git a/app/views/syllabuses/index.js.erb b/app/views/syllabuses/index.js.erb index a07fc7369..0539df6fa 100644 --- a/app/views/syllabuses/index.js.erb +++ b/app/views/syllabuses/index.js.erb @@ -1,36 +1,5 @@ -$("#my_syllabuses").html("<%= j( render :partial => "syllabuses/my_syllabuses") %>"); -$("#join_syllabuses").html("<%= j( render :partial => "syllabuses/join_syllabuses") %>"); -$(".play .nav p").click(function () { - var $a = $(this).attr("data-option"); - $(".play .nav p i").hide(); - $(".play .nav p").removeClass("bold"); - $(this).addClass("bold"); - $(this).find("i").show(); - $(".con").children().hide(); - $(".con").find("." + $a + "").show(); -}); -$(".con .count").click(function () { - if ($(this).find(".cut").css("display") == "none") { - $(this).find(".cut").show(); - $(this).find(".add").hide(); - $(this).parent().next().show(); - } else { - $(this).find(".cut").hide(); - $(this).find(".add").show(); - $(this).parent().next().hide(); - } -}); -$(".con .operate").click(function () { - if ($(this).parent().next().css("display") == "none") { - $(".con .handle").hide(); - $(this).parent().next().show(); - } else { - $(this).parent().next().hide(); - } -}); -$(document).bind("click", function (e) { - var target = $(e.target); - if (target.closest(".con .handle").length == 0 && target.closest(".con .operate").length == 0) { - $(".con .handle").hide(); - } -}); +<% if params[:tab].to_i == 1 %> + $("#my_syllabuses").html("<%= j( render :partial => "syllabuses/my_syllabuses") %>"); +<% elsif params[:tab].to_i == 2 %> + $("#join_syllabuses").html("<%= j( render :partial => "syllabuses/join_syllabuses") %>"); +<% end %> From dfdfe5f7c706283f836e9a2788ff52533fcb3134 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 15 Jun 2017 09:09:02 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E6=8A=8A=E9=A1=B6=E9=83=A8=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E7=9A=84=E6=B6=88=E6=81=AFicon=E9=9A=90?= =?UTF-8?q?=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 3ad3d5775..bb085f106 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -45,10 +45,10 @@
    - +
    @@ -315,6 +322,44 @@ }); }); + + window.onload = function(){ + $("#challenge_task_pass [type=\"latex\"]").bind("click", function(){ + taskpass_editormd.cm.replaceSelection("```latex"); + taskpass_editormd.cm.replaceSelection("\n"); + taskpass_editormd.cm.replaceSelection("\n"); + taskpass_editormd.cm.replaceSelection("```"); + var __Cursor = taskpass_editormd.cm.getDoc().getCursor(); + taskpass_editormd.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#challenge_answer [type=\"latex\"]").bind("click", function(){ + taskanswer_editormd.cm.replaceSelection("```latex"); + taskanswer_editormd.cm.replaceSelection("\n"); + taskanswer_editormd.cm.replaceSelection("\n"); + taskanswer_editormd.cm.replaceSelection("```"); + var __Cursor = taskanswer_editormd.cm.getDoc().getCursor(); + taskanswer_editormd.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#challenge_task_pass [type=\"inline\"]").bind("click", function(){ + taskpass_editormd.cm.replaceSelection("$$$$"); + var __Cursor = taskpass_editormd.cm.getDoc().getCursor(); + taskpass_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2); + taskpass_editormd.cm.focus(); + }); + + $("#challenge_answer [type=\"inline\"]").bind("click", function(){ + taskanswer_editormd.cm.replaceSelection("$$$$"); + var __Cursor = taskanswer_editormd.cm.getDoc().getCursor(); + taskanswer_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2); + taskanswer_editormd.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + } + // 设置textarea的宽度到140以后出现滚动条 var test_set_inputs = document.getElementsByName("test_set[input][]"); var test_set_outputs = document.getElementsByName("test_set[output][]"); diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index e960f03e7..e851537a3 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -57,7 +57,12 @@ toolbarIcons : function() { // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"] + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ] + }, + + toolbarCustomIcons : { + testIcon : "
    ", + testIcon1 : "
    " }, //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 saveHTMLToTextarea : true, @@ -81,7 +86,11 @@ toolbarIcons : function() { // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"] + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ] + }, + toolbarCustomIcons : { + testIcon : "
    ", + testIcon1 : "
    " }, //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 saveHTMLToTextarea : true, @@ -119,4 +128,41 @@ $("#new_shixun").submit(); } } + + window.onload = function(){ + $("#shixun_introduction [type=\"latex\"]").bind("click", function(){ + shixun_editormd.cm.replaceSelection("```latex"); + shixun_editormd.cm.replaceSelection("\n"); + shixun_editormd.cm.replaceSelection("\n"); + shixun_editormd.cm.replaceSelection("```"); + var __Cursor = shixun_editormd.cm.getDoc().getCursor(); + shixun_editormd.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#shixun_propaedeutics [type=\"latex\"]").bind("click", function(){ + shixun_propaedeutics.cm.replaceSelection("```latex"); + shixun_propaedeutics.cm.replaceSelection("\n"); + shixun_propaedeutics.cm.replaceSelection("\n"); + shixun_propaedeutics.cm.replaceSelection("```"); + var __Cursor = shixun_propaedeutics.cm.getDoc().getCursor(); + shixun_propaedeutics.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#shixun_introduction [type=\"inline\"]").bind("click", function(){ + shixun_editormd.cm.replaceSelection("$$$$"); + var __Cursor = shixun_editormd.cm.getDoc().getCursor(); + shixun_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2); + shixun_editormd.cm.focus(); + }); + + $("#shixun_propaedeutics [type=\"inline\"]").bind("click", function(){ + shixun_propaedeutics.cm.replaceSelection("$$$$"); + var __Cursor = shixun_propaedeutics.cm.getDoc().getCursor(); + shixun_propaedeutics.cm.setCursor(__Cursor.line, __Cursor.ch-2); + shixun_propaedeutics.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + } \ No newline at end of file diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index d12907da4..56f47caf4 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -64,7 +64,11 @@ toolbarIcons : function() { // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"] + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ] + }, + toolbarCustomIcons : { + testIcon : "
    ", + testIcon1 : "
    " }, //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 saveHTMLToTextarea : true, @@ -87,7 +91,11 @@ toolbarIcons : function() { // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"] + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ] + }, + toolbarCustomIcons : { + testIcon : "
    ", + testIcon1 : "
    " }, //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 saveHTMLToTextarea : true, @@ -99,4 +107,41 @@ imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url }); + + window.onload = function(){ + $("#setting_introduction [type=\"latex\"]").bind("click", function(){ + setting_editormd.cm.replaceSelection("```latex"); + setting_editormd.cm.replaceSelection("\n"); + setting_editormd.cm.replaceSelection("\n"); + setting_editormd.cm.replaceSelection("```"); + var __Cursor = setting_editormd.cm.getDoc().getCursor(); + setting_editormd.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#setting_propaedeutics [type=\"latex\"]").bind("click", function(){ + p_editormd.cm.replaceSelection("```latex"); + p_editormd.cm.replaceSelection("\n"); + p_editormd.cm.replaceSelection("\n"); + p_editormd.cm.replaceSelection("```"); + var __Cursor = p_editormd.cm.getDoc().getCursor(); + p_editormd.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#setting_introduction [type=\"inline\"]").bind("click", function(){ + setting_editormd.cm.replaceSelection("$$$$"); + var __Cursor = setting_editormd.cm.getDoc().getCursor(); + setting_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2); + setting_editormd.cm.focus(); + }); + + $("#setting_propaedeutics [type=\"inline\"]").bind("click", function(){ + p_editormd.cm.replaceSelection("$$$$"); + var __Cursor = p_editormd.cm.getDoc().getCursor(); + p_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2); + p_editormd.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + } diff --git a/app/views/shixuns/_shixun_list.html.erb b/app/views/shixuns/_shixun_list.html.erb index 07426e41c..ff3fa32de 100644 --- a/app/views/shixuns/_shixun_list.html.erb +++ b/app/views/shixuns/_shixun_list.html.erb @@ -4,14 +4,14 @@
    <% else %> <% @shixuns.each do |shixun| %> -
    -
    +
    +

    - <%= link_to shixun.name, shixun_path(shixun), :target => "_blank" %> + <%= link_to shixun.name, "javascrip:void(0);" %>

    - <%= link_to image_tag(url_to_avatar(shixun.owner), :width =>"60", :height => "60", :class => "panel-warp-img mr10 fl", :alt=>"头像"), user_path(shixun.owner), :target => "_blank" %> - <%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "task-index-name task-hide fl", :target => "_blank" %> + <%= link_to image_tag(url_to_avatar(shixun.owner), :width =>"60", :height => "60", :class => "panel-warp-img mr10 fl", :alt=>"头像"), "javascrip:void(0);" %> + <%= link_to shixun.owner.try(:show_name), "javascrip:void(0);" , :class => "task-index-name task-hide fl", :target => "_blank" %>
    <%= shixun.language == "JDBC" ? "Java/SQL" : shixun.language %> @@ -33,4 +33,9 @@
    <% end %> - + diff --git a/app/views/shixuns/new.html.erb b/app/views/shixuns/new.html.erb index 0517123f2..599c909d6 100644 --- a/app/views/shixuns/new.html.erb +++ b/app/views/shixuns/new.html.erb @@ -1,6 +1,8 @@ <%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> <%= javascript_include_tag '/editormd/editormd.min.js' %> - +
    + +

    <%= User.current.show_name %> > 项目实训 > 新建实训 diff --git a/public/editormd/editormd.min.js b/public/editormd/editormd.min.js index f810e34ff..03d4c96ea 100644 --- a/public/editormd/editormd.min.js +++ b/public/editormd/editormd.min.js @@ -1,3 +1,3 @@ /*! Editor.md v1.5.0 | editormd.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ !function(e){"use strict";"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd||define(["jquery"],e):window.editormd=e()}(function(){"use strict";var e="undefined"!=typeof jQuery?jQuery:Zepto;if("undefined"!=typeof e){var t=function(e,i){return new t.fn.init(e,i)};t.title=t.$name="Editor.md",t.version="1.5.0",t.homePage="https://pandao.github.io/editor.md/",t.classPrefix="editormd-",t.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","reference-link","image","code","preformatted-text","code-block","table","datetime","emoji","html-entities","pagebreak","|","goto-line","watch","preview","fullscreen","clear","search","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},t.defaults={mode:"gfm",name:"",value:"",theme:"",editorTheme:"default",previewTheme:"",markdown:"",appendMarkdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",delay:300,autoLoadModules:!0,watch:!0,placeholder:"Enjoy Markdown! coding now...",gotoLine:!0,codeFold:!1,autoHeight:!1,autoFocus:!0,autoCloseTags:!0,searchReplace:!0,syncScrolling:!0,readOnly:!1,tabSize:4,indentUnit:4,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,showTrailingSpace:!0,matchBrackets:!0,indentWithTabs:!0,styleSelectedText:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocm:!1,tocTitle:"",tocDropdown:!1,tocContainer:"",tocStartLevel:1,htmlDecode:!1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:"full",toolbarTitles:{},toolbarHandlers:{ucwords:function(){return t.toolbarHandlers.ucwords},lowercase:function(){return t.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:t.classPrefix+"bold",h2:t.classPrefix+"bold",h3:t.classPrefix+"bold",h4:t.classPrefix+"bold",h5:t.classPrefix+"bold",h6:t.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link","reference-link":"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o","html-entities":"fa-copyright",pagebreak:"fa-newspaper-o","goto-line":"fa-terminal",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-desktop",search:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
    Open source online Markdown editor.",tocTitle:"目录",toolbar:{undo:"撤销(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗体",del:"删除线",italic:"斜体",quote:"引用",ucwords:"将每个单词首字母转成大写",uppercase:"将所选转换成大写",lowercase:"将所选转换成小写",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6","list-ul":"无序列表","list-ol":"有序列表",hr:"横线",link:"链接","reference-link":"引用链接",image:"添加图片",code:"行内代码","preformatted-text":"预格式文本 / 代码块(缩进风格)","code-block":"代码块(多语言风格)",table:"添加表格",datetime:"日期时间",emoji:"Emoji表情","html-entities":"HTML实体字符",pagebreak:"插入分页符","goto-line":"跳转到行",watch:"关闭实时预览",unwatch:"开启实时预览",preview:"全窗口预览HTML(按 Shift + ESC还原)",fullscreen:"全屏(按ESC还原)",clear:"清空",search:"搜索",help:"使用帮助",info:"关于"+t.title},buttons:{enter:"确定",cancel:"取消",close:"关闭"},dialog:{link:{title:"添加链接",url:"链接地址",urlTitle:"链接标题",urlEmpty:"错误:请填写链接地址。"},referenceLink:{title:"添加引用链接",name:"引用名称",url:"链接地址",urlId:"链接ID",urlTitle:"链接标题",nameEmpty:"错误:引用链接的名称不能为空。",idEmpty:"错误:请填写引用链接的ID。",urlEmpty:"错误:请填写引用链接的URL地址。"},image:{title:"添加图片",url:"图片地址",link:"图片链接",alt:"图片描述",uploadButton:"本地上传",imageURLEmpty:"错误:图片地址不能为空。",uploadFileEmpty:"错误:上传的图片不能为空。",formatNotAllowed:"错误:只允许上传图片文件,允许上传的图片文件格式有:"},preformattedText:{title:"添加预格式文本或代码块",emptyAlert:"错误:请填写预格式文本或代码的内容。"},codeBlock:{title:"添加代码块",selectLabel:"代码语言:",selectDefaultText:"请选择代码语言",otherLanguage:"其他语言",unselectedLanguageAlert:"错误:请选择代码所属的语言类型。",codeEmptyAlert:"错误:请填写代码内容。"},htmlEntities:{title:"HTML 实体字符"},help:{title:"使用帮助"}}}},t.classNames={tex:t.classPrefix+"tex"},t.dialogZindex=99999,t.$katex=null,t.$marked=null,t.$CodeMirror=null,t.$prettyPrint=null;var i,o;t.prototype=t.fn={state:{watching:!1,loaded:!1,preview:!1,fullscreen:!1},init:function(i,o){o=o||{},"object"==typeof i&&(o=i);var r=this.classPrefix=t.classPrefix,n=this.settings=e.extend(!0,t.defaults,o);i="object"==typeof i?n.id:i;var a=this.editor=e("#"+i);this.id=i,this.lang=n.lang;var s=this.classNames={textarea:{html:r+"html-textarea",markdown:r+"markdown-textarea"}};n.pluginPath=""===n.pluginPath?n.path+"../plugins/":n.pluginPath,this.state.watching=n.watch?!0:!1,a.hasClass("editormd")||a.addClass("editormd"),a.css({width:"number"==typeof n.width?n.width+"px":n.width,height:"number"==typeof n.height?n.height+"px":n.height}),n.autoHeight&&a.css("height","auto");var l=this.markdownTextarea=a.children("textarea");l.length<1&&(a.append(""),l=this.markdownTextarea=a.children("textarea")),l.addClass(s.textarea.markdown).attr("placeholder",n.placeholder),("undefined"==typeof l.attr("name")||""===l.attr("name"))&&l.attr("name",""!==n.name?n.name:i+"-markdown-doc");var c=[n.readOnly?"":'',n.saveHTMLToTextarea?'':"",'

    ','
    ','
    '].join("\n");return a.append(c).addClass(r+"vertical"),""!==n.theme&&a.addClass(r+"theme-"+n.theme),this.mask=a.children("."+r+"mask"),this.containerMask=a.children("."+r+"container-mask"),""!==n.markdown&&l.val(n.markdown),""!==n.appendMarkdown&&l.val(l.val()+n.appendMarkdown),this.htmlTextarea=a.children("."+s.textarea.html),this.preview=a.children("."+r+"preview"),this.previewContainer=this.preview.children("."+r+"preview-container"),""!==n.previewTheme&&this.preview.addClass(r+"preview-theme-"+n.previewTheme),"function"==typeof define&&define.amd&&("undefined"!=typeof katex&&(t.$katex=katex),n.searchReplace&&!n.readOnly&&(t.loadCSS(n.path+"codemirror/addon/dialog/dialog"),t.loadCSS(n.path+"codemirror/addon/search/matchesonscrollbar"))),"function"==typeof define&&define.amd||!n.autoLoadModules?("undefined"!=typeof CodeMirror&&(t.$CodeMirror=CodeMirror),"undefined"!=typeof marked&&(t.$marked=marked),this.setCodeMirror().setToolbar().loadedDisplay()):this.loadQueues(),this},loadQueues:function(){var e=this,i=this.settings,o=i.path,r=function(){return t.isIE8?void e.loadedDisplay():void(i.flowChart||i.sequenceDiagram?t.loadScript(o+"raphael.min",function(){t.loadScript(o+"underscore.min",function(){!i.flowChart&&i.sequenceDiagram?t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()}):i.flowChart&&!i.sequenceDiagram?t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){e.loadedDisplay()})}):i.flowChart&&i.sequenceDiagram&&t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()})})})})}):e.loadedDisplay())};return t.loadCSS(o+"codemirror/codemirror.min"),i.searchReplace&&!i.readOnly&&(t.loadCSS(o+"codemirror/addon/dialog/dialog"),t.loadCSS(o+"codemirror/addon/search/matchesonscrollbar")),i.codeFold&&t.loadCSS(o+"codemirror/addon/fold/foldgutter"),t.loadScript(o+"codemirror/codemirror.min",function(){t.$CodeMirror=CodeMirror,t.loadScript(o+"codemirror/modes.min",function(){t.loadScript(o+"codemirror/addons.min",function(){return e.setCodeMirror(),"gfm"!==i.mode&&"markdown"!==i.mode?(e.loadedDisplay(),!1):(e.setToolbar(),void t.loadScript(o+"marked.min",function(){t.$marked=marked,i.previewCodeHighlight?t.loadScript(o+"prettify.min",function(){r()}):r()}))})})}),this},setTheme:function(e){var t=this.editor,i=this.settings.theme,o=this.classPrefix+"theme-";return t.removeClass(o+i).addClass(o+e),this.settings.theme=e,this},setEditorTheme:function(e){var i=this.settings;return i.editorTheme=e,"default"!==e&&t.loadCSS(i.path+"codemirror/theme/"+i.editorTheme),this.cm.setOption("theme",e),this},setCodeMirrorTheme:function(e){return this.setEditorTheme(e),this},setPreviewTheme:function(e){var t=this.preview,i=this.settings.previewTheme,o=this.classPrefix+"preview-theme-";return t.removeClass(o+i).addClass(o+e),this.settings.previewTheme=e,this},setCodeMirror:function(){var e=this.settings,i=this.editor;"default"!==e.editorTheme&&t.loadCSS(e.path+"codemirror/theme/"+e.editorTheme);var o={mode:e.mode,theme:e.editorTheme,tabSize:e.tabSize,dragDrop:!1,autofocus:e.autoFocus,autoCloseTags:e.autoCloseTags,readOnly:e.readOnly?"nocursor":!1,indentUnit:e.indentUnit,lineNumbers:e.lineNumbers,lineWrapping:e.lineWrapping,extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor())}},foldGutter:e.codeFold,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:e.matchBrackets,indentWithTabs:e.indentWithTabs,styleActiveLine:e.styleActiveLine,styleSelectedText:e.styleSelectedText,autoCloseBrackets:e.autoCloseBrackets,showTrailingSpace:e.showTrailingSpace,highlightSelectionMatches:e.matchWordHighlight?{showToken:"onselected"===e.matchWordHighlight?!1:/\w/}:!1};return this.codeEditor=this.cm=t.$CodeMirror.fromTextArea(this.markdownTextarea[0],o),this.codeMirror=this.cmElement=i.children(".CodeMirror"),""!==e.value&&this.cm.setValue(e.value),this.codeMirror.css({fontSize:e.fontSize,width:e.watch?"50%":"100%"}),e.autoHeight&&(this.codeMirror.css("height","auto"),this.cm.setOption("viewportMargin",1/0)),e.lineNumbers||this.codeMirror.find(".CodeMirror-gutters").css("border-right","none"),this},getCodeMirrorOption:function(e){return this.cm.getOption(e)},setCodeMirrorOption:function(e,t){return this.cm.setOption(e,t),this},addKeyMap:function(e,t){return this.cm.addKeyMap(e,t),this},removeKeyMap:function(e){return this.cm.removeKeyMap(e),this},gotoLine:function(t){var i=this.settings;if(!i.gotoLine)return this;var o=this.cm,r=(this.editor,o.lineCount()),n=this.preview;if("string"==typeof t&&("last"===t&&(t=r),"first"===t&&(t=1)),"number"!=typeof t)return alert("Error: The line number must be an integer."),this;if(t=parseInt(t)-1,t>r)return alert("Error: The line number range 1-"+r),this;o.setCursor({line:t,ch:0});var a=o.getScrollInfo(),s=a.clientHeight,l=o.charCoords({line:t,ch:0},"local");if(o.scrollTo(null,(l.top+l.bottom-s)/2),i.watch){var c=this.codeMirror.find(".CodeMirror-scroll")[0],h=e(c).height(),d=c.scrollTop,u=d/c.scrollHeight;n.scrollTop(0===d?0:d+h>=c.scrollHeight-16?n[0].scrollHeight:n[0].scrollHeight*u)}return o.focus(),this},extend:function(){return"undefined"!=typeof arguments[1]&&("function"==typeof arguments[1]&&(arguments[1]=e.proxy(arguments[1],this)),this[arguments[0]]=arguments[1]),"object"==typeof arguments[0]&&"undefined"==typeof arguments[0].length&&e.extend(!0,this,arguments[0]),this},set:function(t,i){return"undefined"!=typeof i&&"function"==typeof i&&(i=e.proxy(i,this)),this[t]=i,this},config:function(t,i){var o=this.settings;return"object"==typeof t&&(o=e.extend(!0,o,t)),"string"==typeof t&&(o[t]=i),this.settings=o,this.recreate(),this},on:function(t,i){var o=this.settings;return"undefined"!=typeof o["on"+t]&&(o["on"+t]=e.proxy(i,this)),this},off:function(e){var t=this.settings;return"undefined"!=typeof t["on"+e]&&(t["on"+e]=function(){}),this},showToolbar:function(t){var i=this.settings;return i.readOnly?this:(i.toolbar&&(this.toolbar.length<1||""===this.toolbar.find("."+this.classPrefix+"menu").html())&&this.setToolbar(),i.toolbar=!0,this.toolbar.show(),this.resize(),e.proxy(t||function(){},this)(),this)},hideToolbar:function(t){var i=this.settings;return i.toolbar=!1,this.toolbar.hide(),this.resize(),e.proxy(t||function(){},this)(),this},setToolbarAutoFixed:function(t){var i=this.state,o=this.editor,r=this.toolbar,n=this.settings;"undefined"!=typeof t&&(n.toolbarAutoFixed=t);var a=function(){var t=e(window),i=t.scrollTop();return n.toolbarAutoFixed?void r.css(i-o.offset().top>10&&i
      ';i.append(n),r=this.toolbar=i.children("."+o+"toolbar")}if(!e.toolbar)return r.hide(),this;r.show();for(var a="function"==typeof e.toolbarIcons?e.toolbarIcons():"string"==typeof e.toolbarIcons?t.toolbarModes[e.toolbarIcons]:e.toolbarIcons,s=r.find("."+this.classPrefix+"menu"),l="",c=!1,h=0,d=a.length;d>h;h++){var u=a[h];if("||"===u)c=!0;else if("|"===u)l+='
    • |
    • ';else{var f=/h(\d)/.test(u),g=u;"watch"!==u||e.watch||(g="unwatch");var p=e.lang.toolbar[g],m=e.toolbarIconTexts[g],w=e.toolbarIconsClass[g];p="undefined"==typeof p?"":p,m="undefined"==typeof m?"":m,w="undefined"==typeof w?"":w;var v=c?'
    • ':"
    • ";"undefined"!=typeof e.toolbarCustomIcons[u]&&"function"!=typeof e.toolbarCustomIcons[u]?v+=e.toolbarCustomIcons[u]:(v+='',v+=''+(f?u.toUpperCase():""===w?m:"")+"",v+=""),v+="
    • ",l=c?v+l:l+v}}return s.html(l),s.find('[title="Lowercase"]').attr("title",e.lang.toolbar.lowercase),s.find('[title="ucwords"]').attr("title",e.lang.toolbar.ucwords),this.setToolbarHandler(),this.setToolbarAutoFixed(),this},dialogLockScreen:function(){return e.proxy(t.dialogLockScreen,this)(),this},dialogShowMask:function(i){return e.proxy(t.dialogShowMask,this)(i),this},getToolbarHandles:function(e){var i=this.toolbarHandlers=t.toolbarHandlers;return e&&"undefined"!=typeof toolbarIconHandlers[e]?i[e]:i},setToolbarHandler:function(){var i=this,o=this.settings;if(!o.toolbar||o.readOnly)return this;var r=this.toolbar,n=this.cm,a=this.classPrefix,s=this.toolbarIcons=r.find("."+a+"menu > li > a"),l=this.getToolbarHandles();return s.bind(t.mouseOrTouch("click","touchend"),function(t){var r=e(this).children(".fa"),a=r.attr("name"),s=n.getCursor(),c=n.getSelection();return""!==a?(i.activeIcon=r,"undefined"!=typeof l[a]?e.proxy(l[a],i)(n):"undefined"!=typeof o.toolbarHandlers[a]&&e.proxy(o.toolbarHandlers[a],i)(n,r,s,c),"link"!==a&&"reference-link"!==a&&"image"!==a&&"code-block"!==a&&"preformatted-text"!==a&&"watch"!==a&&"preview"!==a&&"search"!==a&&"fullscreen"!==a&&"info"!==a&&n.focus(),!1):void 0}),this},createDialog:function(i){return e.proxy(t.createDialog,this)(i)},createInfoDialog:function(){var e=this,i=this.editor,o=this.classPrefix,r=['
      ','
      ','

      '+t.title+"v"+t.version+"

      ","

      "+this.lang.description+"

      ",'

      '+t.homePage+'

      ','

      Copyright © 2015 Pandao, The MIT License.

      ',"
      ",'',"
      "].join("\n");i.append(r);var n=this.infoDialog=i.children("."+o+"dialog-info");return n.find("."+o+"dialog-close").bind(t.mouseOrTouch("click","touchend"),function(){e.hideInfoDialog()}),n.css("border",t.isIE8?"1px solid #ddd":"").css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},infoDialogPosition:function(){var t=this.infoDialog,i=function(){t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"})};return i(),e(window).resize(i),this},showInfoDialog:function(){e("html,body").css("overflow-x","hidden");var i=this.editor,o=this.settings,r=this.infoDialog=i.children("."+this.classPrefix+"dialog-info");return r.length<1&&this.createInfoDialog(),this.lockScreen(!0),this.mask.css({opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor}).show(),r.css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},hideInfoDialog:function(){return e("html,body").css("overflow-x",""),this.infoDialog.hide(),this.mask.hide(),this.lockScreen(!1),this},lockScreen:function(e){return t.lockScreen(e),this.resize(),this},recreate:function(){var e=this.editor,t=this.settings;return this.codeMirror.remove(),this.setCodeMirror(),t.readOnly||(e.find(".editormd-dialog").length>0&&e.find(".editormd-dialog").remove(),t.toolbar&&(this.getToolbarHandles(),this.setToolbar())),this.loadedDisplay(!0),this},previewCodeHighlight:function(){var e=this.settings,t=this.previewContainer;return e.previewCodeHighlight&&(t.find("pre").addClass("prettyprint linenums"),"undefined"!=typeof prettyPrint&&prettyPrint()),this},katexRender:function(){return null===i?this:(this.previewContainer.find("."+t.classNames.tex).each(function(){var i=e(this);t.$katex.render(i.text(),i[0]),i.find(".katex").css("font-size","1.6em")}),this)},flowChartAndSequenceDiagramRender:function(){var i=this,r=this.settings,n=this.previewContainer;if(t.isIE8)return this;if(r.flowChart){if(null===o)return this;n.find(".flowchart").flowChart()}r.sequenceDiagram&&n.find(".sequence-diagram").sequenceDiagram({theme:"simple"});var a=i.preview,s=i.codeMirror,l=s.find(".CodeMirror-scroll"),c=l.height(),h=l.scrollTop(),d=h/l[0].scrollHeight,u=0;a.find(".markdown-toc-list").each(function(){u+=e(this).height()});var f=a.find(".editormd-toc-menu").height();return f=f?f:0,a.scrollTop(0===h?0:h+c>=l[0].scrollHeight-16?a[0].scrollHeight:(a[0].scrollHeight+u+f)*d),this},registerKeyMaps:function(i){var o=this,r=this.cm,n=this.settings,a=t.toolbarHandlers,s=n.disabledKeyMaps;if(i=i||null){for(var l in i)if(e.inArray(l,s)<0){var c={};c[l]=i[l],r.addKeyMap(i)}}else{for(var h in t.keyMaps){var d=t.keyMaps[h],u="string"==typeof d?e.proxy(a[d],o):e.proxy(d,o);if(e.inArray(h,["F9","F10","F11"])<0&&e.inArray(h,s)<0){var f={};f[h]=u,r.addKeyMap(f)}}e(window).keydown(function(t){var i={120:"F9",121:"F10",122:"F11"};if(e.inArray(i[t.keyCode],s)<0)switch(t.keyCode){case 120:return e.proxy(a.watch,o)(),!1;case 121:return e.proxy(a.preview,o)(),!1;case 122:return e.proxy(a.fullscreen,o)(),!1}})}return this},bindScrollEvent:function(){var i=this,o=this.preview,r=this.settings,n=this.codeMirror,a=t.mouseOrTouch;if(!r.syncScrolling)return this;var s=function(){n.find(".CodeMirror-scroll").bind(a("scroll","touchmove"),function(t){var n=e(this).height(),a=e(this).scrollTop(),s=a/e(this)[0].scrollHeight,l=0;o.find(".markdown-toc-list").each(function(){l+=e(this).height()});var c=o.find(".editormd-toc-menu").height();c=c?c:0,o.scrollTop(0===a?0:a+n>=e(this)[0].scrollHeight-16?o[0].scrollHeight:(o[0].scrollHeight+l+c)*s),e.proxy(r.onscroll,i)(t)})},l=function(){n.find(".CodeMirror-scroll").unbind(a("scroll","touchmove"))},c=function(){o.bind(a("scroll","touchmove"),function(t){var o=e(this).height(),a=e(this).scrollTop(),s=a/e(this)[0].scrollHeight,l=n.find(".CodeMirror-scroll");l.scrollTop(0===a?0:a+o>=e(this)[0].scrollHeight?l[0].scrollHeight:l[0].scrollHeight*s),e.proxy(r.onpreviewscroll,i)(t)})},h=function(){o.unbind(a("scroll","touchmove"))};return n.bind({mouseover:s,mouseout:l,touchstart:s,touchend:l}),"single"===r.syncScrolling?this:(o.bind({mouseover:c,mouseout:h,touchstart:c,touchend:h}),this)},bindChangeEvent:function(){var e=this,t=this.cm,o=this.settings;return o.syncScrolling?(t.on("change",function(t,r){o.watch&&e.previewContainer.css("padding",o.autoHeight?"20px 20px 50px 40px":"20px"),i=setTimeout(function(){clearTimeout(i),e.save(),i=null},o.delay)}),this):this},loadedDisplay:function(t){t=t||!1;var i=this,o=this.editor,r=this.preview,n=this.settings;return this.containerMask.hide(),this.save(),n.watch&&r.show(),o.data("oldWidth",o.width()).data("oldHeight",o.height()),this.resize(),this.registerKeyMaps(),e(window).resize(function(){i.resize()}),this.bindScrollEvent().bindChangeEvent(),t||e.proxy(n.onload,this)(),this.state.loaded=!0,this},width:function(e){return this.editor.css("width","number"==typeof e?e+"px":e),this.resize(),this},height:function(e){return this.editor.css("height","number"==typeof e?e+"px":e),this.resize(),this},resize:function(t,i){t=t||null,i=i||null;var o=this.state,r=this.editor,n=this.preview,a=this.toolbar,s=this.settings,l=this.codeMirror;if(t&&r.css("width","number"==typeof t?t+"px":t),!s.autoHeight||o.fullscreen||o.preview?(i&&r.css("height","number"==typeof i?i+"px":i),o.fullscreen&&r.height(e(window).height()),s.toolbar&&!s.readOnly?l.css("margin-top",a.height()+1).height(r.height()-a.height()):l.css("margin-top",0).height(r.height())):(r.css("height","auto"),l.css("height","auto")),s.watch)if(l.width(r.width()/2),n.width(o.preview?r.width():r.width()/2),this.previewContainer.css("padding",s.autoHeight?"20px 20px 50px 40px":"20px"),s.toolbar&&!s.readOnly?n.css("top",a.height()+1):n.css("top",0),!s.autoHeight||o.fullscreen||o.preview){var c=s.toolbar&&!s.readOnly?r.height()-a.height():r.height();n.height(c)}else n.height("");else l.width(r.width()),n.hide();return o.loaded&&e.proxy(s.onresize,this)(),this},save:function(){if(null===i)return this;var r=this,n=this.state,a=this.settings,s=this.cm,l=s.getValue(),c=this.previewContainer;if("gfm"!==a.mode&&"markdown"!==a.mode)return this.markdownTextarea.val(l),this;var h=t.$marked,d=this.markdownToC=[],u=this.markedRendererOptions={toc:a.toc,tocm:a.tocm,tocStartLevel:a.tocStartLevel,pageBreak:a.pageBreak,taskList:a.taskList,emoji:a.emoji,tex:a.tex,atLink:a.atLink,emailLink:a.emailLink,flowChart:a.flowChart,sequenceDiagram:a.sequenceDiagram,previewCodeHighlight:a.previewCodeHighlight},f=this.markedOptions={renderer:t.markedRenderer(d,u),gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:a.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};h.setOptions(f);var g=t.$marked(l,f);if(g=t.filterHTMLTags(g,a.htmlDecode),this.markdownTextarea.text(l),s.save(),a.saveHTMLToTextarea&&this.htmlTextarea.text(g),a.watch||!a.watch&&n.preview){if(c.html(g),this.previewCodeHighlight(),a.toc){var p=""===a.tocContainer?c:e(a.tocContainer),m=p.find("."+this.classPrefix+"toc-menu");p.attr("previewContainer",""===a.tocContainer?"true":"false"),""!==a.tocContainer&&m.length>0&&m.remove(),t.markdownToCRenderer(d,p,a.tocDropdown,a.tocStartLevel),(a.tocDropdown||p.find("."+this.classPrefix+"toc-menu").length>0)&&t.tocDropdownMenu(p,""!==a.tocTitle?a.tocTitle:this.lang.tocTitle),""!==a.tocContainer&&c.find(".markdown-toc").css("border","none")}a.tex&&(!t.kaTeXLoaded&&a.autoLoadModules?t.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,r.katexRender()}):(t.$katex=katex,this.katexRender())),(a.flowChart||a.sequenceDiagram)&&(o=setTimeout(function(){clearTimeout(o),r.flowChartAndSequenceDiagramRender(),o=null},10)),n.loaded&&e.proxy(a.onchange,this)()}return this},focus:function(){return this.cm.focus(),this},setCursor:function(e){return this.cm.setCursor(e),this},getCursor:function(){return this.cm.getCursor()},setSelection:function(e,t){return this.cm.setSelection(e,t),this},getSelection:function(){return this.cm.getSelection()},setSelections:function(e){return this.cm.setSelections(e),this},getSelections:function(){return this.cm.getSelections()},replaceSelection:function(e){return this.cm.replaceSelection(e),this},insertValue:function(e){return this.replaceSelection(e),this},appendMarkdown:function(e){var t=(this.settings,this.cm);return t.setValue(t.getValue()+e),this},setMarkdown:function(e){return this.cm.setValue(e||this.settings.markdown),this},getMarkdown:function(){return this.cm.getValue()},getValue:function(){return this.cm.getValue()},setValue:function(e){return this.cm.setValue(e),this},clear:function(){return this.cm.setValue(""),this},getHTML:function(){return this.settings.saveHTMLToTextarea?this.htmlTextarea.val():(alert("Error: settings.saveHTMLToTextarea == false"),!1)},getTextareaSavedHTML:function(){return this.getHTML()},getPreviewedHTML:function(){return this.settings.watch?this.previewContainer.html():(alert("Error: settings.watch == false"),!1)},watch:function(t){var o=this.settings;if(e.inArray(o.mode,["gfm","markdown"])<0)return this;if(this.state.watching=o.watch=!0,this.preview.show(),this.toolbar){var r=o.toolbarIconsClass.watch,n=o.toolbarIconsClass.unwatch,a=this.toolbar.find(".fa[name=watch]");a.parent().attr("title",o.lang.toolbar.watch),a.removeClass(n).addClass(r)}return this.codeMirror.css("border-right","1px solid #ddd").width(this.editor.width()/2),i=0,this.save().resize(),o.onwatch||(o.onwatch=t||function(){}),e.proxy(o.onwatch,this)(),this},unwatch:function(t){var i=this.settings;if(this.state.watching=i.watch=!1,this.preview.hide(),this.toolbar){var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch,n=this.toolbar.find(".fa[name=watch]");n.parent().attr("title",i.lang.toolbar.unwatch),n.removeClass(o).addClass(r)}return this.codeMirror.css("border-right","none").width(this.editor.width()),this.resize(),i.onunwatch||(i.onunwatch=t||function(){}),e.proxy(i.onunwatch,this)(),this},show:function(t){t=t||function(){};var i=this;return this.editor.show(0,function(){e.proxy(t,i)()}),this},hide:function(t){t=t||function(){};var i=this;return this.editor.hide(0,function(){e.proxy(t,i)()}),this},previewing:function(){var i=this,o=this.editor,r=this.preview,n=this.toolbar,a=this.settings,s=this.codeMirror,l=this.previewContainer;if(e.inArray(a.mode,["gfm","markdown"])<0)return this;a.toolbar&&n&&(n.toggle(),n.find(".fa[name=preview]").toggleClass("active")),s.toggle();var c=function(e){e.shiftKey&&27===e.keyCode&&i.previewed()};"none"===s.css("display")?(this.state.preview=!0,this.state.fullscreen&&r.css("background","#fff"),o.find("."+this.classPrefix+"preview-close-btn").show().bind(t.mouseOrTouch("click","touchend"),function(){i.previewed()}),a.watch?l.css("padding",""):this.save(),l.addClass(this.classPrefix+"preview-active"),r.show().css({position:"",top:0,width:o.width(),height:a.autoHeight&&!this.state.fullscreen?"auto":o.height()}),this.state.loaded&&e.proxy(a.onpreviewing,this)(),e(window).bind("keyup",c)):(e(window).unbind("keyup",c),this.previewed())},previewed:function(){var i=this.editor,o=this.preview,r=this.toolbar,n=this.settings,a=this.previewContainer,s=i.find("."+this.classPrefix+"preview-close-btn");return this.state.preview=!1,this.codeMirror.show(),n.toolbar&&r.show(),o[n.watch?"show":"hide"](),s.hide().unbind(t.mouseOrTouch("click","touchend")),a.removeClass(this.classPrefix+"preview-active"),n.watch&&a.css("padding","20px"),o.css({background:null,position:"absolute",width:i.width()/2,height:n.autoHeight&&!this.state.fullscreen?"auto":i.height()-r.height(),top:n.toolbar?r.height():0}),this.state.loaded&&e.proxy(n.onpreviewed,this)(),this},fullscreen:function(){var t=this,i=this.state,o=this.editor,r=(this.preview,this.toolbar),n=this.settings,a=this.classPrefix+"fullscreen";r&&r.find(".fa[name=fullscreen]").parent().toggleClass("active");var s=function(e){e.shiftKey||27!==e.keyCode||i.fullscreen&&t.fullscreenExit()};return o.hasClass(a)?(e(window).unbind("keyup",s),this.fullscreenExit()):(i.fullscreen=!0,e("html,body").css("overflow","hidden"),o.css({width:e(window).width(),height:e(window).height()}).addClass(a),this.resize(),e.proxy(n.onfullscreen,this)(),e(window).bind("keyup",s)),this},fullscreenExit:function(){var t=this.editor,i=this.settings,o=this.toolbar,r=this.classPrefix+"fullscreen";return this.state.fullscreen=!1,o&&o.find(".fa[name=fullscreen]").parent().removeClass("active"),e("html,body").css("overflow",""),t.css({width:t.data("oldWidth"),height:t.data("oldHeight")}).removeClass(r),this.resize(),e.proxy(i.onfullscreenExit,this)(),this},executePlugin:function(i,o){var r=this,n=this.cm,a=this.settings;return o=a.pluginPath+o,"function"==typeof define?"undefined"==typeof this[i]?(alert("Error: "+i+" plugin is not found, you are not load this plugin."),this):(this[i](n),this):(e.inArray(o,t.loadFiles.plugin)<0?t.loadPlugin(o,function(){t.loadPlugins[i]=r[i],r[i](n)}):e.proxy(t.loadPlugins[i],this)(n),this)},search:function(e){var t=this.settings;return t.searchReplace?(t.readOnly||this.cm.execCommand(e||"find"),this):(alert("Error: settings.searchReplace == false"),this)},searchReplace:function(){return this.search("replace"),this},searchReplaceAll:function(){return this.search("replaceAll"),this}},t.fn.init.prototype=t.fn,t.dialogLockScreen=function(){var t=this.settings||{dialogLockScreen:!0};t.dialogLockScreen&&(e("html,body").css("overflow","hidden"),this.resize())},t.dialogShowMask=function(t){var i=this.editor,o=this.settings||{dialogShowMask:!0};t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"}),o.dialogShowMask&&i.children("."+this.classPrefix+"mask").css("z-index",parseInt(t.css("z-index"))-1).show()},t.toolbarHandlers={undo:function(){this.cm.undo()},redo:function(){this.cm.redo()},bold:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("**"+i+"**"),""===i&&e.setCursor(t.line,t.ch+2)},del:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("~~"+i+"~~"),""===i&&e.setCursor(t.line,t.ch+2)},italic:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("*"+i+"*"),""===i&&e.setCursor(t.line,t.ch+1)},quote:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("> "+i),e.setCursor(t.line,t.ch+2)):e.replaceSelection("> "+i)},ucfirst:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.firstUpperCase(i)),e.setSelections(o)},ucwords:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.wordsFirstUpperCase(i)),e.setSelections(o)},uppercase:function(){var e=this.cm,t=e.getSelection(),i=e.listSelections();e.replaceSelection(t.toUpperCase()),e.setSelections(i)},lowercase:function(){var e=this.cm,t=(e.getCursor(),e.getSelection()),i=e.listSelections();e.replaceSelection(t.toLowerCase()),e.setSelections(i)},h1:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("# "+i),e.setCursor(t.line,t.ch+2)):e.replaceSelection("# "+i)},h2:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0), -e.replaceSelection("## "+i),e.setCursor(t.line,t.ch+3)):e.replaceSelection("## "+i)},h3:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("### "+i),e.setCursor(t.line,t.ch+4)):e.replaceSelection("### "+i)},h4:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("#### "+i),e.setCursor(t.line,t.ch+5)):e.replaceSelection("#### "+i)},h5:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("##### "+i),e.setCursor(t.line,t.ch+6)):e.replaceSelection("##### "+i)},h6:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("###### "+i),e.setCursor(t.line,t.ch+7)):e.replaceSelection("###### "+i)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o];e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm,t=e.getCursor();e.getSelection()}e.replaceSelection((0!==t.ch?"\n\n":"\n")+"------------\n\n")},tex:function(){if(!this.settings.tex)return alert("settings.tex === false"),this;var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("$$"+i+"$$"),""===i&&e.setCursor(t.line,t.ch+2)},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},"reference-link":function(){this.executePlugin("referenceLinkDialog","reference-link-dialog/reference-link-dialog")},pagebreak:function(){if(!this.settings.pageBreak)return alert("settings.pageBreak === false"),this;{var e=this.cm;e.getSelection()}e.replaceSelection("\r\n[========]\r\n")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day");e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},"html-entities":function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},"goto-line":function(){this.executePlugin("gotoLineDialog","goto-line-dialog/goto-line-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},search:function(){this.search()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-B":"bold","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.emoji?(e.replaceSelection(":"+i+":"),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.emoji == false")},"Ctrl-Alt-G":"goto-line","Ctrl-H":"hr","Ctrl-I":"italic","Ctrl-K":"code","Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.atLink?(e.replaceSelection("@"+i),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.atLink == false")},"Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Shift-Ctrl-K":"tex","Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3)},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"html-entities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table","Shift-Alt-P":"pagebreak",F9:"watch",F10:"preview",F11:"fullscreen"};var r=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=r;var n=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=n;var a=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=a,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\w\+-]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g,pageBreak:/^\[[=]{8,}\]$/},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/",ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(i,o){var n={toc:!0,tocm:!1,tocStartLevel:1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},a=e.extend(n,o||{}),s=t.$marked,l=new s.Renderer;i=i||[];var c=t.regexs,h=c.atLink,d=c.emoji,u=c.email,f=c.emailLink,g=c.twemoji,p=c.fontAwesome,m=c.editormdLogo,w=c.pageBreak;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!a.emoji)return e;for(var o=0,r=i.length;r>o;o++)":+1:"===i[o]&&(i[o]=":\\+1:"),e=e.replace(new RegExp(i[o]),function(e,i){var o=e.match(p),r=e.replace(/:/g,"");if(o)for(var n=0,a=o.length;a>n;n++){var s=o[n].replace(/:/g,"");return''}else{var l=e.match(m),c=e.match(g);if(l)for(var h=0,d=l.length;d>h;h++){var u=l[h].replace(/:/g,"");return''}else{if(!c){var f="+1"===r?"plus1":r;return f="black_large_square"===f?"black_square":f,f="moon"===f?"waxing_gibbous_moon":f,':'+r+':'}for(var w=0,v=c.length;v>w;w++){var k=c[w].replace(/:/g,"").replace("tw-","");return'twemoji-'+k+''}}}});return e},l.atLink=function(i){return h.test(i)?(a.atLink&&(i=i.replace(u,function(e,t,i,o){return e.replace(/@/g,"_#_@_#_")}),i=i.replace(h,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),a.emailLink&&(i=i.replace(f,function(t,i,o,r,n){return!i&&e.inArray(n,"jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|"))<0?''+t+"":t})),i):i},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var n=''+i.replace(/@/g,"@")+""):(t&&(n+=' title="'+t+'"'),n+=">"+i+"")},l.heading=function(e,t,o){var n=e,a=/\s*\]*)\>(.*)\<\/a\>\s*/;if(a.test(e)){var s=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var l=0,c=e.length;c>l;l++)s.push(e[l].replace(/\s*href\=\"(.*)\"\s*/g,""));e=s.join(" ")}e=r(e);var h=e.toLowerCase().replace(/[^\w]+/g,"-"),d={text:e,level:t,slug:h},u=/^[\u4e00-\u9fa5]+$/.test(e),f=u?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");i.push(d);var g="';return g+='',g+='',g+=this.atLink(a?this.emoji(n):this.emoji(e)),g+=""},l.pageBreak=function(e){return w.test(e)&&a.pageBreak&&(e='
      '),e},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",n=a.tocm?/^(\[TOC\]|\[TOCM\])$/.test(e):/^\[TOC\]$/.test(e),s=/^\[TOCM\]$/.test(e);e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e;var l='
      '+e+"
      ";return n?s?'
      '+l+"

      ":l:w.test(e)?this.pageBreak(e):""+this.atLink(this.emoji(e))+"

      \n"},l.code=function(e,i,o){return"seq"===i||"sequence"===i?'
      '+e+"
      ":"flow"===i?'
      '+e+"
      ":"math"===i||"latex"===i||"katex"===i?'

      '+e+"

      ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return a.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
    • '+this.atLink(this.emoji(e))+"
    • "):"
    • "+this.atLink(this.emoji(e))+"
    • "},l},t.markdownToCRenderer=function(e,t,i,o){var r="",n=0,a=this.classPrefix;o=o||1;for(var s=0,l=e.length;l>s;s++){var c=e[s].text,h=e[s].level;o>h||(r+=h>n?"":n>h?new Array(n-h+2).join(""):"",r+='
    • '+c+"
        ",n=h)}var d=t.find(".markdown-toc");if(d.length<1&&"false"===t.attr("previewContainer")){var u='
        ';u=i?'
        '+u+"
        ":u,t.html(u),d=t.find(".markdown-toc")}return i&&d.wrap('

        '),d.html('
          ').children(".markdown-toc-list").html(r.replace(/\r?\n?\\<\/ul\>/g,"")),d},t.tocDropdownMenu=function(t,i){i=i||"Table of Contents";var o=400,r=t.find("."+this.classPrefix+"toc-menu");return r.each(function(){var t=e(this),r=t.children(".markdown-toc"),n='',a=''+n+i+"",s=r.children("ul"),l=s.find("li");r.append(a),l.first().before("
        • "+i+" "+n+"

        • "),t.mouseover(function(){s.show(),l.each(function(){var t=e(this),i=t.children("ul");if(""===i.html()&&i.remove(),i.length>0&&""!==i.html()){var r=t.children("a").first();r.children(".fa").length<1&&r.append(e(n).css({"float":"right",paddingTop:"4px"}))}t.mouseover(function(){i.css("z-index",o).show(),o+=1}).mouseleave(function(){i.hide()})})}).mouseleave(function(){s.hide()})}),r},t.filterHTMLTags=function(t,i){if("string"!=typeof t&&(t=new String(t)),"string"!=typeof i)return t;for(var o=i.split("|"),r=o[0].split(","),n=o[1],a=0,s=r.length;s>a;a++){var l=r[a];t=t.replace(new RegExp("]*)>([^>]*)","igm"),"")}if("undefined"!=typeof n){var c=/\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/gi;t="*"===n?t.replace(c,function(e,t,i,o,r){return"<"+t+">"+o+""}):"on*"===n?t.replace(c,function(t,i,o,r,n){var a=e("<"+i+">"+r+""),s=e(t)[0].attributes,l={};e.each(s,function(e,t){'"'!==t.nodeName&&(l[t.nodeName]=t.nodeValue)}),e.each(l,function(e){0===e.indexOf("on")&&delete l[e]}),a.attr(l);var c="undefined"!=typeof a[1]?e(a[1]).text():"";return a[0].outerHTML+c}):t.replace(c,function(t,i,o,r){var a=n.split(","),s=e(t);return s.html(r),e.each(a,function(e){s.attr(a[e],null)}),s[0].outerHTML})}return t},t.markdownToHTML=function(i,o){var r={gfm:!0,toc:!0,tocm:!1,tocStartLevel:1,tocTitle:"目录",tocDropdown:!1,tocContainer:"",markdown:"",markdownSourceCode:!1,htmlDecode:!1,autoLoadKaTeX:!0,pageBreak:!0,atLink:!0,emailLink:!0,tex:!1,taskList:!1,emoji:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0};t.$marked=marked;var n=e("#"+i),a=n.settings=e.extend(!0,r,o||{}),s=n.find("textarea");s.length<1&&(n.append(""),s=n.find("textarea"));var l=""===a.markdown?s.val():a.markdown,c=[],h={toc:a.toc,tocm:a.tocm,tocStartLevel:a.tocStartLevel,taskList:a.taskList,emoji:a.emoji,tex:a.tex,pageBreak:a.pageBreak,atLink:a.atLink,emailLink:a.emailLink,flowChart:a.flowChart,sequenceDiagram:a.sequenceDiagram,previewCodeHighlight:a.previewCodeHighlight},d={renderer:t.markedRenderer(c,h),gfm:a.gfm,tables:!0,breaks:!0,pedantic:!1,sanitize:a.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l=new String(l);var u=marked(l,d);u=t.filterHTMLTags(u,a.htmlDecode),a.markdownSourceCode?s.text(l):s.remove(),n.addClass("markdown-body "+this.classPrefix+"html-preview").append(u);var f=""!==a.tocContainer?e(a.tocContainer):n;if(""!==a.tocContainer&&f.attr("previewContainer",!1),a.toc&&(n.tocContainer=this.markdownToCRenderer(c,f,a.tocDropdown,a.tocStartLevel),(a.tocDropdown||n.find("."+this.classPrefix+"toc-menu").length>0)&&this.tocDropdownMenu(n,a.tocTitle),""!==a.tocContainer&&n.find(".editormd-toc-menu, .editormd-markdown-toc").remove()),a.previewCodeHighlight&&(n.find("pre").addClass("prettyprint linenums"),prettyPrint()),t.isIE8||(a.flowChart&&n.find(".flowchart").flowChart(),a.sequenceDiagram&&n.find(".sequence-diagram").sequenceDiagram({theme:"simple"})),a.tex){var g=function(){n.find("."+t.classNames.tex).each(function(){var t=e(this);katex.render(t.html().replace(/</g,"<").replace(/>/g,">"),t[0]),t.find(".katex").css("font-size","1.6em")})};!a.autoLoadKaTeX||t.$katex||t.kaTeXLoaded?g():this.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,g()})}return n.getMarkdown=function(){return s.val()},n},t.themes=["default","dark"],t.previewThemes=["default","dark"],t.editorThemes=["default","3024-day","3024-night","ambiance","ambiance-mobile","base16-dark","base16-light","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","mbo","mdn-like","midnight","monokai","neat","neo","night","paraiso-dark","paraiso-light","pastel-on-dark","rubyblue","solarized","the-matrix","tomorrow-night-eighties","twilight","vibrant-ink","xq-dark","xq-light"],t.loadPlugins={},t.loadFiles={js:[],css:[],plugin:[]},t.loadPlugin=function(e,i,o){i=i||function(){},this.loadScript(e,function(){t.loadFiles.plugin.push(e),i()},o)},t.loadCSS=function(e,i,o){o=o||"head",i=i||function(){};var r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.onload=r.onreadystatechange=function(){t.loadFiles.css.push(e),i()},r.href=e+".css","head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.isIE="Microsoft Internet Explorer"==navigator.appName,t.isIE8=t.isIE&&"8."==navigator.appVersion.match(/8./i),t.loadScript=function(e,i,o){o=o||"head",i=i||function(){};var r=null;r=document.createElement("script"),r.id=e.replace(/[\./]+/g,"-"),r.type="text/javascript",r.src=e+".js",t.isIE8?r.onreadystatechange=function(){r.readyState&&("loaded"===r.readyState||"complete"===r.readyState)&&(r.onreadystatechange=null,t.loadFiles.js.push(e),i())}:r.onload=function(){t.loadFiles.js.push(e),i()},"head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.katexURL={css:"//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min",js:"//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min"},t.kaTeXLoaded=!1,t.loadKaTeX=function(e){t.loadCSS(t.katexURL.css,function(){t.loadScript(t.katexURL.js,e||function(){})})},t.lockScreen=function(t){e("html,body").css("overflow",t?"hidden":"")},t.createDialog=function(i){var o={name:"",width:420,height:240,title:"",drag:!0,closed:!0,content:"",mask:!0,maskStyle:{backgroundColor:"#fff",opacity:.1},lockScreen:!0,footer:!0,buttons:!1};i=e.extend(!0,o,i);var r=this,n=this.editor,a=t.classPrefix,s=(new Date).getTime(),l=""===i.name?a+"dialog-"+s:i.name,c=t.mouseOrTouch,h='
          ';""!==i.title&&(h+='
          ",h+=''+i.title+"",h+="
          "),i.closed&&(h+=''),h+='
          '+i.content,(i.footer||"string"==typeof i.footer)&&(h+='"),h+="
          ",h+='
          ',h+='
          ',h+="
          ",n.append(h);var d=n.find("."+l);d.lockScreen=function(t){return i.lockScreen&&(e("html,body").css("overflow",t?"hidden":""),r.resize()),d},d.showMask=function(){return i.mask&&n.find("."+a+"mask").css(i.maskStyle).css("z-index",t.dialogZindex-1).show(),d},d.hideMask=function(){return i.mask&&n.find("."+a+"mask").hide(),d},d.loading=function(e){var t=d.find("."+a+"dialog-mask");return t[e?"show":"hide"](),d},d.lockScreen(!0).showMask(),d.show().css({zIndex:t.dialogZindex,border:t.isIE8?"1px solid #ddd":"",width:"number"==typeof i.width?i.width+"px":i.width,height:"number"==typeof i.height?i.height+"px":i.height});var u=function(){d.css({top:(e(window).height()-d.height())/2+"px",left:(e(window).width()-d.width())/2+"px"})};if(u(),e(window).resize(u),d.children("."+a+"dialog-close").bind(c("click","touchend"),function(){d.hide().lockScreen(!1).hideMask()}),"object"==typeof i.buttons){var f=d.footer=d.find("."+a+"dialog-footer");for(var g in i.buttons){var p=i.buttons[g],m=a+g+"-btn";f.append('"),p[1]=e.proxy(p[1],d),f.children("."+m).bind(c("click","touchend"),p[1])}}if(""!==i.title&&i.drag){var w,v,k=d.children("."+a+"dialog-header");i.mask||k.bind(c("click","touchend"),function(){t.dialogZindex+=2,d.css("z-index",t.dialogZindex)}),k.mousedown(function(e){e=e||window.event,w=e.clientX-parseInt(d[0].style.left),v=e.clientY-parseInt(d[0].style.top),document.onmousemove=y});var b=function(e){e.removeClass(a+"user-unselect").off("selectstart")},x=function(e){e.addClass(a+"user-unselect").on("selectstart",function(e){return!1})},y=function(t){t=t||window.event;var i,o,r=parseInt(d[0].style.left),n=parseInt(d[0].style.top);r>=0?r+d.width()<=e(window).width()?i=t.clientX-w:(i=e(window).width()-d.width(),document.onmousemove=null):(i=0,document.onmousemove=null),n>=0?o=t.clientY-v:(o=0,document.onmousemove=null),document.onselectstart=function(){return!1},x(e("body")),x(d),d[0].style.left=i+"px",d[0].style.top=o+"px"};document.onmouseup=function(){b(e("body")),b(d),document.onselectstart=null,document.onmousemove=null},k.touchDraggable=function(){var t=null,i=function(i){var o=i.originalEvent,r=e(this).parent().position();t={x:o.changedTouches[0].pageX-r.left,y:o.changedTouches[0].pageY-r.top}},o=function(i){i.preventDefault();var o=i.originalEvent;e(this).parent().css({top:o.changedTouches[0].pageY-t.y,left:o.changedTouches[0].pageX-t.x})};this.bind("touchstart",i).bind("touchmove",o)},k.touchDraggable()}return t.dialogZindex+=2,d},t.mouseOrTouch=function(e,t){e=e||"click",t=t||"touchend";var i=e;try{document.createEvent("TouchEvent"),i=t}catch(o){}return i},t.dateFormat=function(e){e=e||"";var t=function(e){return 10>e?"0"+e:e},i=new Date,o=i.getFullYear(),r=o.toString().slice(2,4),n=t(i.getMonth()+1),a=t(i.getDate()),s=i.getDay(),l=t(i.getHours()),c=t(i.getMinutes()),h=t(i.getSeconds()),d=t(i.getMilliseconds()),u="",f=r+"-"+n+"-"+a,g=o+"-"+n+"-"+a,p=l+":"+c+":"+h;switch(e){case"UNIX Time":u=i.getTime();break;case"UTC":u=i.toUTCString();break;case"yy":u=r;break;case"year":case"yyyy":u=o;break;case"month":case"mm":u=n;break;case"cn-week-day":case"cn-wd":var m=["日","一","二","三","四","五","六"];u="星期"+m[s];break;case"week-day":case"wd":var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];u=w[s];break;case"day":case"dd":u=a;break;case"hour":case"hh":u=l;break;case"min":case"ii":u=c;break;case"second":case"ss":u=h;break;case"ms":u=d;break;case"yy-mm-dd":u=f;break;case"yyyy-mm-dd":u=g;break;case"yyyy-mm-dd h:i:s ms":case"full + ms":u=g+" "+p+" "+d;break;case"full":case"yyyy-mm-dd h:i:s":default:u=g+" "+p}return u},t}}); \ No newline at end of file +e.replaceSelection("## "+i),e.setCursor(t.line,t.ch+3)):e.replaceSelection("## "+i)},h3:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("### "+i),e.setCursor(t.line,t.ch+4)):e.replaceSelection("### "+i)},h4:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("#### "+i),e.setCursor(t.line,t.ch+5)):e.replaceSelection("#### "+i)},h5:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("##### "+i),e.setCursor(t.line,t.ch+6)):e.replaceSelection("##### "+i)},h6:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("###### "+i),e.setCursor(t.line,t.ch+7)):e.replaceSelection("###### "+i)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o];e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm,t=e.getCursor();e.getSelection()}e.replaceSelection((0!==t.ch?"\n\n":"\n")+"------------\n\n")},tex:function(){if(!this.settings.tex)return alert("settings.tex === false"),this;var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("$$"+i+"$$"),""===i&&e.setCursor(t.line,t.ch+2)},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},"reference-link":function(){this.executePlugin("referenceLinkDialog","reference-link-dialog/reference-link-dialog")},pagebreak:function(){if(!this.settings.pageBreak)return alert("settings.pageBreak === false"),this;{var e=this.cm;e.getSelection()}e.replaceSelection("\r\n[========]\r\n")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day");e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},"html-entities":function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},"goto-line":function(){this.executePlugin("gotoLineDialog","goto-line-dialog/goto-line-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},search:function(){this.search()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-B":"bold","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.emoji?(e.replaceSelection(":"+i+":"),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.emoji == false")},"Ctrl-Alt-G":"goto-line","Ctrl-H":"hr","Ctrl-I":"italic","Ctrl-K":"code","Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.atLink?(e.replaceSelection("@"+i),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.atLink == false")},"Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Shift-Ctrl-K":"tex","Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3)},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"html-entities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table","Shift-Alt-P":"pagebreak",F9:"watch",F10:"preview",F11:"fullscreen"};var r=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=r;var n=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=n;var a=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=a,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\w\+-]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g,pageBreak:/^\[[=]{8,}\]$/},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/",ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(i,o){var n={toc:!0,tocm:!1,tocStartLevel:1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},a=e.extend(n,o||{}),s=t.$marked,l=new s.Renderer;i=i||[];var c=t.regexs,h=c.atLink,d=c.emoji,u=c.email,f=c.emailLink,g=c.twemoji,p=c.fontAwesome,m=c.editormdLogo,w=c.pageBreak;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!a.emoji)return e;for(var o=0,r=i.length;r>o;o++)":+1:"===i[o]&&(i[o]=":\\+1:"),e=e.replace(new RegExp(i[o]),function(e,i){var o=e.match(p),r=e.replace(/:/g,"");if(o)for(var n=0,a=o.length;a>n;n++){var s=o[n].replace(/:/g,"");return''}else{var l=e.match(m),c=e.match(g);if(l)for(var h=0,d=l.length;d>h;h++){var u=l[h].replace(/:/g,"");return''}else{if(!c){var f="+1"===r?"plus1":r;return f="black_large_square"===f?"black_square":f,f="moon"===f?"waxing_gibbous_moon":f,':'+r+':'}for(var w=0,v=c.length;v>w;w++){var k=c[w].replace(/:/g,"").replace("tw-","");return'twemoji-'+k+''}}}});return e},l.atLink=function(i){return h.test(i)?(a.atLink&&(i=i.replace(u,function(e,t,i,o){return e.replace(/@/g,"_#_@_#_")}),i=i.replace(h,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),a.emailLink&&(i=i.replace(f,function(t,i,o,r,n){return!i&&e.inArray(n,"jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|"))<0?''+t+"":t})),i):i},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var n=''+i.replace(/@/g,"@")+""):(t&&(n+=' title="'+t+'"'),n+=">"+i+"")},l.heading=function(e,t,o){var n=e,a=/\s*\]*)\>(.*)\<\/a\>\s*/;if(a.test(e)){var s=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var l=0,c=e.length;c>l;l++)s.push(e[l].replace(/\s*href\=\"(.*)\"\s*/g,""));e=s.join(" ")}e=r(e);var h=e.toLowerCase().replace(/[^\w]+/g,"-"),d={text:e,level:t,slug:h},u=/^[\u4e00-\u9fa5]+$/.test(e),f=u?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");i.push(d);var g="';return g+='',g+='',g+=this.atLink(a?this.emoji(n):this.emoji(e)),g+=""},l.pageBreak=function(e){return w.test(e)&&a.pageBreak&&(e='
          '),e},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",n=a.tocm?/^(\[TOC\]|\[TOCM\])$/.test(e):/^\[TOC\]$/.test(e),s=/^\[TOCM\]$/.test(e);e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e;var l='
          '+e+"
          ";return n?s?'
          '+l+"

          ":l:w.test(e)?this.pageBreak(e):""+this.atLink(this.emoji(e))+"

          \n"},l.code=function(e,i,o){return"seq"===i||"sequence"===i?'
          '+e+"
          ":"flow"===i?'
          '+e+"
          ":"math"===i||"latex"===i||"katex"===i?'

          '+e+"

          ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return a.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
        • '+this.atLink(this.emoji(e))+"
        • "):"
        • "+this.atLink(this.emoji(e))+"
        • "},l},t.markdownToCRenderer=function(e,t,i,o){var r="",n=0,a=this.classPrefix;o=o||1;for(var s=0,l=e.length;l>s;s++){var c=e[s].text,h=e[s].level;o>h||(r+=h>n?"":n>h?new Array(n-h+2).join("
      • "):"",r+='
      • '+c+"