diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000..10fbbe7 --- /dev/null +++ b/.cspell.json @@ -0,0 +1,33 @@ +// cSpell Settings +{ + "version": "0.2", + // language - current active spelling language. + "language": "en,nl", + // import - import dictionaries. + "import": ["@cspell/dict-nl-nl/cspell-ext.json"], + // words - list of words to be always considered correct. + "words": [ + "absmiddle", + "ajax", + "blockquotes", + "Dabblet", + "darkred", + "datetime", + "Dumpert", + "GM_xmlhttpRequest", + "greasemonkey", + "issuetracker", + "jerone", + "Linkify", + "maxlength", + "Mottie's", + "nofollow", + "octicon", + "pjax", + "tampermonkey", + "userscript", + "userscripts", + "violentmonkey", + "whitespaces" + ] +} diff --git a/.ecrc b/.ecrc new file mode 100644 index 0000000..ad72bb7 --- /dev/null +++ b/.ecrc @@ -0,0 +1,23 @@ +{ + "AllowedContentTypes": [], + "Debug": false, + "Disable": { + "EndOfLine": false, + "IndentSize": false, + "Indentation": false, + "InsertFinalNewline": false, + "MaxLineLength": false, + "TrimTrailingWhitespace": false + }, + "Exclude": [ + "Horizon_TV_Fixer/", + "LICENSE.txt" + ], + "Format": "", + "IgnoreDefaults": false, + "NoColor": false, + "PassedFiles": [], + "SpacesAftertabs": false, + "Verbose": false, + "Version": "2.8.0" +} diff --git a/.editorconfig b/.editorconfig index 0f414fb..0ff0317 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,15 @@ root = true indent_style = tab indent_size = 4 tab_width = 4 -end_of_line = lf +end_of_line = lf # To allow compiling code on CI. charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.md] +indent_style = space +indent_size = 4 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..3227eac --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +node_modules/ +package-lock.json +*.min.js +*.jpeg +*.jpg +*.png + +Horizon_TV_Fixer/**/* +LICENSE.txt diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..f1d2b25 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,127 @@ +/* eslint-env node */ +module.exports = { + root: true, + env: { + browser: true, + greasemonkey: true, + es2021: true, + }, + parserOptions: { + ecmaVersion: "latest", + }, + extends: [ + "eslint:recommended", + "plugin:@cspell/recommended", + "plugin:security/recommended-legacy", + + // Display Prettier errors as ESLint errors. + // Enables eslint-plugin-prettier and eslint-config-prettier. + "plugin:prettier/recommended", + + //! Prettier should always be the last configuration in the extends array. + ], + rules: { + "no-unused-vars": ["error", { argsIgnorePattern: "^_" }], // Ignore variables whose names begin with an underscore. + }, + overrides: [ + /* + * Userscript files. + */ + { + files: ["*.user.js"], + extends: ["plugin:userscripts/recommended"], + rules: { + "userscripts/better-use-match": "off", // Disable this warning for now. + }, + settings: { + userscriptVersions: { + tampermonkey: ">=4", + violentmonkey: ">=2", + greasemonkey: "*", + }, + }, + }, + + /* + * JSON files. + */ + { + files: ["*.json"], + extends: [ + "plugin:json/recommended-with-comments", + + // Display Prettier errors as ESLint errors. + // Enables eslint-plugin-prettier and eslint-config-prettier. + "plugin:prettier/recommended", + + //! Prettier should always be the last configuration in the extends array. + ], + }, + + /* + * `package.json` file. + * This needs it's own configuration, because it doesn't work together with `plugin:json`. + * See https://github.com/kellyselden/eslint-plugin-json-files/issues/40 + * Must be after `*.json`. + */ + { + files: ["package.json"], + plugins: ["json-files"], + extends: [ + // Display Prettier errors as ESLint errors. + // Enables eslint-plugin-prettier and eslint-config-prettier. + "plugin:prettier/recommended", + + //! Prettier should always be the last configuration in the extends array. + ], + rules: { + "json-files/ensure-repository-directory": "error", + "json-files/no-branch-in-dependencies": "error", + "json-files/require-engines": "error", + "json-files/require-license": "error", + "json-files/require-unique-dependency-names": "error", + "json-files/sort-package-json": "error", + }, + }, + + /* + * Markdown files. + */ + { + files: ["*.md"], + parser: "eslint-plugin-markdownlint/parser", + extends: [ + "plugin:markdownlint/recommended", + + // Display Prettier errors as ESLint errors. + // Enables eslint-plugin-prettier and eslint-config-prettier. + "plugin:prettier/recommended", + + //! Prettier should always be the last configuration in the extends array. + ], + rules: { + "markdownlint/md007": [ + "error", + { + indent: 4, + }, + ], // For compatibility with Prettier. See https://github.com/DavidAnson/markdownlint/blob/main/doc/Prettier.md + "markdownlint/md030": [ + "error", + { + ol_multi: 3, + ol_single: 3, + ul_multi: 3, + ul_single: 3, + }, + ], // For compatibility with Prettier. See https://github.com/DavidAnson/markdownlint/blob/main/doc/Prettier.md + "markdownlint/md013": "off", // Disable line length. + "markdownlint/md033": [ + "error", + { allowed_elements: ["br", "sup", "kbd"] }, + ], + "prettier/prettier": ["error", { parser: "markdown" }], + }, + }, + ], +}; diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dbbaa91 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# To allow compiling code on CI. +* text=auto eol=lf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0117420 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: "package.json" + - run: npm ci --no-fund + - run: npm run lint diff --git a/.gitignore b/.gitignore index c4bf63d..ec08990 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,163 @@ -*.v12.suo -*.suo +# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,node +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache + +# SvelteKit build / generate output +.svelte-kit + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,node diff --git a/.issuetracker b/.issuetracker new file mode 100644 index 0000000..962b9d5 --- /dev/null +++ b/.issuetracker @@ -0,0 +1,7 @@ +# Integration with Issue Tracker +# +# (note that '\' need to be escaped). + +[issuetracker "GitHub"] + regex = "(?:^|\\b|\\s|\\n|\\()#(\\d+)(?:$|\\b|\\s|\\n|\\))" + url = "https://github.com/jerone/UserScripts/issues/$1" diff --git a/.lockfile-lintrc.json b/.lockfile-lintrc.json new file mode 100644 index 0000000..eb7bbe4 --- /dev/null +++ b/.lockfile-lintrc.json @@ -0,0 +1,12 @@ +{ + "allowedHosts": ["npm"], + "allowedPackageNameAliases": [ + "string-width-cjs:string-width", + "strip-ansi-cjs:strip-ansi", + "wrap-ansi-cjs:wrap-ansi" + ], + "path": "package-lock.json", + "type": "npm", + "validateHttps": true, + "validatePackageNames": true +} diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..02d92e9 --- /dev/null +++ b/.mailmap @@ -0,0 +1 @@ +Jeroen van Warmerdam diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..3227eac --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +node_modules/ +package-lock.json +*.min.js +*.jpeg +*.jpg +*.png + +Horizon_TV_Fixer/**/* +LICENSE.txt diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..6f9a1d2 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,17 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "andywang.vscode-scriptmonkey", + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "streetsidesoftware.code-spell-checker-dutch", + "streetsidesoftware.code-spell-checker" + ], + + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..592fe36 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,35 @@ +{ + /** + * Code language formatting. + */ + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + + /** + * Auto format. + */ + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit" // Fix all fixable errors on explicit save. + }, + // Show ESLint errors in the editor. Languages should match supported files `.eslintrc.js`. + "eslint.validate": ["javascript", "json", "jsonc", "yaml", "markdown"], + + /** + * Scriptmonkey. + */ + "scriptmonkey.metaData.default.author": "jerone", + "scriptmonkey.metaData.default.namespace": "https://github.com/jerone/UserScripts" +} diff --git a/April_Fools_CSS/163341.user.js b/April_Fools_CSS/163341.user.js deleted file mode 100644 index 03e1927..0000000 --- a/April_Fools_CSS/163341.user.js +++ /dev/null @@ -1,82 +0,0 @@ -// ==UserScript== -// @name April Fools CSS -// @description Some CSS april fools -// @author jerone -// @namespace https://github.com/jerone/AprilFoolsCSS -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @include * -// @version 1.1 -// ==/UserScript== - -if(window.top===window){ - - var duration = 2000, // [Integer, positive, miliseconds] This controls the duration of an april fool item; - interval = 8000; // [Integer, positive, miliseconds] This controls the interval of the next april fool; - - var aprilFools = [ // [String] April fools in CSS; Use {duration} for a dynamic duration; - "img { \ - -webkit-transform: rotate(180deg); \ - -moz-transform: rotate(180deg); \ - -ms-transform: rotate(180deg); \ - -o-transform: rotate(180deg); \ - transform: rotate(180deg); \ - }", - "body { \ - -webkit-transform: rotate(1deg); \ - -moz-transform: rotate(1deg); \ - -ms-transform: rotate(1deg); \ - -o-transform: rotate(1deg); \ - transform: rotate(1deg); \ - }", - "body { \ - -webkit-perspective: 300px; \ - -moz-perspective: 300px; \ - -ms-perspective: 300px; \ - perspective: 300px; \ - -webkit-transform: rotateY(180deg); \ - -moz-transform: rotateY(180deg); \ - -ms-transform: rotateY(180deg); \ - transform: rotateY(180deg); \ - -webkit-transform-style: preserve-3d; \ - -moz-transform-style: preserve-3d; \ - -ms-transform-style: preserve-3d; \ - transform-style: preserve-3d; \ - }", - "img { \ - -webkit-transform: scale(0.8); \ - -moz-transform: scale(0.8); \ - -ms-transform: scale(0.8); \ - -o-transform: scale(0.8); \ - transform: scale(0.8); \ - }", - "img { -webkit-animation: spin {duration}s linear infinite; } \ - @-webkit-keyframes spin { \ - 0% { -webkit-transform: rotate(0deg); } \ - 100% { -webkit-transform: rotate(360deg); } \ - }", - "body { -webkit-animation: rainbow {duration}s infinite; } \ - @-webkit-keyframes rainbow { \ - 100% { -webkit-filter: hue-rotate(360deg); } \ - }", - ], - aprilFool = 0, aprilFooled = 0; - - interval = Math.abs(interval); - duration = Math.max(1000, Math.abs(duration)); - - window.setInterval(function(){ - do { aprilFool = Math.floor(Math.random() * aprilFools.length); - } while(aprilFool === aprilFooled); - document.documentElement.classList.add("aprilfool" + (aprilFooled = aprilFool)); - window.console&&console.log("added aprilfool" + aprilFool); - window.setTimeout(function(){ - document.documentElement.classList.remove("aprilfool" + aprilFooled); - window.console&&console.log("removed aprilfool" + aprilFool); - }, duration); - }, interval + duration + 10); - - for(var aprilFool in aprilFools){ - GM_addStyle(".aprilfool" + aprilFool + " " + aprilFools[aprilFool].replace("{duration}", duration/1000)); - } -} diff --git a/April_Fools_CSS/April_Fools_CSS.user.js b/April_Fools_CSS/April_Fools_CSS.user.js new file mode 100644 index 0000000..14cba71 --- /dev/null +++ b/April_Fools_CSS/April_Fools_CSS.user.js @@ -0,0 +1,107 @@ +// ==UserScript== +// @name April Fools CSS +// @description Some CSS april fools +// @author jerone +// @namespace https://github.com/jerone/UserScripts/tree/master/April_Fools_CSS +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @include * +// @version 1.0 +// ==/UserScript== + +// cSpell:ignore transform, aprilfool +/* eslint security/detect-object-injection: "off" */ + +if (window.top === window) { + var duration = 2000, // [Integer, positive, milliseconds] This controls the duration of an april fool item; + interval = 8000; // [Integer, positive, milliseconds] This controls the interval of the next april fool; + + // [String] April fools in CSS; Use {duration} for a dynamic duration; + var aprilFools = [ + // editorconfig-checker-disable + "img { \ + -webkit-transform: rotate(180deg); \ + -moz-transform: rotate(180deg); \ + -ms-transform: rotate(180deg); \ + -o-transform: rotate(180deg); \ + transform: rotate(180deg); \ + }", + "body { \ + -webkit-transform: rotate(1deg); \ + -moz-transform: rotate(1deg); \ + -ms-transform: rotate(1deg); \ + -o-transform: rotate(1deg); \ + transform: rotate(1deg); \ + }", + "body { \ + -webkit-perspective: 300px; \ + -moz-perspective: 300px; \ + -ms-perspective: 300px; \ + perspective: 300px; \ + -webkit-transform: rotateY(180deg); \ + -moz-transform: rotateY(180deg); \ + -ms-transform: rotateY(180deg); \ + transform: rotateY(180deg); \ + -webkit-transform-style: preserve-3d; \ + -moz-transform-style: preserve-3d; \ + -ms-transform-style: preserve-3d; \ + transform-style: preserve-3d; \ + }", + "img { \ + -webkit-transform: scale(0.8); \ + -moz-transform: scale(0.8); \ + -ms-transform: scale(0.8); \ + -o-transform: scale(0.8); \ + transform: scale(0.8); \ + }", + "img { -webkit-animation: spin {duration}s linear infinite; } \ + @-webkit-keyframes spin { \ + 0% { -webkit-transform: rotate(0deg); } \ + 100% { -webkit-transform: rotate(360deg); } \ + }", + "body { -webkit-animation: rainbow {duration}s infinite; } \ + @-webkit-keyframes rainbow { \ + 100% { -webkit-filter: hue-rotate(360deg); } \ + }", + // editorconfig-checker-enable + ], + aprilFool = 0, + aprilFooled = 0; + + interval = Math.abs(interval); + duration = Math.max(1000, Math.abs(duration)); + + window.setInterval( + function () { + do { + aprilFool = Math.floor(Math.random() * aprilFools.length); + } while (aprilFool === aprilFooled); + document.documentElement.classList.add( + "aprilfool" + (aprilFooled = aprilFool), + ); + window.console && console.log("added aprilfool" + aprilFool); + window.setTimeout(function () { + document.documentElement.classList.remove( + "aprilfool" + aprilFooled, + ); + window.console && console.log("removed aprilfool" + aprilFool); + }, duration); + }, + interval + duration + 10, + ); + + for (var aprilFoolText in aprilFools) { + GM_addStyle( + ".aprilfool" + + aprilFoolText + + " " + + aprilFools[aprilFoolText].replace( + "{duration}", + duration / 1000, + ), + ); + } +} diff --git a/April_Fools_CSS/README.md b/April_Fools_CSS/README.md index 1857f25..92bf771 100644 --- a/April_Fools_CSS/README.md +++ b/April_Fools_CSS/README.md @@ -1 +1,24 @@ -[April Fools CSS](http://userscripts.org/scripts/show/163341) \ No newline at end of file +# [April Fools CSS](https://github.com/jerone/UserScripts/tree/master/April_Fools_CSS) (deprecated) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/April_Fools_CSS/April_Fools_CSS.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/April_Fools_CSS/April_Fools_CSS.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +Some CSS April fools + +## Compatible + +- [![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on [![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **1.0** + - Initial version; + +## External links + +- [Greasy Fork](https://greasyfork.org/scripts/47-april-fools-css) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/April_Fools_CSS) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19cdece..10edd58 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,33 +1,37 @@ # Contributing -Anyone can contribute to this repo, so long as you don't break anything on purpose. -### Bug reporting +Anyone can contribute to this repo, so long as you don't break anything on purpose. + +## Bug reporting + Please [report any errors](https://github.com/jerone/UserScripts/issues/new) you're having with one of the scripts. This will help you and others and make the script better. When reporting an issue include the script name in the title and follow the template below for it's description: -> **Script**: `{name}` `{version}`
-> **Browser**: `{name}` `{version}`
-> **Addon** (e.g. Greasemonkey): `{name}` `{version}`
-> **Error Message**: `{message}`
-> **Screenshot**: `{drag&drop}`
-> **Description**: `{description}`
+> **Script**: `{name}` `{version}`
**Browser**: `{name}` `{version}`
**Addon** (e.g. Tampermonkey): `{name}` `{version}`
**Error Message**: `{message}`
**Screenshot**: `{drag&drop}`
**Description**: `{description}`
+ +Or click [here](https://github.com/jerone/UserScripts/issues/new?title=%28{script%20name}%29%20{summary}&body=**Script**%3A%20{name}%20{version}%0A**Browser**%3A%20{name}%20{version}%0A**Addon**%20%28e.g.%20Tampermonkey%29%3A%20{name}%20{version}%0A**Error%20Message**%3A%20%60{message}%60%0A**Screenshot**%3A%20{drag%26drop}%0A**Description**%3A%20{description}) to open a new issue. + +## Bug fixes -**Or click [here](https://github.com/jerone/UserScripts/issues/new?title=%28{script%20name}%29%20{summary}&body=**Script**%3A%20{name}%20{version}%0A**Browser**%3A%20{name}%20{version}%0A**Addon**%20%28e.g.%20Greasemonkey%29%3A%20{name}%20{version}%0A**Error%20Message**%3A%20%60{message}%60%0A**Screenshot**%3A%20{drag%26drop}%0A**Description**%3A%20{description}) to open a new issue.** +If you find any sort of error, spelling mistake, etc. in this project, feel free to fix it and submit a [pull request](https://github.com/jerone/UserScripts/pulls) with your commit. Little fixes like this are welcomed and are usually accepted pretty quickly. -### Bug fixes -If you find any sort of error, spelling mistak, etc. in this project, feel free to fix it and submit a [pull request](https://github.com/jerone/UserScripts/pulls) with your commit. Little fixes like this are welcomed and are usually accepted pretty quickly. +## Feature requests -### Feature requests Time is limited, so feature requests are discussed and released when possible and time permits. You can always send a [pull request](https://github.com/jerone/UserScripts/pulls) to speed up the process. -### Code style -Many conventions are available for writing code, but in this repo there's only one correct and that's mine :) +## Code style + +Many conventions are available for writing code, but in this repo there's only one correct and that's mine 😊 Please use the following conventions: -* Tabs over spaces. -* My tabs are 4 spaces width. -* Always append with an `;`. -* Try to obey [JSHint](http://jshint.com) rules. -* Follow the conventions you see used in the source already. +- Obey to linting (ESLint) rules. You can run them via `npm run lint`. +- Install [EditorConfig](http://editorconfig.org) to help. +- Follow the conventions you see used in the source already. + +## Git Commit Messages + +- Use the past tense ("Added feature" not "Add feature"). +- Limit the first line to 72 characters or less. +- Reference issues and pull requests liberally. diff --git a/Dakar_Extender/208433.user.js b/Dakar_Extender/208433.user.js index 81c92a2..d9f1601 100644 --- a/Dakar_Extender/208433.user.js +++ b/Dakar_Extender/208433.user.js @@ -1,31 +1,31 @@ // ==UserScript== -// @name Dakar Extender -// @description Highlight riders by certain country in standings lists. -// @namespace http://userscripts.org/scripts/show/208433 -// @version 2 -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @grant none -// @require http://code.jquery.com/jquery-2.0.3.min.js -// @icon https://lh6.googleusercontent.com/-pKPBVGEVXk0/UsXXxo0S9JI/AAAAAAAACp0/0N_pV4AqDMY/s512-no/Icon_Dakar2+%25281%2529.png -// @include *dakar.com/* +// @name Dakar Extender +// @description Highlight riders by certain country in standings lists. +// @namespace http://userscripts.org/scripts/show/208433 +// @version 2 +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @grant none +// @require http://code.jquery.com/jquery-2.0.3.min.js +// @icon https://lh6.googleusercontent.com/-pKPBVGEVXk0/UsXXxo0S9JI/AAAAAAAACp0/0N_pV4AqDMY/s512-no/Icon_Dakar2+%25281%2529.png +// @include *dakar.com/* // ==/UserScript== -(function(){ - - var countryCode = "NLD"; - - $(function(){ - $("tr:contains('\("+countryCode+"\)')").css("font-weight","bold"); - }); - -})(); +// cSpell:ignore dakar +/* global $ */ +(function () { + var countryCode = "NLD"; + $(function () { + $("tr:contains('(" + countryCode + ")')").css("font-weight", "bold"); + }); +})(); // ==UserStats== // Chars (excl. spaces): 610 // Chars (incl. spaces): 716 // Words: 65 // Lines: 29 -// ==/UserStats== \ No newline at end of file +// ==/UserStats== diff --git a/Dakar_Extender/README.md b/Dakar_Extender/README.md index 5f21127..9353f47 100644 --- a/Dakar_Extender/README.md +++ b/Dakar_Extender/README.md @@ -1 +1,3 @@ -[Dakar Extender](http://userscripts.org/scripts/show/208433) \ No newline at end of file +# TrackingDakar (deprecated) + +> This userscript has been deprecated in favour of the more useful [TrackingDakar](http://www.trackingdakar.nl/) site. diff --git a/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js b/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js new file mode 100644 index 0000000..9643350 --- /dev/null +++ b/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js @@ -0,0 +1,45 @@ +// ==UserScript== +// @name Darts Data Enhancer +// @id Darts_Data_Enhancer@https://github.com/jerone/UserScripts +// @namespace https://github.com/jerone/UserScripts +// @description Enhances Darts Data +// @author jerone +// @copyright 2015+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Darts_Data_Enhancer#readme +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Darts_Data_Enhancer#readme +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @version 1.0.0 +// @grant none +// @run-at document-end +// @include http://live.dartsdata.com/MatchesList.aspx +// ==/UserScript== + +var playersLeft = document.querySelectorAll( + "#ctl01 > table:nth-child(9) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > table > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(1) > div > table > tbody > tr > td:nth-child(2)", +); +var playersRight = document.querySelectorAll( + "#ctl01 > table:nth-child(9) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > table > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(1) > div > table > tbody > tr > td:nth-child(6)", +); +var players = Array.prototype.concat.apply( + Array.prototype.concat.apply([], playersLeft), + playersRight, +); +Array.prototype.forEach.call(players, function (player) { + var name = player.textContent.trim(); + if (~name.indexOf("Winner Of Match")) return; + var link = document.createElement("a"); + link.setAttribute( + "href", + "https://www.google.com/search?q=" + encodeURIComponent(name), + ); + link.setAttribute("target", "_blank"); + link.appendChild(document.createTextNode(name)); + link.style.color = "#FFF"; + player.innerHTML = ""; + player.appendChild(link); +}); diff --git a/Darts_Data_Enhancer/README.md b/Darts_Data_Enhancer/README.md new file mode 100644 index 0000000..3f4d289 --- /dev/null +++ b/Darts_Data_Enhancer/README.md @@ -0,0 +1,21 @@ +# [Darts Data Enhancer](https://github.com/jerone/UserScripts/tree/master/Darts_Data_Enhancer) (deprecated) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Darts_Data_Enhancer/Darts_Data_Enhancer.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +Add features to enhance darts data tracking site [live.dartsdata.com](http://live.dartsdata.com/): + +- All players are now linked to Google Search. + +## Compatible + +- [![Greasemonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **1.0.0** + - Initial version; diff --git a/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js b/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js index 47a9894..82d7dad 100644 --- a/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js +++ b/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js @@ -1,39 +1,44 @@ // ==UserScript== -// @name GeenStijl & Powned & Dumpert Comment Enhancer -// @namespace https://github.com/jerone/UserScripts -// @description Add features to enhance comments on GeenStijl & Powned & Dumpert & more. -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/GeenStijl_Powned_Dumpert_Comment_Enhancer -// @homepageURL https://github.com/jerone/UserScripts/tree/master/GeenStijl_Powned_Dumpert_Comment_Enhancer -// @downloadURL https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js -// @include http*://*geenstijl.nl/mt/archieven/* -// @include http*://*geenstijl.tv/* -// @include http*://*powned.tv/nieuws/* -// @include http*://*dumpert.nl/mediabase/* -// @include http*://*daskapital.nl/* -// @include http*://*glamora.ma/* -// @version 2.0 -// @grant none +// @name GeenStijl & Powned & Dumpert Comment Enhancer +// @namespace https://github.com/jerone/UserScripts +// @description Add features to enhance comments on GeenStijl & Powned & Dumpert & more. +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/GeenStijl_Powned_Dumpert_Comment_Enhancer +// @homepageURL https://github.com/jerone/UserScripts/tree/master/GeenStijl_Powned_Dumpert_Comment_Enhancer +// @downloadURL https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @include http*://*geenstijl.nl/mt/archieven/* +// @include http*://*geenstijl.tv/* +// @include http*://*powned.tv/nieuws/* +// @include http*://*dumpert.nl/mediabase/* +// @include http*://*daskapital.nl/* +// @include http*://*glamora.ma/* +// @version 2.0 +// @grant none // ==/UserScript== -(function() { +// cSpell:ignore Dumpert, dumpert, geenstijl, powned, daskapital, glamora, perma +/* eslint security/detect-object-injection: "off" */ +(function () { function proxy(fn) { - return function() { + return function () { var that = this; - return function(e) { - var args = that.slice(0); // clone; - args.unshift(e); // prepend event; + return function (e) { + var args = that.slice(0); // clone; + args.unshift(e); // prepend event; fn.apply(this, args); }; }.call([].slice.call(arguments, 1)); } function wait(condition, next) { - var loop = window.setInterval(function() { + var loop = window.setInterval(function () { if (condition() === true) { window.clearInterval(loop); next(); @@ -41,64 +46,111 @@ }, 100); } - String.format = function(string) { + String.format = function (string) { var args = Array.prototype.slice.call(arguments, 1, arguments.length); - return string.replace(/{(\d+)}/g, function(match, number) { + return string.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== "undefined" ? args[number] : match; }); }; - var replyImgScr = "data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABcSURBVChTjZBbDsAgCATl2PDFzW236RjqI+kmSsBxQS0i+q2GzKzVfBy8oOCj3L03bRIROjNHbQGBgRQx+TgC6ALQEawtGeNpzWNwETjD2xlVrGtp/et7ZpddfgEnfhsfVr//KQAAAABJRU5ErkJgggA="; - var permaImgScr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAABGdBTUEAAK/INwWK6QAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABZ0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMDvo9WkAAABfSURBVChTXY9BEsAgCAP7bMqpL4euDaJ2D0xMzKDXvWFmpSYjzsyIYP4YMQ2y7+rRrlhKh2ci091XDH1DJnPtlgsIetpYsTImmoxHVLuVMsHxaDf7D+tpQr/CAjnu/gJVo8cY6M1GEAAAAABJRU5ErkJggg=="; + var replyImgScr = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABcSURBVChTjZBbDsAgCATl2PDFzW236RjqI+kmSsBxQS0i+q2GzKzVfBy8oOCj3L03bRIROjNHbQGBgRQx+TgC6ALQEawtGeNpzWNwETjD2xlVrGtp/et7ZpddfgEnfhsfVr//KQAAAABJRU5ErkJgggA="; + var permaImgScr = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAABGdBTUEAAK/INwWK6QAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABZ0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMDvo9WkAAABfSURBVChTXY9BEsAgCAP7bMqpL4euDaJ2D0xMzKDXvWFmpSYjzsyIYP4YMQ2y7+rRrlhKh2ci091XDH1DJnPtlgsIetpYsTImmoxHVLuVMsHxaDf7D+tpQr/CAjnu/gJVo8cY6M1GEAAAAABJRU5ErkJggg=="; var commentsList = document.getElementById("comments"); if (commentsList) { - wait(function() { - return commentsList.querySelectorAll("article .nsb,.comment .nsb").length > 0; - }, function() { - Array.forEach(commentsList.querySelectorAll("article,.comment"), function(comment) { - var footer = comment.querySelector("footer,.footer"); + wait( + function () { + return ( + commentsList.querySelectorAll("article .nsb,.comment .nsb") + .length > 0 + ); + }, + function () { + Array.forEach( + commentsList.querySelectorAll("article,.comment"), + function (comment) { + var footer = comment.querySelector("footer,.footer"); - if (comment.id) { - var perma = document.createElement("a"); - perma.classList.add("nsb"); - perma.setAttribute("href", String.format("#{0}", comment.id)); - perma.setAttribute("title", String.format("Permalink #{0}", comment.id)); - perma.style.backgroundImage = String.format("url('{0}')", permaImgScr); - perma.style.backgroundPosition = "center center"; - perma.style.marginRight = "4px"; - if (/https?:\/\/www\.powned\.tv\/nieuws\/.*/.test(location.href)) { // add missing css; - perma.style.cursor = "pointer"; - perma.style.cssFloat = "right"; - perma.style.height = perma.style.width = "10px"; - } - footer.appendChild(perma); - } + if (comment.id) { + var perma = document.createElement("a"); + perma.classList.add("nsb"); + perma.setAttribute( + "href", + String.format("#{0}", comment.id), + ); + perma.setAttribute( + "title", + String.format("Permalink #{0}", comment.id), + ); + perma.style.backgroundImage = String.format( + "url('{0}')", + permaImgScr, + ); + perma.style.backgroundPosition = "center center"; + perma.style.marginRight = "4px"; + if ( + /https?:\/\/www\.powned\.tv\/nieuws\/.*/.test( + location.href, + ) + ) { + // add missing css; + perma.style.cursor = "pointer"; + perma.style.cssFloat = "right"; + perma.style.height = perma.style.width = "10px"; + } + footer.appendChild(perma); + } - var textArea = document.getElementById("text"); - if (textArea) { - var reply = document.createElement("span"); - reply.classList.add("nsb"); - reply.setAttribute("title", "Beantwoorden"); - reply.style.backgroundImage = String.format("url('{0}')", replyImgScr); - reply.style.backgroundPosition = "center center"; - reply.style.marginRight = "4px"; - if (/https?:\/\/www\.powned\.tv\/nieuws\/.*/.test(location.href)) { // add missing css; - reply.style.cursor = "pointer"; - reply.style.cssFloat = "right"; - reply.style.height = reply.style.width = "10px"; - } - reply.addEventListener("click", proxy(function() { - textArea.value += String.format("@{0}\n", Array.map(this.childNodes, function(node) { - return (node.nodeType === 3) ? node.textContent.trim() : ""; - }).join(" ").trim().replace(/\s{2,}/, " ").replace(/\s?\|\s?$/g, "")); - textArea.focus(); - textArea.scrollIntoView(); - }).bind(footer)); - footer.appendChild(reply); - } - }); - }); + var textArea = document.getElementById("text"); + if (textArea) { + var reply = document.createElement("span"); + reply.classList.add("nsb"); + reply.setAttribute("title", "Beantwoorden"); + reply.style.backgroundImage = String.format( + "url('{0}')", + replyImgScr, + ); + reply.style.backgroundPosition = "center center"; + reply.style.marginRight = "4px"; + if ( + /https?:\/\/www\.powned\.tv\/nieuws\/.*/.test( + location.href, + ) + ) { + // add missing css; + reply.style.cursor = "pointer"; + reply.style.cssFloat = "right"; + reply.style.height = reply.style.width = "10px"; + } + reply.addEventListener( + "click", + proxy(function () { + textArea.value += String.format( + "@{0}\n", + Array.map( + this.childNodes, + function (node) { + return node.nodeType === 3 + ? node.textContent.trim() + : ""; + }, + ) + .join(" ") + .trim() + .replace(/\s{2,}/, " ") + .replace(/\s?\|\s?$/g, ""), + ); + textArea.focus(); + textArea.scrollIntoView(); + }).bind(footer), + ); + footer.appendChild(reply); + } + }, + ); + }, + ); } - })(); diff --git a/GeenStijl_Powned_Dumpert_Comment_Enhancer/README.md b/GeenStijl_Powned_Dumpert_Comment_Enhancer/README.md index 96fed45..db84d2e 100644 --- a/GeenStijl_Powned_Dumpert_Comment_Enhancer/README.md +++ b/GeenStijl_Powned_Dumpert_Comment_Enhancer/README.md @@ -1,50 +1,49 @@ -# [GeenStijl & Powned & Dumpert Comment Enhancer](https://github.com/jerone/UserScripts/tree/master/GeenStijl_Powned_Dumpert_Comment_Enhancer) +# [GeenStijl & Powned & Dumpert Comment Enhancer](https://github.com/jerone/UserScripts/tree/master/GeenStijl_Powned_Dumpert_Comment_Enhancer) (deprecated) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/GeenStijl_Powned_Dumpert_Comment_Enhancer.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description +## Description Add features to enhance comments on GeenStijl & Powned & Dumpert & more. Currently supported sites: -* http://geenstijl.nl -* http://geenstijl.tv -* http://powned.tv -* http://dumpert.nl -* http://daskapital.nl -* http://glamora.ma +- +- +- +- +- +- -### Screenshot +## Screenshot ![GeenStijl & Powned & Dumpert Comment Enhancer screenshot](https://github.com/jerone/UserScripts/raw/master/GeenStijl_Powned_Dumpert_Comment_Enhancer/screenshot.jpg) -### Compatible +## Compatible -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). +- [![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on [![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... +## Version History -### Version History +- **2.0** + - Add permalink; +- **1.0** + - Initial version; -* **2.0** - * Add permalink; -* **1.0** - * Initial version; +## TODO -### TODO +- Hide all comments; +- Hide newbies; +- Hide particular comments or always show particular comments; +- Highlight particular comments; +- Pre-defined comments; +- Signature; +- ~~Permalink~~; -- Hide all comments; -- Hide newbies; -- Hide particular comments or always show particular comments; -- Highlight particular comments; -- Pre-defined comments; -- Signature; -- ~~Permalink~~; +## External links -### External links - -* [Greasy Fork](https://greasyfork.org/scripts/465-geenstijl-powned-dumpert-comment-enhancer) -* [OpenUserJS](https://openuserjs.org/scripts/jerone/GeenStijl_Powned_Dumpert_Comment_Enhancer) -* [Userscripts.org](http://userscripts.org/scripts/show/35698) (not maintained anymore). +- [Greasy Fork](https://greasyfork.org/scripts/465-geenstijl-powned-dumpert-comment-enhancer) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/GeenStijl_Powned_Dumpert_Comment_Enhancer) diff --git a/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js b/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js new file mode 100644 index 0000000..c0dced1 --- /dev/null +++ b/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js @@ -0,0 +1,282 @@ +// ==UserScript== +// @name GitHub Commit Compare +// @namespace https://github.com/jerone/UserScripts +// @description Add controls to compare commits. +// @author jerone +// @contributor darkred +// @copyright 2017+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/GitHub_Commit_Compare +// @homepageURL https://github.com/jerone/UserScripts/tree/master/GitHub_Commit_Compare +// @downloadURL https://github.com/jerone/UserScripts/raw/master/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @include https://github.com/*/*/commits +// @include https://github.com/*/*/commits/* +// @exclude https://github.com/*/*.diff +// @exclude https://github.com/*/*.patch +// @version 0.0.3 +// @grant none +// ==/UserScript== + +// cSpell:ignore tooltipped, Consolas, Menlo, compareAdisabled, compareBdisabled + +(function () { + function addButton() { + var nav; + if ((nav = document.querySelector(".file-navigation"))) { + // Check if our group of buttons are already attached. + // Remove it, as the 'old' buttons don't have events anymore. + const e = document.getElementById("GitHubCommitCompareGroup"); + if (e) { + e.parentElement.removeChild(e); + } + Array.from( + document.querySelectorAll(".GitHubCommitCompareButtonAB"), + ).forEach(function (b) { + b.parentElement.removeChild(b); + }); + + const c = document.createElement("input"); + c.type = "checkbox"; + c.addEventListener("change", function () { + const bb = document.querySelectorAll( + ".GitHubCommitCompareButtonAB", + ); + if (this.checked) { + if (bb.length === 0) { + addCompareButtons(); + } else { + Array.from(bb).forEach(function (b) { + b.classList.remove("d-none"); + }); + } + } else { + Array.from(bb).forEach(function (b) { + b.classList.add("d-none"); + }); + } + const bbb = document.getElementById( + "GitHubCommitCompareButton", + ); + if (bbb) bbb.classList.remove("disabled"); + }); + + const l = document.createElement("label"); + l.classList.add("tooltipped", "tooltipped-n"); + l.setAttribute("aria-label", "Show commit compare buttons"); + l.style.cssText = ` + float: left; + padding: 3px 10px; + font-size: 12px; + font-weight: 600; + line-height: 20px; + color: #24292e; + vertical-align: middle; + background-color: #fff; + border: 1px solid rgba(27,31,35,0.2); + border-right: 0; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + `; + l.appendChild(c); + + const p = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + p.setAttributeNS( + null, + "d", + "M5 12H4c-.27-.02-.48-.11-.69-.31-.21-.2-.3-.42-.31-.69V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V11c.03.78.34 1.47.94 2.06.6.59 1.28.91 2.06.94h1v2l3-3-3-3v2zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm11 9.48V5c-.03-.78-.34-1.47-.94-2.06-.6-.59-1.28-.91-2.06-.94H9V0L6 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 12 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z", + ); + + const s = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + s.classList.add("octicon", "octicon-diff"); + s.setAttributeNS(null, "height", 16); + s.setAttributeNS(null, "width", 14); + s.setAttributeNS(null, "viewBox", "0 0 14 16"); + s.appendChild(p); + + const a = document.createElement("a"); + a.id = "GitHubCommitCompareButton"; + a.classList.add( + "btn", + "btn-sm", + "tooltipped", + "tooltipped-n", + "disabled", + ); + a.setAttribute("href", "#"); + a.setAttribute("rel", "nofollow"); + a.setAttribute("aria-label", "Compare these commits"); + a.style.cssText = ` + border-top-left-radius: 0; + border-bottom-left-radius: 0; + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + `; + a.appendChild(s); + a.appendChild(document.createElement("span")); + + const g = document.createElement("div"); + g.id = "GitHubCommitCompareGroup"; + g.classList.add("float-right"); + g.appendChild(l); + g.appendChild(a); + + nav.appendChild(g); + } + } + + function updateRadioButtons() { + var compareAdisabled = true; + var compareBdisabled = false; + + const compares = document.querySelectorAll( + ".GitHubCommitCompareButtonAB", + ); + Array.from(compares).forEach(function (compare) { + const compareA = compare.querySelector( + '[name="GitHubCommitCompareButtonA"]', + ); + const compareB = compare.querySelector( + '[name="GitHubCommitCompareButtonB"]', + ); + + compareA.disabled = compareAdisabled; + compareA.parentNode.classList.toggle("disabled", compareAdisabled); + + if (compareA.checked) { + compareBdisabled = true; + } + if (compareB.checked) { + compareAdisabled = false; + } + + compareB.disabled = compareBdisabled; + compareB.parentNode.classList.toggle("disabled", compareBdisabled); + }); + + updateCompareButton(); + } + + function updateCompareButton() { + const repo = document.querySelector('meta[property="og:url"]').content; + + const compareA = document.querySelector( + '.GitHubCommitCompareButtonAB [name="GitHubCommitCompareButtonA"]:checked', + ); + const hashA = + compareA.parentNode.parentNode.parentNode.querySelector( + "clipboard-copy", + ).value; + const compareB = document.querySelector( + '.GitHubCommitCompareButtonAB [name="GitHubCommitCompareButtonB"]:checked', + ); + const hashB = + compareB.parentNode.parentNode.parentNode.querySelector( + "clipboard-copy", + ).value; + + const a = document.getElementById("GitHubCommitCompareButton"); + a.setAttribute("href", `${repo}/compare/${hashA}...${hashB}`); + a.querySelector("span").textContent = + ` ${hashA.substring(0, 7)}...${hashB.substring(0, 7)}`; + + //localStorage.setItem('GitHubCommitCompareButtonHashA', hashA); + //localStorage.setItem('GitHubCommitCompareButtonHashB', hashB); + } + + function addCompareButtons() { + const commits = document.querySelectorAll( + ".commits-list-item .commit-links-cell", + ); + Array.from(commits).forEach(function (item, index) { + const c1 = document.createElement("input"); + c1.name = "GitHubCommitCompareButtonA"; + c1.type = "radio"; + c1.addEventListener("change", updateRadioButtons); + if (index === 1) c1.checked = true; + + const l1 = document.createElement("label"); + l1.classList.add( + "btn", + "btn-outline", + "BtnGroup-item", + "tooltipped", + "tooltipped-s", + ); + l1.setAttribute("aria-label", "Choose a base commit"); + l1.appendChild(c1); + + const c2 = document.createElement("input"); + c2.name = "GitHubCommitCompareButtonB"; + c2.type = "radio"; + c2.addEventListener("change", updateRadioButtons); + if (index === 0) c2.checked = true; + + const l2 = document.createElement("label"); + l2.classList.add( + "btn", + "btn-outline", + "BtnGroup-item", + "tooltipped", + "tooltipped-s", + ); + l2.setAttribute("aria-label", "Choose a head commit"); + l2.appendChild(c2); + + // const p3 = document.createElementNS('http://www.w3.org/2000/svg', 'path'); + // p3.setAttributeNS(null, + //'d', + //'M5 12H4c-.27-.02-.48-.11-.69-.31-.21-.2-.3-.42-.31-.69V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V11c.03.78.34 1.47.94 2.06.6.59 1.28.91 2.06.94h1v2l3-3-3-3v2zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm11 9.48V5c-.03-.78-.34-1.47-.94-2.06-.6-.59-1.28-.91-2.06-.94H9V0L6 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 12 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z'); + + // const s3 = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + // s3.classList.add('octicon', 'octicon-diff'); + // s3.setAttributeNS(null, 'height', 16); + // s3.setAttributeNS(null, 'width', 14); + // s3.setAttributeNS(null, 'viewBox', '0 0 14 16'); + // s3.appendChild(p3); + + // const l3 = document.createElement('a'); + // l3.classList.add('btn', 'btn-outline', 'BtnGroup-item', 'tooltipped', 'tooltipped-sw'); + // l3.setAttribute('aria-label', 'TODO'); + // l3.appendChild(s3); + + const gg = document.createElement("div"); + gg.classList.add( + "GitHubCommitCompareButtonAB", + "commit-links-group", + "BtnGroup", + ); + gg.appendChild(l1); + gg.appendChild(l2); + //gg.appendChild(l3); + + //item.style.width = '350px'; + if (item.querySelector(".muted-link")) { + // Insert after number of comments button. + item.insertBefore( + gg, + item.querySelector(".muted-link").nextSibling, + ); + } else { + item.insertBefore(gg, item.firstChild); + } + }); + + updateRadioButtons(); // Update radio buttons. + } + + // Init. + addButton(); + + // Pjax. + document.addEventListener("pjax:end", addButton); +})(); diff --git a/GitHub_Commit_Compare/README.md b/GitHub_Commit_Compare/README.md new file mode 100644 index 0000000..fb4b0ba --- /dev/null +++ b/GitHub_Commit_Compare/README.md @@ -0,0 +1,41 @@ +# [GitHub Commit Compare](https://github.com/jerone/UserScripts/tree/master/GitHub_Commit_Compare) (abandoned) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/GitHub_Commit_Compare/GitHub_Commit_Compare.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +Add controls to compare commits. + +## Screenshot + +![GitHub Commit Compare screenshot](https://github.com/jerone/UserScripts/raw/master/GitHub_Commit_Compare/screenshot.jpg) + +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **0.0.3** + + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). + +- **0.0.2** + + - 🐛 Fix after GitHub site update (fixed by [@darkred](https://github.com/darkred) in [#128](https://github.com/jerone/UserScripts/issues/128)). + +- **0.0.1** + + - Initial version. + +## Contributors + +- [darkred](https://github.com/darkred) + +## External links + +- [Greasy Fork](https://greasyfork.org/en/scripts/33563-github-commit-compare) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/GitHub_Commit_Compare) diff --git a/GitHub_Commit_Compare/screenshot.jpg b/GitHub_Commit_Compare/screenshot.jpg new file mode 100644 index 0000000..4a82cd9 Binary files /dev/null and b/GitHub_Commit_Compare/screenshot.jpg differ diff --git a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js index 209868f..3fc0f6b 100644 --- a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js +++ b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js @@ -1,115 +1,193 @@ // ==UserScript== -// @id Github_Comment_Enhancer@https://github.com/jerone/UserScripts -// @name Github Comment Enhancer -// @namespace https://github.com/jerone/UserScripts -// @description Enhances Github comments -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js -// @version 2.0.2 -// @grant none -// @run-at document-end -// @include https://github.com/*/*/issues -// @include https://github.com/*/*/issues/* -// @include https://github.com/*/*/pulls -// @include https://github.com/*/*/pull/* -// @include https://github.com/*/*/commit/* -// @include https://github.com/*/*/compare/* -// @include https://github.com/*/*/wiki/* -// @include https://gist.github.com/* +// @name Github Comment Enhancer +// @id Github_Comment_Enhancer@https://github.com/jerone/UserScripts +// @namespace https://github.com/jerone/UserScripts +// @description Enhances Github comments +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer#readme +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer#readme +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @version 2.9.0 +// @icon https://github.githubassets.com/pinned-octocat.svg +// @grant none +// @run-at document-end +// @include https://github.com/* +// @include https://gist.github.com/* // ==/UserScript== -/* global unsafeWindow */ -(function(unsafeWindow) { +// cSpell:ignore gollum, tooltipped, jssuggester, tabnav, facebox, msie +/* eslint security/detect-object-injection: "off" */ +/* eslint security/detect-unsafe-regex: "off" */ +/* eslint security/detect-non-literal-regexp: "off" */ - String.format = function(string) { +(function (unsafeWindow) { + String.format = function (string) { var args = Array.prototype.slice.call(arguments, 1, arguments.length); - return string.replace(/{(\d+)}/g, function(match, number) { + return string.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== "undefined" ? args[number] : match; }); }; + // Choose the character that precedes the list; + var listCharacter = ["*", "-", "+"][0]; + + // Choose the characters that makes up a horizontal line; + var lineCharacter = ["***", "---", "___"][0]; + // Source: https://github.com/gollum/gollum/blob/9c714e768748db4560bc017cacef4afa0c751a63/lib/gollum/public/gollum/javascript/editor/langs/markdown.js var MarkDown = (function MarkDown() { return { "function-bold": { search: /^(\s*)([\s\S]*?)(\s*)$/g, - replace: "$1**$2**$3" + replace: "$1**$2**$3", + shortcut: "ctrl+b", }, "function-italic": { search: /^(\s*)([\s\S]*?)(\s*)$/g, - replace: "$1_$2_$3" + replace: "$1_$2_$3", + shortcut: "ctrl+i", + }, + "function-underline": { + search: /^(\s*)([\s\S]*?)(\s*)$/g, + replace: "$1$2$3", + shortcut: "ctrl+u", }, "function-strikethrough": { search: /^(\s*)([\s\S]*?)(\s*)$/g, - replace: "$1~~$2~~$3" + replace: "$1~~$2~~$3", + shortcut: "ctrl+s", }, "function-h1": { search: /(.+)([\n]?)/g, replace: "# $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+1", }, "function-h2": { search: /(.+)([\n]?)/g, replace: "## $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+2", }, "function-h3": { search: /(.+)([\n]?)/g, replace: "### $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+3", }, "function-h4": { search: /(.+)([\n]?)/g, replace: "#### $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+4", }, "function-h5": { search: /(.+)([\n]?)/g, replace: "##### $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+5", }, "function-h6": { search: /(.+)([\n]?)/g, replace: "###### $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+6", }, "function-link": { - exec: function(txt, selText, commentForm, next) { + exec: function (button, selText, commentForm, next) { var selTxt = selText.trim(), - isUrl = selTxt && /(?:https?:\/\/)|(?:www\.)/.test(selTxt), - href = window.prompt("Link href:", isUrl ? selTxt : ""), - text = window.prompt("Link text:", isUrl ? "" : selTxt); - if (href) { - next(String.format("[{0}]({1}){2}", text || href, href, (/\s+$/.test(selText) ? " " : ""))); - } - } + isUrl = + selTxt && /(?:https?:\/\/)|(?:www\.)/.test(selTxt), + text = isUrl ? "" : selTxt, + href = isUrl ? selTxt : ""; + unsafeWindow.$.GollumDialog.init({ + title: "Insert Link", + fields: [ + { + id: "text", + name: "Link Text", + type: "text", + value: text, + }, + { + id: "href", + name: "URL", + type: "text", + value: href, + }, + ], + OK: function (t) { + if (t.href) { + next( + String.format( + "[{0}]({1}){2}", + t.text || t.href, + t.href, + /\s+$/.test(selText) ? " " : "", + ), + ); + } + }, + }); + }, + shortcut: "ctrl+l", }, "function-image": { - exec: function(txt, selText, commentForm, next) { + exec: function (button, selText, commentForm, next) { var selTxt = selText.trim(), - isUrl = selTxt && /(?:https?:\/\/)|(?:www\.)/.test(selTxt), - href = window.prompt("Image href:", isUrl ? selTxt : ""), - text = window.prompt("Image text:", isUrl ? "" : selTxt); - if (href) { - next(String.format("![{0}]({1}){2}", text || href, href, (/\s+$/.test(selText) ? " " : ""))); - } - } + isUrl = + selTxt && /(?:https?:\/\/)|(?:www\.)/.test(selTxt), + url = isUrl ? selTxt : "", + alt = isUrl ? "" : selTxt; + unsafeWindow.$.GollumDialog.init({ + title: "Insert Image", + fields: [ + { + id: "url", + name: "Image URL", + type: "text", + value: url, + }, + { + id: "alt", + name: "Alt Text", + type: "text", + value: alt, + }, + ], + OK: function (t) { + if (t.url) { + next( + String.format( + "![{0}]({1}){2}", + t.alt || t.url, + t.url, + /\s+$/.test(selText) ? " " : "", + ), + ); + } + }, + }); + }, + shortcut: "ctrl+g", }, "function-ul": { search: /(.+)([\n]?)/g, - replace: "* $1$2", - forceNewline: true + replace: String.format("{0} $1$2", listCharacter), + forceNewline: true, + shortcut: "alt+ctrl+u", }, "function-ol": { - exec: function(txt, selText, commentForm, next) { + exec: function (button, selText, commentForm, next) { var repText = ""; if (!selText) { repText = "1. "; @@ -118,198 +196,288 @@ hasContent = /[\w]+/; for (var i = 0; i < lines.length; i++) { if (hasContent.test(lines[i])) { - repText += String.format("{0}. {1}\n", i + 1, lines[i]); + repText += String.format( + "{0}. {1}\n", + i + 1, + lines[i], + ); } } } next(repText); - } + }, + shortcut: "alt+ctrl+o", }, "function-checklist": { search: /(.+)([\n]?)/g, - replace: "* [ ] $1$2", - forceNewline: true + replace: String.format("{0} [ ] $1$2", listCharacter), + forceNewline: true, + shortcut: "alt+ctrl+t", }, "function-code": { - exec: function(txt, selText, commentForm, next) { - var rt = selText.indexOf("\n") > -1 ? "$1\n```\n$2\n```$3" : "$1`$2`$3"; + exec: function (button, selText, commentForm, next) { + var rt = + selText.indexOf("\n") > -1 + ? "$1\n```\n$2\n```$3" + : "$1`$2`$3"; next(selText.replace(/^(\s*)([\s\S]*?)(\s*)$/g, rt)); - } + }, + shortcut: "ctrl+k", + }, + "function-code-syntax": { + exec: function (button, selText, commentForm, next) { + var rt = "$1\n```" + button.dataset.value + "\n$2\n```$3"; + next(selText.replace(/^(\s*)([\s\S]*?)(\s*)$/g, rt)); + }, }, + "function-blockquote": { search: /(.+)([\n]?)/g, replace: "> $1$2", - forceNewline: true + forceNewline: true, + shortcut: "ctrl+q", }, - "function-hr": { - append: "\n***\n", - forceNewline: true + "function-rule": { + append: String.format("\n{0}\n", lineCharacter), + forceNewline: true, + shortcut: "ctrl+r", }, "function-table": { - append: "\n" + - "| Head | Head | Head |\n" + - "| :--- | :--: | ---: |\n" + - "| Cell | Cell | Cell |\n" + - "| Cell | Cell | Cell |\n", - forceNewline: true + append: + "\n" + + "| Head | Head | Head |\n" + + "| :--- | :----: | ----: |\n" + + "| Cell | Cell | Cell |\n" + + "| Left | Center | Right |\n", + forceNewline: true, + shortcut: "alt+shift+t", }, "function-clear": { - exec: function(txt, selText, commentForm, next) { + exec: function (button, selText, commentForm, next) { commentForm.value = ""; next(""); - } + }, + shortcut: "alt+ctrl+x", }, + "function-snippets-tab": { + exec: function (button, selText, commentForm, next) { + next("\t"); + }, + }, "function-snippets-useragent": { - exec: function(txt, selText, commentForm, next) { + exec: function (button, selText, commentForm, next) { next("`" + navigator.userAgent + "`"); - } + }, }, "function-snippets-contributing": { - exec: function(txt, selText, commentForm, next) { - next("Please, always consider reviewing the [guidelines for contributing](../blob/master/CONTRIBUTING.md) to this repository."); - } - } + exec: function (button, selText, commentForm, next) { + next( + "Please, always consider reviewing the [guidelines for contributing](../blob/master/CONTRIBUTING.md) to this repository.", + ); + }, + }, + + "function-emoji": { + exec: function (button, selText, commentForm, next) { + next(button.dataset.value); + }, + }, }; })(); - var editorHTML = (function editorHTML() { - return '
' + - ' ' + - - '
' + - '
' + - ' ' + - ' h#' + - ' ' + - '
' + - '
' + - '
' + - ' Choose header' + - ' ' + - '
' + - ' ' + - '
' + - '
' + - '
' + - '
' + - - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - - ' ' + - - '
' + - '
' + - ' ' + - ' ' + - ' ' + - '
' + - '
' + - '
' + - ' Snippets' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' + - '
' + - ' ' + - '
' + - '
' + - '
' + - '
' + - - '
' + - - '
' + - ' ' + - ' ' + - ' ' + - '
'; - })(); + var toolBarLeftHTML = + '
' + + /* Bold, italic, underline & Strikethrough; */ + ' " + + /* Headers (1 - 6); */ + '
' + + '
' + + ' ' + + ' ' + + " " + + '
' + + '
' + + '
' + + ' Choose header' + + ' ' + + "
" + + ' " + + "
" + + "
" + + "
" + + "
" + + /* Link & image; */ + '
' + + ' ' + + ' ' + + " " + + ' ' + + ' ' + + " " + + "
" + + /* Lists (unordered, ordered & task); */ + '
' + + ' ' + + ' ' + + " " + + ' ' + + ' ' + + " " + + ' ' + + ' ' + + " " + + "
" + + /* Code (syntax); */ + '
' + + '
' + + ' ' + + ' ' + + " " + + '
' + + '
' + + '
' + + ' Code syntax' + + ' ' + + "
" + + '
' + + '
' + + ' ' + + "
" + + "
" + + '
' + + '
Nothing to show
' + + "
" + + "
" + + "
" + + ' ' + + "
" + + "
" + + /* Blockquote, horizontal rule & table; */ + '
' + + ' ' + + ' ' + + " " + + ' ' + + ' ' + + " " + + ' ' + + ' ' + + " " + + "
" + + /* Snippets; */ + '
' + + '
' + + ' ' + + ' ' + + " " + + '
' + + '
' + + '
' + + ' Snippets' + + ' ' + + "
" + + '
' + + '
' + + ' ' + + "
" + + "
" + + ' " + + "
" + + "
" + + "
" + + "
" + + /* Emoji; */ + '
' + + '
' + + ' ' + + ' ' + + " " + + '
' + + '
' + + '
' + + ' Emoji' + + ' ' + + "
" + + '
' + + '
' + + ' ' + + "
" + + "
" + + '
' + + '
Nothing to show
' + + "
" + + "
" + + "
" + + "
" + + "
" + + "
"; + var toolBarRightHTML = + /* Clear; */ + '
' + + '
' + + ' ' + + ' ' + + " " + + "
" + + "
"; // Source: https://github.com/gollum/gollum/blob/9c714e768748db4560bc017cacef4afa0c751a63/lib/gollum/public/gollum/javascript/editor/gollum.editor.js#L516 - function executeAction(definitionObject, commentForm) { + function executeAction(definitionObject, commentForm, button) { var txt = commentForm.value, selPos = { start: commentForm.selectionStart, - end: commentForm.selectionEnd + end: commentForm.selectionEnd, }, selText = txt.substring(selPos.start, selPos.end), repText = selText, @@ -318,9 +486,14 @@ // execute replacement function; if (definitionObject.exec) { - definitionObject.exec(txt, selText, commentForm, function(repText) { - replaceFieldSelection(commentForm, repText); - }); + definitionObject.exec( + button, + selText, + commentForm, + function (repText) { + replaceFieldSelection(commentForm, repText); + }, + ); return; } @@ -350,7 +523,11 @@ } if (repText) { - if (definitionObject.forceNewline === true && (selPos.start > 0 && txt.substr(Math.max(0, selPos.start - 1), 1) !== "\n")) { + if ( + definitionObject.forceNewline === true && + selPos.start > 0 && + txt.substr(Math.max(0, selPos.start - 1), 1) !== "\n" + ) { repText = "\n" + repText; } replaceFieldSelection(commentForm, repText, reselect, cursor); @@ -358,11 +535,16 @@ } // Source: https://github.com/gollum/gollum/blob/9c714e768748db4560bc017cacef4afa0c751a63/lib/gollum/public/gollum/javascript/editor/gollum.editor.js#L708 - function replaceFieldSelection(commentForm, replaceText, reselect, cursorOffset) { + function replaceFieldSelection( + commentForm, + replaceText, + reselect, + cursorOffset, + ) { var txt = commentForm.value, selPos = { start: commentForm.selectionStart, - end: commentForm.selectionEnd + end: commentForm.selectionEnd, }; var selectNew = true; @@ -375,14 +557,23 @@ scrollTop = commentForm.scrollTop; } - commentForm.value = txt.substring(0, selPos.start) + replaceText + txt.substring(selPos.end); + commentForm.value = + txt.substring(0, selPos.start) + + replaceText + + txt.substring(selPos.end); commentForm.focus(); if (selectNew) { if (cursorOffset) { - commentForm.setSelectionRange(selPos.start + cursorOffset, selPos.start + cursorOffset); + commentForm.setSelectionRange( + selPos.start + cursorOffset, + selPos.start + cursorOffset, + ); } else { - commentForm.setSelectionRange(selPos.start, selPos.start + replaceText.length); + commentForm.setSelectionRange( + selPos.start, + selPos.start + replaceText.length, + ); } } @@ -394,191 +585,1237 @@ function isWiki() { return /\/wiki\//.test(location.href); } - function isGist() { - return location.host === "gist.github.com"; - } + + //function isGist() { + // return "gist.github.com" === location.host; + //} function overrideGollumMarkdown() { unsafeWindow.$.GollumEditor.defineLanguage("markdown", MarkDown); } + function unbindGollumFunctions() { - window.setTimeout(function() { - unsafeWindow.$(".function-button:not(#function-help)").unbind("click"); + window.setTimeout(function () { + unsafeWindow + .$(".function-button:not(#function-help)") + .unbind("click"); }, 1); } - var functionButtonClick = function(e) { - e.preventDefault(); - executeAction(MarkDown[this.id], this.commentForm); - return false; + var buttonEvent = function (e) { + if ( + !this.classList.contains("disabled") && + !this.classList.contains("function-dummy") + ) { + e.preventDefault(); + executeAction(MarkDown[this.id], this.commentForm, this); + return false; + } }; - function addToolbar() { - if (isWiki()) { - // Override existing language with improved & missing functions and remove existing click events; - overrideGollumMarkdown(); - unbindGollumFunctions(); + // The suggester container needs extra margin to move the menu below the text because of the added toolbar. + function fixSuggesterMenu(commentForm) { + commentForm.parentNode.parentNode.querySelector( + ".suggester-container", + ).style.marginTop = "36px"; + } - // Remove existing click events when changing languages; - document.getElementById("wiki_format").addEventListener("change", function() { - unbindGollumFunctions(); + var codeSyntaxTop = [ + "JavaScript", + "Java", + "Ruby", + "PHP", + "Python", + "CSS", + "C++", + "C#", + "C", + "HTML", + ]; // https://github.com/blog/2047-language-trends-on-github + /* cSpell: disable */ + var codeSyntaxList = [ + "ABAP", + "abl", + "aconf", + "ActionScript", + "actionscript 3", + "actionscript3", + "Ada", + "ada2005", + "ada95", + "advpl", + "Agda", + "ags", + "AGS Script", + "ahk", + "Alloy", + "AMPL", + "Ant Build System", + "ANTLR", + "apache", + "ApacheConf", + "Apex", + "API Blueprint", + "APL", + "AppleScript", + "Arc", + "Arduino", + "as3", + "AsciiDoc", + "ASP", + "AspectJ", + "aspx", + "aspx-vb", + "Assembly", + "ATS", + "ats2", + "au3", + "Augeas", + "AutoHotkey", + "AutoIt", + "AutoIt3", + "AutoItScript", + "Awk", + "b3d", + "bash", + "bash session", + "bat", + "batch", + "Batchfile", + "Befunge", + "Bison", + "BitBake", + "blitz3d", + "BlitzBasic", + "BlitzMax", + "blitzplus", + "Bluespec", + "bmax", + "Boo", + "bplus", + "Brainfuck", + "Brightscript", + "Bro", + "bsdmake", + "byond", + "C", + "C#", + "C++", + "c++-objdumb", + "C-ObjDump", + "c2hs", + "C2hs Haskell", + "Cap'n Proto", + "Carto", + "CartoCSS", + "Ceylon", + "cfc", + "cfm", + "cfml", + "Chapel", + "Charity", + "chpl", + "ChucK", + "Cirru", + "Clarion", + "Clean", + "clipper", + "CLIPS", + "Clojure", + "CMake", + "COBOL", + "coffee", + "coffee-script", + "CoffeeScript", + "ColdFusion", + "ColdFusion CFC", + "coldfusion html", + "Common Lisp", + "Component Pascal", + "console", + "Cool", + "Coq", + "cpp", + "Cpp-ObjDump", + "Creole", + "Crystal", + "csharp", + "CSS", + "Cucumber", + "Cuda", + "Cycript", + "Cython", + "D", + "D-ObjDump", + "Darcs Patch", + "Dart", + "dcl", + "delphi", + "desktop", + "Diff", + "DIGITAL Command Language", + "DM", + "DNS Zone", + "Dockerfile", + "Dogescript", + "dosbatch", + "dosini", + "dpatch", + "DTrace", + "dtrace-script", + "Dylan", + "E", + "Eagle", + "eC", + "Ecere Projects", + "ECL", + "ECLiPSe", + "edn", + "Eiffel", + "elisp", + "Elixir", + "Elm", + "emacs", + "Emacs Lisp", + "EmberScript", + "erb", + "Erlang", + "F#", + "Factor", + "Fancy", + "Fantom", + "Filterscript", + "fish", + "flex", + "FLUX", + "Formatted", + "Forth", + "FORTRAN", + "foxpro", + "Frege", + "fsharp", + "fundamental", + "G-code", + "Game Maker Language", + "GAMS", + "GAP", + "GAS", + "GDScript", + "Genshi", + "Gentoo Ebuild", + "Gentoo Eclass", + "Gettext Catalog", + "gf", + "gherkin", + "GLSL", + "Glyph", + "Gnuplot", + "Go", + "Golo", + "Gosu", + "Grace", + "Gradle", + "Grammatical Framework", + "Graph Modeling Language", + "Graphviz (DOT)", + "Groff", + "Groovy", + "Groovy Server Pages", + "gsp", + "Hack", + "Haml", + "Handlebars", + "Harbour", + "Haskell", + "Haxe", + "hbs", + "HCL", + "HTML", + "HTML+Django", + "html+django/jinja", + "HTML+ERB", + "html+jinja", + "HTML+PHP", + "html+ruby", + "htmlbars", + "htmldjango", + "HTTP", + "Hy", + "hylang", + "HyPhy", + "i7", + "IDL", + "Idris", + "igor", + "IGOR Pro", + "igorpro", + "inc", + "Inform 7", + "inform7", + "INI", + "Inno Setup", + "Io", + "Ioke", + "irc", + "IRC log", + "irc logs", + "Isabelle", + "Isabelle ROOT", + "J", + "Jade", + "Jasmin", + "Java", + "java server page", + "Java Server Pages", + "JavaScript", + "JFlex", + "jruby", + "js", + "JSON", + "JSON5", + "JSONiq", + "JSONLD", + "jsp", + "JSX", + "Julia", + "KiCad", + "Kit", + "Kotlin", + "KRL", + "LabVIEW", + "Lasso", + "lassoscript", + "latex", + "Latte", + "Lean", + "Less", + "Lex", + "LFE", + "lhaskell", + "lhs", + "LilyPond", + "Limbo", + "Linker Script", + "Linux Kernel Module", + "Liquid", + "lisp", + "litcoffee", + "Literate Agda", + "Literate CoffeeScript", + "Literate Haskell", + "live-script", + "LiveScript", + "LLVM", + "Logos", + "Logtalk", + "LOLCODE", + "LookML", + "LoomScript", + "ls", + "LSL", + "Lua", + "M", + "macruby", + "make", + "Makefile", + "Mako", + "Markdown", + "Mask", + "Mathematica", + "Matlab", + "Maven POM", + "Max", + "max/msp", + "maxmsp", + "MediaWiki", + "Mercury", + "mf", + "MiniD", + "Mirah", + "mma", + "Modelica", + "Modula-2", + "Module Management System", + "Monkey", + "Moocode", + "MoonScript", + "MTML", + "MUF", + "mumps", + "mupad", + "Myghty", + "nasm", + "NCL", + "Nemerle", + "nesC", + "NetLinx", + "NetLinx+ERB", + "NetLogo", + "NewLisp", + "Nginx", + "nginx configuration file", + "Nimrod", + "Ninja", + "Nit", + "Nix", + "nixos", + "NL", + "node", + "nroff", + "NSIS", + "Nu", + "NumPy", + "nush", + "nvim", + "obj-c", + "obj-c++", + "obj-j", + "objc", + "objc++", + "ObjDump", + "Objective-C", + "Objective-C++", + "Objective-J", + "objectivec", + "objectivec++", + "objectivej", + "objectpascal", + "objj", + "OCaml", + "Omgrofl", + "ooc", + "Opa", + "Opal", + "OpenCL", + "openedge", + "OpenEdge ABL", + "OpenSCAD", + "Org", + "osascript", + "Ox", + "Oxygene", + "Oz", + "Pan", + "Papyrus", + "Parrot", + "Parrot Assembly", + "Parrot Internal Representation", + "Pascal", + "pasm", + "PAWN", + "Perl", + "Perl6", + "PHP", + "PicoLisp", + "PigLatin", + "Pike", + "pir", + "PLpgSQL", + "PLSQL", + "Pod", + "PogoScript", + "posh", + "postscr", + "PostScript", + "pot", + "PowerShell", + "Processing", + "progress", + "Prolog", + "Propeller Spin", + "protobuf", + "Protocol Buffer", + "Protocol Buffers", + "Public Key", + "Puppet", + "Pure Data", + "PureBasic", + "PureScript", + "pyrex", + "Python", + "Python traceback", + "QMake", + "QML", + "R", + "Racket", + "Ragel in Ruby Host", + "ragel-rb", + "ragel-ruby", + "rake", + "RAML", + "raw", + "Raw token data", + "rb", + "rbx", + "RDoc", + "REALbasic", + "Rebol", + "Red", + "red/system", + "Redcode", + "RenderScript", + "reStructuredText", + "RHTML", + "RMarkdown", + "RobotFramework", + "Rouge", + "Rscript", + "rss", + "rst", + "Ruby", + "Rust", + "rusthon", + "Sage", + "salt", + "SaltStack", + "saltstate", + "SAS", + "Sass", + "Scala", + "Scaml", + "Scheme", + "Scilab", + "SCSS", + "Self", + "sh", + "Shell", + "ShellSession", + "Shen", + "Slash", + "Slim", + "Smali", + "Smalltalk", + "Smarty", + "sml", + "SMT", + "sourcemod", + "SourcePawn", + "SPARQL", + "splus", + "SQF", + "SQL", + "SQLPL", + "squeak", + "Squirrel", + "Standard ML", + "Stata", + "STON", + "Stylus", + "SuperCollider", + "SVG", + "Swift", + "SystemVerilog", + "Tcl", + "Tcsh", + "Tea", + "TeX", + "Text", + "Textile", + "Thrift", + "TOML", + "ts", + "Turing", + "Turtle", + "Twig", + "TXL", + "TypeScript", + "udiff", + "Unified Parallel C", + "Unity3D Asset", + "UnrealScript", + "Vala", + "vb.net", + "vbnet", + "VCL", + "Verilog", + "VHDL", + "vim", + "VimL", + "Visual Basic", + "Volt", + "Vue", + "Web Ontology Language", + "WebIDL", + "winbatch", + "wisp", + "wsdl", + "X10", + "xBase", + "XC", + "xhtml", + "XML", + "xml+genshi", + "xml+kid", + "Xojo", + "XPages", + "XProc", + "XQuery", + "XS", + "xsd", + "xsl", + "XSLT", + "xten", + "Xtend", + "Yacc", + "YAML", + "yml", + "Zephir", + "Zimpl", + "zsh", + ]; // https://github.com/jerone/UserScripts/issues/18 + /* cSpell: enable */ + var codeSyntaxes = [] + .concat(codeSyntaxTop, codeSyntaxList) + .filter(function (a, b, c) { + return c.indexOf(a) === b; + }); - Array.prototype.forEach.call(document.querySelectorAll(".comment-form-textarea .function-button"), function(button) { - button.removeEventListener("click", functionButtonClick); - }); + function addCodeSyntax(commentForm) { + var syntaxSuggestions = document.createElement("div"); + syntaxSuggestions.dataset.filterableType = "substring"; + syntaxSuggestions.dataset.filterableFor = + "context-code-syntax-filter-field"; + syntaxSuggestions.dataset.filterableLimit = codeSyntaxTop.length; // Show top code syntaxes on open; + + codeSyntaxes.forEach(function (syntax) { + var syntaxSuggestion = document.createElement("a"); + syntaxSuggestion.setAttribute("href", "#"); + syntaxSuggestion.classList.add( + "function-button", + "select-menu-item", + "js-navigation-item", + ); + syntaxSuggestion.dataset.value = syntax; + syntaxSuggestion.id = "function-code-syntax"; + syntaxSuggestions.appendChild(syntaxSuggestion); + + var syntaxSuggestionText = document.createElement("span"); + syntaxSuggestionText.classList.add( + "select-menu-item-text", + "js-select-button-text", + ); + syntaxSuggestionText.appendChild(document.createTextNode(syntax)); + syntaxSuggestion.appendChild(syntaxSuggestionText); + }); + + var suggester = + commentForm.parentNode.parentNode.querySelector(".code-syntaxes"); + suggester.appendChild(syntaxSuggestions); + } + + var suggestionsCache = {}; + + function addSuggestions(commentForm) { + var jssuggester = commentForm.parentNode.parentNode.querySelector( + ".suggester-container .suggester", + ); + var url = jssuggester.getAttribute("data-url"); + + if (suggestionsCache[url]) { + parseSuggestions(commentForm, suggestionsCache[url]); + } else { + unsafeWindow.$.ajax({ + url: url, + success: function (suggestionsData) { + suggestionsCache[url] = suggestionsData; + parseSuggestions(commentForm, suggestionsData); + }, }); } + } - Array.prototype.forEach.call(document.querySelectorAll(".comment-form-textarea,.js-comment-field"), function(commentForm) { - var gollumEditor; - if (commentForm.classList.contains("GithubCommentEnhancer")) { - gollumEditor = commentForm.previousSibling; - } else { - commentForm.classList.add("GithubCommentEnhancer"); - - if (isWiki()) { - gollumEditor = document.getElementById("gollum-editor-function-bar"); - var temp = document.createElement("div"); - temp.innerHTML = editorHTML; - temp.firstElementChild.appendChild(document.getElementById("function-help")); // restore the help button; - gollumEditor.replaceChild(temp.querySelector("#gollum-editor-function-buttons"), document.getElementById("gollum-editor-function-buttons")); - Array.prototype.forEach.call(temp.children, function(elm) { - elm.style.position = "absolute"; - elm.style.right = "30px"; - elm.style.top = "0"; - commentForm.parentNode.insertBefore(elm, commentForm); - }); - temp = null; - } else { - gollumEditor = document.createElement("div"); - gollumEditor.innerHTML = editorHTML; - gollumEditor.id = "gollum-editor-function-bar"; - gollumEditor.style.height = "26px"; - gollumEditor.style.margin = "10px 0"; - gollumEditor.classList.add("active"); - commentForm.parentNode.insertBefore(gollumEditor, commentForm); + function parseSuggestions(commentForm, suggestionsData) { + suggestionsData = suggestionsData.replace( + /js-navigation-item/g, + "function-button js-navigation-item select-menu-item", + ); + + var suggestions = document.createElement("div"); + suggestions.innerHTML = suggestionsData; + + var emojiSuggestions = suggestions.querySelector(".emoji-suggestions"); + emojiSuggestions.style.display = "block"; + emojiSuggestions.dataset.filterableType = "substring"; + emojiSuggestions.dataset.filterableFor = "context-emoji-filter-field"; + emojiSuggestions.dataset.filterableLimit = "10"; + + var suggester = + commentForm.parentNode.parentNode.querySelector(".suggester"); + suggester.style.display = "block"; + suggester.style.marginTop = "0"; + suggester.appendChild(emojiSuggestions); + + var buttons = suggester.querySelectorAll(".function-button"); + Array.prototype.forEach.call(buttons, function (button) { + button.commentForm = commentForm; + button.id = "function-emoji"; + button.addEventListener("click", buttonEvent, false); + unsafeWindow.$(button).on("navigation:keydown", function (e) { + if (e.hotkey === "enter") { + buttonEvent.call(this, e); } + }); + }); + } - var tabnavExtras = commentForm.parentNode.parentNode.querySelector(".comment-form-head .tabnav-right"); - if (tabnavExtras) { - var sponsored = document.createElement("a"); - sponsored.setAttribute("href", "https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer"); - sponsored.setAttribute("target", "_blank"); - sponsored.classList.add("tabnav-widget", "text", "tabnav-extras"); - var sponsoredIcon = document.createElement("span"); - sponsoredIcon.classList.add("octicon", "octicon-question"); - sponsored.appendChild(sponsoredIcon); - sponsored.appendChild(document.createTextNode("Enhanced by Github Comment Enhancer")); - tabnavExtras.insertBefore(sponsored, tabnavExtras.firstElementChild); - } + function addSponsorLink() { + var sponsoredText = " Enhanced by Github Comment Enhancer"; + var sponsored = document.createElement("a"); + sponsored.setAttribute("target", "_blank"); + sponsored.setAttribute( + "href", + "https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer#readme", + ); + sponsored.classList.add("tabnav-extra"); + sponsored.style.cssFloat = "right"; + var sponsoredSvg = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + sponsoredSvg.classList.add("octicon", "octicon-question"); + sponsoredSvg.setAttribute("height", "16"); + sponsoredSvg.setAttribute("width", "16"); + sponsored.appendChild(sponsoredSvg); + var sponsoredPath = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + sponsoredPath.setAttribute( + "d", + "M6 10h2v2H6V10z m4-3.5c0 2.14-2 2.5-2 2.5H6c0-0.55 0.45-1 1-1h0.5c0.28 0 0.5-0.22 0.5-0.5v-1c0-0.28-0.22-0.5-0.5-0.5h-1c-0.28 0-0.5 0.22-0.5 0.5v0.5H4c0-1.5 1.5-3 3-3s3 1 3 2.5zM7 2.3c3.14 0 5.7 2.56 5.7 5.7S10.14 13.7 7 13.7 1.3 11.14 1.3 8s2.56-5.7 5.7-5.7m0-1.3C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7S10.86 1 7 1z", + ); + sponsoredSvg.appendChild(sponsoredPath); + sponsored.appendChild(document.createTextNode(sponsoredText)); + return sponsored; + } + + function removeGitHubToolbar(commentForm) { + var toolbar = commentForm.parentNode.parentNode.querySelector( + ".toolbar-commenting", + ); + if (toolbar) { + toolbar.parentNode.replaceChild(addSponsorLink(), toolbar); + } + } + + function commentFormKeyEvent(commentForm, e) { + var keys = []; + if (e.altKey) { + keys.push("alt"); + } + if (e.ctrlKey) { + keys.push("ctrl"); + } + if (e.shiftKey) { + keys.push("shift"); + } + keys.push(String.fromCharCode(e.which).toLowerCase()); + var keyCombination = keys.join("+"); + + var action; + for (var actionName in MarkDown) { + if ( + MarkDown[actionName].shortcut && + MarkDown[actionName].shortcut.toLowerCase() === keyCombination + ) { + action = MarkDown[actionName]; + break; } + } + if (action) { + e.preventDefault(); + e.stopPropagation(); + executeAction(action, commentForm, null); + return false; + } + } - if (isGist()) { - Array.prototype.forEach.call(gollumEditor.parentNode.querySelectorAll(".select-menu-button"), function(button) { - button.style.paddingRight = "25px"; - }); + function addToolbar() { + var editors = document.querySelectorAll( + ".comment-form-textarea,.js-comment-field", + ); + if (editors.length > 0) { + if (isWiki()) { + // Override existing language with improved & missing functions and remove existing click events; + overrideGollumMarkdown(); + unbindGollumFunctions(); + + // Remove existing click events when changing languages; + document + .getElementById("wiki_format") + .addEventListener("change", function () { + unbindGollumFunctions(); + + var buttons = document.querySelectorAll( + ".comment-form-textarea .function-button", + ); + Array.prototype.forEach.call( + buttons, + function (button) { + button.removeEventListener( + "click", + buttonEvent, + ); + }, + ); + }); } - Array.prototype.forEach.call(gollumEditor.parentNode.querySelectorAll(".function-button"), function(button) { - if (isGist() && button.classList.contains("minibutton")) { - button.style.padding = "0px"; - button.style.textAlign = "center"; - button.style.width = "30px"; - button.firstElementChild.style.marginRight = "0px"; + Array.prototype.forEach.call(editors, function (commentForm) { + var gollumEditor; + if (commentForm.classList.contains("GithubCommentEnhancer")) { + gollumEditor = commentForm.previousSibling; + } else { + commentForm.classList.add("GithubCommentEnhancer"); + + if (isWiki()) { + gollumEditor = document.getElementById( + "gollum-editor-function-bar", + ); + + var helpButton = document.createElement("div"); + helpButton.classList.add("button-group", "btn-group"); + helpButton.appendChild( + document.getElementById("function-help"), + ); + + var tempLeft = document.createElement("div"); + tempLeft.innerHTML = toolBarLeftHTML; + gollumEditor.replaceChild( + tempLeft, + document.getElementById( + "gollum-editor-function-buttons", + ), + ); + + var tempRight = document.createElement("div"); + tempRight.innerHTML = toolBarRightHTML; + tempRight.firstElementChild.appendChild( + document.createTextNode(" "), + ); // extra space; + tempRight.firstElementChild.appendChild(helpButton); // restore the help button; + gollumEditor.appendChild(tempRight); + + tempLeft = tempRight = null; + } else { + gollumEditor = document.createElement("div"); + gollumEditor.innerHTML = + toolBarLeftHTML + toolBarRightHTML; + gollumEditor.id = "gollum-editor-function-bar"; + gollumEditor.style.height = "26px"; + gollumEditor.style.margin = "10px 0"; + gollumEditor.classList.add("active"); + commentForm.parentNode.insertBefore( + gollumEditor, + commentForm, + ); + + removeGitHubToolbar(commentForm); + } + + // Execute next block only when suggester is available; + if ( + commentForm.parentNode.parentNode.querySelector( + ".suggester-container", + ) + ) { + fixSuggesterMenu(commentForm); + + addSuggestions(commentForm); + } else { + Array.prototype.forEach.call( + gollumEditor.parentNode.querySelectorAll( + ".suggester-function", + ), + function (button) { + button.style.display = "none"; + }, + ); + } + + addCodeSyntax(commentForm); } - button.commentForm = commentForm; // remove event listener doesn't accept `bind`; - button.addEventListener("click", functionButtonClick); + + Array.prototype.forEach.call( + gollumEditor.parentNode.querySelectorAll( + ".function-button", + ), + function (button) { + button.commentForm = commentForm; // remove event listener doesn't accept `bind`; + button.addEventListener("click", buttonEvent, false); + unsafeWindow + .$(button) + .on("navigation:keydown", function (e) { + if (e.hotkey === "enter") { + buttonEvent.call(this, e); + } + }); + }, + ); + + commentForm.addEventListener( + "keydown", + commentFormKeyEvent.bind(this, commentForm), + ); }); - }); + } } - // Source: https://github.com/domchristie/to-markdown - var toMarkdown = function(string) { + function overrideGollumDialog() { + if (unsafeWindow.$.GollumDialog === undefined) { + (function (e) { + var t = { + markupCreated: !1, + markup: "", + attachEvents: function (o) { + e("#gollum-dialog-action-ok").click(function (e) { + t.eventOK(e, o); + }), + e("#gollum-dialog-action-cancel").click( + t.eventCancel, + ), + e( + '#gollum-dialog-dialog input[type="text"]', + ).keydown(function (e) { + 13 === e.keyCode && t.eventOK(e, o); + }); + }, + detachEvents: function () { + e("#gollum-dialog-action-ok").unbind("click"), + e("#gollum-dialog-action-cancel").unbind("click"); + }, + createFieldMarkup: function (e) { + for (var o = "
", n = 0; n < e.length; n++) + if ("object" === typeof e[n]) { + switch ( + ((o += '
'), e[n].type) + ) { + case "text": + o += t.createFieldText(e[n]); + } + o += "
"; + } + return (o += "
"); + }, + createFieldText: function (e) { + var t = ""; + return ( + e.name && + ((t += "")), + (t += '')), + t + ); + }, + createMarkup: function (o, n) { + return ( + (t.markupCreated = !0), + e.facebox + ? '

' + + o + + '

' + + n + + '
' + : '

' + + o + + '

' + + n + + '
' + ); + }, + eventCancel: function (e) { + e.preventDefault(), t.hide(); + }, + eventOK: function (o, n) { + o.preventDefault(); + var a = []; + e("#gollum-dialog-dialog-body input").each(function () { + a[e(this).attr("name")] = e(this).val(); + }), + n && "function" === typeof n && n(a), + t.hide(); + }, + hide: function () { + e.facebox + ? ((t.markupCreated = !1), + e(document).trigger("close.facebox"), + t.detachEvents()) + : e.browser.msie + ? (e("#gollum-dialog-dialog") + .hide() + .removeClass("active"), + e("select").css("visibility", "visible")) + : e("#gollum-dialog-dialog").animate( + { + opacity: 0, + }, + { + duration: 200, + complete: function () { + e( + "#gollum-dialog-dialog", + ).removeClass("active"); + }, + }, + ); + }, + init: function (o) { + var n = "", + a = ""; + o && + "object" === typeof o && + (o.body && + "string" === typeof o.body && + (a = "

" + o.body + "

"), + o.fields && + "object" === typeof o.fields && + (a += t.createFieldMarkup(o.fields)), + o.title && + "string" === typeof o.title && + (n = o.title), + t.markupCreated && + (e.facebox + ? e(document).trigger("close.facebox") + : e("#gollum-dialog-dialog").remove()), + (t.markup = t.createMarkup(n, a)), + e.facebox + ? e(document).bind( + "reveal.facebox", + function () { + o.OK && + "function" === typeof o.OK && + (t.attachEvents(o.OK), + e( + e( + '#facebox input[type="text"]', + ).get(0), + ).focus()); + }, + ) + : (e("body").append(t.markup), + o.OK && + "function" === typeof o.OK && + t.attachEvents(o.OK)), + t.show()); + }, + show: function () { + t.markupCreated && + (e.facebox + ? e.facebox(t.markup) + : e.browser.msie + ? (e("#gollum-dialog.dialog").addClass( + "active", + ), + t.position(), + e("select").css("visibility", "hidden")) + : (e("#gollum-dialog.dialog").css( + "display", + "none", + ), + e("#gollum-dialog-dialog").animate( + { + opacity: 0, + }, + { + duration: 0, + complete: function () { + e( + "#gollum-dialog-dialog", + ).css("display", "block"), + t.position(), + e( + "#gollum-dialog-dialog", + ).animate( + { + opacity: 1, + }, + { + duration: 500, + }, + ); + }, + }, + ))); + }, + position: function () { + var t = e("#gollum-dialog-dialog-inner").height(); + e("#gollum-dialog-dialog-inner") + .css("height", t + "px") + .css("margin-top", -1 * parseInt(t / 2)); + }, + }; + e.facebox && + e(document).bind("reveal.facebox", function () { + e("#facebox img.close_image").remove(); + }), + (e.GollumDialog = t); + })(unsafeWindow.$); + } else { + unsafeWindow.$.GollumEditor.Dialog.createFieldText = + unsafeWindow.$.GollumDialog.createFieldText = function (e) { + var t = ""; + return ( + e.name && + ((t += "")), + (t += '')), + t + ); + }; + } + } + /* + * to-markdown - an HTML to Markdown converter + * Copyright 2011, Dom Christie + * Licensed under the MIT license + * Source: https://github.com/domchristie/to-markdown + * + * Code is altered: + * - Added task list support: https://github.com/domchristie/to-markdown/pull/62 + * - He dependency is removed + */ + var toMarkdown = function (string) { var ELEMENTS = [ { - patterns: 'p', - replacement: function(str, attrs, innerHTML) { - return innerHTML ? '\n\n' + innerHTML + '\n' : ''; - } + patterns: "p", + replacement: function (str, attrs, innerHTML) { + return innerHTML ? "\n\n" + innerHTML + "\n" : ""; + }, }, { - patterns: 'br', - type: 'void', - replacement: '\n' + patterns: "br", + type: "void", + replacement: " \n", }, { - patterns: 'h([1-6])', - replacement: function(str, hLevel, attrs, innerHTML) { - var hPrefix = ''; + patterns: "h([1-6])", + replacement: function (str, hLevel, attrs, innerHTML) { + var hPrefix = ""; for (var i = 0; i < hLevel; i++) { - hPrefix += '#'; + hPrefix += "#"; } - return '\n\n' + hPrefix + ' ' + innerHTML + '\n'; - } + return "\n\n" + hPrefix + " " + innerHTML + "\n"; + }, }, { - patterns: 'hr', - type: 'void', - replacement: '\n\n* * *\n' + patterns: "hr", + type: "void", + replacement: "\n\n* * *\n", }, { - patterns: 'a', - replacement: function(str, attrs, innerHTML) { - var href = attrs.match(attrRegExp('href')), - title = attrs.match(attrRegExp('title')); - return href ? '[' + innerHTML + ']' + '(' + href[1] + (title && title[1] ? ' "' + title[1] + '"' : '') + ')' : str; - } + patterns: "a", + replacement: function (str, attrs, innerHTML) { + var href = attrs.match(attrRegExp("href")), + title = attrs.match(attrRegExp("title")); + return href + ? "[" + + innerHTML + + "]" + + "(" + + href[1] + + (title && title[1] + ? ' "' + title[1] + '"' + : "") + + ")" + : str; + }, }, { - patterns: ['b', 'strong'], - replacement: function(str, attrs, innerHTML) { - return innerHTML ? '**' + innerHTML + '**' : ''; - } + patterns: ["b", "strong"], + replacement: function (str, attrs, innerHTML) { + return innerHTML ? "**" + innerHTML + "**" : ""; + }, }, { - patterns: ['i', 'em'], - replacement: function(str, attrs, innerHTML) { - return innerHTML ? '_' + innerHTML + '_' : ''; - } + patterns: ["i", "em"], + replacement: function (str, attrs, innerHTML) { + return innerHTML ? "_" + innerHTML + "_" : ""; + }, }, { - patterns: 'code', - replacement: function(str, attrs, innerHTML) { - //return innerHTML ? '`' + he.decode(innerHTML) + '`' : ''; - return innerHTML ? '`' + innerHTML + '`' : ''; - } + patterns: "code", + replacement: function (str, attrs, innerHTML) { + return innerHTML ? "`" + innerHTML + "`" : ""; + }, }, { - patterns: 'img', - type: 'void', - replacement: function(str, attrs/*, innerHTML*/) { - var src = attrs.match(attrRegExp('src')), - alt = attrs.match(attrRegExp('alt')), - title = attrs.match(attrRegExp('title')); - return '![' + (alt && alt[1] ? alt[1] : '') + ']' + '(' + src[1] + (title && title[1] ? ' "' + title[1] + '"' : '') + ')'; - } - } + patterns: "img", + type: "void", + replacement: function (str, attrs) { + var src = attrs.match(attrRegExp("src")), + alt = attrs.match(attrRegExp("alt")), + title = attrs.match(attrRegExp("title")); + return src + ? "![" + + (alt && alt[1] ? alt[1] : "") + + "]" + + "(" + + src[1] + + (title && title[1] + ? ' "' + title[1] + '"' + : "") + + ")" + : ""; + }, + }, ]; for (var i = 0, len = ELEMENTS.length; i < len; i++) { - if (typeof ELEMENTS[i].patterns === 'string') { - string = replaceEls(string, { tag: ELEMENTS[i].patterns, replacement: ELEMENTS[i].replacement, type: ELEMENTS[i].type }); + if (typeof ELEMENTS[i].patterns === "string") { + string = replaceEls(string, { + tag: ELEMENTS[i].patterns, + replacement: ELEMENTS[i].replacement, + type: ELEMENTS[i].type, + }); } else { - for (var j = 0, pLen = ELEMENTS[i].patterns.length; j < pLen; j++) { - string = replaceEls(string, { tag: ELEMENTS[i].patterns[j], replacement: ELEMENTS[i].replacement, type: ELEMENTS[i].type }); + for ( + var j = 0, pLen = ELEMENTS[i].patterns.length; + j < pLen; + j++ + ) { + string = replaceEls(string, { + tag: ELEMENTS[i].patterns[j], + replacement: ELEMENTS[i].replacement, + type: ELEMENTS[i].type, + }); } } } function replaceEls(html, elProperties) { - var pattern = elProperties.type === 'void' ? '<' + elProperties.tag + '\\b([^>]*)\\/?>' : '<' + elProperties.tag + '\\b([^>]*)>([\\s\\S]*?)<\\/' + elProperties.tag + '>', - regex = new RegExp(pattern, 'gi'), - markdown = ''; - if (typeof elProperties.replacement === 'string') { + var pattern = + elProperties.type === "void" + ? "<" + elProperties.tag + "\\b([^>]*)\\/?>" + : "<" + + elProperties.tag + + "\\b([^>]*)>([\\s\\S]*?)<\\/" + + elProperties.tag + + ">", + regex = new RegExp(pattern, "gi"), + markdown = ""; + if (typeof elProperties.replacement === "string") { markdown = html.replace(regex, elProperties.replacement); } else { - markdown = html.replace(regex, function(str, p1, p2, p3) { + markdown = html.replace(regex, function (str, p1, p2, p3) { return elProperties.replacement.call(this, str, p1, p2, p3); }); } @@ -586,144 +1823,229 @@ } function attrRegExp(attr) { - return new RegExp(attr + '\\s*=\\s*["\']?([^"\']*)["\']?', 'i'); + return new RegExp(attr + "\\s*=\\s*[\"']?([^\"']*)[\"']?", "i"); } // Pre code blocks - string = string.replace(/]*>`([\s\S]*)`<\/pre>/gi, function(str, innerHTML) { - //var text = he.decode(innerHTML); - var text = innerHTML; - text = text.replace(/^\t+/g, ' '); // convert tabs to spaces (you know it makes sense) - text = text.replace(/\n/g, '\n '); - return '\n\n ' + text + '\n'; - }); + string = string.replace( + /]*>`([\s\S]*?)`<\/pre>/gi, + function (str, innerHTML) { + var text = innerHTML; + text = text.replace(/^\t+/g, " "); // convert tabs to spaces (you know it makes sense) + text = text.replace(/\n/g, "\n "); + return "\n\n " + text + "\n"; + }, + ); // Lists // Escape numbers that could trigger an ol // If there are more than three spaces before the code, it would be in a pre tag // Make sure we are escaping the period not matching any character - string = string.replace(/^(\s{0,3}\d+)\. /g, '$1\\. '); + string = string.replace(/^(\s{0,3}\d+)\. /g, "$1\\. "); // Converts lists that have no child lists (of same type) first, then works its way up var noChildrenRegex = /<(ul|ol)\b[^>]*>(?:(?!/gi; - var replaceListsFn = function(str) { - return replaceLists(str); - }; while (string.match(noChildrenRegex)) { - string = string.replace(noChildrenRegex, replaceListsFn); + string = string.replace(noChildrenRegex, replaceLists); } function replaceLists(html) { - - html = html.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi, function(str, listType, innerHTML) { - var lis = innerHTML.split(''); - lis.splice(lis.length - 1, 1); - - var lisReplace = function(str, innerHTML) { - innerHTML = innerHTML.replace(/^\s+/, ''); - innerHTML = innerHTML.replace(/\n\n/g, '\n\n '); - // indent nested lists - innerHTML = innerHTML.replace(/\n([ ]*)+(\*|\d+\.) /g, '\n$1 $2 '); - return prefix + innerHTML; - }; - - for (i = 0, len = lis.length; i < len; i++) { - if (lis[i]) { - var prefix = (listType === 'ol') ? (i + 1) + ". " : "* "; - lis[i] = lis[i].replace(/\s*]*>([\s\S]*)/i, lisReplace); + html = html.replace( + /<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi, + function (str, listType, innerHTML) { + var lis = innerHTML.split(""); + lis.splice(lis.length - 1, 1); + + for (i = 0, len = lis.length; i < len; i++) { + if (lis[i]) { + var prefix = + listType === "ol" ? i + 1 + ". " : "* "; + lis[i] = lis[i].replace( + /\s*]*>([\s\S]*)/i, + function (str, innerHTML) { + innerHTML = innerHTML.replace( + /\s*]*?(checked[^>]*)?type=['"]?checkbox['"]?[^>]>/, + function (inputStr, checked) { + return checked ? "[X]" : "[ ]"; + }, + ); + innerHTML = innerHTML.replace(/^\s+/, ""); + innerHTML = innerHTML.replace( + /\n\n/g, + "\n\n ", + ); + // indent nested lists + innerHTML = innerHTML.replace( + /\n([ ]*)+(\*|\d+\.) /g, + "\n$1 $2 ", + ); + return prefix + innerHTML; + }, + ); + } + lis[i] = lis[i].replace(/(.) +$/m, "$1"); } - } - return lis.join('\n'); - }); - return '\n\n' + html.replace(/[ \t]+\n|\s+$/g, ''); + return lis.join("\n"); + }, + ); + + return "\n\n" + html.replace(/[ \t]+\n|\s+$/g, ""); } // Blockquotes - var deepest = /]*>((?:(?!/gi; - var replaceBlockquotesFn = function(str) { - return replaceBlockquotes(str); - }; + var deepest = + /]*>((?:(?!/gi; while (string.match(deepest)) { - string = string.replace(deepest, replaceBlockquotesFn); + string = string.replace(deepest, replaceBlockquotes); } function replaceBlockquotes(html) { - html = html.replace(/]*>([\s\S]*?)<\/blockquote>/gi, function(str, inner) { - inner = inner.replace(/^\s+|\s+$/g, ''); - inner = cleanUp(inner); - inner = inner.replace(/^/gm, '> '); - inner = inner.replace(/^(>([ \t]{2,}>)+)/gm, '> >'); - return inner; - }); + html = html.replace( + /]*>([\s\S]*?)<\/blockquote>/gi, + function (str, inner) { + inner = inner.replace(/^\s+|\s+$/g, ""); + inner = cleanUp(inner); + inner = inner.replace(/^/gm, "> "); + inner = inner.replace(/^(>([ \t]{2,}>)+)/gm, "> >"); + return inner; + }, + ); return html; } function cleanUp(string) { - string = string.replace(/^[\t\r\n]+|[\t\r\n]+$/g, ''); // trim leading/trailing whitespace - string = string.replace(/\n\s+\n/g, '\n\n'); - string = string.replace(/\n{3,}/g, '\n\n'); // limit consecutive linebreaks to 2 + string = string.replace(/^[\t\r\n]+|[\t\r\n]+$/g, ""); // trim leading/trailing whitespace + string = string.replace(/\n\s+\n/g, "\n\n"); + string = string.replace(/\n{3,}/g, "\n\n"); // limit consecutive line-breaks to 2 return string; } return cleanUp(string); }; - function addReplyButtons() { - Array.prototype.forEach.call(document.querySelectorAll(".comment"), function(comment) { - var oldReply = comment.querySelector(".GithubCommentEnhancerReply"); - if (oldReply) { oldReply.parentNode.removeChild(oldReply); } - - var header = comment.querySelector(".timeline-comment-header"), - actions = comment.querySelector(".timeline-comment-actions"), - newComment = document.querySelector(".timeline-new-comment .comment-form-textarea"); - - if (!header) { return; } - if (!actions) { - actions = document.createElement("div"); - actions.classList.add("timeline-comment-actions"); - header.insertBefore(actions, header.firstElementChild); - } + function getCommentTextarea(replyBtn) { + var newComment = replyBtn; + while ( + newComment && + !newComment.classList.contains("js-quote-selection-container") + ) { + newComment = newComment.parentNode; + } + if (newComment) { + var lastElementChild = newComment.lastElementChild; + lastElementChild.classList.add("open"); + newComment = lastElementChild.querySelector( + ".comment-form-textarea", + ); + } else { + newComment = document.querySelector( + ".timeline-new-comment .comment-form-textarea", + ); + } + return newComment; + } - var reply = document.createElement("a"); - reply.setAttribute("href", "#"); - reply.classList.add("GithubCommentEnhancerReply", "octicon", "octicon-mail-reply"); - reply.addEventListener("click", function(e) { - e.preventDefault(); + function addReplyButtons() { + Array.prototype.forEach.call( + document.querySelectorAll(".comment"), + function (comment) { + var oldReply = comment.querySelector( + ".GithubCommentEnhancerReply", + ); + if (oldReply) { + oldReply.parentNode.removeChild(oldReply); + } - var timestamp = comment.querySelector(".timestamp"); + var header = comment.querySelector(".timeline-comment-header"), + actions = comment.querySelector( + ".timeline-comment-actions", + ); - var commentText = comment.querySelector(".comment-form-textarea"); - if (commentText) { - commentText = commentText.value; - } else { - commentText = toMarkdown(comment.querySelector(".comment-body").innerHTML); + if (!header) { + return; + } + if (!actions) { + actions = document.createElement("div"); + actions.classList.add("timeline-comment-actions"); + header.insertBefore(actions, header.firstElementChild); } - commentText = commentText.trim().split("\n").map(function(line) { - return "> " + line; - }).join("\n"); - - var text = newComment.value.length > 0 ? "\n" : ""; - text += String.format('@{0} commented on [{1}]({2} "{3} - Enhanced by Github Comment Enhancer"):\n{4}\n\n', - comment.querySelector(".author").textContent, - timestamp.firstElementChild.getAttribute("title"), - timestamp.href, - timestamp.firstElementChild.getAttribute("datetime"), - commentText); - - newComment.value += text; - newComment.setSelectionRange(newComment.value.length, newComment.value.length); - newComment.focus(); - }); - var replyWrapper = document.createElement("span"); - replyWrapper.setAttribute("aria-label", "Reply to this comment"); - replyWrapper.classList.add("tooltipped", "tooltipped-ne"); - replyWrapper.appendChild(reply); + var reply = document.createElement("a"); + reply.setAttribute("href", "#"); + reply.setAttribute("aria-label", "Reply to this comment"); + reply.classList.add( + "GithubCommentEnhancerReply", + "timeline-comment-action", + "tooltipped", + "tooltipped-ne", + ); + reply.addEventListener("click", function (e) { + e.preventDefault(); + + var newComment = getCommentTextarea(this); + + var timestamp = comment.querySelector(".timestamp"); + + var commentText = comment.querySelector( + ".comment-form-textarea", + ); + if (commentText) { + commentText = commentText.value; + } else { + commentText = toMarkdown( + comment.querySelector(".comment-body").innerHTML, + ); + } + commentText = commentText + .trim() + .split("\n") + .map(function (line) { + return "> " + line; + }) + .join("\n"); + + var text = newComment.value.length > 0 ? "\n" : ""; + text += String.format( + '[**@{0}**]({1}/{0}) commented on [{2}]({3} "{4} - Replied by Github Comment Enhancer"):\n{5}\n\n', + comment.querySelector(".author").textContent, + location.origin, + timestamp.firstElementChild.getAttribute("title"), + timestamp.href, + timestamp.firstElementChild.getAttribute("datetime"), + commentText, + ); + + newComment.value += text; + newComment.setSelectionRange( + newComment.value.length, + newComment.value.length, + ); + newComment.focus(); + }); - actions.appendChild(replyWrapper); - }); + var svg = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + svg.classList.add("octicon", "octicon-mail-reply"); + svg.setAttribute("height", "16"); + svg.setAttribute("width", "16"); + reply.appendChild(svg); + var path = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path.setAttribute( + "d", + "M6 2.5l-6 4.5 6 4.5v-3c1.73 0 5.14 0.95 6 4.38 0-4.55-3.06-7.05-6-7.38v-3z", + ); + svg.appendChild(path); + + actions.appendChild(reply); + }, + ); } // init; @@ -731,22 +2053,25 @@ addToolbar(); addReplyButtons(); } + overrideGollumDialog(); init(); // on pjax; - unsafeWindow.$(document).on("pjax:end", init); // `pjax:end` also runs on history back; - - // for inline comments; - var files = document.querySelectorAll('.file-code'); - Array.prototype.forEach.call(files, function(file) { - file = file.firstElementChild; - new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { + unsafeWindow.$(document).on("pjax:end", init); // `pjax:end` also runs on history back; + + // For inline comments on commits; + var files = document.querySelectorAll(".diff-table"); + Array.prototype.forEach.call(files, function (file) { + file = file.querySelector(".diff-table > tbody"); + new MutationObserver(function (mutations) { + mutations.forEach(function (mutation) { if (mutation.target === file) { addToolbar(); } }); - }).observe(file, { childList: true, subtree: true }); + }).observe(file, { + childList: true, + subtree: true, + }); }); - })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window); diff --git a/Github_Comment_Enhancer/README.md b/Github_Comment_Enhancer/README.md index 1bfbaa6..8c9cfc5 100644 --- a/Github_Comment_Enhancer/README.md +++ b/Github_Comment_Enhancer/README.md @@ -1,91 +1,49 @@ -# [Github Comment Enhancer](https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer) - -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js) - -### Description - -Add features to enhance comments & wiki on [Github](https://github.com) and comments on [Github Gist](https://gist.github.com). - -### Screenshot +# [Github Comment Enhancer](https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer) (deprecated) + +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Notice + +\*THIS USERSCRIPT IS SADLY **DEPRECATED\***. Most of this UserScript functionality has been [implemented by GitHub](https://github.com/blog/2097-improved-commenting-with-markdown). The _reply_-feature that GitHub didn't implement, has been moved to it's own UserScript: [Github Reply Comments](https://github.com/jerone/UserScripts/tree/master/Github_Reply_Comments#readme). + +## Description + +Add features to enhance comments & wiki & contact page on [Github](https://github.com) and comments on [Github Gist](https://gist.github.com). + +You can reply to issues, pull requests and inline comments by pressing the reply button on every comment. + +Every comment field also got a toolbar, consisting of the following buttons: + +- Bold (ctrl+b) +- Italic (ctrl+i) +- Underline (ctrl+u) +- Strikethrough (ctrl+s) +- Headers + - Header 1 (ctrl+1) + - Header 2 (ctrl+2) + - Header 3 (ctrl+3) + - Header 4 (ctrl+4) + - Header 5 (ctrl+5) + - Header 6 (ctrl+6) +- Link (ctrl+l) +- Image (ctrl+g) +- Unordered List (alt+ctrl+u) +- Ordered List (alt+ctrl+o) +- Task List (alt+ctrl+t) +- Code (ctrl+k) + - Syntax highlighting +- Quote (ctrl+q) +- Horizontal Rule (ctrl+r) +- Table (alt+shift+t) +- Snippets + - Tab character + - UserAgent + - Contributing message +- Emoji +- Clear content (alt+ctrl+x) + +## Screenshot ![Github Comment Enhancer Screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/screenshot.jpg) - -### Compatible - -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Chromium.png) Native](http://www.chromium.org/developers/design-documents/user-scripts) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/GoogleChrome.png) Google Chrome Desktop](https://www.google.com/chrome/). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) TamperMonkey](http://tampermonkey.net) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/GoogleChrome.png) Google Chrome Desktop](https://www.google.com/chrome/). - -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... - -### Version History - -* **2.0.2** - * Fix multiple reply buttons when navigating back; - * Added native & TamperMonkey for Google Chrome compatibility; -* **2.0.1** - * Small bug fix with reply after another layout update from Github; -* **2.0** - * Fixed issues after recent layout updates (https://github.com/blog/1866-the-new-github-issues); - * Fixed pjax for new issues & PR listing pages; - * Added reply buttons (using [to-markdown](https://github.com/domchristie/to-markdown) to convert to Markdown); -* **1.6** - * Removed floating arrow (fixes https://github.com/jerone/UserScripts/issues/7); - * Fixed history back; - * Fixed buttons on Github Gist; - * Fixed inline comments; -* **1.5** - * Added pinned contributing message; - * Added tooltips for all buttons; -* **1.4** - * Included on [Github Gist](https://gist.github.com); - * Fixed issue with missing trailing space when selected; - * Added snippets (only useragent atm); - * Added clear button; -* **1.3** - * Navigation logic implemented; - * Inline comment logic implemented; - * Included on Wiki pages; - * Fixed warnings by JSHint; -* **1.2** - * Added simple table logic; - * Added headers 4 'til 6; - * Combined headers in one button; - * Reordered buttons; - * Added Task Lists https://help.github.com/articles/writing-on-github#task-lists - * Added fenced code blocks; - * Clean up; -* **1.1.1** - * Fixed space being not part of selection again; -* **1.1** - * Fixed space being not part of selection; - * Added new line when needed; -* **1.0** - * Initial version; - -### TODO - -- ~~Allow editing [markdown files](https://github.com/jerone/UserScripts/edit/master/README.md)~~ -> to hard right now, requires knowledge of hooking into [ACE](https://github.com/ajaxorg/ace); -- Add more snippets (predefined and executable); - -### Notes - -Test cases: - -- https://github.com/jerone/UserScripts/issues/new (new issue) -- https://github.com/jerone/UserScripts/issues/1 (new comment & edit comment) -- https://github.com/jerone/UserScripts/commit/master (comments below & inline comments) -- https://github.com/jerone/UserScripts/wiki/_new (new wiki) -- https://github.com/jerone/OpenUserJS.org/compare/master...app_route (new PR) -- https://gist.github.com/jerone/9526258 (new comment & edit comment) - -### Contributors - -- [tophf](https://github.com/tophf) - -### External links - -* [Greasy Fork](https://greasyfork.org/scripts/493-github-comment-enhancer) -* [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Comment_Enhancer) -* [MonkeyGuts](https://monkeyguts.com/code.php?id=180) diff --git a/Github_Comment_Enhancer/screenshot-2.jpg b/Github_Comment_Enhancer/screenshot-2.jpg new file mode 100644 index 0000000..2366816 Binary files /dev/null and b/Github_Comment_Enhancer/screenshot-2.jpg differ diff --git a/Github_Comment_Enhancer/screenshot.jpg b/Github_Comment_Enhancer/screenshot.jpg index 2366816..69a6a8e 100644 Binary files a/Github_Comment_Enhancer/screenshot.jpg and b/Github_Comment_Enhancer/screenshot.jpg differ diff --git a/Github_Commit_Diff/Github_Commit_Diff.user.js b/Github_Commit_Diff/Github_Commit_Diff.user.js index ec2dbb6..277677f 100644 --- a/Github_Commit_Diff/Github_Commit_Diff.user.js +++ b/Github_Commit_Diff/Github_Commit_Diff.user.js @@ -1,92 +1,185 @@ // ==UserScript== -// @name Github Commit Diff -// @namespace https://github.com/jerone/UserScripts -// @description Adds button to show diff (or patch) file for commit -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Commit_Diff -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Commit_Diff -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/Github_Commit_Diff.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/Github_Commit_Diff.user.js -// @include https://github.com/* -// @version 1.6.1 -// @grant none +// @name Github Commit Diff +// @namespace https://github.com/jerone/UserScripts +// @description Adds button to show diff (or patch) file for commit +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Commit_Diff +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Commit_Diff +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/Github_Commit_Diff.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/Github_Commit_Diff.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @include https://github.com/* +// @exclude https://github.com/*/*.diff +// @exclude https://github.com/*/*.patch +// @version 1.6.7 +// @grant none // ==/UserScript== -/* global unsafeWindow */ -(function() { +// cSpell:ignore tooltipped, diffbar +(function () { function addButton() { var e; - if (!(/\/commit\//.test(location.href) || /\/compare\//.test(location.href) || /\/pull\/\d*\/files/.test(location.href)) || - !(e = document.getElementById("toc"))) { return; } + if ( + (/\/commit\//.test(location.href) || + /\/compare\//.test(location.href)) && + (e = document.getElementById("toc")) + ) { + let r = e.querySelector(".GithubCommitDiffButton"); + if (r) { + r.parentElement.removeChild(r); + } - var r = e.querySelector(".GithubCommitDiffButton"); - if (r) { r.parentElement.removeChild(r); } + let b = e.querySelector(".toc-diff-stats"); - function getPatchOrDiffHref(type) { - return (document.querySelector("link[type='text/plain+" + type + "']") - || document.querySelector("link[type='text/x-" + type + "']") - || { href: location.href + "." + type }).href; - } + const s = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + s.classList.add("octicon", "octicon-diff"); + s.setAttributeNS(null, "height", 16); + s.setAttributeNS(null, "width", 14); + s.setAttributeNS(null, "viewBox", "0 0 14 16"); + + const p = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + p.setAttributeNS( + null, + "d", + "M6 7h2v1H6v2h-1V8H3v-1h2V5h1v2zM3 13h5v-1H3v1z m4.5-11l3.5 3.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V3c0-0.55 0.45-1 1-1h6.5z m2.5 4L7 3H1v12h9V6zM8.5 0S3 0 3 0v1h5l4 4v8h1V4.5L8.5 0z", + ); + s.appendChild(p); + + let a = document.createElement("a"); + a.classList.add("btn", "btn-sm", "tooltipped", "tooltipped-n"); + a.setAttribute("href", getPatchOrDiffHref("diff")); + a.setAttribute("rel", "nofollow"); + a.setAttribute( + "aria-label", + "Show commit diff.\r\nHold Shift to open commit patch.", + ); + a.appendChild(s); + a.appendChild(document.createTextNode(" Diff")); + + let g = document.createElement("div"); + g.classList.add("GithubCommitDiffButton", "float-right"); + g.style.margin = "0 10px 0 0"; // Give us some room + g.appendChild(a); - var b = e.querySelector(".toc-diff-stats"); - - var s = document.createElement("span"); - s.textContent = " "; - s.classList.add("octicon", "octicon-diff"); - s.style.color = "#333"; // set color because of css selector `p.explain .octicon`; - - var a = document.createElement("a"); - a.classList.add("minibutton", "tooltipped", "tooltipped-n"); - a.setAttribute("href", getPatchOrDiffHref("diff")); - a.setAttribute("rel", "nofollow"); - a.setAttribute("aria-label", "Show commit diff.\r\nHold Shift to open commit patch."); - a.appendChild(s); - a.appendChild(document.createTextNode(" Diff")); - - var g = document.createElement("div"); - g.classList.add("GithubCommitDiffButton", "button-group", "right"); - g.style.margin = "0 10px 0 0"; // give us some room; - g.appendChild(a); - - b.parentNode.insertBefore(g, b); - - a.addEventListener("mousedown", function(e) { - if (e.shiftKey) { - var patch = getPatchOrDiffHref("patch"); - e.preventDefault(); - a.setAttribute("href", patch); - if (e.which === 1) { // left click; - location.href = patch; - // To prevent Firefox default behavior (opening a new window) - // when pressing shift-click on a link, delete the link. - this.parentElement.removeChild(this); - } else if (e.which === 2) { // middle click; - window.open(patch, "GithubCommitDiff"); - } - } else { - a.setAttribute("href", getPatchOrDiffHref("diff")); + b.parentNode.insertBefore(g, b); + + a.addEventListener("mousedown", mousedownEvent, false); + a.addEventListener( + "mouseout", + function () { + a.setAttribute("href", getPatchOrDiffHref("diff")); + }, + false, + ); + } else if ( + /\/pull\/\d*\/(files|commits)/.test(location.href) && + (e = document.querySelector( + "#files_bucket .pr-toolbar .diffbar > .float-right", + )) + ) { + let r = e.querySelector(".GithubCommitDiffButton"); + if (r) { + r.parentElement.removeChild(r); } - }, false); - a.addEventListener("mouseout", function() { + + const s = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + s.classList.add("octicon", "octicon-diff"); + s.setAttributeNS(null, "height", 16); + s.setAttributeNS(null, "width", 14); + s.setAttributeNS(null, "viewBox", "0 0 14 16"); + + const p = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + p.setAttributeNS( + null, + "d", + "M6 7h2v1H6v2h-1V8H3v-1h2V5h1v2zM3 13h5v-1H3v1z m4.5-11l3.5 3.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V3c0-0.55 0.45-1 1-1h6.5z m2.5 4L7 3H1v12h9V6zM8.5 0S3 0 3 0v1h5l4 4v8h1V4.5L8.5 0z", + ); + s.appendChild(p); + + let a = document.createElement("a"); + a.classList.add( + "btn", + "btn-sm", + "btn-outline", + "tooltipped", + "tooltipped-s", + ); a.setAttribute("href", getPatchOrDiffHref("diff")); - }, false); - } + a.setAttribute("rel", "nofollow"); + a.setAttribute( + "aria-label", + "Show commit diff.\r\nHold Shift to open commit patch.", + ); + a.appendChild(s); + a.appendChild(document.createTextNode(" Diff")); - // init; - addButton(); + let g = document.createElement("div"); + g.classList.add("GithubCommitDiffButton", "diffbar-item"); + g.appendChild(a); + + e.insertBefore(g, e.firstChild); - // on pjax; - unsafeWindow.$(document).on("pjax:end", addButton); // `pjax:end` also runs on history back; + a.addEventListener("mousedown", mousedownEvent, false); + a.addEventListener( + "mouseout", + function () { + a.setAttribute("href", getPatchOrDiffHref("diff")); + }, + false, + ); + } + } - // on PR files tab; - var f; - if ((f = document.querySelector(".js-pull-request-tab[data-container-id='files_bucket']"))) { - f.addEventListener("click", function() { - window.setTimeout(addButton, 13); - }); + function mousedownEvent(e) { + if (e.shiftKey) { + var patch = getPatchOrDiffHref("patch"); + e.preventDefault(); + this.setAttribute("href", patch); + if (e.which === 1) { + // left click + location.href = patch; + // To prevent Firefox default behavior (opening a new window) + // when pressing shift-click on a link, delete the link. + this.parentElement.removeChild(this); + } else if (e.which === 2) { + // Middle click + window.open(patch, "GithubCommitDiff"); + } + } else { + this.setAttribute("href", getPatchOrDiffHref("diff")); + } } + function getPatchOrDiffHref(type) { + return ( + document.querySelector('link[type="text/plain+' + type + '"]') || + document.querySelector('link[type="text/x-' + type + '"]') || { + href: location.href + "." + type, + } + ).href; + } + + // Init + addButton(); + + // Pjax + document.addEventListener("pjax:end", addButton); })(); diff --git a/Github_Commit_Diff/README.md b/Github_Commit_Diff/README.md index d3b3bf8..d72b87a 100644 --- a/Github_Commit_Diff/README.md +++ b/Github_Commit_Diff/README.md @@ -1,53 +1,97 @@ -# [Github Commit Diff](https://github.com/jerone/UserScripts/tree/master/Github_Commit_Diff) +# [Github Commit Diff](https://github.com/jerone/UserScripts/tree/master/Github_Commit_Diff) (abandoned) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/Github_Commit_Diff.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/Github_Commit_Diff.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Commit_Diff/Github_Commit_Diff.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description - -Adds button to show diff file for commit. Hold Shift key to open the patch file. +## Description +Adds a button to show the `.diff` file for every commit. +Hold Shift key to open the `.patch` file instead of an `.diff` file. This works on commits, pull requests and compare pages. -### Screenshot +## Screenshot ![Github Commit Diff screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Diff/screenshot.jpg) -### Compatible +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **1.6.7** + + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). + +- **1.6.6** + + - Shift open `.patch` was broken (fixes [119](https://github.com/jerone/UserScripts/issues/119)). + +- **1.6.5** + + - Fixed issues after recent layout updates. + +- **1.6.4** + + - Fixed issues after recent layout updates. + +- **1.6.3** + + - Fixed issues after recent layout updates. + +- **1.6.2** + + - Fixed issues after recent layout updates. -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). +- **1.6.1** -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... + - Tooltips now on top. -### Version History +- **1.6** -* **1.6.1** - * Tooltips now on top; -* **1.6** - * Fixed align issue with new split diffs (fixes https://github.com/jerone/UserScripts/issues/24); -* **1.5** - * Fixed issues after recent layout updates (fixes https://github.com/jerone/UserScripts/issues/8); -* **1.4** - * Fixed middle & right mouse clicks; -* **1.3** - * Added to pull requests; - * Added to compare page; -* **1.2** - * Added support for Scriptish; -* **1.1** - * Clean up; -* **1.0** - * Initial version; + - Fixed align issue with new split diffs (fixes [24](https://github.com/jerone/UserScripts/issues/24)). -### Notes +- **1.5** + + - Fixed issues after recent layout updates (fixes [8](https://github.com/jerone/UserScripts/issues/8)). + +- **1.4** + + - Fixed middle & right mouse clicks. + +- **1.3** + + - Added to pull requests. + - Added to compare page. + +- **1.2** + + - Added support for Scriptish. + +- **1.1** + + - Clean up. + +- **1.0** + + - Initial version. + +## Notes Use cases: -* https://github.com/OpenUserJs/OpenUserJS.org/commit/aac291b83a5d5fa4fb4382080473ef3a4dd908c2 (commit) -* https://github.com/OpenUserJs/OpenUserJS.org/pull/327/files (pr) -* https://github.com/OpenUserJs/OpenUserJS.org/compare/master%40%7B1day%7D...master (compare) +- (commit) + +- (PR) + +- + (PR commit) + +- (compare) -### External links +## External links -* [Greasy Fork](https://greasyfork.org/scripts/77) -* [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Commit_Diff) +- [Greasy Fork](https://greasyfork.org/scripts/77) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Commit_Diff) diff --git a/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js b/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js index 6f40567..30a3af9 100644 --- a/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js +++ b/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js @@ -1,77 +1,120 @@ // ==UserScript== -// @name Github Commit Whitespace -// @namespace https://github.com/jerone/UserScripts -// @description Adds button to hide whitespaces from commit -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Commit_Whitespace -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Commit_Whitespace -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js -// @include https://github.com/* -// @version 1.4.1 -// @grant none +// @name Github Commit Whitespace +// @namespace https://github.com/jerone/UserScripts +// @description Adds button to hide whitespaces from commit +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Commit_Whitespace +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Commit_Whitespace +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @include https://github.com/* +// @version 1.5.4 +// @grant none // ==/UserScript== -/* global unsafeWindow */ -(function() { +// cSpell:ignore tooltipped, diffbar +(function () { function addButton() { var e; - if (!(/\/commit\//.test(location.href) || /\/compare\//.test(location.href) || /\/pull\/\d*\/files/.test(location.href)) || - !(e = document.getElementById("toc"))) { return; } + if ( + (/\/commit\//.test(location.href) || + /\/compare\//.test(location.href)) && + (e = document.getElementById("toc")) + ) { + let r = e.querySelector(".GithubCommitWhitespaceButton"); + if (r) { + r.parentElement.removeChild(r); + } - var r = e.querySelector(".GithubCommitWhitespaceButton"); - if (r) { r.parentElement.removeChild(r); } + let on = /w=/.test(location.search); // Any occurrence results in enabling - var on = /w=/.test(location.search); // any occurense results in enabling; + let b = e.querySelector(".toc-diff-stats"); - var b = e.querySelector(".toc-diff-stats"); + let a = document.createElement("a"); + a.classList.add("btn", "btn-sm", "tooltipped", "tooltipped-n"); + if (on) { + a.classList.add("selected"); + } + a.setAttribute("href", url(on)); + a.setAttribute("rel", "nofollow"); + a.setAttribute( + "aria-label", + on ? "Show commit whitespace" : "Hide commit whitespace", + ); + a.appendChild(document.createTextNode("\u2423")); - var s = document.createElement("span"); - s.textContent = " \u2423"; - s.style.color = "#333"; // set color because of css selector `p.explain .octicon`; + let g = document.createElement("div"); + g.classList.add("GithubCommitWhitespaceButton", "float-right"); + g.style.margin = "0 10px 0 0"; // Give us some room + g.appendChild(a); - var a = document.createElement("a"); - a.classList.add("minibutton", "tooltipped", "tooltipped-n"); - if (on) { a.classList.add("selected"); } - a.setAttribute("href", url(on)); - a.setAttribute("rel", "nofollow"); - a.setAttribute("aria-label", on ? "Show commit whitespace" : "Hide commit whitespaces"); - a.appendChild(s); + b.parentNode.insertBefore(g, b); + } else if ( + /\/pull\/\d*\/(files|commits)/.test(location.href) && + (e = document.querySelector( + "#files_bucket .pr-toolbar .diffbar > .pr-review-tools", + )) + ) { + let r = e.querySelector(".GithubCommitWhitespaceButton"); + if (r) { + r.parentElement.removeChild(r); + } - var g = document.createElement("div"); - g.classList.add("GithubCommitWhitespaceButton", "button-group", "right"); - g.style.margin = "0 10px 0 0"; // give us some room; - g.appendChild(a); + let on = /w=/.test(location.search); // Any occurrence result in enabling - b.parentNode.insertBefore(g, b); + let a = document.createElement("a"); + a.classList.add( + "btn", + "btn-sm", + "btn-outline", + "tooltipped", + "tooltipped-s", + ); + a.setAttribute("href", url(on)); + a.setAttribute("rel", "nofollow"); + a.setAttribute( + "aria-label", + on ? "Show commit whitespace" : "Hide commit whitespace", + ); + a.appendChild(document.createTextNode("\u2423")); + + let g = document.createElement("div"); + g.classList.add("GithubCommitWhitespaceButton", "diffbar-item"); + g.appendChild(a); + + e.insertBefore(g, e.firstChild); + } } function url(on) { - var searches = location.search.replace(/^\?/, "").split("&").filter(function(item) { - return item && !/w=.*/.test(item); - }); + var searches = location.search + .replace(/^\?/, "") + .split("&") + .filter(function (item) { + return item && !/w=.*/.test(item); + }); if (!on) { searches.push("w=1"); } - return location.href.replace(location.search, "") - + (searches.length > 0 ? "?" + searches.join("&") : ""); + return ( + location.href + .replace(location.search, "") + .replace(location.hash, "") + + (searches.length > 0 ? "?" + searches.join("&") : "") + + location.hash + ); } - // init; + // Init addButton(); - // on pjax; - unsafeWindow.$(document).on("pjax:end", addButton); // `pjax:end` also runs on history back; - - // on PR files tab; - var f; - if ((f = document.querySelector(".js-pull-request-tab[data-container-id='files_bucket']"))) { - f.addEventListener("click", function() { - window.setTimeout(addButton, 13); - }); - } - + // Pjax + document.addEventListener("pjax:end", addButton); })(); diff --git a/Github_Commit_Whitespace/README.md b/Github_Commit_Whitespace/README.md index 01f1ec3..cc23d03 100644 --- a/Github_Commit_Whitespace/README.md +++ b/Github_Commit_Whitespace/README.md @@ -1,54 +1,109 @@ -# [Github Commit Whitespace](https://github.com/jerone/UserScripts/tree/master/Github_Commit_Whitespace) +# [Github Commit Whitespace](https://github.com/jerone/UserScripts/tree/master/Github_Commit_Whitespace) (abandoned) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Commit_Whitespace/Github_Commit_Whitespace.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description +## Description Adds button to hide whitespaces from commit. This works on commits, pull requests and compare pages. -### Screenshot +## Screenshot + +### Before -##### Before ![Github Commit Whitespace screenshot before](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/screenshot_before.jpg) -##### After + +### After + ![Github Commit Whitespace screenshot after](https://github.com/jerone/UserScripts/raw/master/Github_Commit_Whitespace/screenshot_after.jpg) -### Compatible +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **1.5.4** + + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). + +- **1.5.3** + + - Fix URL generation with hash. + +- **1.5.2** + + - Fixed issues after recent layout updates. + +- **1.5.1** + + - Fixed issues after recent layout updates. + +- **1.5.0** + + - :sparkles: Added support for commits from PR's. + +- **1.4.4** + + - :clapper: New version of GitHub Commit Whitespace. + +- **1.4.3** -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). + - Fixed issues after recent layout updates. -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... +- **1.4.2** -### Version History + - Fixed issues after recent layout updates. -* **1.4.1** - * Tooltips now on top; -* **1.4** - * Fixed align & url issues with new split diffs (fixes https://github.com/jerone/UserScripts/issues/25); -* **1.3** - * Fixed issues after recent layout updates (fixes https://github.com/jerone/UserScripts/issues/9); -* **1.2.1** - * Fixed adding to pull requests; -* **1.2** - * Added to pull requests; -* **1.1** - * Added to compare page; - * Added support for Scriptish; -* **1.0** - * Initial version; +- **1.4.1** -### Notes + - Tooltips now on top. + +- **1.4** + + - Fixed align & url issues with new split diffs (fixes [#25](https://github.com/jerone/UserScripts/issues/25)). + +- **1.3** + + - Fixed issues after recent layout updates (fixes [#9](https://github.com/jerone/UserScripts/issues/9)). + +- **1.2.1** + + - Fixed adding to pull requests. + +- **1.2** + + - Added to pull requests. + +- **1.1** + + - Added to compare page. + - Added support for Scriptish. + +- **1.0** + + - Initial version. + +## Notes Use cases: -* https://github.com/OpenUserJs/OpenUserJS.org/commit/aac291b83a5d5fa4fb4382080473ef3a4dd908c2 (commit) -* https://github.com/OpenUserJs/OpenUserJS.org/pull/327/files (pr) -* https://github.com/OpenUserJs/OpenUserJS.org/compare/master%40%7B1day%7D...master (compare) +- (commit) + +- (PR) + +- + (PR commit) + +- (compare) + +- (compare with hash) -### External links +## External links -* [Greasy Fork](https://greasyfork.org/scripts/467-github-commit-whitespace) -* [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Commit_Whitespace) +- [Greasy Fork](https://greasyfork.org/scripts/467-github-commit-whitespace) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Commit_Whitespace) diff --git a/Github_Gist_Dabblet/165244.user.js b/Github_Gist_Dabblet/165244.user.js deleted file mode 100644 index 5e01590..0000000 --- a/Github_Gist_Dabblet/165244.user.js +++ /dev/null @@ -1,81 +0,0 @@ -// ==UserScript== -// @name Github Gist Dabblet -// @namespace https://github.com/jerone/UserScripts/ -// @description Share your GitHub Gist to Dabblet. -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Gist_Dabblet -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Gist_Dabblet -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Gist_Dabblet/165244.user.js -// @include *://gist.github.com/* -// @version 3.2 -// @grant none -// ==/UserScript== - -/* - * The following urls should be converted to Dabblet: - * - * - https://gist.github.com/jerone/3810309 - * ¯¯¯¯¯¯¯ - * - https://gist.github.com/jerone/3810309/revisions - * ¯¯¯¯¯¯¯ - * - https://gist.github.com/jerone/3810309/forks - * ¯¯¯¯¯¯¯ - * - https://gist.github.com/jerone/3810309/stars - * ¯¯¯¯¯¯¯ - * - https://gist.github.com/jerone/3810309/f2815cc6796ea985f74b8f5f3c717e8de3b12d37 - * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - * - https://gist.github.com/3810309/f2815cc6796ea985f74b8f5f3c717e8de3b12d37 - * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - */ - -String.format = function (string) { - var args = Array.prototype.slice.call(arguments, 1, arguments.length); - return string.replace(/{(\d+)}/g, function (match, number) { - return typeof args[number] != "undefined" ? args[number] : match; - }); -}; - -function addMenuItem() { - var link, linkLong, url, menu, li, user; - - if (document.getElementById("Github_Gist_Share_Dabblet")) return; // already defined in Github Gist Share (http://userscripts.org/scripts/show/157850); - - if ((link = document.querySelector("[name='link-field']")) && (menu = document.querySelector('ul.menu.gisttabs'))) { // check if we're on an actual gists; - user = document.querySelector(".author.vcard").textContent.trim(); - if ((linkLong = document.querySelector(".site-container.js-site-container")) && linkLong.dataset.url) { - var linkLongParts = linkLong.dataset.url.split("/"); - linkLongParts.shift(); - if (/^(?:revisions|forks|stars)$/gi.test(linkLongParts[linkLongParts.length - 1])) { - linkLongParts.pop(); - } - if (new RegExp(user,"gi").test(linkLongParts[0])) { - linkLongParts.shift(); - } - url = "/" + linkLongParts.join("/"); - } else { - url = link.value.replace(new RegExp("https?:\/\/gist\.github\.com/" + user, "gi"), ""); - } - - url = "http://dabblet.com/gist" + url; - - menu.appendChild(li = document.createElement("li")); - li.id = "Github_Gist_Dabblet"; - - var key = "Dabblet", - dabbletA = document.createElement("a"), - dabbletImg = document.createElement("img"); - li.appendChild(dabbletA); - dabbletA.appendChild(dabbletImg); - dabbletA.href = url; - dabbletA.title = String.format("[{0}] {1}", key, dabbletA.href); - dabbletA.style.display = "inline-block"; - dabbletA.target = "_blank"; - dabbletImg.src = "http://dabblet.com/favicon.ico"; - dabbletImg.alt = key; - } -} - -// init; -addMenuItem(); - -// on pjax; -$(document).on("pjax:success", addMenuItem); \ No newline at end of file diff --git a/Github_Gist_Dabblet/README.md b/Github_Gist_Dabblet/README.md deleted file mode 100644 index b7a886d..0000000 --- a/Github_Gist_Dabblet/README.md +++ /dev/null @@ -1 +0,0 @@ -# This script has been replaced in favour of [Github Gist Share](https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share)! \ No newline at end of file diff --git a/Github_Gist_Share/157850.user.js b/Github_Gist_Share/157850.user.js index 7ac1f54..ed5d49f 100644 --- a/Github_Gist_Share/157850.user.js +++ b/Github_Gist_Share/157850.user.js @@ -1,152 +1,306 @@ // ==UserScript== -// @name Github Gist Share -// @namespace https://github.com/jerone/UserScripts/ -// @description Share your GitHub Gist to Twitter, Dabblet & as userscript. -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/157850.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/157850.user.js -// @include *://gist.github.com/* -// @version 4.3 -// @grant none +// @name Github Gist Share +// @namespace https://github.com/jerone/UserScripts/ +// @description Share your GitHub Gist to Twitter, Dabblet, Bl.ocks & as userscript. +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/157850.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/157850.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @include *://gist.github.com/* +// @version 5.1 +// @grant none // ==/UserScript== -/* global unsafeWindow */ -(function() { +// cSpell:ignore Dabblet, Bl.ocks, itemprop, tweetbutton +/* eslint security/detect-object-injection: "off" */ - String.format = function(string) { - var args = Array.prototype.slice.call(arguments, 1, arguments.length); - return string.replace(/{(\d+)}/g, function(match, number) { +(function () { + String.format = function (string) { + const args = Array.prototype.slice.call(arguments, 1, arguments.length); + return string.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== "undefined" ? args[number] : match; }); }; - var socials = { - Twitter: { - show: function(url, user, description, files, stars, forks, revisions) { return true; }, - submit: function(url, user, description, files, stars, forks, revisions) { - var stats = []; - if (files > 1) { - stats.push(files + " files"); + function Menu(container) { + const div$0$0 = document.createElement("div"); + div$0$0.classList.add("file-navigation-option"); + div$0$0.id = "Github_Gist_Share"; + container.insertBefore(div$0$0, container.firstChild); + + const div$1$0 = document.createElement("div"); + div$1$0.classList.add( + "select-menu", + "js-menu-container", + "select-menu-modal-left", + "js-select-menu", + ); + div$0$0.appendChild(div$1$0); + + const button$2$0 = document.createElement("button"); + button$2$0.classList.add( + "btn", + "btn-sm", + "select-menu-button", + "icon-only", + "js-menu-target", + ); + button$2$0.setAttribute("type", "button"); + div$1$0.appendChild(button$2$0); + + const svg$3$0 = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + svg$3$0.classList.add("octicon", "octicon-link-external"); + svg$3$0.setAttributeNS(null, "height", 16); + svg$3$0.setAttributeNS(null, "version", "1.1"); + svg$3$0.setAttributeNS(null, "viewBox", "0 0 12 16"); + svg$3$0.setAttributeNS(null, "width", 12); + button$2$0.appendChild(svg$3$0); + + const path$4$0 = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path$4$0.setAttributeNS( + null, + "d", + "M11 10h1v3c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h3v1H1v10h10v-3zM6 2l2.25 2.25L5 7.5 6.5 9l3.25-3.25L12 8V2H6z", + ); + svg$3$0.appendChild(path$4$0); + + button$2$0.appendChild(document.createTextNode(" Share ")); + + const div$2$1 = document.createElement("div"); + div$2$1.classList.add("select-menu-modal-holder"); + div$1$0.appendChild(div$2$1); + + const div$3$0 = document.createElement("div"); + div$3$0.classList.add( + "select-menu-modal", + "select-menu-modal", + "js-menu-content", + ); + div$2$1.appendChild(div$3$0); + + const div$4$0 = document.createElement("div"); + div$4$0.classList.add("select-menu-header"); + div$3$0.appendChild(div$4$0); + + const svg$5$0 = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + svg$5$0.classList.add("octicon", "octicon-x", "js-menu-close"); + svg$5$0.setAttributeNS(null, "height", 16); + svg$5$0.setAttributeNS(null, "version", "1.1"); + svg$5$0.setAttributeNS(null, "viewBox", "0 0 12 16"); + svg$5$0.setAttributeNS(null, "width", 12); + div$4$0.appendChild(svg$5$0); + + const path$6$0 = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path$6$0.setAttributeNS( + null, + "d", + "M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z", + ); + svg$5$0.appendChild(path$6$0); + + const span$5$1 = document.createElement("span"); + span$5$1.classList.add("select-menu-title"); + div$4$0.appendChild(span$5$1); + + span$5$1.appendChild(document.createTextNode("Share Gist with…")); + + const div$4$1 = document.createElement("div"); + div$4$1.classList.add("select-menu-list", "js-navigation-container"); + div$3$0.appendChild(div$4$1); + + this.itemsContainer = div$4$1; + } + + Menu.prototype.AddItem = function (text, title, href, icon, newTab) { + const a = document.createElement("a"); + a.classList.add("select-menu-item", "js-navigation-item"); + a.setAttribute("href", href); + if (title) a.setAttribute("title", title); + if (newTab) a.setAttribute("target", "_blank"); + this.itemsContainer.appendChild(a); + + const i = document.createElement("img"); + i.classList.add("select-menu-item-icon"); + i.setAttribute("src", icon); + a.appendChild(i); + + const s = document.createElement("span"); + s.classList.add("select-menu-item-text"); + a.appendChild(s); + + s.appendChild(document.createTextNode(text)); + }; + + function getValue(elm) { + return elm ? elm.textContent.trim() : ""; + } + + function getIntValue(elm) { + return elm ? parseInt(elm.textContent.trim(), 10) : 0; + } + + function addMenu() { + const link = document.querySelector(".gist-header-title a"); + const nav = document.querySelector(".file-navigation-options"); + if (link && nav) { + // Check if we're on an actual gist + const data = { + url: link.href, + user: getValue( + document.querySelector(".header-nav-current-user strong"), + ), + author: getValue( + document.querySelector('.author [itemprop="author"]'), + ), + description: getValue( + document.querySelector(".repository-meta-content") || link, + ), + files: document.querySelectorAll(".file").length, + stars: getIntValue( + document.querySelector( + 'a[href$="/stargazers"] .counter, form[action$="/star"] .social-count', + ), + ), + forks: getIntValue( + document.querySelector( + 'a[href$="/forks"] .counter, form[action$="/fork"] .social-count', + ), + ), + revisions: getIntValue( + document.querySelector('a[href$="/revisions"] .counter'), + ), + }; + + console.log(data); + + const menu = new Menu(nav); + + // Twitter + // eslint-disable-next-line no-constant-condition + if (true) { + const stats = []; + if (data.files > 1) { + stats.push(data.files + " files"); } - if (stars === 1) { - stats.push(stars + " star"); - } else if (stars > 1) { - stats.push(stars + " stars"); + if (data.stars === 1) { + stats.push(data.stars + " star"); + } else if (data.stars > 1) { + stats.push(data.stars + " stars"); } - if (forks === 1) { - stats.push(forks + " fork"); - } else if (forks > 1) { - stats.push(forks + " forks"); + if (data.forks === 1) { + stats.push(data.forks + " fork"); + } else if (data.forks > 1) { + stats.push(data.forks + " forks"); } - if (revisions > 1) { - stats.push(revisions + " revisions"); + if (data.revisions > 1) { + stats.push(data.revisions + " revisions"); } - var tweet = String.format("Check out {0} #gist {1} on @github{2} |", - user === document.querySelector(".name").textContent.trim() ? "my" : user + "'s", - description ? "\"" + description + "\"" : "", - stats.length > 0 ? " | " + stats.join(", ") : ""); - - return "https://twitter.com/intent/tweet?original_referer=" + encodeURIComponent(url) + - "&source=tweetbutton&url=" + encodeURIComponent(url) + - "&text=" + encodeURIComponent(tweet); - }, - icon: "https://si0.twimg.com/favicons/favicon.ico" - }, - Dabblet: { - /* - * The following urls should be converted to dabblet: - * _______ - * - https://gist.github.com/jerone/3810309 - * _______ - * - https://gist.github.com/jerone/3810309/revisions - * _______ - * - https://gist.github.com/jerone/3810309/forks - * _______ - * - https://gist.github.com/jerone/3810309/stars - * ________________________________________________ - * - https://gist.github.com/jerone/3810309/f2815cc6796ea985f74b8f5f3c717e8de3b12d37 - * ________________________________________________ - * - https://gist.github.com/3810309/f2815cc6796ea985f74b8f5f3c717e8de3b12d37 - * - */ - show: function(url, user, description, files, stars, forks, revisions) { - // already defined in another UserScript: http://userscripts.org/users/31497/scripts - return !document.getElementById("Github_Gist_Dabblet"); - }, - submit: function(url, user, description, files, stars, forks, revisions) { - var linkLong; - if ((linkLong = document.querySelector(".site-container.js-site-container")) && linkLong.dataset.url) { - var linkLongParts = linkLong.dataset.url.split("/"); - linkLongParts.shift(); - if (/^(?:revisions|forks|stars)$/gi.test(linkLongParts[linkLongParts.length - 1])) { - linkLongParts.pop(); - } - if (new RegExp(user, "gi").test(linkLongParts[0])) { - linkLongParts.shift(); - } - url = "/" + linkLongParts.join("/"); - } else { - url = url.replace(new RegExp("https?:\/\/gist\.github\.com/" + user, "gi"), ""); - } - return "http://dabblet.com/gist" + url; - }, - icon: "http://dabblet.com/favicon.ico" - }, - UserScript: { - show: function(url, user, description, files, stars, forks, revisions) { - return !!document.querySelector(".file[id^='file-'] .raw-url[href$='.user.js']"); - }, - submit: function(url, user, description, files, stars, forks, revisions) { - return (document.querySelector(".file[id^='file-'] .raw-url[href$='.user.js']") || { href: "" }).href.trim(); - }, - icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKwSURBVHjabJNJTBNRGID/mc5MQYVWVNCGTbEtNZGDBj1ogolEMR5UJA2LBmMoIokxERIj8ehJjx6MYIQoJgq4JIa6gEARkKJFTa2iFFtKWwp2oeDCzNQ+31DQCc5L/nmT/P/3749ACAFBECBxiEPFFds0Ws399DRVhtX2udc97ig0PmgOLBkIbOwjAR8uMRRdvXF7pqv/NfrqnEAOlxsdLas6j3Wk2AEpCRcbKvLydrdu1WUr0lXrITEhAZKUSkhQKvKwXiY2ppbDRzCcv29P/ZZsDaSqUkCJYVJGwKMnHTDlmWgTZ/CvjkW4sKTScP1WC+oZsKAxpwv5gyEUnAkj2xc70p88Y8Y2a8VBxT0gispOGa413UVDb23IMe6OwaEw+jTqQKMOF3pptqBSw7k74hLEPaDUOu0VmpFDV58ZCJIAkiDB5fUBz0eApmjQqbOgrqa69HhVbZO4jKUfmiBJBctysHJFPPiDYbA7J4DjeJDLaWAYGVAyErIy0uDs6RPH9OXVtULWYgfEmN3emJK8BlYrEsHl8cEvloX4ODnEyRlgKGZhV1iOhcz0VNixM7dOCCp2EBkeMF3u6DaNqDasg1U4CzlFxxSRKMyz8xjmsPAQwNmRsc2jxGPkR0esHp7n9RBFrYbyUi1DUzh1GujFG0UBQrNz8P7DR3j+9NklqTEK3VVkbNLkVNZc9AwNW5Hb60PT/gCamg6gEbsT3XvYjvIP6i9gu2ShhOWb+BvLD13O9o3azWrVdy4K3wKhv5HfWW1Q39BY19nechPbzQrVwX9bhU+iIqnyQMF+mPvJQr/FCsHwDJgG30ADhl8Y2wQ4jIUVkpdaZRnPcd6AfxomJ32AIhEwdvaC8XG7JLwwvmXPmVFn52Tu2lvQjN9Crn3M6bWY+6otr3oGpWCB/SPAAJaJRguGUxB0AAAAAElFTkSuQmCC" - } - }; + const tweet = String.format( + "Check out {0} #gist {1} on @github {2}", + data.author === data.user ? "my" : data.author + "'s", + data.description ? '"' + data.description + '"' : "", + stats.length > 0 + ? String.format("- {0} -", stats.join(", ")) + : "-", + ); + + const link = + "https://twitter.com/intent/tweet" + + "?original_referer=" + + encodeURIComponent(data.url) + + "&source=tweetbutton&url=" + + encodeURIComponent(data.url) + + "&text=" + + encodeURIComponent(tweet); + + const icon = + "data:image/vnd.microsoft.icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD///8A////A////xT///8f////K////yj///8f////FP///wP///8A////AP///wD///8A////AP///wD///8A////H/357kj55K589tV+ofPFUML0y1+29tV+ofnkrnz9+e5I////H////wP///8A////AP///wD///8A////ANi/foG2iBDuvYkA/9CWAP/npwD/7qwA/+6sAP/urAD/7rAP8/bVfqH9+e8/////A////wD///8A////AP///wD///8A////APDnzjDjx36N3Kcf5e6sAP/urAD/7qwA/+6sAP/urAD/8bww2/357z////8D////AP///wD///8A////AP///wP///8z+N+eifTLX7burAD/7qwA/+6sAP/urAD/7qwA/+6sAP/xvDDb/PjvM////wD///8A////AP///wD69+8V2Kkw1eqpAP/urAD/7qwA/+6sAP/urAD/7qwA/+6sAP/urAD/7qwA//TLX7b///8H////AP///wD///8A+fLfPvbVfqHusA/z7qwA/+6sAP/urAD/7qwA/+6sAP/urAD/7qwA/+6sAP/urAD/+fLfPv///wD///8A////DPXQcKvurAD/7qwA/+6sAP/urAD/7qwA/+6sAP/urAD/7qwA/+6sAP/urAD/7qwA/+/Lb6f///8A////APPpzzzUmQD/7qwA/+6sAP/urAD/7qwA/+enAP/npwD/7qwA/+6sAP/urAD/7qwA/+6sAP/xvDDb////AP///wDt4L5G9dBwq+6sAP/urAD/2JwA/7qGAP+7kCDe1qMf4+6sAP/urAD/7qwA/+6sAP/urAD/7qwA/////yT///8A9/DeLu6sAP/npwD/vYkA/8+wYJ/1794f////AOXIfo7urAD/7qwA/+6sAP/urAD/7qwA/+6sAP/zznCo////KO7hv0jjpAD/vpIf4PDnzjD///8A////AP///wDeyI5x46QA/+6sAP/urAD/7qwA/+qpAP/UmQD/5KkO89u4YKfw584ww5ov0Pr37g////8A////AP///wD///8A+vfuD8OaL9DUmQD/36EA/9icAP+9jA/w07hwjsCYMM/p2a9U////APr37g////8A////AP///wD///8A////AP///wD69+4P07hwjsWgQL/PsGCf9e/eH////wD///8A9e/eH////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAOH/AAAAPwAA4B8AAOAPAADABwAAwAcAAIADAACAAwAAgAMAAIYBAACfAAAAvwEAAP+PAAD//wAA//8AAA=="; + + menu.AddItem( + "Twitter", + tweet + " " + data.url, + link, + icon, + true, + ); + } - function addMenuItem() { - var link, url, menu, li, user, description, files, stars, forks, revisions; - - if ((link = document.querySelector("[name='link-field']")) && (menu = document.querySelector('ul.menu.gisttabs'))) { // check if we're on an actual gists; - url = link.value; - user = document.querySelector(".author.vcard").textContent.trim(); - description = (document.querySelector(".gist-description") || document.querySelector(".js-current-repository") || { textContent: "" }).textContent.trim(); - files = document.querySelectorAll(".file[id^='file-']").length; - stars = (menu.querySelector("a[href$='/stars'] .counter") || { textContent: "" }).textContent.trim(); - forks = (menu.querySelector("a[href$='/forks'] .counter") || { textContent: "" }).textContent.trim(); - revisions = (menu.querySelector("a[href$='/revisions'] .counter") || { textContent: "" }).textContent.trim(); - - menu.appendChild(li = document.createElement("li")); - li.id = "Github_Gist_Share"; - - for (var key in socials) { - var social = socials[key], - socialA = document.createElement("a"), - socialImg = document.createElement("img"); - - if (social.show(url, user, description, files, stars, forks, revisions) !== true) { continue; } - - li.appendChild(socialA); - socialA.appendChild(socialImg); - socialA.id = String.format("{0}_{1}", li.id, key.replace(/\s+/g, "_")); - socialA.href = social.submit && social.submit(url, user, description, files, stars, forks, revisions); - socialA.title = String.format("[{0}] {1}", key, socialA.href); - socialA.style.display = "inline-block"; - socialA.target = "_blank"; - socialImg.src = social.icon; - socialImg.alt = key; + // Userscripts + if ( + document.querySelector( + '.file .file-actions a[href$=".user.js" i]', + ) + ) { + const icon = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKwSURBVHjabJNJTBNRGID/mc5MQYVWVNCGTbEtNZGDBj1ogolEMR5UJA2LBmMoIokxERIj8ehJjx6MYIQoJgq4JIa6gEARkKJFTa2iFFtKWwp2oeDCzNQ+31DQCc5L/nmT/P/3749ACAFBECBxiEPFFds0Ws399DRVhtX2udc97ig0PmgOLBkIbOwjAR8uMRRdvXF7pqv/NfrqnEAOlxsdLas6j3Wk2AEpCRcbKvLydrdu1WUr0lXrITEhAZKUSkhQKvKwXiY2ppbDRzCcv29P/ZZsDaSqUkCJYVJGwKMnHTDlmWgTZ/CvjkW4sKTScP1WC+oZsKAxpwv5gyEUnAkj2xc70p88Y8Y2a8VBxT0gispOGa413UVDb23IMe6OwaEw+jTqQKMOF3pptqBSw7k74hLEPaDUOu0VmpFDV58ZCJIAkiDB5fUBz0eApmjQqbOgrqa69HhVbZO4jKUfmiBJBctysHJFPPiDYbA7J4DjeJDLaWAYGVAyErIy0uDs6RPH9OXVtULWYgfEmN3emJK8BlYrEsHl8cEvloX4ODnEyRlgKGZhV1iOhcz0VNixM7dOCCp2EBkeMF3u6DaNqDasg1U4CzlFxxSRKMyz8xjmsPAQwNmRsc2jxGPkR0esHp7n9RBFrYbyUi1DUzh1GujFG0UBQrNz8P7DR3j+9NklqTEK3VVkbNLkVNZc9AwNW5Hb60PT/gCamg6gEbsT3XvYjvIP6i9gu2ShhOWb+BvLD13O9o3azWrVdy4K3wKhv5HfWW1Q39BY19nechPbzQrVwX9bhU+iIqnyQMF+mPvJQr/FCsHwDJgG30ADhl8Y2wQ4jIUVkpdaZRnPcd6AfxomJ32AIhEwdvaC8XG7JLwwvmXPmVFn52Tu2lvQjN9Crn3M6bWY+6otr3oGpWCB/SPAAJaJRguGUxB0AAAAAElFTkSuQmCC"; + const userscripts = document.querySelectorAll( + '.file .file-actions a[href$=".user.js"]', + ); + Array.prototype.forEach.call( + userscripts, + function (userscript) { + const text = String.format( + 'Userscript "{0}"', + userscript.href.split("/").pop(), + ); + menu.AddItem(text, null, userscript.href, icon, false); + }, + ); + } + + // Dabblet + if ( + document.querySelector( + ".file .type-css, .file .type-html, .file .type-javascript", + ) + ) { + const link = + "http://dabblet.com/gist/" + data.url.split("/").pop(); + const icon = + "data:image/vnd.microsoft.icon;base64,AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAD///8B////AQAAAAMAAAAPAAAAHwAAACcAAAAfAAAADwAAAAP///8B////AQAAAAUAAAARAAAAHwAAAB0AAAAJ////AQAAAAcAAAAjqqqqb9vb28Xn5+fb29vbxaqqqm8AAAAjAAAABwAAAAkAAAApvLy8hd7e3snl5eXBAAAAIwAAAAMAAAAjzc3Nqf39/f/////////////////9/f3/0NDQqQAAACEAAAAp2NjYvf///////////////wAAADEAAAAPra2tc/39/f////////////b29vn///////////39/f8AAABFvLy8jf///////////f39/97e3r8AAAAhAAAAIdzc3Mf//////////66urp8AAABNrq6un///////////AAAAXePj49v//////Pz8/YqKin0AAAAlAAAACQAAACnq6urj//////Hx8fUAAABJAAAADQAAAEnv7+/z/////wAAAGXx8fHz/////+Tk5N8AAAAzAAAAA////wEAAAAh3d3dy///////////l5eXjQAAAEWXl5eN//////////8AAABp9fX19f/////g4ODVAAAAKf///wH///8BAAAAEbm5uYP///////////39/f/u7u7x/f39////////////AAAAafX19fX/////4ODg1QAAACn///8B////AQAAAAUAAAAn19fXu////////////////////////////////wAAAGn19fX1/////93d3dtoaGhXXFxcJwAAAAv///8BAAAABwAAACe5ubmF4+Pj1e/v7+nd3d3f8/Pz+f////8AAABp9fX19f/////c3Nzl7e3t5+zs7M0AAAAh////Af///wEAAAAFAAAAEwAAACUAAAAtAAAAU+np6ev/////AAAAafX19fX/////3Nzc5e3t7efs7OzNAAAAIf///wH///8B////Af///wH///8B////AQAAAC/r6+vn/////wAAAGn19fX1/////93d3dtpaWlVXFxcJwAAAAv///8B////Af///wH///8B////Af///wEAAAAh5ubm0/////8AAABd9fX18f/////i4uLLAAAAH////wH///8B////Af///wH///8B////Af///wH///8BAAAADXR0dEXs7Oy/AAAANbm5uXvz8/PjkpKSVQAAAA3///8B////Af///wH///8B////Af///wH///8B////Af///wEAAAALAAAAFQAAAA0AAAAVAAAAHwAAAA////8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//w=="; + menu.AddItem("Dabblet", link, link, icon, true); + } + + // Bl.ocks + if ( + document.querySelector( + '.file .file-actions a[href$="index.html" i], .file .file-actions a[href$="README.md" i]', + ) + ) { + const link = data.url.replace( + "https://gist.github.com/", + "https://bl.ocks.org/", + ); + const icon = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC0klEQVQ4jaWTTWhcZRSGn++7f3PnTqaTtrRJp4OVlmkzYbRRSQUJrkQoFEVw5UJQGRcVhO66KAxdihXdCFkWusrSIliIESuFRrASf2slY2xDaZN2Mpm5P3P/vq+LEAIprnyXh8Nzznl5D/xPid2Fq+120Yt7UypJjhzvRVe039tq9MrcrnjvGo69HDiVn8+02yGAuRtwaDhYeCZSp3ScobTCefY4ZBlxd52Tsb4stGZFbS4CLwPI3YDyvyvT9kiZ0uQU2BaDlTsMVjtgW5ROPIftjTDS+Xv663Nn6wBme7ZVDJLi1DBLjhTHzSvWXAdZrxP8eBOR5ux/5TUA+r//xODXW+RphCsNYRm6CGDGZnmhUi2citOEJIsRUmLt2YtoTBL+tkTQuQ1Ck/kh0pJIYYDYWVxuGhvTRbvIsYNHMaWFMLZ81UjciSbm4RpZt4u0JGLbc612AKlOxPOHX+Sx3yXTOYk06V/7ChBopSDP0VpvTQbSsE+YxXrebexrtWeLpiEMvEKJxqEm1T09Ft6qMHF9hdr1b/AqB3AnmximTTKMGEab3B09yPf1t0U6Wp031+8tmkJIsiwlyWIcy6FUq3F15hGFpZc4ff8G1RvfkivNA9dlvv46d8cmmTh6gGwjYLlvTZtCodcGD0Wuc/I8I85TlFYsiXFe+PAi1/68x2o3plEfxwNYXuOvzjrDOMV0CsJ0NrxX529+NyfKaqxZa+I5HqZhI6WgVHBoHKtSC2L+WffpBwlhnGIKgTQNpNyJsvj4s4/eC2z/C7tseForHi6/SeuNkzweREggTDJ++GUVlEYYAiEkvV709C+0Pm3tT/zED9SZ8PTMCaERqDxnmCoW/7iPZRlorQj8hHAQ6qcA2/rg/JczkXTncnvf2FRjnJJrc+vOGlGcMOiFuPnGI1cM3/lPwPZprQuz728mhc+1O+plKkeE/agk/QuXPzl7CeAJlkc5xMckqesAAAAASUVORK5CYII="; + menu.AddItem("Bl.ocks", link, link, icon, true); } } } - // init; - addMenuItem(); - - // on pjax; - unsafeWindow.$(document).on("pjax:success", addMenuItem); + // Init + addMenu(); + // Pjax + document.addEventListener("pjax:end", addMenu); })(); diff --git a/Github_Gist_Share/README.md b/Github_Gist_Share/README.md index 1851980..ea1664a 100644 --- a/Github_Gist_Share/README.md +++ b/Github_Gist_Share/README.md @@ -1,50 +1,101 @@ -# [Github Gist Share](https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share) +# [Github Gist Share](https://github.com/jerone/UserScripts/tree/master/Github_Gist_Share) (abandoned) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/157850.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/157850.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Gist_Share/157850.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description +## Description Share your [GitHub Gist](https://gist.github.com) to: -* [Twitter](http://twitter.com) -* [Dabblet](http://dabblet.com) -* UserScript (when name ends with `.user.js`) +- [Twitter](http://twitter.com). -### Screenshot +- UserScript (when a file ends with `.user.js`). -![Github Gist Share screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/screenshot.jpg) +- [Dabblet](http://dabblet.com). -### Compatible +- [Bl.ocks](https://bl.ocks.org) (when Gist contains a `index.html` or + `README.md` file). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). +## Screenshot -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... +![Github Gist Share screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Gist_Share/screenshot.png) -### Version History +## Compatible -* **4.3** - * Converted userscript icon to data uri as USO isn't available anymore; - * Fixed counting files; - * JSHint fixes; -* **4.2** - * Added support for Scriptish; -* **4.1** - * Namespace update; -* **4.0** - * Added userscript support; -* **4.1** - * Added Dabblet; -* **4.1** - * Added Twitter; -* **4.1** - * Initial version; +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. -### Notes +## Version History - - +- **5.1** -### External links + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). -* [Greasy Fork](https://greasyfork.org/scripts/54) -* [Userscripts.org](http://userscripts.org/scripts/show/157850) (not maintained anymore). +- **5.0** + + - Complete rewrite to make it work again. + +- **4.5** + + - Added Bl.ocks support. + +- **4.4** + + - Fixed code after layout changes. + - Removed old code for Github Gist Dabblet. + - Fixed JSHint errors. + +- **4.3** + + - Converted userscript icon to data uri as USO isn't available anymore. + - Fixed counting files. + - JSHint fixes. + +- **4.2** + + - Added support for Scriptish. + +- **4.1** + + - Namespace update. + +- **4.0** + + - Added Userscript support. + +- **3.0** + + - Added Dabblet. + +- **2.0** + + - Added Twitter. + +- **1.0** + + - Initial version. + +## Test case + +- (Twitter with own username + `Check out my #gist "Github Flavored Markdown Stylesheet for Web +Essentials" on @github - 8 stars, 4 forks, 2 revisions - +https://gist.github.com/jerone/9925179`). + +- (Twitter). + +- (forked Gist). + +- (two Userscripts). + +- (Dabblet + ). + +- (Bl.ocks + ). + +## External links + +- [Greasy Fork](https://greasyfork.org/scripts/54-github-gist-share) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Gist_Share) diff --git a/Github_Gist_Share/screenshot.png b/Github_Gist_Share/screenshot.png new file mode 100644 index 0000000..fa6db0c Binary files /dev/null and b/Github_Gist_Share/screenshot.png differ diff --git a/Github_Gist_Share/screenshot.jpg b/Github_Gist_Share/screenshot2.jpg similarity index 100% rename from Github_Gist_Share/screenshot.jpg rename to Github_Gist_Share/screenshot2.jpg diff --git a/Github_Gist_Share/screenshot3.jpg b/Github_Gist_Share/screenshot3.jpg new file mode 100644 index 0000000..58681f5 Binary files /dev/null and b/Github_Gist_Share/screenshot3.jpg differ diff --git a/Github_Image_Viewer/Github_Image_Viewer.user.js b/Github_Image_Viewer/Github_Image_Viewer.user.js index e251403..b81724c 100644 --- a/Github_Image_Viewer/Github_Image_Viewer.user.js +++ b/Github_Image_Viewer/Github_Image_Viewer.user.js @@ -1,36 +1,41 @@ // ==UserScript== -// @id Github_Image_Viewer@https://github.com/jerone/UserScripts -// @name Github Image Viewer -// @namespace https://github.com/jerone/UserScripts -// @description Preview images from within the listing. -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Image_Viewer -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Image_Viewer -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/Github_Image_Viewer.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/Github_Image_Viewer.user.js -// @version 0.1.0 -// @grant none -// @run-at document-end -// @include https://github.com/* +// @name Github Image Viewer +// @id Github_Image_Viewer@https://github.com/jerone/UserScripts +// @namespace https://github.com/jerone/UserScripts +// @description Preview images from within the listing. +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Image_Viewer +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Image_Viewer +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/Github_Image_Viewer.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/Github_Image_Viewer.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @version 0.5.0 +// @icon https://github.githubassets.com/pinned-octocat.svg +// @grant none +// @run-at document-end +// @include https://github.com/* // ==/UserScript== -(function() { +/* eslint security/detect-object-injection: "off" */ - String.format = function(string) { +(function () { + String.format = function (string) { var args = Array.prototype.slice.call(arguments, 1, arguments.length); - return string.replace(/{(\d+)}/g, function(match, number) { + return string.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== "undefined" ? args[number] : match; }); }; function proxy(fn) { - return function() { + return function () { var that = this; - return function(e) { - var args = that.slice(0); // clone; - args.unshift(e); // prepend event; + return function (e) { + var args = that.slice(0); // clone; + args.unshift(e); // prepend event; fn.apply(this, args); }; }.call([].slice.call(arguments, 1)); @@ -43,14 +48,17 @@ _floaterMeta: null, _imageUrl: null, - _loaderSrc: "https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif", - _imageRegex: /(.png|.jpg|.jpeg|.tif|.tiff|.gif|.ico)$/, + _loaderSrc: + "https://github.githubassets.com/images/spinners/octocat-spinner-32.gif", + _imageRegex: /.+(\.jpe?g|\.png|\.gif|\.bmp|\.ico|\.tiff?)$/i, - Initialize: function() { - var floater = GithubImageViewer._floater = document.createElement("div"); + Initialize: function () { + var floater = (GithubImageViewer._floater = + document.createElement("div")); floater.style.position = "absolute"; floater.style.top = "0"; floater.style.left = "0"; + floater.style.zIndex = "999"; document.body.appendChild(floater); var floaterMouseAlign = document.createElement("div"); @@ -62,8 +70,11 @@ floaterMouseAlign.style.fontSize = "11px"; floater.appendChild(floaterMouseAlign); - var floaterTitle = GithubImageViewer._floaterTitle = document.createElement("div"); + var floaterTitle = (GithubImageViewer._floaterTitle = + document.createElement("div")); floaterTitle.style.backgroundColor = "#e6f1f6"; + floaterTitle.style.color = "black"; + floaterTitle.style.textAlign = "center"; floaterTitle.style.borderBottom = "1px solid #d8e6ec"; floaterTitle.style.padding = "3px 5px"; floaterMouseAlign.appendChild(floaterTitle); @@ -77,14 +88,18 @@ floaterCenter.style.padding = "3px"; floaterMouseAlign.appendChild(floaterCenter); - var floaterImage = GithubImageViewer._floaterImage = document.createElement("img"); + var floaterImage = (GithubImageViewer._floaterImage = + document.createElement("img")); floaterImage.setAttribute("src", GithubImageViewer._loaderSrc); floaterImage.style.margin = "auto"; - floaterImage.style.maxWidth = floaterImage.style.maxHeight = "200px"; + floaterImage.style.maxWidth = floaterImage.style.maxHeight = + "200px"; floaterCenter.appendChild(floaterImage); - var floaterMeta = GithubImageViewer._floaterMeta = document.createElement("div"); + var floaterMeta = (GithubImageViewer._floaterMeta = + document.createElement("div")); floaterMeta.style.backgroundColor = "#f8f8f8"; + floaterMeta.style.color = "black"; floaterMeta.style.padding = "3px"; floaterMeta.style.textAlign = "center"; floaterMeta.style.whiteSpace = "nowrap"; @@ -94,75 +109,110 @@ GithubImageViewer.Attach(); }, - Attach: function() { - document.getElementById("js-repo-pjax-container").addEventListener("mousemove", function(e) { - var target = e.target; - if (target.classList && target.classList.contains("js-directory-link") - && GithubImageViewer._imageRegex.test(target.href)) { - - if (GithubImageViewer._visible) { - GithubImageViewer.Show(e.pageX, e.pageY); - } else { - GithubImageViewer.AddTimer(proxy(function() { - GithubImageViewer.ClearTimers(); - + Attach: function () { + document + .getElementById("js-repo-pjax-container") + .addEventListener("mousemove", function (e) { + var target = e.target; + if ( + target.classList && + target.classList.contains("js-navigation-open") && + GithubImageViewer._imageRegex.test(target.href) + ) { + if (target.getAttribute("title")) { + target.dataset.title = target.getAttribute("title"); + target.removeAttribute("title"); + } + + if (GithubImageViewer._visible) { GithubImageViewer.Show(e.pageX, e.pageY); - - var href = target.href; - if (GithubImageViewer._imageUrl !== href) { - GithubImageViewer._imageUrl = href; - GithubImageViewer.SetImage(GithubImageViewer._imageUrl); - - GithubImageViewer.SetTitle(target.getAttribute("title")); - } - })); + } else { + GithubImageViewer.AddTimer( + proxy(function () { + GithubImageViewer.ClearTimers(); + + GithubImageViewer.Show(e.pageX, e.pageY); + + var href = target.href; + if (GithubImageViewer._imageUrl !== href) { + GithubImageViewer._imageUrl = href; + GithubImageViewer.SetImage( + GithubImageViewer._imageUrl, + ); + + GithubImageViewer.SetTitle( + target.dataset.title, + ); + } + }), + ); + } + } else { + GithubImageViewer.Dispose(); } - } else { - GithubImageViewer.ClearTimers(); - - GithubImageViewer.Hide(); - - GithubImageViewer._imageUrl = GithubImageViewer._loaderSrc; - GithubImageViewer.SetImage(GithubImageViewer._imageUrl); - - GithubImageViewer.SetTitle("Loading..."); + }); + document.body.addEventListener("click", function () { + GithubImageViewer.Dispose(); + }); + document.body.addEventListener("contextmenu", function () { + GithubImageViewer.Dispose(); + }); + document.body.addEventListener("keydown", function (e) { + if (e.keyCode === 27) { + GithubImageViewer.Dispose(); } }); }, _visible: false, - Show: function(x, y) { + Show: function (x, y) { GithubImageViewer._visible = true; GithubImageViewer._floater.style.left = x + "px"; GithubImageViewer._floater.style.top = y + "px"; }, - Hide: function() { + Hide: function () { GithubImageViewer._visible = false; GithubImageViewer._floater.style.left = "-1000px"; GithubImageViewer._floater.style.top = "-1000px"; }, + Dispose: function () { + GithubImageViewer.ClearTimers(); + + GithubImageViewer.Hide(); + + GithubImageViewer._imageUrl = GithubImageViewer._loaderSrc; + GithubImageViewer.SetImage(GithubImageViewer._imageUrl); + + GithubImageViewer.SetTitle("Loading..."); + }, + _timers: [], _timeout: 700, - AddTimer: function(fn) { - GithubImageViewer._timers.push(window.setTimeout(fn, GithubImageViewer._timeout)); + AddTimer: function (fn) { + GithubImageViewer._timers.push( + window.setTimeout(fn, GithubImageViewer._timeout), + ); }, - ClearTimers: function() { - Array.prototype.forEach.call(GithubImageViewer._timers, function(timer) { - window.clearTimeout(timer); - }); + ClearTimers: function () { + Array.prototype.forEach.call( + GithubImageViewer._timers, + function (timer) { + window.clearTimeout(timer); + }, + ); }, - SetTitle: function(text) { + SetTitle: function (text) { GithubImageViewer._floaterTitle.textContent = text; }, - SetImage: function(src) { + SetImage: function (src) { src = src.replace("/blob/", "/raw/"); if (src !== GithubImageViewer._loaderSrc) { var temp = document.createElement("img"); temp.style.visibility = "hidden"; - temp.addEventListener("load", function() { + temp.addEventListener("load", function () { GithubImageViewer.SetMeta(this.width, this.height); this.parentNode.removeChild(temp); }); @@ -175,18 +225,21 @@ GithubImageViewer._floaterImage.setAttribute("src", src); }, - SetMeta: function(w, h) { + SetMeta: function (w, h) { if (!w && !h) { GithubImageViewer._floaterMeta.style.display = "none"; } else { GithubImageViewer._floaterMeta.style.display = "block"; - GithubImageViewer._floaterMeta.innerHTML = String.format("W: {0}px | H: {1}px", w, h); + GithubImageViewer._floaterMeta.innerHTML = String.format( + "W: {0}px | H: {1}px", + w, + h, + ); } - } + }, }; if (document.getElementById("js-repo-pjax-container")) { GithubImageViewer.Initialize(); } - })(); diff --git a/Github_Image_Viewer/README.md b/Github_Image_Viewer/README.md index 54636c9..28b4fa5 100644 --- a/Github_Image_Viewer/README.md +++ b/Github_Image_Viewer/README.md @@ -1,38 +1,63 @@ -# [Github Image Viewer](https://github.com/jerone/UserScripts/tree/master/Github_Image_Viewer) +# [Github Image Viewer](https://github.com/jerone/UserScripts/tree/master/Github_Image_Viewer) (abandoned) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/Github_Image_Viewer.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/Github_Image_Viewer.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Image_Viewer/Github_Image_Viewer.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description +## Description Preview images from within the listing. Supported file extensions are: -* `.png` -* `.jpg` -* `.jpeg` -* `.tif` -* `.tiff` -* `.gif` -* `.ico` +- `.jpg` +- `.jpeg` +- `.png` +- `.gif` +- `.bmp` +- `.ico` +- `.tif` +- `.tiff` -### Screenshot +## Screenshot ![Github Image Viewer screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Image_Viewer/screenshot.jpg) -### Compatible +## Compatible + +- [![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on [![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **0.5.0** + - :bug: Fixed loader animation source [#164](https://github.com/jerone/UserScripts/pull/164) + - Text color in floater is now black + - Floater title is now center aligned +- **0.4.2** + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). +- **0.4.1** + - Fixed issues after GitHub site update. +- **0.4.0** + - Added Bitmap `.bmp` support (closes [#82](https://github.com/jerone/UserScripts/issues/82)). + - Detect upper-case extensions (fixes [#82](https://github.com/jerone/UserScripts/issues/82)). + - Images should now have a name, temping to exclude folder named as image extensions (fixes [#82](https://github.com/jerone/UserScripts/issues/82)). +- **0.3.0** + - Removed tooltips. +- **0.2.0** + - Fixed hiding preview on some conditions (fixes [#31](https://github.com/jerone/UserScripts/issues/31)). +- **0.1.1** + - Small z-index fix. +- **0.1.0** + - Initial version. + +## Notes -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). - -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... - -### Version History - -* **0.1.0** - * Initial version; +Use cases: -### Notes +- -Use cases: +## External links -* https://github.com/jerone/UserScripts/tree/master/_resources +- [Greasy Fork](https://greasyfork.org/scripts/6262-github-image-viewer) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Image_Viewer) diff --git a/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js b/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js new file mode 100644 index 0000000..161eba7 --- /dev/null +++ b/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js @@ -0,0 +1,213 @@ +// ==UserScript== +// @name Github JSON Dependencies Linker +// @id Github_JSON_Dependencies_Linker@https://github.com/jerone/UserScripts +// @namespace https://github.com/jerone/UserScripts +// @description Linkify all dependencies found in an JSON file. +// @author jerone +// @copyright 2015+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_JSON_Dependencies_Linker +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_JSON_Dependencies_Linker +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @version 0.3.2 +// @icon https://github.githubassets.com/pinned-octocat.svg +// @grant GM_xmlhttpRequest +// @run-at document-end +// @include https://github.com/*/package.json +// @include https://github.com/*/npm-shrinkwrap.json +// @include https://github.com/*/bower.json +// @include https://github.com/*/project.json +// ==/UserScript== + +// cSpell:ignore linkify, Sindre Sorhus +/* eslint security/detect-object-injection: "off" */ + +(function () { + var blobElm = document.querySelector(".highlight"), + blobLineElms = blobElm.querySelectorAll(".blob-code > span"), + pkg = (function () { + try { + // JSON parser could fail on JSON with comments. + return JSON.parse(blobElm.textContent); + } catch (ex) { + // Strip out comments from the JSON and try again. + return JSON.parse(stripJsonComments(blobElm.textContent)); + } + })(), + isNPM = + location.pathname.endsWith("/package.json") || + location.pathname.endsWith("/npm-shrinkwrap.json"), + isBower = location.pathname.endsWith("/bower.json"), + isNuGet = location.pathname.endsWith("/project.json"), + isAtom = (function () { + if (location.pathname.endsWith("/package.json")) { + if (pkg.atomShellVersion) { + return true; + } else if (pkg.engines && pkg.engines.atom) { + return true; + } + } + return false; + })(), + dependencyKeys = [ + "dependencies", + "devDependencies", + "peerDependencies", + "bundleDependencies", + "bundledDependencies", + "packageDependencies", + "optionalDependencies", + ], + modules = (function () { + var _modules = {}; + dependencyKeys.forEach(function (dependencyKey) { + _modules[dependencyKey] = []; + }); + return _modules; + })(); + + // Get an unique list of all modules. + function fetchModules(root) { + dependencyKeys.forEach(function (dependencyKey) { + var dependencies = root[dependencyKey] || {}; + Object.keys(dependencies).forEach(function (module) { + if (modules[dependencyKey].indexOf(module) === -1) { + modules[dependencyKey].push(module); + } + fetchModules(dependencies[module]); + }); + }); + } + fetchModules(pkg); + + // Linkify module. + function linkify(module, url) { + // Try to find the module; could be multiple locations. + var moduleFilterText = '"' + module + '"'; + var moduleElms = Array.prototype.filter.call( + blobLineElms, + function (blobLineElm) { + if (blobLineElm.textContent.trim() === moduleFilterText) { + // Module name preceding a colon is never a key. + var prev = blobLineElm.previousSibling; + return !(prev && prev.textContent.trim() === ":"); + } + return false; + }, + ); + + // Modules could exist in multiple dependency lists. + Array.prototype.forEach.call(moduleElms, function (moduleElm) { + // Module names are textNodes on Github. + var moduleElmText = Array.prototype.find.call( + moduleElm.childNodes, + function (moduleElmChild) { + return moduleElmChild.nodeType === 3; + }, + ); + + var moduleElmLink = document.createElement("a"); + moduleElmLink.setAttribute("href", url); + moduleElmLink.appendChild(document.createTextNode(module)); + + // Replace textNode, so we keep surrounding elements (like the highlighted quotes). + moduleElm.replaceChild(moduleElmLink, moduleElmText); + }); + } + + /*! + strip-json-comments + Strip comments from JSON. Lets you use comments in your JSON files! + https://github.com/sindresorhus/strip-json-comments + by Sindre Sorhus + MIT License + */ + function stripJsonComments(str) { + var currentChar; + var nextChar; + var insideString = false; + var insideComment = false; + var ret = ""; + for (var i = 0; i < str.length; i++) { + currentChar = str[i]; + nextChar = str[i + 1]; + if (!insideComment && str[i - 1] !== "\\" && currentChar === '"') { + insideString = !insideString; + } + if (insideString) { + ret += currentChar; + continue; + } + if (!insideComment && currentChar + nextChar === "//") { + insideComment = "single"; + i++; + } else if ( + insideComment === "single" && + currentChar + nextChar === "\r\n" + ) { + insideComment = false; + i++; + ret += currentChar; + ret += nextChar; + continue; + } else if (insideComment === "single" && currentChar === "\n") { + insideComment = false; + } else if (!insideComment && currentChar + nextChar === "/*") { + insideComment = "multi"; + i++; + continue; + } else if ( + insideComment === "multi" && + currentChar + nextChar === "*/" + ) { + insideComment = false; + i++; + continue; + } + if (insideComment) { + continue; + } + ret += currentChar; + } + return ret; + } + + // Init. + Object.keys(modules).forEach(function (dependencyKey) { + modules[dependencyKey].forEach(function (module) { + if (isAtom && dependencyKey === "packageDependencies") { + // Atom needs to be before NPM. + let url = "https://atom.io/packages/" + module; + linkify(module, url); + } else if (isNPM) { + let url = "https://www.npmjs.org/package/" + module; + linkify(module, url); + } else if (isBower) { + GM_xmlhttpRequest({ + method: "GET", + url: "http://bower.herokuapp.com/packages/" + module, + onload: function (response) { + var data = JSON.parse(response.responseText); + var re = /github\.com\/([\w\-.]+)\/([\w\-.]+)/i; + var parsedUrl = re.exec(data.url.replace(/\.git$/, "")); + if (parsedUrl) { + var user = parsedUrl[1]; + var repo = parsedUrl[2]; + var url = "https://github.com/" + user + "/" + repo; + linkify(module, url); + } else { + linkify(module, data.url); + } + }, + }); + } else if (isNuGet) { + var url = "https://www.nuget.org/packages/" + module; + linkify(module, url); + } + }); + }); +})(); diff --git a/Github_JSON_Dependencies_Linker/README.md b/Github_JSON_Dependencies_Linker/README.md new file mode 100644 index 0000000..fc992fe --- /dev/null +++ b/Github_JSON_Dependencies_Linker/README.md @@ -0,0 +1,71 @@ +# [Github JSON Dependencies Linker](https://github.com/jerone/UserScripts/tree/master/Github_JSON_Dependencies_Linker) (abandoned) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +Linkify all dependencies found in an JSON file. + +The following JSON schemes are supported: + +- [NPM](https://www.npmjs.com) - `package.json` & `npm-shrinkwrap.json` +- [Bower](http://bower.io) - `bower.json` +- [NuGet](https://www.nuget.org) - `project.json` +- [Atom](https://atom.io) - `package.json` + +In the JSON file it will search for the following dependency keys: + +- `dependencies` +- `devDependencies` +- `peerDependencies` +- `bundleDependencies` +- `bundledDependencies` +- `packageDependencies` +- `optionalDependencies` + +## Screenshot + +![Github JSON Dependencies Linker Screenshot](https://github.com/jerone/UserScripts/raw/master/Github_JSON_Dependencies_Linker/screenshot.jpg) + +## Compatible + +- [![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on [![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **0.3.2** + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). +- **0.3.1** + - Fixed recognizing JSON content. +- **0.3.0** + - Added support for Atom for `packageDependencies`. +- **0.2.0** + - Module name preceding a colon is never a key. + - Added support for npm-shrinkwrap.json. + - Fetching module names is now recursive. +- **0.1.0** + - Initial version. + +## Test cases + +- (multiple package.json dependencies); +- +- (optionalDependencies & different semver); +- (git semver & bundledDependencies); +- (npm-shrinkwrap.json); +- (url semver); +- (ASP.NET project.json with COMMENTS); +- (Atom package.json packageDependencies atomShellVersion); +- (Atom package.json packageDependencies engines.atom); + +## Dependencies + +- Part of [sindresorhus](https://github.com/sindresorhus) module [**strip-json-comments**](https://github.com/sindresorhus/strip-json-comments) is used. + +## External links + +- [Greasy Fork](https://greasyfork.org/en/scripts/8770-github-json-dependencies-linker) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_JSON_Dependencies_Linker) diff --git a/Github_JSON_Dependencies_Linker/screenshot.jpg b/Github_JSON_Dependencies_Linker/screenshot.jpg new file mode 100644 index 0000000..d90bb04 Binary files /dev/null and b/Github_JSON_Dependencies_Linker/screenshot.jpg differ diff --git a/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js b/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js index c2415fc..1cd1033 100644 --- a/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js +++ b/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js @@ -1,272 +1,954 @@ // ==UserScript== -// @name Github News Feed Filter -// @namespace https://github.com/jerone/UserScripts -// @description Add filters for Github homepage news feed items -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_News_Feed_Filter -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_News_Feed_Filter -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js -// @include https://github.com/ -// @include https://github.com/?* -// @include https://github.com/orgs/*/dashboard -// @include https://github.com/orgs/*/dashboard?* -// @include https://github.com/*tab=activity* -// @version 5.3 -// @grant none +// @name Github News Feed Filter +// @namespace https://github.com/jerone/UserScripts +// @description Add filters for GitHub homepage news feed items +// @author jerone +// @contributor darkred +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_News_Feed_Filter +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_News_Feed_Filter +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @include https://github.com/ +// @include https://github.com/?* +// @include https://github.com/orgs/*/dashboard +// @include https://github.com/orgs/*/dashboard?* +// @version 8.2.8 +// @grant none // ==/UserScript== -/* global Event */ -(function() { - - var FILTERS = [ - { id: "*", text: "All News Feed", icon: "octicon-radio-tower", classNames: ["*"] }, +// cSpell:ignore transform, osvg, opath, gollum, hovercards, profilecols +/* eslint security/detect-object-injection: "off" */ + +(function () { + var ICONS = {}; + ICONS["octicon-book"] = + "M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"; + ICONS["octicon-comment-discussion"] = + "M15 1H6c-.55 0-1 .45-1 1v2H1c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h1v3l3-3h4c.55 0 1-.45 1-1V9h1l3 3V9h1c.55 0 1-.45 1-1V2c0-.55-.45-1-1-1zM9 11H4.5L3 12.5V11H1V5h4v3c0 .55.45 1 1 1h3v2zm6-3h-2v1.5L11.5 8H6V2h9v6z"; + ICONS["octicon-git-branch"] = + "M10 5c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v.3c-.02.52-.23.98-.63 1.38-.4.4-.86.61-1.38.63-.83.02-1.48.16-2 .45V4.72a1.993 1.993 0 0 0-1-3.72C.88 1 0 1.89 0 3a2 2 0 0 0 1 1.72v6.56c-.59.35-1 .99-1 1.72 0 1.11.89 2 2 2 1.11 0 2-.89 2-2 0-.53-.2-1-.53-1.36.09-.06.48-.41.59-.47.25-.11.56-.17.94-.17 1.05-.05 1.95-.45 2.75-1.25S8.95 7.77 9 6.73h-.02C9.59 6.37 10 5.73 10 5zM2 1.8c.66 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2C1.35 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2zm0 12.41c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm6-8c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"; + ICONS["octicon-git-branch-create"] = ICONS["octicon-git-branch"]; + ICONS["octicon-git-branch-delete"] = ICONS["octicon-git-branch"]; + ICONS["octicon-git-commit"] = + "M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z"; + ICONS["octicon-home"] = + "M16 9l-3-3V2h-2v2L8 1 0 9h2l1 5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1l1-5h2zm-4 5H9v-4H7v4H4L2.81 7.69 8 2.5l5.19 5.19L12 14z"; + ICONS["octicon-issue-opened"] = + "M7 2.3c3.14 0 5.7 2.56 5.7 5.7S10.14 13.7 7 13.7 1.3 11.14 1.3 8s2.56-5.7 5.7-5.7m0-1.3C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7S10.86 1 7 1z m1 3H6v5h2V4z m0 6H6v2h2V10z"; + ICONS["octicon-person"] = + "M12 14.002a.998.998 0 0 1-.998.998H1.001A1 1 0 0 1 0 13.999V13c0-2.633 4-4 4-4s.229-.409 0-1c-.841-.62-.944-1.59-1-4 .173-2.413 1.867-3 3-3s2.827.586 3 3c-.056 2.41-.159 3.38-1 4-.229.59 0 1 0 1s4 1.367 4 4v1.002z"; + ICONS["octicon-organization"] = + "M16 12.999c0 .439-.45 1-1 1H7.995c-.539 0-.994-.447-.995-.999H1c-.54 0-1-.561-1-1 0-2.634 3-4 3-4s.229-.409 0-1c-.841-.621-1.058-.59-1-3 .058-2.419 1.367-3 2.5-3s2.442.58 2.5 3c.058 2.41-.159 2.379-1 3-.229.59 0 1 0 1s1.549.711 2.42 2.088C9.196 9.369 10 8.999 10 8.999s.229-.409 0-1c-.841-.62-1.058-.59-1-3 .058-2.419 1.367-3 2.5-3s2.437.581 2.495 3c.059 2.41-.158 2.38-1 3-.229.59 0 1 0 1s3.005 1.366 3.005 4"; + ICONS["octicon-plus"] = "M12 9H7v5H5V9H0V7h5V2h2v5h5z"; + ICONS["octicon-radio-tower"] = + "M4.79 6.11c.25-.25.25-.67 0-.92-.32-.33-.48-.76-.48-1.19 0-.43.16-.86.48-1.19.25-.26.25-.67 0-.92a.613.613 0 0 0-.45-.19c-.16 0-.33.06-.45.19-.57.58-.85 1.35-.85 2.11 0 .76.29 1.53.85 2.11.25.25.66.25.9 0zM2.33.52a.651.651 0 0 0-.92 0C.48 1.48.01 2.74.01 3.99c0 1.26.47 2.52 1.4 3.48.25.26.66.26.91 0s.25-.68 0-.94c-.68-.7-1.02-1.62-1.02-2.54 0-.92.34-1.84 1.02-2.54a.66.66 0 0 0 .01-.93zm5.69 5.1A1.62 1.62 0 1 0 6.4 4c-.01.89.72 1.62 1.62 1.62zM14.59.53a.628.628 0 0 0-.91 0c-.25.26-.25.68 0 .94.68.7 1.02 1.62 1.02 2.54 0 .92-.34 1.83-1.02 2.54-.25.26-.25.68 0 .94a.651.651 0 0 0 .92 0c.93-.96 1.4-2.22 1.4-3.48A5.048 5.048 0 0 0 14.59.53zM8.02 6.92c-.41 0-.83-.1-1.2-.3l-3.15 8.37h1.49l.86-1h4l.84 1h1.49L9.21 6.62c-.38.2-.78.3-1.19.3zm-.01.48L9.02 11h-2l.99-3.6zm-1.99 5.59l1-1h2l1 1h-4zm5.19-11.1c-.25.25-.25.67 0 .92.32.33.48.76.48 1.19 0 .43-.16.86-.48 1.19-.25.26-.25.67 0 .92a.63.63 0 0 0 .9 0c.57-.58.85-1.35.85-2.11 0-.76-.28-1.53-.85-2.11a.634.634 0 0 0-.9 0z"; + ICONS["octicon-repo"] = + "M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"; + ICONS["octicon-repo-clone"] = + "M15 0H9v7c0 .55.45 1 1 1h1v1h1V8h3c.55 0 1-.45 1-1V1c0-.55-.45-1-1-1zm-4 7h-1V6h1v1zm4 0h-3V6h3v1zm0-2h-4V1h4v4zM4 5H3V4h1v1zm0-2H3V2h1v1zM2 1h6V0H1C.45 0 0 .45 0 1v12c0 .55.45 1 1 1h2v2l1.5-1.5L6 16v-2h5c.55 0 1-.45 1-1v-3H2V1zm9 10v2H6v-1H3v1H1v-2h10zM3 8h1v1H3V8zm1-1H3V6h1v1z"; + ICONS["octicon-repo-create"] = ICONS["octicon-plus"]; + ICONS["octicon-repo-push"] = + "M4 3H3V2h1v1zM3 5h1V4H3v1zm4 0L4 9h2v7h2V9h2L7 5zm4-5H1C.45 0 0 .45 0 1v12c0 .55.45 1 1 1h4v-1H1v-2h4v-1H2V1h9.02L11 10H9v1h2v2H9v1h2c.55 0 1-.45 1-1V1c0-.55-.45-1-1-1z"; + ICONS["octicon-repo-forked"] = + "M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"; + ICONS["octicon-repo-delete"] = ICONS["octicon-repo"]; + ICONS["octicon-repo-pull"] = + "M13 8V6H7V4h6V2l3 3-3 3zM4 2H3v1h1V2zm7 5h1v6c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v2h-1V1H2v9h9V7zm0 4H1v2h2v-1h3v1h5v-2zM4 6H3v1h1V6zm0-2H3v1h1V4zM3 9h1V8H3v1z"; + ICONS["octicon-star"] = + "M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"; + ICONS["octicon-tag"] = + "M7.73 1.73C7.26 1.26 6.62 1 5.96 1H3.5C2.13 1 1 2.13 1 3.5v2.47c0 .66.27 1.3.73 1.77l6.06 6.06c.39.39 1.02.39 1.41 0l4.59-4.59a.996.996 0 0 0 0-1.41L7.73 1.73zM2.38 7.09c-.31-.3-.47-.7-.47-1.13V3.5c0-.88.72-1.59 1.59-1.59h2.47c.42 0 .83.16 1.13.47l6.14 6.13-4.73 4.73-6.13-6.15zM3.01 3h2v2H3V3h.01z"; + ICONS["octicon-tag-add"] = ICONS["octicon-tag"]; + ICONS["octicon-tag-remove"] = ICONS["octicon-tag"]; + ICONS["octicon-triangle-left"] = "M6 2L0 8l6 6z"; + + var ACTIONS = [ { - id: "issues", text: "Issues", icon: "octicon-issue-opened", classNames: ["issues_opened", "issues_closed", "issues_reopened", "issues_comment"], subFilters: [ - { id: "issues opened", text: "Opened", icon: "octicon-issue-opened", classNames: ["issues_opened"] }, - { id: "issues closed", text: "Closed", icon: "octicon-issue-closed", classNames: ["issues_closed"] }, - { id: "issues reopened", text: "Reopened", icon: "octicon-issue-reopened", classNames: ["issues_reopened"] }, - { id: "issues comments", text: "Comments", icon: "octicon-comment-discussion", classNames: ["issues_comment"] } - ] + id: "*-action", + text: "All news feed", + icon: "octicon-radio-tower", + classNames: ["*-action"], }, { - id: "commits", text: "Commits", icon: "octicon-git-commit", classNames: ["push", "commit_comment"], subFilters: [ - { id: "commits pushed", text: "Pushed", icon: "octicon-git-commit", classNames: ["push"] }, - { id: "commits comments", text: "Comments", icon: "octicon-comment-discussion", classNames: ["commit_comment"] } - ] + id: "issues", + text: "Issues", + icon: "octicon-issue-opened", + classNames: ["issues_labeled"], + subFilters: [ + { + id: "issues labeled", + text: "Labeled", + icon: "octicon-tag", + classNames: ["issues_labeled"], + }, + ], }, { - id: "pr", text: "Pull Requests", icon: "octicon-git-pull-request", classNames: ["pull_request_opened", "pull_request_closed", "pull_request_merged", "pull_request_comment"], subFilters: [ - { id: "pr opened", text: "Opened", icon: "octicon-git-pull-request", classNames: ["pull_request_opened"] }, - { id: "pr closed", text: "Closed", icon: "octicon-git-pull-request-abandoned", classNames: ["pull_request_closed"] }, - { id: "pr merged", text: "Merged", icon: "octicon-git-merge", classNames: ["pull_request_merged"] }, - { id: "pr comments", text: "Comments", icon: "octicon-comment-discussion", classNames: ["pull_request_comment"] } - ] + id: "commits", + text: "Commits", + icon: "octicon-git-commit", + classNames: ["push", "commit_comment"], + subFilters: [ + { + id: "commits pushed", + text: "Pushed", + icon: "octicon-git-commit", + classNames: ["push"], + }, + { + id: "commits comments", + text: "Comments", + icon: "octicon-comment-discussion", + classNames: ["commit_comment"], + }, + ], }, { - id: "repo", text: "Repo", icon: "octicon-repo", classNames: ["create", "public", "fork", "branch_create", "branch_delete", "tag_add", "tag_remove", "release", "delete"], subFilters: [ - { id: "repo created", text: "Created", icon: "octicon-repo-create", classNames: ["create"] }, - { id: "repo public", text: "Public", icon: "octicon-repo-push", classNames: ["public"] }, - { id: "repo forked", text: "Forked", icon: "octicon-repo-forked", classNames: ["fork"] }, + id: "repo", + text: "Repo", + icon: "octicon-repo", + classNames: [ + "repo", + "create", + "public", + "fork", + "branch_create", + "branch_delete", + "tag_add", + "tag_remove", + "release", + "delete", + ], + subFilters: [ + { + id: "repo created", + text: "Created", + icon: "octicon-repo-create", + classNames: ["repo", "create"], + }, + { + id: "repo public", + text: "Public", + icon: "octicon-repo-push", + classNames: ["public"], + }, + { + id: "repo forked", + text: "Forked", + icon: "octicon-repo-forked", + classNames: ["fork"], + }, { - id: "repo branched", text: "Branched", icon: "octicon-git-branch", classNames: ["branch_create", "branch_delete"], subFilters: [ - { id: "repo branch created", text: "Created", icon: "octicon-git-branch-create", classNames: ["branch_create"] }, - { id: "repo branch deleted", text: "Deleted", icon: "octicon-git-branch-delete", classNames: ["branch_delete"] } - ] + id: "repo deleted", + text: "Deleted", + icon: "octicon-repo-delete", + classNames: ["delete"], }, { - id: "repo tagged", text: "Tagged", icon: "octicon-tag", classNames: ["tag_add", "tag_remove"], subFilters: [ - { id: "repo tag added", text: "Added", icon: "octicon-tag-add", classNames: ["tag_add"] }, - { id: "repo tag removed", text: "Removed", icon: "octicon-tag-remove", classNames: ["tag_remove"] } - ] + id: "repo released", + text: "Release", + icon: "octicon-repo-pull", + classNames: ["release"], }, - { id: "repo released", text: "Released", icon: "octicon-repo-pull", classNames: ["release"] }, - { id: "repo deleted", text: "Deleted", icon: "octicon-repo-delete", classNames: ["delete"] } - ] + { + id: "repo branched", + text: "Branch", + icon: "octicon-git-branch", + classNames: ["branch_create", "branch_delete"], + subFilters: [ + { + id: "repo branch created", + text: "Created", + icon: "octicon-git-branch-create", + classNames: ["branch_create"], + }, + { + id: "repo branch deleted", + text: "Deleted", + icon: "octicon-git-branch-delete", + classNames: ["branch_delete"], + }, + ], + }, + { + id: "repo tagged", + text: "Tag", + icon: "octicon-tag", + classNames: ["tag_add", "tag_remove"], + subFilters: [ + { + id: "repo tag added", + text: "Added", + icon: "octicon-tag-add", + classNames: ["tag_add"], + }, + { + id: "repo tag removed", + text: "Removed", + icon: "octicon-tag-remove", + classNames: ["tag_remove"], + }, + ], + }, + ], }, { - id: "user", text: "User", icon: "octicon-person", classNames: ["watch_started", "member_add", "team_add"], subFilters: [ - { id: "user starred", text: "Starred", icon: "octicon-star", classNames: ["watch_started"] }, - { id: "user added", text: "Member added", icon: "octicon-person-add", classNames: ["member_add", "team_add"] } - ] + id: "user", + text: "User", + icon: "octicon-person", + classNames: ["follow"], }, - { id: "wiki", text: "Wiki", icon: "octicon-book", classNames: ["gollum"] }, { - id: "gist", text: "Gist", icon: "octicon-gist", classNames: ["gist_created", "gist_updated"], subFilters: [ - { id: "gist created", text: "Created", icon: "octicon-gist-new", classNames: ["gist_created"] }, - { id: "gist updated", text: "Updated", icon: "octicon-gist", classNames: ["gist_updated"] } - ] - } - // Possible other classes: follow + id: "starred", + text: "Starred", + icon: "octicon-star", + classNames: ["watch_started"], + }, + { + id: "wiki", + text: "Wiki", + icon: "octicon-book", + classNames: ["wiki_created", "wiki_edited"], + subFilters: [ + { + id: "wiki created", + text: "Created", + icon: "octicon-plus", + classNames: ["wiki_created"], + }, + { + id: "wiki edited", + text: "Edited", + icon: "octicon-book", + classNames: ["wiki_edited"], + }, + ], + }, ]; - var datasetId = "githubNewsFeedFilterId"; + var REPOS = []; + + var USERS = []; + + var datasetId = "githubNewsFeedFilter"; + var datasetIdLong = "data-github-news-feed-filter"; + var filterElement = "github-news-feed-filter"; + var filterListElement = "github-news-feed-filter-list"; function proxy(fn) { - return function() { + return function () { var that = this; - return function(e) { - var args = that.slice(0); // clone; - args.unshift(e); // prepend event; + return function (e) { + var args = that.slice(0); // Clone. + args.unshift(e); // Prepend event. fn.apply(this, args); }; }.call([].slice.call(arguments, 1)); } - function addFilterMenu(filters, parent, container, sidebar, main) { + function addStyle(css) { + var node = document.createElement("style"); + node.type = "text/css"; + node.appendChild(document.createTextNode(css)); + document.head.appendChild(node); + } + + addStyle(` + github-news-feed-filter { display: block; } + + github-news-feed-filter .filter-bar { padding: 0; } + + github-news-feed-filter .count { margin-right: 15px; } + + github-news-feed-filter .filter-list .mini-repo-list-item { padding-right: 64px; } + + github-news-feed-filter .filter-list .filter-list .mini-repo-list-item { padding-left: 40px; border-top: 1px dashed #E5E5E5; } + github-news-feed-filter .filter-list .filter-list .filter-list .mini-repo-list-item { padding-left: 50px; } + + github-news-feed-filter .filter-list { display: none; } + github-news-feed-filter .open > .filter-list { display: block; } + github-news-feed-filter .filter-list.open { display: block; } + + github-news-feed-filter .private { font-weight: bold; } + + github-news-feed-filter .stars .octicon { position: absolute; right: -4px; } + github-news-feed-filter .filter-list-item.open > a > .stars > .octicon { transform: rotate(-90deg); } + + .no-alerts { font-style: italic; } + `); + + // Add filter menu list. + function addFilterMenu( + type, + filters, + parent, + newsContainer, + filterContainer, + main, + ) { var ul = document.createElement("ul"); ul.classList.add("filter-list"); - if (!main) { - ul.classList.add("small"); - ul.style.marginLeft = "10px"; - ul.style.display = "none"; + if (main) { + ul.classList.add("mini-repo-list"); } parent.appendChild(ul); - filters.forEach(function(subFilter) { - var li = addFilterMenuItem(subFilter, ul, container, sidebar); + filters.forEach(function (subFilter) { + var li = addFilterMenuItem( + type, + subFilter, + ul, + newsContainer, + filterContainer, + ); if (subFilter.subFilters) { - addFilterMenu(subFilter.subFilters, li, container, sidebar, false); + addFilterMenu( + type, + subFilter.subFilters, + li, + newsContainer, + filterContainer, + false, + ); } }); } - function addFilterMenuItem(filter, parent, container, sidebar) { + // Add filter menu item. + function addFilterMenuItem( + type, + filter, + parent, + newsContainer, + filterContainer, + ) { + // Filter item. + var li = document.createElement("li"); + li.classList.add("filter-list-item"); + li.filterClassNames = filter.classNames; + parent.appendChild(li); + + // Filter link. var a = document.createElement("a"); - a.classList.add("filter-item"); - a.setAttribute("href", "/"); + a.classList.add("mini-repo-list-item", "css-truncate"); + a.setAttribute("href", filter.link || "/"); a.setAttribute("title", filter.classNames.join(" & ")); a.dataset[datasetId] = filter.id; + a.addEventListener( + "click", + proxy(onFilterItemClick, type, newsContainer, filterContainer), + ); + li.appendChild(a); - var s = document.createElement("span"); - s.classList.add("octicon", filter.icon); - s.style.marginRight = "10px"; - s.style.cssFloat = "left"; - s.style.minWidth = "16px"; - a.appendChild(s); + // Filter icon. + var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + svg.classList.add("repo-icon", "octicon", filter.icon); + svg.setAttribute("height", "16"); + svg.setAttribute("width", "16"); + a.appendChild(svg); + var path = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path.setAttribute("d", ICONS[filter.icon]); + svg.appendChild(path); + + // Filter text. + var text = filter.text.split("/"); + var t = document.createElement("span"); + t.classList.add("repo-and-owner", "css-truncate-target"); + a.appendChild(t); + var to = document.createElement("span"); + to.classList.add("owner"); + to.appendChild(document.createTextNode(text[0])); + t.appendChild(to); + if (text.length > 1) { + text.shift(); + t.appendChild(document.createTextNode("/")); + var tr = document.createElement("span"); + tr.classList.add("repo"); + tr.appendChild(document.createTextNode(text.join("/"))); + t.appendChild(tr); + } + // Filter count & sub list arrow. + var s = document.createElement("span"); + s.classList.add("stars"); var c = document.createElement("span"); c.classList.add("count"); c.appendChild(document.createTextNode("0")); - a.appendChild(c); + s.appendChild(c); + if (filter.subFilters) { + s.appendChild(document.createTextNode(" ")); + var osvg = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + osvg.classList.add("octicon", "octicon-triangle-left"); + osvg.setAttribute("height", "16"); + osvg.setAttribute("width", "6"); + s.appendChild(osvg); + var opath = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + opath.setAttribute("d", ICONS["octicon-triangle-left"]); + osvg.appendChild(opath); + } + a.appendChild(s); - a.appendChild(document.createTextNode(filter.text)); + return li; + } - a.addEventListener("click", proxy(function(e, classNames) { - e.preventDefault(); + // Filter item click event. + function onFilterItemClick(e, type, newsContainer, filterContainer) { + e.preventDefault(); + + // Store current filter. + setCurrentFilter(type, this.dataset[datasetId]); + + // Open/close sub list. + Array.forEach( + filterContainer.querySelectorAll(":scope .open"), + function (item) { + item.classList.remove("open"); + }, + ); + showParentMenu(this); + this.parentNode.classList.add("open"); + + // Give it a colored background. + Array.forEach( + filterContainer.querySelectorAll(":scope .private"), + function (m) { + m.classList.remove("private"); + }, + ); + this.parentNode.classList.add("private"); + + // Toggle alert visibility. + toggleAlertsVisibility(newsContainer); + } - var any = false, - all = classNames[0] === "*", - some = function(alert) { return classNames.some(function(cl) { return alert.classList.contains(cl); }); }; - Array.forEach(container.querySelectorAll(".alert"), function(alert) { - alert.style.display = (all || some(alert)) && (any = true) ? "block" : "none"; + // Toggle alert visibility. + function toggleAlertsVisibility(newsContainer) { + // Get selected filters. + var anyVisibleAlert = false; + var classNames = []; + var selected = document.querySelectorAll( + ":scope " + filterElement + " .private", + ); + if (selected.length > 0) { + Array.prototype.forEach.call(selected, function (item) { + classNames.push(item.filterClassNames); }); - var none = container.querySelector(".no-alerts"); - if (any && none) { - none.parentNode.removeChild(none); - } else if (!any && !none) { - none = document.createElement("div"); - none.classList.add("no-alerts"); - none.style.padding = "0 0 1em 45px"; - none.style.fontStyle = "italic"; - none.appendChild(document.createTextNode("No feed items for this filter. Press the button below to load more items...")); - container.insertBefore(none, container.firstChild); - } - - Array.forEach(sidebar.querySelectorAll(".filter-list.small"), function(ul) { ul.style.display = "none"; }); - showParentMenu(a.parentNode); - var subMenu = a.parentNode.querySelector("ul"); - if (subMenu) { subMenu.style.display = "block"; } - - Array.forEach(sidebar.querySelectorAll(".selected"), function(m) { m.classList.remove("selected"); }); - this.classList.add("selected"); - - if (this.dataset[datasetId] !== "*") { - var urlSearch = "filter=" + encodeURIComponent(this.dataset[datasetId]); - history.pushState(null, null, location.search && /filter=[^&]*/g.test(location.search) - ? location.href.replace(/filter=[^&]*/g, urlSearch) - : location.href + (location.search ? "&" : "?") + urlSearch); - } else { - history.pushState(null, null, location.href.replace(/(filter=[^&]*&|\?filter=[^&]*$|&filter=[^&]*)/g, "")); // http://regexr.com/398lv - } - }, filter.classNames)); - - var li = document.createElement("li"); - li.appendChild(a); - li.filterClassNames = filter.classNames; + } - parent.appendChild(li); + // Show/hide alerts. + if ( + classNames.length === 0 || + classNames.every(function (cl) { + return cl.every(function (c) { + return ~c.indexOf("*"); + }); + }) + ) { + anyVisibleAlert = true; + getAllAlerts(newsContainer).forEach(function (alert) { + alert.style.display = "block"; + }); + } else { + getAllAlerts(newsContainer).forEach(function (alert) { + var show = classNames.every(function (cl) { + return cl.some(function (c) { + return ~c.indexOf("*") || alert.classList.contains(c); + }); + }); + anyVisibleAlert = show || anyVisibleAlert; + alert.style.display = show ? "block" : "none"; + // DEBUG: uncomment following line and comment previous line to debug all alerts. + //if(show) alert.style.display = 'none'; + }); + } - return li; + // Show/hide message about no alerts. + var none = newsContainer.querySelector(":scope .no-alerts"); + if (anyVisibleAlert && none) { + none.parentNode.removeChild(none); + } else if (!anyVisibleAlert && !none) { + none = document.createElement("div"); + none.classList.add("no-alerts"); + none.appendChild( + document.createTextNode( + "No feed items for this filter. Please select another filter.", + ), + ); + var firstAlert = getAllAlerts(newsContainer)[0]; + firstAlert.parentNode.insertBefore(none, firstAlert); + } } + // Traverse back up the tree to open sub lists. function showParentMenu(menuItem) { var parentMenuItem = menuItem.parentNode; - if (parentMenuItem.classList.contains("filter-list")) { - parentMenuItem.style.display = "block"; + if (parentMenuItem.classList.contains("filter-list-item")) { + parentMenuItem.classList.add("open"); showParentMenu(parentMenuItem.parentNode); } } - function pageUpdate(container, sidebar, wrapper) { - Array.forEach(container.querySelectorAll(".alert"), function(alert) { - if (alert.getElementsByClassName("octicon-git-branch-create").length > 0) { + // Fix filter action identification. + function fixActionAlerts(newsContainer) { + getAllAlerts(newsContainer).forEach(function (alert) { + if (~alert.textContent.indexOf("created branch")) { alert.classList.remove("create"); alert.classList.add("branch_create"); - } else if (alert.getElementsByClassName("octicon-git-branch-delete").length > 0) { + } else if (~alert.textContent.indexOf("deleted branch")) { alert.classList.remove("delete"); alert.classList.add("branch_delete"); - } else if (alert.getElementsByClassName("octicon-tag-add").length > 0) { + } else if ( + alert.getElementsByClassName("octicon-tag").length > 0 && + !alert.classList.contains("release") + ) { alert.classList.remove("create"); alert.classList.add("tag_add"); - } else if (alert.getElementsByClassName("octicon-tag-remove").length > 0) { + } else if ( + alert.getElementsByClassName("octicon-tag-remove").length > 0 + ) { alert.classList.remove("delete"); alert.classList.add("tag_remove"); - } else if (alert.getElementsByClassName("octicon-git-pull-request").length > 0) { - alert.classList.remove("issues_opened", "issues_closed"); - if (alert.querySelector(".title span").textContent.toUpperCase() === "OPENED") { // English localisation; - alert.classList.add("pull_request_opened"); - } else if (alert.querySelector(".title span").textContent.toUpperCase() === "MERGED") { // English localisation; - alert.classList.add("pull_request_merged"); - } else if (alert.querySelector(".title span").textContent.toUpperCase() === "CLOSED") { // English localisation; - alert.classList.add("pull_request_closed"); + } else if (~alert.textContent.indexOf("labeled an issue")) { + alert.classList.add("issues_labeled"); + } else if (alert.classList.contains("gollum")) { + alert.classList.remove("gollum"); + if (~alert.innerText.indexOf(" created a wiki page in ")) { + alert.classList.add("wiki_created"); + } else if ( + ~alert.innerText.indexOf(" edited a wiki page in ") + ) { + alert.classList.add("wiki_edited"); } - } else if (alert.classList.contains("issues_comment") && alert.querySelectorAll(".title a")[1].getAttribute("href").split("/")[5] === "pull") { - alert.classList.remove("issues_comment"); - alert.classList.add("pull_request_comment"); - } else if (alert.classList.contains("gist")) { - alert.classList.remove("gist"); - alert.classList.add("gist_" + alert.querySelector(".title span").textContent); } }); + } + // Fix filter repo identification. + function fixRepoAlerts(newsContainer) { + REPOS = [ + { + id: "*-repo", + text: "All repositories", + icon: "octicon-repo", + classNames: ["*-repo"], + }, + ]; + + // Get unique list of repos. + var userRepos = new Set(); + getAllAlerts(newsContainer).forEach(function (alert) { + var alertRepo = alert.querySelector( + ':scope [data-ga-click*="target:repo"]:not([data-ga-click*="target:repositories"])', + ); + if (alertRepo) { + // Follow doesn't contain a repo link. + var userRepo = alertRepo.textContent; + userRepos.add(userRepo); + var repo = userRepo.split("/")[1]; + alert.classList.add(repo, userRepo); + } + }); + + // Get list of user repos (forks) per repo names. + var repos = {}; + userRepos.forEach(function (userRepo) { + var repo = userRepo.split("/")[1]; + if (!repos[repo]) { + repos[repo] = []; + } + repos[repo].push(userRepo); + }); - Array.forEach(wrapper.querySelectorAll("li"), function(li) { - var c = li.querySelector(".count"); - if (li.filterClassNames[0] === "*") { - c.textContent = container.querySelectorAll(".alert").length; + // Populate global property. + Object.keys(repos).forEach(function (repo) { + if (repos[repo].length === 1) { + var userRepo = repos[repo][0]; + REPOS.push({ + id: userRepo, + text: userRepo, + link: userRepo, + icon: "octicon-repo", + classNames: [userRepo], + }); } else { - c.textContent = "0"; - Array.forEach(container.querySelectorAll(".alert"), function(alert) { - if (li.filterClassNames.some(function(cl) { return alert.classList.contains(cl); })) { - c.textContent = parseInt(c.textContent, 10) + 1; - } + var repoForks = { + id: repo, + text: repo, + icon: "octicon-repo-clone", + classNames: [repo], + subFilters: [], + }; + repos[repo].forEach(function (userRepo) { + repoForks.classNames.push(userRepo); + repoForks.subFilters.push({ + id: userRepo, + text: userRepo, + link: userRepo, + icon: "octicon-repo", + classNames: [userRepo], + }); }); + REPOS.push(repoForks); } }); + } + // Fix filter user identification. + function fixUserAlerts(newsContainer) { + USERS = [ + { + id: "*-user", + text: "All users", + icon: "octicon-organization", + classNames: ["*-user"], + }, + ]; + + var users = new Set(); + getAllAlerts(newsContainer).forEach(function (alert) { + var usernameElms = alert.querySelectorAll( + ':scope [data-ga-click*="target:actor"]', + ); + Array.prototype.find.call(usernameElms, function (usernameElm) { + var username = usernameElm.textContent; + if (username) { + alert.classList.add(username); + users.add(username); + return true; + } + return false; + }); + }); + + [...users] + .sort(function (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + }) + .forEach(function (username) { + var user = { + id: username, + text: username, + icon: "octicon-person", + classNames: [username], + }; + USERS.push(user); + }); + } + + // Update filter counts. + function updateFilterCounts(filterContainer, newsContainer) { + Array.forEach( + filterContainer.querySelectorAll(":scope li.filter-list-item"), + function (li) { + // Count alerts based on other filters. + var countFiltered = 0; + var classNames = [li.filterClassNames]; + var selected = document.querySelectorAll( + ":scope " + filterElement + " li.filter-list-item.private", + ); + if (selected.length > 0) { + Array.prototype.forEach.call(selected, function (item) { + if (item.parentNode.parentNode !== filterContainer) { + // Exclude list item from current filter container. + classNames.push(item.filterClassNames); + } + }); + } + getAllAlerts(newsContainer).forEach(function (alert) { + var show = classNames.every(function (cl) { + return cl.some(function (c) { + return ( + ~c.indexOf("*") || alert.classList.contains(c) + ); + }); + }); + if (show) { + countFiltered++; + } + }); + + // Count alerts based on current filter. + var countAll = 0; + if (~li.filterClassNames[0].indexOf("*")) { + countAll = getAllAlerts(newsContainer).length; + } else { + getAllAlerts(newsContainer).forEach(function (alert) { + if ( + li.filterClassNames.some(function (cl) { + return alert.classList.contains(cl); + }) + ) { + countAll++; + } + }); + } - var filter = /filter=[^&]*/g.test(location.search) - ? decodeURIComponent(/filter=([^&]*)/g.exec(location.search)[1]) - : "*"; - wrapper.querySelector('.filter-item[data-github-news-feed-filter-id="' + filter + '"]').dispatchEvent(new Event("click")); + li.querySelector(":scope .count").textContent = + countAll + " (" + countFiltered + ")"; + }, + ); } - function addFilters() { - var container = document.querySelector(".news"); - if (!container) { return; } + // Get all alerts. + function getAllAlerts(newsContainer) { + return Array.prototype.map.call( + newsContainer.querySelectorAll( + ":scope div[data-repository-hovercards-enabled] > div > .body", + ), + function (alert) { + return alert.parentNode; + }, + ); + } - var sidebar = document.querySelector(".dashboard-sidebar") || document.querySelector(".column.one-fourth.vcard"); + var CURRENT = {}; - var rule = document.createElement("div"); - rule.classList.add("rule"); - sidebar.insertBefore(rule, sidebar.firstChild); + // Set current filter. + function setCurrentFilter(type, filter) { + CURRENT[type] = filter; + } - var wrapper = document.createElement("div"); - sidebar.insertBefore(wrapper, sidebar.firstChild); + // Get current filter. + function getCurrentFilter(type, filterContainer) { + var filter = CURRENT[type] || "*-" + type; + filterContainer + .querySelector(":scope [" + datasetIdLong + '="' + filter + '"]') + .dispatchEvent(new Event("click")); + } - addFilterMenu(FILTERS, wrapper, container, sidebar, true); + // Add filter tab. + function addFilterTab(type, text, inner, filterer, onCreate, onSelect) { + var filterTabInner = document.createElement("a"); + filterTabInner.setAttribute("href", "#"); + filterTabInner.classList.add("UnderlineNav-item"); + filterTabInner.appendChild(document.createTextNode(text)); + filterer.appendChild(filterTabInner); - pageUpdate(container, sidebar, wrapper); + var filterContainer = document.createElement(filterListElement); + inner.appendChild(filterContainer); - // update on clicking "More"-button; - new MutationObserver(function() { - pageUpdate(container, sidebar, wrapper); - }).observe(container, { childList: true }); + filterTabInner.addEventListener( + "click", + proxy(filterTabInnerClick, type, inner, filterContainer, onSelect), + ); + + onCreate && onCreate(type, filterContainer); } - // init; - addFilters(); + // Filter tab click event. + function filterTabInnerClick(e, type, inner, filterContainer, onSelect) { + e.preventDefault(); + + var selected = inner.querySelector(":scope .selected"); + selected && selected.classList.remove("selected"); + this.classList.add("selected"); + + Array.forEach( + inner.querySelectorAll(filterListElement), + function (menu) { + menu && menu.classList.remove("open"); + }, + ); + filterContainer.classList.add("open"); + onSelect && onSelect(type, filterContainer); + } + + // Init. + (function init() { + var newsContainer = document.querySelector(".news"); + if (!newsContainer) { + return; + } + + // GitHub homepage or profile activity tab. + var sidebar = + document.querySelector(".dashboard-sidebar:not(.is-placeholder)") || + document.querySelector(".profilecols > .column:first-child"); + + var wrapper = document.createElement(filterElement); + wrapper.classList.add("boxed-group", "flush", "user-repos"); + sidebar.insertBefore( + wrapper, + sidebar.querySelector(":scope > *:not(details)"), + ); + + var headerAction = document.createElement("div"); + headerAction.classList.add("boxed-group-action"); + wrapper.appendChild(headerAction); + + var headerLink = document.createElement("a"); + headerLink.setAttribute( + "href", + "https://github.com/jerone/UserScripts", + ); + headerLink.classList.add("btn", "btn-sm"); + headerAction.appendChild(headerLink); + + var headerLinkSvg = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + headerLinkSvg.classList.add("octicon", "octicon-home"); + headerLinkSvg.setAttribute("height", "16"); + headerLinkSvg.setAttribute("width", "16"); + headerLinkSvg.setAttribute( + "title", + "Open Github News Feed Filter homepage", + ); + headerLink.appendChild(headerLinkSvg); + var headerLinkPath = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + headerLinkPath.setAttribute("d", ICONS["octicon-home"]); + headerLinkSvg.appendChild(headerLinkPath); + + var headerText = document.createElement("h3"); + headerText.appendChild(document.createTextNode("News feed filter")); + wrapper.appendChild(headerText); + + var inner = document.createElement("div"); + inner.classList.add("boxed-group-inner"); + wrapper.appendChild(inner); + + var bar = document.createElement("div"); + bar.classList.add("filter-bar"); + inner.appendChild(bar); + + var filterer = document.createElement("nav"); + filterer.classList.add("UnderlineNav-body"); + bar.appendChild(filterer); + + // Create filter tabs. + addFilterTab( + "action", + "Actions", + inner, + filterer, + function onCreateActions(type, filterContainer) { + // Create filter menu. + addFilterMenu( + type, + ACTIONS, + filterContainer, + newsContainer, + filterContainer, + true, + ); + }, + function onSelectActions(type, filterContainer) { + // Fix alert identification. + fixActionAlerts(newsContainer); + // Update filter counts. + updateFilterCounts(filterContainer, newsContainer); + // Restore current filter. + getCurrentFilter(type, filterContainer); + }, + ); + addFilterTab( + "repo", + "Repositories", + inner, + filterer, + function onCreateRepos(type, filterContainer) { + // Fix filter identification and create repos list. + fixRepoAlerts(newsContainer); + // Create filter menu. + addFilterMenu( + type, + REPOS, + filterContainer, + newsContainer, + filterContainer, + true, + ); + }, + function onSelectRepos(type, filterContainer) { + // Fix alert identification and create repos list. + fixRepoAlerts(newsContainer); + // Empty list, so it can be filled again. + while (filterContainer.hasChildNodes()) { + filterContainer.removeChild(filterContainer.lastChild); + } + // Create filter menu. + addFilterMenu( + type, + REPOS, + filterContainer, + newsContainer, + filterContainer, + true, + ); + // Update filter counts. + updateFilterCounts(filterContainer, newsContainer); + // Restore current filter. + getCurrentFilter(type, filterContainer); + }, + ); + addFilterTab( + "user", + "Users", + inner, + filterer, + function onCreateUsers(type, filterContainer) { + // Fix filter identification and create users list. + fixUserAlerts(newsContainer); + // Create filter menu. + addFilterMenu( + type, + USERS, + filterContainer, + newsContainer, + filterContainer, + true, + ); + }, + function onSelectUsers(type, filterContainer) { + // Fix filter identification and create users list. + fixUserAlerts(newsContainer); + // Empty list, so it can be filled again. + while (filterContainer.hasChildNodes()) { + filterContainer.removeChild(filterContainer.lastChild); + } + // Create filter menu. + addFilterMenu( + type, + USERS, + filterContainer, + newsContainer, + filterContainer, + true, + ); + // Update filter counts. + updateFilterCounts(filterContainer, newsContainer); + // Restore current filter. + getCurrentFilter(type, filterContainer); + }, + ); + + // Open first filter tab. + filterer.querySelector("a").dispatchEvent(new Event("click")); + + // Update on clicking "More"-button. + new MutationObserver(function () { + // Re-click the current selected filter on open filter tab. + filterer + .querySelector("a.selected") + .dispatchEvent(new Event("click")); + }).observe(newsContainer, { childList: true, subtree: true }); + })(); })(); diff --git a/Github_News_Feed_Filter/README.md b/Github_News_Feed_Filter/README.md index 02a1fc1..650566c 100644 --- a/Github_News_Feed_Filter/README.md +++ b/Github_News_Feed_Filter/README.md @@ -1,107 +1,226 @@ -# [Github News Feed Filter](https://github.com/jerone/UserScripts/tree/master/Github_News_Feed_Filter) +# [Github News Feed Filter](https://github.com/jerone/UserScripts/tree/master/Github_News_Feed_Filter) (abandoned) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_News_Feed_Filter/Github_News_Feed_Filter.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description +## Description -Add filters for [Github homepage](https://github.com) news feed items. +Add filters for [GitHub homepage](https://github.com) news feed items. -This script also works for organizations and on user profiles [public activity](https://github.com/jerone?tab=activity). +This script also works for organizations. Currently integrated filters: -* Issues - * Opened - * Closed - * Reopened - * Comments -* Commits - * Pushed - * Comments -* Pull Requests - * Opened - * Closed - * Merged - * Comments -* Repo - * Created - * Public - * Forked - * Branched - * Created - * Deleted - * Tagged - * Added - * Removed - * Released - * Deleted -* User - * Starred - * Member added -* Wiki -* Gist - * Created - * Updated - -### Screenshot - -![Github News Feed Filter screenshot](https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/screenshot.jpg) - -### Compatible - -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). - -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... - -### Version History - -* **5.3** - * Added filter history support; -* **5.2** - * Fixed issues after Github site update (https://github.com/jerone/UserScripts/issues/6); -* **5.1** - * Added support for user public activity; -* **5.0** - * More filters added; -* **4.6** - * Show message when filter has no feed items; -* **4.5** - * Added branch deleting support; -* **4.4** - * Added support for organisations; - * Added commit comments; -* **4.3** - * Reordered menu; - * Expanded Gist create & update; - * Changed Starred in User actions and added member add; -* **4.2** - * Added support for Scriptish; -* **4.1** - * Added fork filter; - * Added sub-filters for issues (comments, opened, closed, reopened); -* **4.0** - * Better integrated menu style; -* **3.1** - * Moved PR comments to PR filter; -* **3.0** - * Added Stars, Repo and Wiki filter; - * Moved Comments to Issues filter; - * Made menu lower; -* **2.0** - * Added Pull Requests filter; -* **1.0** - * Initial version; - -### TODO - -- ~~Remember filter choice (use href);~~ -- Remove first alert border-top; -- ~~Can probably run on users public activity stream too (https://github.com/jerone?tab=activity);~~ Only works on direct access. -- Filter on project; - -### External links - -* [Greasy Fork](https://greasyfork.org/scripts/171) -* [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_News_Feed_Filter) -* [MonkeyGuts](https://monkeyguts.com/code.php?id=95) +- **Actions** + + - Commits + + - Pushed + - Comments + + - Repo + + - Created + + - Public + + - Forked + + - Deleted + + - Release + + - Branch + + - Created + - Deleted + + - Tag + + - Added + - Removed + + - Follow + + - Starred + + - Wiki + + - Created + - Edited + +- **Repositories** + + - _Variable on the repos currently in your news list._ + +- **Users** + + - _Variable on the users currently in your news list._ + +## Screenshot + +![Github News Feed Filter screenshot](https://github.com/jerone/UserScripts/raw/master/Github_News_Feed_Filter/screenshot.png) + +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **8.2.8** + + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). + +- **8.2.7** + + - 🐛 Fix after another layout change. Refixes [#68](https://github.com/jerone/UserScripts/issues/68). + +- **8.2.6** + + - 🐛 Fix after another layout change. Refixes [#68](https://github.com/jerone/UserScripts/issues/68) with [#140](https://github.com/jerone/UserScripts/pull/140) (thanks [@darkred](https://github.com/darkred)). + +- **8.2.5** + + - 🐛 Fix showing filter. Fixes [#137](https://github.com/jerone/UserScripts/issues/137). + +- **8.2.4** + + - 🐛 Nav styling. Fixes [#130](https://github.com/jerone/UserScripts/issues/130) and closes [#132](https://github.com/jerone/UserScripts/issues/132) (thanks [@darkred](https://github.com/darkred)). + +- **8.2.3** + + - ✨ Re-added of the "Issues" filter ( Issues|Labeled ) which was removed per [#121 (comment)](https://github.com/jerone/UserScripts/issues/121#issuecomment-336629514) after another GitHub site update (by [@darkred](https://github.com/darkred)). + +- **8.2.2** + + - 🐛 Fix after another layout change. + +- **8.2.1** + + - 🐛 Fix for 'Actions' tab|'Wiki' being empty after GitHub site update (fixed by [@darkred](https://github.com/darkred) in [#127](https://github.com/jerone/UserScripts/issues/127)). + - 🐛 Fix missing created repo actions. + +- **8.2.0** + + - 🐛 Fixed issues after GitHub site update ([#124](https://github.com/jerone/UserScripts/issues/124)). + +- **8.1.1** + + - 🐛 Fix the 'Repositories' tab being empty ([#124](https://github.com/jerone/UserScripts/issues/124), fixed by [@darkred](https://github.com/darkred) in [#126](https://github.com/jerone/UserScripts/pull/126)). + +- **8.1.0** + + - 🐛 Ignore repo detection on follow alerts. + - ✨ Filter by follow action. + +- **8.0.0** + + - Fixed issues after GitHub site update ([#121](https://github.com/jerone/UserScripts/issues/121)). + + GitHub completely redesigned the news feed and removed the issue, PR, member adding and gist related news items. + +- **7.2.0** + + - ✨ Filter by user. + +- **7.1.0** + + - 🐛 Fixed issues after layout updates. Closes [#114](https://github.com/jerone/UserScripts/pull/114). + +- **7.0.1** + + - 🐛 Fixed falsely identification branch creation and deletion. + +- **7.0.0** + + - Restored icons after GitHub switching to SVG. + +- **6.2** + + - ✨ Filter by repo. Fixes [#70](https://github.com/jerone/UserScripts/issues/70). + +- **6.1** + + - 🐛 Fixed counting repo releases as tag actions. + - ✨ Split wiki filter in created and edited. + +- **6.0** + + - Fixed issues after GitHub site update ([#68](https://github.com/jerone/UserScripts/issues/68)). + +- **5.3** + + - Added filter history support. + +- **5.2** + + - Fixed issues after GitHub site update ([#6](https://github.com/jerone/UserScripts/issues/6)). + +- **5.1** + + - Added support for user public activity. + +- **5.0** + + - More filters added. + +- **4.6** + + - Show message when filter has no feed items. + +- **4.5** + + - Added branch deleting support. + +- **4.4** + + - Added support for organizations. + - Added commit comments. + +- **4.3** + + - Reordered menu. + - Expanded Gist create & update. + - Changed Starred in User actions and added member add. + +- **4.2** + + - Added support for Scriptish. + +- **4.1** + + - Added fork filter. + - Added sub-filters for issues (comments, opened, closed, reopened). + +- **4.0** + + - Better integrated menu style. + +- **3.1** + + - Moved PR comments to PR filter. + +- **3.0** + + - Added Stars, Repo and Wiki filter. + - Moved Comments to Issues filter. + - Made menu lower. + +- **2.0** + + - Added Pull Requests filter. + +- **1.0** + + - Initial version. + +## Contributors + +- [darkred](https://github.com/darkred) + +## External links + +- [Greasy Fork](https://greasyfork.org/scripts/171-github-news-feed-filter) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_News_Feed_Filter) diff --git a/Github_News_Feed_Filter/screenshot.jpg b/Github_News_Feed_Filter/screenshot-1.jpg similarity index 100% rename from Github_News_Feed_Filter/screenshot.jpg rename to Github_News_Feed_Filter/screenshot-1.jpg diff --git a/Github_News_Feed_Filter/screenshot-2.png b/Github_News_Feed_Filter/screenshot-2.png new file mode 100644 index 0000000..d13da5e Binary files /dev/null and b/Github_News_Feed_Filter/screenshot-2.png differ diff --git a/Github_News_Feed_Filter/screenshot.png b/Github_News_Feed_Filter/screenshot.png new file mode 100644 index 0000000..c919bc7 Binary files /dev/null and b/Github_News_Feed_Filter/screenshot.png differ diff --git a/Github_Pages_Linker/Github_Pages_Linker.user.js b/Github_Pages_Linker/Github_Pages_Linker.user.js new file mode 100644 index 0000000..e4e0428 --- /dev/null +++ b/Github_Pages_Linker/Github_Pages_Linker.user.js @@ -0,0 +1,124 @@ +// ==UserScript== +// @name Github Pages Linker +// @id Github_Pages_Linker@https://github.com/jerone/UserScripts +// @namespace https://github.com/jerone/UserScripts/ +// @description Add a link to Github Pages (gh-pages) when available. +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Pages_Linker +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Pages_Linker +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Pages_Linker/Github_Pages_Linker.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Pages_Linker/Github_Pages_Linker.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @version 1.2.5 +// @grant none +// @run-at document-end +// @include https://github.com/* +// ==/UserScript== + +/* eslint security/detect-object-injection: "off" */ + +(function () { + String.format = function (string) { + var args = Array.prototype.slice.call(arguments, 1, arguments.length); + return string.replace(/{(\d+)}/g, function (match, number) { + return typeof args[number] !== "undefined" ? args[number] : match; + }); + }; + + function addLink() { + if (document.getElementById("GithubPagesLinker")) { + return; + } + + var meta = document.querySelector("main h1"); + if (!meta) { + return; + } + + var branchSelector = document.querySelector("#branch-select-menu"); + if (!branchSelector) { + return; + } + + var branch = document.querySelector( + '.SelectMenu-item[href$="/tree/gh-pages"]', + ); + if (branch) { + createLink(branch); + } else { + const observer = new MutationObserver(function () { + var branch2 = document.querySelector( + '.SelectMenu-item[href$="/tree/gh-pages"]', + ); + if (branch2) { + observer.disconnect(); + createLink(branch2); + } + }); + + observer.observe(branchSelector, { + subtree: true, + childList: true, + }); + + var dropdown = branchSelector.querySelector("ref-selector"); + window.setTimeout(function () { + dropdown.dispatchEvent( + new CustomEvent("container-mouseover", { bubbles: true }), + ); + }, 100); + } + + function createLink(branch2) { + var tree = branch2.getAttribute("href").split("/"); // `/{user}/{repo}/tree/gh-pages`; + var url = String.format( + "{0}//{1}.github.io/{2}/", + tree[0], + tree[3], + tree[4], + ); + + var div = document.createElement("small"); + div.id = "GithubPagesLinker"; + meta.parentNode.insertBefore(div, meta.nextSibling); + + var img = document.createElement("img"); + img.setAttribute( + "src", + "https://github.githubassets.com/images/icons/emoji/octocat.png", + ); + img.setAttribute("align", "absmiddle"); + img.classList.add("emoji"); + img.style.height = "16px"; + img.style.width = "16px"; + div.appendChild(img); + + div.appendChild(document.createTextNode(" ")); + + var a = document.createElement("a"); + a.setAttribute("href", "{https}://pages.github.com"); + a.setAttribute("title", "More info about gh-pages..."); + a.style.color = "inherit"; + a.appendChild(document.createTextNode("Github Pages")); + div.appendChild(a); + + div.appendChild(document.createTextNode(": ")); + + var aa = document.createElement("a"); + aa.setAttribute("href", url); + aa.appendChild(document.createTextNode(url)); + div.appendChild(aa); + } + } + + // Init; + addLink(); + + // On pjax; + document.addEventListener("pjax:end", addLink); +})(); diff --git a/Github_Pages_Linker/README.md b/Github_Pages_Linker/README.md new file mode 100644 index 0000000..162cd6f --- /dev/null +++ b/Github_Pages_Linker/README.md @@ -0,0 +1,59 @@ +# [Github Pages Linker](https://github.com/jerone/UserScripts/tree/master/Github_Pages_Linker) (abandoned) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Pages_Linker/Github_Pages_Linker.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Pages_Linker/Github_Pages_Linker.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +Add a link to GitHub Pages (gh-pages) when available. + +## Screenshot + +![Github Pages Linker screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Pages_Linker/screenshot.jpg) + +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **1.2.3** + + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). + +- **1.2.2** + + - Fixed issues after layout updates + +- **1.2.1** + + - Fix 301 Moved Permanently redirects. Fixes [#72](https://github.com/jerone/UserScripts/issues/72) + +- **1.2** + + - Don't add the link if it already exists (closes [#63](https://github.com/jerone/UserScripts/pull/63)) + +- **1.1** + + - Added class to identify element + +- **1.0** + + - Initial version + +## Notes + +Test cases: + +- with + +## Contributors + +- [Efreak](https://github.com/Efreak) + +## External links + +- [Greasy Fork](https://greasyfork.org/scripts/6519-github-pages-linker) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Pages_Linker) diff --git a/Github_Pages_Linker/screenshot.jpg b/Github_Pages_Linker/screenshot.jpg new file mode 100644 index 0000000..1a4953b Binary files /dev/null and b/Github_Pages_Linker/screenshot.jpg differ diff --git a/Github_Pull_Request_From/Github_Pull_Request_From.user.js b/Github_Pull_Request_From/Github_Pull_Request_From.user.js index 526f408..22f5c3f 100644 --- a/Github_Pull_Request_From/Github_Pull_Request_From.user.js +++ b/Github_Pull_Request_From/Github_Pull_Request_From.user.js @@ -1,48 +1,70 @@ // ==UserScript== -// @name Github Pull Request From Link -// @namespace https://github.com/jerone/UserScripts/ -// @description Make pull request original branch linkable -// @author jerone -// @copyright 2014+, jerone (http://jeroenvanwarmerdam.nl) -// @license GNU GPLv3 -// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From -// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From -// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js -// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js -// @version 12 -// @grant none -// @include https://github.com/*/* +// @name Github Pull Request From Link +// @namespace https://github.com/jerone/UserScripts/ +// @description Make pull request branches linkable +// @author jerone +// @copyright 2014+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @version 20.1 +// @grant none +// @include https://github.com/*/pull/* +// @exclude https://github.com/*/*.diff +// @exclude https://github.com/*/*.patch // ==/UserScript== -/* global unsafeWindow */ -(function(unsafeWindow) { +/* eslint security/detect-object-injection: "off" */ - String.format = function(string) { +(function () { + String.format = function (string) { var args = Array.prototype.slice.call(arguments, 1, arguments.length); - return string.replace(/{(\d+)}/g, function(match, number) { + return string.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== "undefined" ? args[number] : match; }); }; - // init; function init() { - var repo = document.querySelector(".js-current-repository").textContent; - Array.prototype.forEach.call(document.querySelectorAll("span.commit-ref.current-branch"), function(treeSpan) { - if (treeSpan.querySelector(".unknown-repo")) { return; } - var tree = treeSpan.textContent.trim().split(":"); - var treeLink = document.createElement("a"); - treeLink.setAttribute("href", String.format("https://github.com/{0}/{1}/tree/{2}", - tree.shift(), // user; - repo, // repository; - tree.join(":"))); // branch; - treeLink.innerHTML = treeSpan.innerHTML; - treeSpan.innerHTML = ""; - treeSpan.appendChild(treeLink); - }); + Array.prototype.filter + .call( + document.querySelectorAll( + ".commit-ref[title], .base-ref[title], .head-ref[title]", + ), + function (treeSpan) { + return !treeSpan.querySelector(".unknown-repo"); + }, + ) + .forEach(function (treeSpan) { + const [repo, branch] = treeSpan.title.split(":"); + var treeParts = treeSpan.querySelectorAll( + ".css-truncate-target", + ); + var treeLink = document.createElement("a"); + + // Show underline on hover. + Array.prototype.forEach.call(treeParts, function (part) { + part.style.display = "inline"; + }); + + treeLink.setAttribute( + "href", + String.format("/{0}/tree/{1}", repo, branch), + ); + treeLink.innerHTML = treeSpan.innerHTML; + treeSpan.innerHTML = ""; + treeSpan.appendChild(treeLink); + }); } - init(); - // on pjax; - unsafeWindow.$(document).on("pjax:end", init); // `pjax:end` also runs on history back; + // Page load. + init(); -})(typeof unsafeWindow !== "undefined" ? unsafeWindow : window); + // On pjax. + document.addEventListener("pjax:end", init); +})(); diff --git a/Github_Pull_Request_From/README.md b/Github_Pull_Request_From/README.md index 104a4a2..7de607b 100644 --- a/Github_Pull_Request_From/README.md +++ b/Github_Pull_Request_From/README.md @@ -1,46 +1,67 @@ -# [Github Pull Request From Link](https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From) +# [Github Pull Request From Link](https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From) (abandoned) -[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.jpg)](https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js) +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) -### Description +## Description -Make pull request original branch linkable. +Make pull request branches linkable. -### Screenshot +## Screenshot ![Github Pull Request From Link screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/screenshot.jpg) -### Compatible - -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Scriptish.png) Scriptish](https://addons.mozilla.org/firefox/addon/scriptish/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox Desktop](http://www.mozilla.org/en-US/firefox/fx/#desktop). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Chromium.png) Native](http://www.chromium.org/developers/design-documents/user-scripts) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/GoogleChrome.png) Google Chrome Desktop](https://www.google.com/chrome/). -* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) TamperMonkey](http://tampermonkey.net) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/GoogleChrome.png) Google Chrome Desktop](https://www.google.com/chrome/). - -Please [notify](https://github.com/jerone/UserScripts/issues/new?title=Userscript%20%3Cname%3E%20%28%3Cversion%3E%29%20also%20works%20in%20%3Cbrowser%3E%20on%20%3Cdesktop/device%3E) when this userscript is successfully tested in another browser... - -### Version History - -* **12** - * Don't link "unknown repository" (fixes https://github.com/jerone/UserScripts/issues/22); -* **11** - * Fixed issues after recent layout updates; - * Added native & TamperMonkey for Google Chrome compatibility; -* **10** - * Initial version; - -### Notes - -Test cases: - -* https://github.com/jerone/UserScripts/pull/12 (2 valid, 2 missing); - -### Contributions - -* Changes based on Firefox extension [GitHubExtIns](https://github.com/diegocr/GitHubExtIns) by [Diego Casorran](https://github.com/diegocr). - -### External links - -* [Greasy Fork](https://greasyfork.org/scripts/64) -* [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Pull_Request_From_Link) -* [MonkeyGuts](https://monkeyguts.com/code.php?id=96) +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **20.1** + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). +- **20.0** + - Fix url on forks where another repo name is choosen. Fixes [145](https://github.com/jerone/UserScripts/issues/145). + - Run on more elements. +- **19.1** + - Don't run on repo search page. +- **19** + - Don't run on .patch & .diff route. +- **18** + - Use a host-relative url so that github enterprise is supported. Fixes [#117](https://github.com/jerone/UserScripts/issues/117). +- **17** + - Fixed issues after recent layout updates. Fixes [#111](https://github.com/jerone/UserScripts/issues/111). +- **16** + - Show underline. Fixes [#93](https://github.com/jerone/UserScripts/issues/93). +- **15** + - Fixed invalid chars in url. +- **14** + - Fixed issues after recent layout updates. +- **13** + - Add missing tree author. Fixes [#51](https://github.com/jerone/UserScripts/issues/51). +- **12** + - Don't link "unknown repository". Fixes [#22](https://github.com/jerone/UserScripts/issues/22). +- **11** + - Fixed issues after recent layout updates. + - Added native & TamperMonkey for Google Chrome compatibility. +- **10** + - Initial version. + +## Notes + +Use cases: + +- (2 valid, 1 missing). +- (1 mine, 1 extern). +- (3 without username). +- (fork renamed). + +## Contributions + +- Changes based on Firefox extension [GitHubExtIns](https://github.com/diegocr/GitHubExtIns) by [Diego Casorran](https://github.com/diegocr). + +## External links + +- [Greasy Fork](https://greasyfork.org/scripts/64-github-pull-request-from-link) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Pull_Request_From_Link) diff --git a/Github_Reply_Comments/Github_Reply_Comments.user.js b/Github_Reply_Comments/Github_Reply_Comments.user.js new file mode 100644 index 0000000..bc094ca --- /dev/null +++ b/Github_Reply_Comments/Github_Reply_Comments.user.js @@ -0,0 +1,294 @@ +// ==UserScript== +// @name Github Reply Comments +// @namespace https://github.com/jerone/UserScripts +// @description Easy reply to Github comments +// @author jerone +// @copyright 2016+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_Reply_Comments +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_Reply_Comments +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_Reply_Comments/Github_Reply_Comments.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Reply_Comments/Github_Reply_Comments.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @version 1.0.6 +// @icon https://github.githubassets.com/pinned-octocat.svg +// @grant none +// @include https://github.com/* +// @include https://gist.github.com/* +// @require https://unpkg.com/turndown@5.0.3/dist/turndown.js +// @require https://unpkg.com/turndown-plugin-gfm@1.0.2/dist/turndown-plugin-gfm.js +// @require https://unpkg.com/turndown-plugin-github-code-snippet@1.0.2/turndown-plugin-github-code-snippet.js +// ==/UserScript== + +// cSpell:ignore textareas, previewable, tooltipped +/* eslint security/detect-object-injection: "off" */ +/* global TurndownService,turndownPluginGfm,turndownPluginGithubCodeSnippet */ + +(function () { + String.format = function (string) { + var args = Array.prototype.slice.call(arguments, 1, arguments.length); + return string.replace(/{(\d+)}/g, function (match, number) { + return typeof args[number] !== "undefined" ? args[number] : match; + }); + }; + + function turndownPluginGitHubAlert(turndownService) { + turndownService.addRule("gfm-alert", { + filter: function (node, _options) { + return ( + node.nodeName === "DIV" && + node.classList.contains("markdown-alert") + ); + }, + replacement: function (content, node, options) { + const variant = node + .querySelector(".markdown-alert-title") + .innerText.trim(); + content = content.replace(/^\n+|\n+$/g, ""); + content = content.replace( + // eslint-disable-next-line security/detect-non-literal-regexp + new RegExp("^" + variant), + "[!" + variant.toUpperCase() + "]", + ); + return options.rules.blockquote.replacement(content); + }, + }); + } + + var turndownService = new TurndownService({ + headingStyle: "atx", + codeBlockStyle: "fenced", + hr: "***", + }); + turndownService.use(turndownPluginGfm.gfm); + turndownService.use(turndownPluginGithubCodeSnippet); + turndownService.use(turndownPluginGitHubAlert); + + function getCommentTextarea(replyBtn) { + var newComment = replyBtn; + while ( + newComment && + !newComment.classList.contains("js-quote-selection-container") + ) { + newComment = newComment.parentNode; + } + + var inlineComment = newComment.querySelector( + ".js-inline-comment-form-container", + ); + if (inlineComment) { + inlineComment.classList.add("open"); + } + + var textareas = newComment.querySelectorAll( + ":scope > :not(.last-review-thread) .js-comment-field:not(.github-writer-ckeditor)", + ); + return textareas[textareas.length - 1]; + } + + function getCommentMarkdown(comment) { + var commentText = ""; + + // Use raw comment when available. + // Extra scope is needed to get the correct comment field, which is not an "Reference new issue" modal (with org rights). + var commentForm = comment.querySelector( + ":scope > .js-comment-update .js-comment-field", + ); + if (commentForm) { + commentText = commentForm.value; + } + + // Convert comment HTML to markdown. + if (!commentText) { + // Clone it, so we can alter the HTML a bit, without modifying the page. + var commentBody = comment + .querySelector(".comment-body") + .cloneNode(true); + + // Skip empty PR description. + if ( + commentBody + .querySelector("em") + ?.innerText.includes("No description provided.") + ) { + return ""; + } + + // Remove 'Toggle code wrap' buttons from https://greasyfork.org/en/scripts/18789-github-toggle-code-wrap + Array.prototype.forEach.call( + commentBody.querySelectorAll(".ghd-wrap-toggle"), + function (ghd) { + ghd.remove(); + }, + ); + + // Refined GitHub adds a small avatar to username mention. See https://github.com/refined-github/refined-github/blob/main/source/features/small-user-avatars.tsx + Array.prototype.forEach.call( + commentBody.querySelectorAll(".rgh-small-user-avatars"), + function (rgh) { + rgh.remove(); + }, + ); + + // GitHub add an extra new line, which is converted by Turndown. + Array.prototype.forEach.call( + commentBody.querySelectorAll("pre code"), + function (pre) { + pre.innerHTML = pre.innerHTML.replace(/\n$/g, ""); + }, + ); + + commentText = turndownService.turndown(commentBody.innerHTML); + } + + return commentText; + } + + function addReplyButtons() { + Array.prototype.forEach.call( + document.querySelectorAll(".comment, .review-comment"), + function (comment) { + var oldReply = comment.querySelector( + ".GithubReplyComments, .GithubCommentEnhancerReply", + ); + if (oldReply) { + oldReply.parentNode.removeChild(oldReply); + } + + var header = comment.querySelector( + ":scope > :not(.minimized-comment) .timeline-comment-header", + ), + actions = comment.querySelector( + ":scope > :not(.minimized-comment) .timeline-comment-actions", + ); + + if (!header) { + header = actions; + } + + if (!actions) { + if (!header) { + return; + } + actions = document.createElement("div"); + actions.classList.add("timeline-comment-actions"); + header.insertBefore(actions, header.firstElementChild); + } + + var reply = document.createElement("button"); + reply.setAttribute("type", "button"); + reply.setAttribute("title", "Reply to this comment"); + reply.setAttribute("aria-label", "Reply to this comment"); + reply.classList.add( + "GithubReplyComments", + "btn-link", + "timeline-comment-action", + "tooltipped", + "tooltipped-ne", + ); + reply.addEventListener("click", function (e) { + e.preventDefault(); + + var timestamp = comment.querySelector( + ".js-timestamp, .timestamp", + ); + + var commentText = getCommentMarkdown(comment); + commentText = commentText + .trim() + .split("\n") + .map(function (line) { + return "> " + line; + }) + .join("\n"); + + var newComment = getCommentTextarea(this); + + var author = comment.querySelector(".author"); + var authorLink = + location.origin + + (author.getAttribute("href") || + "/" + author.textContent); + + var text = newComment.value.length > 0 ? "\n" : ""; + text += String.format( + '[**@{0}**]({1}) commented on [{2}]({3} "{4} - Replied by Github Reply Comments"):\n{5}\n\n', + author.textContent, + authorLink, + timestamp.firstElementChild.getAttribute("title"), + timestamp.href, + timestamp.firstElementChild.getAttribute("datetime"), + commentText, + ); + + newComment.value += text; + newComment.setSelectionRange( + newComment.value.length, + newComment.value.length, + ); + //newComment.closest('.previewable-comment-form').querySelector('.js-write-tab').click(); + newComment.focus(); + + // This will enable the "Comment" button, when there was no comment text yet. + newComment.dispatchEvent( + new CustomEvent("change", { + bubbles: true, + cancelable: false, + }), + ); + + // This will render GitHub Writer - https://github.com/ckeditor/github-writer + // https://github.com/ckeditor/github-writer/blob/8dbc12cb01b7903d0d6c90202078214a8637de6d/src/app/plugins/quoteselection.js#L116-L127 + const githubWriter = newComment.closest( + [ + "form.js-new-comment-form[data-github-writer-id]", + "form.js-inline-comment-form[data-github-writer-id]", + ].join(), + ); + if (githubWriter) { + window.postMessage( + { + type: "GitHub-Writer-Quote-Selection", + id: Number( + githubWriter.getAttribute( + "data-github-writer-id", + ), + ), + text: text, + }, + "*", + ); + } + }); + + var svg = document.createElementNS( + "http://www.w3.org/2000/svg", + "svg", + ); + svg.classList.add("octicon", "octicon-mail-reply"); + svg.setAttribute("height", "16"); + svg.setAttribute("width", "16"); + reply.appendChild(svg); + var path = document.createElementNS( + "http://www.w3.org/2000/svg", + "path", + ); + path.setAttribute( + "d", + "M6 2.5l-6 4.5 6 4.5v-3c1.73 0 5.14 0.95 6 4.38 0-4.55-3.06-7.05-6-7.38v-3z", + ); + svg.appendChild(path); + + actions.appendChild(reply); + }, + ); + } + + // init; + addReplyButtons(); + + // on pjax; + document.addEventListener("pjax:end", addReplyButtons); +})(); diff --git a/Github_Reply_Comments/README.md b/Github_Reply_Comments/README.md new file mode 100644 index 0000000..01659df --- /dev/null +++ b/Github_Reply_Comments/README.md @@ -0,0 +1,97 @@ +# [Github Reply Comments](https://github.com/jerone/UserScripts/tree/master/Github_Reply_Comments) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_Reply_Comments/Github_Reply_Comments.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_Reply_Comments/Github_Reply_Comments.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +You can reply to issues, pull requests and inline comments by pressing the +reply button on an comment. + +## Screenshot + +![Github Reply Comments Screenshot](https://github.com/jerone/UserScripts/raw/master/Github_Reply_Comments/screenshot.jpg) + +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- version **next** + + - 🐛 Ignore "Reference new issue" modals when quoting. + - 🐛 Skip empty PR description. + - Add support for [GitHub alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts). + +- version **1.0.6** + + - 🐛 Fix broken comment form. Fixes ([#168](https://github.com/jerone/UserScripts/issues/168)). + +- version **1.0.5** + + - 🐛 Enable the Comment button. Fixes ([#152](https://github.com/jerone/UserScripts/issues/152)). + - Compatible (partially) with [GitHub Writer](https://github.com/ckeditor/github-writer#readme). + +- version **1.0.4** + + - 🐛 Fix link to authors with spaces in their name. Fixes ([#150](https://github.com/jerone/UserScripts/issues/150)). + +- version **1.0.3** + + - 🐛 Fix broken timestamp detection ([#149](https://github.com/jerone/UserScripts/issues/149)). + +- version **1.0.2** + + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). + +- version **1.0.1** + + - Use atx style headings, fenced code blocks, dense hr style. + - Remove trailing new line & ['Toggle code wrap'](https://greasyfork.org/en/scripts/18789-github-toggle-code-wrap) button from code blocks. + - Update [turndown-plugin-github-code-snippet](https://github.com/jerone/turndown-plugin-github-code-snippet). + +- version **1.0.0** + + - Replace to-markdown with [Turndown](https://github.com/domchristie/turndown). + - Some clean up. + - Always fallback to Turndown when original comment code is not available. + - Convert code snippets back to links. Fixes [#144](https://github.com/jerone/UserScripts/issues/133). + +- version **0.1.2** + + - Fix reply button for commits & reviews. Fixes [#133](https://github.com/jerone/UserScripts/issues/133). + +- version **0.1.1** + + - Fix reply button for reviews. Fixes [#125](https://github.com/jerone/UserScripts/issues/125). + +- version **0.1.0** + + - Initial version. + +## Test cases + +- [https://github.com/jerone/UserScripts/issues/1](https://github.com/jerone/UserScripts/issues/1) + (issue comments) + +- [https://github.com/jerone/UserScripts/commit/036935761fc47e8c448378f2730a6ae8548fa8df](https://github.com/jerone/UserScripts/commit/036935761fc47e8c448378f2730a6ae8548fa8df) + (commit comments & inline comments) + +- [https://github.com/jerone/UserScripts/pull/49](https://github.com/jerone/UserScripts/pull/49) + (PR comments & PR review comments & [PR commit comments](https://github.com/jerone/UserScripts/pull/49/files)) + +- [https://gist.github.com/jerone/9526258](https://gist.github.com/jerone/9526258) (comments) + +## Dependencies + +- [Turndown](https://github.com/domchristie/turndown) - Convert HTML into Markdown with JavaScript. +- [turndown-plugin-gfm](https://github.com/domchristie/turndown-plugin-gfm/blob/master/README.md) - A Turndown plugin which adds GitHub Flavored Markdown extensions. +- [turndown-plugin-github-code-snippet](https://github.com/jerone/turndown-plugin-github-code-snippet) - A Turndown plugin to convert GitHub code snippet in comments back into normal links. + +## External links + +- [Greasy Fork](https://greasyfork.org/en/scripts/38372-github-reply-comments) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_Reply_Comments) diff --git a/Github_Reply_Comments/screenshot.jpg b/Github_Reply_Comments/screenshot.jpg new file mode 100644 index 0000000..f199d7f Binary files /dev/null and b/Github_Reply_Comments/screenshot.jpg differ diff --git a/Github_User_Info/Github_User_Info.user.js b/Github_User_Info/Github_User_Info.user.js new file mode 100644 index 0000000..3d040f3 --- /dev/null +++ b/Github_User_Info/Github_User_Info.user.js @@ -0,0 +1,598 @@ +// ==UserScript== +// @name Github User Info +// @id Github_User_Info@https://github.com/jerone/UserScripts +// @namespace https://github.com/jerone/UserScripts +// @description Show inline user information on avatar hover. +// @author jerone +// @copyright 2015+, jerone (https://github.com/jerone) +// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode +// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt +// @homepage https://github.com/jerone/UserScripts/tree/master/Github_User_Info +// @homepageURL https://github.com/jerone/UserScripts/tree/master/Github_User_Info +// @downloadURL https://github.com/jerone/UserScripts/raw/master/Github_User_Info/Github_User_Info.user.js +// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_User_Info/Github_User_Info.user.js +// @supportURL https://github.com/jerone/UserScripts/issues +// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW +// @icon https://github.githubassets.com/pinned-octocat.svg +// @version 0.4.1 +// @grant GM_xmlhttpRequest +// @grant GM_setValue +// @grant GM_getValue +// @grant unsafeWindow +// @run-at document-end +// @include https://github.com/* +// @include https://gist.github.com/* +// ==/UserScript== + +// cSpell:ignore leaderboard, vcard, transform +/* eslint security/detect-object-injection: "off" */ + +(function () { + function proxy(fn) { + return function proxyScope() { + var that = this; + return function proxyEvent(e) { + var args = that.slice(0); // clone + args.unshift(e); // prepend event + fn.apply(this, args); + }; + }.call([].slice.call(arguments, 1)); + } + + var _timer; + + var userMenu = document.createElement("div"); + userMenu.style = + "display: none;" + + "background-color: #F5F5F5;" + + "border-radius: 3px;" + + "border: 1px solid #DDDDDD;" + + "box-shadow: 0 0 10px rgba(0, 0, 1, 0.1);" + + "font-size: 11px;" + + "padding: 10px;" + + "position: absolute;" + + "width: 335px;" + + "z-index: 99;"; + userMenu.classList.add("GithubUserInfo"); + userMenu.addEventListener("mouseleave", function mouseleave() { + // console.log('GithubUserInfo:userMenu', 'mouseleave'); + window.clearTimeout(_timer); + userMenu.style.display = "none"; + }); + document.body.appendChild(userMenu); + + var userAvatar = document.createElement("a"); + userAvatar.style = + "width: 100px;" + + "height: 100px;" + + "float: left;" + + "margin-bottom: 10px;"; + userMenu.appendChild(userAvatar); + var userAvatarImg = document.createElement("img"); + userAvatarImg.style = + "border-radius: 3px;" + + "transition-property: height, width;" + + "transition-duration: 0.5s;"; + userAvatar.appendChild(userAvatarImg); + + var userInfo = document.createElement("div"); + userInfo.style = "width: 100%;" + "padding-left: 102px;"; + userMenu.appendChild(userInfo); + + var userName = document.createElement("div"); + userName.style = + "padding-left: 24px;" + + "white-space: nowrap;" + + "overflow: hidden;" + + "text-overflow: ellipsis;" + + "font-weight: bold;"; + userInfo.appendChild(userName); + + var userCompany = document.createElement("div"); + userCompany.style = + "display: none;" + + "white-space: nowrap;" + + "overflow: hidden;" + + "text-overflow: ellipsis;"; + userInfo.appendChild(userCompany); + var userCompanyIcon = document.createElement("span"); + userCompanyIcon.classList.add("octicon", "octicon-organization"); + userCompanyIcon.style = + "width: 24px;" + "text-align: center;" + "color: #CCC;"; + userCompany.appendChild(userCompanyIcon); + var userCompanyText = document.createElement("span"); + userCompany.appendChild(userCompanyText); + var userCompanyAdmin = document.createElement("span"); + userCompanyAdmin.style = + "display: none;" + + "margin-left: 5px;" + + "position: relative;" + + "top: -1px;" + + "padding: 2px 5px;" + + "font-size: 10px;" + + "font-weight: bold;" + + "color: #FFF;" + + "text-transform: uppercase;" + + "background-color: #4183C4;" + + "border-radius: 3px;"; + userCompanyAdmin.appendChild(document.createTextNode("Staff")); + userCompany.appendChild(userCompanyAdmin); + + var userLocation = document.createElement("div"); + userLocation.style = + "display: none;" + + "white-space: nowrap;" + + "overflow: hidden;" + + "text-overflow: ellipsis;"; + userInfo.appendChild(userLocation); + var userLocationIcon = document.createElement("span"); + userLocationIcon.classList.add("octicon", "octicon-location"); + userLocationIcon.style = + "width: 24px;" + "text-align: center;" + "color: #CCC;"; + userLocation.appendChild(userLocationIcon); + var userLocationText = document.createElement("a"); + userLocationText.setAttribute("target", "_blank"); + userLocation.appendChild(userLocationText); + + var userMail = document.createElement("div"); + userMail.style = + "display: none;" + + "white-space: nowrap;" + + "overflow: hidden;" + + "text-overflow: ellipsis;"; + userInfo.appendChild(userMail); + var userMailIcon = document.createElement("span"); + userMailIcon.classList.add("octicon", "octicon-mail"); + userMailIcon.style = + "width: 24px;" + "text-align: center;" + "color: #CCC;"; + userMail.appendChild(userMailIcon); + var userMailText = document.createElement("a"); + userMail.appendChild(userMailText); + + var userLink = document.createElement("div"); + userLink.style = + "display: none;" + + "white-space: nowrap;" + + "overflow: hidden;" + + "text-overflow: ellipsis;"; + userInfo.appendChild(userLink); + var userLinkIcon = document.createElement("span"); + userLinkIcon.classList.add("octicon", "octicon-link"); + userLinkIcon.style = + "width: 24px;" + "text-align: center;" + "color: #CCC;"; + userLink.appendChild(userLinkIcon); + var userLinkText = document.createElement("a"); + userLinkText.setAttribute("target", "_blank"); + userLink.appendChild(userLinkText); + + var userJoined = document.createElement("div"); + userJoined.style = + "display: none;" + + "white-space: nowrap;" + + "overflow: hidden;" + + "text-overflow: ellipsis;"; + userInfo.appendChild(userJoined); + var userJoinedIcon = document.createElement("span"); + userJoinedIcon.classList.add("octicon", "octicon-clock"); + userJoinedIcon.style = + "width: 24px;" + "text-align: center;" + "color: #CCC;"; + userJoined.appendChild(userJoinedIcon); + userJoined.appendChild(document.createTextNode("Joined ")); + var userJoinedText = unsafeWindow.document.createElement("relative-time"); // https://github.com/github/time-elements + userJoinedText.setAttribute("day", "numeric"); + userJoinedText.setAttribute("month", "short"); + userJoinedText.setAttribute("year", "numeric"); + userJoined.appendChild(userJoinedText); + + var userCounts = document.createElement("div"); + userCounts.style = + "border-top: 1px solid #EEE;" + + "clear: left;" + + "display: flex;" + + "justify-content: space-around;" + + "text-align: center;" + + "white-space: nowrap;"; + userMenu.appendChild(userCounts); + + var userFollowers = document.createElement("a"); + userFollowers.style = "display: none;" + "text-decoration: none;"; + userFollowers.classList.add("vcard-stat"); + userFollowers.setAttribute("target", "_blank"); + userFollowers.setAttribute("title", "Followers"); + userCounts.appendChild(userFollowers); + var userFollowersCount = document.createElement("strong"); + userFollowersCount.style = "display: block;" + "font-size: 28px;"; + userFollowers.appendChild(userFollowersCount); + var userFollowersText = document.createElement("span"); + userFollowersText.appendChild(document.createTextNode("Followers")); + userFollowersText.classList.add("text-muted"); + userFollowers.appendChild(userFollowersText); + + var userFollowing = document.createElement("a"); + userFollowing.style = "display: none;" + "text-decoration: none;"; + userFollowing.classList.add("vcard-stat"); + userFollowing.setAttribute("target", "_blank"); + userFollowing.setAttribute("title", "Following"); + userCounts.appendChild(userFollowing); + var userFollowingCount = document.createElement("strong"); + userFollowingCount.style = "display: block;" + "font-size: 28px;"; + userFollowing.appendChild(userFollowingCount); + var userFollowingText = document.createElement("span"); + userFollowingText.appendChild(document.createTextNode("Following")); + userFollowingText.classList.add("text-muted"); + userFollowing.appendChild(userFollowingText); + + var userRepos = document.createElement("a"); + userRepos.style = "display: none;" + "text-decoration: none;"; + userRepos.classList.add("vcard-stat"); + userRepos.setAttribute("target", "_blank"); + userRepos.setAttribute("title", "Public repositories"); + userCounts.appendChild(userRepos); + var userReposCount = document.createElement("strong"); + userReposCount.style = "display: block;" + "font-size: 28px;"; + userRepos.appendChild(userReposCount); + var userReposText = document.createElement("span"); + userReposText.appendChild(document.createTextNode("Repos")); + userReposText.classList.add("text-muted"); + userRepos.appendChild(userReposText); + + var userOrgs = document.createElement("a"); + userOrgs.style = "display: none;" + "text-decoration: none;"; + userOrgs.classList.add("vcard-stat"); + userOrgs.setAttribute("target", "_blank"); + userOrgs.setAttribute("title", "Public organizations"); + userCounts.appendChild(userOrgs); + var userOrgsCount = document.createElement("strong"); + userOrgsCount.style = "display: block;" + "font-size: 28px;"; + userOrgs.appendChild(userOrgsCount); + var userOrgsText = document.createElement("span"); + userOrgsText.appendChild(document.createTextNode("Orgs")); + userOrgsText.classList.add("text-muted"); + userOrgs.appendChild(userOrgsText); + + var userMembers = document.createElement("a"); + userMembers.style = "display: none;" + "text-decoration: none;"; + userMembers.classList.add("vcard-stat"); + userMembers.setAttribute("target", "_blank"); + userMembers.setAttribute("title", "Public members"); + userCounts.appendChild(userMembers); + var userMembersCount = document.createElement("strong"); + userMembersCount.style = "display: block;" + "font-size: 28px;"; + userMembers.appendChild(userMembersCount); + var userMembersText = document.createElement("span"); + userMembersText.appendChild(document.createTextNode("Members")); + userMembersText.classList.add("text-muted"); + userMembers.appendChild(userMembersText); + + var userGists = document.createElement("a"); + userGists.style = "display: none;" + "text-decoration: none;"; + userGists.classList.add("vcard-stat"); + userGists.setAttribute("target", "_blank"); + userGists.setAttribute("title", "Public gists"); + userCounts.appendChild(userGists); + var userGistsCount = document.createElement("strong"); + userGistsCount.style = "display: block;" + "font-size: 28px;"; + userGists.appendChild(userGistsCount); + var userGistsText = document.createElement("span"); + userGistsText.appendChild(document.createTextNode("Gists")); + userGistsText.classList.add("text-muted"); + userGists.appendChild(userGistsText); + + var UPDATE_INTERVAL_DAYS = 7; + + function getData(elm) { + var username; + if (elm.getAttribute("alt")) { + username = elm.getAttribute("alt").replace("@", ""); + } else if (elm.parentNode.parentNode.querySelector(".author")) { + username = elm.parentNode.parentNode + .querySelector(".author") + .textContent.trim(); + } else { + return; + } + + var rect = elm.getBoundingClientRect(); + var position = { + top: rect.top + window.scrollY, + left: rect.left + window.scrollX, + }; + var avatarSize = { + height: elm.height, + width: elm.width, + }; + + var usersString = GM_getValue("users", "{}"); + var users = JSON.parse(usersString); + if (users[username]) { + var date = new Date(users[username].checked_at), + now = new Date(), + upDate = new Date( + now.setDate(now.getDate() - UPDATE_INTERVAL_DAYS), + ); + if (date > upDate) { + var data = users[username].data; + // console.log('GithubUserInfo:getData', 'CACHED', data); + fillData(defaultData(data), position, avatarSize); + } else { + // console.log('GithubUserInfo:getData', 'AJAX - OUTDATED', username, date, upDate); + fetchData(username, position, avatarSize); + } + } else { + // console.log('GithubUserInfo:getData', 'AJAX - NON-EXISTING', username); + fetchData(username, position, avatarSize); + } + } + + function fetchData(username, position, avatarSize) { + // console.log('GithubUserInfo:fetchData', username); + GM_xmlhttpRequest({ + method: "GET", + url: "https://api.github.com/users/" + username, + onload: proxy(parseUserData, position, avatarSize), + }); + } + + function parseUserData(response, position, avatarSize) { + var dataParsed = parseRawData(response.responseText); + if (!dataParsed) { + return; + } + var data = defaultData(normalizeData(dataParsed)); + // console.log('GithubUserInfo:parseUserData', data.username); + + GM_xmlhttpRequest({ + method: "GET", + url: "https://api.github.com/users/" + data.username + "/orgs", + onload: proxy(parseOrgsData, position, avatarSize, data), + }); + } + + function parseOrgsData(response, position, avatarSize, data) { + var dataParsed = parseRawData(response.responseText); + if (!dataParsed) { + return; + } + data.orgs = dataParsed.length; + // console.log('GithubUserInfo:parseOrgsData', data.username, data.orgs); + + switch (data.type) { + case "Organization": { + GM_xmlhttpRequest({ + method: "GET", + url: + "https://api.github.com/orgs/" + + data.username + + "/members", + onload: proxy(parseMembersData, position, avatarSize, data), + }); + break; + } + default: { + fillData(data, position, avatarSize); + setData(data, data.username); + break; + } + } + } + + function parseMembersData(response, position, avatarSize, data) { + var dataParsed = parseRawData(response.responseText); + if (!dataParsed) { + return; + } + data.members = dataParsed.length; + // console.log('GithubUserInfo:parseMembersData', data.username, data.members); + + fillData(data, position, avatarSize); + setData(data, data.username); + } + + function parseRawData(data) { + data = JSON.parse(data); + if ( + data.message && + data.message.startsWith("API rate limit exceeded") + ) { + console.warn( + "GithubUserInfo:parseRawData", + "API RATE LIMIT EXCEEDED", + ); + return; + } + return data; + } + + function normalizeData(data) { + return { + username: data.login, + avatar: data.avatar_url, + type: data.type, + name: data.name, + company: data.company, + blog: data.blog, + location: data.location, + mail: data.email, + repos: data.public_repos, + gists: data.public_gists, + followers: data.followers, + following: data.following, + created_at: data.created_at, + admin: !!data.site_admin, + }; + } + + function defaultData(data) { + return { + username: data.username, + avatar: data.avatar, + type: data.type, + name: data.name || data.username, + company: data.admin ? "GitHub" : data.company || "", + blog: data.blog || "", + location: data.location || "", + mail: data.mail || "", + repos: data.repos || 0, + gists: data.gists || 0, + followers: data.followers || 0, + following: data.following || 0, + created_at: data.created_at, + admin: data.admin || false, + orgs: data.orgs || 0, + members: data.members || 0, + }; + } + + function setData(data, username) { + // console.log('GithubUserInfo:setData', username, data); + var usersString = GM_getValue("users", "{}"); + var users = JSON.parse(usersString); + users[username] = { + checked_at: new Date().toJSON(), + data: data, + }; + GM_setValue("users", JSON.stringify(users)); + } + + function fillData(data, position, avatarSize) { + // console.log('GithubUserInfo:fillData', data, position, avatarSize); + + userAvatar.setAttribute("href", "https://github.com/" + data.username); + userAvatarImg.style.height = avatarSize.height + "px"; + userAvatarImg.style.width = avatarSize.width + "px"; + userAvatarImg.addEventListener("load", function () { + userMenu.style.top = Math.max(position.top - 10 - 1, 2) + "px"; + userMenu.style.left = Math.max(position.left - 10 - 1, 2) + "px"; + userMenu.style.display = "block"; + window.setTimeout(function avatarAnimationTimeout() { + userAvatarImg.style.height = "100px"; + userAvatarImg.style.width = "100px"; + }, 50); + }); + userAvatarImg.setAttribute("src", ""); + userAvatarImg.setAttribute("src", data.avatar); + + userName.setAttribute("title", data.username); + userName.textContent = data.name; + + if (hasValue(data.company, userCompany)) { + userCompanyText.textContent = data.company; + userCompanyAdmin.style.display = data.admin ? "inline" : "none"; + } + if (hasValue(data.location, userLocation)) { + userLocationText.setAttribute( + "href", + "https://maps.google.com/maps?q=" + + encodeURIComponent(data.location), + ); + userLocationText.textContent = data.location; + } + if (hasValue(data.mail, userMail)) { + userMailText.setAttribute("href", "mailto:" + data.mail); + userMailText.textContent = data.mail; + } + if (hasValue(data.blog, userLink)) { + userLinkText.setAttribute("href", data.blog); + userLinkText.textContent = data.blog; + } + if (hasValue(data.created_at, userJoined)) { + userJoinedText.setAttribute("datetime", data.created_at); + } + + var userCountsHasValue = false; + if (hasValue(data.followers, userFollowers)) { + userCountsHasValue = true; + userFollowers.setAttribute( + "href", + "https://github.com/" + data.username + "/followers", + ); + userFollowersCount.textContent = data.followers; + } + if (hasValue(data.following, userFollowing)) { + userCountsHasValue = true; + userFollowing.setAttribute( + "href", + "https://github.com/" + data.username + "/following", + ); + userFollowingCount.textContent = data.following; + } + if (hasValue(true, userRepos)) { + // Always show repos count, as long another count is shown too + userRepos.setAttribute( + "href", + "https://github.com/" + data.username + "?tab=repositories", + ); + userReposCount.textContent = data.repos; + } + if (hasValue(data.orgs, userOrgs)) { + userCountsHasValue = true; + userOrgs.setAttribute( + "href", + "https://github.com/" + data.username, + ); + userOrgsCount.textContent = data.orgs; + } + if (hasValue(data.members, userMembers)) { + userCountsHasValue = true; + userMembers.setAttribute( + "href", + "https://github.com/orgs/" + data.username + "/people", + ); + userMembersCount.textContent = + data.members === 30 ? "30+" : data.members; + } + if (hasValue(data.gists, userGists)) { + userCountsHasValue = true; + userGists.setAttribute( + "href", + "https://gist.github.com/" + data.username, + ); + userGistsCount.textContent = data.gists; + } + userCounts.style.display = userCountsHasValue ? "flex" : "none"; + + //if (data.type === 'Organization' || data.type === 'User') {} + } + + function hasValue(property, elm) { + elm.style.display = property ? "block" : "none"; + return !!property; + } + + function init() { + var avatars = document.querySelectorAll( + [ + '.avatar[alt^="@"]', // Logged-in user & commits author & issue participant & users organization & organization member + '.avatar-child[alt^="@"]', // Authored committed users + '.gravatar[alt^="@"]', // Following & followers page + '.timeline-comment-avatar[alt^="@"]', // GitHub comments author + '.commits img[alt^="@"]', // Commits on user activity tab + '.leaderboard-gravatar[alt^="@"]', // Trending developer: https://github.com/trending/developers + ".gist-author img", // Gist author + ".gist .js-discussion .timeline-comment-avatar", // Gist comments author + ].join(","), + ); + Array.prototype.forEach.call(avatars, function avatarsForEach(avatar) { + avatar.addEventListener("mouseenter", function mouseenter() { + // console.log('GithubUserInfo:avatar', 'mouseenter'); + _timer = window.setTimeout( + function mouseenterTimer() { + // console.log('GithubUserInfo:avatar', 'timeout'); + getData(this); + }.bind(this), + 500, + ); + }); + avatar.addEventListener("mouseleave", function mouseleave() { + // console.log('GithubUserInfo:avatar', 'mouseleave'); + window.clearTimeout(_timer); + }); + }); + } + + // Init + init(); + + // Pjax + document.addEventListener("pjax:end", init); +})(); diff --git a/Github_User_Info/README.md b/Github_User_Info/README.md new file mode 100644 index 0000000..49eac03 --- /dev/null +++ b/Github_User_Info/README.md @@ -0,0 +1,79 @@ +# [Github User Info](https://github.com/jerone/UserScripts/tree/master/Github_User_Info) (abandoned) + +[![Install](https://raw.github.com/jerone/UserScripts/master/_resources/Install-button.png)](https://github.com/jerone/UserScripts/raw/master/Github_User_Info/Github_User_Info.user.js) +[![Source](https://raw.github.com/jerone/UserScripts/master/_resources/Source-button.png)](https://github.com/jerone/UserScripts/blob/master/Github_User_Info/Github_User_Info.user.js) +[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW) +[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues) + +## Description + +Show user/organization information on avatar hover. + +## Screenshot + +![Github User Info Screenshot](https://github.com/jerone/UserScripts/raw/master/Github_User_Info/screenshot.jpg) + +## Compatible + +- ![Tampermonkey](https://raw.github.com/jerone/UserScripts/master/_resources/Tampermonkey.png) [Tampermonkey](https://addons.mozilla.org/firefox/addon/tampermonkey/) on ![Mozilla Firefox](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop. + +## Version History + +- **0.4.1** + - 🐛 Fix broken icon url ([#146](https://github.com/jerone/UserScripts/pull/146)). +- **0.4.0** + - We're only fetching one page of all members + - Use flexbox css for counts + - Fix showing joined date + - Remove console messages +- **0.3.5** + - Fixed issues after recent layout updates +- **0.3.4** + - Fixed some styling +- **0.3.3** + - Smoother avatar loading on non-cached user info +- **0.3.2** + - Add support for following & followers page + - Add support for trending developer +- **0.3.1** + - Add support for authored committed users +- **0.3.0** + - Add support for GitHub Gist (fixes [#55](https://github.com/jerone/UserScripts/issues/55)) +- **0.2.1** + - Fixed local time on second hover (fixes [#53](https://github.com/jerone/UserScripts/issues/53)) + - Added members count for orgs (closes [#54](https://github.com/jerone/UserScripts/issues/54)) +- **0.2.0** + - Make location linkable to Google Maps + - Added admin/staff recognition + - User with all counts and 4 digit numbers, stretching popup + - Don't error on API limit exceeded + - Fixed not saving data + - Always fill name + - Added organization count + - Fixed z-index + - Added missing hover effect on counts + - Better shadow + - Also run on homepage news feed + - Really fixing pjax events now; + - Animate avatar + - Hide user counts when no counts are available + - Added some logging + - Added class to identify element + - Added username fallback when no name +- **0.1.0** + - Initial version + +## Notes + +Use cases: + +- (User) +- (API user) +- (Organization with admin users) +- (Read your API limit) +- (API Documentation) + +## External links + +- [Greasy Fork](https://greasyfork.org/en/scripts/8989-github-user-info) +- [OpenUserJS](https://openuserjs.org/scripts/jerone/Github_User_Info) diff --git a/Github_User_Info/screenshot.jpg b/Github_User_Info/screenshot.jpg new file mode 100644 index 0000000..3295825 Binary files /dev/null and b/Github_User_Info/screenshot.jpg differ diff --git a/Greasemonkey_issue_1243/293020.user.js b/Greasemonkey_issue_1243/293020.user.js deleted file mode 100644 index ba4d608..0000000 --- a/Greasemonkey_issue_1243/293020.user.js +++ /dev/null @@ -1,10 +0,0 @@ -// ==UserScript== -// @name Greasemonkey issue 1243 -// @namespace https://github.com/greasemonkey/greasemonkey/issues/1243 -// @description GM doesn't allow to use localStorage.length -// @include * -// ==/UserScript== -window.localStorage.setItem('test1', 'test1'); -console.log('Getting data (should be "test1"): ', window.localStorage.getItem('test1')); -window.localStorage.setItem('test2', 'test2'); -console.log('Total count (should be 2 or higher): ', window.localStorage.length); diff --git a/Greasemonkey_issue_1243/README.md b/Greasemonkey_issue_1243/README.md deleted file mode 100644 index 73b17e7..0000000 --- a/Greasemonkey_issue_1243/README.md +++ /dev/null @@ -1 +0,0 @@ -[Greasemonkey issue 1243](http://userscripts.org/scripts/show/293020) \ No newline at end of file diff --git a/Horizon_TV_Fixer/1.1.72/combined.js b/Horizon_TV_Fixer/1.1.72/combined.js new file mode 100644 index 0000000..f2cbc94 --- /dev/null +++ b/Horizon_TV_Fixer/1.1.72/combined.js @@ -0,0 +1,4957 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function(window,undefined){var document=window.document,navigator=window.navigator,location=window.location;var jQuery=(function(){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery)},_jQuery=window.jQuery,_$=window.$,rootjQuery,quickExpr=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,rnotwhite=/\S/,trimLeft=/^\s+/,trimRight=/\s+$/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,rvalidchars=/^[\],:{}\s]*$/,rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rwebkit=/(webkit)[ \/]([\w.]+)/,ropera=/(opera)(?:.*version)?[ \/]([\w.]+)/,rmsie=/(msie) ([\w.]+)/,rmozilla=/(mozilla)(?:.*? rv:([\w.]+))?/,rdashAlpha=/-([a-z]|[0-9])/ig,rmsPrefix=/^-ms-/,fcamelCase=function(all,letter){return(letter+"").toUpperCase()},userAgent=navigator.userAgent,browserMatch,readyList,DOMContentLoaded,toString=Object.prototype.toString,hasOwn=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,trim=String.prototype.trim,indexOf=Array.prototype.indexOf,class2type={};jQuery.fn=jQuery.prototype={constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem,ret,doc;if(!selector){return this}if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}if(selector==="body"&&!context&&document.body){this.context=document;this[0]=document.body;this.selector=selector;this.length=1;return this}if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){match=[null,selector,null]}else{match=quickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;doc=(context?context.ownerDocument||context:document);ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true)}else{selector=[doc.createElement(ret[1])]}}else{ret=jQuery.buildFragment([match[1]],[doc]);selector=(ret.cacheable?jQuery.clone(ret.fragment):ret.fragment).childNodes}return jQuery.merge(this,selector)}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector)}this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}}else{if(!context||context.jquery){return(context||rootjQuery).find(selector)}else{return this.constructor(context).find(selector)}}}else{if(jQuery.isFunction(selector)){return rootjQuery.ready(selector)}}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return slice.call(this,0)},get:function(num){return num==null?this.toArray():(num<0?this[this.length+num]:this[num])},pushStack:function(elems,name,selector){var ret=this.constructor();if(jQuery.isArray(elems)){push.apply(ret,elems)}else{jQuery.merge(ret,elems)}ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector}else{if(name){ret.selector=this.selector+"."+name+"("+selector+")"}}return ret},each:function(callback,args){return jQuery.each(this,callback,args)},ready:function(fn){jQuery.bindReady();readyList.add(fn);return this},eq:function(i){i=+i;return i===-1?this.slice(i):this.slice(i,i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},end:function(){return this.prevObject||this.constructor(null)},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}if(length===i){target=this;--i}for(;i0){return}readyList.fireWith(document,[jQuery]);if(jQuery.fn.trigger){jQuery(document).trigger("ready").off("ready")}}},bindReady:function(){if(readyList){return}readyList=jQuery.Callbacks("once memory");if(document.readyState==="complete"){return setTimeout(jQuery.ready,1)}if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null}catch(e){}if(document.documentElement.doScroll&&toplevel){doScrollCheck()}}}},isFunction:function(obj){return jQuery.type(obj)==="function"},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array"},isWindow:function(obj){return obj&&typeof obj==="object"&&"setInterval" in obj},isNumeric:function(obj){return !isNaN(parseFloat(obj))&&isFinite(obj)},type:function(obj){return obj==null?String(obj):class2type[toString.call(obj)]||"object"},isPlainObject:function(obj){if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false}try{if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false}}catch(e){return false}var key;for(key in obj){}return key===undefined||hasOwn.call(obj,key)},isEmptyObject:function(obj){for(var name in obj){return false}return true},error:function(msg){throw new Error(msg)},parseJSON:function(data){if(typeof data!=="string"||!data){return null}data=jQuery.trim(data);if(window.JSON&&window.JSON.parse){return window.JSON.parse(data)}if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return(new Function("return "+data))()}jQuery.error("Invalid JSON: "+data)},parseXML:function(data){var xml,tmp;try{if(window.DOMParser){tmp=new DOMParser();xml=tmp.parseFromString(data,"text/xml")}else{xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data)}}catch(e){xml=undefined}if(!xml||!xml.documentElement||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data)}return xml},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){(window.execScript||function(data){window["eval"].call(window,data)})(data)}},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase()},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break}}}else{for(;i0&&elems[0]&&elems[length-1])||length===0||jQuery.isArray(elems));if(isArray){for(;i1?sliceDeferred.call(arguments,0):value;if(!(--count)){deferred.resolveWith(deferred,args)}}}function progressFunc(i){return function(value){pValues[i]=arguments.length>1?sliceDeferred.call(arguments,0):value;deferred.notifyWith(promise,pValues)}}if(length>1){for(;i
a";all=div.getElementsByTagName("*");a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return{}}select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];support={leadingWhitespace:(div.firstChild.nodeType===3),tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/top/.test(a.getAttribute("style")),hrefNormalized:(a.getAttribute("href")==="/a"),opacity:/^0.55/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:(input.value==="on"),optSelected:opt.selected,getSetAttribute:div.className!=="t",enctype:!!document.createElement("form").enctype,html5Clone:document.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};input.checked=true;support.noCloneChecked=input.cloneNode(true).checked;select.disabled=true;support.optDisabled=!opt.disabled;try{delete div.test}catch(e){support.deleteExpando=false}if(!div.addEventListener&&div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){support.noCloneEvent=false});div.cloneNode(true).fireEvent("onclick")}input=document.createElement("input");input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";input.setAttribute("checked","checked");div.appendChild(input);fragment=document.createDocumentFragment();fragment.appendChild(div.lastChild);support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;support.appendChecked=input.checked;fragment.removeChild(input);fragment.appendChild(div);div.innerHTML="";if(window.getComputedStyle){marginDiv=document.createElement("div");marginDiv.style.width="0";marginDiv.style.marginRight="0";div.style.width="2px";div.appendChild(marginDiv);support.reliableMarginRight=(parseInt((window.getComputedStyle(marginDiv,null)||{marginRight:0}).marginRight,10)||0)===0}if(div.attachEvent){for(i in {submit:1,change:1,focusin:1}){eventName="on"+i;isSupported=(eventName in div);if(!isSupported){div.setAttribute(eventName,"return;");isSupported=(typeof div[eventName]==="function")}support[i+"Bubbles"]=isSupported}}fragment.removeChild(div);fragment=select=opt=marginDiv=div=input=null;jQuery(function(){var container,outer,inner,table,td,offsetSupport,conMarginTop,ptlm,vb,style,html,body=document.getElementsByTagName("body")[0];if(!body){return}conMarginTop=1;ptlm="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";vb="visibility:hidden;border:0;";style="style='"+ptlm+"border:5px solid #000;padding:0;'";html="
";container=document.createElement("div");container.style.cssText=vb+"width:0;height:0;position:static;top:0;margin-top:"+conMarginTop+"px";body.insertBefore(container,body.firstChild);div=document.createElement("div");container.appendChild(div);div.innerHTML="
t
";tds=div.getElementsByTagName("td");isSupported=(tds[0].offsetHeight===0);tds[0].style.display="";tds[1].style.display="none";support.reliableHiddenOffsets=isSupported&&(tds[0].offsetHeight===0);div.innerHTML="";div.style.width=div.style.paddingLeft="1px";jQuery.boxModel=support.boxModel=div.offsetWidth===2;if(typeof div.style.zoom!=="undefined"){div.style.display="inline";div.style.zoom=1;support.inlineBlockNeedsLayout=(div.offsetWidth===2);div.style.display="";div.innerHTML="
";support.shrinkWrapBlocks=(div.offsetWidth!==2)}div.style.cssText=ptlm+vb;div.innerHTML=html;outer=div.firstChild;inner=outer.firstChild;td=outer.nextSibling.firstChild.firstChild;offsetSupport={doesNotAddBorder:(inner.offsetTop!==5),doesAddBorderForTableAndCells:(td.offsetTop===5)};inner.style.position="fixed";inner.style.top="20px";offsetSupport.fixedPosition=(inner.offsetTop===20||inner.offsetTop===15);inner.style.position=inner.style.top="";outer.style.overflow="hidden";outer.style.position="relative";offsetSupport.subtractsBorderForOverflowNotVisible=(inner.offsetTop===-5);offsetSupport.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==conMarginTop);body.removeChild(container);div=container=null;jQuery.extend(support,offsetSupport)});return support})();var rbrace=/^(?:\{.*\}|\[.*\])$/,rmultiDash=/([A-Z])/g;jQuery.extend({cache:{},uuid:0,expando:"jQuery"+(jQuery.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return !!elem&&!isEmptyDataObject(elem)},data:function(elem,name,data,pvt){if(!jQuery.acceptData(elem)){return}var privateCache,thisCache,ret,internalKey=jQuery.expando,getByName=typeof name==="string",isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[internalKey]:elem[internalKey]&&internalKey,isEvents=name==="events";if((!id||!cache[id]||(!isEvents&&!pvt&&!cache[id].data))&&getByName&&data===undefined){return}if(!id){if(isNode){elem[internalKey]=id=++jQuery.uuid}else{id=internalKey}}if(!cache[id]){cache[id]={};if(!isNode){cache[id].toJSON=jQuery.noop}}if(typeof name==="object"||typeof name==="function"){if(pvt){cache[id]=jQuery.extend(cache[id],name)}else{cache[id].data=jQuery.extend(cache[id].data,name)}}privateCache=thisCache=cache[id];if(!pvt){if(!thisCache.data){thisCache.data={}}thisCache=thisCache.data}if(data!==undefined){thisCache[jQuery.camelCase(name)]=data}if(isEvents&&!thisCache[name]){return privateCache.events}if(getByName){ret=thisCache[name];if(ret==null){ret=thisCache[jQuery.camelCase(name)]}}else{ret=thisCache}return ret},removeData:function(elem,name,pvt){if(!jQuery.acceptData(elem)){return}var thisCache,i,l,internalKey=jQuery.expando,isNode=elem.nodeType,cache=isNode?jQuery.cache:elem,id=isNode?elem[internalKey]:internalKey;if(!cache[id]){return}if(name){thisCache=pvt?cache[id]:cache[id].data;if(thisCache){if(!jQuery.isArray(name)){if(name in thisCache){name=[name]}else{name=jQuery.camelCase(name);if(name in thisCache){name=[name]}else{name=name.split(" ")}}}for(i=0,l=name.length;i-1){return true}}return false},val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.nodeName.toLowerCase()]||jQuery.valHooks[elem.type];if(hooks&&"get" in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}ret=elem.value;return typeof ret==="string"?ret.replace(rreturn,""):ret==null?"":ret}return}isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val;if(this.nodeType!==1){return}if(isFunction){val=value.call(this,i,self.val())}else{val=value}if(val==null){val=""}else{if(typeof val==="number"){val+=""}else{if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+""})}}}hooks=jQuery.valHooks[this.nodeName.toLowerCase()]||jQuery.valHooks[this.type];if(!hooks||!("set" in hooks)||hooks.set(this,val,"value")===undefined){this.value=val}})}});jQuery.extend({valHooks:{option:{get:function(elem){var val=elem.attributes.value;return !val||val.specified?elem.value:elem.text}},select:{get:function(elem){var value,i,max,option,index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null}i=one?index:0;max=one?index+1:options.length;for(;i=0});if(!values.length){elem.selectedIndex=-1}return values}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(elem,name,value,pass){var ret,hooks,notxml,nType=elem.nodeType;if(!elem||nType===3||nType===8||nType===2){return}if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value)}if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value)}notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(rboolean.test(name)?boolHook:nodeHook)}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return}else{if(hooks&&"set" in hooks&¬xml&&(ret=hooks.set(elem,value,name))!==undefined){return ret}else{elem.setAttribute(name,""+value);return value}}}else{if(hooks&&"get" in hooks&¬xml&&(ret=hooks.get(elem,name))!==null){return ret}else{ret=elem.getAttribute(name);return ret===null?undefined:ret}}},removeAttr:function(elem,value){var propName,attrNames,name,l,i=0;if(value&&elem.nodeType===1){attrNames=value.toLowerCase().split(rspace);l=attrNames.length;for(;i=0)}}})});var rformElems=/^(?:textarea|input|select)$/i,rtypenamespace=/^([^\.]*)?(?:\.(.+))?$/,rhoverHack=/\bhover(\.\S+)?\b/,rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rquickIs=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,quickParse=function(selector){var quick=rquickIs.exec(selector);if(quick){quick[1]=(quick[1]||"").toLowerCase();quick[3]=quick[3]&&new RegExp("(?:^|\\s)"+quick[3]+"(?:\\s|$)")}return quick},quickIs=function(elem,m){var attrs=elem.attributes||{};return((!m[1]||elem.nodeName.toLowerCase()===m[1])&&(!m[2]||(attrs.id||{}).value===m[2])&&(!m[3]||m[3].test((attrs["class"]||{}).value)))},hoverHack=function(events){return jQuery.event.special.hover?events:events.replace(rhoverHack,"mouseenter$1 mouseleave$1")};jQuery.event={add:function(elem,types,handler,data,selector){var elemData,eventHandle,events,t,tns,type,namespaces,handleObj,handleObjIn,quick,handlers,special;if(elem.nodeType===3||elem.nodeType===8||!types||!handler||!(elemData=jQuery._data(elem))){return}if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler}if(!handler.guid){handler.guid=jQuery.guid++}events=elemData.events;if(!events){elemData.events=events={}}eventHandle=elemData.handle;if(!eventHandle){elemData.handle=eventHandle=function(e){return typeof jQuery!=="undefined"&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.dispatch.apply(eventHandle.elem,arguments):undefined};eventHandle.elem=elem}types=jQuery.trim(hoverHack(types)).split(" ");for(t=0;t=0){type=type.slice(0,-1);exclusive=true}if(type.indexOf(".")>=0){namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}if((!elem||jQuery.event.customEvent[type])&&!jQuery.event.global[type]){return}event=typeof event==="object"?event[jQuery.expando]?event:new jQuery.Event(type,event):new jQuery.Event(type);event.type=type;event.isTrigger=true;event.exclusive=exclusive;event.namespace=namespaces.join(".");event.namespace_re=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;ontype=type.indexOf(":")<0?"on"+type:"";if(!elem){cache=jQuery.cache;for(i in cache){if(cache[i].events&&cache[i].events[type]){jQuery.event.trigger(event,data,cache[i].handle.elem,true)}}return}event.result=undefined;if(!event.target){event.target=elem}data=data!=null?jQuery.makeArray(data):[];data.unshift(event);special=jQuery.event.special[type]||{};if(special.trigger&&special.trigger.apply(elem,data)===false){return}eventPath=[[elem,special.bindType||type]];if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;cur=rfocusMorph.test(bubbleType+type)?elem:elem.parentNode;old=null;for(;cur;cur=cur.parentNode){eventPath.push([cur,bubbleType]);old=cur}if(old&&old===elem.ownerDocument){eventPath.push([old.defaultView||old.parentWindow||window,bubbleType])}}for(i=0;idelegateCount){handlerQueue.push({elem:this,matches:handlers.slice(delegateCount)})}for(i=0;i0?this.on(name,null,data,fn):this.trigger(name)};if(jQuery.attrFn){jQuery.attrFn[name]=true}if(rkeyEvent.test(name)){jQuery.event.fixHooks[name]=jQuery.event.keyHooks}if(rmouseEvent.test(name)){jQuery.event.fixHooks[name]=jQuery.event.mouseHooks}}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,expando="sizcache"+(Math.random()+"").replace(".",""),done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true,rBackslash=/\\/g,rReturn=/\r\n/g,rNonWord=/\W/;[0,0].sort(function(){baseHasDuplicate=false;return 0});var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;var origContext=context;if(context.nodeType!==1&&context.nodeType!==9){return[]}if(!selector||typeof selector!=="string"){return results}var m,set,checkSet,extra,ret,cur,pop,i,prune=true,contextXML=Sizzle.isXML(context),parts=[],soFar=selector;do{chunker.exec("");m=chunker.exec(soFar);if(m){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break}}}while(m);if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context,seed)}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift()}set=posProcess(selector,set,seed)}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0]}if(context){ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set)}else{prune=false}while(parts.length){cur=parts.pop();pop=cur;if(!Expr.relative[cur]){cur=""}else{pop=parts.pop()}if(pop==null){pop=context}Expr.relative[cur](checkSet,pop,contextXML)}}else{checkSet=parts=[]}}if(!checkSet){checkSet=set}if(!checkSet){Sizzle.error(cur||selector)}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)}else{if(context&&context.nodeType===1){for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&Sizzle.contains(context,checkSet[i]))){results.push(set[i])}}}else{for(i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])}}}}}else{makeArray(checkSet,results)}if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results)}return results};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i0};Sizzle.find=function(expr,context,isXML){var set,i,len,match,type,left;if(!expr){return[]}for(i=0,len=Expr.order.length;i":function(checkSet,part){var elem,isPartStr=typeof part==="string",i=0,l=checkSet.length;if(isPartStr&&!rNonWord.test(part)){part=part.toLowerCase();for(;i=0)){if(!inplace){result.push(elem)}}else{if(inplace){curLoop[i]=false}}}}return false},ID:function(match){return match[1].replace(rBackslash,"")},TAG:function(match,curLoop){return match[1].replace(rBackslash,"").toLowerCase()},CHILD:function(match){if(match[1]==="nth"){if(!match[2]){Sizzle.error(match[0])}match[2]=match[2].replace(/^\+|\s*/g,"");var test=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0}else{if(match[2]){Sizzle.error(match[0])}}match[0]=done++;return match},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1]=match[1].replace(rBackslash,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]}match[4]=(match[4]||match[5]||"").replace(rBackslash,"");if(match[2]==="~="){match[4]=" "+match[4]+" "}return match},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret)}return false}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true}}return match},POS:function(match){match.unshift(true);return match}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"},disabled:function(elem){return elem.disabled===true},checked:function(elem){return elem.checked===true},selected:function(elem){if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},parent:function(elem){return !!elem.firstChild},empty:function(elem){return !elem.firstChild},has:function(elem,i,match){return !!Sizzle(match[3],elem).length},header:function(elem){return(/h\d/i).test(elem.nodeName)},text:function(elem){var attr=elem.getAttribute("type"),type=elem.type;return elem.nodeName.toLowerCase()==="input"&&"text"===type&&(attr===type||attr===null)},radio:function(elem){return elem.nodeName.toLowerCase()==="input"&&"radio"===elem.type},checkbox:function(elem){return elem.nodeName.toLowerCase()==="input"&&"checkbox"===elem.type},file:function(elem){return elem.nodeName.toLowerCase()==="input"&&"file"===elem.type},password:function(elem){return elem.nodeName.toLowerCase()==="input"&&"password"===elem.type},submit:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"submit"===elem.type},image:function(elem){return elem.nodeName.toLowerCase()==="input"&&"image"===elem.type},reset:function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&"reset"===elem.type},button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&"button"===elem.type||name==="button"},input:function(elem){return(/input|select|textarea|button/i).test(elem.nodeName)},focus:function(elem){return elem===elem.ownerDocument.activeElement}},setFilters:{first:function(elem,i){return i===0},last:function(elem,i,match,array){return i===array.length-1},even:function(elem,i){return i%2===0},odd:function(elem,i){return i%2===1},lt:function(elem,i,match){return imatch[3]-0},nth:function(elem,i,match){return match[3]-0===i},eq:function(elem,i,match){return match[3]-0===i}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array)}else{if(name==="contains"){return(elem.textContent||elem.innerText||getText([elem])||"").indexOf(match[3])>=0}else{if(name==="not"){var not=match[3];for(var j=0,l=not.length;j=0)}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||!!elem.nodeName&&elem.nodeName.toLowerCase()===match},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1},ATTR:function(elem,match){var name=match[1],result=Sizzle.attr?Sizzle.attr(elem,name):Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":!type&&Sizzle.attr?result!=null:type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array)}}}};var origPOS=Expr.match.POS,fescape=function(all,num){return"\\"+(num-0+1)};for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+(/(?![^\[]*\])(?![^\(]*\))/.source));Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,fescape))}var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results}return array};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(e){makeArray=function(array,results){var i=0,ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)}else{if(typeof array.length==="number"){for(var l=array.length;i";root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match}}root.removeChild(form);root=form=null})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i])}}results=tmp}return results}}div.innerHTML="";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)}}div=null})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div"),id="__sizzle__";div.innerHTML="

";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return}Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&!Sizzle.isXML(context)){var match=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(query);if(match&&(context.nodeType===1||context.nodeType===9)){if(match[1]){return makeArray(context.getElementsByTagName(query),extra)}else{if(match[2]&&Expr.find.CLASS&&context.getElementsByClassName){return makeArray(context.getElementsByClassName(match[2]),extra)}}}if(context.nodeType===9){if(query==="body"&&context.body){return makeArray([context.body],extra)}else{if(match&&match[3]){var elem=context.getElementById(match[3]);if(elem&&elem.parentNode){if(elem.id===match[3]){return makeArray([elem],extra)}}else{return makeArray([],extra)}}}try{return makeArray(context.querySelectorAll(query),extra)}catch(qsaError){}}else{if(context.nodeType===1&&context.nodeName.toLowerCase()!=="object"){var oldContext=context,old=context.getAttribute("id"),nid=old||id,hasParent=context.parentNode,relativeHierarchySelector=/^\s*[+~]/.test(query);if(!old){context.setAttribute("id",nid)}else{nid=nid.replace(/'/g,"\\$&")}if(relativeHierarchySelector&&hasParent){context=context.parentNode}try{if(!relativeHierarchySelector||hasParent){return makeArray(context.querySelectorAll("[id='"+nid+"'] "+query),extra)}}catch(pseudoError){}finally{if(!old){oldContext.removeAttribute("id")}}}}}return oldSizzle(query,context,extra,seed)};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop]}div=null})()}(function(){var html=document.documentElement,matches=html.matchesSelector||html.mozMatchesSelector||html.webkitMatchesSelector||html.msMatchesSelector;if(matches){var disconnectedMatch=!matches.call(document.createElement("div"),"div"),pseudoWorks=false;try{matches.call(document.documentElement,"[test!='']:sizzle")}catch(pseudoError){pseudoWorks=true}Sizzle.matchesSelector=function(node,expr){expr=expr.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!Sizzle.isXML(node)){try{if(pseudoWorks||!Expr.match.PSEUDO.test(expr)&&!/!=/.test(expr)){var ret=matches.call(node,expr);if(ret||!disconnectedMatch||node.document&&node.document.nodeType!==11){return ret}}}catch(e){}}return Sizzle(expr,null,null,[node]).length>0}}})();(function(){var div=document.createElement("div");div.innerHTML="
";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return}div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return}Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])}};div=null})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i0){match=elem;break}}}elem=elem[dir]}checkSet[i]=match}}}if(document.documentElement.contains){Sizzle.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):true)}}else{if(document.documentElement.compareDocumentPosition){Sizzle.contains=function(a,b){return !!(a.compareDocumentPosition(b)&16)}}else{Sizzle.contains=function(){return false}}}Sizzle.isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false};var posProcess=function(selector,context,seed){var match,tmpSet=[],later="",root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"")}selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i0){for(n=length;n=0:jQuery.filter(selector,this).length>0:this.filter(selector).length>0)},closest:function(selectors,context){var ret=[],i,l,cur=this[0];if(jQuery.isArray(selectors)){var level=1;while(cur&&cur.ownerDocument&&cur!==context){for(i=0;i-1:jQuery.find.matchesSelector(cur,selectors)){ret.push(cur);break}else{cur=cur.parentNode;if(!cur||!cur.ownerDocument||cur===context||cur.nodeType===11){break}}}}ret=ret.length>1?jQuery.unique(ret):ret;return this.pushStack(ret,"closest",selectors)},index:function(elem){if(!elem){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof elem==="string"){return jQuery.inArray(this[0],jQuery(elem))}return jQuery.inArray(elem.jquery?elem[0]:elem,this)},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context):jQuery.makeArray(selector&&selector.nodeType?[selector]:selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all))},andSelf:function(){return this.add(this.prevObject)}});function isDisconnected(node){return !node||!node.parentNode||node.parentNode.nodeType===11}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return jQuery.dir(elem,"parentNode")},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until)},next:function(elem){return jQuery.nth(elem,2,"nextSibling")},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until)},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until)},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until}if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret)}ret=this.length>1&&!guaranteedUnique[name]?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse()}return this.pushStack(ret,name,slice.call(arguments).join(","))}});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")"}return elems.length===1?jQuery.find.matchesSelector(elems[0],expr)?[elems[0]]:[]:jQuery.find.matches(expr,elems)},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur)}cur=cur[dir]}return matched},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break}}return cur},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n)}}return r}});function winnow(elements,qualifier,keep){qualifier=qualifier||0;if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){var retVal=!!qualifier.call(elem,i,elem);return retVal===keep})}else{if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return(elem===qualifier)===keep})}else{if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep)}else{qualifier=jQuery.filter(qualifier,filtered)}}}}return jQuery.grep(elements,function(elem,i){return(jQuery.inArray(elem,qualifier)>=0)===keep})}function createSafeFragment(document){var list=nodeNames.split("|"),safeFrag=document.createDocumentFragment();if(safeFrag.createElement){while(list.length){safeFrag.createElement(list.pop())}}return safeFrag}var nodeNames="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,rtagName=/<([\w:]+)/,rtbody=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},safeFragment=createSafeFragment(document);wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div
","
"]}jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);self.text(text.call(this,i,self.text()))})}if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text))}return jQuery.text(this)},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i))})}if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild}return elem}).append(this)}return this},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i))})}return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html)}else{self.append(html)}})},wrap:function(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html)})},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})}else{if(arguments.length){var set=jQuery.clean(arguments);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})}else{if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery.clean(arguments));return set}}},remove:function(selector,keepData){for(var i=0,elem;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem])}if(elem.parentNode){elem.parentNode.removeChild(elem)}}}return this},empty:function(){for(var i=0,elem;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"))}while(elem.firstChild){elem.removeChild(elem.firstChild)}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null}else{if(typeof value==="string"&&!rnoInnerhtml.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1>");try{for(var i=0,l=this.length;i1&&i0?this.clone(true):this).get();jQuery(insert[i])[original](elems);ret=ret.concat(elems)}return this.pushStack(ret,name,insert.selector)}}});function getAll(elem){if(typeof elem.getElementsByTagName!=="undefined"){return elem.getElementsByTagName("*")}else{if(typeof elem.querySelectorAll!=="undefined"){return elem.querySelectorAll("*")}else{return[]}}}function fixDefaultChecked(elem){if(elem.type==="checkbox"||elem.type==="radio"){elem.defaultChecked=elem.checked}}function findInputs(elem){var nodeName=(elem.nodeName||"").toLowerCase();if(nodeName==="input"){fixDefaultChecked(elem)}else{if(nodeName!=="script"&&typeof elem.getElementsByTagName!=="undefined"){jQuery.grep(elem.getElementsByTagName("input"),fixDefaultChecked)}}}function shimCloneNode(elem){var div=document.createElement("div");safeFragment.appendChild(div);div.innerHTML=elem.outerHTML;return div.firstChild}jQuery.extend({clone:function(elem,dataAndEvents,deepDataAndEvents){var srcElements,destElements,i,clone=jQuery.support.html5Clone||!rnoshimcache.test("<"+elem.nodeName)?elem.cloneNode(true):shimCloneNode(elem);if((!jQuery.support.noCloneEvent||!jQuery.support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){cloneFixAttributes(elem,clone);srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){if(destElements[i]){cloneFixAttributes(srcElements[i],destElements[i])}}}if(dataAndEvents){cloneCopyEvent(elem,clone);if(deepDataAndEvents){srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneCopyEvent(srcElements[i],destElements[i])}}}srcElements=destElements=null;return clone},clean:function(elems,context,fragment,scripts){var checkScriptType;context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document}var ret=[],j;for(var i=0,elem;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+=""}if(!elem){continue}if(typeof elem==="string"){if(!rhtml.test(elem)){elem=context.createTextNode(elem)}else{elem=elem.replace(rxhtmlTag,"<$1>");var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");if(context===document){safeFragment.appendChild(div)}else{createSafeFragment(context).appendChild(div)}div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild}if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]===""&&!hasBody?div.childNodes:[];for(j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])}}}if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild)}elem=div.childNodes}}var len;if(!jQuery.support.appendChecked){if(elem[0]&&typeof(len=elem.length)==="number"){for(j=0;j=0){return value+"px"}}else{return value}}}});if(!jQuery.support.opacity){jQuery.cssHooks.opacity={get:function(elem,computed){return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":computed?"1":""},set:function(elem,value){var style=elem.style,currentStyle=elem.currentStyle,opacity=jQuery.isNumeric(value)?"alpha(opacity="+value*100+")":"",filter=currentStyle&¤tStyle.filter||style.filter||"";style.zoom=1;if(value>=1&&jQuery.trim(filter.replace(ralpha,""))===""){style.removeAttribute("filter");if(currentStyle&&!currentStyle.filter){return}}style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity}}}jQuery(function(){if(!jQuery.support.reliableMarginRight){jQuery.cssHooks.marginRight={get:function(elem,computed){var ret;jQuery.swap(elem,{display:"inline-block"},function(){if(computed){ret=curCSS(elem,"margin-right","marginRight")}else{ret=elem.style.marginRight}});return ret}}}});if(document.defaultView&&document.defaultView.getComputedStyle){getComputedStyle=function(elem,name){var ret,defaultView,computedStyle;name=name.replace(rupper,"-$1").toLowerCase();if((defaultView=elem.ownerDocument.defaultView)&&(computedStyle=defaultView.getComputedStyle(elem,null))){ret=computedStyle.getPropertyValue(name);if(ret===""&&!jQuery.contains(elem.ownerDocument.documentElement,elem)){ret=jQuery.style(elem,name)}}return ret}}if(document.documentElement.currentStyle){currentStyle=function(elem,name){var left,rsLeft,uncomputed,ret=elem.currentStyle&&elem.currentStyle[name],style=elem.style;if(ret===null&&style&&(uncomputed=style[name])){ret=uncomputed}if(!rnumpx.test(ret)&&rnum.test(ret)){left=style.left;rsLeft=elem.runtimeStyle&&elem.runtimeStyle.left;if(rsLeft){elem.runtimeStyle.left=elem.currentStyle.left}style.left=name==="fontSize"?"1em":(ret||0);ret=style.pixelLeft+"px";style.left=left;if(rsLeft){elem.runtimeStyle.left=rsLeft}}return ret===""?"auto":ret}}curCSS=getComputedStyle||currentStyle;function getWH(elem,name,extra){var val=name==="width"?elem.offsetWidth:elem.offsetHeight,which=name==="width"?cssWidth:cssHeight,i=0,len=which.length;if(val>0){if(extra!=="border"){for(;i)<[^<]*)*<\/script>/gi,rselectTextarea=/^(?:select|textarea)/i,rspacesAjax=/\s+/,rts=/([?&])_=[^&]*/,rurl=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,_load=jQuery.fn.load,prefilters={},transports={},ajaxLocation,ajaxLocParts,allTypes=["*/"]+["*"];try{ajaxLocation=location.href}catch(e){ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href}ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}if(jQuery.isFunction(func)){var dataTypes=dataTypeExpression.toLowerCase().split(rspacesAjax),i=0,length=dataTypes.length,dataType,list,placeBefore;for(;i=0){var selector=url.slice(off,url.length);url=url.slice(0,off)}var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=undefined}else{if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST"}}}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(jqXHR,status,responseText){responseText=jqXHR.responseText;if(jqXHR.isResolved()){jqXHR.done(function(r){responseText=r});self.html(selector?jQuery("
").append(responseText.replace(rscript,"")).find(selector):responseText)}if(callback){self.each(callback,[responseText,status,jqXHR])}}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}):{name:elem.name,value:val.replace(rCRLF,"\r\n")}}).get()}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.on(o,f)}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined}return jQuery.ajax({type:method,url:url,data:data,success:callback,dataType:type})}});jQuery.extend({getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script")},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},ajaxSetup:function(target,settings){if(settings){ajaxExtend(target,jQuery.ajaxSettings)}else{settings=target;target=jQuery.ajaxSettings}ajaxExtend(target,settings);return target},ajaxSettings:{url:ajaxLocation,isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":allTypes},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":window.String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};var s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=callbackContext!==s&&(callbackContext.nodeType||callbackContext instanceof jQuery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},ifModifiedKey,requestHeaders={},requestHeadersNames={},responseHeadersString,responseHeaders,transport,timeoutTimer,parts,state=0,fireGlobals,i,jqXHR={readyState:0,setRequestHeader:function(name,value){if(!state){var lname=name.toLowerCase();name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value}return this},getAllResponseHeaders:function(){return state===2?responseHeadersString:null},getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while((match=rheaders.exec(responseHeadersString))){responseHeaders[match[1].toLowerCase()]=match[2]}}match=responseHeaders[key.toLowerCase()]}return match===undefined?null:match},overrideMimeType:function(type){if(!state){s.mimeType=type}return this},abort:function(statusText){statusText=statusText||"abort";if(transport){transport.abort(statusText)}done(0,statusText);return this}};function done(status,nativeStatusText,responses,headers){if(state===2){return}state=2;if(timeoutTimer){clearTimeout(timeoutTimer)}transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;var isSuccess,success,error,statusText=nativeStatusText,response=responses?ajaxHandleResponses(s,jqXHR,responses):undefined,lastModified,etag;if(status>=200&&status<300||status===304){if(s.ifModified){if((lastModified=jqXHR.getResponseHeader("Last-Modified"))){jQuery.lastModified[ifModifiedKey]=lastModified}if((etag=jqXHR.getResponseHeader("Etag"))){jQuery.etag[ifModifiedKey]=etag}}if(status===304){statusText="notmodified";isSuccess=true}else{try{success=ajaxConvert(s,response);statusText="success";isSuccess=true}catch(e){statusText="parsererror";error=e}}}else{error=statusText;if(!statusText||status){statusText="error";if(status<0){status=0}}}jqXHR.status=status;jqXHR.statusText=""+(nativeStatusText||statusText);if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR])}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error])}jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger("ajax"+(isSuccess?"Success":"Error"),[jqXHR,s,isSuccess?success:error])}completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!(--jQuery.active)){jQuery.event.trigger("ajaxStop")}}}deferred.promise(jqXHR);jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;jqXHR.complete=completeDeferred.add;jqXHR.statusCode=function(map){if(map){var tmp;if(state<2){for(tmp in map){statusCode[tmp]=[statusCode[tmp],map[tmp]]}}else{tmp=map[jqXHR.status];jqXHR.then(tmp,tmp)}}return this};s.url=((url||s.url)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().split(rspacesAjax);if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!=ajaxLocParts[1]||parts[2]!=ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))))}if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return false}fireGlobals=s.global;s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}if(!s.hasContent){if(s.data){s.url+=(rquery.test(s.url)?"&":"?")+s.data;delete s.data}ifModifiedKey=s.url;if(s.cache===false){var ts=jQuery.now(),ret=s.url.replace(rts,"$1_="+ts);s.url=ret+((ret===s.url)?(rquery.test(s.url)?"&":"?")+"_="+ts:"")}}if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}if(s.ifModified){ifModifiedKey=ifModifiedKey||s.url;if(jQuery.lastModified[ifModifiedKey]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[ifModifiedKey])}if(jQuery.etag[ifModifiedKey]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[ifModifiedKey])}}jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){jqXHR.abort();return false}for(i in {success:1,error:1,complete:1}){jqXHR[i](s[i])}transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout")},s.timeout)}try{state=1;transport.send(requestHeaders,done)}catch(e){if(state<2){done(-1,e)}else{throw e}}}return jqXHR},param:function(a,traditional){var s=[],add=function(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)};if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional}if(jQuery.isArray(a)||(a.jquery&&!jQuery.isPlainObject(a))){jQuery.each(a,function(){add(this.name,this.value)})}else{for(var prefix in a){buildParams(prefix,a[prefix],traditional,add)}}return s.join("&").replace(r20,"+")}});function buildParams(prefix,obj,traditional,add){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v)}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v,traditional,add)}})}else{if(!traditional&&obj!=null&&typeof obj==="object"){for(var name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add)}}else{add(prefix,obj)}}}jQuery.extend({active:0,lastModified:{},etag:{}});function ajaxHandleResponses(s,jqXHR,responses){var contents=s.contents,dataTypes=s.dataTypes,responseFields=s.responseFields,ct,type,finalDataType,firstDataType;for(type in responseFields){if(type in responses){jqXHR[responseFields[type]]=responses[type]}}while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("content-type")}}if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}if(dataTypes[0] in responses){finalDataType=dataTypes[0]}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}finalDataType=finalDataType||firstDataType}if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}function ajaxConvert(s,response){if(s.dataFilter){response=s.dataFilter(response,s.dataType)}var dataTypes=s.dataTypes,converters={},i,key,length=dataTypes.length,tmp,current=dataTypes[0],prev,conversion,conv,conv1,conv2;for(i=1;i=options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();options.animatedProperties[this.prop]=true;for(p in options.animatedProperties){if(options.animatedProperties[p]!==true){done=false}}if(done){if(options.overflow!=null&&!jQuery.support.shrinkWrapBlocks){jQuery.each(["","X","Y"],function(index,value){elem.style["overflow"+value]=options.overflow[index]})}if(options.hide){jQuery(elem).hide()}if(options.hide||options.show){for(p in options.animatedProperties){jQuery.style(elem,p,options.orig[p]);jQuery.removeData(elem,"fxshow"+p,true);jQuery.removeData(elem,"toggle"+p,true)}}complete=options.complete;if(complete){options.complete=false;complete.call(elem)}}return false}else{if(options.duration==Infinity){this.now=t}else{n=t-this.startTime;this.state=n/options.duration;this.pos=jQuery.easing[options.animatedProperties[this.prop]](this.state,n,0,1,options.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};jQuery.extend(jQuery.fx,{tick:function(){var timer,timers=jQuery.timers,i=0;for(;i").appendTo(body),display=elem.css("display");elem.remove();if(display==="none"||display===""){if(!iframe){iframe=document.createElement("iframe");iframe.frameBorder=iframe.width=iframe.height=0}body.appendChild(iframe);if(!iframeDoc||!iframe.createElement){iframeDoc=(iframe.contentWindow||iframe.contentDocument).document;iframeDoc.write((document.compatMode==="CSS1Compat"?"":"")+"");iframeDoc.close()}elem=iframeDoc.createElement(nodeName);iframeDoc.body.appendChild(elem);display=jQuery.css(elem,"display");body.removeChild(iframe)}elemdisplay[nodeName]=display}return elemdisplay[nodeName]}var rtable=/^t(?:able|d|h)$/i,rroot=/^(?:body|html)$/i;if("getBoundingClientRect" in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0],box;if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i)})}if(!elem||!elem.ownerDocument){return null}if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem)}try{box=elem.getBoundingClientRect()}catch(e){}var doc=elem.ownerDocument,docElem=doc.documentElement;if(!box||!jQuery.contains(docElem,elem)){return box?{top:box.top,left:box.left}:{top:0,left:0}}var body=doc.body,win=getWindow(doc),clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,scrollTop=win.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop,scrollLeft=win.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft,top=box.top+scrollTop-clientTop,left=box.left+scrollLeft-clientLeft;return{top:top,left:left}}}else{jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i)})}if(!elem||!elem.ownerDocument){return null}if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem)}var computedStyle,offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.support.fixedPosition&&prevComputedStyle.position==="fixed"){break}computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.support.doesNotAddBorder&&!(jQuery.support.doesAddBorderForTableAndCells&&rtable.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0}prevOffsetParent=offsetParent;offsetParent=elem.offsetParent}if(jQuery.support.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0}prevComputedStyle=computedStyle}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft}if(jQuery.support.fixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft)}return{top:top,left:left}}}jQuery.offset={bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;if(jQuery.support.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.css(body,"marginTop"))||0;left+=parseFloat(jQuery.css(body,"marginLeft"))||0}return{top:top,left:left}},setOffset:function(elem,options,i){var position=jQuery.css(elem,"position");if(position==="static"){elem.style.position="relative"}var curElem=jQuery(elem),curOffset=curElem.offset(),curCSSTop=jQuery.css(elem,"top"),curCSSLeft=jQuery.css(elem,"left"),calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1,props={},curPosition={},curTop,curLeft;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0}if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset)}if(options.top!=null){props.top=(options.top-curOffset.top)+curTop}if(options.left!=null){props.left=(options.left-curOffset.left)+curLeft}if("using" in options){options.using.call(elem,props)}else{curElem.css(props)}}};jQuery.fn.extend({position:function(){if(!this[0]){return null}var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=rroot.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.css(elem,"marginTop"))||0;offset.left-=parseFloat(jQuery.css(elem,"marginLeft"))||0;parentOffset.top+=parseFloat(jQuery.css(offsetParent[0],"borderTopWidth"))||0;parentOffset.left+=parseFloat(jQuery.css(offsetParent[0],"borderLeftWidth"))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!rroot.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent}return offsetParent})}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem,win;if(val===undefined){elem=this[0];if(!elem){return null}win=getWindow(elem);return win?("pageXOffset" in win)?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method]}return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop())}else{this[method]=val}})}});function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false}jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){var elem=this[0];return elem?elem.style?parseFloat(jQuery.css(elem,type,"padding")):this[type]():null};jQuery.fn["outer"+name]=function(margin){var elem=this[0];return elem?elem.style?parseFloat(jQuery.css(elem,type,margin?"margin":"border")):this[type]():null};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this}if(jQuery.isFunction(size)){return this.each(function(i){var self=jQuery(this);self[type](size.call(this,i,self[type]()))})}if(jQuery.isWindow(elem)){var docElemProp=elem.document.documentElement["client"+name],body=elem.document.body;return elem.document.compatMode==="CSS1Compat"&&docElemProp||body&&body["client"+name]||docElemProp}else{if(elem.nodeType===9){return Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name])}else{if(size===undefined){var orig=jQuery.css(elem,type),ret=parseFloat(orig);return jQuery.isNumeric(ret)?ret:orig}else{return this.css(type,typeof size==="string"?size:size+"px")}}}}});window.jQuery=window.$=jQuery;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return jQuery})}})(window); +/*! + * jQuery UI 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function($,undefined){$.ui=$.ui||{};if($.ui.version){return}$.extend($.ui,{version:"1.8.16",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});$.fn.extend({propAttr:$.fn.prop||$.fn.attr,_focus:$.fn.focus,focus:function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem)}},delay)}):this._focus.apply(this,arguments)},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,"position",1))&&(/(auto|scroll)/).test($.curCSS(this,"overflow",1)+$.curCSS(this,"overflow-y",1)+$.curCSS(this,"overflow-x",1))}).eq(0)}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,"overflow",1)+$.curCSS(this,"overflow-y",1)+$.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!scrollParent.length?$(document):scrollParent},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex)}if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}}return 0},disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.curCSS(elem,"padding"+this,true))||0;if(border){size-=parseFloat($.curCSS(elem,"border"+this+"Width",true))||0}if(margin){size-=parseFloat($.curCSS(elem,"margin"+this,true))||0}});return size}$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)}return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)}return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px")})}});function focusable(element,isTabIndexNotNaN){var nodeName=element.nodeName.toLowerCase();if("area"===nodeName){var map=element.parentNode,mapName=map.name,img;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false}img=$("img[usemap=#"+mapName+"]")[0];return !!img&&visible(img)}return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"==nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&visible(element)}function visible(element){return !$(element).parents().andSelf().filter(function(){return $.curCSS(this,"visibility")==="hidden"||$.expr.filters.hidden(this)}).length}$.extend($.expr[":"],{data:function(elem,i,match){return !!$.data(elem,match[3])},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")))},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN)}});$(function(){var body=document.body,div=body.appendChild(div=document.createElement("div"));$.extend(div.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});$.support.minHeight=div.offsetHeight===100;$.support.selectstart="onselectstart" in div;body.removeChild(div).style.display="none"});$.extend($.ui,{plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return}for(var i=0;i0){return true}el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size))},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width)}})})(jQuery); +/*! + * jQuery UI Widget 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Widget + */ +(function($,undefined){if($.cleanData){var _cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){try{$(elem).triggerHandler("remove")}catch(e){}}_cleanData(elems)}}else{var _remove=$.fn.remove;$.fn.remove=function(selector,keepData){return this.each(function(){if(!keepData){if(!selector||$.filter(selector,[this]).length){$("*",this).add([this]).each(function(){try{$(this).triggerHandler("remove")}catch(e){}})}}return _remove.call($(this),selector,keepData)})}}$.widget=function(name,base,prototype){var namespace=name.split(".")[0],fullName;name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}$.expr[":"][fullName]=function(elem){return !!$.data(elem,name)};$[namespace]=$[namespace]||{};$[namespace][name]=function(options,element){if(arguments.length){this._createWidget(options,element)}};var basePrototype=new base();basePrototype.options=$.extend(true,{},basePrototype.options);$[namespace][name].prototype=$.extend(true,basePrototype,{namespace:namespace,widgetName:name,widgetEventPrefix:$[namespace][name].prototype.widgetEventPrefix||name,widgetBaseClass:fullName},prototype);$.widget.bridge(name,$[namespace][name])};$.widget.bridge=function(name,object){$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;if(isMethodCall&&options.charAt(0)==="_"){return returnValue}if(isMethodCall){this.each(function(){var instance=$.data(this,name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false}})}else{this.each(function(){var instance=$.data(this,name);if(instance){instance.option(options||{})._init()}else{$.data(this,name,new object(options,this))}})}return returnValue}};$.Widget=function(options,element){if(arguments.length){this._createWidget(options,element)}};$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(options,element){$.data(element,this.widgetName,this);this.element=$(element);this.options=$.extend(true,{},this.options,this._getCreateOptions(),options);var self=this;this.element.bind("remove."+this.widgetName,function(){self.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return $.metadata&&$.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(key,value){var options=key;if(arguments.length===0){return $.extend({},this.options)}if(typeof key==="string"){if(value===undefined){return this.options[key]}options={};options[key]=value}this._setOptions(options);return this},_setOptions:function(options){var self=this;$.each(options,function(key,value){self._setOption(key,value)});return this},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget()[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",value)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(type,event,data){var callback=this.options[type];event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();data=data||{};if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop]}}this.element.trigger(event,data);return !($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented())}}})(jQuery); +/*! + * jQuery UI Mouse 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Mouse + * + * Depends: + * jquery.ui.widget.js + */ +(function($,undefined){var mouseHandled=false;$(document).mouseup(function(e){mouseHandled=false});$.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var self=this;this.element.bind("mousedown."+this.widgetName,function(event){return self._mouseDown(event)}).bind("click."+this.widgetName,function(event){if(true===$.data(event.target,self.widgetName+".preventClickEvent")){$.removeData(event.target,self.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(event){if(mouseHandled){return}(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true}}if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(event){return self._mouseMove(event)};this._mouseUpDelegate=function(event){return self._mouseUp(event)};$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true},_mouseMove:function(event){if($.browser.msie&&!(document.documentMode>=9)&&!event.button){return this._mouseUp(event)}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event))}return !this._mouseStarted},_mouseUp:function(event){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target==this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}return false},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance)},_mouseDelayMet:function(event){return this.mouseDelayMet},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true}})})(jQuery);(function($,undefined){$.widget("ui.draggable",$.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(event);if(!this.handle){return false}if(o.iframeFix){$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body")})}return true},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager){$.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));if(o.containment){this._setContainment()}if(this._trigger("start",event)===false){this._clear();return false}this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event)}return true},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp({});return false}this.position=ui.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}return false},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event)}if(this.dropped){dropped=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original"){return false}if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(self._trigger("stop",event)!==false){self._clear()}})}else{if(this._trigger("stop",event)!==false){this._clear()}}return false},_mouseUp:function(event){if(this.options.iframeFix===true){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event)}return $.ui.mouse.prototype._mouseUp.call(this,event)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({})}else{this._clear()}return this},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target){handle=true}});return handle},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=="clone"?this.element.clone().removeAttr("id"):this.element);if(!helper.parents("body").length){helper.appendTo((o.appendTo=="parent"?this.element[0].parentNode:o.appendTo))}if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position"))){helper.css("position","absolute")}return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj=="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left" in obj){this.offset.click.left=obj.left+this.margins.left}if("right" in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top" in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom" in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&$.browser.msie)){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0),right:(parseInt(this.element.css("marginRight"),10)||0),bottom:(parseInt(this.element.css("marginBottom"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var o=this.options;if(o.containment=="parent"){o.containment=this.helper[0].parentNode}if(o.containment=="document"||o.containment=="window"){this.containment=[o.containment=="document"?0:$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,o.containment=="document"?0:$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(o.containment=="document"?0:$(window).scrollLeft())+$(o.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(o.containment=="document"?0:$(window).scrollTop())+($(o.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var c=$(o.containment);var ce=c[0];if(!ce){return}var co=c.offset();var over=($(ce).css("overflow")!="hidden");this.containment=[(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0),(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0),(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=c}else{if(o.containment.constructor==Array){this.containment=o.containment}}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-($.browser.safari&&$.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-($.browser.safari&&$.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))}},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){var containment;if(this.containment){if(this.relative_container){var co=this.relative_container.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]}else{containment=this.containment}if(event.pageX-this.offset.click.leftcontainment[2]){pageX=containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top}}if(o.grid){var top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?(!(top-this.offset.click.topcontainment[3])?top:(!(top-this.offset.click.topcontainment[2])?left:(!(left-this.offset.click.left=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d=t&&y1<=b)||(y2>=t&&y2<=b)||(y1b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1r));break;default:return false;break}};$.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope]||[];var type=event?event.type:null;var list=(t.currentItem||t.element).find(":data(droppable)").andSelf();droppablesLoop:for(var i=0;i
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=o.handles||(!$(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var n=this.handles.split(",");this.handles={};for(var i=0;i');if(/sw|se|ne|nw/.test(handle)){axis.css({zIndex:++o.zIndex})}if("se"==handle){axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[handle]=".ui-resizable-"+handle;this.element.append(axis)}}this._renderAxis=function(target){target=target||this.element;for(var i in this.handles){if(this.handles[i].constructor==String){this.handles[i]=$(this.handles[i],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var axis=$(this.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");target.css(padPos,padWrapper);this._proportionallyResize()}if(!$(this.handles[i]).length){continue}}};this._renderAxis(this.element);this._handles=$(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!self.resizing){if(this.className){var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}self.axis=axis&&axis[1]?axis[1]:"se"}});if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").hover(function(){if(o.disabled){return}$(this).removeClass("ui-resizable-autohide");self._handles.show()},function(){if(o.disabled){return}if(!self.resizing){$(this).addClass("ui-resizable-autohide");self._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){_destroy(this.element);var wrapper=this.element;wrapper.after(this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);_destroy(this.originalElement);return this},_mouseCapture:function(event){var handle=false;for(var i in this.handles){if($(this.handles[i])[0]==event.target){handle=true}}return !this.options.disabled&&handle},_mouseStart:function(event){var o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;this.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is(".ui-draggable")||(/absolute/).test(el.css("position"))){el.css({position:"absolute",top:iniPos.top,left:iniPos.left})}if($.browser.opera&&(/relative/).test(el.css("position"))){el.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var curleft=num(this.helper.css("left")),curtop=num(this.helper.css("top"));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=(typeof o.aspectRatio=="number")?o.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var cursor=$(".ui-resizable-"+this.axis).css("cursor");$("body").css("cursor",cursor=="auto"?this.axis+"-resize":cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true},_mouseDrag:function(event){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=(event.pageX-smp.left)||0,dy=(event.pageY-smp.top)||0;var trigger=this._change[a];if(!trigger){return false}var data=trigger.apply(this,[event,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;this._updateVirtualBoundaries(event.shiftKey);if(this._aspectRatio||event.shiftKey){data=this._updateRatio(data,event)}data=this._respectSize(data,event);this._propagate("resize",event);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(data);this._trigger("resize",event,this.ui());return false},_mouseStop:function(event){this.resizing=false;var o=this.options,self=this;if(this._helper){var pr=this._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var s={width:(self.helper.width()-soffsetw),height:(self.helper.height()-soffseth)},left=(parseInt(self.element.css("left"),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css("top"),10)+(self.position.top-self.originalPosition.top))||null;if(!o.animate){this.element.css($.extend(s,{top:top,left:left}))}self.helper.height(self.size.height);self.helper.width(self.size.width);if(this._helper&&!o.animate){this._proportionallyResize()}}$("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(forceAspectRatio){var o=this.options,pMinWidth,pMaxWidth,pMinHeight,pMaxHeight,b;b={minWidth:isNumber(o.minWidth)?o.minWidth:0,maxWidth:isNumber(o.maxWidth)?o.maxWidth:Infinity,minHeight:isNumber(o.minHeight)?o.minHeight:0,maxHeight:isNumber(o.maxHeight)?o.maxHeight:Infinity};if(this._aspectRatio||forceAspectRatio){pMinWidth=b.minHeight*this.aspectRatio;pMinHeight=b.minWidth/this.aspectRatio;pMaxWidth=b.maxHeight*this.aspectRatio;pMaxHeight=b.maxWidth/this.aspectRatio;if(pMinWidth>b.minWidth){b.minWidth=pMinWidth}if(pMinHeight>b.minHeight){b.minHeight=pMinHeight}if(pMaxWidthdata.width),isminh=isNumber(data.height)&&o.minHeight&&(o.minHeight>data.height);if(isminw){data.width=o.minWidth}if(isminh){data.height=o.minHeight}if(ismaxw){data.width=o.maxWidth}if(ismaxh){data.height=o.maxHeight}var dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height;var cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw&&cw){data.left=dw-o.minWidth}if(ismaxw&&cw){data.left=dw-o.maxWidth}if(isminh&&ch){data.top=dh-o.minHeight}if(ismaxh&&ch){data.top=dh-o.maxHeight}var isNotwh=!data.width&&!data.height;if(isNotwh&&!data.left&&data.top){data.top=null}else{if(isNotwh&&!data.top&&data.left){data.left=null}}return data},_proportionallyResize:function(){var o=this.options;if(!this._proportionallyResizeElements.length){return}var element=this.helper||this.element;for(var i=0;i');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=(ie6?1:0),pxyoffset=(ie6?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+pxyoffset,height:this.element.outerHeight()+pxyoffset,position:"absolute",left:this.elementOffset.left-ie6offset+"px",top:this.elementOffset.top-ie6offset+"px",zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(event,dx,dy){return{width:this.originalSize.width+dx}},w:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx}},n:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy}},s:function(event,dx,dy){return{height:this.originalSize.height+dy}},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);(n!="resize"&&this._trigger(n,event,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});$.extend($.ui.resizable,{version:"1.8.16"});$.ui.plugin.add("resizable","alsoResize",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options;var _store=function(exp){$(exp).each(function(){var el=$(this);el.data("resizable-alsoresize",{width:parseInt(el.width(),10),height:parseInt(el.height(),10),left:parseInt(el.css("left"),10),top:parseInt(el.css("top"),10),position:el.css("position")})})};if(typeof(o.alsoResize)=="object"&&!o.alsoResize.parentNode){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize)}else{$.each(o.alsoResize,function(exp){_store(exp)})}}else{_store(o.alsoResize)}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,os=self.originalSize,op=self.originalPosition;var delta={height:(self.size.height-os.height)||0,width:(self.size.width-os.width)||0,top:(self.position.top-op.top)||0,left:(self.position.left-op.left)||0},_alsoResize=function(exp,c){$(exp).each(function(){var el=$(this),start=$(this).data("resizable-alsoresize"),style={},css=c&&c.length?c:el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0){style[prop]=sum||null}});if($.browser.opera&&/relative/.test(el.css("position"))){self._revertToRelativePosition=true;el.css({position:"absolute",top:"auto",left:"auto"})}el.css(style)})};if(typeof(o.alsoResize)=="object"&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c)})}else{_alsoResize(o.alsoResize)}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var _reset=function(exp){$(exp).each(function(){var el=$(this);el.css({position:el.data("resizable-alsoresize").position})})};if(self._revertToRelativePosition){self._revertToRelativePosition=false;if(typeof(o.alsoResize)=="object"&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp){_reset(exp)})}else{_reset(o.alsoResize)}}$(this).removeData("resizable-alsoresize")}});$.ui.plugin.add("resizable","animate",{stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var pr=self._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var style={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css("left"),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css("top"),10)+(self.position.top-self.originalPosition.top))||null;self.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseInt(self.element.css("width"),10),height:parseInt(self.element.css("height"),10),top:parseInt(self.element.css("top"),10),left:parseInt(self.element.css("left"),10)};if(pr&&pr.length){$(pr[0]).css({width:data.width,height:data.height})}self._updateCache(data);self._propagate("resize",event)}})}});$.ui.plugin.add("resizable","containment",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,el=self.element;var oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce){return}self.containerElement=$(ce);if(/document/.test(oc)||oc==document){self.containerOffset={left:0,top:0};self.containerPosition={left:0,top:0};self.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight}}else{var element=$(ce),p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name))});self.containerOffset=element.offset();self.containerPosition=element.position();self.containerSize={height:(element.innerHeight()-p[3]),width:(element.innerWidth()-p[1])};var co=self.containerOffset,ch=self.containerSize.height,cw=self.containerSize.width,width=($.ui.hasScroll(ce,"left")?ce.scrollWidth:cw),height=($.ui.hasScroll(ce)?ce.scrollHeight:ch);self.parentData={element:ce,left:co.left,top:co.top,width:width,height:height}}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=self._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&(/static/).test(ce.css("position"))){cop=co}if(cp.left<(self._helper?co.left:0)){self.size.width=self.size.width+(self._helper?(self.position.left-co.left):(self.position.left-cop.left));if(pRatio){self.size.height=self.size.width/o.aspectRatio}self.position.left=o.helper?co.left:0}if(cp.top<(self._helper?co.top:0)){self.size.height=self.size.height+(self._helper?(self.position.top-co.top):self.position.top);if(pRatio){self.size.width=self.size.height*o.aspectRatio}self.position.top=self._helper?co.top:0}self.offset.left=self.parentData.left+self.position.left;self.offset.top=self.parentData.top+self.position.top;var woset=Math.abs((self._helper?self.offset.left-cop.left:(self.offset.left-cop.left))+self.sizeDiff.width),hoset=Math.abs((self._helper?self.offset.top-cop.top:(self.offset.top-co.top))+self.sizeDiff.height);var isParent=self.containerElement.get(0)==self.element.parent().get(0),isOffsetRelative=/relative|absolute/.test(self.containerElement.css("position"));if(isParent&&isOffsetRelative){woset-=self.parentData.left}if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio){self.size.height=self.size.width/self.aspectRatio}}if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio){self.size.width=self.size.height*self.aspectRatio}}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options,cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.outerWidth()-self.sizeDiff.width,h=helper.outerHeight()-self.sizeDiff.height;if(self._helper&&!o.animate&&(/relative/).test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}if(self._helper&&!o.animate&&(/static/).test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.clone();self.ghost.css({opacity:0.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof o.ghost=="string"?o.ghost:"");self.ghost.appendTo(self.helper)},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost){self.ghost.css({position:"relative",height:self.size.height,width:self.size.width})}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper){self.helper.get(0).removeChild(self.ghost.get(0))}}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy}else{if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy}else{if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox}else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox}}}}});var num=function(v){return parseInt(v,10)||0};var isNumber=function(value){return !isNaN(parseInt(value,10))}})(jQuery);(function($,undefined){$.widget("ui.selectable",$.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;var selectees;this.refresh=function(){selectees=$(self.options.filter,self.element[0]);selectees.each(function(){var $this=$(this);var pos=$this.offset();$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")})})};this.refresh();this.selectees=selectees.addClass("ui-selectee");this._mouseInit();this.helper=$("
")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(event){var self=this;this.opos=[event.pageX,event.pageY];if(this.options.disabled){return}var options=this.options;this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({left:event.clientX,top:event.clientY,width:0,height:0});if(options.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element})}});$(event.target).parents().andSelf().each(function(){var selectee=$.data(this,"selectable-item");if(selectee){var doSelect=!event.metaKey||!selectee.$element.hasClass("ui-selected");selectee.$element.removeClass(doSelect?"ui-unselecting":"ui-selected").addClass(doSelect?"ui-selecting":"ui-unselecting");selectee.unselecting=!doSelect;selectee.selecting=doSelect;selectee.selected=doSelect;if(doSelect){self._trigger("selecting",event,{selecting:selectee.element})}else{self._trigger("unselecting",event,{unselecting:selectee.element})}return false}})},_mouseDrag:function(event){var self=this;this.dragged=true;if(this.options.disabled){return}var options=this.options;var x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;if(x1>x2){var tmp=x2;x2=x1;x1=tmp}if(y1>y2){var tmp=y2;y2=y1;y1=tmp}this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item");if(!selectee||selectee.element==self.element[0]){return}var hit=false;if(options.tolerance=="touch"){hit=(!(selectee.left>x2||selectee.righty2||selectee.bottomx1&&selectee.righty1&&selectee.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?o.axis==="x"||(/left|right/).test(this.items[0].item.css("float"))||(/inline|table-cell/).test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--){this.items[i].item.removeData("sortable-item")}return this},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget()[value?"addClass":"removeClass"]("ui-sortable-disabled")}else{$.Widget.prototype._setOption.apply(this,arguments)}},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,"sortable-item")==self){currentItem=$(this);return false}});if($.data(event.target,"sortable-item")==self){currentItem=$(event.target)}if(!currentItem){return false}if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target){validHandle=true}});if(!validHandle){return false}}this.currentItem=currentItem;this._removeCurrentsFromItems();return true},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(o.containment){this._setContainment()}if(o.cursor){if($("body").css("cursor")){this._storedCursor=$("body").css("cursor")}$("body").css("cursor",o.cursor)}if(o.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",o.opacity)}if(o.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",o.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this))}}if($.ui.ddmanager){$.ui.ddmanager.current=this}if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection){continue}if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=="semi-dynamic"?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item)}else{break}this._trigger("change",event,this._uiHash());break}}this._contactContainers(event);if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(event,noPropagation){if(!event){return}if($.ui.ddmanager&&!this.options.dropBehaviour){$.ui.ddmanager.drop(this,event)}if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event)})}else{this._clear(event,noPropagation)}return false},cancel:function(){var self=this;if(this.dragging){this._mouseUp({target:null});if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0}}}if(this.placeholder){if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem)}else{$(this.domPosition.parent).prepend(this.currentItem)}}return this},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||(/(.+)[-=_](.+)/));if(res){str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))}});if(!str.length&&o.key){str.push(o.key+"=")}return str.join("&")},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"")});return ret},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=(y1+dyClick)>t&&(y1+dyClick)l&&(x1+dxClick)item[this.floating?"width":"height"])){return isOverElement}else{return(l0?"down":"up")},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left")},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],"sortable");if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst])}}}}queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this)})}return $(items)},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],"sortable");if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst)}}}}for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j=0;i--){var item=this.items[i];if(item.instance!=this.currentContainer&&this.currentContainer&&item.item[0]!=this.currentItem[0]){continue}var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight()}var p=t.offset();item.left=p.left;item.top=p.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight()}}return this},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className){el.style.visibility="hidden"}return el},update:function(container,p){if(className&&!o.forcePlaceholderSize){return}if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css("paddingTop")||0,10)-parseInt(self.currentItem.css("paddingBottom")||0,10))}if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css("paddingLeft")||0,10)-parseInt(self.currentItem.css("paddingRight")||0,10))}}}}self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder)},_contactContainers:function(event){var innermostContainer=null,innermostIndex=null;for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.currentItem[0],this.containers[i].element[0])){continue}if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.ui.contains(this.containers[i].element[0],innermostContainer.element[0])){continue}innermostContainer=this.containers[i];innermostIndex=i}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0}}}if(!innermostContainer){return}if(this.containers.length===1){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}else{if(this.currentContainer!=this.containers[innermostIndex]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[innermostIndex].floating?"left":"top"];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])){continue}var cur=this.items[j][this.containers[innermostIndex].floating?"left":"top"];if(Math.abs(cur-base)this.containment[2]){pageX=this.containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top}}if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.topthis.containment[3])?top:(!(top-this.offset.click.topthis.containment[2])?left:(!(left-this.offset.click.left=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this))}}).call(this,this.containers[i]));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this))}}).call(this,this.containers[i]))}}}for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this))}}).call(this,this.containers[i]))}if(this.containers[i].containerCache.over){delayedTriggers.push((function(c){return function(event){c._trigger("out",event,this._uiHash(this))}}).call(this,this.containers[i]));this.containers[i].containerCache.over=0}}if(this._storedCursor){$("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),active=document.activeElement;element.wrap(wrapper);if(element[0]===active||$.contains(element[0],active)){$(active).focus()}wrapper=element.parent();if(element.css("position")=="static"){wrapper.css({position:"relative"});element.css({position:"relative"})}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto"}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return wrapper.css(props).show()},removeWrapper:function(element){var parent,active=document.activeElement;if(element.parent().is(".ui-effects-wrapper")){parent=element.parent().replaceWith(element);if(element[0]===active||$.contains(element[0],active)){$(active).focus()}return parent}return element},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1]}});return value}});function _normalizeArguments(effect,options,speed,callback){if(typeof effect=="object"){callback=options;speed=null;options=effect;effect=options.effect}if($.isFunction(options)){callback=options;speed=null;options={}}if(typeof options=="number"||$.fx.speeds[options]){callback=speed;speed=options;options={}}if($.isFunction(speed)){callback=speed;speed=null}options=options||{};speed=speed||options.duration;speed=$.fx.off?0:typeof speed=="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;callback=callback||options.complete;return[effect,options,speed,callback]}function standardSpeed(speed){if(!speed||typeof speed==="number"||$.fx.speeds[speed]){return true}if(typeof speed==="string"&&!$.effects[speed]){return true}return false}$.fn.extend({effect:function(effect,options,speed,callback){var args=_normalizeArguments.apply(this,arguments),args2={options:args[1],duration:args[2],callback:args[3]},mode=args2.options.mode,effectMethod=$.effects[effect];if($.fx.off||!effectMethod){if(mode){return this[mode](args2.duration,args2.callback)}else{return this.each(function(){if(args2.callback){args2.callback.call(this)}})}}return effectMethod.call(this,args2)},_show:$.fn.show,show:function(speed){if(standardSpeed(speed)){return this._show.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="show";return this.effect.apply(this,args)}},_hide:$.fn.hide,hide:function(speed){if(standardSpeed(speed)){return this._hide.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="hide";return this.effect.apply(this,args)}},__toggle:$.fn.toggle,toggle:function(speed){if(standardSpeed(speed)||typeof speed==="boolean"||$.isFunction(speed)){return this.__toggle.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args[1].mode="toggle";return this.effect.apply(this,args)}},cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit]}});return val}});$.easing.jswing=$.easing.swing;$.extend($.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return -c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b}return -c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t+b}return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b}return -c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t*t+b}return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return -c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return -c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0){return b}if(t==d){return b+c}if((t/=d/2)<1){return c/2*Math.pow(2,10*(t-1))+b}return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return -c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1){return -c/2*(Math.sqrt(1-t*t)-1)+b}return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0){return b}if((t/=d)==1){return b+c}if(!p){p=d*0.3}if(a").css({position:"absolute",visibility:"visible",left:-j*(width/cells),top:-i*(height/rows)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:width/cells,height:height/rows,left:offset.left+j*(width/cells)+(o.options.mode=="show"?(j-Math.floor(cells/2))*(width/cells):0),top:offset.top+i*(height/rows)+(o.options.mode=="show"?(i-Math.floor(rows/2))*(height/rows):0),opacity:o.options.mode=="show"?0:1}).animate({left:offset.left+j*(width/cells)+(o.options.mode=="show"?0:(j-Math.floor(cells/2))*(width/cells)),top:offset.top+i*(height/rows)+(o.options.mode=="show"?0:(i-Math.floor(rows/2))*(height/rows)),opacity:o.options.mode=="show"?1:0},o.duration||500)}}setTimeout(function(){o.options.mode=="show"?el.css({visibility:"visible"}):el.css({visibility:"visible"}).hide();if(o.callback){o.callback.apply(el[0])}el.dequeue();$("div.ui-effects-explode").remove()},o.duration||500)})}})(jQuery);(function($,undefined){$.effects.fade=function(o){return this.queue(function(){var elem=$(this),mode=$.effects.setMode(elem,o.options.mode||"hide");elem.animate({opacity:mode},{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){(o.callback&&o.callback.apply(this,arguments));elem.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.fold=function(o){return this.queue(function(){var el=$(this),props=["position","top","bottom","left","right"];var mode=$.effects.setMode(el,o.options.mode||"hide");var size=o.options.size||15;var horizFirst=!(!o.options.horizFirst);var duration=o.duration?o.duration/2:$.fx.speeds._default/2;$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});var widthFirst=((mode=="show")!=horizFirst);var ref=widthFirst?["width","height"]:["height","width"];var distance=widthFirst?[wrapper.width(),wrapper.height()]:[wrapper.height(),wrapper.width()];var percent=/([0-9]+)%/.exec(size);if(percent){size=parseInt(percent[1],10)/100*distance[mode=="hide"?0:1]}if(mode=="show"){wrapper.css(horizFirst?{height:0,width:size}:{height:size,width:0})}var animation1={},animation2={};animation1[ref[0]]=mode=="show"?distance[0]:size;animation2[ref[1]]=mode=="show"?distance[1]:0;wrapper.animate(animation1,duration,o.options.easing).animate(animation2,duration,o.options.easing,function(){if(mode=="hide"){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback){o.callback.apply(el[0],arguments)}el.dequeue()})})}})(jQuery);(function($,undefined){$.effects.highlight=function(o){return this.queue(function(){var elem=$(this),props=["backgroundImage","backgroundColor","opacity"],mode=$.effects.setMode(elem,o.options.mode||"show"),animation={backgroundColor:elem.css("backgroundColor")};if(mode=="hide"){animation.opacity=0}$.effects.save(elem,props);elem.show().css({backgroundImage:"none",backgroundColor:o.options.color||"#ffff99"}).animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){(mode=="hide"&&elem.hide());$.effects.restore(elem,props);(mode=="show"&&!$.support.opacity&&this.style.removeAttribute("filter"));(o.callback&&o.callback.apply(this,arguments));elem.dequeue()}})})}})(jQuery);(function($,undefined){$.effects.pulsate=function(o){return this.queue(function(){var elem=$(this),mode=$.effects.setMode(elem,o.options.mode||"show");times=((o.options.times||5)*2)-1;duration=o.duration?o.duration/2:$.fx.speeds._default/2,isVisible=elem.is(":visible"),animateTo=0;if(!isVisible){elem.css("opacity",0).show();animateTo=1}if((mode=="hide"&&isVisible)||(mode=="show"&&!isVisible)){times--}for(var i=0;i').appendTo(document.body).addClass(o.options.className).css({top:startPosition.top,left:startPosition.left,height:elem.innerHeight(),width:elem.innerWidth(),position:"absolute"}).animate(animation,o.duration,o.options.easing,function(){transfer.remove();(o.callback&&o.callback.apply(elem[0],arguments));elem.dequeue()})})}})(jQuery);(function($,undefined){$.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var self=this,options=self.options;self.running=0;self.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");self.headers=self.element.find(options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(options.disabled){return}$(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(options.disabled){return}$(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(options.disabled){return}$(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(options.disabled){return}$(this).removeClass("ui-state-focus")});self.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(options.navigation){var current=self.element.find("a").filter(options.navigationFilter).eq(0);if(current.length){var header=current.closest(".ui-accordion-header");if(header.length){self.active=header}else{self.active=current.closest(".ui-accordion-content").prev()}}}self.active=self._findActive(self.active||options.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");self.active.next().addClass("ui-accordion-content-active");self._createIcons();self.resize();self.element.attr("role","tablist");self.headers.attr("role","tab").bind("keydown.accordion",function(event){return self._keydown(event)}).next().attr("role","tabpanel");self.headers.not(self.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();if(!self.active.length){self.headers.eq(0).attr("tabIndex",0)}else{self.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0})}if(!$.browser.safari){self.headers.find("a").attr("tabIndex",-1)}if(options.event){self.headers.bind(options.event.split(" ").join(".accordion ")+".accordion",function(event){self._clickHandler.call(self,event,this);event.preventDefault()})}},_createIcons:function(){var options=this.options;if(options.icons){$("").addClass("ui-icon "+options.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(options.icons.header).toggleClass(options.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var options=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var contents=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(options.autoHeight||options.fillHeight){contents.css("height","")}return $.Widget.prototype.destroy.call(this)},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key=="active"){this.activate(value)}if(key=="icons"){this._destroyIcons();if(value){this._createIcons()}}if(key=="disabled"){this.headers.add(this.headers.next())[value?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")}},_keydown:function(event){if(this.options.disabled||event.altKey||event.ctrlKey){return}var keyCode=$.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._clickHandler({target:event.target},event.target);event.preventDefault()}if(toFocus){$(event.target).attr("tabIndex",-1);$(toFocus).attr("tabIndex",0);toFocus.focus();return false}return true},resize:function(){var options=this.options,maxHeight;if(options.fillSpace){if($.browser.msie){var defOverflow=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}maxHeight=this.element.parent().height();if($.browser.msie){this.element.parent().css("overflow",defOverflow)}this.headers.each(function(){maxHeight-=$(this).outerHeight(true)});this.headers.next().each(function(){$(this).height(Math.max(0,maxHeight-$(this).innerHeight()+$(this).height()))}).css("overflow","auto")}else{if(options.autoHeight){maxHeight=0;this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).height("").height())}).height(maxHeight)}}return this},activate:function(index){this.options.active=index;var active=this._findActive(index)[0];this._clickHandler({target:active},active);return this},_findActive:function(selector){return selector?typeof selector==="number"?this.headers.filter(":eq("+selector+")"):this.headers.not(this.headers.not(selector)):selector===false?$([]):this.headers.filter(":eq(0)")},_clickHandler:function(event,target){var options=this.options;if(options.disabled){return}if(!event.target){if(!options.collapsible){return}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(options.icons.headerSelected).addClass(options.icons.header);this.active.next().addClass("ui-accordion-content-active");var toHide=this.active.next(),data={options:options,newHeader:$([]),oldHeader:options.active,newContent:$([]),oldContent:toHide},toShow=(this.active=$([]));this._toggle(toShow,toHide,data);return}var clicked=$(event.currentTarget||target),clickedIsActive=clicked[0]===this.active[0];options.active=options.collapsible&&clickedIsActive?false:this.headers.index(clicked);if(this.running||(!options.collapsible&&clickedIsActive)){return}var active=this.active,toShow=clicked.next(),toHide=this.active.next(),data={options:options,newHeader:clickedIsActive&&options.collapsible?$([]):clicked,oldHeader:this.active,newContent:clickedIsActive&&options.collapsible?$([]):toShow,oldContent:toHide},down=this.headers.index(this.active[0])>this.headers.index(clicked[0]);this.active=clickedIsActive?$([]):clicked;this._toggle(toShow,toHide,data,clickedIsActive,down);active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(options.icons.headerSelected).addClass(options.icons.header);if(!clickedIsActive){clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(options.icons.header).addClass(options.icons.headerSelected);clicked.next().addClass("ui-accordion-content-active")}return},_toggle:function(toShow,toHide,data,clickedIsActive,down){var self=this,options=self.options;self.toShow=toShow;self.toHide=toHide;self.data=data;var complete=function(){if(!self){return}return self._completed.apply(self,arguments)};self._trigger("changestart",null,self.data);self.running=toHide.size()===0?toShow.size():toHide.size();if(options.animated){var animOptions={};if(options.collapsible&&clickedIsActive){animOptions={toShow:$([]),toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight||options.fillSpace}}else{animOptions={toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight||options.fillSpace}}if(!options.proxied){options.proxied=options.animated}if(!options.proxiedDuration){options.proxiedDuration=options.duration}options.animated=$.isFunction(options.proxied)?options.proxied(animOptions):options.proxied;options.duration=$.isFunction(options.proxiedDuration)?options.proxiedDuration(animOptions):options.proxiedDuration;var animations=$.ui.accordion.animations,duration=options.duration,easing=options.animated;if(easing&&!animations[easing]&&!$.easing[easing]){easing="slide"}if(!animations[easing]){animations[easing]=function(options){this.slide(options,{easing:easing,duration:duration||700})}}animations[easing](animOptions)}else{if(options.collapsible&&clickedIsActive){toShow.toggle()}else{toHide.hide();toShow.show()}complete(true)}toHide.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur();toShow.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(cancel){this.running=cancel?0:--this.running;if(this.running){return}if(this.options.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length){this.toHide.parent()[0].className=this.toHide.parent()[0].className}this._trigger("change",null,this.data)}});$.extend($.ui.accordion,{version:"1.8.16",animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);if(!options.toHide.size()){options.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},options);return}if(!options.toShow.size()){options.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},options);return}var overflow=options.toShow.css("overflow"),percentDone=0,showProps={},hideProps={},fxAttrs=["height","paddingTop","paddingBottom"],originalWidth;var s=options.toShow;originalWidth=s[0].style.width;s.width(parseInt(s.parent().width(),10)-parseInt(s.css("paddingLeft"),10)-parseInt(s.css("paddingRight"),10)-(parseInt(s.css("borderLeftWidth"),10)||0)-(parseInt(s.css("borderRightWidth"),10)||0));$.each(fxAttrs,function(i,prop){hideProps[prop]="hide";var parts=(""+$.css(options.toShow[0],prop)).match(/^([\d+-.]+)(.*)$/);showProps[prop]={value:parts[1],unit:parts[2]||"px"}});options.toShow.css({height:0,overflow:"hidden"}).show();options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{step:function(now,settings){if(settings.prop=="height"){percentDone=(settings.end-settings.start===0)?0:(settings.now-settings.start)/(settings.end-settings.start)}options.toShow[0].style[settings.prop]=(percentDone*showProps[settings.prop].value)+showProps[settings.prop].unit},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","")}options.toShow.css({width:originalWidth,overflow:overflow});options.complete()}})},bounceslide:function(options){this.slide(options,{easing:options.down?"easeOutBounce":"swing",duration:options.down?1000:200})}}})})(jQuery);(function($,undefined){var requestIndex=0;$.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var self=this,doc=this.element[0].ownerDocument,suppressKeyPress;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(event){if(self.options.disabled||self.element.propAttr("readOnly")){return}suppressKeyPress=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:self._move("previousPage",event);break;case keyCode.PAGE_DOWN:self._move("nextPage",event);break;case keyCode.UP:self._move("previous",event);event.preventDefault();break;case keyCode.DOWN:self._move("next",event);event.preventDefault();break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:if(self.menu.active){suppressKeyPress=true;event.preventDefault()}case keyCode.TAB:if(!self.menu.active){return}self.menu.select(event);break;case keyCode.ESCAPE:self.element.val(self.term);self.close(event);break;default:clearTimeout(self.searching);self.searching=setTimeout(function(){if(self.term!=self.element.val()){self.selectedItem=null;self.search(null,event)}},self.options.delay);break}}).bind("keypress.autocomplete",function(event){if(suppressKeyPress){suppressKeyPress=false;event.preventDefault()}}).bind("focus.autocomplete",function(){if(self.options.disabled){return}self.selectedItem=null;self.previous=self.element.val()}).bind("blur.autocomplete",function(event){if(self.options.disabled){return}clearTimeout(self.searching);self.closing=setTimeout(function(){self.close(event);self._change(event)},150)});this._initSource();this.response=function(){return self._response.apply(self,arguments)};this.menu=$("
    ").addClass("ui-autocomplete").appendTo($(this.options.appendTo||"body",doc)[0]).mousedown(function(event){var menuElement=self.menu.element[0];if(!$(event.target).closest(".ui-menu-item").length){setTimeout(function(){$(document).one("mousedown",function(event){if(event.target!==self.element[0]&&event.target!==menuElement&&!$.ui.contains(menuElement,event.target)){self.close()}})},1)}setTimeout(function(){clearTimeout(self.closing)},13)}).menu({focus:function(event,ui){var item=ui.item.data("item.autocomplete");if(false!==self._trigger("focus",event,{item:item})){if(/^key/.test(event.originalEvent.type)){self.element.val(item.value)}}},selected:function(event,ui){var item=ui.item.data("item.autocomplete"),previous=self.previous;if(self.element[0]!==doc.activeElement){self.element.focus();self.previous=previous;setTimeout(function(){self.previous=previous;self.selectedItem=item},1)}if(false!==self._trigger("select",event,{item:item})){self.element.val(item.value)}self.term=self.element.val();self.close(event);self.selectedItem=item},blur:function(event,ui){if(self.menu.element.is(":visible")&&(self.element.val()!==self.term)){self.element.val(self.term)}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if($.fn.bgiframe){this.menu.element.bgiframe()}},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();$.Widget.prototype.destroy.call(this)},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key==="source"){this._initSource()}if(key==="appendTo"){this.menu.element.appendTo($(value||"body",this.element[0].ownerDocument)[0])}if(key==="disabled"&&value&&this.xhr){this.xhr.abort()}},_initSource:function(){var self=this,array,url;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term))}}else{if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(self.xhr){self.xhr.abort()}self.xhr=$.ajax({url:url,data:request,dataType:"json",autocompleteRequest:++requestIndex,success:function(data,status){if(this.autocompleteRequest===requestIndex){response(data)}},error:function(){if(this.autocompleteRequest===requestIndex){response([])}}})}}else{this.source=this.options.source}}},search:function(value,event){value=value!=null?value:this.element.val();this.term=this.element.val();if(value.length").data("item.autocomplete",item).append($("").text(item.label)).appendTo(ul)},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return}if(this.menu.first()&&/^previous/.test(direction)||this.menu.last()&&/^next/.test(direction)){this.element.val(this.term);this.menu.deactivate();return}this.menu[direction](event)},widget:function(){return this.menu.element}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value)})}})}(jQuery));(function($){$.widget("ui.menu",{_create:function(){var self=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(event){if(!$(event.target).closest(".ui-menu-item a").length){return}event.preventDefault();self.select(event)});this.refresh()},refresh:function(){var self=this;var items=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");items.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(event){self.activate(event,$(this).parent())}).mouseleave(function(){self.deactivate()})},activate:function(event,item){this.deactivate();if(this.hasScroll()){var offset=item.offset().top-this.element.offset().top,scroll=this.element.scrollTop(),elementHeight=this.element.height();if(offset<0){this.element.scrollTop(scroll+offset)}else{if(offset>=elementHeight){this.element.scrollTop(scroll+offset-elementHeight+item.height())}}}this.active=item.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",event,{item:item})},deactivate:function(){if(!this.active){return}this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null},next:function(event){this.move("next",".ui-menu-item:first",event)},previous:function(event){this.move("prev",".ui-menu-item:last",event)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(direction,edge,event){if(!this.active){this.activate(event,this.element.children(edge));return}var next=this.active[direction+"All"](".ui-menu-item").eq(0);if(next.length){this.activate(event,next)}else{this.activate(event,this.element.children(edge))}},nextPage:function(event){if(this.hasScroll()){if(!this.active||this.last()){this.activate(event,this.element.children(".ui-menu-item:first"));return}var base=this.active.offset().top,height=this.element.height(),result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base-height+$(this).height();return close<10&&close>-10});if(!result.length){result=this.element.children(".ui-menu-item:last")}this.activate(event,result)}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))}},previousPage:function(event){if(this.hasScroll()){if(!this.active||this.first()){this.activate(event,this.element.children(".ui-menu-item:last"));return}var base=this.active.offset().top,height=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base+height-$(this).height();return close<10&&close>-10});if(!result.length){result=this.element.children(".ui-menu-item:first")}this.activate(event,result)}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))}},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(buttonElement.empty()).text(),icons=this.options.icons,multipleIcons=icons.primary&&icons.secondary,buttonClasses=[];if(icons.primary||icons.secondary){if(this.options.text){buttonClasses.push("ui-button-text-icon"+(multipleIcons?"s":(icons.primary?"-primary":"-secondary")))}if(icons.primary){buttonElement.prepend("")}if(icons.secondary){buttonElement.append("")}if(!this.options.text){buttonClasses.push(multipleIcons?"ui-button-icons-only":"ui-button-icon-only");if(!this.hasTitle){buttonElement.attr("title",buttonText)}}}else{buttonClasses.push("ui-button-text-only")}buttonElement.addClass(buttonClasses.join(" "))}});$.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(key,value){if(key==="disabled"){this.buttons.button("option",key,value)}$.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var ltr=this.element.css("direction")==="ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return $(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(ltr?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(ltr?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return $(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");$.Widget.prototype.destroy.call(this)}})}(jQuery));(function($,undefined){$.extend($.ui,{datepicker:{version:"1.8.16"}});var PROP_NAME="datepicker";var dpuuid=new Date().getTime();var instActive;function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=bindHover($('
    '))}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){if(this.debug){console.log.apply("",arguments)}},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:bindHover($('
    ')))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});this._autoSize(inst);$.data(target,PROP_NAME,inst);if(inst.settings.disabled){this._disableDatepicker(target)}},_attachments:function(input,inst){var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove()}if(appendText){inst.append=$(''+appendText+"");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==input[0]){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(input[0])}return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var date=new Date(2009,12-1,20);var dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){var findMax=function(names){var max=0;var maxI=0;for(var i=0;imax){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);if(inst.settings.disabled){this._disableDatepicker(target)}inst.dpDiv.css("display","block")},_dialogDatepicker:function(input,date,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){this.uuid+=1;var id="dp"+this.uuid;this._dialogInput=$('');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=(date&&date.constructor==Date?this._formatDate(inst,date):date);this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=document.documentElement.clientWidth;var browserHeight=document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i-1)}},_doKeyUp:function(event){var inst=$.datepicker._getInst(event.target);if(inst.input.val()!=inst.lastVal){try{var date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),(inst.input?inst.input.val():null),$.datepicker._getFormatConfig(inst));if(date){$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst)}}catch(event){$.datepicker.log(event)}}return true},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!=inst){if($.datepicker._datepickerShowing){$.datepicker._triggerOnClose($.datepicker._curInst)}$.datepicker._curInst.dpDiv.stop(true,true)}var beforeShow=$.datepicker._get(inst,"beforeShow");var beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{};if(beforeShowSettings===false){return}extendRemove(inst.settings,beforeShowSettings);inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim");var duration=$.datepicker._get(inst,"duration");var postProcess=function(){var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){var borders=$.datepicker._getBorders(inst.dpDiv);cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}};inst.dpDiv.zIndex($(input).zIndex()+1);$.datepicker._datepickerShowing=true;if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim||"show"]((showAnim?duration:null),postProcess)}if(!showAnim||!duration){postProcess()}if(inst.input.is(":visible")&&!inst.input.is(":disabled")){inst.input.focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var self=this;self.maxRows=4;var borders=$.datepicker._getBorders(inst.dpDiv);instActive=inst;inst.dpDiv.empty().append(this._generateHTML(inst));var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}inst.dpDiv.find("."+this._dayOverClass+" a").mouseover();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst==$.datepicker._curInst&&$.datepicker._datepickerShowing&&inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&inst.input[0]!=document.activeElement){inst.input.focus()}if(inst.yearshtml){var origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},_getBorders:function(elem){var convert=function(value){return{thin:1,medium:2,thick:3}[value]||value};return[parseFloat(convert(elem.css("border-left-width"))),parseFloat(convert(elem.css("border-top-width")))]},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=document.documentElement.clientWidth+$(document).scrollLeft();var viewHeight=document.documentElement.clientHeight+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var inst=this._getInst(obj);var isRTL=this._get(inst,"isRTL");while(obj&&(obj.type=="hidden"||obj.nodeType!=1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}var position=$(obj).offset();return[position.left,position.top]},_triggerOnClose:function(inst){var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}},_hideDatepicker:function(input){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(this._datepickerShowing){var showAnim=this._get(inst,"showAnim");var duration=this._get(inst,"duration");var postProcess=function(){$.datepicker._tidyDialog(inst);this._curInst=null};if($.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess)}if(!showAnim){postProcess()}$.datepicker._triggerOnClose(inst);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if($target[0].id!=$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length==0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker()}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input.focus()}this._lastInput=null}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);var dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));var time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+112?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!date;var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;var newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date()));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!=inst.selectedMonth||origYear!=inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&maxDrawmaxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?''+prevText+"":(hideIfNoPrevNext?"":''+prevText+""));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?''+nextText+"":(hideIfNoPrevNext?"":''+nextText+""));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'":"");var buttonPanel=(showButtonPanel)?'
    '+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'":"")+(isRTL?"":controls)+"
    ":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var showWeek=this._get(inst,"showWeek");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var selectOtherMonths=this._get(inst,"selectOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+='">'}calender+='
    '+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+'
    ';var thead=(showWeek?'":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="=5?' class="ui-datepicker-week-end"':"")+'>'+dayNamesMin[day]+""}calender+=thead+"";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var curRows=Math.ceil((leadDays+daysInMonth)/7);var numRows=(isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows);this.maxRows=numRows;var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow";var tbody=(!showWeek?"":'");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||(minDate&&printDatemaxDate);tbody+='";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+""}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="
    '+this._get(inst,"weekHeader")+"
    '+this._get(inst,"calculateWeek")(printDate)+""+(otherMonth&&!showOtherMonths?" ":(unselectable?''+printDate.getDate()+"":''+printDate.getDate()+""))+"
    "+(isMultiMonth?""+((numMonths[0]>0&&col==numMonths[1]-1)?'
    ':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='
    ';var monthHtml="";if(secondary||!changeMonth){monthHtml+=''+monthNames[drawMonth]+""}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?" ":"")}if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+=''+drawYear+""}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new Date().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+='";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?" ":"")+monthHtml}html+="
    ";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=(minDate&&datemaxDate?maxDate:newDate);return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.bind("mouseout",function(event){var elem=$(event.target).closest(selector);if(!elem.length){return}elem.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(event){var elem=$(event.target).closest(selector);if($.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])||!elem.length){return}elem.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");elem.addClass("ui-state-hover");if(elem.hasClass("ui-datepicker-prev")){elem.addClass("ui-datepicker-prev-hover")}if(elem.hasClass("ui-datepicker-next")){elem.addClass("ui-datepicker-next-hover")}})}function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!this.length){return this}if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.8.16";window["DP_jQuery_"+dpuuid]=$})(jQuery);(function($,undefined){var uiDialogClasses="ui-dialog ui-widget ui-widget-content ui-corner-all ",sizeRelatedOptions={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},attrFn=$.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};$.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset)}}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string"){this.originalTitle=""}this.options.title=this.options.title||this.originalTitle;var self=this,options=self.options,title=options.title||" ",titleId=$.ui.dialog.getTitleId(self.element),uiDialog=(self.uiDialog=$("
    ")).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({zIndex:options.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(event){if(options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){self.close(event);event.preventDefault()}}).attr({role:"dialog","aria-labelledby":titleId}).mousedown(function(event){self.moveToTop(false,event)}),uiDialogContent=self.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(uiDialog),uiDialogTitlebar=(self.uiDialogTitlebar=$("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(uiDialog),uiDialogTitlebarClose=$('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){uiDialogTitlebarClose.addClass("ui-state-hover")},function(){uiDialogTitlebarClose.removeClass("ui-state-hover")}).focus(function(){uiDialogTitlebarClose.addClass("ui-state-focus")}).blur(function(){uiDialogTitlebarClose.removeClass("ui-state-focus")}).click(function(event){self.close(event);return false}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(self.uiDialogTitlebarCloseText=$("")).addClass("ui-icon ui-icon-closethick").text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$("").addClass("ui-dialog-title").attr("id",titleId).html(title).prependTo(uiDialogTitlebar);if($.isFunction(options.beforeclose)&&!$.isFunction(options.beforeClose)){options.beforeClose=options.beforeclose}uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();if(options.draggable&&$.fn.draggable){self._makeDraggable()}if(options.resizable&&$.fn.resizable){self._makeResizable()}self._createButtons(options.buttons);self._isOpen=false;if($.fn.bgiframe){uiDialog.bgiframe()}},_init:function(){if(this.options.autoOpen){this.open()}},destroy:function(){var self=this;if(self.overlay){self.overlay.destroy()}self.uiDialog.hide();self.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");self.uiDialog.remove();if(self.originalTitle){self.element.attr("title",self.originalTitle)}return self},widget:function(){return this.uiDialog},close:function(event){var self=this,maxZ,thisZ;if(false===self._trigger("beforeClose",event)){return}if(self.overlay){self.overlay.destroy()}self.uiDialog.unbind("keypress.ui-dialog");self._isOpen=false;if(self.options.hide){self.uiDialog.hide(self.options.hide,function(){self._trigger("close",event)})}else{self.uiDialog.hide();self._trigger("close",event)}$.ui.dialog.overlay.resize();if(self.options.modal){maxZ=0;$(".ui-dialog").each(function(){if(this!==self.uiDialog[0]){thisZ=$(this).css("z-index");if(!isNaN(thisZ)){maxZ=Math.max(maxZ,thisZ)}}});$.ui.dialog.maxZ=maxZ}return self},isOpen:function(){return this._isOpen},moveToTop:function(force,event){var self=this,options=self.options,saveScroll;if((options.modal&&!force)||(!options.stack&&!options.modal)){return self._trigger("focus",event)}if(options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=options.zIndex}if(self.overlay){$.ui.dialog.maxZ+=1;self.overlay.$el.css("z-index",$.ui.dialog.overlay.maxZ=$.ui.dialog.maxZ)}saveScroll={scrollTop:self.element.scrollTop(),scrollLeft:self.element.scrollLeft()};$.ui.dialog.maxZ+=1;self.uiDialog.css("z-index",$.ui.dialog.maxZ);self.element.attr(saveScroll);self._trigger("focus",event);return self},open:function(){if(this._isOpen){return}var self=this,options=self.options,uiDialog=self.uiDialog;self.overlay=options.modal?new $.ui.dialog.overlay(self):null;self._size();self._position(options.position);uiDialog.show(options.show);self.moveToTop(true);if(options.modal){uiDialog.bind("keypress.ui-dialog",function(event){if(event.keyCode!==$.ui.keyCode.TAB){return}var tabbables=$(":tabbable",this),first=tabbables.filter(":first"),last=tabbables.filter(":last");if(event.target===last[0]&&!event.shiftKey){first.focus(1);return false}else{if(event.target===first[0]&&event.shiftKey){last.focus(1);return false}}})}$(self.element.find(":tabbable").get().concat(uiDialog.find(".ui-dialog-buttonpane :tabbable").get().concat(uiDialog.get()))).eq(0).focus();self._isOpen=true;self._trigger("open");return self},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),uiButtonSet=$("
    ").addClass("ui-dialog-buttonset").appendTo(uiDialogButtonPane);self.uiDialog.find(".ui-dialog-buttonpane").remove();if(typeof buttons==="object"&&buttons!==null){$.each(buttons,function(){return !(hasButtons=true)})}if(hasButtons){$.each(buttons,function(name,props){props=$.isFunction(props)?{click:props,text:name}:props;var button=$('').click(function(){props.click.apply(self.element[0],arguments)}).appendTo(uiButtonSet);$.each(props,function(key,value){if(key==="click"){return}if(key in attrFn){button[key](value)}else{button.attr(key,value)}});if($.fn.button){button.button()}});uiDialogButtonPane.appendTo(self.uiDialog)}},_makeDraggable:function(){var self=this,options=self.options,doc=$(document),heightBeforeDrag;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}self.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){heightBeforeDrag=options.height==="auto"?"auto":$(this).height();$(this).height($(this).height()).addClass("ui-dialog-dragging");self._trigger("dragStart",event,filteredUi(ui))},drag:function(event,ui){self._trigger("drag",event,filteredUi(ui))},stop:function(event,ui){options.position=[ui.position.left-doc.scrollLeft(),ui.position.top-doc.scrollTop()];$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);self._trigger("dragStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}})},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=self.options,position=self.uiDialog.css("position"),resizeHandles=(typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw");function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}self.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:self.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:self._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");self._trigger("resizeStart",event,filteredUi(ui))},resize:function(event,ui){self._trigger("resize",event,filteredUi(ui))},stop:function(event,ui){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();self._trigger("resizeStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}}).css("position",position).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var options=this.options;if(options.height==="auto"){return options.minHeight}else{return Math.min(options.minHeight,options.height)}},_position:function(position){var myAt=[],offset=[0,0],isVisible;if(position){if(typeof position==="string"||(typeof position==="object"&&"0" in position)){myAt=position.split?position.split(" "):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0]}$.each(["left","top"],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition}});position={my:myAt.join(" "),at:myAt.join(" "),offset:offset.join(" ")}}position=$.extend({},$.ui.dialog.prototype.options.position,position)}else{position=$.ui.dialog.prototype.options.position}isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.css({top:0,left:0}).position($.extend({of:window},position));if(!isVisible){this.uiDialog.hide()}},_setOptions:function(options){var self=this,resizableOptions={},resize=false;$.each(options,function(key,value){self._setOption(key,value);if(key in sizeRelatedOptions){resize=true}if(key in resizableRelatedOptions){resizableOptions[key]=value}});if(resize){this._size()}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option",resizableOptions)}},_setOption:function(key,value){var self=this,uiDialog=self.uiDialog;switch(key){case"beforeclose":key="beforeClose";break;case"buttons":self._createButtons(value);break;case"closeText":self.uiDialogTitlebarCloseText.text(""+value);break;case"dialogClass":uiDialog.removeClass(self.options.dialogClass).addClass(uiDialogClasses+value);break;case"disabled":if(value){uiDialog.addClass("ui-dialog-disabled")}else{uiDialog.removeClass("ui-dialog-disabled")}break;case"draggable":var isDraggable=uiDialog.is(":data(draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy")}if(!isDraggable&&value){self._makeDraggable()}break;case"position":self._position(value);break;case"resizable":var isResizable=uiDialog.is(":data(resizable)");if(isResizable&&!value){uiDialog.resizable("destroy")}if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value)}if(!isResizable&&value!==false){self._makeResizable(value)}break;case"title":$(".ui-dialog-title",self.uiDialogTitlebar).html(""+(value||" "));break}$.Widget.prototype._setOption.apply(self,arguments)},_size:function(){var options=this.options,nonContentHeight,minContentHeight,isVisible=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(options.minWidth>options.width){options.width=options.minWidth}nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).height();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);if(options.height==="auto"){if($.support.minHeight){this.element.css({minHeight:minContentHeight,height:"auto"})}else{this.uiDialog.show();var autoHeight=this.element.css("height","auto").height();if(!isVisible){this.uiDialog.hide()}this.element.height(Math.max(autoHeight,minContentHeight))}}else{this.element.height(Math.max(options.height-nonContentHeight,0))}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight())}}});$.extend($.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function($el){var id=$el.attr("id");if(!id){this.uuid+=1;id=this.uuid}return"ui-dialog-title-"+id},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog)}});$.extend($.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:$.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(event){return event+".dialog-overlay"}).join(" "),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){if($(event.target).zIndex()<$.ui.dialog.overlay.maxZ){return false}})}},1);$(document).bind("keydown.dialog-overlay",function(event){if(dialog.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){dialog.close(event);event.preventDefault()}});$(window).bind("resize.dialog-overlay",$.ui.dialog.overlay.resize)}var $el=(this.oldInstances.pop()||$("
    ").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});if($.fn.bgiframe){$el.bgiframe()}this.instances.push($el);return $el},destroy:function($el){var indexOf=$.inArray($el,this.instances);if(indexOf!=-1){this.oldInstances.push(this.instances.splice(indexOf,1)[0])}if(this.instances.length===0){$([document,window]).unbind(".dialog-overlay")}$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css("z-index"))});this.maxZ=maxZ},height:function(){var scrollHeight,offsetHeight;if($.browser.msie&&$.browser.version<7){scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight0?position.left-over:Math.max(position.left-data.collisionPosition.left,position.left)},top:function(position,data){var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(position.top-data.collisionPosition.top,position.top)}},flip:{left:function(position,data){if(data.at[0]===center){return}var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:-data.targetWidth,offset=-2*data.offset[0];position.left+=data.collisionPosition.left<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0},top:function(position,data){if(data.at[1]===center){return}var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=data.collisionPosition.top<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative"}var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if("using" in options){options.using.call(elem,props)}else{curElem.css(props)}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null}if(options){return this.each(function(){$.offset.setOffset(this,options)})}return _offset.call(this)}}}(jQuery));(function($,undefined){$.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=$("
    ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.valueDiv.remove();$.Widget.prototype.destroy.apply(this,arguments)},value:function(newValue){if(newValue===undefined){return this._value()}this._setOption("value",newValue);return this},_setOption:function(key,value){if(key==="value"){this.options.value=value;this._refreshValue();if(this._value()===this.options.max){this._trigger("complete")}}$.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var val=this.options.value;if(typeof val!=="number"){val=0}return Math.min(this.options.max,Math.max(this.min,val))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var value=this.value();var percentage=this._percentage();if(this.oldValue!==value){this.oldValue=value;this._trigger("change")}this.valueDiv.toggle(value>this.min).toggleClass("ui-corner-right",value===this.options.max).width(percentage.toFixed(0)+"%");this.element.attr("aria-valuenow",value)}});$.extend($.ui.progressbar,{version:"1.8.16"})})(jQuery);(function($,undefined){var numPages=5;$.widget("ui.slider",$.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var self=this,o=this.options,existingHandles=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),handle="",handleCount=(o.values&&o.values.length)||1,handles=[];this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(o.disabled?" ui-slider-disabled ui-disabled":""));this.range=$([]);if(o.range){if(o.range===true){if(!o.values){o.values=[this._valueMin(),this._valueMin()]}if(o.values.length&&o.values.length!==2){o.values=[o.values[0],o.values[0]]}}this.range=$("
    ").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+((o.range==="min"||o.range==="max")?" ui-slider-range-"+o.range:""))}for(var i=existingHandles.length;ithisDistance){distance=thisDistance;closestHandle=$(this);index=i}});if(o.range===true&&this.values(1)===o.min){index+=1;closestHandle=$(this.handles[index])}allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;self._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-(closestHandle.height()/2)-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(event){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}return this._trigger("start",event,uiHash)},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if((this.options.values.length===2&&this.options.range===true)&&((index===0&&newVal>otherVal)||(index===1&&newVal1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i=this._valueMax()){return this._valueMax()}var step=(this.options.step>0)?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step)}return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var oRange=this.options.range,o=this.options,self=this,animate=(!this._animateOff)?o.animate:false,valPercent,_set={},lastValPercent,value,valueMin,valueMax;if(this.options.values&&this.options.values.length){this.handles.each(function(i,j){valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(self.options.range===true){if(self.orientation==="horizontal"){if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})}}else{if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate})}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate})}}}});$.extend($.ui.slider,{version:"1.8.16"})}(jQuery));(function($,undefined){var tabId=0,listId=0;function getNextTabId(){return ++tabId}function getNextListId(){return ++listId}$.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(true)},_setOption:function(key,value){if(key=="selected"){if(this.options.collapsible&&value==this.options.selected){return}this.select(value)}else{this.options[key]=value;this._tabify()}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+getNextTabId()},_sanitizeSelector:function(hash){return hash.replace(/:/g,"\\:")},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+getNextListId());return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)))},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var el=$(this);el.html(el.data("label.tabs")).removeData("label.tabs")})},_tabify:function(init){var self=this,o=this.options,fragmentId=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=$(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return $("a",this)[0]});this.panels=$([]);this.anchors.each(function(i,a){var href=$(a).attr("href");var hrefBase=href.split("#")[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split("#")[0]||(baseEl=$("base")[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href}if(fragmentId.test(href)){self.panels=self.panels.add(self.element.find(self._sanitizeSelector(href)))}else{if(href&&href!=="#"){$.data(a,"href.tabs",href);$.data(a,"load.tabs",href.replace(/#.*$/,""));var id=self._tabId(a);a.href="#"+id;var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(self.panels[i-1]||self.list);$panel.data("destroy.tabs",true)}self.panels=self.panels.add($panel)}else{o.disabled.push(i)}}});if(init){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false}})}if(typeof o.selected!=="number"&&o.cookie){o.selected=parseInt(self._cookie(),10)}if(typeof o.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length){o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}o.selected=o.selected||(this.lis.length?0:-1)}else{if(o.selected===null){o.selected=-1}}o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter(".ui-state-disabled"),function(n,i){return self.lis.index(n)}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(o.selected>=0&&this.anchors.length){self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(o.selected).addClass("ui-tabs-selected ui-state-active");self.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[o.selected],self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash))[0]))});this.load(o.selected)}$(window).bind("unload",function(){self.lis.add(self.anchors).unbind(".tabs");self.lis=self.anchors=self.panels=null})}else{o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[o.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(o.cookie){this._cookie(o.selected,o.cookie)}for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(o.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(o.event!=="mouseover"){var addState=function(state,el){if(el.is(":not(.ui-state-disabled)")){el.addClass("ui-state-"+state)}};var removeState=function(state,el){el.removeClass("ui-state-"+state)};this.lis.bind("mouseover.tabs",function(){addState("hover",$(this))});this.lis.bind("mouseout.tabs",function(){removeState("hover",$(this))});this.anchors.bind("focus.tabs",function(){addState("focus",$(this).closest("li"))});this.anchors.bind("blur.tabs",function(){removeState("focus",$(this).closest("li"))})}var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1]}else{hideFx=showFx=o.fx}}function resetStyle($el,fx){$el.css("display","");if(!$.support.opacity&&fx.opacity){$el[0].style.removeAttribute("filter")}}var showTab=showFx?function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.hide().removeClass("ui-tabs-hide").animate(showFx,showFx.duration||"normal",function(){resetStyle($show,showFx);self._trigger("show",null,self._ui(clicked,$show[0]))})}:function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.removeClass("ui-tabs-hide");self._trigger("show",null,self._ui(clicked,$show[0]))};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||"normal",function(){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");resetStyle($hide,hideFx);self.element.dequeue("tabs")})}:function(clicked,$hide,$show){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");self.element.dequeue("tabs")};this.anchors.bind(o.event+".tabs",function(){var el=this,$li=$(el).closest("li"),$hide=self.panels.filter(":not(.ui-tabs-hide)"),$show=self.element.find(self._sanitizeSelector(el.hash));if(($li.hasClass("ui-tabs-selected")&&!o.collapsible)||$li.hasClass("ui-state-disabled")||$li.hasClass("ui-state-processing")||self.panels.filter(":animated").length||self._trigger("select",null,self._ui(this,$show[0]))===false){this.blur();return false}o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass("ui-tabs-selected")){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){hideTab(el,$hide)}).dequeue("tabs");this.blur();return false}else{if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this));this.blur();return false}}}if(o.cookie){self._cookie(o.selected,o.cookie)}if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide)})}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if($.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(index){if(typeof index=="string"){index=this.anchors.index(this.anchors.filter("[href$="+index+"]"))}return index},destroy:function(){var o=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var href=$.data(this,"href.tabs");if(href){this.href=href}var $this=$(this).unbind(".tabs");$.each(["href","load","cache"],function(i,prefix){$this.removeData(prefix+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if($.data(this,"destroy.tabs")){$(this).remove()}else{$(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(o.cookie){this._cookie(null,o.cookie)}return this},add:function(url,label,index){if(index===undefined){index=this.anchors.length}var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf("#")?url.replace("#",""):this._tabId($("a",$li)[0]);$li.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).data("destroy.tabs",true)}$panel.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode)}else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index])}o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this._tabify();if(this.anchors.length==1){o.selected=0;$li.addClass("ui-tabs-selected ui-state-active");$panel.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[0],self.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[index],this.panels[index]));return this},remove:function(index){index=this._getIndex(index);var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(index+(index+1=index?--n:n});this._tabify();this._trigger("remove",null,this._ui($li.find("a")[0],$panel[0]));return this},enable:function(index){index=this._getIndex(index);var o=this.options;if($.inArray(index,o.disabled)==-1){return}this.lis.eq(index).removeClass("ui-state-disabled");o.disabled=$.grep(o.disabled,function(n,i){return n!=index});this._trigger("enable",null,this._ui(this.anchors[index],this.panels[index]));return this},disable:function(index){index=this._getIndex(index);var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass("ui-state-disabled");o.disabled.push(index);o.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[index],this.panels[index]))}return this},select:function(index){index=this._getIndex(index);if(index==-1){if(this.options.collapsible&&this.options.selected!=-1){index=this.options.selected}else{return this}}this.anchors.eq(index).trigger(this.options.event+".tabs");return this},load:function(index){index=this._getIndex(index);var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,"load.tabs");this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(index).addClass("ui-state-processing");if(o.spinner){var span=$("span",a);span.data("label.tabs",span.html()).html(o.spinner)}this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){self.element.find(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,"cache.tabs",true)}self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s)}catch(e){}},error:function(xhr,s,e){self._cleanup();self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.error(xhr,s,index,a)}catch(e){}}}));self.element.dequeue("tabs");return this},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(index,url){this.anchors.eq(index).removeData("cache.tabs").data("load.tabs",url);return this},length:function(){return this.anchors.length}});$.extend($.ui.tabs,{version:"1.8.16"});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++tviewportOffset.top&&elementOffset.topviewportOffset.left&&elementOffset.leftelementOffset.left?"right":(viewportOffset.left+viewportSize.width)<(elementOffset.left+elementSize.width)?"left":"both");visiblePartY=(viewportOffset.top>elementOffset.top?"bottom":(viewportOffset.top+viewportSize.height)<(elementOffset.top+elementSize.height)?"top":"both");visiblePartsMerged=visiblePartX+"-"+visiblePartY;if(!inView||inView!==visiblePartsMerged){$element.data("inview",visiblePartsMerged).trigger("inview",[true,visiblePartX,visiblePartY])}}else{if(inView){$element.data("inview",false).trigger("inview",[false])}}}}}$(w).bind("scroll resize",function(){viewportSize=viewportOffset=null});setInterval(checkInView,250)})(jQuery); +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='
    ';var monthHtml="";if(secondary||!changeMonth){monthHtml+=''+monthNames[drawMonth]+""}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?" ":"")}if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+=''+drawYear+""}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new Date().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+='";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?" ":"")+monthHtml}html+="
    ";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=(minDate&&datemaxDate?maxDate:newDate);return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.bind("mouseout",function(event){var elem=$(event.target).closest(selector);if(!elem.length){return}elem.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(event){var elem=$(event.target).closest(selector);if($.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])||!elem.length){return}elem.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");elem.addClass("ui-state-hover");if(elem.hasClass("ui-datepicker-prev")){elem.addClass("ui-datepicker-prev-hover")}if(elem.hasClass("ui-datepicker-next")){elem.addClass("ui-datepicker-next-hover")}})}function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!this.length){return this}if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.8.16";window["DP_jQuery_"+dpuuid]=$})(jQuery);(function($,undefined){var uiDialogClasses="ui-dialog ui-widget ui-widget-content ui-corner-all ",sizeRelatedOptions={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},attrFn=$.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};$.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset)}}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string"){this.originalTitle=""}this.options.title=this.options.title||this.originalTitle;var self=this,options=self.options,title=options.title||" ",titleId=$.ui.dialog.getTitleId(self.element),uiDialog=(self.uiDialog=$("
    ")).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({zIndex:options.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(event){if(options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){self.close(event);event.preventDefault()}}).attr({role:"dialog","aria-labelledby":titleId}).mousedown(function(event){self.moveToTop(false,event)}),uiDialogContent=self.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(uiDialog),uiDialogTitlebar=(self.uiDialogTitlebar=$("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(uiDialog),uiDialogTitlebarClose=$('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){uiDialogTitlebarClose.addClass("ui-state-hover")},function(){uiDialogTitlebarClose.removeClass("ui-state-hover")}).focus(function(){uiDialogTitlebarClose.addClass("ui-state-focus")}).blur(function(){uiDialogTitlebarClose.removeClass("ui-state-focus")}).click(function(event){self.close(event);return false}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(self.uiDialogTitlebarCloseText=$("")).addClass("ui-icon ui-icon-closethick").text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$("").addClass("ui-dialog-title").attr("id",titleId).html(title).prependTo(uiDialogTitlebar);if($.isFunction(options.beforeclose)&&!$.isFunction(options.beforeClose)){options.beforeClose=options.beforeclose}uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();if(options.draggable&&$.fn.draggable){self._makeDraggable()}if(options.resizable&&$.fn.resizable){self._makeResizable()}self._createButtons(options.buttons);self._isOpen=false;if($.fn.bgiframe){uiDialog.bgiframe()}},_init:function(){if(this.options.autoOpen){this.open()}},destroy:function(){var self=this;if(self.overlay){self.overlay.destroy()}self.uiDialog.hide();self.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");self.uiDialog.remove();if(self.originalTitle){self.element.attr("title",self.originalTitle)}return self},widget:function(){return this.uiDialog},close:function(event){var self=this,maxZ,thisZ;if(false===self._trigger("beforeClose",event)){return}if(self.overlay){self.overlay.destroy()}self.uiDialog.unbind("keypress.ui-dialog");self._isOpen=false;if(self.options.hide){self.uiDialog.hide(self.options.hide,function(){self._trigger("close",event)})}else{self.uiDialog.hide();self._trigger("close",event)}$.ui.dialog.overlay.resize();if(self.options.modal){maxZ=0;$(".ui-dialog").each(function(){if(this!==self.uiDialog[0]){thisZ=$(this).css("z-index");if(!isNaN(thisZ)){maxZ=Math.max(maxZ,thisZ)}}});$.ui.dialog.maxZ=maxZ}return self},isOpen:function(){return this._isOpen},moveToTop:function(force,event){var self=this,options=self.options,saveScroll;if((options.modal&&!force)||(!options.stack&&!options.modal)){return self._trigger("focus",event)}if(options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=options.zIndex}if(self.overlay){$.ui.dialog.maxZ+=1;self.overlay.$el.css("z-index",$.ui.dialog.overlay.maxZ=$.ui.dialog.maxZ)}saveScroll={scrollTop:self.element.scrollTop(),scrollLeft:self.element.scrollLeft()};$.ui.dialog.maxZ+=1;self.uiDialog.css("z-index",$.ui.dialog.maxZ);self.element.attr(saveScroll);self._trigger("focus",event);return self},open:function(){if(this._isOpen){return}var self=this,options=self.options,uiDialog=self.uiDialog;self.overlay=options.modal?new $.ui.dialog.overlay(self):null;self._size();self._position(options.position);uiDialog.show(options.show);self.moveToTop(true);if(options.modal){uiDialog.bind("keypress.ui-dialog",function(event){if(event.keyCode!==$.ui.keyCode.TAB){return}var tabbables=$(":tabbable",this),first=tabbables.filter(":first"),last=tabbables.filter(":last");if(event.target===last[0]&&!event.shiftKey){first.focus(1);return false}else{if(event.target===first[0]&&event.shiftKey){last.focus(1);return false}}})}$(self.element.find(":tabbable").get().concat(uiDialog.find(".ui-dialog-buttonpane :tabbable").get().concat(uiDialog.get()))).eq(0).focus();self._isOpen=true;self._trigger("open");return self},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),uiButtonSet=$("
    ").addClass("ui-dialog-buttonset").appendTo(uiDialogButtonPane);self.uiDialog.find(".ui-dialog-buttonpane").remove();if(typeof buttons==="object"&&buttons!==null){$.each(buttons,function(){return !(hasButtons=true)})}if(hasButtons){$.each(buttons,function(name,props){props=$.isFunction(props)?{click:props,text:name}:props;var button=$('').click(function(){props.click.apply(self.element[0],arguments)}).appendTo(uiButtonSet);$.each(props,function(key,value){if(key==="click"){return}if(key in attrFn){button[key](value)}else{button.attr(key,value)}});if($.fn.button){button.button()}});uiDialogButtonPane.appendTo(self.uiDialog)}},_makeDraggable:function(){var self=this,options=self.options,doc=$(document),heightBeforeDrag;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}self.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){heightBeforeDrag=options.height==="auto"?"auto":$(this).height();$(this).height($(this).height()).addClass("ui-dialog-dragging");self._trigger("dragStart",event,filteredUi(ui))},drag:function(event,ui){self._trigger("drag",event,filteredUi(ui))},stop:function(event,ui){options.position=[ui.position.left-doc.scrollLeft(),ui.position.top-doc.scrollTop()];$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);self._trigger("dragStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}})},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=self.options,position=self.uiDialog.css("position"),resizeHandles=(typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw");function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}self.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:self.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:self._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");self._trigger("resizeStart",event,filteredUi(ui))},resize:function(event,ui){self._trigger("resize",event,filteredUi(ui))},stop:function(event,ui){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();self._trigger("resizeStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}}).css("position",position).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var options=this.options;if(options.height==="auto"){return options.minHeight}else{return Math.min(options.minHeight,options.height)}},_position:function(position){var myAt=[],offset=[0,0],isVisible;if(position){if(typeof position==="string"||(typeof position==="object"&&"0" in position)){myAt=position.split?position.split(" "):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0]}$.each(["left","top"],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition}});position={my:myAt.join(" "),at:myAt.join(" "),offset:offset.join(" ")}}position=$.extend({},$.ui.dialog.prototype.options.position,position)}else{position=$.ui.dialog.prototype.options.position}isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.css({top:0,left:0}).position($.extend({of:window},position));if(!isVisible){this.uiDialog.hide()}},_setOptions:function(options){var self=this,resizableOptions={},resize=false;$.each(options,function(key,value){self._setOption(key,value);if(key in sizeRelatedOptions){resize=true}if(key in resizableRelatedOptions){resizableOptions[key]=value}});if(resize){this._size()}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option",resizableOptions)}},_setOption:function(key,value){var self=this,uiDialog=self.uiDialog;switch(key){case"beforeclose":key="beforeClose";break;case"buttons":self._createButtons(value);break;case"closeText":self.uiDialogTitlebarCloseText.text(""+value);break;case"dialogClass":uiDialog.removeClass(self.options.dialogClass).addClass(uiDialogClasses+value);break;case"disabled":if(value){uiDialog.addClass("ui-dialog-disabled")}else{uiDialog.removeClass("ui-dialog-disabled")}break;case"draggable":var isDraggable=uiDialog.is(":data(draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy")}if(!isDraggable&&value){self._makeDraggable()}break;case"position":self._position(value);break;case"resizable":var isResizable=uiDialog.is(":data(resizable)");if(isResizable&&!value){uiDialog.resizable("destroy")}if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value)}if(!isResizable&&value!==false){self._makeResizable(value)}break;case"title":$(".ui-dialog-title",self.uiDialogTitlebar).html(""+(value||" "));break}$.Widget.prototype._setOption.apply(self,arguments)},_size:function(){var options=this.options,nonContentHeight,minContentHeight,isVisible=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(options.minWidth>options.width){options.width=options.minWidth}nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).height();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);if(options.height==="auto"){if($.support.minHeight){this.element.css({minHeight:minContentHeight,height:"auto"})}else{this.uiDialog.show();var autoHeight=this.element.css("height","auto").height();if(!isVisible){this.uiDialog.hide()}this.element.height(Math.max(autoHeight,minContentHeight))}}else{this.element.height(Math.max(options.height-nonContentHeight,0))}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight())}}});$.extend($.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function($el){var id=$el.attr("id");if(!id){this.uuid+=1;id=this.uuid}return"ui-dialog-title-"+id},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog)}});$.extend($.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:$.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(event){return event+".dialog-overlay"}).join(" "),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){if($(event.target).zIndex()<$.ui.dialog.overlay.maxZ){return false}})}},1);$(document).bind("keydown.dialog-overlay",function(event){if(dialog.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){dialog.close(event);event.preventDefault()}});$(window).bind("resize.dialog-overlay",$.ui.dialog.overlay.resize)}var $el=(this.oldInstances.pop()||$("
    ").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});if($.fn.bgiframe){$el.bgiframe()}this.instances.push($el);return $el},destroy:function($el){var indexOf=$.inArray($el,this.instances);if(indexOf!=-1){this.oldInstances.push(this.instances.splice(indexOf,1)[0])}if(this.instances.length===0){$([document,window]).unbind(".dialog-overlay")}$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css("z-index"))});this.maxZ=maxZ},height:function(){var scrollHeight,offsetHeight;if($.browser.msie&&$.browser.version<7){scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight0?position.left-over:Math.max(position.left-data.collisionPosition.left,position.left)},top:function(position,data){var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(position.top-data.collisionPosition.top,position.top)}},flip:{left:function(position,data){if(data.at[0]===center){return}var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:-data.targetWidth,offset=-2*data.offset[0];position.left+=data.collisionPosition.left<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0},top:function(position,data){if(data.at[1]===center){return}var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=data.collisionPosition.top<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative"}var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if("using" in options){options.using.call(elem,props)}else{curElem.css(props)}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null}if(options){return this.each(function(){$.offset.setOffset(this,options)})}return _offset.call(this)}}}(jQuery));(function($,undefined){$.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=$("
    ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.valueDiv.remove();$.Widget.prototype.destroy.apply(this,arguments)},value:function(newValue){if(newValue===undefined){return this._value()}this._setOption("value",newValue);return this},_setOption:function(key,value){if(key==="value"){this.options.value=value;this._refreshValue();if(this._value()===this.options.max){this._trigger("complete")}}$.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var val=this.options.value;if(typeof val!=="number"){val=0}return Math.min(this.options.max,Math.max(this.min,val))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var value=this.value();var percentage=this._percentage();if(this.oldValue!==value){this.oldValue=value;this._trigger("change")}this.valueDiv.toggle(value>this.min).toggleClass("ui-corner-right",value===this.options.max).width(percentage.toFixed(0)+"%");this.element.attr("aria-valuenow",value)}});$.extend($.ui.progressbar,{version:"1.8.16"})})(jQuery);(function($,undefined){var numPages=5;$.widget("ui.slider",$.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var self=this,o=this.options,existingHandles=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),handle="",handleCount=(o.values&&o.values.length)||1,handles=[];this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(o.disabled?" ui-slider-disabled ui-disabled":""));this.range=$([]);if(o.range){if(o.range===true){if(!o.values){o.values=[this._valueMin(),this._valueMin()]}if(o.values.length&&o.values.length!==2){o.values=[o.values[0],o.values[0]]}}this.range=$("
    ").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+((o.range==="min"||o.range==="max")?" ui-slider-range-"+o.range:""))}for(var i=existingHandles.length;ithisDistance){distance=thisDistance;closestHandle=$(this);index=i}});if(o.range===true&&this.values(1)===o.min){index+=1;closestHandle=$(this.handles[index])}allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;self._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-(closestHandle.height()/2)-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(event){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}return this._trigger("start",event,uiHash)},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if((this.options.values.length===2&&this.options.range===true)&&((index===0&&newVal>otherVal)||(index===1&&newVal1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i=this._valueMax()){return this._valueMax()}var step=(this.options.step>0)?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step)}return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var oRange=this.options.range,o=this.options,self=this,animate=(!this._animateOff)?o.animate:false,valPercent,_set={},lastValPercent,value,valueMin,valueMax;if(this.options.values&&this.options.values.length){this.handles.each(function(i,j){valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(self.options.range===true){if(self.orientation==="horizontal"){if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})}}else{if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate})}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate})}}}});$.extend($.ui.slider,{version:"1.8.16"})}(jQuery));(function($,undefined){var tabId=0,listId=0;function getNextTabId(){return ++tabId}function getNextListId(){return ++listId}$.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(true)},_setOption:function(key,value){if(key=="selected"){if(this.options.collapsible&&value==this.options.selected){return}this.select(value)}else{this.options[key]=value;this._tabify()}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+getNextTabId()},_sanitizeSelector:function(hash){return hash.replace(/:/g,"\\:")},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+getNextListId());return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)))},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var el=$(this);el.html(el.data("label.tabs")).removeData("label.tabs")})},_tabify:function(init){var self=this,o=this.options,fragmentId=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=$(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return $("a",this)[0]});this.panels=$([]);this.anchors.each(function(i,a){var href=$(a).attr("href");var hrefBase=href.split("#")[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split("#")[0]||(baseEl=$("base")[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href}if(fragmentId.test(href)){self.panels=self.panels.add(self.element.find(self._sanitizeSelector(href)))}else{if(href&&href!=="#"){$.data(a,"href.tabs",href);$.data(a,"load.tabs",href.replace(/#.*$/,""));var id=self._tabId(a);a.href="#"+id;var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(self.panels[i-1]||self.list);$panel.data("destroy.tabs",true)}self.panels=self.panels.add($panel)}else{o.disabled.push(i)}}});if(init){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false}})}if(typeof o.selected!=="number"&&o.cookie){o.selected=parseInt(self._cookie(),10)}if(typeof o.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length){o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}o.selected=o.selected||(this.lis.length?0:-1)}else{if(o.selected===null){o.selected=-1}}o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter(".ui-state-disabled"),function(n,i){return self.lis.index(n)}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(o.selected>=0&&this.anchors.length){self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(o.selected).addClass("ui-tabs-selected ui-state-active");self.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[o.selected],self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash))[0]))});this.load(o.selected)}$(window).bind("unload",function(){self.lis.add(self.anchors).unbind(".tabs");self.lis=self.anchors=self.panels=null})}else{o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[o.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(o.cookie){this._cookie(o.selected,o.cookie)}for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(o.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(o.event!=="mouseover"){var addState=function(state,el){if(el.is(":not(.ui-state-disabled)")){el.addClass("ui-state-"+state)}};var removeState=function(state,el){el.removeClass("ui-state-"+state)};this.lis.bind("mouseover.tabs",function(){addState("hover",$(this))});this.lis.bind("mouseout.tabs",function(){removeState("hover",$(this))});this.anchors.bind("focus.tabs",function(){addState("focus",$(this).closest("li"))});this.anchors.bind("blur.tabs",function(){removeState("focus",$(this).closest("li"))})}var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1]}else{hideFx=showFx=o.fx}}function resetStyle($el,fx){$el.css("display","");if(!$.support.opacity&&fx.opacity){$el[0].style.removeAttribute("filter")}}var showTab=showFx?function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.hide().removeClass("ui-tabs-hide").animate(showFx,showFx.duration||"normal",function(){resetStyle($show,showFx);self._trigger("show",null,self._ui(clicked,$show[0]))})}:function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.removeClass("ui-tabs-hide");self._trigger("show",null,self._ui(clicked,$show[0]))};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||"normal",function(){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");resetStyle($hide,hideFx);self.element.dequeue("tabs")})}:function(clicked,$hide,$show){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");self.element.dequeue("tabs")};this.anchors.bind(o.event+".tabs",function(){var el=this,$li=$(el).closest("li"),$hide=self.panels.filter(":not(.ui-tabs-hide)"),$show=self.element.find(self._sanitizeSelector(el.hash));if(($li.hasClass("ui-tabs-selected")&&!o.collapsible)||$li.hasClass("ui-state-disabled")||$li.hasClass("ui-state-processing")||self.panels.filter(":animated").length||self._trigger("select",null,self._ui(this,$show[0]))===false){this.blur();return false}o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass("ui-tabs-selected")){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){hideTab(el,$hide)}).dequeue("tabs");this.blur();return false}else{if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this));this.blur();return false}}}if(o.cookie){self._cookie(o.selected,o.cookie)}if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide)})}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if($.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(index){if(typeof index=="string"){index=this.anchors.index(this.anchors.filter("[href$="+index+"]"))}return index},destroy:function(){var o=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var href=$.data(this,"href.tabs");if(href){this.href=href}var $this=$(this).unbind(".tabs");$.each(["href","load","cache"],function(i,prefix){$this.removeData(prefix+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if($.data(this,"destroy.tabs")){$(this).remove()}else{$(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(o.cookie){this._cookie(null,o.cookie)}return this},add:function(url,label,index){if(index===undefined){index=this.anchors.length}var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf("#")?url.replace("#",""):this._tabId($("a",$li)[0]);$li.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).data("destroy.tabs",true)}$panel.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode)}else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index])}o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this._tabify();if(this.anchors.length==1){o.selected=0;$li.addClass("ui-tabs-selected ui-state-active");$panel.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[0],self.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[index],this.panels[index]));return this},remove:function(index){index=this._getIndex(index);var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(index+(index+1=index?--n:n});this._tabify();this._trigger("remove",null,this._ui($li.find("a")[0],$panel[0]));return this},enable:function(index){index=this._getIndex(index);var o=this.options;if($.inArray(index,o.disabled)==-1){return}this.lis.eq(index).removeClass("ui-state-disabled");o.disabled=$.grep(o.disabled,function(n,i){return n!=index});this._trigger("enable",null,this._ui(this.anchors[index],this.panels[index]));return this},disable:function(index){index=this._getIndex(index);var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass("ui-state-disabled");o.disabled.push(index);o.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[index],this.panels[index]))}return this},select:function(index){index=this._getIndex(index);if(index==-1){if(this.options.collapsible&&this.options.selected!=-1){index=this.options.selected}else{return this}}this.anchors.eq(index).trigger(this.options.event+".tabs");return this},load:function(index){index=this._getIndex(index);var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,"load.tabs");this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(index).addClass("ui-state-processing");if(o.spinner){var span=$("span",a);span.data("label.tabs",span.html()).html(o.spinner)}this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){self.element.find(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,"cache.tabs",true)}self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s)}catch(e){}},error:function(xhr,s,e){self._cleanup();self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.error(xhr,s,index,a)}catch(e){}}}));self.element.dequeue("tabs");return this},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(index,url){this.anchors.eq(index).removeData("cache.tabs").data("load.tabs",url);return this},length:function(){return this.anchors.length}});$.extend($.ui.tabs,{version:"1.8.16"});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++tviewportOffset.top&&elementOffset.topviewportOffset.left&&elementOffset.leftelementOffset.left?"right":(viewportOffset.left+viewportSize.width)<(elementOffset.left+elementSize.width)?"left":"both");visiblePartY=(viewportOffset.top>elementOffset.top?"bottom":(viewportOffset.top+viewportSize.height)<(elementOffset.top+elementSize.height)?"top":"both");visiblePartsMerged=visiblePartX+"-"+visiblePartY;if(!inView||inView!==visiblePartsMerged){$element.data("inview",visiblePartsMerged).trigger("inview",[true,visiblePartX,visiblePartY])}}else{if(inView){$element.data("inview",false).trigger("inview",[false])}}}}}$(w).bind("scroll resize",function(){viewportSize=viewportOffset=null});setInterval(checkInView,250)})(jQuery); +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='
    ';var monthHtml="";if(secondary||!changeMonth){monthHtml+=''+monthNames[drawMonth]+""}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?" ":"")}if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+=''+drawYear+""}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new Date().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+='";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?" ":"")+monthHtml}html+="
    ";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=(minDate&&datemaxDate?maxDate:newDate);return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.bind("mouseout",function(event){var elem=$(event.target).closest(selector);if(!elem.length){return}elem.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(event){var elem=$(event.target).closest(selector);if($.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])||!elem.length){return}elem.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");elem.addClass("ui-state-hover");if(elem.hasClass("ui-datepicker-prev")){elem.addClass("ui-datepicker-prev-hover")}if(elem.hasClass("ui-datepicker-next")){elem.addClass("ui-datepicker-next-hover")}})}function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!this.length){return this}if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.8.16";window["DP_jQuery_"+dpuuid]=$})(jQuery);(function($,undefined){var uiDialogClasses="ui-dialog ui-widget ui-widget-content ui-corner-all ",sizeRelatedOptions={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},attrFn=$.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};$.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset)}}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string"){this.originalTitle=""}this.options.title=this.options.title||this.originalTitle;var self=this,options=self.options,title=options.title||" ",titleId=$.ui.dialog.getTitleId(self.element),uiDialog=(self.uiDialog=$("
    ")).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({zIndex:options.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(event){if(options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){self.close(event);event.preventDefault()}}).attr({role:"dialog","aria-labelledby":titleId}).mousedown(function(event){self.moveToTop(false,event)}),uiDialogContent=self.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(uiDialog),uiDialogTitlebar=(self.uiDialogTitlebar=$("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(uiDialog),uiDialogTitlebarClose=$('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){uiDialogTitlebarClose.addClass("ui-state-hover")},function(){uiDialogTitlebarClose.removeClass("ui-state-hover")}).focus(function(){uiDialogTitlebarClose.addClass("ui-state-focus")}).blur(function(){uiDialogTitlebarClose.removeClass("ui-state-focus")}).click(function(event){self.close(event);return false}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(self.uiDialogTitlebarCloseText=$("")).addClass("ui-icon ui-icon-closethick").text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$("").addClass("ui-dialog-title").attr("id",titleId).html(title).prependTo(uiDialogTitlebar);if($.isFunction(options.beforeclose)&&!$.isFunction(options.beforeClose)){options.beforeClose=options.beforeclose}uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();if(options.draggable&&$.fn.draggable){self._makeDraggable()}if(options.resizable&&$.fn.resizable){self._makeResizable()}self._createButtons(options.buttons);self._isOpen=false;if($.fn.bgiframe){uiDialog.bgiframe()}},_init:function(){if(this.options.autoOpen){this.open()}},destroy:function(){var self=this;if(self.overlay){self.overlay.destroy()}self.uiDialog.hide();self.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");self.uiDialog.remove();if(self.originalTitle){self.element.attr("title",self.originalTitle)}return self},widget:function(){return this.uiDialog},close:function(event){var self=this,maxZ,thisZ;if(false===self._trigger("beforeClose",event)){return}if(self.overlay){self.overlay.destroy()}self.uiDialog.unbind("keypress.ui-dialog");self._isOpen=false;if(self.options.hide){self.uiDialog.hide(self.options.hide,function(){self._trigger("close",event)})}else{self.uiDialog.hide();self._trigger("close",event)}$.ui.dialog.overlay.resize();if(self.options.modal){maxZ=0;$(".ui-dialog").each(function(){if(this!==self.uiDialog[0]){thisZ=$(this).css("z-index");if(!isNaN(thisZ)){maxZ=Math.max(maxZ,thisZ)}}});$.ui.dialog.maxZ=maxZ}return self},isOpen:function(){return this._isOpen},moveToTop:function(force,event){var self=this,options=self.options,saveScroll;if((options.modal&&!force)||(!options.stack&&!options.modal)){return self._trigger("focus",event)}if(options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=options.zIndex}if(self.overlay){$.ui.dialog.maxZ+=1;self.overlay.$el.css("z-index",$.ui.dialog.overlay.maxZ=$.ui.dialog.maxZ)}saveScroll={scrollTop:self.element.scrollTop(),scrollLeft:self.element.scrollLeft()};$.ui.dialog.maxZ+=1;self.uiDialog.css("z-index",$.ui.dialog.maxZ);self.element.attr(saveScroll);self._trigger("focus",event);return self},open:function(){if(this._isOpen){return}var self=this,options=self.options,uiDialog=self.uiDialog;self.overlay=options.modal?new $.ui.dialog.overlay(self):null;self._size();self._position(options.position);uiDialog.show(options.show);self.moveToTop(true);if(options.modal){uiDialog.bind("keypress.ui-dialog",function(event){if(event.keyCode!==$.ui.keyCode.TAB){return}var tabbables=$(":tabbable",this),first=tabbables.filter(":first"),last=tabbables.filter(":last");if(event.target===last[0]&&!event.shiftKey){first.focus(1);return false}else{if(event.target===first[0]&&event.shiftKey){last.focus(1);return false}}})}$(self.element.find(":tabbable").get().concat(uiDialog.find(".ui-dialog-buttonpane :tabbable").get().concat(uiDialog.get()))).eq(0).focus();self._isOpen=true;self._trigger("open");return self},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),uiButtonSet=$("
    ").addClass("ui-dialog-buttonset").appendTo(uiDialogButtonPane);self.uiDialog.find(".ui-dialog-buttonpane").remove();if(typeof buttons==="object"&&buttons!==null){$.each(buttons,function(){return !(hasButtons=true)})}if(hasButtons){$.each(buttons,function(name,props){props=$.isFunction(props)?{click:props,text:name}:props;var button=$('').click(function(){props.click.apply(self.element[0],arguments)}).appendTo(uiButtonSet);$.each(props,function(key,value){if(key==="click"){return}if(key in attrFn){button[key](value)}else{button.attr(key,value)}});if($.fn.button){button.button()}});uiDialogButtonPane.appendTo(self.uiDialog)}},_makeDraggable:function(){var self=this,options=self.options,doc=$(document),heightBeforeDrag;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}self.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){heightBeforeDrag=options.height==="auto"?"auto":$(this).height();$(this).height($(this).height()).addClass("ui-dialog-dragging");self._trigger("dragStart",event,filteredUi(ui))},drag:function(event,ui){self._trigger("drag",event,filteredUi(ui))},stop:function(event,ui){options.position=[ui.position.left-doc.scrollLeft(),ui.position.top-doc.scrollTop()];$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);self._trigger("dragStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}})},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=self.options,position=self.uiDialog.css("position"),resizeHandles=(typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw");function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}self.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:self.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:self._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");self._trigger("resizeStart",event,filteredUi(ui))},resize:function(event,ui){self._trigger("resize",event,filteredUi(ui))},stop:function(event,ui){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();self._trigger("resizeStop",event,filteredUi(ui));$.ui.dialog.overlay.resize()}}).css("position",position).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var options=this.options;if(options.height==="auto"){return options.minHeight}else{return Math.min(options.minHeight,options.height)}},_position:function(position){var myAt=[],offset=[0,0],isVisible;if(position){if(typeof position==="string"||(typeof position==="object"&&"0" in position)){myAt=position.split?position.split(" "):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0]}$.each(["left","top"],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition}});position={my:myAt.join(" "),at:myAt.join(" "),offset:offset.join(" ")}}position=$.extend({},$.ui.dialog.prototype.options.position,position)}else{position=$.ui.dialog.prototype.options.position}isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.css({top:0,left:0}).position($.extend({of:window},position));if(!isVisible){this.uiDialog.hide()}},_setOptions:function(options){var self=this,resizableOptions={},resize=false;$.each(options,function(key,value){self._setOption(key,value);if(key in sizeRelatedOptions){resize=true}if(key in resizableRelatedOptions){resizableOptions[key]=value}});if(resize){this._size()}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option",resizableOptions)}},_setOption:function(key,value){var self=this,uiDialog=self.uiDialog;switch(key){case"beforeclose":key="beforeClose";break;case"buttons":self._createButtons(value);break;case"closeText":self.uiDialogTitlebarCloseText.text(""+value);break;case"dialogClass":uiDialog.removeClass(self.options.dialogClass).addClass(uiDialogClasses+value);break;case"disabled":if(value){uiDialog.addClass("ui-dialog-disabled")}else{uiDialog.removeClass("ui-dialog-disabled")}break;case"draggable":var isDraggable=uiDialog.is(":data(draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy")}if(!isDraggable&&value){self._makeDraggable()}break;case"position":self._position(value);break;case"resizable":var isResizable=uiDialog.is(":data(resizable)");if(isResizable&&!value){uiDialog.resizable("destroy")}if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value)}if(!isResizable&&value!==false){self._makeResizable(value)}break;case"title":$(".ui-dialog-title",self.uiDialogTitlebar).html(""+(value||" "));break}$.Widget.prototype._setOption.apply(self,arguments)},_size:function(){var options=this.options,nonContentHeight,minContentHeight,isVisible=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(options.minWidth>options.width){options.width=options.minWidth}nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).height();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);if(options.height==="auto"){if($.support.minHeight){this.element.css({minHeight:minContentHeight,height:"auto"})}else{this.uiDialog.show();var autoHeight=this.element.css("height","auto").height();if(!isVisible){this.uiDialog.hide()}this.element.height(Math.max(autoHeight,minContentHeight))}}else{this.element.height(Math.max(options.height-nonContentHeight,0))}if(this.uiDialog.is(":data(resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight())}}});$.extend($.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function($el){var id=$el.attr("id");if(!id){this.uuid+=1;id=this.uuid}return"ui-dialog-title-"+id},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog)}});$.extend($.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:$.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(event){return event+".dialog-overlay"}).join(" "),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){if($(event.target).zIndex()<$.ui.dialog.overlay.maxZ){return false}})}},1);$(document).bind("keydown.dialog-overlay",function(event){if(dialog.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){dialog.close(event);event.preventDefault()}});$(window).bind("resize.dialog-overlay",$.ui.dialog.overlay.resize)}var $el=(this.oldInstances.pop()||$("
    ").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});if($.fn.bgiframe){$el.bgiframe()}this.instances.push($el);return $el},destroy:function($el){var indexOf=$.inArray($el,this.instances);if(indexOf!=-1){this.oldInstances.push(this.instances.splice(indexOf,1)[0])}if(this.instances.length===0){$([document,window]).unbind(".dialog-overlay")}$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css("z-index"))});this.maxZ=maxZ},height:function(){var scrollHeight,offsetHeight;if($.browser.msie&&$.browser.version<7){scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight0?position.left-over:Math.max(position.left-data.collisionPosition.left,position.left)},top:function(position,data){var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(position.top-data.collisionPosition.top,position.top)}},flip:{left:function(position,data){if(data.at[0]===center){return}var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:-data.targetWidth,offset=-2*data.offset[0];position.left+=data.collisionPosition.left<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0},top:function(position,data){if(data.at[1]===center){return}var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=data.collisionPosition.top<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative"}var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if("using" in options){options.using.call(elem,props)}else{curElem.css(props)}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null}if(options){return this.each(function(){$.offset.setOffset(this,options)})}return _offset.call(this)}}}(jQuery));(function($,undefined){$.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=$("
    ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.valueDiv.remove();$.Widget.prototype.destroy.apply(this,arguments)},value:function(newValue){if(newValue===undefined){return this._value()}this._setOption("value",newValue);return this},_setOption:function(key,value){if(key==="value"){this.options.value=value;this._refreshValue();if(this._value()===this.options.max){this._trigger("complete")}}$.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var val=this.options.value;if(typeof val!=="number"){val=0}return Math.min(this.options.max,Math.max(this.min,val))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var value=this.value();var percentage=this._percentage();if(this.oldValue!==value){this.oldValue=value;this._trigger("change")}this.valueDiv.toggle(value>this.min).toggleClass("ui-corner-right",value===this.options.max).width(percentage.toFixed(0)+"%");this.element.attr("aria-valuenow",value)}});$.extend($.ui.progressbar,{version:"1.8.16"})})(jQuery);(function($,undefined){var numPages=5;$.widget("ui.slider",$.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var self=this,o=this.options,existingHandles=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),handle="",handleCount=(o.values&&o.values.length)||1,handles=[];this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(o.disabled?" ui-slider-disabled ui-disabled":""));this.range=$([]);if(o.range){if(o.range===true){if(!o.values){o.values=[this._valueMin(),this._valueMin()]}if(o.values.length&&o.values.length!==2){o.values=[o.values[0],o.values[0]]}}this.range=$("
    ").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+((o.range==="min"||o.range==="max")?" ui-slider-range-"+o.range:""))}for(var i=existingHandles.length;ithisDistance){distance=thisDistance;closestHandle=$(this);index=i}});if(o.range===true&&this.values(1)===o.min){index+=1;closestHandle=$(this.handles[index])}allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;self._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-(closestHandle.height()/2)-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(event){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}return this._trigger("start",event,uiHash)},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if((this.options.values.length===2&&this.options.range===true)&&((index===0&&newVal>otherVal)||(index===1&&newVal1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i=this._valueMax()){return this._valueMax()}var step=(this.options.step>0)?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step)}return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var oRange=this.options.range,o=this.options,self=this,animate=(!this._animateOff)?o.animate:false,valPercent,_set={},lastValPercent,value,valueMin,valueMax;if(this.options.values&&this.options.values.length){this.handles.each(function(i,j){valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(self.options.range===true){if(self.orientation==="horizontal"){if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})}}else{if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate)}if(i===1){self.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate})}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate})}}}});$.extend($.ui.slider,{version:"1.8.16"})}(jQuery));(function($,undefined){var tabId=0,listId=0;function getNextTabId(){return ++tabId}function getNextListId(){return ++listId}$.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(true)},_setOption:function(key,value){if(key=="selected"){if(this.options.collapsible&&value==this.options.selected){return}this.select(value)}else{this.options[key]=value;this._tabify()}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+getNextTabId()},_sanitizeSelector:function(hash){return hash.replace(/:/g,"\\:")},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+getNextListId());return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)))},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var el=$(this);el.html(el.data("label.tabs")).removeData("label.tabs")})},_tabify:function(init){var self=this,o=this.options,fragmentId=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=$(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return $("a",this)[0]});this.panels=$([]);this.anchors.each(function(i,a){var href=$(a).attr("href");var hrefBase=href.split("#")[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split("#")[0]||(baseEl=$("base")[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href}if(fragmentId.test(href)){self.panels=self.panels.add(self.element.find(self._sanitizeSelector(href)))}else{if(href&&href!=="#"){$.data(a,"href.tabs",href);$.data(a,"load.tabs",href.replace(/#.*$/,""));var id=self._tabId(a);a.href="#"+id;var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(self.panels[i-1]||self.list);$panel.data("destroy.tabs",true)}self.panels=self.panels.add($panel)}else{o.disabled.push(i)}}});if(init){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false}})}if(typeof o.selected!=="number"&&o.cookie){o.selected=parseInt(self._cookie(),10)}if(typeof o.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length){o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}o.selected=o.selected||(this.lis.length?0:-1)}else{if(o.selected===null){o.selected=-1}}o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter(".ui-state-disabled"),function(n,i){return self.lis.index(n)}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(o.selected>=0&&this.anchors.length){self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(o.selected).addClass("ui-tabs-selected ui-state-active");self.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[o.selected],self.element.find(self._sanitizeSelector(self.anchors[o.selected].hash))[0]))});this.load(o.selected)}$(window).bind("unload",function(){self.lis.add(self.anchors).unbind(".tabs");self.lis=self.anchors=self.panels=null})}else{o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[o.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(o.cookie){this._cookie(o.selected,o.cookie)}for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(o.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(o.event!=="mouseover"){var addState=function(state,el){if(el.is(":not(.ui-state-disabled)")){el.addClass("ui-state-"+state)}};var removeState=function(state,el){el.removeClass("ui-state-"+state)};this.lis.bind("mouseover.tabs",function(){addState("hover",$(this))});this.lis.bind("mouseout.tabs",function(){removeState("hover",$(this))});this.anchors.bind("focus.tabs",function(){addState("focus",$(this).closest("li"))});this.anchors.bind("blur.tabs",function(){removeState("focus",$(this).closest("li"))})}var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1]}else{hideFx=showFx=o.fx}}function resetStyle($el,fx){$el.css("display","");if(!$.support.opacity&&fx.opacity){$el[0].style.removeAttribute("filter")}}var showTab=showFx?function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.hide().removeClass("ui-tabs-hide").animate(showFx,showFx.duration||"normal",function(){resetStyle($show,showFx);self._trigger("show",null,self._ui(clicked,$show[0]))})}:function(clicked,$show){$(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.removeClass("ui-tabs-hide");self._trigger("show",null,self._ui(clicked,$show[0]))};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||"normal",function(){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");resetStyle($hide,hideFx);self.element.dequeue("tabs")})}:function(clicked,$hide,$show){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");self.element.dequeue("tabs")};this.anchors.bind(o.event+".tabs",function(){var el=this,$li=$(el).closest("li"),$hide=self.panels.filter(":not(.ui-tabs-hide)"),$show=self.element.find(self._sanitizeSelector(el.hash));if(($li.hasClass("ui-tabs-selected")&&!o.collapsible)||$li.hasClass("ui-state-disabled")||$li.hasClass("ui-state-processing")||self.panels.filter(":animated").length||self._trigger("select",null,self._ui(this,$show[0]))===false){this.blur();return false}o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass("ui-tabs-selected")){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){hideTab(el,$hide)}).dequeue("tabs");this.blur();return false}else{if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie)}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this));this.blur();return false}}}if(o.cookie){self._cookie(o.selected,o.cookie)}if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide)})}self.element.queue("tabs",function(){showTab(el,$show)});self.load(self.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if($.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(index){if(typeof index=="string"){index=this.anchors.index(this.anchors.filter("[href$="+index+"]"))}return index},destroy:function(){var o=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var href=$.data(this,"href.tabs");if(href){this.href=href}var $this=$(this).unbind(".tabs");$.each(["href","load","cache"],function(i,prefix){$this.removeData(prefix+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if($.data(this,"destroy.tabs")){$(this).remove()}else{$(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(o.cookie){this._cookie(null,o.cookie)}return this},add:function(url,label,index){if(index===undefined){index=this.anchors.length}var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf("#")?url.replace("#",""):this._tabId($("a",$li)[0]);$li.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var $panel=self.element.find("#"+id);if(!$panel.length){$panel=$(o.panelTemplate).attr("id",id).data("destroy.tabs",true)}$panel.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode)}else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index])}o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this._tabify();if(this.anchors.length==1){o.selected=0;$li.addClass("ui-tabs-selected ui-state-active");$panel.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[0],self.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[index],this.panels[index]));return this},remove:function(index){index=this._getIndex(index);var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(index+(index+1=index?--n:n});this._tabify();this._trigger("remove",null,this._ui($li.find("a")[0],$panel[0]));return this},enable:function(index){index=this._getIndex(index);var o=this.options;if($.inArray(index,o.disabled)==-1){return}this.lis.eq(index).removeClass("ui-state-disabled");o.disabled=$.grep(o.disabled,function(n,i){return n!=index});this._trigger("enable",null,this._ui(this.anchors[index],this.panels[index]));return this},disable:function(index){index=this._getIndex(index);var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass("ui-state-disabled");o.disabled.push(index);o.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[index],this.panels[index]))}return this},select:function(index){index=this._getIndex(index);if(index==-1){if(this.options.collapsible&&this.options.selected!=-1){index=this.options.selected}else{return this}}this.anchors.eq(index).trigger(this.options.event+".tabs");return this},load:function(index){index=this._getIndex(index);var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,"load.tabs");this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(index).addClass("ui-state-processing");if(o.spinner){var span=$("span",a);span.data("label.tabs",span.html()).html(o.spinner)}this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){self.element.find(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,"cache.tabs",true)}self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s)}catch(e){}},error:function(xhr,s,e){self._cleanup();self._trigger("load",null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.error(xhr,s,index,a)}catch(e){}}}));self.element.dequeue("tabs");return this},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(index,url){this.anchors.eq(index).removeData("cache.tabs").data("load.tabs",url);return this},length:function(){return this.anchors.length}});$.extend($.ui.tabs,{version:"1.8.16"});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++tviewportOffset.top&&elementOffset.topviewportOffset.left&&elementOffset.leftelementOffset.left?"right":(viewportOffset.left+viewportSize.width)<(elementOffset.left+elementSize.width)?"left":"both");visiblePartY=(viewportOffset.top>elementOffset.top?"bottom":(viewportOffset.top+viewportSize.height)<(elementOffset.top+elementSize.height)?"top":"both");visiblePartsMerged=visiblePartX+"-"+visiblePartY;if(!inView||inView!==visiblePartsMerged){$element.data("inview",visiblePartsMerged).trigger("inview",[true,visiblePartX,visiblePartY])}}else{if(inView){$element.data("inview",false).trigger("inview",[false])}}}}}$(w).bind("scroll resize",function(){viewportSize=viewportOffset=null});setInterval(checkInView,250)})(jQuery); +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('