diff --git a/.eslintignore [DEPRECATED] b/.eslintignore [DEPRECATED] new file mode 100644 index 0000000..db181dd --- /dev/null +++ b/.eslintignore [DEPRECATED] @@ -0,0 +1 @@ +**/*.min.js diff --git a/.eslintrc.js [DEPRECATED] b/.eslintrc.js [DEPRECATED] new file mode 100644 index 0000000..8ebc3c0 --- /dev/null +++ b/.eslintrc.js [DEPRECATED] @@ -0,0 +1,88 @@ +/* eslint-disable quotes */ + +module.exports = { + "root": true, + + "env": { + "browser": true, + "es6": true, + "greasemonkey": true, + "jquery": true, + // "node": true + }, + + "parserOptions": { + // "ecmaVersion": 12, + "ecmaVersion": "latest", + "sourceType": "script", + "ecmaFeatures": { + "globalReturn ": true, + "impliedStrict": true, + // "jsx": true, + }, + }, + + // "extends": "eslint:all", + // "extends": "eslint:recommended", + "extends": [ + "eslint:recommended", + // "eslint:all", + "plugin:css/recommended", + "plugin:jsonc/recommended-with-json", + // "plugin:no-jquery/recommended", + "plugin:no-jquery/deprecated", + // "plugin:no-jquery/slim", + // "plugin:no-jquery/all", + // "plugin:clean-regex/recommended" + "plugin:regexp/recommended", + // "plugin:regexp/all", + ], + + "plugins": [ + "css", + "jsonc", + // "clean-regex", + "no-jquery", + "regexp", + ], + + "rules": { + "complexity": ["warn", 20], + "eqeqeq": "warn", + "func-style": "off", + // "indent": ["warn","tab" ], + // "indent": ["warn","tab", { "SwitchCase": 1 } ], + // "indent": ["warn","tab", { "ignoreComments": true, "SwitchCase": 1 } ], + "indent": ["warn","tab", { "ignoreComments": false, "SwitchCase": 1 } ], + "linebreak-style": ["warn","unix"], + "max-len": "off", + "max-statements-per-line": "off", + "new-cap": "off", + "no-alert": "warn", + "no-console": "warn", + "no-dupe-keys": "warn", + "no-extra-semi": "warn", + "no-inline-comments": "off", + "no-magic-numbers": "off", + "no-misleading-character-class": "warn", + "no-mixed-spaces-and-tabs": "warn", + // "no-var": "off", + "no-multiple-empty-lines": "off", + "no-tabs": "off", + "no-unused-labels": "warn", + "no-unused-vars": ["warn", {"vars": "all", "args": "after-used"}], + "no-useless-escape": "warn", + "padded-blocks": "off", + "quotes": ["warn", "single", { "allowTemplateLiterals": true }] , + "require-jsdoc": "off", + "require-unicode-regexp": "off", + "semi": ["warn","always"], + // "strict": ["error", "global"], + "space-before-function-paren": "off", + // "space-in-parens": ["warn", "always"], + "unicode-bom": ["warn", "never"], + }, + + "reportUnusedDisableDirectives": true + +}; diff --git a/.eslintrc.json [DEPRECATED] b/.eslintrc.json [DEPRECATED] new file mode 100644 index 0000000..a34a4d6 --- /dev/null +++ b/.eslintrc.json [DEPRECATED] @@ -0,0 +1,61 @@ +{ + "root": true, + "env": { + "browser": true, + "es6": true, + "greasemonkey": true, + "jquery": true + }, + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "script", + "ecmaFeatures": { + "globalReturn ": true, + "impliedStrict": true + } + }, + "extends": [ + "eslint:recommended", + "plugin:css/recommended", + "plugin:jsonc/recommended-with-json", + "plugin:no-jquery/deprecated", + "plugin:regexp/recommended" + ], + "plugins": [ + "css", + "jsonc", + "no-jquery", + "regexp" + ], + "rules": { + "complexity": ["warn", 20], + "eqeqeq": "warn", + "func-style": "off", + "indent": ["warn","tab", { "ignoreComments": false, "SwitchCase": 1 } ], + "linebreak-style": ["warn","unix"], + "max-len": "off", + "max-statements-per-line": "off", + "new-cap": "off", + "no-alert": "warn", + "no-console": "warn", + "no-dupe-keys": "warn", + "no-extra-semi": "warn", + "no-inline-comments": "off", + "no-magic-numbers": "off", + "no-misleading-character-class": "warn", + "no-mixed-spaces-and-tabs": "warn", + "no-multiple-empty-lines": "off", + "no-tabs": "off", + "no-unused-labels": "warn", + "no-unused-vars": ["warn", {"vars": "all", "args": "after-used"}], + "no-useless-escape": "warn", + "padded-blocks": "off", + "quotes": ["warn", "single", { "allowTemplateLiterals": true }] , + "require-jsdoc": "off", + "require-unicode-regexp": "off", + "semi": ["warn","always"], + "space-before-function-paren": "off", + "unicode-bom": ["warn", "never"] + }, + "reportUnusedDisableDirectives": true +} diff --git a/.gitattributes b/.gitattributes index bdb0cab..1e78b8c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Auto detect text files and perform LF normalization -* text=auto +* text=auto eol=lf # Custom for Visual Studio *.cs diff=csharp diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..eaba567 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: 🐛 Report a bug +description: File a bug report +title: "[script title] " +labels: bug +body: + - type: markdown + attributes: + value: | + # Thanks for reporting a bug! ⛰ + + Help us replicate the issue by filling in this form. + - type: checkboxes + id: terms + attributes: + label: "Please ensure:" + options: + - label: "I included in the issue title the script name I'm referring to." + required: true + - label: I performed a search of the [issue tracker](https://github.com/darkred/Userscripts/issues) and in the relevant Greasyfork [feedback page](https://greasyfork.org/en/users/2160-darkred?sort=updated) to avoid opening a duplicate issue. + required: true + - label: The bug is caused by the script itself. It doesn't happen if I disable the script, or in a fresh browser profile. + required: true + - type: checkboxes + attributes: + label: 'Include in this issue:' + options: + - label: Screenshots/video/gif demonstrating the bug, if it’s visual + - label: Console errors, if any + - type: textarea + id: the-problem + attributes: + label: Describe the problem and how to replicate it + validations: + required: true + - type: input + id: example-url + attributes: + label: Example URL + description: A REAL URL where the bug appears. + placeholder: https://example.com/page1.htm + validations: + required: true + - type: input + id: script-manager + attributes: + label: Script Manager + description: (Tampermonkey and Violentmonkey are supported - Greasemonkey is NOT supported) + placeholder: e.g. Tampermonkey 4.14 + validations: + required: true + - type: input + id: browsers + attributes: + label: Browser(s) used + description: (make sure it is the latest version - old versions are NOT supported) + placeholder: e.g. Chrome 92 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md.old b/.github/ISSUE_TEMPLATE/feature_request.md.old new file mode 100644 index 0000000..f8b7ea6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md.old @@ -0,0 +1,16 @@ +--- +name: 🆕 Suggest an improvement or new feature +about: ——— +title: '' +labels: enhancement, under discussion +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..45791c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,32 @@ +name: 🆕 Suggest an improvement or new feature +description: ——— +title: "[script title] " +labels: enhancement, under discussion +body: + - type: checkboxes + id: terms + attributes: + label: "Please ensure:" + options: + - label: "I included in the issue title the script name I'm referring to." + required: true + - label: "Before you request from me to write a new script for you, check in https://greasyfork.org/en/scripts and https://openuserjs.org/ : what you ask might be there already." + required: false + - type: textarea + attributes: + label: Description + description: "Try to be as specific as possible, don't make me have to guess what your suggested improvement or feature is." + validations: + required: true + - type: textarea + attributes: + label: Screenshot + description: You can provide screenshots/mockups to better visualize your idea. Files can be dropped in this field + - type: input + attributes: + label: Example URL + description: Include a REAL URL where the feature should appear. Paste a link here + placeholder: https://example.com/index.html + value: https:// + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..75d11ec --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" # Check for updates to GitHub Actions every week diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..b9d6d20 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,14 @@ +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/evergreen.yml b/.github/workflows/evergreen.yml new file mode 100644 index 0000000..57eb768 --- /dev/null +++ b/.github/workflows/evergreen.yml @@ -0,0 +1,22 @@ +name: Weekly dependabot checks + +on: + workflow_dispatch: + schedule: + - cron: '3 2 1 * *' + +permissions: + issues: write + pull-requests: write + +jobs: + evergreen: + name: evergreen + runs-on: ubuntu-latest + + steps: + - name: Run evergreen action + uses: github/evergreen@v1 + env: + GH_TOKEN: ${{ secrets.EVERGREEN_ACTION }} + REPOSITORY: darkred diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..f2415f5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,31 @@ +# from https://github.com/tophf/mpiv/blob/master/.github/workflows/lint.yml +# and https://github.com/stefanoeb/eslint-action/blob/master/README.md + +name: ESLint + +on: + push: + branches: [ master ] + paths-ignore: + - '.github/**' # this yml is also excluded so you need to re-run it explicitly if necessary + - .editorconfig + - LICENSE + - README.md + pull_request: + branches: [ master ] + paths-ignore: + - '.github/**' # this yml is also excluded so you need to re-run it explicitly if necessary + - .editorconfig + - LICENSE + - README.md + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install modules + run: npm install + - name: Run ESLint + run: npx eslint . --ext .user.js diff --git a/.gitignore b/.gitignore index cd2946a..fe04e22 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,9 @@ $RECYCLE.BIN/ Network Trash Folder Temporary Items .apdisk + + +node_modules/ + +# lockfiles +package-lock.json diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/1337X_-_convert_torrent_timestamps_to_relative_format.user.js b/1337X_-_convert_torrent_timestamps_to_relative_format/1337X_-_convert_torrent_timestamps_to_relative_format.user.js new file mode 100644 index 0000000..5eee4ab --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/1337X_-_convert_torrent_timestamps_to_relative_format.user.js @@ -0,0 +1,110 @@ +// ==UserScript== +// @name 1337X - convert torrent timestamps to relative format +// @namespace darkred +// @version 2021.7.14.1 +// @description Converts torrent upload timestamps to relative format +// @author darkred +// @license MIT +// @include /^https:\/\/(www\.)?1337x\.(to|st|ws|eu|se|is|gd|unblocked\.dk)((?!\/torrent)).*$/ +// @grant none +// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.31/moment-timezone-with-data-10-year-range.min.js +// @supportURL https://github.com/darkred/Userscripts/issues +// ==/UserScript== + +// Official mirrors list: https://1337x.to/about + +'use strict'; +/* global moment */ + + + + + +// 11:59am ---> h:hha +// 10am Oct. 30th ---> haA MMM. Do +// 11pm Nov. 4th +// Oct. 31st '20 + + + +// Based on the timestamp on the footer of each RARBG page --> "Sat, 01 May 2020 20:14:56 +0200", +// the script takes that the server time is GMT+2 and that it doesn't take DST. +// Also, the script uses the 'moment-timezone' library as it takes DST offsets into account when converting the timestamps to user/local timezone. + +// This is no typo: +// const serverTimezone = 'Etc/GMT+2'; // -02:00 -02:00 (=no DST) +// const serverTimezone = 'Etc/GMT-2'; // +02:00 +02:00 (=no DST) +const serverTimezone = 'Etc/GMT-1'; // +01:00 +01:00 (=no DST) + +// const serverTimezone = 'Etc/GMT-1'; + +const localTimezone = moment.tz.guess(); // In my case ----> +02:00 +03:00 (DST) + +// const format = 'MM/DD/YYYY HH:mm:ss'; +// const format = 'YYYY-MM-DD HH:mm:ss'; +moment.locale('en'); +const format = ['h:mma', 'ha MMM. Do', 'MMM. Do \'YY']; +const formatTooltip1 = 'h:mma'; // the 1st element of the above array. +const formatTooltip2 = 'ha MMM. Do'; // the 2st element of the array (there can be no 3rd format, e.g. Oct. 31st '20 is only date, not time ). + +// Customize the strings in the locale to display "1 minute ago" instead of "a minute ago" (https://github.com/moment/moment/issues/3764#issuecomment-279928245) +moment.updateLocale('en', { + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'seconds', + m: '1 minute', + mm: '%d minutes', + h: '1 hour', + hh: '%d hours', + d: '1 day', + dd: '%d days', + M: '1 month', + MM: '%d months', + y: '1 year', + yy: '%d years' + } +}); + + +function convertToLocalTimezone(timestamps) { + for (let i = 0; i < timestamps.length; i++) { + let initialTimestamp = timestamps[i].textContent; + if (moment(initialTimestamp, format, true).isValid()) { // As of moment.js v2.3.0, you may specify a boolean for the last argument to make Moment use strict parsing. Strict parsing requires that the format and input match exactly, including delimeters. + let convertedToLocalTimezone = moment.tz(initialTimestamp, format, serverTimezone).tz(localTimezone); + timestamps[i].textContent = convertedToLocalTimezone.fromNow(); + + // timestamps[i].title = initialTimestamp; + if (moment(initialTimestamp, formatTooltip1, true).isValid()) { + timestamps[i].title = convertedToLocalTimezone.format(formatTooltip1); + } else if (moment(initialTimestamp, formatTooltip2, true).isValid()) { + timestamps[i].title = convertedToLocalTimezone.format(formatTooltip2); + // timestamps[i].title = convertedToLocalTimezone.toISOString(); // Display timestamps in tooltips in ISO 8601 format, combining date and time (https://stackoverflow.com/questions/25725019/how-do-i-format-a-date-as-iso-8601-in-moment-js/) + } + } + } + + + // recalculate the relative dates every 1 min + (function(){ + for (let i = 0; i < timestamps.length; i++) { + // timestamps[i].textContent = moment(timestamps[i].title).fromNow(); + + if (timestamps[i].title !== '') { + let tooltipValue = timestamps[i].title; + let convertedToLocalTimezone = moment(tooltipValue, format); // no need to reconvert, it's already in local timezone + timestamps[i].textContent = convertedToLocalTimezone.fromNow(); + } + + } + // setTimeout(arguments.callee, 10 * 1000); // 10 * 1000 msec = 10 sec = 1/6 min + setTimeout(arguments.callee, 60 * 1000); // 60 * 1000 msec = 1 min + })(); + + +} + +// const timestamps = document.querySelectorAll('tr.lista2 td:nth-child(3)'); +const timestamps = document.querySelectorAll('tbody .coll-date'); +convertToLocalTimezone(timestamps); diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/README.md b/1337X_-_convert_torrent_timestamps_to_relative_format/README.md new file mode 100644 index 0000000..abc5eb9 --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/README.md @@ -0,0 +1,13 @@ +This script applies to 1337X torrent lists. +- it converts torrent timestamps to relative format in local timezone. Also, it recalculates them every 1 min. +- The initial timestamps are still available as tooltips (on mouse hover), also converted to local timezone. + +It uses [moment.js](http://momentjs.com/) and [moment-timezone.js](http://momentjs.com/timezone/). + +Screenshot comparison: +Initial: +![](https://i.imgur.com/ZcEdXNI.jpg) +With the script: +![](https://i.imgur.com/1I027xL.jpg) + +[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/moment-timezone-with-data-10-year-range.min.js b/1337X_-_convert_torrent_timestamps_to_relative_format/moment-timezone-with-data-10-year-range.min.js new file mode 100644 index 0000000..5173d52 --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/moment-timezone-with-data-10-year-range.min.js @@ -0,0 +1 @@ +!function(a,i){"use strict";"object"==typeof module&&module.exports?module.exports=i(require("moment")):"function"==typeof define&&define.amd?define(["moment"],i):i(a.moment)}(this,function(c){"use strict";void 0===c.version&&c.default&&(c=c.default);var i,A={},n={},t={},s={},u={};c&&"string"==typeof c.version||O("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var a=c.version.split("."),e=+a[0],r=+a[1];function m(a){return 96= 2.6.0. You are using Moment.js "+c.version+". See momentjs.com"),M.prototype={_set:function(a){this.name=a.name,this.abbrs=a.abbrs,this.untils=a.untils,this.offsets=a.offsets,this.population=a.population},_index:function(a){var i,e=+a,r=this.untils;for(i=0;i= 2.9.0. You are using Moment.js "+c.version+"."),c.defaultZone=a?_(a):null,c};var G=c.momentProperties;return"[object Array]"===Object.prototype.toString.call(G)?(G.push("_z"),G.push("_a")):G&&(G._z=null),B({version:"2020a",zones:["Africa/Abidjan|GMT|0|0||48e5","Africa/Nairobi|EAT|-30|0||47e5","Africa/Algiers|CET|-10|0||26e5","Africa/Lagos|WAT|-10|0||17e6","Africa/Maputo|CAT|-20|0||26e5","Africa/Cairo|EET|-20|0||15e6","Africa/Casablanca|+00 +01|0 -10|010101010101010101010101010101|1O9e0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0|32e5","Europe/Paris|CET CEST|-10 -20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|11e6","Africa/Johannesburg|SAST|-20|0||84e5","Africa/Khartoum|EAT CAT|-30 -20|01|1Usl0|51e5","Africa/Sao_Tome|GMT WAT|0 -10|010|1UQN0 2q00|","Africa/Windhoek|CAT WAT|-20 -10|0101010|1Oc00 11B0 1nX0 11B0 1nX0 11B0|32e4","America/Adak|HST HDT|a0 90|01010101010101010101010|1O100 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|326","America/Anchorage|AKST AKDT|90 80|01010101010101010101010|1O0X0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|30e4","America/Santo_Domingo|AST|40|0||29e5","America/Fortaleza|-03|30|0||34e5","America/Asuncion|-03 -04|30 40|01010101010101010101010|1O6r0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0|28e5","America/Panama|EST|50|0||15e5","America/Mexico_City|CST CDT|60 50|01010101010101010101010|1Oc80 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|20e6","America/Managua|CST|60|0||22e5","America/La_Paz|-04|40|0||19e5","America/Lima|-05|50|0||11e6","America/Denver|MST MDT|70 60|01010101010101010101010|1O0V0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|26e5","America/Campo_Grande|-03 -04|30 40|0101010101|1NTf0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|77e4","America/Cancun|CST EST|60 50|01|1NKU0|63e4","America/Caracas|-0430 -04|4u 40|01|1QMT0|29e5","America/Chicago|CST CDT|60 50|01010101010101010101010|1O0U0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|92e5","America/Chihuahua|MST MDT|70 60|01010101010101010101010|1Oc90 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|81e4","America/Phoenix|MST|70|0||42e5","America/Whitehorse|PST PDT MST|80 70 70|010101010102|1O0W0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0|23e3","America/New_York|EST EDT|50 40|01010101010101010101010|1O0T0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|21e6","America/Los_Angeles|PST PDT|80 70|01010101010101010101010|1O0W0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e6","America/Fort_Nelson|PST MST|80 70|01|1O0W0|39e2","America/Halifax|AST ADT|40 30|01010101010101010101010|1O0S0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|39e4","America/Godthab|-03 -02|30 20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e3","America/Grand_Turk|EST EDT AST|50 40 40|0121010101010101010|1O0T0 1zb0 5Ip0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e2","America/Havana|CST CDT|50 40|01010101010101010101010|1O0R0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0|21e5","America/Metlakatla|PST AKST AKDT|80 90 80|01212120121212121212121|1PAa0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 uM0 jB0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|14e2","America/Miquelon|-03 -02|30 20|01010101010101010101010|1O0R0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|61e2","America/Montevideo|-02 -03|20 30|01|1O0Q0|17e5","America/Noronha|-02|20|0||30e2","America/Port-au-Prince|EST EDT|50 40|010101010101010101010|1O0T0 1zb0 3iN0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e5","Antarctica/Palmer|-03 -04|30 40|010|1QSr0 Ap0|40","America/Santiago|-03 -04|30 40|010101010101010101010|1QSr0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0|62e5","America/Sao_Paulo|-02 -03|20 30|0101010101|1NTe0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|20e6","Atlantic/Azores|-01 +00|10 0|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|25e4","America/St_Johns|NST NDT|3u 2u|01010101010101010101010|1O0Ru 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|11e4","Antarctica/Casey|+08 +11|-80 -b0|010|1RWg0 3m10|10","Asia/Bangkok|+07|-70|0||15e6","Asia/Vladivostok|+10|-a0|0||60e4","Pacific/Bougainville|+11|-b0|0||18e4","Asia/Tashkent|+05|-50|0||23e5","Pacific/Auckland|NZDT NZST|-d0 -c0|01010101010101010101010|1ObO0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00|14e5","Asia/Baghdad|+03|-30|0||66e5","Antarctica/Troll|+00 +02|0 -20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|40","Asia/Dhaka|+06|-60|0||16e6","Asia/Amman|EET EEST|-20 -30|01010101010101010101010|1O8m0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0|25e5","Asia/Kamchatka|+12|-c0|0||18e4","Asia/Baku|+04 +05|-40 -50|010|1O9c0 1o00|27e5","Asia/Barnaul|+06 +07|-60 -70|01|1QyI0|","Asia/Beirut|EET EEST|-20 -30|01010101010101010101010|1O9a0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0|22e5","Asia/Kuala_Lumpur|+08|-80|0||71e5","Asia/Kolkata|IST|-5u|0||15e6","Asia/Chita|+08 +09|-80 -90|01|1QyG0|33e4","Asia/Ulaanbaatar|+08 +09|-80 -90|01010|1O8G0 1cJ0 1cP0 1cJ0|12e5","Asia/Shanghai|CST|-80|0||23e6","Asia/Colombo|+0530|-5u|0||22e5","Asia/Damascus|EET EEST|-20 -30|01010101010101010101010|1O8m0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0|26e5","Asia/Yakutsk|+09|-90|0||28e4","Asia/Dubai|+04|-40|0||39e5","Asia/Famagusta|EET EEST +03|-20 -30 -30|0101201010101010101010|1O9d0 1o00 11A0 15U0 2Ks0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Asia/Gaza|EET EEST|-20 -30|01010101010101010101010|1O8K0 1nz0 1220 1qL0 WN0 1qL0 WN0 1qL0 11c0 1oo0 11c0 1rc0 Wo0 1rc0 Wo0 1rc0 11c0 1oo0 11c0 1oo0 11c0 1oo0|18e5","Asia/Hong_Kong|HKT|-80|0||73e5","Asia/Hovd|+07 +08|-70 -80|01010|1O8H0 1cJ0 1cP0 1cJ0|81e3","Europe/Istanbul|EET EEST +03|-20 -30 -30|01012|1O9d0 1tA0 U00 15w0|13e6","Asia/Jakarta|WIB|-70|0||31e6","Asia/Jayapura|WIT|-90|0||26e4","Asia/Jerusalem|IST IDT|-20 -30|01010101010101010101010|1O8o0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0|81e4","Asia/Kabul|+0430|-4u|0||46e5","Asia/Karachi|PKT|-50|0||24e6","Asia/Kathmandu|+0545|-5J|0||12e5","Asia/Magadan|+10 +11|-a0 -b0|01|1QJQ0|95e3","Asia/Makassar|WITA|-80|0||15e5","Asia/Manila|PST|-80|0||24e6","Europe/Athens|EET EEST|-20 -30|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|35e5","Asia/Novosibirsk|+06 +07|-60 -70|01|1Rmk0|15e5","Asia/Pyongyang|KST KST|-90 -8u|010|1P4D0 6BA0|29e5","Asia/Qyzylorda|+06 +05|-60 -50|01|1Xei0|73e4","Asia/Rangoon|+0630|-6u|0||48e5","Asia/Sakhalin|+10 +11|-a0 -b0|01|1QyE0|58e4","Asia/Seoul|KST|-90|0||23e6","Asia/Tehran|+0330 +0430|-3u -4u|01010101010101010101010|1O6ku 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0|14e6","Asia/Tokyo|JST|-90|0||38e6","Asia/Tomsk|+06 +07|-60 -70|01|1QXU0|10e5","Europe/Lisbon|WET WEST|0 -10|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|27e5","Atlantic/Cape_Verde|-01|10|0||50e4","Australia/Sydney|AEDT AEST|-b0 -a0|01010101010101010101010|1ObQ0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0|40e5","Australia/Adelaide|ACDT ACST|-au -9u|01010101010101010101010|1ObQu 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0|11e5","Australia/Brisbane|AEST|-a0|0||20e5","Australia/Darwin|ACST|-9u|0||12e4","Australia/Eucla|+0845|-8J|0||368","Australia/Lord_Howe|+11 +1030|-b0 -au|01010101010101010101010|1ObP0 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1fzu 1cMu 1cLu 1cMu|347","Australia/Perth|AWST|-80|0||18e5","Pacific/Easter|-05 -06|50 60|010101010101010101010|1QSr0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0|30e2","Europe/Dublin|GMT IST|0 -10|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5","Etc/GMT-1|+01|-10|0||","Pacific/Fakaofo|+13|-d0|0||483","Pacific/Kiritimati|+14|-e0|0||51e2","Etc/GMT-2|+02|-20|0||","Pacific/Tahiti|-10|a0|0||18e4","Pacific/Niue|-11|b0|0||12e2","Etc/GMT+12|-12|c0|0||","Pacific/Galapagos|-06|60|0||25e3","Etc/GMT+7|-07|70|0||","Pacific/Pitcairn|-08|80|0||56","Pacific/Gambier|-09|90|0||125","Etc/UTC|UTC|0|0||","Europe/Ulyanovsk|+03 +04|-30 -40|01|1QyL0|13e5","Europe/London|GMT BST|0 -10|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|10e6","Europe/Chisinau|EET EEST|-20 -30|01010101010101010101010|1O9c0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|67e4","Europe/Moscow|MSK|-30|0||16e6","Europe/Saratov|+03 +04|-30 -40|01|1Sfz0|","Europe/Volgograd|+03 +04|-30 -40|01|1WQL0|10e5","Pacific/Honolulu|HST|a0|0||37e4","MET|MET MEST|-10 -20|01010101010101010101010|1O9d0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|","Pacific/Chatham|+1345 +1245|-dJ -cJ|01010101010101010101010|1ObO0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00|600","Pacific/Apia|+14 +13|-e0 -d0|01010101010101010101010|1ObO0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00|37e3","Pacific/Fiji|+13 +12|-d0 -c0|01010101010101010101010|1NF20 1SM0 uM0 1VA0 s00 1VA0 s00 1VA0 s00 20o0 pc0 20o0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0|88e4","Pacific/Guam|ChST|-a0|0||17e4","Pacific/Marquesas|-0930|9u|0||86e2","Pacific/Pago_Pago|SST|b0|0||37e2","Pacific/Norfolk|+1130 +11 +12|-bu -b0 -c0|012121212121212|1PoCu 9Jcu 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0|25e4","Pacific/Tongatapu|+13 +14|-d0 -e0|010|1S4d0 s00|75e3"],links:["Africa/Abidjan|Africa/Accra","Africa/Abidjan|Africa/Bamako","Africa/Abidjan|Africa/Banjul","Africa/Abidjan|Africa/Bissau","Africa/Abidjan|Africa/Conakry","Africa/Abidjan|Africa/Dakar","Africa/Abidjan|Africa/Freetown","Africa/Abidjan|Africa/Lome","Africa/Abidjan|Africa/Monrovia","Africa/Abidjan|Africa/Nouakchott","Africa/Abidjan|Africa/Ouagadougou","Africa/Abidjan|Africa/Timbuktu","Africa/Abidjan|America/Danmarkshavn","Africa/Abidjan|Atlantic/Reykjavik","Africa/Abidjan|Atlantic/St_Helena","Africa/Abidjan|Etc/GMT","Africa/Abidjan|Etc/GMT+0","Africa/Abidjan|Etc/GMT-0","Africa/Abidjan|Etc/GMT0","Africa/Abidjan|Etc/Greenwich","Africa/Abidjan|GMT","Africa/Abidjan|GMT+0","Africa/Abidjan|GMT-0","Africa/Abidjan|GMT0","Africa/Abidjan|Greenwich","Africa/Abidjan|Iceland","Africa/Algiers|Africa/Tunis","Africa/Cairo|Africa/Tripoli","Africa/Cairo|Egypt","Africa/Cairo|Europe/Kaliningrad","Africa/Cairo|Libya","Africa/Casablanca|Africa/El_Aaiun","Africa/Johannesburg|Africa/Maseru","Africa/Johannesburg|Africa/Mbabane","Africa/Lagos|Africa/Bangui","Africa/Lagos|Africa/Brazzaville","Africa/Lagos|Africa/Douala","Africa/Lagos|Africa/Kinshasa","Africa/Lagos|Africa/Libreville","Africa/Lagos|Africa/Luanda","Africa/Lagos|Africa/Malabo","Africa/Lagos|Africa/Ndjamena","Africa/Lagos|Africa/Niamey","Africa/Lagos|Africa/Porto-Novo","Africa/Maputo|Africa/Blantyre","Africa/Maputo|Africa/Bujumbura","Africa/Maputo|Africa/Gaborone","Africa/Maputo|Africa/Harare","Africa/Maputo|Africa/Kigali","Africa/Maputo|Africa/Lubumbashi","Africa/Maputo|Africa/Lusaka","Africa/Nairobi|Africa/Addis_Ababa","Africa/Nairobi|Africa/Asmara","Africa/Nairobi|Africa/Asmera","Africa/Nairobi|Africa/Dar_es_Salaam","Africa/Nairobi|Africa/Djibouti","Africa/Nairobi|Africa/Juba","Africa/Nairobi|Africa/Kampala","Africa/Nairobi|Africa/Mogadishu","Africa/Nairobi|Indian/Antananarivo","Africa/Nairobi|Indian/Comoro","Africa/Nairobi|Indian/Mayotte","America/Adak|America/Atka","America/Adak|US/Aleutian","America/Anchorage|America/Juneau","America/Anchorage|America/Nome","America/Anchorage|America/Sitka","America/Anchorage|America/Yakutat","America/Anchorage|US/Alaska","America/Campo_Grande|America/Cuiaba","America/Chicago|America/Indiana/Knox","America/Chicago|America/Indiana/Tell_City","America/Chicago|America/Knox_IN","America/Chicago|America/Matamoros","America/Chicago|America/Menominee","America/Chicago|America/North_Dakota/Beulah","America/Chicago|America/North_Dakota/Center","America/Chicago|America/North_Dakota/New_Salem","America/Chicago|America/Rainy_River","America/Chicago|America/Rankin_Inlet","America/Chicago|America/Resolute","America/Chicago|America/Winnipeg","America/Chicago|CST6CDT","America/Chicago|Canada/Central","America/Chicago|US/Central","America/Chicago|US/Indiana-Starke","America/Chihuahua|America/Mazatlan","America/Chihuahua|Mexico/BajaSur","America/Denver|America/Boise","America/Denver|America/Cambridge_Bay","America/Denver|America/Edmonton","America/Denver|America/Inuvik","America/Denver|America/Ojinaga","America/Denver|America/Shiprock","America/Denver|America/Yellowknife","America/Denver|Canada/Mountain","America/Denver|MST7MDT","America/Denver|Navajo","America/Denver|US/Mountain","America/Fortaleza|America/Araguaina","America/Fortaleza|America/Argentina/Buenos_Aires","America/Fortaleza|America/Argentina/Catamarca","America/Fortaleza|America/Argentina/ComodRivadavia","America/Fortaleza|America/Argentina/Cordoba","America/Fortaleza|America/Argentina/Jujuy","America/Fortaleza|America/Argentina/La_Rioja","America/Fortaleza|America/Argentina/Mendoza","America/Fortaleza|America/Argentina/Rio_Gallegos","America/Fortaleza|America/Argentina/Salta","America/Fortaleza|America/Argentina/San_Juan","America/Fortaleza|America/Argentina/San_Luis","America/Fortaleza|America/Argentina/Tucuman","America/Fortaleza|America/Argentina/Ushuaia","America/Fortaleza|America/Bahia","America/Fortaleza|America/Belem","America/Fortaleza|America/Buenos_Aires","America/Fortaleza|America/Catamarca","America/Fortaleza|America/Cayenne","America/Fortaleza|America/Cordoba","America/Fortaleza|America/Jujuy","America/Fortaleza|America/Maceio","America/Fortaleza|America/Mendoza","America/Fortaleza|America/Paramaribo","America/Fortaleza|America/Recife","America/Fortaleza|America/Rosario","America/Fortaleza|America/Santarem","America/Fortaleza|Antarctica/Rothera","America/Fortaleza|Atlantic/Stanley","America/Fortaleza|Etc/GMT+3","America/Godthab|America/Nuuk","America/Halifax|America/Glace_Bay","America/Halifax|America/Goose_Bay","America/Halifax|America/Moncton","America/Halifax|America/Thule","America/Halifax|Atlantic/Bermuda","America/Halifax|Canada/Atlantic","America/Havana|Cuba","America/La_Paz|America/Boa_Vista","America/La_Paz|America/Guyana","America/La_Paz|America/Manaus","America/La_Paz|America/Porto_Velho","America/La_Paz|Brazil/West","America/La_Paz|Etc/GMT+4","America/Lima|America/Bogota","America/Lima|America/Eirunepe","America/Lima|America/Guayaquil","America/Lima|America/Porto_Acre","America/Lima|America/Rio_Branco","America/Lima|Brazil/Acre","America/Lima|Etc/GMT+5","America/Los_Angeles|America/Ensenada","America/Los_Angeles|America/Santa_Isabel","America/Los_Angeles|America/Tijuana","America/Los_Angeles|America/Vancouver","America/Los_Angeles|Canada/Pacific","America/Los_Angeles|Mexico/BajaNorte","America/Los_Angeles|PST8PDT","America/Los_Angeles|US/Pacific","America/Los_Angeles|US/Pacific-New","America/Managua|America/Belize","America/Managua|America/Costa_Rica","America/Managua|America/El_Salvador","America/Managua|America/Guatemala","America/Managua|America/Regina","America/Managua|America/Swift_Current","America/Managua|America/Tegucigalpa","America/Managua|Canada/Saskatchewan","America/Mexico_City|America/Bahia_Banderas","America/Mexico_City|America/Merida","America/Mexico_City|America/Monterrey","America/Mexico_City|Mexico/General","America/New_York|America/Detroit","America/New_York|America/Fort_Wayne","America/New_York|America/Indiana/Indianapolis","America/New_York|America/Indiana/Marengo","America/New_York|America/Indiana/Petersburg","America/New_York|America/Indiana/Vevay","America/New_York|America/Indiana/Vincennes","America/New_York|America/Indiana/Winamac","America/New_York|America/Indianapolis","America/New_York|America/Iqaluit","America/New_York|America/Kentucky/Louisville","America/New_York|America/Kentucky/Monticello","America/New_York|America/Louisville","America/New_York|America/Montreal","America/New_York|America/Nassau","America/New_York|America/Nipigon","America/New_York|America/Pangnirtung","America/New_York|America/Thunder_Bay","America/New_York|America/Toronto","America/New_York|Canada/Eastern","America/New_York|EST5EDT","America/New_York|US/East-Indiana","America/New_York|US/Eastern","America/New_York|US/Michigan","America/Noronha|Atlantic/South_Georgia","America/Noronha|Brazil/DeNoronha","America/Noronha|Etc/GMT+2","America/Panama|America/Atikokan","America/Panama|America/Cayman","America/Panama|America/Coral_Harbour","America/Panama|America/Jamaica","America/Panama|EST","America/Panama|Jamaica","America/Phoenix|America/Creston","America/Phoenix|America/Dawson_Creek","America/Phoenix|America/Hermosillo","America/Phoenix|MST","America/Phoenix|US/Arizona","America/Santiago|Chile/Continental","America/Santo_Domingo|America/Anguilla","America/Santo_Domingo|America/Antigua","America/Santo_Domingo|America/Aruba","America/Santo_Domingo|America/Barbados","America/Santo_Domingo|America/Blanc-Sablon","America/Santo_Domingo|America/Curacao","America/Santo_Domingo|America/Dominica","America/Santo_Domingo|America/Grenada","America/Santo_Domingo|America/Guadeloupe","America/Santo_Domingo|America/Kralendijk","America/Santo_Domingo|America/Lower_Princes","America/Santo_Domingo|America/Marigot","America/Santo_Domingo|America/Martinique","America/Santo_Domingo|America/Montserrat","America/Santo_Domingo|America/Port_of_Spain","America/Santo_Domingo|America/Puerto_Rico","America/Santo_Domingo|America/St_Barthelemy","America/Santo_Domingo|America/St_Kitts","America/Santo_Domingo|America/St_Lucia","America/Santo_Domingo|America/St_Thomas","America/Santo_Domingo|America/St_Vincent","America/Santo_Domingo|America/Tortola","America/Santo_Domingo|America/Virgin","America/Sao_Paulo|Brazil/East","America/St_Johns|Canada/Newfoundland","America/Whitehorse|America/Dawson","America/Whitehorse|Canada/Yukon","Antarctica/Palmer|America/Punta_Arenas","Asia/Baghdad|Antarctica/Syowa","Asia/Baghdad|Asia/Aden","Asia/Baghdad|Asia/Bahrain","Asia/Baghdad|Asia/Kuwait","Asia/Baghdad|Asia/Qatar","Asia/Baghdad|Asia/Riyadh","Asia/Baghdad|Etc/GMT-3","Asia/Baghdad|Europe/Kirov","Asia/Baghdad|Europe/Minsk","Asia/Bangkok|Antarctica/Davis","Asia/Bangkok|Asia/Ho_Chi_Minh","Asia/Bangkok|Asia/Krasnoyarsk","Asia/Bangkok|Asia/Novokuznetsk","Asia/Bangkok|Asia/Phnom_Penh","Asia/Bangkok|Asia/Saigon","Asia/Bangkok|Asia/Vientiane","Asia/Bangkok|Etc/GMT-7","Asia/Bangkok|Indian/Christmas","Asia/Dhaka|Antarctica/Vostok","Asia/Dhaka|Asia/Almaty","Asia/Dhaka|Asia/Bishkek","Asia/Dhaka|Asia/Dacca","Asia/Dhaka|Asia/Kashgar","Asia/Dhaka|Asia/Omsk","Asia/Dhaka|Asia/Qostanay","Asia/Dhaka|Asia/Thimbu","Asia/Dhaka|Asia/Thimphu","Asia/Dhaka|Asia/Urumqi","Asia/Dhaka|Etc/GMT-6","Asia/Dhaka|Indian/Chagos","Asia/Dubai|Asia/Muscat","Asia/Dubai|Asia/Tbilisi","Asia/Dubai|Asia/Yerevan","Asia/Dubai|Etc/GMT-4","Asia/Dubai|Europe/Samara","Asia/Dubai|Indian/Mahe","Asia/Dubai|Indian/Mauritius","Asia/Dubai|Indian/Reunion","Asia/Gaza|Asia/Hebron","Asia/Hong_Kong|Hongkong","Asia/Jakarta|Asia/Pontianak","Asia/Jerusalem|Asia/Tel_Aviv","Asia/Jerusalem|Israel","Asia/Kamchatka|Asia/Anadyr","Asia/Kamchatka|Etc/GMT-12","Asia/Kamchatka|Kwajalein","Asia/Kamchatka|Pacific/Funafuti","Asia/Kamchatka|Pacific/Kwajalein","Asia/Kamchatka|Pacific/Majuro","Asia/Kamchatka|Pacific/Nauru","Asia/Kamchatka|Pacific/Tarawa","Asia/Kamchatka|Pacific/Wake","Asia/Kamchatka|Pacific/Wallis","Asia/Kathmandu|Asia/Katmandu","Asia/Kolkata|Asia/Calcutta","Asia/Kuala_Lumpur|Asia/Brunei","Asia/Kuala_Lumpur|Asia/Irkutsk","Asia/Kuala_Lumpur|Asia/Kuching","Asia/Kuala_Lumpur|Asia/Singapore","Asia/Kuala_Lumpur|Etc/GMT-8","Asia/Kuala_Lumpur|Singapore","Asia/Makassar|Asia/Ujung_Pandang","Asia/Rangoon|Asia/Yangon","Asia/Rangoon|Indian/Cocos","Asia/Seoul|ROK","Asia/Shanghai|Asia/Chongqing","Asia/Shanghai|Asia/Chungking","Asia/Shanghai|Asia/Harbin","Asia/Shanghai|Asia/Macao","Asia/Shanghai|Asia/Macau","Asia/Shanghai|Asia/Taipei","Asia/Shanghai|PRC","Asia/Shanghai|ROC","Asia/Tashkent|Antarctica/Mawson","Asia/Tashkent|Asia/Aqtau","Asia/Tashkent|Asia/Aqtobe","Asia/Tashkent|Asia/Ashgabat","Asia/Tashkent|Asia/Ashkhabad","Asia/Tashkent|Asia/Atyrau","Asia/Tashkent|Asia/Dushanbe","Asia/Tashkent|Asia/Oral","Asia/Tashkent|Asia/Samarkand","Asia/Tashkent|Asia/Yekaterinburg","Asia/Tashkent|Etc/GMT-5","Asia/Tashkent|Indian/Kerguelen","Asia/Tashkent|Indian/Maldives","Asia/Tehran|Iran","Asia/Tokyo|Japan","Asia/Ulaanbaatar|Asia/Choibalsan","Asia/Ulaanbaatar|Asia/Ulan_Bator","Asia/Vladivostok|Antarctica/DumontDUrville","Asia/Vladivostok|Asia/Ust-Nera","Asia/Vladivostok|Etc/GMT-10","Asia/Vladivostok|Pacific/Chuuk","Asia/Vladivostok|Pacific/Port_Moresby","Asia/Vladivostok|Pacific/Truk","Asia/Vladivostok|Pacific/Yap","Asia/Yakutsk|Asia/Dili","Asia/Yakutsk|Asia/Khandyga","Asia/Yakutsk|Etc/GMT-9","Asia/Yakutsk|Pacific/Palau","Atlantic/Azores|America/Scoresbysund","Atlantic/Cape_Verde|Etc/GMT+1","Australia/Adelaide|Australia/Broken_Hill","Australia/Adelaide|Australia/South","Australia/Adelaide|Australia/Yancowinna","Australia/Brisbane|Australia/Lindeman","Australia/Brisbane|Australia/Queensland","Australia/Darwin|Australia/North","Australia/Lord_Howe|Australia/LHI","Australia/Perth|Australia/West","Australia/Sydney|Australia/ACT","Australia/Sydney|Australia/Canberra","Australia/Sydney|Australia/Currie","Australia/Sydney|Australia/Hobart","Australia/Sydney|Australia/Melbourne","Australia/Sydney|Australia/NSW","Australia/Sydney|Australia/Tasmania","Australia/Sydney|Australia/Victoria","Etc/UTC|Etc/UCT","Etc/UTC|Etc/Universal","Etc/UTC|Etc/Zulu","Etc/UTC|UCT","Etc/UTC|UTC","Etc/UTC|Universal","Etc/UTC|Zulu","Europe/Athens|Asia/Nicosia","Europe/Athens|EET","Europe/Athens|Europe/Bucharest","Europe/Athens|Europe/Helsinki","Europe/Athens|Europe/Kiev","Europe/Athens|Europe/Mariehamn","Europe/Athens|Europe/Nicosia","Europe/Athens|Europe/Riga","Europe/Athens|Europe/Sofia","Europe/Athens|Europe/Tallinn","Europe/Athens|Europe/Uzhgorod","Europe/Athens|Europe/Vilnius","Europe/Athens|Europe/Zaporozhye","Europe/Chisinau|Europe/Tiraspol","Europe/Dublin|Eire","Europe/Istanbul|Asia/Istanbul","Europe/Istanbul|Turkey","Europe/Lisbon|Atlantic/Canary","Europe/Lisbon|Atlantic/Faeroe","Europe/Lisbon|Atlantic/Faroe","Europe/Lisbon|Atlantic/Madeira","Europe/Lisbon|Portugal","Europe/Lisbon|WET","Europe/London|Europe/Belfast","Europe/London|Europe/Guernsey","Europe/London|Europe/Isle_of_Man","Europe/London|Europe/Jersey","Europe/London|GB","Europe/London|GB-Eire","Europe/Moscow|Europe/Simferopol","Europe/Moscow|W-SU","Europe/Paris|Africa/Ceuta","Europe/Paris|Arctic/Longyearbyen","Europe/Paris|Atlantic/Jan_Mayen","Europe/Paris|CET","Europe/Paris|Europe/Amsterdam","Europe/Paris|Europe/Andorra","Europe/Paris|Europe/Belgrade","Europe/Paris|Europe/Berlin","Europe/Paris|Europe/Bratislava","Europe/Paris|Europe/Brussels","Europe/Paris|Europe/Budapest","Europe/Paris|Europe/Busingen","Europe/Paris|Europe/Copenhagen","Europe/Paris|Europe/Gibraltar","Europe/Paris|Europe/Ljubljana","Europe/Paris|Europe/Luxembourg","Europe/Paris|Europe/Madrid","Europe/Paris|Europe/Malta","Europe/Paris|Europe/Monaco","Europe/Paris|Europe/Oslo","Europe/Paris|Europe/Podgorica","Europe/Paris|Europe/Prague","Europe/Paris|Europe/Rome","Europe/Paris|Europe/San_Marino","Europe/Paris|Europe/Sarajevo","Europe/Paris|Europe/Skopje","Europe/Paris|Europe/Stockholm","Europe/Paris|Europe/Tirane","Europe/Paris|Europe/Vaduz","Europe/Paris|Europe/Vatican","Europe/Paris|Europe/Vienna","Europe/Paris|Europe/Warsaw","Europe/Paris|Europe/Zagreb","Europe/Paris|Europe/Zurich","Europe/Paris|Poland","Europe/Ulyanovsk|Europe/Astrakhan","Pacific/Auckland|Antarctica/McMurdo","Pacific/Auckland|Antarctica/South_Pole","Pacific/Auckland|NZ","Pacific/Bougainville|Antarctica/Macquarie","Pacific/Bougainville|Asia/Srednekolymsk","Pacific/Bougainville|Etc/GMT-11","Pacific/Bougainville|Pacific/Efate","Pacific/Bougainville|Pacific/Guadalcanal","Pacific/Bougainville|Pacific/Kosrae","Pacific/Bougainville|Pacific/Noumea","Pacific/Bougainville|Pacific/Pohnpei","Pacific/Bougainville|Pacific/Ponape","Pacific/Chatham|NZ-CHAT","Pacific/Easter|Chile/EasterIsland","Pacific/Fakaofo|Etc/GMT-13","Pacific/Fakaofo|Pacific/Enderbury","Pacific/Galapagos|Etc/GMT+6","Pacific/Gambier|Etc/GMT+9","Pacific/Guam|Pacific/Saipan","Pacific/Honolulu|HST","Pacific/Honolulu|Pacific/Johnston","Pacific/Honolulu|US/Hawaii","Pacific/Kiritimati|Etc/GMT-14","Pacific/Niue|Etc/GMT+11","Pacific/Pago_Pago|Pacific/Midway","Pacific/Pago_Pago|Pacific/Samoa","Pacific/Pago_Pago|US/Samoa","Pacific/Pitcairn|Etc/GMT+8","Pacific/Tahiti|Etc/GMT+10","Pacific/Tahiti|Pacific/Rarotonga"],countries:["AD|Europe/Andorra","AE|Asia/Dubai","AF|Asia/Kabul","AG|America/Port_of_Spain America/Antigua","AI|America/Port_of_Spain America/Anguilla","AL|Europe/Tirane","AM|Asia/Yerevan","AO|Africa/Lagos Africa/Luanda","AQ|Antarctica/Casey Antarctica/Davis Antarctica/DumontDUrville Antarctica/Mawson Antarctica/Palmer Antarctica/Rothera Antarctica/Syowa Antarctica/Troll Antarctica/Vostok Pacific/Auckland Antarctica/McMurdo","AR|America/Argentina/Buenos_Aires America/Argentina/Cordoba America/Argentina/Salta America/Argentina/Jujuy America/Argentina/Tucuman America/Argentina/Catamarca America/Argentina/La_Rioja America/Argentina/San_Juan America/Argentina/Mendoza America/Argentina/San_Luis America/Argentina/Rio_Gallegos America/Argentina/Ushuaia","AS|Pacific/Pago_Pago","AT|Europe/Vienna","AU|Australia/Lord_Howe Antarctica/Macquarie Australia/Hobart Australia/Currie Australia/Melbourne Australia/Sydney Australia/Broken_Hill Australia/Brisbane Australia/Lindeman Australia/Adelaide Australia/Darwin Australia/Perth Australia/Eucla","AW|America/Curacao America/Aruba","AX|Europe/Helsinki Europe/Mariehamn","AZ|Asia/Baku","BA|Europe/Belgrade Europe/Sarajevo","BB|America/Barbados","BD|Asia/Dhaka","BE|Europe/Brussels","BF|Africa/Abidjan Africa/Ouagadougou","BG|Europe/Sofia","BH|Asia/Qatar Asia/Bahrain","BI|Africa/Maputo Africa/Bujumbura","BJ|Africa/Lagos Africa/Porto-Novo","BL|America/Port_of_Spain America/St_Barthelemy","BM|Atlantic/Bermuda","BN|Asia/Brunei","BO|America/La_Paz","BQ|America/Curacao America/Kralendijk","BR|America/Noronha America/Belem America/Fortaleza America/Recife America/Araguaina America/Maceio America/Bahia America/Sao_Paulo America/Campo_Grande America/Cuiaba America/Santarem America/Porto_Velho America/Boa_Vista America/Manaus America/Eirunepe America/Rio_Branco","BS|America/Nassau","BT|Asia/Thimphu","BW|Africa/Maputo Africa/Gaborone","BY|Europe/Minsk","BZ|America/Belize","CA|America/St_Johns America/Halifax America/Glace_Bay America/Moncton America/Goose_Bay America/Blanc-Sablon America/Toronto America/Nipigon America/Thunder_Bay America/Iqaluit America/Pangnirtung America/Atikokan America/Winnipeg America/Rainy_River America/Resolute America/Rankin_Inlet America/Regina America/Swift_Current America/Edmonton America/Cambridge_Bay America/Yellowknife America/Inuvik America/Creston America/Dawson_Creek America/Fort_Nelson America/Vancouver America/Whitehorse America/Dawson","CC|Indian/Cocos","CD|Africa/Maputo Africa/Lagos Africa/Kinshasa Africa/Lubumbashi","CF|Africa/Lagos Africa/Bangui","CG|Africa/Lagos Africa/Brazzaville","CH|Europe/Zurich","CI|Africa/Abidjan","CK|Pacific/Rarotonga","CL|America/Santiago America/Punta_Arenas Pacific/Easter","CM|Africa/Lagos Africa/Douala","CN|Asia/Shanghai Asia/Urumqi","CO|America/Bogota","CR|America/Costa_Rica","CU|America/Havana","CV|Atlantic/Cape_Verde","CW|America/Curacao","CX|Indian/Christmas","CY|Asia/Nicosia Asia/Famagusta","CZ|Europe/Prague","DE|Europe/Zurich Europe/Berlin Europe/Busingen","DJ|Africa/Nairobi Africa/Djibouti","DK|Europe/Copenhagen","DM|America/Port_of_Spain America/Dominica","DO|America/Santo_Domingo","DZ|Africa/Algiers","EC|America/Guayaquil Pacific/Galapagos","EE|Europe/Tallinn","EG|Africa/Cairo","EH|Africa/El_Aaiun","ER|Africa/Nairobi Africa/Asmara","ES|Europe/Madrid Africa/Ceuta Atlantic/Canary","ET|Africa/Nairobi Africa/Addis_Ababa","FI|Europe/Helsinki","FJ|Pacific/Fiji","FK|Atlantic/Stanley","FM|Pacific/Chuuk Pacific/Pohnpei Pacific/Kosrae","FO|Atlantic/Faroe","FR|Europe/Paris","GA|Africa/Lagos Africa/Libreville","GB|Europe/London","GD|America/Port_of_Spain America/Grenada","GE|Asia/Tbilisi","GF|America/Cayenne","GG|Europe/London Europe/Guernsey","GH|Africa/Accra","GI|Europe/Gibraltar","GL|America/Godthab America/Danmarkshavn America/Scoresbysund America/Thule","GM|Africa/Abidjan Africa/Banjul","GN|Africa/Abidjan Africa/Conakry","GP|America/Port_of_Spain America/Guadeloupe","GQ|Africa/Lagos Africa/Malabo","GR|Europe/Athens","GS|Atlantic/South_Georgia","GT|America/Guatemala","GU|Pacific/Guam","GW|Africa/Bissau","GY|America/Guyana","HK|Asia/Hong_Kong","HN|America/Tegucigalpa","HR|Europe/Belgrade Europe/Zagreb","HT|America/Port-au-Prince","HU|Europe/Budapest","ID|Asia/Jakarta Asia/Pontianak Asia/Makassar Asia/Jayapura","IE|Europe/Dublin","IL|Asia/Jerusalem","IM|Europe/London Europe/Isle_of_Man","IN|Asia/Kolkata","IO|Indian/Chagos","IQ|Asia/Baghdad","IR|Asia/Tehran","IS|Atlantic/Reykjavik","IT|Europe/Rome","JE|Europe/London Europe/Jersey","JM|America/Jamaica","JO|Asia/Amman","JP|Asia/Tokyo","KE|Africa/Nairobi","KG|Asia/Bishkek","KH|Asia/Bangkok Asia/Phnom_Penh","KI|Pacific/Tarawa Pacific/Enderbury Pacific/Kiritimati","KM|Africa/Nairobi Indian/Comoro","KN|America/Port_of_Spain America/St_Kitts","KP|Asia/Pyongyang","KR|Asia/Seoul","KW|Asia/Riyadh Asia/Kuwait","KY|America/Panama America/Cayman","KZ|Asia/Almaty Asia/Qyzylorda Asia/Qostanay Asia/Aqtobe Asia/Aqtau Asia/Atyrau Asia/Oral","LA|Asia/Bangkok Asia/Vientiane","LB|Asia/Beirut","LC|America/Port_of_Spain America/St_Lucia","LI|Europe/Zurich Europe/Vaduz","LK|Asia/Colombo","LR|Africa/Monrovia","LS|Africa/Johannesburg Africa/Maseru","LT|Europe/Vilnius","LU|Europe/Luxembourg","LV|Europe/Riga","LY|Africa/Tripoli","MA|Africa/Casablanca","MC|Europe/Monaco","MD|Europe/Chisinau","ME|Europe/Belgrade Europe/Podgorica","MF|America/Port_of_Spain America/Marigot","MG|Africa/Nairobi Indian/Antananarivo","MH|Pacific/Majuro Pacific/Kwajalein","MK|Europe/Belgrade Europe/Skopje","ML|Africa/Abidjan Africa/Bamako","MM|Asia/Yangon","MN|Asia/Ulaanbaatar Asia/Hovd Asia/Choibalsan","MO|Asia/Macau","MP|Pacific/Guam Pacific/Saipan","MQ|America/Martinique","MR|Africa/Abidjan Africa/Nouakchott","MS|America/Port_of_Spain America/Montserrat","MT|Europe/Malta","MU|Indian/Mauritius","MV|Indian/Maldives","MW|Africa/Maputo Africa/Blantyre","MX|America/Mexico_City America/Cancun America/Merida America/Monterrey America/Matamoros America/Mazatlan America/Chihuahua America/Ojinaga America/Hermosillo America/Tijuana America/Bahia_Banderas","MY|Asia/Kuala_Lumpur Asia/Kuching","MZ|Africa/Maputo","NA|Africa/Windhoek","NC|Pacific/Noumea","NE|Africa/Lagos Africa/Niamey","NF|Pacific/Norfolk","NG|Africa/Lagos","NI|America/Managua","NL|Europe/Amsterdam","NO|Europe/Oslo","NP|Asia/Kathmandu","NR|Pacific/Nauru","NU|Pacific/Niue","NZ|Pacific/Auckland Pacific/Chatham","OM|Asia/Dubai Asia/Muscat","PA|America/Panama","PE|America/Lima","PF|Pacific/Tahiti Pacific/Marquesas Pacific/Gambier","PG|Pacific/Port_Moresby Pacific/Bougainville","PH|Asia/Manila","PK|Asia/Karachi","PL|Europe/Warsaw","PM|America/Miquelon","PN|Pacific/Pitcairn","PR|America/Puerto_Rico","PS|Asia/Gaza Asia/Hebron","PT|Europe/Lisbon Atlantic/Madeira Atlantic/Azores","PW|Pacific/Palau","PY|America/Asuncion","QA|Asia/Qatar","RE|Indian/Reunion","RO|Europe/Bucharest","RS|Europe/Belgrade","RU|Europe/Kaliningrad Europe/Moscow Europe/Simferopol Europe/Kirov Europe/Astrakhan Europe/Volgograd Europe/Saratov Europe/Ulyanovsk Europe/Samara Asia/Yekaterinburg Asia/Omsk Asia/Novosibirsk Asia/Barnaul Asia/Tomsk Asia/Novokuznetsk Asia/Krasnoyarsk Asia/Irkutsk Asia/Chita Asia/Yakutsk Asia/Khandyga Asia/Vladivostok Asia/Ust-Nera Asia/Magadan Asia/Sakhalin Asia/Srednekolymsk Asia/Kamchatka Asia/Anadyr","RW|Africa/Maputo Africa/Kigali","SA|Asia/Riyadh","SB|Pacific/Guadalcanal","SC|Indian/Mahe","SD|Africa/Khartoum","SE|Europe/Stockholm","SG|Asia/Singapore","SH|Africa/Abidjan Atlantic/St_Helena","SI|Europe/Belgrade Europe/Ljubljana","SJ|Europe/Oslo Arctic/Longyearbyen","SK|Europe/Prague Europe/Bratislava","SL|Africa/Abidjan Africa/Freetown","SM|Europe/Rome Europe/San_Marino","SN|Africa/Abidjan Africa/Dakar","SO|Africa/Nairobi Africa/Mogadishu","SR|America/Paramaribo","SS|Africa/Juba","ST|Africa/Sao_Tome","SV|America/El_Salvador","SX|America/Curacao America/Lower_Princes","SY|Asia/Damascus","SZ|Africa/Johannesburg Africa/Mbabane","TC|America/Grand_Turk","TD|Africa/Ndjamena","TF|Indian/Reunion Indian/Kerguelen","TG|Africa/Abidjan Africa/Lome","TH|Asia/Bangkok","TJ|Asia/Dushanbe","TK|Pacific/Fakaofo","TL|Asia/Dili","TM|Asia/Ashgabat","TN|Africa/Tunis","TO|Pacific/Tongatapu","TR|Europe/Istanbul","TT|America/Port_of_Spain","TV|Pacific/Funafuti","TW|Asia/Taipei","TZ|Africa/Nairobi Africa/Dar_es_Salaam","UA|Europe/Simferopol Europe/Kiev Europe/Uzhgorod Europe/Zaporozhye","UG|Africa/Nairobi Africa/Kampala","UM|Pacific/Pago_Pago Pacific/Wake Pacific/Honolulu Pacific/Midway","US|America/New_York America/Detroit America/Kentucky/Louisville America/Kentucky/Monticello America/Indiana/Indianapolis America/Indiana/Vincennes America/Indiana/Winamac America/Indiana/Marengo America/Indiana/Petersburg America/Indiana/Vevay America/Chicago America/Indiana/Tell_City America/Indiana/Knox America/Menominee America/North_Dakota/Center America/North_Dakota/New_Salem America/North_Dakota/Beulah America/Denver America/Boise America/Phoenix America/Los_Angeles America/Anchorage America/Juneau America/Sitka America/Metlakatla America/Yakutat America/Nome America/Adak Pacific/Honolulu","UY|America/Montevideo","UZ|Asia/Samarkand Asia/Tashkent","VA|Europe/Rome Europe/Vatican","VC|America/Port_of_Spain America/St_Vincent","VE|America/Caracas","VG|America/Port_of_Spain America/Tortola","VI|America/Port_of_Spain America/St_Thomas","VN|Asia/Bangkok Asia/Ho_Chi_Minh","VU|Pacific/Efate","WF|Pacific/Wallis","WS|Pacific/Apia","YE|Asia/Riyadh Asia/Aden","YT|Africa/Nairobi Indian/Mayotte","ZA|Africa/Johannesburg","ZM|Africa/Maputo Africa/Lusaka","ZW|Africa/Maputo Africa/Harare"]}),c}); diff --git a/1337X_-_convert_torrent_timestamps_to_relative_format/moment.min.js b/1337X_-_convert_torrent_timestamps_to_relative_format/moment.min.js new file mode 100644 index 0000000..57cd2d4 --- /dev/null +++ b/1337X_-_convert_torrent_timestamps_to_relative_format/moment.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function f(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(m(e,t))return;return 1}function r(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var n=[],s=0;s>>0,s=0;sFe(e)?(r=e+1,a-Fe(e)):(r=e,a);return{year:r,dayOfYear:o}}function Ae(e,t,n){var s,i,r=Ge(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+je(i=e.year()-1,t,n):a>je(e.year(),t,n)?(s=a-je(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function je(e,t,n){var s=Ge(e,t,n),i=Ge(e+1,t,n);return(Fe(e)-s+i)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),A("week",5),A("isoWeek",5),ce("w",te),ce("ww",te,Q),ce("W",te),ce("WW",te,Q),ge(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=Z(e)});function Ie(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ce("d",te),ce("e",te),ce("E",te),ce("dd",function(e,t){return t.weekdaysMinRegex(e)}),ce("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ce("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:y(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,s){t[s]=Z(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$e="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qe=de,Be=de,Je=de;function Qe(){function e(e,t){return t.length-e.length}for(var t,n,s,i,r=[],a=[],o=[],u=[],l=0;l<7;l++)t=_([2e3,1]).day(l),n=me(this.weekdaysMin(t,"")),s=me(this.weekdaysShort(t,"")),i=me(this.weekdays(t,"")),r.push(n),a.push(s),o.push(i),u.push(n),u.push(s),u.push(i);r.sort(e),a.sort(e),o.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Xe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),L("hour","h"),A("hour",13),ce("a",et),ce("A",et),ce("H",te),ce("h",te),ce("k",te),ce("HH",te,Q),ce("hh",te,Q),ce("kk",te,Q),ce("hmm",ne),ce("hmmss",se),ce("Hmm",ne),ce("Hmmss",se),ye(["H","HH"],Me),ye(["k","kk"],function(e,t,n){var s=Z(e);t[Me]=24===s?0:s}),ye(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ye(["h","hh"],function(e,t,n){t[Me]=Z(e),y(n).bigHour=!0}),ye("hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s)),y(n).bigHour=!0}),ye("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i)),y(n).bigHour=!0}),ye("Hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s))}),ye("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i))});var tt=z("Hours",!0);var nt,st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){for(var t,n,s,i,r=0;r=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s=t-1)break;t--}r++}return nt}function ut(t){var e;if(void 0===it[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=nt._abbr,require("./locale/"+t),lt(e)}catch(e){it[t]=null}return it[t]}function lt(e,t){var n;return e&&((n=r(t)?dt(e):ht(e,t))?nt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),nt._abbr}function ht(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ut(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new x(b(s,t)),rt[e]&&rt[e].forEach(function(e){ht(e.name,e.config)}),lt(e),it[e]}function dt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return nt;if(!o(e)){if(t=ut(e))return t;e=[e]}return ot(e)}function ct(e){var t,n=e._a;return n&&-2===y(e).overflow&&(t=n[ve]<0||11xe(n[pe],n[ve])?ke:n[Me]<0||24je(n,r,a)?y(e)._overflowWeeks=!0:null!=u?y(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[pe]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=St(e._a[pe],s[pe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(y(e)._overflowDayOfYear=!0),n=Ve(r,0,e._dayOfYear),e._a[ve]=n.getUTCMonth(),e._a[ke]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=u[t]=s[t];for(;t<7;t++)e._a[t]=u[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[De]&&0===e._a[Se]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ve:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,u),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(y(e).weekdayMismatch=!0)}}function Ot(e){if(e._f!==f.ISO_8601)if(e._f!==f.RFC_2822){e._a=[],y(e).empty=!0;for(var t,n,s,i,r,a,o,u=""+e._i,l=u.length,h=0,d=H(e._f,e._locale).match(N)||[],c=0;cn.valueOf():n.valueOf()"}),pn.toJSON=function(){return this.isValid()?this.toISOString():null},pn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},pn.unix=function(){return Math.floor(this.valueOf()/1e3)},pn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},pn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},pn.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},pn.isLocal=function(){return!!this.isValid()&&!this._isUTC},pn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},pn.isUtc=At,pn.isUTC=At,pn.zoneAbbr=function(){return this._isUTC?"UTC":""},pn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},pn.dates=n("dates accessor is deprecated. Use date instead.",fn),pn.months=n("months accessor is deprecated. Use month instead",Ue),pn.years=n("years accessor is deprecated. Use year instead",Le),pn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),pn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,t={};return v(t,this),(t=bt(t))._a?(e=(t._isUTC?_:Tt)(t._a),this._isDSTShifted=this.isValid()&&0 i.flaticon-magnet { + font-size: 13px; + color: #da3a04 + } + + .list-button-dl > i.flaticon-torrent-download { + font-size: 13px; + color: #89ad19; + } + + table.table-list td.dl-buttons { + border-left: 1px solid #f6f6f6; + border-right: 1px solid #c0c0c0; + padding-left: 2.5px; + padding-right: 2.5px; + text-align: center !important; + position: relative; + display: table-cell !important; /* proper height of cell on multiple row torrent name */ + width: 6%; + } + + td.dl-buttons > a, + td.dl-buttons > a:hover, + td.dl-buttons > a:visited, + td.dl-buttons > a:link, + td.dl-buttons > a:active { + color: inherit; + text-decoration: none; + cursor: pointer; + display: inline-block !important; + /* margin: 0 1.5px; */ + margin: 0 2px; + } + + table.table-list td.coll-1b { + border-right: 1px solid silver; + } + + .table-list > thead > tr > th:nth-child(2), + .table-list > thead > tr > td:nth-child(2) { + text-align: center; + } + +`); + + +function appendColumn() { + + const allTables = document.querySelectorAll('.table-list-wrap'); // for pages with multiple tables e.g. https://1337x.to/home/ + const isSeries = window.location.href.includes('/series/'); // for pages with tables that have no header e.g. https://1337x.to/series/a-to-z/1/13/ + const title = 'ml dl'; + + + allTables.forEach((table) => { + + const headersCellsInitial = table.querySelectorAll(`.table-list > thead > tr:not(.blank) > th:nth-child(1), + .table-list > tbody > tr:not(.blank) > td:nth-child(1)`); + headersCellsInitial.forEach((cell, index) => { + if (index === 0 && !isSeries) { + cell.insertAdjacentHTML('afterend', `` + title + ``); + } else { + cell.insertAdjacentHTML('afterend', `` + title + ``); + } + }); + + const headersCellsNew = table.querySelectorAll(`.table-list > thead > tr:not(.blank) > th:nth-child(2), + .table-list > tbody > tr:not(.blank) > td:nth-child(2)`); + headersCellsNew.forEach((cell, index) => { + cell.classList.add('coll-1b'); + if (index === 0 && !isSeries) { + cell.innerHTML = title; + } else { + cell.classList.add('dl-buttons'); + + let href; + if (!isSeries){ + href = headersCellsInitial[index].firstElementChild.nextElementSibling.href; + } else { + href = headersCellsInitial[index].firstElementChild.href; + } + + cell.innerHTML = ``; + cell.innerHTML += ``; + } + }); + + + }); + + +} + + + +function addClickListeners(links, type){ + + links.forEach((link) => { + + link.addEventListener('click', function(){ + + let href = this.getAttribute('href'); + if (href === 'javascript:void(0)') { + let tLink = this.getAttribute('data-href'); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', tLink, true); // XMLHttpRequest.open(method, url, async) + xhr.onload = function () { + + let container = document.implementation.createHTMLDocument().documentElement; + container.innerHTML = xhr.responseText; + + let retrievedLink = (type === 'ml') ? container.querySelector('a[href^="magnet:"]') : container.querySelector('.dropdown-menu > li > a'); + + if (retrievedLink) { + link.setAttribute('href', retrievedLink.href.replace('http:', 'https:')); // the links are http and as such are blocked in Chrome + link.click(); + } + + + }; + xhr.send(); + + } + + }, false); + + }); + +} + + + +function createColumn(){ + appendColumn(); + addClickListeners(document.querySelectorAll('.list-button-magnet'), 'ml' ); + addClickListeners(document.querySelectorAll('.list-button-dl'), 'dl' ); +} + + +createColumn(); diff --git a/1337x_-_torrent_and_magnet_links/README.md b/1337x_-_torrent_and_magnet_links/README.md new file mode 100644 index 0000000..899c5f6 --- /dev/null +++ b/1337x_-_torrent_and_magnet_links/README.md @@ -0,0 +1,17 @@ +Adds a column with torrent and magnet links in 1337x lists: +![](https://i.imgur.com/goYAFQH.jpg) + +Notes: + +- The script generates all links via XHR: + - The DL/ML links will have: + - as tooltip: "`ml/dl via xhr`". + - as destination (href): + - initially: `javascript:void(0)` *(to avoid taking the user back to the top of the page, which occurred if having `#`, instead)*, + - as you click a ml/dl icon, the relevant target URL will be retrieved via XHR in the background. +- Thanks to: + - NotNeo: most of the CSS is from his [1337X - Magnet/Torrent links everywhere](https://greasyfork.org/en/scripts/373230-1337x-magnet-torrent-links-everywhere) script, + - barn852 for [this](https://greasyfork.org/en/scripts/420754-1337x-torrent-and-magnet-links/discussions/96026) contribution . +- Tampermonkey and Violentmonkey are supported - Greasemonkey is NOT supported. + +[Hosted at GitHub](https://github.com/darkred/Userscripts) diff --git a/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js new file mode 100644 index 0000000..d28f711 --- /dev/null +++ b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js @@ -0,0 +1,255 @@ +// ==UserScript== +// @name Blabbermouth - generate timestamps and add link to the fb comments area +// @namespace darkred +// @version 2.0 +// @date 2022.5.14 +// @description Generates missing timestamps or converts the existing ones in relative format, and adds link to the fb comments area +// @author darkred +// @license MIT +// @include /^(https?:)?\/\/(www\.)?blabbermouth\.net\/(news|reviews)?/ +// @exclude /^(https?:)?\/\/(www\.)?blabbermouth\.net\/reviews(\/page|$)/ +// @include https://www.facebook.com/plugins/feedback.php* +// @grant none +// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js +// @supportURL https://github.com/darkred/Userscripts/issues +// @icon https://drnizx3otcofi.cloudfront.net/b64e6010-2ac1-4e95-b545-1a2994bbbd04/img/favicon/favicon-32x32.png +// ==/UserScript== + + +/* global moment */ +/* eslint-disable no-console */ + +'use strict'; + + +// Customize the strings in the locale to display "1 minute ago" instead of "a minute ago" (https://github.com/moment/moment/issues/3764#issuecomment-279928245) +moment.updateLocale('en', { + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'seconds', + m: '1 minute', + mm: '%d minutes', + h: '1 hour', + hh: '%d hours', + d: '1 day', + dd: '%d days', + M: '1 month', + MM: '%d months', + y: '1 year', + yy: '%d years' + } +}); + +function convertToLocalTimezone(timestamp) { + // (the timestamp is in ISO 8601 format and its trailing Z means that it's in UTC ) + // 2020-03-05T15:40:38.000Z old + // 2022-05-11T12:16:05+00:00 new + let initialTimestamp = timestamp; + if (moment(initialTimestamp, moment.ISO_8601, true).isValid()) { + // let convertedToLocalTimezone = moment(initialTimestamp.replace('Z','') + '-05:00', 'YYYY-MM-DDTHH:mm:ssZ'); // the server's timezone is GMT-5 + let convertedToLocalTimezone = moment(initialTimestamp + '-03:47', 'YYYY-MM-DDTHH:mm:ss+Z'); // the server's timezone is GMT-4 plus 13 min, in order to sync with the relevant post timestamps in both Facebook and Twitter(TW is 1 min later than FB) blabbbermouth pages + publishedTimeLTZ = convertedToLocalTimezone.fromNow(); + let format = 'YYYY-MM-DD HH:mm:ss'; + publishedTimeLTZtitle = convertedToLocalTimezone.format(format); + } +} + +function recalc(existingTimestampElement, format, notitle) { + setInterval(function() { + if (existingTimestampElement && moment(existingTimestampElement.title, format, true).isValid()) { + existingTimestampElement.textContent = moment(existingTimestampElement.title).fromNow(); + } else if (notitle === true) { + existingTimestampElement.innerText = moment(existingTimestampElement.innerText.trim()).fromNow(); + } + }, 1 * 60 * 1000); // repeat every 1 minute +} + + +function onClick(){ + document.querySelector('iframe[title="fb:comments Facebook Social Plugin"]').scrollIntoView(); +} + + +// 1. IF ON NEWS PAGES LISTINGS (convertTolocal + apply to pagination) +if ( + window.location.href.endsWith('blabbermouth.net/') || + window.location.href.endsWith('blabbermouth.net/news') || + window.location.href.includes('blabbermouth.net/news/page/') +) { + + let options = { + root: null, + rootMargin: '0px', + threshold: 0 + }; + + let callback = (entries) => { + entries.forEach(entry => { + + if (!entry.target.classList.contains('done')){ + + + if (entry.isIntersecting && !entry.target.classList.contains('in-viewport') ) { + entry.target.classList.add('in-viewport'); + + const xhr = new XMLHttpRequest(); + const url = entry.target.parentElement.parentElement.firstElementChild.firstElementChild.href; + xhr.open('GET', url, true); // XMLHttpRequest.open(method, url, async) + xhr.onload = function () { + + let container = document.implementation.createHTMLDocument().documentElement; + container.innerHTML = xhr.responseText; + + let publishedTimestamp = container.querySelector('meta[property="article:published_time"]').content; + + convertToLocalTimezone(publishedTimestamp); + + entry.target.textContent = publishedTimeLTZ; + entry.target.title = publishedTimeLTZtitle; + + entry.target.classList.add('done'); + + recalc(entry.target, 'YYYY-MM-DD HH:mm:ss'); + }; + xhr.send(); + } + } + }); + }; + + let observer = new IntersectionObserver(callback, options); + + let allTimestamps = document.querySelectorAll('.news-single span.date'); + allTimestamps.forEach((element) => { + observer.observe(element); + }); + + + // ---------------------------------------- + // Watch for pagination events (when new '.article' children are added inside the '.infinite_scroll' element) + const targetNode2 = document.querySelector('.infinite-scroll-component'); + const config2 = { attributes: false, childList: true, subtree: false }; + + const callback2 = function(mutationsList) { + for(const mutation of mutationsList) { + if (mutation.type === 'childList') { + let allTimestamps = document.querySelectorAll('.news-single span.date'); + allTimestamps.forEach((element) => { + observer.observe(element); + }); + } + } + }; + + const observer2 = new MutationObserver(callback2); + observer2.observe(targetNode2, config2); + // ---------------------------------------- + + + // /blabbermouth\.net/\(reviews|news)/i.test(window.location.href) + +// 2+3. ELSE IF ON CD/DVD REVIEWS OR NEWS PAGES ((convertTolocal + generate timestamp) +} else if ( /blabbermouth\.net\/(reviews|news)/i.test(window.location.href) && + !window.location.href.includes('/page/') ) { + + //--- Double-check that this iframe is on the expected domain: + if (/blabbermouth\.net/i.test(location.host)) { + console.log('Userscript is in the MAIN page.'); + + // 2019-10-17T15:32:18.000Z + + + let publishedTimestamp; + if (document.querySelector('meta[property="article:published_time"]') !== null) { + publishedTimestamp = document.querySelector('meta[property="article:published_time"]').content; + } + console.log('publishedTimestamp: ' + publishedTimestamp); + + + + if (window.location.href.includes('blabbermouth.net/news/')) { + + var publishedTimeLTZ, publishedTimeLTZtitle; + + convertToLocalTimezone(publishedTimestamp); + + let existingTimestampElement = document.querySelector('div > h1+span.date'); + + existingTimestampElement.textContent = publishedTimeLTZ; + existingTimestampElement.title = publishedTimeLTZtitle; + + recalc(existingTimestampElement, 'YYYY-MM-DD HH:mm:ss'); + + } + + + + + + + + + if (!window.location.href.includes('blabbermouth.net/news/page/')){ + + convertToLocalTimezone(publishedTimestamp); + + var commentcount = '0'; + + var datePart = !window.location.href.includes('blabbermouth.net/news/') ? `${publishedTimeLTZ}` : ''; + + var HTML = ` +${datePart} + +`; + + const refSelector = '.reviews-single-article > div > .reviews-rate-comments,div > h1+span.date'; + + if (document.querySelector(refSelector) !== null) { + document.querySelector(refSelector).insertAdjacentHTML('afterend', HTML); + document.querySelector(refSelector).title = publishedTimeLTZtitle; + + document.getElementById('commentCount').addEventListener('click', onClick, false); + + let newDateTimeElement = document.querySelector('span.date'); + recalc(newDateTimeElement, 'YYYY-MM-DD HH:mm:ss'); + } + + } + + // Wait for messages [commentcount] (from iframe) + window.addEventListener('message', function addFbCounter(e) { + // something from an unknown domain, or doesn't contain the string "Comment" let's ignore it + console.log('Received message: ' + e.data); + if (e.origin !== 'https://www.facebook.com' || e.data.indexOf(' Comment') === -1) { + return; + } + console.log('Received message: ' + e.data); + // document.querySelector('#commentCount').innerText = e.data.replace(/ Comments?/i,''); + document.querySelector('#commentCount').innerText = e.data; + window.removeEventListener('message', addFbCounter); + }, + false + ); + console.log('Waiting for Message 1, from iframe...'); + } + + +// ELSE IF IT'S ON THE FACEBOOK COMMENTS IFRAME (send fb comment count to main page) +} + +if (window.location.href.includes('facebook.com')) { + + console.log('Userscript is in the FRAMED page.'); + + const selector = '._50f7'; + // Send commentcount to MAIN page + window.parent.postMessage( + document.querySelector(selector).innerText, + 'https://blabbermouth.net/reviews/' + ); +} diff --git a/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/README.md b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/README.md new file mode 100644 index 0000000..5ddf36c --- /dev/null +++ b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/README.md @@ -0,0 +1,36 @@ +This script applies to blabbermouth.net. + +Blabbermouth only displays timestamps (just the date) in news listings and pages. +**It doesn't display timestamps in cd/dvd reviews pages at all.** +The script generates timestamps in relative format, in all cases. + +In details: + +- in **news** and **cd/dvd reviews** pages: + + It generates timestamps *(making use of the existing `published_time` data from inside the pages, e.g. `2020-02-20T19:10:22.000Z`)* +in relative format. Also, it recalculates them every 1 minute. +_(the initial retrieved timestamps -converted to local timezone's offset- are tooltips: just hover mouse on a relative date to view)_ + + It also shows a link to the Facebook comments next to the generated timestamp, +with **the comment count from that fb iframe** 1 (i.e. `6 Comments`, not just "Comments" ). + + +- in **news** listings: + + As you scroll down each page, it retrieves the relevant target news page in the background in order to get the relevant `published_time` data from the page, and then generates timestamps (like before) in relative format. + + Since v1.2 now the script also works in paginated news pages. +  + +1 Compatibility note regarding that feature: + +- Violentmonkey: the script works in ok with VM in its default settings. +- Tampermonkey: in order to work with TM, you have to remove the `*://www.facebook.com/plugins/*` pattern from TM blacklist (it's blacklisted in TM settings by default). +- Greasemonkey: not supported. + +--- + +The script uses [moment.js](http://momentjs.com/). + +[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/BugMeNot/BugMeNot.user.js b/BugMeNot/BugMeNot.user.js index 7681dac..56044fa 100644 --- a/BugMeNot/BugMeNot.user.js +++ b/BugMeNot/BugMeNot.user.js @@ -1,105 +1,39 @@ // ==UserScript== // @name BugMeNot // @namespace darkred +// @version 2017.12.15 +// @description Integrates BugMeNot into any login form (it retrieves all matching logins from bugmenot.com and autofills the login form) // @authors hosts, Matt McCarthy, darkred -// @description It integrates BugMeNot into any login form (it retrieves all matching logins from bugmenot.com and autofills the login form) +// @license MIT // @include http://* // @include https://* // @exclude http://bugmenot.com/* -// @version 2016.10.27 -// @grant GM_xmlhttpRequest -// @grant GM_setValue +// @grant GM.getValue // @grant GM_getValue -// @grant GM_log +// @grant GM.setValue +// @grant GM_setValue +// @grant GM.openInTab // @grant GM_openInTab +// @grant GM.xmlHttpRequest +// @grant GM_xmlhttpRequest +// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js // @noframes // @run-at document-idle +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +// // @grant GM.listValues + // latest version by hosts: 01.03.09 // based on code found at http://www.oreillynet.com/pub/h/4171 // ---------------------------- // based on code by Matt McCarthy // and included here with his gracious permission +/* global GM */ -// new logins gotten from the current page (reset on every page load) -var retrievals = 0; -// millisecond delay between a field losing focus and checking to see -// if any other of our fields has focus. If this is too low, the menu -// won't work because it will get "display: none" and its onclick -// won't fire. -// var BLUR_TIMEOUT = 150; -var BLUR_TIMEOUT = 250; - -//http://www.bugmenot.com/view/orasisx.net -//phoneRegex = /(?:http://)(.*)/.*?/; -//doma= location.href.match( phoneRegex ); - -// myString = location.href; -// domainnameRE = new RegExp('(?:https?://)(.*?)/.*?', 'i'); -// domainname = myString.match(domainnameRE) -// domainname = domainname[1]; -//alert (domainname); -var myString = location.href; -var domainnameRE = new RegExp('(?:https?://)(www\.)?(.*?)/.*?', 'i'); -var domainname = myString.match(domainnameRE); -domainname = domainname[2]; - -// If the current domain name doesn't match the stored lastURL, then reset the counter -if (GM_getValue('lastURL').indexOf(domainname) == -1){ - var counter = 0; - GM_setValue('counter', 0); -} else { - counter = parseInt(GM_getValue('counter')); // else retrieve stored counter value -} - - -// var allInputs = null; -var bmnView = 'http://bugmenot.com/view'; -var bmnUri = bmnView + '/' + domainname; -var bmnHomeUri = 'http://bugmenot.com/'; -var DEBUG = false; -// var bmnWrappers = new Object(); - -var Style = { - menuLink: { - border: 'none', - backgroundColor: '#fff', - color: '#000', - display: 'block', - padding: '2px', - margin: '0', - // width: '12em', - width: '17em', - fontSize: '8pt', - fontWeight: 'normal', - textDecoration: 'none' - }, - menuLinkHover: { - backgroundColor: '#316AC5', - color: '#fff' - }, - menuLinkWrapper: { - textAlign: 'left', - padding: '1px', - margin: 0 - }, - bmnWrapper: { - display: 'none', - fontFamily: 'tahoma, verdana, arial, sans-serif', - whiteSpace: 'nowrap', - position: 'absolute', - zIndex: 1000, - padding: '2px', - border: '1px solid #ACA899', - backgroundColor: '#fff', - opacity: '0.9', - filter: 'alpha(opacity=90)' - } -}; function copyProperties(to, from) { for (var i in from) { to[i] = from[i]; @@ -116,84 +50,96 @@ function getBmnWrapper(pwFieldIndex) { function processPasswordFields() { - var allInputs = document.getElementsByTagName('input'); - //allInputslength = allInputs.length; - var bmnContainer = document.createElement('div'); - bmnContainer.id = 'reify-bugmenot-container'; - var bodyEl = document.getElementsByTagName('body')[0]; - if (!bodyEl) return; - for (var i = 0; i < allInputs.length; i++) { - var pwField = allInputs[i]; - //GM_log (allInputs[i].type.toLowerCase()); - if (!(pwField.type && pwField.type.toLowerCase() == 'password')) { - continue; - } - var previousTextFieldInd = getPreviousTextField(i, allInputs); - if (previousTextFieldInd == - 1) { - if (DEBUG) { - GM_log('Couldn\'t find text field before password input ' + - i + '.'); + (async function() { + var allInputs = document.getElementsByTagName('input'); + //allInputslength = allInputs.length; + var bmnContainer = document.createElement('div'); + bmnContainer.id = 'reify-bugmenot-container'; + var bodyEl = document.getElementsByTagName('body')[0]; + if (!bodyEl) return; + for (var i = 0; i < allInputs.length; i++) { + var pwField = allInputs[i]; + // console.log(allInputs[i].type.toLowerCase()); + if (!(pwField.type && pwField.type.toLowerCase() == 'password')) { continue; } - } - var usernameField = allInputs[previousTextFieldInd]; - usernameField.blur(); // Workaround for when the Username textbox has focus by default on page load - usernameField.setAttribute('usernameInputIndex', previousTextFieldInd); - usernameField.setAttribute('passwordInputIndex', i); - Utility.addEventHandler(usernameField, 'focus', usernameField_onfocus); - Utility.addEventHandler(usernameField, 'blur', usernameField_onblur); - Utility.addEventHandler(pwField, 'focus', pwField_onfocus); - Utility.addEventHandler(pwField, 'blur', pwField_onblur); - pwField.setAttribute('usernameInputIndex', previousTextFieldInd); - pwField.setAttribute('passwordInputIndex', i); - - // var getLoginLink = menuLink(bmnUri, 'Get login from BugMeNot', 'Get a login from BugMeNot', getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - if (counter == 0) { - var myprompt = 'Get login from BugMeNot' + ' (' + (counter + 1) + '/-)'; - var myprompt2 = 'Get a login from BugMeNot'; - } else { - var total = JSON.parse(GM_getValue('allUsernames')).length; - if (counter < total) { - myprompt = 'Try next login from BugMeNot' + ' (' + (counter + 1) + '/' + total + ')'; - myprompt2 = 'Try next login'; + var previousTextFieldInd = getPreviousTextField(i, allInputs); + if (previousTextFieldInd == - 1) { + if (DEBUG) { + console.log('Couldn\'t find text field before password input ' + i + '.'); + continue; + } + } + var usernameField = allInputs[previousTextFieldInd]; + usernameField.blur(); // Workaround for when the Username textbox has focus by default on page load + usernameField.setAttribute('usernameInputIndex', previousTextFieldInd); + usernameField.setAttribute('passwordInputIndex', i); + Utility.addEventHandler(usernameField, 'focus', usernameField_onfocus); + Utility.addEventHandler(usernameField, 'blur', usernameField_onblur); + Utility.addEventHandler(pwField, 'focus', pwField_onfocus); + Utility.addEventHandler(pwField, 'blur', pwField_onblur); + pwField.setAttribute('usernameInputIndex', previousTextFieldInd); + pwField.setAttribute('passwordInputIndex', i); + + // var getLoginLink = menuLink(bmnUri, 'Get login from BugMeNot', 'Get a login from BugMeNot', getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + + // console.log('counter2: ' + counter); + if (counter === 0) { + // counter = 0; + var myprompt = 'Get login from BugMeNot' + ' (' + (counter + 1) + '/-)'; + var myprompt2 = 'Get a login from BugMeNot'; } else { - myprompt = 'No other logins'; - myprompt2 = 'No other logins available'; + // var total = JSON.parse(await GM.getValue('allUsernames')).length + var total; + total = JSON.parse(await GM.getValue('allUsernames')).length ; + // console.log('total: ' + total + ' | ' + ' counter: ' + counter); + // console.log(counter <= total); + + + if (counter + 1 <= total) { + myprompt = 'Try next login from BugMeNot' + ' (' + (counter + 1) + '/' + total + ')'; + myprompt2 = 'Try next login'; + } else { + myprompt = 'No other logins'; + myprompt2 = 'No other logins available'; + } + // })(); + } - } - var getLoginLink = menuLink(bmnUri, myprompt, myprompt2, getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var getLoginLinkWrapper = menuEntry(getLoginLink, Style.menuLinkWrapper); + var getLoginLink = menuLink(bmnUri, myprompt, myprompt2, getLoginLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var getLoginLinkWrapper = menuEntry(getLoginLink, Style.menuLinkWrapper); - if (counter > 0) { - var resetCounterLink = menuLink('', 'Reset login attempt counter', 'Resets the login attempt counter (reloads the page)', resetCounterLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var resetCounterLinkWrapper = menuEntry(resetCounterLink, Style.menuLinkWrapper); - } + if (counter > 0) { + var resetCounterLink = menuLink('', 'Reset login attempt counter', 'Resets the login attempt counter (reloads the page)', resetCounterLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var resetCounterLinkWrapper = menuEntry(resetCounterLink, Style.menuLinkWrapper); + } - var fullFormLink = menuLink(bmnUri, 'More options', 'See more options for getting logins from BugMeNot.com ' + '(opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var fullFormLinkWrapper = menuEntry(fullFormLink, Style.menuLinkWrapper); + var fullFormLink = menuLink(bmnUri, 'More options', 'See more options for getting logins from BugMeNot.com ' + '(opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var fullFormLinkWrapper = menuEntry(fullFormLink, Style.menuLinkWrapper); - var visitBmnLink = menuLink(bmnHomeUri, 'Visit BugMeNot', 'Go to the BugMeNot home page (opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); - var visitBmnLinkWrapper = menuEntry(visitBmnLink, Style.menuLinkWrapper); + var visitBmnLink = menuLink(bmnHomeUri, 'Visit BugMeNot', 'Go to the BugMeNot home page (opens a new window)', openMenuLink_onclick, Style.menuLink, previousTextFieldInd, i, menuLink_onmouseover, menuLink_onmouseout); + var visitBmnLinkWrapper = menuEntry(visitBmnLink, Style.menuLinkWrapper); - var bmnWrapper = document.createElement('div'); - bmnWrapper.id = 'reify-bugmenot-bmnWrapper' + i; - bmnWrapper.className = 'reify-bugmenot-bmnWrapper'; + var bmnWrapper = document.createElement('div'); + bmnWrapper.id = 'reify-bugmenot-bmnWrapper' + i; + bmnWrapper.className = 'reify-bugmenot-bmnWrapper'; - bmnWrapper.appendChild(getLoginLinkWrapper); - if (counter > 0) { - bmnWrapper.appendChild(resetCounterLinkWrapper); - } - bmnWrapper.appendChild(fullFormLinkWrapper); - bmnWrapper.appendChild(visitBmnLinkWrapper); + bmnWrapper.appendChild(getLoginLinkWrapper); + if (counter > 0) { + bmnWrapper.appendChild(resetCounterLinkWrapper); + } + bmnWrapper.appendChild(fullFormLinkWrapper); + bmnWrapper.appendChild(visitBmnLinkWrapper); - copyProperties(bmnWrapper.style, Style.bmnWrapper); - bmnContainer.appendChild(bmnWrapper); - } - if (bmnContainer.hasChildNodes()) { - bodyEl.appendChild(bmnContainer); - } + copyProperties(bmnWrapper.style, Style.bmnWrapper); + bmnContainer.appendChild(bmnWrapper); + } + if (bmnContainer.hasChildNodes()) { + bodyEl.appendChild(bmnContainer); + } + })(); } function menuEntry(linkEl, styleObj) { @@ -242,8 +188,8 @@ function getLoginLink_onclick(event) { } function openMenuLink_onclick(event) { - if (typeof GM_openInTab != 'undefined') { - GM_openInTab(this.href); + if (typeof GM.openInTab !== 'undefined') { + GM.openInTab(this.href); } else { window.open(this.href); } @@ -255,7 +201,10 @@ function openMenuLink_onclick(event) { } function resetCounterLink_onclick(){ - GM_setValue('counter', 0); + (async function() { + GM.setValue('counter', 0); + })(); + window.location.reload(); } @@ -299,11 +248,11 @@ function pwField_onblur(event) { function hideIfNoFocus(usernameField, pwField) { return (function () { var bUsernameFocus = usernameField.getAttribute('hasFocus'); - if (typeof bUsernameFocus == 'string') { + if (typeof bUsernameFocus === 'string') { bUsernameFocus = (bUsernameFocus && bUsernameFocus != 'false'); } var bPasswordFocus = pwField.getAttribute('hasFocus'); - if (typeof bPasswordFocus == 'string') { + if (typeof bPasswordFocus === 'string') { bPasswordFocus = (bPasswordFocus && bPasswordFocus != 'false'); } if ((!bUsernameFocus) && (!bPasswordFocus)) { @@ -318,7 +267,7 @@ function showHideBmnWrapper(usernameField, pwField, show) { bmnWrapper.style.display = 'block'; positionBmnWrapper(bmnWrapper, usernameField, pwField); } else { - //GM_log('hiding bugmenot wrapper'); + // console.log('hiding bugmenot wrapper'); bmnWrapper.style.display = 'none'; // Menu links may not get onmouseout event, so they get // stuck with the hover style unless we do this. @@ -332,12 +281,12 @@ function showHideBmnWrapper(usernameField, pwField, show) { function positionBmnWrapper(bmnWrapper, usernameField, pwField) { var pwLeft = Utility.elementLeft(pwField); if (pwLeft + pwField.offsetWidth + bmnWrapper.offsetWidth + - Utility.scrollLeft() + 10 < Utility.viewportWidth()) { +Utility.scrollLeft() + 10 < Utility.viewportWidth()) { bmnWrapper.style.left = (pwLeft + pwField.offsetWidth + 2) + 'px'; bmnWrapper.style.top = Utility.elementTop(pwField) + 'px'; } else { bmnWrapper.style.left = (Utility.elementLeft(usernameField) - - bmnWrapper.offsetWidth - 2) + 'px'; + bmnWrapper.offsetWidth - 2) + 'px'; bmnWrapper.style.top = Utility.elementTop(usernameField) + 'px'; } } @@ -348,97 +297,118 @@ function positionBmnWrapper(bmnWrapper, usernameField, pwField) { // for pages other than the current one. function getLogin(uri, usernameInputIndex, passwordInputIndex) { - var allInputs = document.getElementsByTagName('input'); - var usernameField = allInputs[usernameInputIndex]; - var pwField = allInputs[passwordInputIndex]; - waitOrRestoreFields(usernameField, pwField, false); - // var hostUri = location.hostname; - var firstAttempt = retrievals == 0; - var submitData = 'submit=This+login+didn%27t+work&num=' + retrievals + - '&site=' + encodeURI(location.hostname); - - if (counter == 0){ - GM_xmlhttpRequest({ - method: firstAttempt ? 'get' : 'post', - headers: firstAttempt ? null : - { - 'Content-type': 'application/x-www-form-urlencoded' + (async function() { + + var allInputs = document.getElementsByTagName('input'); + var usernameField = allInputs[usernameInputIndex]; + var pwField = allInputs[passwordInputIndex]; + waitOrRestoreFields(usernameField, pwField, false); + // var hostUri = location.hostname; + var firstAttempt = retrievals == 0; + var submitData = 'submit=This+login+didn%27t+work&num=' + retrievals + +'&site=' + encodeURI(location.hostname); + + + + // console.log(uri + ' ' + usernameInputIndex + ' ' + passwordInputIndex); + if (counter === 0){ + console.log('( retrieving logins from bugmenot.com via XHR... )'); + // (async function(){ + GM.xmlHttpRequest({ + method: firstAttempt ? 'get' : 'post', + headers: firstAttempt ? null : + { + 'Content-type': 'application/x-www-form-urlencoded' + }, + data: firstAttempt ? null : submitData, + url: firstAttempt ? uri : bmnView, + // synchronous: true, + onload: function (responseDetails) { + if (responseDetails.status == 200) { + waitOrRestoreFields(usernameField, pwField, true); + // decoded = decodeit(responseDetails.responseText); + var decoded = responseDetails.responseText; + var doc = textToXml(decoded); + if (!(doc && doc.documentElement)) { + return Errors.say(Errors.malformedResponse); + } + + + + var allUsernames = doc.documentElement.querySelectorAll('dd:nth-child(2) > kbd'); + var allPasswords = doc.documentElement.querySelectorAll('dd:nth-child(4) > kbd'); + var allUsernamesArray = []; + var allPasswordsArray = []; + for (var i = 0; i < allUsernames.length; i++) { + allUsernamesArray.push(allUsernames[i].innerHTML); + allPasswordsArray.push(allPasswords[i].innerHTML); + } + + var temp = ''; + for (var j = 0; j < allUsernamesArray.length; j++){ + temp += (j + 1) + ': ' + allUsernamesArray[j] + ', ' + allPasswordsArray[j] + '\n'; + } + console.log('Found logins (' + allUsernamesArray.length + '):\n' + temp); + + (async function() { + GM.setValue('allUsernames', JSON.stringify(allUsernamesArray)); + GM.setValue('allPasswords', JSON.stringify(allPasswordsArray)); + })(); + // + // var accountInfo = doc.documentElement.getElementsByTagName('td') [0]; + var accountInfo = doc.documentElement.getElementsByTagName('kbd') [0]; + if (!(accountInfo)) { + return Errors.say(Errors.noLoginAvailable); + } + usernameField.value = accountInfo.childNodes[0].nodeValue; + // var pwsField = doc.documentElement.getElementsByTagName('td') [1]; + var pwsField = doc.documentElement.getElementsByTagName('kbd') [1]; + pwField.value = pwsField.childNodes[0].nodeValue; + retrievals++; + } else { + return Errors.say(Errors.xmlHttpFailure); + } }, - data: firstAttempt ? null : submitData, - url: firstAttempt ? uri : bmnView, - onload: function (responseDetails) { - if (responseDetails.status == 200) { + onerror: function (responseDetails) { waitOrRestoreFields(usernameField, pwField, true); - // decoded = decodeit(responseDetails.responseText); - var decoded = responseDetails.responseText; - var doc = textToXml(decoded); - if (!(doc && doc.documentElement)) { - return Errors.say(Errors.malformedResponse); - } + Errors.say(Errors.xmlHttpFailure); + } + }); + // })(); + } else { - var allUsernames = doc.documentElement.querySelectorAll('dd:nth-child(2) > kbd'); - var allPasswords = doc.documentElement.querySelectorAll('dd:nth-child(4) > kbd'); - var allUsernamesArray = []; - var allPasswordsArray = []; - for (var i = 0; i < allUsernames.length; i++) { - allUsernamesArray.push(allUsernames[i].innerHTML); - allPasswordsArray.push(allPasswords[i].innerHTML); - } + var retrievedUsernames = []; + var retrievedPasswords = []; + // (async function() { + retrievedUsernames = JSON.parse(await GM.getValue('allUsernames')); + retrievedPasswords = JSON.parse(await GM.getValue('allPasswords')); + var temp = ''; + for (var j = 0; j < retrievedUsernames.length; j++){ + temp += (j + 1) + ': ' + retrievedUsernames[j] + ', ' + retrievedPasswords[j] + '\n'; + } + console.log('Found logins (' + retrievedUsernames.length + '):\n' + temp); + usernameField.value = retrievedUsernames[counter]; + pwField.value = retrievedPasswords[counter]; + // })(); - var temp = ''; - for (var j = 0; j < allUsernamesArray.length; j++){ - temp += (j + 1) + ': ' + allUsernamesArray[j] + ', ' + allPasswordsArray[j] + '\n'; - } - console.log('Found logins (' + allUsernamesArray.length + '):\n' + temp); - GM_setValue('allUsernames', JSON.stringify(allUsernamesArray)); - GM_setValue('allPasswords', JSON.stringify(allPasswordsArray)); + } - // var accountInfo = doc.documentElement.getElementsByTagName('td') [0]; - var accountInfo = doc.documentElement.getElementsByTagName('kbd') [0]; - if (!(accountInfo)) { - return Errors.say(Errors.noLoginAvailable); - } - usernameField.value = accountInfo.childNodes[0].nodeValue; - // var pwsField = doc.documentElement.getElementsByTagName('td') [1]; - var pwsField = doc.documentElement.getElementsByTagName('kbd') [1]; - pwField.value = pwsField.childNodes[0].nodeValue; - retrievals++; - } else { - return Errors.say(Errors.xmlHttpFailure); - } - }, - onerror: function (responseDetails) { - waitOrRestoreFields(usernameField, pwField, true); - Errors.say(Errors.xmlHttpFailure); - } - }); - } else { - var retrievedUsernames = []; - var retrievedPasswords = []; - retrievedUsernames = JSON.parse(GM_getValue('allUsernames')); - retrievedPasswords = JSON.parse(GM_getValue('allPasswords')); - - var temp = ''; - for (var j = 0; j < retrievedUsernames.length; j++){ - temp += (j + 1) + ': ' + retrievedUsernames[j] + ', ' + retrievedPasswords[j] + '\n'; - } - console.log('Found logins (' + retrievedUsernames.length + '):\n' + temp); + counter = parseInt(counter); + counter++; // (after all is done..) + GM.setValue('counter', counter); // .. store just increased counter and.. + GM.setValue('lastURL', String(window.location)); // .. store current location as lastURL + - usernameField.value = retrievedUsernames[counter]; - pwField.value = retrievedPasswords[counter]; - } - counter = parseInt(counter); - counter++; // (after all is done..) - GM_setValue('counter', counter); // .. store just increased counter and.. - GM_setValue('lastURL', String(window.location)); // .. store current location as lastURL + })(); + } function waitOrRestoreFields(usernameField, pwField, restore) { @@ -515,10 +485,10 @@ function decodeit(codedtext) { function textToXml(t) { try { - if (typeof DOMParser != undefined) { + if (typeof DOMParser !== 'undefined') { //t = toString(t); - // var dp = new DOMParser( ); - // return dp.parseFromString(t, "text/xml"); + // var dp = new DOMParser( ); + // return dp.parseFromString(t, "text/xml"); var parser = new DOMParser(); //var t = t.replace(/<\?xml.*?\?>/g, ""); // strip tag //t = "\n" + t + ""; @@ -537,16 +507,106 @@ function textToXml(t) { } } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +var Style = { + menuLink: { + border: 'none', + backgroundColor: '#fff', + color: '#000', + display: 'block', + padding: '2px', + margin: '0', + // width: '12em', + width: '17em', + fontSize: '8pt', + fontWeight: 'normal', + textDecoration: 'none' + }, + menuLinkHover: { + backgroundColor: '#316AC5', + color: '#fff' + }, + menuLinkWrapper: { + textAlign: 'left', + padding: '1px', + margin: 0 + }, + bmnWrapper: { + display: 'none', + fontFamily: 'tahoma, verdana, arial, sans-serif', + whiteSpace: 'nowrap', + position: 'absolute', + zIndex: 1000, + padding: '2px', + border: '1px solid #ACA899', + backgroundColor: '#fff', + opacity: '0.9', + filter: 'alpha(opacity=90)' + } +}; + + + + + + + + + + + + + + + + + + var Errors = { noLoginAvailable: 'Sorry, but BugMeNot.com had no login available ' + - 'for this site.\nIf you\'re feeling helpful, you can click "More ' + - 'options" to provide a login for future visitors.', +'for this site.\nIf you\'re feeling helpful, you can click "More ' + +'options" to provide a login for future visitors.', malformedResponse: 'Sorry, but I couldn\'t understand the response ' + - 'from BugMeNot.com.\nThe service might be unavailable.', +'from BugMeNot.com.\nThe service might be unavailable.', siteBlocked: 'Sorry, but I couldn\'t understand the response ' + - 'from BugMeNot.com.\nThe service might be unavailable.', +'from BugMeNot.com.\nThe service might be unavailable.', xmlHttpFailure: 'There was an error in contacting BugMeNot.com.\n' + - 'The server may be unavailable or having internal errors.', +'The server may be unavailable or having internal errors.', say: function (msg) { alert(msg); return false; @@ -600,6 +660,86 @@ var Utility = { } }; -main(); + + + + + + + + + + + + + + + + + + + + + + + +// new logins gotten from the current page (reset on every page load) +var retrievals = 0; +// millisecond delay between a field losing focus and checking to see +// if any other of our fields has focus. If this is too low, the menu +// won't work because it will get "display: none" and its onclick +// won't fire. +// var BLUR_TIMEOUT = 150; +const BLUR_TIMEOUT = 250; + +//http://www.bugmenot.com/view/orasisx.net +//phoneRegex = /(?:http://)(.*)/.*?/; +//doma= location.href.match( phoneRegex ); + +// myString = location.href; +// domainnameRE = new RegExp('(?:https?://)(.*?)/.*?', 'i'); +// domainname = myString.match(domainnameRE) +// domainname = domainname[1]; +//alert (domainname); +const myString = location.href; +const domainnameRE = new RegExp('(?:https?://)(www\\.)?(.*?)/.*?', 'i'); +const domainname = myString.match(domainnameRE)[2]; + +// var allInputs = null; +const bmnView = 'http://bugmenot.com/view'; +const bmnUri = bmnView + '/' + domainname; +const bmnHomeUri = 'http://bugmenot.com/'; +const DEBUG = false; +// var bmnWrappers = new Object(); + + +var counter ; + + +// If the current domain name doesn't match the stored lastURL, then reset the counter +var lastURL; +(async function() { + lastURL = await GM.getValue('lastURL', ''); + // console.log('lastURL: ' + lastURL); + if (lastURL.indexOf(domainname) === -1){ + counter = 0; + GM.setValue('counter', 0); + // console.log('CASE 0'); + } else { + counter = parseInt(await GM.getValue('counter', 0)); + // console.log('counter1: ' + counter); + } + // console.log(await GM.listValues()); + + main(); +})(); + + + + +// main(); + + + // to do // http://www.bugmenot.com/view/thecavernforum.com Site Blocked diff --git a/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js b/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js index e88ee95..c5e082f 100644 --- a/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js +++ b/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles/Bugzilla_-_reveal_the_Depends,_Blocks,_See_Also_and_Duplicates_bug_titles.user.js @@ -1,12 +1,15 @@ -// ==UserScript== +// ==UserScript== // @name Bugzilla - reveal the Depends, Blocks, See Also and Duplicates bug titles // @namespace darkred +// @version 2017.16.11 // @description Reveal the Depends, Blocks, See Also and Duplicates bug titles in bugzilla.mozilla.org via keyboard shortcuts +// @license MIT // @include https://bugzilla.mozilla.org/show_bug.cgi?id=* -// @version 2017.3.7 // @grant none -// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js +// @require https://code.jquery.com/jquery-3.2.1.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== /* eslint-disable no-unused-vars */ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0553819 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing to my Userscripts repo + +* [How To Report Issues, Or Make Requests](#how-to-report-issues-or-make-requests) +* [Contributing Code](#contributing-code) + * [Installation](#installation) + * [Pull Requests](#pull-requests) + + +## How to Report Issues, Or Make Requests. + +When reporting problems: +- Start the issue title having the related script title in parenthesis. +- Be as specific as possible, I need to know where to look. +- State name and version of your browser and script manager. +- Provide a web address example where I can see the problem for myself. A domain name is not enough. +- Provide a screenshot if necessary. + +When making feature requests: +- Be as specific as possible, don't make me have to guess what you want. + + +## Contributing Code + +### Installation: + +Just use a script manager, such as Tampermonkey, Greasemonkey or Violentmonkey + +### Pull Requests: + +You are welcome to open pull requests as long as you: +* Follow the style that is already being used in the code, see the repo's [`.eslintrc` rules](https://github.com/darkred/Userscripts/blob/master/.eslintrc) +* When naming variables: + * Use names that properly describe the contents of the variable. + * Use camel casing as needed. +* Use comments if necesary. +* Use semicolons. +* Use single quotes. +* Use tabs, not 4 spaces indentation. +* Try not to have too long lines. diff --git a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js index 7dc9f6f..8b4bfec 100644 --- a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js +++ b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial.user.js @@ -1,21 +1,38 @@ // ==UserScript== // @name Firefox for desktop - list fixed bugs in Mercurial // @namespace darkred -// @authors darkred, johnp -// @description It generates a list of fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs +// @version 4.2.9 +// @date 2020.8.25 +// @description Lists fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs +// @author darkred, johnp +// @license MIT // @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ -// @version 4.2.2 -// @date 2017.3.25 -// @grant GM_addStyle +// @grant GM_getResourceURL // @grant GM_getResourceText +// @grant GM_addStyle +// @grant GM_xmlhttpRequest // @grant GM_setClipboard // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js -// @resource customCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource IconSet1 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +// @resource IconSet2 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +// @resource IconSet3 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +// @resource IconSet4 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +// @resource IconSet5 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_217bc0_256x240.png +// @resource IconSet6 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_469bdd_256x240.png +// @resource IconSet7 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_6da8d5_256x240.png +// Thanks a lot to: johnp (your contribution is most appreciated!), wOxxOm and Brock Adams. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -/* global $:false */ -/* eslint-disable no-console */ + + + + + + +/* eslint-disable no-console, complexity */ var silent = false; @@ -23,27 +40,50 @@ var debug = false; time('MozillaMercurial'); -String.prototype.escapeHTML = function() { - var tagsToReplace = { - '&': '&', - '<': '<', - '>': '>' - }; - return this.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; - }); -}; + + +// the dialog will only be opened after all these promises have finished +var requests = []; + // theme for the jQuery dialog -// $("head").append( -// '' -// ); -var newCSS = GM_getResourceText ('customCSS'); -GM_addStyle (newCSS); +if (typeof(GM_getResourceText) !== 'undefined' && typeof(GM_addStyle) !== 'undefined') { + + + // https://stackoverflow.com/a/11532646/ , i.e. https://stackoverflow.com/a/11532646/3231411 (By Brock Adams) + // Themes files URLs: https://cdnjs.com/libraries/jqueryui + let iconSet1 = GM_getResourceURL ('IconSet1'); + let iconSet2 = GM_getResourceURL ('IconSet2'); + let iconSet3 = GM_getResourceURL ('IconSet3'); + let iconSet4 = GM_getResourceURL ('IconSet4'); + let iconSet5 = GM_getResourceURL ('IconSet5'); + let iconSet6 = GM_getResourceURL ('IconSet6'); + let iconSet7 = GM_getResourceURL ('IconSet7'); + let jqUI_CssSrc = GM_getResourceText ('jqUI_CSS'); + // jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\/ui\-bg_.*00\.png\)/g, ''); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_75_d0e5f5_1x400\.png/g, iconSet1); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_85_dfeffc_1x400\.png/g, iconSet2); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_gloss-wave_55_5c9ccc_500x100\.png/g, iconSet3); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_inset-hard_100_fcfdfd_1x100\.png/g, iconSet4); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_217bc0_256x240\.png/g, iconSet5); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_469bdd_256x240\.png/g, iconSet6); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_6da8d5_256x240\.png/g, iconSet7); + + GM_addStyle (jqUI_CssSrc); + + +} else { // e.g. Greasemonkey: https://github.com/greasemonkey/greasemonkey/issues/2548 + // load jquery-ui css dynamically to bypass Content-Security-Policy restrictions + let loadCss = $.get('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', function(css) { + $('head').append(''); + }); + requests.push(loadCss); // prevent a possible race condition where the dialog is opened before the css is loaded +} + + + + var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/; @@ -68,151 +108,176 @@ var numBugs = bugIds.length; var counter = 0; var rest_url = base_url + bugIds.join(); -time('MozillaMercurial-REST'); -$.getJSON(rest_url, function(data) { - timeEnd('MozillaMercurial-REST'); - data.bugs.sort(function(a, b) { - return (a.product + ': ' + a.component + ': ' + a.summary) > (b.product + ': ' + b.component + ': ' + b.summary); - }); - $.each(data.bugs, function(index) { - let bug = data.bugs[index]; - // process bug (let "shorthands" just to simplify things during refactoring) - let status = bug.status; - if (bug.resolution !== '') {status += ' ' + bug.resolution;} - let product = bug.product; - let component = bug.component; - let platform = bug.platform; - if (platform == 'Unspecified') { - platform = 'Uns'; - } - if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { - platform += '/' + bug.op_sys; - } - let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; - // todo: message??? - - log('----------------------------------------------------------------------------------------------------------------------------------'); - log((index + 1) + '/' + numBugs); // Progression counter - log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); - - if (isRelevant(bug)) { - // add html code for this bug - bugsComplete.push('#' - + bug.id - + '' - + ' (' + product + ': ' + component + ') ' - + bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '
'); - } - counter++; // increase counter - // remove processed bug from bugIds - let i = bugIds.indexOf(bug.id); - if (i !== -1) {bugIds[i] = null;} - }); - log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); - - // process remaining bugs one-by-one - var requests = []; - time('MozillaMercurial-missing'); - $.each(bugIds, function(index) { - let id = bugIds[index]; - if (id !== null) { - time('Requesting missing bug ' + id); - let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, - function(json) { - // I've not end up here yet, so cry if we do - console.error('Request succeeded unexpectedly!'); - console.error('Please submit this information to the script authors:'); - timeEnd('Requesting missing bug ' + id); - console.log(json); - let bug = json.bugs[0]; - console.log(bug); - // TODO: display as much information as possible -}); - // Actually, we usually get an error - promise.error(function(req, status, error) { - timeEnd('Requesting missing bug ' + id); - if (error == 'Authorization Required') { - log('Bug ' + id + ' requires authorization!'); - log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); - let text = ' requires authorization!
'; - - bugsComplete.push('#' - + id + '' + text); - } else { - console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); - } - }); - requests.push(promise); - } + + +String.prototype.escapeHTML = function() { + var tagsToReplace = { + '&': '&', + '<': '<', + '>': '>' + }; + + return this.replace(/[&<>]/g, function(tag) { + return tagsToReplace[tag] || tag; }); - // wait for all requests to be settled, then join them together - // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed - $.when.apply($, $.map(requests, function(p) { - return p.then(null, function() { - return $.Deferred().resolveWith(this, arguments); +}; + + + +time('MozillaMercurial-REST'); + + +GM_xmlhttpRequest({ + method: 'GET', + url: rest_url, + onload: function(response) { + + var data = JSON.parse(response.responseText); + + timeEnd('MozillaMercurial-REST'); + data.bugs.sort(function(a, b) { + return (a.product + ': ' + a.component + ': ' + a.summary).localeCompare(b.product + ': ' + b.component + ': ' + b.summary); // had to change '>' with '.localeCompare' because the sorting wasn't applied when run with Tampermonkey + }); + $.each(data.bugs, function(index) { + let bug = data.bugs[index]; + // process bug (let "shorthands" just to simplify things during refactoring) + let status = bug.status; + if (bug.resolution !== '') {status += ' ' + bug.resolution;} + let product = bug.product; + let component = bug.component; + let platform = bug.platform; + if (platform === 'Unspecified') { + platform = 'Uns'; + } + if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { + platform += '/' + bug.op_sys; + } + let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; + // todo: message??? + + log('----------------------------------------------------------------------------------------------------------------------------------'); + log((index + 1) + '/' + numBugs); // Progression counter + log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); + + if (isRelevant(bug)) { + // add html code for this bug + // console.log(typeof bug.summary) + bugsComplete.push('#' + + 'https://bugzilla.mozilla.org/show_bug.cgi?id='+ bug.id + '"' + ' title="' + bug.id + ' - ' + bug.summary + '">#' + + bug.id + + '' + + ' (' + product + ': ' + component + ') ' + + bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '
'); + } + counter++; // increase counter + // remove processed bug from bugIds + let i = bugIds.indexOf(bug.id); + if (i !== -1) {bugIds[i] = null;} }); - })).always(function() { - timeEnd('MozillaMercurial-missing'); - // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below - var docu = ''; - docu = bugsComplete.join(''); - - var div = document.createElement('div'); - $('div.page_footer').append(div); - div.id = 'dialog'; - // GM_setClipboard (docu); // This line stores the list content HTML code to clipboard (aimed for MozillaZine daily "The Official Win32 xxxxxxx builds" maintainer) - docu = '
' + docu + '
'; - div.innerHTML = docu; - $('#dialog').hide(); - - $(function() { - $('#dialog').dialog({ - title: 'List of recently fixed bugs of Firefox for Desktop (' + bugsComplete.length + ')', - width: '1350px' + log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); + + // process remaining bugs one-by-one + time('MozillaMercurial-missing'); + $.each(bugIds, function(index) { + let id = bugIds[index]; + if (id !== null) { + time('Requesting missing bug ' + id); + let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, + function(json) { + // I've not end up here yet, so cry if we do + console.error('Request for bug ' + id + ' succeeded unexpectedly!'); + timeEnd('Requesting missing bug ' + id); + console.error(json); + }); + // Actually, we usually get an '401 Authorization Required' error + promise.fail(function(req, status, error) { + timeEnd('Requesting missing bug ' + id); + if (error === 'Authorization Required') { + log('Bug ' + id + ' requires authorization!'); + log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); + let text = ' requires authorization!
'; + + bugsComplete.push('#' + + id + '' + text); + } else { + console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); + } + }); + requests.push(promise); + } + }); + // wait for all requests to be settled, then join them together + // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed + $.when.apply($, $.map(requests, function(p) { + return p.then(null, function() { + return $.Deferred().resolveWith(this, arguments); }); + })).always(function() { + timeEnd('MozillaMercurial-missing'); + // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below + var docu = ''; + docu = bugsComplete.join(''); + + var div = document.createElement('div'); + $('div.page_footer').append(div); + div.id = 'dialog'; + // GM_setClipboard (docu); // This line stores the list content HTML code to clipboard (aimed for MozillaZine daily "The Official Win32 xxxxxxx builds" maintainer) + // docu = '
' + docu + '
'; + docu = '
' + docu + '
'; + div.innerHTML = docu; + $('#dialog').hide(); + + $(function() { + $('#dialog').dialog({ + title: 'List of recently fixed bugs of Firefox for Desktop (' + bugsComplete.length + ')', + width: '1350px' + }); + }); + + log('ALL IS DONE'); + timeEnd('MozillaMercurial'); }); - log('ALL IS DONE'); - timeEnd('MozillaMercurial'); - }); + } }); function isRelevant(bug) { if (!bug.id) {return false;} - if (bug.status && bug.status != 'RESOLVED' && bug.status != 'VERIFIED') { + if (bug.status && bug.status !== 'RESOLVED' && bug.status !== 'VERIFIED') { log(' IRRELEVANT because of it\'s Status --> ' + bug.status); return false; } - if (bug.component && bug.product && bug.component == 'Build Config' && (bug.product == 'Toolkit' || bug.product == 'Firefox')) { + if (bug.component && bug.product && bug.component === 'Build Config' && (bug.product === 'Toolkit' || bug.product === 'Firefox')) { log(' IRRELEVANT because of it\'s Product --> ' + bug.product + 'having component --> ' + bug.component); return false; } - if (bug.product && bug.product != 'Add-on SDK' && - bug.product != 'Cloud Services' && - bug.product != 'Core' && - bug.product != 'Firefox' && - bug.product != 'Hello (Loop)' && - bug.product != 'Toolkit') { + if ( bug.product && + bug.product !== 'Add-on SDK' && + bug.product !== 'Cloud Services' && + bug.product !== 'Core' && + bug.product !== 'Firefox' && + bug.product !== 'Hello (Loop)' && + bug.product !== 'Toolkit') { log(' IRRELEVANT because of it\'s Product --> ' + bug.product); return false; } - if (bug.component && bug.component == 'AutoConfig' || - bug.component == 'Build Config' || - bug.component == 'DMD' || - bug.component == 'Embedding: GRE Core' || - bug.component == 'Embedding: Mac' || - bug.component == 'Embedding: MFC Embed' || - bug.component == 'Embedding: Packaging' || - bug.component == 'Hardware Abstraction Layer' || - bug.component == 'mach' || - bug.component == 'Nanojit' || - bug.component == 'QuickLaunch' || - bug.component == 'Widget: Gonk') { + if (bug.component && bug.component === 'AutoConfig'|| + bug.component === 'Build Config' || + bug.component === 'DMD' || + bug.component === 'Embedding: GRE Core' || + bug.component === 'Embedding: Mac' || + bug.component === 'Embedding: MFC Embed' || + bug.component === 'Embedding: Packaging' || + bug.component === 'Hardware Abstraction Layer' || + bug.component === 'mach' || + bug.component === 'Nanojit' || + bug.component === 'QuickLaunch' || + bug.component === 'Widget: Gonk') { log(' IRRELEVANT because of it\'s Component --> ' + bug.component); return false; @@ -256,7 +321,7 @@ $('#dialog').dialog({ minHeight: 200, zIndex: 3666 }) - .dialog('widget').draggable('option', 'containment', 'none'); + .dialog('widget').draggable('option', 'containment', 'none'); //-- Fix crazy bug in FF! ... $('#dialog').parent().css({ diff --git a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js index aa7a06c..3c616ce 100644 --- a/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js +++ b/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_fixed_bugs_in_Mercurial_as_sortable_table.user.js @@ -1,10 +1,16 @@ // ==UserScript== // @name Firefox for desktop - list fixed bugs in Mercurial as sortable table // @namespace darkred -// @authors darkred, johnp -// @description It generates a sortable table list of fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs -// @version 5.5.4 -// @date 2017.3.25 +// @version 5.5.9.2 +// @date 2020.8.25 +// @description Lists (as sortable table) fixed bugs related to Firefox for desktop in Mozilla Mercurial pushlogs +// @author darkred, johnp +// @license MIT +// @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ +// @grant GM_getResourceURL +// @grant GM_getResourceText +// @grant GM_addStyle +// @grant GM_xmlhttpRequest // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.24.3/js/jquery.tablesorter.min.js @@ -13,95 +19,139 @@ // @require https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js -// @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ -// @grant GM_addStyle -// @grant GM_getResourceText -// @resource customCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource IconSet1 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +// @resource IconSet2 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +// @resource IconSet3 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +// @resource IconSet4 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +// @resource IconSet5 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_217bc0_256x240.png +// @resource IconSet6 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_469bdd_256x240.png +// @resource IconSet7 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_6da8d5_256x240.png +// Thanks a lot to: johnp (your contribution is most appreciated!), wOxxOm and Brock Adams. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -/* global $:false, jstz, moment */ +/* eslint-disable no-console, complexity */ +/* global jstz, moment */ + + +var silent = false; +var debug = false; + +time('MozillaMercurial'); + + + // CSS rules in order to show 'up' and 'down' arrows in each table header -var stylesheet = ' \ -'; +var stylesheet = ` +`; $('head').append(stylesheet); -// in order to highlight hovered table row -GM_addStyle('#tbl tr:hover{ background:#F6E6C6 !important;}'); +var stylesheet2 = +``; +$('head').append(stylesheet2); -// in order the bug list to have width 1500px -GM_addStyle('.ui-dialog {width:1200px !important;}'); +// the dialog will only be opened after all these promises have finished +var requests = []; + + +// theme for the jQuery dialog +if (typeof(GM_getResourceText) !== 'undefined' && typeof(GM_addStyle) !== 'undefined') { + + + // https://stackoverflow.com/a/11532646/ , i.e. https://stackoverflow.com/a/11532646/3231411 (By Brock Adams) + // Themes files URLs: https://cdnjs.com/libraries/jqueryui + let iconSet1 = GM_getResourceURL ('IconSet1'); + let iconSet2 = GM_getResourceURL ('IconSet2'); + let iconSet3 = GM_getResourceURL ('IconSet3'); + let iconSet4 = GM_getResourceURL ('IconSet4'); + let iconSet5 = GM_getResourceURL ('IconSet5'); + let iconSet6 = GM_getResourceURL ('IconSet6'); + let iconSet7 = GM_getResourceURL ('IconSet7'); + let jqUI_CssSrc = GM_getResourceText ('jqUI_CSS'); + // jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\/ui\-bg_.*00\.png\)/g, ''); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_75_d0e5f5_1x400\.png/g, iconSet1); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_85_dfeffc_1x400\.png/g, iconSet2); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_gloss-wave_55_5c9ccc_500x100\.png/g, iconSet3); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_inset-hard_100_fcfdfd_1x100\.png/g, iconSet4); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_217bc0_256x240\.png/g, iconSet5); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_469bdd_256x240\.png/g, iconSet6); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_6da8d5_256x240\.png/g, iconSet7); + + GM_addStyle (jqUI_CssSrc); + + +} else { // e.g. Greasemonkey: https://github.com/greasemonkey/greasemonkey/issues/2548 + // load jquery-ui css dynamically to bypass Content-Security-Policy restrictions + let loadCss = $.get('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', function(css) { + $('head').append(''); + }); + requests.push(loadCss); // prevent a possible race condition where the dialog is opened before the css is loaded +} + -var silent = false; -var debug = false; -time('MozillaMercurial'); -String.prototype.escapeHTML = function() { - var tagsToReplace = { - '&': '&', - '<': '<', - '>': '>' - }; - return this.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; - }); -}; // theme for the jQuery dialog // $('head').append( @@ -110,8 +160,14 @@ String.prototype.escapeHTML = function() { // // 'href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css" ' + // uncomment this line (and comment line 89) in order to change theme // 'rel="stylesheet" type="text/css">' // ); -var newCSS = GM_getResourceText ('customCSS'); -GM_addStyle (newCSS); +// var newCSS = GM_getResourceText ('customCSS'); +// GM_addStyle (newCSS); +$.ajax({ + url:'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', + success:function(data){ + $('').appendTo('head').html(data); + } +}); var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/; var base_url = 'https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,resolution,product,component,op_sys,platform,whiteboard,last_change_time&id='; @@ -135,66 +191,82 @@ var numBugs = bugIds.length; var counter = 0; var rest_url = base_url + bugIds.join(); -time('MozillaMercurial-REST'); +String.prototype.escapeHTML = function() { + var tagsToReplace = { + '&': '&', + '<': '<', + '>': '>' + }; + return this.replace(/[&<>]/g, function(tag) { + return tagsToReplace[tag] || tag; + }); +}; +time('MozillaMercurial-REST'); -$.getJSON(rest_url, function(data) { - timeEnd('MozillaMercurial-REST'); - $.each(data.bugs, function(index) { - let bug = data.bugs[index]; - // process bug (let "shorthands" just to simplify things during refactoring) - let status = bug.status; - if (bug.resolution !== '') {status += ' ' + bug.resolution;} - let product = bug.product; - let component = bug.component; - let platform = bug.platform; - if (platform == 'Unspecified') { - platform = 'Uns'; - } - if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { - platform += '/' + bug.op_sys; - } - let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; - // todo: message??? +GM_xmlhttpRequest({ + method: 'GET', + url: rest_url, + onload: function(response) { + var data = JSON.parse(response.responseText); + timeEnd('MozillaMercurial-REST'); + $.each(data.bugs, function(index) { + let bug = data.bugs[index]; + // process bug (let "shorthands" just to simplify things during refactoring) + let status = bug.status; + if (bug.resolution !== '') {status += ' ' + bug.resolution;} + let product = bug.product; + let component = bug.component; + let platform = bug.platform; + if (platform === 'Unspecified') { + platform = 'Uns'; + } + if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { + platform += '/' + bug.op_sys; + } + let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; + // todo: message??? - // 2015-11-09T14:40:41Z - function toRelativeTime(time, zone) { - var format2 = ('YYYY-MM-DD HH:mm:ss Z'); - return moment(time, format2).tz(zone).fromNow(); - } - function getLocalTimezone(){ - var tz = jstz.determine(); // Determines the time zone of the browser client - return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" - } + // 2015-11-09T14:40:41Z + function toRelativeTime(time, zone) { + var format2 = ('YYYY-MM-DD HH:mm:ss Z'); + return moment(time, format2).tz(zone).fromNow(); + } + + + function getLocalTimezone(){ + var tz = jstz.determine(); // Determines the time zone of the browser client + return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" + } - var changetime; - var localTimezone = getLocalTimezone(); + var changetime; + var localTimezone = getLocalTimezone(); - if (bug.last_change_time !== '') { - var temp = toRelativeTime(bug.last_change_time, localTimezone); - if (temp.match(/(an?)\ .*/)) { - changetime = temp.replace(/an?/, 1); + if (bug.last_change_time !== '') { + var temp = toRelativeTime(bug.last_change_time, localTimezone); + if (temp.match(/(an?) .*/)) { + changetime = temp.replace(/an?/, 1); + } else { + changetime = temp; + } + // changetime } else { - changetime = temp; + changetime = ''; } - // changetime - } else { - changetime = ''; - } @@ -203,174 +275,171 @@ $.getJSON(rest_url, function(data) { - log('----------------------------------------------------------------------------------------------------------------------------------'); - log((index + 1) + '/' + numBugs); // Progression counter - log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); + log('----------------------------------------------------------------------------------------------------------------------------------'); + log((index + 1) + '/' + numBugs); // Progression counter + log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); - if (isRelevant(bug)) { - // add html code for this bug - bugsComplete.push('' - + bug.id - + '' - + '(' + product + ': ' + component + ') ' - + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' - + '' + changetime + ''); // previously had a
at the end; - } - counter++; // increase counter - // remove processed bug from bugIds - let i = bugIds.indexOf(bug.id); - if (i !== -1) {bugIds[i] = null;} - }); - log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); - - - - - // process remaining bugs one-by-one - var requests = []; - time('MozillaMercurial-missing'); - $.each(bugIds, function(index) { - let id = bugIds[index]; - if (id !== null) { - time('Requesting missing bug ' + id); - let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, - function(json) { - // I've not end up here yet, so cry if we do - console.error('Request succeeded unexpectedly!'); - console.error('Please submit this information to the script authors:'); - timeEnd('Requesting missing bug ' + id); - console.log(json); - let bug = json.bugs[0]; - console.log(bug); - // TODO: display as much information as possible -}); - // Actually, we usually get an error - promise.error(function(req, status, error) { - timeEnd('Requesting missing bug ' + id); - if (error == 'Authorization Required') { - // log("Bug " + id + " requires authorization!"); - log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); - let text = ' requires authorization!
'; - - bugsComplete.push('#' - + id + '' + text); - } else { - console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); - } - }); - requests.push(promise); - } - }); - // wait for all requests to be settled, then join them together - // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed - $.when.apply($, $.map(requests, function(p) { - return p.then(null, function() { - return $.Deferred().resolveWith(this, arguments); + if (isRelevant(bug)) { + // add html code for this bug + bugsComplete.push('' + + 'https://bugzilla.mozilla.org/show_bug.cgi?id='+ bug.id + '"' + ' title="' + bug.id + ' - ' + bug.summary + '">#' + + bug.id + + '' + + '(' + product + ': ' + component + ') ' + + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' + + '' + changetime + ''); // previously had a
at the end; + } + counter++; // increase counter + // remove processed bug from bugIds + let i = bugIds.indexOf(bug.id); + if (i !== -1) {bugIds[i] = null;} }); - })).always(function() { - timeEnd('MozillaMercurial-missing'); - // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below - var docu = ''; - docu = bugsComplete.join(''); - docu = ' ' + - '' + - '' + - '' + // '' + - '' + - '' + // '' + - '' + - '' + docu + '
BugNoProduct/ComponentProduct/Component_________SummaryModified
Modified__
'; - - - - - var div = document.createElement('div'); - $('div.page_footer').append(div); - div.id = 'dialog'; - docu = '
' + docu + '
'; - div.innerHTML = docu; - $('#dialog').hide(); - - $(function() { - $('#dialog').dialog({ - title: 'List of fixed bugs of Firefox for desktop (' + bugsComplete.length + ')', - width: '1350px' - }); + log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); + + + + + // process remaining bugs one-by-one + time('MozillaMercurial-missing'); + $.each(bugIds, function(index) { + let id = bugIds[index]; + if (id !== null) { + time('Requesting missing bug ' + id); + let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, + function(json) { + // I've not end up here yet, so cry if we do + console.error('Request for bug ' + id + ' succeeded unexpectedly!'); + timeEnd('Requesting missing bug ' + id); + console.error(json); + }); + // Actually, we usually get an '401 Authorization Required' error + promise.fail(function(req, status, error) { + timeEnd('Requesting missing bug ' + id); + if (error === 'Authorization Required') { + // log("Bug " + id + " requires authorization!"); + log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); + let text = ' requires authorization!
'; + + bugsComplete.push('#' + + id + '' + text); + } else { + console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); + } + }); + requests.push(promise); + } }); + // wait for all requests to be settled, then join them together + // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed + $.when.apply($, $.map(requests, function(p) { + return p.then(null, function() { + return $.Deferred().resolveWith(this, arguments); + }); + })).always(function() { + timeEnd('MozillaMercurial-missing'); + // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below + var docu = ''; + docu = bugsComplete.join(''); + docu = ' ' + + '' + + '' + + '' + // '' + + '' + + '' + // '' + + '' + + '' + docu + '
BugNoProduct/ComponentProduct/Component_________SummaryModified
Modified__
'; + + + + + var div = document.createElement('div'); + $('div.page_footer').append(div); + div.id = 'dialog'; + docu = '
' + docu + '
'; + div.innerHTML = docu; + $('#dialog').hide(); + + $(function() { + $('#dialog').dialog({ + title: 'List of fixed bugs of Firefox for desktop (' + bugsComplete.length + ')', + width: '1350px' + }); + }); -// THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! -// add parser through the tablesorter addParser method (for the "Last modified" column) - $.tablesorter.addParser({ - // set a unique id - id: 'dates', - is: function(s) { - return false; // return false so this parser is not auto detected - }, - format: function(s) { - // format your data for normalization - if (s !== ''){ - var number1, number2; + // THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! + // add parser through the tablesorter addParser method (for the "Last modified" column) + $.tablesorter.addParser({ + // set a unique id + id: 'dates', + is: function(s) { + return false; // return false so this parser is not auto detected + }, + format: function(s) { + // format your data for normalization + if (s !== ''){ + var number1, number2; - // format your data for normalization - number1 = Number((/(.{1,2})\ .*/).exec(s)[1]); + // format your data for normalization + number1 = Number((/(.{1,2}) .*/).exec(s)[1]); - if (s.match(/A few seconds ago/)) { number2 = 0;} - else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} - else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} - else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} - else if (s.match(/(.*)days?.*/)) { number2 = 86400;} - else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} - else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} - return number1 * number2; + if (s.match(/A few seconds ago/)) { number2 = 0;} + else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} + else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} + else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} + else if (s.match(/(.*)days?.*/)) { number2 = 86400;} + else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} + else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} + return number1 * number2; - } - }, - // set type, either numeric or text - type: 'numeric' - }); + } + }, + // set type, either numeric or text + type: 'numeric' + }); -// make table sortable - $('#tbl').tablesorter({ - cssAsc: 'up', - cssDesc: 'down', - sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' - headers: {3: {sorter: 'dates'}}, - initialized: function() { - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 4; k++) { - mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + // make table sortable + $('#tbl').tablesorter({ + cssAsc: 'up', + cssDesc: 'down', + sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' + headers: {3: {sorter: 'dates'}}, + initialized: function() { + var mytable = document.getElementById('tbl'); + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (let k = 0; k < 4; k++) { + mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + } } } } - } - }); + }); - log('ALL IS DONE'); - timeEnd('MozillaMercurial'); + log('ALL IS DONE'); + timeEnd('MozillaMercurial'); - }); + }); + } }); @@ -379,13 +448,13 @@ var flag = 1; // bind keypress of ` so that when pressed, the separators between groups of the same timestamps to be removed, in order to sort manually var listener = new window.keypress.Listener(); listener.simple_combo('`', function() { - // console.log('You pressed `'); + // console.log('You pressed `'); if (flag === 1) { flag = 0; - // remove seperators + // remove seperators var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - for (var k = 0; k < 4; k++) { + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + for (let k = 0; k < 4; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = 'none'; } } @@ -394,13 +463,13 @@ listener.simple_combo('`', function() { } else { if (flag === 0) { flag = 1; - // console.log('You pressed ~'); - var sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' + // console.log('You pressed ~'); + sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' $('#tbl').trigger('sorton', [sorting]); - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 4; k++) { + mytable = document.getElementById('tbl'); + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (let k = 0; k < 4; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; } } @@ -416,35 +485,37 @@ listener.simple_combo('`', function() { function isRelevant(bug) { if (!bug.id) {return false;} - if (bug.status && bug.status != 'RESOLVED' && bug.status != 'VERIFIED') { + if (bug.status && bug.status !== 'RESOLVED' && bug.status !== 'VERIFIED') { log(' IRRELEVANT because of it\'s Status --> ' + bug.status); return false; } - if (bug.component && bug.product && bug.component == 'Build Config' && (bug.product == 'Toolkit' || bug.product == 'Firefox')) { + if (bug.component && bug.product && bug.component === 'Build Config' && (bug.product === 'Toolkit' || bug.product === 'Firefox')) { log(' IRRELEVANT because of it\'s Product --> ' + bug.product + 'having component --> ' + bug.component); return false; } - if (bug.product && bug.product != 'Add-on SDK' && - bug.product != 'Cloud Services' && - bug.product != 'Core' && - bug.product != 'Firefox' && - bug.product != 'Hello (Loop)' && - bug.product != 'Toolkit') { + if (bug.product && + bug.product !== 'Add-on SDK' && + bug.product !== 'Cloud Services' && + bug.product !== 'Core' && + bug.product !== 'Firefox' && + bug.product !== 'Hello (Loop)' && + bug.product !== 'Toolkit') { log(' IRRELEVANT because of it\'s Product --> ' + bug.product); return false; } - if (bug.component && bug.component == 'AutoConfig' || - bug.component == 'Build Config' || - bug.component == 'DMD' || - bug.component == 'Embedding: GRE Core' || - bug.component == 'Embedding: Mac' || - bug.component == 'Embedding: MFC Embed' || - bug.component == 'Embedding: Packaging' || - bug.component == 'Hardware Abstraction Layer' || - bug.component == 'mach' || - bug.component == 'Nanojit' || - bug.component == 'QuickLaunch' || - bug.component == 'Widget: Gonk') { + if (bug.component && + bug.component === 'AutoConfig' || + bug.component === 'Build Config' || + bug.component === 'DMD' || + bug.component === 'Embedding: GRE Core' || + bug.component === 'Embedding: Mac' || + bug.component === 'Embedding: MFC Embed' || + bug.component === 'Embedding: Packaging' || + bug.component === 'Hardware Abstraction Layer' || + bug.component === 'mach' || + bug.component === 'Nanojit' || + bug.component === 'QuickLaunch' || + bug.component === 'Widget: Gonk') { log(' IRRELEVANT because of it\'s Component --> ' + bug.component); return false; } @@ -474,7 +545,7 @@ function timeEnd(str) { } } -// $(function() { + $('#dialog').dialog({ modal: false, title: 'Draggable, sizeable dialog', @@ -484,10 +555,9 @@ $('#dialog').dialog({ of: document, collision: 'none' }, - // width: 1500, // not working + // width: 1500, // not working zIndex: 3666 -}) - .dialog('widget').draggable('option', 'containment', 'none'); +}).dialog('widget').draggable('option', 'containment', 'none'); //-- Fix crazy bug in FF! ... $('#dialog').parent().css({ diff --git a/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js b/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js index a21254b..f66838a 100644 --- a/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js +++ b/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table/Firefox_for_desktop_-_list_modified_bugs_in_Mercurial_as_sortable_table.user.js @@ -1,10 +1,16 @@ // ==UserScript== // @name Firefox for desktop - list modified bugs in Mercurial as sortable table // @namespace darkred -// @authors darkred, johnp -// @description It generates a sortable table list of bugs related to Firefox for desktop for which patches have landed in Mozilla Mercurial pushlogs -// @version 5.5.4 -// @date 2017.3.25 +// @version 5.5.9.2 +// @date 2020.8.25 +// @description Lists (as sortable table) bugs related to Firefox for desktop for which patches have landed in Mozilla Mercurial pushlogs +// @author darkred, johnp +// @license MIT +// @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ +// @grant GM_getResourceURL +// @grant GM_getResourceText +// @grant GM_addStyle +// @grant GM_xmlhttpRequest // @require https://code.jquery.com/jquery-2.1.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.24.3/js/jquery.tablesorter.min.js @@ -13,94 +19,127 @@ // @require https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js -// @include /^https?:\/\/hg\.mozilla\.org.*pushloghtml.*/ -// @grant GM_addStyle -// @grant GM_getResourceText -// @resource customCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css +// @resource IconSet1 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +// @resource IconSet2 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +// @resource IconSet3 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +// @resource IconSet4 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +// @resource IconSet5 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_217bc0_256x240.png +// @resource IconSet6 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_469bdd_256x240.png +// @resource IconSet7 https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/redmond/images/ui-icons_6da8d5_256x240.png +// Thanks a lot to: johnp (your contribution is most appreciated!), wOxxOm and Brock Adams. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +/* eslint-disable no-console, complexity */ +/* global jstz, moment */ + + +var silent = false; +var debug = false; + +time('MozillaMercurial'); + + + // CSS rules in order to show 'up' and 'down' arrows in each table header -var stylesheet = ' \ -'; +var stylesheet = ` +`; $('head').append(stylesheet); +var stylesheet2 = +``; +$('head').append(stylesheet2); -// in order the bug list to have width 1500px // it was 1500 and then 1600 -GM_addStyle('.ui-dialog {\ - width:1700px !important;\ -}'); +// the dialog will only be opened after all these promises have finished +var requests = []; -var silent = false; -var debug = false; +// theme for the jQuery dialog +if (typeof(GM_getResourceText) !== 'undefined' && typeof(GM_addStyle) !== 'undefined') { + + + // https://stackoverflow.com/a/11532646/ , i.e. https://stackoverflow.com/a/11532646/3231411 (By Brock Adams) + // Themes files URLs: https://cdnjs.com/libraries/jqueryui + let iconSet1 = GM_getResourceURL ('IconSet1'); + let iconSet2 = GM_getResourceURL ('IconSet2'); + let iconSet3 = GM_getResourceURL ('IconSet3'); + let iconSet4 = GM_getResourceURL ('IconSet4'); + let iconSet5 = GM_getResourceURL ('IconSet5'); + let iconSet6 = GM_getResourceURL ('IconSet6'); + let iconSet7 = GM_getResourceURL ('IconSet7'); + let jqUI_CssSrc = GM_getResourceText ('jqUI_CSS'); + // jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\/ui\-bg_.*00\.png\)/g, ''); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_75_d0e5f5_1x400\.png/g, iconSet1); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_glass_85_dfeffc_1x400\.png/g, iconSet2); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_gloss-wave_55_5c9ccc_500x100\.png/g, iconSet3); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-bg_inset-hard_100_fcfdfd_1x100\.png/g, iconSet4); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_217bc0_256x240\.png/g, iconSet5); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_469bdd_256x240\.png/g, iconSet6); + jqUI_CssSrc = jqUI_CssSrc.replace (/images\/ui-icons_6da8d5_256x240\.png/g, iconSet7); + + GM_addStyle (jqUI_CssSrc); + + +} else { // e.g. Greasemonkey: https://github.com/greasemonkey/greasemonkey/issues/2548 + // load jquery-ui css dynamically to bypass Content-Security-Policy restrictions + let loadCss = $.get('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.min.css', function(css) { + $('head').append(''); + }); + requests.push(loadCss); // prevent a possible race condition where the dialog is opened before the css is loaded +} -time('MozillaMercurial'); -String.prototype.escapeHTML = function() { - var tagsToReplace = { - '&': '&', - '<': '<', - '>': '>' - }; - return this.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; - }); -}; -// theme for the jQuery dialog -// $('head').append( -// '' -// ); -var newCSS = GM_getResourceText ('customCSS'); -GM_addStyle (newCSS); var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/; @@ -125,66 +164,83 @@ var numBugs = bugIds.length; var counter = 0; var rest_url = base_url + bugIds.join(); -time('MozillaMercurial-REST'); + + +String.prototype.escapeHTML = function() { + var tagsToReplace = { + '&': '&', + '<': '<', + '>': '>' + }; + return this.replace(/[&<>]/g, function(tag) { + return tagsToReplace[tag] || tag; + }); +}; +time('MozillaMercurial-REST'); +GM_xmlhttpRequest({ + method: 'GET', + url: rest_url, + onload: function(response) { -$.getJSON(rest_url, function(data) { - timeEnd('MozillaMercurial-REST'); - $.each(data.bugs, function(index) { - let bug = data.bugs[index]; - // process bug (let "shorthands" just to simplify things during refactoring) - let status = bug.status; - if (bug.resolution !== '') {status += ' ' + bug.resolution;} - let product = bug.product; - let component = bug.component; - let platform = bug.platform; - if (platform == 'Unspecified') { - platform = 'Uns'; - } - if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { - platform += '/' + bug.op_sys; - } - let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; - // todo: message??? + var data = JSON.parse(response.responseText); + + timeEnd('MozillaMercurial-REST'); + $.each(data.bugs, function(index) { + let bug = data.bugs[index]; + // process bug (let "shorthands" just to simplify things during refactoring) + let status = bug.status; + if (bug.resolution !== '') {status += ' ' + bug.resolution;} + let product = bug.product; + let component = bug.component; + let platform = bug.platform; + if (platform === 'Unspecified') { + platform = 'Uns'; + } + if (bug.op_sys !== '' && bug.op_sys !== 'Unspecified') { + platform += '/' + bug.op_sys; + } + let whiteboard = bug.whiteboard === '' ? '[]' : bug.whiteboard; + // todo: message??? - // 2015-11-09T14:40:41Z - function toRelativeTime(time, zone) { - var format2 = ('YYYY-MM-DD HH:mm:ss Z'); - return moment(time, format2).tz(zone).fromNow(); - } + // 2015-11-09T14:40:41Z + function toRelativeTime(time, zone) { + var format2 = ('YYYY-MM-DD HH:mm:ss Z'); + return moment(time, format2).tz(zone).fromNow(); + } - function getLocalTimezone(){ - var tz = jstz.determine(); // Determines the time zone of the browser client - return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" - } + function getLocalTimezone(){ + var tz = jstz.determine(); // Determines the time zone of the browser client + return tz.name(); // Returns the name of the time zone eg "Europe/Berlin" + } - var changetime; - var localTimezone = getLocalTimezone(); + var changetime; + var localTimezone = getLocalTimezone(); - if (bug.last_change_time !== '') { - var temp = toRelativeTime(bug.last_change_time, localTimezone); - if (temp.match(/(an?)\ .*/)) { - changetime = temp.replace(/an?/, 1); + if (bug.last_change_time !== '') { + var temp = toRelativeTime(bug.last_change_time, localTimezone); + if (temp.match(/(an?) .*/)) { + changetime = temp.replace(/an?/, 1); + } else { + changetime = temp; + } + // changetime } else { - changetime = temp; + changetime = ''; } - // changetime - } else { - changetime = ''; - } @@ -193,176 +249,174 @@ $.getJSON(rest_url, function(data) { - log('----------------------------------------------------------------------------------------------------------------------------------'); - log((index + 1) + '/' + numBugs); // Progression counter - log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); + log('----------------------------------------------------------------------------------------------------------------------------------'); + log((index + 1) + '/' + numBugs); // Progression counter + log('BugNo: ' + bug.id + '\nTitle: ' + bug.summary + '\nStatus: ' + status + '\nProduct: ' + product + '\nComponent: ' + component + '\nPlatform: ' + platform + '\nWhiteboard: ' + whiteboard); - if (isRelevant(bug)) { - // add html code for this bug - bugsComplete.push('' - + bug.id - + '' - + '(' + product + ': ' + component + ') ' - + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' - + '' + changetime + '' - + '' + status + ''); // previously had a
at the end; - } - counter++; // increase counter - // remove processed bug from bugIds - let i = bugIds.indexOf(bug.id); - if (i !== -1) {bugIds[i] = null;} - }); - log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); - - - - - // process remaining bugs one-by-one - var requests = []; - time('MozillaMercurial-missing'); - $.each(bugIds, function(index) { - let id = bugIds[index]; - if (id !== null) { - time('Requesting missing bug ' + id); - let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, - function(json) { - // I've not end up here yet, so cry if we do - console.error('Request succeeded unexpectedly!'); - console.error('Please submit this information to the script authors:'); - timeEnd('Requesting missing bug ' + id); - console.log(json); - let bug = json.bugs[0]; - console.log(bug); - // TODO: display as much information as possible -}); - // Actually, we usually get an error - promise.error(function(req, status, error) { - timeEnd('Requesting missing bug ' + id); - if (error == 'Authorization Required') { - // log("Bug " + id + " requires authorization!"); - log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); - let text = ' requires authorization!
'; - - bugsComplete.push('#' - + id + '' + text); - } else { - console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); - } - }); - requests.push(promise); - } - }); - // wait for all requests to be settled, then join them together - // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed - $.when.apply($, $.map(requests, function(p) { - return p.then(null, function() { - return $.Deferred().resolveWith(this, arguments); + if (isRelevant(bug)) { + // add html code for this bug + bugsComplete.push('' + + 'https://bugzilla.mozilla.org/show_bug.cgi?id='+ bug.id + '"' + ' title="' + bug.id + ' - ' + bug.summary + '">#' + + bug.id + + '' + + '(' + product + ': ' + component + ') ' + + ''+bug.summary.escapeHTML() + ' [' + platform + ']' + whiteboard.escapeHTML() + '' + + '' + changetime + '' + + '' + status + ''); // previously had a
at the end; + } + counter++; // increase counter + // remove processed bug from bugIds + let i = bugIds.indexOf(bug.id); + if (i !== -1) {bugIds[i] = null;} }); - })).always(function() { - timeEnd('MozillaMercurial-missing'); - // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below - var docu = ''; - docu = bugsComplete.join(''); - docu = ' ' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + docu + '
BugNoProduct/ComponentSummaryModified___Status____________
'; - - - - - var div = document.createElement('div'); - $('div.page_footer').append(div); - div.id = 'dialog'; - docu = '
' + docu + '
'; - div.innerHTML = docu; - $('#dialog').hide(); - - $(function() { - $('#dialog').dialog({ - title: 'List of modified bugs of Firefox for desktop (' + bugsComplete.length + ')', - width: '1350px' - }); + log('==============\nReceived ' + counter + ' of ' + numBugs + ' bugs.'); + + + + + // process remaining bugs one-by-one + time('MozillaMercurial-missing'); + $.each(bugIds, function(index) { + let id = bugIds[index]; + if (id !== null) { + time('Requesting missing bug ' + id); + let promise = $.getJSON('https://bugzilla.mozilla.org/rest/bug/' + id, + function(json) { + // I've not end up here yet, so cry if we do + console.error('Request for bug ' + id + ' succeeded unexpectedly!'); + timeEnd('Requesting missing bug ' + id); + console.error(json); + }); + // Actually, we usually get an '401 Authorization Required' error + promise.fail(function(req, status, error) { + timeEnd('Requesting missing bug ' + id); + if (error === 'Authorization Required') { + + // log("Bug " + id + " requires authorization!"); + log('https://bugzilla.mozilla.org/show_bug.cgi?id=' + id + ' requires authorization!'); + let text = ' requires authorization!
'; + + bugsComplete.push('#' + + id + '' + text); + } else { + console.error('Unexpected error encountered (Bug' + id + '): ' + status + ' ' + error); + } + }); + requests.push(promise); + } }); + // wait for all requests to be settled, then join them together + // Source: https://stackoverflow.com/questions/19177087/deferred-how-to-detect-when-every-promise-has-been-executed + $.when.apply($, $.map(requests, function(p) { + return p.then(null, function() { + return $.Deferred().resolveWith(this, arguments); + }); + })).always(function() { + timeEnd('MozillaMercurial-missing'); + // Variable that will contain all values of the bugsComplete array, and will be displayed in the 'dialog' below + var docu = ''; + docu = bugsComplete.join(''); + docu = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + docu + '
BugNoProduct/ComponentSummaryModified___Status____________
'; + + + + + var div = document.createElement('div'); + $('div.page_footer').append(div); + div.id = 'dialog'; + docu = '
' + docu + '
'; + div.innerHTML = docu; + $('#dialog').hide(); + + $(function() { + $('#dialog').dialog({ + title: 'List of modified bugs of Firefox for desktop (' + bugsComplete.length + ')', + width: '1350px' + }); + }); -// THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! -// add parser through the tablesorter addParser method (for the "Last modified" column) - $.tablesorter.addParser({ - // set a unique id - id: 'dates', - is: function(s) { - return false; // return false so this parser is not auto detected - }, - format: function(s) { - // format your data for normalization - if (s !== ''){ - var number1, number2; + // THE CUSTOM PARSER MUST BE PUT BEFORE '$('#tbl').tablesorter ( {'' or else it wont work !!!! + // add parser through the tablesorter addParser method (for the "Last modified" column) + $.tablesorter.addParser({ + // set a unique id + id: 'dates', + is: function(s) { + return false; // return false so this parser is not auto detected + }, + format: function(s) { + // format your data for normalization + if (s !== ''){ + var number1, number2; - // format your data for normalization - number1 = Number((/(.{1,2})\ .*/).exec(s)[1]); + // format your data for normalization + number1 = Number((/(.{1,2}) .*/).exec(s)[1]); - if (s.match(/A few seconds ago/)) { number2 = 0;} - else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} - else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} - else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} - else if (s.match(/(.*)days?.*/)) { number2 = 86400;} - else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} - else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} - return number1 * number2; + if (s.match(/A few seconds ago/)) { number2 = 0;} + else if (s.match(/(.*)seconds?.*/)) { number2 = 1;} + else if (s.match(/(.*)minutes?.*/)) {number2 = 60;} + else if (s.match(/(.*)hours?.*/)) { number2 = 3600;} + else if (s.match(/(.*)days?.*/)) { number2 = 86400;} + else if (s.match(/(.*)months?.*/)) { number2 = 30 * 86400;} + else if (s.match(/(.*)years?.*/)) {number2 = 365 * 30 * 86400;} + return number1 * number2; - } - }, - // set type, either numeric or text - type: 'numeric' - }); + } + }, + // set type, either numeric or text + type: 'numeric' + }); -// make table sortable - $('#tbl').tablesorter({ - cssAsc: 'up', - cssDesc: 'down', - sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' - headers: {3: {sorter: 'dates'}}, - initialized: function() { - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 5; k++) { - mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + // make table sortable + $('#tbl').tablesorter({ + cssAsc: 'up', + cssDesc: 'down', + sortList: [[3, 0],[1, 0],[2, 0]], // in order the table to be sorted by default by column 3 'Modified', then by column 1 'Product/Component' and then by column 2 'Summary' + headers: {3: {sorter: 'dates'}}, + initialized: function() { + var mytable = document.getElementById('tbl'); + for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (var k = 0; k < 5; k++) { + mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; + } } } } - } - }); + }); - log('ALL IS DONE'); - timeEnd('MozillaMercurial'); + log('ALL IS DONE'); + timeEnd('MozillaMercurial'); - }); + }); + } }); @@ -371,13 +425,13 @@ var flag = 1; // bind keypress of ` so that when pressed, the separators between groups of the same timestamps to be removed, in order to sort manually var listener = new window.keypress.Listener(); listener.simple_combo('`', function() { - // console.log('You pressed `'); + // console.log('You pressed `'); if (flag === 1) { flag = 0; - // remove seperators + // remove seperators var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - for (var k = 0; k < 5; k++) { + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + for (let k = 0; k < 5; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = 'none'; } } @@ -386,13 +440,13 @@ listener.simple_combo('`', function() { } else { if (flag === 0) { flag = 1; - // console.log('You pressed ~'); - var sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' + // console.log('You pressed ~'); + sorting = [[3, 0], [1, 0], [2, 0]]; // sort by column 3 'Modified Date, then by '1 'Product/Component' and then by column 2 'Summary' $('#tbl').trigger('sorton', [sorting]); - var mytable = document.getElementById('tbl'); - for (var i = 2, j = mytable.rows.length + 1; i < j; i++) { - if (mytable.rows[i].cells[3].innerHTML != mytable.rows[i - 1].cells[3].innerHTML) { - for (var k = 0; k < 5; k++) { + mytable = document.getElementById('tbl'); + for (let i = 2, j = mytable.rows.length + 1; i < j; i++) { + if (mytable.rows[i].cells[3].innerHTML !== mytable.rows[i - 1].cells[3].innerHTML) { + for (let k = 0; k < 5; k++) { mytable.rows[i - 1].cells[k].style.borderBottom = '1px black dotted'; } } @@ -408,35 +462,37 @@ listener.simple_combo('`', function() { function isRelevant(bug) { if (!bug.id) {return false;} - // if (bug.status && bug.status != 'RESOLVED' && bug.status != 'VERIFIED') { - // log(' IRRELEVANT because of it\'s Status --> ' + bug.status); - // return false; - // } - if (bug.component && bug.product && bug.component == 'Build Config' && (bug.product == 'Toolkit' || bug.product == 'Firefox')) { + // if (bug.status && bug.status !== 'RESOLVED' && bug.status !== 'VERIFIED') { + // log(' IRRELEVANT because of it\'s Status --> ' + bug.status); + // return false; + // } + if (bug.component && bug.product && bug.component === 'Build Config' && (bug.product === 'Toolkit' || bug.product === 'Firefox')) { log(' IRRELEVANT because of it\'s Product --> ' + bug.product + 'having component --> ' + bug.component); return false; } - if (bug.product && bug.product != 'Add-on SDK' && - bug.product != 'Cloud Services' && - bug.product != 'Core' && - bug.product != 'Firefox' && - bug.product != 'Hello (Loop)' && - bug.product != 'Toolkit') { + if (bug.product && + bug.product !== 'Add-on SDK' && + bug.product !== 'Cloud Services' && + bug.product !== 'Core' && + bug.product !== 'Firefox' && + bug.product !== 'Hello (Loop)' && + bug.product !== 'Toolkit') { log(' IRRELEVANT because of it\'s Product --> ' + bug.product); return false; } - if (bug.component && bug.component == 'AutoConfig' || - bug.component == 'Build Config' || - bug.component == 'DMD' || - bug.component == 'Embedding: GRE Core' || - bug.component == 'Embedding: Mac' || - bug.component == 'Embedding: MFC Embed' || - bug.component == 'Embedding: Packaging' || - bug.component == 'Hardware Abstraction Layer' || - bug.component == 'mach' || - bug.component == 'Nanojit' || - bug.component == 'QuickLaunch' || - bug.component == 'Widget: Gonk') { + if (bug.component && + bug.component === 'AutoConfig' || + bug.component === 'Build Config' || + bug.component === 'DMD' || + bug.component === 'Embedding: GRE Core' || + bug.component === 'Embedding: Mac' || + bug.component === 'Embedding: MFC Embed' || + bug.component === 'Embedding: Packaging' || + bug.component === 'Hardware Abstraction Layer' || + bug.component === 'mach' || + bug.component === 'Nanojit' || + bug.component === 'QuickLaunch' || + bug.component === 'Widget: Gonk') { log(' IRRELEVANT because of it\'s Component --> ' + bug.component); return false; } @@ -466,7 +522,6 @@ function timeEnd(str) { } } -// $(function() { $('#dialog').dialog({ modal: false, title: 'Draggable, sizeable dialog', @@ -476,10 +531,10 @@ $('#dialog').dialog({ of: document, collision: 'none' }, - // width: 1500, // not working + // width: 1500, // not working zIndex: 3666 }) - .dialog('widget').draggable('option', 'containment', 'none'); + .dialog('widget').draggable('option', 'containment', 'none'); //-- Fix crazy bug in FF! ... $('#dialog').parent().css({ diff --git a/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js b/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js index 07edf5e..5d7d2fc 100644 --- a/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js +++ b/GitHub_Confirmations_before_submitting_issues_and_comments/GitHub_Confirmations_before_submitting_issues_and_comments.user.js @@ -1,11 +1,13 @@ -// ==UserScript== +// ==UserScript== // @name GitHub - Confirmations before submitting issues and comments // @namespace darkred -// @author darkred +// @version 2017.4.26 // @description Creates a confirmation popup whenever attempting to create an issue or post comment via Ctrl+Enter in GitHub +// @author darkred +// @license MIT // @include https://github.com/* -// @version 2017.4.26 // @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== diff --git a/GitHub_Confirmations_before_submitting_issues_and_comments/README.md b/GitHub_Confirmations_before_submitting_issues_and_comments/README.md index b7a07e9..3c78fa0 100644 --- a/GitHub_Confirmations_before_submitting_issues_and_comments/README.md +++ b/GitHub_Confirmations_before_submitting_issues_and_comments/README.md @@ -12,4 +12,5 @@ i.e. it applies in these 3 cases: - when attempting to submit a new comment (while having focus in the new comment textarea) via Ctrl+Enter
-Thanks to trespassersW for his help [here](https://greasyfork.org/en/forum/discussion/comment/25063/#Comment_25063). + +Thanks to trespassersW for his help [here](https://greasyfork.org/en/discussions/development/55889-script-for-creating-a-confirmation-popup-when-submitting-closing-an-issue-via-ctrl-enter-in-github#comment-145065). diff --git a/Google_youtube_search_link/Google_youtube_search_link.user.js b/Google_youtube_search_link/Google_youtube_search_link.user.js index fd4c0d5..e998740 100644 --- a/Google_youtube_search_link/Google_youtube_search_link.user.js +++ b/Google_youtube_search_link/Google_youtube_search_link.user.js @@ -1,16 +1,24 @@ // ==UserScript== // @name Google YouTube search link -// @description Adds a YouTube search link next to the Videos link (e.g. Web, Images, Videos, YouTube, News, Maps, Shopping, ...) -// @version 2017.6.8 -// @author wOxxOm, darkred // @namespace darkred -// @license MIT License +// @author wOxxOm, darkred +// @license MIT +// @description Adds a YouTube search link next to the Videos link (e.g. Web, Images, Videos, YouTube, News, Maps, Shopping, ...) +// @version 2022.5.27 // @include https://www.google.com/* // @include /https?:\/\/(www\.)?google\.(com|(?:com?\.)?\w\w)\/.*/ // @grant none // @run-at document-start +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +const escapeHTMLPolicy = (({ trustedTypes }, policy) => + trustedTypes + ? trustedTypes.createPolicy('myEscapePolicy', policy) + : policy)(window, { + createHTML: (str) => str, +}); + process(); new MutationObserver(process).observe(document, { childList: true, subtree: true }); @@ -19,15 +27,17 @@ function process(mutations) { if (youtube) return; - var menu = document.querySelector('#hdtb-msb'); // selector for the element that contains all the links (Web, Images, Videos, News, Maps, Shopping, ...) + // Selectors for the bar element that contains all the links (Web, Images, Videos, News, Maps, Shopping, ...) + // '.ndYZfc', is for when the 'Images' tab is selected. The other, '#hdtb', is for all other cases. + var menu = document.querySelector('#hdtb, .ndYZfc'); if (!menu) return; - var menuContainer = menu.querySelector('.hdtb-imb').parentNode; + var menuContainer = menu.querySelector('#hdtb-msb, .tAcEof').parentNode; // '.tAcEof' is for when the 'Images' tab is selected. The other, '#hdtb-msb', is for all other cases. if (!youtube) { var q = '', - queryElement = document.querySelector('input[name="q"]'); // selector for the Google search input textbox + queryElement = document.querySelector('input[name="q"]'); // The google search input textbox if (queryElement) { if (queryElement.value) q = encodeURIComponent(queryElement.value); @@ -42,15 +52,65 @@ function process(mutations) { } }).observe(queryElement, { attributes: true, attributeFilter: ['value'] }); // monitor the textbox for changes (your typed criteria) } - } else if ((q = location.href.match(/^.+?(?:[#\/&?](?:q|query))=(.+?)(?:|&.+|\|.+)$/))) + } else if ((q = location.href.match(/^.+?(?:[#/&?](?:q|query))=(.+?)(?:|&.+|\|.+)$/))) q = q[1]; - var node = document.querySelector(`a[href*='tbm=vid']`); // selector for the 'Videos' link (works in any Google search page language) - var text = '
' + - 'Youtube' + - '
'; - node.parentElement.insertAdjacentHTML('afterend', text); // insert the YouTube link + // Source URL: https://upload.wikimedia.org/wikipedia/commons/c/c9/YouTube_play_buttom_dark_icon_%282013-2017%29.svg + // No change is done to its source code (the only thing applied to it is the CSS below) + var svg = ` + + + + + + + + + + `; + + var text = ''; + + const isVideosTabSelected = !!document.querySelector('.hdtb-mitem.hdtb-msel path[d^="M10 16.5l6-4.5-6-4.5"]'); + var node = isVideosTabSelected === false ? document.querySelector(`a[href*='tbm=vid']`) : document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span').parentNode; + + + // (when the selected/active tab is 'Images') select the 'Images' selected tab svg icon by its path[d] attribute + var imagesTabSelected = !!document.querySelector('path[d^="M14 13l"]').closest('span.rQEFy'); + if (imagesTabSelected) { + text = '' + svg + 'YouTube'; + // select the (next, non-selected/non-active) 'Videos' tab svg icon by its path[d] attribute + node = document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span'); + } + + const escaped = escapeHTMLPolicy.createHTML(text); + node.parentElement.insertAdjacentHTML('afterend', escaped); // insert the YouTube link + } new MutationObserver(process).observe(menuContainer, { childList: true }); } + + +function addCss(cssString) { + var head = document.getElementsByTagName('head')[0]; + var newCss = document.createElement('style'); + newCss.type = 'text/css'; + newCss.innerHTML = escapeHTMLPolicy.createHTML(cssString); + head.appendChild(newCss); +} + +addCss(` + #__YOUTUBE_SEARCH__ svg { + filter: invert(100%); + } +`); diff --git a/Google_youtube_search_link/README.md b/Google_youtube_search_link/README.md index ac822ff..09b6fe2 100644 --- a/Google_youtube_search_link/README.md +++ b/Google_youtube_search_link/README.md @@ -11,7 +11,7 @@ _It doesn't rearrange the rest links (see note)._ i.e. if you type something in google search that looks like you're searching for _images_, -the links will become: +the links will become [2] : `All | Images | Videos | YouTube | etc` If it looks like you're looking for _videos_, the links will become: @@ -29,8 +29,10 @@ And, if you type a _book_ title then the links will become:
-_Note: The initial script was offering:_ -- _either (by default) to re-arrange links so that the Images, Videos, Youtube links to always be on 2nd, 3rd, 4th places, -which was breaking the Google's default tabs order (which takes into account the kind of search criteria that you have entered) -and is removed in this fork._ -- _or to add the YouTube link after all existing links, to the right (with some spacing in between)._ +_Notes:_ +1. The initial script was offering: + - either (by default) to re-arrange links so that the Images, Videos, Youtube links to always be on 2nd, 3rd, 4th places, +_which was breaking the Google's default tabs order (which takes into account the kind of search criteria that you have entered) and is removed in this fork._ + - or to add the YouTube link after all existing links, to the right (with some spacing in between). +2. The script currently no longer works when you are in the 'Images' tab, because the selectors are changed. [TODO] +*see https://github.com/darkred/Userscripts/issues/20#issuecomment-778643921* \ No newline at end of file diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js index 4bae36d..2c4fb41 100644 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js +++ b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages.user.js @@ -1,39 +1,52 @@ -// ==UserScript== +// ==UserScript== // @name GreasyFork - add a 'send PM to user' button in Greasyfork profile pages // @namespace darkred -// @description It adds a 'send PM to user' button in Greasyfork profile pages +// @version 2021.1.22 +// @description Adds a 'send PM to user' button in Greasyfork profile pages (also compatible with Citrus GFork). +// @author darkred +// @license MIT // @include https://greasyfork.org/*/users/* // @include https://greasyfork.org/*/forum/messages/add -// @version 2016.10.03 -// @grant GM_getResourceURL -// @resource icon http://i.imgur.com/ZU0xS0c.jpg +// @include https://sleazyfork.org/*/users/* +// @include https://sleazyfork.org/*/forum/messages/add +// @run-at document-idle +// @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -if (window.location.href.indexOf('users') > -1 // if current URL is a profile page - && document.querySelector('.user-profile-link > a:nth-child(1)').innerHTML != document.querySelector('div.width-constraint:nth-child(2) > h2:nth-child(1)').innerHTML) { // ... and this profile page is not yours - - var profileName = document.querySelector('div.width-constraint:nth-child(2) > h2:nth-child(1)').innerHTML; - sessionStorage.setItem('recipient', profileName); // store in sessionStorage the profileName (it will be inserted in the 'Recipients' textbox ) -after you press the button- - - var referenceNode = document.querySelector('div.width-constraint:nth-child(2) > h2:nth-child(1)'); - var a = document.createElement('input'); - referenceNode.appendChild(a); - - a.style.padding = '0px 12px'; - a.setAttribute('type', 'image'); - a.setAttribute('src', GM_getResourceURL('icon') ); - a.id = 'pmButton'; - a.title = 'Send PM to ' + profileName; - - document.getElementById('pmButton').addEventListener('click', function() { - window.open('https://greasyfork.org/en/forum/messages/add', '_self'); - }); - +var yourProfileNameElement = document.querySelector('.user-profile-link > a:nth-child(1)'); +if (yourProfileNameElement !== null) { + var yourProfileName = yourProfileNameElement.innerHTML; + var yourProfileURL = yourProfileNameElement.href; + // https://greasyfork.org/en/users/2160-darkred + // https://greasyfork.org/en/users/2160-darkred/conversations/new + // https://greasyfork.org/en/users/2160-darkred/conversations/new?other_user=JasonBarnabe + var yourCreateNewConversationURL = yourProfileURL + '/conversations/new' ; } +var targetProfileNameElement = document.querySelector('.text-content > h2'); +if (targetProfileNameElement !== null) { + // var targetProfileName = targetProfileNameElement.firstChild.textContent.replace('\'s Profile', ''); // the .firstChild is for mods profile pages, e.g. https://greasyfork.org/en/users/1-jasonbarnabe , https://greasyfork.org/en/users/2159-woxxom + var targetProfileName = targetProfileNameElement.firstChild.textContent; // the .firstChild is for mods profile pages, e.g. https://greasyfork.org/en/users/1-jasonbarnabe , https://greasyfork.org/en/users/2159-woxxom +} -if (window.location.href.indexOf('messages') > -1) { // if current URL is a 'send PM' page - document.querySelector('#Form_To').innerHTML = sessionStorage.getItem('recipient'); // .. then insert the stored value of 'recipient' in the 'Recipients' textbox +if (window.location.href.indexOf('users') !== -1 // if current URL is a profile page + && yourProfileName !== targetProfileName // ... and this profile page is not yours + && window.location.href !== yourProfileURL + '/conversations' // ... and this profile page is not your conversations page + && window.location.href.indexOf('conversations/new') === -1) { // .. and this page is not a 'Create a new conversation' page + sessionStorage.setItem('recipient', targetProfileName); // store in sessionStorage the profileName (it will be inserted in the 'Recipients' textbox ) -after you press the button- + var a = document.createElement('a'); + targetProfileNameElement.appendChild(a); + a.style.padding = '0px 12px'; + var img = document.createElement('img'); + a.appendChild(img); + // http://i.imgur.com/ZU0xS0c.jpg + img.setAttribute('src', 'data:image/jpeg;base64,/9j/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAATABcDAREAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAABwAICf/EACgQAAEEAQMCBQUAAAAAAAAAAAECAwQFEQAGEgcIEyEiMUEUNmGl4//EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDof1i6ryOlkCHIi0YvlvJdccjpl+A4203x5OAcFFQHMZx7A59skAMDvnyfsj9t/DQPnS/fUnqDtxyxmVQpJbb5YdgGT462jxSoBZ4p4qIWDxIyMjPn5ADTuZg3ibzZN1R0c+7kVf1q0twoy3gh1QZDZcCQfTkFWD5K4lPzoAqDXblqLJq7r+kVoxuFDiXA85AkOQ0KBBKm43h+lR/KylOfSkYGA0f2x0s6m2demdVz6gzLt+W1Gsm1oeCFNM+/IAqwQpPL5450DBoLQWg//9k='); + a.id = 'pmButton'; + a.title = 'Send PM to ' + targetProfileName; + // var yourCreateNewConversationURL = yourProfileURL + '/conversations/new' ; + // https://greasyfork.org/en/users/2160-darkred/conversations/new?other_user=JasonBarnabe + a.href = yourCreateNewConversationURL + '?other_user=' + targetProfileName; } diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md index bb967f5..fb06b0a 100644 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md +++ b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages/README.md @@ -1,12 +1,28 @@ By default you may send a pm via a user's forum profile page (e.g. see link 1). With this script you may also send a pm via user's Greasyfork profile page (e.g. see link 2). + ``` -Forum profile: https://greasyfork.org/en/forum/profile/324/darkred -Greasyfork profile: https://greasyfork.org/en/users/2160-darkred +Forum profile: https://greasyfork.org/en/forum/profile/1/JasonBarnabe +Greasyfork profile: https://greasyfork.org/en/users/1-jasonbarnabe ``` example: -![image](https://i.imgur.com/KPikvlM.jpg) +![](https://i.imgur.com/0pe0Ce2.jpg) + +How it works: + +- By clicking the script's PM icon, the script always gets you to a "Create a new conversation" page (`https://greasyfork.org/en/users/your_username/conversations/new?other_user=target_username`). +- In contrast, by clicking the the site's built-in"Send message" link: + - if you haven't sent any PM before, +it gets you to a "Create a new conversation (`https://greasyfork.org/en/users/your_username/conversations/new?other_user=target_username`) + - if you have send PMs before, +it gets you to a "Conversation with user" page (`https://greasyfork.org/en/users/your_username/conversations/___`) +where all your previous PMs are displayed in the same page, +and you have to scroll down to reach the "Post Reply" form. + +Notes: + +- the button doesn't appear in your own Greasyfork profile page, and it only works when you are logged in, for obvious reasons, +- it is compatible with Citrus GFork. -*Notes: the button doesn't appear in your own Greasyfork profile page, -and it only works when you are logged in, for obvious reasons*. \ No newline at end of file +[Hosted in GitHub](https://github.com/darkred/Userscripts) \ No newline at end of file diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik.user.js b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik.user.js deleted file mode 100644 index 92c88a3..0000000 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik.user.js +++ /dev/null @@ -1,61 +0,0 @@ -// ==UserScript== -// @name GreasyFork - add a 'send PM to user' button in Greasyfork profile pages - for Citrus GFork -// @namespace darkred -// @description It adds a 'send PM to user' button in Greasyfork profile pages -// @include https://greasyfork.org/*/users/* -// @include https://greasyfork.org/*/forum/messages/add -// @version 2016.12.16 -// @grant GM_getResourceURL -// @resource icon http://i.imgur.com/ZU0xS0c.jpg -// @run-at document-idle -// @require https://greasyfork.org/scripts/24818-bililiterange/code/bililiteRange.js -// @require https://code.jquery.com/jquery-3.1.1.min.js -// @require https://greasyfork.org/scripts/24819-jquery-simulate/code/jquery-simulate.js -// @require https://greasyfork.org/scripts/24820-jquery-simulate-ext/code/jquery-simulate-ext.js -// @require https://greasyfork.org/scripts/24822-jquery-simulate-key-sequence-js/code/jquerysimulatekey-sequencejs.js -// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js?version=139586 -// ==/UserScript== - -if (document.querySelector('.user-profile-link > a:nth-child(1)') !== null) { - var yourProfileName = document.querySelector('.user-profile-link > a:nth-child(1)').innerHTML; -} -if (document.querySelector('#user-profile > h1:nth-child(1)') !== null) { - var currentProfileName = document.querySelector('#user-profile > h1:nth-child(1)').textContent.replace('\'s Profile', ''); -} -if (window.location.href.indexOf('users') !== -1 // if current URL is a profile page - && yourProfileName !== currentProfileName) { // ... and this profile page is not yours - sessionStorage.setItem('recipient', currentProfileName); // store in sessionStorage the profileName (it will be inserted in the 'Recipients' textbox ) -after you press the button- - var referenceNode = document.querySelector('#user-profile > h1:nth-child(1)'); - var a = document.createElement('input'); - referenceNode.appendChild(a); - a.style.padding = '0px 12px'; - a.setAttribute('type', 'image'); - a.setAttribute('src', GM_getResourceURL('icon')); - a.id = 'pmButton'; - a.title = 'Send PM to ' + currentProfileName; - var lang = String(window.location).match(/^https:\/\/greasyfork\.org\/([a-zA-Z-]+)\/.*$/)[1]; - document.getElementById('pmButton').addEventListener('click', function() { - window.open('https://greasyfork.org/' + lang + '/forum/messages/add', '_self'); - }); -} - -if (window.location.href.indexOf('messages') !== -1) { // if current URL is a 'send PM' page - document.querySelector('#token-input-Form_To').focus(); - document.querySelector('#token-input-Form_To').style.width = 'auto'; - - // document.querySelector('#token-input-Form_To').value = sessionStorage.getItem('recipient'); - var recipient = sessionStorage.getItem('recipient'); - $('#token-input-Form_To').simulate('key-sequence', { sequence: recipient, delay: 1 }); - - document.arrive('.token-input-selected-dropdown-item', function () { - triggerMouseEvent (document.querySelector('.token-input-selected-dropdown-item'), 'mousedown'); - }); - -} - - -function triggerMouseEvent (node, eventType) { - var clickEvent = document.createEvent ('MouseEvents'); - clickEvent.initEvent (eventType, true, true); - node.dispatchEvent (clickEvent); -} diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/README.md b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/README.md deleted file mode 100644 index cc963c2..0000000 --- a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/README.md +++ /dev/null @@ -1,32 +0,0 @@ -By default you may send a pm via a user's forum profile page (e.g. see link 1). -With this script you may also send a pm via user's Greasyfork profile page (e.g. see link 2). -``` -Forum profile: https://greasyfork.org/en/forum/profile/324/darkred -Greasyfork profile: https://greasyfork.org/en/users/2160-darkred -``` - -example: -![](https://i.imgur.com/LUN73U5.gif) - -*Notes: the button doesn't appear in your own Greasyfork profile page, -and it only works when you are logged in, for obvious reasons*. -
- -**Update 11/12/2016**: -The script was not working ok (because you have to simulate a keypress sequence -with a delay between each press- -in order the username to be "typed" in the autocomplete popup, and so the script to be able to click it, to select it). -I fixed it, but, in order to manage sending this simulated keypress sequence ( 1-line in the script! - line 47) -I have to use the following `require`'s : -- `jQuery`, -- 1 from [bililiteRange](https://github.com/dwachss/bililiteRange), -- 1 from [jquery-simulate](https://github.com/jquery/jquery-simulate) (by jQuery), and -- 2 from [jquery-simulate-ext](https://github.com/j-ulrich/jquery-simulate-ext) . - -The fact that these `require`'s are needed in order by the `jquery-simulate-ext` plugin to work, -is documented here: [https://github.com/j-ulrich/jquery-simulate-ext#usage](https://github.com/j-ulrich/jquery-simulate-ext#usage). - -And, I also use [arrive.js](https://github.com/uzairfarooq/arrive) in the script. - -
- -[Hosted in GitHub](https://github.com/darkred/Userscripts) diff --git a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/ZU0xS0c.jpg b/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/ZU0xS0c.jpg deleted file mode 100644 index 37a95b4..0000000 Binary files a/GreasyFork_-_add_a_send_PM_to_user_button_in_Greasyfork_profile_pages_-_for_Cik/ZU0xS0c.jpg and /dev/null differ diff --git a/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js b/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js index 42e58b0..d9e0fbe 100644 --- a/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js +++ b/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author/GreasyFork_-_filter_discussions_on_scripts_by_review_type_and_author.user.js @@ -1,21 +1,23 @@ -// ==UserScript== +// ==UserScript== // @name GreasyFork - filter discussions on scripts by review type and author // @namespace darkred +// @version 2017.4.19 +// @description Filter discussions on scripts by review type and author via filter buttons, a hoverable dropdown menu or an autocomplete searchbox // @author darkred // @contributor decembre -// @description Filter discussions on scripts by review type and author via filter buttons, a hoverable dropdown menu or an autocomplete searchbox +// @license MIT // @include https://greasyfork.org/*/scripts/*/feedback* // @include https://greasyfork.org/*/users/* -// @version 2017.4.19 // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @grant GM_getResourceText -// @resource jquery-ui.css http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css // @require https://code.jquery.com/jquery-3.1.1.min.js // @require https://code.jquery.com/ui/1.12.1/jquery-ui.min.js +// @resource jquery-ui.css http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css // This is partially based on this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. // Thanks a lot to kuehlschrank for making another great script. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== diff --git a/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js b/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js index 02eac76..e1c5603 100644 --- a/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js +++ b/GreasyFork_-_filter_libraries_in_profiles/GreasyFork_-_filter_libraries_in_profiles.user.js @@ -1,30 +1,36 @@ -// ==UserScript== +// ==UserScript== // @name GreasyFork - filter libraries in profiles // @namespace darkred +// @version 2018.9.6 // @description Filters libraries in GreasyFork profiles +// @author darkred +// @contributor Skej +// @license MIT // @include https://greasyfork.org/*/users/* -// @version 1 +// @require https://code.jquery.com/jquery-3.3.1.min.js // @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -var all = document.querySelectorAll('article').length; -var libraries = document.getElementsByClassName('script-type').length; -var scripts = document.querySelectorAll('article').length - libraries; + +var all = document.querySelectorAll('li[data-script-type="public"], li[data-script-type="library"]').length; +var libraries = document.querySelectorAll('li[data-script-type="library"]').length; +var scripts = all - libraries; var parentElement = document.querySelector('#script-list-sort'); var theFirstChild = parentElement.firstChild; -var div = document.createElement("div"); +var div = document.createElement('div'); parentElement.insertBefore(div, theFirstChild); -div.style.position = "fixed"; -div.style.background = "white"; +div.style.position = 'fixed'; +div.style.background = 'white'; -div.style.top = "150px"; -div.style.right = "287px"; +div.style.top = '150px'; +div.style.right = '287px'; @@ -44,30 +50,27 @@ b.onclick = toggleScripts; var c = document.createElement('a'); div.appendChild(c); -c.innerHTML = '' + 'Libraries: ' + '' + '' + libraries + '' + "
"; +c.innerHTML = '' + 'Libraries: ' + '' + '' + libraries + '' + '
'; c.onclick = toggleLibraries; b.click(); function toggleAll(){ - a.style.fontWeight = "bold"; b.style.fontWeight = "normal"; c.style.fontWeight = "normal"; - $('article').show(); - $('.script-type').parent().parent().show(); + a.style.fontWeight = 'bold'; b.style.fontWeight = 'normal'; c.style.fontWeight = 'normal'; + $('li[data-script-type="public"], li[data-script-type="library"]').show(); } function toggleScripts(){ - a.style.fontWeight = "normal"; b.style.fontWeight = "bold"; c.style.fontWeight = "normal"; - $('article').show(); - $('.script-type').parent().parent().hide(); + a.style.fontWeight = 'normal'; b.style.fontWeight = 'bold'; c.style.fontWeight = 'normal'; + $('li[data-script-type="public"], li[data-script-type="library"]').hide(); + $('li[data-script-type="public"]').show(); } function toggleLibraries(){ - a.style.fontWeight = "normal"; b.style.fontWeight = "normal"; c.style.fontWeight = "bold"; - $('article').hide(); - $('.script-type').parent().parent().show(); - - + a.style.fontWeight = 'normal'; b.style.fontWeight = 'normal'; c.style.fontWeight = 'bold'; + $('li[data-script-type="public"], li[data-script-type="library"]').hide(); + $('li[data-script-type="library"]').show(); } diff --git a/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js b/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js index 3f1b716..2b460d6 100644 --- a/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js +++ b/GreasyFork_Bullshit_Filter/GreasyFork_Bullshit_Filter.user.js @@ -1,207 +1,185 @@ // ==UserScript== // @name GreasyFork Bullshit Filter // @namespace darkred -// @author kuehlschrank, darkred +// @version 2021.3.31 // @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. Applies to posts in Forum too. -// @version 2017.5.18 -// @icon https://s3.amazonaws.com/uso_ss/icon/97145/large.png +// @author kuehlschrank, darkred, valacar, Graphen +// @license MIT +// @icon https://raw.githubusercontent.com/darkred/Userscripts/master/GreasyFork_Bullshit_Filter/large.png +// @include /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts|discussions|users).*$/ +// @exclude /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts\/[\w-]+\/feedback|discussions\/[\d]+|users\/.*\/conversations.*)$/ // @grant none -// @include https://greasyfork.org/*/scripts* -// @exclude /^https:\/\/greasyfork.org\/.*\/scripts\/\d+.*/ -// @exclude https://greasyfork.org/*/scripts/by-site -// @exclude https://greasyfork.org/*/scripts/by-site?* -// @include https://greasyfork.org/*/forum* -// @exclude https://greasyfork.org/*/forum/discussion/* -// @exclude https://greasyfork.org/*/forum/profile* -// @exclude https://greasyfork.org/*/forum/messages* -// @exclude https://greasyfork.org/*/forum/categories -// This is an edited version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. -// Thanks a lot to kuehlschrank for making another great script. +// This is a modified version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. +// Thanks a lot to: +// - kuehlschrank for making another great script, +// - valacar for the refactoring, +// - Graphen for the 'Non-Latin' regex. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -if (window.location.href.indexOf('forum') === -1) { - (function() { - var filters = { - 'Non-ASCII': /[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i - }; - if (typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - - // Note: you may uncomment line 35 (and comment out line 36), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered - function insertStyle() { - var style = document.createElement('style'); - // style.textContent = 'li.filtered { background-color:khaki; !important;} .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.textContent = 'li.filtered { display:none !important; } .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.type = 'text/css'; - document.querySelector('head').appendChild(style); - } +(function() { - function insertStatus() { - var p = document.querySelector('#script-list-option-groups'); - if (p) { - var status = document.createElement('span'); - status.className = 'filter-status'; - p.appendChild(status); - } + const DEBUGGING = 0; + + const filters = { + 'Non-ASCII': /[^\x00-\x7F\s]+/, + 'Non-Latin': /[^\u0000-\u024F\u2000-\u214F\s]+/, + 'Games': /Aimbot|AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Balz|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bloble|Bonk|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epicmafia|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(o|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Krunker|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|MooMoo|MyFreeFarm|narwhale\.io|Neopets|NeoQuest|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|Skribbl|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|Survivio|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|World\s*of\s*Tanks|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium|Yohoho|Zombs/iu, + 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/iu, + 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|(just )?(\ban? |\b)test(ing|s|\d|\b)|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download|theme|(night|dark) ?(mode)?/iu + }; + + const commonCss = ` + .filter-status { + margin-left: 6px; } - function filterScripts() { - var activeFilters = []; - for (var filter in filters) { - if (filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); - } - } - var nodes = document.querySelectorAll('article > h2'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for (var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.parentNode.parentNode.classList.remove('filtered'); - for (var j = 0; j < numActiveFilters; j++) { - if (td.innerText.match(activeFilters[j])) { - td.parentNode.parentNode.classList.add('filtered'); - numFiltered++; - break; - } - } - } - document.querySelector('.filter-status').textContent = document.querySelectorAll('article > h2').length - numFiltered + ' scripts (' + numFiltered + ' filtered)'; + .filter-switches { + display: none; } - function insertSwitches() { - var span = document.createElement('span'); - span.className = 'filter-switches'; - for (var filter in filters) { - if (filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } - } - document.querySelector('.filter-status').parentNode.appendChild(span); + :hover>.filter-switches { + display: block; } - function createSwitch(label, isOn) { - var a = document.createElement('a'); - a.className = isOn ? 'filter-on' : 'filter-off'; - a.textContent = label; - a.addEventListener('click', function(e) { - if (this.className == 'filter-on') { - this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); - } else { - this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); - } - filterScripts(); - e.preventDefault(); - }, false); - return a; + .filter-on, + .filter-off { + display: block; + width: 100px; } - function my_GM_setValue(name, value) { - localStorage.setItem(name, value); + .filter-switches a { + text-decoration: none; + color: inherit; + cursor: pointer; } - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; + .filter-switches a { + margin-left: 8px; + padding: 0 4px; } - })(); -} else { + a.filter-on { + background-color: #ffcccc; + color: #333333; + text-decoration: line-through; + } - (function() { - var filters = { - 'Non-ASCII': /[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i - }; - if (typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; + a.filter-off { + background-color: #ccffcc; + color: #333333; + } + `; + + const isOnForum = /discussions|feedback/.test(window.location.href); + + const site = {}; + if (isOnForum) { + site.css = '.discussion-list-item.filtered { display: none; } .filter-on, .filter-off { color: black; } ' + commonCss; + site.cssDebug = '.discussion-list-item.filtered { background-color: khaki; } ' + commonCss; + site.filterStatusLocation = '.list-option-groups'; + site.itemsToCheck = '.discussion-list-item'; + site.itemType = 'discussions'; + site.removeFilter = function(el) { + el.classList.remove('filtered'); + }; + site.applyFilter = function(el, activeFilter) { + const temp = el.children[1].innerText; + if (temp && temp.match(activeFilter)) { + el.classList.add('filtered'); + return true; + } + return false; + }; + } else { + site.css = 'li.filtered { display: none; } ' + commonCss; + site.cssDebug = 'li.filtered { background-color: khaki; } ' + commonCss; + site.filterStatusLocation = '#script-list-option-groups'; + site.itemsToCheck = 'article > h2'; + site.itemType = 'scripts'; + site.removeFilter = function(el) { + el.parentNode.parentNode.classList.remove('filtered'); + }; + site.applyFilter = function(el, activeFilter) { + if (el.innerText.match(activeFilter)) { + el.parentNode.parentNode.classList.add('filtered'); + return true; + } + return false; + }; } + insertStyle(); insertStatus(); filterScripts(); insertSwitches(); - // Note: you may uncomment line 35 (and comment out line 36), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered function insertStyle() { - var style = document.createElement('style'); - // style.textContent = '.ItemDiscussion.filtered { background-color:khaki !important;} .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } '; - style.textContent = '.ItemDiscussion.filtered { display:none !important; } .filter-status { margin-left: 6px; } .filter-switches { display:none; } *:hover > .filter-switches { display:block !important; } .filter-on, .filter-off {display:block !important; width: 97px;}} .filter-switches a { text-decoration:none !important; color:inherit; cursor:pointer; } .filter-switches a { margin-left: 8px; padding: 0 4px; } a.filter-on { background-color:#ffcccc; color:#333333; text-decoration:line-through !important } a.filter-off { background-color:#ccffcc; color:#333333 } .filter-on, .filter-off { color: black !important;} '; + const style = document.createElement('style'); + style.textContent = DEBUGGING ? site.cssDebug : site.css; style.type = 'text/css'; - document.querySelector('head').appendChild(style); + document.head.appendChild(style); } function insertStatus() { - var p = document.querySelector('#Head'); + const p = document.querySelector(site.filterStatusLocation); if (p) { - var status = document.createElement('span'); + const status = document.createElement('span'); status.className = 'filter-status'; p.appendChild(status); } } function filterScripts() { - var activeFilters = []; - for (var filter in filters) { - if (filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); + const activeFilters = []; + for (let filterType of Object.keys(filters)) { + if (configGetValue(filterType, 'on') === 'on') { + activeFilters.push(filters[filterType]); } } - var nodes = document.querySelectorAll('.ItemDiscussion'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for (var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.classList.remove('filtered'); - for (var j = 0; j < numActiveFilters; j++) { - var temp = td.children[1].firstElementChild.innerText; - if(temp.match(activeFilters[j])) { - td.classList.add('filtered'); + const nodes = document.querySelectorAll(site.itemsToCheck); + let numFiltered = 0; + for (let node of nodes) { + site.removeFilter(node); + for (let activeFilter of activeFilters) { + let filtered = site.applyFilter(node, activeFilter); + if (filtered) { numFiltered++; break; } } } - document.querySelector('.filter-status').innerText = (document.querySelectorAll('.ItemDiscussion').length - numFiltered) + ' discussions (' + numFiltered + ' filtered)'; + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + const numUnfiltered = document.querySelectorAll(site.itemsToCheck).length - numFiltered; + filterStatus.textContent = `${numUnfiltered} ${site.itemType} (${numFiltered} filtered)`; + } } function insertSwitches() { - var span = document.createElement('span'); + const span = document.createElement('span'); span.className = 'filter-switches'; - for (var filter in filters) { - if (filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } + for (let filterType of Object.keys(filters)) { + span.appendChild(createSwitch(filterType, configGetValue(filterType, 'on') === 'on')); + } + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + filterStatus.parentNode.appendChild(span); } - document.querySelector('.filter-status').parentNode.appendChild(span); } function createSwitch(label, isOn) { - var a = document.createElement('a'); + const a = document.createElement('a'); a.className = isOn ? 'filter-on' : 'filter-off'; a.textContent = label; a.addEventListener('click', function(e) { - if (this.className == 'filter-on') { + if (this.className === 'filter-on') { this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); + configSetValue(this.textContent, 'off'); } else { this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); + configSetValue(this.textContent, 'on'); } filterScripts(); e.preventDefault(); @@ -209,20 +187,13 @@ if (window.location.href.indexOf('forum') === -1) { return a; } - function my_GM_setValue(name, value) { + function configSetValue(name, value) { localStorage.setItem(name, value); } - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; + function configGetValue(name, defaultValue) { + const value = localStorage.getItem(name); + return value ? value : defaultValue; } -})(); - - - -} \ No newline at end of file +})(); diff --git a/GreasyFork_Bullshit_Filter/README.md b/GreasyFork_Bullshit_Filter/README.md index 79ce41d..45bca2e 100644 --- a/GreasyFork_Bullshit_Filter/README.md +++ b/GreasyFork_Bullshit_Filter/README.md @@ -3,7 +3,7 @@ i.e. it filters any/all of these 4 categories: * **Games**: scripts for browser games like Kingdoms of Camelot, Mafia Wars and Ikariam * **Social Networks**: scripts for general purpose social networking sites like Facebook, studiVZ and VKontakte * **Non-ASCII**: scripts that use non-English characters in description (accents, umlauts, cyrillic letters, ...) -* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test". +* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test", scripts for themes/dark/night mode (because they are, in effect, userstyles). The filters list appears just below the `#script-list-option-groups` element (i.e. on the right). ![image](https://i.imgur.com/ASbOvvm.gif) @@ -11,4 +11,5 @@ The filters list appears just below the `#script-list-option-groups` element (i. *Note: you may uncomment line 35 (and comment out line 46), in order the filtered scripts to be highlighted khaki -instead of hiding them- so that you can check which scripts have been filtered.* This is a modified version of this script: [userscripts.org Bullshit Filter](http://userscripts-mirror.org/scripts/show/97145) (by kuehlschrank). -Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to valacar for [the refactoring](https://greasyfork.org/en/forum/discussion/42803/refactored). diff --git a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js index 9d89dac..a710d94 100644 --- a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js +++ b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork.user.js @@ -1,362 +1,241 @@ // ==UserScript== // @name GreasyFork Bullshit Filter - for TS Citrus Gfork // @namespace darkred -// @author kuehlschrank, darkred +// @version 2021.3.31 // @description Hides scripts for popular browser games and social networks as well as scripts that use "foreign" characters in descriptions. Applies to posts in Forum too. -// @version 2017.5.18 -// @icon https://s3.amazonaws.com/uso_ss/icon/97145/large.png +// @author kuehlschrank, darkred, valacar, Graphen +// @license MIT +// @icon https://raw.githubusercontent.com/darkred/Userscripts/master/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/large.png +// @include /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts|discussions|users).*$/ +// @exclude /^https:\/\/(greasy|sleazy)fork\.org\/(.*\/)?(scripts\/[\w-]+\/feedback|discussions\/[\d]+|users\/.*\/conversations.*)$/ // @grant none -// @include https://greasyfork.org/*/scripts* -// @exclude /^https:\/\/greasyfork.org\/.*\/scripts\/\d+.*/ -// @exclude https://greasyfork.org/*/scripts/by-site -// @exclude https://greasyfork.org/*/scripts/by-site?* -// @include https://greasyfork.org/*/forum* -// @exclude https://greasyfork.org/*/forum/discussion/* -// @exclude https://greasyfork.org/*/forum/profile* -// @exclude https://greasyfork.org/*/forum/messages* -// @exclude https://greasyfork.org/*/forum/categories // @run-at document-idle -// This is an edited version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. -// Thanks a lot to kuehlschrank for making another great script. +// This is a modified version of this script (http://userscripts-mirror.org/scripts/show/97145) by kuehlschrank. +// Thanks a lot to: +// - kuehlschrank for making another great script, +// - valacar for the refactoring, +// - Graphen for the 'Non-Latin' regex. +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== -if (window.location.href.indexOf('forum') === -1) { - (function() { - var filters = { - 'Non-ASCII':/[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter':/^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i +(function() { + + const DEBUGGING = 0; + + const filters = { + 'Non-ASCII': /[^\x00-\x7F\s]+/, + 'Non-Latin': /[^\u0000-\u024F\u2000-\u214F\s]+/, + 'Games': /Aimbot|AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Balz|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bloble|Bonk|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epicmafia|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(o|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Krunker|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|MooMoo|MyFreeFarm|narwhale\.io|Neopets|NeoQuest|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|Skribbl|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|Survivio|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|World\s*of\s*Tanks|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium|Yohoho|Zombs/iu, + 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/iu, + 'Clutter': /^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|(just )?(\ban? |\b)test(ing|s|\d|\b)|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download|theme|(night|dark) ?(mode)?/iu + }; + + const commonCss = ` + .filter-status { + margin-left: 6px; + position: fixed; + top: calc(0%); + left: calc(13.5%); + color: #787878; + } + .filter-switches { + display: none; + } + *:hover > .filter-switches { + display: block !important; + position: fixed; + top: calc(1.7%); + left: calc(14%); + } + .filter-on, + .filter-off { + display: block !important; + width: 105px; + } + .filter-switches a { + text-decoration: none !important; + color: inherit; + cursor: pointer; + } + .filter-switches a { + margin-left: 8px; + padding: 0 4px; + } + a.filter-on { + background-color: #ea6e6e; + color: #333333; + text-decoration: line-through !important; + } + a.filter-off { + background-color: #6da46b; + color: #333333; + } + `; + + const isOnForum = /discussions|feedback/.test(window.location.href); + + const site = {}; + if (isOnForum) { + site.css = '.discussion-list-item.filtered { display: none; } .filter-on, .filter-off { color: black; } ' + commonCss; + site.cssDebug = '.discussion-list-item.filtered { background-color: khaki !important; } ' + commonCss; + site.filterStatusLocation = '#main-header'; + site.itemsToCheck = '.discussion-list-item'; + site.itemType = 'discussions'; + site.removeFilter = function(el) { + el.classList.remove('filtered'); }; - if(typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } - - - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - - - var target = document.querySelector('#script-table > tbody:nth-child(2)'); - var observer = new MutationObserver((mutations) => { - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - }), - config = { - childList: true, - subtree: true, - }; - observer.observe(target, config); - - - - - - // Note: you may uncomment line 37-81 and comment out line 36, in order the filtered scripts to be highlighted red -instead of hiding them- so that you can check which scripts have been filtered - function insertStyle() { - var style = document.createElement('style'); - // style.textContent = ` tr.filtered td, li.filtered {background-color:khaki !important;} .filter-status {margin-left:6px; position:fixed; top:calc(0%); left:calc(13.5%)} .filter-switches {display:none; position:fixed; top:calc(2.5%); left:calc(14%)} *:hover > .filter-switches {display:block !important; position:fixed; top:calc(2.5%); left:calc(14%)} .filter-on,.filter-off {display:block !important; width:105px}} .filter-switches a {text-decoration:none !important; color:inherit; cursor:pointer} .filter-switches a {margin-left:8px; padding:0 4px} a.filter-on {background-color:#ff6161; color:#333333; text-decoration:line-through !important} a.filter-off {background-color:#97ca97;color:#333333; `; - style.textContent = ` tr.filtered, li.filtered { - display: none !important; - } - .filter-status { - margin-left: 6px; - position: fixed; - top: calc(0%); - left: calc(13.5%); - } - .filter-switches { - display: none; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - *:hover > .filter-switches { - display: block !important; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - .filter-on, - .filter-off { - display: block !important; - width: 105px; - } - } - .filter-switches a { - text-decoration: none !important; - color: inherit; - cursor: pointer; - } - .filter-switches a { - margin-left: 8px; - padding: 0 4px; - } - a.filter-on { - background-color: #ea6e6e; - color: #333333; - text-decoration: line-through !important - } - a.filter-off { - background-color: #6da46b; - color: #333333; - }`; - style.type = 'text/css'; - document.querySelector('head').appendChild(style); - } - - function insertStatus() { - var p = document.querySelector('#main-header'); - if(p) { - var status = document.createElement('span'); - status.className = 'filter-status'; - p.appendChild(status); + site.applyFilter = function(el, activeFilter) { + let temp = el.children[1].innerText; + if(temp && temp.match(activeFilter)) { + el.classList.add('filtered'); + return true; } - } - - function filterScripts() { - var activeFilters = []; - for(var filter in filters) { - if(filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); - } + return false; + }; + } else { // Is in script listings + site.css = 'tr.filtered, li.filtered { display: none; } ' + commonCss; + site.cssDebug = 'tr.filtered td, li.filtered { background-color: khaki !important; } ' + commonCss; + site.filterStatusLocation = '#main-header'; + site.itemsToCheck = `tbody > tr > td > div.thetitle, + #browse-script-list > li`; + site.itemType = 'scripts'; + site.removeFilter = function(el) { + if (window.location.href.indexOf('/libraries') === -1) { + el.parentNode.parentNode.classList.remove('filtered'); + } else { + el.classList.remove('filtered'); } - var nodes = document.querySelectorAll('tbody > tr > td > div.thetitle, #browse-script-list > li'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for(var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { + }; + site.applyFilter = function(el, activeFilter) { + if (window.location.href.indexOf('/libraries') === -1) { + var temp = el.parentNode.firstChild.firstChild.textContent + ' ' + el.parentNode.lastChild.textContent; // store script's name and description (with a space between) to variable 'temp' + } else { + temp = el.getAttribute('data-script-name') + ' ' + el.firstElementChild.firstElementChild.children[3].innerText; + } + if (temp && temp.match(activeFilter)) { if (window.location.href.indexOf('/libraries') === -1) { - td.parentNode.parentNode.classList.remove('filtered'); + el.parentNode.parentNode.classList.add('filtered'); } else { - td.classList.remove('filtered'); - } - for(var j = 0; j < numActiveFilters; j++) { - if (window.location.href.indexOf('/libraries') === -1) { - var temp = td.parentNode.firstChild.firstChild.textContent + ' ' + td.parentNode.lastChild.textContent; // store script's name and description (with a space between) to variable 'temp' - } else { - // temp = td.firstElementChild.firstElementChild.innerText + ' ' + td.firstElementChild.children[3].innerText; - temp = td.getAttribute('data-script-name') + ' ' + td.firstElementChild.firstElementChild.children[3].innerText; - } - if(temp.match(activeFilters[j])) { - if (window.location.href.indexOf('/libraries') === -1) { - td.parentNode.parentNode.classList.add('filtered'); - } else { - td.classList.add('filtered'); - } - numFiltered++; - break; - } + el.classList.add('filtered'); } + return true; } + return false; + }; + } - document.querySelector('.filter-status').textContent = (document.querySelectorAll('tbody > tr > td > div.thetitle, #browse-script-list > li').length - numFiltered) + ' scripts (' + numFiltered + ' filtered)'; - } + insertStyle(); + insertStatus(); + filterScripts(); + insertSwitches(); - function insertSwitches() { - var span = document.createElement('span'); - span.className = 'filter-switches'; - for(var filter in filters) { - if(filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); - } - } - document.querySelector('.filter-status').parentNode.appendChild(span); - } - function createSwitch(label, isOn) { - var a = document.createElement('a'); - a.className = isOn ? 'filter-on' : 'filter-off'; - a.textContent = label; - a.addEventListener('click', function(e) { - if(this.className == 'filter-on') { - this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); - } else { - this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); + if (!isOnForum){ + + const target = document.querySelector('#script-table > tbody:nth-child(2)'); + const observer = new MutationObserver((mutations) => { + insertStyle(); + if (!document.querySelector('.filter-status')){ + insertStatus(); } filterScripts(); - e.preventDefault(); - }, false); - return a; - } - - function my_GM_setValue(name, value) { - localStorage.setItem(name, value); - } - - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; - } - return value; - } - - })(); - - -} else { - + if (!document.querySelector('.filter-switches')){ + insertSwitches(); + } + }), + config = { + childList: true, + subtree: true, + }; + observer.observe(target, config); - (function() { - var filters = { - 'Non-ASCII':/[^\x00-\x7F\s]+/i, - 'Games': /AntiGame|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium/i, - 'Social Networks': /Face\s*book|Google(\+| Plus)|\bHabbo|Kaskus|\bLepra|Leprosorium|MySpace|meinVZ|odnoklassniki|Одноклассники|Orkut|sch(ue|ü)ler(VZ|\.cc)?|studiVZ|Unfriend|Valenth|VK|vkontakte|ВКонтакте|Qzone|Twitter|TweetDeck/i, - 'Clutter':/^\s*(.{1,3})\1+\n|^\s*(.+?)\n+\2\n*$|^\s*.{1,5}\n|do\s*n('|o)?t (install|download)|nicht installieren|just(\s*a)?\s*test|^\s*.{0,4}test.{0,4}\n|\ntest(ing)?\s*|^\s*(\{@|Smolka|Hacks)|\[\d{4,5}\]|free\s*download/i - }; - if(typeof GM_getValue == 'undefined' || (typeof GM_getValue.toString == 'function' && GM_getValue.toString().indexOf('not supported') > -1)) { - GM_getValue = my_GM_getValue; - GM_setValue = my_GM_setValue; - } + } - insertStyle(); - insertStatus(); - filterScripts(); - insertSwitches(); - // Note: you may uncomment line 37-81 and comment out line 36, in order the filtered scripts to be highlighted red -instead of hiding them- so that you can check which scripts have been filtered - function insertStyle() { - var style = document.createElement('style'); - // style.textContent = '.ItemDiscussion.filtered {background-color:khaki !important;} .filter-status {margin-left:6px; position:fixed; top:calc(0%); left:calc(13.5%)} .filter-switches {display:none; position:fixed; top:calc(2.5%); left:calc(14%)} *:hover > .filter-switches {display:block !important; position:fixed; top:calc(2.5%); left:calc(14%)} .filter-on,.filter-off {display:block !important; width:105px}} .filter-switches a {text-decoration:none !important; color:inherit; cursor:pointer} .filter-switches a {margin-left:8px; padding:0 4px} a.filter-on {background-color:#ff6161; color:#333333; text-decoration:line-through !important} a.filter-off {background-color:#97ca97;color:#333333; '; - style.textContent = ` .ItemDiscussion.filtered { - display: none !important; - } - .filter-status { - margin-left: 6px; - position: fixed; - top: calc(0%); - left: calc(13.5%); - } - .filter-switches { - display: none; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - *:hover > .filter-switches { - display: block !important; - position: fixed; - top: calc(2.5%); - left: calc(14%); - } - .filter-on, - .filter-off { - display: block !important; - width: 105px; - } - } - .filter-switches a { - text-decoration: none !important; - color: inherit; - cursor: pointer; - } - .filter-switches a { - margin-left: 8px; - padding: 0 4px; - } - a.filter-on { - background-color: #ea6e6e; - color: #333333; - text-decoration: line-through !important - } - a.filter-off { - background-color: #6da46b; - color: #333333; - }`; - style.type = 'text/css'; - document.querySelector('head').appendChild(style); - } + function insertStyle() { + const style = document.createElement('style'); + style.textContent = DEBUGGING ? site.cssDebug : site.css; + style.type = 'text/css'; + document.head.appendChild(style); + } - function insertStatus() { - var p = document.querySelector('#Head'); - if(p) { - var status = document.createElement('span'); - status.className = 'filter-status'; - p.appendChild(status); - } + function insertStatus() { + const p = document.querySelector(site.filterStatusLocation); + if (p) { + const status = document.createElement('span'); + status.className = 'filter-status'; + p.appendChild(status); } + } - function filterScripts() { - var activeFilters = []; - for(var filter in filters) { - if(filters.hasOwnProperty(filter) && GM_getValue(filter, 'on') == 'on') { - activeFilters.push(filters[filter]); - } - } - var nodes = document.querySelectorAll('.ItemDiscussion'), - numActiveFilters = activeFilters.length, - numFiltered = 0; - for(var i = 0, numNodes = nodes.length, td = null; i < numNodes && (td = nodes[i]); i++) { - td.classList.remove('filtered'); - for(var j = 0; j < numActiveFilters; j++) { - var temp = td.children[1].firstElementChild.innerText; - if(temp.match(activeFilters[j])) { - td.classList.add('filtered'); - numFiltered++; - break; - } - } + function filterScripts() { + const activeFilters = []; + for (let filterType of Object.keys(filters)) { + if (configGetValue(filterType, 'on') === 'on') { + activeFilters.push(filters[filterType]); } - - document.querySelector('.filter-status').innerText = (document.querySelectorAll('.ItemDiscussion').length - numFiltered) + ' discussions (' + numFiltered + ' filtered)'; } - - - - function insertSwitches() { - var span = document.createElement('span'); - span.className = 'filter-switches'; - for(var filter in filters) { - if(filters.hasOwnProperty(filter)) { - span.appendChild(createSwitch(filter, GM_getValue(filter, 'on') == 'on')); + const nodes = document.querySelectorAll(site.itemsToCheck); + let numFiltered = 0; + for (let node of nodes) { + site.removeFilter(node); + for (let activeFilter of activeFilters) { + let filtered = site.applyFilter(node, activeFilter); + if (filtered) { + numFiltered++; + break; } } - document.querySelector('.filter-status').parentNode.appendChild(span); } - - function createSwitch(label, isOn) { - var a = document.createElement('a'); - a.className = isOn ? 'filter-on' : 'filter-off'; - a.textContent = label; - a.addEventListener('click', function(e) { - if(this.className == 'filter-on') { - this.className = 'filter-off'; - GM_setValue(this.textContent, 'off'); - } else { - this.className = 'filter-on'; - GM_setValue(this.textContent, 'on'); - } - filterScripts(); - e.preventDefault(); - }, false); - return a; - } - - function my_GM_setValue(name, value) { - localStorage.setItem(name, value); - } - - function my_GM_getValue(name, defaultValue) { - var value; - if (!(value = localStorage.getItem(name))) { - return defaultValue; + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + const numUnfiltered = document.querySelectorAll(site.itemsToCheck).length - numFiltered; + filterStatus.textContent = `${numUnfiltered} ${site.itemType} (${numFiltered} filtered)`; + } + } + + function insertSwitches() { + const span = document.createElement('span'); + span.className = 'filter-switches'; + for (let filterType of Object.keys(filters)) { + span.appendChild(createSwitch(filterType, configGetValue(filterType, 'on') === 'on')); + } + const filterStatus = document.querySelector('.filter-status'); + if (filterStatus) { + filterStatus.parentNode.appendChild(span); + } + } + + function createSwitch(label, isOn) { + const a = document.createElement('a'); + a.className = isOn ? 'filter-on' : 'filter-off'; + a.textContent = label; + a.addEventListener('click', function(e) { + if (this.className === 'filter-on') { + this.className = 'filter-off'; + configSetValue(this.textContent, 'off'); + } else { + this.className = 'filter-on'; + configSetValue(this.textContent, 'on'); } - return value; - } + filterScripts(); + e.preventDefault(); + }, false); + return a; + } - })(); + function configSetValue(name, value) { + localStorage.setItem(name, value); + } + function configGetValue(name, defaultValue) { + const value = localStorage.getItem(name); + return value ? value : defaultValue; + } -} +})(); diff --git a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md index 88ad243..bce16a8 100644 --- a/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md +++ b/GreasyFork_Bullshit_Filter_-_for_TS_Citrus_Gfork/README.md @@ -3,7 +3,7 @@ i.e. it filters any/all of these 4 categories: * **Games**: scripts for browser games like Kingdoms of Camelot, Mafia Wars and Ikariam * **Social Networks**: scripts for general purpose social networking sites like Facebook, studiVZ and VKontakte * **Non-ASCII**: scripts that use non-English characters in description (accents, umlauts, cyrillic letters, ...) -* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test". +* **Clutter**: obvious spam, titles like "asdasdasd", description = title, title < 6 characters, "just a test", scripts for themes/dark/night mode (because they are, in effect, userstyles). It's the same as [GreasyFork Bullshit Filter](https://greasyfork.org/en/scripts/12179-greasyfork-bull-filter,) now compatible with [TS] Citrus GFork. @@ -14,4 +14,5 @@ Note: you may comment out #49 and uncomment #50 in order to change position of t This is a modified version of this script: [userscripts.org Bullshit Filter](http://userscripts-mirror.org/scripts/show/97145) (by kuehlschrank). -Thanks a lot to kuehlschrank for making another great script. \ No newline at end of file +Thanks a lot to kuehlschrank for making another great script. +Thanks a lot to valacar for [the refactoring](https://greasyfork.org/en/forum/discussion/42803/refactored). diff --git a/IMDb_user_reviews_pages_-_ten_star_ratings/IMDb_user_reviews_pages_-_ten_star_ratings.user.js b/IMDb_user_reviews_pages_-_ten_star_ratings/IMDb_user_reviews_pages_-_ten_star_ratings.user.js new file mode 100644 index 0000000..72af65b --- /dev/null +++ b/IMDb_user_reviews_pages_-_ten_star_ratings/IMDb_user_reviews_pages_-_ten_star_ratings.user.js @@ -0,0 +1,87 @@ +// ==UserScript== +// @name IMDb user reviews pages - ten star ratings +// @namespace darkred +// @version 2018.4.30 +// @description In IMDb user reviews pages, display the ratings with 10 stars, instead of just 1 +// @author darkred +// @license MIT +// @match https://www.imdb.com/title/*/reviews* +// @grant GM_addStyle +// @supportURL https://github.com/darkred/Userscripts/issues +// ==/UserScript== + + + +// Example: +// rating = 9 +// is displayed as: +// 1 star + 9/10 text +// +// Therefore: (1 existing +) 8 more stars needed +// and, if element is larger than 9, i.e. >9, i.e. 10th then blacken it + + +const fillColor = ['#e8e7e7', '#e6e5e5']; // default (almost white --> a bit darker) +// const fillColor = ['#2b2b2b', '#2f2f2f']; // for use with a dark style + + + +function addStars(){ + + let stars = document.querySelectorAll('.ipl-star-icon'); + + for (let i = 0; i < stars.length; i++) { + + if (stars[i].parentNode.children.length !== 12) { // if not already 10-star (+ 2 elements) + + let rating = Number(stars[i].nextElementSibling.textContent); + for (let j = 0; j < 9; j++) { // 9 more stars to each line + let clone = stars[i].cloneNode(true); + stars[i].parentNode.insertBefore(clone, stars[i].nextSibling); // https://stackoverflow.com/questions/11117519/inserting-a-clone-after-the-original + + } + + + for (let j = 0; j < 10; j++) { + + if (j > rating-1 ) { + if (i % 2 === 0){ // https://stackoverflow.com/a/12984254 (odd/even iterations of the loop) + stars[i].parentNode.children[j].children[1].setAttribute('style', 'fill:' + fillColor[0] + ';'); // for use with this style: https://userstyles.org/styles/98447/imdb-com-nightmode ---> OK + } else { + stars[i].parentNode.children[j].children[1].setAttribute('style', 'fill:' + fillColor[1] + ';'); // for use with this style: https://userstyles.org/styles/98447/imdb-com-nightmode ---> OK + } + } + + + } + } + + } + +} + +let CSS = ` + svg.ipl-star-icon { + height: 18px; + width: 18px; + vertical-align: middle !important; + } +`; +GM_addStyle(CSS); + + + +addStars(); + + + + +var observer = new MutationObserver(function() { + addStars(); +}).observe(document.querySelector('div.lister-list'), // target of the observer: the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) + { + // attributes: true, + childList: true, + // characterData: true, + // subtree: true, + }); // config of the observer \ No newline at end of file diff --git a/IMDb_user_reviews_pages_-_ten_star_ratings/README.md b/IMDb_user_reviews_pages_-_ten_star_ratings/README.md new file mode 100644 index 0000000..e24429d --- /dev/null +++ b/IMDb_user_reviews_pages_-_ten_star_ratings/README.md @@ -0,0 +1,12 @@ +This userscript applies to IMDb user reviews pages. It displays the ratings with 10 stars, instead of just 1. +_It also works when you click the 'Load More' button to view more reviews._ + +Screenshot from e.g. https://www.imdb.com/title/tt0076759/reviews +Intial: +![initial](https://i.imgur.com/ApMIFAK.jpg) + +With the script: +![With the script](https://i.imgur.com/Wl0PKtQ.jpg) + +Note: if you use this style: [IMDb.com - Nightmode](https://userstyles.org/styles/98447/imdb-com-nightmode) (like me) then comment out line 22 and uncomment line 29, +in order the extra stars to be almost-black (instead of almost-white). diff --git a/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js b/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js index 1a049ed..3c5be12 100644 --- a/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js +++ b/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js @@ -1,17 +1,38 @@ -// ==UserScript== +// ==UserScript== // @name Instagram - visible images counter // @namespace darkred -// @description Shows (in instagram profile pages) how many images out of total (as a number and as a percentage) are currently visible, as you scroll down the page +// @version 2024.2.23 +// @description Shows in instagram profile pages how many images out of total (as a number and as a percentage) are currently visible, as you scroll down the page. +// @author darkred +// @license MIT // @include https://www.instagram.com/* -// @version 2016.11.18 // @grant none -// @require https://code.jquery.com/jquery-3.0.0.min.js -// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js?version=139586 +// @require https://code.jquery.com/jquery-3.2.1.min.js +// @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== +/* eslint-disable no-console */ +const escapeHTMLPolicy = (({ trustedTypes }, policy) => + trustedTypes + ? trustedTypes.createPolicy('myEscapePolicy', policy) + : policy)(window, { + createHTML: (str) => str, +}); + + +var stylesheet = +``; +$('head').append(stylesheet); +// Not needed anymore +/* // If you scroll down, beyond the first 12 images, then the "LOAD MORE" button(to show more images) will be automatically clicked $(window).scroll(function() { if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) { @@ -19,49 +40,86 @@ $(window).scroll(function() { element.click(); } }); +*/ - +var hrefselems = []; +var hrefs = []; +var total; function showCounter() { - var visibleCount = $( `a[href*='taken-by']` ).length; // Count of visible images - var totalString = $(`span:contains('posts')`).eq(1).children().eq(0).html(); // The 'total' value (it's a string) - var total = totalString.replace(/(\d+),(?=\d{3}(\D|$))/g, '$1'); // Apply regex to 'total' string to strip the thousand comma seperator - if (visibleCount > total){ - visibleCount = total; + + // var totalString = $(`span:contains('posts'):last-child > span, .g47SY`).html(); // The 'total' value (it's a string). The ".g47SY" selector is for localized pages, e.g. https://www.instagram.com/instagram/?hl=de + // var totalString = document.querySelector(`#react-root > section > main > div > header > section > ul > li:nth-child(1) > * > span`).textContent; // The 'total' value (it's a string). The ".g47SY" selector is for localized pages, e.g. https://www.instagram.com/instagram/?hl=de + var totalString = document.querySelector(`[id^=mount_0_0_] section > main > div > header > section > ul > li:nth-child(1) > * > span`).textContent; // The 'total' value (it's a string). The ".g47SY" selector is for localized pages, e.g. https://www.instagram.com/instagram/?hl=de + total = totalString.replace(',', '').replace('.', ''); // strip the thousand comma/dot seperator + + + // hrefselems = document.querySelectorAll(`a[href*='taken-by']`); + // hrefselems = document.querySelectorAll(`._aabd._aa8k._aanf > a`); + // hrefselems = document.querySelectorAll(`._aabd._aa8k._al3l > a`); + hrefselems = document.querySelectorAll(`._aabd._aa8k.x2pgyrj > a`); + $.each(hrefselems, function(index, value) { + // hrefs.indexOf(String(value)) === -1 ? hrefs.push(String(value)) : console.log("This item already exists"); // https://stackoverflow.com/a/36683363 + if (hrefs.indexOf(String(value)) === -1) { // hrefs.count -below- serves as a counter for the newly added displayed images (on each infinite scrolling event) + hrefs.push(String(value)); + } + }); + + var visibleCount = hrefs.length; + + var visiblePercent = ((visibleCount / total) * 100).toFixed(1); // Visible images count as percentage + if (isNaN(visiblePercent)) { + visiblePercent = 0 ; // avoid NaN } - var visiblePercent = ((visibleCount / total) * 100).toFixed(1); // Visible images as percentage + var counter = visibleCount + ' / ' + totalString + ' that is ' + visiblePercent + '%'; return counter; + } -function createDiv(){ +function createDiv() { // Creation of the counter element document.body.appendChild(div); - div.innerHTML = showCounter(); // Initial display of the counter + // div.innerHTML = showCounter(); // Initial display of the counter + div.innerHTML = escapeHTMLPolicy.createHTML(showCounter()); // Initial display of the counter div.style.top = '1px'; div.style.right = '1px'; div.style.position = 'fixed'; + div.className = 'counter'; } -function observer(){ +function createObserver() { + // var thePics = document.querySelector('div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'); + var thePics = document.querySelector('div[style*="flex-direction: column;"], div[style$="padding-top: 0px;"]'); // the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) --> https://stackoverflow.com/a/5110337 ("wildcard * in CSS") starting (^=) with x and ending ($=) with y + if (!thePics){ + return; + } + + hrefselems.length = 0; // empty the array (see https://stackoverflow.com/a/1232046, method #2) + hrefs.length = 0; /// --------------------------------- /// mutation observer -monitors the Posts grid for infinite scrolling event-. /// --------------------------------- - observer1 = new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { - div.innerHTML = showCounter(); // In each infinite scrolling event, re-calculate counter - }); - }).observe($('article').children().eq(1).children()[0], // target of the observer - { - // attributes: true, + observer = new MutationObserver(function() { // --> Callback function to execute when mutations are observed + if (div.innerHTML.indexOf(total + ' / ' + total) === -1) { + // div.innerHTML = showCounter(); // On each infinite scrolling event, re-calculate counter + div.innerHTML = escapeHTMLPolicy.createHTML(showCounter()); // On each infinite scrolling event, re-calculate counter + } + // }).observe(document.querySelector('._havey'), // target of the observer: the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) + // }).observe(document.querySelector('div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'), // target of the observer: the "pics" area element, with rows that contain 3 pics each (watching for 'row' element additions) + }); + + observer.observe(thePics, // target of the observer + { // attributes: true, childList: true, // characterData: true, + // subtree: true, }); // config of the observer } @@ -71,27 +129,88 @@ function observer(){ -var div = document.createElement('div'); // global variable -var observer1; // global variable +var div = document.createElement('div'); +var observer; -if (document.URL !== 'https://www.instagram.com/' && - document.URL.indexOf('https://www.instagram.com/p/') === -1 ){ - createDiv(); - observer(); -} +// var avatarSelector = 'span[style="width: 152px; height: 152px;"]'; // the profile's photo/avatar element +// var avatarSelector = 'main > article > header > section > div._ienqf > div > button'; // the 3-dots icon +// var avatarSelector = 'div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'; // the 3-dots icon +// var avatarSelector = '._mainc'; // the profile's bio area element +// var avatarSelector = 'h1.notranslate'; // the profile name element +// var avatarSelector = 'h1.rhpdm'; // the profile name element +// var avatarSelector = 'span.-nal3'; // the 'posts' count element, e.g. 683 posts +// var avatarSelector = 'ul.k9GMp'; // the profile's 3 counters container element +// var avatarSelector = '.eC4Dz'; // the profile's username container element +// var avatarSelector = '._aa_m'; // the profile's username container element +// var avatarSelector = '._aa_c'; // the profile's username container element +// var avatarSelector = 'main > article > header > section > div._ienqf > div > button'; // the 3-dots icon +// var avatarSelector = 'div[style="flex-direction: column; padding-bottom: 0px; padding-top: 0px;"]'; // the 3-dots icon +var avatarSelector = '.x1q0g3np.x2lah0s.x8j4wrb'; // the 3-dots icon -$(document).arrive('article ._5axto', function() { // 'article .5axto' + +if (document.querySelector(avatarSelector) ) { + if (!document.querySelector('.counter')){ + createDiv(); + createObserver(); + } +} else { + console.log('ERROR: Cannot create the Counter element, the avatarSelector element ( ' + avatarSelector + ' ) doesn\'t exist !!'); +} + + +document.arrive(avatarSelector, function() { // the avatar in the profile page createDiv(); - observer(); + createObserver(); + // alert() }); -$(document).leave('article ._5axto', function() { - if (!document.querySelector('article ._5axto')) { - div.remove(); - observer1.disconnect(); +function removeCounter(){ + div.remove(); + hrefselems.length = 0; // empty the array (see https://stackoverflow.com/a/1232046, method #2) + hrefs.length = 0; + total = ''; + observer.disconnect(); + // if (observer) { + // observer.disconnect(); + // } +} + + +document.leave(avatarSelector, function() { + if (!document.querySelector(avatarSelector)){ + removeCounter(); } }); + + +// when navigating using the browser's back/forth +window.addEventListener('popstate', function () { + // alert() + removeCounter(); + console.log('COUNTER IS REMOVED'); + + // TODO + // createDiv(); + // createObserver(); + +}); + + +// when navigating from a profile to another via searchbox // history API) +// https://stackoverflow.com/questions/56760727/how-to-observe-a-change-in-the-url-using-javascript +(function(){ + var rs = history.pushState; + history.pushState = function(state, title, url){ + if ( !url.includes('/following/') && !url.includes('/followers/') && !url.includes('/p/') && !url.includes('/direct/') && !window.location.href.includes('/p/') ){ // avoid all possible in-page/popup "pages" (a profile's following/followers, and posts -opened by clicking on a thumb-) + rs.apply(history, arguments); // preserve normal functionality + console.log('navigating', arguments); // do something extra here; raise an event + removeCounter(); + // alert() + } + }; +}()); + diff --git a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js index b1319cf..4e57692 100644 --- a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js +++ b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup.user.js @@ -1,11 +1,13 @@ -// ==UserScript== +// ==UserScript== // @name KAT - add APPROVE ALL and APPROVE SELECTED buttons to Feedback popup // @namespace darkred +// @version 2015.12.30 +// @description Adds 'APPROVE ALL' and 'APPROVE SELECTED' buttons inside the 'Torrents awaiting feedback' popup // @author darkred +// @license MIT // @include https://kat.cr/* -// @description Adds 'APPROVE ALL' and 'APPROVE SELECTED' buttons inside the 'Torrents awaiting feedback' popup -// @version 2015.12.30 // @grant none +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== @@ -13,21 +15,21 @@ function approveAll() { - var x = document.getElementsByClassName('ka-thumbs-up'); - for (var i = 2; i < x.length; i++) { - x[i].click(); - } + var x = document.getElementsByClassName('ka-thumbs-up'); + for (var i = 2; i < x.length; i++) { + x[i].click(); + } } function approveSelected() { - var x = document.getElementsByClassName('torrentboxes'); - var y = document.querySelectorAll("table > tbody > tr > td > div > form > div > a > i.ka-thumbs-up "); - for (var i = 0; i < x.length; i++) { + var x = document.getElementsByClassName('torrentboxes'); + var y = document.querySelectorAll('table > tbody > tr > td > div > form > div > a > i.ka-thumbs-up '); + for (var i = 0; i < x.length; i++) { if (x[i].checked){ - y[i].click(); + y[i].click(); } - } + } } @@ -38,72 +40,72 @@ function approveSelected() { document.querySelector('.showFeedback > a').addEventListener('click', function() { - new MutationObserver(function(mutations, observer) { - if (document.querySelector('#fancybox-wrap') ) { - observer.disconnect(); - console.log('TRUE'); + new MutationObserver(function(mutations, observer) { + if (document.querySelector('#fancybox-wrap') ) { + observer.disconnect(); + console.log('TRUE'); - // add button "APPROVE SELECTED" - var parentElement = document.querySelector('div.buttonsline:nth-child(10)'); - var theFirstChild = parentElement.firstChild; - var button1 = document.createElement('BUTTON'); - parentElement.insertBefore(button1, theFirstChild); - button1.id = 'mybutton1'; - button1.innerHTML = 'APPROVE SELECTED'; - button1.className = 'siteButton bigButton'; + // add button "APPROVE SELECTED" + var parentElement = document.querySelector('div.buttonsline:nth-child(10)'); + var theFirstChild = parentElement.firstChild; + var button1 = document.createElement('BUTTON'); + parentElement.insertBefore(button1, theFirstChild); + button1.id = 'mybutton1'; + button1.innerHTML = 'APPROVE SELECTED'; + button1.className = 'siteButton bigButton'; - button1.addEventListener('click', function() { - approveSelected(); - // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. - }); + button1.addEventListener('click', function() { + approveSelected(); + // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. + }); - // add button "APPROVE ALL" - parentElement = document.querySelector('div.buttonsline:nth-child(10)'); - theFirstChild = parentElement.firstChild; - var button2 = document.createElement('BUTTON'); - parentElement.insertBefore(button2, theFirstChild); - button2.id = 'mybutton2'; - button2.innerHTML = 'APPROVE ALL'; - button2.className = 'siteButton bigButton'; - button2.style = 'margin-right: 4px'; + // add button "APPROVE ALL" + parentElement = document.querySelector('div.buttonsline:nth-child(10)'); + theFirstChild = parentElement.firstChild; + var button2 = document.createElement('BUTTON'); + parentElement.insertBefore(button2, theFirstChild); + button2.id = 'mybutton2'; + button2.innerHTML = 'APPROVE ALL'; + button2.className = 'siteButton bigButton'; + button2.style = 'margin-right: 4px'; - button2.addEventListener('click', function() { - approveAll(); - document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. - }); + button2.addEventListener('click', function() { + approveAll(); + document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. + }); - // add button "DISCARD ALL" - parentElement = document.querySelector('button.siteButton:nth-child(3)'); - theFirstChild = parentElement.firstChild; - var button3 = document.createElement('BUTTON'); - parentElement.parentNode.insertBefore(button3, theFirstChild.nextSibling); - button3.id = 'mybutton3'; - button3.innerHTML = 'DISCARD ALL'; - button3.className = 'siteButton bigButton'; + // add button "DISCARD ALL" + parentElement = document.querySelector('button.siteButton:nth-child(3)'); + theFirstChild = parentElement.firstChild; + var button3 = document.createElement('BUTTON'); + parentElement.parentNode.insertBefore(button3, theFirstChild.nextSibling); + button3.id = 'mybutton3'; + button3.innerHTML = 'DISCARD ALL'; + button3.className = 'siteButton bigButton'; - button3.addEventListener('click', function() { - document.querySelector('th.lasttd:nth-child(1) > input:nth-child(1)').click(); - document.querySelector('button.siteButton:nth-child(3)').click(); - // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. - }); + button3.addEventListener('click', function() { + document.querySelector('th.lasttd:nth-child(1) > input:nth-child(1)').click(); + document.querySelector('button.siteButton:nth-child(3)').click(); + // document.querySelector('#fancybox-close').click(); // uncomment this line to also close the popup after approving all torrents. + }); - } - }).observe( - document.querySelector('#fancybox-wrap'), { - attributes: true, - attributeFilter: ['style'], - } - ); + } + }).observe( + document.querySelector('#fancybox-wrap'), { + attributes: true, + attributeFilter: ['style'], + } + ); diff --git a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md index 351db6c..2d7111f 100644 --- a/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md +++ b/KAT_-_add_APPROVE_ALL_and_APPROVE_SELECTED_buttons_to_Feedback_popup/README.md @@ -5,5 +5,4 @@ _(by default it only has `DISCARD SELECTED`)_ _Note: You may uncomment lines 59, 76 and/or 94 to also close the popup after approving all/selected torrents._ -
Thanks to wOxxOm for his help in [here](http://stackoverflow.com/questions/34072802/insertbefore-enclosed-in-addeventlistener-click-and-called-via-mutationobserv). \ No newline at end of file diff --git a/Markdown_toolbar_for_GreasyFork/66x40-solid.png b/Markdown_toolbar_for_GreasyFork/66x40-solid.png new file mode 100644 index 0000000..579b9e0 Binary files /dev/null and b/Markdown_toolbar_for_GreasyFork/66x40-solid.png differ diff --git a/Markdown_toolbar_for_GreasyFork/Markdown_toolbar_for_GreasyFork.user.js b/Markdown_toolbar_for_GreasyFork/Markdown_toolbar_for_GreasyFork.user.js new file mode 100644 index 0000000..e8b43ac --- /dev/null +++ b/Markdown_toolbar_for_GreasyFork/Markdown_toolbar_for_GreasyFork.user.js @@ -0,0 +1,352 @@ +// ==UserScript== +// @name Markdown toolbar for GreasyFork +// @name:ru Markdown-тулбар для GreasyFork +// @name:zh-CN GreasyFork markdown +// @namespace darkred +// @version 2.0.4 +// @description Select Markdown format by default, add help links, add toolbar formatting buttons for markdown +// @description:ru Включает формат Markdown по умолчанию, добавляет справочные ссылки по форматам, добавляет панель кнопок форматирования markdown +// @description:zh-CN 在论坛默认使用 Markdown 格式,添加格式帮助链接及 Markdown 工具栏 +// @author wOxxOm, darkred +// @contributor JixunMoe +// @license MIT +// @icon https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/66x40-solid.png +// @include https://greasyfork.org/*discussions/* +// @include https://greasyfork.org/*scripts/*/versions/new* +// @include https://greasyfork.org/*scripts/*/feedback* +// @include https://greasyfork.org/*script_versions/new* +// @include https://greasyfork.org/*/conversations/* +// @include https://greasyfork.org/*/users/edit +// @grant GM_addStyle +// @run-at document-start +// @supportURL https://github.com/darkred/Userscripts/issues +// ==/UserScript== + + +// Example URLS to test: +// https://greasyfork.org/en/discussions/new +// https://greasyfork.org/en/scripts/422887-markdown-toolbar-for-greasyfork/discussions/78139 +// https://greasyfork.org/en/scripts/23493/versions/new +// https://greasyfork.org/en/scripts/422445-github-watcher/feedback +// https://greasyfork.org/en/users/2160-darkred/conversations/new +// https://greasyfork.org/en/users/edit + + + + + +var inForum = location.href.indexOf('/discussions') > 0; +var inPostNewScriptVer = location.href.indexOf('/versions/new') > 0; + + +// Native $("selector:contains('text')"); https://github.com/nefe/You-Dont-Need-jQuery#1.12 +function contains(selector, text) { + var elements = document.querySelectorAll(selector); + return Array.from(elements).filter(function(element) { + return RegExp(text).test(element.textContent); + }); +} + + +window.addEventListener('DOMContentLoaded', function(e) { + + // var refElements = contains('.label-note', '(See allowed code)' ); + var refElements = document.querySelectorAll(` + input[name="authenticity_token"] + .label-note, + + label[for="script-version-additional-info-0"] + .label-note, + label[for="changelog"] + .label-note, + + label[for="conversation_messages_attributes_0_content"] + .label-note, + + label[for="user_profile"] + .label-note, + + form > .label-note + `); + + if (inForum){ + + refElements.forEach(element => {element.insertAdjacentHTML('beforeend','
'); addFeatures(element); }); + + } + else { // not in Forum + + // This page has 2 non-code textareas: 'Additional info' and 'Changelog' + if (inPostNewScriptVer) { + + refElements.forEach(element => { addFeatures(element.appendChild(document.createElement('br'))); }); + + } else { // every other page + + + if (nn = document.querySelectorAll('input[value="markdown"]')) { + for (var n, i=0; (i?' ; + n.insertAdjacentHTML('beforeend', + ' (?)'); + // if (location.href.indexOf('/forum/messages/') > -1) + if (location.href.indexOf('/conversations/') > -1) + GM_addStyle('#ConversationForm label { display:inline-block; margin-right:2ex }\ + #ConversationForm .TextBox { margin-top:0 }'); +*/ +// ------------------------------------------------------------------ + + + GM_addStyle('\ + .Button {\ + display: inline-block;\ + cursor: pointer;\ + margin: 0px;\ + font-size: 12px;\ + line-height: 1;\ + font-weight: bold;\ + padding: 4px 6px;\ + background: -moz-linear-gradient(center bottom , #CCC 0%, #FAFAFA 100%) repeat scroll 0% 0% #F8F8F8;\ + border: 1px solid #999;\ + border-radius: 2px;\ + white-space: nowrap;\ + text-shadow: 0px 1px 0px #FFF;\ + box-shadow: 0px 1px 0px #FFF inset, 0px -1px 2px #BBB inset;\ + color: #333;}' + ); + + + + + + + // add buttons + // debugger + btnMake(n, ''+__('B')+'', __('Bold'), '**'); + btnMake(n, ''+__('I')+'', __('Italic'), '*'); + btnMake(n, ''+__('U')+'', __('Underline'), '',''); + btnMake(n, ''+__('S')+'', __('Strikethrough'), '',''); + btnMake(n, '<br>', __('Force line break'), '
','', true); + btnMake(n, '---', __('Horizontal line'), '\n\n---\n\n', '', true); + btnMake(n, __('URL'), __('Add URL to selected text'), + function(e) { + try {edWrapInTag('[', ']('+prompt(__('URL')+':')+')', edInit(e.target))} + catch(ex) {} + }); + btnMake(n, __('Image (https)'), __('Convert selected https://url to inline image'), '!['+__('image')+'](', ')'); + if (inForum) + btnMake(n, __('Table'), __('Insert table template'), __('\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n'), '', true); + btnMake(n, __('Code'), __('Apply CODE markdown to selected text'), + function(e){ + var ed = edInit(e.target); + if (ed.sel.indexOf('\n') < 0) + edWrapInTag('`', '`', ed); + else + edWrapInTag(((ed.sel1==0) || (ed.text.charAt(ed.sel1-1) == '\n') ? '' : '\n') + '```' + (ed.sel.charAt(0) == '\n' ? '' : '\n'), + (ed.sel.substr(-1) == '\n' ? '' : '\n') + '```' + (ed.text.substr(ed.sel2,1) == '\n' ? '' : '\n'), + ed); + }); + + + + + + var allPreviewTabs = contains('.preview-tab', 'Preview' ); + allPreviewTabs.forEach(element => { element.onclick = function(event) { + let target = event.target; // delegation: where was the click? + if (target.tagName !== 'A' && target.tagName !== 'SPAN') {return} + // console.log(element.closest('.label-note') ) + form.querySelectorAll('.Button').forEach(element2 => element2.style.display = 'none'); + } } ); + + var allWriteTabs = contains('.write-tab', 'Write' ); + allWriteTabs.forEach(element => { element.onclick = function(event) { + let target = event.target; // where was the click? + if (target.tagName !== 'A' && target.tagName !== 'SPAN') {return} + form.querySelectorAll('.Button').forEach(element2 => element2.style.display = 'inline-block'); + } }); + + + + + +} + + + + +function btnMake(afterNode, label, title, tag1_or_cb, tag2, noWrap) { + var a = document.createElement('a'); + a.className = 'Button'; + a.innerHTML = label; + a.title = title; + // if (inForum) + // a.style.setProperty('float','right'); + a.addEventListener('click', + typeof(tag1_or_cb) == 'function' ? tag1_or_cb : // if + noWrap ? function(e){edInsertText(tag1_or_cb, edInit(e.target))} : // else if + function(e){edWrapInTag(tag1_or_cb, tag2, edInit(e.target))} // else + ); + + + var nparent; + inForum ? nparent = afterNode : nparent = afterNode.parentNode; + a.textAreaNode = nparent.textAreaNode || nparent.parentNode.querySelector('textArea');; + nparent.appendChild(a); +} + + + + +function edInit(btn) { + var ed = {node: btn.textAreaNode || btn.parentNode.textAreaNode}; + ed.sel1 = ed.node.selectionStart; + ed.sel2 = ed.node.selectionEnd, + ed.text = ed.node.value; + ed.sel = ed.text.substring(ed.sel1, ed.sel2); + return ed; +} + +function edWrapInTag(tag1, tag2, ed) { + ed.node.value = ed.text.substr(0, ed.sel1) + tag1 + ed.sel + (tag2?tag2:tag1) + ed.text.substr(ed.sel2); + ed.node.setSelectionRange(ed.sel1 + tag1.length, ed.sel1 + tag1.length + ed.sel.length); + ed.node.focus(); +} + +function edInsertText(text, ed) { + ed.node.value = ed.text.substr(0, ed.sel2) + text + ed.text.substr(ed.sel2); + ed.node.setSelectionRange(ed.sel2 + text.length, ed.sel2 + text.length); + ed.node.focus(); +} + +var __ = (function (l, langs) { + var lang = langs[l] || langs[l.replace(/-.+/, '')]; + return lang ? function (text) { return lang[text] || text; } + : function (text) { return text }; // No matching language, fallback to english +})(location.pathname.match(/^\/(.+?)\//)[1], { + // Can be full name, or just the beginning part. + 'zh-CN': { + 'Bold': '粗体', + 'Italic': '斜体', + 'Underline': '下划线', + 'Strikethrough': '删除线', + 'Force line break': '强制换行', + 'Horizontal line': '水平分割线', + 'URL': '链接', + 'Add URL to selected text': '为所选文字添加链接', + 'Image (https)': '图片 (https)', + 'Convert selected https://url to inline image': '将所选地址转换为行内图片', + 'image': '图片描述', // Default image alt value + 'Table': '表格', + 'Insert table template': '插入表格模板', + 'Code': '代码', + 'Apply CODE markdown to selected text': '将选中代码围起来', + + '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n': + '\n| 表头 1 | 表头 2 |\n|-------|-------|\n| 表格 1 | 表格 2 |\n| 表格 3 | 表格 4 |\n' + }, + 'ru': { + 'B': 'Ж', + 'I': 'К', + 'U': 'Ч', + 'S': 'П', + 'Bold': 'Жирный', + 'Italic': 'Курсив', + 'Underline': 'Подчеркнутый', + 'Strikethrough': 'Перечеркнутый', + 'Force line break': 'Новая строка', + 'Horizontal line': 'Горизонтальная линия', + 'URL': 'ссылка', + 'Add URL to selected text': 'Добавить ссылку к выделенному тексту', + 'Image (https)': 'Картинка (https)', + 'Convert selected https://url to inline image': 'Преобразовать выделенный https:// адрес в картинку', + 'image': 'картинка', // Default image alt value + 'Table': 'Таблица', + 'Insert table template': 'Вставить шаблон таблицы', + 'Code': 'Код', + 'Apply CODE markdown to selected text': 'Пометить выделенный фрагмент как программный код', + + '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n': + '\n| заголовок1 | заголовок2 |\n|-------|-------|\n| ячейка1 | ячейка2 |\n| ячейка3 | ячейка4 |\n' + }, + 'fr': { + 'B': 'G', + 'I': 'I', + 'U': 'S', + 'S': 'B', + 'Bold': 'Gras', + 'Italic': 'Italique', + 'Underline': 'Souligné', + 'Strikethrough': 'Barré', + 'Force line break': 'Forcer le saut de ligne', + 'Horizontal line': 'Ligne horizontale', + 'URL': 'URL', + 'Add URL to selected text': 'Ajouter URL au texte sélectionné', + 'Image (https)': 'Image (https)', + 'Convert selected https://url to inline image': 'Convertir https://url sélectionnés en images', + 'image': 'image', // Default image alt value + 'Table': 'Tableau', + 'Insert table template': 'Insérer un modèle de table', + 'Code': 'Code', + 'Apply CODE markdown to selected text': 'Appliquer CODE markdown au texte sélectionné', + + '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n': + '\n| En-tête 1 | En-tête 2 |\n|-------|-------|\n| cellule 1 | cellule 2 |\n| cellule 3 | cellule 4 |\n' + } +}); diff --git a/Markdown_toolbar_for_GreasyFork/README.md b/Markdown_toolbar_for_GreasyFork/README.md new file mode 100644 index 0000000..55a668e --- /dev/null +++ b/Markdown_toolbar_for_GreasyFork/README.md @@ -0,0 +1,29 @@ +The script is a modified version of by wOxxOm, to work with the new GF layout. +Thanks to wOxxOm for offering the initial versions. + +* Common formatting buttons (markdown only) +* (forum) HTML & markdown formatting help links +* CODE markdown button that wraps selected text in \` or \``` if multiple lines are selected. +* MARKDOWN format by default for new comments - also can be set in your profile settings. + +Tested on Chrome/Firefox with Tampermonkey/Violentmonkey *(Greasemonkey is not supported)*. + +Screenshots: + +
+Forum + +![](https://i.imgur.com/lxFoQBs.jpg) ![](https://i.imgur.com/9CLLAzV.jpg) +
+ +
+Publish script | Info + +![](https://i.imgur.com/poPEKZ3.jpg) +
+ +
+Conversations/pm + +![](https://i.imgur.com/VZ4clqQ.jpg) +
\ No newline at end of file diff --git a/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js b/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js index bd546c8..4d9a6ef 100644 --- a/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js +++ b/Markdown_toolbar_for_reddit.com/Markdown_toolbar_for_redditcom.user.js @@ -1,18 +1,22 @@ -// ==UserScript== +// ==UserScript== // @name Markdown toolbar for reddit.com // @namespace darkred +// @version 1.4.1 +// @description Creates a Markdown toolbar whenever you make/edit text posts or comments in reddit.com // @author wOxxOm, darkred -// @description Creates a Markdown toolbar whenever you make/edit text posts or comments in reddit.com. +// @license MIT // @include https://www.reddit.com/*submit* +// @include https://old.reddit.com/*submit* // @include https://www.reddit.com/*comments* -// @icon https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/66x40-solid.png -// @version 1.3 +// @include https://old.reddit.com/*comments* // @grant GM_addStyle +// @icon https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/66x40-solid.png // // // This is a modified version of the script "Markdown toolbar for GreasyFork and UserStyles.org" ()https://greasyfork.org/en/scripts/6779-markdown-toolbar-for-greasyfork-and-userstyles-org) // Thanks a lot to wOxxOm for making that script. // +// @supportURL https://github.com/darkred/Userscripts/issues // ==/UserScript== @@ -20,18 +24,18 @@ var x; // IF IT'S A SUBMIT PAGE if (window.location.href.indexOf('submit') > - 1) { - // THEN ADD TOOLBAR TO THE 'NEW POST' TEXTBOX - x = document.querySelectorAll('div.md > textarea:nth-child(1)')[0].parentNode; - addFeatures(x); + // THEN ADD TOOLBAR TO THE 'NEW POST' TEXTBOX + x = document.querySelectorAll('div.md > textarea:nth-child(1)')[0].parentNode; + addFeatures(x); } else { - var textareas = document.querySelectorAll('textarea'); + var textareas = document.querySelectorAll('textarea'); - // ADD TOOLBAR: TO EDITING YOUR POST, TO 'NEW COMMENT' FORM AND TO EDITING YOUR EXISTING COMMENT(S) - for (i = 0; i < textareas.length - 2; i++) { - x = document.querySelectorAll('textarea') [i].parentNode; - addFeatures(x); - } + // ADD TOOLBAR: TO EDITING YOUR POST, TO 'NEW COMMENT' FORM AND TO EDITING YOUR EXISTING COMMENT(S) + for (var i = 0; i < textareas.length; i++) { + x = document.querySelectorAll('textarea') [i].parentNode; + addFeatures(x); + } } @@ -40,96 +44,96 @@ else { function addFeatures(n) { - n.parentNode.textAreaNode = x.firstChild; - - GM_addStyle('\ - .Button {\ - display: inline-block;\ - cursor: pointer;\ - margin: 0px;\ - font-size: 12px;\ - line-height: 1;\ - font-weight: bold;\ - padding: 4px 6px;\ - background: -moz-linear-gradient(center bottom , #CCC 0%, #FAFAFA 100%) repeat scroll 0% 0% #F8F8F8;\ - border: 1px solid #999;\ - border-radius: 2px;\ - white-space: nowrap;\ - text-shadow: 0px 1px 0px #FFF;\ - box-shadow: 0px 1px 0px #FFF inset, 0px -1px 2px #BBB inset;\ - color: #333;}'); - - - // add buttons - btnMake(n, 'B', 'Bold', '**'); - btnMake(n, 'I', 'Italic', '*'); - // btnMake(n, 'U', 'Underline', '',''); - // btnMake(n, 'S', 'Strikethrough', '',''); - btnMake(n, 'S', 'Strikethrough', '~~'); - btnMake(n, '^', 'Superscript', '^','', true); - btnMake(n, '\\n', 'Line break', ' \n', '', true); - btnMake(n, '---', 'Horizontal line', '\n\n---\n\n', '', true); - btnMake(n, 'URL', 'Add URL to selected text', - function(e) { - try {edWrapInTag('[', ']('+prompt('URL'+':')+')', edInit(e.target))} - catch(e) {}; - }); - // btnMake(n, 'Image', 'Convert selected https://url to inline image', '!['+'image'+'](', ')'); - btnMake(n, 'Table', 'Insert table template', '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n', '', true); - btnMake(n, 'Code', 'Apply CODE markdown to selected text', - function(e){ - var ed = edInit(e.target); - if (ed.sel.indexOf('\n') < 0) - edWrapInTag('`', '`', ed); - else - edWrapInTag(((ed.sel1==0) || (ed.text.charAt(ed.sel1-1) == '\n') ? '' : '\n') + '```' + (ed.sel.charAt(0) == '\n' ? '' : '\n'), - (ed.sel.substr(-1) == '\n' ? '' : '\n') + '```' + (ed.text.substr(ed.sel2,1) == '\n' ? '' : '\n'), - ed); - }); + n.parentNode.textAreaNode = x.firstChild; + + GM_addStyle('\ + .Button {\ + display: inline-block;\ + cursor: pointer;\ + margin: 0px;\ + font-size: 12px;\ + line-height: 1;\ + font-weight: bold;\ + padding: 4px 6px;\ + background: -moz-linear-gradient(center bottom , #CCC 0%, #FAFAFA 100%) repeat scroll 0% 0% #F8F8F8;\ + border: 1px solid #999;\ + border-radius: 2px;\ + white-space: nowrap;\ + text-shadow: 0px 1px 0px #FFF;\ + box-shadow: 0px 1px 0px #FFF inset, 0px -1px 2px #BBB inset;\ + color: #333;}'); + + + // add buttons + btnMake(n, 'B', 'Bold', '**'); + btnMake(n, 'I', 'Italic', '*'); + // btnMake(n, 'U', 'Underline', '',''); + // btnMake(n, 'S', 'Strikethrough', '',''); + btnMake(n, 'S', 'Strikethrough', '~~'); + btnMake(n, '^', 'Superscript', '^','', true); + btnMake(n, '\\n', 'Line break', ' \n', '', true); + btnMake(n, '---', 'Horizontal line', '\n\n---\n\n', '', true); + btnMake(n, 'URL', 'Add URL to selected text', + function(e) { + try {edWrapInTag('[', ']('+prompt('URL'+':')+')', edInit(e.target));} + catch(e) {} + }); + // btnMake(n, 'Image', 'Convert selected https://url to inline image', '!['+'image'+'](', ')'); + btnMake(n, 'Table', 'Insert table template', '\n| head1 | head2 |\n|-------|-------|\n| cell1 | cell2 |\n| cell3 | cell4 |\n', '', true); + btnMake(n, 'Code', 'Apply CODE markdown to selected text', + function(e){ + var ed = edInit(e.target); + if (ed.sel.indexOf('\n') < 0) + edWrapInTag('`', '`', ed); + else + edWrapInTag(((ed.sel1==0) || (ed.text.charAt(ed.sel1-1) == '\n') ? '' : '\n') + '```' + (ed.sel.charAt(0) == '\n' ? '' : '\n'), + (ed.sel.substr(-1) == '\n' ? '' : '\n') + '```' + (ed.text.substr(ed.sel2,1) == '\n' ? '' : '\n'), + ed); + }); } function btnMake(afterNode, label, title, tag1, tag2, noWrap) { - var a = document.createElement('a'); - a.className = 'Button'; - a.innerHTML = label; - a.title = title; - a.style.setProperty('float','right'); - - a.addEventListener('click', - typeof(tag1) == 'function' - ? tag1 - : noWrap ? function(e){edInsertText(tag1, edInit(e.target))} - : function(e){edWrapInTag(tag1, tag2, edInit(e.target))}); - - var nparent = afterNode.parentNode; - a.textAreaNode = nparent.textAreaNode; - nparent.insertBefore(a, nparent.firstElementChild); + var a = document.createElement('a'); + a.className = 'Button'; + a.innerHTML = label; + a.title = title; + a.style.setProperty('float','right'); + + a.addEventListener('click', + typeof(tag1) === 'function' + ? tag1 + : noWrap ? function(e){edInsertText(tag1, edInit(e.target));} + : function(e){edWrapInTag(tag1, tag2, edInit(e.target));}); + + var nparent = afterNode.parentNode; + a.textAreaNode = nparent.textAreaNode; + nparent.insertBefore(a, nparent.firstElementChild); } function edInit(btn) { - var ed = {node: btn.parentNode.textAreaNode } ; + var ed = {node: btn.parentNode.textAreaNode } ; - ed.sel1 = ed.node.selectionStart; - ed.sel2 = ed.node.selectionEnd, - ed.text = ed.node.value; - ed.sel = ed.text.substring(ed.sel1, ed.sel2); - return ed; + ed.sel1 = ed.node.selectionStart; + ed.sel2 = ed.node.selectionEnd, + ed.text = ed.node.value; + ed.sel = ed.text.substring(ed.sel1, ed.sel2); + return ed; } function edWrapInTag(tag1, tag2, ed) { - ed.node.value = ed.text.substr(0, ed.sel1) + tag1 + ed.sel + (tag2?tag2:tag1) + ed.text.substr(ed.sel2); - ed.node.setSelectionRange(ed.sel1 + tag1.length, ed.sel1 + tag1.length + ed.sel.length); - ed.node.focus(); + ed.node.value = ed.text.substr(0, ed.sel1) + tag1 + ed.sel + (tag2?tag2:tag1) + ed.text.substr(ed.sel2); + ed.node.setSelectionRange(ed.sel1 + tag1.length, ed.sel1 + tag1.length + ed.sel.length); + ed.node.focus(); } function edInsertText(text, ed) { - ed.node.value = ed.text.substr(0, ed.sel2) + text + ed.text.substr(ed.sel2); - ed.node.setSelectionRange(ed.sel2 + text.length, ed.sel2 + text.length); - ed.node.focus(); + ed.node.value = ed.text.substr(0, ed.sel2) + text + ed.text.substr(ed.sel2); + ed.node.setSelectionRange(ed.sel2 + text.length, ed.sel2 + text.length); + ed.node.focus(); } \ No newline at end of file diff --git a/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn.user.js b/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn.user.js deleted file mode 100644 index 85eb050..0000000 --- a/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn.user.js +++ /dev/null @@ -1,111 +0,0 @@ -// ==UserScript== -// @name Metal Archives - group together entries for the same album in the Reviews section -// @namespace darkred -// @description Groups together entries for the same album in the Reviews section -// @include http://www.metal-archives.com/review/browse* -// @version 1 -// @grant GM_addStyle -// @run-at document-idle -// @require https://code.jquery.com/jquery-3.1.1.min.js -// ==/UserScript== - - -function groupRatings(){ - - var allAlbumTitlesRefs = $('#reviewList > tbody > tr > td:nth-child(3)'), - AllBandRefs = $('#reviewList > tbody > tr > td:nth-child(2)'), - duplicateTitles = [], - bandAndAlbums = []; - - - $(allAlbumTitlesRefs).each(function(index, el) { - let bandAndTitleTemp = AllBandRefs[index].textContent + '|' + allAlbumTitlesRefs[index].textContent; - bandAndAlbums.push(bandAndTitleTemp); - }); - - var bandAndAlbumsUnique = []; - $.each(bandAndAlbums, function(index, val) { - if (bandAndAlbumsUnique.indexOf(val) === -1){ - bandAndAlbumsUnique.push(val); - } else { - if (duplicateTitles.indexOf(val) === -1){ - duplicateTitles.push(val); - } - } - }); - - - - - - $.each(duplicateTitles, function(index, el) { - - var regex = /(.*)\|(.*)/; - var band = el.match(regex)[1]; - var album = el.match(regex)[2]; - - var toDelete = $(`tbody > tr > td:nth-child(2)`).filter(`:contains("` + band + `")`); - toDelete = $(toDelete).next().filter(`:contains("` + album + `")`); - toDelete = $(toDelete).parent(); - - var ratings = []; - - - $.each($(toDelete), function(index, el) { - ratings.push(parseInt($(el).children(':nth-child(4)').html().replace('%', ''))); - }); - - var sum = 0; - $.each(ratings, function(index, val) { - sum += parseInt(val, 10); - }); - var avg = sum/ratings.length; - avg = Math.round(avg); - - // $(toDelete).first().children(':nth-child(4)').html(avg + '%~ (' + ratings.length + ')'); - $(toDelete).first().children(':nth-child(4)').html(avg + '%~ '); - - $(toDelete).first().children(':nth-child(5)').html('(' + ratings.length + ' authors)'); - $(toDelete).first().children(':nth-child(5)').css('color', '#A2787a'); - - - - toDelete = toDelete.not($(toDelete).first()); - $.each($(toDelete), function(index, el) { - $(el).remove(); - }); - - }); - - - - -} - - -// selector for the Rating column (4th column) -// GM_addStyle('#reviewList > tbody > tr > td:nth-child(4) {width: 70px;}'); -// GM_addStyle('#reviewList > tbody > tr > td:nth-child(4) {width: 44px;}'); - - - - -const target = document.querySelector('#reviewList'), - observer = new MutationObserver((mutations) => { - - observer.disconnect(); - - groupRatings(); - - // Update entries count (substracting the removed duplicate entries) to the navigation buttons located to the start and to the end of the Reviews list - var a = $('#reviewList_info'); - var entries = $('#reviewList > tbody > tr > td:nth-child(3) > A').length; - $(a).html($(a).text().replace('of', '(' + entries + ')' )); - a = $('div.dataTables_info:nth-child(7)'); - $(a).html($(a).text().replace('of', '(' + entries + ')' )); - - observer.observe(target, config); - - }), - config = {childList: true}; -observer.observe(target, config); diff --git a/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/README.md b/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/README.md deleted file mode 100644 index c373e39..0000000 --- a/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/README.md +++ /dev/null @@ -1,23 +0,0 @@ -This userscript applies to metal-archives.com(Metal Archives), in the [Review section](http://www.metal-archives.com/review/browse/by/rating). - - -As per request here: [Improving the Display of the Review Section](http://www.metal-archives.com/board/viewtopic.php?f=3&t=111286&sid=1f8d52b324bbe9ce10fb5cc6090eb204) - -The script: -- groups all reviews for the same album in one entry, -- changes the relevant value in the Authors column to e.g. `(2 authors)`, -- replaces the Rating percentage of the entries, with the average of them all, -- updates the entries count of the displayed Review entries list (i.e. after removing the duplicate entries) -to the navigation buttons located to the start and to the end of the list, and -- works when changing Review pages or after switching the pages 'tabs' (`DATE`, `RATING`, `ALPHA`). - - - Screenshots - Before: -[![](https://i.imgur.com/TQ70ilBl.jpg)](https://i.imgur.com/TQ70ilB.jpg) - -After: -[![](https://i.imgur.com/rjZvCf3l.jpg)](https://i.imgur.com/rjZvCf3.jpg) - - -*Tested in Greasemonkey.* \ No newline at end of file diff --git a/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/jquery-3.1.1.min.js b/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/jquery-3.1.1.min.js deleted file mode 100644 index 4c5be4c..0000000 --- a/Metal_Archives_-_group_together_entries_for_the_same_album_in_the_Reviews_sectn/jquery-3.1.1.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */ -!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R), -a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)), -void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("