diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index ac25fbe9d..770c36a58 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -19,7 +19,7 @@ class CommentsController < ApplicationController default_search_scope :news include ApplicationHelper model_object News - before_filter :find_model_object + before_filter :find_model_object before_filter :find_project_from_association before_filter :authorize @@ -76,6 +76,6 @@ class CommentsController < ApplicationController @comment = nil @news end - - + + end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 87c1e288b..2e9925916 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -115,23 +115,16 @@ class HomeworkCommonController < ApplicationController end end - # uri = URI('http://test.gitlab.trustie.net/api/questions.json') - # req = Net::HTTP::Post.new(uri, initheader = {'Content-Type' =>'application/json'}) - # req.body = question.to_json - # res = Net::HTTP.start(uri.hostname, uri.port) do |http| - # http.request(req) + # uri = URI('http://192.168.80.21:8080/api/questions.json') + # body = question.to_json + # res = Net::HTTP.new(uri.host, uri.port).start do |client| + # request = Net::HTTP::Post.new(uri.path) + # request.body = body + # request["Content-Type"] = "application/json" + # client.request(request) # end - - uri = URI('http://192.168.80.21:8080/api/questions.json') - body = question.to_json - res = Net::HTTP.new(uri.host, uri.port).start do |client| - request = Net::HTTP::Post.new(uri.path) - request.body = body - request["Content-Type"] = "application/json" - client.request(request) - end - result = JSON.parse(res.body) - homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 + # result = JSON.parse(res.body) + # homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 homework.homework_detail_programing = homework_detail_programing else @@ -254,15 +247,15 @@ class HomeworkCommonController < ApplicationController question[:input] << test.input question[:output] << test.output end - uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json") - body = question.to_json - res = Net::HTTP.new(uri.host, uri.port).start do |client| - request = Net::HTTP::Put.new(uri.path) - request.body = body - request["Content-Type"] = "application/json" - client.request(request) - end - result = JSON.parse(res.body) + # uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json") + # body = question.to_json + # res = Net::HTTP.new(uri.host, uri.port).start do |client| + # request = Net::HTTP::Put.new(uri.path) + # request.body = body + # request["Content-Type"] = "application/json" + # client.request(request) + # end + # result = JSON.parse(res.body) end @homework.save_attachments(params[:attachments]) @@ -406,4 +399,4 @@ class HomeworkCommonController < ApplicationController student_works += student_works student_works[index + 1 .. index + n] end -end \ No newline at end of file +end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 9f4b5f171..c73e6bc93 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -66,14 +66,14 @@ class IssuesController < ApplicationController if @query.valid? case params[:format] - when 'csv', 'pdf' - @limit = 10#Setting.issues_export_limit.to_i - when 'atom' - @limit = 10#Setting.feeds_limit.to_i - when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 10}) - else - @limit = 10#per_page_option + when 'csv', 'pdf' + @limit = 10#Setting.issues_export_limit.to_i + when 'atom' + @limit = 10#Setting.feeds_limit.to_i + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 10}) + else + @limit = 10#per_page_option end @assign_to_id = params[:assigned_to_id] @author_id = params[:author_id] @@ -84,9 +84,9 @@ class IssuesController < ApplicationController @issue_pages = Paginator.new @issue_count, @limit, params['page'] @offset ||= @issue_pages.offset @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => sort_clause, - :offset => @offset, - :limit => @limit) + :order => sort_clause, + :offset => @offset, + :limit => @limit) @issue_count_by_group = @query.issue_count_by_group respond_to do |format| format.js @@ -143,16 +143,16 @@ class IssuesController < ApplicationController @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq respond_to do |format|`` - format.html { - retrieve_previous_and_next_issue_ids - render :template => 'issues/show', :layout => @project_base_tag#by young - } - format.api - format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } - format.pdf { - pdf = issue_to_pdf(@issue, :journals => @journals) - send_data(pdf, :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") - } + format.html { + retrieve_previous_and_next_issue_ids + render :template => 'issues/show', :layout => @project_base_tag#by young + } + format.api + format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } + format.pdf { + pdf = issue_to_pdf(@issue, :journals => @journals) + send_data(pdf, :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") + } end end @@ -322,8 +322,8 @@ class IssuesController < ApplicationController issue.reload if @copy issue = issue.copy({}, - :attachments => params[:copy_attachments].present?, - :subtasks => params[:copy_subtasks].present? + :attachments => params[:copy_attachments].present?, + :subtasks => params[:copy_subtasks].present? ) end journal = issue.init_journal(User.current, params[:notes]) @@ -353,21 +353,21 @@ class IssuesController < ApplicationController @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f if @hours > 0 case params[:todo] - when 'destroy' - # nothing to do - when 'nullify' - TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues]) - when 'reassign' - reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) - if reassign_to.nil? - flash.now[:error] = l(:error_issue_not_found_in_project) - return + when 'destroy' + # nothing to do + when 'nullify' + TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues]) + when 'reassign' + reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) + if reassign_to.nil? + flash.now[:error] = l(:error_issue_not_found_in_project) + return + else + TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) + end else - TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) - end - else - # display the destroy form if it's a user request - return unless api_request? + # display the destroy form if it's a user request + return unless api_request? end end @issues.each do |issue| @@ -435,14 +435,14 @@ class IssuesController < ApplicationController issue_attributes = params[:issue] if issue_attributes && params[:conflict_resolution] case params[:conflict_resolution] - when 'overwrite' - issue_attributes = issue_attributes.dup - issue_attributes.delete(:lock_version) - when 'add_notes' - issue_attributes = issue_attributes.slice(:notes) - when 'cancel' - redirect_to issue_url(@issue) - return false + when 'overwrite' + issue_attributes = issue_attributes.dup + issue_attributes.delete(:lock_version) + when 'add_notes' + issue_attributes = issue_attributes.slice(:notes) + when 'cancel' + redirect_to issue_url(@issue) + return false end end @issue.safe_attributes = issue_attributes diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 1af832b79..7726ab3da 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -3,13 +3,45 @@ class StudentWorkController < ApplicationController include StudentWorkHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list] protect_from_forgery :except => :set_program_score + ### + def program_test + resultObj = {status: 0, results: [], error_msg: '', time: Time.now} + student_work = find_or_save_student_work + unless student_work + resultObj[:status] = 100 + else + if @homework.homework_type == 2 && @homework.homework_detail_programing + result = test_realtime(student_work, params[:src]) + logger.debug result + resultObj[:status] = result["status"] + resultObj[:results] = result["results"] + resultObj[:error_msg] = result["error_msg"] + results = result["results"] + if result["status"].to_i == -2 #编译错误 + results = [result["error_msg"]] + end + student_work_test = student_work.student_work_tests.build(status: result["status"], results: results, + src: params[:src]) + unless student_work.save + resultObj[:status] = 200 + else + resultObj[:status] = result["status"].to_i + resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:index] = student_work.student_work_tests.count + end + + end + end + render :json => resultObj + end + def index #设置作业对应的forge_messages表的viewed字段 query_student_work = @homework.course_messages @@ -102,20 +134,16 @@ class StudentWorkController < ApplicationController end def new - student_work = @homework.student_works.where("user_id = ?",User.current.id).first - if student_work.nil? - @stundet_work = StudentWork.new - respond_to do |format| - format.html - end - else - render_403 + @student_work = @homework.student_works.where("user_id = ?",User.current.id).first + if @student_work.nil? + @student_work = StudentWork.new end end def create if params[:student_work] - stundet_work = StudentWork.new + stundet_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id] + stundet_work ||= StudentWork.new stundet_work.name = params[:student_work][:name] stundet_work.description = params[:student_work][:description] stundet_work.project_id = params[:student_work][:project_id] @@ -128,23 +156,9 @@ class StudentWorkController < ApplicationController stundet_work.late_penalty = 0 end render_attachment_warning_if_needed(stundet_work) - if stundet_work.save if @homework.homework_type == 2 && @homework.homework_detail_programing #编程作业,学生提交作品后计算系统得分 - url = "http://192.168.80.21:8080/api/questions/#{@homework.homework_detail_programing.question_id}/solutions.json" - solutions = { - student_work_id:stundet_work.id, - src:Base64.encode64(stundet_work.description), - language:@homework.homework_detail_programing.language - } - uri = URI(url) - body = solutions.to_json - res = Net::HTTP.new(uri.host, uri.port).start do |client| - request = Net::HTTP::Post.new(uri.path) - request.body = body - request["Content-Type"] = "application/json" - client.request(request) - end + end respond_to do |format| format.html { @@ -584,4 +598,44 @@ class StudentWorkController < ApplicationController book.write xls_report xls_report.string end + + def find_or_save_student_work + student_work = @homework.student_works.where(user_id: User.current.id).first + if student_work.nil? + @homework.student_works.build( + name: params[:title], + description: params[:src], + user_id: User.current.id + ) + unless @homework.save + else + student_work = @homework.student_works.where(user_id: User.current.id).first + end + end + student_work + end + + + def test_realtime(student_work, src) + url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json" + + factor = [] + @homework.homework_tests.each do |test| + factor << {input: test.input, output: test.output} + end + solutions = { + src:src, + language:@homework.homework_detail_programing.language, + factor: factor + } + uri = URI(url) + body = solutions.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Post.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + JSON.parse(res.body) + end end \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6671f122b..ea4dc25a3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -41,12 +41,12 @@ class UsersController < ApplicationController before_filter :can_show_course, :only => [:user_courses,:user_homeworks] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, - :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, - :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, - :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, - :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, - :user_import_homeworks,:user_search_homeworks,:user_import_resource] + :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, + :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, + :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, + :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, + :user_import_homeworks,:user_search_homeworks,:user_import_resource] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -223,7 +223,7 @@ class UsersController < ApplicationController end # end - ##added by fq +##added by fq def watch_bids # cond = 'bids.reward_type <> 1' # @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang @@ -286,7 +286,7 @@ class UsersController < ApplicationController unless User.current.admin? if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end @@ -347,6 +347,24 @@ class UsersController < ApplicationController end end + def new_user_commit_homework + @user = User.current + @homework = HomeworkCommon.find(params[:homework_id]) + @student_work = @homework.student_works.where(user_id: User.current.id).first + if @student_work.nil? + @student_work = StudentWork.new + end + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end + end + + def user_commit_homework + flash[:notice] = l(:notice_successful_create) + redirect_to user_homeworks_user_path(User.current) + end + def user_new_homework if params[:homework_common] homework = HomeworkCommon.new @@ -354,7 +372,7 @@ class UsersController < ApplicationController homework.description = params[:homework_common][:description] homework.end_time = params[:homework_common][:end_time] || Time.now homework.publish_time = Time.now - homework.homework_type = 1 + homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 2 homework.user_id = User.current.id homework.course_id = params[:course_id] @@ -363,17 +381,36 @@ class UsersController < ApplicationController render_attachment_warning_if_needed(homework) #匿评作业相关属性 - homework_detail_manual = HomeworkDetailManual.new - homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - homework_detail_manual.comment_status = 1 - homework_detail_manual.evaluation_start = Time.now - homework_detail_manual.evaluation_end = Time.now - homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 - homework_detail_manual.absence_penalty = 2 - homework.homework_detail_manual = homework_detail_manual + if homework.homework_type == 1 + homework_detail_manual = HomeworkDetailManual.new + homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 + homework_detail_manual.comment_status = 1 + homework_detail_manual.evaluation_start = Time.now + homework_detail_manual.evaluation_end = Time.now + homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 + homework_detail_manual.absence_penalty = 2 + homework.homework_detail_manual = homework_detail_manual + else + homework_detail_programing = HomeworkDetailPrograming.new + homework.homework_detail_programing = homework_detail_programing + homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 + homework_detail_programing.language = params[:program][:language].to_i + + inputs = params[:program][:input] + if Array === inputs + inputs.each_with_index do |val, i| + homework.homework_tests << HomeworkTest.new( + input: val, + output: params[:program][:output][i] + ) + end + end + + end if homework.save homework_detail_manual.save if homework_detail_manual + homework_detail_programing.save if homework_detail_programing redirect_to user_homeworks_user_path(User.current.id) end end @@ -406,18 +443,18 @@ class UsersController < ApplicationController return end if(params[:type].blank? || params[:type] == "1") #全部 - user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ - "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") + user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") elsif params[:type] == "2" #课程资源 - user_course_ids = User.current.courses.map { |c| c.id} - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc") + user_course_ids = User.current.courses.map { |c| c.id} + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc") elsif params[:type] == "3" #项目资源 - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") elsif params[:type] == "4" #附件 - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") elsif params[:type] == "5" #用户资源 - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc") end @type = params[:type] @limit = 7 @@ -437,18 +474,18 @@ class UsersController < ApplicationController def user_ref_resource_search search = params[:search].to_s.strip.downcase if(params[:type].blank? || params[:type] == "1") #全部 - user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 - @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ - " or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like '%#{search}%') ").order("created_on desc") + user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询 + @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + " or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like '%#{search}%') ").order("created_on desc") elsif params[:type] == "2" #课程资源 - user_course_ids = User.current.courses.map { |c| c.id} - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) and (filename like '%#{search}%') ").order("created_on desc") + user_course_ids = User.current.courses.map { |c| c.id} + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) and (filename like '%#{search}%') ").order("created_on desc") elsif params[:type] == "3" #项目资源 - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project' and (filename like '%#{search}%')").order("created_on desc") elsif params[:type] == "4" #附件 - @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc") elsif params[:type] == "5" #用户资源 - @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc") + @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc") end @type = params[:type] @limit = 7 @@ -466,20 +503,20 @@ class UsersController < ApplicationController #将资源批量引入 def import_resources_to_homework @attachments = [] - unless params[:checkbox1].nil? || params[:checkbox1].blank? - params[:checkbox1].each do |id| - atta = Attachment.find(id) - att_copy = atta.copy - att_copy.container_id = nil - att_copy.container_type = nil - att_copy.copy_from = atta.id - att_copy.save - @attachments << att_copy - end - end - respond_to do |format| - format.js + unless params[:checkbox1].nil? || params[:checkbox1].blank? + params[:checkbox1].each do |id| + atta = Attachment.find(id) + att_copy = atta.copy + att_copy.container_id = nil + att_copy.container_type = nil + att_copy.copy_from = atta.id + att_copy.save + @attachments << att_copy end + end + respond_to do |format| + format.js + end end @@ -529,16 +566,16 @@ class UsersController < ApplicationController sort_update %w(login firstname lastname mail admin created_on last_login_on) case params[:format] - when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 15}) - else - @limit = 15 + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 15}) + else + @limit = 15 end # retrieve all users # 先内连一下statuses 保证排序之后数量一致 scope = User.visible. - joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id") + joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id") # unknow scope = scope.in_group(params[:group_id]) if params[:group_id].present? @@ -549,29 +586,29 @@ class UsersController < ApplicationController # users classify case params[:user_sort_type] - when '0' - # 创建时间排序 - @s_type = 0 - @users = scope.reorder('users.created_on DESC') - when '1' - # 活跃度排序, 就是所谓的得分情况 - @s_type = 1 - @users = scope. - joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1"). - reorder('option_numbers.total_score DESC') - when '2' - # 粉丝数排序 - @s_type = 2 - @users = scope. - #joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id"). - reorder('user_statuses.watchers_count DESC') + when '0' + # 创建时间排序 + @s_type = 0 + @users = scope.reorder('users.created_on DESC') + when '1' + # 活跃度排序, 就是所谓的得分情况 + @s_type = 1 + @users = scope. + joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1"). + reorder('option_numbers.total_score DESC') + when '2' + # 粉丝数排序 + @s_type = 2 + @users = scope. + #joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id"). + reorder('user_statuses.watchers_count DESC') - else - # 默认活跃度排序 - @s_type = 1 - @users = scope. - joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1"). - reorder('option_numbers.total_score DESC') + else + # 默认活跃度排序 + @s_type = 1 + @users = scope. + joins("LEFT JOIN option_numbers ON users.id = option_numbers.user_id and option_numbers.score_type = 1"). + reorder('option_numbers.total_score DESC') end # limit and offset @@ -591,20 +628,20 @@ class UsersController < ApplicationController sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) (redirect_to user_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? - case params[:format] + case params[:format] when 'xml', 'json' @offset, @limit = api_offset_and_limit({:limit => 15}) else @limit = 15#per_page_option - end - # - #@status = params[:status] || 1 - #has = { - # "show_changesets" => true - #} - # scope = User.logged.status(@status) - # @search_by = params[:search_by] ? params[:search_by][:id] : 0 - # scope = scope.like(params[:name],@search_by) if params[:name].present? + end + # + #@status = params[:status] || 1 + #has = { + # "show_changesets" => true + #} + # scope = User.logged.status(@status) + # @search_by = params[:search_by] ? params[:search_by][:id] : 0 + # scope = scope.like(params[:name],@search_by) if params[:name].present? @search_by = params[:search_by] ? params[:search_by] : 0 us = UsersService.new @@ -637,13 +674,13 @@ class UsersController < ApplicationController def user_courses4show @page = params[:page].to_i + 1 @courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) - end + end #显示更多用户项目 def user_projects4show @page = params[:page].to_i + 1 @projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5).offset(@page * 5) - end + end def user_course_activities lastid = nil @@ -741,7 +778,7 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) else @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) - end + end else @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) end @@ -759,124 +796,124 @@ class UsersController < ApplicationController # Author lizanle # Description type 1 :所有动态包括我关注的人 type 2:我的动态 type 3:关于我的回复 case params[:type] - when "1" - if @user == User.current - activity = Activity.where('user_id = ?', User.current.id).order('id desc') - @activity_count = activity.count - @activity_pages = Paginator.new @activity_count, pre_count, params['page'] - @activity = activity.offset(@activity_pages.offset).limit(@activity_pages.per_page).all - @state = 1 - end - when "2" - message = [] - if @user == User.current - message = JournalsForMessage.reference_message(@user.id) - message += Journal.reference_message(@user.id) - end - @activity_count = message.size - @info_pages = Paginator.new @activity_count, pre_count, params['page'] - messages = message.sort {|x,y| y.created_on <=> x.created_on } - @message = messages[@info_pages.offset, @info_pages.per_page] - @state = 2 + when "1" + if @user == User.current + activity = Activity.where('user_id = ?', User.current.id).order('id desc') + @activity_count = activity.count + @activity_pages = Paginator.new @activity_count, pre_count, params['page'] + @activity = activity.offset(@activity_pages.offset).limit(@activity_pages.per_page).all + @state = 1 + end + when "2" + message = [] + if @user == User.current + message = JournalsForMessage.reference_message(@user.id) + message += Journal.reference_message(@user.id) + end + @activity_count = message.size + @info_pages = Paginator.new @activity_count, pre_count, params['page'] + messages = message.sort {|x,y| y.created_on <=> x.created_on } + @message = messages[@info_pages.offset, @info_pages.per_page] + @state = 2 else - # Time 2015-02-04 10:50:49 - # Author lizanle - # Description 所有动态 - where_condition = nil; - # where_condition = "act_type <> 'JournalsForMessage'" - user_ids = [] - if @user == User.current - watcher = User.watched_by(@user) - watcher.push(User.current) - user_ids = watcher.map{|x| x.id} - else - user_ids << @user.id - end - activity = Activity.where(where_condition).where(user_id: user_ids).order('id desc') - - permission = !User.current.admin? - if permission - #Issue - act_ids = activity.where(act_type: 'Issue').select('act_id').map{|x| x.act_id} - project_ids = Issue.where(id: act_ids).select('distinct project_id').map{|x| x.project_id} - p_ids = [] - Project.where(id: project_ids).each do |x| - p_ids << x.id unless x.visible?(User.current) + # Time 2015-02-04 10:50:49 + # Author lizanle + # Description 所有动态 + where_condition = nil; + # where_condition = "act_type <> 'JournalsForMessage'" + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id end - ids = [] - ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id} + activity = Activity.where(where_condition).where(user_id: user_ids).order('id desc') - #HomeworkCommon - act_ids = activity.where(act_type: 'HomeworkCommon').select('act_id').map{|x| x.act_id} - course_ids = HomeworkCommon.where(id: act_ids).select('distinct course_id').map{|x| x.course_id} - c_ids = [] - Course.where(id: course_ids).each do |x| - c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) + permission = !User.current.admin? + if permission + #Issue + act_ids = activity.where(act_type: 'Issue').select('act_id').map{|x| x.act_id} + project_ids = Issue.where(id: act_ids).select('distinct project_id').map{|x| x.project_id} + p_ids = [] + Project.where(id: project_ids).each do |x| + p_ids << x.id unless x.visible?(User.current) + end + ids = [] + ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id} + + #HomeworkCommon + act_ids = activity.where(act_type: 'HomeworkCommon').select('act_id').map{|x| x.act_id} + course_ids = HomeworkCommon.where(id: act_ids).select('distinct course_id').map{|x| x.course_id} + c_ids = [] + Course.where(id: course_ids).each do |x| + c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) + end + ids << HomeworkCommon.where(id: act_ids, course_id: c_ids).map{|x| x.id} + + #Journal + act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id} + project_ids = Journal.where(id:act_ids, journalized_type: 'Project').select('distinct journalized_id').map{|x| x.journalized_id} + p_ids = [] + Project.where(id: project_ids).each do |x| + p_ids << x.id unless x.visible?(User.current) + end + ids << Journal.where(id: act_ids, journalized_id: p_ids, journalized_type: 'Project').map{|x| x.id} + + #News + act_ids = activity.where(act_type: 'News').select('act_id').map{|x| x.act_id} + project_ids = News.where(id: act_ids).select('distinct project_id').map{|x| x.project_id} + p_ids = [] + Project.where(id: project_ids).each do |x| + p_ids << x.id unless x.visible?(User.current) + end + ids << News.where(id: act_ids, project_id: p_ids).map{|x| x.id} + + project_ids = News.where(id: act_ids).select('distinct course_id').map{|x| x.course_id} + c_ids = [] + Course.where(id: project_ids).each do |x| + c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) + end + ids << News.where(id: act_ids, course_id: p_ids).map{|x| x.id} + + #Message + act_ids = activity.where(act_type: 'Message').select('act_id').map{|x| x.act_id} + board_ids = Message.where(id: act_ids).select('distinct board_id').map{|x| x.board_id} + project_ids = Board.where(id: board_ids).select('distinct project_id').map{|x| x.project_id} + p_ids = [] + Project.where(id: project_ids).each do |x| + p_ids << x.id unless x.visible?(User.current) + end + ids << Message.where(id: act_ids, board_id: p_ids).map{|x| x.id} + + project_ids = Board.where(id: board_ids).select('distinct course_id').map{|x| x.course_id} + c_ids = [] + Course.where(id: project_ids).each do |x| + c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) + end + ids << Message.where(id: act_ids, board_id: c_ids).map{|x| x.id} + + logger.debug "filter ids #{ids}" + + activity = activity.where('act_id not in (?)', ids.flatten ).order('id desc') unless ids.flatten.empty? end - ids << HomeworkCommon.where(id: act_ids, course_id: c_ids).map{|x| x.id} - #Journal - act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id} - project_ids = Journal.where(id:act_ids, journalized_type: 'Project').select('distinct journalized_id').map{|x| x.journalized_id} - p_ids = [] - Project.where(id: project_ids).each do |x| - p_ids << x.id unless x.visible?(User.current) - end - ids << Journal.where(id: act_ids, journalized_id: p_ids, journalized_type: 'Project').map{|x| x.id} + # activity = activity.reject { |e| + # e.act.nil? || + # (!User.current.admin? && !e.act.nil? + # (((e.act_type == "Issue") && !e.act.project.visible?(User.current)) || + # (e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) || + # (e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) || + # (e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) || + # (e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course)))))) + # } + # - #News - act_ids = activity.where(act_type: 'News').select('act_id').map{|x| x.act_id} - project_ids = News.where(id: act_ids).select('distinct project_id').map{|x| x.project_id} - p_ids = [] - Project.where(id: project_ids).each do |x| - p_ids << x.id unless x.visible?(User.current) - end - ids << News.where(id: act_ids, project_id: p_ids).map{|x| x.id} - - project_ids = News.where(id: act_ids).select('distinct course_id').map{|x| x.course_id} - c_ids = [] - Course.where(id: project_ids).each do |x| - c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) - end - ids << News.where(id: act_ids, course_id: p_ids).map{|x| x.id} - - #Message - act_ids = activity.where(act_type: 'Message').select('act_id').map{|x| x.act_id} - board_ids = Message.where(id: act_ids).select('distinct board_id').map{|x| x.board_id} - project_ids = Board.where(id: board_ids).select('distinct project_id').map{|x| x.project_id} - p_ids = [] - Project.where(id: project_ids).each do |x| - p_ids << x.id unless x.visible?(User.current) - end - ids << Message.where(id: act_ids, board_id: p_ids).map{|x| x.id} - - project_ids = Board.where(id: board_ids).select('distinct course_id').map{|x| x.course_id} - c_ids = [] - Course.where(id: project_ids).each do |x| - c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) - end - ids << Message.where(id: act_ids, board_id: c_ids).map{|x| x.id} - - logger.debug "filter ids #{ids}" - - activity = activity.where('act_id not in (?)', ids.flatten ).order('id desc') unless ids.flatten.empty? - end - - # activity = activity.reject { |e| - # e.act.nil? || - # (!User.current.admin? && !e.act.nil? - # (((e.act_type == "Issue") && !e.act.project.visible?(User.current)) || - # (e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) || - # (e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) || - # (e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) || - # (e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course)))))) - # } - # - - @activity_count = activity.count - @activity_pages = Paginator.new @activity_count, pre_count, params['page'] - @activity = activity.slice(@activity_pages.offset,@activity_pages.per_page) - @state = 0 + @activity_count = activity.count + @activity_pages = Paginator.new @activity_count, pre_count, params['page'] + @activity = activity.slice(@activity_pages.offset,@activity_pages.per_page) + @state = 0 end if params[:user].present? @@ -904,7 +941,7 @@ class UsersController < ApplicationController if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) # redirect_to home_path render_404 - return + return end end @@ -936,7 +973,7 @@ class UsersController < ApplicationController unless User.current.admin? if !@user.active? render_404 - return + return end end @@ -994,7 +1031,7 @@ class UsersController < ApplicationController unless @user.id.nil? #后台注册的用户默认权限为男性开发员 ue = UserExtensions.create(:identity => 3, - :gender => 0, + :gender => 0, :user_id => @user.id) ue.save end @@ -1064,7 +1101,7 @@ class UsersController < ApplicationController @user = User.find(params[:id]) #@user.save_attachments(params[:attachments],User.current) # Container_type为Principal - Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type]) + Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type]) if(params[:type].blank?|| params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 @@ -1120,10 +1157,10 @@ class UsersController < ApplicationController # 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源 def user_resource_delete if params[:resource_id].present? - Attachment.where("author_id = #{User.current.id}").delete(params[:resource_id]) + Attachment.where("author_id = #{User.current.id}").delete(params[:resource_id]) elsif params[:checkbox1].present? - params[:checkbox1].each do |id| - Attachment.where("author_id = #{User.current.id}").delete(id) + params[:checkbox1].each do |id| + Attachment.where("author_id = #{User.current.id}").delete(id) end end @@ -1174,17 +1211,17 @@ class UsersController < ApplicationController @offset ||= @atta_pages.offset #@curse_attachments_all = @all_attachments[@offset, @limit] @attachments = paginateHelper @attachments,25 - respond_to do |format| - format.js - end + respond_to do |format| + format.js + end end #根据id或者名称搜索教师或者助教为当前用户的课程 def search_user_course @user = User.current if !params[:search].nil? - @course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like '%#{params[:search.to_s]}%'") - .select { |course| @user.allowed_to?(:as_teacher,course)} + @course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like '%#{params[:search.to_s]}%'") + .select { |course| @user.allowed_to?(:as_teacher,course)} else @course = @user.courses .select { |course| @user.allowed_to?(:as_teacher,course)} @@ -1216,28 +1253,28 @@ class UsersController < ApplicationController # 将资源发送到对应的课程,分为发送单个,或者批量发送 def add_exist_file_to_course @flag = true - if params[:send_id].present? + if params[:send_id].present? send_id = params[:send_id] ori = Attachment.find_by_id(send_id) course_ids = params[:course_ids] if course_ids.nil? @flag = false end - unless course_ids.nil? - course_ids.each do |id| - next if ori.blank? - attach_copied_obj = ori.copy - attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 - attach_copied_obj.container = Course.find(id) - attach_copied_obj.created_on = Time.now - attach_copied_obj.author_id = User.current.id - if attach_copied_obj.attachtype == nil - attach_copied_obj.attachtype = 4 - end - attach_copied_obj.save - @save_message = attach_copied_obj.errors.full_messages - end + unless course_ids.nil? + course_ids.each do |id| + next if ori.blank? + attach_copied_obj = ori.copy + attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 + attach_copied_obj.container = Course.find(id) + attach_copied_obj.created_on = Time.now + attach_copied_obj.author_id = User.current.id + if attach_copied_obj.attachtype == nil + attach_copied_obj.attachtype = 4 + end + attach_copied_obj.save + @save_message = attach_copied_obj.errors.full_messages end + end elsif params[:send_ids].present? send_ids = params[:send_ids].split(" ") course_ids = params[:course_ids] @@ -1264,7 +1301,7 @@ class UsersController < ApplicationController end end else - @flag = false + @flag = false end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ @@ -1353,15 +1390,15 @@ class UsersController < ApplicationController # 资源预览 def resource_preview - preview_id = params[:resource_id] - @file = Attachment.find(preview_id) - @preview_able = false; - if %w(pdf pptx doc docx xls xlsx).any?{|x| @file.filename.downcase.end_with?(x)} - @preview_able = true; - end - respond_to do |format| - format.js - end + preview_id = params[:resource_id] + @file = Attachment.find(preview_id) + @preview_able = false; + if %w(pdf pptx doc docx xls xlsx).any?{|x| @file.filename.downcase.end_with?(x)} + @preview_able = true; + end + respond_to do |format| + format.js + end end # 重命名资源 @@ -1401,7 +1438,7 @@ class UsersController < ApplicationController def destroy_membership @membership = Member.find(params[:membership_id]) if @membership.deletable? - @membership.destroy + @membership.destroy end respond_to do |format| format.html { redirect_to edit_user_url(@user, :tab => 'memberships') } @@ -1416,31 +1453,31 @@ class UsersController < ApplicationController @obj_flag = params[:tag_for_save][:object_flag] case @obj_flag - when '1' then - @obj = User.find_by_id(@obj_id) - when '2' then - @obj = Project.find_by_id(@obj_id) - when '3' then - @obj = Issue.find_by_id(@obj_id) - when '4' then - # @obj = Bid.find_by_id(@obj_id) - when '5' then - @obj = Forum.find_by_id(@obj_id) - when '6' - @obj = Attachment.find_by_id(@obj_id) - when '7' then - @obj = Contest.find_by_id(@obj_id) - when '8' - @obj = OpenSourceProject.find_by_id(@obj_id) - when '9' - @obj = Course.find_by_id(@obj_id) - else - @obj = nil + when '1' then + @obj = User.find_by_id(@obj_id) + when '2' then + @obj = Project.find_by_id(@obj_id) + when '3' then + @obj = Issue.find_by_id(@obj_id) + when '4' then + # @obj = Bid.find_by_id(@obj_id) + when '5' then + @obj = Forum.find_by_id(@obj_id) + when '6' + @obj = Attachment.find_by_id(@obj_id) + when '7' then + @obj = Contest.find_by_id(@obj_id) + when '8' + @obj = OpenSourceProject.find_by_id(@obj_id) + when '9' + @obj = Course.find_by_id(@obj_id) + else + @obj = nil end unless @obj.nil? @obj.tag_list.add(@tags.split(",")) else - return + return end if @obj.save logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}" @@ -1531,9 +1568,9 @@ class UsersController < ApplicationController def update_extensions(user_extensions) user_extensions = params[:user_extensions] unless user_extensions.nil? - user_extensions = UserExtensions.find_by_id(user_extensions.user_id) + user_extensions = UserExtensions.find_by_id(user_extensions.user_id) - # user_extensions. + # user_extensions. end end @@ -1624,9 +1661,9 @@ class UsersController < ApplicationController else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type in" + - " ('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon'))"+ - " or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )" + - " and (filename like '%#{search}%') ").order("created_on desc") + " ('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon'))"+ + " or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )" + + " and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "2" #课程资源 if User.current.id.to_i == params[:id].to_i @@ -1635,7 +1672,7 @@ class UsersController < ApplicationController else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中 @attachments = Attachment.where("((author_id = #{params[:id]} and is_public = 1 and container_type = 'Course') "+ - "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )"+ + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) )"+ " and (filename like '%#{search}%') ").order("created_on desc") end elsif params[:type] == "3" #项目资源 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7b83bb1c2..fcf28506a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2337,7 +2337,7 @@ module ApplicationHelper #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 def user_for_homework_common homework,is_teacher if is_teacher #老师显示作品数量 - link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" + link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else #学生显示提交作品、修改作品等按钮 work = cur_user_works_for_homework homework if work.nil? diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index e7ab001da..b9f762f69 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -71,7 +71,7 @@ module UsersHelper def user_settings_tabs tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general}, {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural} - ] + ] if Group.all.any? tabs.insert 1, {:name => 'groups', :partial => 'users/groups', :label => :label_group_plural} end @@ -83,7 +83,7 @@ module UsersHelper def get_users_by_tag(tag_name) User.tagged_with(tag_name).order('updated_on desc') end - + # added by fq # - + # TODO: 待删 # def show_activity(state) # content = ''.html_safe @@ -114,19 +114,19 @@ module UsersHelper # end # content_tag('div', content, :class => "pagination") # end - + #TODO: 待删 def watch_projects(state) content = ''.html_safe case state - when 0 - s = content_tag('span', l(:label_project_take), :class => "current-page") - content << content_tag('li', s) - content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1})) - when 1 - s = content_tag('span', l(:label_has_watched_project), :class => "current-page") - content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'})) - content << content_tag('li', s, :class => "current-page") + when 0 + s = content_tag('span', l(:label_project_take), :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1})) + when 1 + s = content_tag('span', l(:label_has_watched_project), :class => "current-page") + content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'})) + content << content_tag('li', s, :class => "current-page") end content_tag('div', content, :class => "pagination") end @@ -134,59 +134,59 @@ module UsersHelper def user_course(state) content = ''.html_safe if @user != User.current - if @user.user_extensions.identity == 0 + if @user.user_extensions.identity == 0 case state - when 0 - s = content_tag('span', '他执教的课程', :class => "current-page") - content << content_tag('li', s) - content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) - content_tag('div', content, :class => "pagination") - when 1 - s = content_tag('span', '他发布的作业', :class => "current-page") - content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'})) - content << content_tag('li', s, :class => "current-page") - content_tag('div', content, :class => "pagination") + when 0 + s = content_tag('span', '他执教的课程', :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to('他发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) + content_tag('div', content, :class => "pagination") + when 1 + s = content_tag('span', '他发布的作业', :class => "current-page") + content << content_tag('li', link_to('他执教的课程', {:controller => 'users', :action => 'user_courses'})) + content << content_tag('li', s, :class => "current-page") + content_tag('div', content, :class => "pagination") end - else + else case state - when 0 - s = content_tag('span', '他的课程', :class => "current-page") - content << content_tag('li', s) - content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) - content_tag('div', content, :class => "pagination") - when 1 - s = content_tag('span', '他的作业', :class => "current-page") - content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0})) - content << content_tag('li', s, :class => "current-page") - content_tag('div', content, :class => "pagination") + when 0 + s = content_tag('span', '他的课程', :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to('他的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) + content_tag('div', content, :class => "pagination") + when 1 + s = content_tag('span', '他的作业', :class => "current-page") + content << content_tag('li', link_to('他的课程', {:controller => 'users', :action => 'user_courses', :type => 0})) + content << content_tag('li', s, :class => "current-page") + content_tag('div', content, :class => "pagination") end end else - if @user.user_extensions.identity == 0 + if @user.user_extensions.identity == 0 case state - when 0 - s = content_tag('span', l(:label_teaching_course), :class => "current-page") - content << content_tag('li', s) - content << content_tag('li', link_to(l(:label_release_homework), {:controller => 'users', :action => 'user_courses', :type => 1})) - content_tag('div', content, :class => "pagination") - when 1 - s = content_tag('span', l(:label_release_homework), :class => "current-page") - content << content_tag('li', link_to(l(:label_teaching_course), {:controller => 'users', :action => 'user_courses'})) - content << content_tag('li', s, :class => "current-page") - content_tag('div', content, :class => "pagination") + when 0 + s = content_tag('span', l(:label_teaching_course), :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to(l(:label_release_homework), {:controller => 'users', :action => 'user_courses', :type => 1})) + content_tag('div', content, :class => "pagination") + when 1 + s = content_tag('span', l(:label_release_homework), :class => "current-page") + content << content_tag('li', link_to(l(:label_teaching_course), {:controller => 'users', :action => 'user_courses'})) + content << content_tag('li', s, :class => "current-page") + content_tag('div', content, :class => "pagination") end - else + else case state - when 0 - s = content_tag('span', l(:label_my_course), :class => "current-page") - content << content_tag('li', s) - content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) - content_tag('div', content, :class => "pagination") - when 1 - s = content_tag('span', '我的作业', :class => "current-page") - content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0})) - content << content_tag('li', s, :class => "current-page") - content_tag('div', content, :class => "pagination") + when 0 + s = content_tag('span', l(:label_my_course), :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) + content_tag('div', content, :class => "pagination") + when 1 + s = content_tag('span', '我的作业', :class => "current-page") + content << content_tag('li', link_to(l(:label_my_course), {:controller => 'users', :action => 'user_courses', :type => 0})) + content << content_tag('li', s, :class => "current-page") + content_tag('div', content, :class => "pagination") end end end @@ -196,42 +196,42 @@ module UsersHelper def sort_user(state, project_type) content = ''.html_safe case state - when 0 - content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ))) - content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ))) - content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ), :class=>"selected") ) - when 1 - content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ), :class=>"selected") ) - content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ))) - content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ))) - when 2 - content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ))) - content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ), :class=>"selected") ) - content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ))) + when 0 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ))) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ))) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ), :class=>"selected") ) + when 1 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ), :class=>"selected") ) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ))) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ))) + when 2 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(params.merge({:user_sort_type => '1', :project_type => project_type}) ))) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(params.merge({:user_sort_type => '2', :project_type => project_type}) ), :class=>"selected") ) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(params.merge({:user_sort_type => '0', :project_type => project_type}) ))) end content = content_tag('ul', content) content_tag('div', content, :class => "tabs") - end - + end + def sort_user_enterprise(state, project_type) content = ''.html_safe case state - when 0 - content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected") - when 1 - content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected") - content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type))) - when 2 - content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected") - content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type))) + when 0 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected") + when 1 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type))) + when 2 + content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type))) end content = content_tag('ul', content) content_tag('div', content, :class => "tabs_enterprise") - end + end def gender_avatar_uri user img_uri = '/images/sidebar/female.png' @@ -256,7 +256,7 @@ module UsersHelper # people_ids += (members_to_user_ids(tmp)) unless tmp.nil? # end # people_ids.include?(login_user.id) or (login_user == user) or login_user.admin? - + false end @@ -290,7 +290,7 @@ module UsersHelper membership.collect { |e| memberships.push(e) } - ## 判断课程是否过期 [需封装] + ## 判断课程是否过期 [需封装] memberships_doing = [] memberships_done = [] memberships.map { |e| @@ -546,7 +546,7 @@ module UsersHelper type = [] user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| option = [] - option << course.name + option << course.name+"("+course.time.to_s+course.term+")" option << course.id type << option end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 217c7d770..1c066495f 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -56,4 +56,6 @@ class HomeworkCommon < ActiveRecord::Base Mailer.run.homework_added(self) end + delegate :language_name, :to => :homework_detail_programing + end diff --git a/app/models/homework_detail_programing.rb b/app/models/homework_detail_programing.rb index 4c7134806..e5938d091 100644 --- a/app/models/homework_detail_programing.rb +++ b/app/models/homework_detail_programing.rb @@ -2,4 +2,8 @@ class HomeworkDetailPrograming < ActiveRecord::Base attr_accessible :language, :standard_code, :homework_common_id belongs_to :homework_common + + def language_name + %W(c c++).at(self.language.to_i - 1) + end end diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb index df2848194..b4d8a4262 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -2,5 +2,4 @@ class HomeworkTest < ActiveRecord::Base attr_accessible :input, :output, :homework_common_id,:result,:error_msg belongs_to :homework_common - has_many :student_work_test end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index b95c11c11..6e39c954a 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -7,7 +7,7 @@ class StudentWork < ActiveRecord::Base has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy belongs_to :project - has_many :student_work_test + has_many :student_work_tests, order: 'id desc' before_destroy :delete_praise diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index 413528b82..96aa1d6c3 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,12 +1,12 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id, :result, :error_msg - - belongs_to :homework_test + attr_accessible :student_work_id, :results, :status, :src belongs_to :student_work + serialize :results, Array + def status_to_s - case self.result.to_i + case self.status.to_i when -1 '编译出错' when -2 @@ -33,10 +33,11 @@ class StudentWorkTest < ActiveRecord::Base end def test_score - if self.result.to_i == 0 + if self.status.to_i == 0 format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) else 0 end end + end diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index d55b714ad..dd3c3dfb2 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -1,3 +1,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); -init_KindEditor_data(<%= @user_activity_id%>); +init_KindEditor_data('<%= @user_activity_id%>'); diff --git a/app/views/homework_common/_new_homework_detail_manual_form.html.erb b/app/views/homework_common/_new_homework_detail_manual_form.html.erb new file mode 100644 index 000000000..7fb728ad0 --- /dev/null +++ b/app/views/homework_common/_new_homework_detail_manual_form.html.erb @@ -0,0 +1,74 @@ +
+
+
+
发布作业
+
+
+
+ +
+
+ 导入作业 + +
+ +
+
+
+
+ <% if edit_mode %> + <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> + <% else %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :description,:editor_id => 'homework_description_editor' %> + <% end %> +
+
+ +
+ + +
+ 高级功能 +
+
+
+ +
+ 发布 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'fr mr10 mt3'%> +
+
+
+
+ +
+ + + diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 6fc0fff0e..f5fb595e1 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,17 +1,16 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<% content_for :header_tags do %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + <%= javascript_include_tag 'homework','baiduTemplate' %> +<% end %> + <%= error_messages_for 'homework_common' %> -
-

- <%= l(:label_course_homework_new)%> -

-
+
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <%= render :partial => 'homework_common/new_homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> <% end%>
+ +
diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb index e84d0f87a..7ed852fea 100644 --- a/app/views/homework_common/next_step.html.erb +++ b/app/views/homework_common/next_step.html.erb @@ -1,4 +1,4 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> <%= error_messages_for 'homework_common' %>

diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index dc6ca52d5..3513c5c86 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -101,9 +101,9 @@ 课程 <% if is_current_user%> <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> - <%=link_to image_tag("../images/menu_setting.png",width:"14px", height: "14px",class: "homepageMenuSetting fr",title: "新建课程"), new_course_path%> + <%=link_to "", new_course_path, :class => "homepageMenuSetting fr"%> <% else%> - <%=link_to image_tag("../images/menu_setting.png",width:"14px", height: "14px",class: "homepageMenuSetting fr", title:"加入课程"), join_private_courses_courses_path ,:remote => true%> + <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:remote => true%> <% end%> <% end%>

@@ -117,7 +117,7 @@ 项目 <% if is_current_user%> - <%=link_to image_tag("../images/menu_setting.png",width:"14px", height: "14px",class: "homepageMenuSetting fr",title:"新建项目"), new_project_path%> + <%=link_to "", new_project_path, :class => "homepageMenuSetting fr"%> <% end%>
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index c72f9d422..8d27f31aa 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,3 +1,8 @@ +<% content_for :header_tags do %> + <%= javascript_include_tag 'homework','baiduTemplate' %> +<% end %> + +<% if @homework.homework_type == 1 %> + + +
+
+
+
提交作品
+
+
+
+
<%= @homework.name %>
截止时间:<%= @homework.end_time %> +
+ <%= @homework.user.show_name %> +

<%= @homework.description %>
+输入 2 1 1 4 4 2 3 6 5
+输出 15
+

+
+

注:迟交扣2分,缺评一个作品扣2

+
+
+ <%= form_for(@student_work, + :html => { :multipart => true }, + :url => {:controller => 'student_work', + :action => 'create', + :student_work_id => @student_work.id, + :homework => @homework.id + }, + :method => :post) do |f|%> + +
+ 请使用 <%= @homework.language_name %> 语言编写 +
+
+ <%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %> +
+
+ <%= f.text_area :description, id: 'program-src', class:" W700 H150", placeholder:"请贴入你的代码", rows: 10 %> +
+ + <% end %> +
+
+
+ <% @student_work.student_work_tests.each_with_index do |test, index| %> +
+

第<%= @student_work.student_work_tests.count - index%>次测试

<%= test.created_at.to_s(:db) %> +
+
+ <% if test.status.to_i == -2 %> +
<%= test.results.first %>
+ <% else %> +
+
    + <% test.results.each_with_index do |x, i| %> +
  • 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
    +
  • + <% else %> + 测试正确! +
    + + <% end %> + <% end %> +
+
+ <% end %> + <% end %> +
+
+ +<% end %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index f27d6cae5..85e958253 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,108 +1,108 @@ -
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> -
-
-
- <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> - <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> - <% end %> - TO - <%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course), :class => "newsBlue ml15 mr5"%> -
-
- <% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey" %> - <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey"%> - <% end %> -
-
- 发帖时间:<%= format_date(activity.created_on) %> -
- - -
帖子描述: - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
- -
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course), :class => "newsBlue ml15 mr5"%> +
+
+ <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey"%> + <% end %> +
+
+ 发帖时间:<%= format_date(activity.created_on) %>
-
-
- <% count=0 %> -
回复( - <% if activity.parent_id.nil? %> - <% count=activity.replies_count%> - <%=count %> - <% else %> - <% count=activity.parent.replies_count%> - <%=count %> - <% end %> - )
-
<%#=format_date(activity.updated_on)%>
- <%if count>2 %> - - <% end %> -
-
-
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> - - - -

-
- 取消 - 发送 - <% end%> + +
帖子描述: + <% if activity.parent_id.nil? %> + <%= activity.content.to_s.html_safe%> + <% else %> + <%= activity.parent.content.to_s.html_safe%> + <% end %> +
+ +
+
+
+
+
+ <% count=0 %> +
回复( + <% if activity.parent_id.nil? %> + <% count=activity.replies_count%> + <%=count %> + <% else %> + <% count=activity.parent.replies_count%> + <%=count %> + <% end %> + )
+
<%#=format_date(activity.updated_on)%>
+ <%if count>2 %> + -
-
+ <% end %> +
- <% activity= activity.parent_id.nil? ? activity:activity.parent%> - <% replies_all_i = 0 %> - <% unless activity.children.empty? %> -
-
    - <% activity.children.reorder("created_on desc").each do |reply|%> - <% replies_all_i=replies_all_i+1 %> -
  • -
    - <%= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %> -
    -
    -
    - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= format_date(reply.created_on) %> - <%#= link_to( +
    +
    + <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + + + +

    +
    + 取消 + 发送 + <% end%> +
    +
    +
    + + <% activity= activity.parent_id.nil? ? activity:activity.parent%> + <% replies_all_i = 0 %> + <% unless activity.children.empty? %> +
    +
      + <% activity.children.reorder("created_on desc").each do |reply|%> + <% replies_all_i=replies_all_i+1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %> +
      +
      +
      + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_date(reply.created_on) %> + <%#= link_to( l(:button_delete), {:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'}, :method => :post, @@ -110,15 +110,15 @@ :title => l(:button_delete), :class => 'replyGrey fr ml10' ) if reply.course_destroyable_by?(User.current) %> - -
      -
      <%= reply.content.html_safe %>
      -
      -
      -
    • - <% end %> -
    -
    - <% end %> -
    -
    + +
+
<%= reply.content.html_safe %>
+
+
+ + <% end %> + +
+ <% end %> +
+
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 442ad5e59..669c67ded 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -84,6 +84,6 @@ <% end %>
- <% end %> + <% end %>
\ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index f23bdb74c..97c647111 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -11,7 +11,7 @@ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.project.name.to_s+" | 项目缺陷", project_issues_path(activity.project), :class => "newsBlue ml15"%> - +
<%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> <%= get_issue_priority(activity.priority_id)[1] %> @@ -19,11 +19,11 @@
指派给   <% unless activity.assigned_to_id.nil? %> - <% if activity.try(:assigned_to).try(:realname) == ' ' %> - <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> - <% else %> - <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> - <% end %> + <% if activity.try(:assigned_to).try(:realname) == ' ' %> + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% end %> <% end %>
时间:<%=format_date(activity.created_on) %>
@@ -37,21 +37,21 @@
<% if activity.attachments.any? %> <% activity.attachments.each do |attachment| %> -
+
<%= link_to_short_attachment attachment,:length=> 58, :class => 'homepagePostFileAtt newsBlue', :download => true -%> - <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), - :controller => 'attachments', - :action => 'show', - :id => attachment, - :filename => attachment.filename %> - <% end %> - ( + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename %> + <% end %> + ( <%= number_to_human_size attachment.filesize %>) -
+
<% end %> <% end %>
@@ -110,7 +110,7 @@
<% if reply.try(:user).try(:realname) == ' ' %> <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> + <% else %> <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_date(reply.created_on) %> diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index ab86fc21d..ab49fd9d6 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -1,25 +1,25 @@ <% if attachments.nil? || attachments.empty? %> - - - + + + <% else %> <% attachments.each do |attach| %> -
    -
  • - -
  • -
  • - - <%= link_to truncate(attach.filename,:length=>18), download_named_attachment_path(attach.id, attach.filename), - :title => attach.filename,:class=>'resourcesBlack'%> -
  • -
  • <%= number_to_human_size(attach.filesize) %>
  • -
  • <%= get_resource_type(attach.container_type)%>
  • -
  • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
  • -
  • <%= attach.author_id %>
  • -
  • <%= format_date(attach.created_on) %>
  • -
  • <%= attach.id %>
  • -
- <% end %> +
    +
  • + +
  • +
  • + + <%= link_to truncate(attach.filename,:length=>18), download_named_attachment_path(attach.id, attach.filename), + :title => attach.filename,:class=>'resourcesBlack'%> +
  • +
  • <%= number_to_human_size(attach.filesize) %>
  • +
  • <%= get_resource_type(attach.container_type)%>
  • +
  • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
  • +
  • <%= attach.author_id %>
  • +
  • <%= format_date(attach.created_on) %>
  • +
  • <%= attach.id %>
  • +
+ <% end %> <% end %> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index a5325342c..2dcdd04cf 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -8,6 +8,7 @@ span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} div.ke-toolbar .ke-outline{border:none;} + .ke-inline-block{display: none;} <% user_activities.each do |user_activity| if user_activities %> @@ -59,4 +60,5 @@ <% end %> <% end %> <% end %> - \ No newline at end of file + + <%= link_to "点击展开更多",user_activities_path(@user.id),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 00ca5d345..c6c17edf9 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -1,4 +1,8 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<% content_for :header_tags do %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + <%= javascript_include_tag 'homework','baiduTemplate' %> +<% end %> +
@@ -35,11 +39,53 @@ <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework} %>
-
- 发送 - - 取消 -
+
+ 发送 + + 取消 +
-
+ + + +
+ 编程选项 +
+
+
+ + + + +
+
+
+ + + + diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index faa09ef70..e1bbf6e1c 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -53,4 +53,5 @@
<% end%> - \ No newline at end of file + +<%= link_to "加载更多",user_homeworks_user_path(User.current.id),:id => "user_show_more_homework",:remote => "true",:class => "loadMore mt10 f_grey"%> \ No newline at end of file diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb new file mode 100644 index 000000000..a150c39ba --- /dev/null +++ b/app/views/users/new_user_commit_homework.html.erb @@ -0,0 +1,117 @@ +<% content_for :header_tags do %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + <%= javascript_include_tag 'homework','baiduTemplate' %> +<% end %> + + + + + +
+
+
+
提交作品
+
+
+
+
<%= @homework.name %>
截止时间:<%= @homework.end_time %> +
+ <%= @homework.user.show_name %> +

<%= @homework.description %>
+输入 2 1 1 4 4 2 3 6 5
+输出 15
+

+
+

注:迟交扣2分,缺评一个作品扣2

+
+
+ <%= form_for(@student_work, + :html => { :multipart => true }, + :url => {:controller => 'users', + :action => 'user_commit_homework', + :student_work_id => @student_work.id, + :homework => @homework.id + }, + :method => :post) do |f|%> + +
+ 请使用 <%= @homework.language_name %> 语言编写 +
+
+ <%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %> +
+
+ <%= f.text_area :description, id: 'program-src', class:" W700 H150", placeholder:"请贴入你的代码", rows: 10 %> +
+ + <% end %> +
+
+
+ <% @student_work.student_work_tests.each_with_index do |test, index| %> +
+

第<%= @student_work.student_work_tests.count - index%>次测试

<%= test.created_at.to_s(:db) %> +
+
+ <% if test.status.to_i == -2 %> +
<%= test.results.first %>
+ <% else %> +
+
    + <% test.results.each_with_index do |x, i| %> +
  • 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
    +
  • + <% else %> + 测试正确! +
    + + <% end %> + <% end %> +
+
+ <% end %> + <% end %> +
+
\ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 74ca48595..76599739c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,19 +1,3 @@ - -
diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb index 0ce84cf0e..f870b38b9 100644 --- a/app/views/users/show.js.erb +++ b/app/views/users/show.js.erb @@ -1,4 +1,4 @@ $("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page} )%>"); <% if @user_activities.count < 10%> -$(window).off("scroll", scrollHandler); +$("#show_more_activities").hide(); <% end%> diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb new file mode 100644 index 000000000..a7416cf40 --- /dev/null +++ b/app/views/users/user_commit_homework.html.erb @@ -0,0 +1,114 @@ + + + + + + +
+
+
+
提交作品
+
+
+
+
<%= @homework.name %>
截止时间:<%= @homework.end_time %> +
+ <%= @homework.user.show_name %> +

<%= @homework.description %>
+输入 2 1 1 4 4 2 3 6 5
+输出 15
+

+
+

注:迟交扣2分,缺评一个作品扣2

+
+
+ <%= form_for(@student_work, + :html => { :multipart => true }, + :url => {:controller => 'student_work', + :action => 'create', + :student_work_id => @student_work.id, + :homework => @homework.id + }, + :method => :post) do |f|%> + +
+ 请使用 <%= @homework.language_name %> 语言编写 +
+
+ <%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %> +
+
+ <%= f.text_area :description, id: 'program-src', class:" W700 H150", placeholder:"请贴入你的代码", rows: 10 %> +
+ + <% end %> +
+
+
+ <% @student_work.student_work_tests.each_with_index do |test, index| %> +
+

第<%= @student_work.student_work_tests.count - index%>次测试

<%= test.created_at.to_s(:db) %> +
+
+ <% if test.status.to_i == -2 %> +
<%= test.results.first %>
+ <% else %> +
+
    + <% test.results.each_with_index do |x, i| %> +
  • 测试<%=i+1%> + <% if x["status"].to_i != 0 %> + 测试错误! + 您的输出: + <%=x["result"]%> + 正确输出: + <%=x["output"]%> +
    +
  • + <% else %> + 测试正确! +
    + + <% end %> + <% end %> +
+
+ <% end %> + <% end %> +
+
\ No newline at end of file diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index d401ea314..18238bf8f 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -1,21 +1,8 @@ --> diff --git a/config/configuration.yml b/config/configuration.yml index ef204a31e..af68515eb 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -199,9 +199,12 @@ default: repository_root_path: '/tmp/htdocs' + judge_server: 'http://judge.trustie.net/' + # specific configuration options for production environment # that overrides the default ones production: + judge_server: 'http://192.168.80.21:8080/' repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs' cookie_domain: ".trustie.net" rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf diff --git a/config/routes.rb b/config/routes.rb index 444df3a60..8454a1c47 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -120,6 +120,7 @@ RedmineApp::Application.routes.draw do get 'absence_penalty_list' get 'evaluation_list' post 'set_program_score' + post 'program_test' end end @@ -171,7 +172,7 @@ RedmineApp::Application.routes.draw do resources :contests, only: [:index] do resources :contestnotifications do # get 'preview', on: :collection - resources :notificationcomments + resources :notificationcomments end collection do @@ -232,7 +233,7 @@ RedmineApp::Application.routes.draw do end end end - + resources :shares @@ -310,8 +311,11 @@ RedmineApp::Application.routes.draw do collection do match "tag_saveEx" , :via => [:get, :post] post "user_new_homework" + get 'new_user_commit_homework' + post "user_commit_homework" post 'user_select_homework' end + member do match 'user_projects_index', :to => 'users#user_projects_index', :via => :get match 'user_projects', :to => 'users#user_projects', :via => :get @@ -369,7 +373,7 @@ RedmineApp::Application.routes.draw do get 'user_resource_type' get 'user_ref_resource_search' post 'import_resources_to_homework' - # end + # end end end match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" @@ -483,7 +487,7 @@ RedmineApp::Application.routes.draw do collection do match "getattachtype" , :via => [:get, :post] match "search_project",:via => [:post,:get] - #match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post] + #match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post] end end @@ -513,7 +517,7 @@ RedmineApp::Application.routes.draw do resources :repositories, :except => [:index, :show] do member do get 'newrepo', :via => [:get, :post] - # get 'create', :via=>[:get, :post] + # get 'create', :via=>[:get, :post] end end match 'wiki/index', :via => :get @@ -603,8 +607,8 @@ RedmineApp::Application.routes.draw do :controller => 'repositories', :format => false, :constraints => { - :action => /(browse|show|entry|raw|annotate|diff)/, - :rev => /[a-z0-9\.\-_]+/ + :action => /(browse|show|entry|raw|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ } get 'projects/:id/repository/statistics', :to => 'repositories#stats' @@ -621,8 +625,8 @@ RedmineApp::Application.routes.draw do :controller => 'repositories', :format => false, :constraints => { - :action => /(browse|show|entry|raw|annotate|diff)/, - :rev => /[a-z0-9\.\-_]+/ + :action => /(browse|show|entry|raw|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ } get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', :controller => 'repositories', @@ -725,7 +729,7 @@ RedmineApp::Application.routes.draw do get 'test_connection', :as => 'try_connection' end collection do - get 'autocomplete_for_new_user' + get 'autocomplete_for_new_user' end end @@ -787,7 +791,7 @@ RedmineApp::Application.routes.draw do collection do match 'chang_read_flag', :via => :get end - end + end end # end of resources :courses match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback' diff --git a/db/migrate/20150828011415_change_student_work_tests.rb b/db/migrate/20150828011415_change_student_work_tests.rb new file mode 100644 index 000000000..7d4459ab6 --- /dev/null +++ b/db/migrate/20150828011415_change_student_work_tests.rb @@ -0,0 +1,13 @@ +class ChangeStudentWorkTests < ActiveRecord::Migration + + def change + change_table :student_work_tests do |t| + t.remove :error_msg + t.remove :result + t.remove :homework_test_id + t.integer :status, default: 9 + t.text :results + end + end + +end diff --git a/db/migrate/20150828155329_add_src_to_student_work_tests.rb b/db/migrate/20150828155329_add_src_to_student_work_tests.rb new file mode 100644 index 000000000..89bd80882 --- /dev/null +++ b/db/migrate/20150828155329_add_src_to_student_work_tests.rb @@ -0,0 +1,5 @@ +class AddSrcToStudentWorkTests < ActiveRecord::Migration + def change + add_column :student_work_tests, :src, :text + end +end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index ce5a960cf..8e5e38ee4 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -99,13 +99,13 @@ function initFilters(){ $('#filters-table td.field input[type=checkbox]').each(function(){ toggleFilter($(this).val()); }); - $('#filters-table td.field input[type=checkbox]').live('click',function(){ + $('#filters-table td.field input[type=checkbox]').on('click',function(){ toggleFilter($(this).val()); }); - $('#filters-table .toggle-multiselect').live('click',function(){ + $('#filters-table .toggle-multiselect').on('click',function(){ toggleMultiSelect($(this).siblings('select')); }); - $('#filters-table input[type=text]').live('keypress', function(e){ + $('#filters-table input[type=text]').on('keypress', function(e){ if (e.keyCode == 13) submit_query_form("query_form"); }); } diff --git a/public/javascripts/baiduTemplate.js b/public/javascripts/baiduTemplate.js new file mode 100644 index 000000000..2f05969e3 --- /dev/null +++ b/public/javascripts/baiduTemplate.js @@ -0,0 +1,216 @@ +/** + * baiduTemplate简单好用的Javascript模板引擎 1.0.6 版本 + * http://baidufe.github.com/BaiduTemplate + * 开源协议:BSD License + * 浏览器环境占用命名空间 baidu.template ,nodejs环境直接安装 npm install baidutemplate + * @param str{String} dom结点ID,或者模板string + * @param data{Object} 需要渲染的json对象,可以为空。当data为{}时,仍然返回html。 + * @return 如果无data,直接返回编译后的函数;如果有data,返回html。 + * @author wangxiao + * @email 1988wangxiao@gmail.com +*/ + +;(function(window){ + + //取得浏览器环境的baidu命名空间,非浏览器环境符合commonjs规范exports出去 + //修正在nodejs环境下,采用baidu.template变量名 + var baidu = typeof module === 'undefined' ? (window.baidu = window.baidu || {}) : module.exports; + + //模板函数(放置于baidu.template命名空间下) + baidu.template = function(str, data){ + + //检查是否有该id的元素存在,如果有元素则获取元素的innerHTML/value,否则认为字符串为模板 + var fn = (function(){ + + //判断如果没有document,则为非浏览器环境 + if(!window.document){ + return bt._compile(str); + }; + + //HTML5规定ID可以由任何不包含空格字符的字符串组成 + var element = document.getElementById(str); + if (element) { + + //取到对应id的dom,缓存其编译后的HTML模板函数 + if (bt.cache[str]) { + return bt.cache[str]; + }; + + //textarea或input则取value,其它情况取innerHTML + var html = /^(textarea|input)$/i.test(element.nodeName) ? element.value : element.innerHTML; + return bt._compile(html); + + }else{ + + //是模板字符串,则生成一个函数 + //如果直接传入字符串作为模板,则可能变化过多,因此不考虑缓存 + return bt._compile(str); + }; + + })(); + + //有数据则返回HTML字符串,没有数据则返回函数 支持data={}的情况 + var result = bt._isObject(data) ? fn( data ) : fn; + fn = null; + + return result; + }; + + //取得命名空间 baidu.template + var bt = baidu.template; + + //标记当前版本 + bt.versions = bt.versions || []; + bt.versions.push('1.0.6'); + + //缓存 将对应id模板生成的函数缓存下来。 + bt.cache = {}; + + //自定义分隔符,可以含有正则中的字符,可以是HTML注释开头 + bt.LEFT_DELIMITER = bt.LEFT_DELIMITER||'<%'; + bt.RIGHT_DELIMITER = bt.RIGHT_DELIMITER||'%>'; + + //自定义默认是否转义,默认为默认自动转义 + bt.ESCAPE = true; + + //HTML转义 + bt._encodeHTML = function (source) { + return String(source) + .replace(/&/g,'&') + .replace(//g,'>') + .replace(/\\/g,'\') + .replace(/"/g,'"') + .replace(/'/g,'''); + }; + + //转义影响正则的字符 + bt._encodeReg = function (source) { + return String(source).replace(/([.*+?^=!:${}()|[\]/\\])/g,'\\$1'); + }; + + //转义UI UI变量使用在HTML页面标签onclick等事件函数参数中 + bt._encodeEventHTML = function (source) { + return String(source) + .replace(/&/g,'&') + .replace(//g,'>') + .replace(/"/g,'"') + .replace(/'/g,''') + .replace(/\\\\/g,'\\') + .replace(/\\\//g,'\/') + .replace(/\\n/g,'\n') + .replace(/\\r/g,'\r'); + }; + + //将字符串拼接生成函数,即编译过程(compile) + bt._compile = function(str){ + var funBody = "var _template_fun_array=[];\nvar fn=(function(__data__){\nvar _template_varName='';\nfor(name in __data__){\n_template_varName+=('var '+name+'=__data__[\"'+name+'\"];');\n};\neval(_template_varName);\n_template_fun_array.push('"+bt._analysisStr(str)+"');\n_template_varName=null;\n})(_template_object);\nfn = null;\nreturn _template_fun_array.join('');\n"; + return new Function("_template_object",funBody); + }; + + //判断是否是Object类型 + bt._isObject = function (source) { + return 'function' === typeof source || !!(source && 'object' === typeof source); + }; + + //解析模板字符串 + bt._analysisStr = function(str){ + + //取得分隔符 + var _left_ = bt.LEFT_DELIMITER; + var _right_ = bt.RIGHT_DELIMITER; + + //对分隔符进行转义,支持正则中的元字符,可以是HTML注释 + var _left = bt._encodeReg(_left_); + var _right = bt._encodeReg(_right_); + + str = String(str) + + //去掉分隔符中js注释 + .replace(new RegExp("("+_left+"[^"+_right+"]*)//.*\n","g"), "$1") + + //去掉注释内容 <%* 这里可以任意的注释 *%> + //默认支持HTML注释,将HTML注释匹配掉的原因是用户有可能用 来做分割符 + .replace(new RegExp("", "g"),"") + .replace(new RegExp(_left+"\\*.*?\\*"+_right, "g"),"") + + //把所有换行去掉 \r回车符 \t制表符 \n换行符 + .replace(new RegExp("[\\r\\t\\n]","g"), "") + + //用来处理非分隔符内部的内容中含有 斜杠 \ 单引号 ‘ ,处理办法为HTML转义 + .replace(new RegExp(_left+"(?:(?!"+_right+")[\\s\\S])*"+_right+"|((?:(?!"+_left+")[\\s\\S])+)","g"),function (item, $1) { + var str = ''; + if($1){ + + //将 斜杠 单引 HTML转义 + str = $1.replace(/\\/g,"\").replace(/'/g,'''); + while(/<[^<]*?'[^<]*?>/g.test(str)){ + + //将标签内的单引号转义为\r 结合最后一步,替换为\' + str = str.replace(/(<[^<]*?)'([^<]*?>)/g,'$1\r$2') + }; + }else{ + str = item; + } + return str ; + }); + + + str = str + //定义变量,如果没有分号,需要容错 <%var val='test'%> + .replace(new RegExp("("+_left+"[\\s]*?var[\\s]*?.*?[\\s]*?[^;])[\\s]*?"+_right,"g"),"$1;"+_right_) + + //对变量后面的分号做容错(包括转义模式 如<%:h=value%>) <%=value;%> 排除掉函数的情况 <%fun1();%> 排除定义变量情况 <%var val='test';%> + .replace(new RegExp("("+_left+":?[hvu]?[\\s]*?=[\\s]*?[^;|"+_right+"]*?);[\\s]*?"+_right,"g"),"$1"+_right_) + + //按照 <% 分割为一个个数组,再用 \t 和在一起,相当于将 <% 替换为 \t + //将模板按照<%分为一段一段的,再在每段的结尾加入 \t,即用 \t 将每个模板片段前面分隔开 + .split(_left_).join("\t"); + + //支持用户配置默认是否自动转义 + if(bt.ESCAPE){ + str = str + + //找到 \t=任意一个字符%> 替换为 ‘,任意字符,' + //即替换简单变量 \t=data%> 替换为 ',data,' + //默认HTML转义 也支持HTML转义写法<%:h=value%> + .replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'"); + }else{ + str = str + + //默认不转义HTML转义 + .replace(new RegExp("\\t=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':$1,'"); + }; + + str = str + + //支持HTML转义写法<%:h=value%> + .replace(new RegExp("\\t:h=(.*?)"+_right,"g"),"',typeof($1) === 'undefined'?'':baidu.template._encodeHTML($1),'") + + //支持不转义写法 <%:=value%>和<%-value%> + .replace(new RegExp("\\t(?::=|-)(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':$1,'") + + //支持url转义 <%:u=value%> + .replace(new RegExp("\\t:u=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':encodeURIComponent($1),'") + + //支持UI 变量使用在HTML页面标签onclick等事件函数参数中 <%:v=value%> + .replace(new RegExp("\\t:v=(.*?)"+_right,"g"),"',typeof($1)==='undefined'?'':baidu.template._encodeEventHTML($1),'") + + //将字符串按照 \t 分成为数组,在用'); 将其合并,即替换掉结尾的 \t 为 '); + //在if,for等语句前面加上 '); ,形成 ');if ');for 的形式 + .split("\t").join("');") + + //将 %> 替换为_template_fun_array.push(' + //即去掉结尾符,生成函数中的push方法 + //如:if(list.length=5){%>

',list[4],'

');} + //会被替换为 if(list.length=5){_template_fun_array.push('

',list[4],'

');} + .split(_right_).join("_template_fun_array.push('") + + //将 \r 替换为 \ + .split("\r").join("\\'"); + + return str; + }; + +})(window); diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js new file mode 100644 index 000000000..67bfd59c3 --- /dev/null +++ b/public/javascripts/homework.js @@ -0,0 +1,133 @@ +$(function(){ +//提交作业 + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + var tested = false; + var valid_form = function() { + var src = $('#program-src').val(); + var title = $('#program-title').val(); + + if (!src) { + alert('请输入正确的代码'); + return false; + } + if (!title) { + alert('请输入标题'); + return false; + } + return true; + } + + var test_program = function(cb){ + var homework_id = $('#test-program-btn').attr('data-homework-id'); + var student_work_id = $('#test-program-btn').attr('data-student-work-id'); + var src = $('#program-src').val(); + var title = $('#program-title').val(); + + if(!valid_form()){ + return; + } + + $.post( + '/student_work/program_test', + {homework: homework_id, student_work_id: student_work_id, src: src, title: title}, + function(data,status){ + tested = true; + console.log(data); + + if (typeof cb == 'function') {cb(); return;} + + + var html=bt('t:result-list',data); + $('.ProResult').prepend(html); + + if (data.status==0) { + var r=confirm("答题正确,是否立刻提交?"); + if (r) { + $(".HomeWorkCon form").submit(); + } + } + } + ); + }; + + $('#test-program-btn').on('click', test_program); + + + $('#commit-program-work-btn').on('click', function(){ + if(!valid_form()){ + return; + } + if($('.ProResult .ProResultTop').length<=0){ + var r=confirm("测试后才能提交,是否立刻测试?"); + if (r) { + test_program(); + } + return; + } + + if (!tested) { + test_program(function(){ + $(".HomeWorkCon form").submit(); + }); + return; + } + + $(".HomeWorkCon form").submit(); + }); + + $('form.edit_student_work').on('keydown', '#program-src', function(){ + tested = false; + }); + + +//发布作业 + var isProgramHomework = function(){ + return !$(".advanced_option").is(":hidden"); + } + + var submit_comm_homework = function(id){ + var valid = true; + if (isProgramHomework()) { + $.each($('.advanced_option textarea.InputBox'), function(i, val){ + if ($(val).val().length<=0) { + $(val).focus(); + valid = false; + return false; + } + }); + if (valid) { + $('input[name=homework_type]').val(2); + }; + } + if (valid) { + submit_homework(id); + } + } + window.submit_comm_homework = submit_comm_homework; + + var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true}; + + $('input.date-input').datepicker(datepickerOptions); + + $('a.pic_date').on('click', function(){ + $(this).parent().prev().first().focus(); + }) + + + $('a.DropBtn').on('click', function(){ + $(".advanced_option").toggle(); + }); + + $(".HomeWork").on('click', 'a.icon_add', function(){ + var html = bt('t:test-answer-list', null); + $(this).parent('.mt10').after(html); + + }); + $(".HomeWork").on('click', 'a.icon_remove', function(){ + $(this).parent('.mt10').remove(); + }); +}); \ No newline at end of file diff --git a/public/javascripts/jQuery.autoMail.js b/public/javascripts/jQuery.autoMail.js index 1750914fd..bf3519561 100644 --- a/public/javascripts/jQuery.autoMail.js +++ b/public/javascripts/jQuery.autoMail.js @@ -131,13 +131,13 @@ }); //鼠标经过列表项事件 //鼠标经过 - $(".mailHover").live("mouseover", function(){ + $(".mailHover").on("mouseover", function(){ index = Number($(this).attr("id").split("_")[1]); liveValue = $("#mailList_"+index).text(); x.children("." + cf).removeClass(cf).addClass(cl); $(this).addClass(cf).removeClass(cl); }); - $(".mailHover").live("click", function(){ + $(".mailHover").on("click", function(){ $("#mail").val($(this).html()); }); diff --git a/public/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js b/public/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js index 7f3701c87..bc0cddacc 100644 --- a/public/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js +++ b/public/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js @@ -1,5 +1,8 @@ -/*! jQuery v1.8.3 jquery.com | jquery.org/license */ -(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
t
",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
","
"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); +/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; + +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("