From 4213f2436cd64339f4c0fd53bacef50645058777 Mon Sep 17 00:00:00 2001 From: mhweaver Date: Sun, 7 Aug 2011 10:32:38 +0300 Subject: [PATCH 01/70] Fix bug where clicking thumbnails would not cause the bar to open. --- src/redditContent.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/redditContent.js b/src/redditContent.js index 89d4849..f428469 100644 --- a/src/redditContent.js +++ b/src/redditContent.js @@ -43,8 +43,9 @@ function scrapeThingInfo(thing) { function thingClicked(e) { var a = e.target - if (a.nodeName != 'A' || !a.classList.contains('title')) { return } - + if (a.nodeName == 'IMG') { a = a.parentElement } + if (a.nodeName != 'A' || (!a.classList.contains('title') && !a.classList.contains('thumbnail'))) { return } + // Find the parent element of the clicked link that represents the entire thing. var el = a do { From e8c6b029f8de050a5ba448b0f3387036f21a330b Mon Sep 17 00:00:00 2001 From: mhweaver Date: Tue, 6 Mar 2012 19:16:20 -0500 Subject: [PATCH 02/70] Add preference for display on https pages. Merged with help from Justin Paupore . --- src/background.js | 54 ++++++++++++++++++++++++++++------------------- src/manifest.json | 2 +- src/options.html | 1 + 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/background.js b/src/background.js index 5a737a4..b9a4b81 100644 --- a/src/background.js +++ b/src/background.js @@ -4,6 +4,7 @@ function initOptions() { 'autoShowSelf': true, 'showTooltips': true, 'checkMail': true, + 'allowHttps': false } for (key in defaultOptions) { @@ -433,16 +434,14 @@ mailChecker = { } } -function setPageActionIcon(tab) { - if (/^http:\/\/.*/.test(tab.url)) { - var info = redditInfo.getURL(tab.url) - if (info) { - chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit.png'}) - } else { - chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit-inactive.png'}) - } +function setPageActionIcon(tab, info) { + var pattern = (localStorage['allowHttps'] == 'true') ? /^https?:\/\/.*/ : /^http:\/\/.*/ + if (pattern.test(tab.url)) { + var iconPath = info ? '/images/reddit.png' : '/images/reddit-inactive.png' + chrome.pageAction.setIcon({tabId:tab.id, path:iconPath}) chrome.pageAction.show(tab.id) - return info + } else { + chrome.pageAction.hide(tab.id) } } @@ -463,7 +462,7 @@ function onActionClicked(tab) { redditInfo.lookupURL(tab.url, true, function(info) { window.clearInterval(workingAnimation) - setPageActionIcon(tab) + setPageActionIcon(tab, info) delete workingPageActions[tab.id] if (info) { @@ -494,12 +493,15 @@ chrome.extension.onConnect.addListener(function(port) { case 'overlay': tabStatus.add(port) var tab = port.sender.tab, - info = setPageActionIcon(tab) + info = redditInfo.getURL(tab.url) + setPageActionIcon(tab, info) if (info) { if (localStorage['autoShow'] == 'false') { console.log('Auto-show disabled. Ignoring reddit page', info) } else if (localStorage['autoShowSelf'] == 'false' && info.is_self) { console.log('Ignoring self post', info) + } else if (localStorage['allowHttps'] == 'false' && /^https:\/\/.*/.test(tab.url)) { + console.log('Https page. Ignoring', info) } else if (barStatus.hidden[info.name]) { console.log('Bar was closed on this page. Ignoring.', info) } else { @@ -515,27 +517,35 @@ chrome.extension.onConnect.addListener(function(port) { }) window.addEventListener('storage', function(e) { - if (e.key == 'checkMail') { - if (e.newValue == 'true') { - mailChecker.start() - } else { - mailChecker.stop() - } + switch (e.key) { + case 'checkMail': + if (e.newValue == 'true') { + mailChecker.start() + } else { + mailChecker.stop() + } + break + case 'allowHttps': + setAllPageActionIcons() + break } }, false) // Show page action for existing tabs. -chrome.windows.getAll({populate:true}, function(wins) { - wins.forEach(function(win) { - win.tabs.forEach(function(tab) { - setPageActionIcon(tab) +function setAllPageActionIcons() { + chrome.windows.getAll({populate:true}, function(wins) { + wins.forEach(function(win) { + win.tabs.forEach(function(tab) { + setPageActionIcon(tab, redditInfo.getURL(tab.url)) + }) }) }) -}) +} initOptions() console.log('Shine loaded.') redditInfo.init() +setAllPageActionIcons() if (localStorage['checkMail'] == 'true') { mailChecker.start() } else { diff --git a/src/manifest.json b/src/manifest.json index c3efe24..03a1634 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -25,7 +25,7 @@ "js": ["debug.js", "redditContent.js"] }, { - "matches": ["http://*/*"], + "matches": ["http://*/*", "https://*/*"], "run_at": "document_start", "js": ["debug.js", "pageOverlay.js"], "css": ["pageOverlay.css"] diff --git a/src/options.html b/src/options.html index 813d9b0..eddbcaf 100644 --- a/src/options.html +++ b/src/options.html @@ -19,6 +19,7 @@

logoreddit companion options

  • +
  • From 1ed3b265786df1c989edbc16ae8a821b80fd94ff Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Tue, 26 Jun 2012 18:33:49 -0700 Subject: [PATCH 03/70] Add right padding to indented option groups. --- src/options.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options.css b/src/options.css index 024472b..a09c655 100644 --- a/src/options.css +++ b/src/options.css @@ -6,7 +6,7 @@ h1 > img { height:64px; padding-right:10px; vertical-align:middle; } #container a { color:#777; } #contents { margin:1em 0; border:1px solid #dedede; border-left:0; border-right:0; } #contents > section { margin:2em 0; } -section > .options { margin-top:.5em; padding-left:15px; } +section > .options { margin-top:.5em; padding:0 15px; } section > shinebar, section > .notification-demo { border-radius:5px; box-shadow: 0 1px 8px rgba(0,0,0,.75); } .notification-demo { position:relative; font-size:.8em; background:url(/images/reddit-mail.svg) white 10px 7px no-repeat; width:225px; padding:5px; padding-left:50px; } .notification-demo > .close { position:absolute; top:10px; right:10px; width:7px; height:7px; opacity:.5; } From 7985752cad7c2747bd1f1e4b256ba46f5b60e49d Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Tue, 26 Jun 2012 18:03:24 -0700 Subject: [PATCH 04/70] Display a disabled page action icon when applicable. --- src/background.js | 33 ++++-- src/images/reddit-disabled.png | Bin 0 -> 996 bytes src/images/reddit-disabled.svg | 203 +++++++++++++++++++++++++++++++++ 3 files changed, 228 insertions(+), 8 deletions(-) create mode 100644 src/images/reddit-disabled.png create mode 100644 src/images/reddit-disabled.svg diff --git a/src/background.js b/src/background.js index b9a4b81..d1a76f8 100644 --- a/src/background.js +++ b/src/background.js @@ -434,14 +434,31 @@ mailChecker = { } } +var protocolRe = /^(\w+):.*/ +function urlProtocol(url) { + var match = url && url.match(protocolRe) + return match && match[1] +} + function setPageActionIcon(tab, info) { - var pattern = (localStorage['allowHttps'] == 'true') ? /^https?:\/\/.*/ : /^http:\/\/.*/ - if (pattern.test(tab.url)) { - var iconPath = info ? '/images/reddit.png' : '/images/reddit-inactive.png' - chrome.pageAction.setIcon({tabId:tab.id, path:iconPath}) - chrome.pageAction.show(tab.id) - } else { - chrome.pageAction.hide(tab.id) + switch (urlProtocol(tab.url)) { + case 'https': + if (localStorage['allowHttps'] != 'true') { + chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit-disabled.png'}) + chrome.pageAction.setTitle({tabId:tab.id, title:'Companion is disabled on secure pages (enable in the options)'}) + chrome.pageAction.show(tab.id) + break + } + // Otherwise, fall through... + case 'http': + var iconPath = info ? '/images/reddit.png' : '/images/reddit-inactive.png' + chrome.pageAction.setIcon({tabId:tab.id, path:iconPath}) + chrome.pageAction.setTitle({tabId:tab.id, title:'Show reddit information'}) + chrome.pageAction.show(tab.id) + break + + default: + chrome.pageAction.hide(tab.id) } } @@ -500,7 +517,7 @@ chrome.extension.onConnect.addListener(function(port) { console.log('Auto-show disabled. Ignoring reddit page', info) } else if (localStorage['autoShowSelf'] == 'false' && info.is_self) { console.log('Ignoring self post', info) - } else if (localStorage['allowHttps'] == 'false' && /^https:\/\/.*/.test(tab.url)) { + } else if (localStorage['allowHttps'] == 'false' && urlProtocol(tab.url) == 'https') { console.log('Https page. Ignoring', info) } else if (barStatus.hidden[info.name]) { console.log('Bar was closed on this page. Ignoring.', info) diff --git a/src/images/reddit-disabled.png b/src/images/reddit-disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..c3e5ce9fe03973efb0bd157dd521600eca4c8e03 GIT binary patch literal 996 zcmVyD`)L!k(KyDR{+F4| zye@uPq?I=Gz}-CFJ-mC~IhQcT@IS#fceyi_XjZnyg`pU<0icXyqPF?4lxwT+LD69C&>E#t_t>`5dNE%o*FmHqvF z``+GO+uYn7x3aQAj*gBTvMhH3FxK+2r^#f}=5#u5$HvCK1@L5QYU-1#t1FYHX@n4> z8;!;?fXYKM0e}dg2tcZ8WC7qjK0da3z20j8I)ImGWICXw;F*<(dkGf~i<63X&wLX0w?(91b}U2>jaG+WI<^ z$uwFlmfs~w`VPQ1gfaH<=H})Xkx1mJ!C*jLU7c2`RJfj=9?s=*5xd1la(cJ`yk(m@Ep!otEUm&;}9?d`?<{5%^P8cG9r&H+gIe7-CpL>EO70De;x<(v@m zXwC>Bj8b|IATNp{1VO0y{r;Z;q<8=-&-356x3_9?vy^69DR;2{;RdLYYV;Qb{BdZ&y8Ltu{Rb2jB^S&S*4hJvcZ}2L=Xy0`LO> zkO#WFmrkdLmzS42&1N$n2m}lr9UZK(v5^8$0o2{y-5FD<6xrF?(G*2dW@ctiT3TAZ z0`TMC$pGM8UDy4wSgbuBkGEc4Ue@cnP9#avZ*Olop68j}Zhz(T`CfK+cfSA-1#te? z?2r5y0q_h!Cjg5q%a(jT-_YFLTxx1+x(1N1YLxj$V~xwv2%!95mue-e34Z`*)Ohs# S(!5^)0000 + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + From 3dda1cf78beb1e6c56abbb1ddd09796ab48d2852 Mon Sep 17 00:00:00 2001 From: sc0tt Date: Tue, 26 Jun 2012 18:30:29 -0700 Subject: [PATCH 05/70] Add configurable message notification hide delay. Merged with help from Justin Paupore . --- src/background.js | 10 +++++++++- src/options.css | 12 +++++++++--- src/options.html | 4 ++++ src/options.js | 17 +++++++++++++++++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/background.js b/src/background.js index d1a76f8..c04d022 100644 --- a/src/background.js +++ b/src/background.js @@ -4,7 +4,9 @@ function initOptions() { 'autoShowSelf': true, 'showTooltips': true, 'checkMail': true, - 'allowHttps': false + 'allowHttps': false, + 'notifyTimeout': false, + 'notifyTime': 30, } for (key in defaultOptions) { @@ -396,6 +398,12 @@ mailNotifier = { var n = this.notification = webkitNotifications.createNotification('images/reddit-mail.svg', title, text) + if (localStorage['notifyTimeout'] == 'true') { + setTimeout(function() { + n.cancel() + }, parseInt(localStorage['notifyTime'])*1000) + } + this.notification.onclick = function() { window.open('http://www.reddit.com/message/unread/') n.cancel() diff --git a/src/options.css b/src/options.css index a09c655..dfdd605 100644 --- a/src/options.css +++ b/src/options.css @@ -16,8 +16,14 @@ section > shinebar, section > .notification-demo { border-radius:5px; box-shadow .options li { list-style-type:none; } .options label { display: inline-block; font-weight:bold; cursor:pointer; } .options input[type="checkbox"] { cursor:pointer; } -shinebar, .notification-demo, section li { -webkit-transition-property:opacity; -webkit-transition-duration:.15s; } +.options input[type="number"] { width:50px; } +.options .finePrint { font-size:.7em; font-weight:bold; } +.options #notifyTime { margin-left:25px; width:425px; } +.options #numSeconds { border-bottom:1px dotted black; } +shinebar, .notification-demo, section li, #notifyTime { -webkit-transition-property:opacity; -webkit-transition-duration:.15s; } #contents shinebar, #contents section.bar li { opacity:.5; } #contents.autoShow shinebar, #contents.autoShow section.bar li, #contents section.bar li:first-child { opacity:1; } -#contents .notification-demo { opacity:.5; } -#contents.checkMail .notification-demo { opacity:1; } +#contents .notification-demo, #contents section.notifications li { opacity:.5; } +#contents.checkMail .notification-demo, #contents.checkMail section.notifications li, #contents section.notifications li:first-child { opacity:1; } +#notifyTime { opacity:.5; } +#contents.checkMail.notifyTimeout #notifyTime { opacity: 1; } diff --git a/src/options.html b/src/options.html index eddbcaf..fc8d9a7 100644 --- a/src/options.html +++ b/src/options.html @@ -32,6 +32,10 @@

    logoreddit companion options

    • +
    • + (adjust below)
      + +
    diff --git a/src/options.js b/src/options.js index e60a8a6..5b6f90a 100644 --- a/src/options.js +++ b/src/options.js @@ -20,4 +20,21 @@ $(document).ready(function() { localStorage[this.id] = value $('#contents').toggleClass(this.id, value) }) + + $('#notifyTime') + .val(localStorage['notifyTime']) + .change(function() { + var sec = parseInt($(this).val()) + if (isNaN(sec)) { + sec = 30 + } else if (sec > 300) { + sec = 300 + } else if (sec < 10) { + sec = 10 + } + localStorage[$(this).attr('id')] = sec + $('#numSeconds').text(sec) + }) + + $('#numSeconds').text(localStorage['notifyTime']) }) From 82e6607c8265283fe6495c23c860209c5302cd65 Mon Sep 17 00:00:00 2001 From: mhweaver Date: Wed, 7 Mar 2012 18:52:20 -0500 Subject: [PATCH 06/70] Add option to hide page action icon. Merged with help from Justin Paupore . --- src/background.js | 11 ++++++++++- src/options.css | 2 +- src/options.html | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/background.js b/src/background.js index c04d022..44349b5 100644 --- a/src/background.js +++ b/src/background.js @@ -7,6 +7,7 @@ function initOptions() { 'allowHttps': false, 'notifyTimeout': false, 'notifyTime': 30, + 'showPageAction': true } for (key in defaultOptions) { @@ -449,6 +450,11 @@ function urlProtocol(url) { } function setPageActionIcon(tab, info) { + if (localStorage['showPageAction'] != 'true') { + chrome.pageAction.hide(tab.id) + return + } + switch (urlProtocol(tab.url)) { case 'https': if (localStorage['allowHttps'] != 'true') { @@ -551,6 +557,7 @@ window.addEventListener('storage', function(e) { } break case 'allowHttps': + case 'showPageAction': setAllPageActionIcons() break } @@ -570,7 +577,9 @@ function setAllPageActionIcons() { initOptions() console.log('Shine loaded.') redditInfo.init() -setAllPageActionIcons() +if (localStorage['showPageAction'] == 'true') { + setAllPageActionIcons() +} if (localStorage['checkMail'] == 'true') { mailChecker.start() } else { diff --git a/src/options.css b/src/options.css index dfdd605..c6823da 100644 --- a/src/options.css +++ b/src/options.css @@ -22,7 +22,7 @@ section > shinebar, section > .notification-demo { border-radius:5px; box-shadow .options #numSeconds { border-bottom:1px dotted black; } shinebar, .notification-demo, section li, #notifyTime { -webkit-transition-property:opacity; -webkit-transition-duration:.15s; } #contents shinebar, #contents section.bar li { opacity:.5; } -#contents.autoShow shinebar, #contents.autoShow section.bar li, #contents section.bar li:first-child { opacity:1; } +#contents.autoShow shinebar, #contents.autoShow section.bar li, #contents section.bar .autoShowLine, #contents section.bar .showPageActionLine { opacity:1; } #contents .notification-demo, #contents section.notifications li { opacity:.5; } #contents.checkMail .notification-demo, #contents.checkMail section.notifications li, #contents section.notifications li:first-child { opacity:1; } #notifyTime { opacity:.5; } diff --git a/src/options.html b/src/options.html index fc8d9a7..38beae9 100644 --- a/src/options.html +++ b/src/options.html @@ -16,7 +16,8 @@

    logoreddit companion options

      -
    • +
    • +
    • From c54ded1f72aba4c504bc1c19e8f3b5965aa4742d Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Tue, 26 Jun 2012 19:27:56 -0700 Subject: [PATCH 07/70] Reorder and reword bar opening options. --- src/options.css | 2 +- src/options.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/options.css b/src/options.css index c6823da..c4c0882 100644 --- a/src/options.css +++ b/src/options.css @@ -22,7 +22,7 @@ section > shinebar, section > .notification-demo { border-radius:5px; box-shadow .options #numSeconds { border-bottom:1px dotted black; } shinebar, .notification-demo, section li, #notifyTime { -webkit-transition-property:opacity; -webkit-transition-duration:.15s; } #contents shinebar, #contents section.bar li { opacity:.5; } -#contents.autoShow shinebar, #contents.autoShow section.bar li, #contents section.bar .autoShowLine, #contents section.bar .showPageActionLine { opacity:1; } +#contents.autoShow shinebar, #contents.autoShow section.bar li, #contents section.bar .autoShowLine, #contents section.bar .showPageActionLine, #contents section.bar .allowHttpsLine { opacity:1; } #contents .notification-demo, #contents section.notifications li { opacity:.5; } #contents.checkMail .notification-demo, #contents.checkMail section.notifications li, #contents section.notifications li:first-child { opacity:1; } #notifyTime { opacity:.5; } diff --git a/src/options.html b/src/options.html index 38beae9..3e2ee21 100644 --- a/src/options.html +++ b/src/options.html @@ -17,10 +17,10 @@

      logoreddit companion options

      • -
      • -
      • +
      • +
      • +
      • -
      From 93dc47606d0b8f64a3001bb0dee03972ef1a5e54 Mon Sep 17 00:00:00 2001 From: mhweaver Date: Wed, 7 Mar 2012 18:56:21 -0500 Subject: [PATCH 08/70] Fix bug where submission title truncated (fixes #25). Merged with help from Justin Paupore . --- src/submit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/submit.js b/src/submit.js index 7b60dcb..b62e5ae 100644 --- a/src/submit.js +++ b/src/submit.js @@ -18,7 +18,7 @@ function randomMsg() { $(document).ready(function() { $(window).resize(fitHeight) - $('#title-input').keypress(function(e) { + $('#title-input').keyup(function(e) { updateTarget() if (e.which == 13) { window.top.location = $('#submit').attr('href') From 77175ebc7c2c70da8fa278d8cdec953f68b80149 Mon Sep 17 00:00:00 2001 From: mhweaver Date: Tue, 26 Jun 2012 19:45:19 -0700 Subject: [PATCH 09/70] Add option to not display message content in notifications. Merged with help from Justin Paupore . --- src/background.js | 10 ++++++++-- src/options.html | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/background.js b/src/background.js index 44349b5..b38c542 100644 --- a/src/background.js +++ b/src/background.js @@ -7,6 +7,7 @@ function initOptions() { 'allowHttps': false, 'notifyTimeout': false, 'notifyTime': 30, + 'notifyMessageContents': true, 'showPageAction': true } @@ -372,8 +373,13 @@ mailNotifier = { var title, text if (newCount == 1) { var message = messages[newIdx] - title = message.data.author + ': ' + message.data.subject - text = message.data.body + if (localStorage['notifyMessageContents'] == 'true') { + title = message.data.author + ': ' + message.data.subject + text = message.data.body + } else { + title = 'reddit: new message!' + text = 'You have a new message.' + } } else if (newCount > 1) { title = 'reddit: new messages!' text = 'You have ' + messages.length + ' new messages.' diff --git a/src/options.html b/src/options.html index 3e2ee21..f38c448 100644 --- a/src/options.html +++ b/src/options.html @@ -37,6 +37,7 @@

      logoreddit companion options

      (adjust below)
    • +
    From 0cb3fb624d29aa63f301fd4ec2fa564c11bd845c Mon Sep 17 00:00:00 2001 From: Justin Paupore Date: Wed, 7 Mar 2012 19:11:24 -0500 Subject: [PATCH 10/70] Center companion options on screen. --- src/options.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/options.css b/src/options.css index c4c0882..7ff16d4 100644 --- a/src/options.css +++ b/src/options.css @@ -1,5 +1,7 @@ -html, body { margin:0; font-family:sans-serif; color:#222; } -#container { margin-left:auto; margin-right:auto; width:500px; background: #f1f1f1; margin-top:200px; border:2px solid #bbb; border-radius:10px; padding:20px; -webkit-user-select:none; } +html, body { margin:0; font-family:sans-serif; color:#222; width:100%; height:100%; } +html { display: table; } +body { display: table-cell; vertical-align: middle; } +#container { margin-left:auto; margin-right:auto; width:500px; background: #f1f1f1; border:2px solid #bbb; border-radius:10px; padding:20px; -webkit-user-select:none; vertical-align:middle; overflow:auto; } h1 { text-align:center; font-size:1.5em; margin:0; margin-top:10px; } h1 > img { height:64px; padding-right:10px; vertical-align:middle; } #container > p { margin:0; } From a036641714ad93dbc15fc6e5cef8734e657ed807 Mon Sep 17 00:00:00 2001 From: Justin Paupore Date: Wed, 7 Mar 2012 19:13:52 -0500 Subject: [PATCH 11/70] Add option to close tab / go back after voting. --- src/background.js | 10 ++++++++++ src/bar.js | 15 ++++++++++----- src/options.html | 1 + src/pageOverlay.js | 7 +++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/background.js b/src/background.js index b38c542..2d10942 100644 --- a/src/background.js +++ b/src/background.js @@ -217,6 +217,7 @@ tabStatus = { tabData = {port:port} console.log('Tab added', tabId) this.tabId[tabId] = tabData + port.onMessage.addListener(this.handleCommand.bind(this, tabId)) port.onDisconnect.addListener(this.remove.bind(this, tabId)) }, @@ -266,6 +267,15 @@ tabStatus = { this.send(tabId, { action: 'showSubmit' }) + }, + + handleCommand: function(tabId, msg) { + console.log('Received message from tab', tabId, msg) + switch (msg.action) { + case 'closeTab': + chrome.tabs.remove(tabId) + break + } } } diff --git a/src/bar.js b/src/bar.js index 024c068..8e6d51f 100644 --- a/src/bar.js +++ b/src/bar.js @@ -10,11 +10,16 @@ function likeDelta(likes) { } } -function vote(likes) { +function vote(likes, shift) { info.score += likeDelta(likes) - likeDelta(info.likes) info.likes = likes update() port.postMessage({action:'vote', likes:info.likes}) + // If closeOnVote set, close unless shift is pressed. + // If unset, close if shift is pressed. + if (!!localStorage['closeOnVote'] != !!shift) { + msgJSON({action:'closeByVote'}) + } } function toggleSaved() { @@ -77,12 +82,12 @@ function initButtons() { if (buttonsReady || info._fake) { return } $('#comments').attr('href', 'http://www.reddit.com'+info.permalink) - $('#upvote').click(function() { - vote(info.likes == true ? null : true) + $('#upvote').click(function(evt) { + vote(info.likes == true ? null : true, evt.shiftKey) }) - $('#downvote').click(function() { - vote(info.likes == false ? null : false) + $('#downvote').click(function(evt) { + vote(info.likes == false ? null : false, evt.shiftKey) }) $('#save').click(function() { diff --git a/src/options.html b/src/options.html index f38c448..ed23667 100644 --- a/src/options.html +++ b/src/options.html @@ -21,6 +21,7 @@

    logoreddit companion options

  • +
  • diff --git a/src/pageOverlay.js b/src/pageOverlay.js index 547c68f..b5d6417 100644 --- a/src/pageOverlay.js +++ b/src/pageOverlay.js @@ -82,6 +82,13 @@ window.addEventListener('message', function(e) { case 'close': removeBar() break + case 'closeByVote': + if (window.history.length > 1) { + window.history.go(-1) + } else { + port.postMessage({action:'closeTab'}) + } + break } } }, false) From b316abb226026927855733b1a07d0990fda166d3 Mon Sep 17 00:00:00 2001 From: Justin Paupore Date: Thu, 30 Aug 2012 22:09:09 -0700 Subject: [PATCH 12/70] Add modmail notifications & refactor notification code. --- src/background.js | 166 +++++++++++++++++++++++++++++++++++----------- src/options.html | 1 + 2 files changed, 129 insertions(+), 38 deletions(-) diff --git a/src/background.js b/src/background.js index 2d10942..0af6b0d 100644 --- a/src/background.js +++ b/src/background.js @@ -4,6 +4,7 @@ function initOptions() { 'autoShowSelf': true, 'showTooltips': true, 'checkMail': true, + 'checkModMail': true, 'allowHttps': false, 'notifyTimeout': false, 'notifyTime': 30, @@ -62,6 +63,7 @@ redditInfo = { if (resp.data) { console.log('Updated reddit user data', resp.data) this.storeModhash(resp.data.modhash) + this.storeUsername(resp.data.name) if (callback) { callback(resp.data) } } }.bind(this), @@ -69,9 +71,11 @@ redditInfo = { }) }, - fetchMail: function(callback) { + fetchMail: function(callback, isModMail) { this.request({ - url: 'http://www.reddit.com/message/unread.json', + url: isModMail ? + 'http://www.reddit.com/message/moderator.json' : + 'http://www.reddit.com/message/unread.json', success: function(resp) { if (resp.data) { callback(resp.data.children) @@ -201,11 +205,16 @@ redditInfo = { }, init: function() { + this.user = localStorage['username'] this.modhash = localStorage['modhash'] }, storeModhash: function(modhash) { localStorage['modhash'] = this.modhash = modhash + }, + + storeUsername: function(username) { + localStorage['username'] = this.user = username } } @@ -363,58 +372,110 @@ barStatus = { } } -mailNotifier = { - lastSeen: null, - notify: function(messages) { +Notifier.prototype = { + url: null, + image: null, + title: null, + text: null, + localStorageKey: null, + lastSeen: 0, + notification: null, + /* + * Returned object: + * count: Number of new messages + * title: Title of first new message, or null + * body: Body of first new message, or null + * time: The most recent message timestamp among + * this message and any of its children. + */ + processMessage: function(message, since) { + var data = message.data + var rv = { + count: 0, + title: null, + body: null, + time: since + } + + if (data.replies) { + rv = this.processMessageList(data.replies.data.children, since) + } + + if (data.author != redditInfo.user && data.created_utc > since) { + rv.count++ + rv.title = data.author + ': ' + data.subject + rv.body = data.body + rv.time = Math.max(rv.time, data.created_utc) + console.log('New message: ', data) + } + + return rv + }, + + processMessageList: function(messages, since) { + var rv = { + count: 0, + title: null, + body: null, + time: since + } + + for (var i = 0; i < messages.length; i++) { + var messageData = this.processMessage(messages[i], since) + rv.count += messageData.count + rv.title = rv.title || messageData.title + rv.body = rv.body || messageData.body + rv.time = Math.max(rv.time, messageData.time) + } + + return rv + }, + + + notify: function(messages, force) { var newIdx = null, - lastSeen = this.lastSeen, + lastSeen = force ? this.lastSeen - 1 : this.lastSeen, newCount = 0 - for (i = 0; i < messages.length; i++) { - var messageTime = messages[i].data.created_utc*1000 - if (!lastSeen || messageTime > lastSeen) { - newCount++ - if (!newIdx) { newIdx = i } - this.lastSeen = Math.max(this.lastSeen, messageTime) - } - } - console.log('New messages: ', newCount) + var data = this.processMessageList(messages, lastSeen) + + localStorage[this.localStorageKey] = this.lastSeen = data.time + + console.log('New messages: ', data.count) var title, text - if (newCount == 1) { - var message = messages[newIdx] - if (localStorage['notifyMessageContents'] == 'true') { - title = message.data.author + ': ' + message.data.subject - text = message.data.body - } else { + if (data.count > 1) { + title = this.title + text = this.text.replace('{count}', data.count) + } else if (data.count == 1) { + if (localStorage['notificationPrivacy'] == 'true') { title = 'reddit: new message!' text = 'You have a new message.' + } else { + title = data.title + text = data.body } - } else if (newCount > 1) { - title = 'reddit: new messages!' - text = 'You have ' + messages.length + ' new messages.' + } else { + return } - if (newCount > 0) { - this.showNotification(title, text) - } + this.showNotification(title, text) }, clear: function() { if (this.notification) { this.notification.cancel() } + + this.notification = null }, - notification: null, showNotification: function(title, text) { - if (this.notification) { - this.notification.cancel() - } + this.clear() var n = this.notification = - webkitNotifications.createNotification('images/reddit-mail.svg', title, text) - + webkitNotifications.createNotification(this.image, title, text) + if (localStorage['notifyTimeout'] == 'true') { setTimeout(function() { n.cancel() @@ -422,14 +483,37 @@ mailNotifier = { } this.notification.onclick = function() { - window.open('http://www.reddit.com/message/unread/') + window.open(this.url) n.cancel() - } + }.bind(this) this.notification.show() } } +function Notifier(url, image, title, text) { + this.url = url + this.image = image + this.title = title + this.text = text + this.localStorageKey = 'last-seen:'+url + this.lastSeen = parseFloat(localStorage[this.localStorageKey]) || 0 +} + +mailNotifier = new Notifier( + 'http://www.reddit.com/message/unread/', + 'images/reddit-mail.svg', + 'reddit: new messages!', + 'You have {count} new messages.' +) + +modmailNotifier = new Notifier( + 'http://www.reddit.com/message/moderator/', + 'images/reddit-mail.svg', + 'reddit: new modmail!', + 'You have {count} new moderator messages.' +) + mailChecker = { checkInterval: 5*60*1000, @@ -448,13 +532,19 @@ mailChecker = { this.interval = null } }, - check: function() { + check: function(force) { redditInfo.update(function(info) { - if (info.has_mail) { - redditInfo.fetchMail(mailNotifier.notify.bind(mailNotifier)) + if (info.has_mail || force) { + redditInfo.fetchMail(function(m) { mailNotifier.notify(m, force) }, false) } else { mailNotifier.clear() } + + if (localStorage.checkModMail == 'true' && (info.has_mod_mail || force)) { + redditInfo.fetchMail(function(m) { modmailNotifier.notify(m, force) }, true) + } else { + modmailNotifier.clear() + } }) } } diff --git a/src/options.html b/src/options.html index ed23667..3e04e3d 100644 --- a/src/options.html +++ b/src/options.html @@ -34,6 +34,7 @@

    logoreddit companion options

    • +
    • (adjust below)
      From bee6702068acad44cbd15e4a3a8700bf0e2cebf2 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Thu, 30 Aug 2012 22:26:14 -0700 Subject: [PATCH 13/70] Add modmail notification icon. --- src/background.js | 2 +- src/images/reddit-modmail.svg | 221 ++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 src/images/reddit-modmail.svg diff --git a/src/background.js b/src/background.js index 0af6b0d..6fd784c 100644 --- a/src/background.js +++ b/src/background.js @@ -509,7 +509,7 @@ mailNotifier = new Notifier( modmailNotifier = new Notifier( 'http://www.reddit.com/message/moderator/', - 'images/reddit-mail.svg', + 'images/reddit-modmail.svg', 'reddit: new modmail!', 'You have {count} new moderator messages.' ) diff --git a/src/images/reddit-modmail.svg b/src/images/reddit-modmail.svg new file mode 100644 index 0000000..5e98a9f --- /dev/null +++ b/src/images/reddit-modmail.svg @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + From d5bb87d5cd929379fb0f98363d210dc664a9f7a5 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Thu, 30 Aug 2012 22:33:02 -0700 Subject: [PATCH 14/70] Show all messages if notify forced. --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 6fd784c..f14813d 100644 --- a/src/background.js +++ b/src/background.js @@ -434,7 +434,7 @@ Notifier.prototype = { notify: function(messages, force) { var newIdx = null, - lastSeen = force ? this.lastSeen - 1 : this.lastSeen, + lastSeen = force ? 0 : this.lastSeen, newCount = 0 var data = this.processMessageList(messages, lastSeen) From b9766af3a59712cd2f033e0fd9d36c66c7518daa Mon Sep 17 00:00:00 2001 From: Justin Paupore Date: Mon, 3 Sep 2012 14:21:18 -0700 Subject: [PATCH 15/70] Rich markdown-formatted notifications. HTML notifications from marklr:master. --- src/background.js | 117 ++++++++++++++++++++++++++-------------------- src/mail.css | 10 ++++ src/mail.html | 20 ++++++++ src/mail.js | 21 +++++++++ 4 files changed, 118 insertions(+), 50 deletions(-) create mode 100644 src/mail.css create mode 100644 src/mail.html create mode 100644 src/mail.js diff --git a/src/background.js b/src/background.js index f14813d..9c53886 100644 --- a/src/background.js +++ b/src/background.js @@ -380,32 +380,36 @@ Notifier.prototype = { localStorageKey: null, lastSeen: 0, notification: null, - /* - * Returned object: - * count: Number of new messages - * title: Title of first new message, or null - * body: Body of first new message, or null - * time: The most recent message timestamp among - * this message and any of its children. - */ + + createDefaultValue: function(since) { + return { + count: 0, // Number of new messages, + time: since, // Most recent time among all messages found. + info: { // Information for the *most recent* message: + author: null, // Message author + subject: null, // Message subject + dest: null, // Message destination (typically you, but can be different for modmail) + body: null, // Message body (Markdown) + body_html: null, // Message body (HTML) + subreddit: null, // Message subreddit (set for replies/modmail, null for PMs) + } + } + }, + processMessage: function(message, since) { var data = message.data - var rv = { - count: 0, - title: null, - body: null, - time: since - } + var rv = this.createDefaultValue(since) if (data.replies) { rv = this.processMessageList(data.replies.data.children, since) } - if (data.author != redditInfo.user && data.created_utc > since) { + if (data.author != redditInfo.user && data.created_utc > rv.time) { rv.count++ - rv.title = data.author + ': ' + data.subject - rv.body = data.body - rv.time = Math.max(rv.time, data.created_utc) + rv.time = Math.max(rv.time, data.created_utc) + for (var i in rv.info) { + rv.info[i] = data[i] + } console.log('New message: ', data) } @@ -413,24 +417,51 @@ Notifier.prototype = { }, processMessageList: function(messages, since) { - var rv = { - count: 0, - title: null, - body: null, - time: since - } + var rv = this.createDefaultValue(since) for (var i = 0; i < messages.length; i++) { var messageData = this.processMessage(messages[i], since) + rv.count += messageData.count - rv.title = rv.title || messageData.title - rv.body = rv.body || messageData.body - rv.time = Math.max(rv.time, messageData.time) + if (rv.time < messageData.time) { + rv.time = messageData.time + rv.info = messageData.info + } } return rv }, + createNotification: function(data) { + var substPlural = function(text) { + return text.replace('{count}', data.count).replace('{s}', data.count > 1 ? 's' : '') + } + + var title, text, info, isRich = false + + if (data.count > 1) { + isRich = false + } else if (data.count == 1) { + isRich = (localStorage['notificationPrivacy'] != 'true') + } else { + return null + } + + if (isRich) { + return webkitNotifications.createHTMLNotification( + 'mail.html#'+JSON.stringify({ + image: this.image, + info: data.info + }) + ) + } else { + return webkitNotifications.createNotification( + this.image, + substPlural(this.title), + substPlural(this.text) + ) + } + }, notify: function(messages, force) { var newIdx = null, @@ -443,23 +474,11 @@ Notifier.prototype = { console.log('New messages: ', data.count) - var title, text - if (data.count > 1) { - title = this.title - text = this.text.replace('{count}', data.count) - } else if (data.count == 1) { - if (localStorage['notificationPrivacy'] == 'true') { - title = 'reddit: new message!' - text = 'You have a new message.' - } else { - title = data.title - text = data.body - } - } else { - return - } + var n = this.createNotification(data) - this.showNotification(title, text) + if (n) { + this.showNotification(n) + } }, clear: function() { @@ -470,12 +489,10 @@ Notifier.prototype = { this.notification = null }, - showNotification: function(title, text) { + showNotification: function(n) { this.clear() + this.notification = n - var n = this.notification = - webkitNotifications.createNotification(this.image, title, text) - if (localStorage['notifyTimeout'] == 'true') { setTimeout(function() { n.cancel() @@ -503,15 +520,15 @@ function Notifier(url, image, title, text) { mailNotifier = new Notifier( 'http://www.reddit.com/message/unread/', 'images/reddit-mail.svg', - 'reddit: new messages!', - 'You have {count} new messages.' + 'reddit: new message{s}!', + 'You have {count} new message{s}.' ) modmailNotifier = new Notifier( 'http://www.reddit.com/message/moderator/', 'images/reddit-modmail.svg', 'reddit: new modmail!', - 'You have {count} new moderator messages.' + 'You have {count} new moderator message{s}.' ) mailChecker = { diff --git a/src/mail.css b/src/mail.css new file mode 100644 index 0000000..1a9a671 --- /dev/null +++ b/src/mail.css @@ -0,0 +1,10 @@ +body { margin: 5px; font: normal small verdana, arial, helvetica, sans-serif; cursor: pointer; overflow: hidden; } +td { font-size: small; } +p { margin: 5px 2px; } +#text-cell > p:first-child { margin-top: 0 } +#img-cell { width: 18px; padding-right: 2px; } +#img-cell > img { margin-top: 1px; } +#from, #r.sr { font-weight: bold; } +#header { font-size: smaller; margin-bottom: 3px; } +#subject { font-weight: bold; } +.userlink { text-decoration: none; cursor: pointer; color: blue; } diff --git a/src/mail.html b/src/mail.html new file mode 100644 index 0000000..b9c3dcb --- /dev/null +++ b/src/mail.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + +
      + +
      +
      +
      +
      + + diff --git a/src/mail.js b/src/mail.js new file mode 100644 index 0000000..921c97b --- /dev/null +++ b/src/mail.js @@ -0,0 +1,21 @@ +$(document).ready(function() { + var data = JSON.parse(window.location.hash.substr(1)) + + window.scroll(0, 0) + + console.log('Received message data:', data) + + function expand(text) { + return unescape(text).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') + } + + $('#mail-image').attr('src', expand(data.image)) + $('#from').html(data.info.author) + if (data.info.subreddit) { + $('#r').html('/r/'+data.info.subreddit).addClass('sr') + } else { + $('#r').html('private message') + } + $('#subject').html(data.info.subject) + $('#body').html(expand(data.info.body_html)) +}) From 725e1ec90a9ffc56e5d564a9b520747fb30f3970 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 14:48:19 -0700 Subject: [PATCH 16/70] Refactor mail/modmail fetch functions. --- src/background.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/background.js b/src/background.js index 9c53886..8d5dcea 100644 --- a/src/background.js +++ b/src/background.js @@ -71,11 +71,9 @@ redditInfo = { }) }, - fetchMail: function(callback, isModMail) { + _fetchMail: function(url, callback) { this.request({ - url: isModMail ? - 'http://www.reddit.com/message/moderator.json' : - 'http://www.reddit.com/message/unread.json', + url: url, success: function(resp) { if (resp.data) { callback(resp.data.children) @@ -85,6 +83,14 @@ redditInfo = { }) }, + fetchMail: function(callback) { + this._fetchMail('http://www.reddit.com/message/unread.json', callback) + }, + + fetchModMail: function(callback) { + this._fetchMail('http://www.reddit.com/message/moderator.json', callback) + }, + _queryInfo: function(params, callback) { console.log('Performing AJAX info call for ', params) params.limit = 1 @@ -552,13 +558,13 @@ mailChecker = { check: function(force) { redditInfo.update(function(info) { if (info.has_mail || force) { - redditInfo.fetchMail(function(m) { mailNotifier.notify(m, force) }, false) + redditInfo.fetchMail(function(m) { mailNotifier.notify(m, force) }) } else { mailNotifier.clear() } if (localStorage.checkModMail == 'true' && (info.has_mod_mail || force)) { - redditInfo.fetchMail(function(m) { modmailNotifier.notify(m, force) }, true) + redditInfo.fetchModMail(function(m) { modmailNotifier.notify(m, force) }) } else { modmailNotifier.clear() } From 182d5fd73c88689fa119e1657622d50dc2fac924 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 15:18:25 -0700 Subject: [PATCH 17/70] Reorder Notifier functions. --- src/background.js | 53 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/background.js b/src/background.js index 8d5dcea..b926abc 100644 --- a/src/background.js +++ b/src/background.js @@ -378,6 +378,14 @@ barStatus = { } } +function Notifier(url, image, title, text) { + this.url = url + this.image = image + this.title = title + this.text = text + this.localStorageKey = 'last-seen:'+url + this.lastSeen = parseFloat(localStorage[this.localStorageKey]) || 0 +} Notifier.prototype = { url: null, image: null, @@ -438,6 +446,24 @@ Notifier.prototype = { return rv }, + notify: function(messages, force) { + var newIdx = null, + lastSeen = force ? 0 : this.lastSeen, + newCount = 0 + + var data = this.processMessageList(messages, lastSeen) + + localStorage[this.localStorageKey] = this.lastSeen = data.time + + console.log('New messages: ', data.count) + + var n = this.createNotification(data) + + if (n) { + this.showNotification(n) + } + }, + createNotification: function(data) { var substPlural = function(text) { return text.replace('{count}', data.count).replace('{s}', data.count > 1 ? 's' : '') @@ -469,24 +495,6 @@ Notifier.prototype = { } }, - notify: function(messages, force) { - var newIdx = null, - lastSeen = force ? 0 : this.lastSeen, - newCount = 0 - - var data = this.processMessageList(messages, lastSeen) - - localStorage[this.localStorageKey] = this.lastSeen = data.time - - console.log('New messages: ', data.count) - - var n = this.createNotification(data) - - if (n) { - this.showNotification(n) - } - }, - clear: function() { if (this.notification) { this.notification.cancel() @@ -514,15 +522,6 @@ Notifier.prototype = { } } -function Notifier(url, image, title, text) { - this.url = url - this.image = image - this.title = title - this.text = text - this.localStorageKey = 'last-seen:'+url - this.lastSeen = parseFloat(localStorage[this.localStorageKey]) || 0 -} - mailNotifier = new Notifier( 'http://www.reddit.com/message/unread/', 'images/reddit-mail.svg', From c0f26f99b9a1b81291b4678bf5ea4f1a959141b7 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 15:16:34 -0700 Subject: [PATCH 18/70] Don't auto-clear notifications when showing new ones. --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index b926abc..aa538ba 100644 --- a/src/background.js +++ b/src/background.js @@ -460,6 +460,7 @@ Notifier.prototype = { var n = this.createNotification(data) if (n) { + this.clear() this.showNotification(n) } }, @@ -504,7 +505,6 @@ Notifier.prototype = { }, showNotification: function(n) { - this.clear() this.notification = n if (localStorage['notifyTimeout'] == 'true') { From 64d2edf3319d7b6d3b09d476a0a545811a578f98 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 15:17:15 -0700 Subject: [PATCH 19/70] Replace "force" parameter with demo function. --- src/background.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/background.js b/src/background.js index aa538ba..efd721c 100644 --- a/src/background.js +++ b/src/background.js @@ -446,12 +446,11 @@ Notifier.prototype = { return rv }, - notify: function(messages, force) { + notify: function(messages) { var newIdx = null, - lastSeen = force ? 0 : this.lastSeen, newCount = 0 - var data = this.processMessageList(messages, lastSeen) + var data = this.processMessageList(messages, this.lastSeen) localStorage[this.localStorageKey] = this.lastSeen = data.time @@ -519,6 +518,24 @@ Notifier.prototype = { }.bind(this) this.notification.show() + }, + + demo: function() { + var data = { + count: 1, + time: Date.now(), + info: { + author: 'test_sender', + subject: 'test', + dest: 'tester', + body: 'hello! how are you?\n\n#heading 1\n##heading 2\n###heading 3\n####heading 4\n#####heading 5\n######heading 6\n\nhello, world!\n\n hello, code.\n\n*farewell.*', + body_html: '

      hello! how are you?

      heading 1

      \n\n

      heading 2

      \n\n

      heading 3

      \n\n

      heading 4

      \n\n
      heading 5
      \n\n
      heading 6
      \n\n

      hello, world!

      \n\n
      hello, code.\n
      \n\n

      farewell.

      \n
      ', + subreddit: 'test', + } + } + this.showNotification(this.createNotification(data)) + data.count = 2 + this.showNotification(this.createNotification(data)) } } @@ -554,16 +571,16 @@ mailChecker = { this.interval = null } }, - check: function(force) { + check: function() { redditInfo.update(function(info) { - if (info.has_mail || force) { - redditInfo.fetchMail(function(m) { mailNotifier.notify(m, force) }) + if (info.has_mail) { + redditInfo.fetchMail(mailNotifier.notify.bind(mailNotifier)) } else { mailNotifier.clear() } - if (localStorage.checkModMail == 'true' && (info.has_mod_mail || force)) { - redditInfo.fetchModMail(function(m) { modmailNotifier.notify(m, force) }) + if (localStorage.checkModMail == 'true' && info.has_mod_mail) { + redditInfo.fetchModMail(modmailNotifier.notify.bind(modmailNotifier)) } else { modmailNotifier.clear() } From edaa9db479caddee039fe9c2ce3f7d3d7e01f9df Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 15:42:45 -0700 Subject: [PATCH 20/70] Simplify recursive message traversal via a closure. --- src/background.js | 71 ++++++++++++++++------------------------------- src/mail.js | 10 +++---- 2 files changed, 29 insertions(+), 52 deletions(-) diff --git a/src/background.js b/src/background.js index efd721c..7c7f620 100644 --- a/src/background.js +++ b/src/background.js @@ -395,55 +395,34 @@ Notifier.prototype = { lastSeen: 0, notification: null, - createDefaultValue: function(since) { - return { - count: 0, // Number of new messages, - time: since, // Most recent time among all messages found. - info: { // Information for the *most recent* message: - author: null, // Message author - subject: null, // Message subject - dest: null, // Message destination (typically you, but can be different for modmail) - body: null, // Message body (Markdown) - body_html: null, // Message body (HTML) - subreddit: null, // Message subreddit (set for replies/modmail, null for PMs) - } - } - }, - - processMessage: function(message, since) { - var data = message.data - var rv = this.createDefaultValue(since) - - if (data.replies) { - rv = this.processMessageList(data.replies.data.children, since) - } - - if (data.author != redditInfo.user && data.created_utc > rv.time) { - rv.count++ - rv.time = Math.max(rv.time, data.created_utc) - for (var i in rv.info) { - rv.info[i] = data[i] + processMessageList: function(messages, since) { + var result = { + count: 0, + latest_message: { + created_utc: since } - console.log('New message: ', data) } - return rv - }, + function processMessages(messages) { + messages.forEach(function(message) { + var data = message.data - processMessageList: function(messages, since) { - var rv = this.createDefaultValue(since) - - for (var i = 0; i < messages.length; i++) { - var messageData = this.processMessage(messages[i], since) + if (data.author != redditInfo.user && data.created_utc > since) { + result.count++ + if (data.created_utc > result.latest_message.created_utc) { + result.latest_message = data + } + console.log('New message: ', data) + } - rv.count += messageData.count - if (rv.time < messageData.time) { - rv.time = messageData.time - rv.info = messageData.info - } + if (data.replies) { + rv = processMessages(data.replies.data.children) + } + }) } - return rv + processMessages(messages) + return result }, notify: function(messages) { @@ -451,8 +430,7 @@ Notifier.prototype = { newCount = 0 var data = this.processMessageList(messages, this.lastSeen) - - localStorage[this.localStorageKey] = this.lastSeen = data.time + localStorage[this.localStorageKey] = this.lastSeen = data.latest_message.created_utc console.log('New messages: ', data.count) @@ -483,7 +461,7 @@ Notifier.prototype = { return webkitNotifications.createHTMLNotification( 'mail.html#'+JSON.stringify({ image: this.image, - info: data.info + message: data.latest_message }) ) } else { @@ -523,8 +501,7 @@ Notifier.prototype = { demo: function() { var data = { count: 1, - time: Date.now(), - info: { + latest_message: { author: 'test_sender', subject: 'test', dest: 'tester', diff --git a/src/mail.js b/src/mail.js index 921c97b..c28d9ec 100644 --- a/src/mail.js +++ b/src/mail.js @@ -10,12 +10,12 @@ $(document).ready(function() { } $('#mail-image').attr('src', expand(data.image)) - $('#from').html(data.info.author) - if (data.info.subreddit) { - $('#r').html('/r/'+data.info.subreddit).addClass('sr') + $('#from').html(data.message.author) + if (data.message.subreddit) { + $('#r').html('/r/'+data.message.subreddit).addClass('sr') } else { $('#r').html('private message') } - $('#subject').html(data.info.subject) - $('#body').html(expand(data.info.body_html)) + $('#subject').html(data.message.subject) + $('#body').html(expand(data.message.body_html)) }) From 703cc7ab1fb9128eb37f023501ba7744128b094c Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 15:44:12 -0700 Subject: [PATCH 21/70] Delete empty Notifier defaults. --- src/background.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/background.js b/src/background.js index 7c7f620..b57d3ad 100644 --- a/src/background.js +++ b/src/background.js @@ -387,11 +387,6 @@ function Notifier(url, image, title, text) { this.lastSeen = parseFloat(localStorage[this.localStorageKey]) || 0 } Notifier.prototype = { - url: null, - image: null, - title: null, - text: null, - localStorageKey: null, lastSeen: 0, notification: null, From fea654581dc40e79dbb7080a36c889cfe1d14293 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 16:14:55 -0700 Subject: [PATCH 22/70] Tweak mail.css whitespace to match other files. --- src/mail.css | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mail.css b/src/mail.css index 1a9a671..7b439ad 100644 --- a/src/mail.css +++ b/src/mail.css @@ -1,10 +1,10 @@ -body { margin: 5px; font: normal small verdana, arial, helvetica, sans-serif; cursor: pointer; overflow: hidden; } -td { font-size: small; } -p { margin: 5px 2px; } -#text-cell > p:first-child { margin-top: 0 } -#img-cell { width: 18px; padding-right: 2px; } -#img-cell > img { margin-top: 1px; } -#from, #r.sr { font-weight: bold; } -#header { font-size: smaller; margin-bottom: 3px; } -#subject { font-weight: bold; } -.userlink { text-decoration: none; cursor: pointer; color: blue; } +body { margin:5px; font:normal small verdana, arial, helvetica, sans-serif; cursor:pointer; overflow:hidden; } +td { font-size:small; } +p { margin:5px 2px; } +#text-cell > p:first-child { margin-top:0 } +#img-cell { width:18px; padding-right:2px; } +#img-cell > img { margin-top:1px; } +#from, #r.sr { font-weight:bold; } +#header { font-size:smaller; margin-bottom:3px; } +#subject { font-weight:bold; } +.userlink { text-decoration:none; cursor:pointer; color:blue; } From 51dcd1263720cceb5f614ecdbd8ae52e60108f9d Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 16:19:59 -0700 Subject: [PATCH 23/70] Rename mail notification files. --- src/background.js | 2 +- src/{mail.css => mail-notification.css} | 0 src/{mail.html => mail-notification.html} | 4 ++-- src/{mail.js => mail-notification.js} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/{mail.css => mail-notification.css} (100%) rename src/{mail.html => mail-notification.html} (84%) rename src/{mail.js => mail-notification.js} (100%) diff --git a/src/background.js b/src/background.js index b57d3ad..faddbbe 100644 --- a/src/background.js +++ b/src/background.js @@ -454,7 +454,7 @@ Notifier.prototype = { if (isRich) { return webkitNotifications.createHTMLNotification( - 'mail.html#'+JSON.stringify({ + 'mail-notification.html#'+JSON.stringify({ image: this.image, message: data.latest_message }) diff --git a/src/mail.css b/src/mail-notification.css similarity index 100% rename from src/mail.css rename to src/mail-notification.css diff --git a/src/mail.html b/src/mail-notification.html similarity index 84% rename from src/mail.html rename to src/mail-notification.html index b9c3dcb..a4a706d 100644 --- a/src/mail.html +++ b/src/mail-notification.html @@ -1,8 +1,8 @@ - - + + diff --git a/src/mail.js b/src/mail-notification.js similarity index 100% rename from src/mail.js rename to src/mail-notification.js From 95a0881a54aea4592228338ba8c6e7f9e3539eec Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 16:21:05 -0700 Subject: [PATCH 24/70] Remove unnecessary tag closings. --- src/bar.html | 2 +- src/mail-notification.html | 2 +- src/options.html | 4 ++-- src/submit.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bar.html b/src/bar.html index 5b8b62b..693092c 100644 --- a/src/bar.html +++ b/src/bar.html @@ -1,7 +1,7 @@ - + diff --git a/src/mail-notification.html b/src/mail-notification.html index a4a706d..de1dfe1 100644 --- a/src/mail-notification.html +++ b/src/mail-notification.html @@ -2,7 +2,7 @@ - +
      diff --git a/src/options.html b/src/options.html index 3e04e3d..41d8425 100644 --- a/src/options.html +++ b/src/options.html @@ -4,8 +4,8 @@ - - + + reddit companion options diff --git a/src/submit.html b/src/submit.html index a3df487..8f7e68e 100644 --- a/src/submit.html +++ b/src/submit.html @@ -1,7 +1,7 @@ - + From bbf567ffcd6dae439e73b692cb13007f36690ce0 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 16:47:22 -0700 Subject: [PATCH 25/70] Clean up mail-notification.js. --- src/mail-notification.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/mail-notification.js b/src/mail-notification.js index c28d9ec..9b83b00 100644 --- a/src/mail-notification.js +++ b/src/mail-notification.js @@ -1,15 +1,13 @@ +function expand(text) { + return unescape(text).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') +} + $(document).ready(function() { var data = JSON.parse(window.location.hash.substr(1)) - window.scroll(0, 0) - console.log('Received message data:', data) - function expand(text) { - return unescape(text).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') - } - - $('#mail-image').attr('src', expand(data.image)) + $('#mail-image').attr('src', data.image) $('#from').html(data.message.author) if (data.message.subreddit) { $('#r').html('/r/'+data.message.subreddit).addClass('sr') From e1442ec349f945a16b1204a2bc4c2edb6bbea8b0 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 17:21:50 -0700 Subject: [PATCH 26/70] Make fitHeight() document generic. Also, remove 9999px initial draw step. --- src/bar.css | 2 +- src/utils.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bar.css b/src/bar.css index 81504e1..b8c6189 100644 --- a/src/bar.css +++ b/src/bar.css @@ -16,7 +16,7 @@ button#save span { background-image:url(/images/savegray.svg); padding-left:16px .saved button#save span { background-image:url(/images/save.svg); } button#login span { background-image:url(/images/login.svg); } -#bar { display:-webkit-box; width:9999px; color:#222; text-align:left; font-family:sans-serif; border-top-left-radius:5px; border-bottom-left-radius:5px; } +#bar { display:-webkit-box; color:#222; text-align:left; font-family:sans-serif; border-top-left-radius:5px; border-bottom-left-radius:5px; } #bar > * { display:-webkit-box; -webkit-box-align:center; vertical-align:middle; } #logo { width:19px; -webkit-box-align:stretch; padding:0 7px; text-align:center; background:url(/images/reddit.svg) no-repeat center center, -webkit-linear-gradient(90deg, rgba(0,0,0,.1), rgba(0,0,0,.05)); border-right:1px solid rgba(0,0,0,.1); } .liked #logo { background:url(/images/reddit.svg) no-repeat center center, -webkit-linear-gradient(90deg, rgba(255,139,96,.75), rgba(255,139,96,.35)); } diff --git a/src/utils.js b/src/utils.js index b10a5b6..bca1475 100644 --- a/src/utils.js +++ b/src/utils.js @@ -3,8 +3,7 @@ function msgJSON(request) { } function fitHeight() { - msgJSON({action:'height', height:$('#bar').height()}) - $('#bar').width('100%') + msgJSON({action:'height', height:document.body.offsetHeight}) } function getRandomInt(min, max) { From 2297ddb4511d485c582212b2b4472a3ffe3bd233 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 18:12:49 -0700 Subject: [PATCH 27/70] Update to manifest version 2. --- src/manifest.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/manifest.json b/src/manifest.json index 03a1634..651391e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,7 @@ { "name": "reddit companion", "version": "1.1.1", + "manifest_version": 2, "description": "Turn your browser into a redditor's best friend.", "options_page": "options.html", "permissions": [ @@ -13,11 +14,13 @@ "48" : "images/shine-48.png", "128" : "images/shine-128.png" }, + "background" : { + "page": "background.html" + }, "page_action": { "default_icon": "images/reddit.png", "default_title": "Show reddit information" }, - "background_page" : "background.html", "content_scripts": [ { "matches": ["http://*.reddit.com/*"], @@ -30,5 +33,11 @@ "js": ["debug.js", "pageOverlay.js"], "css": ["pageOverlay.css"] } + ], + "web_accessible_resources": [ + "bar.html", + "submit.html", + "images/reddit-mail.svg", + "images/reddit-modmail.svg" ] } From 66803570fdae437c2aec19bec7c3148c94bfcf01 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 20:37:01 -0700 Subject: [PATCH 28/70] Upgrade to jQuery 1.8. --- src/jquery.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/jquery.js b/src/jquery.js index b2ac174..f121291 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -1,18 +1,2 @@ -/*! - * jQuery JavaScript Library v1.6.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu May 12 15:04:36 2011 -0400 - */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
      a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
      ",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
      t
      ",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem -)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

      ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
      ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/",""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
      ","
      "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument|| -b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
      ").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
      ";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file +/*! jQuery v@1.8.0 jquery.com | jquery.org/license */ +(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
      a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
      t
      ",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
      ",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;jq&&u.push({elem:this,matches:o.slice(q)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;ai){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="
      ",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="

      ",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
      ","
      "]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
      ").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file From 4fb5bf22ac28b76a62e88661abdf5c76c4af6b01 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 20:57:14 -0700 Subject: [PATCH 29/70] Add a stricter CSP. --- src/manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/manifest.json b/src/manifest.json index 651391e..b1b9f4e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -9,6 +9,7 @@ "notifications", "http://*/*" ], + "content_security_policy": "default-src 'self'; connect-src 'self' http://www.reddit.com", "icons": { "16" : "images/shine-16.png", "48" : "images/shine-48.png", From fbbe43af9d3ff4a5bc79137c13eb6ff2e3539cb1 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 20:58:09 -0700 Subject: [PATCH 30/70] Add warning about CSP and unsafe message html. --- src/mail-notification.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mail-notification.js b/src/mail-notification.js index 9b83b00..07c12a0 100644 --- a/src/mail-notification.js +++ b/src/mail-notification.js @@ -15,5 +15,8 @@ $(document).ready(function() { $('#r').html('private message') } $('#subject').html(data.message.subject) + + // WARNING: this depends on the CSP to prevent unsafe-inline scripts in the + // body_html from executing. $('#body').html(expand(data.message.body_html)) }) From 3886ab52b695363da447a1edcd08693a41567238 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 20:59:04 -0700 Subject: [PATCH 31/70] Convert some unnecessary $.html to $.text. --- src/mail-notification.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mail-notification.js b/src/mail-notification.js index 07c12a0..694a54b 100644 --- a/src/mail-notification.js +++ b/src/mail-notification.js @@ -8,13 +8,13 @@ $(document).ready(function() { console.log('Received message data:', data) $('#mail-image').attr('src', data.image) - $('#from').html(data.message.author) + $('#from').text(data.message.author) if (data.message.subreddit) { - $('#r').html('/r/'+data.message.subreddit).addClass('sr') + $('#r').text('/r/'+data.message.subreddit).addClass('sr') } else { - $('#r').html('private message') + $('#r').text('private message') } - $('#subject').html(data.message.subject) + $('#subject').text(data.message.subject) // WARNING: this depends on the CSP to prevent unsafe-inline scripts in the // body_html from executing. From 6e5ecc666bcf9a3446fa29ab13b622c815a6afe2 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 21:03:59 -0700 Subject: [PATCH 32/70] Add CSS to mimic reddit message styling. --- src/mail-notification.css | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/mail-notification.css b/src/mail-notification.css index 7b439ad..4a72776 100644 --- a/src/mail-notification.css +++ b/src/mail-notification.css @@ -8,3 +8,37 @@ p { margin:5px 2px; } #header { font-size:smaller; margin-bottom:3px; } #subject { font-weight:bold; } .userlink { text-decoration:none; cursor:pointer; color:blue; } + +/* from reddit's /public/static/css/reddit.css */ +.md { font: normal x-small verdana, arial, helvetica, sans-serif; } +.md * { margin:0; padding:0; } +.md h1 { font-size: 18px; font-weight: normal; margin: 10px 0; } +.md h2 { color: #369; font-size: 13px; } +.md h2 a { text-decoration: none; } +.md h2 a:visited { color: #369; } +.md h2 a:hover { text-decoration: underline; } +.md h3 { font-size:110%; } +.md a img { border: 0 none; } +.md a { text-decoration: none; color: #369; } +.md { max-width: 60em; overflow: auto; font-size: small; } +.md p, .md h1 { margin: 5px 0; } +.md h1 { font-weight: normal; font-size: 100%; } +.md > * { margin-bottom: 0px; } +.md strong { font-weight: bold; } +.md em { font-style: italic; } +.md strong em { font-style: italic; font-weight: bold; } +.md img { display: none } +.md ol, .md ul { margin: 10px 2em; } +.md ul { list-style: disc outside } +.md ol { list-style: decimal outside } +.md pre { margin: 10px; } +.md blockquote, .help blockquote { + border-left: 2px solid #369; + padding-left: 4px; + margin: 5px; + margin-right: 15px; +} +.md td, .md th { border: 1px solid #EEE; padding: 1px 3px; } +.md th { font-weight: bold; } +.md table { margin: 5px 10px; } +.md center { text-align: left; } From ab9a3f6aa1d103c0c900749ab30f76e7b6c7fcf4 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 21:41:02 -0700 Subject: [PATCH 33/70] Style message notifications like the reddit inbox. --- src/background.js | 1 + src/mail-notification.css | 16 ++++++++-------- src/mail-notification.html | 31 +++++++++++++------------------ src/mail-notification.js | 5 +++-- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/background.js b/src/background.js index faddbbe..521e55d 100644 --- a/src/background.js +++ b/src/background.js @@ -455,6 +455,7 @@ Notifier.prototype = { if (isRich) { return webkitNotifications.createHTMLNotification( 'mail-notification.html#'+JSON.stringify({ + title: substPlural(this.title), image: this.image, message: data.latest_message }) diff --git a/src/mail-notification.css b/src/mail-notification.css index 4a72776..dfeb167 100644 --- a/src/mail-notification.css +++ b/src/mail-notification.css @@ -1,13 +1,13 @@ body { margin:5px; font:normal small verdana, arial, helvetica, sans-serif; cursor:pointer; overflow:hidden; } -td { font-size:small; } -p { margin:5px 2px; } -#text-cell > p:first-child { margin-top:0 } -#img-cell { width:18px; padding-right:2px; } -#img-cell > img { margin-top:1px; } +#icon { height:32px; width:32px; float:left; } +#title { font-weight:bold; } +#title, #subject { margin-left:38px; font-family:helvetica, arial, sans-serif; font-size:13px; } #from, #r.sr { font-weight:bold; } -#header { font-size:smaller; margin-bottom:3px; } -#subject { font-weight:bold; } -.userlink { text-decoration:none; cursor:pointer; color:blue; } +#from { color:#336699; } +#r { color:black; } +#divider { border:none; border-bottom:1px dotted #888; margin-bottom:.25em; } +#description { color:#888; font-size:x-small; } +.md { margin-left:15px; } /* from reddit's /public/static/css/reddit.css */ .md { font: normal x-small verdana, arial, helvetica, sans-serif; } diff --git a/src/mail-notification.html b/src/mail-notification.html index de1dfe1..0acf900 100644 --- a/src/mail-notification.html +++ b/src/mail-notification.html @@ -1,20 +1,15 @@ - - - - - - -
      - - - - -
      - -
      -
      -
      -
      - + + + + + + + +
      +
      +
      +
      from via :
      +
      + diff --git a/src/mail-notification.js b/src/mail-notification.js index 694a54b..630cb66 100644 --- a/src/mail-notification.js +++ b/src/mail-notification.js @@ -7,14 +7,15 @@ $(document).ready(function() { console.log('Received message data:', data) - $('#mail-image').attr('src', data.image) + $('#icon').attr('src', data.image) + $('#title').text(data.title) + $('#subject').text(data.message.subject) $('#from').text(data.message.author) if (data.message.subreddit) { $('#r').text('/r/'+data.message.subreddit).addClass('sr') } else { $('#r').text('private message') } - $('#subject').text(data.message.subject) // WARNING: this depends on the CSP to prevent unsafe-inline scripts in the // body_html from executing. From f3cde48b6dda1b5230774ef82f9977fe7391b36c Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 22:09:03 -0700 Subject: [PATCH 34/70] Load options page bar preview upon DOM ready. Apparently switching on CSP caused the iframe content to be unable to access chrome.extension. Loading the iframe after the options page DOM seems to work around this issue. --- src/options.html | 2 +- src/options.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/options.html b/src/options.html index 41d8425..a9c9a12 100644 --- a/src/options.html +++ b/src/options.html @@ -13,7 +13,7 @@

      logoreddit companion options

      - +
      • diff --git a/src/options.js b/src/options.js index 5b6f90a..3966742 100644 --- a/src/options.js +++ b/src/options.js @@ -1,4 +1,6 @@ $(document).ready(function() { + $('shinebar iframe').attr('src', chrome.extension.getURL('bar.html') + '#_shine_demo') + var messages = [ 'greetings, human.', 'someone is wrong on the internet!', From 339543178c6b5d29f4716d937142063c299add89 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 22:15:00 -0700 Subject: [PATCH 35/70] Move to the bottom of the DOM. --- src/bar.html | 8 ++++---- src/mail-notification.html | 4 ++-- src/options.html | 6 +++--- src/submit.html | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bar.html b/src/bar.html index 693092c..7a25ab9 100644 --- a/src/bar.html +++ b/src/bar.html @@ -2,10 +2,6 @@ - - - -
        @@ -20,5 +16,9 @@
      + + + + diff --git a/src/mail-notification.html b/src/mail-notification.html index 0acf900..fb5a5ea 100644 --- a/src/mail-notification.html +++ b/src/mail-notification.html @@ -1,7 +1,5 @@ - - @@ -11,5 +9,7 @@
      from via :
      + + diff --git a/src/options.html b/src/options.html index a9c9a12..a670670 100644 --- a/src/options.html +++ b/src/options.html @@ -1,9 +1,6 @@ - - - reddit companion options @@ -46,5 +43,8 @@

      logoreddit companion options

      Want to help decide on new features? Join /r/companion.

    + + + diff --git a/src/submit.html b/src/submit.html index 8f7e68e..3adcdde 100644 --- a/src/submit.html +++ b/src/submit.html @@ -2,10 +2,6 @@ - - - -
    @@ -16,5 +12,9 @@
    + + + + From 7a8a259d7046eafbe3716a51277da5300f20dad5 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 22:21:33 -0700 Subject: [PATCH 36/70] Set target="_blank" for /r/companion link. --- src/options.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options.html b/src/options.html index a670670..607a7ca 100644 --- a/src/options.html +++ b/src/options.html @@ -41,7 +41,7 @@

    logoreddit companion options

    -

    Want to help decide on new features? Join /r/companion.

    +

    Want to help decide on new features? Join /r/companion.

    From 017ad9817f962b003b7b20fbebcaf51cda0ca70d Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 22:25:45 -0700 Subject: [PATCH 37/70] Remove tooltips toggle option. --- src/background.js | 1 - src/bar.js | 7 +------ src/options.html | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/background.js b/src/background.js index 521e55d..4eb4549 100644 --- a/src/background.js +++ b/src/background.js @@ -2,7 +2,6 @@ function initOptions() { defaultOptions = { 'autoShow': true, 'autoShowSelf': true, - 'showTooltips': true, 'checkMail': true, 'checkModMail': true, 'allowHttps': false, diff --git a/src/bar.js b/src/bar.js index 8e6d51f..f4b0595 100644 --- a/src/bar.js +++ b/src/bar.js @@ -62,9 +62,7 @@ function update() { } else { $('#bar').removeClass('saved') } - if (localStorage['showTooltips'] != 'false') { - $('#save').attr('title', info.saved ? 'Unsave' : 'Save') - } + $('#save').attr('title', info.saved ? 'Unsave' : 'Save') $('#score').text(info.score) if (info.subreddit) { @@ -107,9 +105,6 @@ function initButtons() { } $(document).ready(function() { - if (localStorage['showTooltips'] == 'false') { - $('#bar *[title]').removeAttr('title') - } $(window).resize(fitHeight) }) diff --git a/src/options.html b/src/options.html index 607a7ca..bb77b08 100644 --- a/src/options.html +++ b/src/options.html @@ -17,7 +17,6 @@

    logoreddit companion options

  • -
  • From 65d98166f09004feee9f1d778c63537225866db8 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 22:34:03 -0700 Subject: [PATCH 38/70] Update submit button target on bar load. Fixes empty submit page issue. --- src/submit.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/submit.js b/src/submit.js index b62e5ae..6b1d0cf 100644 --- a/src/submit.js +++ b/src/submit.js @@ -30,5 +30,6 @@ $(document).ready(function() { }) randomMsg() + updateTarget() fitHeight() }) From ce740b43ee90810184683b962b7e469a95042eac Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 22:39:21 -0700 Subject: [PATCH 39/70] Clean up trailing whitespace. --- src/background.js | 22 +++++++++++----------- src/bar.js | 4 ++-- src/pageOverlay.js | 4 ++-- src/redditContent.js | 8 ++++---- src/submit.js | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/background.js b/src/background.js index 4eb4549..0128f91 100644 --- a/src/background.js +++ b/src/background.js @@ -36,7 +36,7 @@ redditInfo = { getURL: function(url) { return this.url[url] }, - + setURL: function(url, info) { info._ts = info._ts || Date.now() var stored = this.fullname[info.name] @@ -114,7 +114,7 @@ redditInfo = { error: function() { callback(false) } }) }, - + _storedLookup: function(keyName, key, array, useStored, callback) { // Internal rate limited cached info getter. // @@ -142,7 +142,7 @@ redditInfo = { console.log('Info already being fetched. Skipping update.', stored) return false } - + storedAge = Math.floor((now - stored._ts) / 1000) if (storedAge < redditInfo.freshAgeThreshold) { console.log('Info is', storedAge, 'seconds old. Skipping update.', stored) @@ -172,7 +172,7 @@ redditInfo = { _thingAction: function(action, data, callback) { if (!this.isLoggedIn()) { callback(false, 'not logged in') } - + data.uh = this.modhash this.request({ type: 'POST', @@ -192,7 +192,7 @@ redditInfo = { } else { dir = 0 } - + this._thingAction('vote', {id:fullname, dir:dir}, callback) }, @@ -203,7 +203,7 @@ redditInfo = { unsave: function(fullname, callback) { this._thingAction('unsave', {id:fullname}, callback) }, - + isLoggedIn: function() { // TODO: check for cookie return this.modhash != null && this.modhash != '' @@ -213,7 +213,7 @@ redditInfo = { this.user = localStorage['username'] this.modhash = localStorage['modhash'] }, - + storeModhash: function(modhash) { localStorage['modhash'] = this.modhash = modhash }, @@ -264,7 +264,7 @@ tabStatus = { fullname: fullname }) }, - + updateTab: function(tabId) { var tabData = this.tabId[tabId] if (tabData && tabData.bar) { @@ -336,7 +336,7 @@ barStatus = { }) }.bind(this)) }, - + updateInfo: function(info) { if (this.fullname[info.name]) { this.fullname[info.name].forEach(function(barData) { @@ -607,12 +607,12 @@ function onActionClicked(tab) { } frame = (frame + 1) % 6 }, 200) - + redditInfo.lookupURL(tab.url, true, function(info) { window.clearInterval(workingAnimation) setPageActionIcon(tab, info) delete workingPageActions[tab.id] - + if (info) { tabStatus.showInfo(tab.id, info.name) } else { diff --git a/src/bar.js b/src/bar.js index f4b0595..215bf34 100644 --- a/src/bar.js +++ b/src/bar.js @@ -36,7 +36,7 @@ function update() { initButtons() $('#title').text(info.title) - + if (loggedIn) { $('#bar').removeClass('logged-out').addClass('logged-in') } else { @@ -79,7 +79,7 @@ function update() { function initButtons() { if (buttonsReady || info._fake) { return } $('#comments').attr('href', 'http://www.reddit.com'+info.permalink) - + $('#upvote').click(function(evt) { vote(info.likes == true ? null : true, evt.shiftKey) }) diff --git a/src/pageOverlay.js b/src/pageOverlay.js index b5d6417..2f583f4 100644 --- a/src/pageOverlay.js +++ b/src/pageOverlay.js @@ -21,7 +21,7 @@ ShineOverlay.prototype = { this.overlay.appendChild(this.frame) document.documentElement.appendChild(this.overlay) }, - + setHeight: function(height) { if (height) { this.overlay.style.height = height @@ -36,7 +36,7 @@ ShineOverlay.prototype = { }.bind(this)) this.setHeight(0) }, - + _display: function(url) { this.frame.setAttribute('src', chrome.extension.getURL(url)) }, diff --git a/src/redditContent.js b/src/redditContent.js index f428469..59eb428 100644 --- a/src/redditContent.js +++ b/src/redditContent.js @@ -6,7 +6,7 @@ function scrapeThingInfo(thing) { return false; } info.name = fullnameMatch[1]; - + info.title = thing.querySelector('a.title').innerText; var entry = thing.querySelector('.entry'), @@ -25,16 +25,16 @@ function scrapeThingInfo(thing) { info.saved = thing.classList.contains('saved') info.score = parseInt(thing.querySelector('.score'+scoreClass).innerText) - + info.subreddit = (thing.querySelector('a.subreddit') || document.querySelector('.redditname > a')).innerText info.num_comments = parseInt(thing.querySelector('.comments').innerText) || 0 info.permalink = thing.querySelector('.comments').href.match(/.*reddit.com(\/.+)/)[1] - + info.domain = thing.querySelector('.domain > a').innerText info.is_self = info.domain == ('self.' + info.subreddit) - + info._ts = pageTimestamp console.log('Scraped info from page:', info) diff --git a/src/submit.js b/src/submit.js index 6b1d0cf..e126667 100644 --- a/src/submit.js +++ b/src/submit.js @@ -24,7 +24,7 @@ $(document).ready(function() { window.top.location = $('#submit').attr('href') } }) - + $('#close').click(function() { msgJSON({action:'close'}) }) From c07bb52a9e27075bc545ec4f8cc3f2a2c9d2e735 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 3 Sep 2012 23:05:57 -0700 Subject: [PATCH 40/70] Update NEWS. --- NEWS | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NEWS b/NEWS index 8e36b81..a00f8d0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +== Version 1.2.0 == +* Display markdown formatting in notifications. [marklr + blueshiftlabs] +* Add modmail notifications. [blueshiftlabs] +* Add option to close tab / go back after voting. [blueshiftlabs] +* Add option to not display message content in notifications. [mhweaver] +* Add option to hide page action icon. [mhweaver] +* Add configurable message notification timeouts. [sc0tt] +* Add preference to display bar on https pages. [mhweaver] +* Fix bug where clicking thumbnails wouldn't open bar. [mhweaver] +* Fix bug where submission title is truncated. [mhweaver] +* Fix bug where clicking the submit button didn't fill in the URL. [chromakode] +* Add strict CSP for extra security. [chromakode] +* Update internal jQuery to 1.8.0. [chromakode] +* Update to latest Chrome manifest style. [chromakode] + == Version 1.1.1 == * Use canonical www. prefix when linking to reddit.com. [chromakode] From d0eb88f47c895fb222f2f2f8213dd1fed4940423 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Thu, 6 Sep 2012 23:49:29 -0700 Subject: [PATCH 41/70] Spiffy up the notifications a bit. Prevent scroll bars by clipping and fading long messages. --- src/mail-notification.css | 7 +++++-- src/mail-notification.html | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mail-notification.css b/src/mail-notification.css index dfeb167..decba06 100644 --- a/src/mail-notification.css +++ b/src/mail-notification.css @@ -2,12 +2,15 @@ body { margin:5px; font:normal small verdana, arial, helvetica, sans-serif; curs #icon { height:32px; width:32px; float:left; } #title { font-weight:bold; } #title, #subject { margin-left:38px; font-family:helvetica, arial, sans-serif; font-size:13px; } +#subject { width:250px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; } #from, #r.sr { font-weight:bold; } #from { color:#336699; } #r { color:black; } -#divider { border:none; border-bottom:1px dotted #888; margin-bottom:.25em; } +#divider { border:none; border-bottom:1px dashed #bbb; margin-bottom:.25em; width:100%; } #description { color:#888; font-size:x-small; } -.md { margin-left:15px; } +#body { max-height:75px; overflow:hidden; } +.md { margin-left:15px; margin-right:5px; } +#fade { position:absolute; left:0; right:0; top:100px; bottom:0px; box-shadow:0 -47px 34px -27px white inset; } /* from reddit's /public/static/css/reddit.css */ .md { font: normal x-small verdana, arial, helvetica, sans-serif; } diff --git a/src/mail-notification.html b/src/mail-notification.html index fb5a5ea..ffe5515 100644 --- a/src/mail-notification.html +++ b/src/mail-notification.html @@ -9,6 +9,7 @@
    from via :
    +
    From 2feb2d5329d8ae3e84738bb1a7a4849697effcaf Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 00:03:54 -0700 Subject: [PATCH 42/70] Expand HTML entities in the bar title. --- src/bar.js | 2 +- src/mail-notification.html | 1 + src/mail-notification.js | 4 ---- src/utils.js | 4 ++++ 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bar.js b/src/bar.js index 215bf34..a1fcdd3 100644 --- a/src/bar.js +++ b/src/bar.js @@ -35,7 +35,7 @@ function toggleSaved() { function update() { initButtons() - $('#title').text(info.title) + $('#title').text(expand(info.title)) if (loggedIn) { $('#bar').removeClass('logged-out').addClass('logged-in') diff --git a/src/mail-notification.html b/src/mail-notification.html index ffe5515..8e52f98 100644 --- a/src/mail-notification.html +++ b/src/mail-notification.html @@ -11,6 +11,7 @@
    + diff --git a/src/mail-notification.js b/src/mail-notification.js index 630cb66..a9a47be 100644 --- a/src/mail-notification.js +++ b/src/mail-notification.js @@ -1,7 +1,3 @@ -function expand(text) { - return unescape(text).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') -} - $(document).ready(function() { var data = JSON.parse(window.location.hash.substr(1)) diff --git a/src/utils.js b/src/utils.js index bca1475..1cd9441 100644 --- a/src/utils.js +++ b/src/utils.js @@ -14,3 +14,7 @@ function getRandomInt(min, max) { function randomChoice(items) { return items[getRandomInt(0, items.length-1)] } + +function expand(text) { + return unescape(text).replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&') +} From 685cfb2b4b7fb61ff5b5bcb3f7809dca73243950 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 00:11:08 -0700 Subject: [PATCH 43/70] jQuery 1.8.1. --- src/jquery.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jquery.js b/src/jquery.js index f121291..e7f2a29 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -1,2 +1,2 @@ -/*! jQuery v@1.8.0 jquery.com | jquery.org/license */ -(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
    a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
    t
    ",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
    ",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;jq&&u.push({elem:this,matches:o.slice(q)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;ai){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="
    ",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="

    ",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
    ","
    "]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
    ").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file +/*! jQuery v@1.8.1 jquery.com | jquery.org/license */ +(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.1",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
    a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
    t
    ",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
    ",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j=0),h[l]&&j.push(k);j.length&&t.push({elem:f,matches:j})}n.length>o&&t.push({elem:this,matches:n.slice(o)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function $(a,b,c,d){c=c||[],b=b||q;var e,f,g,j,k=b.nodeType;if(k!==1&&k!==9)return[];if(!a||typeof a!="string")return c;g=h(b);if(!g&&!d)if(e=L.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&i(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return u.apply(c,t.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&X&&b.getElementsByClassName)return u.apply(c,t.call(b.getElementsByClassName(j),0)),c}return bk(a,b,c,d,g)}function _(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function ba(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bb(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bc(a,b,c,d){var e,g,h,i,j,k,l,m,n,p,r=!c&&b!==q,s=(r?"":"")+a.replace(H,"$1"),u=y[o][s];if(u)return d?0:t.call(u,0);j=a,k=[],m=0,n=f.preFilter,p=f.filter;while(j){if(!e||(g=I.exec(j)))g&&(j=j.slice(g[0].length),h.selector=l),k.push(h=[]),l="",r&&(j=" "+j);e=!1;if(g=J.exec(j))l+=g[0],j=j.slice(g[0].length),e=h.push({part:g.pop().replace(H," "),string:g[0],captures:g});for(i in p)(g=S[i].exec(j))&&(!n[i]||(g=n[i](g,b,c)))&&(l+=g[0],j=j.slice(g[0].length),e=h.push({part:i,string:g.shift(),captures:g}));if(!e)break}return l&&(h.selector=l),d?j.length:j?$.error(a):t.call(y(s,k),0)}function bd(a,b,e,f){var g=b.dir,h=s++;return a||(a=function(a){return a===e}),b.first?function(b){while(b=b[g])if(b.nodeType===1)return a(b)&&b}:f?function(b){while(b=b[g])if(b.nodeType===1&&a(b))return b}:function(b){var e,f=h+"."+c,i=f+"."+d;while(b=b[g])if(b.nodeType===1){if((e=b[o])===i)return b.sizset;if(typeof e=="string"&&e.indexOf(f)===0){if(b.sizset)return b}else{b[o]=i;if(a(b))return b.sizset=!0,b;b.sizset=!1}}}}function be(a,b){return a?function(c){var d=b(c);return d&&a(d===!0?c:d)}:b}function bf(a,b,c){var d,e,g=0;for(;d=a[g];g++)f.relative[d.part]?e=bd(e,f.relative[d.part],b,c):e=be(e,f.filter[d.part].apply(null,d.captures.concat(b,c)));return e}function bg(a){return function(b){var c,d=0;for(;c=a[d];d++)if(c(b))return!0;return!1}}function bh(a,b,c,d){var e=0,f=b.length;for(;e0?i(h,c,g):[]}function bj(a,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s=0,t=a.length,v=S.POS,w=new RegExp("^"+v.source+"(?!"+A+")","i"),x=function(){var a=1,c=arguments.length-2;for(;al){g+=k.slice(l,n.index),l=p,q=[c],J.test(g)&&(m&&(q=m),m=e);if(r=O.test(g))g=g.slice(0,-5).replace(J,"$&*"),l++;n.length>1&&n[0].replace(w,x),m=bi(g,n[1],n[2],q,m,r)}g=""}}o||(g+=k),o=!1}g?J.test(g)?bh(g,m||[c],d,e):$(g,c,d,e?e.concat(m):m):u.apply(d,m)}return t===1?d:$.uniqueSort(d)}function bk(a,b,e,g,h){a=a.replace(H,"$1");var i,k,l,m,n,o,p,q,r,s,v=bc(a,b,h),w=b.nodeType;if(S.POS.test(a))return bj(v,b,e,g);if(g)i=t.call(g,0);else if(v.length===1){if((o=t.call(v[0],0)).length>2&&(p=o[0]).part==="ID"&&w===9&&!h&&f.relative[o[1].part]){b=f.find.ID(p.captures[0].replace(R,""),b,h)[0];if(!b)return e;a=a.slice(o.shift().string.length)}r=(v=N.exec(o[0].string))&&!v.index&&b.parentNode||b,q="";for(n=o.length-1;n>=0;n--){p=o[n],s=p.part,q=p.string+q;if(f.relative[s])break;if(f.order.test(s)){i=f.find[s](p.captures[0].replace(R,""),r,h);if(i==null)continue;a=a.slice(0,a.length-q.length)+q.replace(S[s],""),a||u.apply(e,t.call(i,0));break}}}if(a){k=j(a,b,h),c=k.dirruns++,i==null&&(i=f.find.TAG("*",N.test(a)&&b.parentNode||b));for(n=0;m=i[n];n++)d=k.runs++,k(m)&&e.push(m)}return e}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=a.document,r=q.documentElement,s=0,t=[].slice,u=[].push,v=function(a,b){return a[o]=b||!0,a},w=function(){var a={},b=[];return v(function(c,d){return b.push(c)>f.cacheLength&&delete a[b.shift()],a[c]=d},a)},x=w(),y=w(),z=w(),A="[\\x20\\t\\r\\n\\f]",B="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",C=B.replace("w","w#"),D="([*^$|!~]?=)",E="\\["+A+"*("+B+")"+A+"*(?:"+D+A+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+C+")|)|)"+A+"*\\]",F=":("+B+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+E+")|[^:]|\\\\.)*|.*))\\)|)",G=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",H=new RegExp("^"+A+"+|((?:^|[^\\\\])(?:\\\\.)*)"+A+"+$","g"),I=new RegExp("^"+A+"*,"+A+"*"),J=new RegExp("^"+A+"*([\\x20\\t\\r\\n\\f>+~])"+A+"*"),K=new RegExp(F),L=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,M=/^:not/,N=/[\x20\t\r\n\f]*[+~]/,O=/:not\($/,P=/h\d/i,Q=/input|select|textarea|button/i,R=/\\(?!\\)/g,S={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),NAME:new RegExp("^\\[name=['\"]?("+B+")['\"]?\\]"),TAG:new RegExp("^("+B.replace("w","w*")+")"),ATTR:new RegExp("^"+E),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+A+"*(even|odd|(([+-]|)(\\d*)n|)"+A+"*(?:([+-]|)"+A+"*(\\d+)|))"+A+"*\\)|)","i"),POS:new RegExp(G,"ig"),needsContext:new RegExp("^"+A+"*[>+~]|"+G,"i")},T=function(a){var b=q.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},U=T(function(a){return a.appendChild(q.createComment("")),!a.getElementsByTagName("*").length}),V=T(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),W=T(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),X=T(function(a){return a.innerHTML="",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),Y=T(function(a){a.id=o+0,a.innerHTML="
    ",r.insertBefore(a,r.firstChild);var b=q.getElementsByName&&q.getElementsByName(o).length===2+q.getElementsByName(o+0).length;return e=!q.getElementById(o),r.removeChild(a),b});try{t.call(r.childNodes,0)[0].nodeType}catch(Z){t=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}$.matches=function(a,b){return $(a,null,null,b)},$.matchesSelector=function(a,b){return $(b,null,null,[a]).length>0},g=$.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=g(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=g(b);return c},h=$.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},i=$.contains=r.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:r.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},$.attr=function(a,b){var c,d=h(a);return d||(b=b.toLowerCase()),f.attrHandle[b]?f.attrHandle[b](a):W||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},f=$.selectors={cacheLength:50,createPseudo:v,match:S,order:new RegExp("ID|TAG"+(Y?"|NAME":"")+(X?"|CLASS":"")),attrHandle:V?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:e?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:U?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(R,""),a[3]=(a[4]||a[5]||"").replace(R,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||$.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&$.error(a[0]),a},PSEUDO:function(a,b,c){var d,e;if(S.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(d=a[4])K.test(d)&&(e=bc(d,b,c,!0))&&(e=d.indexOf(")",d.length-e)-d.length)&&(d=d.slice(0,e),a[0]=a[0].slice(0,e)),a[2]=d;return a.slice(0,3)}},filter:{ID:e?function(a){return a=a.replace(R,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(R,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(R,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=x[o][a];return b||(b=x(a,new RegExp("(^|"+A+")"+a+"("+A+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=$.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return $.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=s++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[o]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[o]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e,g=f.pseudos[a]||f.pseudos[a.toLowerCase()];return g||$.error("unsupported pseudo: "+a),g[o]?g(b,c,d):g.length>1?(e=[a,a,"",b],function(a){return g(a,0,e)}):g}},pseudos:{not:v(function(a,b,c){var d=j(a.replace(H,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!f.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:v(function(a){return function(b){return(b.textContent||b.innerText||g(b)).indexOf(a)>-1}}),has:v(function(a){return function(b){return $(a,b).length>0}}),header:function(a){return P.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:_("radio"),checkbox:_("checkbox"),file:_("file"),password:_("password"),image:_("image"),submit:ba("submit"),reset:ba("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return Q.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e",a.querySelectorAll("[selected]").length||e.push("\\["+A+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="

    ",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+A+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bk=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return u.apply(f,t.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j,k,l,m=d.getAttribute("id"),n=m||o,p=N.test(a)&&d.parentNode||d;m?n=n.replace(c,"\\$&"):d.setAttribute("id",n),j=bc(a,d,h),n="[id='"+n+"']";for(k=0,l=j.length;k0})}(),f.setFilters.nth=f.setFilters.eq,f.filters=f.pseudos,$.attr=p.attr,p.find=$,p.expr=$.selectors,p.expr[":"]=p.expr.pseudos,p.unique=$.uniqueSort,p.text=$.getText,p.isXMLDoc=$.isXML,p.contains=$.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
    ","
    "]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{cj=f.href}catch(cy){cj=e.createElement("a"),cj.href="",cj=cj.href}ck=ct.exec(cj.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
    ").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:cj,isLocal:cn.test(ck[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,ck[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==ck[1]&&i[2]==ck[2]&&(i[3]||(i[1]==="http:"?80:443))==(ck[3]||(ck[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cQ.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file From baaabe3e7b266fb3846ae1294280ceaeeccc2f32 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 00:12:07 -0700 Subject: [PATCH 44/70] Update NEWS. --- NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a00f8d0..396cf55 100644 --- a/NEWS +++ b/NEWS @@ -9,8 +9,9 @@ * Fix bug where clicking thumbnails wouldn't open bar. [mhweaver] * Fix bug where submission title is truncated. [mhweaver] * Fix bug where clicking the submit button didn't fill in the URL. [chromakode] +* Fix bug where HTML entities appeared in bar titles. [chromakode] * Add strict CSP for extra security. [chromakode] -* Update internal jQuery to 1.8.0. [chromakode] +* Update internal jQuery to 1.8.1. [chromakode] * Update to latest Chrome manifest style. [chromakode] == Version 1.1.1 == From 94621db7e0a26d13c44febcd286cec3c35c12edc Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 00:13:24 -0700 Subject: [PATCH 45/70] Whitespace. --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 0128f91..e6affd3 100644 --- a/src/background.js +++ b/src/background.js @@ -210,7 +210,7 @@ redditInfo = { }, init: function() { - this.user = localStorage['username'] + this.user = localStorage['username'] this.modhash = localStorage['modhash'] }, From 511f7385f15ea452c8a570f4aedf59b2b99104a2 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 16:57:06 -0700 Subject: [PATCH 46/70] Remove dead code. --- src/background.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/background.js b/src/background.js index e6affd3..941d045 100644 --- a/src/background.js +++ b/src/background.js @@ -244,7 +244,6 @@ tabStatus = { remove: function(tabId) { console.log('Tab removed', tabId) - var fullname = this.tabId[tabId].fullname delete this.tabId[tabId] }, From 473e94ca38fb33e2258813315574e3b83332d697 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 17:03:18 -0700 Subject: [PATCH 47/70] Remove unnecessary if statement. --- src/background.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/background.js b/src/background.js index 941d045..1ffa83f 100644 --- a/src/background.js +++ b/src/background.js @@ -303,9 +303,7 @@ barStatus = { this.fullname[fullname] = [] } this.fullname[fullname].push(barData) - if (this.hidden[barData.fullname]) { - delete this.hidden[barData.fullname] - } + delete this.hidden[barData.fullname] port.onMessage.addListener(this.handleCommand.bind(this, barData)) port.onDisconnect.addListener(this.remove.bind(this, barData)) tabStatus.addBar(port.sender.tab.id, barData) From 9116ae8cd24f68476b8ae957de3b0f6f1670332a Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 16:59:30 -0700 Subject: [PATCH 48/70] Isolate https page access into an optional permission. This commit resurrects the old programmatic injection of the page overlay, which we must do for https pages since the content script no longer matches them. It also consolidates the various UI updates upon tab change / load into tabStatus.updateTab. --- src/background.js | 75 +++++++++++++++++++++++++++++++++++++++++++---- src/manifest.json | 5 +++- src/options.html | 2 +- src/options.js | 29 ++++++++++++++++-- 4 files changed, 101 insertions(+), 10 deletions(-) diff --git a/src/background.js b/src/background.js index 1ffa83f..9f7b60d 100644 --- a/src/background.js +++ b/src/background.js @@ -223,13 +223,61 @@ redditInfo = { } } +function addContent(tab, files, callback) { + var startTime = Date.now() + + function injectNext() { + var fileInfo = files.shift() + if (fileInfo) { + var extension = fileInfo.file.match(/\.\w+$/) + extension = extension && extension[0] + + console.log('Injecting', fileInfo.file, fileInfo) + if (extension == '.js') { + var inject = chrome.tabs.executeScript + } else if (extension == '.css') { + var inject = chrome.tabs.insertCSS + } else { + throw "Invalid file extension." + } + + inject(tab.id, fileInfo, function() { + injectNext() + }) + } else { + console.log("Content injection took", Date.now() - startTime, 'ms') + if (callback) { callback() } + } + } + + injectNext() +} + +function addOverlayContent(tab, callback) { + addContent(tab, [ + {file:'pageOverlay.css', runAt:'document_start'}, + {file:'debug.js', runAt:'document_start'}, + {file:'pageOverlay.js', runAt:'document_start'} + ], callback) +} + tabStatus = { tabId: {}, + injecting: {}, + + ensureOverlay: function(tab) { + var needsOverlay = localStorage['allowHttps'] == 'true' && urlProtocol(tab.url) == 'https' + if (needsOverlay && !(tab.id in this.tabId) && !(tab.id in this.injecting)) { + this.injecting[tab.id] = true + addOverlayContent(tab) + } + }, add: function(port) { var tabId = port.sender.tab.id, tabData = {port:port} console.log('Tab added', tabId) + delete this.injecting[tabId] this.tabId[tabId] = tabData port.onMessage.addListener(this.handleCommand.bind(this, tabId)) port.onDisconnect.addListener(this.remove.bind(this, tabId)) @@ -264,8 +312,19 @@ tabStatus = { }) }, - updateTab: function(tabId) { - var tabData = this.tabId[tabId] + updateTab: function(tab, ensureOverlay) { + var url = tab.url, + tabId = tab.id, + tabData = this.tabId[tabId], + info = redditInfo.getURL(url) + + setPageActionIcon(tab, info) + + // Manually inject the page overlay if we have permission on https pages. + if (ensureOverlay && info) { + this.ensureOverlay(tab) + } + if (tabData && tabData.bar) { console.log('Updating tab', tabId) barStatus.update(tabData.bar) @@ -607,7 +666,7 @@ function onActionClicked(tab) { redditInfo.lookupURL(tab.url, true, function(info) { window.clearInterval(workingAnimation) - setPageActionIcon(tab, info) + tabStatus.updateTab(tab, true) delete workingPageActions[tab.id] if (info) { @@ -618,8 +677,15 @@ function onActionClicked(tab) { }) } -chrome.tabs.onSelectionChanged.addListener(tabStatus.updateTab.bind(tabStatus)) chrome.pageAction.onClicked.addListener(onActionClicked) +chrome.tabs.onActivated.addListener(function(activeInfo) { + chrome.tabs.get(activeInfo.tabId, function(tab) { + tabStatus.updateTab(tab) + }) +}) +chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { + tabStatus.updateTab(tab, true) +}) chrome.extension.onRequest.addListener(function(request, sender, callback) { switch (request.action) { @@ -639,7 +705,6 @@ chrome.extension.onConnect.addListener(function(port) { tabStatus.add(port) var tab = port.sender.tab, info = redditInfo.getURL(tab.url) - setPageActionIcon(tab, info) if (info) { if (localStorage['autoShow'] == 'false') { console.log('Auto-show disabled. Ignoring reddit page', info) diff --git a/src/manifest.json b/src/manifest.json index b1b9f4e..09030a8 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -9,6 +9,9 @@ "notifications", "http://*/*" ], + "optional_permissions": [ + "https://*/*" + ], "content_security_policy": "default-src 'self'; connect-src 'self' http://www.reddit.com", "icons": { "16" : "images/shine-16.png", @@ -29,7 +32,7 @@ "js": ["debug.js", "redditContent.js"] }, { - "matches": ["http://*/*", "https://*/*"], + "matches": ["http://*/*"], "run_at": "document_start", "js": ["debug.js", "pageOverlay.js"], "css": ["pageOverlay.css"] diff --git a/src/options.html b/src/options.html index bb77b08..096389c 100644 --- a/src/options.html +++ b/src/options.html @@ -15,8 +15,8 @@

    logoreddit companion options

    • -
    • +
    diff --git a/src/options.js b/src/options.js index 3966742..73f963e 100644 --- a/src/options.js +++ b/src/options.js @@ -10,6 +10,29 @@ $(document).ready(function() { ] $('.notification-demo > .message').text(randomChoice(messages)) + var prefHandlers = { + allowHttps: function(name, value) { + if (value) { + chrome.permissions.request({ + origins: ['https://*/*'] + }, function(granted) { + prefHandlers.checkbox(name, granted) + }) + } else { + chrome.permissions.remove({ + origins: ['https://*/*'] + }, function(removed) { + prefHandlers.checkbox(name, !removed) + }) + } + }, + + checkbox: function(name, value) { + localStorage[name] = value + $('#contents').toggleClass(name, value) + } + } + $('input[type=checkbox]') .each(function(i, el) { if (localStorage[el.id] == 'true') { @@ -18,9 +41,9 @@ $(document).ready(function() { } }) .click(function() { - var value= $(this).is(':checked') - localStorage[this.id] = value - $('#contents').toggleClass(this.id, value) + var value = $(this).is(':checked'), + handler = prefHandlers[this.id] || prefHandlers.checkbox + handler(this.id, value) }) $('#notifyTime') From 187e1563725c7f052cccd4e4bd55770b42e32b28 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 17:17:42 -0700 Subject: [PATCH 49/70] Fix dangling tabData.bar issue. --- src/background.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/background.js b/src/background.js index 9f7b60d..d1c7db4 100644 --- a/src/background.js +++ b/src/background.js @@ -283,7 +283,7 @@ tabStatus = { port.onDisconnect.addListener(this.remove.bind(this, tabId)) }, - addBar: function(tabId, bar) { + setBar: function(tabId, bar) { var tabData = this.tabId[tabId] if (tabData) { tabData.bar = bar @@ -327,7 +327,7 @@ tabStatus = { if (tabData && tabData.bar) { console.log('Updating tab', tabId) - barStatus.update(tabData.bar) + barStatus.update(tabData.bar, true) } }, @@ -365,7 +365,7 @@ barStatus = { delete this.hidden[barData.fullname] port.onMessage.addListener(this.handleCommand.bind(this, barData)) port.onDisconnect.addListener(this.remove.bind(this, barData)) - tabStatus.addBar(port.sender.tab.id, barData) + tabStatus.setBar(port.sender.tab.id, barData) }, remove: function(barData) { @@ -378,6 +378,7 @@ barStatus = { if (!bars.length) { delete this.fullname[fullname] } + tabStatus.setBar(barData.port.sender.tab.id, null) } }, From f647e2492bced905bc2bcaeae8a773b87d180ea0 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 17:18:19 -0700 Subject: [PATCH 50/70] Cleanup. --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index d1c7db4..9ee3bf0 100644 --- a/src/background.js +++ b/src/background.js @@ -384,7 +384,7 @@ barStatus = { update: function(barData, stored) { redditInfo.lookupName(barData.fullname, stored, function(info) { - if (info == null) { return } + if (!info) { return } console.log('Updating bar', barData) barData.port.postMessage({ action: 'update', From 1b8c7d0f1bad0c782e8322928575526ab8755536 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 17:31:27 -0700 Subject: [PATCH 51/70] Fix defunct info update upon failed action. --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 9ee3bf0..daad369 100644 --- a/src/background.js +++ b/src/background.js @@ -411,7 +411,7 @@ barStatus = { console.log('Received message from bar', barData, msg) var updateAfter = function(success) { if (!success) { - this.update.bind(this, barData) + barStatus.update(barData, true) } } switch (msg.action) { From cba886f1b2788b7871702dabc9588d0408a3f543 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 17:31:41 -0700 Subject: [PATCH 52/70] Fix action abort when not logged in. --- src/background.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index daad369..e9a3065 100644 --- a/src/background.js +++ b/src/background.js @@ -171,7 +171,10 @@ redditInfo = { }, _thingAction: function(action, data, callback) { - if (!this.isLoggedIn()) { callback(false, 'not logged in') } + if (!this.isLoggedIn()) { + callback(false, 'not logged in') + return + } data.uh = this.modhash this.request({ From 54dffa0472f9b851f12bb9503bc59f713596e471 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 18:53:32 -0700 Subject: [PATCH 53/70] Consolidate checks when interacting with https pages. --- src/background.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/background.js b/src/background.js index e9a3065..894c55f 100644 --- a/src/background.js +++ b/src/background.js @@ -268,6 +268,10 @@ tabStatus = { tabId: {}, injecting: {}, + canOverlay: function(tab) { + return localStorage['allowHttps'] == 'true' || urlProtocol(tab.url) != 'https' + }, + ensureOverlay: function(tab) { var needsOverlay = localStorage['allowHttps'] == 'true' && urlProtocol(tab.url) == 'https' if (needsOverlay && !(tab.id in this.tabId) && !(tab.id in this.injecting)) { @@ -632,30 +636,27 @@ function setPageActionIcon(tab, info) { return } - switch (urlProtocol(tab.url)) { - case 'https': - if (localStorage['allowHttps'] != 'true') { - chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit-disabled.png'}) - chrome.pageAction.setTitle({tabId:tab.id, title:'Companion is disabled on secure pages (enable in the options)'}) - chrome.pageAction.show(tab.id) - break - } - // Otherwise, fall through... - case 'http': - var iconPath = info ? '/images/reddit.png' : '/images/reddit-inactive.png' - chrome.pageAction.setIcon({tabId:tab.id, path:iconPath}) - chrome.pageAction.setTitle({tabId:tab.id, title:'Show reddit information'}) - chrome.pageAction.show(tab.id) - break + if (!tabStatus.canOverlay(tab)) { + chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit-disabled.png'}) + chrome.pageAction.setTitle({tabId:tab.id, title:'Companion is disabled on secure pages (enable in the options)'}) + chrome.pageAction.show(tab.id) + return + } - default: - chrome.pageAction.hide(tab.id) + var protocol = urlProtocol(tab.url) + if (protocol == 'http' || protocol == 'https') { + var iconPath = info ? '/images/reddit.png' : '/images/reddit-inactive.png' + chrome.pageAction.setIcon({tabId:tab.id, path:iconPath}) + chrome.pageAction.setTitle({tabId:tab.id, title:'Show reddit information'}) + chrome.pageAction.show(tab.id) + } else { + chrome.pageAction.hide(tab.id) } } var workingPageActions = {} function onActionClicked(tab) { - if (tab.id in workingPageActions) { return } + if (!tabStatus.canOverlay(tab) || tab.id in workingPageActions) { return } workingPageActions[tab.id] = true var frame = 0 @@ -714,7 +715,7 @@ chrome.extension.onConnect.addListener(function(port) { console.log('Auto-show disabled. Ignoring reddit page', info) } else if (localStorage['autoShowSelf'] == 'false' && info.is_self) { console.log('Ignoring self post', info) - } else if (localStorage['allowHttps'] == 'false' && urlProtocol(tab.url) == 'https') { + } else if (!tabStatus.canOverlay(tab)) { console.log('Https page. Ignoring', info) } else if (barStatus.hidden[info.name]) { console.log('Bar was closed on this page. Ignoring.', info) From e66f05afd89a439730b52b827128c14b2481a7ea Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 18:53:49 -0700 Subject: [PATCH 54/70] Disconnect from https page overlays when https disabled. --- src/background.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/background.js b/src/background.js index 894c55f..7d7d1f1 100644 --- a/src/background.js +++ b/src/background.js @@ -302,6 +302,16 @@ tabStatus = { delete this.tabId[tabId] }, + removeHttps: function() { + for (var tabId in this.tabId) { + chrome.tabs.get(Number(tabId), function(tab) { + if (urlProtocol(tab.url) == 'https') { + tabStatus.tabId[tab.id].port.disconnect() + } + }) + } + }, + send: function(tabId, msg) { var tabData = this.tabId[tabId] if (tabData) { @@ -741,6 +751,9 @@ window.addEventListener('storage', function(e) { } break case 'allowHttps': + if (e.newValue == 'false') { + tabStatus.removeHttps() + } case 'showPageAction': setAllPageActionIcons() break From 8c7130750a3c0bc17b96f0715712726b42abbadd Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 21:54:23 -0700 Subject: [PATCH 55/70] Use cookie state to determine reddit logged in status. --- src/background.js | 25 +++++++++++++++++++++++-- src/manifest.json | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/background.js b/src/background.js index 7d7d1f1..ad91b82 100644 --- a/src/background.js +++ b/src/background.js @@ -208,13 +208,34 @@ redditInfo = { }, isLoggedIn: function() { - // TODO: check for cookie - return this.modhash != null && this.modhash != '' + return this.hasCookie + }, + + setLoggedIn: function(hasCookie) { + this.hasCookie = hasCookie + console.log("Changed reddit logged in state:", hasCookie) + if (!hasCookie) { + this.storeUsername(null) + this.storeModhash(null) + } }, init: function() { this.user = localStorage['username'] this.modhash = localStorage['modhash'] + + chrome.cookies.get({ + url:'http://www.reddit.com', name:'reddit_session' + }, function(cookie) { + redditInfo.setLoggedIn(!!cookie) + }) + + chrome.cookies.onChanged.addListener(function(changeInfo) { + var cookie = changeInfo.cookie + if (cookie.domain == '.reddit.com' && cookie.name == 'reddit_session') { + redditInfo.setLoggedIn(!changeInfo.removed) + } + }) }, storeModhash: function(modhash) { diff --git a/src/manifest.json b/src/manifest.json index 09030a8..e3f0bd3 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -7,6 +7,7 @@ "permissions": [ "tabs", "notifications", + "cookies", "http://*/*" ], "optional_permissions": [ From 43a78403e8f986ca6c66783cb592d680b8935bae Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 21:54:57 -0700 Subject: [PATCH 56/70] Add proper modhash fetch and retry for login state changes. --- src/background.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index ad91b82..73076ba 100644 --- a/src/background.js +++ b/src/background.js @@ -170,12 +170,28 @@ redditInfo = { this._storedLookup('id', name, this.fullname, useStored, callback) }, - _thingAction: function(action, data, callback) { + _thingAction: function(action, data, callback, isRetry) { if (!this.isLoggedIn()) { callback(false, 'not logged in') return } + if (!this.modhash) { + if (isRetry) { + console.log('No modhash after thingAction update. Aborting.') + } + + console.log('Attempted thingAction without modhash. Updating.') + this.update(function(success) { + if (success) { + redditInfo._thingAction(action, data, callback, true) + } else { + console.log('Failed thingAction modhash update. Aborting.') + callback(false) + } + }) + } + data.uh = this.modhash this.request({ type: 'POST', From dddfe0da42b8974b68f98587d94266d8ade93398 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 22:59:15 -0700 Subject: [PATCH 57/70] Larger, more square page action icon. --- src/background.js | 4 +- src/images/pageaction-disabled.png | Bin 0 -> 701 bytes src/images/pageaction-disabled.svg | 395 +++++++++++++++++++++++++++++ src/images/pageaction-inactive.png | Bin 0 -> 813 bytes src/images/pageaction.png | Bin 0 -> 830 bytes src/images/pageaction.svg | 359 ++++++++++++++++++++++++++ src/images/reddit-disabled.png | Bin 996 -> 0 bytes src/images/reddit-disabled.svg | 203 --------------- 8 files changed, 756 insertions(+), 205 deletions(-) create mode 100644 src/images/pageaction-disabled.png create mode 100644 src/images/pageaction-disabled.svg create mode 100644 src/images/pageaction-inactive.png create mode 100644 src/images/pageaction.png create mode 100644 src/images/pageaction.svg delete mode 100644 src/images/reddit-disabled.png delete mode 100644 src/images/reddit-disabled.svg diff --git a/src/background.js b/src/background.js index 73076ba..fd2b7a4 100644 --- a/src/background.js +++ b/src/background.js @@ -684,7 +684,7 @@ function setPageActionIcon(tab, info) { } if (!tabStatus.canOverlay(tab)) { - chrome.pageAction.setIcon({tabId:tab.id, path:'/images/reddit-disabled.png'}) + chrome.pageAction.setIcon({tabId:tab.id, path:'/images/pageaction-disabled.png'}) chrome.pageAction.setTitle({tabId:tab.id, title:'Companion is disabled on secure pages (enable in the options)'}) chrome.pageAction.show(tab.id) return @@ -692,7 +692,7 @@ function setPageActionIcon(tab, info) { var protocol = urlProtocol(tab.url) if (protocol == 'http' || protocol == 'https') { - var iconPath = info ? '/images/reddit.png' : '/images/reddit-inactive.png' + var iconPath = info ? '/images/pageaction.png' : '/images/pageaction-inactive.png' chrome.pageAction.setIcon({tabId:tab.id, path:iconPath}) chrome.pageAction.setTitle({tabId:tab.id, title:'Show reddit information'}) chrome.pageAction.show(tab.id) diff --git a/src/images/pageaction-disabled.png b/src/images/pageaction-disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..bae51825ae6c057b956b91d25a8fa62402d4a10c GIT binary patch literal 701 zcmV;u0z&Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iyq= z1}O1^8=X#vv9U2UO#@g~2PC@C z!zVp-0grWEKQZJQknB3}?%3G@UI-x&LIAu5IB(6%z-_<}7`?ZZz-Pb$%4c2blg$BB zK(&Y3;^HFFXq4&cX-w0^vMg$~8k?J&WV2a-Ht-3!348>e31Du1etya@3^JJv#bS}! z+1WqtozLePnSzTSN3t*{GD3C}bXti4Se7=F@wJZzMG%1(MM59p@z%CRD zQ!6Vg#A30bOseZT2L}f%EGz(&UBFv_NF?%Ct`CR9^i2GwZw+gGeVzUN{h^53?KT@5 z8vq}Us~H3yZf$MhcDvCu4PDn69UVngRTM>`+wEf8Hiw6YbUK|QoSB&ccnY+R`|Lh& zqf{yp2n4Wg8{4+&cDp}=tSF3(jG(G2J3BkX<8gpjz{|5tdkct#LLpMA6v1E+kH>?Q z5`ewEJ+`;ENvG57?(PCS2i~7H?JuDgLL8Bt$e+uF<2V4z=Oy6u??5h>!|U~aZ!{XB z*=)KdCnueWi3wS$R4%4css8Np?*zJHn&w@<-=C0D8d6H#ah&mLwd!*mXIx6D*J?F? jC=_~N7{)z7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/images/pageaction-inactive.png b/src/images/pageaction-inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..80da90d8dcafdd7449b381f2917048f6da7a3deb GIT binary patch literal 813 zcmV+|1JeA7P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iyq= z1vmu&vbOaA00ON^L_t(I%dL~$OOtUF$3J`KU`(9~ZJ-PkhsyG0;*GA&DLkThAt^!D zUyye-GrUNUA$a2-;H9!bfr;$pVu2TFsgc$ugbDWWfY1_Tb7?Y0Yd&49W@}OwoxAhp zoX_u^^E*eSD2l>=vZBid9v&VNjYhFpENHb_c6WDKSXcmHaBvW-)p~i@?CdP1rKJP{ zft)rzK8{+gW_o)1@~~7Y1;FU&C;(??XG~2^q19^tzRgG^LR(u~&KCrMzP>)(ZZ`l< zrxO6xMIUf-a>DBBD$!_^SS&^+lR>3YVKSMhuC7KD#S0%*DT<+5UWymcE(L;W9Hf4lRJrNt-o_xE#jbVNKJN04P1v)Ro0`WpAg9-M<#9>LzLe8S!) ztUd;yx$!D@@3{ztLew`jAW0HJPfrhvi;ML3_EJ);%O>qSht2okdkTqztd=+cUkEn$ zVCMw@J38=sJcy!*V7J?|FSWFsSJ3DLb1`(bLPcd(tEkNSwZ+ibnG0=hYDS~c z;BYvyt5H)^gCt3`TCL~68)JoovRyBbBuT5B(GR)AD+VJYBX>{>0?A~O znVA{7y1MA@?k-%~jg1YKmzOabjSLJ7U^1Bs+S=dW$M5%(NF*2<8lvT=SzmYoZnqna zMngKCE`a^eCnqN_zJOmr04|pcyFFsYB_+Aa=I7@D3V?Zsetdk4D2gN!i5v*X rfdHzis<7Mb2;b+X)9HTS=D*rEMl%Ws*%E?q00000NkvXXu0mjfX^Lwr literal 0 HcmV?d00001 diff --git a/src/images/pageaction.png b/src/images/pageaction.png new file mode 100644 index 0000000000000000000000000000000000000000..1ff511c1e3ad5665e9581bd3d4a63c3260428263 GIT binary patch literal 830 zcmV-E1Ht@>P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iyq= z1_UfKwdp?q00O>AL_t(I%e7SBOOs&~e!hL*z#B&pOQc+eBnP$a`)<5QFT4r7u2^)D z1`+B%U_uv?*~q-GZX*0yckO05EogR=OcI3HkX^ij;N}*oO zFa_W;Os1Ny&Q91J4%n(}u%5AEV|@d$SQLR^5F^9G27pB)m;0nBiW9)BuIqPEUtj;O zx3`yvhMqDJv2W%Bml9s@6cZ7Tjg4_%Umx4;_O~FSw8!INRns^ei4@tR-ORJE4=c>N znaA!GO0l%Ws;aWj=VKyDgNPogs>%}+6UC;Papvok&u}P@g+oPbX1qXsGC0T%hl7cz zfB(XNuB?O)yXbc^y9W+q?twghAQl!Dn25dsfC2!LB>98Ez?JIi^TmI(xId(do1`%b6=+19{4I;7t*tXehrnR*-WHK3)mzN`%Oror;3|6ZZ z(P%Wix2wB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/images/reddit-disabled.png b/src/images/reddit-disabled.png deleted file mode 100644 index c3e5ce9fe03973efb0bd157dd521600eca4c8e03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 996 zcmVyD`)L!k(KyDR{+F4| zye@uPq?I=Gz}-CFJ-mC~IhQcT@IS#fceyi_XjZnyg`pU<0icXyqPF?4lxwT+LD69C&>E#t_t>`5dNE%o*FmHqvF z``+GO+uYn7x3aQAj*gBTvMhH3FxK+2r^#f}=5#u5$HvCK1@L5QYU-1#t1FYHX@n4> z8;!;?fXYKM0e}dg2tcZ8WC7qjK0da3z20j8I)ImGWICXw;F*<(dkGf~i<63X&wLX0w?(91b}U2>jaG+WI<^ z$uwFlmfs~w`VPQ1gfaH<=H})Xkx1mJ!C*jLU7c2`RJfj=9?s=*5xd1la(cJ`yk(m@Ep!otEUm&;}9?d`?<{5%^P8cG9r&H+gIe7-CpL>EO70De;x<(v@m zXwC>Bj8b|IATNp{1VO0y{r;Z;q<8=-&-356x3_9?vy^69DR;2{;RdLYYV;Qb{BdZ&y8Ltu{Rb2jB^S&S*4hJvcZ}2L=Xy0`LO> zkO#WFmrkdLmzS42&1N$n2m}lr9UZK(v5^8$0o2{y-5FD<6xrF?(G*2dW@ctiT3TAZ z0`TMC$pGM8UDy4wSgbuBkGEc4Ue@cnP9#avZ*Olop68j}Zhz(T`CfK+cfSA-1#te? z?2r5y0q_h!Cjg5q%a(jT-_YFLTxx1+x(1N1YLxj$V~xwv2%!95mue-e34Z`*)Ohs# S(!5^)0000 - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - From 58cbf7bef22577b5f8ebf2476b6a8329a352a6a6 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 23:15:14 -0700 Subject: [PATCH 58/70] Cleanup. --- src/background.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/background.js b/src/background.js index fd2b7a4..7393b90 100644 --- a/src/background.js +++ b/src/background.js @@ -359,13 +359,6 @@ tabStatus = { } }, - _showInfo: function(tabId, fullname) { - this.send(tabId, { - action: 'showInfo', - fullname: fullname - }) - }, - updateTab: function(tab, ensureOverlay) { var url = tab.url, tabId = tab.id, @@ -386,7 +379,10 @@ tabStatus = { }, showInfo: function(tabId, fullname) { - this._showInfo(tabId, fullname) + this.send(tabId, { + action: 'showInfo', + fullname: fullname + }) }, showSubmit: function(tabId) { From 34abcd64e19cff1644155eec92a5f5fc79c533f6 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 23:15:33 -0700 Subject: [PATCH 59/70] Toggle between submit and info bars on page action click. --- src/background.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 7393b90..44438e6 100644 --- a/src/background.js +++ b/src/background.js @@ -391,6 +391,15 @@ tabStatus = { }) }, + toggleInfo: function(tabId, fullname) { + var tabData = this.tabId[tabId] + if (tabData && tabData.bar) { + this.showSubmit(tabId) + } else { + this.showInfo(tabId, fullname) + } + }, + handleCommand: function(tabId, msg) { console.log('Received message from tab', tabId, msg) switch (msg.action) { @@ -718,7 +727,7 @@ function onActionClicked(tab) { delete workingPageActions[tab.id] if (info) { - tabStatus.showInfo(tab.id, info.name) + tabStatus.toggleInfo(tab.id, info.name) } else { tabStatus.showSubmit(tab.id) } From 9372b695bb84ba7b97a0b8f8d4189edeaa6e4c50 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 23:47:06 -0700 Subject: [PATCH 60/70] Update NEWS. --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 396cf55..937ddf7 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ * Fix bug where clicking the submit button didn't fill in the URL. [chromakode] * Fix bug where HTML entities appeared in bar titles. [chromakode] * Add strict CSP for extra security. [chromakode] +* Improved login state tracking. [chromakode] +* Clicking the page action a second time opens the submit bar. [chromakode] +* New more square page action icons. [chromakode] * Update internal jQuery to 1.8.1. [chromakode] * Update to latest Chrome manifest style. [chromakode] From 2d4e80f990b493cc9fe6d356b17b31f41e41127a Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 7 Sep 2012 23:55:00 -0700 Subject: [PATCH 61/70] Flip the antenna in the disabled page action icon. --- src/images/pageaction-disabled.png | Bin 701 -> 712 bytes src/images/pageaction-disabled.svg | 48 ++++++++++++++++------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/images/pageaction-disabled.png b/src/images/pageaction-disabled.png index bae51825ae6c057b956b91d25a8fa62402d4a10c..338b7944d9df92589309d43e5150edb10f78d21f 100644 GIT binary patch delta 625 zcmV-%0*?K?1;_=EVt+Oe@v6be0006=Nkl1`OaFaDN%FfUl<^6E&?T4y_FD+0*aD!-pZ=CJXl5CS0tK&gue;0Np`K>y6l4DooJNF;*a@26g`Q>)b|7K#l^)P0c7&|JQEWW z7>0q@>piuv>h(IIP>52gL@Jd+0nF9a)r<4<^CXkWGnsU7aFAxR$<)*oz*7hC8X%EK z{FUpY(P(EluR7NFu(Gnk!NI|qh#HLsYinx&@4BZM1b^%h%$I7~X7CKwDdG&F>i5&*+6*xcMCo6WMjy9@9HczaR;GD3)B zl3()YaB5QMpXi!1}Myu8ft@bI_2y*;tNzwhw-{np6Hh^$m9S~{KXy#3>E(my&n zdc)`Q-H}r2Qc90yS>9^3dcm?RuawfWv9aL`hr_pZT~7fn{#X3~he*eSe0onU00000 LNkvXXu0mjfh*K!W delta 614 zcmV-s0-62D1-%83Vt*+KSes{;0006#NklVv){g*5PJ zz#w!{aFI|AF*q5akR{lyOL6IvQA(GPAr(p|_dqHkICL^JprRcmNRYI~;T1_DX^GT9 z3NP=vB(<%rCZhjxxIh0r@ZWRJg@0Je5VKz3D)1Gsfos4c;D1i9_eBgrwgh|wF7+Fo zPKU9vF*HpBSXKuly3oTXJ#+z&bzMI(FH@q)5NkYYPA}ho10{_S%5b13AhP-1fB_C zZhn4#$}kKvnSTt$Vv*U|*+1@`&*w=dldP?+QLoooU0tmUV5v|jkVqtGwOaUmzJcYn zEDO^#DVNJcqfr#VE))t=D=RC+VzHr2s_Qxj2L~)HEC7^Uz*~SwB=T3T4~N6_O#G&A z4QqXUo&Ej&p@`b;HX9oo03VL483Z0~ZEfLpyU{caU4PdZ9UVngRTM>`+wEf8Hiw6Y zbUK|QoSB&ccnY+R`|Lh&qf{yp2n4Wg8{4+&cDp}=tSF3(jG(G2J3BkX<8gpjz{|5t zdkct#LLpMA6v1E+kH>?Q5`ewEJ+`;ENvG57?(PCS2i~7H?JuDgLL8Bt$e+uF<2V4z z=Oy6u?_WSJm&5Dzes44yqSXe<&1sU>L?dK;wVa4>TgdkzVz2W&i*H07*qoM6N<$f|g_) ALI3~& diff --git a/src/images/pageaction-disabled.svg b/src/images/pageaction-disabled.svg index 2a765e3..ecdca06 100644 --- a/src/images/pageaction-disabled.svg +++ b/src/images/pageaction-disabled.svg @@ -244,11 +244,11 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="38.443359" - inkscape:cx="11.727581" - inkscape:cy="7.9359306" + inkscape:zoom="17.085937" + inkscape:cx="6.5098904" + inkscape:cy="3.859076" inkscape:document-units="px" - inkscape:current-layer="Layer_2" + inkscape:current-layer="g4337" showgrid="false" inkscape:snap-global="false" inkscape:window-width="1268" @@ -290,6 +290,28 @@ + + + + - - Date: Sat, 8 Sep 2012 00:05:40 -0700 Subject: [PATCH 62/70] Cleanup. --- src/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 44438e6..1a76a89 100644 --- a/src/background.js +++ b/src/background.js @@ -45,7 +45,7 @@ redditInfo = { this.fullname[info.name] = info console.log('Stored reddit info for', url, info) } else { - console.log('Received info not newer than stored info. Did not store.', stored, info) + console.log('Received info older than stored info. Did not store.', stored, info) } }, From 2de60992e4e79d2c77b0308f4faaf62fef8b3750 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 8 Sep 2012 00:10:30 -0700 Subject: [PATCH 63/70] Double quotes -> single quotes. --- src/background.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/background.js b/src/background.js index 1a76a89..4beaff5 100644 --- a/src/background.js +++ b/src/background.js @@ -229,7 +229,7 @@ redditInfo = { setLoggedIn: function(hasCookie) { this.hasCookie = hasCookie - console.log("Changed reddit logged in state:", hasCookie) + console.log('Changed reddit logged in state:', hasCookie) if (!hasCookie) { this.storeUsername(null) this.storeModhash(null) @@ -278,14 +278,14 @@ function addContent(tab, files, callback) { } else if (extension == '.css') { var inject = chrome.tabs.insertCSS } else { - throw "Invalid file extension." + throw 'Invalid file extension.' } inject(tab.id, fileInfo, function() { injectNext() }) } else { - console.log("Content injection took", Date.now() - startTime, 'ms') + console.log('Content injection took', Date.now() - startTime, 'ms') if (callback) { callback() } } } From d234c207998f1075f967cc5877bc20fc64b54c32 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 8 Sep 2012 00:44:47 -0700 Subject: [PATCH 64/70] Redirect detection. --- src/background.js | 25 +++++++++++++++++++------ src/manifest.json | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/background.js b/src/background.js index 4beaff5..0fcc4b8 100644 --- a/src/background.js +++ b/src/background.js @@ -22,6 +22,7 @@ redditInfo = { freshAgeThreshold: 5*60, url: {}, + redirects: {}, fullname: { _shine_demo: { title: 'companion bar', @@ -34,7 +35,11 @@ redditInfo = { fetching: {}, getURL: function(url) { - return this.url[url] + return this.url[url] || this.fullname[this.redirects[url]] + }, + + getFullname: function(fullname) { + return this.fullname[fullname] }, setURL: function(url, info) { @@ -115,16 +120,16 @@ redditInfo = { }) }, - _storedLookup: function(keyName, key, array, useStored, callback) { + _storedLookup: function(keyName, key, getter, useStored, callback) { // Internal rate limited cached info getter. // - // Look up `key` from `array` and call `callback` with the stored data immediately if + // Look up `key` using `getter` and call `callback` with the stored data immediately if // `useStored` is true and stored info is available. If stored data is // currently in the process of being refreshed or it is older than // redditInfo.freshAgeThreshold seconds old, false is returned. Otherwise, // the data is fetched from reddit and `callback` is invoked with the // result. - var stored = array[key], + var stored = getter.call(this, key), storedAge = 0, now = Date.now() if (stored) { @@ -163,11 +168,11 @@ redditInfo = { }, lookupURL: function(url, useStored, callback) { - this._storedLookup('url', url, this.url, useStored, callback) + this._storedLookup('url', url, this.getURL, useStored, callback) }, lookupName: function(name, useStored, callback) { - this._storedLookup('id', name, this.fullname, useStored, callback) + this._storedLookup('id', name, this.getFullname, useStored, callback) }, _thingAction: function(action, data, callback, isRetry) { @@ -252,6 +257,14 @@ redditInfo = { redditInfo.setLoggedIn(!changeInfo.removed) } }) + + chrome.webRequest.onBeforeRedirect.addListener(function(details) { + var info = redditInfo.url[details.url] + if (info) { + console.log('Detected redirect from', details.url, 'to', details.redirectUrl) + redditInfo.redirects[details.redirectUrl] = info.name + } + }, {urls:[''], types:['main_frame']}) }, storeModhash: function(modhash) { diff --git a/src/manifest.json b/src/manifest.json index e3f0bd3..a54a3bd 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -8,6 +8,7 @@ "tabs", "notifications", "cookies", + "webRequest", "http://*/*" ], "optional_permissions": [ From e238e202c273c15436a596514e82e2430953380d Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 8 Sep 2012 01:29:44 -0700 Subject: [PATCH 65/70] Update NEWS. --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 937ddf7..f7c7b66 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ == Version 1.2.0 == +* Redirect handling. [chromakode] * Display markdown formatting in notifications. [marklr + blueshiftlabs] * Add modmail notifications. [blueshiftlabs] * Add option to close tab / go back after voting. [blueshiftlabs] From e45e6c6266b46fb7a76d48c1bc668f1f65494d11 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 8 Sep 2012 01:40:03 -0700 Subject: [PATCH 66/70] Update default page action icon. --- src/images/reddit.png | Bin 1018 -> 0 bytes src/manifest.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/images/reddit.png diff --git a/src/images/reddit.png b/src/images/reddit.png deleted file mode 100644 index d7d2bf607998973d737fe5b42bee1d061e4c28a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1018 zcmVeR*4vA9x|DNFvrFm z1$`AnL6H?l5dtxcGC}cSdvWO4i!jiKpc7%R(Gjvn5UPxT-NTfnb}qronk<_&(IzH0 z$<5hAl-g1@*@5rjJHPK7z8~N3d^(c&pQr>-3Lt(#ymm#Q3BX$bbO8Paa5EZ>wkDIw zlBTAnT>yRnv8$T(4Gs~YB zlPMV=AOF#4H2wl0r6Xwo@WJ8XVS6YP5_@`j{`C9(b@TJ{9g3pdh{a;Y zsi}!KG&Cq~w>!|;*_rVB{jWDSH$SsjEPDWc0Lfmb(|J!6#hfHbx!T&=l*weuPEAea zeLf#Up%62f3=a+t==FN(a=CJnBxPk;PD+xL6GbuSbUN>m?1ieTcg<#VYIAdwcDtQU zr<1CxlIbLwI^hdQosj7y&(6*`Iy%a(t}bqGZ_{ixr&LwF3r*A9vMitW_4RRLVxlO@ zq{urR^z`(4Wo0Gz_xFp!$2;UL zJ^5h?xwlp1_O^=qTl!+1WFQcr!C)xN%*?Eld=DfI>2!Kp5QJPL5_#Uz?gR4S{TJJO zc)!S>BNzu;eb3P>UvjpFv=Iv&KI zXW8TN(BW|W3SbXF@?y%{yk75DCX?xGd3m`&l8HouV`F11D=TAZX(`Lg%Q-SK!jqHY zqbw{eXw}u#$*rxed6G9t;&N=>+1S|lvaYV~)ZuVs*4EZ|bacc*p}=S~N=?%ki^aIK zw8YldR<*vq{%If(_=4oy7alL?up^hteKI>c`;EU1>MMXuvs;WwD zZ*M=Go161!n&u|iep#=3#eY_E9wj?~>x!ZngTbI^v)N8%Sxx|W3gBk|y8!Z+g|9Mu o8D#(j0M7tq|Lx#a%&v@o0E)AAV8ebBwEzGB07*qoM6N<$f?JQ^8~^|S diff --git a/src/manifest.json b/src/manifest.json index a54a3bd..2abb0d9 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -24,7 +24,7 @@ "page": "background.html" }, "page_action": { - "default_icon": "images/reddit.png", + "default_icon": "images/pageaction.png", "default_title": "Show reddit information" }, "content_scripts": [ From db29154bf5c8d2fd4d87b336cc1311d5463eeb4a Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 8 Sep 2012 01:42:58 -0700 Subject: [PATCH 67/70] Remove unused image files. --- src/images/close.png | Bin 99 -> 0 bytes src/images/reddit-inactive.png | Bin 1022 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/images/close.png delete mode 100644 src/images/reddit-inactive.png diff --git a/src/images/close.png b/src/images/close.png deleted file mode 100644 index 460e05cb64ae5e174cc577929e664d139e22a483..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 99 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4u_bxCyDxec)B=- sNK8%s^Z)<zopr0E&?sg#Z8m diff --git a/src/images/reddit-inactive.png b/src/images/reddit-inactive.png deleted file mode 100644 index bad45d9477b09ca280175df7b923d5314b378b8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1022 zcmV;TqgND$pL~fLwaloK`jaslb>eSP9Bi#^W1HHA zJ9RDMMyNI}L^KP*wTdF@PRvFWMT9O~xR87unVCg5ZB>NHjH59>HjSgr*hYlq+`i{atnmqSBC72$AL>g($}%+AjK z9S|xZgc>M0K0YpVxm;R{#d6_rII?DDW*&Mxo_m2nKzn|Eo}$y~l)SvWaA|4jh0SL3 zH8nL|I~1V2NIQ+T6VEA@@eLZDhU;vB7!ua?& zsWAm&QOLM=XT;TCAgQ?)68-)CIGs)=CnsrdZ&$ot?@y{|H2RsrU}$M*Xh=00jm*x@ z!p#*7S>QGd(@!DuK3rbFU^Ap@Vd@E_WzgN-jSvD^mT$dYuPjNDbkf_~`&yP|tX6AW zf#(Id_Q3lBj`!oatex3IM0mNpo{^9*&KTMHUwq0jRI9M^O~Y%gfPf zwUm{Wp(qM_rKN?OoE!py z0J*ujoSmJqxw*;I)KoMS3f-=)t^L;6*!T}! z{Cwf}`z4J=6Ehl(q3-T(&%nTdPm-ipz}t7=e_QkiKmm~McDp}vI-Th?H8od-g@u>E sWx}K2hoEGB4FEL|{jW#Kk|h=Y0Dt6)`=lLy`2YX_07*qoM6N<$f;Cj)*#H0l From 77f4afa40c895a45e68ba8bf87a139f3ea3b0941 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 8 Sep 2012 01:48:27 -0700 Subject: [PATCH 68/70] Reset checkbox value when https permissions denied. --- src/options.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/options.js b/src/options.js index 73f963e..66aaadb 100644 --- a/src/options.js +++ b/src/options.js @@ -11,25 +11,26 @@ $(document).ready(function() { $('.notification-demo > .message').text(randomChoice(messages)) var prefHandlers = { - allowHttps: function(name, value) { + allowHttps: function(name, value, el) { if (value) { chrome.permissions.request({ origins: ['https://*/*'] }, function(granted) { - prefHandlers.checkbox(name, granted) + prefHandlers.checkbox(name, granted, el) }) } else { chrome.permissions.remove({ origins: ['https://*/*'] }, function(removed) { - prefHandlers.checkbox(name, !removed) + prefHandlers.checkbox(name, !removed, el) }) } }, - checkbox: function(name, value) { + checkbox: function(name, value, el) { localStorage[name] = value $('#contents').toggleClass(name, value) + $(el).prop('checked', value) } } @@ -43,7 +44,7 @@ $(document).ready(function() { .click(function() { var value = $(this).is(':checked'), handler = prefHandlers[this.id] || prefHandlers.checkbox - handler(this.id, value) + handler(this.id, value, this) }) $('#notifyTime') From 8d9778e085ec3c6cfae2865176946e49d9458db7 Mon Sep 17 00:00:00 2001 From: mhweaver Date: Sun, 9 Sep 2012 01:12:51 -0600 Subject: [PATCH 69/70] Increased right margin on close button In OS X, the scroll bar tends to completely cover the close button. Shifting it slightly to the left allows the button to still be usable, even when the scroll bar is visible. --- src/bar.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bar.css b/src/bar.css index b8c6189..b39faab 100644 --- a/src/bar.css +++ b/src/bar.css @@ -37,5 +37,5 @@ input#title-input:focus { outline:none; box-shadow:0 0 4px rgba(0,0,0,1); } input#title-input::-webkit-input-placeholder { color:#555; } #close { background:none; padding:0; margin-right:6px; box-shadow:none; border-radius:2px; opacity:.5; } -#close img { margin-top:3px; } +#close img { margin-top:3px; margin-right:4px;} #close:hover { opacity:.75; } From 998f41e581abe84fb2aad1bea88d2f911f7e9cc9 Mon Sep 17 00:00:00 2001 From: mhweaver Date: Sun, 9 Sep 2012 01:48:46 -0600 Subject: [PATCH 70/70] Moved margin-right from #close img to #bar It makes more sense that the margin be part of the bar than the button. --- src/bar.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bar.css b/src/bar.css index b39faab..8524291 100644 --- a/src/bar.css +++ b/src/bar.css @@ -16,7 +16,7 @@ button#save span { background-image:url(/images/savegray.svg); padding-left:16px .saved button#save span { background-image:url(/images/save.svg); } button#login span { background-image:url(/images/login.svg); } -#bar { display:-webkit-box; color:#222; text-align:left; font-family:sans-serif; border-top-left-radius:5px; border-bottom-left-radius:5px; } +#bar { display:-webkit-box; color:#222; text-align:left; font-family:sans-serif; border-top-left-radius:5px; border-bottom-left-radius:5px; margin-right:4px; } #bar > * { display:-webkit-box; -webkit-box-align:center; vertical-align:middle; } #logo { width:19px; -webkit-box-align:stretch; padding:0 7px; text-align:center; background:url(/images/reddit.svg) no-repeat center center, -webkit-linear-gradient(90deg, rgba(0,0,0,.1), rgba(0,0,0,.05)); border-right:1px solid rgba(0,0,0,.1); } .liked #logo { background:url(/images/reddit.svg) no-repeat center center, -webkit-linear-gradient(90deg, rgba(255,139,96,.75), rgba(255,139,96,.35)); } @@ -37,5 +37,5 @@ input#title-input:focus { outline:none; box-shadow:0 0 4px rgba(0,0,0,1); } input#title-input::-webkit-input-placeholder { color:#555; } #close { background:none; padding:0; margin-right:6px; box-shadow:none; border-radius:2px; opacity:.5; } -#close img { margin-top:3px; margin-right:4px;} +#close img { margin-top:3px;} #close:hover { opacity:.75; }