From b09b968f9616ca1ee15290946e50aa2f4b11e3fb Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 4 Dec 2013 13:43:04 +0100 Subject: [PATCH 01/56] Twitter search server has changed domain name (thanks mrvdb) --- plugins/TwitterBridge/lib/twitterimport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/TwitterBridge/lib/twitterimport.php b/plugins/TwitterBridge/lib/twitterimport.php index 2d481688aa..5cb2259b92 100644 --- a/plugins/TwitterBridge/lib/twitterimport.php +++ b/plugins/TwitterBridge/lib/twitterimport.php @@ -519,7 +519,7 @@ class TwitterImport static function tagLink($tag, $orig) { - return "{$orig}"; + return "{$orig}"; } static function atLink($screenName, $fullName, $orig) From 95222df899a9ec3be564170ac78833f249306d0c Mon Sep 17 00:00:00 2001 From: root Date: Tue, 31 Dec 2013 23:56:56 +0000 Subject: [PATCH 02/56] check local/plugins before plugins in Plugin::onAutoload --- lib/plugin.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugin.php b/lib/plugin.php index 605a4d12b5..5acdc1c2ba 100644 --- a/lib/plugin.php +++ b/lib/plugin.php @@ -99,7 +99,11 @@ class Plugin */ public function onAutoload($cls) { $cls = basename($cls); - $basedir = INSTALLDIR . '/plugins/' . mb_substr(get_called_class(), 0, -6); + $basedir = INSTALLDIR . '/local/plugins/' . mb_substr(get_called_class(), 0, -6); + if (!file_exists($basedir)) { + $basedir = INSTALLDIR . '/plugins/' . mb_substr(get_called_class(), 0, -6); + } + $file = null; if (preg_match('/^(\w+)(Action|Form)$/', $cls, $type)) { From b81d7c425d977ac8eacdf2675c1c0e64b3ecc19c Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 1 Jan 2014 19:43:31 +0100 Subject: [PATCH 03/56] better comment for PuSH <0.4 hack --- plugins/OStatus/classes/FeedSub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index 8418e37a49..2e62c512d1 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -279,7 +279,7 @@ class FeedSub extends Managed_DataObject $headers = array('Content-Type: application/x-www-form-urlencoded'); $post = array('hub.mode' => $mode, 'hub.callback' => $callback, - 'hub.verify' => 'async', // TODO: deprecated, remove when noone uses PuSH <0.4 + 'hub.verify' => 'async', // TODO: deprecated, remove when noone uses PuSH <0.4 (only 'async' method used there) 'hub.verify_token' => 'Deprecated-since-PuSH-0.4', // TODO: rm! 'hub.secret' => $this->secret, From df43684196b7156701e0a7df99de622d3f62ed7e Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 1 Jan 2014 19:44:02 +0100 Subject: [PATCH 04/56] apparently not only regex 'https?' urls are sent --- actions/apioauthrequesttoken.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/apioauthrequesttoken.php b/actions/apioauthrequesttoken.php index 083bbc3756..e961f4f464 100644 --- a/actions/apioauthrequesttoken.php +++ b/actions/apioauthrequesttoken.php @@ -146,7 +146,7 @@ class ApiOAuthRequestTokenAction extends ApiOAuthAction return true; } else { - return common_valid_http_url($callback); + return filter_var($callback, FILTER_VALIDATE_URL); } } } From 4ab56f34dd05ce351bcc91c0533d7597a00f3605 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 1 Jan 2014 20:09:11 +0100 Subject: [PATCH 05/56] Previous edit made translation notes incompatible --- actions/apitimelinementions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index ce6c73c0d1..c1811ac01b 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -119,8 +119,8 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction // TRANS: Subtitle for timeline of most recent mentions of a user. // TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname, // TRANS: %3$s is a user's full name. - _('%1$s updates that reply to updates from %2$s / %3$s.'), - $sitename, $this->target->getBestName(), $this->target->nickname + _('%1$s updates that reply to updates from %3$s / %2$s.'), + $sitename, $this->target->nickname, $this->target->getBestName() ); switch($this->format) { From 915d329b5a17ac9c4e582ff55672037072f73c32 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 1 Jan 2014 20:30:30 +0100 Subject: [PATCH 06/56] updating prepare and handle --- actions/shownotice.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/actions/shownotice.php b/actions/shownotice.php index 6a026d2d36..1f92978062 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -70,7 +70,7 @@ class ShownoticeAction extends Action * * @return success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); if ($this->boolean('ajax')) { @@ -117,16 +117,16 @@ class ShownoticeAction extends Action * * @return Notice */ - function getNotice() + protected function getNotice() { $id = $this->arg('notice'); $notice = Notice::getKV('id', $id); - if (empty($notice)) { + if (!$notice instanceof Notice) { // Did we used to have it, and it got deleted? $deleted = Deleted_notice::getKV($id); - if (!empty($deleted)) { + if ($deleted instanceof Deleted_notice) { // TRANS: Client error displayed trying to show a deleted notice. $this->clientError(_('Notice deleted.'), 410); } else { @@ -211,9 +211,9 @@ class ShownoticeAction extends Action * * @return void */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); if ($this->boolean('ajax')) { $this->showAjax(); From 9edde007b15dd1840df03cd3cb4fbf7ff400b3f0 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 1 Jan 2014 20:30:57 +0100 Subject: [PATCH 07/56] instanceof checks for better typing --- lib/apiaction.php | 2 +- lib/apignusocialoauthdatastore.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/apiaction.php b/lib/apiaction.php index d151f4c51f..dd4047125a 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -1466,7 +1466,7 @@ class ApiAction extends Action } else if ($this->arg('screen_name')) { $nickname = common_canonical_nickname($this->arg('screen_name')); $user = User::getKV('nickname', $nickname); - return $user ? $user->getProfile() : null; + return $user instanceof User ? $user->getProfile() : null; } else { // Fall back to trying the currently authenticated user return $this->scoped; diff --git a/lib/apignusocialoauthdatastore.php b/lib/apignusocialoauthdatastore.php index 7550ec5f6f..da412df8d2 100644 --- a/lib/apignusocialoauthdatastore.php +++ b/lib/apignusocialoauthdatastore.php @@ -30,7 +30,7 @@ class ApiGNUsocialOAuthDataStore extends OAuthDataStore { $con = Consumer::getKV('consumer_key', $consumerKey); - if (!$con) { + if (!$con instanceof Consumer) { // Create an anon consumer and anon application if one // doesn't exist already From 15c95dc4159656bfd7c1bb60b906c9359afccf74 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 12 Jan 2014 22:37:41 +0100 Subject: [PATCH 08/56] getByUri added to Notice for future use --- classes/Notice.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/Notice.php b/classes/Notice.php index f40a4c2111..83a8eaa3e8 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -216,6 +216,11 @@ class Notice extends Managed_DataObject return $this->url ?: $this->uri; } + public function getByUri($uri) + { + return Notice::getKV('uri', $uri); + } + /** * Extract #hashtags from this notice's content and save them to the database. */ From 08dba7e21d10c71d81f7781490566f62156230f4 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 12 Jan 2014 22:41:30 +0100 Subject: [PATCH 09/56] Notice::getByUri is of course static --- classes/Notice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 83a8eaa3e8..a1750dda4d 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -216,9 +216,9 @@ class Notice extends Managed_DataObject return $this->url ?: $this->uri; } - public function getByUri($uri) + public static function getByUri($uri) { - return Notice::getKV('uri', $uri); + return static::getKV('uri', $uri); } /** From edee39790e6b125e01049e82a54a765de492a85a Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 12 Jan 2014 22:46:50 +0100 Subject: [PATCH 10/56] Use exceptions for Notice::getByUri ..jeez, a long time since I commited. Three in a row to get this right. Sorry :) --- classes/Notice.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/Notice.php b/classes/Notice.php index a1750dda4d..6ed4b34afa 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -218,7 +218,12 @@ class Notice extends Managed_DataObject public static function getByUri($uri) { - return static::getKV('uri', $uri); + $notice = new Notice(); + $notice->uri = $uri; + if (!$notice->find(true)) { + throw new NoResultException($notice); + } + return $notice; } /** From 711f93889260ba35e5c5d2fe704fefa0320e58cf Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Sun, 26 Jan 2014 22:27:16 +0100 Subject: [PATCH 11/56] Fiw TwitterBridge after SSL enforcement (https://dev.twitter.com/discussions/24239) --- plugins/TwitterBridge/lib/twitteroauthclient.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/TwitterBridge/lib/twitteroauthclient.php b/plugins/TwitterBridge/lib/twitteroauthclient.php index 720844211a..f992a09079 100644 --- a/plugins/TwitterBridge/lib/twitteroauthclient.php +++ b/plugins/TwitterBridge/lib/twitteroauthclient.php @@ -310,7 +310,7 @@ class TwitterOAuthClient extends OAuthClient function statusesRetweet($id) { - $url = "http://api.twitter.com/1.1/statuses/retweet/$id.json"; + $url = "https://api.twitter.com/1.1/statuses/retweet/$id.json"; $response = $this->oAuthPost($url); $status = json_decode($response); return $status; @@ -326,7 +326,7 @@ class TwitterOAuthClient extends OAuthClient function favoritesCreate($id) { - $url = "http://api.twitter.com/1.1/favorites/create.json"; + $url = "https://api.twitter.com/1.1/favorites/create.json"; $params=array(); $params['id'] = $id; $response = $this->oAuthPost($url, $params); @@ -344,7 +344,7 @@ class TwitterOAuthClient extends OAuthClient function favoritesDestroy($id) { - $url = "http://api.twitter.com/1.1/favorites/destroy.json"; + $url = "https://api.twitter.com/1.1/favorites/destroy.json"; $params=array(); $params['id'] = $id; $response = $this->oAuthPost($url,$params); @@ -362,7 +362,7 @@ class TwitterOAuthClient extends OAuthClient function statusesDestroy($id) { - $url = "http://api.twitter.com/1.1/statuses/destroy/$id.json"; + $url = "https://api.twitter.com/1.1/statuses/destroy/$id.json"; $response = $this->oAuthPost($url); $status = json_decode($response); return $status; From a40b5996ebcd25bc284a1fb294ac74647bcafa97 Mon Sep 17 00:00:00 2001 From: Matt Lee Date: Fri, 7 Feb 2014 10:27:27 -0500 Subject: [PATCH 12/56] Updated logos --- theme/neo/logo.png | Bin 2837 -> 3617 bytes theme/neo/mobilelogo.png | Bin 990 -> 1309 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/theme/neo/logo.png b/theme/neo/logo.png index e4634b9e9c59f8b314008468e8c4906865f6c646..0b293847ee0849c1dfe2264afec6847baa0156aa 100644 GIT binary patch delta 3573 zcmWlbdpuMBAIDeU{Gvkc=2Bs-*yC*bykGCv^Yu#O&JlPGNtThsPMp8U$|L9_#bE&gF_-DX zH7(pH=yu_VHxK#G=q*yAR)SL9E^OvKIxeZsPMmNN)Q?I8bdyyM-Wl%bX>P=a@JLLI zcJVNPX#M(?FymtO%*aCcYR7a665hh4XU!Wzie6El)VRJ@<2E^-!En^k;CtNr9^5y& zfa$~ZACR$YO8r{`a5x;~cY2HwP>$FA&27CJK*}1aSnVIwa{F(m0mua--^>vsP4;vf# zc(a=raUi=LrnW+-=a>~wEiJw5>od8@dFgn67MrB1trD`*bg;D`#2yE`dly$wAO>ps zo_5>+aN7gdJ|n|gR#U@MRaG_MF3-!$`!p$uH6k){dVb#3v=aqGxx3>$QVsH>PFPu4 z15KDiHwfkHdxq7l6;uhip`eiViHD0z2m*1Y?rLdk zV@<8C_p_g;LLab$&fkmYkuEseTT7KWJUm>S@6D7~Rqd&&s;*Aa&2^lstgQUj(eWHK zVD%_cXLx2X_x_u#ER)MTQjj=!OJX~bSX)aev#(oR9j{Y8sjpYfiqO)ELS@_4__#db zV55&!#aB4?%H35_kyB2(ruO0NA_M|~Vf!CiSZrJGa!Xh@m6_cmM^>O;5`#-4hoV*Aq*{SKUf8(9c2mJu=Br?@eX_m0DNK+@hTd!9)qa+S?gG zQ&Uq--Xta_rv1a^^3t*L)RYvz`5rLnsYCfiP*7-SQWzpJF)`MpaCWTCNrs(+!_>wm zZeqfr=%?rQ-rnp&HnyW4vxUY+4i67s+Vuxsr4s#Ti>=mKW9W=D14F~)H*aFn)42sS z{-t{U)7sjKi;r(5sD!@G%IXvOtmN$Cl2cpz?vskL@(h&}h^FOd@G8Z@qeKnUQ5!Su zXnNI%-=FVXeVDt!OPnbwDd=i@d;7tO2^P>VQXuqYd^{#=FSTuI3VWmS%NJk=7^`d( zhlecz4O>P=cy3#jwWWv}N+`panVG-!^>z3*o;(LW#Er3YTtfz+%(-`%}@ZCF6Q)0(!W z!!vDORkrN$?L9e-Bocq_pk6^rycIn|Wc`ANWASjeQu82r{d!VMMm;o1Ng9ZW^5f&D| zc@uT`RykOFydg4k=(dCeL{U-kIitvB>;#o+^y<|ss&4@4{l||VaX7tFOLHVr;Bh$c zXQT4uM9;cXq4;v*hHphhMN1xkGvIs4u!Q-Sjg1;Qy1FTeiOdHF2mY*(nCyQK<0{w$ z1y5>Hq%<_Lakz8|o0f=8J3G7Vo3sR;p6>4MlAev(PFh}v8bmrsZtJJG)YlGW6@pg#HcXj}J6)i__o#GuA&gBKSUo94Pw@BgGNEjcZvvk(9Wtnch_ zeHEP}T)XQBB9TY~%h;X8)zyv(a=8EY;vjVXo)JMg?Wit4pW(J;NfSUoHa@=ZN)F2- zQUn~V@w;MFiq*WP!r`}=4Cm5?i- z*Xilc>A!0p50}_HhzUwgPS(@cf7Xlwf!?cybG!9t#lnR(5s0h8!or`QjLJT@C~(Zd z%elR)!b&FV!Cby`z6t`SL*IbIj41P%=iO@NChY)}LH6Ax^BsKjScQRn6F-1$Hz z3x<)eg^{zs4tmy`b;JSQbQ^`Iw4p)~dHEkp=j!U}+7RJRwl^5J?&@Te?$c8hP)URbvp1Js>c!w;>WRi4i$JUuPi1&W=Bjqjhl5 z|HtL?KtO2&VRgrM;!3QRqh$erx52@|qN1Xy-bR0H!Q$E)57jg#s8rL+iYHyl{w0NC zRwk*cD$v!{^;cU8mO`0YThq8h!8`T6SNhcuc~r!qG@Qxx7cJF9fF|?0(ZwbHV9CWN zEGnU^&J9=VLg-OOVseIv$3I3!E{~A|7g)^qwzt2Ax$Vzq`u=D6$<)f~#rAek{m!sm zPljIMkdT4`mqC8YprDd8K6=Bqy1JT?iOJC+54hfJq;|c9Jr#Z1@!n^$!Fw=Vp<{0n z+y9L>JVs<j&#WELZf;N@Q9F+K1q7U1tbKfZCK8rXRDl`Xb3eYpHl{}*!v0=0or;A0krKoG#s9vmK0etxp* z{SN;9u-F0)-v(wYdjeQ3p>S`tZcSD;J8~Dy#+IL#2cy@8uDNcX9&bH(UXqoSFNas2vwclRw3k?4$9)JAM$`_y{P8hcj zp(_T3x<%xP2!AXs%?DB|#UTH}Q!(Rra77;~dgZn>kOcKV2He{R2a^Fqw%UtVr3b;` zh8a>^5J9%V=IDzU>9+_QQh=zmo+k^Bw8Pvy*7vJyJ_%Tdp(xc+eI6EISVlrl1zfV8(~7|I5MLls3sbBm|6t|1x^702|d2qlKA2>nw58+5kO*=YpUOz z%_UqQWk`}!$O2v^RO;u*2nU;~nHl?9s5vF>+q`j`QoBxAN)QtvQ4iq4CSeRD6nT(ZJ!r83o3u2U zy^}n%;?bKLAXW4_D0FQ?M_c=!cbS>ffBwXJ3>7#YZqssI4Py}Y_KB61vR|vJGz*6` zr82a05U7cIOs>OaPahv$9UTUs+oE8+Q*?Ub=g%;)Sw|*TuWPFJFc>BA+qY#rD3A*m zF5JsE+o(VIn?rzHNVS_cahIDHgOum~{K+XRV+jcfK@?lya5z*8N=HYhsJQqUfgtGG p_ns+PukFHNso1!=YWrj?_MG4P`KZXMk|+>x>Fb!l%d}8Y{|9X<5G?=z delta 2785 zcmV<73Lf>L9F-Q3Bnkm@Qb$4nuFf3kks&aD+XxyH6FHl6Zp8oq3YAGjK~!ko?OJ=V z7G)iNo^$g+Ty$5HT}AOWpw@12F#!=|@Rq4)5~Plo5->;9oN{zBO>s(19jnnPvxK}s zUcj2tR8%nUA?_9^qFIvrIgGoCA*h^lp8nune9yMuIeNYiJ%60v%s1!z_PqPPzxVfl zKEKQJ+XechPx_=!`lL_#q|U;!i>@CIkTi?rNdQJ#|LTymhU8t6ZX>xy(f|N|CON(b z>-S5O=zVM5!vQ>y|CW?wm3WsD{q#u|kpz;Fq{&$&&Kxfg$*unb@Kjcb#}(E%PSU;k zIJ5U_vr2qHe!=kq0vG{c7RjjqhS_U>0(gw%1Cr*ET$d)1dU8mP7km-GPe~5cmWi85 zE|PQ`fYSiXB)OZl*QX?1NAgc;5^btBuj_{`0FIY*3V=fZw35u{cn-krl5Wo`@mq!a zUInn{C*4PyLEPmjx+H(p8`0+a;e`OMA=zvI)+ux3`WrCp4B+@0mJ@(B zD>}<$pdltI+4iD!9@79^R|2?Q0X#@@Y>ri1e_MBwdrG>;@q!t32c7GO+mW0Nz_rpt zrxayfBY-vlV@R$7&{}qnb+7C>?2jcUl5DXL&Wt(8^~1qsx)knLA+>FP9b;_RQZJ)9 zUeF?GuD!0kW+6(^WQCLJRugTJPIfIsSXz!S)A54c3RB!i(y_+;pUvz92Vi@Wzi_-@ zXEUb79#cGvYUiCxlch*2fTQfaNqUFmm6GlU&`xp}0OtW11z>zuiC=O3utCxc0R7Dd z+9XXNc^!a(mf`1;TxiXI-w5dgtF|~&QnM9UVGP?M>0AJpTh~JX?Upwl1K=mt+-(4U z3E+B?tp<4S16W_DL;tpAyIkRaNxBHY3Zv5$NoSL6mvll_i4%K{4^C|yL~?4Gqmpcr z^ze4`+h4CZF zX%c0oIP3uMS|RoLIVdbynBy`SKbQZ`D)A$(A5J0pgrptKTn!`-bp3EhnnY^~=e@SzG?26| ztHf)%Os~0;g}?hcUSP9VWR-Yx4!AC)vB-=iHCCyO2w(z#06%x(LTCqoeOy1B(A9c& z#K?`bt?D^R?M1MVJj3W8iy|i`1##cysuw>p#N_1;8&N&!BP$)%~ z*nqS2ei^_$g>`*Ndv#}j^S!G5?MSy7z}u2`Fi0hU;Uu4Ryr2QVasdAUa6f>BStVXy zrvn@eV5%{HWFBSTmeg({F93XA(jfpI?8Y}3B}P8ZR0Ka&<|f!A@o;NlYSO45*mBliO^pjO@Onr;(-#UxL+3`zivW^9ek1pSs}jzzyiYx&#;VtGtuz^C#%HSXN@?LcLTUlQa@uG zn$opFQY*<(l12eIRnkV+59a{5HBF+;bp~FUZe86nKvJXSECTRl^QktstgJN%z>vDJ z*Q^qMNb(vr$p_*R-kkCS{TXPXw&I;ywy>9R_EGs%enR^;VKp*^sbkeS~%^@0e^ zLUbg6^^#VT?Dk`bO|6-&Q+myf`7(g%0H(WtemK>1ruPT1KgqpqzAmZ1Apv*yFg<*e zjD6meTrw)WhzUPXc>T!t{)C1IYH8XBu7gc17HUeMe?3n zgX0C`vP%49jVZDg*+8eF5a4+azge z8Nf`f_|`TcAFD`ySSSS!cKxuS8rgBYpe3usA8u37IbLu$$+k3!mXs*{w|aS`;{_v3 z6WK0Q*~OeWKrVyzQa}&oC2V<6pGWO~M#l>-%qsDf1~4NeonNS9I{+*z?BOH;E3!(w zs$`8-0E*7jnty4T*R~eGq))jdSnv8_Z2F%0zVxYl0Ni=_(fX?;9 zuK<`2pughyQ?d<{N&!1_=Y$UnNI*_>lE+VaSI{|LFap3sk_H-MA4>Aj zGQF+u>q$P+gD5u;z@a&jG2v~0Bgtiw+6ruICjbZ9z?5`inP+|ikN=tD1wWMJS}e1l z&5n!DBuQS9ry$o4uK@4^!?rz=Cj&US3LDIUyDm+l6}^A}EpWWx`y@wN0i>DaBuSGB z4d`6|CIDBte)xWxL^sq8bR-wUJS#04u7qai7Zw&C{d`=RVAV`Ho|dM6N%YkcfbKvt zL+3XjPImq9idyiR*T>wje3-b>HaI7_^x!@R00JiIfBt36hF!KuFfc3i2GbVz4$C~?T zNpncPQ2?p^Xi3%^80$!$W?DeCFzKd3ByFrhLRiv+Yb->&HzXYe;J&iAb*yXo0)GW? zOqxW$uA*Oa31C~hjdW=eEp@!$Y14a}31BRMT?(H6BFV*)eoOLywJwaboaC`N&;T@% z%t=TC$pz*G!aSU`OM0RTINBXAI1|7Z(D@~T7p?CPW6J~bHZxy`Aq(B5n%MQjGbMe` zr2D;0I)4(tY5;4}B-&WGXM^Jfw*a_T(s2N$k(_9nz&0CN4&V-wze|&-Rwnwcu}@z5 zGy-@bZ=RPp>GLE^H<@#5Ai1(+@BcR4h&=$D0AQk|eMs(3^1qUnOZq#>g_5GI5^v~2 nzX#FzeZj`U`SeMje75pG?ynYRy;8WU00000NkvXXu0mjfh<+jd diff --git a/theme/neo/mobilelogo.png b/theme/neo/mobilelogo.png index cd2e0e7f16d24e832186cf3310dc77c774b29b87..7645fae265e4dd38f0e59c21771e41ee197ba67d 100644 GIT binary patch delta 1247 zcmV<51R(p~2b~I#B#|*Kf8GKI4;v3LA}tUA00gQ@L_t(Y$L*J0NK{)C$N&4xI5VO{ z&VZ6R84Q$JJy?_x5fp@3^d$^bpncI}R4CG;5Rs(4LS z%s@&XR#Y}MM8`b8`_P@!o%9x5h}(s`;BfZYYn`)y>wnhX`y2zHfB&di`VZUx@c$Zo zI-OQ?bF*g5n4!wbN}WA>R*vJi0X;oEs;;h9b#=9RdwcaOrwAa&aolsZJz327__(xp z?_P?Einx9IHm_g5rlX^SqeqW2GBQFu9_RGw(+m#}bLPw$EX$(5zn|a19LGW7aG2e@ zcLNZQ$B~32ii(Qde|C3wHvn_z&ZVcPhu_7#!C+7W0|PpF@}&0c+2g*R(a}-2y?y(3 zrPFDpQmJ27GRb68=gytetXZ?PWy_Wy#gs+PTUc25l_`_S(9+UEK|#T!!1?+41cN~e3JQ4ef8fDyQ7$e#z@tZx2m}I? z!UqBY4j(>DS67!iQ4)y+O-)Udm6fr6{d$tgr2F8{pFh*y-cChD1@q_6=fsH?g4QB{(UxV*ucSq2LX8h{ymM2jZ{`vvUKTEu3x_n!1(z1 zH=(ny?9{1Kf3&r=O`1S$ZLK?aOG^uD)~unbs)|@F=Bn`WVQRpjUABZ-cV4z66ef+SY0T7_-f?%10)ZDQ)wsTgDE?CfM{ zXy}{JSv3JZefmUMS=j{m*49=RzNV&zNF?H3+qO+-e`hC8pFU;v>eU!yICA8O>)*L^ zC&n1|@83^dT^$~ehx6ypyMD{Eki^ZKH(mIlp&_@&0QwY9a}y?fUc zZ{NOsw6(QiSr(RMkxHdCJwxOYc`uch0+_`gyH*enL^oK$rLZJ{NBO?IZxN!ro*GnuGV{mW~zu!+N6e5*Mkw_%) zfBAe!B9qCuiB6j~jaRQ;(b(9CBo-}NL~m~|l32HH9b30rPFCeA`z98Rg_Hd4-O9M%a<>jGiT1E_xJbrtF*LK#l^*v zq_MFvefaP}d3kvX27{8MzP>({mzOIX4oi}rJb9u}DCB-w{sEsHj&Went`-0Q002ov JPDHLkV1hqMf{p+H delta 924 zcmV;N17rN13f>2hBnkm@Qb$4nuFf3kks&aD+XW2}I34B~VzU4M171l)K~zY`&6Yoi zTvZgtf8XqEjA9ht6#AxEEi6po3`Emt5sQ=t6EQX$+z^e57(r|dg3TH%lr(~cC?*=x zBqX4S@h>X)2f>VQFhL}R7@Wby8A7tMNOtpC?7hp~$D3xeaXs+3ckbMK&Uemt?zu;Q zB$DMV0e1pVNZJnE9{;lq@TH_vwhu{~8T1OX0?G2$UBIi7Hh59-xTKS|j{v)Yy^m-k8Mke`~L(E40^@uD*@kVw(qlj3b-+F1=_U00{dzRA1_CndHq{kc0_HAV=gI;lN1oc-&0S^Y}869>cb!>l9q4%W< zZ1W_kQlya&;||*oW_jx}a7NO9&$d61baK!uuCU5t`|nWQ%IgcvA!!mgAn9XZn9v$)axKe$TlZE`U;e_Q zv+CgMRf~gOaUM8YdeYyQv@Oj=+Z%yz!_u7Xuc|=WzFyK_*A#q~wR(wr?dRSGR}XHCI>H=6COz;hKKM_sbmU9NqpwEey9eUko2TVN+IMqnh)XC&>G z^yyVLlJyd^V Date: Sun, 23 Feb 2014 14:47:41 +0100 Subject: [PATCH 13/56] slightly less confusing inline if --- lib/mail.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/mail.php b/lib/mail.php index 9ba4b0311c..d967cfd796 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -50,9 +50,7 @@ function mail_backend() if (!$backend) { $backend = Mail::factory(common_config('mail', 'backend'), - (common_config('mail', 'params')) ? - common_config('mail', 'params') : - array()); + common_config('mail', 'params') ?: array()); if (PEAR::isError($backend)) { common_server_error($backend->getMessage(), 500); } From 5487c596fcdc4dd237171e185fa3b6ae8ccd9338 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 23 Feb 2014 14:57:12 +0100 Subject: [PATCH 14/56] Remove callback sneakery by StatusNet --- CONFIGURE | 26 ---- actions/snapshotadminpanel.php | 255 --------------------------------- lib/adminpanelnav.php | 8 -- lib/default.php | 4 - lib/router.php | 1 - lib/snapshot.php | 213 --------------------------- scripts/reportsnapshot.php | 30 ---- 7 files changed, 537 deletions(-) delete mode 100644 actions/snapshotadminpanel.php delete mode 100644 lib/snapshot.php delete mode 100644 scripts/reportsnapshot.php diff --git a/CONFIGURE b/CONFIGURE index d41f64b44f..c4a43a3dc8 100644 --- a/CONFIGURE +++ b/CONFIGURE @@ -532,32 +532,6 @@ welcome: nickname of a user account that sends welcome messages to new If either of these special user accounts are specified, the users should be created before the configuration is updated. -snapshot --------- - -The software will, by default, send statistical snapshots about the -local installation to a stats server on the status.net Web site. This -data is used by the developers to prioritize development decisions. No -identifying data about users or organizations is collected. The data -is available to the public for review. Participating in this survey -helps StatusNet developers take your needs into account when updating -the software. - -run: string indicating when to run the statistics. Values can be 'web' - (run occasionally at Web time), 'cron' (run from a cron script), - or 'never' (don't ever run). If you set it to 'cron', remember to - schedule the script to run on a regular basis. -frequency: if run value is 'web', how often to report statistics. - Measured in Web hits; depends on how active your site is. - Default is 10000 -- that is, one report every 10000 Web hits, - on average. -reporturl: URL to post statistics to. Defaults to StatusNet developers' - report system, but if they go evil or disappear you may - need to update this to another value. Note: if you - don't want to report stats, it's much better to - set 'run' to 'never' than to set this value to something - nonsensical. - attachments ----------- diff --git a/actions/snapshotadminpanel.php b/actions/snapshotadminpanel.php deleted file mode 100644 index 214b3d648b..0000000000 --- a/actions/snapshotadminpanel.php +++ /dev/null @@ -1,255 +0,0 @@ -. - * - * @category Settings - * @package StatusNet - * @author Zach Copley - * @copyright 2010 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET')) { - exit(1); -} - -/** - * Manage snapshots - * - * @category Admin - * @package StatusNet - * @author Zach Copley - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ -class SnapshotadminpanelAction extends AdminPanelAction -{ - /** - * Returns the page title - * - * @return string page title - */ - function title() - { - // TRANS: Title for admin panel to configure snapshots. - return _m('TITLE','Snapshots'); - } - - /** - * Instructions for using this form. - * - * @return string instructions - */ - function getInstructions() - { - // TRANS: Instructions for admin panel to configure snapshots. - return _('Manage snapshot configuration'); - } - - /** - * Show the snapshots admin panel form - * - * @return void - */ - function showForm() - { - $form = new SnapshotAdminPanelForm($this); - $form->show(); - return; - } - - /** - * Save settings from the form - * - * @return void - */ - function saveSettings() - { - static $settings = array( - 'snapshot' => array('run', 'reporturl', 'frequency') - ); - - $values = array(); - - foreach ($settings as $section => $parts) { - foreach ($parts as $setting) { - $values[$section][$setting] = $this->trimmed($setting); - } - } - - // This throws an exception on validation errors - - $this->validate($values); - - // assert(all values are valid); - - $config = new Config(); - - $config->query('BEGIN'); - - foreach ($settings as $section => $parts) { - foreach ($parts as $setting) { - Config::save($section, $setting, $values[$section][$setting]); - } - } - - $config->query('COMMIT'); - - return; - } - - function validate(&$values) - { - // Validate snapshot run value - - if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) { - // TRANS: Client error displayed on admin panel for snapshots when providing an invalid run value. - $this->clientError(_('Invalid snapshot run value.')); - } - - // Validate snapshot frequency value - - if (!Validate::number($values['snapshot']['frequency'])) { - // TRANS: Client error displayed on admin panel for snapshots when providing an invalid value for frequency. - $this->clientError(_('Snapshot frequency must be a number.')); - } - - // Validate report URL - - if (!is_null($values['snapshot']['reporturl']) - && !common_valid_http_url($values['snapshot']['reporturl'])) { - // TRANS: Client error displayed on admin panel for snapshots when providing an invalid report URL. - $this->clientError(_('Invalid snapshot report URL.')); - } - } -} - -// @todo FIXME: add documentation -class SnapshotAdminPanelForm extends AdminForm -{ - /** - * ID of the form - * - * @return int ID of the form - */ - function id() - { - return 'form_snapshot_admin_panel'; - } - - /** - * class of the form - * - * @return string class of the form - */ - function formClass() - { - return 'form_settings'; - } - - /** - * Action of the form - * - * @return string URL of the action - */ - function action() - { - return common_local_url('snapshotadminpanel'); - } - - /** - * Data elements of the form - * - * @return void - */ - function formData() - { - $this->out->elementStart( - 'fieldset', - array('id' => 'settings_admin_snapshots') - ); - // TRANS: Fieldset legend on admin panel for snapshots. - $this->out->element('legend', null, _m('LEGEND','Snapshots')); - $this->out->elementStart('ul', 'form_data'); - $this->li(); - $snapshot = array( - // TRANS: Option in dropdown for snapshot method in admin panel for snapshots. - 'web' => _('Randomly during web hit'), - // TRANS: Option in dropdown for snapshot method in admin panel for snapshots. - 'cron' => _('In a scheduled job'), - // TRANS: Option in dropdown for snapshot method in admin panel for snapshots. - 'never' => _('Never') - ); - $this->out->dropdown( - 'run', - // TRANS: Dropdown label for snapshot method in admin panel for snapshots. - _('Data snapshots'), - $snapshot, - // TRANS: Dropdown title for snapshot method in admin panel for snapshots. - _('When to send statistical data to status.net servers.'), - false, - $this->value('run', 'snapshot') - ); - $this->unli(); - - $this->li(); - $this->input( - 'frequency', - // TRANS: Input field label for snapshot frequency in admin panel for snapshots. - _('Frequency'), - // TRANS: Input field title for snapshot frequency in admin panel for snapshots. - _('Snapshots will be sent once every N web hits.'), - 'snapshot' - ); - $this->unli(); - - $this->li(); - $this->input( - 'reporturl', - // TRANS: Input field label for snapshot report URL in admin panel for snapshots. - _('Report URL'), - // TRANS: Input field title for snapshot report URL in admin panel for snapshots. - _('Snapshots will be sent to this URL.'), - 'snapshot' - ); - $this->unli(); - $this->out->elementEnd('ul'); - $this->out->elementEnd('fieldset'); - } - - /** - * Action elements - * - * @return void - */ - function formActions() - { - $this->out->submit( - 'submit', - // TRANS: Button text to save snapshot settings. - _m('BUTTON','Save'), - 'submit', - null, - // TRANS: Button title to save snapshot settings. - _('Save snapshot settings.') - ); - } -} diff --git a/lib/adminpanelnav.php b/lib/adminpanelnav.php index 40c4889f27..93a4d36ebb 100644 --- a/lib/adminpanelnav.php +++ b/lib/adminpanelnav.php @@ -134,14 +134,6 @@ class AdminPanelNav extends Menu $menu_title, $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel'); } - if (AdminPanelAction::canAdmin('snapshot')) { - // TRANS: Menu item title in administrator navigation panel. - $menu_title = _('Snapshots configuration'); - // TRANS: Menu item in administrator navigation panel. - $this->out->menuItem(common_local_url('snapshotadminpanel'), _m('MENU','Snapshots'), - $menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel'); - } - if (AdminPanelAction::canAdmin('license')) { // TRANS: Menu item title in administrator navigation panel. $menu_title = _('Set site license'); diff --git a/lib/default.php b/lib/default.php index 6a04b32ddd..65a74d0959 100644 --- a/lib/default.php +++ b/lib/default.php @@ -207,10 +207,6 @@ $default = 'newuser' => array('default' => null, 'welcome' => null), - 'snapshot' => - array('run' => 'web', - 'frequency' => 10000, - 'reporturl' => 'http://status.net/stats/report'), 'attachments' => array('server' => null, 'dir' => INSTALLDIR . '/file/', diff --git a/lib/router.php b/lib/router.php index c8277859de..ad49c8c144 100644 --- a/lib/router.php +++ b/lib/router.php @@ -847,7 +847,6 @@ class Router $m->connect('panel/paths', array('action' => 'pathsadminpanel')); $m->connect('panel/sessions', array('action' => 'sessionsadminpanel')); $m->connect('panel/sitenotice', array('action' => 'sitenoticeadminpanel')); - $m->connect('panel/snapshot', array('action' => 'snapshotadminpanel')); $m->connect('panel/license', array('action' => 'licenseadminpanel')); $m->connect('panel/plugins', array('action' => 'pluginsadminpanel')); diff --git a/lib/snapshot.php b/lib/snapshot.php deleted file mode 100644 index f41efba7d7..0000000000 --- a/lib/snapshot.php +++ /dev/null @@ -1,213 +0,0 @@ -. - * - * @category Stats - * @package StatusNet - * @author Evan Prodromou - * @copyright 2009 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -/** - * A snapshot of site stats that can report itself to headquarters - * - * This class will collect statistics on the site and report them to - * a statistics server of the admin's choice. (Default is the big one - * at status.net.) - * - * It can either be called from a cron job, or run occasionally by the - * Web site. - * - * @category Stats - * @package StatusNet - * @author Evan Prodromou - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - */ - -class Snapshot -{ - var $stats = null; - - /** - * Constructor for a snapshot - */ - - function __construct() - { - } - - /** - * Static function for reporting statistics - * - * This function checks whether it should report statistics, based on - * the current configuation settings. If it should, it creates a new - * Snapshot object, takes a snapshot, and reports it to headquarters. - * - * @return void - */ - - static function check() - { - switch (common_config('snapshot', 'run')) { - case 'web': - // skip if we're not running on the Web. - if (!isset($_SERVER) || !array_key_exists('REQUEST_METHOD', $_SERVER)) { - break; - } - // Run once every frequency hits - // XXX: do frequency by time (once a week, etc.) rather than - // hits - if (rand() % common_config('snapshot', 'frequency') == 0) { - $snapshot = new Snapshot(); - $snapshot->take(); - $snapshot->report(); - } - break; - case 'cron': - // skip if we're running on the Web - if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { - break; - } - common_log(LOG_INFO, 'Running snapshot from cron job'); - // We're running from the command line; assume - - $snapshot = new Snapshot(); - $snapshot->take(); - common_log(LOG_INFO, count($snapshot->stats) . " statistics being uploaded."); - $snapshot->report(); - - break; - case 'never': - break; - default: - common_log(LOG_WARNING, "Unrecognized value for snapshot run config."); - } - } - - /** - * Take a snapshot of the server - * - * Builds an array of statistical and configuration data based - * on the local database and config files. We avoid grabbing any - * information that could be personal or private. - * - * @return void - */ - - function take() - { - $this->stats = array(); - - // Some basic identification stuff - - $this->stats['version'] = GNUSOCIAL_VERSION; - $this->stats['phpversion'] = phpversion(); - $this->stats['name'] = common_config('site', 'name'); - $this->stats['root'] = common_root_url(); - - // non-identifying stats on various tables. Primary - // interest is size and rate of activity of service. - - $tables = array('user', - 'notice', - 'subscription', - 'user_group'); - - foreach ($tables as $table) { - $this->tableStats($table); - } - - // stats on some important config options - - $this->stats['theme'] = common_config('site', 'theme'); - $this->stats['dbtype'] = common_config('db', 'type'); - $this->stats['xmpp'] = common_config('xmpp', 'enabled'); - $this->stats['inboxes'] = common_config('inboxes', 'enabled'); - $this->stats['queue'] = common_config('queue', 'enabled'); - $this->stats['license'] = common_config('license', 'url'); - $this->stats['fancy'] = common_config('site', 'fancy'); - $this->stats['private'] = common_config('site', 'private'); - $this->stats['closed'] = common_config('site', 'closed'); - $this->stats['memcached'] = common_config('memcached', 'enabled'); - $this->stats['language'] = common_config('site', 'language'); - $this->stats['timezone'] = common_config('site', 'timezone'); - - } - - /** - * Reports statistics to headquarters - * - * Posts statistics to a reporting server. - * - * @return void - */ - - function report() - { - // XXX: Use OICU2 and OAuth to make authorized requests - - $reporturl = common_config('snapshot', 'reporturl'); - try { - $request = HTTPClient::start(); - $request->post($reporturl, null, $this->stats); - } catch (Exception $e) { - common_log(LOG_WARNING, "Error in snapshot: " . $e->getMessage()); - } - } - - /** - * Updates statistics for a single table - * - * Determines the size of a table and its oldest and newest rows. - * Goal here is to see how active a site is. Note that it - * fills up the instance stats variable. - * - * @param string $table name of table to check - * - * @return void - */ - - function tableStats($table) - { - $inst = DB_DataObject::factory($table); - - $inst->selectAdd(); - $inst->selectAdd('count(*) as cnt, '. - 'min(created) as first, '. - 'max(created) as last'); - - if ($inst->find(true)) { - $this->stats[$table.'count'] = $inst->cnt; - $this->stats[$table.'first'] = $inst->first; - $this->stats[$table.'last'] = $inst->last; - } - - $inst->free(); - unset($inst); - } -} diff --git a/scripts/reportsnapshot.php b/scripts/reportsnapshot.php deleted file mode 100644 index 71f1019ee6..0000000000 --- a/scripts/reportsnapshot.php +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env php -. - */ - -define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); - -$helptext = << Date: Sun, 23 Feb 2014 15:01:23 +0100 Subject: [PATCH 15/56] Snapshot call was left behind --- index.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.php b/index.php index 2b27845e59..82be959455 100644 --- a/index.php +++ b/index.php @@ -242,8 +242,6 @@ function main() } global $user, $action; - Snapshot::check(); - if (!_have_config()) { $msg = sprintf( // TRANS: Error message displayed when there is no StatusNet configuration file. From 834ecd0f80209a44935f730d81466810cdc3c779 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 23 Feb 2014 20:12:01 +0100 Subject: [PATCH 16/56] Autocomplete now matches remote profiles as well. --- plugins/Autocomplete/actions/autocomplete.php | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/plugins/Autocomplete/actions/autocomplete.php b/plugins/Autocomplete/actions/autocomplete.php index 787ef15326..fce0014573 100644 --- a/plugins/Autocomplete/actions/autocomplete.php +++ b/plugins/Autocomplete/actions/autocomplete.php @@ -2,7 +2,7 @@ /** * StatusNet, the distributed open-source microblogging tool * - * List users for autocompletion + * List profiles and groups for autocompletion * * PHP version 5 * @@ -29,7 +29,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } @@ -62,8 +62,8 @@ class AutocompleteAction extends Action function lastModified() { $max=0; - foreach($this->users as $user){ - $max = max($max,strtotime($user->modified),strtotime($user->getProfile()->modified)); + foreach($this->profiles as $profile){ + $max = max($max,strtotime($user->modified),strtotime($profile->modified)); } foreach($this->groups as $group){ $max = max($max,strtotime($group->modified)); @@ -103,19 +103,22 @@ class AutocompleteAction extends Action } $this->groups=array(); - $this->users=array(); + $this->profiles=array(); $term = $this->arg('term'); $limit = $this->arg('limit'); if($limit > 200) $limit=200; //prevent DOS attacks if(substr($term,0,1)=='@'){ - //user search + //profile search $term=substr($term,1); - $user = new User(); - $user->limit($limit); - $user->whereAdd('nickname like \'' . trim($user->escape($term), '\'') . '%\''); - if($user->find()){ - while($user->fetch()) { - $this->users[]=clone($user); + $profile = new Profile(); + $profile->limit($limit); + $profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\''); + $profile->whereAdd(sprintf('id in (SELECT id FROM user) OR ' + . 'id in (SELECT subscribed from subscription' + . ' where subscriber = %d)', $cur->id)); + if ($profile->find()) { + while($profile->fetch()) { + $this->profiles[]=clone($profile); } } } @@ -139,8 +142,7 @@ class AutocompleteAction extends Action parent::handle(); $results = array(); - foreach($this->users as $user){ - $profile = $user->getProfile(); + foreach($this->profiles as $profile){ $avatarUrl = $profile->avatarUrl(AVATAR_MINI_SIZE); $results[] = array( 'value' => '@'.$profile->nickname, From 47fbe165628858532476345237fa5b67513119ba Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 23 Feb 2014 21:05:34 +0100 Subject: [PATCH 17/56] stricter typing --- lib/attachmentlist.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 1d5be73714..c0c45a1dbb 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -28,7 +28,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } @@ -67,12 +67,12 @@ class AttachmentList extends Widget } /** - * show the list of notices + * show the list of attachments * * "Uses up" the stream by looping through it. So, probably can't * be called twice on the same list. * - * @return int count of notices listed. + * @return int count of items listed. */ function show() { @@ -101,16 +101,13 @@ class AttachmentList extends Widget } /** - * returns a new list item for the current notice + * returns a new list item for the current attachment * - * Recipe (factory?) method; overridden by sub-classes to give - * a different list item class. + * @param File $attachment the current attachment * - * @param Notice $notice the current notice - * - * @return NoticeListItem a list item for displaying the notice + * @return AttachmentListItem a list item for displaying the attachment */ - function newListItem($attachment) + function newListItem(File $attachment) { return new AttachmentListItem($attachment, $this->out); } @@ -142,13 +139,9 @@ class AttachmentListItem extends Widget var $oembed = null; /** - * constructor - * - * Also initializes the profile attribute. - * - * @param Notice $notice The notice we'll display + * @param File $attachment the attachment we will display */ - function __construct($attachment, $out=null) + function __construct(File $attachment, $out=null) { parent::__construct($out); $this->attachment = $attachment; From 63102950b2e7f65667d8b342420eb5af06500744 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 23 Feb 2014 21:28:52 +0100 Subject: [PATCH 18/56] Compare to profile id of group, for backward compatibility --- actions/editgroup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/editgroup.php b/actions/editgroup.php index 1f77880684..ee1f5b86ff 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -177,7 +177,7 @@ class EditgroupAction extends GroupAction $nickname = Nickname::normalize($nickname, true); } catch (NicknameTakenException $e) { // Abort only if the nickname is occupied by _another_ group - if ($e->profile->id != $this->group->id) { + if ($e->profile->id != $this->group->profile_id) { $this->showForm($e->getMessage()); return; } From 698a7adb834ad2ef4db05ee9717dd860c3979fe5 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 23 Feb 2014 21:49:55 +0100 Subject: [PATCH 19/56] mentions from OStatus lookup were missing a 'type' attribute in common_linkify_mention --- plugins/OStatus/OStatusPlugin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index c6c413873e..75d4fb74bc 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -332,7 +332,7 @@ class OStatusPlugin extends Plugin * Find any explicit remote mentions. Accepted forms: * Webfinger: @user@example.com * Profile link: @example.com/mublog/user - * @param Profile $sender (os user?) + * @param Profile $sender * @param string $text input markup text * @param array &$mention in/out param: set of found mentions * @return boolean hook return value @@ -354,6 +354,7 @@ class OStatusPlugin extends Plugin if ($oprofile && !$oprofile->isGroup()) { $profile = $oprofile->localProfile(); $matches[$pos] = array('mentioned' => array($profile), + 'type' => 'mention', 'text' => $target, 'position' => $pos, 'url' => $profile->profileurl); @@ -380,6 +381,7 @@ class OStatusPlugin extends Plugin if ($oprofile && !$oprofile->isGroup()) { $profile = $oprofile->localProfile(); $matches[$pos] = array('mentioned' => array($profile), + 'type' => 'mention', 'text' => $target, 'position' => $pos, 'url' => $profile->profileurl); From 703aa302b68163d6f06c2a972b937d34c8379e38 Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Sun, 26 Jan 2014 23:53:44 +0100 Subject: [PATCH 20/56] Add 'profile_image_url_https' to enhance compatiblity with Twitter clients since they now need https URLs instead of plain http --- lib/apiaction.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/apiaction.php b/lib/apiaction.php index dd4047125a..f8ffbc84a5 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -215,6 +215,8 @@ class ApiAction extends Action // TODO: avatar url template (example.com/user/avatar?size={x}x{y}) $twitter_user['profile_image_url'] = Avatar::urlByProfile($profile, AVATAR_STREAM_SIZE); + $twitter_user['profile_image_url_https'] = $twitter_user['profile_image_url']; + // START introduced by qvitter API, not necessary for StatusNet API $twitter_user['profile_image_url_profile_size'] = Avatar::urlByProfile($profile, AVATAR_PROFILE_SIZE); try { From 28081e9115891f4a148b813dbe162eae067c9cb6 Mon Sep 17 00:00:00 2001 From: Jean Baptiste Favre Date: Sun, 26 Jan 2014 23:57:27 +0100 Subject: [PATCH 21/56] Add various entry points to enhance compatibility with Twitter client like Twidere --- lib/router.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/router.php b/lib/router.php index ad49c8c144..23ebe00d6b 100644 --- a/lib/router.php +++ b/lib/router.php @@ -397,6 +397,15 @@ class Router $m->connect('api/statuses/replies.:format', array('action' => 'ApiTimelineMentions', 'format' => '(xml|json|rss|atom|as)')); + + $m->connect('api/statuses/mentions_timeline/:id.:format', + array('action' => 'ApiTimelineMentions', + 'id' => Nickname::INPUT_FMT, + 'format' => '(xml|json|rss|atom|as)')); + + $m->connect('api/statuses/mentions_timeline.:format', + array('action' => 'ApiTimelineMentions', + 'format' => '(xml|json|rss|atom|as)')); $m->connect('api/statuses/retweeted_by_me.:format', array('action' => 'ApiTimelineRetweetedByMe', @@ -604,6 +613,18 @@ class Router // favorites + $m->connect('api/favorites/create.:format', + array('action' => 'ApiFavoriteCreate', + 'format' => '(xml|json)')); + + $m->connect('api/favorites/destroy.:format', + array('action' => 'ApiFavoriteDestroy', + 'format' => '(xml|json)')); + + $m->connect('api/favorites/list.:format', + array('action' => 'ApiTimelineFavorites', + 'format' => '(xml|json|rss|atom|as)')); + $m->connect('api/favorites/:id.:format', array('action' => 'ApiTimelineFavorites', 'id' => Nickname::INPUT_FMT, @@ -622,6 +643,7 @@ class Router array('action' => 'ApiFavoriteDestroy', 'id' => '[0-9]+', 'format' => '(xml|json)')); + // blocks $m->connect('api/blocks/create/:id.:format', @@ -747,6 +769,9 @@ class Router 'format' => '(xml|json|rss|atom|as)')); // Lists (people tags) + $m->connect('api/lists/list.:format', + array('action' => 'ApiListSubscriptions', + 'format' => '(xml|json)')); $m->connect('api/lists/memberships.:format', array('action' => 'ApiListMemberships', @@ -824,6 +849,10 @@ class Router 'api/statusnet/media/upload', array('action' => 'ApiMediaUpload') ); + $m->connect( + 'api/statuses/update_with_media.json', + array('action' => 'ApiMediaUpload') + ); // search $m->connect('api/search.atom', array('action' => 'ApiSearchAtom')); @@ -843,7 +872,7 @@ class Router $m->connect('panel/site', array('action' => 'siteadminpanel')); $m->connect('panel/user', array('action' => 'useradminpanel')); - $m->connect('panel/access', array('action' => 'accessadminpanel')); + $m->connect('panel/access', array('action' => 'accessadminpanel')); $m->connect('panel/paths', array('action' => 'pathsadminpanel')); $m->connect('panel/sessions', array('action' => 'sessionsadminpanel')); $m->connect('panel/sitenotice', array('action' => 'sitenoticeadminpanel')); From 398491b39b2105fa5bb443a9cf679f3e62234620 Mon Sep 17 00:00:00 2001 From: GNU Social instance Date: Mon, 24 Feb 2014 00:31:37 +0100 Subject: [PATCH 22/56] Remove util.min.js (minifying is EVIL) --- js/Makefile | 4 ---- js/util.min.js | 1 - lib/action.php | 11 ++++------- 3 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 js/util.min.js diff --git a/js/Makefile b/js/Makefile index 33757d11f8..57ac5ecb36 100644 --- a/js/Makefile +++ b/js/Makefile @@ -1,16 +1,12 @@ .fake: all clean TARGETS=util.min.js extlib/json2.min.js extlib/jquery.cookie.min.js -UTIL_SOURCES=util.js xbImportNode.js geometa.js all: $(TARGETS) clean: rm -f $(TARGETS) -util.min.js: $(UTIL_SOURCES) - cat $+ | yui-compressor --type js > $@ - extlib/json2.min.js: extlib/json2.js yui-compressor $+ > $@ diff --git a/js/util.min.js b/js/util.min.js deleted file mode 100644 index d9633807f9..0000000000 --- a/js/util.min.js +++ /dev/null @@ -1 +0,0 @@ -var SN={C:{I:{CounterBlackout:false,MaxLength:140,PatternUsername:/^[0-9a-zA-Z\-_.]*$/,HTTP20x30x:[200,201,202,203,204,205,206,300,301,302,303,304,305,306,307],NoticeFormMaster:null},S:{Disabled:"disabled",Warning:"warning",Error:"error",Success:"success",Processing:"processing",CommandResult:"command_result",FormNotice:"form_notice",NoticeDataGeo:"notice_data-geo",NoticeDataGeoCookie:"NoticeDataGeo",NoticeDataGeoSelected:"notice_data-geo_selected",StatusNetInstance:"StatusNetInstance"}},messages:{},msg:function(a){if(SN.messages[a]===undefined){return"["+a+"]"}return SN.messages[a]},U:{FormNoticeEnhancements:function(d){if(jQuery.data(d[0],"ElementData")===undefined){var a=d.find(".count").text();if(a===undefined){a=SN.C.I.MaxLength}jQuery.data(d[0],"ElementData",{MaxLength:a});SN.U.Counter(d);var c=d.find(".notice_data-text:first");c.on("keyup",function(f){SN.U.Counter(d)});var b=function(f){window.setTimeout(function(){SN.U.Counter(d)},50)};c.on("cut",b).on("paste",b)}else{d.find(".count").text(jQuery.data(d[0],"ElementData").MaxLength)}},Counter:function(d){SN.C.I.FormNoticeCurrent=d;var b=jQuery.data(d[0],"ElementData").MaxLength;if(b<=0){return}var c=b-SN.U.CharacterCount(d);var a=d.find(".count");if(c.toString()!=a.text()){if(!SN.C.I.CounterBlackout||c===0){if(a.text()!=String(c)){a.text(c)}if(c<0){d.addClass(SN.C.S.Warning)}else{d.removeClass(SN.C.S.Warning)}if(!SN.C.I.CounterBlackout){SN.C.I.CounterBlackout=true;SN.C.I.FormNoticeCurrent=d;window.setTimeout("SN.U.ClearCounterBlackout(SN.C.I.FormNoticeCurrent);",500)}}}},CharacterCount:function(a){return a.find(".notice_data-text:first").val().length},ClearCounterBlackout:function(a){SN.C.I.CounterBlackout=false;SN.U.Counter(a)},RewriteAjaxAction:function(a){if(document.location.protocol==="https:"&&a.substr(0,5)==="http:"){return a.replace(/^http:\/\/[^:\/]+/,"https://"+document.location.host)}return a},FormXHR:function(a,b){$.ajax({type:"POST",dataType:"xml",url:SN.U.RewriteAjaxAction(a.attr("action")),data:a.serialize()+"&ajax=1",beforeSend:function(c){a.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true)},error:function(e,f,d){var c=null;if(e.responseXML){c=$("#error",e.responseXML).text()}window.alert(c||d||f);a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false)},success:function(c,e){if($("form",c)[0]!==undefined){var d=document._importNode($("form",c)[0],true);a.replaceWith(d);if(b){b()}}else{if($("p",c)[0]!==undefined){a.replaceWith(document._importNode($("p",c)[0],true));if(b){b()}}else{window.alert("Unknown error.")}}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('

').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find(".notice_data-text:first").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false);a();if(g=="timeout"){c("error","Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists.")}else{var d=SN.U.GetResponseXML(f);if($("."+SN.C.S.Error,d).length>0){b.append(document._importNode($("."+SN.C.S.Error,d)[0],true))}else{if(parseInt(f.status)===0||jQuery.inArray(parseInt(f.status),SN.C.I.HTTP20x30x)>=0){b.resetForm().find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}else{c("error","(Sorry! We had trouble sending your notice ("+f.status+" "+f.statusText+"). Please report the problem to the site administrator if this happens again.")}}}},success:function(j,f){a();var p=$("#"+SN.C.S.Error,j);if(p.length>0){c("error",p.text())}else{if($("body")[0].id=="bookmarklet"){self.close()}var d=$("#"+SN.C.S.CommandResult,j);if(d.length>0){c("success",d.text())}else{var o=document._importNode($("li",j)[0],true);var k=$("#notices_primary .notices:first");var m=b.closest("li.notice-reply");if(m.length>0){var l=b.closest(".threaded-replies");var n=l.find(".notice-reply-placeholder");m.remove();var e=$(o).attr("id");if($("#"+e).length==0){$(o).insertBefore(n)}n.show()}else{if(k.length>0&&SN.U.belongsOnTimeline(o)){if($("#"+o.id).length===0){var h=b.find("[name=inreplyto]").val();var g="#notices_primary #notice-"+h;if($("body")[0].id=="conversation"){if(h.length>0&&$(g+" .notices").length<1){$(g).append('
    ')}$($(g+" .notices")[0]).append(o)}else{k.prepend(o)}$("#"+o.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+o.id));SN.U.switchInputFormTab("placeholder")}}else{c("success",$("title",j).text())}}}b.resetForm();b.find("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").prop(SN.C.S.Disabled,false).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").prop("checked",SN.C.I.NoticeDataGeo.NDG)}})},FormProfileSearchXHR:function(a){$.ajax({type:"POST",dataType:"xml",url:a.attr("action"),data:a.serialize()+"&ajax=1",beforeSend:function(b){a.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true)},error:function(c,d,b){window.alert(b||d)},success:function(d,f){var b=$("#profile_search_results");if($("ul",d)[0]!==undefined){var c=document._importNode($("ul",d)[0],true);b.replaceWith(c)}else{var e=$("
  • ").append(document._importNode($("p",d)[0],true));b.html(e)}a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,false)}})},FormPeopletagsXHR:function(a){$.ajax({type:"POST",dataType:"xml",url:a.attr("action"),data:a.serialize()+"&ajax=1",beforeSend:function(b){a.find(".submit").addClass(SN.C.S.Processing).addClass(SN.C.S.Disabled).prop(SN.C.S.Disabled,true)},error:function(c,d,b){window.alert(b||d)},success:function(d,e){var c=a.parents(".entity_tags");if($(".entity_tags",d)[0]!==undefined){var b=document._importNode($(".entity_tags",d)[0],true);$(b).find(".editable").append($('').closest(".notice-options").addClass("opaque");a.find("button.close").click(function(){$(this).remove();a.removeClass("dialogbox").closest(".notice-options").removeClass("opaque");a.find(".submit_dialogbox").remove();a.find(".submit").show();return false})},NoticeAttachments:function(){$(".notice a.attachment").each(function(){SN.U.NoticeWithAttachment($(this).closest(".notice"))})},NoticeWithAttachment:function(b){if(b.find(".attachment").length===0){return}var a=b.find(".attachment.more");if(a.length>0){$(a[0]).click(function(){var c=$(this);c.addClass(SN.C.S.Processing);$.get(c.attr("href")+"/ajax",null,function(d){c.parent(".entry-content").html($(d).find("#attachment_view .entry-content").html())});return false}).attr("title",SN.msg("showmore_tooltip"))}},NoticeDataAttach:function(c){var b;var a=c.find("input[type=file]");a.change(function(f){c.find(".attach-status").remove();var e=$(this).val();if(!e){return false}var d=$('
    ');d.find("code").text(e);d.find("button").click(function(){d.remove();a.val("");return false});c.append(d);if(typeof this.files==="object"){for(b=0;bg){f=false}if(f){h(c,function(k){var j=$("").attr("title",e).attr("alt",e).attr("src",k).attr("style","height: 120px");d.find(".attach-status").append(j)})}else{var b=$("
    ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var l=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var m=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var k=a.find("label.notice_data-geo");function f(o){k.attr("title",jQuery.trim(k.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").prop("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(o){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(o)}else{a.find(".geo_status_wrapper").remove()}}function n(o,p){SN.U.NoticeGeoStatus(a,"Looking up place name...");$.getJSON(o,p,function(q){var r,t,s;if(q.location_ns!==undefined){a.find("[name=location_ns]").val(q.location_ns);r=q.location_ns}if(q.location_id!==undefined){a.find("[name=location_id]").val(q.location_id);t=q.location_id}if(q.name===undefined){s=p.lat+";"+p.lon}else{s=q.name}SN.U.NoticeGeoStatus(a,s,p.lat,p.lon,q.url);k.attr("title",NoticeDataGeo_text.ShareDisable+" ("+s+")");a.find("[name=lat]").val(p.lat);a.find("[name=lon]").val(p.lon);a.find("[name=location_ns]").val(r);a.find("[name=location_id]").val(t);a.find("[name=notice_data-geo]").prop("checked",true);var u={NLat:p.lat,NLon:p.lon,NLNS:r,NLID:t,NLN:s,NLNU:q.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(u),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.prop("checked",false)}else{c.prop("checked",true)}var h=a.find(".notice_data-geo_wrap");var j=h.attr("data-api");k.attr("title",k.text());c.change(function(){if(c.prop("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){k.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus(a,"Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(q){a.find("[name=lat]").val(q.coords.latitude);a.find("[name=lon]").val(q.coords.longitude);var r={lat:q.coords.latitude,lon:q.coords.longitude,token:$("#token").val()};n(j,r)},function(q){switch(q.code){case q.PERMISSION_DENIED:f("Location permission denied.");break;case q.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&l.length>0){var o={lat:e,lon:l,token:$("#token").val()};n(j,o)}else{f();c.remove();k.remove()}}}else{var p=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(p.NLat);a.find("[name=lon]").val(p.NLon);a.find("[name=location_ns]").val(p.NLNS);a.find("[name=location_id]").val(p.NLID);a.find("[name=notice_data-geo]").prop("checked",p.NDG);SN.U.NoticeGeoStatus(a,p.NLN,p.NLat,p.NLon,p.NLNU);k.attr("title",NoticeDataGeo_text.ShareDisable+" ("+p.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(e,a,f,g,c){var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
    ');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").prop("checked",false).change();return false});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},NewDirectMessage:function(){NDM=$(".entity_send-a-message a");NDM.attr({href:NDM.attr("href")+"&ajax=1"});NDM.on("click",function(){var a=$(".entity_send-a-message form");if(a.length===0){$(this).addClass(SN.C.S.Processing);$.get(NDM.attr("href"),null,function(b){$(".entity_send-a-message").append(document._importNode($("form",b)[0],true));a=$(".entity_send-a-message .form_notice");SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);a.append('');$(".entity_send-a-message button").click(function(){a.hide();return false});NDM.removeClass(SN.C.S.Processing)})}else{a.show();$(".entity_send-a-message textarea").focus()}return false})},GetFullYear:function(c,d,a){var b=new Date();b.setFullYear(c,d,a);return b},StatusNetInstance:{Set:function(b){var a=SN.U.StatusNetInstance.Get();if(a!==null){b=$.extend(a,b)}$.cookie(SN.C.S.StatusNetInstance,JSON.stringify(b),{path:"/",expires:SN.U.GetFullYear(2029,0,1)})},Get:function(){var a=$.cookie(SN.C.S.StatusNetInstance);if(a!==null){return JSON.parse(a)}return null},Delete:function(){$.cookie(SN.C.S.StatusNetInstance,null)}},belongsOnTimeline:function(b){var a=$("body").attr("id");if(a=="public"){return true}var c=$("#nav_profile a").attr("href");if(c){var d=$(b).find(".vcard.author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false},switchInputFormTab:function(a){$(".input_form_nav_tab.current").removeClass("current");if(a=="placeholder"){$("#input_form_nav_status").addClass("current")}else{$("#input_form_nav_"+a).addClass("current")}var b=$(".input_form.current.nonav");if(b.length>0){return}$(".input_form.current").removeClass("current");$("#input_form_"+a).addClass("current").find(".ajax-notice").each(function(){var c=$(this);SN.Init.NoticeFormSetup(c)}).find(".notice_data-text").focus()},showMoreMenuItems:function(c){$("#"+c+" .more_link").remove();var b="#"+c+" .extended_menu";var a=$(b);a.removeClass("extended_menu");return void (0)}},Init:{NoticeForm:function(){if($("body.user_in").length>0){$("#input_form_placeholder input.placeholder").focus(function(){SN.U.switchInputFormTab("status")});$("body").on("click",function(g){var d=$("#content .input_forms div.current");if(d.length>0){if($("#content .input_forms").has(g.target).length==0){var a=d.find('textarea, input[type=text], input[type=""]');var c=false;a.each(function(){c=c||$(this).val()});if(!c){SN.U.switchInputFormTab("placeholder")}}}var b=$("li.notice-reply");if(b.length>0){var f=$(g.target);b.each(function(){var k=$(this);if(k.has(g.target).length==0){var h=k.find(".notice_data-text:first");var j=$.trim(h.val());if(j==""||j==h.data("initialText")){var e=k.closest("li.notice");k.remove();e.find("li.notice-reply-placeholder").show()}}})}});$(".input_forms fieldset fieldset label").inFieldLabels({fadeOpacity:0})}},NoticeFormSetup:function(a){if(!a.data("NoticeFormSetup")){SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a);a.data("NoticeFormSetup",true)}},Notices:function(){if($("body.user_in").length>0){var a=$(".form_notice:first");if(a.length>0){SN.C.I.NoticeFormMaster=document._importNode(a[0],true)}SN.U.NoticeRepeat();SN.U.NoticeReply();SN.U.NoticeInlineReplySetup()}SN.U.NoticeAttachments()},EntityActions:function(){if($("body.user_in").length>0){$(document).on("click",".form_user_subscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_unsubscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_group_join",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_group_leave",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_nudge",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_peopletag_subscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_peopletag_unsubscribe",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_add_peopletag",function(){SN.U.FormXHR($(this));return false});$(document).on("click",".form_user_remove_peopletag",function(){SN.U.FormXHR($(this));return false});SN.U.NewDirectMessage()}},ProfileSearch:function(){if($("body.user_in").length>0){$(document).on("click",".form_peopletag_edit_user_search input.submit",function(){SN.U.FormProfileSearchXHR($(this).parents("form"));return false})}},Login:function(){if(SN.U.StatusNetInstance.Get()!==null){var a=SN.U.StatusNetInstance.Get().Nickname;if(a!==null){$("#form_login #nickname").val(a)}}$("#form_login").on("submit",function(){SN.U.StatusNetInstance.Set({Nickname:$("#form_login #nickname").val()});return true})},PeopletagAutocomplete:function(b){var a=function(d){return d.split(/\s+/)};var c=function(d){return a(d).pop()};b.on("keydown",function(d){if(d.keyCode===$.ui.keyCode.TAB&&$(this).data("autocomplete").menu.active){d.preventDefault()}}).autocomplete({minLength:0,source:function(e,d){d($.ui.autocomplete.filter(SN.C.PtagACData,c(e.term)))},focus:function(){return false},select:function(e,f){var d=a(this.value);d.pop();d.push(f.item.value);d.push("");this.value=d.join(" ");return false}}).data("autocomplete")._renderItem=function(e,f){var d=''+f.tag+' '+f.mode+''+f.freq+"";return $("
  • ").addClass("mode-"+f.mode).addClass("ptag-ac-line").data("item.autocomplete",f).append(d).appendTo(e)}},PeopleTags:function(){$(".user_profile_tags .editable").append($('
  • ');$("#realtime_pause").text(SN.msg("realtime_pause")).attr("title",SN.msg("realtime_pause_tooltip")).bind("click",function(){RealtimeUpdate.removeNoticesHover();RealtimeUpdate.showPlay();return false})},showPlay:function(){RealtimeUpdate.setPause(true);$("#realtime_playpause").remove();$("#realtime_actions").prepend('
  • ');$("#realtime_play").text(SN.msg("realtime_play")).attr("title",SN.msg("realtime_play_tooltip")).bind("click",function(){RealtimeUpdate.showPause();return false})},setPause:function(a){RealtimeUpdate._paused=a;if(typeof(localStorage)!="undefined"){localStorage.setItem("RealtimeUpdate_paused",RealtimeUpdate._paused)}},showQueuedNotices:function(){$.each(RealtimeUpdate._queuedNotices,function(a,b){RealtimeUpdate.insertNoticeItem(b)});RealtimeUpdate._queuedNotices=[];RealtimeUpdate.removeQueuedCounter()},updateQueuedCounter:function(){$("#realtime_playpause #queued_counter").html("("+RealtimeUpdate._queuedNotices.length+")")},removeQueuedCounter:function(){$("#realtime_playpause #queued_counter").empty()},addNoticesHover:function(){$("#notices_primary .notices").hover(function(){if(RealtimeUpdate._paused===false){RealtimeUpdate.showPlay()}},function(){if(RealtimeUpdate._paused===true){RealtimeUpdate.showPause()}})},removeNoticesHover:function(){$("#notices_primary .notices").unbind()},initAddPopup:function(a,b,c){$("#realtime_timeline").append('');$("#realtime_popup").text(SN.msg("realtime_popup")).attr("title",SN.msg("realtime_popup_tooltip")).bind("click",function(){window.open(a,"","toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550");return false})},initPopupWindow:function(){$(".notices .entry-title a, .notices .entry-content a").bind("click",function(){window.open(this.href,"");return false});$("#showstream .entity_profile").css({width:"69%"})}}; \ No newline at end of file From c0c8250ff76237373e5a5da4a1203d15dd438929 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 24 Feb 2014 01:05:13 +0100 Subject: [PATCH 24/56] minify removed from core (use plugin if desired) My reasoning: Minifying makes third party review harder. A visitor on a GNU social site should have no problem reading, understanding and modifying javascripts for their own liking. A minified script is much more difficult to use, reuse, modify and share. Free software is not minified. --- js/extlib/jquery-ui/jquery-ui.min.js | 7 ------- js/extlib/jquery.cookie.min.js | 8 -------- js/extlib/jquery.form.min.js | 7 ------- js/extlib/jquery.infieldlabel.min.js | 10 ---------- js/extlib/jquery.min.js | 6 ------ js/extlib/json2.min.js | 1 - lib/action.php | 21 ++++++--------------- lib/default.php | 1 - 8 files changed, 6 insertions(+), 55 deletions(-) delete mode 100644 js/extlib/jquery-ui/jquery-ui.min.js delete mode 100644 js/extlib/jquery.cookie.min.js delete mode 100644 js/extlib/jquery.form.min.js delete mode 100644 js/extlib/jquery.infieldlabel.min.js delete mode 100644 js/extlib/jquery.min.js delete mode 100644 js/extlib/json2.min.js diff --git a/js/extlib/jquery-ui/jquery-ui.min.js b/js/extlib/jquery-ui/jquery-ui.min.js deleted file mode 100644 index ca9ab9e3fa..0000000000 --- a/js/extlib/jquery-ui/jquery-ui.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! jQuery UI - v1.10.3 - 2013-09-11 -* http://jqueryui.com -* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js -* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */ - -(function(t,e){function n(e,n){var r,s,o,a=e.nodeName.toLowerCase();return"area"===a?(r=e.parentNode,s=r.name,e.href&&s&&"map"===r.nodeName.toLowerCase()?(o=t("img[usemap=#"+s+"]")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(a)?!e.disabled:"a"===a?e.href||n:n)&&i(e)}function i(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var r=0,s=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({focus:function(e){return function(n,i){return"number"==typeof n?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),i&&i.call(e)},n)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(n){if(n!==e)return this.css("zIndex",n);if(this.length)for(var i,r,s=t(this[0]);s.length&&s[0]!==document;){if(i=s.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(r=parseInt(s.css("zIndex"),10),!isNaN(r)&&0!==r))return r;s=s.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++r)})},removeUniqueId:function(){return this.each(function(){s.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(n){return!!t.data(n,e)}}):function(e,n,i){return!!t.data(e,i[3])},focusable:function(e){return n(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var i=t.attr(e,"tabindex"),r=isNaN(i);return(r||i>=0)&&n(e,!r)}}),t("").outerWidth(1).jquery||t.each(["Width","Height"],function(n,i){function r(e,n,i,r){return t.each(s,function(){n-=parseFloat(t.css(e,"padding"+this))||0,i&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0),r&&(n-=parseFloat(t.css(e,"margin"+this))||0)}),n}var s="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(n){return n===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,r(this,n)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,r(this,e,!0,n)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(n){return arguments.length?e.call(this,t.camelCase(n)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,n,i){var r,s=t.ui[e].prototype;for(r in i)s.plugins[r]=s.plugins[r]||[],s.plugins[r].push([n,i[r]])},call:function(t,e,n){var i,r=t.plugins[e];if(r&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(i=0;r.length>i;i++)t.options[r[i][0]]&&r[i][1].apply(t.element,n)}},hasScroll:function(e,n){if("hidden"===t(e).css("overflow"))return!1;var i=n&&"left"===n?"scrollLeft":"scrollTop",r=!1;return e[i]>0?!0:(e[i]=1,r=e[i]>0,e[i]=0,r)}})})(jQuery);(function(e,t){var a=0,i=Array.prototype.slice,r=e.cleanData;e.cleanData=function(t){for(var a,i=0;null!=(a=t[i]);i++)try{e(a).triggerHandler("remove")}catch(s){}r(t)},e.widget=function(a,i,r){var s,n,o,d,l={},u=a.split(".")[0];a=a.split(".")[1],s=u+"-"+a,r||(r=i,i=e.Widget),e.expr[":"][s.toLowerCase()]=function(t){return!!e.data(t,s)},e[u]=e[u]||{},n=e[u][a],o=e[u][a]=function(e,a){return this._createWidget?(arguments.length&&this._createWidget(e,a),t):new o(e,a)},e.extend(o,n,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),d=new i,d.options=e.widget.extend({},d.options),e.each(r,function(a,r){return e.isFunction(r)?(l[a]=function(){var e=function(){return i.prototype[a].apply(this,arguments)},t=function(e){return i.prototype[a].apply(this,e)};return function(){var a,i=this._super,s=this._superApply;return this._super=e,this._superApply=t,a=r.apply(this,arguments),this._super=i,this._superApply=s,a}}(),t):(l[a]=r,t)}),o.prototype=e.widget.extend(d,{widgetEventPrefix:n?d.widgetEventPrefix:a},l,{constructor:o,namespace:u,widgetName:a,widgetFullName:s}),n?(e.each(n._childConstructors,function(t,a){var i=a.prototype;e.widget(i.namespace+"."+i.widgetName,o,a._proto)}),delete n._childConstructors):i._childConstructors.push(o),e.widget.bridge(a,o)},e.widget.extend=function(a){for(var r,s,n=i.call(arguments,1),o=0,d=n.length;d>o;o++)for(r in n[o])s=n[o][r],n[o].hasOwnProperty(r)&&s!==t&&(a[r]=e.isPlainObject(s)?e.isPlainObject(a[r])?e.widget.extend({},a[r],s):e.widget.extend({},s):s);return a},e.widget.bridge=function(a,r){var s=r.prototype.widgetFullName||a;e.fn[a]=function(n){var o="string"==typeof n,d=i.call(arguments,1),l=this;return n=!o&&d.length?e.widget.extend.apply(null,[n].concat(d)):n,o?this.each(function(){var i,r=e.data(this,s);return r?e.isFunction(r[n])&&"_"!==n.charAt(0)?(i=r[n].apply(r,d),i!==r&&i!==t?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):t):e.error("no such method '"+n+"' for "+a+" widget instance"):e.error("cannot call methods on "+a+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?t.option(n||{})._init():e.data(this,s,new r(n,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
    ",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=a++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(a,i){var r,s,n,o=a;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof a)if(o={},r=a.split("."),a=r.shift(),r.length){for(s=o[a]=e.widget.extend({},this.options[a]),n=0;r.length-1>n;n++)s[r[n]]=s[r[n]]||{},s=s[r[n]];if(a=r.pop(),i===t)return s[a]===t?null:s[a];s[a]=i}else{if(i===t)return this.options[a]===t?null:this.options[a];o[a]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(a,i,r){var s,n=this;"boolean"!=typeof a&&(r=i,i=a,a=!1),r?(i=s=e(i),this.bindings=this.bindings.add(i)):(r=i,i=this.element,s=this.widget()),e.each(r,function(r,o){function d(){return a||n.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?n[o]:o).apply(n,arguments):t}"string"!=typeof o&&(d.guid=o.guid=o.guid||d.guid||e.guid++);var l=r.match(/^(\w+)\s*(.*)$/),u=l[1]+n.eventNamespace,h=l[2];h?s.delegate(h,u,d):i.bind(u,d)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function a(){return("string"==typeof e?i[e]:e).apply(i,arguments)}var i=this;return setTimeout(a,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,a,i){var r,s,n=this.options[t];if(i=i||{},a=e.Event(a),a.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),a.target=this.element[0],s=a.originalEvent)for(r in s)r in a||(a[r]=s[r]);return this.element.trigger(a,i),!(e.isFunction(n)&&n.apply(this.element[0],[a].concat(i))===!1||a.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,a){e.Widget.prototype["_"+t]=function(i,r,s){"string"==typeof r&&(r={effect:r});var n,o=r?r===!0||"number"==typeof r?a:r.effect||a:t;r=r||{},"number"==typeof r&&(r={duration:r}),n=!e.isEmptyObject(r),r.complete=s,r.delay&&i.delay(r.delay),n&&e.effects&&e.effects.effect[o]?i[t](r):o!==t&&i[o]?i[o](r.duration,r.easing,s):i.queue(function(a){e(this)[t](),s&&s.call(i[0]),a()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(a){return!0===e.data(a.target,t.widgetName+".preventClickEvent")?(e.removeData(a.target,t.widgetName+".preventClickEvent"),a.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(a){if(!t){this._mouseStarted&&this._mouseUp(a),this._mouseDownEvent=a;var r=this,i=1===a.which,s="string"==typeof this.options.cancel&&a.target.nodeName?e(a.target).closest(this.options.cancel).length:!1;return i&&!s&&this._mouseCapture(a)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=this._mouseStart(a)!==!1,!this._mouseStarted)?(a.preventDefault(),!0):(!0===e.data(a.target,this.widgetName+".preventClickEvent")&&e.removeData(a.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),a.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(e,t){function a(e,t,a){return[parseFloat(e[0])*(m.test(e[0])?t/100:1),parseFloat(e[1])*(m.test(e[1])?a/100:1)]}function i(t,a){return parseInt(e.css(t,a),10)||0}function r(t){var a=t[0];return 9===a.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(a)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:a.preventDefault?{width:0,height:0,offset:{top:a.pageY,left:a.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var s,n=Math.max,o=Math.abs,d=Math.round,u=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,m=/%$/,p=e.fn.position;e.position={scrollbarWidth:function(){if(s!==t)return s;var a,i,r=e("
    "),n=r.children()[0];return e("body").append(r),a=n.offsetWidth,r.css("overflow","scroll"),i=n.offsetWidth,a===i&&(i=r[0].clientWidth),r.remove(),s=a-i},getScrollInfo:function(t){var a=t.isWindow?"":t.element.css("overflow-x"),i=t.isWindow?"":t.element.css("overflow-y"),r="scroll"===a||"auto"===a&&t.widthi?"left":a>0?"right":"center",vertical:0>s?"top":r>0?"bottom":"middle"};h>m&&m>o(a+i)&&(d.horizontal="center"),c>f&&f>o(r+s)&&(d.vertical="middle"),d.important=n(o(a),o(i))>n(o(r),o(s))?"horizontal":"vertical",t.using.call(this,e,d)}),l.offset(e.extend(D,{using:u}))})},e.ui.position={fit:{left:function(e,t){var a,i=t.within,r=i.isWindow?i.scrollLeft:i.offset.left,s=i.width,o=e.left-t.collisionPosition.marginLeft,d=r-o,u=o+t.collisionWidth-s-r;t.collisionWidth>s?d>0&&0>=u?(a=e.left+d+t.collisionWidth-s-r,e.left+=d-a):e.left=u>0&&0>=d?r:d>u?r+s-t.collisionWidth:r:d>0?e.left+=d:u>0?e.left-=u:e.left=n(e.left-o,e.left)},top:function(e,t){var a,i=t.within,r=i.isWindow?i.scrollTop:i.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,d=r-o,u=o+t.collisionHeight-s-r;t.collisionHeight>s?d>0&&0>=u?(a=e.top+d+t.collisionHeight-s-r,e.top+=d-a):e.top=u>0&&0>=d?r:d>u?r+s-t.collisionHeight:r:d>0?e.top+=d:u>0?e.top-=u:e.top=n(e.top-o,e.top)}},flip:{left:function(e,t){var a,i,r=t.within,s=r.offset.left+r.scrollLeft,n=r.width,d=r.isWindow?r.scrollLeft:r.offset.left,u=e.left-t.collisionPosition.marginLeft,l=u-d,h=u+t.collisionWidth-n-d,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,m="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,p=-2*t.offset[0];0>l?(a=e.left+c+m+p+t.collisionWidth-n-s,(0>a||o(l)>a)&&(e.left+=c+m+p)):h>0&&(i=e.left-t.collisionPosition.marginLeft+c+m+p-d,(i>0||h>o(i))&&(e.left+=c+m+p))},top:function(e,t){var a,i,r=t.within,s=r.offset.top+r.scrollTop,n=r.height,d=r.isWindow?r.scrollTop:r.offset.top,u=e.top-t.collisionPosition.marginTop,l=u-d,h=u+t.collisionHeight-n-d,c="top"===t.my[1],m=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,p="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,f=-2*t.offset[1];0>l?(i=e.top+m+p+f+t.collisionHeight-n-s,e.top+m+p+f>l&&(0>i||o(l)>i)&&(e.top+=m+p+f)):h>0&&(a=e.top-t.collisionPosition.marginTop+m+p+f-d,e.top+m+p+f>h&&(a>0||h>o(a))&&(e.top+=m+p+f))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,a,i,r,s,n=document.getElementsByTagName("body")[0],o=document.createElement("div");t=document.createElement(n?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},n&&e.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"});for(s in i)t.style[s]=i[s];t.appendChild(o),a=n||document.documentElement,a.insertBefore(t,a.firstChild),o.style.cssText="position: absolute; left: 10.7432222px;",r=e(o).offset().left,e.support.offsetFractions=r>10&&11>r,t.innerHTML="",a.removeChild(t)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var a=this.options;return this.helper||a.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(a.iframeFix===!0?"iframe":a.iframeFix).each(function(){e("
    ").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var a=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,a){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!a){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var a=this,r=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(r=e.ui.ddmanager.drop(this,t)),this.dropped&&(r=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!r||"valid"===this.options.revert&&r||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,r)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){a._trigger("stop",t)!==!1&&a._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var a=this.options,r=e.isFunction(a.helper)?e(a.helper.apply(this.element[0],[t])):"clone"===a.helper?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo("parent"===a.appendTo?this.element[0].parentNode:a.appendTo),r[0]===this.element[0]||/(fixed|absolute)/.test(r.css("position"))||r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,a,r,i=this.options;return i.containment?"window"===i.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===i.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):i.containment.constructor===Array?(this.containment=i.containment,undefined):("parent"===i.containment&&(i.containment=this.helper[0].parentNode),a=e(i.containment),r=a[0],r&&(t="hidden"!==a.css("overflow"),this.containment=[(parseInt(a.css("borderLeftWidth"),10)||0)+(parseInt(a.css("paddingLeft"),10)||0),(parseInt(a.css("borderTopWidth"),10)||0)+(parseInt(a.css("paddingTop"),10)||0),(t?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(a.css("borderRightWidth"),10)||0)-(parseInt(a.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(a.css("borderBottomWidth"),10)||0)-(parseInt(a.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=a),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,a){a||(a=this.position);var r="absolute"===t?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:i.scrollTop(),left:i.scrollLeft()}),{top:a.top+this.offset.relative.top*r+this.offset.parent.top*r-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*r,left:a.left+this.offset.relative.left*r+this.offset.parent.left*r-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*r}},_generatePosition:function(t){var a,r,i,s,n=this.options,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,d=t.pageX,u=t.pageY;return this.offset.scroll||(this.offset.scroll={top:o.scrollTop(),left:o.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(r=this.relative_container.offset(),a=[this.containment[0]+r.left,this.containment[1]+r.top,this.containment[2]+r.left,this.containment[3]+r.top]):a=this.containment,t.pageX-this.offset.click.lefta[2]&&(d=a[2]+this.offset.click.left),t.pageY-this.offset.click.top>a[3]&&(u=a[3]+this.offset.click.top)),n.grid&&(i=n.grid[1]?this.originalPageY+Math.round((u-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY,u=a?i-this.offset.click.top>=a[1]||i-this.offset.click.top>a[3]?i:i-this.offset.click.top>=a[1]?i-n.grid[1]:i+n.grid[1]:i,s=n.grid[0]?this.originalPageX+Math.round((d-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX,d=a?s-this.offset.click.left>=a[0]||s-this.offset.click.left>a[2]?s:s-this.offset.click.left>=a[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:u-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,a,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[a,r]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,a,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,a){var r=e(this).data("ui-draggable"),i=r.options,s=e.extend({},a,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var a=e.data(this,"ui-sortable");a&&!a.options.disabled&&(r.sortables.push({instance:a,shouldRevert:a.options.revert}),a.refreshPositions(),a._trigger("activate",t,s))})},stop:function(t,a){var r=e(this).data("ui-draggable"),i=e.extend({},a,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===r.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,a){var r=e(this).data("ui-draggable"),i=this;e.each(r.sortables,function(){var s=!1,n=this;this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(s=!0,e.each(r.sortables,function(){return this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this!==n&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(n.instance.element[0],this.instance.element[0])&&(s=!1),s})),s?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return a.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),a=e(this).data("ui-draggable").options;t.css("cursor")&&(a._cursor=t.css("cursor")),t.css("cursor",a.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,a){var r=e(a.helper),i=e(this).data("ui-draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,a){var r=e(this).data("ui-draggable").options;r._opacity&&e(a.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var a=e(this).data("ui-draggable"),r=a.options,i=!1;a.scrollParent[0]!==document&&"HTML"!==a.scrollParent[0].tagName?(r.axis&&"x"===r.axis||(a.overflowOffset.top+a.scrollParent[0].offsetHeight-t.pageY=0;h--)o=m.snapElements[h].left,d=o+m.snapElements[h].width,u=m.snapElements[h].top,l=u+m.snapElements[h].height,o-f>y||g>d+f||u-f>x||k>l+f||!e.contains(m.snapElements[h].item.ownerDocument,m.snapElements[h].item)?(m.snapElements[h].snapping&&m.options.snap.release&&m.options.snap.release.call(m.element,t,e.extend(m._uiHash(),{snapItem:m.snapElements[h].item})),m.snapElements[h].snapping=!1):("inner"!==p.snapMode&&(r=f>=Math.abs(u-x),i=f>=Math.abs(l-k),s=f>=Math.abs(o-y),n=f>=Math.abs(d-g),r&&(a.position.top=m._convertPositionTo("relative",{top:u-m.helperProportions.height,left:0}).top-m.margins.top),i&&(a.position.top=m._convertPositionTo("relative",{top:l,left:0}).top-m.margins.top),s&&(a.position.left=m._convertPositionTo("relative",{top:0,left:o-m.helperProportions.width}).left-m.margins.left),n&&(a.position.left=m._convertPositionTo("relative",{top:0,left:d}).left-m.margins.left)),c=r||i||s||n,"outer"!==p.snapMode&&(r=f>=Math.abs(u-k),i=f>=Math.abs(l-x),s=f>=Math.abs(o-g),n=f>=Math.abs(d-y),r&&(a.position.top=m._convertPositionTo("relative",{top:u,left:0}).top-m.margins.top),i&&(a.position.top=m._convertPositionTo("relative",{top:l-m.helperProportions.height,left:0}).top-m.margins.top),s&&(a.position.left=m._convertPositionTo("relative",{top:0,left:o}).left-m.margins.left),n&&(a.position.left=m._convertPositionTo("relative",{top:0,left:d-m.helperProportions.width}).left-m.margins.left)),!m.snapElements[h].snapping&&(r||i||s||n||c)&&m.options.snap.snap&&m.options.snap.snap.call(m.element,t,e.extend(m._uiHash(),{snapItem:m.snapElements[h].item})),m.snapElements[h].snapping=r||i||s||n||c)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,a=this.data("ui-draggable").options,r=e.makeArray(e(a.stack)).sort(function(t,a){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(a).css("zIndex"),10)||0)});r.length&&(t=parseInt(e(r[0]).css("zIndex"),10)||0,e(r).each(function(a){e(this).css("zIndex",t+a)}),this.css("zIndex",t+r.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,a){var r=e(a.helper),i=e(this).data("ui-draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,a){var r=e(this).data("ui-draggable").options;r._zIndex&&e(a.helper).css("zIndex",r._zIndex)}})})(jQuery);(function(e){function t(e,t,a){return e>t&&t+a>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,a=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(a)?a:function(e){return e.is(a)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,a=e.ui.ddmanager.droppables[this.options.scope];a.length>t;t++)a[t]===this&&a.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,a){"accept"===t&&(this.accept=e.isFunction(a)?a:function(e){return e.is(a)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var a=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),a&&this._trigger("activate",t,this.ui(a))},_deactivate:function(t){var a=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),a&&this._trigger("deactivate",t,this.ui(a))},_over:function(t){var a=e.ui.ddmanager.current;a&&(a.currentItem||a.element)[0]!==this.element[0]&&this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(a)))},_out:function(t){var a=e.ui.ddmanager.current;a&&(a.currentItem||a.element)[0]!==this.element[0]&&this.accept.call(this.element[0],a.currentItem||a.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(a)))},_drop:function(t,a){var i=a||e.ui.ddmanager.current,r=!1;return i&&(i.currentItem||i.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&e.ui.intersect(i,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(r=!0,!1):undefined}),r?!1:this.accept.call(this.element[0],i.currentItem||i.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(i)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,a,i){if(!a.offset)return!1;var r,s,n=(e.positionAbs||e.position.absolute).left,o=n+e.helperProportions.width,d=(e.positionAbs||e.position.absolute).top,l=d+e.helperProportions.height,u=a.offset.left,h=u+a.proportions.width,c=a.offset.top,m=c+a.proportions.height;switch(i){case"fit":return n>=u&&h>=o&&d>=c&&m>=l;case"intersect":return n+e.helperProportions.width/2>u&&h>o-e.helperProportions.width/2&&d+e.helperProportions.height/2>c&&m>l-e.helperProportions.height/2;case"pointer":return r=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,s=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(s,c,a.proportions.height)&&t(r,u,a.proportions.width);case"touch":return(d>=c&&m>=d||l>=c&&m>=l||c>d&&l>m)&&(n>=u&&h>=n||o>=u&&h>=o||u>n&&o>h);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,a){var i,r,s=e.ui.ddmanager.droppables[t.options.scope]||[],n=a?a.type:null,o=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(i=0;s.length>i;i++)if(!(s[i].options.disabled||t&&!s[i].accept.call(s[i].element[0],t.currentItem||t.element))){for(r=0;o.length>r;r++)if(o[r]===s[i].element[0]){s[i].proportions.height=0;continue e}s[i].visible="none"!==s[i].element.css("display"),s[i].visible&&("mousedown"===n&&s[i]._activate.call(s[i],a),s[i].offset=s[i].element.offset(),s[i].proportions={width:s[i].element[0].offsetWidth,height:s[i].element[0].offsetHeight})}},drop:function(t,a){var i=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(i=this._drop.call(this,a)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,a)))}),i},dragStart:function(t,a){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,a)})},drag:function(t,a){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,a),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var i,r,s,n=e.ui.intersect(t,this,this.options.tolerance),o=!n&&this.isover?"isout":n&&!this.isover?"isover":null;o&&(this.options.greedy&&(r=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===r}),s.length&&(i=e.data(s[0],"ui-droppable"),i.greedyChild="isover"===o)),i&&"isover"===o&&(i.isover=!1,i.isout=!0,i._out.call(i,a)),this[o]=!0,this["isout"===o?"isover":"isout"]=!1,this["isover"===o?"_over":"_out"].call(this,a),i&&"isout"===o&&(i.isout=!1,i.isover=!0,i._over.call(i,a)))}})},dragStop:function(t,a){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,a)}}})(jQuery);(function(e){function t(e){return parseInt(e,10)||0}function a(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,a,i,r,s,n=this,o=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("
    ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=o.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},a=0;t.length>a;a++)i=e.trim(t[a]),s="ui-resizable-"+i,r=e("
    "),r.css({zIndex:o.zIndex}),"se"===i&&r.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[i]=".ui-resizable-"+i,this.element.append(r);this._renderAxis=function(t){var a,i,r,s;t=t||this.element;for(a in this.handles)this.handles[a].constructor===String&&(this.handles[a]=e(this.handles[a],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(i=e(this.handles[a],this.element),s=/sw|ne|nw|se|n|s/.test(a)?i.outerHeight():i.outerWidth(),r=["padding",/ne|nw|n/.test(a)?"Top":/se|sw|s/.test(a)?"Bottom":/^e$/.test(a)?"Right":"Left"].join(""),t.css(r,s),this._proportionallyResize()),e(this.handles[a]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){n.resizing||(this.className&&(r=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),n.axis=r&&r[1]?r[1]:"se")}),o.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){o.disabled||(e(this).removeClass("ui-resizable-autohide"),n._handles.show())}).mouseleave(function(){o.disabled||n.resizing||(e(this).addClass("ui-resizable-autohide"),n._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,a=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(a(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),a(this.originalElement),this},_mouseCapture:function(t){var a,i,r=!1;for(a in this.handles)i=e(this.handles[a])[0],(i===t.target||e.contains(i,t.target))&&(r=!0);return!this.options.disabled&&r},_mouseStart:function(a){var i,r,s,n=this.options,o=this.element.position(),d=this.element;return this.resizing=!0,/absolute/.test(d.css("position"))?d.css({position:"absolute",top:d.css("top"),left:d.css("left")}):d.is(".ui-draggable")&&d.css({position:"absolute",top:o.top,left:o.left}),this._renderProxy(),i=t(this.helper.css("left")),r=t(this.helper.css("top")),n.containment&&(i+=e(n.containment).scrollLeft()||0,r+=e(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:r},this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()},this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()},this.originalPosition={left:i,top:r},this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()},this.originalMousePosition={left:a.pageX,top:a.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===s?this.axis+"-resize":s),d.addClass("ui-resizable-resizing"),this._propagate("start",a),!0},_mouseDrag:function(t){var a,i=this.helper,r={},s=this.originalMousePosition,n=this.axis,o=this.position.top,d=this.position.left,l=this.size.width,u=this.size.height,h=t.pageX-s.left||0,c=t.pageY-s.top||0,m=this._change[n];return m?(a=m.apply(this,[t,h,c]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(a=this._updateRatio(a,t)),a=this._respectSize(a,t),this._updateCache(a),this._propagate("resize",t),this.position.top!==o&&(r.top=this.position.top+"px"),this.position.left!==d&&(r.left=this.position.left+"px"),this.size.width!==l&&(r.width=this.size.width+"px"),this.size.height!==u&&(r.height=this.size.height+"px"),i.css(r),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(r)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var a,i,r,s,n,o,d,l=this.options,u=this;return this._helper&&(a=this._proportionallyResizeElements,i=a.length&&/textarea/i.test(a[0].nodeName),r=i&&e.ui.hasScroll(a[0],"left")?0:u.sizeDiff.height,s=i?0:u.sizeDiff.width,n={width:u.helper.width()-s,height:u.helper.height()-r},o=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,d=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(n,{top:d,left:o})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,i,r,s,n,o=this.options;n={minWidth:a(o.minWidth)?o.minWidth:0,maxWidth:a(o.maxWidth)?o.maxWidth:1/0,minHeight:a(o.minHeight)?o.minHeight:0,maxHeight:a(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=n.minHeight*this.aspectRatio,r=n.minWidth/this.aspectRatio,i=n.maxHeight*this.aspectRatio,s=n.maxWidth/this.aspectRatio,t>n.minWidth&&(n.minWidth=t),r>n.minHeight&&(n.minHeight=r),n.maxWidth>i&&(n.maxWidth=i),n.maxHeight>s&&(n.maxHeight=s)),this._vBoundaries=n},_updateCache:function(e){this.offset=this.helper.offset(),a(e.left)&&(this.position.left=e.left),a(e.top)&&(this.position.top=e.top),a(e.height)&&(this.size.height=e.height),a(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,r=this.axis;return a(e.height)?e.width=e.height*this.aspectRatio:a(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===r&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===r&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,r=a(e.width)&&t.maxWidth&&t.maxWidthe.width,o=a(e.height)&&t.minHeight&&t.minHeight>e.height,d=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,u=/sw|nw|w/.test(i),h=/nw|ne|n/.test(i);return n&&(e.width=t.minWidth),o&&(e.height=t.minHeight),r&&(e.width=t.maxWidth),s&&(e.height=t.maxHeight),n&&u&&(e.left=d-t.minWidth),r&&u&&(e.left=d-t.maxWidth),o&&h&&(e.top=l-t.minHeight),s&&h&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,a,i,r,s=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(r=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],a=[r.css("borderTopWidth"),r.css("borderRightWidth"),r.css("borderBottomWidth"),r.css("borderLeftWidth")],i=[r.css("paddingTop"),r.css("paddingRight"),r.css("paddingBottom"),r.css("paddingLeft")],t=0;a.length>t;t++)this.borderDif[t]=(parseInt(a[t],10)||0)+(parseInt(i[t],10)||0);r.css({height:s.height()-this.borderDif[0]-this.borderDif[2]||0,width:s.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,a=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("
    "),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++a.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var a=this.originalSize,i=this.originalPosition;return{left:i.left+t,width:a.width-t}},n:function(e,t,a){var i=this.originalSize,r=this.originalPosition;return{top:r.top+a,height:i.height-a}},s:function(e,t,a){return{height:this.originalSize.height+a}},se:function(t,a,i){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,a,i]))},sw:function(t,a,i){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,a,i]))},ne:function(t,a,i){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,a,i]))},nw:function(t,a,i){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,a,i]))}},_propagate:function(t,a){e.ui.plugin.call(this,t,[a,this.ui()]),"resize"!==t&&this._trigger(t,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var a=e(this).data("ui-resizable"),i=a.options,r=a._proportionallyResizeElements,s=r.length&&/textarea/i.test(r[0].nodeName),n=s&&e.ui.hasScroll(r[0],"left")?0:a.sizeDiff.height,o=s?0:a.sizeDiff.width,d={width:a.size.width-o,height:a.size.height-n},l=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null,u=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(d,u&&l?{top:u,left:l}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};r&&r.length&&e(r[0]).css({width:i.width,height:i.height}),a._updateCache(i),a._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var a,i,r,s,n,o,d,l=e(this).data("ui-resizable"),u=l.options,h=l.element,c=u.containment,m=c instanceof e?c.get(0):/parent/.test(c)?h.parent().get(0):c;m&&(l.containerElement=e(m),/document/.test(c)||c===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(a=e(m),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,r){i[e]=t(a.css("padding"+r))}),l.containerOffset=a.offset(),l.containerPosition=a.position(),l.containerSize={height:a.innerHeight()-i[3],width:a.innerWidth()-i[1]},r=l.containerOffset,s=l.containerSize.height,n=l.containerSize.width,o=e.ui.hasScroll(m,"left")?m.scrollWidth:n,d=e.ui.hasScroll(m)?m.scrollHeight:s,l.parentData={element:m,left:r.left,top:r.top,width:o,height:d}))},resize:function(t){var a,i,r,s,n=e(this).data("ui-resizable"),o=n.options,d=n.containerOffset,l=n.position,u=n._aspectRatio||t.shiftKey,h={top:0,left:0},c=n.containerElement;c[0]!==document&&/static/.test(c.css("position"))&&(h=d),l.left<(n._helper?d.left:0)&&(n.size.width=n.size.width+(n._helper?n.position.left-d.left:n.position.left-h.left),u&&(n.size.height=n.size.width/n.aspectRatio),n.position.left=o.helper?d.left:0),l.top<(n._helper?d.top:0)&&(n.size.height=n.size.height+(n._helper?n.position.top-d.top:n.position.top),u&&(n.size.width=n.size.height*n.aspectRatio),n.position.top=n._helper?d.top:0),n.offset.left=n.parentData.left+n.position.left,n.offset.top=n.parentData.top+n.position.top,a=Math.abs((n._helper?n.offset.left-h.left:n.offset.left-h.left)+n.sizeDiff.width),i=Math.abs((n._helper?n.offset.top-h.top:n.offset.top-d.top)+n.sizeDiff.height),r=n.containerElement.get(0)===n.element.parent().get(0),s=/relative|absolute/.test(n.containerElement.css("position")),r&&s&&(a-=n.parentData.left),a+n.size.width>=n.parentData.width&&(n.size.width=n.parentData.width-a,u&&(n.size.height=n.size.width/n.aspectRatio)),i+n.size.height>=n.parentData.height&&(n.size.height=n.parentData.height-i,u&&(n.size.width=n.size.height*n.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),a=t.options,i=t.containerOffset,r=t.containerPosition,s=t.containerElement,n=e(t.helper),o=n.offset(),d=n.outerWidth()-t.sizeDiff.width,l=n.outerHeight()-t.sizeDiff.height;t._helper&&!a.animate&&/relative/.test(s.css("position"))&&e(this).css({left:o.left-r.left-i.left,width:d,height:l}),t._helper&&!a.animate&&/static/.test(s.css("position"))&&e(this).css({left:o.left-r.left-i.left,width:d,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),a=t.options,i=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof a.alsoResize||a.alsoResize.parentNode?i(a.alsoResize):a.alsoResize.length?(a.alsoResize=a.alsoResize[0],i(a.alsoResize)):e.each(a.alsoResize,function(e){i(e)})},resize:function(t,a){var i=e(this).data("ui-resizable"),r=i.options,s=i.originalSize,n=i.originalPosition,o={height:i.size.height-s.height||0,width:i.size.width-s.width||0,top:i.position.top-n.top||0,left:i.position.left-n.left||0},d=function(t,i){e(t).each(function(){var t=e(this),r=e(this).data("ui-resizable-alsoresize"),s={},n=i&&i.length?i:t.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(n,function(e,t){var a=(r[t]||0)+(o[t]||0);a&&a>=0&&(s[t]=a||null)}),t.css(s)})};"object"!=typeof r.alsoResize||r.alsoResize.nodeType?d(r.alsoResize):e.each(r.alsoResize,function(e,t){d(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),a=t.options,i=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof a.ghost?a.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),a=t.options,i=t.size,r=t.originalSize,s=t.originalPosition,n=t.axis,o="number"==typeof a.grid?[a.grid,a.grid]:a.grid,d=o[0]||1,l=o[1]||1,u=Math.round((i.width-r.width)/d)*d,h=Math.round((i.height-r.height)/l)*l,c=r.width+u,m=r.height+h,p=a.maxWidth&&c>a.maxWidth,f=a.maxHeight&&m>a.maxHeight,g=a.minWidth&&a.minWidth>c,y=a.minHeight&&a.minHeight>m;a.grid=o,g&&(c+=d),y&&(m+=l),p&&(c-=d),f&&(m-=l),/^(se|s|e)$/.test(n)?(t.size.width=c,t.size.height=m):/^(ne)$/.test(n)?(t.size.width=c,t.size.height=m,t.position.top=s.top-h):/^(sw)$/.test(n)?(t.size.width=c,t.size.height=m,t.position.left=s.left-u):(t.size.width=c,t.size.height=m,t.position.top=s.top-h,t.position.left=s.left-u)}})})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("
    ")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,a=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(a.filter,this.element[0]),this._trigger("start",t),e(a.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),a.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var a=e.data(this,"selectable-item");a.startselected=!0,t.metaKey||t.ctrlKey||(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,i._trigger("unselecting",t,{unselecting:a.element}))}),e(t.target).parents().addBack().each(function(){var a,r=e.data(this,"selectable-item");return r?(a=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected"),r.$element.removeClass(a?"ui-unselecting":"ui-selected").addClass(a?"ui-selecting":"ui-unselecting"),r.unselecting=!a,r.selecting=a,r.selected=a,a?i._trigger("selecting",t,{selecting:r.element}):i._trigger("unselecting",t,{unselecting:r.element}),!1):undefined}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,a=this,r=this.options,s=this.opos[0],n=this.opos[1],o=t.pageX,d=t.pageY;return s>o&&(i=o,o=s,s=i),n>d&&(i=d,d=n,n=i),this.helper.css({left:s,top:n,width:o-s,height:d-n}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==a.element[0]&&("touch"===r.tolerance?l=!(i.left>o||s>i.right||i.top>d||n>i.bottom):"fit"===r.tolerance&&(l=i.left>s&&o>i.right&&i.top>n&&d>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,a._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),a._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,a._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-unselecting"),a.unselecting=!1,a.startselected=!1,i._trigger("unselected",t,{unselected:a.element})}),e(".ui-selecting",this.element[0]).each(function(){var a=e.data(this,"selectable-item");a.$element.removeClass("ui-selecting").addClass("ui-selected"),a.selecting=!1,a.selected=!0,a.startselected=!0,i._trigger("selected",t,{selected:a.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}function i(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var a=null,r=!1,s=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,s.widgetName+"-item")===s?(a=e(this),!1):undefined}),e.data(t.target,s.widgetName+"-item")===s&&(a=e(t.target)),a?!this.options.handle||i||(e(this.options.handle,a).find("*").addBack().each(function(){this===t.target&&(r=!0)}),r)?(this.currentItem=a,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,a){var r,s,n=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),n.containment&&this._setContainment(),n.cursor&&"auto"!==n.cursor&&(s=this.document.find("body"),this.storedCursor=s.css("cursor"),s.css("cursor",n.cursor),this.storedStylesheet=e("").appendTo(s)),n.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",n.opacity)),n.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",n.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!a)for(r=this.containers.length-1;r>=0;r--)this.containers[r]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,a,r,s,n=this.options,o=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY=0;i--)if(a=this.items[i],r=a.item[0],s=this._intersectsWithPointer(a),s&&a.instance===this.currentContainer&&r!==this.currentItem[0]&&this.placeholder[1===s?"next":"prev"]()[0]!==r&&!e.contains(this.placeholder[0],r)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],r):!0)){if(this.direction=1===s?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(a))break;this._rearrange(t,a),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var a=this,r=this.placeholder.offset(),s=this.options.axis,n={};s&&"x"!==s||(n.left=r.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),s&&"y"!==s||(n.top=r.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(n,parseInt(this.options.revert,10)||500,function(){a._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&a.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!a.length&&t.key&&a.push(t.key+"="),a.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),a=[];return t=t||{},i.each(function(){a.push(e(t.item||this).attr(t.attribute||"id")||"")}),a},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,a=this.positionAbs.top,r=a+this.helperProportions.height,s=e.left,n=s+e.width,o=e.top,h=o+e.height,l=this.offset.click.top,d=this.offset.click.left,u="x"===this.options.axis||a+l>o&&h>a+l,c="y"===this.options.axis||t+d>s&&n>t+d,p=u&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>s&&n>i-this.helperProportions.width/2&&a+this.helperProportions.height/2>o&&h>r-this.helperProportions.height/2},_intersectsWithPointer:function(e){var i="x"===this.options.axis||t(this.positionAbs.top+this.offset.click.top,e.top,e.height),a="y"===this.options.axis||t(this.positionAbs.left+this.offset.click.left,e.left,e.width),r=i&&a,s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return r?this.floating?n&&"right"===n||"down"===s?2:1:s&&("down"===s?2:1):!1},_intersectsWithSides:function(e){var i=t(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),a=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?"right"===s&&a||"left"===s&&!a:r&&("down"===r&&i||"up"===r&&!i)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var i,a,r,s,n=[],o=[],h=this._connectWith();if(h&&t)for(i=h.length-1;i>=0;i--)for(r=e(h[i]),a=r.length-1;a>=0;a--)s=e.data(r[a],this.widgetFullName),s&&s!==this&&!s.options.disabled&&o.push([e.isFunction(s.options.items)?s.options.items.call(s.element):e(s.options.items,s.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),s]);for(o.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=o.length-1;i>=0;i--)o[i][0].each(function(){n.push(this)});return e(n)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,a,r,s,n,o,h,l,d=this.items,u=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(r=e(c[i]),a=r.length-1;a>=0;a--)s=e.data(r[a],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(u.push([e.isFunction(s.options.items)?s.options.items.call(s.element[0],t,{item:this.currentItem}):e(s.options.items,s.element),s]),this.containers.push(s));for(i=u.length-1;i>=0;i--)for(n=u[i][1],o=u[i][0],a=0,l=o.length;l>a;a++)h=e(o[a]),h.data(this.widgetName+"-item",n),d.push({item:h,instance:n,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,a,r,s;for(i=this.items.length-1;i>=0;i--)a=this.items[i],a.instance!==this.currentContainer&&this.currentContainer&&a.item[0]!==this.currentItem[0]||(r=this.options.toleranceElement?e(this.options.toleranceElement,a.item):a.item,t||(a.width=r.outerWidth(),a.height=r.outerHeight()),s=r.offset(),a.left=s.left,a.top=s.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)s=this.containers[i].element.offset(),this.containers[i].containerCache.left=s.left,this.containers[i].containerCache.top=s.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,a=t.options;a.placeholder&&a.placeholder.constructor!==String||(i=a.placeholder,a.placeholder={element:function(){var a=t.currentItem[0].nodeName.toLowerCase(),r=e("<"+a+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===a?t.currentItem.children().each(function(){e(" ",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(r)}):"img"===a&&r.attr("src",t.currentItem.attr("src")),i||r.css("visibility","hidden"),r},update:function(e,r){(!i||a.forcePlaceholderSize)&&(r.height()||r.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),r.width()||r.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(a.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),a.placeholder.update(t,t.placeholder)},_contactContainers:function(a){var r,s,n,o,h,l,d,u,c,p,m=null,f=null;for(r=this.containers.length-1;r>=0;r--)if(!e.contains(this.currentItem[0],this.containers[r].element[0]))if(this._intersectsWith(this.containers[r].containerCache)){if(m&&e.contains(this.containers[r].element[0],m.element[0]))continue;m=this.containers[r],f=r}else this.containers[r].containerCache.over&&(this.containers[r]._trigger("out",a,this._uiHash(this)),this.containers[r].containerCache.over=0);if(m)if(1===this.containers.length)this.containers[f].containerCache.over||(this.containers[f]._trigger("over",a,this._uiHash(this)),this.containers[f].containerCache.over=1);else{for(n=1e4,o=null,p=m.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",d=this.positionAbs[h]+this.offset.click[h],s=this.items.length-1;s>=0;s--)e.contains(this.containers[f].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(!p||t(this.positionAbs.top+this.offset.click.top,this.items[s].top,this.items[s].height))&&(u=this.items[s].item.offset()[h],c=!1,Math.abs(u-d)>Math.abs(u+this.items[s][l]-d)&&(c=!0,u+=this.items[s][l]),n>Math.abs(u-d)&&(n=Math.abs(u-d),o=this.items[s],this.direction=c?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[f])return;o?this._rearrange(a,o,null,!0):this._rearrange(a,null,this.containers[f].element,!0),this._trigger("change",a,this._uiHash()),this.containers[f]._trigger("change",a,this._uiHash(this)),this.currentContainer=this.containers[f],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[f]._trigger("over",a,this._uiHash(this)),this.containers[f].containerCache.over=1}},_createHelper:function(t){var i=this.options,a=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return a.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]),a[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!a[0].style.width||i.forceHelperSize)&&a.width(this.currentItem.width()),(!a[0].style.height||i.forceHelperSize)&&a.height(this.currentItem.height()),a},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,a,r=this.options;"parent"===r.containment&&(r.containment=this.helper[0].parentNode),("document"===r.containment||"window"===r.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===r.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===r.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(r.containment)||(t=e(r.containment)[0],i=e(r.containment).offset(),a="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(a?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(a?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var a="absolute"===t?1:-1,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(r[0].tagName);return{top:i.top+this.offset.relative.top*a+this.offset.parent.top*a-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():s?0:r.scrollTop())*a,left:i.left+this.offset.relative.left*a+this.offset.parent.left*a-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():s?0:r.scrollLeft())*a}},_generatePosition:function(t){var i,a,r=this.options,s=t.pageX,n=t.pageY,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(o[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.leftthis.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(n=this.containment[3]+this.offset.click.top)),r.grid&&(i=this.originalPageY+Math.round((n-this.originalPageY)/r.grid[1])*r.grid[1],n=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-r.grid[1]:i+r.grid[1]:i,a=this.originalPageX+Math.round((s-this.originalPageX)/r.grid[0])*r.grid[0],s=this.containment?a-this.offset.click.left>=this.containment[0]&&a-this.offset.click.left<=this.containment[2]?a:a-this.offset.click.left>=this.containment[0]?a-r.grid[0]:a+r.grid[0]:a)),{top:n-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:o.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:o.scrollLeft())}},_rearrange:function(e,t,i,a){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var r=this.counter;this._delay(function(){r===this.counter&&this.refreshPositions(!a)})},_clear:function(e,t){this.reverting=!1;var i,a=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&a.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||a.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(a.push(function(e){this._trigger("remove",e,this._uiHash())}),a.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),a.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)t||a.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(a.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),i=0;a.length>i;i++)a[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(i=0;a.length>i;i++)a[i].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})})(jQuery);(function(e){var t=0,i={},a={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",a.height=a.paddingTop=a.paddingBottom=a.borderTopWidth=a.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e(),content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),undefined):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t),undefined)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,a=this.headers.length,r=this.headers.index(t.target),s=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:s=this.headers[(r+1)%a];break;case i.LEFT:case i.UP:s=this.headers[(r-1+a)%a];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:s=this.headers[0];break;case i.END:s=this.headers[a-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,a=this.options,r=a.heightStyle,s=this.element.parent(),n=this.accordionId="ui-accordion-"+(this.element.attr("id")||++t);this.active=this._findActive(a.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(t){var i=e(this),a=i.attr("id"),r=i.next(),s=r.attr("id");a||(a=n+"-header-"+t,i.attr("id",a)),s||(s=n+"-panel-"+t,r.attr("id",s)),i.attr("aria-controls",s),r.attr("aria-labelledby",a)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(a.event),"fill"===r?(i=s.height(),this.element.siblings(":visible").each(function(){var t=e(this),a=t.css("position");"absolute"!==a&&"fixed"!==a&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===r&&(i=0,this.headers.next().each(function(){i=Math.max(i,e(this).css("height","").height())}).height(i))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,a=this.active,r=e(t.currentTarget),s=r[0]===a[0],n=s&&i.collapsible,o=n?e():r.next(),h=a.next(),l={oldHeader:a,oldPanel:h,newHeader:n?e():r,newPanel:o};t.preventDefault(),s&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=n?!1:this.headers.index(r),this.active=s?e():r,this._toggle(l),a.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&a.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),s||(r.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&r.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),r.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,a=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=a,this.options.animate?this._animate(i,a,t):(a.hide(),i.show(),this._toggleComplete(t)),a.attr({"aria-expanded":"false","aria-hidden":"true"}),a.prev().attr("aria-selected","false"),i.length&&a.length?a.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,r){var s,n,o,h=this,l=0,d=e.length&&(!t.length||e.index()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,i,a,s=this.element[0].nodeName.toLowerCase(),r="textarea"===s,n="input"===s;this.isMultiLine=r?!0:n?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[r||n?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return t=!0,a=!0,i=!0,undefined;t=!1,a=!1,i=!1;var r=e.ui.keyCode;switch(s.keyCode){case r.PAGE_UP:t=!0,this._move("previousPage",s);break;case r.PAGE_DOWN:t=!0,this._move("nextPage",s);break;case r.UP:t=!0,this._keyEvent("previous",s);break;case r.DOWN:t=!0,this._keyEvent("next",s);break;case r.ENTER:case r.NUMPAD_ENTER:this.menu.active&&(t=!0,s.preventDefault(),this.menu.select(s));break;case r.TAB:this.menu.active&&this.menu.select(s);break;case r.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(s),s.preventDefault());break;default:i=!0,this._searchTimeout(s)}},keypress:function(a){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&a.preventDefault(),undefined;if(!i){var s=e.ui.keyCode;switch(a.keyCode){case s.PAGE_UP:this._move("previousPage",a);break;case s.PAGE_DOWN:this._move("nextPage",a);break;case s.UP:this._keyEvent("previous",a);break;case s.DOWN:this._keyEvent("next",a)}}},input:function(e){return a?(a=!1,e.preventDefault(),undefined):(this._searchTimeout(e),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(e),this._change(e),undefined)}}),this._initSource(),this.menu=e("