{"action":"created","comment":{"url":"https://api.github.com/repos/naver/egjs/pulls/comments/56303819","id":56303819,"diff_hunk":"@@ -0,0 +1,299 @@\n+/**\n+* Copyright (c) 2015 NAVER Corp.\n+* egjs projects are licensed under the MIT license\n+*/\n+eg.module(\"pauseResume\", [\"jQuery\"], function($) {\n+\t\"use strict\";\n+\n+\tvar animateFn = $.fn.animate;\n+\tvar stopFn = $.fn.stop;\n+\tvar uuid = 1;\n+\n+\tfunction now() {\n+\t\treturn new Date().getTime();\n+\t}\n+\n+\tfunction AniProperty(prop, optall, prevProp, isFirst) {\n+\t\tthis.opt = optall;\n+\t\tthis.start = -1;\n+\t\tthis.elapsed = 0;\n+\t\tthis.paused = false;\n+\t\tthis.uuid = uuid++;\n+\t\tthis.easingNames = [];\n+\t\tthis.prop = isFirst ? {} : $.extend({}, prevProp);\n+\n+\t\tfor (var propName in prop) {\n+\t\t\tvar propValue = prop[propName];\n+\t\t\tvar markIndex;\n+\t\t\tvar sign;\n+\n+\t\t\t//If it has a absoulte value.\n+\t\t\tif (typeof(propValue) !== \"string\" ||\n+\t\t\t\t(markIndex = propValue.search(/[+|-]=/)) < 0) {\n+\t\t\t\tthis.prop[propName] = propValue;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tsign = propValue.charAt(markIndex) === \"-\" ? -1 : 1;\n+\n+\t\t\t//If it has a relative value\n+\t\t\tthis.prop[propName] = propValue\n+\t\t\t\t.replace(/([-|+])*([\\d|\\.])+/g,\n+\t\t\t\t\tgenerateAbsoluteValMaker(prevProp, propName, sign))\n+\t\t\t\t.replace(/[-|+]+=/g, \"\");\n+\t\t}\n+\t}\n+\n+\t/**\n+\t * Generate a new absolute value maker.\n+\t *\n+\t * function to avoid JS Hint error \"Don't make functions within a loop\"\n+\t */\n+\tfunction generateAbsoluteValMaker(prevProp, propName, sign) {\n+\t\treturn function absoluteValMaker(match) {\n+\t\t\tvar currValue = prevProp[propName] ? parseFloat(prevProp[propName]) : 0;\n+\t\t\treturn currValue + Number(match) * sign;\n+\t\t};\n+\t}\n+\n+\tAniProperty.prototype.init = function() {\n+\t\tthis.start = now();\n+\t\tthis.elapsed = 0;\n+\t};\n+\n+\tAniProperty.prototype.addEasingFn = function(easingName) {\n+\t\tthis.easingNames.push(easingName);\n+\t};\n+\n+\tAniProperty.prototype.clearEasingFn = function() {\n+\t\tvar easing;\n+\t\twhile (easing = this.easingNames.shift()) {\n+\t\t\tdelete $.easing[easing];\n+\t\t}\n+\t\tthis.easingNames = [];\n+\t};\n+\n+\tfunction addAniProperty(el, prop, optall) {\n+\t\tvar prevProp;\n+\t\tvar propCount = el.__aniProps ? el.__aniProps.length : 0;\n+\t\tvar isFirst = false;\n+\t\tvar newProp;\n+\n+\t\tif (propCount === 0) {\n+\t\t\tprevProp = el.style;\n+\t\t\tisFirst = true;\n+\t\t} else {\n+\t\t\tprevProp = el.__aniProps[propCount - 1].prop;\n+\t\t}\n+\n+\t\t//prevProp is used for calculating absolute value by accumulating aniProps.\n+\t\t//So newProp has absolute value accumlated.\n+\t\tnewProp = new AniProperty(prop, optall, prevProp, isFirst);\n+\t\tel.__aniProps = el.__aniProps || [];\n+\n+\t\t//Animation is excuted immediately.\n+\t\tif (el.__aniProps.length === 0) {\n+\t\t\tnewProp.init();\n+\t\t}\n+\t\tel.__aniProps.push(newProp);\n+\t}\n+\n+\tfunction getOptAll(speed, easing, fn) {\n+\t\tvar opt = speed && typeof speed === \"object\" ?\n+\t\tjQuery.extend({}, speed) : {\n+\t\t\tcomplete: fn || !fn && easing ||\n+\t\t\t\tjQuery.isFunction(speed) && speed,\n+\t\t\tduration: speed,\n+\t\t\teasing: fn && easing ||\n+\t\t\t\t\teasing && !jQuery.isFunction(easing) && easing\n+\t\t};\n+\n+\t\topt.duration = jQuery.fx.off ? 0 : typeof opt.duration === \"number\" ?\n+\t\t\topt.duration : opt.duration in jQuery.fx.speeds ?\n+\t\t\t\tjQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;\n+\n+\t\t// normalize opt.queue - true/undefined/null -> \"fx\"\n+\t\tif (opt.queue == null || opt.queue === true) {\n+\t\t\topt.queue = \"fx\";\n+\t\t}\n+\n+\t\treturn opt;\n+\t}\n+\n+\t$.fn.animate = function(prop, speed, easing, callback) {\n+\t\treturn this.each(function() {\n+\t\t\t//optall should be made for each elements.\n+\t\t\tvar optall = getOptAll(speed, easing, callback);\n+\t\t\tvar orginalComplete = optall.complete;\n+\n+\t\t\t//Override to check current animation is done.\n+\t\t\toptall.complete = function() {\n+\t\t\t\t//Dequeue animation property that was ended.\n+\t\t\t\tvar removeProp = this.__aniProps.shift();\n+\t\t\t\tremoveProp.clearEasingFn();\n+\n+\t\t\t\t// console.log(\"ani complete, shift prop:\", removeProp);\n+\t\t\t\tthis.__aniProps[0] && this.__aniProps[0].init();\n+\t\t\t\tif (orginalComplete && typeof(orginalComplete) === \"function\") {\n+\t\t\t\t\torginalComplete.call(this);\n+\t\t\t\t}\n+\t\t\t};\n+\n+\t\t\t//Queue animation property to recover the current animation.\n+\t\t\taddAniProperty(this, prop, optall);\n+\t\t\tanimateFn.call($(this), prop, optall);\n+\t\t});\n+\n+\t\t// TODO: Below code is more reasonable?\n+\t\t// return animateFn.call(this, prop, optall); // and declare optall at outside this.each loop.\n+\t};\n+\n+\t$.fn.pause = function() {\n+\t\t// console.warn(\"===========PAUSE==============\");\n+\t\treturn this.each(function() {\n+\t\t\tvar p;\n+\t\t\tvar type = \"fx\";\n+\n+\t\t\tif (!this.__aniProps) {","path":"src/hook/pauseResume.js","position":157,"original_position":157,"commit_id":"25305a8b0ac966bef889924734f5f54b50faefea","original_commit_id":"25305a8b0ac966bef889924734f5f54b50faefea","user":{"login":"mixed","id":22300,"avatar_url":"https://avatars.githubusercontent.com/u/22300?v=3","gravatar_id":"","url":"https://api.github.com/users/mixed","html_url":"https://github.com/mixed","followers_url":"https://api.github.com/users/mixed/followers","following_url":"https://api.github.com/users/mixed/following{/other_user}","gists_url":"https://api.github.com/users/mixed/gists{/gist_id}","starred_url":"https://api.github.com/users/mixed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixed/subscriptions","organizations_url":"https://api.github.com/users/mixed/orgs","repos_url":"https://api.github.com/users/mixed/repos","events_url":"https://api.github.com/users/mixed/events{/privacy}","received_events_url":"https://api.github.com/users/mixed/received_events","type":"User","site_admin":false},"body":"Repeat Code\r\nhttps://github.com/naver/egjs/pull/151/files#diff-03e3e7f5c3a6fa118a3e235f1a9c5214R157\r\n~\r\nhttps://github.com/naver/egjs/pull/151/files#diff-03e3e7f5c3a6fa118a3e235f1a9c5214R1164","created_at":"2016-03-16T09:34:03Z","updated_at":"2016-03-16T09:34:03Z","html_url":"https://github.com/naver/egjs/pull/151#discussion_r56303819","pull_request_url":"https://api.github.com/repos/naver/egjs/pulls/151","_links":{"self":{"href":"https://api.github.com/repos/naver/egjs/pulls/comments/56303819"},"html":{"href":"https://github.com/naver/egjs/pull/151#discussion_r56303819"},"pull_request":{"href":"https://api.github.com/repos/naver/egjs/pulls/151"}}},"pull_request":{"url":"https://api.github.com/repos/naver/egjs/pulls/151","id":62355132,"html_url":"https://github.com/naver/egjs/pull/151","diff_url":"https://github.com/naver/egjs/pull/151.diff","patch_url":"https://github.com/naver/egjs/pull/151.patch","issue_url":"https://api.github.com/repos/naver/egjs/issues/151","number":151,"state":"open","locked":false,"title":"feat(pauseResume): pause/resume feature(jQuery plugin)","user":{"login":"jongmoon","id":3255471,"avatar_url":"https://avatars.githubusercontent.com/u/3255471?v=3","gravatar_id":"","url":"https://api.github.com/users/jongmoon","html_url":"https://github.com/jongmoon","followers_url":"https://api.github.com/users/jongmoon/followers","following_url":"https://api.github.com/users/jongmoon/following{/other_user}","gists_url":"https://api.github.com/users/jongmoon/gists{/gist_id}","starred_url":"https://api.github.com/users/jongmoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongmoon/subscriptions","organizations_url":"https://api.github.com/users/jongmoon/orgs","repos_url":"https://api.github.com/users/jongmoon/repos","events_url":"https://api.github.com/users/jongmoon/events{/privacy}","received_events_url":"https://api.github.com/users/jongmoon/received_events","type":"User","site_admin":false},"body":"## Issue\r\n#111\r\n\r\n## Details\r\njQuery Animate - pause/resume plugin feature\r\n\r\n## Preferred reviewers\r\n@naver/egjs-dev \r\n","created_at":"2016-03-10T08:33:24Z","updated_at":"2016-03-16T09:34:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3b642a9885f10910a2451eda662d5af752fa622","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/naver/egjs/pulls/151/commits","review_comments_url":"https://api.github.com/repos/naver/egjs/pulls/151/comments","review_comment_url":"https://api.github.com/repos/naver/egjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/naver/egjs/issues/151/comments","statuses_url":"https://api.github.com/repos/naver/egjs/statuses/25305a8b0ac966bef889924734f5f54b50faefea","head":{"label":"jongmoon:master","ref":"master","sha":"25305a8b0ac966bef889924734f5f54b50faefea","user":{"login":"jongmoon","id":3255471,"avatar_url":"https://avatars.githubusercontent.com/u/3255471?v=3","gravatar_id":"","url":"https://api.github.com/users/jongmoon","html_url":"https://github.com/jongmoon","followers_url":"https://api.github.com/users/jongmoon/followers","following_url":"https://api.github.com/users/jongmoon/following{/other_user}","gists_url":"https://api.github.com/users/jongmoon/gists{/gist_id}","starred_url":"https://api.github.com/users/jongmoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongmoon/subscriptions","organizations_url":"https://api.github.com/users/jongmoon/orgs","repos_url":"https://api.github.com/users/jongmoon/repos","events_url":"https://api.github.com/users/jongmoon/events{/privacy}","received_events_url":"https://api.github.com/users/jongmoon/received_events","type":"User","site_admin":false},"repo":{"id":48477803,"name":"egjs","full_name":"jongmoon/egjs","owner":{"login":"jongmoon","id":3255471,"avatar_url":"https://avatars.githubusercontent.com/u/3255471?v=3","gravatar_id":"","url":"https://api.github.com/users/jongmoon","html_url":"https://github.com/jongmoon","followers_url":"https://api.github.com/users/jongmoon/followers","following_url":"https://api.github.com/users/jongmoon/following{/other_user}","gists_url":"https://api.github.com/users/jongmoon/gists{/gist_id}","starred_url":"https://api.github.com/users/jongmoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongmoon/subscriptions","organizations_url":"https://api.github.com/users/jongmoon/orgs","repos_url":"https://api.github.com/users/jongmoon/repos","events_url":"https://api.github.com/users/jongmoon/events{/privacy}","received_events_url":"https://api.github.com/users/jongmoon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jongmoon/egjs","description":"Set of UI interactions, effects and utilities components library using jQuery.","fork":true,"url":"https://api.github.com/repos/jongmoon/egjs","forks_url":"https://api.github.com/repos/jongmoon/egjs/forks","keys_url":"https://api.github.com/repos/jongmoon/egjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jongmoon/egjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jongmoon/egjs/teams","hooks_url":"https://api.github.com/repos/jongmoon/egjs/hooks","issue_events_url":"https://api.github.com/repos/jongmoon/egjs/issues/events{/number}","events_url":"https://api.github.com/repos/jongmoon/egjs/events","assignees_url":"https://api.github.com/repos/jongmoon/egjs/assignees{/user}","branches_url":"https://api.github.com/repos/jongmoon/egjs/branches{/branch}","tags_url":"https://api.github.com/repos/jongmoon/egjs/tags","blobs_url":"https://api.github.com/repos/jongmoon/egjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jongmoon/egjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jongmoon/egjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jongmoon/egjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jongmoon/egjs/statuses/{sha}","languages_url":"https://api.github.com/repos/jongmoon/egjs/languages","stargazers_url":"https://api.github.com/repos/jongmoon/egjs/stargazers","contributors_url":"https://api.github.com/repos/jongmoon/egjs/contributors","subscribers_url":"https://api.github.com/repos/jongmoon/egjs/subscribers","subscription_url":"https://api.github.com/repos/jongmoon/egjs/subscription","commits_url":"https://api.github.com/repos/jongmoon/egjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jongmoon/egjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jongmoon/egjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jongmoon/egjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/jongmoon/egjs/contents/{+path}","compare_url":"https://api.github.com/repos/jongmoon/egjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jongmoon/egjs/merges","archive_url":"https://api.github.com/repos/jongmoon/egjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jongmoon/egjs/downloads","issues_url":"https://api.github.com/repos/jongmoon/egjs/issues{/number}","pulls_url":"https://api.github.com/repos/jongmoon/egjs/pulls{/number}","milestones_url":"https://api.github.com/repos/jongmoon/egjs/milestones{/number}","notifications_url":"https://api.github.com/repos/jongmoon/egjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jongmoon/egjs/labels{/name}","releases_url":"https://api.github.com/repos/jongmoon/egjs/releases{/id}","deployments_url":"https://api.github.com/repos/jongmoon/egjs/deployments","created_at":"2015-12-23T08:00:03Z","updated_at":"2016-01-28T06:58:17Z","pushed_at":"2016-03-16T06:12:07Z","git_url":"git://github.com/jongmoon/egjs.git","ssh_url":"git@github.com:jongmoon/egjs.git","clone_url":"https://github.com/jongmoon/egjs.git","svn_url":"https://github.com/jongmoon/egjs","homepage":"https://egjs.github.io","size":2109,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"naver:master","ref":"master","sha":"2d47975913a5100cfc6f60cdae5db6bf394a37fb","user":{"login":"naver","id":6589568,"avatar_url":"https://avatars.githubusercontent.com/u/6589568?v=3","gravatar_id":"","url":"https://api.github.com/users/naver","html_url":"https://github.com/naver","followers_url":"https://api.github.com/users/naver/followers","following_url":"https://api.github.com/users/naver/following{/other_user}","gists_url":"https://api.github.com/users/naver/gists{/gist_id}","starred_url":"https://api.github.com/users/naver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naver/subscriptions","organizations_url":"https://api.github.com/users/naver/orgs","repos_url":"https://api.github.com/users/naver/repos","events_url":"https://api.github.com/users/naver/events{/privacy}","received_events_url":"https://api.github.com/users/naver/received_events","type":"Organization","site_admin":false},"repo":{"id":46768645,"name":"egjs","full_name":"naver/egjs","owner":{"login":"naver","id":6589568,"avatar_url":"https://avatars.githubusercontent.com/u/6589568?v=3","gravatar_id":"","url":"https://api.github.com/users/naver","html_url":"https://github.com/naver","followers_url":"https://api.github.com/users/naver/followers","following_url":"https://api.github.com/users/naver/following{/other_user}","gists_url":"https://api.github.com/users/naver/gists{/gist_id}","starred_url":"https://api.github.com/users/naver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naver/subscriptions","organizations_url":"https://api.github.com/users/naver/orgs","repos_url":"https://api.github.com/users/naver/repos","events_url":"https://api.github.com/users/naver/events{/privacy}","received_events_url":"https://api.github.com/users/naver/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/naver/egjs","description":"Set of UI interactions, effects and utilities components library using jQuery.","fork":false,"url":"https://api.github.com/repos/naver/egjs","forks_url":"https://api.github.com/repos/naver/egjs/forks","keys_url":"https://api.github.com/repos/naver/egjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/naver/egjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/naver/egjs/teams","hooks_url":"https://api.github.com/repos/naver/egjs/hooks","issue_events_url":"https://api.github.com/repos/naver/egjs/issues/events{/number}","events_url":"https://api.github.com/repos/naver/egjs/events","assignees_url":"https://api.github.com/repos/naver/egjs/assignees{/user}","branches_url":"https://api.github.com/repos/naver/egjs/branches{/branch}","tags_url":"https://api.github.com/repos/naver/egjs/tags","blobs_url":"https://api.github.com/repos/naver/egjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/naver/egjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/naver/egjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/naver/egjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/naver/egjs/statuses/{sha}","languages_url":"https://api.github.com/repos/naver/egjs/languages","stargazers_url":"https://api.github.com/repos/naver/egjs/stargazers","contributors_url":"https://api.github.com/repos/naver/egjs/contributors","subscribers_url":"https://api.github.com/repos/naver/egjs/subscribers","subscription_url":"https://api.github.com/repos/naver/egjs/subscription","commits_url":"https://api.github.com/repos/naver/egjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/naver/egjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/naver/egjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/naver/egjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/naver/egjs/contents/{+path}","compare_url":"https://api.github.com/repos/naver/egjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/naver/egjs/merges","archive_url":"https://api.github.com/repos/naver/egjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/naver/egjs/downloads","issues_url":"https://api.github.com/repos/naver/egjs/issues{/number}","pulls_url":"https://api.github.com/repos/naver/egjs/pulls{/number}","milestones_url":"https://api.github.com/repos/naver/egjs/milestones{/number}","notifications_url":"https://api.github.com/repos/naver/egjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/naver/egjs/labels{/name}","releases_url":"https://api.github.com/repos/naver/egjs/releases{/id}","deployments_url":"https://api.github.com/repos/naver/egjs/deployments","created_at":"2015-11-24T05:18:03Z","updated_at":"2016-02-19T06:51:21Z","pushed_at":"2016-03-16T09:21:34Z","git_url":"git://github.com/naver/egjs.git","ssh_url":"git@github.com:naver/egjs.git","clone_url":"https://github.com/naver/egjs.git","svn_url":"https://github.com/naver/egjs","homepage":"https://naver.github.io/egjs","size":10833,"stargazers_count":102,"watchers_count":102,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":42,"forks":15,"open_issues":42,"watchers":102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/naver/egjs/pulls/151"},"html":{"href":"https://github.com/naver/egjs/pull/151"},"issue":{"href":"https://api.github.com/repos/naver/egjs/issues/151"},"comments":{"href":"https://api.github.com/repos/naver/egjs/issues/151/comments"},"review_comments":{"href":"https://api.github.com/repos/naver/egjs/pulls/151/comments"},"review_comment":{"href":"https://api.github.com/repos/naver/egjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/naver/egjs/pulls/151/commits"},"statuses":{"href":"https://api.github.com/repos/naver/egjs/statuses/25305a8b0ac966bef889924734f5f54b50faefea"}}}}