From 98131614119f39a3f341392c98a4d2320b5b8e21 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 26 Jul 2014 23:53:16 -0400 Subject: [PATCH] Reser repo owner to organization when error occurs in repo create page, dashboard news feed page, create organization page --- cmd/web.go | 24 +-- conf/locale/locale_en-US.ini | 8 + conf/locale/locale_zh-CN.ini | 8 + models/action.go | 8 +- models/repo.go | 32 ++-- modules/auth/org.go | 2 +- modules/middleware/context.go | 2 - public/ng/css/gogs.css | 16 +- public/ng/js/gogs.js | 213 ++++++++++++++---------- public/ng/js/min/gogs-min.js | 9 +- routers/org/org.go | 65 ++------ routers/repo/repo.go | 52 +++--- routers/user/home.go | 75 +++++++-- templates/ng/base/head.tmpl | 1 + templates/org/create.tmpl | 31 ++++ templates/repo/create.tmpl | 14 +- templates/user/dashboard/dashboard.tmpl | 31 +++- templates/user/dashboard/nav.tmpl | 2 +- templates/user/dashboard/pulls.tmpl | 5 + templates/user/pulls.tmpl | 17 -- templates/user/signin.tmpl | 2 +- templates/user/signup.tmpl | 2 +- 22 files changed, 350 insertions(+), 269 deletions(-) create mode 100644 templates/org/create.tmpl create mode 100644 templates/user/dashboard/pulls.tmpl delete mode 100644 templates/user/pulls.tmpl diff --git a/cmd/web.go b/cmd/web.go index 744614f6b7..a0690cda25 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -104,9 +104,8 @@ func runWeb(*cli.Context) { m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install) m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost) m.Group("", func(r *macaron.Router) { - r.Get("/issues", user.Issues) r.Get("/pulls", user.Pulls) - r.Get("/stars", user.Stars) + r.Get("/issues", user.Issues) }, reqSignIn) // API routers. @@ -171,13 +170,6 @@ func runWeb(*cli.Context) { m.Map(cpt) m.Get("/captcha/*", cpt.Handler) - m.Group("/repo", func(r *macaron.Router) { - r.Get("/create", repo.Create) - r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost) - r.Get("/migrate", repo.Migrate) - r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost) - }, reqSignIn) - adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true}) m.Get("/admin", adminReq, admin.Dashboard) @@ -215,10 +207,10 @@ func runWeb(*cli.Context) { // Organization routers. m.Group("/org", func(r *macaron.Router) { - r.Get("/create", org.New) - r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.NewPost) + r.Get("/create", org.Create) + r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost) r.Get("/:org", org.Home) - r.Get("/:org/dashboard", org.Dashboard) + r.Get("/:org/dashboard", user.Dashboard) r.Get("/:org/members", org.Members) r.Get("/:org/teams", org.Teams) @@ -233,6 +225,14 @@ func runWeb(*cli.Context) { r.Post("/:org/settings/delete", org.DeletePost) }, reqSignIn) + // Repository routers. + m.Group("/repo", func(r *macaron.Router) { + r.Get("/create", repo.Create) + r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost) + r.Get("/migrate", repo.Migrate) + r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost) + }, reqSignIn) + m.Group("/:username/:reponame", func(r *macaron.Router) { r.Get("/settings", repo.Setting) r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost) diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index c673ca9f49..8d5e85d89c 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -74,10 +74,12 @@ password_not_match = Password and re-type password are not same. username_been_taken = Username has been already taken. repo_name_been_taken = Repository name has been already taken. +org_name_been_taken = Organization name has been already taken. email_been_used = E-mail address has been already used. ssh_key_been_used = Public key name has been used. illegal_username = Your username contains illegal characters. illegal_repo_name = Repository name contains illegal characters. +illegal_org_name = Organization name contains illegal characters. username_password_incorrect = Username or password is not correct. invalid_ssh_key = Sorry, we're not able to verify your SSH key: %s @@ -140,6 +142,12 @@ license_helper = Select a license file init_readme = Initialize this repository with a README.md create_repo = Create Repository +[org] +org_name_holder = Organization Name +org_name_helper = Great organization names are short and memorable. +org_email_helper = Organization's Email receives all notifications and confirmations. +create_org = Create Organization + [action] create_repo = created repository %s commit_repo = pushed to %s at %s diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini index ff542a374c..9ec267cd39 100644 --- a/conf/locale/locale_zh-CN.ini +++ b/conf/locale/locale_zh-CN.ini @@ -74,10 +74,12 @@ password_not_match = 密码与确认密码未匹配。 username_been_taken = 用户名已经被占用。 repo_name_been_taken = 仓库名称已经被占用。 +org_name_been_taken = 组织名称已经被占用。 email_been_used = 邮箱地址已经被使用。 ssh_key_been_used = SSH 密钥已经被使用。 illegal_username = 您的用户名包含非法字符。 illegal_repo_name = 仓库名称包含非法字符。 +illegal_org_name = 组织名称包含非法字符。 username_password_incorrect = 用户名或密码不正确。 invalid_ssh_key = 很抱歉,我们无法验证您输入的 SSH 密钥:%s @@ -140,6 +142,12 @@ license_helper = 请选择授权许可文件 init_readme = 使用 README.md 文件初始化仓库 create_repo = 创建仓库 +[org] +org_name_holder = 组织名称 +org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。 +org_email_helper = 组织的邮箱用于接收所有通知和确认邮件。 +create_org = 创建组织 + [action] create_repo = 创建了仓库 %s commit_repo = 推送了 %s 分支的代码到 %s diff --git a/models/action.go b/models/action.go index b9d45ab375..b5f692c49f 100644 --- a/models/action.go +++ b/models/action.go @@ -305,13 +305,11 @@ func TransferRepoAction(u, newUser *User, repo *Repository) (err error) { } // GetFeeds returns action list of given user in given context. -func GetFeeds(userid, offset int64, isProfile bool) ([]*Action, error) { +func GetFeeds(uid, offset int64, isProfile bool) ([]*Action, error) { actions := make([]*Action, 0, 20) - sess := x.Limit(20, int(offset)).Desc("id").Where("user_id=?", userid) + sess := x.Limit(20, int(offset)).Desc("id").Where("user_id=?", uid) if isProfile { - sess.Where("is_private=?", false).And("act_user_id=?", userid) - } else { - sess.And("act_user_id!=?", userid) + sess.Where("is_private=?", false).And("act_user_id=?", uid) } err := sess.Find(&actions) return actions, err diff --git a/models/repo.go b/models/repo.go index 1e899c182b..8139d22abf 100644 --- a/models/repo.go +++ b/models/repo.go @@ -204,6 +204,22 @@ type Mirror struct { NextUpdate time.Time } +func GetMirror(repoId int64) (*Mirror, error) { + m := &Mirror{RepoId: repoId} + has, err := x.Get(m) + if err != nil { + return nil, err + } else if !has { + return nil, ErrMirrorNotExist + } + return m, nil +} + +func UpdateMirror(m *Mirror) error { + _, err := x.Id(m.Id).Update(m) + return err +} + // MirrorRepository creates a mirror repository from source. func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) error { _, stderr, err := process.ExecTimeout(10*time.Minute, @@ -226,22 +242,6 @@ func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) er return nil } -func GetMirror(repoId int64) (*Mirror, error) { - m := &Mirror{RepoId: repoId} - has, err := x.Get(m) - if err != nil { - return nil, err - } else if !has { - return nil, ErrMirrorNotExist - } - return m, nil -} - -func UpdateMirror(m *Mirror) error { - _, err := x.Id(m.Id).Update(m) - return err -} - // MirrorUpdate checks and updates mirror repositories. func MirrorUpdate() { if err := x.Iterate(new(Mirror), func(idx int, bean interface{}) error { diff --git a/modules/auth/org.go b/modules/auth/org.go index c45d83a711..0895780e3f 100644 --- a/modules/auth/org.go +++ b/modules/auth/org.go @@ -19,7 +19,7 @@ import ( // \/ /_____/ \/ \/ \/ \/ \/ type CreateOrgForm struct { - OrgName string `form:"orgname" binding:"Required;AlphaDashDot;MaxSize(30)"` + OrgName string `form:"org_name" binding:"Required;AlphaDashDot;MaxSize(30)"` Email string `form:"email" binding:"Required;Email;MaxSize(50)"` } diff --git a/modules/middleware/context.go b/modules/middleware/context.go index 463d9ba980..ee203b762d 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -220,8 +220,6 @@ func Contexter() macaron.Handler { ctx.IsSigned = true ctx.Data["IsSigned"] = ctx.IsSigned ctx.Data["SignedUser"] = ctx.User - ctx.Data["SignedUserId"] = ctx.User.Id - ctx.Data["SignedUserName"] = ctx.User.Name ctx.Data["IsAdmin"] = ctx.User.IsAdmin } diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css index d352f0bf68..2b8f57608f 100644 --- a/public/ng/css/gogs.css +++ b/public/ng/css/gogs.css @@ -265,6 +265,9 @@ img.avatar-30 { .markdown ul li { list-style: inside; } +.markdown ol li { + list-style: decimal inside; +} .markdown li { line-height: 1.6; margin-top: 6px; @@ -346,10 +349,6 @@ img.avatar-30 { .markdown .btn { color: #fff; } -.markdown .anchor-wrap { - /*margin-top: -50px;*/ - /*padding-top: 50px;*/ -} .markdown h1 a, .markdown h2 a, .markdown h3 a { @@ -660,40 +659,49 @@ The dashboard page style #dashboard-sidebar-menu > li.last > a { border-top-right-radius: .3em; } +#dashboard-my-mirror li, #dashboard-my-org li, #dashboard-my-repo li { border-bottom: 1px solid #EAEAEA; } +#dashboard-my-mirror li.private, #dashboard-my-org li.private, #dashboard-my-repo li.private { background-color: #fcf8e9; } +#dashboard-my-mirror li:last-child, #dashboard-my-org li:last-child, #dashboard-my-repo li:last-child { border-bottom: none; } +#dashboard-my-mirror li a, #dashboard-my-org li a, #dashboard-my-repo li a { padding: 6px 1.2em; display: block; } +#dashboard-my-mirror li a .octicon, #dashboard-my-org li a .octicon, #dashboard-my-repo li a .octicon { margin-right: 6px; color: #888; } +#dashboard-my-mirror li a:hover .repo-name, #dashboard-my-org li a:hover .repo-name, #dashboard-my-repo li a:hover .repo-name { text-decoration: underline; } +#dashboard-my-mirror .repo-name, #dashboard-my-org .repo-name, #dashboard-my-repo .repo-name { font-size: 1.1em; } +#dashboard-my-mirror .repo-star, #dashboard-my-org .repo-star, #dashboard-my-repo .repo-star { color: #888; } +#dashboard-my-mirror .repo-contrib-header, #dashboard-my-org .repo-contrib-header, #dashboard-my-repo .repo-contrib-header { border-top: 1px solid #d6d6d6; diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index e5f109af01..68bd279fef 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -1,8 +1,11 @@ // @codekit-prepend "lib/jquery-1.11.1.min.js" +// @codekit-prepend "lib/lib.js" // @codekit-prepend "lib/tabs.js" +var Gogs = {}; + (function ($) { - // extend jQuery ajax, set csrf token value + // Extend jQuery ajax, set CSRF token value. var ajax = $.ajax; $.extend({ ajax: function (url, options) { @@ -51,15 +54,131 @@ }); }(jQuery)); +(function ($) { + // Render markdown. + Gogs.renderMarkdown = function () { + var $md = $('.markdown'); + var $pre = $md.find('pre > code').parent(); + $pre.addClass('prettyprint linenums'); + prettyPrint(); + + // Set anchor. + var headers = {}; + $md.find('h1, h2, h3, h4, h5, h6').each(function () { + var node = $(this); + var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-')); + var name = val; + if (headers[val] > 0) { + name = val + '-' + headers[val]; + } + if (headers[val] == undefined) { + headers[val] = 1; + } else { + headers[val] += 1; + } + node = node.wrap('
'); + node.append(''); + }); + }; + + // Render code view. + Gogs.renderCodeView = function () { + function selectRange($list, $select, $from) { + $list.removeClass('active'); + if ($from) { + var a = parseInt($select.attr('rel').substr(1)); + var b = parseInt($from.attr('rel').substr(1)); + var c; + if (a != b) { + if (a > b) { + c = a; + a = b; + b = c; + } + var classes = []; + for (i = a; i <= b; i++) { + classes.push('.L' + i); + } + $list.filter(classes.join(',')).addClass('active'); + $.changeHash('#L' + a + '-' + 'L' + b); + return + } + } + $select.addClass('active'); + $.changeHash('#' + $select.attr('rel')); + } + + $(document).on('click', '.lines-num span', function (e) { + var $select = $(this); + var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li'); + selectRange($list, $list.filter('[rel=' + $select.attr('rel') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null)); + $.deSelect(); + }); + + $('.code-view .lines-code > pre').each(function () { + var $pre = $(this); + var $lineCode = $pre.parent(); + var $lineNums = $lineCode.siblings('.lines-num'); + if ($lineNums.length > 0) { + var nums = $pre.find('ol.linenums > li').length; + for (var i = 1; i <= nums; i++) { + $lineNums.append('' + i + ''); + } + } + }); + + $(window).on('hashchange', function (e) { + var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/); + var $list = $('.code-view ol.linenums > li'); + if (m) { + var $first = $list.filter('.' + m[1]); + selectRange($list, $first, $list.filter('.' + m[2])); + $("html, body").scrollTop($first.offset().top - 200); + return; + } + m = window.location.hash.match(/^#(L\d+)$/); + if (m) { + var $first = $list.filter('.' + m[1]); + selectRange($list, $first); + $("html, body").scrollTop($first.offset().top - 200); + } + }).trigger('hashchange'); + }; +})(jQuery); + +function initCore() { + Gogs.renderMarkdown(); + Gogs.renderCodeView(); +} + +function initRepoCreate() { + // Owner switch menu click. + $('#repo-create-owner-list').on('click', 'li', function () { + if (!$(this).hasClass('checked')) { + var uid = $(this).data('uid'); + $('#repo-owner-id').val(uid); + $('#repo-owner-avatar').attr("src", $(this).find('img').attr("src")); + $('#repo-owner-name').text($(this).text().trim()); + + $(this).parent().find('.checked').removeClass('checked'); + $(this).addClass('checked'); + console.log("set repo owner to uid :", uid, $(this).text().trim()); + } + }); +} + $(document).ready(function () { + initCore(); + if ($('#repo-create-form').length) { + initRepoCreate(); + } + Tabs('#dashboard-sidebar-menu'); homepage(); settingsProfile(); settingsSSHKeys(); settingsDelete(); - renderMarkdown(); - renderCodeView(); // Fix language drop-down menu height. var l = $('#footer-lang li').length; @@ -114,92 +233,4 @@ function settingsDelete() { return true; } }); -} - -function renderMarkdown() { - var $md = $('.markdown'); - var $pre = $md.find('pre > code').parent(); - $pre.addClass('prettyprint linenums'); - prettyPrint(); - - // Set anchor. - var headers = {}; - $md.find('h1, h2, h3, h4, h5, h6').each(function () { - var node = $(this); - var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-')); - var name = val; - if (headers[val] > 0) { - name = val + '-' + headers[val]; - } - if (headers[val] == undefined) { - headers[val] = 1; - } else { - headers[val] += 1; - } - node = node.wrap('
'); - node.append(''); - }); -} - -function renderCodeView() { - function selectRange($list, $select, $from) { - $list.removeClass('active'); - if ($from) { - var a = parseInt($select.attr('rel').substr(1)); - var b = parseInt($from.attr('rel').substr(1)); - var c; - if (a != b) { - if (a > b) { - c = a; - a = b; - b = c; - } - var classes = []; - for (i = a; i <= b; i++) { - classes.push('.L' + i); - } - $list.filter(classes.join(',')).addClass('active'); - $.changeHash('#L' + a + '-' + 'L' + b); - return - } - } - $select.addClass('active'); - $.changeHash('#' + $select.attr('rel')); - } - - $(document).on('click', '.lines-num span', function (e) { - var $select = $(this); - var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li'); - selectRange($list, $list.filter('[rel=' + $select.attr('rel') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null)); - $.deSelect(); - }); - - $('.code-view .lines-code > pre').each(function () { - var $pre = $(this); - var $lineCode = $pre.parent(); - var $lineNums = $lineCode.siblings('.lines-num'); - if ($lineNums.length > 0) { - var nums = $pre.find('ol.linenums > li').length; - for (var i = 1; i <= nums; i++) { - $lineNums.append('' + i + ''); - } - } - }); - - $(window).on('hashchange', function (e) { - var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/); - var $list = $('.code-view ol.linenums > li'); - if (m) { - var $first = $list.filter('.' + m[1]); - selectRange($list, $first, $list.filter('.' + m[2])); - $("html, body").scrollTop($first.offset().top - 200); - return; - } - m = window.location.hash.match(/^#(L\d+)$/); - if (m) { - var $first = $list.filter('.' + m[1]); - selectRange($list, $first); - $("html, body").scrollTop($first.offset().top - 200); - } - }).trigger('hashchange'); } \ No newline at end of file diff --git a/public/ng/js/min/gogs-min.js b/public/ng/js/min/gogs-min.js index 75c99f778c..4e4d63fe52 100644 --- a/public/ng/js/min/gogs-min.js +++ b/public/ng/js/min/gogs-min.js @@ -1,4 +1,5 @@ -function Tabs(e){function t(e){console.log("hide",e),e.removeClass("js-tab-nav-show"),$(e.data("tab-target")).removeClass("js-tab-show").hide()}function n(e){console.log("show",e),e.addClass("js-tab-nav-show"),$(e.data("tab-target")).addClass("js-tab-show").show()}var r=$(e);if(r.length){var i=r.find(".js-tab-nav-show");i.length&&$(i.data("tab-target")).addClass("js-tab-show"),r.on("click",".js-tab-nav",function(){var e=$(this);e.hasClass("js-tab-nav-show")||(i=r.find(".js-tab-nav-show").eq(0),t(i),n(e))}),console.log("init tabs @",e)}}function homepage(){$("#promo-form").submit(function(e){return""===$("#username").val()?(e.preventDefault(),window.location.href="/user/login",!0):void 0}),$("#register-button").click(function(e){return""===$("#username").val()?(e.preventDefault(),window.location.href="/user/sign_up",!0):void $("#promo-form").attr("action","/user/sign_up")})}function settingsProfile(){$("#user-profile-form").submit(function(e){return $("#username").data("uname")==$("#username").val()||confirm("Username has been changed, do you want to continue?")?void 0:(e.preventDefault(),!0)})}function settingsSSHKeys(){$("#ssh-add").click(function(){$("#user-ssh-add-form").removeClass("hide")})}function settingsDelete(){$("#delete-account-button").click(function(e){return confirm("This account is going to deleted, do you want to continue?")?void 0:(e.preventDefault(),!0)})}function renderMarkdown(){var e=$(".markdown"),t=e.find("pre > code").parent();t.addClass("prettyprint linenums"),prettyPrint();var n={};e.find("h1, h2, h3, h4, h5, h6").each(function(){var e=$(this),t=encodeURIComponent(e.text().toLowerCase().replace(/[^\w\- ]/g,"").replace(/[ ]/g,"-")),r=t;n[t]>0&&(r=t+"-"+n[t]),void 0==n[t]?n[t]=1:n[t]+=1,e=e.wrap('
'),e.append('')})}function renderCodeView(){function e(e,t,n){if(e.removeClass("active"),n){var r=parseInt(t.attr("rel").substr(1)),o=parseInt(n.attr("rel").substr(1)),a;if(r!=o){r>o&&(a=r,r=o,o=a);var s=[];for(i=r;o>=i;i++)s.push(".L"+i);return e.filter(s.join(",")).addClass("active"),void $.changeHash("#L"+r+"-L"+o)}}t.addClass("active"),$.changeHash("#"+t.attr("rel"))}$(document).on("click",".lines-num span",function(t){var n=$(this),r=n.parent().siblings(".lines-code").find("ol.linenums > li");e(r,r.filter("[rel="+n.attr("rel")+"]"),t.shiftKey?r.filter(".active").eq(0):null),$.deSelect()}),$(".code-view .lines-code > pre").each(function(){var e=$(this),t=e.parent(),n=t.siblings(".lines-num");if(n.length>0)for(var r=e.find("ol.linenums > li").length,i=1;r>=i;i++)n.append(''+i+"")}),$(window).on("hashchange",function(t){var n=window.location.hash.match(/^#(L\d+)\-(L\d+)$/),r=$(".code-view ol.linenums > li");if(n){var i=r.filter("."+n[1]);return e(r,i,r.filter("."+n[2])),void $("html, body").scrollTop(i.offset().top-200)}if(n=window.location.hash.match(/^#(L\d+)$/)){var i=r.filter("."+n[1]);e(r,i),$("html, body").scrollTop(i.offset().top-200)}}).trigger("hashchange")}!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=ot.type(e);return"function"===n||ot.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function r(e,t,n){if(ot.isFunction(t))return ot.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return ot.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(pt.test(t))return ot.filter(t,e,n);t=ot.filter(t,e)}return ot.grep(e,function(e){return ot.inArray(e,t)>=0!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t=wt[e]={};return ot.each(e.match(xt)||[],function(e,n){t[n]=!0}),t}function a(){mt.addEventListener?(mt.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1)):(mt.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(mt.addEventListener||"load"===event.type||"complete"===mt.readyState)&&(a(),ot.ready())}function l(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(Et,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:kt.test(n)?ot.parseJSON(n):n}catch(i){}ot.data(e,t,n)}else n=void 0}return n}function u(e){var t;for(t in e)if(("data"!==t||!ot.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(ot.acceptData(e)){var i,o,a=ot.expando,s=e.nodeType,l=s?ot.cache:e,u=s?e[a]:e[a]&&a;if(u&&l[u]&&(r||l[u].data)||void 0!==n||"string"!=typeof t)return u||(u=s?e[a]=Y.pop()||ot.guid++:a),l[u]||(l[u]=s?{}:{toJSON:ot.noop}),("object"==typeof t||"function"==typeof t)&&(r?l[u]=ot.extend(l[u],t):l[u].data=ot.extend(l[u].data,t)),o=l[u],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[ot.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[ot.camelCase(t)])):i=o,i}}function d(e,t,n){if(ot.acceptData(e)){var r,i,o=e.nodeType,a=o?ot.cache:e,s=o?e[ot.expando]:ot.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){ot.isArray(t)?t=t.concat(ot.map(t,ot.camelCase)):t in r?t=[t]:(t=ot.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!u(r):!ot.isEmptyObject(r))return}(n||(delete a[s].data,u(a[s])))&&(o?ot.cleanData([e],!0):rt.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}function f(){return!0}function p(){return!1}function h(){try{return mt.activeElement}catch(e){}}function m(e){var t=Mt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function g(e,t){var n,r,i=0,o=typeof e.getElementsByTagName!==Ct?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==Ct?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||ot.nodeName(r,t)?o.push(r):ot.merge(o,g(r,t));return void 0===t||t&&ot.nodeName(e,t)?ot.merge([e],o):o}function v(e){Lt.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t){return ot.nodeName(e,"table")&&ot.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function b(e){return e.type=(null!==ot.find.attr(e,"type"))+"/"+e.type,e}function x(e){var t=Vt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){for(var n,r=0;null!=(n=e[r]);r++)ot._data(n,"globalEval",!t||ot._data(t[r],"globalEval"))}function T(e,t){if(1===t.nodeType&&ot.hasData(e)){var n,r,i,o=ot._data(e),a=ot._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)ot.event.add(t,n,s[n][r])}a.data&&(a.data=ot.extend({},a.data))}}function C(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!rt.noCloneEvent&&t[ot.expando]){i=ot._data(t);for(r in i.events)ot.removeEvent(t,r,i.handle);t.removeAttribute(ot.expando)}"script"===n&&t.text!==e.text?(b(t).text=e.text,x(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),rt.html5Clone&&e.innerHTML&&!ot.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Lt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function N(t,n){var r,i=ot(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:ot.css(i[0],"display");return i.detach(),o}function k(e){var t=mt,n=Zt[e];return n||(n=N(e,t),"none"!==n&&n||(Qt=(Qt||ot("