{"action":"created","comment":{"url":"https://api.github.com/repos/ecomfe/esui/pulls/comments/37501229","id":37501229,"diff_hunk":"@@ -226,6 +226,101 @@ define(\n                 },\r\n \r\n                 /**\r\n+                 * 监听一个区域 为这个区域内带有data-role='tip'属性的节点添加tip\r\n+                 * 在该区域内部所有的DOM节点里 若要添加tip提示 需配置以下属性\r\n+                 * 1. data-role='tip' 所有具有该属性的节点都会增加tip提示\r\n+                 * 2. data-tip-title='提示标题' 该节点所要显示的提示的标题内容\r\n+                 * 3. data-tip-title='提示内容' 该节点所要显示的提示的内容\r\n+                 * 一旦配置过以上属性 就可以自动为该区域内所有类似的节点添加相应的tip\r\n+                 *\r\n+                 * 有时可能想要针对不同的元素对其的title或者content进行更多方面的控制\r\n+                 * 则可以通过自定义方法实现，即传入的customBeforeShowHandler方法\r\n+                 * 该方法默认有两个参数，title与content\r\n+                 *\r\n+                 * 使用方法如下所示：\r\n+                 *\r\n+                 * 假设DOM结构如下：\r\n+                 * <div id=\"main\">\r\n+                 *      <button data-role=\"tip\" data-tip-title=\"submit\" data-tip-content=\"确认提示\">确认</button>\r\n+                 *      <button data-role=\"tip\" data-tip-title=\"cancel\" data-tip-content=\"取消提示\">取消</button>\r\n+                 * </div>\r\n+                 *\r\n+                 * 则JS中可按如下方式使用\r\n+                 * var tipLayer = ui.create('TipLayer', {\r\n+                 *   title: '最普通的提示',\r\n+                 *   content: '提示'\r\n+                 * });\r\n+                 * tipLayer.monitor('#main', {showMode: 'over'}, function (title, content) {\r\n+                 *   if (title === \"submit\") {\r\n+                 *       this.setContent('确认后才可点击！');\r\n+                 *   }\r\n+                 *   else {\r\n+                 *       this.setContent(content);\r\n+                 *   }\r\n+                 * });\r\n+                 *\r\n+                 *\r\n+                 * @param {string} selector JQuery选择器\r\n+                 * @param {Object=} options 绑定参数\r\n+                 *    {string} showMode 展示触发模式\r\n+                 *    {number} delayTime 延迟展示时间\r\n+                 * @param {Function} customBeforeShowHandler beforeShow的自定义处理方法\r\n+                 */\r\n+                monitor: function (selector, options, customBeforeShowHandler) {\r\n+                    var showMode = options.showMode || 'over';\r\n+                    var delayTime = options.delayTime || 0;\r\n+                    var containerElement = $(selector);\r\n+\r\n+                    // 为防止delayTime时出现 tip还未hide就更改内容的情况 监听beforeshow事件 在此刻再进行更改\r\n+                    this.on('beforeshow', function (e) {\r\n+                        var title = e.title;\r\n+                        var content = e.content;\r\n+                        if (typeof customBeforeShowHandler === 'function') {\r\n+                            customBeforeShowHandler.call(this, title, content);\r\n+                            return;\r\n+                        }\r\n+                        this.setTitle(title);\r\n+                        this.setContent(content);\r\n+                    }, this);\r\n+\r\n+                    function showTip(event) {\r\n+                        var targetDOM = $(event.target);\r\n+                        // 检查是否具有data-attached的属性 有的话直接忽略就可以\r\n+                        if (!targetDOM.data('data-attached')) {\r\n+                            this.attachTo({\r\n+                                targetDOM: targetDOM,\r\n+                                showMode: showMode,\r\n+                                delayTime: delayTime,\r\n+                                positionOpt: {top: 'top', right: 'left'}\r\n+                            });\r\n+                            // 凡是已经attachTo过之后的节点 都自动添加一个data-attached的属性 防止重复绑定\r\n+                            targetDOM.data('data-attached', true);\r\n+                            // 第一次绑定的时候需要手动show一下才可以显示tip\r\n+                            // targetDOM.trigger(event.type);\r\n+                            delayShow(this, delayTime, targetDOM, {\r\n+                                targetPositionOpt: {top: 'top', right: 'right'},\r\n+                                positionOpt: {top: 'top', right: 'left'}\r\n+                            });\r\n+                        }\r\n+                        // 阻止冒泡到父节点 以防止tipLayer自动hide掉\r\n+                        event.stopPropagation();\r\n+                    }\r\n+\r\n+                    if (!containerElement) {\r\n+                        return;\r\n+                    }\r\n+\r\n+                    if (showMode === 'over') {\r\n+                        this.helper.addDOMEvent(containerElement,\r","path":"src/TipLayer.js","position":89,"original_position":89,"commit_id":"7bb247962c66b570735a9fdcd726d009dd8c63d5","original_commit_id":"7bb247962c66b570735a9fdcd726d009dd8c63d5","user":{"login":"yankun01","id":6520754,"avatar_url":"https://avatars.githubusercontent.com/u/6520754?v=3","gravatar_id":"","url":"https://api.github.com/users/yankun01","html_url":"https://github.com/yankun01","followers_url":"https://api.github.com/users/yankun01/followers","following_url":"https://api.github.com/users/yankun01/following{/other_user}","gists_url":"https://api.github.com/users/yankun01/gists{/gist_id}","starred_url":"https://api.github.com/users/yankun01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yankun01/subscriptions","organizations_url":"https://api.github.com/users/yankun01/orgs","repos_url":"https://api.github.com/users/yankun01/repos","events_url":"https://api.github.com/users/yankun01/events{/privacy}","received_events_url":"https://api.github.com/users/yankun01/received_events","type":"User","site_admin":false},"body":"这个是兼容的。 \r\n","created_at":"2015-08-20T07:19:39Z","updated_at":"2015-08-20T07:19:39Z","html_url":"https://github.com/ecomfe/esui/pull/505#discussion_r37501229","pull_request_url":"https://api.github.com/repos/ecomfe/esui/pulls/505","_links":{"self":{"href":"https://api.github.com/repos/ecomfe/esui/pulls/comments/37501229"},"html":{"href":"https://github.com/ecomfe/esui/pull/505#discussion_r37501229"},"pull_request":{"href":"https://api.github.com/repos/ecomfe/esui/pulls/505"}}},"pull_request":{"url":"https://api.github.com/repos/ecomfe/esui/pulls/505","id":42430054,"html_url":"https://github.com/ecomfe/esui/pull/505","diff_url":"https://github.com/ecomfe/esui/pull/505.diff","patch_url":"https://github.com/ecomfe/esui/pull/505.patch","issue_url":"https://api.github.com/repos/ecomfe/esui/issues/505","number":505,"state":"open","locked":false,"title":"3.2/develop jq","user":{"login":"PacoIrene","id":3017934,"avatar_url":"https://avatars.githubusercontent.com/u/3017934?v=3","gravatar_id":"","url":"https://api.github.com/users/PacoIrene","html_url":"https://github.com/PacoIrene","followers_url":"https://api.github.com/users/PacoIrene/followers","following_url":"https://api.github.com/users/PacoIrene/following{/other_user}","gists_url":"https://api.github.com/users/PacoIrene/gists{/gist_id}","starred_url":"https://api.github.com/users/PacoIrene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PacoIrene/subscriptions","organizations_url":"https://api.github.com/users/PacoIrene/orgs","repos_url":"https://api.github.com/users/PacoIrene/repos","events_url":"https://api.github.com/users/PacoIrene/events{/privacy}","received_events_url":"https://api.github.com/users/PacoIrene/received_events","type":"User","site_admin":false},"body":"为TIP控件添加一个监听某一区域的方法，针对该区域内所有的特殊节点添加TIP提示","created_at":"2015-08-14T07:21:32Z","updated_at":"2015-08-20T07:19:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a87270f2a1d97917e6c3a37bd2c22d6583bbd534","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ecomfe/esui/pulls/505/commits","review_comments_url":"https://api.github.com/repos/ecomfe/esui/pulls/505/comments","review_comment_url":"https://api.github.com/repos/ecomfe/esui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ecomfe/esui/issues/505/comments","statuses_url":"https://api.github.com/repos/ecomfe/esui/statuses/7bb247962c66b570735a9fdcd726d009dd8c63d5","head":{"label":"PacoIrene:3.2/develop-jq","ref":"3.2/develop-jq","sha":"7bb247962c66b570735a9fdcd726d009dd8c63d5","user":{"login":"PacoIrene","id":3017934,"avatar_url":"https://avatars.githubusercontent.com/u/3017934?v=3","gravatar_id":"","url":"https://api.github.com/users/PacoIrene","html_url":"https://github.com/PacoIrene","followers_url":"https://api.github.com/users/PacoIrene/followers","following_url":"https://api.github.com/users/PacoIrene/following{/other_user}","gists_url":"https://api.github.com/users/PacoIrene/gists{/gist_id}","starred_url":"https://api.github.com/users/PacoIrene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PacoIrene/subscriptions","organizations_url":"https://api.github.com/users/PacoIrene/orgs","repos_url":"https://api.github.com/users/PacoIrene/repos","events_url":"https://api.github.com/users/PacoIrene/events{/privacy}","received_events_url":"https://api.github.com/users/PacoIrene/received_events","type":"User","site_admin":false},"repo":{"id":38095445,"name":"esui","full_name":"PacoIrene/esui","owner":{"login":"PacoIrene","id":3017934,"avatar_url":"https://avatars.githubusercontent.com/u/3017934?v=3","gravatar_id":"","url":"https://api.github.com/users/PacoIrene","html_url":"https://github.com/PacoIrene","followers_url":"https://api.github.com/users/PacoIrene/followers","following_url":"https://api.github.com/users/PacoIrene/following{/other_user}","gists_url":"https://api.github.com/users/PacoIrene/gists{/gist_id}","starred_url":"https://api.github.com/users/PacoIrene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PacoIrene/subscriptions","organizations_url":"https://api.github.com/users/PacoIrene/orgs","repos_url":"https://api.github.com/users/PacoIrene/repos","events_url":"https://api.github.com/users/PacoIrene/events{/privacy}","received_events_url":"https://api.github.com/users/PacoIrene/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PacoIrene/esui","description":"enterprise simple ui library","fork":true,"url":"https://api.github.com/repos/PacoIrene/esui","forks_url":"https://api.github.com/repos/PacoIrene/esui/forks","keys_url":"https://api.github.com/repos/PacoIrene/esui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PacoIrene/esui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PacoIrene/esui/teams","hooks_url":"https://api.github.com/repos/PacoIrene/esui/hooks","issue_events_url":"https://api.github.com/repos/PacoIrene/esui/issues/events{/number}","events_url":"https://api.github.com/repos/PacoIrene/esui/events","assignees_url":"https://api.github.com/repos/PacoIrene/esui/assignees{/user}","branches_url":"https://api.github.com/repos/PacoIrene/esui/branches{/branch}","tags_url":"https://api.github.com/repos/PacoIrene/esui/tags","blobs_url":"https://api.github.com/repos/PacoIrene/esui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PacoIrene/esui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PacoIrene/esui/git/refs{/sha}","trees_url":"https://api.github.com/repos/PacoIrene/esui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PacoIrene/esui/statuses/{sha}","languages_url":"https://api.github.com/repos/PacoIrene/esui/languages","stargazers_url":"https://api.github.com/repos/PacoIrene/esui/stargazers","contributors_url":"https://api.github.com/repos/PacoIrene/esui/contributors","subscribers_url":"https://api.github.com/repos/PacoIrene/esui/subscribers","subscription_url":"https://api.github.com/repos/PacoIrene/esui/subscription","commits_url":"https://api.github.com/repos/PacoIrene/esui/commits{/sha}","git_commits_url":"https://api.github.com/repos/PacoIrene/esui/git/commits{/sha}","comments_url":"https://api.github.com/repos/PacoIrene/esui/comments{/number}","issue_comment_url":"https://api.github.com/repos/PacoIrene/esui/issues/comments{/number}","contents_url":"https://api.github.com/repos/PacoIrene/esui/contents/{+path}","compare_url":"https://api.github.com/repos/PacoIrene/esui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PacoIrene/esui/merges","archive_url":"https://api.github.com/repos/PacoIrene/esui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PacoIrene/esui/downloads","issues_url":"https://api.github.com/repos/PacoIrene/esui/issues{/number}","pulls_url":"https://api.github.com/repos/PacoIrene/esui/pulls{/number}","milestones_url":"https://api.github.com/repos/PacoIrene/esui/milestones{/number}","notifications_url":"https://api.github.com/repos/PacoIrene/esui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PacoIrene/esui/labels{/name}","releases_url":"https://api.github.com/repos/PacoIrene/esui/releases{/id}","created_at":"2015-06-26T06:44:01Z","updated_at":"2015-06-26T06:44:01Z","pushed_at":"2015-08-19T10:04:16Z","git_url":"git://github.com/PacoIrene/esui.git","ssh_url":"git@github.com:PacoIrene/esui.git","clone_url":"https://github.com/PacoIrene/esui.git","svn_url":"https://github.com/PacoIrene/esui","homepage":null,"size":6037,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ecomfe:3.2/develop","ref":"3.2/develop","sha":"2f7fb389d2ff7ffe495080105cdfaa9b07443165","user":{"login":"ecomfe","id":2268460,"avatar_url":"https://avatars.githubusercontent.com/u/2268460?v=3","gravatar_id":"","url":"https://api.github.com/users/ecomfe","html_url":"https://github.com/ecomfe","followers_url":"https://api.github.com/users/ecomfe/followers","following_url":"https://api.github.com/users/ecomfe/following{/other_user}","gists_url":"https://api.github.com/users/ecomfe/gists{/gist_id}","starred_url":"https://api.github.com/users/ecomfe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecomfe/subscriptions","organizations_url":"https://api.github.com/users/ecomfe/orgs","repos_url":"https://api.github.com/users/ecomfe/repos","events_url":"https://api.github.com/users/ecomfe/events{/privacy}","received_events_url":"https://api.github.com/users/ecomfe/received_events","type":"Organization","site_admin":false},"repo":{"id":7668304,"name":"esui","full_name":"ecomfe/esui","owner":{"login":"ecomfe","id":2268460,"avatar_url":"https://avatars.githubusercontent.com/u/2268460?v=3","gravatar_id":"","url":"https://api.github.com/users/ecomfe","html_url":"https://github.com/ecomfe","followers_url":"https://api.github.com/users/ecomfe/followers","following_url":"https://api.github.com/users/ecomfe/following{/other_user}","gists_url":"https://api.github.com/users/ecomfe/gists{/gist_id}","starred_url":"https://api.github.com/users/ecomfe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecomfe/subscriptions","organizations_url":"https://api.github.com/users/ecomfe/orgs","repos_url":"https://api.github.com/users/ecomfe/repos","events_url":"https://api.github.com/users/ecomfe/events{/privacy}","received_events_url":"https://api.github.com/users/ecomfe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ecomfe/esui","description":"enterprise simple ui library","fork":false,"url":"https://api.github.com/repos/ecomfe/esui","forks_url":"https://api.github.com/repos/ecomfe/esui/forks","keys_url":"https://api.github.com/repos/ecomfe/esui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ecomfe/esui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ecomfe/esui/teams","hooks_url":"https://api.github.com/repos/ecomfe/esui/hooks","issue_events_url":"https://api.github.com/repos/ecomfe/esui/issues/events{/number}","events_url":"https://api.github.com/repos/ecomfe/esui/events","assignees_url":"https://api.github.com/repos/ecomfe/esui/assignees{/user}","branches_url":"https://api.github.com/repos/ecomfe/esui/branches{/branch}","tags_url":"https://api.github.com/repos/ecomfe/esui/tags","blobs_url":"https://api.github.com/repos/ecomfe/esui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ecomfe/esui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ecomfe/esui/git/refs{/sha}","trees_url":"https://api.github.com/repos/ecomfe/esui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ecomfe/esui/statuses/{sha}","languages_url":"https://api.github.com/repos/ecomfe/esui/languages","stargazers_url":"https://api.github.com/repos/ecomfe/esui/stargazers","contributors_url":"https://api.github.com/repos/ecomfe/esui/contributors","subscribers_url":"https://api.github.com/repos/ecomfe/esui/subscribers","subscription_url":"https://api.github.com/repos/ecomfe/esui/subscription","commits_url":"https://api.github.com/repos/ecomfe/esui/commits{/sha}","git_commits_url":"https://api.github.com/repos/ecomfe/esui/git/commits{/sha}","comments_url":"https://api.github.com/repos/ecomfe/esui/comments{/number}","issue_comment_url":"https://api.github.com/repos/ecomfe/esui/issues/comments{/number}","contents_url":"https://api.github.com/repos/ecomfe/esui/contents/{+path}","compare_url":"https://api.github.com/repos/ecomfe/esui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ecomfe/esui/merges","archive_url":"https://api.github.com/repos/ecomfe/esui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ecomfe/esui/downloads","issues_url":"https://api.github.com/repos/ecomfe/esui/issues{/number}","pulls_url":"https://api.github.com/repos/ecomfe/esui/pulls{/number}","milestones_url":"https://api.github.com/repos/ecomfe/esui/milestones{/number}","notifications_url":"https://api.github.com/repos/ecomfe/esui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ecomfe/esui/labels{/name}","releases_url":"https://api.github.com/repos/ecomfe/esui/releases{/id}","created_at":"2013-01-17T15:10:21Z","updated_at":"2015-08-11T01:43:33Z","pushed_at":"2015-08-20T05:21:12Z","git_url":"git://github.com/ecomfe/esui.git","ssh_url":"git@github.com:ecomfe/esui.git","clone_url":"https://github.com/ecomfe/esui.git","svn_url":"https://github.com/ecomfe/esui","homepage":null,"size":10707,"stargazers_count":163,"watchers_count":163,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":143,"mirror_url":null,"open_issues_count":64,"forks":143,"open_issues":64,"watchers":163,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ecomfe/esui/pulls/505"},"html":{"href":"https://github.com/ecomfe/esui/pull/505"},"issue":{"href":"https://api.github.com/repos/ecomfe/esui/issues/505"},"comments":{"href":"https://api.github.com/repos/ecomfe/esui/issues/505/comments"},"review_comments":{"href":"https://api.github.com/repos/ecomfe/esui/pulls/505/comments"},"review_comment":{"href":"https://api.github.com/repos/ecomfe/esui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ecomfe/esui/pulls/505/commits"},"statuses":{"href":"https://api.github.com/repos/ecomfe/esui/statuses/7bb247962c66b570735a9fdcd726d009dd8c63d5"}}}}