├── .gitignore ├── img ├── icon16.png ├── icon19.png ├── icon48.png ├── icon128.png ├── icon19_grey.png ├── dribbble-icon.png ├── icon19_light.png ├── twitter-sprite.png ├── extension-icons.png ├── extension-sprite.png └── extension-header-bg.png ├── css ├── inject │ └── dribbble.css ├── tipsy.css └── extension.css ├── js ├── kippt_content.js ├── kippt_tabs.js ├── inject │ ├── popup.js │ ├── dribbble.js │ ├── hackernews.js │ ├── quora.js │ ├── googlereader.js │ └── twitter.js ├── kippt_context_menu.js ├── kippt_omnibox.js ├── options.js ├── background.js ├── vendor │ ├── spin.js │ ├── socket.js │ ├── blur.js │ ├── tipsy.js │ ├── json2.js │ └── jquery.js └── kippt_extension.js ├── background.html ├── README.md ├── LICENSE ├── manifest.json ├── options.html └── extension.html /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | 4 | img/.DS_Store 5 | -------------------------------------------------------------------------------- /img/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/icon16.png -------------------------------------------------------------------------------- /img/icon19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/icon19.png -------------------------------------------------------------------------------- /img/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/icon48.png -------------------------------------------------------------------------------- /img/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/icon128.png -------------------------------------------------------------------------------- /img/icon19_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/icon19_grey.png -------------------------------------------------------------------------------- /img/dribbble-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/dribbble-icon.png -------------------------------------------------------------------------------- /img/icon19_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/icon19_light.png -------------------------------------------------------------------------------- /img/twitter-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/twitter-sprite.png -------------------------------------------------------------------------------- /img/extension-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/extension-icons.png -------------------------------------------------------------------------------- /img/extension-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/extension-sprite.png -------------------------------------------------------------------------------- /img/extension-header-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kippt/kippt-chrome/HEAD/img/extension-header-bg.png -------------------------------------------------------------------------------- /css/inject/dribbble.css: -------------------------------------------------------------------------------- 1 | div.meta-act a.meta-kippt { 2 | background-position: 12px 7px; 3 | } 4 | 5 | div.meta-act a.meta-kippt:hover { 6 | background-position: 12px -41px; 7 | } -------------------------------------------------------------------------------- /js/kippt_content.js: -------------------------------------------------------------------------------- 1 | // http://code.google.com/chrome/extensions/messaging.html 2 | chrome.extension.onRequest.addListener( 3 | function(request, sender, sendResponse) { 4 | if (request.helper == 'get_note'){ 5 | sendResponse({note: document.getSelection().toString()}); 6 | } else { 7 | sendResponse({note: ''}); // snub them. 8 | } 9 | } 10 | ); 11 | -------------------------------------------------------------------------------- /background.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kippt-chrome 2 | 3 | This is Kippt.com's official Chrome add-on. It's licensed under MIT and we accept improvements in pull-requests. 4 | 5 | ## Installation 6 | 7 | You can load the extension from Chrome's Extension tab using *Load unpacked extension...* option once you have enabled *Developer mode*. Alternative you can install the official build from [Chrome Web Store](https://chrome.google.com/webstore/detail/pjldngiecbcfldpghnimmdelafenmbni). 8 | 9 | ## TODO 10 | 11 | * Search for clips 12 | * Add keyboard shortcut (e.g. cmd+shift+k) -------------------------------------------------------------------------------- /js/kippt_tabs.js: -------------------------------------------------------------------------------- 1 | function setIconColor() { 2 | switch (localStorage["button_color"]) { 3 | case "grey": 4 | chrome.browserAction.setIcon({ 5 | path: "img/icon19_grey.png" 6 | }); 7 | break; 8 | case "light": 9 | chrome.browserAction.setIcon({ 10 | path: "img/icon19_light.png" 11 | }); 12 | break; 13 | default: 14 | chrome.browserAction.setIcon({ 15 | path: "img/icon19.png" 16 | }); 17 | break; 18 | } 19 | } 20 | 21 | chrome.tabs.onCreated.addListener(setIconColor); 22 | chrome.tabs.onActivated.addListener(setIconColor); -------------------------------------------------------------------------------- /js/inject/popup.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | window.KipptOpenPopup = function(data) { 3 | var url = encodeURIComponent(data.url), 4 | title= encodeURIComponent(data.title), 5 | notes= encodeURIComponent(data.notes), 6 | source = encodeURIComponent(data.source); 7 | 8 | if (data.notes) 9 | notes= encodeURIComponent(data.notes) 10 | else 11 | notes = '' 12 | 13 | var windowUrl = "https://kippt.com/extensions/new?url="+ url +"&title="+ title + "¬es="+ notes + "&source="+ source; 14 | window.open(windowUrl, "kippt-popup", "location=no,menubar=no,status=no,titlebar=no,scrollbars=no,width=420,height=192"); 15 | }; 16 | }); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Kippt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /js/kippt_context_menu.js: -------------------------------------------------------------------------------- 1 | var clickHandler = function(e) { 2 | var url = e.pageUrl; 3 | var selection = ''; 4 | var data = JSON.stringify({url: url}); 5 | 6 | // Selected text on current page (save page url) 7 | if (e.selectionText) { 8 | selection = e.selectionText; 9 | data = JSON.stringify({url: url, notes: selection}); 10 | } 11 | 12 | // Saving a link 13 | if (e.linkUrl) { 14 | url = e.linkUrl; 15 | data = JSON.stringify({url: url}); 16 | } 17 | 18 | $.ajax({ 19 | type: 'POST', 20 | url: 'https://kippt.com/api/clips/', 21 | data: data, 22 | dataType: 'json', 23 | timeout: 2500, 24 | error: function(xhr, type){ alert('Something went wrong when saving to Kippt. Have you signed in?') }, 25 | }); 26 | }; 27 | 28 | chrome.contextMenus.create({ 29 | "title": "Save link to Kippt", 30 | "contexts": ["link"], 31 | "onclick" : clickHandler 32 | }); 33 | 34 | chrome.contextMenus.create({ 35 | "title": "Save selection to Kippt", 36 | "contexts": ["selection"], 37 | "onclick" : clickHandler 38 | }); 39 | 40 | chrome.contextMenus.create({ 41 | "title": "Save page to Kippt", 42 | "contexts": ["page"], 43 | "onclick" : clickHandler 44 | }); 45 | -------------------------------------------------------------------------------- /js/kippt_omnibox.js: -------------------------------------------------------------------------------- 1 | chrome.omnibox.onInputChanged.addListener(function(text, suggest) { 2 | if (text.length > 0) { 3 | var search = 'https://kippt.com/api/search/clips/?limit=5&q=' + text; 4 | $.getJSON(search, function(data){ 5 | if (data.objects) { 6 | var suggestions = []; 7 | for (s in data.objects) { 8 | var title = data.objects[s].title; 9 | var url = data.objects[s].url; 10 | var url_domain = data.objects[s].url_domain; 11 | suggestions.push({ 12 | description: title+' - '+url_domain+'', 13 | content: url 14 | }); 15 | } 16 | suggest(suggestions); 17 | } 18 | }); 19 | } 20 | }); 21 | 22 | chrome.omnibox.onInputEntered.addListener(function(text) { 23 | chrome.tabs.getSelected(null, function(tab) { 24 | if ((text.indexOf('http://') == 0) || (text.indexOf('https://') == 0)) { 25 | // Go to search result 26 | chrome.tabs.update(tab.id, {url : text}); 27 | } else { 28 | // Search Kippt 29 | chrome.tabs.update(tab.id, {url : 'https://kippt.com/search?q='+text}); 30 | } 31 | }); 32 | }); -------------------------------------------------------------------------------- /js/inject/dribbble.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | var openPopup = function(a, title, url) { 4 | data = { 5 | title: title, 6 | url: url, 7 | source: "chrome_extension_dribbble" 8 | }; 9 | KipptOpenPopup(data); 10 | }; 11 | 12 | var inject = function() { 13 | var tweetAction = $('.meta-act').has('.meta-act-link.meta-share'); 14 | if (tweetAction.length === 1){ 15 | // Insert kippt link at the end 16 | var sprite = chrome.extension.getURL('/img/dribbble-icon.png'); 17 | var a = $('
Save to Kippt
'); 18 | a.on('click', function(e) { 19 | e.preventDefault(); 20 | 21 | // Get URL and title 22 | var url = document.URL; 23 | var title = $('h1').text() + " by " + $('.shot-byline-user a').text(); 24 | 25 | openPopup(a, title, url); 26 | }); 27 | 28 | // New link at the end 29 | tweetAction.after(a); 30 | } 31 | }; 32 | 33 | // Check opt-out status 34 | chrome.extension.sendRequest({method: 'getStorage'}, function(response) { 35 | var bool = response.storage['inject_dribbble']; 36 | if (bool == 'true' || bool === undefined) inject(); 37 | }); 38 | 39 | }); 40 | -------------------------------------------------------------------------------- /js/inject/hackernews.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | var openPopup = function(a, title, url) { 4 | data = { 5 | title: title, 6 | url: url, 7 | source: "chrome_extension_hackernews" 8 | }; 9 | KipptOpenPopup(data); 10 | }; 11 | 12 | var inject = function() { 13 | var tdList = $('tr td.subtext'); 14 | if (tdList.length == 0) 15 | return; 16 | 17 | tdList.each(function(i, td) { 18 | var aList = $('a', td); 19 | //if (aList.length != 3) 20 | // return; 21 | 22 | var a = $('save to kippt'); 23 | a.on('click', function(e) { 24 | e.preventDefault(); 25 | // Get URL and title 26 | var tdAbove = td.parentElement.previousSibling.childNodes[2]; 27 | var aLink = $('a', tdAbove)[0]; 28 | var title = aLink.innerText; 29 | var url = aLink.href; 30 | 31 | openPopup(a, title, url); 32 | }); 33 | 34 | // New link at the end 35 | var last = aList.last(); 36 | last.after(a); 37 | a.before(' | '); 38 | }); 39 | }; 40 | 41 | // Check opt-out status 42 | chrome.extension.sendRequest({method: 'getStorage'}, function(response) { 43 | var bool = response.storage['inject_hn']; 44 | if (bool == 'true' || bool == undefined) inject(); 45 | }); 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /js/inject/quora.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | var openPopup = function(a, title, url) { 4 | data = { 5 | title: title, 6 | url: url, 7 | source: "chrome_extension_quora" 8 | }; 9 | KipptOpenPopup(data); 10 | }; 11 | 12 | var inject = function() { 13 | var rowList = $('.feed_item'); 14 | if (rowList.length === 0){ //If not home page 15 | var a = $('Save to Kippt'); 16 | a.on('click', function(e) { 17 | e.preventDefault(); 18 | // Get URL and title 19 | var url = document.URL; 20 | var title = $('h1').text(); 21 | 22 | openPopup(a, title, url); 23 | }); 24 | 25 | // New link at the end 26 | $('.item_action_bar').append(a); 27 | } else { 28 | rowList.each(function(no, div) { 29 | var aList = $('a', div); 30 | if (aList.length <= 1) 31 | return; 32 | 33 | var a = $('Save to Kippt'); 34 | a.on('click', function(e) { 35 | e.preventDefault(); 36 | // Get URL and title 37 | var url = "https://quora.com" + $('.question_link', div).attr('href'); 38 | var title = $('.question_link', div)[0].innerText; 39 | 40 | openPopup(a, title, url); 41 | }); 42 | 43 | // New link at the end 44 | $('.item_action_bar', div).append(a); 45 | }); 46 | } 47 | }; 48 | 49 | // Check opt-out status 50 | chrome.extension.sendRequest({method: 'getStorage'}, function(response) { 51 | var bool = response.storage['inject_quora']; 52 | if (bool == 'true' || bool === undefined) inject(); 53 | }); 54 | 55 | }); 56 | -------------------------------------------------------------------------------- /js/options.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | var inject_inputs = ['inject_hn', 'inject_twitter', 'inject_google_reader', 'inject_quora', 'inject_dribbble']; 3 | 4 | // Saves options to localStorage. 5 | var save_options = function() { 6 | var select = $("#button-color"); 7 | var color = $("#button-color input[name=button_color]:checked").val(); 8 | localStorage["button_color"] = color; 9 | 10 | switch (localStorage["button_color"]) { 11 | case "grey": 12 | chrome.browserAction.setIcon({ 13 | path: "img/icon19_grey.png" 14 | }); 15 | break; 16 | case "light": 17 | chrome.browserAction.setIcon({ 18 | path: "img/icon19_light.png" 19 | }); 20 | break; 21 | default: 22 | chrome.browserAction.setIcon({ 23 | path: "img/icon19.png" 24 | }); 25 | break; 26 | } 27 | 28 | // Injection 29 | $.each(inject_inputs, function(i, name) { 30 | var sel = 'input[name=' + name + ']'; 31 | localStorage[name] = $(sel).is(':checked'); 32 | }); 33 | }; 34 | 35 | // Restores select box state to saved value from localStorage. 36 | var restore_options = function() { 37 | var color = localStorage["button_color"]; 38 | if (color === undefined) { 39 | $("#button-color input[name=button_color]").first().attr('checked', 'checked') 40 | } 41 | $("#button-color input[name=button_color]").each(function (index, option) { 42 | if ($(option).val() == color) { 43 | option.checked = "true"; 44 | } 45 | }); 46 | 47 | $.each(inject_inputs, function(i, name) { 48 | var sel = 'input[name=' + name + ']'; 49 | var bool = localStorage[name]; 50 | if (bool == undefined) bool = 'true'; 51 | $(sel).attr('checked', bool == 'true'); 52 | }); 53 | }; 54 | 55 | restore_options(); 56 | $("button").click(save_options); 57 | 58 | }); 59 | 60 | -------------------------------------------------------------------------------- /css/tipsy.css: -------------------------------------------------------------------------------- 1 | .tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; } 2 | .tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; } 3 | 4 | /* Rounded corners */ 5 | .tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } 6 | 7 | /* Uncomment for shadow */ 8 | /*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/ 9 | 10 | .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; } 11 | 12 | /* Rules to colour arrows */ 13 | .tipsy-arrow-n { border-bottom-color: #000; } 14 | .tipsy-arrow-s { border-top-color: #000; } 15 | .tipsy-arrow-e { border-left-color: #000; } 16 | .tipsy-arrow-w { border-right-color: #000; } 17 | 18 | .tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; } 19 | .tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} 20 | .tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} 21 | .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } 22 | .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } 23 | .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } 24 | .tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; } 25 | .tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; } -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Kippt", 3 | "version": "1.1.9", 4 | "manifest_version": 2, 5 | "description": "Kippt.com's Chrome extension", 6 | "homepage_url": "https://kippt.com", 7 | "icons": { 8 | "16": "img/icon16.png", 9 | "48": "img/icon48.png", 10 | "128": "img/icon128.png" 11 | }, 12 | "permissions": [ 13 | "tabs", 14 | "contextMenus", 15 | "https://kippt.com/" 16 | ], 17 | 18 | "web_accessible_resources": [ 19 | "img/twitter-sprite.png", 20 | "img/icon16.png", 21 | "img/dribbble-icon.png" 22 | ], 23 | 24 | "omnibox": { "keyword" : "k" }, 25 | "options_page": "options.html", 26 | "background": { 27 | "page" : "background.html" 28 | }, 29 | 30 | "browser_action": { 31 | "default_icon": "img/icon19.png", 32 | "default_title": "Kippt this page", 33 | "default_popup": "extension.html" 34 | }, 35 | "content_scripts": [{ 36 | "js": ["js/kippt_content.js"], 37 | "matches": ["http://*/*", "https://*/*"] 38 | }, 39 | { 40 | "all_frames": true, 41 | "js": ["js/kippt_extension.js"], 42 | "matches": ["https://kippt.com/extensions*"] 43 | }, 44 | { 45 | "js": ["js/vendor/jquery.js", "js/inject/popup.js", "js/inject/hackernews.js"], 46 | "run_at": "document_end", 47 | "matches": [ 48 | "*://news.ycombinator.com/*", 49 | "*://news.ycombinator.net/*", 50 | "*://news.ycombinator.org/*", 51 | "*://hackerne.ws/*" 52 | 53 | ] 54 | }, 55 | { 56 | "js": ["js/vendor/jquery.js", "js/inject/popup.js", "js/inject/twitter.js"], 57 | "matches": ["*://*.twitter.com/*"] 58 | }, 59 | { 60 | "js": ["js/vendor/jquery.js", "js/inject/popup.js", "js/inject/quora.js"], 61 | "matches": ["*://*.quora.com/*"] 62 | }, 63 | { 64 | "js": ["js/vendor/jquery.js", "js/inject/popup.js", "js/inject/dribbble.js"], 65 | "css": ["css/inject/dribbble.css"], 66 | "matches": ["*://*.dribbble.com/shots/*"] 67 | }, 68 | { 69 | "js": ["js/vendor/jquery.js", "js/inject/popup.js", "js/inject/googlereader.js"], 70 | "matches": ["*://*.google.com/reader/*"] 71 | }] 72 | 73 | } 74 | -------------------------------------------------------------------------------- /js/inject/googlereader.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | var openPopup = function(a, title, url) { 3 | data = { 4 | title: title, 5 | url: url, 6 | source: "chrome_extension_reader" 7 | }; 8 | KipptOpenPopup(data); 9 | }; 10 | 11 | var hasKipptAction = function(div) { 12 | return $('.action-kippt', div).length > 0 13 | }; 14 | 15 | var getShareContent = function (el) { 16 | var link = $('a.entry-title-link', el); 17 | var title = link.text(); 18 | var url = link.attr('href'); 19 | return {title: title, url: url}; 20 | }; 21 | 22 | var inject = function() { 23 | $('div#viewer-container').on('click', 'div.expanded', function(event) { 24 | // Mouseover fired for child elements so need to find the right div 25 | var el = event.target; 26 | 27 | while (!$(el).hasClass('entry')) { 28 | if (el == undefined) 29 | return; 30 | el = el.parentElement; 31 | } 32 | el = $(el); 33 | 34 | // Actions list 35 | var div = $('.entry-actions', $(el)); 36 | 37 | // Don't add kippt link again 38 | if (hasKipptAction(div)) 39 | return; 40 | 41 | // Insert kippt link at the end 42 | var sprite = chrome.extension.getURL('/img/icon16.png'); 43 | var a = $('Kippt'); 44 | a.on('click', function(e) { 45 | e.preventDefault(); 46 | var content = getShareContent(el); 47 | openPopup(a, content.title, content.url); 48 | }); 49 | 50 | var newAction = $(''); 51 | newAction.append(a); 52 | 53 | var c = div.children(); 54 | var lastAction = c[c.length - 1]; 55 | $(lastAction).after(newAction); 56 | 57 | }); 58 | }; 59 | 60 | // Check opt-out status 61 | chrome.extension.sendRequest({method: 'getStorage'}, function(response) { 62 | var bool = response.storage['inject_google_reader']; 63 | if (bool == 'true' || bool == undefined) inject(); 64 | }); 65 | 66 | }); 67 | -------------------------------------------------------------------------------- /js/background.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | // Functions for socket.js 3 | window.KipptExtension = { 4 | taskReceived: function(msg) { 5 | // Helper function for clip creation 6 | var createNewClip = function(msg) { 7 | // Remove variable 'type', added by Chrome 8 | delete msg.type; 9 | var isFavorite = msg['is_favorite']; 10 | delete msg['is_favorite']; 11 | 12 | var type; 13 | if (!msg.id) { 14 | // Create new 15 | type = 'POST' 16 | url = 'https://kippt.com/api/clips/'; 17 | } else { 18 | // Update 19 | type = 'PUT' 20 | url = 'https://kippt.com/api/clips/'+msg.id+'/' 21 | } 22 | 23 | $.ajax({ 24 | url: url, 25 | type: type, 26 | dataType: 'json', 27 | data: JSON.stringify(msg) 28 | }) 29 | .done(function(data){ 30 | // Clear page cache 31 | localStorage.removeItem('cache-title'); 32 | localStorage.removeItem('cache-notes'); 33 | // Set favorite if selected 34 | if (isFavorite) { 35 | $.ajax({ 36 | url: 'https://kippt.com' + data['resource_uri'] + 'favorite/', 37 | type: 'POST', 38 | dataType: 'json', 39 | }) 40 | } 41 | }) 42 | .fail(function(jqXHR, textStatus){ 43 | alert( "Something went wrong when saving. Try again or contact hello@kippt.com"); 44 | }); 45 | } 46 | 47 | // New list 48 | if (msg['new_list']) { 49 | $.ajax({ 50 | url: 'https://kippt.com/api/lists/', 51 | type: 'POST', 52 | dataType: 'json', 53 | data: JSON.stringify(msg['new_list']) 54 | }) 55 | .done(function(data){ 56 | // Create clip with new list 57 | msg['list'] = data.id; 58 | createNewClip(msg); 59 | }) 60 | .fail(function(){ 61 | alert( "Something went wrong when saving. Try again or contact hello@kippt.com"); 62 | }); 63 | } else { 64 | // Create clip with existing list 65 | createNewClip(msg); 66 | } 67 | } 68 | }; 69 | 70 | // Message passing 71 | chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { 72 | if (request.method == 'getStorage') { 73 | sendResponse({storage: localStorage}); 74 | } else { 75 | sendResponse({}); // snub them. 76 | } 77 | }); 78 | 79 | })(); 80 | 81 | -------------------------------------------------------------------------------- /js/inject/twitter.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $('head').append(''); 3 | 4 | var openPopup = function(a, title, url, notes) { 5 | data = { 6 | title: title, 7 | url: url, 8 | notes: notes, 9 | source: "chrome_extension_twitter" 10 | }; 11 | KipptOpenPopup(data); 12 | }; 13 | 14 | var hasKipptAction = function(ul) { 15 | var found = false; 16 | $.each(ul.children(), function(i, li) { 17 | if ($(li).hasClass('action-kippt')) { 18 | found = true; 19 | return false; 20 | } 21 | }); 22 | return found; 23 | }; 24 | 25 | var getShareContent = function(parentEl) { 26 | var tweetEl = $('.js-tweet-text', parentEl); 27 | 28 | // Ignoring hashtag or @reply links 29 | var links = $('a:not(.twitter-hashtag, .twitter-atreply)', tweetEl); 30 | var a = null; 31 | var url = null; 32 | var tweetUrl = $('.time a', parentEl)[0].href; 33 | if (links.length >= 1) { 34 | // Take the first link 35 | a = links[0]; 36 | url = a.href; 37 | } 38 | 39 | // Make a copy to extract text 40 | var el = $('' + tweetEl.html() + ''); 41 | if (a) $('a', el).remove() // Remove all links 42 | var title = el.text(); 43 | title = title.replace(/(\r\n|\n|\r)/gm, ''); // Strip newlines etc 44 | 45 | return {url: url, title: title, tweetUrl: tweetUrl}; 46 | }; 47 | 48 | var inject = function() { 49 | $('div.content-main').on('mouseover', '.js-stream-item', function(event) { 50 | // Mouseover fired for child elements so need to find the right div 51 | var el = event.target; 52 | while (!$(el).hasClass('js-stream-item')) { 53 | if (el == undefined) 54 | return; 55 | el = el.parentElement; 56 | } 57 | el = $(el); 58 | 59 | // Actions list 60 | var ul = $('ul.tweet-actions', $(el)); 61 | 62 | // Don't add kippt link again 63 | if (hasKipptAction(ul)) 64 | return; 65 | 66 | // Insert kippt link at the end 67 | var sprite = chrome.extension.getURL('/img/twitter-sprite.png'); 68 | var content = getShareContent(el); 69 | var a = $('Kippt'); 70 | 71 | a.on('click', function(e) { 72 | e.preventDefault(); 73 | if (content.url) 74 | openPopup(a, content.title, content.url, null); 75 | else 76 | var notes = 'Via ' + content.tweetUrl; 77 | openPopup(a, content.title, content.tweetUrl, notes); 78 | }); 79 | 80 | var newAction = $('
  • '); 81 | newAction.append(a); 82 | 83 | var c = ul.children(); 84 | var lastAction = c[c.length - 1]; 85 | $(lastAction).after(newAction); 86 | 87 | }); 88 | }; 89 | 90 | // Check opt-out status 91 | chrome.extension.sendRequest({method: 'getStorage'}, function(response) { 92 | var bool = response.storage['inject_twitter']; 93 | if (bool == 'true' || bool == undefined) inject(); 94 | }); 95 | 96 | }); 97 | -------------------------------------------------------------------------------- /js/vendor/spin.js: -------------------------------------------------------------------------------- 1 | //fgnass.github.com/spin.js#v1.2.5 2 | (function(a,b,c){function g(a,c){var d=b.createElement(a||"div"),e;for(e in c)d[e]=c[e];return d}function h(a){for(var b=1,c=arguments.length;b>1):c.left+e)+"px",top:(c.top=="auto"?i.y-h.y+(a.offsetHeight>>1):c.top+e)+"px"})),d.setAttribute("aria-role","progressbar"),b.lines(d,b.opts);if(!f){var j=0,k=c.fps,m=k/c.speed,o=(1-c.opacity)/(m*c.trail/100),p=m/c.lines;!function q(){j++;for(var a=c.lines;a;a--){var e=Math.max(1-(j+a*p)%m*o,c.opacity);b.opacity(d,c.lines-a,e,c)}b.timeout=b.el&&setTimeout(q,~~(1e3/k))}()}return b},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=c),this},lines:function(a,b){function e(a,d){return l(g(),{position:"absolute",width:b.length+b.width+"px",height:b.width+"px",background:a,boxShadow:d,transformOrigin:"left",transform:"rotate("+~~(360/b.lines*c+b.rotate)+"deg) translate("+b.radius+"px"+",0)",borderRadius:(b.width>>1)+"px"})}var c=0,d;for(;c',b)}var b=l(g("group"),{behavior:"url(#default#VML)"});!k(b,"transform")&&b.adj?(i.addRule(".spin-vml","behavior:url(#default#VML)"),p.prototype.lines=function(b,c){function f(){return l(a("group",{coordsize:e+" "+e,coordorigin:-d+" "+ -d}),{width:e,height:e})}function k(b,e,g){h(i,h(l(f(),{rotation:360/c.lines*b+"deg",left:~~e}),h(l(a("roundrect",{arcsize:1}),{width:d,height:c.width,left:c.radius,top:-c.width>>1,filter:g}),a("fill",{color:c.color,opacity:c.opacity}),a("stroke",{opacity:0}))))}var d=c.length+c.width,e=2*d,g=-(c.width+c.length)*2+"px",i=l(f(),{position:"absolute",top:g,left:g}),j;if(c.shadow)for(j=1;j<=c.lines;j++)k(j,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(j=1;j<=c.lines;j++)k(j);return h(b,i)},p.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d 2 | 3 | 4 | Kippt Options 5 | 103 | 104 | 105 |
    106 |

    Kippt Extension Settings

    107 |
    108 |

    Button style

    109 |
      110 |
    • 111 |
    • 112 |
    • 113 |
    114 |
    115 | 125 |
    126 | 127 |
    128 |
    129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /extension.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    13 |
    14 | 15 |
    16 |
    17 | Modify existing clip 18 |
    19 | 20 | 21 | 22 |
    23 | 24 |
    25 | 26 |
    27 |
    28 | 29 |
    30 | 31 |
    32 | 35 |
    36 | 37 | 38 |
    39 |
    40 | 41 |
    42 |
    43 | 44 |
    45 | 49 | 50 | 54 | 55 |
    56 | 57 | 58 |
    59 | 60 |
    61 | 62 | 63 |
    64 | 65 |
    66 | 67 | 68 |
    69 | 70 |
    71 | 72 | 73 |
    74 | 75 |
    76 | 77 | 78 |
    79 | 80 |
    81 | 82 | 83 |
    84 | 85 | 86 |
    87 |
    88 | 89 | -------------------------------------------------------------------------------- /js/vendor/socket.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Chrome Extension Socket 3 | * 4 | * 5 | * Copyright (C) 2012, JJ Ford (jj.n.ford@gmail.com) 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | * this software and associated documentation files (the "Software"), to deal in 9 | * the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is furnished to do 12 | * so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | */ 26 | (function() { 27 | 28 | // --------------------------------------------------------------------------------------------- 29 | // Override these methods <--------------------------------------------------------------------- 30 | // --------------------------------------------------------------------------------------------- 31 | 32 | /** 33 | * Triggered when the extension popup receives a message from the extension background page. 34 | * Executes on the extension popup. 35 | * 36 | * @param msg A message object. 37 | */ 38 | function popupMessageReceived(msg) {}; 39 | 40 | /** 41 | * Triggered when extension background page receives a message from the extension popup. 42 | * Executes on the extension background page. 43 | * 44 | * @param msg A message object. 45 | */ 46 | function backgroundMessageReceived(msg) {}; 47 | 48 | /** 49 | * Triggered when the extension background page receives a new task message. 50 | * Executes on the extension background page. 51 | * 52 | * @param A message object. 53 | */ 54 | function taskReceived(msg) { 55 | KipptExtension.taskReceived(msg); 56 | }; 57 | 58 | /** 59 | * Triggered when an extension background task is started. 60 | * Executes on the extension popup. 61 | */ 62 | function taskStarted() {}; 63 | 64 | /** 65 | * Triggered when all extension background tasks have been completed. 66 | * Executes on the extension popup. 67 | */ 68 | function tasksComplete() {}; 69 | 70 | // --------------------------------------------------------------------------------------------- 71 | // WARNING: IF SOURCE IS ALTERED BEYOND THIS POINT THERE IS RISK OF BREAKING SOMETHING. -------- 72 | // --------------------------------------------------------------------------------------------- 73 | 74 | window.Socket = { 75 | 76 | init: function() { 77 | this.tasks = 0; 78 | this.port = chrome.extension.connect({name: "down"}); 79 | this.bind(); 80 | }, 81 | 82 | bind: function() { 83 | chrome.extension.onConnect.addListener( function(port) { 84 | if(port.name === "down") { 85 | Socket.port = chrome.extension.connect({name: "up"}); 86 | } 87 | port.onMessage.addListener( function(msg) { 88 | Socket.onMessage(msg); 89 | }); 90 | Socket.port.onDisconnect.addListener( function(port) { 91 | port.onMessage.removeListener(); 92 | Socket.port.onMessage.removeListener(); 93 | }); 94 | }); 95 | }, 96 | 97 | onMessage: function(msg) { 98 | try { 99 | if(msg.type === "message") { 100 | if(Socket.port.name == "up") { 101 | backgroundMessageReceived(msg); 102 | } else { 103 | popupMessageReceived(msg); 104 | } 105 | } else if(msg.type === "task") { 106 | Socket.tasks++; 107 | taskReceived(msg); 108 | } else if(msg.type === "taskComplete") { 109 | tasksComplete(); 110 | } 111 | } catch(UnknownMesssageType) {} 112 | }, 113 | 114 | postMessage: function(msg) { 115 | try { 116 | if(!msg) { 117 | msg = {}; 118 | } 119 | msg.type = "message"; 120 | Socket.port.postMessage(msg); 121 | } catch(PortPostException) {} 122 | }, 123 | 124 | postTask: function(msg) { 125 | if(Socket.port.name === "down") { 126 | taskStarted(msg); 127 | } 128 | try { 129 | if(!msg) { 130 | msg = {}; 131 | } 132 | msg.type = "task"; 133 | Socket.port.postMessage(msg); 134 | } catch(PortPostException) {} 135 | }, 136 | 137 | postTaskComplete: function() { 138 | if(Socket.tasks > 0) { 139 | --Socket.tasks; 140 | } 141 | if(Socket.tasks === 0) { 142 | try { 143 | Socket.port.postMessage({type: "taskComplete"}); 144 | } catch(PortPostException) {} 145 | } 146 | } 147 | }; 148 | 149 | Socket.init(); 150 | 151 | })(); -------------------------------------------------------------------------------- /js/vendor/blur.js: -------------------------------------------------------------------------------- 1 | // Stackblur, courtesy of Mario Klingemann: http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html 2 | (function(l){l.fn.blurjs=function(e){function O(){this.a=this.b=this.g=this.r=0;this.next=null}var y=document.createElement("canvas"),P=!1,H=l(this).selector.replace(/[^a-zA-Z0-9]/g,"");if(y.getContext){var e=l.extend({source:"body",radius:5,overlay:"",offset:{x:0,y:0},optClass:"",cache:!1,cacheKeyPrefix:"blurjs-",draggable:!1,debug:!1},e),R=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345, 3 | 328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309, 4 | 305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],S=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20, 5 | 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, 6 | 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];return this.each(function(){var A=l(this),I=l(e.source),B=I.css("backgroundImage").replace(/"/g,"").replace(/url\(|\)$/ig,"");ctx=y.getContext("2d");tempImg=new Image;tempImg.onload=function(){if(P)j=tempImg.src;else{y.style.display="none";y.width=tempImg.width;y.height=tempImg.height;ctx.drawImage(tempImg,0,0);var j=y.width,q=y.height,k=e.radius;if(!(isNaN(k)||1>k)){var k= 7 | k|0,M=y.getContext("2d"),l;try{try{l=M.getImageData(0,0,j,q)}catch(L){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),l=M.getImageData(0,0,j,q)}catch(T){throw alert("Cannot access local image"),Error("unable to access local image data: "+T);}}}catch(U){throw alert("Cannot access image"),Error("unable to access image data: "+U);}var c=l.data,u,z,a,d,f,J,g,h,i,v,w,x,m,n,o,r,s,t,C;u=k+k+1;var K=j-1,N=q-1,p=k+1,D=p*(p+1)/2,E=new O,b=E;for(a=1;a>G,c[f+1]=h*F>>G,c[f+2]=i*F>>G,g-=v,h-=w,i-=x,v-=a.r,w-=a.g,x-=a.b,d=J+((d=u+k+1)>G,c[d+1]=h*F>>G,c[d+2]=i*F>>G,g-=v,h-=w,i-=x,v-=a.r,w-=a.g,x-=a.b,d=u+((d=z+p) div { 165 | padding:2px; 166 | width:41px; 167 | height:24px; 168 | display:inline-block; 169 | line-height:20px; 170 | border-radius:2px; 171 | margin-top:3px; 172 | position:relative; 173 | } 174 | 175 | #kippt-actions .toggle { 176 | display:inline-block; 177 | width:20px; 178 | height:20px; 179 | text-align:center; 180 | margin-top: 1px; 181 | border-radius:2px; 182 | line-height:18px; 183 | vertical-align:middle; 184 | } 185 | 186 | #kippt-actions .toggle { 187 | background:url(../img/extension-sprite.png) no-repeat; 188 | } 189 | 190 | #kippt-actions .twitter .toggle { 191 | background-position:-25px -25px; 192 | } 193 | 194 | #kippt-actions .facebook .toggle { 195 | background-position:-25px 1px; 196 | } 197 | 198 | #kippt-actions .buffer .toggle { 199 | background-position:-25px -56px; 200 | } 201 | 202 | #kippt-actions .appdotnet .toggle { 203 | background-position:-84px -28px; 204 | } 205 | 206 | #kippt-actions .tumblr .toggle { 207 | background-position:-54px -28px; 208 | } 209 | 210 | #kippt-actions .instapaper .toggle { 211 | background-position:-54px -57px; 212 | } 213 | 214 | #kippt-actions .readability .toggle { 215 | background-position:-54px -83px; 216 | } 217 | 218 | #kippt-actions .pocket .toggle { 219 | background-position:-25px -84px; 220 | } 221 | 222 | #kippt-actions .buffer, #kippt-actions .appdotnet, #kippt-actions .tumblr, #kippt-actions .instapaper, #kippt-actions .readability, #kippt-actions .pocket { 223 | display:none; 224 | } 225 | 226 | #kippt-actions .connect a { 227 | display:block; 228 | width:45px; 229 | height:45px; 230 | position:absolute; 231 | top:0; 232 | right:0; 233 | } 234 | 235 | #submit_clip, a.button { 236 | float: right; 237 | margin: 0 2px 0 0; 238 | min-width: 73px; 239 | background-color: #EFEFEF; 240 | background-image: -moz-linear-gradient(white, #EFEFEF); 241 | background-image: -o-linear-gradient(white, #EFEFEF); 242 | background-image: -ms-linear-gradient(white, #EFEFEF); 243 | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, white), color-stop(1, #EFEFEF)); 244 | background-image: -webkit-linear-gradient(white, #EFEFEF); 245 | box-shadow: 0 1px 1px #EEE; 246 | 247 | font-weight: bold; 248 | border: 1px solid #CCC; 249 | border-top: 1px solid #DDD; 250 | color: #333; 251 | text-shadow: 0 1px 0px white; 252 | border-bottom: 1px solid #AAA; 253 | padding: 0.5em 0.8em; 254 | -webkit-border-radius: 3px; 255 | -moz-border-radius: 3px; 256 | -ms-border-radius: 3px; 257 | -o-border-radius: 3px; 258 | border-radius: 3px; 259 | 260 | -webkit-transition: 0.15s border-color linear; 261 | -moz-transition: 0.15s border-color linear; 262 | white-space: nowrap; 263 | vertical-align: middle; 264 | 265 | font-size: 13px; 266 | line-height: 18px; 267 | position:absolute; 268 | right:10px; 269 | bottom:8px; 270 | } 271 | 272 | #submit_clip:hover, a.button:hover { 273 | background-position: 0 0; 274 | border-color: #BBB; 275 | -webkit-transition: 0.15s border-color linear; 276 | -moz-transition: 0.15s border-color linear; 277 | 278 | background-position: 0 0px; 279 | border: 1px solid #999; 280 | -moz-box-shadow: 0 0 3px #ccc; 281 | -ms-box-shadow: 0 0 3px #ccc; 282 | -o-box-shadow: 0 0 3px #ccc; 283 | -webkit-box-shadow: 0 0 3px #CCC; 284 | box-shadow: 0 0 3px #CCC; 285 | } 286 | 287 | #submit_clip:focus, a.button:focus { 288 | outline: 5px auto -webkit-focus-ring-color; 289 | outline-offset: -2px; 290 | } 291 | 292 | #submit_clip:active, a.button:active { 293 | background-image: none 294 | box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); 295 | background-color: #e6e6e6; 296 | background-color: #d9d9d9 \9; 297 | outline: 0; 298 | } 299 | -------------------------------------------------------------------------------- /js/kippt_extension.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | var existingClipId; 3 | 4 | Kippt = { 5 | userId: null 6 | }; 7 | 8 | // Load user data from cache 9 | if (localStorage.getItem('kipptUser')) 10 | Kippt.userId = localStorage.getItem('kipptUserId'); 11 | 12 | Kippt.closePopover = function() { 13 | window.close(); 14 | }; 15 | 16 | Kippt.openTab = function(url) { 17 | chrome.tabs.create({url: url}); 18 | }; 19 | 20 | Kippt.updateLists = function(data) { 21 | var existingSelection = $('#id_list option:selected').val(); 22 | 23 | // Clear loading 24 | $('#id_list').html(''); 25 | for (var i in data) { 26 | var list = data[i], title; 27 | 28 | // Add user to title if not the current user 29 | if (Kippt.userId && Kippt.userId != list['user']['id']) 30 | title = list['title'] + ' (' + list['user']['username'] + ')'; 31 | else 32 | title = list['title']; 33 | $('#id_list').append(new Option(title, list['id'])); 34 | } 35 | if (!existingSelection) 36 | $('#id_list option').first().attr('selected', 'selected'); 37 | else 38 | $('#id_list option[value='+existingSelection+']').attr('selected', 'selected'); 39 | 40 | $('#id_list').append(''); 41 | $('#id_list').on('change', function(){ 42 | if ($(this).children("option#new-list-toggle:selected").length) { 43 | $('#id_list').hide(); 44 | $('#new_list').css('display', 'inline-block'); 45 | $('#id_new_list').focus(); 46 | } 47 | }); 48 | }; 49 | 50 | chrome.tabs.getSelected(null, function(tab) { 51 | // Extension 52 | chrome.tabs.sendRequest(tab.id, {helper: 'get_note'}, function(response) { 53 | if (response){ 54 | selected_note = response.note; 55 | } else { 56 | selected_note = ''; 57 | } 58 | 59 | // Kippt extension 60 | chrome.tabs.getSelected(null, function(tab){ 61 | var kippt_url = 'https://kippt.com/extensions/new'; 62 | var tab_url = tab.url; 63 | var tab_title = tab.title; 64 | 65 | 66 | $('#id_title').val(tab_title.trim()); 67 | $('#id_url').val(tab_url); 68 | $('#id_notes').val(selected_note.trim()); 69 | 70 | $('textarea').focus(); 71 | 72 | // Get from cache 73 | if (localStorage.getItem('cache-title')) 74 | $('#id_title').val( localStorage.getItem('cache-title') ); 75 | if (localStorage.getItem('cache-notes')) 76 | $('#id_notes').val( localStorage.getItem('cache-notes') ); 77 | }); 78 | 79 | if (tab.url.indexOf('chrome://') == 0) { 80 | // Not tab content - Open Kippt in it 81 | chrome.tabs.update(tab.id, {url: 'https://kippt.com/'}); 82 | Kippt.closePopover(); 83 | } else { 84 | // General variables 85 | var url = tab.url, 86 | existingClipId = false; 87 | 88 | // Init spinner 89 | var opts = { 90 | lines: 9, 91 | length: 2, 92 | width: 2, 93 | radius: 3, 94 | rotate: 0, 95 | color: '#111', 96 | speed: 1, 97 | trail: 27, 98 | shadow: false, 99 | hwaccel: false, 100 | className: 'spinner', 101 | zIndex: 2e9, 102 | top: 'auto', 103 | left: 'auto' 104 | }; 105 | var spinner = new Spinner(opts).spin(); 106 | 107 | // Get user data 108 | $.ajax({ 109 | url: 'https://kippt.com/api/account/?include_data=services', 110 | type: "GET", 111 | dataType: 'json' 112 | }) 113 | .done(function(data){ 114 | Kippt.userId = data['id']; 115 | localStorage.setItem('kipptUserId', data['id']); 116 | 117 | $.each(data.services, function(name, connected) { 118 | if (connected) { 119 | $("#kippt-actions ." + name).toggleClass("connected", connected); 120 | $("#kippt-actions ." + name).css('display', 'inline-block'); 121 | } 122 | }); 123 | }) 124 | .fail(function(jqXHR, textStatus){ 125 | // Logged out user, open login page 126 | Kippt.openTab('https://kippt.com/login/'); 127 | Kippt.closePopover(); 128 | }); 129 | 130 | // Check for duplicates 131 | $('.existing .loading').append(spinner.el); 132 | $.ajax({ 133 | url: 'https://kippt.com/api/clips/?include_data=list&url='+escape(url), 134 | type: "GET", 135 | dataType: 'json' 136 | }) 137 | .done(function(response){ 138 | $('.existing .loading').hide(); 139 | if (response.meta.total_count) { 140 | var duplicate = response.objects[0]; 141 | $('.existing a').show(); 142 | $('.existing a').click(function(e){ 143 | existingClipId = duplicate.id; 144 | $('#id_title').val(duplicate.title); 145 | $('#id_notes').val(duplicate.notes); 146 | $('#id_list option[value='+duplicate.list.id+']').attr('selected', 'selected'); 147 | $('.existing').hide(); 148 | }); 149 | } 150 | }); 151 | 152 | // Fill lists from cache 153 | var listCache = localStorage.getItem('kipptListCache'); 154 | if (listCache) { 155 | Kippt.updateLists(JSON.parse(listCache)); 156 | } 157 | 158 | // Update lists from remote 159 | $.getJSON( 160 | 'https://kippt.com/api/lists/?limit=0&include_data=user', 161 | function(response) { 162 | var responseJSON = JSON.stringify(response.objects); 163 | // Update only if lists have changed 164 | if (responseJSON !== listCache) { 165 | // Update UI 166 | Kippt.updateLists(response.objects); 167 | // Save to cache 168 | localStorage.setItem('kipptListCache', responseJSON); 169 | } 170 | } 171 | ) 172 | 173 | // Handle save 174 | $('#submit_clip').click(function(e){ 175 | // Data 176 | var data = { 177 | url: url, 178 | title: $('#id_title').val(), 179 | notes: $('#id_notes').val(), 180 | list: $('#id_list option:selected').val(), 181 | source: 'chrome_v1.1' 182 | }; 183 | 184 | // Favorite 185 | if ($('#id_is_favorite').is(':checked')) 186 | data.is_favorite = true; 187 | 188 | 189 | if (existingClipId) { 190 | data.id = existingClipId; 191 | } 192 | 193 | // New list 194 | if ($('#id_new_list').val()) { 195 | data['new_list'] = {}; 196 | data['new_list']['title'] = $('#id_new_list').val() 197 | if ($('#id_private').is(':checked')) 198 | data['new_list'].is_private = true 199 | else 200 | data['new_list'].is_private = false 201 | } 202 | 203 | // Shares 204 | var services = []; 205 | $('.share:checked').each(function(i, elem){ 206 | services.push($(elem).data('service')); 207 | }); 208 | data['share'] = services; 209 | 210 | // Save to Kippt in background 211 | Socket.postTask(data); 212 | Kippt.closePopover(); 213 | }); 214 | 215 | // Cache title & notes on change 216 | $('#id_title').on('keyup change cut paste', function(e){ 217 | localStorage.setItem('cache-title', $('#id_title').val()) 218 | }); 219 | $('#id_notes').on('keyup change cut paste', function(e){ 220 | localStorage.setItem('cache-notes', $('#id_notes').val()) 221 | }); 222 | 223 | $(document).on("keydown", function(e){ 224 | if (e.which == 13 && e.metaKey) { 225 | e.preventDefault(); 226 | $('#submit_clip').click(); 227 | } 228 | }); 229 | } 230 | 231 | // Connect a service to share 232 | $(document).on("click", "#kippt-actions > div:not(.connected)", function() { 233 | Kippt.openTab("https://kippt.com/accounts/settings/connections/"); 234 | Kippt.closePopover(); 235 | }); 236 | 237 | // Configure share tooltips 238 | $("#kippt-actions > div").tipsy({ 239 | gravity: "sw", 240 | title: function() { 241 | var el = $(this); 242 | if (el.hasClass("connected")) { 243 | return "Share on " + el.attr("data-service-name"); 244 | } 245 | else { 246 | return "Click to connect with " + el.attr("data-service-name"); 247 | } 248 | } 249 | }); 250 | }); 251 | }); 252 | }); 253 | -------------------------------------------------------------------------------- /js/vendor/tipsy.js: -------------------------------------------------------------------------------- 1 | // tipsy, facebook style tooltips for jquery 2 | // version 1.0.0a 3 | // (c) 2008-2010 jason frame [jason@onehackoranother.com] 4 | // released under the MIT license 5 | 6 | (function($) { 7 | 8 | function maybeCall(thing, ctx) { 9 | return (typeof thing == 'function') ? (thing.call(ctx)) : thing; 10 | }; 11 | 12 | function isElementInDOM(ele) { 13 | while (ele = ele.parentNode) { 14 | if (ele == document) return true; 15 | } 16 | return false; 17 | }; 18 | 19 | function Tipsy(element, options) { 20 | this.$element = $(element); 21 | this.options = options; 22 | this.enabled = true; 23 | this.fixTitle(); 24 | }; 25 | 26 | Tipsy.prototype = { 27 | show: function() { 28 | var title = this.getTitle(); 29 | if (title && this.enabled) { 30 | var $tip = this.tip(); 31 | 32 | $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title); 33 | $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity 34 | $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body); 35 | 36 | var pos = $.extend({}, this.$element.offset(), { 37 | width: this.$element[0].offsetWidth, 38 | height: this.$element[0].offsetHeight 39 | }); 40 | 41 | var actualWidth = $tip[0].offsetWidth, 42 | actualHeight = $tip[0].offsetHeight, 43 | gravity = maybeCall(this.options.gravity, this.$element[0]); 44 | 45 | var tp; 46 | switch (gravity.charAt(0)) { 47 | case 'n': 48 | tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; 49 | break; 50 | case 's': 51 | tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; 52 | break; 53 | case 'e': 54 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}; 55 | break; 56 | case 'w': 57 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}; 58 | break; 59 | } 60 | 61 | if (gravity.length == 2) { 62 | if (gravity.charAt(1) == 'w') { 63 | tp.left = pos.left + pos.width / 2 - 15; 64 | } else { 65 | tp.left = pos.left + pos.width / 2 - actualWidth + 15; 66 | } 67 | } 68 | 69 | $tip.css(tp).addClass('tipsy-' + gravity); 70 | $tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0); 71 | if (this.options.className) { 72 | $tip.addClass(maybeCall(this.options.className, this.$element[0])); 73 | } 74 | 75 | if (this.options.fade) { 76 | $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity}); 77 | } else { 78 | $tip.css({visibility: 'visible', opacity: this.options.opacity}); 79 | } 80 | } 81 | }, 82 | 83 | hide: function() { 84 | if (this.options.fade) { 85 | this.tip().stop().fadeOut(function() { $(this).remove(); }); 86 | } else { 87 | this.tip().remove(); 88 | } 89 | }, 90 | 91 | fixTitle: function() { 92 | var $e = this.$element; 93 | if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') { 94 | $e.attr('original-title', $e.attr('title') || '').removeAttr('title'); 95 | } 96 | }, 97 | 98 | getTitle: function() { 99 | var title, $e = this.$element, o = this.options; 100 | this.fixTitle(); 101 | var title, o = this.options; 102 | if (typeof o.title == 'string') { 103 | title = $e.attr(o.title == 'title' ? 'original-title' : o.title); 104 | } else if (typeof o.title == 'function') { 105 | title = o.title.call($e[0]); 106 | } 107 | title = ('' + title).replace(/(^\s*|\s*$)/, ""); 108 | return title || o.fallback; 109 | }, 110 | 111 | tip: function() { 112 | if (!this.$tip) { 113 | this.$tip = $('
    ').html('
    '); 114 | this.$tip.data('tipsy-pointee', this.$element[0]); 115 | } 116 | return this.$tip; 117 | }, 118 | 119 | validate: function() { 120 | if (!this.$element[0].parentNode) { 121 | this.hide(); 122 | this.$element = null; 123 | this.options = null; 124 | } 125 | }, 126 | 127 | enable: function() { this.enabled = true; }, 128 | disable: function() { this.enabled = false; }, 129 | toggleEnabled: function() { this.enabled = !this.enabled; } 130 | }; 131 | 132 | $.fn.tipsy = function(options) { 133 | 134 | if (options === true) { 135 | return this.data('tipsy'); 136 | } else if (typeof options == 'string') { 137 | var tipsy = this.data('tipsy'); 138 | if (tipsy) tipsy[options](); 139 | return this; 140 | } 141 | 142 | options = $.extend({}, $.fn.tipsy.defaults, options); 143 | 144 | function get(ele) { 145 | var tipsy = $.data(ele, 'tipsy'); 146 | if (!tipsy) { 147 | tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options)); 148 | $.data(ele, 'tipsy', tipsy); 149 | } 150 | return tipsy; 151 | } 152 | 153 | function enter() { 154 | var tipsy = get(this); 155 | tipsy.hoverState = 'in'; 156 | if (options.delayIn == 0) { 157 | tipsy.show(); 158 | } else { 159 | tipsy.fixTitle(); 160 | setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn); 161 | } 162 | }; 163 | 164 | function leave() { 165 | var tipsy = get(this); 166 | tipsy.hoverState = 'out'; 167 | if (options.delayOut == 0) { 168 | tipsy.hide(); 169 | } else { 170 | setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut); 171 | } 172 | }; 173 | 174 | if (!options.live) this.each(function() { get(this); }); 175 | 176 | if (options.trigger != 'manual') { 177 | var binder = options.live ? 'live' : 'bind', 178 | eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', 179 | eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'; 180 | this[binder](eventIn, enter)[binder](eventOut, leave); 181 | } 182 | 183 | return this; 184 | 185 | }; 186 | 187 | $.fn.tipsy.defaults = { 188 | className: null, 189 | delayIn: 0, 190 | delayOut: 0, 191 | fade: false, 192 | fallback: '', 193 | gravity: 'n', 194 | html: false, 195 | live: false, 196 | offset: 0, 197 | opacity: 0.8, 198 | title: 'title', 199 | trigger: 'hover' 200 | }; 201 | 202 | $.fn.tipsy.revalidate = function() { 203 | $('.tipsy').each(function() { 204 | var pointee = $.data(this, 'tipsy-pointee'); 205 | if (!pointee || !isElementInDOM(pointee)) { 206 | $(this).remove(); 207 | } 208 | }); 209 | }; 210 | 211 | // Overwrite this method to provide options on a per-element basis. 212 | // For example, you could store the gravity in a 'tipsy-gravity' attribute: 213 | // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' }); 214 | // (remember - do not modify 'options' in place!) 215 | $.fn.tipsy.elementOptions = function(ele, options) { 216 | return $.metadata ? $.extend({}, options, $(ele).metadata()) : options; 217 | }; 218 | 219 | $.fn.tipsy.autoNS = function() { 220 | return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n'; 221 | }; 222 | 223 | $.fn.tipsy.autoWE = function() { 224 | return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w'; 225 | }; 226 | 227 | /** 228 | * yields a closure of the supplied parameters, producing a function that takes 229 | * no arguments and is suitable for use as an autogravity function like so: 230 | * 231 | * @param margin (int) - distance from the viewable region edge that an 232 | * element should be before setting its tooltip's gravity to be away 233 | * from that edge. 234 | * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer 235 | * if there are no viewable region edges effecting the tooltip's 236 | * gravity. It will try to vary from this minimally, for example, 237 | * if 'sw' is preferred and an element is near the right viewable 238 | * region edge, but not the top edge, it will set the gravity for 239 | * that element's tooltip to be 'se', preserving the southern 240 | * component. 241 | */ 242 | $.fn.tipsy.autoBounds = function(margin, prefer) { 243 | return function() { 244 | var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)}, 245 | boundTop = $(document).scrollTop() + margin, 246 | boundLeft = $(document).scrollLeft() + margin, 247 | $this = $(this); 248 | 249 | if ($this.offset().top < boundTop) dir.ns = 'n'; 250 | if ($this.offset().left < boundLeft) dir.ew = 'w'; 251 | if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e'; 252 | if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's'; 253 | 254 | return dir.ns + (dir.ew ? dir.ew : ''); 255 | } 256 | }; 257 | 258 | })(jQuery); -------------------------------------------------------------------------------- /js/vendor/json2.js: -------------------------------------------------------------------------------- 1 | /* 2 | json2.js 3 | 2011-10-19 4 | 5 | Public Domain. 6 | 7 | NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. 8 | 9 | See http://www.JSON.org/js.html 10 | 11 | 12 | This code should be minified before deployment. 13 | See http://javascript.crockford.com/jsmin.html 14 | 15 | USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO 16 | NOT CONTROL. 17 | 18 | 19 | This file creates a global JSON object containing two methods: stringify 20 | and parse. 21 | 22 | JSON.stringify(value, replacer, space) 23 | value any JavaScript value, usually an object or array. 24 | 25 | replacer an optional parameter that determines how object 26 | values are stringified for objects. It can be a 27 | function or an array of strings. 28 | 29 | space an optional parameter that specifies the indentation 30 | of nested structures. If it is omitted, the text will 31 | be packed without extra whitespace. If it is a number, 32 | it will specify the number of spaces to indent at each 33 | level. If it is a string (such as '\t' or ' '), 34 | it contains the characters used to indent at each level. 35 | 36 | This method produces a JSON text from a JavaScript value. 37 | 38 | When an object value is found, if the object contains a toJSON 39 | method, its toJSON method will be called and the result will be 40 | stringified. A toJSON method does not serialize: it returns the 41 | value represented by the name/value pair that should be serialized, 42 | or undefined if nothing should be serialized. The toJSON method 43 | will be passed the key associated with the value, and this will be 44 | bound to the value 45 | 46 | For example, this would serialize Dates as ISO strings. 47 | 48 | Date.prototype.toJSON = function (key) { 49 | function f(n) { 50 | // Format integers to have at least two digits. 51 | return n < 10 ? '0' + n : n; 52 | } 53 | 54 | return this.getUTCFullYear() + '-' + 55 | f(this.getUTCMonth() + 1) + '-' + 56 | f(this.getUTCDate()) + 'T' + 57 | f(this.getUTCHours()) + ':' + 58 | f(this.getUTCMinutes()) + ':' + 59 | f(this.getUTCSeconds()) + 'Z'; 60 | }; 61 | 62 | You can provide an optional replacer method. It will be passed the 63 | key and value of each member, with this bound to the containing 64 | object. The value that is returned from your method will be 65 | serialized. If your method returns undefined, then the member will 66 | be excluded from the serialization. 67 | 68 | If the replacer parameter is an array of strings, then it will be 69 | used to select the members to be serialized. It filters the results 70 | such that only members with keys listed in the replacer array are 71 | stringified. 72 | 73 | Values that do not have JSON representations, such as undefined or 74 | functions, will not be serialized. Such values in objects will be 75 | dropped; in arrays they will be replaced with null. You can use 76 | a replacer function to replace those with JSON values. 77 | JSON.stringify(undefined) returns undefined. 78 | 79 | The optional space parameter produces a stringification of the 80 | value that is filled with line breaks and indentation to make it 81 | easier to read. 82 | 83 | If the space parameter is a non-empty string, then that string will 84 | be used for indentation. If the space parameter is a number, then 85 | the indentation will be that many spaces. 86 | 87 | Example: 88 | 89 | text = JSON.stringify(['e', {pluribus: 'unum'}]); 90 | // text is '["e",{"pluribus":"unum"}]' 91 | 92 | 93 | text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); 94 | // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' 95 | 96 | text = JSON.stringify([new Date()], function (key, value) { 97 | return this[key] instanceof Date ? 98 | 'Date(' + this[key] + ')' : value; 99 | }); 100 | // text is '["Date(---current time---)"]' 101 | 102 | 103 | JSON.parse(text, reviver) 104 | This method parses a JSON text to produce an object or array. 105 | It can throw a SyntaxError exception. 106 | 107 | The optional reviver parameter is a function that can filter and 108 | transform the results. It receives each of the keys and values, 109 | and its return value is used instead of the original value. 110 | If it returns what it received, then the structure is not modified. 111 | If it returns undefined then the member is deleted. 112 | 113 | Example: 114 | 115 | // Parse the text. Values that look like ISO date strings will 116 | // be converted to Date objects. 117 | 118 | myData = JSON.parse(text, function (key, value) { 119 | var a; 120 | if (typeof value === 'string') { 121 | a = 122 | /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); 123 | if (a) { 124 | return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], 125 | +a[5], +a[6])); 126 | } 127 | } 128 | return value; 129 | }); 130 | 131 | myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { 132 | var d; 133 | if (typeof value === 'string' && 134 | value.slice(0, 5) === 'Date(' && 135 | value.slice(-1) === ')') { 136 | d = new Date(value.slice(5, -1)); 137 | if (d) { 138 | return d; 139 | } 140 | } 141 | return value; 142 | }); 143 | 144 | 145 | This is a reference implementation. You are free to copy, modify, or 146 | redistribute. 147 | */ 148 | 149 | /*jslint evil: true, regexp: true */ 150 | 151 | /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, 152 | call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, 153 | getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, 154 | lastIndex, length, parse, prototype, push, replace, slice, stringify, 155 | test, toJSON, toString, valueOf 156 | */ 157 | 158 | 159 | // Create a JSON object only if one does not already exist. We create the 160 | // methods in a closure to avoid creating global variables. 161 | 162 | var JSON; 163 | if (!JSON) { 164 | JSON = {}; 165 | } 166 | 167 | (function () { 168 | 'use strict'; 169 | 170 | function f(n) { 171 | // Format integers to have at least two digits. 172 | return n < 10 ? '0' + n : n; 173 | } 174 | 175 | if (typeof Date.prototype.toJSON !== 'function') { 176 | 177 | Date.prototype.toJSON = function (key) { 178 | 179 | return isFinite(this.valueOf()) 180 | ? this.getUTCFullYear() + '-' + 181 | f(this.getUTCMonth() + 1) + '-' + 182 | f(this.getUTCDate()) + 'T' + 183 | f(this.getUTCHours()) + ':' + 184 | f(this.getUTCMinutes()) + ':' + 185 | f(this.getUTCSeconds()) + 'Z' 186 | : null; 187 | }; 188 | 189 | String.prototype.toJSON = 190 | Number.prototype.toJSON = 191 | Boolean.prototype.toJSON = function (key) { 192 | return this.valueOf(); 193 | }; 194 | } 195 | 196 | var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 197 | escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, 198 | gap, 199 | indent, 200 | meta = { // table of character substitutions 201 | '\b': '\\b', 202 | '\t': '\\t', 203 | '\n': '\\n', 204 | '\f': '\\f', 205 | '\r': '\\r', 206 | '"' : '\\"', 207 | '\\': '\\\\' 208 | }, 209 | rep; 210 | 211 | 212 | function quote(string) { 213 | 214 | // If the string contains no control characters, no quote characters, and no 215 | // backslash characters, then we can safely slap some quotes around it. 216 | // Otherwise we must also replace the offending characters with safe escape 217 | // sequences. 218 | 219 | escapable.lastIndex = 0; 220 | return escapable.test(string) ? '"' + string.replace(escapable, function (a) { 221 | var c = meta[a]; 222 | return typeof c === 'string' 223 | ? c 224 | : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 225 | }) + '"' : '"' + string + '"'; 226 | } 227 | 228 | 229 | function str(key, holder) { 230 | 231 | // Produce a string from holder[key]. 232 | 233 | var i, // The loop counter. 234 | k, // The member key. 235 | v, // The member value. 236 | length, 237 | mind = gap, 238 | partial, 239 | value = holder[key]; 240 | 241 | // If the value has a toJSON method, call it to obtain a replacement value. 242 | 243 | if (value && typeof value === 'object' && 244 | typeof value.toJSON === 'function') { 245 | value = value.toJSON(key); 246 | } 247 | 248 | // If we were called with a replacer function, then call the replacer to 249 | // obtain a replacement value. 250 | 251 | if (typeof rep === 'function') { 252 | value = rep.call(holder, key, value); 253 | } 254 | 255 | // What happens next depends on the value's type. 256 | 257 | switch (typeof value) { 258 | case 'string': 259 | return quote(value); 260 | 261 | case 'number': 262 | 263 | // JSON numbers must be finite. Encode non-finite numbers as null. 264 | 265 | return isFinite(value) ? String(value) : 'null'; 266 | 267 | case 'boolean': 268 | case 'null': 269 | 270 | // If the value is a boolean or null, convert it to a string. Note: 271 | // typeof null does not produce 'null'. The case is included here in 272 | // the remote chance that this gets fixed someday. 273 | 274 | return String(value); 275 | 276 | // If the type is 'object', we might be dealing with an object or an array or 277 | // null. 278 | 279 | case 'object': 280 | 281 | // Due to a specification blunder in ECMAScript, typeof null is 'object', 282 | // so watch out for that case. 283 | 284 | if (!value) { 285 | return 'null'; 286 | } 287 | 288 | // Make an array to hold the partial results of stringifying this object value. 289 | 290 | gap += indent; 291 | partial = []; 292 | 293 | // Is the value an array? 294 | 295 | if (Object.prototype.toString.apply(value) === '[object Array]') { 296 | 297 | // The value is an array. Stringify every element. Use null as a placeholder 298 | // for non-JSON values. 299 | 300 | length = value.length; 301 | for (i = 0; i < length; i += 1) { 302 | partial[i] = str(i, value) || 'null'; 303 | } 304 | 305 | // Join all of the elements together, separated with commas, and wrap them in 306 | // brackets. 307 | 308 | v = partial.length === 0 309 | ? '[]' 310 | : gap 311 | ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' 312 | : '[' + partial.join(',') + ']'; 313 | gap = mind; 314 | return v; 315 | } 316 | 317 | // If the replacer is an array, use it to select the members to be stringified. 318 | 319 | if (rep && typeof rep === 'object') { 320 | length = rep.length; 321 | for (i = 0; i < length; i += 1) { 322 | if (typeof rep[i] === 'string') { 323 | k = rep[i]; 324 | v = str(k, value); 325 | if (v) { 326 | partial.push(quote(k) + (gap ? ': ' : ':') + v); 327 | } 328 | } 329 | } 330 | } else { 331 | 332 | // Otherwise, iterate through all of the keys in the object. 333 | 334 | for (k in value) { 335 | if (Object.prototype.hasOwnProperty.call(value, k)) { 336 | v = str(k, value); 337 | if (v) { 338 | partial.push(quote(k) + (gap ? ': ' : ':') + v); 339 | } 340 | } 341 | } 342 | } 343 | 344 | // Join all of the member texts together, separated with commas, 345 | // and wrap them in braces. 346 | 347 | v = partial.length === 0 348 | ? '{}' 349 | : gap 350 | ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' 351 | : '{' + partial.join(',') + '}'; 352 | gap = mind; 353 | return v; 354 | } 355 | } 356 | 357 | // If the JSON object does not yet have a stringify method, give it one. 358 | 359 | if (typeof JSON.stringify !== 'function') { 360 | JSON.stringify = function (value, replacer, space) { 361 | 362 | // The stringify method takes a value and an optional replacer, and an optional 363 | // space parameter, and returns a JSON text. The replacer can be a function 364 | // that can replace values, or an array of strings that will select the keys. 365 | // A default replacer method can be provided. Use of the space parameter can 366 | // produce text that is more easily readable. 367 | 368 | var i; 369 | gap = ''; 370 | indent = ''; 371 | 372 | // If the space parameter is a number, make an indent string containing that 373 | // many spaces. 374 | 375 | if (typeof space === 'number') { 376 | for (i = 0; i < space; i += 1) { 377 | indent += ' '; 378 | } 379 | 380 | // If the space parameter is a string, it will be used as the indent string. 381 | 382 | } else if (typeof space === 'string') { 383 | indent = space; 384 | } 385 | 386 | // If there is a replacer, it must be a function or an array. 387 | // Otherwise, throw an error. 388 | 389 | rep = replacer; 390 | if (replacer && typeof replacer !== 'function' && 391 | (typeof replacer !== 'object' || 392 | typeof replacer.length !== 'number')) { 393 | throw new Error('JSON.stringify'); 394 | } 395 | 396 | // Make a fake root object containing our value under the key of ''. 397 | // Return the result of stringifying the value. 398 | 399 | return str('', {'': value}); 400 | }; 401 | } 402 | 403 | 404 | // If the JSON object does not yet have a parse method, give it one. 405 | 406 | if (typeof JSON.parse !== 'function') { 407 | JSON.parse = function (text, reviver) { 408 | 409 | // The parse method takes a text and an optional reviver function, and returns 410 | // a JavaScript value if the text is a valid JSON text. 411 | 412 | var j; 413 | 414 | function walk(holder, key) { 415 | 416 | // The walk method is used to recursively walk the resulting structure so 417 | // that modifications can be made. 418 | 419 | var k, v, value = holder[key]; 420 | if (value && typeof value === 'object') { 421 | for (k in value) { 422 | if (Object.prototype.hasOwnProperty.call(value, k)) { 423 | v = walk(value, k); 424 | if (v !== undefined) { 425 | value[k] = v; 426 | } else { 427 | delete value[k]; 428 | } 429 | } 430 | } 431 | } 432 | return reviver.call(holder, key, value); 433 | } 434 | 435 | 436 | // Parsing happens in four stages. In the first stage, we replace certain 437 | // Unicode characters with escape sequences. JavaScript handles many characters 438 | // incorrectly, either silently deleting them, or treating them as line endings. 439 | 440 | text = String(text); 441 | cx.lastIndex = 0; 442 | if (cx.test(text)) { 443 | text = text.replace(cx, function (a) { 444 | return '\\u' + 445 | ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 446 | }); 447 | } 448 | 449 | // In the second stage, we run the text against regular expressions that look 450 | // for non-JSON patterns. We are especially concerned with '()' and 'new' 451 | // because they can cause invocation, and '=' because it can cause mutation. 452 | // But just to be safe, we want to reject all unexpected forms. 453 | 454 | // We split the second stage into 4 regexp operations in order to work around 455 | // crippling inefficiencies in IE's and Safari's regexp engines. First we 456 | // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we 457 | // replace all simple value tokens with ']' characters. Third, we delete all 458 | // open brackets that follow a colon or comma or that begin the text. Finally, 459 | // we look to see that the remaining characters are only whitespace or ']' or 460 | // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. 461 | 462 | if (/^[\],:{}\s]*$/ 463 | .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') 464 | .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') 465 | .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { 466 | 467 | // In the third stage we use the eval function to compile the text into a 468 | // JavaScript structure. The '{' operator is subject to a syntactic ambiguity 469 | // in JavaScript: it can begin a block or an object literal. We wrap the text 470 | // in parens to eliminate the ambiguity. 471 | 472 | j = eval('(' + text + ')'); 473 | 474 | // In the optional fourth stage, we recursively walk the new structure, passing 475 | // each name/value pair to a reviver function for possible transformation. 476 | 477 | return typeof reviver === 'function' 478 | ? walk({'': j}, '') 479 | : j; 480 | } 481 | 482 | // If the text is not JSON parseable, then a SyntaxError is thrown. 483 | 484 | throw new SyntaxError('JSON.parse'); 485 | }; 486 | } 487 | }()); -------------------------------------------------------------------------------- /js/vendor/jquery.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.7.2 jquery.com | jquery.org/license */ 2 | (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,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;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};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=m.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.7.2",length:0,size:function(){return this.length},toArray:function(){return F.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)?E.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(),A.add(a);return this},eq:function(a){a=+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(F.apply(this,arguments),"slice",F.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:E,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;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.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):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(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(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},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?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
    a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.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:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
    "+""+"
    ",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
    t
    ",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
    ",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([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&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.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.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),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,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=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},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( 3 | a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.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(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.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]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),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]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.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!!m(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=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([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&&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=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null: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=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=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(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.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:[]}},o.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&&(o.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")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[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}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.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 m(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;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;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)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));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(S(c[0])||S(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);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).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 V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bh=U(c);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){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},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){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):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 4 | .clean(arguments);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.clean(arguments));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){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&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,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.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,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),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&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.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(bM,"")).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||bN.test(this.nodeName)||bH.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(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(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?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[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","*":bW},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},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),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>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),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.Callbacks("once memory"),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=bG.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.add,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(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.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]!=="*"?", "+bW+"; 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=bZ(bT,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){if(s<2)w(-1,z);else throw 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(bC,"+")}}),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=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);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);try{m.text=h.responseText}catch(a){}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;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-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({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); --------------------------------------------------------------------------------